浏览代码

merged with mrdoob. fixed so depthMask is correctly restored after stencil and lensflares. removed all enable/disable _gl.BLEND as it's always on.

Mikael Emtinger 14 年之前
父节点
当前提交
7b07f34b7d

+ 231 - 228
build/Three.js

@@ -12,21 +12,21 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,b,e){this.set(a||0,c||0,b||0,e||1)};
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,b,e){this.set(a||0,c||0,b||0,e||1)};
 THREE.Vector4.prototype={set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 THREE.Vector4.prototype={set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var c,b,e=a.objects,f=[];a=0;for(c=e.length;a<c;a++){b=e[a];b instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(b)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function c(G,K,O,z){z=z.clone().subSelf(K);O=O.clone().subSelf(K);var P=G.clone().subSelf(K);G=z.dot(z);K=z.dot(O);z=z.dot(P);var Q=O.dot(O);O=O.dot(P);P=1/(G*Q-K*K);Q=(Q*z-K*O)*P;G=(G*O-K*z)*P;return Q>0&&G>0&&Q+G<1}var b,e,f,g,h,j,m,o,n,t,
-x,w=a.geometry,A=w.vertices,F=[];b=0;for(e=w.faces.length;b<e;b++){f=w.faces[b];t=this.origin.clone();x=this.direction.clone();m=a.matrixWorld;g=m.multiplyVector3(A[f.a].position.clone());h=m.multiplyVector3(A[f.b].position.clone());j=m.multiplyVector3(A[f.c].position.clone());m=f instanceof THREE.Face4?m.multiplyVector3(A[f.d].position.clone()):null;o=a.matrixRotationWorld.multiplyVector3(f.normal.clone());n=x.dot(o);if(n<0){o=o.dot((new THREE.Vector3).sub(g,t))/n;t=t.addSelf(x.multiplyScalar(o));
-if(f instanceof THREE.Face3){if(c(t,g,h,j)){f={distance:this.origin.distanceTo(t),point:t,face:f,object:a};F.push(f)}}else if(f instanceof THREE.Face4&&(c(t,g,h,m)||c(t,h,j,m))){f={distance:this.origin.distanceTo(t),point:t,face:f,object:a};F.push(f)}}}return F}};
+THREE.Ray.prototype={intersectScene:function(a){var c,b,e=a.objects,f=[];a=0;for(c=e.length;a<c;a++){b=e[a];b instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(b)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function c(G,J,S,D){D=D.clone().subSelf(J);S=S.clone().subSelf(J);var L=G.clone().subSelf(J);G=D.dot(D);J=D.dot(S);D=D.dot(L);var N=S.dot(S);S=S.dot(L);L=1/(G*N-J*J);N=(N*D-J*S)*L;G=(G*S-J*D)*L;return N>0&&G>0&&N+G<1}var b,e,f,g,h,j,m,o,n,t,
+y,w=a.geometry,z=w.vertices,E=[];b=0;for(e=w.faces.length;b<e;b++){f=w.faces[b];t=this.origin.clone();y=this.direction.clone();m=a.matrixWorld;g=m.multiplyVector3(z[f.a].position.clone());h=m.multiplyVector3(z[f.b].position.clone());j=m.multiplyVector3(z[f.c].position.clone());m=f instanceof THREE.Face4?m.multiplyVector3(z[f.d].position.clone()):null;o=a.matrixRotationWorld.multiplyVector3(f.normal.clone());n=y.dot(o);if(n<0){o=o.dot((new THREE.Vector3).sub(g,t))/n;t=t.addSelf(y.multiplyScalar(o));
+if(f instanceof THREE.Face3){if(c(t,g,h,j)){f={distance:this.origin.distanceTo(t),point:t,face:f,object:a};E.push(f)}}else if(f instanceof THREE.Face4&&(c(t,g,h,m)||c(t,h,j,m))){f={distance:this.origin.distanceTo(t),point:t,face:f,object:a};E.push(f)}}}return E}};
 THREE.Rectangle=function(){function a(){g=e-c;h=f-b}var c,b,e,f,g,h,j=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(m,o,n,t){j=!1;c=m;b=o;e=n;f=t;a()};this.addPoint=function(m,o){if(j){j=!1;c=m;b=o;e=m;f=o}else{c=c<m?c:m;b=b<o?b:o;e=e>m?e:m;f=f>o?f:o}a()};
 THREE.Rectangle=function(){function a(){g=e-c;h=f-b}var c,b,e,f,g,h,j=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(m,o,n,t){j=!1;c=m;b=o;e=n;f=t;a()};this.addPoint=function(m,o){if(j){j=!1;c=m;b=o;e=m;f=o}else{c=c<m?c:m;b=b<o?b:o;e=e>m?e:m;f=f>o?f:o}a()};
-this.add3Points=function(m,o,n,t,x,w){if(j){j=!1;c=m<n?m<x?m:x:n<x?n:x;b=o<t?o<w?o:w:t<w?t:w;e=m>n?m>x?m:x:n>x?n:x;f=o>t?o>w?o:w:t>w?t:w}else{c=m<n?m<x?m<c?m:c:x<c?x:c:n<x?n<c?n:c:x<c?x:c;b=o<t?o<w?o<b?o:b:w<b?w:b:t<w?t<b?t:b:w<b?w:b;e=m>n?m>x?m>e?m:e:x>e?x:e:n>x?n>e?n:e:x>e?x:e;f=o>t?o>w?o>f?o:f:w>f?w:f:t>w?t>f?t:f:w>f?w:f}a()};this.addRectangle=function(m){if(j){j=!1;c=m.getLeft();b=m.getTop();e=m.getRight();f=m.getBottom()}else{c=c<m.getLeft()?c:m.getLeft();b=b<m.getTop()?b:m.getTop();e=e>m.getRight()?
+this.add3Points=function(m,o,n,t,y,w){if(j){j=!1;c=m<n?m<y?m:y:n<y?n:y;b=o<t?o<w?o:w:t<w?t:w;e=m>n?m>y?m:y:n>y?n:y;f=o>t?o>w?o:w:t>w?t:w}else{c=m<n?m<y?m<c?m:c:y<c?y:c:n<y?n<c?n:c:y<c?y:c;b=o<t?o<w?o<b?o:b:w<b?w:b:t<w?t<b?t:b:w<b?w:b;e=m>n?m>y?m>e?m:e:y>e?y:e:n>y?n>e?n:e:y>e?y:e;f=o>t?o>w?o>f?o:f:w>f?w:f:t>w?t>f?t:f:w>f?w:f}a()};this.addRectangle=function(m){if(j){j=!1;c=m.getLeft();b=m.getTop();e=m.getRight();f=m.getBottom()}else{c=c<m.getLeft()?c:m.getLeft();b=b<m.getTop()?b:m.getTop();e=e>m.getRight()?
 e:m.getRight();f=f>m.getBottom()?f:m.getBottom()}a()};this.inflate=function(m){c-=m;b-=m;e+=m;f+=m;a()};this.minSelf=function(m){c=c>m.getLeft()?c:m.getLeft();b=b>m.getTop()?b:m.getTop();e=e<m.getRight()?e:m.getRight();f=f<m.getBottom()?f:m.getBottom();a()};this.instersects=function(m){return Math.min(e,m.getRight())-Math.max(c,m.getLeft())>=0&&Math.min(f,m.getBottom())-Math.max(b,m.getTop())>=0};this.empty=function(){j=!0;f=e=b=c=0;a()};this.isEmpty=function(){return j}};
 e:m.getRight();f=f>m.getBottom()?f:m.getBottom()}a()};this.inflate=function(m){c-=m;b-=m;e+=m;f+=m;a()};this.minSelf=function(m){c=c>m.getLeft()?c:m.getLeft();b=b>m.getTop()?b:m.getTop();e=e<m.getRight()?e:m.getRight();f=f<m.getBottom()?f:m.getBottom();a()};this.instersects=function(m){return Math.min(e,m.getRight())-Math.max(c,m.getLeft())>=0&&Math.min(f,m.getBottom())-Math.max(b,m.getTop())>=0};this.empty=function(){j=!0;f=e=b=c=0;a()};this.isEmpty=function(){return j}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
-THREE.Matrix4=function(a,c,b,e,f,g,h,j,m,o,n,t,x,w,A,F){this.set(a||1,c||0,b||0,e||0,f||0,g||1,h||0,j||0,m||0,o||0,n||1,t||0,x||0,w||0,A||0,F||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,c,b,e,f,g,h,j,m,o,n,t,x,w,A,F){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=f;this.n22=g;this.n23=h;this.n24=j;this.n31=m;this.n32=o;this.n33=n;this.n34=t;this.n41=x;this.n42=w;this.n43=A;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var e=THREE.Matrix4.__v1,
+THREE.Matrix4=function(a,c,b,e,f,g,h,j,m,o,n,t,y,w,z,E){this.set(a||1,c||0,b||0,e||0,f||0,g||1,h||0,j||0,m||0,o||0,n||1,t||0,y||0,w||0,z||0,E||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,c,b,e,f,g,h,j,m,o,n,t,y,w,z,E){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=f;this.n22=g;this.n23=h;this.n24=j;this.n31=m;this.n32=o;this.n33=n;this.n34=t;this.n41=y;this.n42=w;this.n43=z;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var e=THREE.Matrix4.__v1,
 f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;e.cross(b,g).normalize();if(e.length()===0){g.x+=1.0E-4;e.cross(b,g).normalize()}f.cross(g,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=g.x;this.n21=e.y;this.n22=f.y;this.n23=g.y;this.n31=e.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,e=a.z,f=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*f;a.y=(this.n21*c+this.n22*b+this.n23*
 f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;e.cross(b,g).normalize();if(e.length()===0){g.x+=1.0E-4;e.cross(b,g).normalize()}f.cross(g,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=g.x;this.n21=e.y;this.n22=f.y;this.n23=g.y;this.n31=e.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,e=a.z,f=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*f;a.y=(this.n21*c+this.n22*b+this.n23*
 e+this.n24)*f;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,f=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*f;a.y=this.n21*c+this.n22*b+this.n23*e+this.n24*f;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*f;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*this.n33;a.normalize();
 e+this.n24)*f;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,f=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*f;a.y=this.n21*c+this.n22*b+this.n23*e+this.n24*f;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*f;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*this.n33;a.normalize();
-return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,e=a.n12,f=a.n13,g=a.n14,h=a.n21,j=a.n22,m=a.n23,o=a.n24,n=a.n31,t=a.n32,x=a.n33,w=a.n34,A=a.n41,F=a.n42,G=a.n43,K=a.n44,O=c.n11,z=c.n12,P=c.n13,Q=c.n14,R=c.n21,Da=c.n22,
-ha=c.n23,na=c.n24,Y=c.n31,d=c.n32,$=c.n33,ya=c.n34;this.n11=b*O+e*R+f*Y;this.n12=b*z+e*Da+f*d;this.n13=b*P+e*ha+f*$;this.n14=b*Q+e*na+f*ya+g;this.n21=h*O+j*R+m*Y;this.n22=h*z+j*Da+m*d;this.n23=h*P+j*ha+m*$;this.n24=h*Q+j*na+m*ya+o;this.n31=n*O+t*R+x*Y;this.n32=n*z+t*Da+x*d;this.n33=n*P+t*ha+x*$;this.n34=n*Q+t*na+x*ya+w;this.n41=A*O+F*R+G*Y;this.n42=A*z+F*Da+G*d;this.n43=A*P+F*ha+G*$;this.n44=A*Q+F*na+G*ya+K;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;
+return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,e=a.n12,f=a.n13,g=a.n14,h=a.n21,j=a.n22,m=a.n23,o=a.n24,n=a.n31,t=a.n32,y=a.n33,w=a.n34,z=a.n41,E=a.n42,G=a.n43,J=a.n44,S=c.n11,D=c.n12,L=c.n13,N=c.n14,O=c.n21,Fa=c.n22,
+oa=c.n23,xa=c.n24,W=c.n31,d=c.n32,Z=c.n33,ya=c.n34;this.n11=b*S+e*O+f*W;this.n12=b*D+e*Fa+f*d;this.n13=b*L+e*oa+f*Z;this.n14=b*N+e*xa+f*ya+g;this.n21=h*S+j*O+m*W;this.n22=h*D+j*Fa+m*d;this.n23=h*L+j*oa+m*Z;this.n24=h*N+j*xa+m*ya+o;this.n31=n*S+t*O+y*W;this.n32=n*D+t*Fa+y*d;this.n33=n*L+t*oa+y*Z;this.n34=n*N+t*xa+y*ya+w;this.n41=z*S+E*O+G*W;this.n42=z*D+E*Fa+G*d;this.n43=z*L+E*oa+G*Z;this.n44=z*N+E*xa+G*ya+J;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;
 b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},
 b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},
-determinant:function(){var a=this.n11,c=this.n12,b=this.n13,e=this.n14,f=this.n21,g=this.n22,h=this.n23,j=this.n24,m=this.n31,o=this.n32,n=this.n33,t=this.n34,x=this.n41,w=this.n42,A=this.n43,F=this.n44;return e*h*o*x-b*j*o*x-e*g*n*x+c*j*n*x+b*g*t*x-c*h*t*x-e*h*m*w+b*j*m*w+e*f*n*w-a*j*n*w-b*f*t*w+a*h*t*w+e*g*m*A-c*j*m*A-e*f*o*A+a*j*o*A+c*f*t*A-a*g*t*A-b*g*m*F+c*h*m*F+b*f*o*F-a*h*o*F-c*f*n*F+a*g*n*F},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=
+determinant:function(){var a=this.n11,c=this.n12,b=this.n13,e=this.n14,f=this.n21,g=this.n22,h=this.n23,j=this.n24,m=this.n31,o=this.n32,n=this.n33,t=this.n34,y=this.n41,w=this.n42,z=this.n43,E=this.n44;return e*h*o*y-b*j*o*y-e*g*n*y+c*j*n*y+b*g*t*y-c*h*t*y-e*h*m*w+b*j*m*w+e*f*n*w-a*j*n*w-b*f*t*w+a*h*t*w+e*g*m*z-c*j*m*z-e*f*o*z+a*j*o*z+c*f*t*z-a*g*t*z-b*g*m*E+c*h*m*E+b*f*o*E-a*h*o*E-c*f*n*E+a*g*n*E},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=
 a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;
 a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;
 this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;
 this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;
 a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},
 a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},
@@ -34,8 +34,8 @@ setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},
 a.z,m=f*g,o=f*h;this.set(m*g+b,m*h-e*j,m*j+e*h,0,m*h+e*j,o*h+b,o*j-e*g,0,m*j-e*h,o*j+e*g,f*j*j+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(b);b=Math.sin(b);var g=Math.cos(e);e=Math.sin(e);var h=a*b,j=c*b;this.n11=f*g;this.n12=-f*e;this.n13=b;this.n21=j*g+a*e;this.n22=-j*e+a*g;this.n23=-c*f;this.n31=-h*g+c*e;this.n32=h*e+c*g;this.n33=a*f;return this},
 a.z,m=f*g,o=f*h;this.set(m*g+b,m*h-e*j,m*j+e*h,0,m*h+e*j,o*h+b,o*j-e*g,0,m*j-e*h,o*j+e*g,f*j*j+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(b);b=Math.sin(b);var g=Math.cos(e);e=Math.sin(e);var h=a*b,j=c*b;this.n11=f*g;this.n12=-f*e;this.n13=b;this.n21=j*g+a*e;this.n22=-j*e+a*g;this.n23=-c*f;this.n31=-h*g+c*e;this.n32=h*e+c*g;this.n33=a*f;return this},
 setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,f=a.w,g=c+c,h=b+b,j=e+e;a=c*g;var m=c*h;c*=j;var o=b*h;b*=j;e*=j;g*=f;h*=f;f*=j;this.n11=1-(o+e);this.n12=m-f;this.n13=c+h;this.n21=m+f;this.n22=1-(a+e);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+o);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=
 setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,f=a.w,g=c+c,h=b+b,j=e+e;a=c*g;var m=c*h;c*=j;var o=b*h;b*=j;e*=j;g*=f;h*=f;f*=j;this.n11=1-(o+e);this.n12=m-f;this.n13=c+h;this.n21=m+f;this.n22=1-(a+e);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+o);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=
 a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var b=1/c.x,e=1/c.y,f=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
 a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var b=1/c.x,e=1/c.y,f=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
-THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,e=a.n12,f=a.n13,g=a.n14,h=a.n21,j=a.n22,m=a.n23,o=a.n24,n=a.n31,t=a.n32,x=a.n33,w=a.n34,A=a.n41,F=a.n42,G=a.n43,K=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=m*w*F-o*x*F+o*t*G-j*w*G-m*t*K+j*x*K;c.n12=g*x*F-f*w*F-g*t*G+e*w*G+f*t*K-e*x*K;c.n13=f*o*F-g*m*F+g*j*G-e*o*G-f*j*K+e*m*K;c.n14=g*m*t-f*o*t-g*j*x+e*o*x+f*j*w-e*m*w;c.n21=o*x*A-m*w*A-o*n*G+h*w*G+m*n*K-h*x*K;c.n22=f*w*A-g*x*A+g*n*G-b*w*G-f*n*K+b*x*K;c.n23=g*m*A-f*o*A-g*h*G+b*o*G+f*h*K-b*m*K;
-c.n24=f*o*n-g*m*n+g*h*x-b*o*x-f*h*w+b*m*w;c.n31=j*w*A-o*t*A+o*n*F-h*w*F-j*n*K+h*t*K;c.n32=g*t*A-e*w*A-g*n*F+b*w*F+e*n*K-b*t*K;c.n33=f*o*A-g*j*A+g*h*F-b*o*F-e*h*K+b*j*K;c.n34=g*j*n-e*o*n-g*h*t+b*o*t+e*h*w-b*j*w;c.n41=m*t*A-j*x*A-m*n*F+h*x*F+j*n*G-h*t*G;c.n42=e*x*A-f*t*A+f*n*F-b*x*F-e*n*G+b*t*G;c.n43=f*j*A-e*m*A-f*h*F+b*m*F+e*h*G-b*j*G;c.n44=e*m*n-f*j*n+f*h*t-b*m*t-e*h*x+b*j*x;c.multiplyScalar(1/a.determinant());return c};
+THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,e=a.n12,f=a.n13,g=a.n14,h=a.n21,j=a.n22,m=a.n23,o=a.n24,n=a.n31,t=a.n32,y=a.n33,w=a.n34,z=a.n41,E=a.n42,G=a.n43,J=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=m*w*E-o*y*E+o*t*G-j*w*G-m*t*J+j*y*J;c.n12=g*y*E-f*w*E-g*t*G+e*w*G+f*t*J-e*y*J;c.n13=f*o*E-g*m*E+g*j*G-e*o*G-f*j*J+e*m*J;c.n14=g*m*t-f*o*t-g*j*y+e*o*y+f*j*w-e*m*w;c.n21=o*y*z-m*w*z-o*n*G+h*w*G+m*n*J-h*y*J;c.n22=f*w*z-g*y*z+g*n*G-b*w*G-f*n*J+b*y*J;c.n23=g*m*z-f*o*z-g*h*G+b*o*G+f*h*J-b*m*J;
+c.n24=f*o*n-g*m*n+g*h*y-b*o*y-f*h*w+b*m*w;c.n31=j*w*z-o*t*z+o*n*E-h*w*E-j*n*J+h*t*J;c.n32=g*t*z-e*w*z-g*n*E+b*w*E+e*n*J-b*t*J;c.n33=f*o*z-g*j*z+g*h*E-b*o*E-e*h*J+b*j*J;c.n34=g*j*n-e*o*n-g*h*t+b*o*t+e*h*w-b*j*w;c.n41=m*t*z-j*y*z-m*n*E+h*y*E+j*n*G-h*t*G;c.n42=e*y*z-f*t*z+f*n*E-b*y*E-e*n*G+b*t*G;c.n43=f*j*z-e*m*z-f*h*E+b*m*E+e*h*G-b*j*G;c.n44=e*m*n-f*j*n+f*h*t-b*m*t-e*h*y+b*j*y;c.multiplyScalar(1/a.determinant());return c};
 THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,o=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,t=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*h+a.n31*o;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*e;b[1]=a*f;b[2]=a*g;b[3]=a*h;b[4]=a*j;b[5]=a*m;b[6]=a*o;b[7]=a*n;b[8]=a*t;return c};
 THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,o=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,t=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*h+a.n31*o;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*e;b[1]=a*f;b[2]=a*g;b[3]=a*h;b[4]=a*j;b[5]=a*m;b[6]=a*o;b[7]=a*n;b[8]=a*t;return c};
 THREE.Matrix4.makeFrustum=function(a,c,b,e,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*f/(e-b);h.n23=(e+b)/(e-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,e){var f;a=b*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,b,e)};
 THREE.Matrix4.makeFrustum=function(a,c,b,e,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*f/(e-b);h.n23=(e+b)/(e-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,e){var f;a=b*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,b,e)};
 THREE.Matrix4.makeOrtho=function(a,c,b,e,f,g){var h,j,m,o;h=new THREE.Matrix4;j=c-a;m=b-e;o=g-f;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((c+a)/j);h.n21=0;h.n22=2/m;h.n23=0;h.n24=-((b+e)/m);h.n31=0;h.n32=0;h.n33=-2/o;h.n34=-((g+f)/o);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Matrix4.makeOrtho=function(a,c,b,e,f,g){var h,j,m,o;h=new THREE.Matrix4;j=c-a;m=b-e;o=g-f;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((c+a)/j);h.n21=0;h.n22=2/m;h.n23=0;h.n24=-((b+e)/m);h.n31=0;h.n32=0;h.n33=-2/o;h.n34=-((g+f)/o);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
@@ -56,16 +56,16 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,c,b;a=0;for(c=this.f
 b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,e,f,g,h,j=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){g=this.faces[e];if(a&&g.vertexNormals.length){j.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)j.addSelf(g.vertexNormals[c]);j.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];j.sub(h.position,b.position);m.sub(c.position,b.position);j.crossSelf(m)}j.isZero()||
 b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,e,f,g,h,j=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){g=this.faces[e];if(a&&g.vertexNormals.length){j.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)j.addSelf(g.vertexNormals[c]);j.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];j.sub(h.position,b.position);m.sub(c.position,b.position);j.crossSelf(m)}j.isZero()||
 j.normalize();g.normal.copy(j)}},computeVertexNormals:function(){var a,c,b,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=
 j.normalize();g.normal.copy(j)}},computeVertexNormals:function(){var a,c,b,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=
 this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){e[b.a].addSelf(b.normal);e[b.b].addSelf(b.normal);e[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){e[b.a].addSelf(b.normal);e[b.b].addSelf(b.normal);e[b.c].addSelf(b.normal);e[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(e[b.a]);
 this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){e[b.a].addSelf(b.normal);e[b.b].addSelf(b.normal);e[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){e[b.a].addSelf(b.normal);e[b.b].addSelf(b.normal);e[b.c].addSelf(b.normal);e[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(e[b.a]);
-b.vertexNormals[1].copy(e[b.b]);b.vertexNormals[2].copy(e[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(e[b.a]);b.vertexNormals[1].copy(e[b.b]);b.vertexNormals[2].copy(e[b.c]);b.vertexNormals[3].copy(e[b.d])}}},computeTangents:function(){function a(aa,oa,Aa,V,S,ka,ua){j=aa.vertices[oa].position;m=aa.vertices[Aa].position;o=aa.vertices[V].position;n=h[S];t=h[ka];x=h[ua];w=m.x-j.x;A=o.x-j.x;F=m.y-j.y;G=o.y-j.y;K=m.z-j.z;O=o.z-j.z;z=t.u-n.u;P=x.u-n.u;Q=t.v-n.v;R=x.v-n.v;Da=1/(z*R-P*
-Q);d.set((R*w-Q*A)*Da,(R*F-Q*G)*Da,(R*K-Q*O)*Da);$.set((z*A-P*w)*Da,(z*G-P*F)*Da,(z*O-P*K)*Da);na[oa].addSelf(d);na[Aa].addSelf(d);na[V].addSelf(d);Y[oa].addSelf($);Y[Aa].addSelf($);Y[V].addSelf($)}var c,b,e,f,g,h,j,m,o,n,t,x,w,A,F,G,K,O,z,P,Q,R,Da,ha,na=[],Y=[],d=new THREE.Vector3,$=new THREE.Vector3,ya=new THREE.Vector3,Ea=new THREE.Vector3,Fa=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){na[c]=new THREE.Vector3;Y[c]=new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];
-h=this.faceVertexUvs[0][c];if(g instanceof THREE.Face3)a(this,g.a,g.b,g.c,0,1,2);else if(g instanceof THREE.Face4){a(this,g.a,g.b,g.c,0,1,2);a(this,g.a,g.b,g.d,0,1,3)}}var sa=["a","b","c","d"];c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];for(e=0;e<g.vertexNormals.length;e++){Fa.copy(g.vertexNormals[e]);f=g[sa[e]];ha=na[f];ya.copy(ha);ya.subSelf(Fa.multiplyScalar(Fa.dot(ha))).normalize();Ea.cross(g.vertexNormals[e],ha);f=Ea.dot(Y[f]);f=f<0?-1:1;g.vertexTangents[e]=new THREE.Vector4(ya.x,ya.y,
+b.vertexNormals[1].copy(e[b.b]);b.vertexNormals[2].copy(e[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(e[b.a]);b.vertexNormals[1].copy(e[b.b]);b.vertexNormals[2].copy(e[b.c]);b.vertexNormals[3].copy(e[b.d])}}},computeTangents:function(){function a(X,qa,za,ea,U,ma,Ca){j=X.vertices[qa].position;m=X.vertices[za].position;o=X.vertices[ea].position;n=h[U];t=h[ma];y=h[Ca];w=m.x-j.x;z=o.x-j.x;E=m.y-j.y;G=o.y-j.y;J=m.z-j.z;S=o.z-j.z;D=t.u-n.u;L=y.u-n.u;N=t.v-n.v;O=y.v-n.v;Fa=1/(D*O-L*N);
+d.set((O*w-N*z)*Fa,(O*E-N*G)*Fa,(O*J-N*S)*Fa);Z.set((D*z-L*w)*Fa,(D*G-L*E)*Fa,(D*S-L*J)*Fa);xa[qa].addSelf(d);xa[za].addSelf(d);xa[ea].addSelf(d);W[qa].addSelf(Z);W[za].addSelf(Z);W[ea].addSelf(Z)}var c,b,e,f,g,h,j,m,o,n,t,y,w,z,E,G,J,S,D,L,N,O,Fa,oa,xa=[],W=[],d=new THREE.Vector3,Z=new THREE.Vector3,ya=new THREE.Vector3,Ga=new THREE.Vector3,Ha=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){xa[c]=new THREE.Vector3;W[c]=new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];
+h=this.faceVertexUvs[0][c];if(g instanceof THREE.Face3)a(this,g.a,g.b,g.c,0,1,2);else if(g instanceof THREE.Face4){a(this,g.a,g.b,g.c,0,1,2);a(this,g.a,g.b,g.d,0,1,3)}}var ra=["a","b","c","d"];c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];for(e=0;e<g.vertexNormals.length;e++){Ha.copy(g.vertexNormals[e]);f=g[ra[e]];oa=xa[f];ya.copy(oa);ya.subSelf(Ha.multiplyScalar(Ha.dot(oa))).normalize();Ga.cross(g.vertexNormals[e],oa);f=Ga.dot(W[f]);f=f<0?-1:1;g.vertexTangents[e]=new THREE.Vector4(ya.x,ya.y,
 ya.z,f)}}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;
 ya.z,f)}}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;
 if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere=
 if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere=
 {radius:a}}};THREE.GeometryIdCounter=0;
 {radius:a}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(a){function c(w,A,F,G,K,O,z){w=(F-w)*0.5;G=(G-A)*0.5;return(2*(A-F)+w+G)*z+(-3*(A-F)-2*w-G)*O+w*K+A}this.points=a;var b=[],e={x:0,y:0,z:0},f,g,h,j,m,o,n,t,x;this.initFromArray=function(w){this.points=[];for(var A=0;A<w.length;A++)this.points[A]={x:w[A][0],y:w[A][1],z:w[A][2]}};this.getPoint=function(w){f=(this.points.length-1)*w;g=Math.floor(f);h=f-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;o=this.points[b[0]];n=this.points[b[1]];
-t=this.points[b[2]];x=this.points[b[3]];j=h*h;m=h*j;e.x=c(o.x,n.x,t.x,x.x,h,j,m);e.y=c(o.y,n.y,t.y,x.y,h,j,m);e.z=c(o.z,n.z,t.z,x.z,h,j,m);return e};this.getControlPointsArray=function(){var w,A,F=this.points.length,G=[];for(w=0;w<F;w++){A=this.points[w];G[w]=[A.x,A.y,A.z]}return G};this.getLength=function(w){var A,F,G=A=A=0,K=new THREE.Vector3,O=new THREE.Vector3,z=[],P=0;z[0]=0;w||(w=100);F=this.points.length*w;K.copy(this.points[0]);for(w=1;w<F;w++){A=w/F;position=this.getPoint(A);O.copy(position);
-P+=O.distanceTo(K);K.copy(position);A*=this.points.length-1;A=Math.floor(A);if(A!=G){z[A]=P;G=A}}z[z.length]=P;return{chunks:z,total:P}};this.reparametrizeByArcLength=function(w){var A,F,G,K,O,z,P=[],Q=new THREE.Vector3,R=this.getLength();P.push(Q.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){F=R.chunks[A]-R.chunks[A-1];z=Math.ceil(w*F/R.total);K=(A-1)/(this.points.length-1);O=A/(this.points.length-1);for(F=1;F<z-1;F++){G=K+F*(1/z)*(O-K);position=this.getPoint(G);P.push(Q.copy(position).clone())}P.push(Q.copy(this.points[A]).clone())}this.points=
-P}};
+THREE.Spline=function(a){function c(w,z,E,G,J,S,D){w=(E-w)*0.5;G=(G-z)*0.5;return(2*(z-E)+w+G)*D+(-3*(z-E)-2*w-G)*S+w*J+z}this.points=a;var b=[],e={x:0,y:0,z:0},f,g,h,j,m,o,n,t,y;this.initFromArray=function(w){this.points=[];for(var z=0;z<w.length;z++)this.points[z]={x:w[z][0],y:w[z][1],z:w[z][2]}};this.getPoint=function(w){f=(this.points.length-1)*w;g=Math.floor(f);h=f-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;o=this.points[b[0]];n=this.points[b[1]];
+t=this.points[b[2]];y=this.points[b[3]];j=h*h;m=h*j;e.x=c(o.x,n.x,t.x,y.x,h,j,m);e.y=c(o.y,n.y,t.y,y.y,h,j,m);e.z=c(o.z,n.z,t.z,y.z,h,j,m);return e};this.getControlPointsArray=function(){var w,z,E=this.points.length,G=[];for(w=0;w<E;w++){z=this.points[w];G[w]=[z.x,z.y,z.z]}return G};this.getLength=function(w){var z,E,G=z=z=0,J=new THREE.Vector3,S=new THREE.Vector3,D=[],L=0;D[0]=0;w||(w=100);E=this.points.length*w;J.copy(this.points[0]);for(w=1;w<E;w++){z=w/E;position=this.getPoint(z);S.copy(position);
+L+=S.distanceTo(J);J.copy(position);z*=this.points.length-1;z=Math.floor(z);if(z!=G){D[z]=L;G=z}}D[D.length]=L;return{chunks:D,total:L}};this.reparametrizeByArcLength=function(w){var z,E,G,J,S,D,L=[],N=new THREE.Vector3,O=this.getLength();L.push(N.copy(this.points[0]).clone());for(z=1;z<this.points.length;z++){E=O.chunks[z]-O.chunks[z-1];D=Math.ceil(w*E/O.total);J=(z-1)/(this.points.length-1);S=z/(this.points.length-1);for(E=1;E<D-1;E++){G=J+E*(1/D)*(S-J);position=this.getPoint(G);L.push(N.copy(position).clone())}L.push(N.copy(this.points[z]).clone())}this.points=
+L}};
 THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(f){for(var g=0;g<a.length;g++)a[g].update(f)};b.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};b.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};b.add=function(f){c[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");c[f.name]=f;if(f.initialized!==!0){for(var g=0;g<f.hierarchy.length;g++){for(var h=0;h<f.hierarchy[g].keys.length;h++){if(f.hierarchy[g].keys[h].time<0)f.hierarchy[g].keys[h].time=
 THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(f){for(var g=0;g<a.length;g++)a[g].update(f)};b.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};b.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};b.add=function(f){c[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");c[f.name]=f;if(f.initialized!==!0){for(var g=0;g<f.hierarchy.length;g++){for(var h=0;h<f.hierarchy[g].keys.length;h++){if(f.hierarchy[g].keys[h].time<0)f.hierarchy[g].keys[h].time=
 0;if(f.hierarchy[g].keys[h].rot!==undefined&&!(f.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var j=f.hierarchy[g].keys[h].rot;f.hierarchy[g].keys[h].rot=new THREE.Quaternion(j[0],j[1],j[2],j[3])}}if(f.hierarchy[g].keys[0].morphTargets!==undefined){j={};for(h=0;h<f.hierarchy[g].keys.length;h++)for(var m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++){var o=f.hierarchy[g].keys[h].morphTargets[m];j[o]=-1}f.hierarchy[g].usedMorphTargets=j;for(h=0;h<f.hierarchy[g].keys.length;h++){var n=
 0;if(f.hierarchy[g].keys[h].rot!==undefined&&!(f.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var j=f.hierarchy[g].keys[h].rot;f.hierarchy[g].keys[h].rot=new THREE.Quaternion(j[0],j[1],j[2],j[3])}}if(f.hierarchy[g].keys[0].morphTargets!==undefined){j={};for(h=0;h<f.hierarchy[g].keys.length;h++)for(var m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++){var o=f.hierarchy[g].keys[h].morphTargets[m];j[o]=-1}f.hierarchy[g].usedMorphTargets=j;for(h=0;h<f.hierarchy[g].keys.length;h++){var n=
 {};for(o in j){for(m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++)if(f.hierarchy[g].keys[h].morphTargets[m]===o){n[o]=f.hierarchy[g].keys[h].morphTargetsInfluences[m];break}m===f.hierarchy[g].keys[h].morphTargets.length&&(n[o]=0)}f.hierarchy[g].keys[h].morphTargetsInfluences=n}}for(h=1;h<f.hierarchy[g].keys.length;h++)if(f.hierarchy[g].keys[h].time===f.hierarchy[g].keys[h-1].time){f.hierarchy[g].keys.splice(h,1);h--}for(h=1;h<f.hierarchy[g].keys.length;h++)f.hierarchy[g].keys[h].index=h}h=parseInt(f.length*
 {};for(o in j){for(m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++)if(f.hierarchy[g].keys[h].morphTargets[m]===o){n[o]=f.hierarchy[g].keys[h].morphTargetsInfluences[m];break}m===f.hierarchy[g].keys[h].morphTargets.length&&(n[o]=0)}f.hierarchy[g].keys[h].morphTargetsInfluences=n}}for(h=1;h<f.hierarchy[g].keys.length;h++)if(f.hierarchy[g].keys[h].time===f.hierarchy[g].keys[h-1].time){f.hierarchy[g].keys.splice(h,1);h--}for(h=1;h<f.hierarchy[g].keys.length;h++)f.hierarchy[g].keys[h].index=h}h=parseInt(f.length*
@@ -75,8 +75,8 @@ THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=
 f instanceof THREE.Bone?f.skinMatrix:f.matrix}var g=f.animationCache.prevKey;f=f.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];f.pos=this.getNextKeyWith("pos",b,1);f.rot=this.getNextKeyWith("rot",b,1);f.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 f instanceof THREE.Bone?f.skinMatrix:f.matrix}var g=f.animationCache.prevKey;f=f.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];f.pos=this.getNextKeyWith("pos",b,1);f.rot=this.getNextKeyWith("rot",b,1);f.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,f,g,h,j,m,o,n=this.data.JIT.hierarchy,t,x;this.currentTime+=a*this.timeScale;x=this.currentTime;t=this.currentTime%=this.data.length;o=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var w=0,A=this.hierarchy.length;w<A;w++){a=this.hierarchy[w];m=a.animationCache;if(this.JITCompile&&n[w][o]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=n[w][o];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=n[w][o];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var F=0;F<3;F++){b=c[F];h=m.prevKey[b];j=m.nextKey[b];if(j.time<=x){if(t<x)if(this.loop){h=this.data.hierarchy[w].keys[0];for(j=this.getNextKeyWith(b,w,1);j.time<t;){h=j;j=this.getNextKeyWith(b,w,j.index+1)}}else{this.stop();return}else{do{h=j;j=this.getNextKeyWith(b,w,j.index+1)}while(j.time<
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,f,g,h,j,m,o,n=this.data.JIT.hierarchy,t,y;this.currentTime+=a*this.timeScale;y=this.currentTime;t=this.currentTime%=this.data.length;o=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var w=0,z=this.hierarchy.length;w<z;w++){a=this.hierarchy[w];m=a.animationCache;if(this.JITCompile&&n[w][o]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=n[w][o];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=n[w][o];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var E=0;E<3;E++){b=c[E];h=m.prevKey[b];j=m.nextKey[b];if(j.time<=y){if(t<y)if(this.loop){h=this.data.hierarchy[w].keys[0];for(j=this.getNextKeyWith(b,w,1);j.time<t;){h=j;j=this.getNextKeyWith(b,w,j.index+1)}}else{this.stop();return}else{do{h=j;j=this.getNextKeyWith(b,w,j.index+1)}while(j.time<
 t)}m.prevKey[b]=h;m.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(t-h.time)/(j.time-h.time);f=h[b];g=j[b];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+w);e=e<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=f[0]+(g[0]-f[0])*e;b.y=f[1]+(g[1]-f[1])*e;b.z=f[2]+(g[2]-f[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
 t)}m.prevKey[b]=h;m.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(t-h.time)/(j.time-h.time);f=h[b];g=j[b];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+w);e=e<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=f[0]+(g[0]-f[0])*e;b.y=f[1]+(g[1]-f[1])*e;b.z=f[2]+(g[2]-f[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
 this.getPrevKeyWith("pos",w,h.index-1).pos;this.points[1]=f;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",w,j.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);b.x=f[0];b.y=f[1];b.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(b===
 this.getPrevKeyWith("pos",w,h.index-1).pos;this.points[1]=f;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",w,j.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);b.x=f[0];b.y=f[1];b.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(b===
 "rot")THREE.Quaternion.slerp(f,g,a.quaternion,e);else if(b==="scl"){b=a.scale;b.x=f[0]+(g[0]-f[0])*e;b.y=f[1]+(g[1]-f[1])*e;b.z=f[2]+(g[2]-f[2])*e}}}}if(this.JITCompile&&n[0][o]===undefined){this.hierarchy[0].update(undefined,!0);for(w=0;w<this.hierarchy.length;w++)n[w][o]=this.hierarchy[w]instanceof THREE.Bone?this.hierarchy[w].skinMatrix.clone():this.hierarchy[w].matrix.clone()}}};
 "rot")THREE.Quaternion.slerp(f,g,a.quaternion,e);else if(b==="scl"){b=a.scale;b.x=f[0]+(g[0]-f[0])*e;b.y=f[1]+(g[1]-f[1])*e;b.z=f[2]+(g[2]-f[2])*e}}}}if(this.JITCompile&&n[0][o]===undefined){this.hierarchy[0].update(undefined,!0);for(w=0;w<this.hierarchy.length;w++)n[w][o]=this.hierarchy[w]instanceof THREE.Bone?this.hierarchy[w].skinMatrix.clone():this.hierarchy[w].matrix.clone()}}};
@@ -85,10 +85,11 @@ THREE.Animation.prototype.interpolate=function(a,c,b,e,f,g,h){a=(b-a)*0.5;e=(e-c
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
 THREE.Camera=function(a,c,b,e,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=e||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera=function(a,c,b,e,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=e||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
-THREE.Camera.prototype.update=function(a,c,b){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position)}a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0;for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};
-THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=b||0};THREE.DirectionalLight.prototype=new THREE.Light;
-THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=b||0};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.LensFlare=function(a,c,b,e){THREE.Object3D.call(this);this.positionScreen=new THREE.Vector3;this.lensFlares=[];this.customUpdateCallback=undefined;a!==undefined&&this.add(a,c,b,e)};
-THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;THREE.LensFlare.prototype.add=function(a,c,b,e){c===undefined&&(c=-1);b===undefined&&(b=0);if(e===undefined)e=THREE.BillboardBlending;b=Math.min(b,Math.max(0,b));this.lensFlares.push({texture:a,size:c,distance:b,x:0,y:0,z:0,scale:1,rotation:1,opacity:1,blending:e})};
+THREE.Camera.prototype.update=function(a,c,b){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
+!1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
+THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=b||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=b||0};THREE.PointLight.prototype=new THREE.Light;
+THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.LensFlare=function(a,c,b,e){THREE.Object3D.call(this);this.positionScreen=new THREE.Vector3;this.lensFlares=[];this.customUpdateCallback=undefined;a!==undefined&&this.add(a,c,b,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
+THREE.LensFlare.prototype.add=function(a,c,b,e){c===undefined&&(c=-1);b===undefined&&(b=0);if(e===undefined)e=THREE.BillboardBlending;b=Math.min(b,Math.max(0,b));this.lensFlares.push({texture:a,size:c,distance:b,x:0,y:0,z:0,scale:1,rotation:1,opacity:1,blending:e})};
 THREE.LensFlare.prototype.updateLensFlares=function(a){var c,b=this.lensFlares.length,e,f=-this.positionScreen.x*2,g=-this.positionScreen.y*2;for(c=0;c<b;c++){e=this.lensFlares[c];e.x=this.positionScreen.x+f*e.distance;e.y=this.positionScreen.y+g*e.distance;e.wantedScale=a*0.2+0.8;e.wantedRotation=e.x*Math.PI*0.25;e.wantedOpacity=a;e.scale+=(e.wantedScale-e.scale)*0.25;e.rotation+=(e.wantedRotation-e.rotation)*0.25;e.opacity+=(e.wantedOpacity-e.opacity)*0.5}};THREE.NoShading=0;THREE.FlatShading=1;
 THREE.LensFlare.prototype.updateLensFlares=function(a){var c,b=this.lensFlares.length,e,f=-this.positionScreen.x*2,g=-this.positionScreen.y*2;for(c=0;c<b;c++){e=this.lensFlares[c];e.x=this.positionScreen.x+f*e.distance;e.y=this.positionScreen.y+g*e.distance;e.wantedScale=a*0.2+0.8;e.wantedRotation=e.x*Math.PI*0.25;e.wantedOpacity=a;e.scale+=(e.wantedScale-e.scale)*0.25;e.rotation+=(e.wantedRotation-e.rotation)*0.25;e.opacity+=(e.wantedOpacity-e.opacity)*0.5}};THREE.NoShading=0;THREE.FlatShading=1;
 THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};
 THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};
 THREE.UVMapping=function(){};
 THREE.UVMapping=function(){};
@@ -148,61 +149,62 @@ THREE.LOD.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updat
 THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
 THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
 THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(a){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=a.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,b=this.geometry.faces,e=this.geometry.edgeFaces,f=a.faces;a=a.vertices;var g=f.length,h,j,m,o,n,t=["a","b","c","d"];for(m=0;m<g;m++){j=c.length;h=f[m];if(h instanceof THREE.Face4){o=4;j=new THREE.Face4(j,j+1,j+2,j+3)}else{o=3;j=new THREE.Face3(j,j+1,j+2)}j.normal.copy(h.normal);b.push(j);for(j=
 THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(a){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=a.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,b=this.geometry.faces,e=this.geometry.edgeFaces,f=a.faces;a=a.vertices;var g=f.length,h,j,m,o,n,t=["a","b","c","d"];for(m=0;m<g;m++){j=c.length;h=f[m];if(h instanceof THREE.Face4){o=4;j=new THREE.Face4(j,j+1,j+2,j+3)}else{o=3;j=new THREE.Face3(j,j+1,j+2)}j.normal.copy(h.normal);b.push(j);for(j=
 0;j<o;j++){n=a[h[t[j]]];c.push(new THREE.Vertex(n.position.clone()))}}for(g=0;g<f.length-1;g++){a=b[g];for(h=g+1;h<f.length;h++){j=b[h];j=this.facesShareEdge(c,a,j);if(j!==undefined){j=new THREE.Face4(j.indices[0],j.indices[3],j.indices[2],j.indices[1]);j.normal.set(1,0,0);e.push(j)}}}};
 0;j<o;j++){n=a[h[t[j]]];c.push(new THREE.Vertex(n.position.clone()))}}for(g=0;g<f.length-1;g++){a=b[g];for(h=g+1;h<f.length;h++){j=b[h];j=this.facesShareEdge(c,a,j);if(j!==undefined){j=new THREE.Face4(j.indices[0],j.indices[3],j.indices[2],j.indices[1]);j.normal.set(1,0,0);e.push(j)}}}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,b){var e,f,g,h,j,m,o,n,t,x,w,A,F,G=0,K=["a","b","c","d"];e=c instanceof THREE.Face4?4:3;f=b instanceof THREE.Face4?4:3;for(A=0;A<e;A++){g=c[K[A]];j=a[g];for(F=0;F<f;F++){h=b[K[F]];m=a[h];if(Math.abs(j.position.x-m.position.x)<1.0E-4&&Math.abs(j.position.y-m.position.y)<1.0E-4&&Math.abs(j.position.z-m.position.z)<1.0E-4){G++;if(G===1){o=j;n=m;t=g;x=h;w=K[A]}if(G===2){w+=K[A];return w==="ad"||w==="ac"?{faces:[c,b],vertices:[o,n,m,j],indices:[t,
-x,h,g],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,b],vertices:[o,j,m,n],indices:[t,g,h,x],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.facesShareEdge=function(a,c,b){var e,f,g,h,j,m,o,n,t,y,w,z,E,G=0,J=["a","b","c","d"];e=c instanceof THREE.Face4?4:3;f=b instanceof THREE.Face4?4:3;for(z=0;z<e;z++){g=c[J[z]];j=a[g];for(E=0;E<f;E++){h=b[J[E]];m=a[h];if(Math.abs(j.position.x-m.position.x)<1.0E-4&&Math.abs(j.position.y-m.position.y)<1.0E-4&&Math.abs(j.position.z-m.position.z)<1.0E-4){G++;if(G===1){o=j;n=m;t=g;y=h;w=J[z]}if(G===2){w+=J[z];return w==="ad"||w==="ac"?{faces:[c,b],vertices:[o,n,m,j],indices:[t,
+y,h,g],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,b],vertices:[o,j,m,n],indices:[t,g,h,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(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c||1;this.far=b||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c||1;this.far=b||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
-THREE.Projector=function(){function a(){var d=m[j]=m[j]||new THREE.RenderableVertex;j++;return d}function c(d,$){return $.z-d.z}function b(d,$){var ya=0,Ea=1,Fa=d.z+d.w,sa=$.z+$.w,aa=-d.z+d.w,oa=-$.z+$.w;if(Fa>=0&&sa>=0&&aa>=0&&oa>=0)return!0;else if(Fa<0&&sa<0||aa<0&&oa<0)return!1;else{if(Fa<0)ya=Math.max(ya,Fa/(Fa-sa));else sa<0&&(Ea=Math.min(Ea,Fa/(Fa-sa)));if(aa<0)ya=Math.max(ya,aa/(aa-oa));else oa<0&&(Ea=Math.min(Ea,aa/(aa-oa)));if(Ea<ya)return!1;else{d.lerpSelf($,ya);$.lerpSelf(d,1-Ea);return!0}}}
-var e,f,g=[],h,j,m=[],o,n,t=[],x,w=[],A,F,G=[],K,O,z=[],P=new THREE.Vector4,Q=new THREE.Vector4,R=new THREE.Matrix4,Da=new THREE.Matrix4,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],na=new THREE.Vector4,Y=new THREE.Vector4;this.projectVector=function(d,$){R.multiply($.projectionMatrix,$.matrixWorldInverse);R.multiplyVector3(d);return d};this.unprojectVector=function(d,$){R.multiply($.matrixWorld,THREE.Matrix4.makeInvert($.projectionMatrix));
-R.multiplyVector3(d);return d};this.projectObjects=function(d,$,ya){$=[];var Ea,Fa,sa;f=0;Fa=d.objects;d=0;for(Ea=Fa.length;d<Ea;d++){sa=Fa[d];var aa;if(!(aa=!sa.visible))if(aa=sa instanceof THREE.Mesh){a:{aa=void 0;for(var oa=sa.matrixWorld,Aa=-sa.geometry.boundingSphere.radius*Math.max(sa.scale.x,Math.max(sa.scale.y,sa.scale.z)),V=0;V<6;V++){aa=ha[V].x*oa.n14+ha[V].y*oa.n24+ha[V].z*oa.n34+ha[V].w;if(aa<=Aa){aa=!1;break a}}aa=!0}aa=!aa}if(!aa){aa=g[f]=g[f]||new THREE.RenderableObject;f++;e=aa;P.copy(sa.position);
-R.multiplyVector3(P);e.object=sa;e.z=P.z;$.push(e)}}ya&&$.sort(c);return $};this.projectScene=function(d,$,ya){var Ea=[],Fa=$.near,sa=$.far,aa,oa,Aa,V,S,ka,ua,ia,Ba,Ga,Qa,Ra,bb,Ya,M,X,ma;O=F=x=n=0;$.matrixAutoUpdate&&$.updateMatrix();d.update(undefined,!1,$);R.multiply($.projectionMatrix,$.matrixWorldInverse);ha[0].set(R.n41-R.n11,R.n42-R.n12,R.n43-R.n13,R.n44-R.n14);ha[1].set(R.n41+R.n11,R.n42+R.n12,R.n43+R.n13,R.n44+R.n14);ha[2].set(R.n41+R.n21,R.n42+R.n22,R.n43+R.n23,R.n44+R.n24);ha[3].set(R.n41-
-R.n21,R.n42-R.n22,R.n43-R.n23,R.n44-R.n24);ha[4].set(R.n41-R.n31,R.n42-R.n32,R.n43-R.n33,R.n44-R.n34);ha[5].set(R.n41+R.n31,R.n42+R.n32,R.n43+R.n33,R.n44+R.n34);for(aa=0;aa<6;aa++){Ba=ha[aa];Ba.divideScalar(Math.sqrt(Ba.x*Ba.x+Ba.y*Ba.y+Ba.z*Ba.z))}Ba=this.projectObjects(d,$,!0);d=0;for(aa=Ba.length;d<aa;d++){Ga=Ba[d].object;if(Ga.visible){Qa=Ga.matrixWorld;Ra=Ga.matrixRotationWorld;bb=Ga.materials;Ya=Ga.overdraw;j=0;if(Ga instanceof THREE.Mesh){M=Ga.geometry;V=M.vertices;X=M.faces;M=M.faceVertexUvs;
-oa=0;for(Aa=V.length;oa<Aa;oa++){h=a();h.positionWorld.copy(V[oa].position);Qa.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);R.multiplyVector4(h.positionScreen);h.positionScreen.x/=h.positionScreen.w;h.positionScreen.y/=h.positionScreen.w;h.visible=h.positionScreen.z>Fa&&h.positionScreen.z<sa}V=0;for(oa=X.length;V<oa;V++){Aa=X[V];if(Aa instanceof THREE.Face3){S=m[Aa.a];ka=m[Aa.b];ua=m[Aa.c];if(S.visible&&ka.visible&&ua.visible&&(Ga.doubleSided||Ga.flipSided!=(ua.positionScreen.x-
-S.positionScreen.x)*(ka.positionScreen.y-S.positionScreen.y)-(ua.positionScreen.y-S.positionScreen.y)*(ka.positionScreen.x-S.positionScreen.x)<0)){ia=t[n]=t[n]||new THREE.RenderableFace3;n++;o=ia;o.v1.copy(S);o.v2.copy(ka);o.v3.copy(ua)}else continue}else if(Aa instanceof THREE.Face4){S=m[Aa.a];ka=m[Aa.b];ua=m[Aa.c];ia=m[Aa.d];if(S.visible&&ka.visible&&ua.visible&&ia.visible&&(Ga.doubleSided||Ga.flipSided!=((ia.positionScreen.x-S.positionScreen.x)*(ka.positionScreen.y-S.positionScreen.y)-(ia.positionScreen.y-
-S.positionScreen.y)*(ka.positionScreen.x-S.positionScreen.x)<0||(ka.positionScreen.x-ua.positionScreen.x)*(ia.positionScreen.y-ua.positionScreen.y)-(ka.positionScreen.y-ua.positionScreen.y)*(ia.positionScreen.x-ua.positionScreen.x)<0))){ma=w[x]=w[x]||new THREE.RenderableFace4;x++;o=ma;o.v1.copy(S);o.v2.copy(ka);o.v3.copy(ua);o.v4.copy(ia)}else continue}o.normalWorld.copy(Aa.normal);Ra.multiplyVector3(o.normalWorld);o.centroidWorld.copy(Aa.centroid);Qa.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);
-R.multiplyVector3(o.centroidScreen);ua=Aa.vertexNormals;S=0;for(ka=ua.length;S<ka;S++){ia=o.vertexNormalsWorld[S];ia.copy(ua[S]);Ra.multiplyVector3(ia)}S=0;for(ka=M.length;S<ka;S++)if(ma=M[S][V]){ua=0;for(ia=ma.length;ua<ia;ua++)o.uvs[S][ua]=ma[ua]}o.meshMaterials=bb;o.faceMaterials=Aa.materials;o.overdraw=Ya;o.z=o.centroidScreen.z;Ea.push(o)}}else if(Ga instanceof THREE.Line){Da.multiply(R,Qa);V=Ga.geometry.vertices;S=a();S.positionScreen.copy(V[0].position);Da.multiplyVector4(S.positionScreen);
-oa=1;for(Aa=V.length;oa<Aa;oa++){S=a();S.positionScreen.copy(V[oa].position);Da.multiplyVector4(S.positionScreen);ka=m[j-2];na.copy(S.positionScreen);Y.copy(ka.positionScreen);if(b(na,Y)){na.multiplyScalar(1/na.w);Y.multiplyScalar(1/Y.w);Qa=G[F]=G[F]||new THREE.RenderableLine;F++;A=Qa;A.v1.positionScreen.copy(na);A.v2.positionScreen.copy(Y);A.z=Math.max(na.z,Y.z);A.materials=Ga.materials;Ea.push(A)}}}else if(Ga instanceof THREE.Particle){Q.set(Ga.position.x,Ga.position.y,Ga.position.z,1);R.multiplyVector4(Q);
-Q.z/=Q.w;if(Q.z>0&&Q.z<1){Qa=z[O]=z[O]||new THREE.RenderableParticle;O++;K=Qa;K.x=Q.x/Q.w;K.y=Q.y/Q.w;K.z=Q.z;K.rotation=Ga.rotation.z;K.scale.x=Ga.scale.x*Math.abs(K.x-(Q.x+$.projectionMatrix.n11)/(Q.w+$.projectionMatrix.n14));K.scale.y=Ga.scale.y*Math.abs(K.y-(Q.y+$.projectionMatrix.n22)/(Q.w+$.projectionMatrix.n24));K.materials=Ga.materials;Ea.push(K)}}}}ya&&Ea.sort(c);return Ea}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,f,g;this.domElement=document.createElement("div");this.setSize=function(h,j){b=h;e=j;f=b/2;g=e/2};this.render=function(h,j){var m,o,n,t,x,w,A,F;a=c.projectScene(h,j);m=0;for(o=a.length;m<o;m++){x=a[m];if(x instanceof THREE.RenderableParticle){A=x.x*f+f;F=x.y*g+g;n=0;for(t=x.material.length;n<t;n++){w=x.material[n];if(w instanceof THREE.ParticleDOMMaterial){w=w.domElement;w.style.left=A+"px";w.style.top=F+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(la){if(w!=la)n.globalAlpha=w=la}function c(la){if(A!=la){switch(la){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}A=la}}function b(la){if(F!=la)n.strokeStyle=F=la}var e=null,f=new THREE.Projector,g=document.createElement("canvas"),h,j,m,o,n=g.getContext("2d"),t=new THREE.Color(0),x=0,w=1,A=0,
-F=null,G=null,K=1,O,z,P,Q,R=new THREE.RenderableVertex,Da=new THREE.RenderableVertex,ha,na,Y,d,$,ya,Ea,Fa,sa,aa,oa,Aa,V=new THREE.Color,S=new THREE.Color,ka=new THREE.Color,ua=new THREE.Color,ia=new THREE.Color,Ba,Ga,Qa,Ra,bb,Ya,M,X,ma,W,T=new THREE.Rectangle,k=new THREE.Rectangle,y=new THREE.Rectangle,B=!1,p=new THREE.Color,C=new THREE.Color,L=new THREE.Color,H=new THREE.Color,E=new THREE.Vector3,D,ca,I,ea,ga,wa,qa=16;D=document.createElement("canvas");D.width=D.height=2;ca=D.getContext("2d");ca.fillStyle=
-"rgba(0,0,0,1)";ca.fillRect(0,0,2,2);I=ca.getImageData(0,0,2,2);ea=I.data;ga=document.createElement("canvas");ga.width=ga.height=qa;wa=ga.getContext("2d");wa.translate(-qa/2,-qa/2);wa.scale(qa,qa);qa--;this.domElement=g;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(la,va){h=la;j=va;m=h/2;o=j/2;g.width=h;g.height=j;T.set(-m,-o,m,o);w=1;A=0;G=F=null;K=1};this.setClearColor=function(la,va){t=la;x=va};this.setClearColorHex=function(la,va){t.setHex(la);x=va};this.clear=
-function(){n.setTransform(1,0,0,-1,m,o);if(!k.isEmpty()){k.inflate(1);k.minSelf(T);if(t.hex==0&&x==0)n.clearRect(k.getX(),k.getY(),k.getWidth(),k.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(t.r*255)+","+Math.floor(t.g*255)+","+Math.floor(t.b*255)+","+x+")";n.fillRect(k.getX(),k.getY(),k.getWidth(),k.getHeight())}k.empty()}};this.render=function(la,va){function Ca(N){var ja,fa,Z,ta=N.lights;C.setRGB(0,0,0);L.setRGB(0,0,0);H.setRGB(0,0,0);N=0;for(ja=ta.length;N<ja;N++){fa=
-ta[N];Z=fa.color;if(fa instanceof THREE.AmbientLight){C.r+=Z.r;C.g+=Z.g;C.b+=Z.b}else if(fa instanceof THREE.DirectionalLight){L.r+=Z.r;L.g+=Z.g;L.b+=Z.b}else if(fa instanceof THREE.PointLight){H.r+=Z.r;H.g+=Z.g;H.b+=Z.b}}}function da(N,ja,fa,Z){var ta,ra,za,U,Ha=N.lights;N=0;for(ta=Ha.length;N<ta;N++){ra=Ha[N];za=ra.color;if(ra instanceof THREE.DirectionalLight){U=fa.dot(ra.position);if(!(U<=0)){U*=ra.intensity;Z.r+=za.r*U;Z.g+=za.g*U;Z.b+=za.b*U}}else if(ra instanceof THREE.PointLight){U=fa.dot(E.sub(ra.position,
-ja).normalize());if(!(U<=0)){U*=ra.distance==0?1:1-Math.min(ja.distanceTo(ra.position)/ra.distance,1);if(U!=0){U*=ra.intensity;Z.r+=za.r*U;Z.g+=za.g*U;Z.b+=za.b*U}}}}}function pa(N,ja,fa){a(fa.opacity);c(fa.blending);var Z,ta,ra,za,U,Ha;if(fa instanceof THREE.ParticleBasicMaterial){if(fa.map){za=fa.map.image;U=za.width>>1;Ha=za.height>>1;fa=ja.scale.x*m;ra=ja.scale.y*o;Z=fa*U;ta=ra*Ha;y.set(N.x-Z,N.y-ta,N.x+Z,N.y+ta);if(T.instersects(y)){n.save();n.translate(N.x,N.y);n.rotate(-ja.rotation);n.scale(fa,
--ra);n.translate(-U,-Ha);n.drawImage(za,0,0);n.restore()}}}else if(fa instanceof THREE.ParticleCanvasMaterial){Z=ja.scale.x*m;ta=ja.scale.y*o;y.set(N.x-Z,N.y-ta,N.x+Z,N.y+ta);if(T.instersects(y)){b(fa.color.__styleString);ra=fa.color.__styleString;if(G!=ra)n.fillStyle=G=ra;n.save();n.translate(N.x,N.y);n.rotate(-ja.rotation);n.scale(Z,ta);fa.program(n);n.restore()}}}function xa(N,ja,fa,Z){a(Z.opacity);c(Z.blending);n.beginPath();n.moveTo(N.positionScreen.x,N.positionScreen.y);n.lineTo(ja.positionScreen.x,
-ja.positionScreen.y);n.closePath();if(Z instanceof THREE.LineBasicMaterial){V.__styleString=Z.color.__styleString;N=Z.linewidth;if(K!=N)n.lineWidth=K=N;b(V.__styleString);n.stroke();y.inflate(Z.linewidth*2)}}function La(N,ja,fa,Z,ta,ra,za,U,Ha){a(U.opacity);c(U.blending);ha=N.positionScreen.x;na=N.positionScreen.y;Y=ja.positionScreen.x;d=ja.positionScreen.y;$=fa.positionScreen.x;ya=fa.positionScreen.y;Za(ha,na,Y,d,$,ya);if(U instanceof THREE.MeshBasicMaterial)if(U.map){if(U.map.mapping instanceof
-THREE.UVMapping){Ra=za.uvs[0];$a(ha,na,Y,d,$,ya,U.map.image,Ra[Z].u,Ra[Z].v,Ra[ta].u,Ra[ta].v,Ra[ra].u,Ra[ra].v)}}else if(U.envMap){if(U.envMap.mapping instanceof THREE.SphericalReflectionMapping){N=va.matrixWorldInverse;E.copy(za.vertexNormalsWorld[0]);bb=(E.x*N.n11+E.y*N.n12+E.z*N.n13)*0.5+0.5;Ya=-(E.x*N.n21+E.y*N.n22+E.z*N.n23)*0.5+0.5;E.copy(za.vertexNormalsWorld[1]);M=(E.x*N.n11+E.y*N.n12+E.z*N.n13)*0.5+0.5;X=-(E.x*N.n21+E.y*N.n22+E.z*N.n23)*0.5+0.5;E.copy(za.vertexNormalsWorld[2]);ma=(E.x*N.n11+
-E.y*N.n12+E.z*N.n13)*0.5+0.5;W=-(E.x*N.n21+E.y*N.n22+E.z*N.n23)*0.5+0.5;$a(ha,na,Y,d,$,ya,U.envMap.image,bb,Ya,M,X,ma,W)}}else U.wireframe?Ia(U.color.__styleString,U.wireframeLinewidth):Pa(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){if(U.map.mapping instanceof THREE.UVMapping){Ra=za.uvs[0];$a(ha,na,Y,d,$,ya,U.map.image,Ra[Z].u,Ra[Z].v,Ra[ta].u,Ra[ta].v,Ra[ra].u,Ra[ra].v)}c(THREE.SubtractiveBlending)}if(B)if(!U.wireframe&&U.shading==THREE.SmoothShading&&
-za.vertexNormalsWorld.length==3){S.r=ka.r=ua.r=C.r;S.g=ka.g=ua.g=C.g;S.b=ka.b=ua.b=C.b;da(Ha,za.v1.positionWorld,za.vertexNormalsWorld[0],S);da(Ha,za.v2.positionWorld,za.vertexNormalsWorld[1],ka);da(Ha,za.v3.positionWorld,za.vertexNormalsWorld[2],ua);ia.r=(ka.r+ua.r)*0.5;ia.g=(ka.g+ua.g)*0.5;ia.b=(ka.b+ua.b)*0.5;Qa=eb(S,ka,ua,ia);$a(ha,na,Y,d,$,ya,Qa,0,0,1,0,0,1)}else{p.r=C.r;p.g=C.g;p.b=C.b;da(Ha,za.centroidWorld,za.normalWorld,p);V.r=U.color.r*p.r;V.g=U.color.g*p.g;V.b=U.color.b*p.b;V.updateStyleString();
-U.wireframe?Ia(V.__styleString,U.wireframeLinewidth):Pa(V.__styleString)}else U.wireframe?Ia(U.color.__styleString,U.wireframeLinewidth):Pa(U.color.__styleString)}else if(U instanceof THREE.MeshDepthMaterial){Ba=va.near;Ga=va.far;S.r=S.g=S.b=1-Ua(N.positionScreen.z,Ba,Ga);ka.r=ka.g=ka.b=1-Ua(ja.positionScreen.z,Ba,Ga);ua.r=ua.g=ua.b=1-Ua(fa.positionScreen.z,Ba,Ga);ia.r=(ka.r+ua.r)*0.5;ia.g=(ka.g+ua.g)*0.5;ia.b=(ka.b+ua.b)*0.5;Qa=eb(S,ka,ua,ia);$a(ha,na,Y,d,$,ya,Qa,0,0,1,0,0,1)}else if(U instanceof
-THREE.MeshNormalMaterial){V.r=Wa(za.normalWorld.x);V.g=Wa(za.normalWorld.y);V.b=Wa(za.normalWorld.z);V.updateStyleString();U.wireframe?Ia(V.__styleString,U.wireframeLinewidth):Pa(V.__styleString)}}function Va(N,ja,fa,Z,ta,ra,za,U,Ha){a(U.opacity);c(U.blending);if(U.map||U.envMap){La(N,ja,Z,0,1,3,za,U,Ha);La(ta,fa,ra,1,2,3,za,U,Ha)}else{ha=N.positionScreen.x;na=N.positionScreen.y;Y=ja.positionScreen.x;d=ja.positionScreen.y;$=fa.positionScreen.x;ya=fa.positionScreen.y;Ea=Z.positionScreen.x;Fa=Z.positionScreen.y;
-sa=ta.positionScreen.x;aa=ta.positionScreen.y;oa=ra.positionScreen.x;Aa=ra.positionScreen.y;if(U instanceof THREE.MeshBasicMaterial){Ma(ha,na,Y,d,$,ya,Ea,Fa);U.wireframe?Ia(U.color.__styleString,U.wireframeLinewidth):Pa(U.color.__styleString)}else if(U instanceof THREE.MeshLambertMaterial)if(B)if(!U.wireframe&&U.shading==THREE.SmoothShading&&za.vertexNormalsWorld.length==4){S.r=ka.r=ua.r=ia.r=C.r;S.g=ka.g=ua.g=ia.g=C.g;S.b=ka.b=ua.b=ia.b=C.b;da(Ha,za.v1.positionWorld,za.vertexNormalsWorld[0],S);da(Ha,
-za.v2.positionWorld,za.vertexNormalsWorld[1],ka);da(Ha,za.v4.positionWorld,za.vertexNormalsWorld[3],ua);da(Ha,za.v3.positionWorld,za.vertexNormalsWorld[2],ia);Qa=eb(S,ka,ua,ia);Za(ha,na,Y,d,Ea,Fa);$a(ha,na,Y,d,Ea,Fa,Qa,0,0,1,0,0,1);Za(sa,aa,$,ya,oa,Aa);$a(sa,aa,$,ya,oa,Aa,Qa,1,0,1,1,0,1)}else{p.r=C.r;p.g=C.g;p.b=C.b;da(Ha,za.centroidWorld,za.normalWorld,p);V.r=U.color.r*p.r;V.g=U.color.g*p.g;V.b=U.color.b*p.b;V.updateStyleString();Ma(ha,na,Y,d,$,ya,Ea,Fa);U.wireframe?Ia(V.__styleString,U.wireframeLinewidth):
-Pa(V.__styleString)}else{Ma(ha,na,Y,d,$,ya,Ea,Fa);U.wireframe?Ia(U.color.__styleString,U.wireframeLinewidth):Pa(U.color.__styleString)}else if(U instanceof THREE.MeshNormalMaterial){V.r=Wa(za.normalWorld.x);V.g=Wa(za.normalWorld.y);V.b=Wa(za.normalWorld.z);V.updateStyleString();Ma(ha,na,Y,d,$,ya,Ea,Fa);U.wireframe?Ia(V.__styleString,U.wireframeLinewidth):Pa(V.__styleString)}else if(U instanceof THREE.MeshDepthMaterial){Ba=va.near;Ga=va.far;S.r=S.g=S.b=1-Ua(N.positionScreen.z,Ba,Ga);ka.r=ka.g=ka.b=
-1-Ua(ja.positionScreen.z,Ba,Ga);ua.r=ua.g=ua.b=1-Ua(Z.positionScreen.z,Ba,Ga);ia.r=ia.g=ia.b=1-Ua(fa.positionScreen.z,Ba,Ga);Qa=eb(S,ka,ua,ia);Za(ha,na,Y,d,Ea,Fa);$a(ha,na,Y,d,Ea,Fa,Qa,0,0,1,0,0,1);Za(sa,aa,$,ya,oa,Aa);$a(sa,aa,$,ya,oa,Aa,Qa,1,0,1,1,0,1)}}}function Za(N,ja,fa,Z,ta,ra){n.beginPath();n.moveTo(N,ja);n.lineTo(fa,Z);n.lineTo(ta,ra);n.lineTo(N,ja);n.closePath()}function Ma(N,ja,fa,Z,ta,ra,za,U){n.beginPath();n.moveTo(N,ja);n.lineTo(fa,Z);n.lineTo(ta,ra);n.lineTo(za,U);n.lineTo(N,ja);n.closePath()}
-function Ia(N,ja){b(N);if(K!=ja)n.lineWidth=K=ja;n.stroke();y.inflate(ja*2)}function Pa(N){if(G!=N)n.fillStyle=G=N;n.fill()}function $a(N,ja,fa,Z,ta,ra,za,U,Ha,fb,Oa,cb,jb){var ab,db;ab=za.width-1;db=za.height-1;U*=ab;Ha*=db;fb*=ab;Oa*=db;cb*=ab;jb*=db;fa-=N;Z-=ja;ta-=N;ra-=ja;fb-=U;Oa-=Ha;cb-=U;jb-=Ha;ab=fb*jb-cb*Oa;if(ab!=0){db=1/ab;ab=(jb*fa-Oa*ta)*db;Oa=(jb*Z-Oa*ra)*db;fa=(fb*ta-cb*fa)*db;Z=(fb*ra-cb*Z)*db;N=N-ab*U-fa*Ha;ja=ja-Oa*U-Z*Ha;n.save();n.transform(ab,Oa,fa,Z,N,ja);n.clip();n.drawImage(za,
-0,0);n.restore()}}function eb(N,ja,fa,Z){var ta=~~(N.r*255),ra=~~(N.g*255);N=~~(N.b*255);var za=~~(ja.r*255),U=~~(ja.g*255);ja=~~(ja.b*255);var Ha=~~(fa.r*255),fb=~~(fa.g*255);fa=~~(fa.b*255);var Oa=~~(Z.r*255),cb=~~(Z.g*255);Z=~~(Z.b*255);ea[0]=ta<0?0:ta>255?255:ta;ea[1]=ra<0?0:ra>255?255:ra;ea[2]=N<0?0:N>255?255:N;ea[4]=za<0?0:za>255?255:za;ea[5]=U<0?0:U>255?255:U;ea[6]=ja<0?0:ja>255?255:ja;ea[8]=Ha<0?0:Ha>255?255:Ha;ea[9]=fb<0?0:fb>255?255:fb;ea[10]=fa<0?0:fa>255?255:fa;ea[12]=Oa<0?0:Oa>255?255:
-Oa;ea[13]=cb<0?0:cb>255?255:cb;ea[14]=Z<0?0:Z>255?255:Z;ca.putImageData(I,0,0);wa.drawImage(D,0,0);return ga}function Ua(N,ja,fa){N=(N-ja)/(fa-ja);return N*N*(3-2*N)}function Wa(N){N=(N+1)*0.5;return N<0?0:N>1?1:N}function Ja(N,ja){var fa=ja.x-N.x,Z=ja.y-N.y,ta=1/Math.sqrt(fa*fa+Z*Z);fa*=ta;Z*=ta;ja.x+=fa;ja.y+=Z;N.x-=fa;N.y-=Z}var Xa,Ta,J,Ka,Sa,gb,hb,Na;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,o);e=f.projectScene(la,va,this.sortElements);(B=la.lights.length>0)&&Ca(la);Xa=0;for(Ta=e.length;Xa<
-Ta;Xa++){J=e[Xa];y.empty();if(J instanceof THREE.RenderableParticle){O=J;O.x*=m;O.y*=o;Ka=0;for(Sa=J.materials.length;Ka<Sa;){Na=J.materials[Ka++];Na.opacity!=0&&pa(O,J,Na,la)}}else if(J instanceof THREE.RenderableLine){O=J.v1;z=J.v2;O.positionScreen.x*=m;O.positionScreen.y*=o;z.positionScreen.x*=m;z.positionScreen.y*=o;y.addPoint(O.positionScreen.x,O.positionScreen.y);y.addPoint(z.positionScreen.x,z.positionScreen.y);if(T.instersects(y)){Ka=0;for(Sa=J.materials.length;Ka<Sa;){Na=J.materials[Ka++];
-Na.opacity!=0&&xa(O,z,J,Na,la)}}}else if(J instanceof THREE.RenderableFace3){O=J.v1;z=J.v2;P=J.v3;O.positionScreen.x*=m;O.positionScreen.y*=o;z.positionScreen.x*=m;z.positionScreen.y*=o;P.positionScreen.x*=m;P.positionScreen.y*=o;if(J.overdraw){Ja(O.positionScreen,z.positionScreen);Ja(z.positionScreen,P.positionScreen);Ja(P.positionScreen,O.positionScreen)}y.add3Points(O.positionScreen.x,O.positionScreen.y,z.positionScreen.x,z.positionScreen.y,P.positionScreen.x,P.positionScreen.y);if(T.instersects(y)){Ka=
-0;for(Sa=J.meshMaterials.length;Ka<Sa;){Na=J.meshMaterials[Ka++];if(Na instanceof THREE.MeshFaceMaterial){gb=0;for(hb=J.faceMaterials.length;gb<hb;)(Na=J.faceMaterials[gb++])&&Na.opacity!=0&&La(O,z,P,0,1,2,J,Na,la)}else Na.opacity!=0&&La(O,z,P,0,1,2,J,Na,la)}}}else if(J instanceof THREE.RenderableFace4){O=J.v1;z=J.v2;P=J.v3;Q=J.v4;O.positionScreen.x*=m;O.positionScreen.y*=o;z.positionScreen.x*=m;z.positionScreen.y*=o;P.positionScreen.x*=m;P.positionScreen.y*=o;Q.positionScreen.x*=m;Q.positionScreen.y*=
-o;R.positionScreen.copy(z.positionScreen);Da.positionScreen.copy(Q.positionScreen);if(J.overdraw){Ja(O.positionScreen,z.positionScreen);Ja(z.positionScreen,Q.positionScreen);Ja(Q.positionScreen,O.positionScreen);Ja(P.positionScreen,R.positionScreen);Ja(P.positionScreen,Da.positionScreen)}y.addPoint(O.positionScreen.x,O.positionScreen.y);y.addPoint(z.positionScreen.x,z.positionScreen.y);y.addPoint(P.positionScreen.x,P.positionScreen.y);y.addPoint(Q.positionScreen.x,Q.positionScreen.y);if(T.instersects(y)){Ka=
-0;for(Sa=J.meshMaterials.length;Ka<Sa;){Na=J.meshMaterials[Ka++];if(Na instanceof THREE.MeshFaceMaterial){gb=0;for(hb=J.faceMaterials.length;gb<hb;)(Na=J.faceMaterials[gb++])&&Na.opacity!=0&&Va(O,z,P,Q,R,Da,J,Na,la)}else Na.opacity!=0&&Va(O,z,P,Q,R,Da,J,Na,la)}}}k.addRectangle(y)}n.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(sa,aa,oa){var Aa,V,S,ka;Aa=0;for(V=sa.lights.length;Aa<V;Aa++){S=sa.lights[Aa];if(S instanceof THREE.DirectionalLight){ka=aa.normalWorld.dot(S.position)*S.intensity;if(ka>0){oa.r+=S.color.r*ka;oa.g+=S.color.g*ka;oa.b+=S.color.b*ka}}else if(S instanceof THREE.PointLight){na.sub(S.position,aa.centroidWorld);na.normalize();ka=aa.normalWorld.dot(na)*S.intensity;if(ka>0){oa.r+=S.color.r*ka;oa.g+=S.color.g*ka;oa.b+=S.color.b*ka}}}}function c(sa,aa,oa,Aa,V,S){$=e(ya++);
-$.setAttribute("d","M "+sa.positionScreen.x+" "+sa.positionScreen.y+" L "+aa.positionScreen.x+" "+aa.positionScreen.y+" L "+oa.positionScreen.x+","+oa.positionScreen.y+"z");if(V instanceof THREE.MeshBasicMaterial)z.__styleString=V.color.__styleString;else if(V instanceof THREE.MeshLambertMaterial)if(O){P.r=Q.r;P.g=Q.g;P.b=Q.b;a(S,Aa,P);z.r=V.color.r*P.r;z.g=V.color.g*P.g;z.b=V.color.b*P.b;z.updateStyleString()}else z.__styleString=V.color.__styleString;else if(V instanceof THREE.MeshDepthMaterial){ha=
-1-V.__2near/(V.__farPlusNear-Aa.z*V.__farMinusNear);z.setRGB(ha,ha,ha)}else V instanceof THREE.MeshNormalMaterial&&z.setRGB(f(Aa.normalWorld.x),f(Aa.normalWorld.y),f(Aa.normalWorld.z));V.wireframe?$.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+V.wireframeLinewidth+"; stroke-opacity: "+V.opacity+"; stroke-linecap: "+V.wireframeLinecap+"; stroke-linejoin: "+V.wireframeLinejoin):$.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+V.opacity);j.appendChild($)}
-function b(sa,aa,oa,Aa,V,S,ka){$=e(ya++);$.setAttribute("d","M "+sa.positionScreen.x+" "+sa.positionScreen.y+" L "+aa.positionScreen.x+" "+aa.positionScreen.y+" L "+oa.positionScreen.x+","+oa.positionScreen.y+" L "+Aa.positionScreen.x+","+Aa.positionScreen.y+"z");if(S instanceof THREE.MeshBasicMaterial)z.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshLambertMaterial)if(O){P.r=Q.r;P.g=Q.g;P.b=Q.b;a(ka,V,P);z.r=S.color.r*P.r;z.g=S.color.g*P.g;z.b=S.color.b*P.b;z.updateStyleString()}else z.__styleString=
-S.color.__styleString;else if(S instanceof THREE.MeshDepthMaterial){ha=1-S.__2near/(S.__farPlusNear-V.z*S.__farMinusNear);z.setRGB(ha,ha,ha)}else S instanceof THREE.MeshNormalMaterial&&z.setRGB(f(V.normalWorld.x),f(V.normalWorld.y),f(V.normalWorld.z));S.wireframe?$.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+S.wireframeLinewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframeLinecap+"; stroke-linejoin: "+S.wireframeLinejoin):$.setAttribute("style",
-"fill: "+z.__styleString+"; fill-opacity: "+S.opacity);j.appendChild($)}function e(sa){if(Y[sa]==null){Y[sa]=document.createElementNS("http://www.w3.org/2000/svg","path");Fa==0&&Y[sa].setAttribute("shape-rendering","crispEdges")}return Y[sa]}function f(sa){return sa<0?Math.min((1+sa)*0.5,0.5):0.5+Math.min(sa*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,o,n,t,x,w,A,F,G=new THREE.Rectangle,K=new THREE.Rectangle,O=!1,z=new THREE.Color(16777215),
-P=new THREE.Color(16777215),Q=new THREE.Color(0),R=new THREE.Color(0),Da=new THREE.Color(0),ha,na=new THREE.Vector3,Y=[],d=[],$,ya,Ea,Fa=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(sa){switch(sa){case "high":Fa=1;break;case "low":Fa=0}};this.setSize=function(sa,aa){m=sa;o=aa;n=m/2;t=o/2;j.setAttribute("viewBox",-n+" "+-t+" "+m+" "+o);j.setAttribute("width",m);j.setAttribute("height",o);G.set(-n,-t,n,t)};this.clear=function(){for(;j.childNodes.length>
-0;)j.removeChild(j.childNodes[0])};this.render=function(sa,aa){var oa,Aa,V,S,ka,ua,ia,Ba;this.autoClear&&this.clear();g=h.projectScene(sa,aa,this.sortElements);Ea=ya=0;if(O=sa.lights.length>0){ia=sa.lights;Q.setRGB(0,0,0);R.setRGB(0,0,0);Da.setRGB(0,0,0);oa=0;for(Aa=ia.length;oa<Aa;oa++){V=ia[oa];S=V.color;if(V instanceof THREE.AmbientLight){Q.r+=S.r;Q.g+=S.g;Q.b+=S.b}else if(V instanceof THREE.DirectionalLight){R.r+=S.r;R.g+=S.g;R.b+=S.b}else if(V instanceof THREE.PointLight){Da.r+=S.r;Da.g+=S.g;
-Da.b+=S.b}}}oa=0;for(Aa=g.length;oa<Aa;oa++){ia=g[oa];K.empty();if(ia instanceof THREE.RenderableParticle){x=ia;x.x*=n;x.y*=-t;V=0;for(S=ia.materials.length;V<S;)V++}else if(ia instanceof THREE.RenderableLine){x=ia.v1;w=ia.v2;x.positionScreen.x*=n;x.positionScreen.y*=-t;w.positionScreen.x*=n;w.positionScreen.y*=-t;K.addPoint(x.positionScreen.x,x.positionScreen.y);K.addPoint(w.positionScreen.x,w.positionScreen.y);if(G.instersects(K)){V=0;for(S=ia.materials.length;V<S;)if((Ba=ia.materials[V++])&&Ba.opacity!=
-0){ka=x;ua=w;var Ga=Ea++;if(d[Ga]==null){d[Ga]=document.createElementNS("http://www.w3.org/2000/svg","line");Fa==0&&d[Ga].setAttribute("shape-rendering","crispEdges")}$=d[Ga];$.setAttribute("x1",ka.positionScreen.x);$.setAttribute("y1",ka.positionScreen.y);$.setAttribute("x2",ua.positionScreen.x);$.setAttribute("y2",ua.positionScreen.y);if(Ba instanceof THREE.LineBasicMaterial){z.__styleString=Ba.color.__styleString;$.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+
-Ba.linewidth+"; stroke-opacity: "+Ba.opacity+"; stroke-linecap: "+Ba.linecap+"; stroke-linejoin: "+Ba.linejoin);j.appendChild($)}}}}else if(ia instanceof THREE.RenderableFace3){x=ia.v1;w=ia.v2;A=ia.v3;x.positionScreen.x*=n;x.positionScreen.y*=-t;w.positionScreen.x*=n;w.positionScreen.y*=-t;A.positionScreen.x*=n;A.positionScreen.y*=-t;K.addPoint(x.positionScreen.x,x.positionScreen.y);K.addPoint(w.positionScreen.x,w.positionScreen.y);K.addPoint(A.positionScreen.x,A.positionScreen.y);if(G.instersects(K)){V=
-0;for(S=ia.meshMaterials.length;V<S;){Ba=ia.meshMaterials[V++];if(Ba instanceof THREE.MeshFaceMaterial){ka=0;for(ua=ia.faceMaterials.length;ka<ua;)(Ba=ia.faceMaterials[ka++])&&Ba.opacity!=0&&c(x,w,A,ia,Ba,sa)}else Ba&&Ba.opacity!=0&&c(x,w,A,ia,Ba,sa)}}}else if(ia instanceof THREE.RenderableFace4){x=ia.v1;w=ia.v2;A=ia.v3;F=ia.v4;x.positionScreen.x*=n;x.positionScreen.y*=-t;w.positionScreen.x*=n;w.positionScreen.y*=-t;A.positionScreen.x*=n;A.positionScreen.y*=-t;F.positionScreen.x*=n;F.positionScreen.y*=
--t;K.addPoint(x.positionScreen.x,x.positionScreen.y);K.addPoint(w.positionScreen.x,w.positionScreen.y);K.addPoint(A.positionScreen.x,A.positionScreen.y);K.addPoint(F.positionScreen.x,F.positionScreen.y);if(G.instersects(K)){V=0;for(S=ia.meshMaterials.length;V<S;){Ba=ia.meshMaterials[V++];if(Ba instanceof THREE.MeshFaceMaterial){ka=0;for(ua=ia.faceMaterials.length;ka<ua;)(Ba=ia.faceMaterials[ka++])&&Ba.opacity!=0&&b(x,w,A,F,ia,Ba,sa)}else Ba&&Ba.opacity!=0&&b(x,w,A,F,ia,Ba,sa)}}}}}};
+THREE.Projector=function(){function a(){var d=m[j]=m[j]||new THREE.RenderableVertex;j++;return d}function c(d,Z){return Z.z-d.z}function b(d,Z){var ya=0,Ga=1,Ha=d.z+d.w,ra=Z.z+Z.w,X=-d.z+d.w,qa=-Z.z+Z.w;if(Ha>=0&&ra>=0&&X>=0&&qa>=0)return!0;else if(Ha<0&&ra<0||X<0&&qa<0)return!1;else{if(Ha<0)ya=Math.max(ya,Ha/(Ha-ra));else ra<0&&(Ga=Math.min(Ga,Ha/(Ha-ra)));if(X<0)ya=Math.max(ya,X/(X-qa));else qa<0&&(Ga=Math.min(Ga,X/(X-qa)));if(Ga<ya)return!1;else{d.lerpSelf(Z,ya);Z.lerpSelf(d,1-Ga);return!0}}}var e,
+f,g=[],h,j,m=[],o,n,t=[],y,w=[],z,E,G=[],J,S,D=[],L=new THREE.Vector4,N=new THREE.Vector4,O=new THREE.Matrix4,Fa=new THREE.Matrix4,oa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],xa=new THREE.Vector4,W=new THREE.Vector4;this.projectVector=function(d,Z){O.multiply(Z.projectionMatrix,Z.matrixWorldInverse);O.multiplyVector3(d);return d};this.unprojectVector=function(d,Z){O.multiply(Z.matrixWorld,THREE.Matrix4.makeInvert(Z.projectionMatrix));
+O.multiplyVector3(d);return d};this.projectObjects=function(d,Z,ya){Z=[];var Ga,Ha,ra;f=0;Ha=d.objects;d=0;for(Ga=Ha.length;d<Ga;d++){ra=Ha[d];var X;if(!(X=!ra.visible))if(X=ra instanceof THREE.Mesh){a:{X=void 0;for(var qa=ra.matrixWorld,za=-ra.geometry.boundingSphere.radius*Math.max(ra.scale.x,Math.max(ra.scale.y,ra.scale.z)),ea=0;ea<6;ea++){X=oa[ea].x*qa.n14+oa[ea].y*qa.n24+oa[ea].z*qa.n34+oa[ea].w;if(X<=za){X=!1;break a}}X=!0}X=!X}if(!X){X=g[f]=g[f]||new THREE.RenderableObject;f++;e=X;L.copy(ra.position);
+O.multiplyVector3(L);e.object=ra;e.z=L.z;Z.push(e)}}ya&&Z.sort(c);return Z};this.projectScene=function(d,Z,ya){var Ga=[],Ha=Z.near,ra=Z.far,X,qa,za,ea,U,ma,Ca,fa,ja,Da,Sa,Xa,Wa,Ta,M,V,na;S=E=y=n=0;Z.matrixAutoUpdate&&Z.updateMatrix();d.update(undefined,!1,Z);O.multiply(Z.projectionMatrix,Z.matrixWorldInverse);oa[0].set(O.n41-O.n11,O.n42-O.n12,O.n43-O.n13,O.n44-O.n14);oa[1].set(O.n41+O.n11,O.n42+O.n12,O.n43+O.n13,O.n44+O.n14);oa[2].set(O.n41+O.n21,O.n42+O.n22,O.n43+O.n23,O.n44+O.n24);oa[3].set(O.n41-
+O.n21,O.n42-O.n22,O.n43-O.n23,O.n44-O.n24);oa[4].set(O.n41-O.n31,O.n42-O.n32,O.n43-O.n33,O.n44-O.n34);oa[5].set(O.n41+O.n31,O.n42+O.n32,O.n43+O.n33,O.n44+O.n34);for(X=0;X<6;X++){ja=oa[X];ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z))}ja=this.projectObjects(d,Z,!0);d=0;for(X=ja.length;d<X;d++){Da=ja[d].object;if(Da.visible){Sa=Da.matrixWorld;Xa=Da.matrixRotationWorld;Wa=Da.materials;Ta=Da.overdraw;j=0;if(Da instanceof THREE.Mesh){M=Da.geometry;ea=M.vertices;V=M.faces;M=M.faceVertexUvs;qa=
+0;for(za=ea.length;qa<za;qa++){h=a();h.positionWorld.copy(ea[qa].position);Sa.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);O.multiplyVector4(h.positionScreen);h.positionScreen.x/=h.positionScreen.w;h.positionScreen.y/=h.positionScreen.w;h.visible=h.positionScreen.z>Ha&&h.positionScreen.z<ra}ea=0;for(qa=V.length;ea<qa;ea++){za=V[ea];if(za instanceof THREE.Face3){U=m[za.a];ma=m[za.b];Ca=m[za.c];if(U.visible&&ma.visible&&Ca.visible&&(Da.doubleSided||Da.flipSided!=(Ca.positionScreen.x-
+U.positionScreen.x)*(ma.positionScreen.y-U.positionScreen.y)-(Ca.positionScreen.y-U.positionScreen.y)*(ma.positionScreen.x-U.positionScreen.x)<0)){fa=t[n]=t[n]||new THREE.RenderableFace3;n++;o=fa;o.v1.copy(U);o.v2.copy(ma);o.v3.copy(Ca)}else continue}else if(za instanceof THREE.Face4){U=m[za.a];ma=m[za.b];Ca=m[za.c];fa=m[za.d];if(U.visible&&ma.visible&&Ca.visible&&fa.visible&&(Da.doubleSided||Da.flipSided!=((fa.positionScreen.x-U.positionScreen.x)*(ma.positionScreen.y-U.positionScreen.y)-(fa.positionScreen.y-
+U.positionScreen.y)*(ma.positionScreen.x-U.positionScreen.x)<0||(ma.positionScreen.x-Ca.positionScreen.x)*(fa.positionScreen.y-Ca.positionScreen.y)-(ma.positionScreen.y-Ca.positionScreen.y)*(fa.positionScreen.x-Ca.positionScreen.x)<0))){na=w[y]=w[y]||new THREE.RenderableFace4;y++;o=na;o.v1.copy(U);o.v2.copy(ma);o.v3.copy(Ca);o.v4.copy(fa)}else continue}o.normalWorld.copy(za.normal);Xa.multiplyVector3(o.normalWorld);o.centroidWorld.copy(za.centroid);Sa.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);
+O.multiplyVector3(o.centroidScreen);Ca=za.vertexNormals;U=0;for(ma=Ca.length;U<ma;U++){fa=o.vertexNormalsWorld[U];fa.copy(Ca[U]);Xa.multiplyVector3(fa)}U=0;for(ma=M.length;U<ma;U++)if(na=M[U][ea]){Ca=0;for(fa=na.length;Ca<fa;Ca++)o.uvs[U][Ca]=na[Ca]}o.meshMaterials=Wa;o.faceMaterials=za.materials;o.overdraw=Ta;o.z=o.centroidScreen.z;Ga.push(o)}}else if(Da instanceof THREE.Line){Fa.multiply(O,Sa);ea=Da.geometry.vertices;U=a();U.positionScreen.copy(ea[0].position);Fa.multiplyVector4(U.positionScreen);
+qa=1;for(za=ea.length;qa<za;qa++){U=a();U.positionScreen.copy(ea[qa].position);Fa.multiplyVector4(U.positionScreen);ma=m[j-2];xa.copy(U.positionScreen);W.copy(ma.positionScreen);if(b(xa,W)){xa.multiplyScalar(1/xa.w);W.multiplyScalar(1/W.w);Sa=G[E]=G[E]||new THREE.RenderableLine;E++;z=Sa;z.v1.positionScreen.copy(xa);z.v2.positionScreen.copy(W);z.z=Math.max(xa.z,W.z);z.materials=Da.materials;Ga.push(z)}}}else if(Da instanceof THREE.Particle){N.set(Da.position.x,Da.position.y,Da.position.z,1);O.multiplyVector4(N);
+N.z/=N.w;if(N.z>0&&N.z<1){Sa=D[S]=D[S]||new THREE.RenderableParticle;S++;J=Sa;J.x=N.x/N.w;J.y=N.y/N.w;J.z=N.z;J.rotation=Da.rotation.z;J.scale.x=Da.scale.x*Math.abs(J.x-(N.x+Z.projectionMatrix.n11)/(N.w+Z.projectionMatrix.n14));J.scale.y=Da.scale.y*Math.abs(J.y-(N.y+Z.projectionMatrix.n22)/(N.w+Z.projectionMatrix.n24));J.materials=Da.materials;Ga.push(J)}}}}ya&&Ga.sort(c);return Ga}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,f,g;this.domElement=document.createElement("div");this.setSize=function(h,j){b=h;e=j;f=b/2;g=e/2};this.render=function(h,j){var m,o,n,t,y,w,z,E;a=c.projectScene(h,j);m=0;for(o=a.length;m<o;m++){y=a[m];if(y instanceof THREE.RenderableParticle){z=y.x*f+f;E=y.y*g+g;n=0;for(t=y.material.length;n<t;n++){w=y.material[n];if(w instanceof THREE.ParticleDOMMaterial){w=w.domElement;w.style.left=z+"px";w.style.top=E+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(ka){if(w!=ka)n.globalAlpha=w=ka}function c(ka){if(z!=ka){switch(ka){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}z=ka}}function b(ka){if(E!=ka)n.strokeStyle=E=ka}var e=null,f=new THREE.Projector,g=document.createElement("canvas"),h,j,m,o,n=g.getContext("2d"),t=new THREE.Color(0),y=0,w=1,z=0,
+E=null,G=null,J=null,S=null,D=null,L,N,O,Fa,oa=new THREE.RenderableVertex,xa=new THREE.RenderableVertex,W,d,Z,ya,Ga,Ha,ra,X,qa,za,ea,U,ma=new THREE.Color,Ca=new THREE.Color,fa=new THREE.Color,ja=new THREE.Color,Da=new THREE.Color,Sa,Xa,Wa,Ta,M,V,na,Aa,ca,ga,k=new THREE.Rectangle,B=new THREE.Rectangle,x=new THREE.Rectangle,p=!1,A=new THREE.Color,F=new THREE.Color,H=new THREE.Color,K=new THREE.Color,C=new THREE.Vector3,$,I,la,Y,ua,sa,Ea=16;$=document.createElement("canvas");$.width=$.height=2;I=$.getContext("2d");
+I.fillStyle="rgba(0,0,0,1)";I.fillRect(0,0,2,2);la=I.getImageData(0,0,2,2);Y=la.data;ua=document.createElement("canvas");ua.width=ua.height=Ea;sa=ua.getContext("2d");sa.translate(-Ea/2,-Ea/2);sa.scale(Ea,Ea);Ea--;this.domElement=g;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ka,va){h=ka;j=va;m=h/2;o=j/2;g.width=h;g.height=j;k.set(-m,-o,m,o);w=1;z=0;D=S=J=G=E=null};this.setClearColor=function(ka,va){t=ka;y=va};this.setClearColorHex=function(ka,va){t.setHex(ka);y=
+va};this.clear=function(){n.setTransform(1,0,0,-1,m,o);if(!B.isEmpty()){B.inflate(1);B.minSelf(k);if(t.hex==0&&y==0)n.clearRect(B.getX(),B.getY(),B.getWidth(),B.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(t.r*255)+","+Math.floor(t.g*255)+","+Math.floor(t.b*255)+","+y+")";n.fillRect(B.getX(),B.getY(),B.getWidth(),B.getHeight())}B.empty()}};this.render=function(ka,va){function ha(P){var da,aa,T,ta=P.lights;F.setRGB(0,0,0);H.setRGB(0,0,0);K.setRGB(0,0,0);P=0;for(da=
+ta.length;P<da;P++){aa=ta[P];T=aa.color;if(aa instanceof THREE.AmbientLight){F.r+=T.r;F.g+=T.g;F.b+=T.b}else if(aa instanceof THREE.DirectionalLight){H.r+=T.r;H.g+=T.g;H.b+=T.b}else if(aa instanceof THREE.PointLight){K.r+=T.r;K.g+=T.g;K.b+=T.b}}}function ia(P,da,aa,T){var ta,Ja,pa,Q,Oa=P.lights;P=0;for(ta=Oa.length;P<ta;P++){Ja=Oa[P];pa=Ja.color;if(Ja instanceof THREE.DirectionalLight){Q=aa.dot(Ja.position);if(!(Q<=0)){Q*=Ja.intensity;T.r+=pa.r*Q;T.g+=pa.g*Q;T.b+=pa.b*Q}}else if(Ja instanceof THREE.PointLight){Q=
+aa.dot(C.sub(Ja.position,da).normalize());if(!(Q<=0)){Q*=Ja.distance==0?1:1-Math.min(da.distanceTo(Ja.position)/Ja.distance,1);if(Q!=0){Q*=Ja.intensity;T.r+=pa.r*Q;T.g+=pa.g*Q;T.b+=pa.b*Q}}}}}function wa(P,da,aa){a(aa.opacity);c(aa.blending);var T,ta,Ja,pa,Q,Oa;if(aa instanceof THREE.ParticleBasicMaterial){if(aa.map){pa=aa.map.image;Q=pa.width>>1;Oa=pa.height>>1;aa=da.scale.x*m;Ja=da.scale.y*o;T=aa*Q;ta=Ja*Oa;x.set(P.x-T,P.y-ta,P.x+T,P.y+ta);if(k.instersects(x)){n.save();n.translate(P.x,P.y);n.rotate(-da.rotation);
+n.scale(aa,-Ja);n.translate(-Q,-Oa);n.drawImage(pa,0,0);n.restore()}}}else if(aa instanceof THREE.ParticleCanvasMaterial){T=da.scale.x*m;ta=da.scale.y*o;x.set(P.x-T,P.y-ta,P.x+T,P.y+ta);if(k.instersects(x)){b(aa.color.__styleString);Ja=aa.color.__styleString;if(G!=Ja)n.fillStyle=G=Ja;n.save();n.translate(P.x,P.y);n.rotate(-da.rotation);n.scale(T,ta);aa.program(n);n.restore()}}}function Qa(P,da,aa,T){a(T.opacity);c(T.blending);n.beginPath();n.moveTo(P.positionScreen.x,P.positionScreen.y);n.lineTo(da.positionScreen.x,
+da.positionScreen.y);n.closePath();if(T instanceof THREE.LineBasicMaterial){ma.__styleString=T.color.__styleString;P=T.linewidth;if(J!=P)n.lineWidth=J=P;P=T.linecap;if(S!=P)n.lineCap=S=P;P=T.linejoin;if(D!=P)n.lineJoin=D=P;b(ma.__styleString);n.stroke();x.inflate(T.linewidth*2)}}function Va(P,da,aa,T,ta,Ja,pa,Q,Oa){a(Q.opacity);c(Q.blending);W=P.positionScreen.x;d=P.positionScreen.y;Z=da.positionScreen.x;ya=da.positionScreen.y;Ga=aa.positionScreen.x;Ha=aa.positionScreen.y;Ma(W,d,Z,ya,Ga,Ha);if(Q instanceof
+THREE.MeshBasicMaterial)if(Q.map){if(Q.map.mapping instanceof THREE.UVMapping){Ta=pa.uvs[0];bb(W,d,Z,ya,Ga,Ha,Q.map.image,Ta[T].u,Ta[T].v,Ta[ta].u,Ta[ta].v,Ta[Ja].u,Ta[Ja].v)}}else if(Q.envMap){if(Q.envMap.mapping instanceof THREE.SphericalReflectionMapping){P=va.matrixWorldInverse;C.copy(pa.vertexNormalsWorld[0]);M=(C.x*P.n11+C.y*P.n12+C.z*P.n13)*0.5+0.5;V=-(C.x*P.n21+C.y*P.n22+C.z*P.n23)*0.5+0.5;C.copy(pa.vertexNormalsWorld[1]);na=(C.x*P.n11+C.y*P.n12+C.z*P.n13)*0.5+0.5;Aa=-(C.x*P.n21+C.y*P.n22+
+C.z*P.n23)*0.5+0.5;C.copy(pa.vertexNormalsWorld[2]);ca=(C.x*P.n11+C.y*P.n12+C.z*P.n13)*0.5+0.5;ga=-(C.x*P.n21+C.y*P.n22+C.z*P.n23)*0.5+0.5;bb(W,d,Z,ya,Ga,Ha,Q.envMap.image,M,V,na,Aa,ca,ga)}}else Q.wireframe?Pa(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){if(Q.map.mapping instanceof THREE.UVMapping){Ta=pa.uvs[0];bb(W,d,Z,ya,Ga,Ha,Q.map.image,Ta[T].u,Ta[T].v,Ta[ta].u,
+Ta[ta].v,Ta[Ja].u,Ta[Ja].v)}c(THREE.SubtractiveBlending)}if(p)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&pa.vertexNormalsWorld.length==3){Ca.r=fa.r=ja.r=F.r;Ca.g=fa.g=ja.g=F.g;Ca.b=fa.b=ja.b=F.b;ia(Oa,pa.v1.positionWorld,pa.vertexNormalsWorld[0],Ca);ia(Oa,pa.v2.positionWorld,pa.vertexNormalsWorld[1],fa);ia(Oa,pa.v3.positionWorld,pa.vertexNormalsWorld[2],ja);Da.r=(fa.r+ja.r)*0.5;Da.g=(fa.g+ja.g)*0.5;Da.b=(fa.b+ja.b)*0.5;Wa=$a(Ca,fa,ja,Da);bb(W,d,Z,ya,Ga,Ha,Wa,0,0,1,0,0,1)}else{A.r=F.r;A.g=F.g;
+A.b=F.b;ia(Oa,pa.centroidWorld,pa.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?Pa(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(ma.__styleString)}else Q.wireframe?Pa(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=va.near;Xa=va.far;Ca.r=Ca.g=Ca.b=1-Za(P.positionScreen.z,Sa,Xa);fa.r=fa.g=fa.b=1-
+Za(da.positionScreen.z,Sa,Xa);ja.r=ja.g=ja.b=1-Za(aa.positionScreen.z,Sa,Xa);Da.r=(fa.r+ja.r)*0.5;Da.g=(fa.g+ja.g)*0.5;Da.b=(fa.b+ja.b)*0.5;Wa=$a(Ca,fa,ja,Da);bb(W,d,Z,ya,Ga,Ha,Wa,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){ma.r=Ka(pa.normalWorld.x);ma.g=Ka(pa.normalWorld.y);ma.b=Ka(pa.normalWorld.z);ma.updateStyleString();Q.wireframe?Pa(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(ma.__styleString)}}function eb(P,da,aa,T,ta,Ja,pa,Q,Oa){a(Q.opacity);
+c(Q.blending);if(Q.map||Q.envMap){Va(P,da,T,0,1,3,pa,Q,Oa);Va(ta,aa,Ja,1,2,3,pa,Q,Oa)}else{W=P.positionScreen.x;d=P.positionScreen.y;Z=da.positionScreen.x;ya=da.positionScreen.y;Ga=aa.positionScreen.x;Ha=aa.positionScreen.y;ra=T.positionScreen.x;X=T.positionScreen.y;qa=ta.positionScreen.x;za=ta.positionScreen.y;ea=Ja.positionScreen.x;U=Ja.positionScreen.y;if(Q instanceof THREE.MeshBasicMaterial){La(W,d,Z,ya,Ga,Ha,ra,X);Q.wireframe?Pa(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):
+cb(Q.color.__styleString)}else if(Q instanceof THREE.MeshLambertMaterial)if(p)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&pa.vertexNormalsWorld.length==4){Ca.r=fa.r=ja.r=Da.r=F.r;Ca.g=fa.g=ja.g=Da.g=F.g;Ca.b=fa.b=ja.b=Da.b=F.b;ia(Oa,pa.v1.positionWorld,pa.vertexNormalsWorld[0],Ca);ia(Oa,pa.v2.positionWorld,pa.vertexNormalsWorld[1],fa);ia(Oa,pa.v4.positionWorld,pa.vertexNormalsWorld[3],ja);ia(Oa,pa.v3.positionWorld,pa.vertexNormalsWorld[2],Da);Wa=$a(Ca,fa,ja,Da);Ma(W,d,Z,ya,ra,X);bb(W,d,Z,ya,
+ra,X,Wa,0,0,1,0,0,1);Ma(qa,za,Ga,Ha,ea,U);bb(qa,za,Ga,Ha,ea,U,Wa,1,0,1,1,0,1)}else{A.r=F.r;A.g=F.g;A.b=F.b;ia(Oa,pa.centroidWorld,pa.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();La(W,d,Z,ya,Ga,Ha,ra,X);Q.wireframe?Pa(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(ma.__styleString)}else{La(W,d,Z,ya,Ga,Ha,ra,X);Q.wireframe?Pa(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(Q.color.__styleString)}else if(Q instanceof
+THREE.MeshNormalMaterial){ma.r=Ka(pa.normalWorld.x);ma.g=Ka(pa.normalWorld.y);ma.b=Ka(pa.normalWorld.z);ma.updateStyleString();La(W,d,Z,ya,Ga,Ha,ra,X);Q.wireframe?Pa(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(ma.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=va.near;Xa=va.far;Ca.r=Ca.g=Ca.b=1-Za(P.positionScreen.z,Sa,Xa);fa.r=fa.g=fa.b=1-Za(da.positionScreen.z,Sa,Xa);ja.r=ja.g=ja.b=1-Za(T.positionScreen.z,Sa,Xa);Da.r=Da.g=Da.b=1-Za(aa.positionScreen.z,
+Sa,Xa);Wa=$a(Ca,fa,ja,Da);Ma(W,d,Z,ya,ra,X);bb(W,d,Z,ya,ra,X,Wa,0,0,1,0,0,1);Ma(qa,za,Ga,Ha,ea,U);bb(qa,za,Ga,Ha,ea,U,Wa,1,0,1,1,0,1)}}}function Ma(P,da,aa,T,ta,Ja){n.beginPath();n.moveTo(P,da);n.lineTo(aa,T);n.lineTo(ta,Ja);n.lineTo(P,da);n.closePath()}function La(P,da,aa,T,ta,Ja,pa,Q){n.beginPath();n.moveTo(P,da);n.lineTo(aa,T);n.lineTo(ta,Ja);n.lineTo(pa,Q);n.lineTo(P,da);n.closePath()}function Pa(P,da,aa,T){if(J!=da)n.lineWidth=J=da;if(S!=aa)n.lineCap=S=aa;if(D!=T)n.lineJoin=D=T;b(P);n.stroke();
+x.inflate(da*2)}function cb(P){if(G!=P)n.fillStyle=G=P;n.fill()}function bb(P,da,aa,T,ta,Ja,pa,Q,Oa,Ra,db,hb,jb){var fb,ib;fb=pa.width-1;ib=pa.height-1;Q*=fb;Oa*=ib;Ra*=fb;db*=ib;hb*=fb;jb*=ib;aa-=P;T-=da;ta-=P;Ja-=da;Ra-=Q;db-=Oa;hb-=Q;jb-=Oa;fb=Ra*jb-hb*db;if(fb!=0){ib=1/fb;fb=(jb*aa-db*ta)*ib;db=(jb*T-db*Ja)*ib;aa=(Ra*ta-hb*aa)*ib;T=(Ra*Ja-hb*T)*ib;P=P-fb*Q-aa*Oa;da=da-db*Q-T*Oa;n.save();n.transform(fb,db,aa,T,P,da);n.clip();n.drawImage(pa,0,0);n.restore()}}function $a(P,da,aa,T){var ta=~~(P.r*
+255),Ja=~~(P.g*255);P=~~(P.b*255);var pa=~~(da.r*255),Q=~~(da.g*255);da=~~(da.b*255);var Oa=~~(aa.r*255),Ra=~~(aa.g*255);aa=~~(aa.b*255);var db=~~(T.r*255),hb=~~(T.g*255);T=~~(T.b*255);Y[0]=ta<0?0:ta>255?255:ta;Y[1]=Ja<0?0:Ja>255?255:Ja;Y[2]=P<0?0:P>255?255:P;Y[4]=pa<0?0:pa>255?255:pa;Y[5]=Q<0?0:Q>255?255:Q;Y[6]=da<0?0:da>255?255:da;Y[8]=Oa<0?0:Oa>255?255:Oa;Y[9]=Ra<0?0:Ra>255?255:Ra;Y[10]=aa<0?0:aa>255?255:aa;Y[12]=db<0?0:db>255?255:db;Y[13]=hb<0?0:hb>255?255:hb;Y[14]=T<0?0:T>255?255:T;I.putImageData(la,
+0,0);sa.drawImage($,0,0);return ua}function Za(P,da,aa){P=(P-da)/(aa-da);return P*P*(3-2*P)}function Ka(P){P=(P+1)*0.5;return P<0?0:P>1?1:P}function Ya(P,da){var aa=da.x-P.x,T=da.y-P.y,ta=1/Math.sqrt(aa*aa+T*T);aa*=ta;T*=ta;da.x+=aa;da.y+=T;P.x-=aa;P.y-=T}var Ua,R,Ba,Na,gb,kb,ab,Ia;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,o);e=f.projectScene(ka,va,this.sortElements);(p=ka.lights.length>0)&&ha(ka);Ua=0;for(R=e.length;Ua<R;Ua++){Ba=e[Ua];x.empty();if(Ba instanceof THREE.RenderableParticle){L=
+Ba;L.x*=m;L.y*=o;Na=0;for(gb=Ba.materials.length;Na<gb;){Ia=Ba.materials[Na++];Ia.opacity!=0&&wa(L,Ba,Ia,ka)}}else if(Ba instanceof THREE.RenderableLine){L=Ba.v1;N=Ba.v2;L.positionScreen.x*=m;L.positionScreen.y*=o;N.positionScreen.x*=m;N.positionScreen.y*=o;x.addPoint(L.positionScreen.x,L.positionScreen.y);x.addPoint(N.positionScreen.x,N.positionScreen.y);if(k.instersects(x)){Na=0;for(gb=Ba.materials.length;Na<gb;){Ia=Ba.materials[Na++];Ia.opacity!=0&&Qa(L,N,Ba,Ia,ka)}}}else if(Ba instanceof THREE.RenderableFace3){L=
+Ba.v1;N=Ba.v2;O=Ba.v3;L.positionScreen.x*=m;L.positionScreen.y*=o;N.positionScreen.x*=m;N.positionScreen.y*=o;O.positionScreen.x*=m;O.positionScreen.y*=o;if(Ba.overdraw){Ya(L.positionScreen,N.positionScreen);Ya(N.positionScreen,O.positionScreen);Ya(O.positionScreen,L.positionScreen)}x.add3Points(L.positionScreen.x,L.positionScreen.y,N.positionScreen.x,N.positionScreen.y,O.positionScreen.x,O.positionScreen.y);if(k.instersects(x)){Na=0;for(gb=Ba.meshMaterials.length;Na<gb;){Ia=Ba.meshMaterials[Na++];
+if(Ia instanceof THREE.MeshFaceMaterial){kb=0;for(ab=Ba.faceMaterials.length;kb<ab;)(Ia=Ba.faceMaterials[kb++])&&Ia.opacity!=0&&Va(L,N,O,0,1,2,Ba,Ia,ka)}else Ia.opacity!=0&&Va(L,N,O,0,1,2,Ba,Ia,ka)}}}else if(Ba instanceof THREE.RenderableFace4){L=Ba.v1;N=Ba.v2;O=Ba.v3;Fa=Ba.v4;L.positionScreen.x*=m;L.positionScreen.y*=o;N.positionScreen.x*=m;N.positionScreen.y*=o;O.positionScreen.x*=m;O.positionScreen.y*=o;Fa.positionScreen.x*=m;Fa.positionScreen.y*=o;oa.positionScreen.copy(N.positionScreen);xa.positionScreen.copy(Fa.positionScreen);
+if(Ba.overdraw){Ya(L.positionScreen,N.positionScreen);Ya(N.positionScreen,Fa.positionScreen);Ya(Fa.positionScreen,L.positionScreen);Ya(O.positionScreen,oa.positionScreen);Ya(O.positionScreen,xa.positionScreen)}x.addPoint(L.positionScreen.x,L.positionScreen.y);x.addPoint(N.positionScreen.x,N.positionScreen.y);x.addPoint(O.positionScreen.x,O.positionScreen.y);x.addPoint(Fa.positionScreen.x,Fa.positionScreen.y);if(k.instersects(x)){Na=0;for(gb=Ba.meshMaterials.length;Na<gb;){Ia=Ba.meshMaterials[Na++];
+if(Ia instanceof THREE.MeshFaceMaterial){kb=0;for(ab=Ba.faceMaterials.length;kb<ab;)(Ia=Ba.faceMaterials[kb++])&&Ia.opacity!=0&&eb(L,N,O,Fa,oa,xa,Ba,Ia,ka)}else Ia.opacity!=0&&eb(L,N,O,Fa,oa,xa,Ba,Ia,ka)}}}B.addRectangle(x)}n.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(ra,X,qa){var za,ea,U,ma;za=0;for(ea=ra.lights.length;za<ea;za++){U=ra.lights[za];if(U instanceof THREE.DirectionalLight){ma=X.normalWorld.dot(U.position)*U.intensity;if(ma>0){qa.r+=U.color.r*ma;qa.g+=U.color.g*ma;qa.b+=U.color.b*ma}}else if(U instanceof THREE.PointLight){xa.sub(U.position,X.centroidWorld);xa.normalize();ma=X.normalWorld.dot(xa)*U.intensity;if(ma>0){qa.r+=U.color.r*ma;qa.g+=U.color.g*ma;qa.b+=U.color.b*ma}}}}function c(ra,X,qa,za,ea,U){Z=e(ya++);
+Z.setAttribute("d","M "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+X.positionScreen.x+" "+X.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+"z");if(ea instanceof THREE.MeshBasicMaterial)D.__styleString=ea.color.__styleString;else if(ea instanceof THREE.MeshLambertMaterial)if(S){L.r=N.r;L.g=N.g;L.b=N.b;a(U,za,L);D.r=ea.color.r*L.r;D.g=ea.color.g*L.g;D.b=ea.color.b*L.b;D.updateStyleString()}else D.__styleString=ea.color.__styleString;else if(ea instanceof THREE.MeshDepthMaterial){oa=
+1-ea.__2near/(ea.__farPlusNear-za.z*ea.__farMinusNear);D.setRGB(oa,oa,oa)}else ea instanceof THREE.MeshNormalMaterial&&D.setRGB(f(za.normalWorld.x),f(za.normalWorld.y),f(za.normalWorld.z));ea.wireframe?Z.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+ea.wireframeLinewidth+"; stroke-opacity: "+ea.opacity+"; stroke-linecap: "+ea.wireframeLinecap+"; stroke-linejoin: "+ea.wireframeLinejoin):Z.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+ea.opacity);
+j.appendChild(Z)}function b(ra,X,qa,za,ea,U,ma){Z=e(ya++);Z.setAttribute("d","M "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+X.positionScreen.x+" "+X.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+" L "+za.positionScreen.x+","+za.positionScreen.y+"z");if(U instanceof THREE.MeshBasicMaterial)D.__styleString=U.color.__styleString;else if(U instanceof THREE.MeshLambertMaterial)if(S){L.r=N.r;L.g=N.g;L.b=N.b;a(ma,ea,L);D.r=U.color.r*L.r;D.g=U.color.g*L.g;D.b=U.color.b*L.b;D.updateStyleString()}else D.__styleString=
+U.color.__styleString;else if(U instanceof THREE.MeshDepthMaterial){oa=1-U.__2near/(U.__farPlusNear-ea.z*U.__farMinusNear);D.setRGB(oa,oa,oa)}else U instanceof THREE.MeshNormalMaterial&&D.setRGB(f(ea.normalWorld.x),f(ea.normalWorld.y),f(ea.normalWorld.z));U.wireframe?Z.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+U.wireframeLinewidth+"; stroke-opacity: "+U.opacity+"; stroke-linecap: "+U.wireframeLinecap+"; stroke-linejoin: "+U.wireframeLinejoin):Z.setAttribute("style",
+"fill: "+D.__styleString+"; fill-opacity: "+U.opacity);j.appendChild(Z)}function e(ra){if(W[ra]==null){W[ra]=document.createElementNS("http://www.w3.org/2000/svg","path");Ha==0&&W[ra].setAttribute("shape-rendering","crispEdges")}return W[ra]}function f(ra){return ra<0?Math.min((1+ra)*0.5,0.5):0.5+Math.min(ra*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,o,n,t,y,w,z,E,G=new THREE.Rectangle,J=new THREE.Rectangle,S=!1,D=new THREE.Color(16777215),
+L=new THREE.Color(16777215),N=new THREE.Color(0),O=new THREE.Color(0),Fa=new THREE.Color(0),oa,xa=new THREE.Vector3,W=[],d=[],Z,ya,Ga,Ha=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ra){switch(ra){case "high":Ha=1;break;case "low":Ha=0}};this.setSize=function(ra,X){m=ra;o=X;n=m/2;t=o/2;j.setAttribute("viewBox",-n+" "+-t+" "+m+" "+o);j.setAttribute("width",m);j.setAttribute("height",o);G.set(-n,-t,n,t)};this.clear=function(){for(;j.childNodes.length>
+0;)j.removeChild(j.childNodes[0])};this.render=function(ra,X){var qa,za,ea,U,ma,Ca,fa,ja;this.autoClear&&this.clear();g=h.projectScene(ra,X,this.sortElements);Ga=ya=0;if(S=ra.lights.length>0){fa=ra.lights;N.setRGB(0,0,0);O.setRGB(0,0,0);Fa.setRGB(0,0,0);qa=0;for(za=fa.length;qa<za;qa++){ea=fa[qa];U=ea.color;if(ea instanceof THREE.AmbientLight){N.r+=U.r;N.g+=U.g;N.b+=U.b}else if(ea instanceof THREE.DirectionalLight){O.r+=U.r;O.g+=U.g;O.b+=U.b}else if(ea instanceof THREE.PointLight){Fa.r+=U.r;Fa.g+=
+U.g;Fa.b+=U.b}}}qa=0;for(za=g.length;qa<za;qa++){fa=g[qa];J.empty();if(fa instanceof THREE.RenderableParticle){y=fa;y.x*=n;y.y*=-t;ea=0;for(U=fa.materials.length;ea<U;)ea++}else if(fa instanceof THREE.RenderableLine){y=fa.v1;w=fa.v2;y.positionScreen.x*=n;y.positionScreen.y*=-t;w.positionScreen.x*=n;w.positionScreen.y*=-t;J.addPoint(y.positionScreen.x,y.positionScreen.y);J.addPoint(w.positionScreen.x,w.positionScreen.y);if(G.instersects(J)){ea=0;for(U=fa.materials.length;ea<U;)if((ja=fa.materials[ea++])&&
+ja.opacity!=0){ma=y;Ca=w;var Da=Ga++;if(d[Da]==null){d[Da]=document.createElementNS("http://www.w3.org/2000/svg","line");Ha==0&&d[Da].setAttribute("shape-rendering","crispEdges")}Z=d[Da];Z.setAttribute("x1",ma.positionScreen.x);Z.setAttribute("y1",ma.positionScreen.y);Z.setAttribute("x2",Ca.positionScreen.x);Z.setAttribute("y2",Ca.positionScreen.y);if(ja instanceof THREE.LineBasicMaterial){D.__styleString=ja.color.__styleString;Z.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+
+ja.linewidth+"; stroke-opacity: "+ja.opacity+"; stroke-linecap: "+ja.linecap+"; stroke-linejoin: "+ja.linejoin);j.appendChild(Z)}}}}else if(fa instanceof THREE.RenderableFace3){y=fa.v1;w=fa.v2;z=fa.v3;y.positionScreen.x*=n;y.positionScreen.y*=-t;w.positionScreen.x*=n;w.positionScreen.y*=-t;z.positionScreen.x*=n;z.positionScreen.y*=-t;J.addPoint(y.positionScreen.x,y.positionScreen.y);J.addPoint(w.positionScreen.x,w.positionScreen.y);J.addPoint(z.positionScreen.x,z.positionScreen.y);if(G.instersects(J)){ea=
+0;for(U=fa.meshMaterials.length;ea<U;){ja=fa.meshMaterials[ea++];if(ja instanceof THREE.MeshFaceMaterial){ma=0;for(Ca=fa.faceMaterials.length;ma<Ca;)(ja=fa.faceMaterials[ma++])&&ja.opacity!=0&&c(y,w,z,fa,ja,ra)}else ja&&ja.opacity!=0&&c(y,w,z,fa,ja,ra)}}}else if(fa instanceof THREE.RenderableFace4){y=fa.v1;w=fa.v2;z=fa.v3;E=fa.v4;y.positionScreen.x*=n;y.positionScreen.y*=-t;w.positionScreen.x*=n;w.positionScreen.y*=-t;z.positionScreen.x*=n;z.positionScreen.y*=-t;E.positionScreen.x*=n;E.positionScreen.y*=
+-t;J.addPoint(y.positionScreen.x,y.positionScreen.y);J.addPoint(w.positionScreen.x,w.positionScreen.y);J.addPoint(z.positionScreen.x,z.positionScreen.y);J.addPoint(E.positionScreen.x,E.positionScreen.y);if(G.instersects(J)){ea=0;for(U=fa.meshMaterials.length;ea<U;){ja=fa.meshMaterials[ea++];if(ja instanceof THREE.MeshFaceMaterial){ma=0;for(Ca=fa.faceMaterials.length;ma<Ca;)(ja=fa.faceMaterials[ma++])&&ja.opacity!=0&&b(y,w,z,E,fa,ja,ra)}else ja&&ja.opacity!=0&&b(y,w,z,E,fa,ja,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",
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -229,118 +231,118 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
 vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
 THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
 THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
 THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
 THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(a){function c(k,y,B){var p,C,L,H=k.vertices,E=H.length,D=k.colors,ca=D.length,I=k.__vertexArray,ea=k.__colorArray,ga=k.__sortArray,wa=k.__dirtyVertices,qa=k.__dirtyColors;if(B.sortParticles){Ba.multiplySelf(B.matrixWorld);for(p=0;p<E;p++){C=H[p].position;Ra.copy(C);Ba.multiplyVector3(Ra);ga[p]=[Ra.z,p]}ga.sort(function(la,va){return va[0]-la[0]});for(p=0;p<E;p++){C=H[ga[p][1]].position;L=p*3;I[L]=C.x;I[L+1]=C.y;I[L+2]=C.z}for(p=0;p<ca;p++){L=p*3;color=D[ga[p][1]];ea[L]=
-color.r;ea[L+1]=color.g;ea[L+2]=color.b}}else{if(wa)for(p=0;p<E;p++){C=H[p].position;L=p*3;I[L]=C.x;I[L+1]=C.y;I[L+2]=C.z}if(qa)for(p=0;p<ca;p++){color=D[p];L=p*3;ea[L]=color.r;ea[L+1]=color.g;ea[L+2]=color.b}}if(wa||B.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,k.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,I,y)}if(qa||B.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,k.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,ea,y)}}function b(k,y){k.uniforms=Uniforms.clone(y.uniforms);k.vertexShader=y.vertexShader;
-k.fragmentShader=y.fragmentShader}function e(k,y,B,p,C){p.__webglProgram||Fa.initMaterial(p,y,B,C);var L=p.program,H=L.uniforms,E=p.uniforms;if(L!=ya){d.useProgram(L);ya=L}d.uniformMatrix4fv(H.projectionMatrix,!1,Ga);if(B&&(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial||p instanceof THREE.LineBasicMaterial||p instanceof THREE.ParticleBasicMaterial)){E.fogColor.value.setHex(B.color.hex);if(B instanceof THREE.Fog){E.fogNear.value=
-B.near;E.fogFar.value=B.far}else if(B instanceof THREE.FogExp2)E.fogDensity.value=B.density}if(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial||p.lights){var D,ca,I=0,ea=0,ga=0,wa,qa,la,va,Ca=bb,da=Ca.directional.colors,pa=Ca.directional.positions,xa=Ca.point.colors,La=Ca.point.positions,Va=Ca.point.distances,Za=0,Ma=0;B=ca=va=0;for(D=y.length;B<D;B++){ca=y[B];wa=ca.color;qa=ca.position;la=ca.intensity;va=ca.distance;if(ca instanceof THREE.AmbientLight){I+=wa.r;ea+=wa.g;
-ga+=wa.b}else if(ca instanceof THREE.DirectionalLight){va=Za*3;da[va]=wa.r*la;da[va+1]=wa.g*la;da[va+2]=wa.b*la;pa[va]=qa.x;pa[va+1]=qa.y;pa[va+2]=qa.z;Za+=1}else if(ca instanceof THREE.PointLight){ca=Ma*3;xa[ca]=wa.r*la;xa[ca+1]=wa.g*la;xa[ca+2]=wa.b*la;La[ca]=qa.x;La[ca+1]=qa.y;La[ca+2]=qa.z;Va[Ma]=va;Ma+=1}}for(B=Za*3;B<da.length;B++)da[B]=0;for(B=Ma*3;B<xa.length;B++)xa[B]=0;Ca.point.length=Ma;Ca.directional.length=Za;Ca.ambient[0]=I;Ca.ambient[1]=ea;Ca.ambient[2]=ga;B=bb;E.enableLighting.value=
-B.directional.length+B.point.length;E.ambientLightColor.value=B.ambient;E.directionalLightColor.value=B.directional.colors;E.directionalLightDirection.value=B.directional.positions;E.pointLightColor.value=B.point.colors;E.pointLightPosition.value=B.point.positions;E.pointLightDistance.value=B.point.distances}if(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial){E.diffuse.value.setRGB(p.color.r,p.color.g,p.color.b);E.opacity.value=p.opacity;
-E.map.texture=p.map;E.lightMap.texture=p.lightMap;E.envMap.texture=p.envMap;E.reflectivity.value=p.reflectivity;E.refractionRatio.value=p.refractionRatio;E.combine.value=p.combine;E.useRefract.value=p.envMap&&p.envMap.mapping instanceof THREE.CubeRefractionMapping}if(p instanceof THREE.LineBasicMaterial){E.diffuse.value.setRGB(p.color.r,p.color.g,p.color.b);E.opacity.value=p.opacity}else if(p instanceof THREE.ParticleBasicMaterial){E.psColor.value.setRGB(p.color.r,p.color.g,p.color.b);E.opacity.value=
-p.opacity;E.size.value=p.size;E.scale.value=$.height/2;E.map.texture=p.map}else if(p instanceof THREE.MeshPhongMaterial){E.ambient.value.setRGB(p.ambient.r,p.ambient.g,p.ambient.b);E.specular.value.setRGB(p.specular.r,p.specular.g,p.specular.b);E.shininess.value=p.shininess}else if(p instanceof THREE.MeshDepthMaterial){E.mNear.value=k.near;E.mFar.value=k.far;E.opacity.value=p.opacity}else if(p instanceof THREE.MeshNormalMaterial)E.opacity.value=p.opacity;for(var Ia in E)if(ea=L.uniforms[Ia]){D=E[Ia];
-I=D.type;B=D.value;if(I=="i")d.uniform1i(ea,B);else if(I=="f")d.uniform1f(ea,B);else if(I=="fv1")d.uniform1fv(ea,B);else if(I=="fv")d.uniform3fv(ea,B);else if(I=="v2")d.uniform2f(ea,B.x,B.y);else if(I=="v3")d.uniform3f(ea,B.x,B.y,B.z);else if(I=="c")d.uniform3f(ea,B.r,B.g,B.b);else if(I=="t"){d.uniform1i(ea,B);if(D=D.texture)if(D.image instanceof Array&&D.image.length==6){if(D.image.length==6){if(D.needsUpdate){if(D.__webglInit){d.bindTexture(d.TEXTURE_CUBE_MAP,D.image.__webglTextureCube);for(I=0;I<
-6;++I)d.texSubImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,0,0,d.RGBA,d.UNSIGNED_BYTE,D.image[I])}else{D.image.__webglTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,D.image.__webglTextureCube);for(I=0;I<6;++I)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,D.image[I]);D.__webglInit=!0}Q(d.TEXTURE_CUBE_MAP,D,D.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);D.needsUpdate=!1}d.activeTexture(d.TEXTURE0+B);d.bindTexture(d.TEXTURE_CUBE_MAP,D.image.__webglTextureCube)}}else R(D,
-B)}}d.uniformMatrix4fv(H.modelViewMatrix,!1,C._modelViewMatrixArray);d.uniformMatrix3fv(H.normalMatrix,!1,C._normalMatrixArray);(p instanceof THREE.MeshShaderMaterial||p instanceof THREE.MeshPhongMaterial||p.envMap)&&d.uniform3f(H.cameraPosition,k.position.x,k.position.y,k.position.z);(p instanceof THREE.MeshShaderMaterial||p.envMap||p.skinning)&&d.uniformMatrix4fv(H.objectMatrix,!1,C._objectMatrixArray);(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshShaderMaterial||
-p.skinning)&&d.uniformMatrix4fv(H.viewMatrix,!1,Qa);if(p instanceof THREE.ShadowVolumeDynamicMaterial){k=E.directionalLightDirection.value;k[0]=-y.position.x;k[1]=-y.position.y;k[2]=-y.position.z;d.uniform3fv(H.directionalLightDirection,k);d.uniformMatrix4fv(H.objectMatrix,!1,C._objectMatrixArray);d.uniformMatrix4fv(H.viewMatrix,!1,Qa)}if(p.skinning){d.uniformMatrix4fv(H.cameraInverseMatrix,!1,Qa);d.uniformMatrix4fv(H.boneGlobalMatrices,!1,C.boneMatrices)}return L}function f(k,y,B,p,C,L){if(p.opacity!=
-0){k=e(k,y,B,p,L).attributes;if(p.morphTargets){y=p.program.attributes;L.morphTargetBase!==-1?d.bindBuffer(d.ARRAY_BUFFER,C.__webglMorphTargetsBuffers[L.morphTargetBase]):d.bindBuffer(d.ARRAY_BUFFER,C.__webglVertexBuffer);d.vertexAttribPointer(y.position,3,d.FLOAT,!1,0,0);if(L.morphTargetForcedOrder.length){B=0;for(var H=L.morphTargetForcedOrder,E=L.morphTargetInfluences;B<p.numSupportedMorphTargets&&B<H.length;){d.bindBuffer(d.ARRAY_BUFFER,C.__webglMorphTargetsBuffers[H[B]]);d.vertexAttribPointer(y["morphTarget"+
-B],3,d.FLOAT,!1,0,0);L.__webglMorphTargetInfluences[B]=E[H[B]];B++}}else{H=[];var D=-1,ca=0;E=L.morphTargetInfluences;var I,ea=E.length;B=0;for(L.morphTargetBase!==-1&&(H[L.morphTargetBase]=!0);B<p.numSupportedMorphTargets;){for(I=0;I<ea;I++)if(!H[I]&&E[I]>D){ca=I;D=E[ca]}d.bindBuffer(d.ARRAY_BUFFER,C.__webglMorphTargetsBuffers[ca]);d.vertexAttribPointer(y["morphTarget"+B],3,d.FLOAT,!1,0,0);L.__webglMorphTargetInfluences[B]=D;H[ca]=1;D=-1;B++}}d.uniform1fv(p.program.uniforms.morphTargetInfluences,
-L.__webglMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,C.__webglVertexBuffer);d.vertexAttribPointer(k.position,3,d.FLOAT,!1,0,0)}if(k.color>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webglColorBuffer);d.vertexAttribPointer(k.color,3,d.FLOAT,!1,0,0)}if(k.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webglNormalBuffer);d.vertexAttribPointer(k.normal,3,d.FLOAT,!1,0,0)}if(k.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webglTangentBuffer);d.vertexAttribPointer(k.tangent,4,d.FLOAT,!1,0,0)}if(k.uv>=0)if(C.__webglUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,
-C.__webglUVBuffer);d.vertexAttribPointer(k.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(k.uv)}else d.disableVertexAttribArray(k.uv);if(k.uv2>=0)if(C.__webglUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,C.__webglUV2Buffer);d.vertexAttribPointer(k.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(k.uv2)}else d.disableVertexAttribArray(k.uv2);if(p.skinning&&k.skinVertexA>=0&&k.skinVertexB>=0&&k.skinIndex>=0&&k.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webglSkinVertexABuffer);d.vertexAttribPointer(k.skinVertexA,
-4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,C.__webglSkinVertexBBuffer);d.vertexAttribPointer(k.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,C.__webglSkinIndicesBuffer);d.vertexAttribPointer(k.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,C.__webglSkinWeightsBuffer);d.vertexAttribPointer(k.skinWeight,4,d.FLOAT,!1,0,0)}if(L instanceof THREE.Mesh)if(p.wireframe){d.lineWidth(p.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,C.__webglLineBuffer);d.drawElements(d.LINES,
-C.__webglLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,C.__webglFaceBuffer);d.drawElements(d.TRIANGLES,C.__webglFaceCount,d.UNSIGNED_SHORT,0)}else if(L instanceof THREE.Line){L=L.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(p.linewidth);d.drawArrays(L,0,C.__webglLineCount)}else if(L instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,C.__webglParticleCount);else L instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,C.__webglVertexCount)}}function g(k,y){if(!k.__webglVertexBuffer)k.__webglVertexBuffer=
-d.createBuffer();if(!k.__webglNormalBuffer)k.__webglNormalBuffer=d.createBuffer();if(k.hasPos){d.bindBuffer(d.ARRAY_BUFFER,k.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,k.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(y.attributes.position);d.vertexAttribPointer(y.attributes.position,3,d.FLOAT,!1,0,0)}if(k.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,k.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,k.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(y.attributes.normal);d.vertexAttribPointer(y.attributes.normal,
-3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,k.count);k.count=0}function h(k){if(sa!=k.doubleSided){k.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);sa=k.doubleSided}if(aa!=k.flipSided){k.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);aa=k.flipSided}}function j(k){if(Aa!=k){k?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);Aa=k}}function m(k){ia[0].set(k.n41-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);ia[1].set(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);ia[2].set(k.n41+k.n21,k.n42+k.n22,
-k.n43+k.n23,k.n44+k.n24);ia[3].set(k.n41-k.n21,k.n42-k.n22,k.n43-k.n23,k.n44-k.n24);ia[4].set(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);ia[5].set(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);var y;for(k=0;k<6;k++){y=ia[k];y.divideScalar(Math.sqrt(y.x*y.x+y.y*y.y+y.z*y.z))}}function o(k){for(var y=k.matrixWorld,B=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),p=0;p<6;p++){k=ia[p].x*y.n14+ia[p].y*y.n24+ia[p].z*y.n34+ia[p].w;if(k<=B)return!1}return!0}function n(k,
-y){k.list[k.count]=y;k.count+=1}function t(k){var y,B,p=k.object,C=k.opaque,L=k.transparent;L.count=0;k=C.count=0;for(y=p.materials.length;k<y;k++){B=p.materials[k];B.opacity&&B.opacity<1||B.blending!=THREE.NormalBlending?n(L,B):n(C,B)}}function x(k){var y,B,p,C,L=k.object,H=k.buffer,E=k.opaque,D=k.transparent;D.count=0;k=E.count=0;for(p=L.materials.length;k<p;k++){y=L.materials[k];if(y instanceof THREE.MeshFaceMaterial){y=0;for(B=H.materials.length;y<B;y++)(C=H.materials[y])&&(C.opacity&&C.opacity<
-1||C.blending!=THREE.NormalBlending?n(D,C):n(E,C))}else{C=y;C.opacity&&C.opacity<1||C.blending!=THREE.NormalBlending?n(D,C):n(E,C)}}}function w(k,y){return y.z-k.z}function A(k){d.enable(d.POLYGON_OFFSET_FILL);d.polygonOffset(0.1,1);d.enable(d.STENCIL_TEST);d.depthMask(!1);d.colorMask(!1,!1,!1,!1);d.stencilFunc(d.ALWAYS,1,255);d.stencilOpSeparate(d.BACK,d.KEEP,d.INCR,d.KEEP);d.stencilOpSeparate(d.FRONT,d.KEEP,d.DECR,d.KEEP);var y,B=k.lights.length,p,C=k.lights,L=[],H,E,D,ca,I,ea=k.__webglShadowVolumes.length;
-for(y=0;y<B;y++){p=k.lights[y];if(p instanceof THREE.DirectionalLight){L[0]=-p.position.x;L[1]=-p.position.y;L[2]=-p.position.z;for(I=0;I<ea;I++){p=k.__webglShadowVolumes[I].object;H=k.__webglShadowVolumes[I].buffer;E=p.materials[0];E.program||Fa.initMaterial(E,C,undefined,p);E=E.program;D=E.uniforms;ca=E.attributes;if(ya!==E){d.useProgram(E);ya=E;d.uniformMatrix4fv(D.projectionMatrix,!1,Ga);d.uniformMatrix4fv(D.viewMatrix,!1,Qa);d.uniform3fv(D.directionalLightDirection,L)}p.matrixWorld.flattenToArray(p._objectMatrixArray);
-d.uniformMatrix4fv(D.objectMatrix,!1,p._objectMatrixArray);d.bindBuffer(d.ARRAY_BUFFER,H.__webglVertexBuffer);d.vertexAttribPointer(ca.position,3,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,H.__webglNormalBuffer);d.vertexAttribPointer(ca.normal,3,d.FLOAT,!1,0,0);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,H.__webglFaceBuffer);d.cullFace(d.FRONT);d.drawElements(d.TRIANGLES,H.__webglFaceCount,d.UNSIGNED_SHORT,0);d.cullFace(d.BACK);d.drawElements(d.TRIANGLES,H.__webglFaceCount,d.UNSIGNED_SHORT,0)}}}d.disable(d.POLYGON_OFFSET_FILL);
-d.colorMask(!0,!0,!0,!0);d.stencilFunc(d.NOTEQUAL,0,255);d.stencilOp(d.KEEP,d.KEEP,d.KEEP);d.disable(d.DEPTH_TEST);oa="";ya=W.program;d.useProgram(W.program);d.uniformMatrix4fv(W.projectionLocation,!1,Ga);d.uniform1f(W.darknessLocation,W.darkness);d.bindBuffer(d.ARRAY_BUFFER,W.vertexBuffer);d.vertexAttribPointer(W.vertexLocation,3,d.FLOAT,!1,0,0);d.enableVertexAttribArray(W.vertexLocation);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.blendEquation(d.FUNC_ADD);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,
-W.elementBuffer);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0);d.disable(d.STENCIL_TEST);d.enable(d.DEPTH_TEST);d.disable(d.BLEND);d.depthMask(!0)}function F(k,y){var B,p,C,L=k.__webglLensFlares.length,H,E,D;H=new THREE.Vector3;var ca=ua/ka;E=ka*0.5;D=ua*0.5;var I=16/ua,ea=[I*ca,I],ga=[1,1,0];I=[1,1];var wa,qa=T.readBackPixels,la,va,Ca=T.uniforms;B=T.attributes;d.useProgram(T.program);ya=T.program;oa="";d.uniform1i(Ca.map,0);d.activeTexture(d.TEXTURE0);d.uniform1f(Ca.opacity,1);d.uniform1f(Ca.rotation,
-0);d.uniform2fv(Ca.scale,ea);d.bindBuffer(d.ARRAY_BUFFER,T.vertexBuffer);d.vertexAttribPointer(B.vertex,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(B.uv,2,d.FLOAT,!1,16,8);d.bindTexture(d.TEXTURE_2D,T.tempTexture);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,T.elementBuffer);d.disable(d.CULL_FACE);d.depthMask(!1);for(C=0;C<L;C++){B=k.__webglLensFlares[C].object;H.set(B.matrixWorld.n14,B.matrixWorld.n24,B.matrixWorld.n34);y.matrixWorldInverse.multiplyVector3(H);p=H.z;y.projectionMatrix.multiplyVector3(H);ga[0]=
-H.x;ga[1]=H.y;ga[2]=H.z;I[0]=ga[0]*E+E;I[1]=ga[1]*D+D;d.copyTexSubImage2D(d.TEXTURE_2D,0,0,0,I[0]-8,I[1]-8,16,16);d.uniform3fv(Ca.screenPosition,ga);d.uniform1i(Ca.renderPink,1);d.enable(d.DEPTH_TEST);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0);try{d.readPixels(I[0]-8,I[1]-8,16,16,d.RGBA,d.UNSIGNED_BYTE,T.readBackPixels)}catch(da){console.log("WebGLRenderer.renderLensFlare: readPixels failed!")}d.getError()&&console.log("WebGLRenderer.renderLensFlare: readPixels failed!");sampleDistance=parseInt(6*
-(1-Math.max(0,Math.min(-p,y.far))/y.far),10)+1;p=sampleDistance*4;wa=sampleDistance*64;va=0;la=28-p+(448-wa);T.readBackPixels[la+0]===255&&T.readBackPixels[la+1]===0&&T.readBackPixels[la+2]===255&&(va+=0.2);la=28+p+(448-wa);qa[la+0]===255&&qa[la+1]===0&&qa[la+2]===255&&(va+=0.2);la=28+p+(448+wa);qa[la+0]===255&&qa[la+1]===0&&qa[la+2]===255&&(va+=0.2);la=28-p+(448+wa);qa[la+0]===255&&qa[la+1]===0&&qa[la+2]===255&&(va+=0.2);la=476;qa[la+0]===255&&qa[la+1]===0&&qa[la+2]===255&&(va+=0.2);B.positionScreen.x=
-ga[0];B.positionScreen.y=ga[1];B.positionScreen.z=ga[2];B.customUpdateCallback?B.customUpdateCallback(va,B):B.updateLensFlares(va);d.uniform1i(Ca.renderPink,0);d.disable(d.DEPTH_TEST);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0)}d.enable(d.BLEND);for(C=0;C<L;C++){B=k.__webglLensFlares[C].object;H=0;for(E=B.lensFlares.length;H<E;H++){D=B.lensFlares[H];if(D.opacity>0.0010&&D.scale>0.0010){ga[0]=D.x;ga[1]=D.y;ga[2]=D.z;I=D.size*D.scale/ua;ea[0]=I*ca;ea[1]=I;d.uniform3fv(Ca.screenPosition,ga);d.uniform1f(Ca.rotation,
-D.rotation);d.uniform2fv(Ca.scale,ea);d.uniform1f(Ca.opacity,D.opacity);P(D.blending);R(D.texture,0);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0)}}}d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(!0);d.disable(d.BLEND)}function G(k,y){k._modelViewMatrix.multiplyToArray(y.matrixWorldInverse,k.matrixWorld,k._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(k._modelViewMatrix).transposeIntoArray(k._normalMatrixArray)}function K(k){var y,B,p;if(k instanceof THREE.Mesh){B=k.geometry;for(y in B.geometryGroups){p=
-B.geometryGroups[y];if(B.__dirtyVertices||B.__dirtyMorphTargets||B.__dirtyElements||B.__dirtyUvs||B.__dirtyNormals||B.__dirtyColors||B.__dirtyTangents){var C=d.DYNAMIC_DRAW,L=void 0,H=void 0,E=void 0,D=void 0;E=void 0;var ca=void 0,I=void 0,ea=void 0,ga=void 0,wa=void 0,qa=void 0,la=void 0,va=void 0,Ca=void 0,da=void 0,pa=void 0,xa=void 0,La=void 0;I=void 0;ea=void 0;D=void 0;ga=void 0;D=void 0;da=void 0;pa=void 0;I=void 0;da=void 0;pa=void 0;xa=void 0;La=void 0;da=void 0;pa=void 0;xa=void 0;La=void 0;
-da=void 0;pa=void 0;xa=void 0;La=void 0;da=void 0;pa=void 0;xa=void 0;D=void 0;ga=void 0;ca=void 0;E=void 0;E=void 0;var Va=void 0,Za=void 0,Ma=void 0,Ia=0,Pa=0,$a=0,eb=0,Ua=0,Wa=0,Ja=0,Xa=0,Ta=0,J=0,Ka=0,Sa=p.__vertexArray,gb=p.__uvArray,hb=p.__uv2Array,Na=p.__normalArray,N=p.__tangentArray,ja=p.__colorArray,fa=p.__skinVertexAArray,Z=p.__skinVertexBArray,ta=p.__skinIndexArray,ra=p.__skinWeightArray,za=p.__morphTargetsArrays,U=p.__faceArray,Ha=p.__lineArray,fb=p.__needsSmoothNormals;qa=p.__vertexColorType;
-wa=p.__uvType;la=p.__normalType;var Oa=k.geometry,cb=Oa.__dirtyVertices,jb=Oa.__dirtyElements,ab=Oa.__dirtyUvs,db=Oa.__dirtyNormals,qb=Oa.__dirtyTangents,rb=Oa.__dirtyColors,sb=Oa.__dirtyMorphTargets,mb=Oa.vertices,tb=p.faces,wb=Oa.faces,ub=Oa.faceVertexUvs[0],vb=Oa.faceVertexUvs[1],nb=Oa.skinVerticesA,ob=Oa.skinVerticesB,pb=Oa.skinIndices,kb=Oa.skinWeights,lb=Oa.edgeFaces,ib=Oa.morphTargets;L=0;for(H=tb.length;L<H;L++){E=tb[L];D=wb[E];ub&&(va=ub[E]);vb&&(Ca=vb[E]);E=D.vertexNormals;ca=D.normal;I=
-D.vertexColors;ea=D.color;ga=D.vertexTangents;if(D instanceof THREE.Face3){if(cb){da=mb[D.a].position;pa=mb[D.b].position;xa=mb[D.c].position;Sa[Pa]=da.x;Sa[Pa+1]=da.y;Sa[Pa+2]=da.z;Sa[Pa+3]=pa.x;Sa[Pa+4]=pa.y;Sa[Pa+5]=pa.z;Sa[Pa+6]=xa.x;Sa[Pa+7]=xa.y;Sa[Pa+8]=xa.z;Pa+=9}if(sb){Va=0;for(Za=ib.length;Va<Za;Va++){da=ib[Va].vertices[D.a].position;pa=ib[Va].vertices[D.b].position;xa=ib[Va].vertices[D.c].position;Ma=za[Va];Ma[Ka+0]=da.x;Ma[Ka+1]=da.y;Ma[Ka+2]=da.z;Ma[Ka+3]=pa.x;Ma[Ka+4]=pa.y;Ma[Ka+5]=
-pa.z;Ma[Ka+6]=xa.x;Ma[Ka+7]=xa.y;Ma[Ka+8]=xa.z}Ka+=9}if(kb.length){da=kb[D.a];pa=kb[D.b];xa=kb[D.c];ra[J]=da.x;ra[J+1]=da.y;ra[J+2]=da.z;ra[J+3]=da.w;ra[J+4]=pa.x;ra[J+5]=pa.y;ra[J+6]=pa.z;ra[J+7]=pa.w;ra[J+8]=xa.x;ra[J+9]=xa.y;ra[J+10]=xa.z;ra[J+11]=xa.w;da=pb[D.a];pa=pb[D.b];xa=pb[D.c];ta[J]=da.x;ta[J+1]=da.y;ta[J+2]=da.z;ta[J+3]=da.w;ta[J+4]=pa.x;ta[J+5]=pa.y;ta[J+6]=pa.z;ta[J+7]=pa.w;ta[J+8]=xa.x;ta[J+9]=xa.y;ta[J+10]=xa.z;ta[J+11]=xa.w;da=nb[D.a];pa=nb[D.b];xa=nb[D.c];fa[J]=da.x;fa[J+1]=da.y;
-fa[J+2]=da.z;fa[J+3]=1;fa[J+4]=pa.x;fa[J+5]=pa.y;fa[J+6]=pa.z;fa[J+7]=1;fa[J+8]=xa.x;fa[J+9]=xa.y;fa[J+10]=xa.z;fa[J+11]=1;da=ob[D.a];pa=ob[D.b];xa=ob[D.c];Z[J]=da.x;Z[J+1]=da.y;Z[J+2]=da.z;Z[J+3]=1;Z[J+4]=pa.x;Z[J+5]=pa.y;Z[J+6]=pa.z;Z[J+7]=1;Z[J+8]=xa.x;Z[J+9]=xa.y;Z[J+10]=xa.z;Z[J+11]=1;J+=12}if(rb&&qa){if(I.length==3&&qa==THREE.VertexColors){D=I[0];da=I[1];pa=I[2]}else pa=da=D=ea;ja[Ta]=D.r;ja[Ta+1]=D.g;ja[Ta+2]=D.b;ja[Ta+3]=da.r;ja[Ta+4]=da.g;ja[Ta+5]=da.b;ja[Ta+6]=pa.r;ja[Ta+7]=pa.g;ja[Ta+8]=
-pa.b;Ta+=9}if(qb&&Oa.hasTangents){I=ga[0];ea=ga[1];D=ga[2];N[Ja]=I.x;N[Ja+1]=I.y;N[Ja+2]=I.z;N[Ja+3]=I.w;N[Ja+4]=ea.x;N[Ja+5]=ea.y;N[Ja+6]=ea.z;N[Ja+7]=ea.w;N[Ja+8]=D.x;N[Ja+9]=D.y;N[Ja+10]=D.z;N[Ja+11]=D.w;Ja+=12}if(db&&la)if(E.length==3&&fb)for(ga=0;ga<3;ga++){ca=E[ga];Na[Wa]=ca.x;Na[Wa+1]=ca.y;Na[Wa+2]=ca.z;Wa+=3}else for(ga=0;ga<3;ga++){Na[Wa]=ca.x;Na[Wa+1]=ca.y;Na[Wa+2]=ca.z;Wa+=3}if(ab&&va!==undefined&&wa)for(ga=0;ga<3;ga++){E=va[ga];gb[$a]=E.u;gb[$a+1]=E.v;$a+=2}if(ab&&Ca!==undefined&&wa)for(ga=
-0;ga<3;ga++){E=Ca[ga];hb[eb]=E.u;hb[eb+1]=E.v;eb+=2}if(jb){U[Ua]=Ia;U[Ua+1]=Ia+1;U[Ua+2]=Ia+2;Ua+=3;Ha[Xa]=Ia;Ha[Xa+1]=Ia+1;Ha[Xa+2]=Ia;Ha[Xa+3]=Ia+2;Ha[Xa+4]=Ia+1;Ha[Xa+5]=Ia+2;Xa+=6;Ia+=3}}else if(D instanceof THREE.Face4){if(cb){da=mb[D.a].position;pa=mb[D.b].position;xa=mb[D.c].position;La=mb[D.d].position;Sa[Pa]=da.x;Sa[Pa+1]=da.y;Sa[Pa+2]=da.z;Sa[Pa+3]=pa.x;Sa[Pa+4]=pa.y;Sa[Pa+5]=pa.z;Sa[Pa+6]=xa.x;Sa[Pa+7]=xa.y;Sa[Pa+8]=xa.z;Sa[Pa+9]=La.x;Sa[Pa+10]=La.y;Sa[Pa+11]=La.z;Pa+=12}if(sb){Va=0;for(Za=
-ib.length;Va<Za;Va++){da=ib[Va].vertices[D.a].position;pa=ib[Va].vertices[D.b].position;xa=ib[Va].vertices[D.c].position;La=ib[Va].vertices[D.d].position;Ma=za[Va];Ma[Ka+0]=da.x;Ma[Ka+1]=da.y;Ma[Ka+2]=da.z;Ma[Ka+3]=pa.x;Ma[Ka+4]=pa.y;Ma[Ka+5]=pa.z;Ma[Ka+6]=xa.x;Ma[Ka+7]=xa.y;Ma[Ka+8]=xa.z;Ma[Ka+9]=La.x;Ma[Ka+10]=La.y;Ma[Ka+11]=La.z}Ka+=12}if(kb.length){da=kb[D.a];pa=kb[D.b];xa=kb[D.c];La=kb[D.d];ra[J]=da.x;ra[J+1]=da.y;ra[J+2]=da.z;ra[J+3]=da.w;ra[J+4]=pa.x;ra[J+5]=pa.y;ra[J+6]=pa.z;ra[J+7]=pa.w;
-ra[J+8]=xa.x;ra[J+9]=xa.y;ra[J+10]=xa.z;ra[J+11]=xa.w;ra[J+12]=La.x;ra[J+13]=La.y;ra[J+14]=La.z;ra[J+15]=La.w;da=pb[D.a];pa=pb[D.b];xa=pb[D.c];La=pb[D.d];ta[J]=da.x;ta[J+1]=da.y;ta[J+2]=da.z;ta[J+3]=da.w;ta[J+4]=pa.x;ta[J+5]=pa.y;ta[J+6]=pa.z;ta[J+7]=pa.w;ta[J+8]=xa.x;ta[J+9]=xa.y;ta[J+10]=xa.z;ta[J+11]=xa.w;ta[J+12]=La.x;ta[J+13]=La.y;ta[J+14]=La.z;ta[J+15]=La.w;da=nb[D.a];pa=nb[D.b];xa=nb[D.c];La=nb[D.d];fa[J]=da.x;fa[J+1]=da.y;fa[J+2]=da.z;fa[J+3]=1;fa[J+4]=pa.x;fa[J+5]=pa.y;fa[J+6]=pa.z;fa[J+
-7]=1;fa[J+8]=xa.x;fa[J+9]=xa.y;fa[J+10]=xa.z;fa[J+11]=1;fa[J+12]=La.x;fa[J+13]=La.y;fa[J+14]=La.z;fa[J+15]=1;da=ob[D.a];pa=ob[D.b];xa=ob[D.c];D=ob[D.d];Z[J]=da.x;Z[J+1]=da.y;Z[J+2]=da.z;Z[J+3]=1;Z[J+4]=pa.x;Z[J+5]=pa.y;Z[J+6]=pa.z;Z[J+7]=1;Z[J+8]=xa.x;Z[J+9]=xa.y;Z[J+10]=xa.z;Z[J+11]=1;Z[J+12]=D.x;Z[J+13]=D.y;Z[J+14]=D.z;Z[J+15]=1;J+=16}if(rb&&qa){if(I.length==4&&qa==THREE.VertexColors){D=I[0];da=I[1];pa=I[2];I=I[3]}else I=pa=da=D=ea;ja[Ta]=D.r;ja[Ta+1]=D.g;ja[Ta+2]=D.b;ja[Ta+3]=da.r;ja[Ta+4]=da.g;
-ja[Ta+5]=da.b;ja[Ta+6]=pa.r;ja[Ta+7]=pa.g;ja[Ta+8]=pa.b;ja[Ta+9]=I.r;ja[Ta+10]=I.g;ja[Ta+11]=I.b;Ta+=12}if(qb&&Oa.hasTangents){I=ga[0];ea=ga[1];D=ga[2];ga=ga[3];N[Ja]=I.x;N[Ja+1]=I.y;N[Ja+2]=I.z;N[Ja+3]=I.w;N[Ja+4]=ea.x;N[Ja+5]=ea.y;N[Ja+6]=ea.z;N[Ja+7]=ea.w;N[Ja+8]=D.x;N[Ja+9]=D.y;N[Ja+10]=D.z;N[Ja+11]=D.w;N[Ja+12]=ga.x;N[Ja+13]=ga.y;N[Ja+14]=ga.z;N[Ja+15]=ga.w;Ja+=16}if(db&&la)if(E.length==4&&fb)for(ga=0;ga<4;ga++){ca=E[ga];Na[Wa]=ca.x;Na[Wa+1]=ca.y;Na[Wa+2]=ca.z;Wa+=3}else for(ga=0;ga<4;ga++){Na[Wa]=
-ca.x;Na[Wa+1]=ca.y;Na[Wa+2]=ca.z;Wa+=3}if(ab&&va!==undefined&&wa)for(ga=0;ga<4;ga++){E=va[ga];gb[$a]=E.u;gb[$a+1]=E.v;$a+=2}if(ab&&Ca!==undefined&&wa)for(ga=0;ga<4;ga++){E=Ca[ga];hb[eb]=E.u;hb[eb+1]=E.v;eb+=2}if(jb){U[Ua]=Ia;U[Ua+1]=Ia+1;U[Ua+2]=Ia+3;U[Ua+3]=Ia+1;U[Ua+4]=Ia+2;U[Ua+5]=Ia+3;Ua+=6;Ha[Xa]=Ia;Ha[Xa+1]=Ia+1;Ha[Xa+2]=Ia;Ha[Xa+3]=Ia+3;Ha[Xa+4]=Ia+1;Ha[Xa+5]=Ia+2;Ha[Xa+6]=Ia+2;Ha[Xa+7]=Ia+3;Xa+=8;Ia+=4}}}if(lb){L=0;for(H=lb.length;L<H;L++){U[Ua]=lb[L].a;U[Ua+1]=lb[L].b;U[Ua+2]=lb[L].c;U[Ua+
-3]=lb[L].a;U[Ua+4]=lb[L].c;U[Ua+5]=lb[L].d;Ua+=6}}if(cb){d.bindBuffer(d.ARRAY_BUFFER,p.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Sa,C)}if(sb){Va=0;for(Za=ib.length;Va<Za;Va++){d.bindBuffer(d.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[Va]);d.bufferData(d.ARRAY_BUFFER,za[Va],C)}}if(rb&&Ta>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,ja,C)}if(db){d.bindBuffer(d.ARRAY_BUFFER,p.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Na,C)}if(qb&&Oa.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,
-p.__webglTangentBuffer);d.bufferData(d.ARRAY_BUFFER,N,C)}if(ab&&$a>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webglUVBuffer);d.bufferData(d.ARRAY_BUFFER,gb,C)}if(ab&&eb>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webglUV2Buffer);d.bufferData(d.ARRAY_BUFFER,hb,C)}if(jb){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,U,C);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Ha,C)}if(J>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinVertexABuffer);
-d.bufferData(d.ARRAY_BUFFER,fa,C);d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,Z,C);d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,ta,C);d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,ra,C)}}}B.__dirtyVertices=!1;B.__dirtyMorphTargets=!1;B.__dirtyElements=!1;B.__dirtyUvs=!1;B.__dirtyNormals=!1;B.__dirtyTangents=!1;B.__dirtyColors=!1}else if(k instanceof THREE.Ribbon){B=k.geometry;if(B.__dirtyVertices||
-B.__dirtyColors){k=B;y=d.DYNAMIC_DRAW;la=k.vertices;C=k.colors;va=la.length;L=C.length;Ca=k.__vertexArray;H=k.__colorArray;Ia=k.__dirtyColors;if(k.__dirtyVertices){for(wa=0;wa<va;wa++){qa=la[wa].position;p=wa*3;Ca[p]=qa.x;Ca[p+1]=qa.y;Ca[p+2]=qa.z}d.bindBuffer(d.ARRAY_BUFFER,k.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Ca,y)}if(Ia){for(wa=0;wa<L;wa++){color=C[wa];p=wa*3;H[p]=color.r;H[p+1]=color.g;H[p+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,k.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,H,
-y)}}B.__dirtyVertices=!1;B.__dirtyColors=!1}else if(k instanceof THREE.Line){B=k.geometry;if(B.__dirtyVertices||B.__dirtyColors){k=B;y=d.DYNAMIC_DRAW;la=k.vertices;C=k.colors;va=la.length;L=C.length;Ca=k.__vertexArray;H=k.__colorArray;Ia=k.__dirtyColors;if(k.__dirtyVertices){for(wa=0;wa<va;wa++){qa=la[wa].position;p=wa*3;Ca[p]=qa.x;Ca[p+1]=qa.y;Ca[p+2]=qa.z}d.bindBuffer(d.ARRAY_BUFFER,k.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Ca,y)}if(Ia){for(wa=0;wa<L;wa++){color=C[wa];p=wa*3;H[p]=color.r;
-H[p+1]=color.g;H[p+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,k.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,H,y)}}B.__dirtyVertices=!1;B.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem){B=k.geometry;(B.__dirtyVertices||B.__dirtyColors||k.sortParticles)&&c(B,d.DYNAMIC_DRAW,k);B.__dirtyVertices=!1;B.__dirtyColors=!1}}function O(k){function y(ga){var wa=[];B=0;for(p=ga.length;B<p;B++)ga[B]==undefined?wa.push("undefined"):wa.push(ga[B].id);return wa.join("_")}var B,p,C,L,H,E,D,ca,I={},ea=k.morphTargets!==
-undefined?k.morphTargets.length:0;k.geometryGroups={};C=0;for(L=k.faces.length;C<L;C++){H=k.faces[C];E=H.materials;D=y(E);I[D]==undefined&&(I[D]={hash:D,counter:0});ca=I[D].hash+"_"+I[D].counter;k.geometryGroups[ca]==undefined&&(k.geometryGroups[ca]={faces:[],materials:E,vertices:0,numMorphTargets:ea});H=H instanceof THREE.Face3?3:4;if(k.geometryGroups[ca].vertices+H>65535){I[D].counter+=1;ca=I[D].hash+"_"+I[D].counter;k.geometryGroups[ca]==undefined&&(k.geometryGroups[ca]={faces:[],materials:E,vertices:0,
-numMorphTargets:ea})}k.geometryGroups[ca].faces.push(C);k.geometryGroups[ca].vertices+=H}}function z(k,y,B){k.push({buffer:y,object:B,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function P(k){if(k!=oa){switch(k){case THREE.AdditiveAlphaBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);
-break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD);d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}oa=k}}function Q(k,y,B){if((B.width&B.width-1)==0&&(B.height&B.height-1)==0){d.texParameteri(k,d.TEXTURE_WRAP_S,Y(y.wrapS));d.texParameteri(k,d.TEXTURE_WRAP_T,Y(y.wrapT));d.texParameteri(k,d.TEXTURE_MAG_FILTER,Y(y.magFilter));d.texParameteri(k,d.TEXTURE_MIN_FILTER,
-Y(y.minFilter));d.generateMipmap(k)}else{d.texParameteri(k,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(k,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(k,d.TEXTURE_MAG_FILTER,na(y.magFilter));d.texParameteri(k,d.TEXTURE_MIN_FILTER,na(y.minFilter))}}function R(k,y){if(k.needsUpdate){if(k.__webglInit){d.bindTexture(d.TEXTURE_2D,k.__webglTexture);d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,k.image)}else{k.__webglTexture=d.createTexture();d.bindTexture(d.TEXTURE_2D,k.__webglTexture);
-d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,k.image);k.__webglInit=!0}Q(d.TEXTURE_2D,k,k.image);d.bindTexture(d.TEXTURE_2D,null);k.needsUpdate=!1}d.activeTexture(d.TEXTURE0+y);d.bindTexture(d.TEXTURE_2D,k.__webglTexture)}function Da(k){if(k&&!k.__webglFramebuffer){k.__webglFramebuffer=d.createFramebuffer();k.__webglRenderbuffer=d.createRenderbuffer();k.__webglTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,k.__webglRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,
-k.width,k.height);d.bindTexture(d.TEXTURE_2D,k.__webglTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,Y(k.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,Y(k.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,Y(k.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,Y(k.minFilter));d.texImage2D(d.TEXTURE_2D,0,Y(k.format),k.width,k.height,0,Y(k.format),Y(k.type),null);d.bindFramebuffer(d.FRAMEBUFFER,k.__webglFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,
-d.TEXTURE_2D,k.__webglTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,k.__webglRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var y,B;if(k){y=k.__webglFramebuffer;B=k.width;k=k.height}else{y=null;B=ka;k=ua}if(y!=Ea){d.bindFramebuffer(d.FRAMEBUFFER,y);d.viewport(V,S,B,k);Ea=y}}function ha(k,y){var B;if(k=="fragment")B=d.createShader(d.FRAGMENT_SHADER);else k=="vertex"&&(B=d.createShader(d.VERTEX_SHADER));
-d.shaderSource(B,y);d.compileShader(B);if(!d.getShaderParameter(B,d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(B));console.error(y);return null}return B}function na(k){switch(k){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function Y(k){switch(k){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;
-case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;
-case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var d,$=document.createElement("canvas"),ya=null,Ea=null,Fa=this,sa=null,aa=null,oa=null,Aa=null,V=0,S=0,ka=0,ua=0,ia=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ba=new THREE.Matrix4,Ga=new Float32Array(16),Qa=new Float32Array(16),Ra=new THREE.Vector4,bb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Ya=!0,M=!0,X=new THREE.Color(0),ma=0;if(a){if(a.stencil!=undefined)Ya=a.stencil;if(a.antialias!==undefined)M=a.antialias;a.clearColor!==undefined&&X.setHex(a.clearColor);if(a.clearAlpha!==undefined)ma=a.clearAlpha}this.maxMorphTargets=8;
-this.domElement=$;this.autoClear=!0;this.sortObjects=!0;(function(k,y,B,p){try{if(!(d=$.getContext("experimental-webgl",{antialias:k,stencil:p})))throw"Error creating WebGL context.";}catch(C){console.error(C)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(y.r,y.g,y.b,B)})(M,X,ma,Ya);this.context=d;
-if(Ya){var W={};W.vertices=new Float32Array(12);W.faces=new Uint16Array(6);W.darkness=0.5;W.vertices[0]=-2;W.vertices[1]=-1;W.vertices[2]=-1;W.vertices[3]=2;W.vertices[4]=-1;W.vertices[5]=-1;W.vertices[6]=2;W.vertices[7]=1;W.vertices[8]=-1;W.vertices[9]=-2;W.vertices[10]=1;W.vertices[11]=-1;W.faces[0]=0;W.faces[1]=1;W.faces[2]=2;W.faces[3]=0;W.faces[4]=2;W.faces[5]=3;W.vertexBuffer=d.createBuffer();W.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,W.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,
-W.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,W.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,W.faces,d.STATIC_DRAW);W.program=d.createProgram();d.attachShader(W.program,ha("fragment",THREE.ShaderLib.shadowPost.fragmentShader));d.attachShader(W.program,ha("vertex",THREE.ShaderLib.shadowPost.vertexShader));d.linkProgram(W.program);W.vertexLocation=d.getAttribLocation(W.program,"position");W.projectionLocation=d.getUniformLocation(W.program,"projectionMatrix");W.darknessLocation=
-d.getUniformLocation(W.program,"darkness")}var T={};T.vertices=new Float32Array(16);T.faces=new Uint16Array(6);T.transparency=0.5;a=0;T.vertices[a++]=-1;T.vertices[a++]=-1;T.vertices[a++]=0;T.vertices[a++]=0;T.vertices[a++]=1;T.vertices[a++]=-1;T.vertices[a++]=1;T.vertices[a++]=0;T.vertices[a++]=1;T.vertices[a++]=1;T.vertices[a++]=1;T.vertices[a++]=1;T.vertices[a++]=-1;T.vertices[a++]=1;T.vertices[a++]=0;T.vertices[a++]=1;a=0;T.faces[a++]=0;T.faces[a++]=1;T.faces[a++]=2;T.faces[a++]=0;T.faces[a++]=
-2;T.faces[a++]=3;T.vertexBuffer=d.createBuffer();T.elementBuffer=d.createBuffer();T.tempTexture=d.createTexture();T.readBackPixels=new Uint8Array(1024);d.bindBuffer(d.ARRAY_BUFFER,T.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,T.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,T.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,T.faces,d.STATIC_DRAW);d.bindTexture(d.TEXTURE_2D,T.tempTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGB,16,16,0,d.RGB,d.UNSIGNED_BYTE,null);d.texParameteri(d.TEXTURE_2D,
-d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.NEAREST);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.NEAREST);T.program=d.createProgram();d.attachShader(T.program,ha("fragment",THREE.ShaderLib.lensFlare.fragmentShader));d.attachShader(T.program,ha("vertex",THREE.ShaderLib.lensFlare.vertexShader));d.linkProgram(T.program);T.attributes={};T.uniforms={};T.attributes.vertex=d.getAttribLocation(T.program,
-"position");T.attributes.uv=d.getAttribLocation(T.program,"UV");T.uniforms.map=d.getUniformLocation(T.program,"map");T.uniforms.opacity=d.getUniformLocation(T.program,"opacity");T.uniforms.scale=d.getUniformLocation(T.program,"scale");T.uniforms.rotation=d.getUniformLocation(T.program,"rotation");T.uniforms.screenPosition=d.getUniformLocation(T.program,"screenPosition");T.uniforms.renderPink=d.getUniformLocation(T.program,"renderPink");this.setSize=function(k,y){$.width=k;$.height=y;this.setViewport(0,
-0,$.width,$.height)};this.setViewport=function(k,y,B,p){V=k;S=y;ka=B;ua=p;d.viewport(V,S,ka,ua)};this.setScissor=function(k,y,B,p){d.scissor(k,y,B,p)};this.enableScissorTest=function(k){k?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(k){d.depthMask(k)};this.setClearColorHex=function(k,y){var B=new THREE.Color(k);d.clearColor(B.r,B.g,B.b,y)};this.setClearColor=function(k,y){d.clearColor(k.r,k.g,k.b,y)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT|
-d.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(k){W.darkness=k};this.initMaterial=function(k,y,B,p){var C,L,H,E;if(k instanceof THREE.MeshDepthMaterial)b(k,THREE.ShaderLib.depth);else if(k instanceof THREE.ShadowVolumeDynamicMaterial)b(k,THREE.ShaderLib.shadowVolumeDynamic);else if(k instanceof THREE.MeshNormalMaterial)b(k,THREE.ShaderLib.normal);else if(k instanceof THREE.MeshBasicMaterial)b(k,THREE.ShaderLib.basic);else if(k instanceof THREE.MeshLambertMaterial)b(k,THREE.ShaderLib.lambert);
-else if(k instanceof THREE.MeshPhongMaterial)b(k,THREE.ShaderLib.phong);else if(k instanceof THREE.LineBasicMaterial)b(k,THREE.ShaderLib.basic);else k instanceof THREE.ParticleBasicMaterial&&b(k,THREE.ShaderLib.particle_basic);if(!k.program){var D,ca,I;D=I=E=0;for(H=y.length;D<H;D++){ca=y[D];ca instanceof THREE.DirectionalLight&&I++;ca instanceof THREE.PointLight&&E++}if(E+I<=4)y=I;else{y=Math.ceil(4*I/(E+I));E=4-y}E={directional:y,point:E};y=50;if(p!==undefined&&p instanceof THREE.SkinnedMesh)y=
-p.bones.length;H={map:k.map,envMap:k.envMap,lightMap:k.lightMap,vertexColors:k.vertexColors,fog:B,sizeAttenuation:k.sizeAttenuation,skinning:k.skinning,morphTargets:k.morphTargets,maxDirLights:E.directional,maxPointLights:E.point,maxBones:y};B=k.fragmentShader;E=k.vertexShader;y=d.createProgram();D=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+H.maxDirLights,"#define MAX_POINT_LIGHTS "+H.maxPointLights,H.fog?"#define USE_FOG":"",H.fog instanceof THREE.FogExp2?"#define FOG_EXP2":
-"",H.map?"#define USE_MAP":"",H.envMap?"#define USE_ENVMAP":"",H.lightMap?"#define USE_LIGHTMAP":"",H.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");H=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+H.maxDirLights,"#define MAX_POINT_LIGHTS "+H.maxPointLights,"#define MAX_BONES "+H.maxBones,H.map?"#define USE_MAP":"",H.envMap?"#define USE_ENVMAP":"",H.lightMap?"#define USE_LIGHTMAP":
-"",H.vertexColors?"#define USE_COLOR":"",H.skinning?"#define USE_SKINNING":"",H.morphTargets?"#define USE_MORPHTARGETS":"",H.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-d.attachShader(y,ha("fragment",D+B));d.attachShader(y,ha("vertex",H+E));d.linkProgram(y);d.getProgramParameter(y,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(y,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");y.uniforms={};y.attributes={};k.program=y;B=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(C in k.uniforms)B.push(C);
-C=k.program;E=0;for(y=B.length;E<y;E++){D=B[E];C.uniforms[D]=d.getUniformLocation(C,D)}B=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(C=0;C<this.maxMorphTargets;C++)B.push("morphTarget"+C);for(L in k.attributes)B.push(L);L=k.program;C=B;B=0;for(E=C.length;B<E;B++){y=C[B];L.attributes[y]=d.getAttribLocation(L,y)}L=k.program.attributes;d.enableVertexAttribArray(L.position);L.color>=0&&d.enableVertexAttribArray(L.color);L.normal>=0&&d.enableVertexAttribArray(L.normal);
-L.tangent>=0&&d.enableVertexAttribArray(L.tangent);if(k.skinning&&L.skinVertexA>=0&&L.skinVertexB>=0&&L.skinIndex>=0&&L.skinWeight>=0){d.enableVertexAttribArray(L.skinVertexA);d.enableVertexAttribArray(L.skinVertexB);d.enableVertexAttribArray(L.skinIndex);d.enableVertexAttribArray(L.skinWeight)}if(k.morphTargets){k.numSupportedMorphTargets=0;if(L.morphTarget0>=0){d.enableVertexAttribArray(L.morphTarget0);k.numSupportedMorphTargets++}if(L.morphTarget1>=0){d.enableVertexAttribArray(L.morphTarget1);
-k.numSupportedMorphTargets++}if(L.morphTarget2>=0){d.enableVertexAttribArray(L.morphTarget2);k.numSupportedMorphTargets++}if(L.morphTarget3>=0){d.enableVertexAttribArray(L.morphTarget3);k.numSupportedMorphTargets++}if(L.morphTarget4>=0){d.enableVertexAttribArray(L.morphTarget4);k.numSupportedMorphTargets++}if(L.morphTarget5>=0){d.enableVertexAttribArray(L.morphTarget5);k.numSupportedMorphTargets++}if(L.morphTarget6>=0){d.enableVertexAttribArray(L.morphTarget6);k.numSupportedMorphTargets++}if(L.morphTarget7>=
-0){d.enableVertexAttribArray(L.morphTarget7);k.numSupportedMorphTargets++}p.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);C=0;for(L=this.maxMorphTargets;C<L;C++)p.__webglMorphTargetInfluences[C]=0}}k.__webglProgram=!0};this.render=function(k,y,B,p){var C,L,H,E,D,ca,I,ea,ga=k.lights,wa=k.fog;y.matrixAutoUpdate&&y.updateMatrix();k.update(undefined,!1,y);y.matrixWorldInverse.flattenToArray(Qa);y.projectionMatrix.flattenToArray(Ga);Ba.multiply(y.projectionMatrix,y.matrixWorldInverse);
-m(Ba);this.initWebGLObjects(k);Da(B);(this.autoClear||p)&&this.clear();D=k.__webglObjects.length;for(p=0;p<D;p++){C=k.__webglObjects[p];I=C.object;if(I.visible)if(!(I instanceof THREE.Mesh)||o(I)){I.matrixWorld.flattenToArray(I._objectMatrixArray);G(I,y);x(C);C.render=!0;if(this.sortObjects){Ra.copy(I.position);Ba.multiplyVector3(Ra);C.z=Ra.z}}else C.render=!1;else C.render=!1}this.sortObjects&&k.__webglObjects.sort(w);ca=k.__webglObjectsImmediate.length;for(p=0;p<ca;p++){C=k.__webglObjectsImmediate[p];
-I=C.object;if(I.visible){I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray);G(I,y);t(C)}}P(THREE.NormalBlending);for(p=0;p<D;p++){C=k.__webglObjects[p];if(C.render){I=C.object;ea=C.buffer;H=C.opaque;h(I);for(C=0;C<H.count;C++){E=H.list[C];j(E.depthTest);f(y,ga,wa,E,ea,I)}}}for(p=0;p<ca;p++){C=k.__webglObjectsImmediate[p];I=C.object;if(I.visible){H=C.opaque;h(I);for(C=0;C<H.count;C++){E=H.list[C];j(E.depthTest);L=e(y,ga,wa,E,I);I.render(function(qa){g(qa,L)})}}}for(p=0;p<D;p++){C=
-k.__webglObjects[p];if(C.render){I=C.object;ea=C.buffer;H=C.transparent;h(I);for(C=0;C<H.count;C++){E=H.list[C];P(E.blending);j(E.depthTest);f(y,ga,wa,E,ea,I)}}}for(p=0;p<ca;p++){C=k.__webglObjectsImmediate[p];I=C.object;if(I.visible){H=C.transparent;h(I);for(C=0;C<H.count;C++){E=H.list[C];P(E.blending);j(E.depthTest);L=e(y,ga,wa,E,I);I.render(function(qa){g(qa,L)})}}}Ya&&k.__webglShadowVolumes.length&&k.lights.length&&A(k);k.__webglLensFlares.length&&F(k,y);if(B&&B.minFilter!==THREE.NearestFilter&&
-B.minFilter!==THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,B.__webglTexture);d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}};this.initWebGLObjects=function(k){if(!k.__webglObjects){k.__webglObjects=[];k.__webglObjectsImmediate=[];k.__webglShadowVolumes=[];k.__webglLensFlares=[]}for(;k.__objectsAdded.length;){var y=k.__objectsAdded[0],B=k,p=void 0,C=void 0,L=void 0;if(y._modelViewMatrix==undefined){y._modelViewMatrix=new THREE.Matrix4;y._normalMatrixArray=new Float32Array(9);y._modelViewMatrixArray=
-new Float32Array(16);y._objectMatrixArray=new Float32Array(16);y.matrixWorld.flattenToArray(y._objectMatrixArray)}if(y instanceof THREE.Mesh){C=y.geometry;C.geometryGroups==undefined&&O(C);for(p in C.geometryGroups){L=C.geometryGroups[p];if(!L.__webglVertexBuffer){var H=L;H.__webglVertexBuffer=d.createBuffer();H.__webglNormalBuffer=d.createBuffer();H.__webglTangentBuffer=d.createBuffer();H.__webglColorBuffer=d.createBuffer();H.__webglUVBuffer=d.createBuffer();H.__webglUV2Buffer=d.createBuffer();H.__webglSkinVertexABuffer=
-d.createBuffer();H.__webglSkinVertexBBuffer=d.createBuffer();H.__webglSkinIndicesBuffer=d.createBuffer();H.__webglSkinWeightsBuffer=d.createBuffer();H.__webglFaceBuffer=d.createBuffer();H.__webglLineBuffer=d.createBuffer();if(H.numMorphTargets){var E=void 0,D=void 0;H.__webglMorphTargetsBuffers=[];E=0;for(D=H.numMorphTargets;E<D;E++)H.__webglMorphTargetsBuffers.push(d.createBuffer())}H=L;E=y;var ca=void 0,I=void 0,ea=void 0;ea=void 0;var ga=D=0,wa=0;ca=void 0;I=void 0;var qa=void 0;I=void 0;var la=
-E.geometry;qa=la.faces;var va=H.faces;ca=0;for(I=va.length;ca<I;ca++){ea=va[ca];ea=qa[ea];if(ea instanceof THREE.Face3){D+=3;ga+=1;wa+=3}else if(ea instanceof THREE.Face4){D+=4;ga+=2;wa+=4}}ca=H;I=E;qa=void 0;va=void 0;var Ca=void 0,da=void 0;Ca=void 0;ea=[];qa=0;for(va=I.materials.length;qa<va;qa++){Ca=I.materials[qa];if(Ca instanceof THREE.MeshFaceMaterial){Ca=0;for(l=ca.materials.length;Ca<l;Ca++)(da=ca.materials[Ca])&&ea.push(da)}else(da=Ca)&&ea.push(da)}I=ea;a:{ca=void 0;qa=void 0;va=I.length;
-for(ca=0;ca<va;ca++){qa=I[ca];if(qa.map||qa.lightMap||qa instanceof THREE.MeshShaderMaterial){ca=!0;break a}}ca=!1}a:{qa=I;va=void 0;ea=void 0;Ca=qa.length;for(va=0;va<Ca;va++){ea=qa[va];if(!(ea instanceof THREE.MeshBasicMaterial&&!ea.envMap||ea instanceof THREE.MeshDepthMaterial)){qa=ea&&ea.shading!=undefined&&ea.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}qa=!1}a:{va=void 0;ea=void 0;Ca=I.length;for(va=0;va<Ca;va++){ea=I[va];if(ea.vertexColors){I=ea.vertexColors;
-break a}}I=!1}H.__vertexArray=new Float32Array(D*3);if(qa)H.__normalArray=new Float32Array(D*3);if(la.hasTangents)H.__tangentArray=new Float32Array(D*4);if(I)H.__colorArray=new Float32Array(D*3);if(ca){if(la.faceUvs.length>0||la.faceVertexUvs.length>0)H.__uvArray=new Float32Array(D*2);if(la.faceUvs.length>1||la.faceVertexUvs.length>1)H.__uv2Array=new Float32Array(D*2)}if(E.geometry.skinWeights.length&&E.geometry.skinIndices.length){H.__skinVertexAArray=new Float32Array(D*4);H.__skinVertexBArray=new Float32Array(D*
-4);H.__skinIndexArray=new Float32Array(D*4);H.__skinWeightArray=new Float32Array(D*4)}H.__faceArray=new Uint16Array(ga*3+(E.geometry.edgeFaces?E.geometry.edgeFaces.length*6:0));H.__lineArray=new Uint16Array(wa*2);if(H.numMorphTargets){la=void 0;va=void 0;H.__morphTargetsArrays=[];la=0;for(va=H.numMorphTargets;la<va;la++)H.__morphTargetsArrays.push(new Float32Array(D*3))}H.__needsSmoothNormals=qa==THREE.SmoothShading;H.__uvType=ca;H.__vertexColorType=I;H.__normalType=qa;H.__webglFaceCount=ga*3+(E.geometry.edgeFaces?
-E.geometry.edgeFaces.length*6:0);H.__webglLineCount=wa*2;C.__dirtyVertices=!0;C.__dirtyMorphTargets=!0;C.__dirtyElements=!0;C.__dirtyUvs=!0;C.__dirtyNormals=!0;C.__dirtyTangents=!0;C.__dirtyColors=!0}y instanceof THREE.ShadowVolume?z(B.__webglShadowVolumes,L,y):z(B.__webglObjects,L,y)}}else if(y instanceof THREE.LensFlare)z(B.__webglLensFlares,undefined,y);else if(y instanceof THREE.Ribbon){C=y.geometry;if(!C.__webglVertexBuffer){p=C;p.__webglVertexBuffer=d.createBuffer();p.__webglColorBuffer=d.createBuffer();
-p=C;L=p.vertices.length;p.__vertexArray=new Float32Array(L*3);p.__colorArray=new Float32Array(L*3);p.__webglVertexCount=L;C.__dirtyVertices=!0;C.__dirtyColors=!0}z(B.__webglObjects,C,y)}else if(y instanceof THREE.Line){C=y.geometry;if(!C.__webglVertexBuffer){p=C;p.__webglVertexBuffer=d.createBuffer();p.__webglColorBuffer=d.createBuffer();p=C;L=p.vertices.length;p.__vertexArray=new Float32Array(L*3);p.__colorArray=new Float32Array(L*3);p.__webglLineCount=L;C.__dirtyVertices=!0;C.__dirtyColors=!0}z(B.__webglObjects,
-C,y)}else if(y instanceof THREE.ParticleSystem){C=y.geometry;if(!C.__webglVertexBuffer){p=C;p.__webglVertexBuffer=d.createBuffer();p.__webglColorBuffer=d.createBuffer();p=C;L=p.vertices.length;p.__vertexArray=new Float32Array(L*3);p.__colorArray=new Float32Array(L*3);p.__sortArray=[];p.__webglParticleCount=L;C.__dirtyVertices=!0;C.__dirtyColors=!0}z(B.__webglObjects,C,y)}else THREE.MarchingCubes!==undefined&&y instanceof THREE.MarchingCubes&&B.__webglObjectsImmediate.push({object:y,opaque:{list:[],
-count:0},transparent:{list:[],count:0}});k.__objectsAdded.splice(0,1)}for(;k.__objectsRemoved.length;){y=k.__objectsRemoved[0];B=k;C=void 0;p=void 0;for(C=B.__webglObjects.length-1;C>=0;C--){p=B.__webglObjects[C].object;y==p&&B.__webglObjects.splice(C,1)}k.__objectsRemoved.splice(0,1)}y=0;for(B=k.__webglObjects.length;y<B;y++)K(k.__webglObjects[y].object,k);y=0;for(B=k.__webglShadowVolumes.length;y<B;y++)K(k.__webglShadowVolumes[y].object,k);y=0;for(B=k.__webglLensFlares.length;y<B;y++)K(k.__webglLensFlares[y].object,
-k)};this.setFaceCulling=function(k,y){if(k){!y||y=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(k=="back")d.cullFace(d.BACK);else k=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+THREE.WebGLRenderer=function(a){function c(k,B,x){var p,A,F,H=k.vertices,K=H.length,C=k.colors,$=C.length,I=k.__vertexArray,la=k.__colorArray,Y=k.__sortArray,ua=k.__dirtyVertices,sa=k.__dirtyColors;if(x.sortParticles){Da.multiplySelf(x.matrixWorld);for(p=0;p<K;p++){A=H[p].position;Wa.copy(A);Da.multiplyVector3(Wa);Y[p]=[Wa.z,p]}Y.sort(function(Ea,ka){return ka[0]-Ea[0]});for(p=0;p<K;p++){A=H[Y[p][1]].position;F=p*3;I[F]=A.x;I[F+1]=A.y;I[F+2]=A.z}for(p=0;p<$;p++){F=p*3;color=C[Y[p][1]];la[F]=color.r;
+la[F+1]=color.g;la[F+2]=color.b}}else{if(ua)for(p=0;p<K;p++){A=H[p].position;F=p*3;I[F]=A.x;I[F+1]=A.y;I[F+2]=A.z}if(sa)for(p=0;p<$;p++){color=C[p];F=p*3;la[F]=color.r;la[F+1]=color.g;la[F+2]=color.b}}if(ua||x.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,k.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,I,B)}if(sa||x.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,k.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,la,B)}}function b(k,B){k.uniforms=Uniforms.clone(B.uniforms);k.vertexShader=B.vertexShader;
+k.fragmentShader=B.fragmentShader}function e(k,B,x,p,A){p.__webglProgram||ra.initMaterial(p,B,x,A);var F=p.program,H=F.uniforms,K=p.uniforms;if(F!=ya){d.useProgram(F);ya=F}d.uniformMatrix4fv(H.projectionMatrix,!1,Sa);if(x&&(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial||p instanceof THREE.LineBasicMaterial||p instanceof THREE.ParticleBasicMaterial)){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(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial||p.lights){var C,$,I=0,la=0,Y=0,ua,sa,Ea,ka,va=Ta,ha=va.directional.colors,ia=va.directional.positions,wa=va.point.colors,Qa=va.point.positions,Va=va.point.distances,eb=0,Ma=0;x=$=ka=0;for(C=B.length;x<C;x++){$=B[x];ua=$.color;sa=$.position;Ea=$.intensity;ka=$.distance;if($ instanceof THREE.AmbientLight){I+=ua.r;la+=ua.g;Y+=ua.b}else if($ instanceof
+THREE.DirectionalLight){ka=eb*3;ha[ka]=ua.r*Ea;ha[ka+1]=ua.g*Ea;ha[ka+2]=ua.b*Ea;ia[ka]=sa.x;ia[ka+1]=sa.y;ia[ka+2]=sa.z;eb+=1}else if($ instanceof THREE.PointLight){$=Ma*3;wa[$]=ua.r*Ea;wa[$+1]=ua.g*Ea;wa[$+2]=ua.b*Ea;Qa[$]=sa.x;Qa[$+1]=sa.y;Qa[$+2]=sa.z;Va[Ma]=ka;Ma+=1}}for(x=eb*3;x<ha.length;x++)ha[x]=0;for(x=Ma*3;x<wa.length;x++)wa[x]=0;va.point.length=Ma;va.directional.length=eb;va.ambient[0]=I;va.ambient[1]=la;va.ambient[2]=Y;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(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial){K.diffuse.value.setRGB(p.color.r,p.color.g,p.color.b);K.opacity.value=p.opacity;K.map.texture=p.map;K.lightMap.texture=p.lightMap;K.envMap.texture=
+p.envMap;K.reflectivity.value=p.reflectivity;K.refractionRatio.value=p.refractionRatio;K.combine.value=p.combine;K.useRefract.value=p.envMap&&p.envMap.mapping instanceof THREE.CubeRefractionMapping}if(p instanceof THREE.LineBasicMaterial){K.diffuse.value.setRGB(p.color.r,p.color.g,p.color.b);K.opacity.value=p.opacity}else if(p instanceof THREE.ParticleBasicMaterial){K.psColor.value.setRGB(p.color.r,p.color.g,p.color.b);K.opacity.value=p.opacity;K.size.value=p.size;K.scale.value=Z.height/2;K.map.texture=
+p.map}else if(p instanceof THREE.MeshPhongMaterial){K.ambient.value.setRGB(p.ambient.r,p.ambient.g,p.ambient.b);K.specular.value.setRGB(p.specular.r,p.specular.g,p.specular.b);K.shininess.value=p.shininess}else if(p instanceof THREE.MeshDepthMaterial){K.mNear.value=k.near;K.mFar.value=k.far;K.opacity.value=p.opacity}else if(p instanceof THREE.MeshNormalMaterial)K.opacity.value=p.opacity;for(var La in K)if(la=F.uniforms[La]){C=K[La];I=C.type;x=C.value;if(I=="i")d.uniform1i(la,x);else if(I=="f")d.uniform1f(la,
+x);else if(I=="fv1")d.uniform1fv(la,x);else if(I=="fv")d.uniform3fv(la,x);else if(I=="v2")d.uniform2f(la,x.x,x.y);else if(I=="v3")d.uniform3f(la,x.x,x.y,x.z);else if(I=="c")d.uniform3f(la,x.r,x.g,x.b);else if(I=="t"){d.uniform1i(la,x);if(C=C.texture)if(C.image instanceof Array&&C.image.length==6){if(C.image.length==6){if(C.needsUpdate){if(C.__webglInit){d.bindTexture(d.TEXTURE_CUBE_MAP,C.image.__webglTextureCube);for(I=0;I<6;++I)d.texSubImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,0,0,d.RGBA,d.UNSIGNED_BYTE,
+C.image[I])}else{C.image.__webglTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,C.image.__webglTextureCube);for(I=0;I<6;++I)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,C.image[I]);C.__webglInit=!0}N(d.TEXTURE_CUBE_MAP,C,C.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);C.needsUpdate=!1}d.activeTexture(d.TEXTURE0+x);d.bindTexture(d.TEXTURE_CUBE_MAP,C.image.__webglTextureCube)}}else O(C,x)}}d.uniformMatrix4fv(H.modelViewMatrix,!1,A._modelViewMatrixArray);
+d.uniformMatrix3fv(H.normalMatrix,!1,A._normalMatrixArray);(p instanceof THREE.MeshShaderMaterial||p instanceof THREE.MeshPhongMaterial||p.envMap)&&d.uniform3f(H.cameraPosition,k.position.x,k.position.y,k.position.z);(p instanceof THREE.MeshShaderMaterial||p.envMap||p.skinning)&&d.uniformMatrix4fv(H.objectMatrix,!1,A._objectMatrixArray);(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshShaderMaterial||p.skinning)&&d.uniformMatrix4fv(H.viewMatrix,
+!1,Xa);if(p instanceof THREE.ShadowVolumeDynamicMaterial){k=K.directionalLightDirection.value;k[0]=-B.position.x;k[1]=-B.position.y;k[2]=-B.position.z;d.uniform3fv(H.directionalLightDirection,k);d.uniformMatrix4fv(H.objectMatrix,!1,A._objectMatrixArray);d.uniformMatrix4fv(H.viewMatrix,!1,Xa)}if(p.skinning){d.uniformMatrix4fv(H.cameraInverseMatrix,!1,Xa);d.uniformMatrix4fv(H.boneGlobalMatrices,!1,A.boneMatrices)}return F}function f(k,B,x,p,A,F){if(p.opacity!=0){k=e(k,B,x,p,F).attributes;if(p.morphTargets){B=
+p.program.attributes;F.morphTargetBase!==-1?d.bindBuffer(d.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[F.morphTargetBase]):d.bindBuffer(d.ARRAY_BUFFER,A.__webglVertexBuffer);d.vertexAttribPointer(B.position,3,d.FLOAT,!1,0,0);if(F.morphTargetForcedOrder.length){x=0;for(var H=F.morphTargetForcedOrder,K=F.morphTargetInfluences;x<p.numSupportedMorphTargets&&x<H.length;){d.bindBuffer(d.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[H[x]]);d.vertexAttribPointer(B["morphTarget"+x],3,d.FLOAT,!1,0,0);F.__webglMorphTargetInfluences[x]=
+K[H[x]];x++}}else{H=[];var C=-1,$=0;K=F.morphTargetInfluences;var I,la=K.length;x=0;for(F.morphTargetBase!==-1&&(H[F.morphTargetBase]=!0);x<p.numSupportedMorphTargets;){for(I=0;I<la;I++)if(!H[I]&&K[I]>C){$=I;C=K[$]}d.bindBuffer(d.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[$]);d.vertexAttribPointer(B["morphTarget"+x],3,d.FLOAT,!1,0,0);F.__webglMorphTargetInfluences[x]=C;H[$]=1;C=-1;x++}}d.uniform1fv(p.program.uniforms.morphTargetInfluences,F.__webglMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,
+A.__webglVertexBuffer);d.vertexAttribPointer(k.position,3,d.FLOAT,!1,0,0)}if(k.color>=0){d.bindBuffer(d.ARRAY_BUFFER,A.__webglColorBuffer);d.vertexAttribPointer(k.color,3,d.FLOAT,!1,0,0)}if(k.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,A.__webglNormalBuffer);d.vertexAttribPointer(k.normal,3,d.FLOAT,!1,0,0)}if(k.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,A.__webglTangentBuffer);d.vertexAttribPointer(k.tangent,4,d.FLOAT,!1,0,0)}if(k.uv>=0)if(A.__webglUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,A.__webglUVBuffer);
+d.vertexAttribPointer(k.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(k.uv)}else d.disableVertexAttribArray(k.uv);if(k.uv2>=0)if(A.__webglUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,A.__webglUV2Buffer);d.vertexAttribPointer(k.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(k.uv2)}else d.disableVertexAttribArray(k.uv2);if(p.skinning&&k.skinVertexA>=0&&k.skinVertexB>=0&&k.skinIndex>=0&&k.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,A.__webglSkinVertexABuffer);d.vertexAttribPointer(k.skinVertexA,4,d.FLOAT,
+!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,A.__webglSkinVertexBBuffer);d.vertexAttribPointer(k.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,A.__webglSkinIndicesBuffer);d.vertexAttribPointer(k.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,A.__webglSkinWeightsBuffer);d.vertexAttribPointer(k.skinWeight,4,d.FLOAT,!1,0,0)}if(F instanceof THREE.Mesh)if(p.wireframe){d.lineWidth(p.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,A.__webglLineBuffer);d.drawElements(d.LINES,A.__webglLineCount,
+d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,A.__webglFaceBuffer);d.drawElements(d.TRIANGLES,A.__webglFaceCount,d.UNSIGNED_SHORT,0)}else if(F instanceof THREE.Line){F=F.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(p.linewidth);d.drawArrays(F,0,A.__webglLineCount)}else if(F instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,A.__webglParticleCount);else F instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,A.__webglVertexCount)}}function g(k,B){if(!k.__webglVertexBuffer)k.__webglVertexBuffer=
+d.createBuffer();if(!k.__webglNormalBuffer)k.__webglNormalBuffer=d.createBuffer();if(k.hasPos){d.bindBuffer(d.ARRAY_BUFFER,k.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,k.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(B.attributes.position);d.vertexAttribPointer(B.attributes.position,3,d.FLOAT,!1,0,0)}if(k.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,k.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,k.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(B.attributes.normal);d.vertexAttribPointer(B.attributes.normal,
+3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,k.count);k.count=0}function h(k){if(X!=k.doubleSided){k.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);X=k.doubleSided}if(qa!=k.flipSided){k.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);qa=k.flipSided}}function j(k){if(ea!=k){k?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);ea=k}}function m(k){ja[0].set(k.n41-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);ja[1].set(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);ja[2].set(k.n41+k.n21,k.n42+k.n22,
+k.n43+k.n23,k.n44+k.n24);ja[3].set(k.n41-k.n21,k.n42-k.n22,k.n43-k.n23,k.n44-k.n24);ja[4].set(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);ja[5].set(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);var B;for(k=0;k<6;k++){B=ja[k];B.divideScalar(Math.sqrt(B.x*B.x+B.y*B.y+B.z*B.z))}}function o(k){for(var B=k.matrixWorld,x=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),p=0;p<6;p++){k=ja[p].x*B.n14+ja[p].y*B.n24+ja[p].z*B.n34+ja[p].w;if(k<=x)return!1}return!0}function n(k,
+B){k.list[k.count]=B;k.count+=1}function t(k){var B,x,p=k.object,A=k.opaque,F=k.transparent;F.count=0;k=A.count=0;for(B=p.materials.length;k<B;k++){x=p.materials[k];x.opacity&&x.opacity<1||x.blending!=THREE.NormalBlending?n(F,x):n(A,x)}}function y(k){var B,x,p,A,F=k.object,H=k.buffer,K=k.opaque,C=k.transparent;C.count=0;k=K.count=0;for(p=F.materials.length;k<p;k++){B=F.materials[k];if(B instanceof THREE.MeshFaceMaterial){B=0;for(x=H.materials.length;B<x;B++)(A=H.materials[B])&&(A.opacity&&A.opacity<
+1||A.blending!=THREE.NormalBlending?n(C,A):n(K,A))}else{A=B;A.opacity&&A.opacity<1||A.blending!=THREE.NormalBlending?n(C,A):n(K,A)}}}function w(k,B){return B.z-k.z}function z(k){d.enable(d.POLYGON_OFFSET_FILL);d.polygonOffset(0.1,1);d.enable(d.STENCIL_TEST);d.depthMask(!1);d.colorMask(!1,!1,!1,!1);d.stencilFunc(d.ALWAYS,1,255);d.stencilOpSeparate(d.BACK,d.KEEP,d.INCR,d.KEEP);d.stencilOpSeparate(d.FRONT,d.KEEP,d.DECR,d.KEEP);var B,x=k.lights.length,p,A=k.lights,F=[],H,K,C,$,I,la=k.__webglShadowVolumes.length;
+for(B=0;B<x;B++){p=k.lights[B];if(p instanceof THREE.DirectionalLight){F[0]=-p.position.x;F[1]=-p.position.y;F[2]=-p.position.z;for(I=0;I<la;I++){p=k.__webglShadowVolumes[I].object;H=k.__webglShadowVolumes[I].buffer;K=p.materials[0];K.program||ra.initMaterial(K,A,undefined,p);K=K.program;C=K.uniforms;$=K.attributes;if(ya!==K){d.useProgram(K);ya=K;d.uniformMatrix4fv(C.projectionMatrix,!1,Sa);d.uniformMatrix4fv(C.viewMatrix,!1,Xa);d.uniform3fv(C.directionalLightDirection,F)}p.matrixWorld.flattenToArray(p._objectMatrixArray);
+d.uniformMatrix4fv(C.objectMatrix,!1,p._objectMatrixArray);d.bindBuffer(d.ARRAY_BUFFER,H.__webglVertexBuffer);d.vertexAttribPointer($.position,3,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,H.__webglNormalBuffer);d.vertexAttribPointer($.normal,3,d.FLOAT,!1,0,0);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,H.__webglFaceBuffer);d.cullFace(d.FRONT);d.drawElements(d.TRIANGLES,H.__webglFaceCount,d.UNSIGNED_SHORT,0);d.cullFace(d.BACK);d.drawElements(d.TRIANGLES,H.__webglFaceCount,d.UNSIGNED_SHORT,0)}}}d.disable(d.POLYGON_OFFSET_FILL);
+d.colorMask(!0,!0,!0,!0);d.stencilFunc(d.NOTEQUAL,0,255);d.stencilOp(d.KEEP,d.KEEP,d.KEEP);d.disable(d.DEPTH_TEST);za="";ya=ca.program;d.useProgram(ca.program);d.uniformMatrix4fv(ca.projectionLocation,!1,Sa);d.uniform1f(ca.darknessLocation,ca.darkness);d.bindBuffer(d.ARRAY_BUFFER,ca.vertexBuffer);d.vertexAttribPointer(ca.vertexLocation,3,d.FLOAT,!1,0,0);d.enableVertexAttribArray(ca.vertexLocation);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.blendEquation(d.FUNC_ADD);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,
+ca.elementBuffer);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0);d.disable(d.STENCIL_TEST);d.enable(d.DEPTH_TEST);d.depthMask(Ha)}function E(k,B){var x,p,A,F=k.__webglLensFlares.length,H,K,C;H=new THREE.Vector3;var $=fa/Ca;K=Ca*0.5;C=fa*0.5;var I=16/fa,la=[I*$,I],Y=[1,1,0];I=[1,1];var ua,sa=ga.readBackPixels,Ea,ka,va=ga.uniforms;x=ga.attributes;d.useProgram(ga.program);ya=ga.program;za="";d.uniform1i(va.map,0);d.activeTexture(d.TEXTURE0);d.uniform1f(va.opacity,1);d.uniform1f(va.rotation,0);d.uniform2fv(va.scale,
+la);d.bindBuffer(d.ARRAY_BUFFER,ga.vertexBuffer);d.vertexAttribPointer(x.vertex,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(x.uv,2,d.FLOAT,!1,16,8);d.bindTexture(d.TEXTURE_2D,ga.tempTexture);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,ga.elementBuffer);d.disable(d.CULL_FACE);d.depthMask(!1);for(A=0;A<F;A++){x=k.__webglLensFlares[A].object;H.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);B.matrixWorldInverse.multiplyVector3(H);p=H.z;B.projectionMatrix.multiplyVector3(H);Y[0]=H.x;Y[1]=H.y;Y[2]=H.z;
+I[0]=Y[0]*K+K;I[1]=Y[1]*C+C;d.copyTexSubImage2D(d.TEXTURE_2D,0,0,0,I[0]-8,I[1]-8,16,16);d.uniform3fv(va.screenPosition,Y);d.uniform1i(va.renderPink,1);d.enable(d.DEPTH_TEST);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0);try{d.readPixels(I[0]-8,I[1]-8,16,16,d.RGBA,d.UNSIGNED_BYTE,ga.readBackPixels)}catch(ha){console.log("WebGLRenderer.renderLensFlare: readPixels failed!")}d.getError()&&console.log("WebGLRenderer.renderLensFlare: readPixels failed!");sampleDistance=parseInt(5*(1-Math.max(0,Math.min(-p,
+B.far))/B.far),10)+2;p=sampleDistance*4;ua=sampleDistance*64;ka=0;Ea=28-p+(448-ua);ga.readBackPixels[Ea+0]===255&&ga.readBackPixels[Ea+1]===0&&ga.readBackPixels[Ea+2]===255&&(ka+=0.2);Ea=28+p+(448-ua);sa[Ea+0]===255&&sa[Ea+1]===0&&sa[Ea+2]===255&&(ka+=0.2);Ea=28+p+(448+ua);sa[Ea+0]===255&&sa[Ea+1]===0&&sa[Ea+2]===255&&(ka+=0.2);Ea=28-p+(448+ua);sa[Ea+0]===255&&sa[Ea+1]===0&&sa[Ea+2]===255&&(ka+=0.2);Ea=476;sa[Ea+0]===255&&sa[Ea+1]===0&&sa[Ea+2]===255&&(ka+=0.2);x.positionScreen.x=Y[0];x.positionScreen.y=
+Y[1];x.positionScreen.z=Y[2];x.customUpdateCallback?x.customUpdateCallback(ka,x):x.updateLensFlares(ka);d.uniform1i(va.renderPink,0);d.disable(d.DEPTH_TEST);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0)}for(A=0;A<F;A++){x=k.__webglLensFlares[A].object;H=0;for(K=x.lensFlares.length;H<K;H++){C=x.lensFlares[H];if(C.opacity>0.0010&&C.scale>0.0010){Y[0]=C.x;Y[1]=C.y;Y[2]=C.z;I=C.size*C.scale/fa;la[0]=I*$;la[1]=I;d.uniform3fv(va.screenPosition,Y);d.uniform1f(va.rotation,C.rotation);d.uniform2fv(va.scale,
+la);d.uniform1f(va.opacity,C.opacity);L(C.blending);O(C.texture,0);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0)}}}d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(Ha)}function G(k,B){k._modelViewMatrix.multiplyToArray(B.matrixWorldInverse,k.matrixWorld,k._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(k._modelViewMatrix).transposeIntoArray(k._normalMatrixArray)}function J(k){var B,x,p;if(k instanceof THREE.Mesh){x=k.geometry;for(B in x.geometryGroups){p=x.geometryGroups[B];if(x.__dirtyVertices||
+x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents){var A=d.DYNAMIC_DRAW,F=void 0,H=void 0,K=void 0,C=void 0;K=void 0;var $=void 0,I=void 0,la=void 0,Y=void 0,ua=void 0,sa=void 0,Ea=void 0,ka=void 0,va=void 0,ha=void 0,ia=void 0,wa=void 0,Qa=void 0;I=void 0;la=void 0;C=void 0;Y=void 0;C=void 0;ha=void 0;ia=void 0;I=void 0;ha=void 0;ia=void 0;wa=void 0;Qa=void 0;ha=void 0;ia=void 0;wa=void 0;Qa=void 0;ha=void 0;ia=void 0;wa=void 0;Qa=void 0;
+ha=void 0;ia=void 0;wa=void 0;C=void 0;Y=void 0;$=void 0;K=void 0;K=void 0;var Va=void 0,eb=void 0,Ma=void 0,La=0,Pa=0,cb=0,bb=0,$a=0,Za=0,Ka=0,Ya=0,Ua=0,R=0,Ba=0,Na=p.__vertexArray,gb=p.__uvArray,kb=p.__uv2Array,ab=p.__normalArray,Ia=p.__tangentArray,P=p.__colorArray,da=p.__skinVertexAArray,aa=p.__skinVertexBArray,T=p.__skinIndexArray,ta=p.__skinWeightArray,Ja=p.__morphTargetsArrays,pa=p.__faceArray,Q=p.__lineArray,Oa=p.__needsSmoothNormals;sa=p.__vertexColorType;ua=p.__uvType;Ea=p.__normalType;
+var Ra=k.geometry,db=Ra.__dirtyVertices,hb=Ra.__dirtyElements,jb=Ra.__dirtyUvs,fb=Ra.__dirtyNormals,ib=Ra.__dirtyTangents,sb=Ra.__dirtyColors,tb=Ra.__dirtyMorphTargets,ob=Ra.vertices,ub=p.faces,xb=Ra.faces,vb=Ra.faceVertexUvs[0],wb=Ra.faceVertexUvs[1],pb=Ra.skinVerticesA,qb=Ra.skinVerticesB,rb=Ra.skinIndices,mb=Ra.skinWeights,nb=Ra.edgeFaces,lb=Ra.morphTargets;F=0;for(H=ub.length;F<H;F++){K=ub[F];C=xb[K];vb&&(ka=vb[K]);wb&&(va=wb[K]);K=C.vertexNormals;$=C.normal;I=C.vertexColors;la=C.color;Y=C.vertexTangents;
+if(C instanceof THREE.Face3){if(db){ha=ob[C.a].position;ia=ob[C.b].position;wa=ob[C.c].position;Na[Pa]=ha.x;Na[Pa+1]=ha.y;Na[Pa+2]=ha.z;Na[Pa+3]=ia.x;Na[Pa+4]=ia.y;Na[Pa+5]=ia.z;Na[Pa+6]=wa.x;Na[Pa+7]=wa.y;Na[Pa+8]=wa.z;Pa+=9}if(tb){Va=0;for(eb=lb.length;Va<eb;Va++){ha=lb[Va].vertices[C.a].position;ia=lb[Va].vertices[C.b].position;wa=lb[Va].vertices[C.c].position;Ma=Ja[Va];Ma[Ba+0]=ha.x;Ma[Ba+1]=ha.y;Ma[Ba+2]=ha.z;Ma[Ba+3]=ia.x;Ma[Ba+4]=ia.y;Ma[Ba+5]=ia.z;Ma[Ba+6]=wa.x;Ma[Ba+7]=wa.y;Ma[Ba+8]=wa.z}Ba+=
+9}if(mb.length){ha=mb[C.a];ia=mb[C.b];wa=mb[C.c];ta[R]=ha.x;ta[R+1]=ha.y;ta[R+2]=ha.z;ta[R+3]=ha.w;ta[R+4]=ia.x;ta[R+5]=ia.y;ta[R+6]=ia.z;ta[R+7]=ia.w;ta[R+8]=wa.x;ta[R+9]=wa.y;ta[R+10]=wa.z;ta[R+11]=wa.w;ha=rb[C.a];ia=rb[C.b];wa=rb[C.c];T[R]=ha.x;T[R+1]=ha.y;T[R+2]=ha.z;T[R+3]=ha.w;T[R+4]=ia.x;T[R+5]=ia.y;T[R+6]=ia.z;T[R+7]=ia.w;T[R+8]=wa.x;T[R+9]=wa.y;T[R+10]=wa.z;T[R+11]=wa.w;ha=pb[C.a];ia=pb[C.b];wa=pb[C.c];da[R]=ha.x;da[R+1]=ha.y;da[R+2]=ha.z;da[R+3]=1;da[R+4]=ia.x;da[R+5]=ia.y;da[R+6]=ia.z;
+da[R+7]=1;da[R+8]=wa.x;da[R+9]=wa.y;da[R+10]=wa.z;da[R+11]=1;ha=qb[C.a];ia=qb[C.b];wa=qb[C.c];aa[R]=ha.x;aa[R+1]=ha.y;aa[R+2]=ha.z;aa[R+3]=1;aa[R+4]=ia.x;aa[R+5]=ia.y;aa[R+6]=ia.z;aa[R+7]=1;aa[R+8]=wa.x;aa[R+9]=wa.y;aa[R+10]=wa.z;aa[R+11]=1;R+=12}if(sb&&sa){if(I.length==3&&sa==THREE.VertexColors){C=I[0];ha=I[1];ia=I[2]}else ia=ha=C=la;P[Ua]=C.r;P[Ua+1]=C.g;P[Ua+2]=C.b;P[Ua+3]=ha.r;P[Ua+4]=ha.g;P[Ua+5]=ha.b;P[Ua+6]=ia.r;P[Ua+7]=ia.g;P[Ua+8]=ia.b;Ua+=9}if(ib&&Ra.hasTangents){I=Y[0];la=Y[1];C=Y[2];Ia[Ka]=
+I.x;Ia[Ka+1]=I.y;Ia[Ka+2]=I.z;Ia[Ka+3]=I.w;Ia[Ka+4]=la.x;Ia[Ka+5]=la.y;Ia[Ka+6]=la.z;Ia[Ka+7]=la.w;Ia[Ka+8]=C.x;Ia[Ka+9]=C.y;Ia[Ka+10]=C.z;Ia[Ka+11]=C.w;Ka+=12}if(fb&&Ea)if(K.length==3&&Oa)for(Y=0;Y<3;Y++){$=K[Y];ab[Za]=$.x;ab[Za+1]=$.y;ab[Za+2]=$.z;Za+=3}else for(Y=0;Y<3;Y++){ab[Za]=$.x;ab[Za+1]=$.y;ab[Za+2]=$.z;Za+=3}if(jb&&ka!==undefined&&ua)for(Y=0;Y<3;Y++){K=ka[Y];gb[cb]=K.u;gb[cb+1]=K.v;cb+=2}if(jb&&va!==undefined&&ua)for(Y=0;Y<3;Y++){K=va[Y];kb[bb]=K.u;kb[bb+1]=K.v;bb+=2}if(hb){pa[$a]=La;pa[$a+
+1]=La+1;pa[$a+2]=La+2;$a+=3;Q[Ya]=La;Q[Ya+1]=La+1;Q[Ya+2]=La;Q[Ya+3]=La+2;Q[Ya+4]=La+1;Q[Ya+5]=La+2;Ya+=6;La+=3}}else if(C instanceof THREE.Face4){if(db){ha=ob[C.a].position;ia=ob[C.b].position;wa=ob[C.c].position;Qa=ob[C.d].position;Na[Pa]=ha.x;Na[Pa+1]=ha.y;Na[Pa+2]=ha.z;Na[Pa+3]=ia.x;Na[Pa+4]=ia.y;Na[Pa+5]=ia.z;Na[Pa+6]=wa.x;Na[Pa+7]=wa.y;Na[Pa+8]=wa.z;Na[Pa+9]=Qa.x;Na[Pa+10]=Qa.y;Na[Pa+11]=Qa.z;Pa+=12}if(tb){Va=0;for(eb=lb.length;Va<eb;Va++){ha=lb[Va].vertices[C.a].position;ia=lb[Va].vertices[C.b].position;
+wa=lb[Va].vertices[C.c].position;Qa=lb[Va].vertices[C.d].position;Ma=Ja[Va];Ma[Ba+0]=ha.x;Ma[Ba+1]=ha.y;Ma[Ba+2]=ha.z;Ma[Ba+3]=ia.x;Ma[Ba+4]=ia.y;Ma[Ba+5]=ia.z;Ma[Ba+6]=wa.x;Ma[Ba+7]=wa.y;Ma[Ba+8]=wa.z;Ma[Ba+9]=Qa.x;Ma[Ba+10]=Qa.y;Ma[Ba+11]=Qa.z}Ba+=12}if(mb.length){ha=mb[C.a];ia=mb[C.b];wa=mb[C.c];Qa=mb[C.d];ta[R]=ha.x;ta[R+1]=ha.y;ta[R+2]=ha.z;ta[R+3]=ha.w;ta[R+4]=ia.x;ta[R+5]=ia.y;ta[R+6]=ia.z;ta[R+7]=ia.w;ta[R+8]=wa.x;ta[R+9]=wa.y;ta[R+10]=wa.z;ta[R+11]=wa.w;ta[R+12]=Qa.x;ta[R+13]=Qa.y;ta[R+14]=
+Qa.z;ta[R+15]=Qa.w;ha=rb[C.a];ia=rb[C.b];wa=rb[C.c];Qa=rb[C.d];T[R]=ha.x;T[R+1]=ha.y;T[R+2]=ha.z;T[R+3]=ha.w;T[R+4]=ia.x;T[R+5]=ia.y;T[R+6]=ia.z;T[R+7]=ia.w;T[R+8]=wa.x;T[R+9]=wa.y;T[R+10]=wa.z;T[R+11]=wa.w;T[R+12]=Qa.x;T[R+13]=Qa.y;T[R+14]=Qa.z;T[R+15]=Qa.w;ha=pb[C.a];ia=pb[C.b];wa=pb[C.c];Qa=pb[C.d];da[R]=ha.x;da[R+1]=ha.y;da[R+2]=ha.z;da[R+3]=1;da[R+4]=ia.x;da[R+5]=ia.y;da[R+6]=ia.z;da[R+7]=1;da[R+8]=wa.x;da[R+9]=wa.y;da[R+10]=wa.z;da[R+11]=1;da[R+12]=Qa.x;da[R+13]=Qa.y;da[R+14]=Qa.z;da[R+15]=
+1;ha=qb[C.a];ia=qb[C.b];wa=qb[C.c];C=qb[C.d];aa[R]=ha.x;aa[R+1]=ha.y;aa[R+2]=ha.z;aa[R+3]=1;aa[R+4]=ia.x;aa[R+5]=ia.y;aa[R+6]=ia.z;aa[R+7]=1;aa[R+8]=wa.x;aa[R+9]=wa.y;aa[R+10]=wa.z;aa[R+11]=1;aa[R+12]=C.x;aa[R+13]=C.y;aa[R+14]=C.z;aa[R+15]=1;R+=16}if(sb&&sa){if(I.length==4&&sa==THREE.VertexColors){C=I[0];ha=I[1];ia=I[2];I=I[3]}else I=ia=ha=C=la;P[Ua]=C.r;P[Ua+1]=C.g;P[Ua+2]=C.b;P[Ua+3]=ha.r;P[Ua+4]=ha.g;P[Ua+5]=ha.b;P[Ua+6]=ia.r;P[Ua+7]=ia.g;P[Ua+8]=ia.b;P[Ua+9]=I.r;P[Ua+10]=I.g;P[Ua+11]=I.b;Ua+=
+12}if(ib&&Ra.hasTangents){I=Y[0];la=Y[1];C=Y[2];Y=Y[3];Ia[Ka]=I.x;Ia[Ka+1]=I.y;Ia[Ka+2]=I.z;Ia[Ka+3]=I.w;Ia[Ka+4]=la.x;Ia[Ka+5]=la.y;Ia[Ka+6]=la.z;Ia[Ka+7]=la.w;Ia[Ka+8]=C.x;Ia[Ka+9]=C.y;Ia[Ka+10]=C.z;Ia[Ka+11]=C.w;Ia[Ka+12]=Y.x;Ia[Ka+13]=Y.y;Ia[Ka+14]=Y.z;Ia[Ka+15]=Y.w;Ka+=16}if(fb&&Ea)if(K.length==4&&Oa)for(Y=0;Y<4;Y++){$=K[Y];ab[Za]=$.x;ab[Za+1]=$.y;ab[Za+2]=$.z;Za+=3}else for(Y=0;Y<4;Y++){ab[Za]=$.x;ab[Za+1]=$.y;ab[Za+2]=$.z;Za+=3}if(jb&&ka!==undefined&&ua)for(Y=0;Y<4;Y++){K=ka[Y];gb[cb]=K.u;
+gb[cb+1]=K.v;cb+=2}if(jb&&va!==undefined&&ua)for(Y=0;Y<4;Y++){K=va[Y];kb[bb]=K.u;kb[bb+1]=K.v;bb+=2}if(hb){pa[$a]=La;pa[$a+1]=La+1;pa[$a+2]=La+3;pa[$a+3]=La+1;pa[$a+4]=La+2;pa[$a+5]=La+3;$a+=6;Q[Ya]=La;Q[Ya+1]=La+1;Q[Ya+2]=La;Q[Ya+3]=La+3;Q[Ya+4]=La+1;Q[Ya+5]=La+2;Q[Ya+6]=La+2;Q[Ya+7]=La+3;Ya+=8;La+=4}}}if(nb){F=0;for(H=nb.length;F<H;F++){pa[$a]=nb[F].a;pa[$a+1]=nb[F].b;pa[$a+2]=nb[F].c;pa[$a+3]=nb[F].a;pa[$a+4]=nb[F].c;pa[$a+5]=nb[F].d;$a+=6}}if(db){d.bindBuffer(d.ARRAY_BUFFER,p.__webglVertexBuffer);
+d.bufferData(d.ARRAY_BUFFER,Na,A)}if(tb){Va=0;for(eb=lb.length;Va<eb;Va++){d.bindBuffer(d.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[Va]);d.bufferData(d.ARRAY_BUFFER,Ja[Va],A)}}if(sb&&Ua>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,P,A)}if(fb){d.bindBuffer(d.ARRAY_BUFFER,p.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,ab,A)}if(ib&&Ra.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,p.__webglTangentBuffer);d.bufferData(d.ARRAY_BUFFER,Ia,A)}if(jb&&cb>0){d.bindBuffer(d.ARRAY_BUFFER,
+p.__webglUVBuffer);d.bufferData(d.ARRAY_BUFFER,gb,A)}if(jb&&bb>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webglUV2Buffer);d.bufferData(d.ARRAY_BUFFER,kb,A)}if(hb){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,pa,A);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Q,A)}if(R>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,da,A);d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinVertexBBuffer);
+d.bufferData(d.ARRAY_BUFFER,aa,A);d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,T,A);d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,ta,A)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(k instanceof THREE.Ribbon){x=k.geometry;if(x.__dirtyVertices||x.__dirtyColors){k=x;B=d.DYNAMIC_DRAW;Ea=k.vertices;A=k.colors;ka=Ea.length;
+F=A.length;va=k.__vertexArray;H=k.__colorArray;La=k.__dirtyColors;if(k.__dirtyVertices){for(ua=0;ua<ka;ua++){sa=Ea[ua].position;p=ua*3;va[p]=sa.x;va[p+1]=sa.y;va[p+2]=sa.z}d.bindBuffer(d.ARRAY_BUFFER,k.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,va,B)}if(La){for(ua=0;ua<F;ua++){color=A[ua];p=ua*3;H[p]=color.r;H[p+1]=color.g;H[p+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,k.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,H,B)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(k instanceof THREE.Line){x=
+k.geometry;if(x.__dirtyVertices||x.__dirtyColors){k=x;B=d.DYNAMIC_DRAW;Ea=k.vertices;A=k.colors;ka=Ea.length;F=A.length;va=k.__vertexArray;H=k.__colorArray;La=k.__dirtyColors;if(k.__dirtyVertices){for(ua=0;ua<ka;ua++){sa=Ea[ua].position;p=ua*3;va[p]=sa.x;va[p+1]=sa.y;va[p+2]=sa.z}d.bindBuffer(d.ARRAY_BUFFER,k.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,va,B)}if(La){for(ua=0;ua<F;ua++){color=A[ua];p=ua*3;H[p]=color.r;H[p+1]=color.g;H[p+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,k.__webglColorBuffer);
+d.bufferData(d.ARRAY_BUFFER,H,B)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem){x=k.geometry;(x.__dirtyVertices||x.__dirtyColors||k.sortParticles)&&c(x,d.DYNAMIC_DRAW,k);x.__dirtyVertices=!1;x.__dirtyColors=!1}}function S(k){function B(Y){var ua=[];x=0;for(p=Y.length;x<p;x++)Y[x]==undefined?ua.push("undefined"):ua.push(Y[x].id);return ua.join("_")}var x,p,A,F,H,K,C,$,I={},la=k.morphTargets!==undefined?k.morphTargets.length:0;k.geometryGroups={};A=0;for(F=k.faces.length;A<
+F;A++){H=k.faces[A];K=H.materials;C=B(K);I[C]==undefined&&(I[C]={hash:C,counter:0});$=I[C].hash+"_"+I[C].counter;k.geometryGroups[$]==undefined&&(k.geometryGroups[$]={faces:[],materials:K,vertices:0,numMorphTargets:la});H=H instanceof THREE.Face3?3:4;if(k.geometryGroups[$].vertices+H>65535){I[C].counter+=1;$=I[C].hash+"_"+I[C].counter;k.geometryGroups[$]==undefined&&(k.geometryGroups[$]={faces:[],materials:K,vertices:0,numMorphTargets:la})}k.geometryGroups[$].faces.push(A);k.geometryGroups[$].vertices+=
+H}}function D(k,B,x){k.push({buffer:B,object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(k){if(k!=za){switch(k){case THREE.AdditiveAlphaBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,
+d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD);d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}za=k}}function N(k,B,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){d.texParameteri(k,d.TEXTURE_WRAP_S,W(B.wrapS));d.texParameteri(k,d.TEXTURE_WRAP_T,W(B.wrapT));d.texParameteri(k,d.TEXTURE_MAG_FILTER,W(B.magFilter));d.texParameteri(k,d.TEXTURE_MIN_FILTER,W(B.minFilter));d.generateMipmap(k)}else{d.texParameteri(k,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);
+d.texParameteri(k,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(k,d.TEXTURE_MAG_FILTER,xa(B.magFilter));d.texParameteri(k,d.TEXTURE_MIN_FILTER,xa(B.minFilter))}}function O(k,B){if(k.needsUpdate){if(k.__webglInit){d.bindTexture(d.TEXTURE_2D,k.__webglTexture);d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,k.image)}else{k.__webglTexture=d.createTexture();d.bindTexture(d.TEXTURE_2D,k.__webglTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,k.image);k.__webglInit=!0}N(d.TEXTURE_2D,
+k,k.image);d.bindTexture(d.TEXTURE_2D,null);k.needsUpdate=!1}d.activeTexture(d.TEXTURE0+B);d.bindTexture(d.TEXTURE_2D,k.__webglTexture)}function Fa(k){if(k&&!k.__webglFramebuffer){k.__webglFramebuffer=d.createFramebuffer();k.__webglRenderbuffer=d.createRenderbuffer();k.__webglTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,k.__webglRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,k.width,k.height);d.bindTexture(d.TEXTURE_2D,k.__webglTexture);d.texParameteri(d.TEXTURE_2D,
+d.TEXTURE_WRAP_S,W(k.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,W(k.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,W(k.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,W(k.minFilter));d.texImage2D(d.TEXTURE_2D,0,W(k.format),k.width,k.height,0,W(k.format),W(k.type),null);d.bindFramebuffer(d.FRAMEBUFFER,k.__webglFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,k.__webglTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,
+d.RENDERBUFFER,k.__webglRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var B,x;if(k){B=k.__webglFramebuffer;x=k.width;k=k.height}else{B=null;x=Ca;k=fa}if(B!=Ga){d.bindFramebuffer(d.FRAMEBUFFER,B);d.viewport(U,ma,x,k);Ga=B}}function oa(k,B){var x;if(k=="fragment")x=d.createShader(d.FRAGMENT_SHADER);else k=="vertex"&&(x=d.createShader(d.VERTEX_SHADER));d.shaderSource(x,B);d.compileShader(x);if(!d.getShaderParameter(x,d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(x));
+console.error(B);return null}return x}function xa(k){switch(k){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function W(k){switch(k){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;
+case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;
+case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var d,Z=document.createElement("canvas"),ya=null,Ga=null,Ha=!0,ra=this,X=null,qa=null,za=null,ea=null,U=0,ma=0,Ca=0,fa=0,ja=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Da=new THREE.Matrix4,Sa=new Float32Array(16),Xa=new Float32Array(16),Wa=new THREE.Vector4,
+Ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},M=!0,V=!0,na=new THREE.Color(0),Aa=0;if(a){if(a.stencil!=undefined)M=a.stencil;if(a.antialias!==undefined)V=a.antialias;a.clearColor!==undefined&&na.setHex(a.clearColor);if(a.clearAlpha!==undefined)Aa=a.clearAlpha}this.maxMorphTargets=8;this.domElement=Z;this.autoClear=!0;this.sortObjects=!0;(function(k,B,x,p){try{if(!(d=Z.getContext("experimental-webgl",{antialias:k,stencil:p})))throw"Error creating WebGL context.";
+}catch(A){console.error(A)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(B.r,B.g,B.b,x)})(V,na,Aa,M);this.context=d;if(M){var ca={};ca.vertices=new Float32Array(12);ca.faces=new Uint16Array(6);ca.darkness=0.5;ca.vertices[0]=-2;ca.vertices[1]=-1;ca.vertices[2]=-1;ca.vertices[3]=2;ca.vertices[4]=-1;
+ca.vertices[5]=-1;ca.vertices[6]=2;ca.vertices[7]=1;ca.vertices[8]=-1;ca.vertices[9]=-2;ca.vertices[10]=1;ca.vertices[11]=-1;ca.faces[0]=0;ca.faces[1]=1;ca.faces[2]=2;ca.faces[3]=0;ca.faces[4]=2;ca.faces[5]=3;ca.vertexBuffer=d.createBuffer();ca.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,ca.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,ca.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,ca.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ca.faces,d.STATIC_DRAW);ca.program=
+d.createProgram();d.attachShader(ca.program,oa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));d.attachShader(ca.program,oa("vertex",THREE.ShaderLib.shadowPost.vertexShader));d.linkProgram(ca.program);ca.vertexLocation=d.getAttribLocation(ca.program,"position");ca.projectionLocation=d.getUniformLocation(ca.program,"projectionMatrix");ca.darknessLocation=d.getUniformLocation(ca.program,"darkness")}var ga={};ga.vertices=new Float32Array(16);ga.faces=new Uint16Array(6);ga.transparency=0.5;a=0;
+ga.vertices[a++]=-1;ga.vertices[a++]=-1;ga.vertices[a++]=0;ga.vertices[a++]=0;ga.vertices[a++]=1;ga.vertices[a++]=-1;ga.vertices[a++]=1;ga.vertices[a++]=0;ga.vertices[a++]=1;ga.vertices[a++]=1;ga.vertices[a++]=1;ga.vertices[a++]=1;ga.vertices[a++]=-1;ga.vertices[a++]=1;ga.vertices[a++]=0;ga.vertices[a++]=1;a=0;ga.faces[a++]=0;ga.faces[a++]=1;ga.faces[a++]=2;ga.faces[a++]=0;ga.faces[a++]=2;ga.faces[a++]=3;ga.vertexBuffer=d.createBuffer();ga.elementBuffer=d.createBuffer();ga.tempTexture=d.createTexture();
+ga.readBackPixels=new Uint8Array(1024);d.bindBuffer(d.ARRAY_BUFFER,ga.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,ga.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,ga.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ga.faces,d.STATIC_DRAW);d.bindTexture(d.TEXTURE_2D,ga.tempTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGB,16,16,0,d.RGB,d.UNSIGNED_BYTE,null);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_2D,
+d.TEXTURE_MAG_FILTER,d.NEAREST);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.NEAREST);ga.program=d.createProgram();d.attachShader(ga.program,oa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));d.attachShader(ga.program,oa("vertex",THREE.ShaderLib.lensFlare.vertexShader));d.linkProgram(ga.program);ga.attributes={};ga.uniforms={};ga.attributes.vertex=d.getAttribLocation(ga.program,"position");ga.attributes.uv=d.getAttribLocation(ga.program,"UV");ga.uniforms.map=d.getUniformLocation(ga.program,
+"map");ga.uniforms.opacity=d.getUniformLocation(ga.program,"opacity");ga.uniforms.scale=d.getUniformLocation(ga.program,"scale");ga.uniforms.rotation=d.getUniformLocation(ga.program,"rotation");ga.uniforms.screenPosition=d.getUniformLocation(ga.program,"screenPosition");ga.uniforms.renderPink=d.getUniformLocation(ga.program,"renderPink");this.setSize=function(k,B){Z.width=k;Z.height=B;this.setViewport(0,0,Z.width,Z.height)};this.setViewport=function(k,B,x,p){U=k;ma=B;Ca=x;fa=p;d.viewport(U,ma,Ca,
+fa)};this.setScissor=function(k,B,x,p){d.scissor(k,B,x,p)};this.enableScissorTest=function(k){k?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(k){Ha=k;d.depthMask(k)};this.setClearColorHex=function(k,B){var x=new THREE.Color(k);d.clearColor(x.r,x.g,x.b,B)};this.setClearColor=function(k,B){d.clearColor(k.r,k.g,k.b,B)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT|d.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(k){ca.darkness=
+k};this.initMaterial=function(k,B,x,p){var A,F,H,K;if(k instanceof THREE.MeshDepthMaterial)b(k,THREE.ShaderLib.depth);else if(k instanceof THREE.ShadowVolumeDynamicMaterial)b(k,THREE.ShaderLib.shadowVolumeDynamic);else if(k instanceof THREE.MeshNormalMaterial)b(k,THREE.ShaderLib.normal);else if(k instanceof THREE.MeshBasicMaterial)b(k,THREE.ShaderLib.basic);else if(k instanceof THREE.MeshLambertMaterial)b(k,THREE.ShaderLib.lambert);else if(k instanceof THREE.MeshPhongMaterial)b(k,THREE.ShaderLib.phong);
+else if(k instanceof THREE.LineBasicMaterial)b(k,THREE.ShaderLib.basic);else k instanceof THREE.ParticleBasicMaterial&&b(k,THREE.ShaderLib.particle_basic);if(!k.program){var C,$,I;C=I=K=0;for(H=B.length;C<H;C++){$=B[C];$ instanceof THREE.DirectionalLight&&I++;$ instanceof THREE.PointLight&&K++}if(K+I<=4)B=I;else{B=Math.ceil(4*I/(K+I));K=4-B}K={directional:B,point:K};B=50;if(p!==undefined&&p instanceof THREE.SkinnedMesh)B=p.bones.length;H={map:k.map,envMap:k.envMap,lightMap:k.lightMap,vertexColors:k.vertexColors,
+fog:x,sizeAttenuation:k.sizeAttenuation,skinning:k.skinning,morphTargets:k.morphTargets,maxDirLights:K.directional,maxPointLights:K.point,maxBones:B};x=k.fragmentShader;K=k.vertexShader;B=d.createProgram();C=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+H.maxDirLights,"#define MAX_POINT_LIGHTS "+H.maxPointLights,H.fog?"#define USE_FOG":"",H.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",H.map?"#define USE_MAP":"",H.envMap?"#define USE_ENVMAP":"",H.lightMap?"#define USE_LIGHTMAP":
+"",H.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");H=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+H.maxDirLights,"#define MAX_POINT_LIGHTS "+H.maxPointLights,"#define MAX_BONES "+H.maxBones,H.map?"#define USE_MAP":"",H.envMap?"#define USE_ENVMAP":"",H.lightMap?"#define USE_LIGHTMAP":"",H.vertexColors?"#define USE_COLOR":"",H.skinning?"#define USE_SKINNING":"",H.morphTargets?"#define USE_MORPHTARGETS":
+"",H.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+d.attachShader(B,oa("fragment",C+x));d.attachShader(B,oa("vertex",H+K));d.linkProgram(B);d.getProgramParameter(B,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(B,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");B.uniforms={};B.attributes={};k.program=B;x=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(A in k.uniforms)x.push(A);
+A=k.program;K=0;for(B=x.length;K<B;K++){C=x[K];A.uniforms[C]=d.getUniformLocation(A,C)}x=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(A=0;A<this.maxMorphTargets;A++)x.push("morphTarget"+A);for(F in k.attributes)x.push(F);F=k.program;A=x;x=0;for(K=A.length;x<K;x++){B=A[x];F.attributes[B]=d.getAttribLocation(F,B)}F=k.program.attributes;d.enableVertexAttribArray(F.position);F.color>=0&&d.enableVertexAttribArray(F.color);F.normal>=0&&d.enableVertexAttribArray(F.normal);
+F.tangent>=0&&d.enableVertexAttribArray(F.tangent);if(k.skinning&&F.skinVertexA>=0&&F.skinVertexB>=0&&F.skinIndex>=0&&F.skinWeight>=0){d.enableVertexAttribArray(F.skinVertexA);d.enableVertexAttribArray(F.skinVertexB);d.enableVertexAttribArray(F.skinIndex);d.enableVertexAttribArray(F.skinWeight)}if(k.morphTargets){k.numSupportedMorphTargets=0;if(F.morphTarget0>=0){d.enableVertexAttribArray(F.morphTarget0);k.numSupportedMorphTargets++}if(F.morphTarget1>=0){d.enableVertexAttribArray(F.morphTarget1);
+k.numSupportedMorphTargets++}if(F.morphTarget2>=0){d.enableVertexAttribArray(F.morphTarget2);k.numSupportedMorphTargets++}if(F.morphTarget3>=0){d.enableVertexAttribArray(F.morphTarget3);k.numSupportedMorphTargets++}if(F.morphTarget4>=0){d.enableVertexAttribArray(F.morphTarget4);k.numSupportedMorphTargets++}if(F.morphTarget5>=0){d.enableVertexAttribArray(F.morphTarget5);k.numSupportedMorphTargets++}if(F.morphTarget6>=0){d.enableVertexAttribArray(F.morphTarget6);k.numSupportedMorphTargets++}if(F.morphTarget7>=
+0){d.enableVertexAttribArray(F.morphTarget7);k.numSupportedMorphTargets++}p.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);A=0;for(F=this.maxMorphTargets;A<F;A++)p.__webglMorphTargetInfluences[A]=0}}k.__webglProgram=!0};this.render=function(k,B,x,p){var A,F,H,K,C,$,I,la,Y=k.lights,ua=k.fog;B.matrixAutoUpdate&&B.updateMatrix();k.update(undefined,!1,B);B.matrixWorldInverse.flattenToArray(Xa);B.projectionMatrix.flattenToArray(Sa);Da.multiply(B.projectionMatrix,B.matrixWorldInverse);
+m(Da);this.initWebGLObjects(k);Fa(x);(this.autoClear||p)&&this.clear();C=k.__webglObjects.length;for(p=0;p<C;p++){A=k.__webglObjects[p];I=A.object;if(I.visible)if(!(I instanceof THREE.Mesh)||o(I)){I.matrixWorld.flattenToArray(I._objectMatrixArray);G(I,B);y(A);A.render=!0;if(this.sortObjects){Wa.copy(I.position);Da.multiplyVector3(Wa);A.z=Wa.z}}else A.render=!1;else A.render=!1}this.sortObjects&&k.__webglObjects.sort(w);$=k.__webglObjectsImmediate.length;for(p=0;p<$;p++){A=k.__webglObjectsImmediate[p];
+I=A.object;if(I.visible){I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray);G(I,B);t(A)}}L(THREE.NormalBlending);for(p=0;p<C;p++){A=k.__webglObjects[p];if(A.render){I=A.object;la=A.buffer;H=A.opaque;h(I);for(A=0;A<H.count;A++){K=H.list[A];j(K.depthTest);f(B,Y,ua,K,la,I)}}}for(p=0;p<$;p++){A=k.__webglObjectsImmediate[p];I=A.object;if(I.visible){H=A.opaque;h(I);for(A=0;A<H.count;A++){K=H.list[A];j(K.depthTest);F=e(B,Y,ua,K,I);I.render(function(sa){g(sa,F)})}}}for(p=0;p<C;p++){A=
+k.__webglObjects[p];if(A.render){I=A.object;la=A.buffer;H=A.transparent;h(I);for(A=0;A<H.count;A++){K=H.list[A];L(K.blending);j(K.depthTest);f(B,Y,ua,K,la,I)}}}for(p=0;p<$;p++){A=k.__webglObjectsImmediate[p];I=A.object;if(I.visible){H=A.transparent;h(I);for(A=0;A<H.count;A++){K=H.list[A];L(K.blending);j(K.depthTest);F=e(B,Y,ua,K,I);I.render(function(sa){g(sa,F)})}}}M&&k.__webglShadowVolumes.length&&k.lights.length&&z(k);k.__webglLensFlares.length&&E(k,B);if(x&&x.minFilter!==THREE.NearestFilter&&x.minFilter!==
+THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,x.__webglTexture);d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}};this.initWebGLObjects=function(k){if(!k.__webglObjects){k.__webglObjects=[];k.__webglObjectsImmediate=[];k.__webglShadowVolumes=[];k.__webglLensFlares=[]}for(;k.__objectsAdded.length;){var B=k.__objectsAdded[0],x=k,p=void 0,A=void 0,F=void 0;if(B._modelViewMatrix==undefined){B._modelViewMatrix=new THREE.Matrix4;B._normalMatrixArray=new Float32Array(9);B._modelViewMatrixArray=
+new Float32Array(16);B._objectMatrixArray=new Float32Array(16);B.matrixWorld.flattenToArray(B._objectMatrixArray)}if(B instanceof THREE.Mesh){A=B.geometry;A.geometryGroups==undefined&&S(A);for(p in A.geometryGroups){F=A.geometryGroups[p];if(!F.__webglVertexBuffer){var H=F;H.__webglVertexBuffer=d.createBuffer();H.__webglNormalBuffer=d.createBuffer();H.__webglTangentBuffer=d.createBuffer();H.__webglColorBuffer=d.createBuffer();H.__webglUVBuffer=d.createBuffer();H.__webglUV2Buffer=d.createBuffer();H.__webglSkinVertexABuffer=
+d.createBuffer();H.__webglSkinVertexBBuffer=d.createBuffer();H.__webglSkinIndicesBuffer=d.createBuffer();H.__webglSkinWeightsBuffer=d.createBuffer();H.__webglFaceBuffer=d.createBuffer();H.__webglLineBuffer=d.createBuffer();if(H.numMorphTargets){var K=void 0,C=void 0;H.__webglMorphTargetsBuffers=[];K=0;for(C=H.numMorphTargets;K<C;K++)H.__webglMorphTargetsBuffers.push(d.createBuffer())}H=F;K=B;var $=void 0,I=void 0,la=void 0;la=void 0;var Y=C=0,ua=0;$=void 0;I=void 0;var sa=void 0;I=void 0;var Ea=K.geometry;
+sa=Ea.faces;var ka=H.faces;$=0;for(I=ka.length;$<I;$++){la=ka[$];la=sa[la];if(la instanceof THREE.Face3){C+=3;Y+=1;ua+=3}else if(la instanceof THREE.Face4){C+=4;Y+=2;ua+=4}}$=H;I=K;sa=void 0;ka=void 0;var va=void 0,ha=void 0;va=void 0;la=[];sa=0;for(ka=I.materials.length;sa<ka;sa++){va=I.materials[sa];if(va instanceof THREE.MeshFaceMaterial){va=0;for(l=$.materials.length;va<l;va++)(ha=$.materials[va])&&la.push(ha)}else(ha=va)&&la.push(ha)}I=la;a:{$=void 0;sa=void 0;ka=I.length;for($=0;$<ka;$++){sa=
+I[$];if(sa.map||sa.lightMap||sa instanceof THREE.MeshShaderMaterial){$=!0;break a}}$=!1}a:{sa=I;ka=void 0;la=void 0;va=sa.length;for(ka=0;ka<va;ka++){la=sa[ka];if(!(la instanceof THREE.MeshBasicMaterial&&!la.envMap||la instanceof THREE.MeshDepthMaterial)){sa=la&&la.shading!=undefined&&la.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}sa=!1}a:{ka=void 0;la=void 0;va=I.length;for(ka=0;ka<va;ka++){la=I[ka];if(la.vertexColors){I=la.vertexColors;break a}}I=!1}H.__vertexArray=
+new Float32Array(C*3);if(sa)H.__normalArray=new Float32Array(C*3);if(Ea.hasTangents)H.__tangentArray=new Float32Array(C*4);if(I)H.__colorArray=new Float32Array(C*3);if($){if(Ea.faceUvs.length>0||Ea.faceVertexUvs.length>0)H.__uvArray=new Float32Array(C*2);if(Ea.faceUvs.length>1||Ea.faceVertexUvs.length>1)H.__uv2Array=new Float32Array(C*2)}if(K.geometry.skinWeights.length&&K.geometry.skinIndices.length){H.__skinVertexAArray=new Float32Array(C*4);H.__skinVertexBArray=new Float32Array(C*4);H.__skinIndexArray=
+new Float32Array(C*4);H.__skinWeightArray=new Float32Array(C*4)}H.__faceArray=new Uint16Array(Y*3+(K.geometry.edgeFaces?K.geometry.edgeFaces.length*6:0));H.__lineArray=new Uint16Array(ua*2);if(H.numMorphTargets){Ea=void 0;ka=void 0;H.__morphTargetsArrays=[];Ea=0;for(ka=H.numMorphTargets;Ea<ka;Ea++)H.__morphTargetsArrays.push(new Float32Array(C*3))}H.__needsSmoothNormals=sa==THREE.SmoothShading;H.__uvType=$;H.__vertexColorType=I;H.__normalType=sa;H.__webglFaceCount=Y*3+(K.geometry.edgeFaces?K.geometry.edgeFaces.length*
+6:0);H.__webglLineCount=ua*2;A.__dirtyVertices=!0;A.__dirtyMorphTargets=!0;A.__dirtyElements=!0;A.__dirtyUvs=!0;A.__dirtyNormals=!0;A.__dirtyTangents=!0;A.__dirtyColors=!0}B instanceof THREE.ShadowVolume?D(x.__webglShadowVolumes,F,B):D(x.__webglObjects,F,B)}}else if(B instanceof THREE.LensFlare)D(x.__webglLensFlares,undefined,B);else if(B instanceof THREE.Ribbon){A=B.geometry;if(!A.__webglVertexBuffer){p=A;p.__webglVertexBuffer=d.createBuffer();p.__webglColorBuffer=d.createBuffer();p=A;F=p.vertices.length;
+p.__vertexArray=new Float32Array(F*3);p.__colorArray=new Float32Array(F*3);p.__webglVertexCount=F;A.__dirtyVertices=!0;A.__dirtyColors=!0}D(x.__webglObjects,A,B)}else if(B instanceof THREE.Line){A=B.geometry;if(!A.__webglVertexBuffer){p=A;p.__webglVertexBuffer=d.createBuffer();p.__webglColorBuffer=d.createBuffer();p=A;F=p.vertices.length;p.__vertexArray=new Float32Array(F*3);p.__colorArray=new Float32Array(F*3);p.__webglLineCount=F;A.__dirtyVertices=!0;A.__dirtyColors=!0}D(x.__webglObjects,A,B)}else if(B instanceof
+THREE.ParticleSystem){A=B.geometry;if(!A.__webglVertexBuffer){p=A;p.__webglVertexBuffer=d.createBuffer();p.__webglColorBuffer=d.createBuffer();p=A;F=p.vertices.length;p.__vertexArray=new Float32Array(F*3);p.__colorArray=new Float32Array(F*3);p.__sortArray=[];p.__webglParticleCount=F;A.__dirtyVertices=!0;A.__dirtyColors=!0}D(x.__webglObjects,A,B)}else THREE.MarchingCubes!==undefined&&B instanceof THREE.MarchingCubes&&x.__webglObjectsImmediate.push({object:B,opaque:{list:[],count:0},transparent:{list:[],
+count:0}});k.__objectsAdded.splice(0,1)}for(;k.__objectsRemoved.length;){B=k.__objectsRemoved[0];x=k;A=void 0;p=void 0;for(A=x.__webglObjects.length-1;A>=0;A--){p=x.__webglObjects[A].object;B==p&&x.__webglObjects.splice(A,1)}k.__objectsRemoved.splice(0,1)}B=0;for(x=k.__webglObjects.length;B<x;B++)J(k.__webglObjects[B].object,k);B=0;for(x=k.__webglShadowVolumes.length;B<x;B++)J(k.__webglShadowVolumes[B].object,k);B=0;for(x=k.__webglLensFlares.length;B<x;B++)J(k.__webglLensFlares[B].object,k)};this.setFaceCulling=
+function(k,B){if(k){!B||B=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(k=="back")d.cullFace(d.BACK);else k=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var e,f=b.length;for(e=0;e<f;e++){a=b[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var e,f=b.length;for(e=0;e<f;e++){a=b[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.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.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
-var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,e=a.vertices.length,f=b?c.geometry:c,g=a.vertices,h=f.vertices,j=a.faces,m=f.faces,o=a.faceVertexUvs[0];f=f.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var n=0,t=h.length;n<t;n++){var x=new THREE.Vertex(h[n].position.clone());b&&c.matrix.multiplyVector3(x.position);g.push(x)}n=0;for(t=m.length;n<t;n++){h=m[n];var w,A,F=h.vertexNormals;x=h.vertexColors;if(h instanceof THREE.Face3)w=new THREE.Face3(h.a+e,h.b+e,h.c+
-e);else h instanceof THREE.Face4&&(w=new THREE.Face4(h.a+e,h.b+e,h.c+e,h.d+e));w.normal.copy(h.normal);b=0;for(g=F.length;b<g;b++){A=F[b];w.vertexNormals.push(A.clone())}w.color.copy(h.color);b=0;for(g=x.length;b<g;b++){A=x[b];w.vertexColors.push(A.clone())}w.materials=h.materials.slice();w.centroid.copy(h.centroid);j.push(w)}n=0;for(t=f.length;n<t;n++){e=f[n];j=[];b=0;for(g=e.length;b<g;b++)j.push(new THREE.UV(e[b].u,e[b].v));o.push(j)}}},ImageUtils={loadTexture:function(a,c,b){var e=new Image,f=
-new THREE.Texture(e,c);e.onload=function(){f.needsUpdate=!0;b&&b(this)};e.src=a;return f},loadTextureCube:function(a,c,b){var e,f=[],g=new THREE.Texture(f,c);c=f.loadCount=0;for(e=a.length;c<e;++c){f[c]=new Image;f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;b&&b(this)};f[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,e){var f=new Worker(a);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);f.onmessage=function(h){function j(Aa,V){return V=="relativeToHTML"?
-Aa:g+"/"+Aa}function m(){for(w in Y.objects)if(!aa.objects[w]){O=Y.objects[w];if(R=aa.geometries[O.geometry]){na=[];for(oa=0;oa<O.materials.length;oa++)na[oa]=aa.materials[O.materials[oa]];z=O.position;r=O.rotation;q=O.quaternion;s=O.scale;q=0;na.length==0&&(na[0]=new THREE.MeshFaceMaterial);object=new THREE.Mesh(R,na);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=O.visible;aa.scene.addObject(object);aa.objects[w]=object}}}function o(Aa){return function(V){aa.geometries[Aa]=V;m();ya-=1;n()}}function n(){e({total_models:Fa,total_textures:sa,loaded_models:Fa-ya,loaded_textures:sa-Ea},aa);ya==0&&Ea==0&&b(aa)}var t,x,w,A,F,G,K,O,z,P,Q,R,Da,ha,na,Y,d,$,ya,Ea,Fa,sa,aa;Y=h.data;d=new THREE.BinaryLoader;$=new THREE.JSONLoader;Ea=ya=0;aa={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};h=function(){Ea-=
-1;n()};for(F in Y.cameras){P=Y.cameras[F];if(P.type=="perspective")Da=new THREE.Camera(P.fov,P.aspect,P.near,P.far);else if(P.type=="ortho"){Da=new THREE.Camera;Da.projectionMatrix=THREE.Matrix4.makeOrtho(P.left,P.right,P.top,P.bottom,P.near,P.far)}z=P.position;P=P.target;Da.position.set(z[0],z[1],z[2]);Da.target.position.set(P[0],P[1],P[2]);aa.cameras[F]=Da}for(A in Y.lights){F=Y.lights[A];Da=F.color!==undefined?F.color:16777215;P=F.intensity!==undefined?F.intensity:1;if(F.type=="directional"){z=
-F.direction;light=new THREE.DirectionalLight(Da,P);light.position.set(z[0],z[1],z[2]);light.position.normalize()}else if(F.type=="point"){z=F.position;light=new THREE.PointLight(Da,P);light.position.set(z[0],z[1],z[2])}aa.scene.addLight(light);aa.lights[A]=light}for(G in Y.fogs){A=Y.fogs[G];if(A.type=="linear")ha=new THREE.Fog(0,A.near,A.far);else A.type=="exp2"&&(ha=new THREE.FogExp2(0,A.density));P=A.color;ha.color.setRGB(P[0],P[1],P[2]);aa.fogs[G]=ha}if(aa.cameras&&Y.defaults.camera)aa.currentCamera=
-aa.cameras[Y.defaults.camera];if(aa.fogs&&Y.defaults.fog)aa.scene.fog=aa.fogs[Y.defaults.fog];P=Y.defaults.bgcolor;aa.bgColor=new THREE.Color;aa.bgColor.setRGB(P[0],P[1],P[2]);aa.bgColorAlpha=Y.defaults.bgalpha;for(t in Y.geometries){G=Y.geometries[t];if(G.type=="bin_mesh"||G.type=="ascii_mesh")ya+=1}Fa=ya;for(t in Y.geometries){G=Y.geometries[t];if(G.type=="cube"){R=new Cube(G.width,G.height,G.depth,G.segmentsWidth,G.segmentsHeight,G.segmentsDepth,null,G.flipped,G.sides);aa.geometries[t]=R}else if(G.type==
-"plane"){R=new Plane(G.width,G.height,G.segmentsWidth,G.segmentsHeight);aa.geometries[t]=R}else if(G.type=="sphere"){R=new Sphere(G.radius,G.segmentsWidth,G.segmentsHeight);aa.geometries[t]=R}else if(G.type=="cylinder"){R=new Cylinder(G.numSegs,G.topRad,G.botRad,G.height,G.topOffset,G.botOffset);aa.geometries[t]=R}else if(G.type=="torus"){R=new Torus(G.radius,G.tube,G.segmentsR,G.segmentsT);aa.geometries[t]=R}else if(G.type=="icosahedron"){R=new Icosahedron(G.subdivisions);aa.geometries[t]=R}else if(G.type==
-"bin_mesh")d.load({model:j(G.url,Y.urlBaseType),callback:o(t)});else G.type=="ascii_mesh"&&$.load({model:j(G.url,Y.urlBaseType),callback:o(t)})}for(K in Y.textures){t=Y.textures[K];Ea+=t.url instanceof Array?t.url.length:1}sa=Ea;for(K in Y.textures){t=Y.textures[K];if(t.mapping!=undefined&&THREE[t.mapping]!=undefined)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){G=[];for(var oa=0;oa<t.url.length;oa++)G[oa]=j(t.url[oa],Y.urlBaseType);G=ImageUtils.loadTextureCube(G,t.mapping,h)}else{G=ImageUtils.loadTexture(j(t.url,
-Y.urlBaseType),t.mapping,h);if(THREE[t.minFilter]!=undefined)G.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=undefined)G.magFilter=THREE[t.magFilter]}aa.textures[K]=G}for(x in Y.materials){K=Y.materials[x];for(Q in K.parameters)if(Q=="envMap"||Q=="map"||Q=="lightMap")K.parameters[Q]=aa.textures[K.parameters[Q]];else if(Q=="shading")K.parameters[Q]=K.parameters[Q]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(Q=="blending")K.parameters[Q]=THREE[K.parameters[Q]]?THREE[K.parameters[Q]]:
-THREE.NormalBlending;else Q=="combine"&&(K.parameters[Q]=K.parameters[Q]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);K=new THREE[K.type](K.parameters);aa.materials[x]=K}m();c(aa)}},addMesh:function(a,c,b,e,f,g,h,j,m,o){c=new THREE.Mesh(c,o);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=e;c.position.y=f;c.position.z=g;c.rotation.x=h;c.rotation.y=j;c.rotation.z=m;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var e=ShaderUtils.lib.cube;e.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,
+var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,e=a.vertices.length,f=b?c.geometry:c,g=a.vertices,h=f.vertices,j=a.faces,m=f.faces,o=a.faceVertexUvs[0];f=f.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var n=0,t=h.length;n<t;n++){var y=new THREE.Vertex(h[n].position.clone());b&&c.matrix.multiplyVector3(y.position);g.push(y)}n=0;for(t=m.length;n<t;n++){h=m[n];var w,z,E=h.vertexNormals;y=h.vertexColors;if(h instanceof THREE.Face3)w=new THREE.Face3(h.a+e,h.b+e,h.c+
+e);else h instanceof THREE.Face4&&(w=new THREE.Face4(h.a+e,h.b+e,h.c+e,h.d+e));w.normal.copy(h.normal);b=0;for(g=E.length;b<g;b++){z=E[b];w.vertexNormals.push(z.clone())}w.color.copy(h.color);b=0;for(g=y.length;b<g;b++){z=y[b];w.vertexColors.push(z.clone())}w.materials=h.materials.slice();w.centroid.copy(h.centroid);j.push(w)}n=0;for(t=f.length;n<t;n++){e=f[n];j=[];b=0;for(g=e.length;b<g;b++)j.push(new THREE.UV(e[b].u,e[b].v));o.push(j)}}},ImageUtils={loadTexture:function(a,c,b){var e=new Image,f=
+new THREE.Texture(e,c);e.onload=function(){f.needsUpdate=!0;b&&b(this)};e.src=a;return f},loadTextureCube:function(a,c,b){var e,f=[],g=new THREE.Texture(f,c);c=f.loadCount=0;for(e=a.length;c<e;++c){f[c]=new Image;f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;b&&b(this)};f[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,e){var f=new Worker(a);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);f.onmessage=function(h){function j(za,ea){return ea=="relativeToHTML"?
+za:g+"/"+za}function m(){for(w in W.objects)if(!X.objects[w]){S=W.objects[w];if(O=X.geometries[S.geometry]){xa=[];for(qa=0;qa<S.materials.length;qa++)xa[qa]=X.materials[S.materials[qa]];D=S.position;r=S.rotation;q=S.quaternion;s=S.scale;q=0;xa.length==0&&(xa[0]=new THREE.MeshFaceMaterial);object=new THREE.Mesh(O,xa);object.position.set(D[0],D[1],D[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);
+object.visible=S.visible;X.scene.addObject(object);X.objects[w]=object}}}function o(za){return function(ea){X.geometries[za]=ea;m();ya-=1;n()}}function n(){e({total_models:Ha,total_textures:ra,loaded_models:Ha-ya,loaded_textures:ra-Ga},X);ya==0&&Ga==0&&b(X)}var t,y,w,z,E,G,J,S,D,L,N,O,Fa,oa,xa,W,d,Z,ya,Ga,Ha,ra,X;W=h.data;d=new THREE.BinaryLoader;Z=new THREE.JSONLoader;Ga=ya=0;X={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};h=function(){Ga-=
+1;n()};for(E in W.cameras){L=W.cameras[E];if(L.type=="perspective")Fa=new THREE.Camera(L.fov,L.aspect,L.near,L.far);else if(L.type=="ortho"){Fa=new THREE.Camera;Fa.projectionMatrix=THREE.Matrix4.makeOrtho(L.left,L.right,L.top,L.bottom,L.near,L.far)}D=L.position;L=L.target;Fa.position.set(D[0],D[1],D[2]);Fa.target.position.set(L[0],L[1],L[2]);X.cameras[E]=Fa}for(z in W.lights){E=W.lights[z];Fa=E.color!==undefined?E.color:16777215;L=E.intensity!==undefined?E.intensity:1;if(E.type=="directional"){D=
+E.direction;light=new THREE.DirectionalLight(Fa,L);light.position.set(D[0],D[1],D[2]);light.position.normalize()}else if(E.type=="point"){D=E.position;light=new THREE.PointLight(Fa,L);light.position.set(D[0],D[1],D[2])}X.scene.addLight(light);X.lights[z]=light}for(G in W.fogs){z=W.fogs[G];if(z.type=="linear")oa=new THREE.Fog(0,z.near,z.far);else z.type=="exp2"&&(oa=new THREE.FogExp2(0,z.density));L=z.color;oa.color.setRGB(L[0],L[1],L[2]);X.fogs[G]=oa}if(X.cameras&&W.defaults.camera)X.currentCamera=
+X.cameras[W.defaults.camera];if(X.fogs&&W.defaults.fog)X.scene.fog=X.fogs[W.defaults.fog];L=W.defaults.bgcolor;X.bgColor=new THREE.Color;X.bgColor.setRGB(L[0],L[1],L[2]);X.bgColorAlpha=W.defaults.bgalpha;for(t in W.geometries){G=W.geometries[t];if(G.type=="bin_mesh"||G.type=="ascii_mesh")ya+=1}Ha=ya;for(t in W.geometries){G=W.geometries[t];if(G.type=="cube"){O=new Cube(G.width,G.height,G.depth,G.segmentsWidth,G.segmentsHeight,G.segmentsDepth,null,G.flipped,G.sides);X.geometries[t]=O}else if(G.type==
+"plane"){O=new Plane(G.width,G.height,G.segmentsWidth,G.segmentsHeight);X.geometries[t]=O}else if(G.type=="sphere"){O=new Sphere(G.radius,G.segmentsWidth,G.segmentsHeight);X.geometries[t]=O}else if(G.type=="cylinder"){O=new Cylinder(G.numSegs,G.topRad,G.botRad,G.height,G.topOffset,G.botOffset);X.geometries[t]=O}else if(G.type=="torus"){O=new Torus(G.radius,G.tube,G.segmentsR,G.segmentsT);X.geometries[t]=O}else if(G.type=="icosahedron"){O=new Icosahedron(G.subdivisions);X.geometries[t]=O}else if(G.type==
+"bin_mesh")d.load({model:j(G.url,W.urlBaseType),callback:o(t)});else G.type=="ascii_mesh"&&Z.load({model:j(G.url,W.urlBaseType),callback:o(t)})}for(J in W.textures){t=W.textures[J];Ga+=t.url instanceof Array?t.url.length:1}ra=Ga;for(J in W.textures){t=W.textures[J];if(t.mapping!=undefined&&THREE[t.mapping]!=undefined)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){G=[];for(var qa=0;qa<t.url.length;qa++)G[qa]=j(t.url[qa],W.urlBaseType);G=ImageUtils.loadTextureCube(G,t.mapping,h)}else{G=ImageUtils.loadTexture(j(t.url,
+W.urlBaseType),t.mapping,h);if(THREE[t.minFilter]!=undefined)G.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=undefined)G.magFilter=THREE[t.magFilter]}X.textures[J]=G}for(y in W.materials){J=W.materials[y];for(N in J.parameters)if(N=="envMap"||N=="map"||N=="lightMap")J.parameters[N]=X.textures[J.parameters[N]];else if(N=="shading")J.parameters[N]=J.parameters[N]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(N=="blending")J.parameters[N]=THREE[J.parameters[N]]?THREE[J.parameters[N]]:THREE.NormalBlending;
+else N=="combine"&&(J.parameters[N]=J.parameters[N]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);J=new THREE[J.type](J.parameters);X.materials[y]=J}m();c(X)}},addMesh:function(a,c,b,e,f,g,h,j,m,o){c=new THREE.Mesh(c,o);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=e;c.position.y=f;c.position.z=g;c.rotation.x=h;c.rotation.y=j;c.rotation.z=m;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var e=ShaderUtils.lib.cube;e.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,
 vertexShader:e.vertexShader,uniforms:e.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);return c},addPanoramaCube:function(a,c,b){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));
 vertexShader:e.vertexShader,uniforms:e.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);return c},addPanoramaCube:function(a,c,b){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));
 e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,e,!0),new THREE.MeshFaceMaterial);a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var e=c/2;c=new Plane(c,c);var f=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-e,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,e,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));
 e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,e,!0),new THREE.MeshFaceMaterial);a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var e=c/2;c=new Plane(c,c);var f=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-e,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,e,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));
 SceneUtils.addMesh(a,c,1,0,e,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,c,1,0,-e,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,e,f=a.children.length;for(e=0;e<f;e++){b=a.children[e];c(b);SceneUtils.traverseHierarchy(b,c)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",
 SceneUtils.addMesh(a,c,1,0,e,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,c,1,0,-e,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,e,f=a.children.length;for(e=0;e<f;e++){b=a.children[e];c(b);SceneUtils.traverseHierarchy(b,c)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",
@@ -354,42 +356,42 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,e,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;b=Array(g);for(c=e=0;c<g;++c){b[c]=Math.exp(-((c-f)*(c-f))/(2*a*a));e+=b[c]}for(c=0;c<g;++c)b[c]/=e;return b}};
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,e,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;b=Array(g);for(c=e=0;c<g;++c){b[c]=Math.exp(-((c-f)*(c-f))/(2*a*a));e+=b[c]}for(c=0;c<g;++c)b[c]/=e;return b}};
-THREE.QuakeCamera=function(a){function c(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
-a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
-this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=
+THREE.QuakeCamera=function(a){function c(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
+a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.activeLook!==undefined)this.activeLook=a.activeLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
+this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=
 !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
 !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
 !1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);
 !1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);
-var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;b=this.target.position;var e=this.position;b.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=e.y+100*Math.cos(this.phi);b.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
+var b=this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;b=this.target.position;var e=this.position;b.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=e.y+100*Math.cos(this.phi);b.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
 !1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
 !1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
 THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
 THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
-THREE.PathCamera=function(a){function c(o,n,t,x){var w={name:t,fps:0.6,length:x,hierarchy:[]},A,F=n.getControlPointsArray(),G=n.getLength(),K=F.length,O=0;A=K-1;n={parent:-1,keys:[]};n.keys[0]={time:0,pos:F[0],rot:[0,0,0,1],scl:[1,1,1]};n.keys[A]={time:x,pos:F[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<K-1;A++){O=x*G.chunks[A]/G.total;n.keys[A]={time:O,pos:F[A]}}w.hierarchy[0]=n;THREE.AnimationHandler.add(w);return new THREE.Animation(o,t,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(o,n){var t,
-x,w=new THREE.Geometry;for(t=0;t<o.points.length*n;t++){x=t/(o.points.length*n);x=o.getPoint(x);w.vertices[t]=new THREE.Vertex(new THREE.Vector3(x.x,x.y,x.z))}return w}function e(o,n){var t=b(n,10),x=b(n,10),w=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(t,w);particleObj=new THREE.ParticleSystem(x,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);x=new Sphere(1,
-16,8);w=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<n.points.length;i++){t=new THREE.Mesh(x,w);t.position.copy(n.points[i]);t.updateMatrix();o.addChild(t)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
+THREE.PathCamera=function(a){function c(o,n,t,y){var w={name:t,fps:0.6,length:y,hierarchy:[]},z,E=n.getControlPointsArray(),G=n.getLength(),J=E.length,S=0;z=J-1;n={parent:-1,keys:[]};n.keys[0]={time:0,pos:E[0],rot:[0,0,0,1],scl:[1,1,1]};n.keys[z]={time:y,pos:E[z],rot:[0,0,0,1],scl:[1,1,1]};for(z=1;z<J-1;z++){S=y*G.chunks[z]/G.total;n.keys[z]={time:S,pos:E[z]}}w.hierarchy[0]=n;THREE.AnimationHandler.add(w);return new THREE.Animation(o,t,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(o,n){var t,
+y,w=new THREE.Geometry;for(t=0;t<o.points.length*n;t++){y=t/(o.points.length*n);y=o.getPoint(y);w.vertices[t]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return w}function e(o,n){var t=b(n,10),y=b(n,10),w=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(t,w);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);w=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<n.points.length;i++){t=new THREE.Mesh(y,w);t.position.copy(n.points[i]);t.updateMatrix();o.addChild(t)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
 !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
-this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var f=Math.PI*2,g=Math.PI/180;this.update=function(o,n,t){var x,w;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;x=this.phi%f;this.phi=x>=0?x:x+f;x=this.verticalAngleMap.srcRange;w=this.verticalAngleMap.dstRange;
-this.phi=(this.phi-x[0])*(w[1]-w[0])/(x[1]-x[0])+w[0];x=this.horizontalAngleMap.srcRange;w=this.horizontalAngleMap.dstRange;this.theta=(this.theta-x[0])*(w[1]-w[0])/(x[1]-x[0])+w[0];x=this.target.position;x.x=100*Math.sin(this.phi)*Math.cos(this.theta);x.y=100*Math.cos(this.phi);x.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,o,n,t)};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 f=Math.PI*2,g=Math.PI/180;this.update=function(o,n,t){var y,w;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;y=this.phi%f;this.phi=y>=0?y:y+f;y=this.verticalAngleMap.srcRange;w=this.verticalAngleMap.dstRange;
+this.phi=(this.phi-y[0])*(w[1]-w[0])/(y[1]-y[0])+w[0];y=this.horizontalAngleMap.srcRange;w=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(w[1]-w[0])/(y[1]-y[0])+w[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,n,t)};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.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),j=new Cube(10,10,20),m=new Cube(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(m,h);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
 this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),j=new Cube(10,10,20),m=new Cube(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(m,h);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
 c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(o,n){return function(){n.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;
 c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(o,n){return function(){n.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(a,c,b,e,f,g,h,j,m){function o(G,K,O,z,P,Q,R,Da){var ha,na,Y=e||1,d=f||1,$=P/2,ya=Q/2,Ea=n.vertices.length;if(G=="x"&&K=="y"||G=="y"&&K=="x")ha="z";else if(G=="x"&&K=="z"||G=="z"&&K=="x"){ha="y";d=g||1}else if(G=="z"&&K=="y"||G=="y"&&K=="z"){ha="x";Y=g||1}var Fa=Y+1,sa=d+1;P/=Y;var aa=Q/d;for(na=0;na<sa;na++)for(Q=0;Q<Fa;Q++){var oa=new THREE.Vector3;oa[G]=(Q*P-$)*O;oa[K]=(na*aa-ya)*z;oa[ha]=R;n.vertices.push(new THREE.Vertex(oa))}for(na=0;na<d;na++)for(Q=0;Q<Y;Q++){n.faces.push(new THREE.Face4(Q+
-Fa*na+Ea,Q+Fa*(na+1)+Ea,Q+1+Fa*(na+1)+Ea,Q+1+Fa*na+Ea,null,null,Da));n.faceVertexUvs[0].push([new THREE.UV(Q/Y,na/d),new THREE.UV(Q/Y,(na+1)/d),new THREE.UV((Q+1)/Y,(na+1)/d),new THREE.UV((Q+1)/Y,na/d)])}}THREE.Geometry.call(this);var n=this,t=a/2,x=c/2,w=b/2;j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var A=0;A<6;A++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=undefined)for(var F in m)this.sides[F]!=
-undefined&&(this.sides[F]=m[F]);this.sides.px&&o("z","y",1*j,-1,b,c,-t,this.materials[0]);this.sides.nx&&o("z","y",-1*j,-1,b,c,t,this.materials[1]);this.sides.py&&o("x","z",1*j,1,a,b,x,this.materials[2]);this.sides.ny&&o("x","z",1*j,-1,a,b,-x,this.materials[3]);this.sides.pz&&o("x","y",1*j,-1,a,c,w,this.materials[4]);this.sides.nz&&o("x","y",-1*j,-1,a,c,-w,this.materials[5]);(function(){for(var G=[],K=[],O=0,z=n.vertices.length;O<z;O++){for(var P=n.vertices[O],Q=!1,R=0,Da=G.length;R<Da;R++){var ha=
-G[R];if(P.position.x==ha.position.x&&P.position.y==ha.position.y&&P.position.z==ha.position.z){K[O]=R;Q=!0;break}}if(!Q){K[O]=G.length;G.push(new THREE.Vertex(P.position.clone()))}}O=0;for(z=n.faces.length;O<z;O++){P=n.faces[O];P.a=K[P.a];P.b=K[P.b];P.c=K[P.c];P.d=K[P.d]}n.vertices=G})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
-var Cylinder=function(a,c,b,e,f,g){function h(n,t,x){j.vertices.push(new THREE.Vertex(new THREE.Vector3(n,t,x)))}THREE.Geometry.call(this);var j=this,m=Math.PI,o=e/2;for(e=0;e<a;e++)h(Math.sin(2*m*e/a)*c,Math.cos(2*m*e/a)*c,-o);for(e=0;e<a;e++)h(Math.sin(2*m*e/a)*b,Math.cos(2*m*e/a)*b,o);for(e=0;e<a;e++)j.faces.push(new THREE.Face4(e,e+a,a+(e+1)%a,(e+1)%a));if(b>0){h(0,0,-o-(g||0));for(e=a;e<a+a/2;e++)j.faces.push(new THREE.Face4(2*a,(2*e-2*a)%a,(2*e-2*a+1)%a,(2*e-2*a+2)%a))}if(c>0){h(0,0,o+(f||0));
+var Cube=function(a,c,b,e,f,g,h,j,m){function o(G,J,S,D,L,N,O,Fa){var oa,xa,W=e||1,d=f||1,Z=L/2,ya=N/2,Ga=n.vertices.length;if(G=="x"&&J=="y"||G=="y"&&J=="x")oa="z";else if(G=="x"&&J=="z"||G=="z"&&J=="x"){oa="y";d=g||1}else if(G=="z"&&J=="y"||G=="y"&&J=="z"){oa="x";W=g||1}var Ha=W+1,ra=d+1;L/=W;var X=N/d;for(xa=0;xa<ra;xa++)for(N=0;N<Ha;N++){var qa=new THREE.Vector3;qa[G]=(N*L-Z)*S;qa[J]=(xa*X-ya)*D;qa[oa]=O;n.vertices.push(new THREE.Vertex(qa))}for(xa=0;xa<d;xa++)for(N=0;N<W;N++){n.faces.push(new THREE.Face4(N+
+Ha*xa+Ga,N+Ha*(xa+1)+Ga,N+1+Ha*(xa+1)+Ga,N+1+Ha*xa+Ga,null,null,Fa));n.faceVertexUvs[0].push([new THREE.UV(N/W,xa/d),new THREE.UV(N/W,(xa+1)/d),new THREE.UV((N+1)/W,(xa+1)/d),new THREE.UV((N+1)/W,xa/d)])}}THREE.Geometry.call(this);var n=this,t=a/2,y=c/2,w=b/2;j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var z=0;z<6;z++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=undefined)for(var E in m)this.sides[E]!=
+undefined&&(this.sides[E]=m[E]);this.sides.px&&o("z","y",1*j,-1,b,c,-t,this.materials[0]);this.sides.nx&&o("z","y",-1*j,-1,b,c,t,this.materials[1]);this.sides.py&&o("x","z",1*j,1,a,b,y,this.materials[2]);this.sides.ny&&o("x","z",1*j,-1,a,b,-y,this.materials[3]);this.sides.pz&&o("x","y",1*j,-1,a,c,w,this.materials[4]);this.sides.nz&&o("x","y",-1*j,-1,a,c,-w,this.materials[5]);(function(){for(var G=[],J=[],S=0,D=n.vertices.length;S<D;S++){for(var L=n.vertices[S],N=!1,O=0,Fa=G.length;O<Fa;O++){var oa=
+G[O];if(L.position.x==oa.position.x&&L.position.y==oa.position.y&&L.position.z==oa.position.z){J[S]=O;N=!0;break}}if(!N){J[S]=G.length;G.push(new THREE.Vertex(L.position.clone()))}}S=0;for(D=n.faces.length;S<D;S++){L=n.faces[S];L.a=J[L.a];L.b=J[L.b];L.c=J[L.c];L.d=J[L.d]}n.vertices=G})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+var Cylinder=function(a,c,b,e,f,g){function h(n,t,y){j.vertices.push(new THREE.Vertex(new THREE.Vector3(n,t,y)))}THREE.Geometry.call(this);var j=this,m=Math.PI,o=e/2;for(e=0;e<a;e++)h(Math.sin(2*m*e/a)*c,Math.cos(2*m*e/a)*c,-o);for(e=0;e<a;e++)h(Math.sin(2*m*e/a)*b,Math.cos(2*m*e/a)*b,o);for(e=0;e<a;e++)j.faces.push(new THREE.Face4(e,e+a,a+(e+1)%a,(e+1)%a));if(b>0){h(0,0,-o-(g||0));for(e=a;e<a+a/2;e++)j.faces.push(new THREE.Face4(2*a,(2*e-2*a)%a,(2*e-2*a+1)%a,(2*e-2*a+2)%a))}if(c>0){h(0,0,o+(f||0));
 for(e=a+a/2;e<2*a;e++)j.faces.push(new THREE.Face4(2*a+1,(2*e-2*a+2)%a+a,(2*e-2*a+1)%a+a,(2*e-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
 for(e=a+a/2;e<2*a;e++)j.faces.push(new THREE.Face4(2*a+1,(2*e-2*a+2)%a+a,(2*e-2*a+1)%a+a,(2*e-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
-var Icosahedron=function(a){function c(t,x,w){var A=Math.sqrt(t*t+x*x+w*w);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(t/A,x/A,w/A)))-1}function b(t,x,w,A){A.faces.push(new THREE.Face3(t,x,w))}function e(t,x){var w=f.vertices[t].position,A=f.vertices[x].position;return c((w.x+A.x)/2,(w.y+A.y)/2,(w.z+A.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
+var Icosahedron=function(a){function c(t,y,w){var z=Math.sqrt(t*t+y*y+w*w);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(t/z,y/z,w/z)))-1}function b(t,y,w,z){z.faces.push(new THREE.Face3(t,y,w))}function e(t,y){var w=f.vertices[t].position,z=f.vertices[y].position;return c((w.x+z.x)/2,(w.y+z.y)/2,(w.z+z.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
 1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var m=e(g.faces[j].a,g.faces[j].b),o=e(g.faces[j].b,g.faces[j].c),n=e(g.faces[j].c,g.faces[j].a);b(g.faces[j].a,m,n,h);b(g.faces[j].b,o,m,h);b(g.faces[j].c,
 1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var m=e(g.faces[j].a,g.faces[j].b),o=e(g.faces[j].b,g.faces[j].c),n=e(g.faces[j].c,g.faces[j].a);b(g.faces[j].a,m,n,h);b(g.faces[j].b,o,m,h);b(g.faces[j].c,
 n,o,h);b(m,o,n,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
 n,o,h);b(m,o,n,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
 function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var e=[],f=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));e[j]=a[j].clone();f[j]=this.vertices.length-1}for(var m=(new THREE.Matrix4).setRotationZ(c),o=0;o<=this.angle+0.0010;o+=c){for(j=0;j<e.length;j++)if(o<this.angle){e[j]=m.multiplyVector3(e[j].clone());this.vertices.push(new THREE.Vertex(e[j]));g[j]=this.vertices.length-1}else g=h;o==0&&(h=f);for(j=
 function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var e=[],f=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));e[j]=a[j].clone();f[j]=this.vertices.length-1}for(var m=(new THREE.Matrix4).setRotationZ(c),o=0;o<=this.angle+0.0010;o+=c){for(j=0;j<e.length;j++)if(o<this.angle){e[j]=m.multiplyVector3(e[j].clone());this.vertices.push(new THREE.Vertex(e[j]));g[j]=this.vertices.length-1}else g=h;o==0&&(h=f);for(j=
 0;j<f.length-1;j++){this.faces.push(new THREE.Face4(g[j],g[j+1],f[j+1],f[j]));this.faceVertexUvs[0].push([new THREE.UV(o/b,j/a.length),new THREE.UV(o/b,(j+1)/a.length),new THREE.UV((o-c)/b,(j+1)/a.length),new THREE.UV((o-c)/b,j/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
 0;j<f.length-1;j++){this.faces.push(new THREE.Face4(g[j],g[j+1],f[j+1],f[j]));this.faceVertexUvs[0].push([new THREE.UV(o/b,j/a.length),new THREE.UV(o/b,(j+1)/a.length),new THREE.UV((o-c)/b,(j+1)/a.length),new THREE.UV((o-c)/b,j/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
 var Plane=function(a,c,b,e){THREE.Geometry.call(this);var f,g=a/2,h=c/2;b=b||1;e=e||1;var j=b+1,m=e+1;a/=b;var o=c/e;for(f=0;f<m;f++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(f*o-h),0)));for(f=0;f<e;f++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+j*f,c+j*(f+1),c+1+j*(f+1),c+1+j*f));this.faceVertexUvs[0].push([new THREE.UV(c/b,f/e),new THREE.UV(c/b,(f+1)/e),new THREE.UV((c+1)/b,(f+1)/e),new THREE.UV((c+1)/b,f/e)])}this.computeCentroids();this.computeFaceNormals()};
 var Plane=function(a,c,b,e){THREE.Geometry.call(this);var f,g=a/2,h=c/2;b=b||1;e=e||1;var j=b+1,m=e+1;a/=b;var o=c/e;for(f=0;f<m;f++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(f*o-h),0)));for(f=0;f<e;f++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+j*f,c+j*(f+1),c+1+j*(f+1),c+1+j*f));this.faceVertexUvs[0].push([new THREE.UV(c/b,f/e),new THREE.UV(c/b,(f+1)/e),new THREE.UV((c+1)/b,(f+1)/e),new THREE.UV((c+1)/b,f/e)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
-var Sphere=function(a,c,b){THREE.Geometry.call(this);var e,f=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){e=b/h;var j=a*Math.cos(e*f),m=a*Math.sin(e*f),o=[],n=0;for(e=0;e<g;e++){var t=2*e/g,x=m*Math.sin(t*f);t=m*Math.cos(t*f);(b==0||b==h)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,j,x)))-1);o.push(n)}c.push(o)}var w,A,F;f=c.length;for(b=0;b<f;b++){g=c[b].length;if(b>0)for(e=0;e<g;e++){o=e==g-1;h=c[b][o?0:e+1];j=c[b][o?g-1:e];m=c[b-1][o?g-1:e];o=c[b-1][o?
-0:e+1];x=b/(f-1);w=(b-1)/(f-1);A=(e+1)/g;t=e/g;n=new THREE.UV(1-A,x);x=new THREE.UV(1-t,x);t=new THREE.UV(1-t,w);var G=new THREE.UV(1-A,w);if(b<c.length-1){w=this.vertices[h].position.clone();A=this.vertices[j].position.clone();F=this.vertices[m].position.clone();w.normalize();A.normalize();F.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([n,x,t])}if(b>1){w=this.vertices[h].position.clone();
-A=this.vertices[m].position.clone();F=this.vertices[o].position.clone();w.normalize();A.normalize();F.normalize();this.faces.push(new THREE.Face3(h,m,o,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([n,t,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
+var Sphere=function(a,c,b){THREE.Geometry.call(this);var e,f=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){e=b/h;var j=a*Math.cos(e*f),m=a*Math.sin(e*f),o=[],n=0;for(e=0;e<g;e++){var t=2*e/g,y=m*Math.sin(t*f);t=m*Math.cos(t*f);(b==0||b==h)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,j,y)))-1);o.push(n)}c.push(o)}var w,z,E;f=c.length;for(b=0;b<f;b++){g=c[b].length;if(b>0)for(e=0;e<g;e++){o=e==g-1;h=c[b][o?0:e+1];j=c[b][o?g-1:e];m=c[b-1][o?g-1:e];o=c[b-1][o?
+0:e+1];y=b/(f-1);w=(b-1)/(f-1);z=(e+1)/g;t=e/g;n=new THREE.UV(1-z,y);y=new THREE.UV(1-t,y);t=new THREE.UV(1-t,w);var G=new THREE.UV(1-z,w);if(b<c.length-1){w=this.vertices[h].position.clone();z=this.vertices[j].position.clone();E=this.vertices[m].position.clone();w.normalize();z.normalize();E.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(E.x,E.y,E.z)]));this.faceVertexUvs[0].push([n,y,t])}if(b>1){w=this.vertices[h].position.clone();
+z=this.vertices[m].position.clone();E=this.vertices[o].position.clone();w.normalize();z.normalize();E.normalize();this.faces.push(new THREE.Face3(h,m,o,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(E.x,E.y,E.z)]));this.faceVertexUvs[0].push([n,t,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
 var Torus=function(a,c,b,e){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){e=b/this.segmentsT*2*Math.PI;var f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
 var Torus=function(a,c,b,e){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){e=b/this.segmentsT*2*Math.PI;var f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
 1;b<=this.segmentsT;++b){e=(this.segmentsT+1)*c+b;f=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(e,f,g,h));this.faceVertexUvs[0].push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
 1;b<=this.segmentsT;++b){e=(this.segmentsT+1)*c+b;f=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(e,f,g,h));this.faceVertexUvs[0].push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
-var TorusKnot=function(a,c,b,e,f,g,h){function j(t,x,w,A,F,G){x=w/A*t;w=Math.cos(x);return new THREE.Vector3(F*(2+w)*0.5*Math.cos(t),F*(2+w)*Math.sin(t)*0.5,G*F*Math.sin(x)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=f||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var m=
+var TorusKnot=function(a,c,b,e,f,g,h){function j(t,y,w,z,E,G){y=w/z*t;w=Math.cos(y);return new THREE.Vector3(E*(2+w)*0.5*Math.cos(t),E*(2+w)*Math.sin(t)*0.5,G*E*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=f||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var m=
 a/this.segmentsR*2*this.p*Math.PI;h=c/this.segmentsT*2*Math.PI;f=j(m,h,this.q,this.p,this.radius,this.heightScale);m=j(m+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=m.x-f.x;b.y=m.y-f.y;b.z=m.z-f.z;e.x=m.x+f.x;e.y=m.y+f.y;e.z=m.z+f.z;g.cross(b,e);e.cross(g,b);g.normalize();e.normalize();m=this.tube*Math.cos(h);h=this.tube*Math.sin(h);f.x+=m*e.x+h*g.x;f.y+=m*e.y+h*g.y;f.z+=m*e.z+h*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
 a/this.segmentsR*2*this.p*Math.PI;h=c/this.segmentsT*2*Math.PI;f=j(m,h,this.q,this.p,this.radius,this.heightScale);m=j(m+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=m.x-f.x;b.y=m.y-f.y;b.z=m.z-f.z;e.x=m.x+f.x;e.y=m.y+f.y;e.z=m.z+f.z;g.cross(b,e);e.cross(g,b);g.normalize();e.normalize();m=this.tube*Math.cos(h);h=this.tube*Math.sin(h);f.x+=m*e.x+h*g.x;f.y+=m*e.y+h*g.y;f.z+=m*e.z+h*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
 0;c<this.segmentsT;++c){g=(a+1)%this.segmentsR;h=(c+1)%this.segmentsT;f=this.grid[a][c];b=this.grid[g][c];e=this.grid[a][h];g=this.grid[g][h];h=new THREE.UV(a/this.segmentsR,c/this.segmentsT);m=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var o=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(f,b,e));this.faceVertexUvs[0].push([h,m,o]);this.faces.push(new THREE.Face3(g,e,b));this.faceVertexUvs[0].push([n,
 0;c<this.segmentsT;++c){g=(a+1)%this.segmentsR;h=(c+1)%this.segmentsT;f=this.grid[a][c];b=this.grid[g][c];e=this.grid[a][h];g=this.grid[g][h];h=new THREE.UV(a/this.segmentsR,c/this.segmentsT);m=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var o=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(f,b,e));this.faceVertexUvs[0].push([h,m,o]);this.faces.push(new THREE.Face3(g,e,b));this.faceVertexUvs[0].push([n,
 o,m])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 o,m])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
@@ -398,40 +400,41 @@ this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.p
 Math.LN2));j.image.width=n;j.image.height=t;j.image.getContext("2d").drawImage(this,0,0,n,t)}else j.image=this;j.needsUpdate=!0};o.src=m}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1,wireframe:a.wireframe};if(a.shading)if(a.shading=="Phong")f="MeshPhongMaterial";else a.shading=="Basic"&&(f="MeshBasicMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;
 Math.LN2));j.image.width=n;j.image.height=t;j.image.getContext("2d").drawImage(this,0,0,n,t)}else j.image=this;j.needsUpdate=!0};o.src=m}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1,wireframe:a.wireframe};if(a.shading)if(a.shading=="Phong")f="MeshPhongMaterial";else a.shading=="Basic"&&(f="MeshBasicMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;
 e(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;e(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[f](g)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;
 e(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;e(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[f](g)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;
 THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var c=this,b=a.model,e=a.callback,f=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(g){c.createModel(g.data,e,f);c.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
 THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var c=this,b=a.model,e=a.callback,f=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(g){c.createModel(g.data,e,f);c.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry;this.init_materials(e,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var f,g,h,j,m,o,n,t,x,w,A=a.faces;t=a.vertices;var F=a.normals,G=a.colors,K=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&K++;for(f=0;f<K;f++){e.faceUvs[f]=[];e.faceVertexUvs[f]=[]}j=0;for(m=t.length;j<m;){x=new THREE.Vertex;x.position.x=t[j++];x.position.y=t[j++];x.position.z=t[j++];e.vertices.push(x)}j=
-0;for(m=A.length;j<m;){o=A[j++];n=o&1;h=o&2;f=o&4;g=o&8;t=o&16;x=o&32;w=o&64;o&=128;if(n){n=new THREE.Face4;n.a=A[j++];n.b=A[j++];n.c=A[j++];n.d=A[j++];nVertices=4}else{n=new THREE.Face3;n.a=A[j++];n.b=A[j++];n.c=A[j++];nVertices=3}if(h){materialIndex=A[j++];n.materials=e.materials[materialIndex]}h=e.faces.length;if(f)for(f=0;f<K;f++){uvLayer=a.uvs[f];uvIndex=A[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];e.faceUvs[f][h]=new THREE.UV(u,v)}if(g)for(f=0;f<K;f++){uvLayer=a.uvs[f];uvs=[];for(g=0;g<
-nVertices;g++){uvIndex=A[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[g]=new THREE.UV(u,v)}e.faceVertexUvs[f][h]=uvs}if(t){normalIndex=A[j++]*3;normal=new THREE.Vector3;normal.x=F[normalIndex++];normal.y=F[normalIndex++];normal.z=F[normalIndex];n.normal=normal}if(x)for(f=0;f<nVertices;f++){normalIndex=A[j++]*3;normal=new THREE.Vector3;normal.x=F[normalIndex++];normal.y=F[normalIndex++];normal.z=F[normalIndex];n.vertexNormals.push(normal)}if(w){color=new THREE.Color(A[j++]);n.color=color}if(o)for(f=
-0;f<nVertices;f++){colorIndex=A[j++];color=new THREE.Color(G[colorIndex]);n.vertexColors.push(color)}e.faces.push(n)}}})();(function(){var f,g,h,j;if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f+=2){h=a.skinWeights[f];j=a.skinWeights[f+1];e.skinWeights.push(new THREE.Vector4(h,j,0,0))}}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f+=2){h=a.skinIndices[f];j=a.skinIndices[f+1];e.skinIndices.push(new THREE.Vector4(h,j,0,0))}}e.bones=a.bones;e.animation=a.animation})();(function(){if(a.morphTargets!==
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry;this.init_materials(e,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var f,g,h,j,m,o,n,t,y,w,z=a.faces;t=a.vertices;var E=a.normals,G=a.colors,J=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&J++;for(f=0;f<J;f++){e.faceUvs[f]=[];e.faceVertexUvs[f]=[]}j=0;for(m=t.length;j<m;){y=new THREE.Vertex;y.position.x=t[j++];y.position.y=t[j++];y.position.z=t[j++];e.vertices.push(y)}j=
+0;for(m=z.length;j<m;){o=z[j++];n=o&1;h=o&2;f=o&4;g=o&8;t=o&16;y=o&32;w=o&64;o&=128;if(n){n=new THREE.Face4;n.a=z[j++];n.b=z[j++];n.c=z[j++];n.d=z[j++];nVertices=4}else{n=new THREE.Face3;n.a=z[j++];n.b=z[j++];n.c=z[j++];nVertices=3}if(h){materialIndex=z[j++];n.materials=e.materials[materialIndex]}h=e.faces.length;if(f)for(f=0;f<J;f++){uvLayer=a.uvs[f];uvIndex=z[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];e.faceUvs[f][h]=new THREE.UV(u,v)}if(g)for(f=0;f<J;f++){uvLayer=a.uvs[f];uvs=[];for(g=0;g<
+nVertices;g++){uvIndex=z[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[g]=new THREE.UV(u,v)}e.faceVertexUvs[f][h]=uvs}if(t){normalIndex=z[j++]*3;normal=new THREE.Vector3;normal.x=E[normalIndex++];normal.y=E[normalIndex++];normal.z=E[normalIndex];n.normal=normal}if(y)for(f=0;f<nVertices;f++){normalIndex=z[j++]*3;normal=new THREE.Vector3;normal.x=E[normalIndex++];normal.y=E[normalIndex++];normal.z=E[normalIndex];n.vertexNormals.push(normal)}if(w){color=new THREE.Color(z[j++]);n.color=color}if(o)for(f=
+0;f<nVertices;f++){colorIndex=z[j++];color=new THREE.Color(G[colorIndex]);n.vertexColors.push(color)}e.faces.push(n)}}})();(function(){var f,g,h,j;if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f+=2){h=a.skinWeights[f];j=a.skinWeights[f+1];e.skinWeights.push(new THREE.Vector4(h,j,0,0))}}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f+=2){h=a.skinIndices[f];j=a.skinIndices[f+1];e.skinIndices.push(new THREE.Vector4(h,j,0,0))}}e.bones=a.bones;e.animation=a.animation})();(function(){if(a.morphTargets!==
 undefined){var f,g,h,j;f=0;for(g=a.morphTargets.length;f<g;f++){e.morphTargets[f]={};e.morphTargets[f].name=a.morphTargets[f].name;e.morphTargets[f].vertices=[];dstVertices=e.morphTargets[f].vertices;srcVertices=a.morphTargets[f].vertices;h=0;for(j=srcVertices.length;h<j;h+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[h],srcVertices[h+1],srcVertices[h+2])))}}})();e.computeCentroids();e.computeFaceNormals();c(e)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
 undefined){var f,g,h,j;f=0;for(g=a.morphTargets.length;f<g;f++){e.morphTargets[f]={};e.morphTargets[f].name=a.morphTargets[f].name;e.morphTargets[f].vertices=[];dstVertices=e.morphTargets[f].vertices;srcVertices=a.morphTargets[f].vertices;h=0;for(j=srcVertices.length;h<j;h+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[h],srcVertices[h+1],srcVertices[h+2])))}}})();e.computeCentroids();e.computeFaceNormals();c(e)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
 THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.BinaryLoader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,f,e,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};
 THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.BinaryLoader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,f,e,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};
 c.postMessage(a)},loadAjaxBuffers:function(a,c,b,e,f,g){var h=new XMLHttpRequest,j=e+"/"+a,m=0;h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,f,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(g){m==0&&(m=h.getResponseHeader("Content-Length"));g({total:m,loaded:h.responseText.length})}}else h.readyState==2&&(m=h.getResponseHeader("Content-Length"))};h.open("GET",j,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
 c.postMessage(a)},loadAjaxBuffers:function(a,c,b,e,f,g){var h=new XMLHttpRequest,j=e+"/"+a,m=0;h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,f,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(g){m==0&&(m=h.getResponseHeader("Content-Length"));g({total:m,loaded:h.responseText.length})}}else h.readyState==2&&(m=h.getResponseHeader("Content-Length"))};h.open("GET",j,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
-h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(a,c,b,e){var f=function(g){function h(M,X){var ma=n(M,X),W=n(M,X+1),T=n(M,X+2),k=n(M,X+3),y=(k<<1&255|T>>7)-127;ma|=(T&127)<<16|W<<8;if(ma==0&&y==-127)return 0;return(1-2*(k>>7))*(1+ma*Math.pow(2,-23))*Math.pow(2,y)}function j(M,X){var ma=n(M,X),W=n(M,X+1),T=n(M,X+2);return(n(M,X+3)<<24)+(T<<16)+(W<<8)+ma}function m(M,X){var ma=n(M,X);return(n(M,X+1)<<8)+ma}function o(M,X){var ma=n(M,X);return ma>127?ma-256:ma}function n(M,
-X){return M.charCodeAt(X)&255}function t(M){var X,ma,W;X=j(a,M);ma=j(a,M+R);W=j(a,M+Da);M=m(a,M+ha);THREE.BinaryLoader.prototype.f3(K,X,ma,W,M)}function x(M){var X,ma,W,T,k,y;X=j(a,M);ma=j(a,M+R);W=j(a,M+Da);T=m(a,M+ha);k=j(a,M+na);y=j(a,M+Y);M=j(a,M+d);THREE.BinaryLoader.prototype.f3n(K,P,X,ma,W,T,k,y,M)}function w(M){var X,ma,W,T;X=j(a,M);ma=j(a,M+$);W=j(a,M+ya);T=j(a,M+Ea);M=m(a,M+Fa);THREE.BinaryLoader.prototype.f4(K,X,ma,W,T,M)}function A(M){var X,ma,W,T,k,y,B,p;X=j(a,M);ma=j(a,M+$);W=j(a,M+
-ya);T=j(a,M+Ea);k=m(a,M+Fa);y=j(a,M+sa);B=j(a,M+aa);p=j(a,M+oa);M=j(a,M+Aa);THREE.BinaryLoader.prototype.f4n(K,P,X,ma,W,T,k,y,B,p,M)}function F(M){var X,ma;X=j(a,M);ma=j(a,M+V);M=j(a,M+S);THREE.BinaryLoader.prototype.uv3(K.faceVertexUvs[0],Q[X*2],Q[X*2+1],Q[ma*2],Q[ma*2+1],Q[M*2],Q[M*2+1])}function G(M){var X,ma,W;X=j(a,M);ma=j(a,M+ka);W=j(a,M+ua);M=j(a,M+ia);THREE.BinaryLoader.prototype.uv4(K.faceVertexUvs[0],Q[X*2],Q[X*2+1],Q[ma*2],Q[ma*2+1],Q[W*2],Q[W*2+1],Q[M*2],Q[M*2+1])}var K=this,O=0,z,P=[],
-Q=[],R,Da,ha,na,Y,d,$,ya,Ea,Fa,sa,aa,oa,Aa,V,S,ka,ua,ia,Ba,Ga,Qa,Ra,bb,Ya;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(K,e,g);z={signature:a.substr(O,8),header_bytes:n(a,O+8),vertex_coordinate_bytes:n(a,O+9),normal_coordinate_bytes:n(a,O+10),uv_coordinate_bytes:n(a,O+11),vertex_index_bytes:n(a,O+12),normal_index_bytes:n(a,O+13),uv_index_bytes:n(a,O+14),material_index_bytes:n(a,O+15),nvertices:j(a,O+16),nnormals:j(a,O+16+4),nuvs:j(a,O+16+8),ntri_flat:j(a,O+16+12),ntri_smooth:j(a,
-O+16+16),ntri_flat_uv:j(a,O+16+20),ntri_smooth_uv:j(a,O+16+24),nquad_flat:j(a,O+16+28),nquad_smooth:j(a,O+16+32),nquad_flat_uv:j(a,O+16+36),nquad_smooth_uv:j(a,O+16+40)};O+=z.header_bytes;R=z.vertex_index_bytes;Da=z.vertex_index_bytes*2;ha=z.vertex_index_bytes*3;na=z.vertex_index_bytes*3+z.material_index_bytes;Y=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;d=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;$=z.vertex_index_bytes;ya=z.vertex_index_bytes*2;
-Ea=z.vertex_index_bytes*3;Fa=z.vertex_index_bytes*4;sa=z.vertex_index_bytes*4+z.material_index_bytes;aa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;oa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;Aa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;V=z.uv_index_bytes;S=z.uv_index_bytes*2;ka=z.uv_index_bytes;ua=z.uv_index_bytes*2;ia=z.uv_index_bytes*3;g=z.vertex_index_bytes*3+z.material_index_bytes;Ya=z.vertex_index_bytes*4+z.material_index_bytes;
-Ba=z.ntri_flat*g;Ga=z.ntri_smooth*(g+z.normal_index_bytes*3);Qa=z.ntri_flat_uv*(g+z.uv_index_bytes*3);Ra=z.ntri_smooth_uv*(g+z.normal_index_bytes*3+z.uv_index_bytes*3);bb=z.nquad_flat*Ya;g=z.nquad_smooth*(Ya+z.normal_index_bytes*4);Ya=z.nquad_flat_uv*(Ya+z.uv_index_bytes*4);O+=function(M){for(var X,ma,W,T=z.vertex_coordinate_bytes*3,k=M+z.nvertices*T;M<k;M+=T){X=h(a,M);ma=h(a,M+z.vertex_coordinate_bytes);W=h(a,M+z.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(K,X,ma,W)}return z.nvertices*
-T}(O);O+=function(M){for(var X,ma,W,T=z.normal_coordinate_bytes*3,k=M+z.nnormals*T;M<k;M+=T){X=o(a,M);ma=o(a,M+z.normal_coordinate_bytes);W=o(a,M+z.normal_coordinate_bytes*2);P.push(X/127,ma/127,W/127)}return z.nnormals*T}(O);O+=function(M){for(var X,ma,W=z.uv_coordinate_bytes*2,T=M+z.nuvs*W;M<T;M+=W){X=h(a,M);ma=h(a,M+z.uv_coordinate_bytes);Q.push(X,ma)}return z.nuvs*W}(O);Ba=O+Ba;Ga=Ba+Ga;Qa=Ga+Qa;Ra=Qa+Ra;bb=Ra+bb;g=bb+g;Ya=g+Ya;(function(M){var X,ma=z.vertex_index_bytes*3+z.material_index_bytes,
-W=ma+z.uv_index_bytes*3,T=M+z.ntri_flat_uv*W;for(X=M;X<T;X+=W){t(X);F(X+ma)}return T-M})(Ga);(function(M){var X,ma=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,W=ma+z.uv_index_bytes*3,T=M+z.ntri_smooth_uv*W;for(X=M;X<T;X+=W){x(X);F(X+ma)}return T-M})(Qa);(function(M){var X,ma=z.vertex_index_bytes*4+z.material_index_bytes,W=ma+z.uv_index_bytes*4,T=M+z.nquad_flat_uv*W;for(X=M;X<T;X+=W){w(X);G(X+ma)}return T-M})(g);(function(M){var X,ma=z.vertex_index_bytes*4+z.material_index_bytes+
-z.normal_index_bytes*4,W=ma+z.uv_index_bytes*4,T=M+z.nquad_smooth_uv*W;for(X=M;X<T;X+=W){A(X);G(X+ma)}return T-M})(Ya);(function(M){var X,ma=z.vertex_index_bytes*3+z.material_index_bytes,W=M+z.ntri_flat*ma;for(X=M;X<W;X+=ma)t(X);return W-M})(O);(function(M){var X,ma=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,W=M+z.ntri_smooth*ma;for(X=M;X<W;X+=ma)x(X);return W-M})(Ba);(function(M){var X,ma=z.vertex_index_bytes*4+z.material_index_bytes,W=M+z.nquad_flat*ma;for(X=M;X<W;X+=ma)w(X);
-return W-M})(Ra);(function(M){var X,ma=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,W=M+z.nquad_smooth*ma;for(X=M;X<W;X+=ma)A(X);return W-M})(bb);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))},v:function(a,c,b,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,e)))},f3:function(a,c,b,e,f){a.faces.push(new THREE.Face3(c,b,e,null,null,a.materials[f]))},f4:function(a,c,b,e,f,g){a.faces.push(new THREE.Face4(c,
-b,e,f,null,null,a.materials[g]))},f3n:function(a,c,b,e,f,g,h,j,m){g=a.materials[g];var o=c[j*3],n=c[j*3+1];j=c[j*3+2];var t=c[m*3],x=c[m*3+1];m=c[m*3+2];a.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(o,n,j),new THREE.Vector3(t,x,m)],null,g))},f4n:function(a,c,b,e,f,g,h,j,m,o,n){h=a.materials[h];var t=c[m*3],x=c[m*3+1];m=c[m*3+2];var w=c[o*3],A=c[o*3+1];o=c[o*3+2];var F=c[n*3],G=c[n*3+1];n=c[n*3+2];a.faces.push(new THREE.Face4(b,e,f,g,[new THREE.Vector3(c[j*
-3],c[j*3+1],c[j*3+2]),new THREE.Vector3(t,x,m),new THREE.Vector3(w,A,o),new THREE.Vector3(F,G,n)],null,h))},uv3:function(a,c,b,e,f,g,h){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(e,f));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,c,b,e,f,g,h,j,m){var o=[];o.push(new THREE.UV(c,b));o.push(new THREE.UV(e,f));o.push(new THREE.UV(g,h));o.push(new THREE.UV(j,m));a.push(o)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
+h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(a,c,b,e){var f=function(g){function h(M,V){var na=n(M,V),Aa=n(M,V+1),ca=n(M,V+2),ga=n(M,V+3),k=(ga<<1&255|ca>>7)-127;na|=(ca&127)<<16|Aa<<8;if(na==0&&k==-127)return 0;return(1-2*(ga>>7))*(1+na*Math.pow(2,-23))*Math.pow(2,k)}function j(M,V){var na=n(M,V),Aa=n(M,V+1),ca=n(M,V+2);return(n(M,V+3)<<24)+(ca<<16)+(Aa<<8)+na}function m(M,V){var na=n(M,V);return(n(M,V+1)<<8)+na}function o(M,V){var na=n(M,V);return na>127?
+na-256:na}function n(M,V){return M.charCodeAt(V)&255}function t(M){var V,na,Aa;V=j(a,M);na=j(a,M+O);Aa=j(a,M+Fa);M=m(a,M+oa);THREE.BinaryLoader.prototype.f3(J,V,na,Aa,M)}function y(M){var V,na,Aa,ca,ga,k;V=j(a,M);na=j(a,M+O);Aa=j(a,M+Fa);ca=m(a,M+oa);ga=j(a,M+xa);k=j(a,M+W);M=j(a,M+d);THREE.BinaryLoader.prototype.f3n(J,L,V,na,Aa,ca,ga,k,M)}function w(M){var V,na,Aa,ca;V=j(a,M);na=j(a,M+Z);Aa=j(a,M+ya);ca=j(a,M+Ga);M=m(a,M+Ha);THREE.BinaryLoader.prototype.f4(J,V,na,Aa,ca,M)}function z(M){var V,na,
+Aa,ca,ga,k,B,x;V=j(a,M);na=j(a,M+Z);Aa=j(a,M+ya);ca=j(a,M+Ga);ga=m(a,M+Ha);k=j(a,M+ra);B=j(a,M+X);x=j(a,M+qa);M=j(a,M+za);THREE.BinaryLoader.prototype.f4n(J,L,V,na,Aa,ca,ga,k,B,x,M)}function E(M){var V,na;V=j(a,M);na=j(a,M+ea);M=j(a,M+U);THREE.BinaryLoader.prototype.uv3(J.faceVertexUvs[0],N[V*2],N[V*2+1],N[na*2],N[na*2+1],N[M*2],N[M*2+1])}function G(M){var V,na,Aa;V=j(a,M);na=j(a,M+ma);Aa=j(a,M+Ca);M=j(a,M+fa);THREE.BinaryLoader.prototype.uv4(J.faceVertexUvs[0],N[V*2],N[V*2+1],N[na*2],N[na*2+1],N[Aa*
+2],N[Aa*2+1],N[M*2],N[M*2+1])}var J=this,S=0,D,L=[],N=[],O,Fa,oa,xa,W,d,Z,ya,Ga,Ha,ra,X,qa,za,ea,U,ma,Ca,fa,ja,Da,Sa,Xa,Wa,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(J,e,g);D={signature:a.substr(S,8),header_bytes:n(a,S+8),vertex_coordinate_bytes:n(a,S+9),normal_coordinate_bytes:n(a,S+10),uv_coordinate_bytes:n(a,S+11),vertex_index_bytes:n(a,S+12),normal_index_bytes:n(a,S+13),uv_index_bytes:n(a,S+14),material_index_bytes:n(a,S+15),nvertices:j(a,S+16),nnormals:j(a,S+16+4),nuvs:j(a,
+S+16+8),ntri_flat:j(a,S+16+12),ntri_smooth:j(a,S+16+16),ntri_flat_uv:j(a,S+16+20),ntri_smooth_uv:j(a,S+16+24),nquad_flat:j(a,S+16+28),nquad_smooth:j(a,S+16+32),nquad_flat_uv:j(a,S+16+36),nquad_smooth_uv:j(a,S+16+40)};S+=D.header_bytes;O=D.vertex_index_bytes;Fa=D.vertex_index_bytes*2;oa=D.vertex_index_bytes*3;xa=D.vertex_index_bytes*3+D.material_index_bytes;W=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;d=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;Z=
+D.vertex_index_bytes;ya=D.vertex_index_bytes*2;Ga=D.vertex_index_bytes*3;Ha=D.vertex_index_bytes*4;ra=D.vertex_index_bytes*4+D.material_index_bytes;X=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;qa=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;za=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;ea=D.uv_index_bytes;U=D.uv_index_bytes*2;ma=D.uv_index_bytes;Ca=D.uv_index_bytes*2;fa=D.uv_index_bytes*3;g=D.vertex_index_bytes*3+D.material_index_bytes;
+Ta=D.vertex_index_bytes*4+D.material_index_bytes;ja=D.ntri_flat*g;Da=D.ntri_smooth*(g+D.normal_index_bytes*3);Sa=D.ntri_flat_uv*(g+D.uv_index_bytes*3);Xa=D.ntri_smooth_uv*(g+D.normal_index_bytes*3+D.uv_index_bytes*3);Wa=D.nquad_flat*Ta;g=D.nquad_smooth*(Ta+D.normal_index_bytes*4);Ta=D.nquad_flat_uv*(Ta+D.uv_index_bytes*4);S+=function(M){for(var V,na,Aa,ca=D.vertex_coordinate_bytes*3,ga=M+D.nvertices*ca;M<ga;M+=ca){V=h(a,M);na=h(a,M+D.vertex_coordinate_bytes);Aa=h(a,M+D.vertex_coordinate_bytes*2);
+THREE.BinaryLoader.prototype.v(J,V,na,Aa)}return D.nvertices*ca}(S);S+=function(M){for(var V,na,Aa,ca=D.normal_coordinate_bytes*3,ga=M+D.nnormals*ca;M<ga;M+=ca){V=o(a,M);na=o(a,M+D.normal_coordinate_bytes);Aa=o(a,M+D.normal_coordinate_bytes*2);L.push(V/127,na/127,Aa/127)}return D.nnormals*ca}(S);S+=function(M){for(var V,na,Aa=D.uv_coordinate_bytes*2,ca=M+D.nuvs*Aa;M<ca;M+=Aa){V=h(a,M);na=h(a,M+D.uv_coordinate_bytes);N.push(V,na)}return D.nuvs*Aa}(S);ja=S+ja;Da=ja+Da;Sa=Da+Sa;Xa=Sa+Xa;Wa=Xa+Wa;g=Wa+
+g;Ta=g+Ta;(function(M){var V,na=D.vertex_index_bytes*3+D.material_index_bytes,Aa=na+D.uv_index_bytes*3,ca=M+D.ntri_flat_uv*Aa;for(V=M;V<ca;V+=Aa){t(V);E(V+na)}return ca-M})(Da);(function(M){var V,na=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,Aa=na+D.uv_index_bytes*3,ca=M+D.ntri_smooth_uv*Aa;for(V=M;V<ca;V+=Aa){y(V);E(V+na)}return ca-M})(Sa);(function(M){var V,na=D.vertex_index_bytes*4+D.material_index_bytes,Aa=na+D.uv_index_bytes*4,ca=M+D.nquad_flat_uv*Aa;for(V=M;V<ca;V+=
+Aa){w(V);G(V+na)}return ca-M})(g);(function(M){var V,na=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,Aa=na+D.uv_index_bytes*4,ca=M+D.nquad_smooth_uv*Aa;for(V=M;V<ca;V+=Aa){z(V);G(V+na)}return ca-M})(Ta);(function(M){var V,na=D.vertex_index_bytes*3+D.material_index_bytes,Aa=M+D.ntri_flat*na;for(V=M;V<Aa;V+=na)t(V);return Aa-M})(S);(function(M){var V,na=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,Aa=M+D.ntri_smooth*na;for(V=M;V<Aa;V+=na)y(V);return Aa-
+M})(ja);(function(M){var V,na=D.vertex_index_bytes*4+D.material_index_bytes,Aa=M+D.nquad_flat*na;for(V=M;V<Aa;V+=na)w(V);return Aa-M})(Xa);(function(M){var V,na=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,Aa=M+D.nquad_smooth*na;for(V=M;V<Aa;V+=na)z(V);return Aa-M})(Wa);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))},v:function(a,c,b,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,e)))},f3:function(a,
+c,b,e,f){a.faces.push(new THREE.Face3(c,b,e,null,null,a.materials[f]))},f4:function(a,c,b,e,f,g){a.faces.push(new THREE.Face4(c,b,e,f,null,null,a.materials[g]))},f3n:function(a,c,b,e,f,g,h,j,m){g=a.materials[g];var o=c[j*3],n=c[j*3+1];j=c[j*3+2];var t=c[m*3],y=c[m*3+1];m=c[m*3+2];a.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(o,n,j),new THREE.Vector3(t,y,m)],null,g))},f4n:function(a,c,b,e,f,g,h,j,m,o,n){h=a.materials[h];var t=c[m*3],y=c[m*3+1];m=
+c[m*3+2];var w=c[o*3],z=c[o*3+1];o=c[o*3+2];var E=c[n*3],G=c[n*3+1];n=c[n*3+2];a.faces.push(new THREE.Face4(b,e,f,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(t,y,m),new THREE.Vector3(w,z,o),new THREE.Vector3(E,G,n)],null,h))},uv3:function(a,c,b,e,f,g,h){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(e,f));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,c,b,e,f,g,h,j,m){var o=[];o.push(new THREE.UV(c,b));o.push(new THREE.UV(e,f));o.push(new THREE.UV(g,h));o.push(new THREE.UV(j,
+m));a.push(o)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,e,f){return b+(e-b)*f};this.VIntX=function(b,e,f,g,h,j,m,o,n,t){h=(h-n)/(t-n);n=this.normal_cache;e[g]=j+h*this.delta;e[g+1]=m;e[g+2]=o;f[g]=this.lerp(n[b],n[b+3],h);f[g+1]=this.lerp(n[b+1],n[b+4],h);f[g+2]=this.lerp(n[b+2],n[b+5],h)};this.VIntY=function(b,e,f,g,h,j,m,o,n,t){h=(h-n)/(t-n);n=this.normal_cache;e[g]=j;e[g+1]=m+h*this.delta;e[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(b,e,f){return b+(e-b)*f};this.VIntX=function(b,e,f,g,h,j,m,o,n,t){h=(h-n)/(t-n);n=this.normal_cache;e[g]=j+h*this.delta;e[g+1]=m;e[g+2]=o;f[g]=this.lerp(n[b],n[b+3],h);f[g+1]=this.lerp(n[b+1],n[b+4],h);f[g+2]=this.lerp(n[b+2],n[b+5],h)};this.VIntY=function(b,e,f,g,h,j,m,o,n,t){h=(h-n)/(t-n);n=this.normal_cache;e[g]=j;e[g+1]=m+h*this.delta;e[g+
 2]=o;e=b+this.yd*3;f[g]=this.lerp(n[b],n[e],h);f[g+1]=this.lerp(n[b+1],n[e+1],h);f[g+2]=this.lerp(n[b+2],n[e+2],h)};this.VIntZ=function(b,e,f,g,h,j,m,o,n,t){h=(h-n)/(t-n);n=this.normal_cache;e[g]=j;e[g+1]=m;e[g+2]=o+h*this.delta;e=b+this.zd*3;f[g]=this.lerp(n[b],n[e],h);f[g+1]=this.lerp(n[b+1],n[e+1],h);f[g+2]=this.lerp(n[b+2],n[e+2],h)};this.compNorm=function(b){var e=b*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[b-1]-this.field[b+1];this.normal_cache[e+1]=this.field[b-this.yd]-
 2]=o;e=b+this.yd*3;f[g]=this.lerp(n[b],n[e],h);f[g+1]=this.lerp(n[b+1],n[e+1],h);f[g+2]=this.lerp(n[b+2],n[e+2],h)};this.VIntZ=function(b,e,f,g,h,j,m,o,n,t){h=(h-n)/(t-n);n=this.normal_cache;e[g]=j;e[g+1]=m;e[g+2]=o+h*this.delta;e=b+this.zd*3;f[g]=this.lerp(n[b],n[e],h);f[g+1]=this.lerp(n[b+1],n[e+1],h);f[g+2]=this.lerp(n[b+2],n[e+2],h)};this.compNorm=function(b){var e=b*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[b-1]-this.field[b+1];this.normal_cache[e+1]=this.field[b-this.yd]-
-this.field[b+this.yd];this.normal_cache[e+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,e,f,g,h,j){var m=g+1,o=g+this.yd,n=g+this.zd,t=m+this.yd,x=m+this.zd,w=g+this.yd+this.zd,A=m+this.yd+this.zd,F=0,G=this.field[g],K=this.field[m],O=this.field[o],z=this.field[t],P=this.field[n],Q=this.field[x],R=this.field[w],Da=this.field[A];G<h&&(F|=1);K<h&&(F|=2);O<h&&(F|=8);z<h&&(F|=4);P<h&&(F|=16);Q<h&&(F|=32);R<h&&(F|=128);Da<h&&(F|=64);var ha=THREE.edgeTable[F];if(ha==0)return 0;
-var na=this.delta,Y=b+na,d=e+na;na=f+na;if(ha&1){this.compNorm(g);this.compNorm(m);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,e,f,G,K)}if(ha&2){this.compNorm(m);this.compNorm(t);this.VIntY(m*3,this.vlist,this.nlist,3,h,Y,e,f,K,z)}if(ha&4){this.compNorm(o);this.compNorm(t);this.VIntX(o*3,this.vlist,this.nlist,6,h,b,d,f,O,z)}if(ha&8){this.compNorm(g);this.compNorm(o);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,e,f,G,O)}if(ha&16){this.compNorm(n);this.compNorm(x);this.VIntX(n*3,this.vlist,this.nlist,
-12,h,b,e,na,P,Q)}if(ha&32){this.compNorm(x);this.compNorm(A);this.VIntY(x*3,this.vlist,this.nlist,15,h,Y,e,na,Q,Da)}if(ha&64){this.compNorm(w);this.compNorm(A);this.VIntX(w*3,this.vlist,this.nlist,18,h,b,d,na,R,Da)}if(ha&128){this.compNorm(n);this.compNorm(w);this.VIntY(n*3,this.vlist,this.nlist,21,h,b,e,na,P,R)}if(ha&256){this.compNorm(g);this.compNorm(n);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,e,f,G,P)}if(ha&512){this.compNorm(m);this.compNorm(x);this.VIntZ(m*3,this.vlist,this.nlist,27,h,Y,
-e,f,K,Q)}if(ha&1024){this.compNorm(t);this.compNorm(A);this.VIntZ(t*3,this.vlist,this.nlist,30,h,Y,d,f,z,Da)}if(ha&2048){this.compNorm(o);this.compNorm(w);this.VIntZ(o*3,this.vlist,this.nlist,33,h,b,d,f,O,R)}F<<=4;for(h=g=0;THREE.triTable[F+h]!=-1;){b=F+h;e=b+1;f=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[e],3*THREE.triTable[f],j);h+=3;g++}return g};this.posnormtriv=function(b,e,f,g,h,j){var m=this.count*3;this.positionArray[m]=b[f];this.positionArray[m+1]=b[f+
+this.field[b+this.yd];this.normal_cache[e+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,e,f,g,h,j){var m=g+1,o=g+this.yd,n=g+this.zd,t=m+this.yd,y=m+this.zd,w=g+this.yd+this.zd,z=m+this.yd+this.zd,E=0,G=this.field[g],J=this.field[m],S=this.field[o],D=this.field[t],L=this.field[n],N=this.field[y],O=this.field[w],Fa=this.field[z];G<h&&(E|=1);J<h&&(E|=2);S<h&&(E|=8);D<h&&(E|=4);L<h&&(E|=16);N<h&&(E|=32);O<h&&(E|=128);Fa<h&&(E|=64);var oa=THREE.edgeTable[E];if(oa==0)return 0;
+var xa=this.delta,W=b+xa,d=e+xa;xa=f+xa;if(oa&1){this.compNorm(g);this.compNorm(m);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,e,f,G,J)}if(oa&2){this.compNorm(m);this.compNorm(t);this.VIntY(m*3,this.vlist,this.nlist,3,h,W,e,f,J,D)}if(oa&4){this.compNorm(o);this.compNorm(t);this.VIntX(o*3,this.vlist,this.nlist,6,h,b,d,f,S,D)}if(oa&8){this.compNorm(g);this.compNorm(o);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,e,f,G,S)}if(oa&16){this.compNorm(n);this.compNorm(y);this.VIntX(n*3,this.vlist,this.nlist,
+12,h,b,e,xa,L,N)}if(oa&32){this.compNorm(y);this.compNorm(z);this.VIntY(y*3,this.vlist,this.nlist,15,h,W,e,xa,N,Fa)}if(oa&64){this.compNorm(w);this.compNorm(z);this.VIntX(w*3,this.vlist,this.nlist,18,h,b,d,xa,O,Fa)}if(oa&128){this.compNorm(n);this.compNorm(w);this.VIntY(n*3,this.vlist,this.nlist,21,h,b,e,xa,L,O)}if(oa&256){this.compNorm(g);this.compNorm(n);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,e,f,G,L)}if(oa&512){this.compNorm(m);this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,27,h,W,
+e,f,J,N)}if(oa&1024){this.compNorm(t);this.compNorm(z);this.VIntZ(t*3,this.vlist,this.nlist,30,h,W,d,f,D,Fa)}if(oa&2048){this.compNorm(o);this.compNorm(w);this.VIntZ(o*3,this.vlist,this.nlist,33,h,b,d,f,S,O)}E<<=4;for(h=g=0;THREE.triTable[E+h]!=-1;){b=E+h;e=b+1;f=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[e],3*THREE.triTable[f],j);h+=3;g++}return g};this.posnormtriv=function(b,e,f,g,h,j){var m=this.count*3;this.positionArray[m]=b[f];this.positionArray[m+1]=b[f+
 1];this.positionArray[m+2]=b[f+2];this.positionArray[m+3]=b[g];this.positionArray[m+4]=b[g+1];this.positionArray[m+5]=b[g+2];this.positionArray[m+6]=b[h];this.positionArray[m+7]=b[h+1];this.positionArray[m+8]=b[h+2];this.normalArray[m]=e[f];this.normalArray[m+1]=e[f+1];this.normalArray[m+2]=e[f+2];this.normalArray[m+3]=e[g];this.normalArray[m+4]=e[g+1];this.normalArray[m+5]=e[g+2];this.normalArray[m+6]=e[h];this.normalArray[m+7]=e[h+1];this.normalArray[m+8]=e[h+2];this.hasPos=!0;this.hasNormal=!0;
 1];this.positionArray[m+2]=b[f+2];this.positionArray[m+3]=b[g];this.positionArray[m+4]=b[g+1];this.positionArray[m+5]=b[g+2];this.positionArray[m+6]=b[h];this.positionArray[m+7]=b[h+1];this.positionArray[m+8]=b[h+2];this.normalArray[m]=e[f];this.normalArray[m+1]=e[f+1];this.normalArray[m+2]=e[f+2];this.normalArray[m+3]=e[g];this.normalArray[m+4]=e[g+1];this.normalArray[m+5]=e[g+2];this.normalArray[m+6]=e[h];this.normalArray[m+7]=e[h+1];this.normalArray[m+8]=e[h+2];this.hasPos=!0;this.hasNormal=!0;
-this.count+=3;this.count>=this.maxCount-3&&j(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;b(this)}};this.addBall=function(b,e,f,g,h){var j=this.size*Math.sqrt(g/h),m=f*this.size,o=e*this.size,n=b*this.size,t=Math.floor(m-j);t<1&&(t=1);m=Math.floor(m+j);m>this.size-1&&(m=this.size-1);var x=Math.floor(o-j);x<1&&(x=1);o=Math.floor(o+j);o>this.size-1&&(o=
-this.size-1);var w=Math.floor(n-j);w<1&&(w=1);j=Math.floor(n+j);j>this.size-1&&(j=this.size-1);for(var A,F,G,K,O,z;t<m;t++){n=this.size2*t;F=t/this.size-f;O=F*F;for(F=x;F<o;F++){G=n+this.size*F;A=F/this.size-e;z=A*A;for(A=w;A<j;A++){K=A/this.size-b;K=g/(1.0E-6+K*K+z+O)-h;K>0&&(this.field[G+A]+=K)}}}};this.addPlaneX=function(b,e){var f,g,h,j,m,o=this.size,n=this.yd,t=this.zd,x=this.field,w=o*Math.sqrt(b/e);w>o&&(w=o);for(f=0;f<w;f++){g=f/o;g*=g;j=b/(1.0E-4+g)-e;if(j>0)for(g=0;g<o;g++){m=f+g*n;for(h=
-0;h<o;h++)x[t*h+m]+=j}}};this.addPlaneY=function(b,e){var f,g,h,j,m,o,n=this.size,t=this.yd,x=this.zd,w=this.field,A=n*Math.sqrt(b/e);A>n&&(A=n);for(g=0;g<A;g++){f=g/n;f*=f;j=b/(1.0E-4+f)-e;if(j>0){m=g*t;for(f=0;f<n;f++){o=m+f;for(h=0;h<n;h++)w[x*h+o]+=j}}}};this.addPlaneZ=function(b,e){var f,g,h,j,m,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/e);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;j=b/(1.0E-4+f)-e;if(j>0){m=zd*h;for(g=0;g<size;g++){o=m+g*yd;
-for(f=0;f<size;f++)field[o+f]+=j}}}};this.reset=function(){var b;for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var e,f,g,h,j,m,o,n,t,x=this.size-2;for(h=1;h<x;h++){t=this.size2*h;o=(h-this.halfsize)/this.halfsize;for(g=1;g<x;g++){n=t+this.size*g;m=(g-this.halfsize)/this.halfsize;for(f=1;f<x;f++){j=(f-this.halfsize)/this.halfsize;e=n+f;this.polygonize(j,m,o,e,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,e=new THREE.Geometry;
-this.render(function(f){var g,h,j,m,o,n,t,x;for(g=0;g<f.count;g++){o=g*3;t=o+1;x=o+2;h=f.positionArray[o];j=f.positionArray[t];m=f.positionArray[x];n=new THREE.Vector3(h,j,m);h=f.normalArray[o];j=f.normalArray[t];m=f.normalArray[x];o=new THREE.Vector3(h,j,m);o.normalize();o=new THREE.Vertex(n,o);e.vertices.push(o)}nfaces=f.count/3;for(g=0;g<nfaces;g++){o=(b+g)*3;t=o+1;x=o+2;n=e.vertices[o].normal;h=e.vertices[t].normal;j=e.vertices[x].normal;o=new THREE.Face3(o,t,x,[n,h,j]);e.faces.push(o)}b+=nfaces;
+this.count+=3;this.count>=this.maxCount-3&&j(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;b(this)}};this.addBall=function(b,e,f,g,h){var j=this.size*Math.sqrt(g/h),m=f*this.size,o=e*this.size,n=b*this.size,t=Math.floor(m-j);t<1&&(t=1);m=Math.floor(m+j);m>this.size-1&&(m=this.size-1);var y=Math.floor(o-j);y<1&&(y=1);o=Math.floor(o+j);o>this.size-1&&(o=
+this.size-1);var w=Math.floor(n-j);w<1&&(w=1);j=Math.floor(n+j);j>this.size-1&&(j=this.size-1);for(var z,E,G,J,S,D;t<m;t++){n=this.size2*t;E=t/this.size-f;S=E*E;for(E=y;E<o;E++){G=n+this.size*E;z=E/this.size-e;D=z*z;for(z=w;z<j;z++){J=z/this.size-b;J=g/(1.0E-6+J*J+D+S)-h;J>0&&(this.field[G+z]+=J)}}}};this.addPlaneX=function(b,e){var f,g,h,j,m,o=this.size,n=this.yd,t=this.zd,y=this.field,w=o*Math.sqrt(b/e);w>o&&(w=o);for(f=0;f<w;f++){g=f/o;g*=g;j=b/(1.0E-4+g)-e;if(j>0)for(g=0;g<o;g++){m=f+g*n;for(h=
+0;h<o;h++)y[t*h+m]+=j}}};this.addPlaneY=function(b,e){var f,g,h,j,m,o,n=this.size,t=this.yd,y=this.zd,w=this.field,z=n*Math.sqrt(b/e);z>n&&(z=n);for(g=0;g<z;g++){f=g/n;f*=f;j=b/(1.0E-4+f)-e;if(j>0){m=g*t;for(f=0;f<n;f++){o=m+f;for(h=0;h<n;h++)w[y*h+o]+=j}}}};this.addPlaneZ=function(b,e){var f,g,h,j,m,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/e);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;j=b/(1.0E-4+f)-e;if(j>0){m=zd*h;for(g=0;g<size;g++){o=m+g*yd;
+for(f=0;f<size;f++)field[o+f]+=j}}}};this.reset=function(){var b;for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var e,f,g,h,j,m,o,n,t,y=this.size-2;for(h=1;h<y;h++){t=this.size2*h;o=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){n=t+this.size*g;m=(g-this.halfsize)/this.halfsize;for(f=1;f<y;f++){j=(f-this.halfsize)/this.halfsize;e=n+f;this.polygonize(j,m,o,e,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,e=new THREE.Geometry;
+this.render(function(f){var g,h,j,m,o,n,t,y;for(g=0;g<f.count;g++){o=g*3;t=o+1;y=o+2;h=f.positionArray[o];j=f.positionArray[t];m=f.positionArray[y];n=new THREE.Vector3(h,j,m);h=f.normalArray[o];j=f.normalArray[t];m=f.normalArray[y];o=new THREE.Vector3(h,j,m);o.normalize();o=new THREE.Vertex(n,o);e.vertices.push(o)}nfaces=f.count/3;for(g=0;g<nfaces;g++){o=(b+g)*3;t=o+1;y=o+2;n=e.vertices[o].normal;h=e.vertices[t].normal;j=e.vertices[y].normal;o=new THREE.Face3(o,t,y,[n,h,j]);e.faces.push(o)}b+=nfaces;
 f.count=0});return e};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 f.count=0});return e};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,

+ 58 - 57
build/custom/ThreeCanvas.js

@@ -12,21 +12,21 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,e){this.set(a||0,b||0,c||0,e||1)};
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,e){this.set(a||0,b||0,c||0,e||1)};
 THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,d=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(d=d.concat(this.intersectObject(c)))}d.sort(function(f,g){return f.distance-g.distance});return d},intersectObject:function(a){function b(G,B,z,D){D=D.clone().subSelf(B);z=z.clone().subSelf(B);var I=G.clone().subSelf(B);G=D.dot(D);B=D.dot(z);D=D.dot(I);var H=z.dot(z);z=z.dot(I);I=1/(G*H-B*B);H=(H*D-B*z)*I;G=(G*z-B*D)*I;return H>0&&G>0&&H+G<1}var c,e,d,f,g,i,h,j,k,n,
-p,o=a.geometry,v=o.vertices,y=[];c=0;for(e=o.faces.length;c<e;c++){d=o.faces[c];n=this.origin.clone();p=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(v[d.a].position.clone());g=h.multiplyVector3(v[d.b].position.clone());i=h.multiplyVector3(v[d.c].position.clone());h=d instanceof THREE.Face4?h.multiplyVector3(v[d.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(d.normal.clone());k=p.dot(j);if(k<0){j=j.dot((new THREE.Vector3).sub(f,n))/k;n=n.addSelf(p.multiplyScalar(j));
-if(d instanceof THREE.Face3){if(b(n,f,g,i)){d={distance:this.origin.distanceTo(n),point:n,face:d,object:a};y.push(d)}}else if(d instanceof THREE.Face4&&(b(n,f,g,h)||b(n,g,i,h))){d={distance:this.origin.distanceTo(n),point:n,face:d,object:a};y.push(d)}}}return y}};
+THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,d=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(d=d.concat(this.intersectObject(c)))}d.sort(function(f,g){return f.distance-g.distance});return d},intersectObject:function(a){function b(D,A,U,V){V=V.clone().subSelf(A);U=U.clone().subSelf(A);var B=D.clone().subSelf(A);D=V.dot(V);A=V.dot(U);V=V.dot(B);var u=U.dot(U);U=U.dot(B);B=1/(D*u-A*A);u=(u*V-A*U)*B;D=(D*U-A*V)*B;return u>0&&D>0&&u+D<1}var c,e,d,f,g,i,h,j,k,n,
+q,o=a.geometry,w=o.vertices,z=[];c=0;for(e=o.faces.length;c<e;c++){d=o.faces[c];n=this.origin.clone();q=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(w[d.a].position.clone());g=h.multiplyVector3(w[d.b].position.clone());i=h.multiplyVector3(w[d.c].position.clone());h=d instanceof THREE.Face4?h.multiplyVector3(w[d.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(d.normal.clone());k=q.dot(j);if(k<0){j=j.dot((new THREE.Vector3).sub(f,n))/k;n=n.addSelf(q.multiplyScalar(j));
+if(d instanceof THREE.Face3){if(b(n,f,g,i)){d={distance:this.origin.distanceTo(n),point:n,face:d,object:a};z.push(d)}}else if(d instanceof THREE.Face4&&(b(n,f,g,h)||b(n,g,i,h))){d={distance:this.origin.distanceTo(n),point:n,face:d,object:a};z.push(d)}}}return z}};
 THREE.Rectangle=function(){function a(){f=e-b;g=d-c}var b,c,e,d,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return d};this.set=function(h,j,k,n){i=!1;b=h;c=j;e=k;d=n;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;e=h;d=j}else{b=b<h?b:h;c=c<j?c:j;e=e>h?e:h;d=d>j?d:j}a()};
 THREE.Rectangle=function(){function a(){f=e-b;g=d-c}var b,c,e,d,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return d};this.set=function(h,j,k,n){i=!1;b=h;c=j;e=k;d=n;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;e=h;d=j}else{b=b<h?b:h;c=c<j?c:j;e=e>h?e:h;d=d>j?d:j}a()};
-this.add3Points=function(h,j,k,n,p,o){if(i){i=!1;b=h<k?h<p?h:p:k<p?k:p;c=j<n?j<o?j:o:n<o?n:o;e=h>k?h>p?h:p:k>p?k:p;d=j>n?j>o?j:o:n>o?n:o}else{b=h<k?h<p?h<b?h:b:p<b?p:b:k<p?k<b?k:b:p<b?p:b;c=j<n?j<o?j<c?j:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c;e=h>k?h>p?h>e?h:e:p>e?p:e:k>p?k>e?k:e:p>e?p:e;d=j>n?j>o?j>d?j:d:o>d?o:d:n>o?n>d?n:d:o>d?o:d}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();e=h.getRight();d=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();e=e>h.getRight()?
+this.add3Points=function(h,j,k,n,q,o){if(i){i=!1;b=h<k?h<q?h:q:k<q?k:q;c=j<n?j<o?j:o:n<o?n:o;e=h>k?h>q?h:q:k>q?k:q;d=j>n?j>o?j:o:n>o?n:o}else{b=h<k?h<q?h<b?h:b:q<b?q:b:k<q?k<b?k:b:q<b?q:b;c=j<n?j<o?j<c?j:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c;e=h>k?h>q?h>e?h:e:q>e?q:e:k>q?k>e?k:e:q>e?q:e;d=j>n?j>o?j>d?j:d:o>d?o:d:n>o?n>d?n:d:o>d?o:d}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();e=h.getRight();d=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();e=e>h.getRight()?
 e:h.getRight();d=d>h.getBottom()?d:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;e+=h;d+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();e=e<h.getRight()?e:h.getRight();d=d<h.getBottom()?d:h.getBottom();a()};this.instersects=function(h){return Math.min(e,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(d,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;d=e=c=b=0;a()};this.isEmpty=function(){return i}};
 e:h.getRight();d=d>h.getBottom()?d:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;e+=h;d+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();e=e<h.getRight()?e:h.getRight();d=d<h.getBottom()?d:h.getBottom();a()};this.instersects=function(h){return Math.min(e,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(d,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;d=e=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,e,d,f,g,i,h,j,k,n,p,o,v,y){this.set(a||1,b||0,c||0,e||0,d||0,f||1,g||0,i||0,h||0,j||0,k||1,n||0,p||0,o||0,v||0,y||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,e,d,f,g,i,h,j,k,n,p,o,v,y){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=d;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=j;this.n33=k;this.n34=n;this.n41=p;this.n42=o;this.n43=v;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
+THREE.Matrix4=function(a,b,c,e,d,f,g,i,h,j,k,n,q,o,w,z){this.set(a||1,b||0,c||0,e||0,d||0,f||1,g||0,i||0,h||0,j||0,k||1,n||0,q||0,o||0,w||0,z||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,e,d,f,g,i,h,j,k,n,q,o,w,z){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=d;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=j;this.n33=k;this.n34=n;this.n41=q;this.n42=o;this.n43=w;this.n44=z;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
 d=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;e.cross(c,f).normalize();if(e.length()===0){f.x+=1.0E-4;e.cross(c,f).normalize()}d.cross(f,e).normalize();this.n11=e.x;this.n12=d.x;this.n13=f.x;this.n21=e.y;this.n22=d.y;this.n23=f.y;this.n31=e.z;this.n32=d.z;this.n33=f.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,d=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*d;a.y=(this.n21*b+this.n22*c+this.n23*
 d=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;e.cross(c,f).normalize();if(e.length()===0){f.x+=1.0E-4;e.cross(c,f).normalize()}d.cross(f,e).normalize();this.n11=e.x;this.n12=d.x;this.n13=f.x;this.n21=e.y;this.n22=d.y;this.n23=f.y;this.n31=e.z;this.n32=d.z;this.n33=f.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,d=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*d;a.y=(this.n21*b+this.n22*c+this.n23*
 e+this.n24)*d;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*d;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,d=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*d;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*d;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*d;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*d;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();
 e+this.n24)*d;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*d;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,d=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*d;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*d;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*d;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*d;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,k=a.n31,n=a.n32,p=a.n33,o=a.n34,v=a.n41,y=a.n42,G=a.n43,B=a.n44,z=b.n11,D=b.n12,I=b.n13,H=b.n14,q=b.n21,aa=b.n22,
-K=b.n23,P=b.n24,Q=b.n31,w=b.n32,s=b.n33,L=b.n34;this.n11=c*z+e*q+d*Q;this.n12=c*D+e*aa+d*w;this.n13=c*I+e*K+d*s;this.n14=c*H+e*P+d*L+f;this.n21=g*z+i*q+h*Q;this.n22=g*D+i*aa+h*w;this.n23=g*I+i*K+h*s;this.n24=g*H+i*P+h*L+j;this.n31=k*z+n*q+p*Q;this.n32=k*D+n*aa+p*w;this.n33=k*I+n*K+p*s;this.n34=k*H+n*P+p*L+o;this.n41=v*z+y*q+G*Q;this.n42=v*D+y*aa+G*w;this.n43=v*I+y*K+G*s;this.n44=v*H+y*P+G*L+B;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,k=a.n31,n=a.n32,q=a.n33,o=a.n34,w=a.n41,z=a.n42,D=a.n43,A=a.n44,U=b.n11,V=b.n12,B=b.n13,u=b.n14,p=b.n21,Y=b.n22,
+Z=b.n23,aa=b.n24,P=b.n31,x=b.n32,t=b.n33,K=b.n34;this.n11=c*U+e*p+d*P;this.n12=c*V+e*Y+d*x;this.n13=c*B+e*Z+d*t;this.n14=c*u+e*aa+d*K+f;this.n21=g*U+i*p+h*P;this.n22=g*V+i*Y+h*x;this.n23=g*B+i*Z+h*t;this.n24=g*u+i*aa+h*K+j;this.n31=k*U+n*p+q*P;this.n32=k*V+n*Y+q*x;this.n33=k*B+n*Z+q*t;this.n34=k*u+n*aa+q*K+o;this.n41=w*U+z*p+D*P;this.n42=w*V+z*Y+D*x;this.n43=w*B+z*Z+D*t;this.n44=w*u+z*aa+D*K+A;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;
 c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
 c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,b=this.n12,c=this.n13,e=this.n14,d=this.n21,f=this.n22,g=this.n23,i=this.n24,h=this.n31,j=this.n32,k=this.n33,n=this.n34,p=this.n41,o=this.n42,v=this.n43,y=this.n44;return e*g*j*p-c*i*j*p-e*f*k*p+b*i*k*p+c*f*n*p-b*g*n*p-e*g*h*o+c*i*h*o+e*d*k*o-a*i*k*o-c*d*n*o+a*g*n*o+e*f*h*v-b*i*h*v-e*d*j*v+a*i*j*v+b*d*n*v-a*f*n*v-c*f*h*y+b*g*h*y+c*d*j*y-a*g*j*y-b*d*k*y+a*f*k*y},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
+this.n11,b=this.n12,c=this.n13,e=this.n14,d=this.n21,f=this.n22,g=this.n23,i=this.n24,h=this.n31,j=this.n32,k=this.n33,n=this.n34,q=this.n41,o=this.n42,w=this.n43,z=this.n44;return e*g*j*q-c*i*j*q-e*f*k*q+b*i*k*q+c*f*n*q-b*g*n*q-e*g*h*o+c*i*h*o+e*d*k*o-a*i*k*o-c*d*n*o+a*g*n*o+e*f*h*w-b*i*h*w-e*d*j*w+a*i*j*w+b*d*n*w-a*f*n*w-c*f*h*z+b*g*h*z+c*d*j*z-a*g*j*z-b*d*k*z+a*f*k*z},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
@@ -34,8 +34,8 @@ b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:functio
 f+c,h*g-e*i,h*i+e*g,0,h*g+e*i,j*g+c,j*i-e*f,0,h*i-e*g,j*i+e*f,d*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var d=Math.cos(c);c=Math.sin(c);var f=Math.cos(e);e=Math.sin(e);var g=a*c,i=b*c;this.n11=d*f;this.n12=-d*e;this.n13=c;this.n21=i*f+a*e;this.n22=-i*e+a*f;this.n23=-b*d;this.n31=-g*f+b*e;this.n32=g*e+b*f;this.n33=a*d;return this},setRotationFromQuaternion:function(a){var b=
 f+c,h*g-e*i,h*i+e*g,0,h*g+e*i,j*g+c,j*i-e*f,0,h*i-e*g,j*i+e*f,d*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var d=Math.cos(c);c=Math.sin(c);var f=Math.cos(e);e=Math.sin(e);var g=a*c,i=b*c;this.n11=d*f;this.n12=-d*e;this.n13=c;this.n21=i*f+a*e;this.n22=-i*e+a*f;this.n23=-b*d;this.n31=-g*f+b*e;this.n32=g*e+b*f;this.n33=a*d;return this},setRotationFromQuaternion:function(a){var b=
 a.x,c=a.y,e=a.z,d=a.w,f=b+b,g=c+c,i=e+e;a=b*f;var h=b*g;b*=i;var j=c*g;c*=i;e*=i;f*=d;g*=d;d*=i;this.n11=1-(j+e);this.n12=h-d;this.n13=b+g;this.n21=h+d;this.n22=1-(a+e);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
 a.x,c=a.y,e=a.z,d=a.w,f=b+b,g=c+c,i=e+e;a=b*f;var h=b*g;b*=i;var j=c*g;c*=i;e*=i;f*=d;g*=d;d*=i;this.n11=1-(j+e);this.n12=h-d;this.n13=b+g;this.n21=h+d;this.n22=1-(a+e);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
 a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,d=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*d;this.n23=a.n23*d;this.n33=a.n33*d}};
 a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,d=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*d;this.n23=a.n23*d;this.n33=a.n33*d}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,k=a.n31,n=a.n32,p=a.n33,o=a.n34,v=a.n41,y=a.n42,G=a.n43,B=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*o*y-j*p*y+j*n*G-i*o*G-h*n*B+i*p*B;b.n12=f*p*y-d*o*y-f*n*G+e*o*G+d*n*B-e*p*B;b.n13=d*j*y-f*h*y+f*i*G-e*j*G-d*i*B+e*h*B;b.n14=f*h*n-d*j*n-f*i*p+e*j*p+d*i*o-e*h*o;b.n21=j*p*v-h*o*v-j*k*G+g*o*G+h*k*B-g*p*B;b.n22=d*o*v-f*p*v+f*k*G-c*o*G-d*k*B+c*p*B;b.n23=f*h*v-d*j*v-f*g*G+c*j*G+d*g*B-c*h*B;
-b.n24=d*j*k-f*h*k+f*g*p-c*j*p-d*g*o+c*h*o;b.n31=i*o*v-j*n*v+j*k*y-g*o*y-i*k*B+g*n*B;b.n32=f*n*v-e*o*v-f*k*y+c*o*y+e*k*B-c*n*B;b.n33=d*j*v-f*i*v+f*g*y-c*j*y-e*g*B+c*i*B;b.n34=f*i*k-e*j*k-f*g*n+c*j*n+e*g*o-c*i*o;b.n41=h*n*v-i*p*v-h*k*y+g*p*y+i*k*G-g*n*G;b.n42=e*p*v-d*n*v+d*k*y-c*p*y-e*k*G+c*n*G;b.n43=d*i*v-e*h*v-d*g*y+c*h*y+e*g*G-c*i*G;b.n44=e*h*k-d*i*k+d*g*n-c*h*n-e*g*p+c*i*p;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,k=a.n31,n=a.n32,q=a.n33,o=a.n34,w=a.n41,z=a.n42,D=a.n43,A=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*o*z-j*q*z+j*n*D-i*o*D-h*n*A+i*q*A;b.n12=f*q*z-d*o*z-f*n*D+e*o*D+d*n*A-e*q*A;b.n13=d*j*z-f*h*z+f*i*D-e*j*D-d*i*A+e*h*A;b.n14=f*h*n-d*j*n-f*i*q+e*j*q+d*i*o-e*h*o;b.n21=j*q*w-h*o*w-j*k*D+g*o*D+h*k*A-g*q*A;b.n22=d*o*w-f*q*w+f*k*D-c*o*D-d*k*A+c*q*A;b.n23=f*h*w-d*j*w-f*g*D+c*j*D+d*g*A-c*h*A;
+b.n24=d*j*k-f*h*k+f*g*q-c*j*q-d*g*o+c*h*o;b.n31=i*o*w-j*n*w+j*k*z-g*o*z-i*k*A+g*n*A;b.n32=f*n*w-e*o*w-f*k*z+c*o*z+e*k*A-c*n*A;b.n33=d*j*w-f*i*w+f*g*z-c*j*z-e*g*A+c*i*A;b.n34=f*i*k-e*j*k-f*g*n+c*j*n+e*g*o-c*i*o;b.n41=h*n*w-i*q*w-h*k*z+g*q*z+i*k*D-g*n*D;b.n42=e*q*w-d*n*w+d*k*z-c*q*z-e*k*D+c*n*D;b.n43=d*i*w-e*h*w-d*g*z+c*h*z+e*g*D-c*i*D;b.n44=e*h*k-d*i*k+d*g*n-c*h*n-e*g*q+c*i*q;b.multiplyScalar(1/a.determinant());return b};
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,d=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*g+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*d;c[2]=a*f;c[3]=a*g;c[4]=a*i;c[5]=a*h;c[6]=a*j;c[7]=a*k;c[8]=a*n;return b};
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,d=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*g+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*d;c[2]=a*f;c[3]=a*g;c[4]=a*i;c[5]=a*h;c[6]=a*j;c[7]=a*k;c[8]=a*n;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,e,d,f){var g;g=new THREE.Matrix4;g.n11=2*d/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*d/(e-c);g.n23=(e+c)/(e-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+d)/(f-d);g.n34=-2*f*d/(f-d);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,e){var d;a=c*Math.tan(a*Math.PI/360);d=-a;return THREE.Matrix4.makeFrustum(d*b,a*b,d,a,c,e)};
 THREE.Matrix4.makeFrustum=function(a,b,c,e,d,f){var g;g=new THREE.Matrix4;g.n11=2*d/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*d/(e-c);g.n23=(e+c)/(e-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+d)/(f-d);g.n34=-2*f*d/(f-d);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,e){var d;a=c*Math.tan(a*Math.PI/360);d=-a;return THREE.Matrix4.makeFrustum(d*b,a*b,d,a,c,e)};
 THREE.Matrix4.makeOrtho=function(a,b,c,e,d,f){var g,i,h,j;g=new THREE.Matrix4;i=b-a;h=c-e;j=f-d;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+e)/h);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+d)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Matrix4.makeOrtho=function(a,b,c,e,d,f){var g,i,h,j;g=new THREE.Matrix4;i=b-a;h=c-e;j=f-d;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+e)/h);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+d)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=e*d;this.w=g*f-i*c;this.x=g*c+i*f;this.y=e*b*f+a*d*c;this.z=a*d*f-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=e*d;this.w=g*f-i*c;this.x=g*c+i*f;this.y=e*b*f+a*d*c;this.z=a*d*f-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+d*f+c*i-e*g;this.y=c*a+d*g+e*f-b*i;this.z=e*a+d*i+b*g-c*f;this.w=d*a-b*f-c*g-e*i;return this},
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+d*f+c*i-e*g;this.y=c*a+d*g+e*f-b*i;this.z=e*a+d*i+b*g-c*f;this.w=d*a-b*f-c*g-e*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*d-i*e,k=h*e+i*c-f*d,n=h*d+f*e-g*c;c=-f*c-g*e-i*d;b.x=j*h+c*-f+k*-i-n*-g;b.y=k*h+c*-g+n*-f-j*-i;b.z=n*h+c*-i+j*-g-k*-f;return b}};
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*d-i*e,k=h*e+i*c-f*d,n=h*d+f*e-g*c;c=-f*c-g*e-i*d;b.x=j*h+c*-f+k*-i-n*-g;b.y=k*h+c*-g+n*-f-j*-i;b.z=n*h+c*-i+j*-g-k*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,f,g){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.Face4=function(a,b,c,e,d,f,g){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -56,9 +56,9 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,e,d,f,g,i=new THREE.Vector3,h=new THREE.Vector3;e=0;for(d=this.faces.length;e<d;e++){f=this.faces[e];if(a&&f.vertexNormals.length){i.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)i.addSelf(f.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];g=this.vertices[f.c];i.sub(g.position,c.position);h.sub(b.position,c.position);i.crossSelf(h)}i.isZero()||
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,e,d,f,g,i=new THREE.Vector3,h=new THREE.Vector3;e=0;for(d=this.faces.length;e<d;e++){f=this.faces[e];if(a&&f.vertexNormals.length){i.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)i.addSelf(f.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];g=this.vertices[f.c];i.sub(g.position,c.position);h.sub(b.position,c.position);i.crossSelf(h)}i.isZero()||
 i.normalize();f.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=
 i.normalize();f.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=
 this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal);e[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(e[c.a]);
 this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal);e[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(e[c.a]);
-c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c]);c.vertexNormals[3].copy(e[c.d])}}},computeTangents:function(){function a(M,T,U,C,A,F,E){i=M.vertices[T].position;h=M.vertices[U].position;j=M.vertices[C].position;k=g[A];n=g[F];p=g[E];o=h.x-i.x;v=j.x-i.x;y=h.y-i.y;G=j.y-i.y;B=h.z-i.z;z=j.z-i.z;D=n.u-k.u;I=p.u-k.u;H=n.v-k.v;q=p.v-k.v;aa=1/(D*q-I*H);w.set((q*
-o-H*v)*aa,(q*y-H*G)*aa,(q*B-H*z)*aa);s.set((D*v-I*o)*aa,(D*G-I*y)*aa,(D*z-I*B)*aa);P[T].addSelf(w);P[U].addSelf(w);P[C].addSelf(w);Q[T].addSelf(s);Q[U].addSelf(s);Q[C].addSelf(s)}var b,c,e,d,f,g,i,h,j,k,n,p,o,v,y,G,B,z,D,I,H,q,aa,K,P=[],Q=[],w=new THREE.Vector3,s=new THREE.Vector3,L=new THREE.Vector3,W=new THREE.Vector3,X=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){P[b]=new THREE.Vector3;Q[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];
-if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.c,0,1,2);a(this,f.a,f.b,f.d,0,1,3)}}var Y=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(e=0;e<f.vertexNormals.length;e++){X.copy(f.vertexNormals[e]);d=f[Y[e]];K=P[d];L.copy(K);L.subSelf(X.multiplyScalar(X.dot(K))).normalize();W.cross(f.vertexNormals[e],K);d=W.dot(Q[d]);d=d<0?-1:1;f.vertexTangents[e]=new THREE.Vector4(L.x,L.y,L.z,d)}}this.hasTangents=!0},computeBoundingBox:function(){var a;
+c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c]);c.vertexNormals[3].copy(e[c.d])}}},computeTangents:function(){function a(E,R,S,W,H,C,F){i=E.vertices[R].position;h=E.vertices[S].position;j=E.vertices[W].position;k=g[H];n=g[C];q=g[F];o=h.x-i.x;w=j.x-i.x;z=h.y-i.y;D=j.y-i.y;A=h.z-i.z;U=j.z-i.z;V=n.u-k.u;B=q.u-k.u;u=n.v-k.v;p=q.v-k.v;Y=1/(V*p-B*u);x.set((p*
+o-u*w)*Y,(p*z-u*D)*Y,(p*A-u*U)*Y);t.set((V*w-B*o)*Y,(V*D-B*z)*Y,(V*U-B*A)*Y);aa[R].addSelf(x);aa[S].addSelf(x);aa[W].addSelf(x);P[R].addSelf(t);P[S].addSelf(t);P[W].addSelf(t)}var b,c,e,d,f,g,i,h,j,k,n,q,o,w,z,D,A,U,V,B,u,p,Y,Z,aa=[],P=[],x=new THREE.Vector3,t=new THREE.Vector3,K=new THREE.Vector3,N=new THREE.Vector3,Q=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){aa[b]=new THREE.Vector3;P[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];
+if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.c,0,1,2);a(this,f.a,f.b,f.d,0,1,3)}}var T=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(e=0;e<f.vertexNormals.length;e++){Q.copy(f.vertexNormals[e]);d=f[T[e]];Z=aa[d];K.copy(Z);K.subSelf(Q.multiplyScalar(Q.dot(Z))).normalize();N.cross(f.vertexNormals[e],Z);d=N.dot(P[d]);d=d<0?-1:1;f.vertexTangents[e]=new THREE.Vector4(K.x,K.y,K.z,d)}}this.hasTangents=!0},computeBoundingBox:function(){var a;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;
 else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
 else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
 THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(d){for(var f=0;f<a.length;f++)a[f].update(d)};c.addToUpdate=function(d){a.indexOf(d)===-1&&a.push(d)};c.removeFromUpdate=function(d){d=a.indexOf(d);d!==-1&&a.splice(d,1)};c.add=function(d){b[d.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+d.name+" already exists in library. Overwriting.");b[d.name]=d;if(d.initialized!==!0){for(var f=0;f<d.hierarchy.length;f++){for(var g=0;g<d.hierarchy[f].keys.length;g++){if(d.hierarchy[f].keys[g].time<
 THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(d){for(var f=0;f<a.length;f++)a[f].update(d)};c.addToUpdate=function(d){a.indexOf(d)===-1&&a.push(d)};c.removeFromUpdate=function(d){d=a.indexOf(d);d!==-1&&a.splice(d,1)};c.add=function(d){b[d.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+d.name+" already exists in library. Overwriting.");b[d.name]=d;if(d.initialized!==!0){for(var f=0;f<d.hierarchy.length;f++){for(var g=0;g<d.hierarchy[f].keys.length;g++){if(d.hierarchy[f].keys[g].time<
@@ -70,8 +70,8 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
 d instanceof THREE.Bone?d.skinMatrix:d.matrix}var f=d.animationCache.prevKey;d=d.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];d.pos=this.getNextKeyWith("pos",c,1);d.rot=this.getNextKeyWith("rot",c,1);d.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 d instanceof THREE.Bone?d.skinMatrix:d.matrix}var f=d.animationCache.prevKey;d=d.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];d.pos=this.getNextKeyWith("pos",c,1);d.rot=this.getNextKeyWith("rot",c,1);d.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,d,f,g,i,h,j,k=this.data.JIT.hierarchy,n,p;this.currentTime+=a*this.timeScale;p=this.currentTime;n=this.currentTime%=this.data.length;j=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,v=this.hierarchy.length;o<v;o++){a=this.hierarchy[o];h=a.animationCache;if(this.JITCompile&&k[o][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=k[o][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=k[o][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var y=0;y<3;y++){c=b[y];g=h.prevKey[c];i=h.nextKey[c];if(i.time<=p){if(n<p)if(this.loop){g=this.data.hierarchy[o].keys[0];for(i=this.getNextKeyWith(c,o,1);i.time<n;){g=i;i=this.getNextKeyWith(c,o,i.index+1)}}else{this.stop();return}else{do{g=i;i=this.getNextKeyWith(c,o,i.index+1)}while(i.time<
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,d,f,g,i,h,j,k=this.data.JIT.hierarchy,n,q;this.currentTime+=a*this.timeScale;q=this.currentTime;n=this.currentTime%=this.data.length;j=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,w=this.hierarchy.length;o<w;o++){a=this.hierarchy[o];h=a.animationCache;if(this.JITCompile&&k[o][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=k[o][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=k[o][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var z=0;z<3;z++){c=b[z];g=h.prevKey[c];i=h.nextKey[c];if(i.time<=q){if(n<q)if(this.loop){g=this.data.hierarchy[o].keys[0];for(i=this.getNextKeyWith(c,o,1);i.time<n;){g=i;i=this.getNextKeyWith(c,o,i.index+1)}}else{this.stop();return}else{do{g=i;i=this.getNextKeyWith(c,o,i.index+1)}while(i.time<
 n)}h.prevKey[c]=g;h.nextKey[c]=i}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(n-g.time)/(i.time-g.time);d=g[c];f=i[c];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+o);e=e<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=d[0]+(f[0]-d[0])*e;c.y=d[1]+(f[1]-d[1])*e;c.z=d[2]+(f[2]-d[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
 n)}h.prevKey[c]=g;h.nextKey[c]=i}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(n-g.time)/(i.time-g.time);d=g[c];f=i[c];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+o);e=e<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=d[0]+(f[0]-d[0])*e;c.y=d[1]+(f[1]-d[1])*e;c.z=d[2]+(f[2]-d[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
 this.getPrevKeyWith("pos",o,g.index-1).pos;this.points[1]=d;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",o,i.index+1).pos;e=e*0.33+0.33;d=this.interpolateCatmullRom(this.points,e);c.x=d[0];c.y=d[1];c.z=d[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(c===
 this.getPrevKeyWith("pos",o,g.index-1).pos;this.points[1]=d;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",o,i.index+1).pos;e=e*0.33+0.33;d=this.interpolateCatmullRom(this.points,e);c.x=d[0];c.y=d[1];c.z=d[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(c===
 "rot")THREE.Quaternion.slerp(d,f,a.quaternion,e);else if(c==="scl"){c=a.scale;c.x=d[0]+(f[0]-d[0])*e;c.y=d[1]+(f[1]-d[1])*e;c.z=d[2]+(f[2]-d[2])*e}}}}if(this.JITCompile&&k[0][j]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)k[o][j]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
 "rot")THREE.Quaternion.slerp(d,f,a.quaternion,e);else if(c==="scl"){c=a.scale;c.x=d[0]+(f[0]-d[0])*e;c.y=d[1]+(f[1]-d[1])*e;c.z=d[2]+(f[2]-d[2])*e}}}}if(this.JITCompile&&k[0][j]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)k[o][j]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
@@ -80,10 +80,11 @@ THREE.Animation.prototype.interpolate=function(a,b,c,e,d,f,g){a=(c-a)*0.5;e=(e-b
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
 THREE.Camera=function(a,b,c,e,d){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=e||2E3;this.target=d||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera=function(a,b,c,e,d){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=e||2E3;this.target=d||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
-THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position)}a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0;for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};
-THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1;this.distance=c||0};THREE.DirectionalLight.prototype=new THREE.Light;
-THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1;this.distance=c||0};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
-THREE.MultiplyBlending=3;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
+THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
+!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
+THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1;this.distance=c||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1;this.distance=c||0};THREE.PointLight.prototype=new THREE.Light;
+THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
+THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;
@@ -123,42 +124,42 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.f
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;
 THREE.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.Projector=function(){function a(){var w=h[i]=h[i]||new THREE.RenderableVertex;i++;return w}function b(w,s){return s.z-w.z}function c(w,s){var L=0,W=1,X=w.z+w.w,Y=s.z+s.w,M=-w.z+w.w,T=-s.z+s.w;if(X>=0&&Y>=0&&M>=0&&T>=0)return!0;else if(X<0&&Y<0||M<0&&T<0)return!1;else{if(X<0)L=Math.max(L,X/(X-Y));else Y<0&&(W=Math.min(W,X/(X-Y)));if(M<0)L=Math.max(L,M/(M-T));else T<0&&(W=Math.min(W,M/(M-T)));if(W<L)return!1;else{w.lerpSelf(s,L);s.lerpSelf(w,1-W);return!0}}}var e,d,f=[],g,i,h=[],j,k,n=[],p,o=
-[],v,y,G=[],B,z,D=[],I=new THREE.Vector4,H=new THREE.Vector4,q=new THREE.Matrix4,aa=new THREE.Matrix4,K=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],P=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(w,s){q.multiply(s.projectionMatrix,s.matrixWorldInverse);q.multiplyVector3(w);return w};this.unprojectVector=function(w,s){q.multiply(s.matrixWorld,THREE.Matrix4.makeInvert(s.projectionMatrix));q.multiplyVector3(w);return w};
-this.projectObjects=function(w,s,L){s=[];var W,X,Y;d=0;X=w.objects;w=0;for(W=X.length;w<W;w++){Y=X[w];var M;if(!(M=!Y.visible))if(M=Y instanceof THREE.Mesh){a:{M=void 0;for(var T=Y.matrixWorld,U=-Y.geometry.boundingSphere.radius*Math.max(Y.scale.x,Math.max(Y.scale.y,Y.scale.z)),C=0;C<6;C++){M=K[C].x*T.n14+K[C].y*T.n24+K[C].z*T.n34+K[C].w;if(M<=U){M=!1;break a}}M=!0}M=!M}if(!M){M=f[d]=f[d]||new THREE.RenderableObject;d++;e=M;I.copy(Y.position);q.multiplyVector3(I);e.object=Y;e.z=I.z;s.push(e)}}L&&
-s.sort(b);return s};this.projectScene=function(w,s,L){var W=[],X=s.near,Y=s.far,M,T,U,C,A,F,E,S,ba,R,da,ea,Fa,Ga,na,Ba,ua;z=y=p=k=0;s.matrixAutoUpdate&&s.updateMatrix();w.update(undefined,!1,s);q.multiply(s.projectionMatrix,s.matrixWorldInverse);K[0].set(q.n41-q.n11,q.n42-q.n12,q.n43-q.n13,q.n44-q.n14);K[1].set(q.n41+q.n11,q.n42+q.n12,q.n43+q.n13,q.n44+q.n14);K[2].set(q.n41+q.n21,q.n42+q.n22,q.n43+q.n23,q.n44+q.n24);K[3].set(q.n41-q.n21,q.n42-q.n22,q.n43-q.n23,q.n44-q.n24);K[4].set(q.n41-q.n31,q.n42-
-q.n32,q.n43-q.n33,q.n44-q.n34);K[5].set(q.n41+q.n31,q.n42+q.n32,q.n43+q.n33,q.n44+q.n34);for(M=0;M<6;M++){ba=K[M];ba.divideScalar(Math.sqrt(ba.x*ba.x+ba.y*ba.y+ba.z*ba.z))}ba=this.projectObjects(w,s,!0);w=0;for(M=ba.length;w<M;w++){R=ba[w].object;if(R.visible){da=R.matrixWorld;ea=R.matrixRotationWorld;Fa=R.materials;Ga=R.overdraw;i=0;if(R instanceof THREE.Mesh){na=R.geometry;C=na.vertices;Ba=na.faces;na=na.faceVertexUvs;T=0;for(U=C.length;T<U;T++){g=a();g.positionWorld.copy(C[T].position);da.multiplyVector3(g.positionWorld);
-g.positionScreen.copy(g.positionWorld);q.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>X&&g.positionScreen.z<Y}C=0;for(T=Ba.length;C<T;C++){U=Ba[C];if(U instanceof THREE.Face3){A=h[U.a];F=h[U.b];E=h[U.c];if(A.visible&&F.visible&&E.visible&&(R.doubleSided||R.flipSided!=(E.positionScreen.x-A.positionScreen.x)*(F.positionScreen.y-A.positionScreen.y)-(E.positionScreen.y-A.positionScreen.y)*(F.positionScreen.x-
-A.positionScreen.x)<0)){S=n[k]=n[k]||new THREE.RenderableFace3;k++;j=S;j.v1.copy(A);j.v2.copy(F);j.v3.copy(E)}else continue}else if(U instanceof THREE.Face4){A=h[U.a];F=h[U.b];E=h[U.c];S=h[U.d];if(A.visible&&F.visible&&E.visible&&S.visible&&(R.doubleSided||R.flipSided!=((S.positionScreen.x-A.positionScreen.x)*(F.positionScreen.y-A.positionScreen.y)-(S.positionScreen.y-A.positionScreen.y)*(F.positionScreen.x-A.positionScreen.x)<0||(F.positionScreen.x-E.positionScreen.x)*(S.positionScreen.y-E.positionScreen.y)-
-(F.positionScreen.y-E.positionScreen.y)*(S.positionScreen.x-E.positionScreen.x)<0))){ua=o[p]=o[p]||new THREE.RenderableFace4;p++;j=ua;j.v1.copy(A);j.v2.copy(F);j.v3.copy(E);j.v4.copy(S)}else continue}j.normalWorld.copy(U.normal);ea.multiplyVector3(j.normalWorld);j.centroidWorld.copy(U.centroid);da.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);q.multiplyVector3(j.centroidScreen);E=U.vertexNormals;A=0;for(F=E.length;A<F;A++){S=j.vertexNormalsWorld[A];S.copy(E[A]);ea.multiplyVector3(S)}A=
-0;for(F=na.length;A<F;A++)if(ua=na[A][C]){E=0;for(S=ua.length;E<S;E++)j.uvs[A][E]=ua[E]}j.meshMaterials=Fa;j.faceMaterials=U.materials;j.overdraw=Ga;j.z=j.centroidScreen.z;W.push(j)}}else if(R instanceof THREE.Line){aa.multiply(q,da);C=R.geometry.vertices;A=a();A.positionScreen.copy(C[0].position);aa.multiplyVector4(A.positionScreen);T=1;for(U=C.length;T<U;T++){A=a();A.positionScreen.copy(C[T].position);aa.multiplyVector4(A.positionScreen);F=h[i-2];P.copy(A.positionScreen);Q.copy(F.positionScreen);
-if(c(P,Q)){P.multiplyScalar(1/P.w);Q.multiplyScalar(1/Q.w);da=G[y]=G[y]||new THREE.RenderableLine;y++;v=da;v.v1.positionScreen.copy(P);v.v2.positionScreen.copy(Q);v.z=Math.max(P.z,Q.z);v.materials=R.materials;W.push(v)}}}else if(R instanceof THREE.Particle){H.set(R.position.x,R.position.y,R.position.z,1);q.multiplyVector4(H);H.z/=H.w;if(H.z>0&&H.z<1){da=D[z]=D[z]||new THREE.RenderableParticle;z++;B=da;B.x=H.x/H.w;B.y=H.y/H.w;B.z=H.z;B.rotation=R.rotation.z;B.scale.x=R.scale.x*Math.abs(B.x-(H.x+s.projectionMatrix.n11)/
-(H.w+s.projectionMatrix.n14));B.scale.y=R.scale.y*Math.abs(B.y-(H.y+s.projectionMatrix.n22)/(H.w+s.projectionMatrix.n24));B.materials=R.materials;W.push(B)}}}}L&&W.sort(b);return W}};
-THREE.CanvasRenderer=function(){function a(Z){if(o!=Z)k.globalAlpha=o=Z}function b(Z){if(v!=Z){switch(Z){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}v=Z}}function c(Z){if(y!=Z)k.strokeStyle=y=Z}var e=null,d=new THREE.Projector,f=document.createElement("canvas"),g,i,h,j,k=f.getContext("2d"),n=new THREE.Color(0),p=0,o=1,v=0,y=null,G=null,
-B=1,z,D,I,H,q=new THREE.RenderableVertex,aa=new THREE.RenderableVertex,K,P,Q,w,s,L,W,X,Y,M,T,U,C=new THREE.Color,A=new THREE.Color,F=new THREE.Color,E=new THREE.Color,S=new THREE.Color,ba,R,da,ea,Fa,Ga,na,Ba,ua,Wa,za=new THREE.Rectangle,ia=new THREE.Rectangle,fa=new THREE.Rectangle,Ua=!1,ha=new THREE.Color,ga=new THREE.Color,Ma=new THREE.Color,Na=new THREE.Color,$=new THREE.Vector3,Ha,Ia,Va,ja,Ja,Oa,Ca=16;Ha=document.createElement("canvas");Ha.width=Ha.height=2;Ia=Ha.getContext("2d");Ia.fillStyle=
-"rgba(0,0,0,1)";Ia.fillRect(0,0,2,2);Va=Ia.getImageData(0,0,2,2);ja=Va.data;Ja=document.createElement("canvas");Ja.width=Ja.height=Ca;Oa=Ja.getContext("2d");Oa.translate(-Ca/2,-Ca/2);Oa.scale(Ca,Ca);Ca--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(Z,ka){g=Z;i=ka;h=g/2;j=i/2;f.width=g;f.height=i;za.set(-h,-j,h,j);o=1;v=0;G=y=null;B=1};this.setClearColor=function(Z,ka){n=Z;p=ka};this.setClearColorHex=function(Z,ka){n.setHex(Z);p=ka};this.clear=
-function(){k.setTransform(1,0,0,-1,h,j);if(!ia.isEmpty()){ia.inflate(1);ia.minSelf(za);if(n.hex==0&&p==0)k.clearRect(ia.getX(),ia.getY(),ia.getWidth(),ia.getHeight());else{b(THREE.NormalBlending);a(1);k.fillStyle="rgba("+Math.floor(n.r*255)+","+Math.floor(n.g*255)+","+Math.floor(n.b*255)+","+p+")";k.fillRect(ia.getX(),ia.getY(),ia.getWidth(),ia.getHeight())}ia.empty()}};this.render=function(Z,ka){function Za(l){var x,t,r,N=l.lights;ga.setRGB(0,0,0);Ma.setRGB(0,0,0);Na.setRGB(0,0,0);l=0;for(x=N.length;l<
-x;l++){t=N[l];r=t.color;if(t instanceof THREE.AmbientLight){ga.r+=r.r;ga.g+=r.g;ga.b+=r.b}else if(t instanceof THREE.DirectionalLight){Ma.r+=r.r;Ma.g+=r.g;Ma.b+=r.b}else if(t instanceof THREE.PointLight){Na.r+=r.r;Na.g+=r.g;Na.b+=r.b}}}function pa(l,x,t,r){var N,J,u,m,V=l.lights;l=0;for(N=V.length;l<N;l++){J=V[l];u=J.color;if(J instanceof THREE.DirectionalLight){m=t.dot(J.position);if(!(m<=0)){m*=J.intensity;r.r+=u.r*m;r.g+=u.g*m;r.b+=u.b*m}}else if(J instanceof THREE.PointLight){m=t.dot($.sub(J.position,
-x).normalize());if(!(m<=0)){m*=J.distance==0?1:1-Math.min(x.distanceTo(J.position)/J.distance,1);if(m!=0){m*=J.intensity;r.r+=u.r*m;r.g+=u.g*m;r.b+=u.b*m}}}}}function $a(l,x,t){a(t.opacity);b(t.blending);var r,N,J,u,m,V;if(t instanceof THREE.ParticleBasicMaterial){if(t.map){u=t.map.image;m=u.width>>1;V=u.height>>1;t=x.scale.x*h;J=x.scale.y*j;r=t*m;N=J*V;fa.set(l.x-r,l.y-N,l.x+r,l.y+N);if(za.instersects(fa)){k.save();k.translate(l.x,l.y);k.rotate(-x.rotation);k.scale(t,-J);k.translate(-m,-V);k.drawImage(u,
-0,0);k.restore()}}}else if(t instanceof THREE.ParticleCanvasMaterial){r=x.scale.x*h;N=x.scale.y*j;fa.set(l.x-r,l.y-N,l.x+r,l.y+N);if(za.instersects(fa)){c(t.color.__styleString);J=t.color.__styleString;if(G!=J)k.fillStyle=G=J;k.save();k.translate(l.x,l.y);k.rotate(-x.rotation);k.scale(r,N);t.program(k);k.restore()}}}function ab(l,x,t,r){a(r.opacity);b(r.blending);k.beginPath();k.moveTo(l.positionScreen.x,l.positionScreen.y);k.lineTo(x.positionScreen.x,x.positionScreen.y);k.closePath();if(r instanceof
-THREE.LineBasicMaterial){C.__styleString=r.color.__styleString;l=r.linewidth;if(B!=l)k.lineWidth=B=l;c(C.__styleString);k.stroke();fa.inflate(r.linewidth*2)}}function Pa(l,x,t,r,N,J,u,m,V){a(m.opacity);b(m.blending);K=l.positionScreen.x;P=l.positionScreen.y;Q=x.positionScreen.x;w=x.positionScreen.y;s=t.positionScreen.x;L=t.positionScreen.y;Ka(K,P,Q,w,s,L);if(m instanceof THREE.MeshBasicMaterial)if(m.map){if(m.map.mapping instanceof THREE.UVMapping){ea=u.uvs[0];qa(K,P,Q,w,s,L,m.map.image,ea[r].u,ea[r].v,
-ea[N].u,ea[N].v,ea[J].u,ea[J].v)}}else if(m.envMap){if(m.envMap.mapping instanceof THREE.SphericalReflectionMapping){l=ka.matrixWorldInverse;$.copy(u.vertexNormalsWorld[0]);Fa=($.x*l.n11+$.y*l.n12+$.z*l.n13)*0.5+0.5;Ga=-($.x*l.n21+$.y*l.n22+$.z*l.n23)*0.5+0.5;$.copy(u.vertexNormalsWorld[1]);na=($.x*l.n11+$.y*l.n12+$.z*l.n13)*0.5+0.5;Ba=-($.x*l.n21+$.y*l.n22+$.z*l.n23)*0.5+0.5;$.copy(u.vertexNormalsWorld[2]);ua=($.x*l.n11+$.y*l.n12+$.z*l.n13)*0.5+0.5;Wa=-($.x*l.n21+$.y*l.n22+$.z*l.n23)*0.5+0.5;qa(K,
-P,Q,w,s,L,m.envMap.image,Fa,Ga,na,Ba,ua,Wa)}}else m.wireframe?va(m.color.__styleString,m.wireframeLinewidth):wa(m.color.__styleString);else if(m instanceof THREE.MeshLambertMaterial){if(m.map&&!m.wireframe){if(m.map.mapping instanceof THREE.UVMapping){ea=u.uvs[0];qa(K,P,Q,w,s,L,m.map.image,ea[r].u,ea[r].v,ea[N].u,ea[N].v,ea[J].u,ea[J].v)}b(THREE.SubtractiveBlending)}if(Ua)if(!m.wireframe&&m.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3){A.r=F.r=E.r=ga.r;A.g=F.g=E.g=ga.g;A.b=F.b=E.b=
-ga.b;pa(V,u.v1.positionWorld,u.vertexNormalsWorld[0],A);pa(V,u.v2.positionWorld,u.vertexNormalsWorld[1],F);pa(V,u.v3.positionWorld,u.vertexNormalsWorld[2],E);S.r=(F.r+E.r)*0.5;S.g=(F.g+E.g)*0.5;S.b=(F.b+E.b)*0.5;da=Qa(A,F,E,S);qa(K,P,Q,w,s,L,da,0,0,1,0,0,1)}else{ha.r=ga.r;ha.g=ga.g;ha.b=ga.b;pa(V,u.centroidWorld,u.normalWorld,ha);C.r=m.color.r*ha.r;C.g=m.color.g*ha.g;C.b=m.color.b*ha.b;C.updateStyleString();m.wireframe?va(C.__styleString,m.wireframeLinewidth):wa(C.__styleString)}else m.wireframe?
-va(m.color.__styleString,m.wireframeLinewidth):wa(m.color.__styleString)}else if(m instanceof THREE.MeshDepthMaterial){ba=ka.near;R=ka.far;A.r=A.g=A.b=1-Aa(l.positionScreen.z,ba,R);F.r=F.g=F.b=1-Aa(x.positionScreen.z,ba,R);E.r=E.g=E.b=1-Aa(t.positionScreen.z,ba,R);S.r=(F.r+E.r)*0.5;S.g=(F.g+E.g)*0.5;S.b=(F.b+E.b)*0.5;da=Qa(A,F,E,S);qa(K,P,Q,w,s,L,da,0,0,1,0,0,1)}else if(m instanceof THREE.MeshNormalMaterial){C.r=Da(u.normalWorld.x);C.g=Da(u.normalWorld.y);C.b=Da(u.normalWorld.z);C.updateStyleString();
-m.wireframe?va(C.__styleString,m.wireframeLinewidth):wa(C.__styleString)}}function Xa(l,x,t,r,N,J,u,m,V){a(m.opacity);b(m.blending);if(m.map||m.envMap){Pa(l,x,r,0,1,3,u,m,V);Pa(N,t,J,1,2,3,u,m,V)}else{K=l.positionScreen.x;P=l.positionScreen.y;Q=x.positionScreen.x;w=x.positionScreen.y;s=t.positionScreen.x;L=t.positionScreen.y;W=r.positionScreen.x;X=r.positionScreen.y;Y=N.positionScreen.x;M=N.positionScreen.y;T=J.positionScreen.x;U=J.positionScreen.y;if(m instanceof THREE.MeshBasicMaterial){Ra(K,P,
-Q,w,s,L,W,X);m.wireframe?va(m.color.__styleString,m.wireframeLinewidth):wa(m.color.__styleString)}else if(m instanceof THREE.MeshLambertMaterial)if(Ua)if(!m.wireframe&&m.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==4){A.r=F.r=E.r=S.r=ga.r;A.g=F.g=E.g=S.g=ga.g;A.b=F.b=E.b=S.b=ga.b;pa(V,u.v1.positionWorld,u.vertexNormalsWorld[0],A);pa(V,u.v2.positionWorld,u.vertexNormalsWorld[1],F);pa(V,u.v4.positionWorld,u.vertexNormalsWorld[3],E);pa(V,u.v3.positionWorld,u.vertexNormalsWorld[2],S);da=
-Qa(A,F,E,S);Ka(K,P,Q,w,W,X);qa(K,P,Q,w,W,X,da,0,0,1,0,0,1);Ka(Y,M,s,L,T,U);qa(Y,M,s,L,T,U,da,1,0,1,1,0,1)}else{ha.r=ga.r;ha.g=ga.g;ha.b=ga.b;pa(V,u.centroidWorld,u.normalWorld,ha);C.r=m.color.r*ha.r;C.g=m.color.g*ha.g;C.b=m.color.b*ha.b;C.updateStyleString();Ra(K,P,Q,w,s,L,W,X);m.wireframe?va(C.__styleString,m.wireframeLinewidth):wa(C.__styleString)}else{Ra(K,P,Q,w,s,L,W,X);m.wireframe?va(m.color.__styleString,m.wireframeLinewidth):wa(m.color.__styleString)}else if(m instanceof THREE.MeshNormalMaterial){C.r=
-Da(u.normalWorld.x);C.g=Da(u.normalWorld.y);C.b=Da(u.normalWorld.z);C.updateStyleString();Ra(K,P,Q,w,s,L,W,X);m.wireframe?va(C.__styleString,m.wireframeLinewidth):wa(C.__styleString)}else if(m instanceof THREE.MeshDepthMaterial){ba=ka.near;R=ka.far;A.r=A.g=A.b=1-Aa(l.positionScreen.z,ba,R);F.r=F.g=F.b=1-Aa(x.positionScreen.z,ba,R);E.r=E.g=E.b=1-Aa(r.positionScreen.z,ba,R);S.r=S.g=S.b=1-Aa(t.positionScreen.z,ba,R);da=Qa(A,F,E,S);Ka(K,P,Q,w,W,X);qa(K,P,Q,w,W,X,da,0,0,1,0,0,1);Ka(Y,M,s,L,T,U);qa(Y,M,
-s,L,T,U,da,1,0,1,1,0,1)}}}function Ka(l,x,t,r,N,J){k.beginPath();k.moveTo(l,x);k.lineTo(t,r);k.lineTo(N,J);k.lineTo(l,x);k.closePath()}function Ra(l,x,t,r,N,J,u,m){k.beginPath();k.moveTo(l,x);k.lineTo(t,r);k.lineTo(N,J);k.lineTo(u,m);k.lineTo(l,x);k.closePath()}function va(l,x){c(l);if(B!=x)k.lineWidth=B=x;k.stroke();fa.inflate(x*2)}function wa(l){if(G!=l)k.fillStyle=G=l;k.fill()}function qa(l,x,t,r,N,J,u,m,V,ra,la,sa,La){var oa,ta;oa=u.width-1;ta=u.height-1;m*=oa;V*=ta;ra*=oa;la*=ta;sa*=oa;La*=ta;
-t-=l;r-=x;N-=l;J-=x;ra-=m;la-=V;sa-=m;La-=V;oa=ra*La-sa*la;if(oa!=0){ta=1/oa;oa=(La*t-la*N)*ta;la=(La*r-la*J)*ta;t=(ra*N-sa*t)*ta;r=(ra*J-sa*r)*ta;l=l-oa*m-t*V;x=x-la*m-r*V;k.save();k.transform(oa,la,t,r,l,x);k.clip();k.drawImage(u,0,0);k.restore()}}function Qa(l,x,t,r){var N=~~(l.r*255),J=~~(l.g*255);l=~~(l.b*255);var u=~~(x.r*255),m=~~(x.g*255);x=~~(x.b*255);var V=~~(t.r*255),ra=~~(t.g*255);t=~~(t.b*255);var la=~~(r.r*255),sa=~~(r.g*255);r=~~(r.b*255);ja[0]=N<0?0:N>255?255:N;ja[1]=J<0?0:J>255?255:
-J;ja[2]=l<0?0:l>255?255:l;ja[4]=u<0?0:u>255?255:u;ja[5]=m<0?0:m>255?255:m;ja[6]=x<0?0:x>255?255:x;ja[8]=V<0?0:V>255?255:V;ja[9]=ra<0?0:ra>255?255:ra;ja[10]=t<0?0:t>255?255:t;ja[12]=la<0?0:la>255?255:la;ja[13]=sa<0?0:sa>255?255:sa;ja[14]=r<0?0:r>255?255:r;Ia.putImageData(Va,0,0);Oa.drawImage(Ha,0,0);return Ja}function Aa(l,x,t){l=(l-x)/(t-x);return l*l*(3-2*l)}function Da(l){l=(l+1)*0.5;return l<0?0:l>1?1:l}function xa(l,x){var t=x.x-l.x,r=x.y-l.y,N=1/Math.sqrt(t*t+r*r);t*=N;r*=N;x.x+=t;x.y+=r;l.x-=
-t;l.y-=r}var Sa,Ya,O,ma,ya,Ea,Ta,ca;this.autoClear?this.clear():k.setTransform(1,0,0,-1,h,j);e=d.projectScene(Z,ka,this.sortElements);(Ua=Z.lights.length>0)&&Za(Z);Sa=0;for(Ya=e.length;Sa<Ya;Sa++){O=e[Sa];fa.empty();if(O instanceof THREE.RenderableParticle){z=O;z.x*=h;z.y*=j;ma=0;for(ya=O.materials.length;ma<ya;){ca=O.materials[ma++];ca.opacity!=0&&$a(z,O,ca,Z)}}else if(O instanceof THREE.RenderableLine){z=O.v1;D=O.v2;z.positionScreen.x*=h;z.positionScreen.y*=j;D.positionScreen.x*=h;D.positionScreen.y*=
-j;fa.addPoint(z.positionScreen.x,z.positionScreen.y);fa.addPoint(D.positionScreen.x,D.positionScreen.y);if(za.instersects(fa)){ma=0;for(ya=O.materials.length;ma<ya;){ca=O.materials[ma++];ca.opacity!=0&&ab(z,D,O,ca,Z)}}}else if(O instanceof THREE.RenderableFace3){z=O.v1;D=O.v2;I=O.v3;z.positionScreen.x*=h;z.positionScreen.y*=j;D.positionScreen.x*=h;D.positionScreen.y*=j;I.positionScreen.x*=h;I.positionScreen.y*=j;if(O.overdraw){xa(z.positionScreen,D.positionScreen);xa(D.positionScreen,I.positionScreen);
-xa(I.positionScreen,z.positionScreen)}fa.add3Points(z.positionScreen.x,z.positionScreen.y,D.positionScreen.x,D.positionScreen.y,I.positionScreen.x,I.positionScreen.y);if(za.instersects(fa)){ma=0;for(ya=O.meshMaterials.length;ma<ya;){ca=O.meshMaterials[ma++];if(ca instanceof THREE.MeshFaceMaterial){Ea=0;for(Ta=O.faceMaterials.length;Ea<Ta;)(ca=O.faceMaterials[Ea++])&&ca.opacity!=0&&Pa(z,D,I,0,1,2,O,ca,Z)}else ca.opacity!=0&&Pa(z,D,I,0,1,2,O,ca,Z)}}}else if(O instanceof THREE.RenderableFace4){z=O.v1;
-D=O.v2;I=O.v3;H=O.v4;z.positionScreen.x*=h;z.positionScreen.y*=j;D.positionScreen.x*=h;D.positionScreen.y*=j;I.positionScreen.x*=h;I.positionScreen.y*=j;H.positionScreen.x*=h;H.positionScreen.y*=j;q.positionScreen.copy(D.positionScreen);aa.positionScreen.copy(H.positionScreen);if(O.overdraw){xa(z.positionScreen,D.positionScreen);xa(D.positionScreen,H.positionScreen);xa(H.positionScreen,z.positionScreen);xa(I.positionScreen,q.positionScreen);xa(I.positionScreen,aa.positionScreen)}fa.addPoint(z.positionScreen.x,
-z.positionScreen.y);fa.addPoint(D.positionScreen.x,D.positionScreen.y);fa.addPoint(I.positionScreen.x,I.positionScreen.y);fa.addPoint(H.positionScreen.x,H.positionScreen.y);if(za.instersects(fa)){ma=0;for(ya=O.meshMaterials.length;ma<ya;){ca=O.meshMaterials[ma++];if(ca instanceof THREE.MeshFaceMaterial){Ea=0;for(Ta=O.faceMaterials.length;Ea<Ta;)(ca=O.faceMaterials[Ea++])&&ca.opacity!=0&&Xa(z,D,I,H,q,aa,O,ca,Z)}else ca.opacity!=0&&Xa(z,D,I,H,q,aa,O,ca,Z)}}}ia.addRectangle(fa)}k.setTransform(1,0,0,
-1,0,0)}};
+THREE.Projector=function(){function a(){var x=h[i]=h[i]||new THREE.RenderableVertex;i++;return x}function b(x,t){return t.z-x.z}function c(x,t){var K=0,N=1,Q=x.z+x.w,T=t.z+t.w,E=-x.z+x.w,R=-t.z+t.w;if(Q>=0&&T>=0&&E>=0&&R>=0)return!0;else if(Q<0&&T<0||E<0&&R<0)return!1;else{if(Q<0)K=Math.max(K,Q/(Q-T));else T<0&&(N=Math.min(N,Q/(Q-T)));if(E<0)K=Math.max(K,E/(E-R));else R<0&&(N=Math.min(N,E/(E-R)));if(N<K)return!1;else{x.lerpSelf(t,K);t.lerpSelf(x,1-N);return!0}}}var e,d,f=[],g,i,h=[],j,k,n=[],q,o=
+[],w,z,D=[],A,U,V=[],B=new THREE.Vector4,u=new THREE.Vector4,p=new THREE.Matrix4,Y=new THREE.Matrix4,Z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],aa=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(x,t){p.multiply(t.projectionMatrix,t.matrixWorldInverse);p.multiplyVector3(x);return x};this.unprojectVector=function(x,t){p.multiply(t.matrixWorld,THREE.Matrix4.makeInvert(t.projectionMatrix));p.multiplyVector3(x);return x};
+this.projectObjects=function(x,t,K){t=[];var N,Q,T;d=0;Q=x.objects;x=0;for(N=Q.length;x<N;x++){T=Q[x];var E;if(!(E=!T.visible))if(E=T instanceof THREE.Mesh){a:{E=void 0;for(var R=T.matrixWorld,S=-T.geometry.boundingSphere.radius*Math.max(T.scale.x,Math.max(T.scale.y,T.scale.z)),W=0;W<6;W++){E=Z[W].x*R.n14+Z[W].y*R.n24+Z[W].z*R.n34+Z[W].w;if(E<=S){E=!1;break a}}E=!0}E=!E}if(!E){E=f[d]=f[d]||new THREE.RenderableObject;d++;e=E;B.copy(T.position);p.multiplyVector3(B);e.object=T;e.z=B.z;t.push(e)}}K&&
+t.sort(b);return t};this.projectScene=function(x,t,K){var N=[],Q=t.near,T=t.far,E,R,S,W,H,C,F,I,M,G,da,ia,ja,fa,pa,Da,wa;U=z=q=k=0;t.matrixAutoUpdate&&t.updateMatrix();x.update(undefined,!1,t);p.multiply(t.projectionMatrix,t.matrixWorldInverse);Z[0].set(p.n41-p.n11,p.n42-p.n12,p.n43-p.n13,p.n44-p.n14);Z[1].set(p.n41+p.n11,p.n42+p.n12,p.n43+p.n13,p.n44+p.n14);Z[2].set(p.n41+p.n21,p.n42+p.n22,p.n43+p.n23,p.n44+p.n24);Z[3].set(p.n41-p.n21,p.n42-p.n22,p.n43-p.n23,p.n44-p.n24);Z[4].set(p.n41-p.n31,p.n42-
+p.n32,p.n43-p.n33,p.n44-p.n34);Z[5].set(p.n41+p.n31,p.n42+p.n32,p.n43+p.n33,p.n44+p.n34);for(E=0;E<6;E++){M=Z[E];M.divideScalar(Math.sqrt(M.x*M.x+M.y*M.y+M.z*M.z))}M=this.projectObjects(x,t,!0);x=0;for(E=M.length;x<E;x++){G=M[x].object;if(G.visible){da=G.matrixWorld;ia=G.matrixRotationWorld;ja=G.materials;fa=G.overdraw;i=0;if(G instanceof THREE.Mesh){pa=G.geometry;W=pa.vertices;Da=pa.faces;pa=pa.faceVertexUvs;R=0;for(S=W.length;R<S;R++){g=a();g.positionWorld.copy(W[R].position);da.multiplyVector3(g.positionWorld);
+g.positionScreen.copy(g.positionWorld);p.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>Q&&g.positionScreen.z<T}W=0;for(R=Da.length;W<R;W++){S=Da[W];if(S instanceof THREE.Face3){H=h[S.a];C=h[S.b];F=h[S.c];if(H.visible&&C.visible&&F.visible&&(G.doubleSided||G.flipSided!=(F.positionScreen.x-H.positionScreen.x)*(C.positionScreen.y-H.positionScreen.y)-(F.positionScreen.y-H.positionScreen.y)*(C.positionScreen.x-
+H.positionScreen.x)<0)){I=n[k]=n[k]||new THREE.RenderableFace3;k++;j=I;j.v1.copy(H);j.v2.copy(C);j.v3.copy(F)}else continue}else if(S instanceof THREE.Face4){H=h[S.a];C=h[S.b];F=h[S.c];I=h[S.d];if(H.visible&&C.visible&&F.visible&&I.visible&&(G.doubleSided||G.flipSided!=((I.positionScreen.x-H.positionScreen.x)*(C.positionScreen.y-H.positionScreen.y)-(I.positionScreen.y-H.positionScreen.y)*(C.positionScreen.x-H.positionScreen.x)<0||(C.positionScreen.x-F.positionScreen.x)*(I.positionScreen.y-F.positionScreen.y)-
+(C.positionScreen.y-F.positionScreen.y)*(I.positionScreen.x-F.positionScreen.x)<0))){wa=o[q]=o[q]||new THREE.RenderableFace4;q++;j=wa;j.v1.copy(H);j.v2.copy(C);j.v3.copy(F);j.v4.copy(I)}else continue}j.normalWorld.copy(S.normal);ia.multiplyVector3(j.normalWorld);j.centroidWorld.copy(S.centroid);da.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);p.multiplyVector3(j.centroidScreen);F=S.vertexNormals;H=0;for(C=F.length;H<C;H++){I=j.vertexNormalsWorld[H];I.copy(F[H]);ia.multiplyVector3(I)}H=
+0;for(C=pa.length;H<C;H++)if(wa=pa[H][W]){F=0;for(I=wa.length;F<I;F++)j.uvs[H][F]=wa[F]}j.meshMaterials=ja;j.faceMaterials=S.materials;j.overdraw=fa;j.z=j.centroidScreen.z;N.push(j)}}else if(G instanceof THREE.Line){Y.multiply(p,da);W=G.geometry.vertices;H=a();H.positionScreen.copy(W[0].position);Y.multiplyVector4(H.positionScreen);R=1;for(S=W.length;R<S;R++){H=a();H.positionScreen.copy(W[R].position);Y.multiplyVector4(H.positionScreen);C=h[i-2];aa.copy(H.positionScreen);P.copy(C.positionScreen);
+if(c(aa,P)){aa.multiplyScalar(1/aa.w);P.multiplyScalar(1/P.w);da=D[z]=D[z]||new THREE.RenderableLine;z++;w=da;w.v1.positionScreen.copy(aa);w.v2.positionScreen.copy(P);w.z=Math.max(aa.z,P.z);w.materials=G.materials;N.push(w)}}}else if(G instanceof THREE.Particle){u.set(G.position.x,G.position.y,G.position.z,1);p.multiplyVector4(u);u.z/=u.w;if(u.z>0&&u.z<1){da=V[U]=V[U]||new THREE.RenderableParticle;U++;A=da;A.x=u.x/u.w;A.y=u.y/u.w;A.z=u.z;A.rotation=G.rotation.z;A.scale.x=G.scale.x*Math.abs(A.x-(u.x+
+t.projectionMatrix.n11)/(u.w+t.projectionMatrix.n14));A.scale.y=G.scale.y*Math.abs(A.y-(u.y+t.projectionMatrix.n22)/(u.w+t.projectionMatrix.n24));A.materials=G.materials;N.push(A)}}}}K&&N.sort(b);return N}};
+THREE.CanvasRenderer=function(){function a($){if(o!=$)k.globalAlpha=o=$}function b($){if(w!=$){switch($){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}w=$}}function c($){if(z!=$)k.strokeStyle=z=$}var e=null,d=new THREE.Projector,f=document.createElement("canvas"),g,i,h,j,k=f.getContext("2d"),n=new THREE.Color(0),q=0,o=1,w=0,z=null,D=null,
+A=null,U=null,V=null,B,u,p,Y,Z=new THREE.RenderableVertex,aa=new THREE.RenderableVertex,P,x,t,K,N,Q,T,E,R,S,W,H,C=new THREE.Color,F=new THREE.Color,I=new THREE.Color,M=new THREE.Color,G=new THREE.Color,da,ia,ja,fa,pa,Da,wa,Wa,Xa,Ya,Ba=new THREE.Rectangle,ka=new THREE.Rectangle,ea=new THREE.Rectangle,Ua=!1,ha=new THREE.Color,ga=new THREE.Color,Ma=new THREE.Color,Na=new THREE.Color,ba=new THREE.Vector3,Ha,Ia,Va,la,Ja,Oa,Ea=16;Ha=document.createElement("canvas");Ha.width=Ha.height=2;Ia=Ha.getContext("2d");
+Ia.fillStyle="rgba(0,0,0,1)";Ia.fillRect(0,0,2,2);Va=Ia.getImageData(0,0,2,2);la=Va.data;Ja=document.createElement("canvas");Ja.width=Ja.height=Ea;Oa=Ja.getContext("2d");Oa.translate(-Ea/2,-Ea/2);Oa.scale(Ea,Ea);Ea--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function($,ma){g=$;i=ma;h=g/2;j=i/2;f.width=g;f.height=i;Ba.set(-h,-j,h,j);o=1;w=0;V=U=A=D=z=null};this.setClearColor=function($,ma){n=$;q=ma};this.setClearColorHex=function($,ma){n.setHex($);q=
+ma};this.clear=function(){k.setTransform(1,0,0,-1,h,j);if(!ka.isEmpty()){ka.inflate(1);ka.minSelf(Ba);if(n.hex==0&&q==0)k.clearRect(ka.getX(),ka.getY(),ka.getWidth(),ka.getHeight());else{b(THREE.NormalBlending);a(1);k.fillStyle="rgba("+Math.floor(n.r*255)+","+Math.floor(n.g*255)+","+Math.floor(n.b*255)+","+q+")";k.fillRect(ka.getX(),ka.getY(),ka.getWidth(),ka.getHeight())}ka.empty()}};this.render=function($,ma){function ab(m){var y,s,r,L=m.lights;ga.setRGB(0,0,0);Ma.setRGB(0,0,0);Na.setRGB(0,0,0);
+m=0;for(y=L.length;m<y;m++){s=L[m];r=s.color;if(s instanceof THREE.AmbientLight){ga.r+=r.r;ga.g+=r.g;ga.b+=r.b}else if(s instanceof THREE.DirectionalLight){Ma.r+=r.r;Ma.g+=r.g;Ma.b+=r.b}else if(s instanceof THREE.PointLight){Na.r+=r.r;Na.g+=r.g;Na.b+=r.b}}}function ra(m,y,s,r){var L,J,v,l,X=m.lights;m=0;for(L=X.length;m<L;m++){J=X[m];v=J.color;if(J instanceof THREE.DirectionalLight){l=s.dot(J.position);if(!(l<=0)){l*=J.intensity;r.r+=v.r*l;r.g+=v.g*l;r.b+=v.b*l}}else if(J instanceof THREE.PointLight){l=
+s.dot(ba.sub(J.position,y).normalize());if(!(l<=0)){l*=J.distance==0?1:1-Math.min(y.distanceTo(J.position)/J.distance,1);if(l!=0){l*=J.intensity;r.r+=v.r*l;r.g+=v.g*l;r.b+=v.b*l}}}}}function bb(m,y,s){a(s.opacity);b(s.blending);var r,L,J,v,l,X;if(s instanceof THREE.ParticleBasicMaterial){if(s.map){v=s.map.image;l=v.width>>1;X=v.height>>1;s=y.scale.x*h;J=y.scale.y*j;r=s*l;L=J*X;ea.set(m.x-r,m.y-L,m.x+r,m.y+L);if(Ba.instersects(ea)){k.save();k.translate(m.x,m.y);k.rotate(-y.rotation);k.scale(s,-J);
+k.translate(-l,-X);k.drawImage(v,0,0);k.restore()}}}else if(s instanceof THREE.ParticleCanvasMaterial){r=y.scale.x*h;L=y.scale.y*j;ea.set(m.x-r,m.y-L,m.x+r,m.y+L);if(Ba.instersects(ea)){c(s.color.__styleString);J=s.color.__styleString;if(D!=J)k.fillStyle=D=J;k.save();k.translate(m.x,m.y);k.rotate(-y.rotation);k.scale(r,L);s.program(k);k.restore()}}}function cb(m,y,s,r){a(r.opacity);b(r.blending);k.beginPath();k.moveTo(m.positionScreen.x,m.positionScreen.y);k.lineTo(y.positionScreen.x,y.positionScreen.y);
+k.closePath();if(r instanceof THREE.LineBasicMaterial){C.__styleString=r.color.__styleString;m=r.linewidth;if(A!=m)k.lineWidth=A=m;m=r.linecap;if(U!=m)k.lineCap=U=m;m=r.linejoin;if(V!=m)k.lineJoin=V=m;c(C.__styleString);k.stroke();ea.inflate(r.linewidth*2)}}function Pa(m,y,s,r,L,J,v,l,X){a(l.opacity);b(l.blending);P=m.positionScreen.x;x=m.positionScreen.y;t=y.positionScreen.x;K=y.positionScreen.y;N=s.positionScreen.x;Q=s.positionScreen.y;Ka(P,x,t,K,N,Q);if(l instanceof THREE.MeshBasicMaterial)if(l.map){if(l.map.mapping instanceof
+THREE.UVMapping){fa=v.uvs[0];sa(P,x,t,K,N,Q,l.map.image,fa[r].u,fa[r].v,fa[L].u,fa[L].v,fa[J].u,fa[J].v)}}else if(l.envMap){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping){m=ma.matrixWorldInverse;ba.copy(v.vertexNormalsWorld[0]);pa=(ba.x*m.n11+ba.y*m.n12+ba.z*m.n13)*0.5+0.5;Da=-(ba.x*m.n21+ba.y*m.n22+ba.z*m.n23)*0.5+0.5;ba.copy(v.vertexNormalsWorld[1]);wa=(ba.x*m.n11+ba.y*m.n12+ba.z*m.n13)*0.5+0.5;Wa=-(ba.x*m.n21+ba.y*m.n22+ba.z*m.n23)*0.5+0.5;ba.copy(v.vertexNormalsWorld[2]);Xa=
+(ba.x*m.n11+ba.y*m.n12+ba.z*m.n13)*0.5+0.5;Ya=-(ba.x*m.n21+ba.y*m.n22+ba.z*m.n23)*0.5+0.5;sa(P,x,t,K,N,Q,l.envMap.image,pa,Da,wa,Wa,Xa,Ya)}}else l.wireframe?xa(l.color.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(l.color.__styleString);else if(l instanceof THREE.MeshLambertMaterial){if(l.map&&!l.wireframe){if(l.map.mapping instanceof THREE.UVMapping){fa=v.uvs[0];sa(P,x,t,K,N,Q,l.map.image,fa[r].u,fa[r].v,fa[L].u,fa[L].v,fa[J].u,fa[J].v)}b(THREE.SubtractiveBlending)}if(Ua)if(!l.wireframe&&
+l.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==3){F.r=I.r=M.r=ga.r;F.g=I.g=M.g=ga.g;F.b=I.b=M.b=ga.b;ra(X,v.v1.positionWorld,v.vertexNormalsWorld[0],F);ra(X,v.v2.positionWorld,v.vertexNormalsWorld[1],I);ra(X,v.v3.positionWorld,v.vertexNormalsWorld[2],M);G.r=(I.r+M.r)*0.5;G.g=(I.g+M.g)*0.5;G.b=(I.b+M.b)*0.5;ja=Qa(F,I,M,G);sa(P,x,t,K,N,Q,ja,0,0,1,0,0,1)}else{ha.r=ga.r;ha.g=ga.g;ha.b=ga.b;ra(X,v.centroidWorld,v.normalWorld,ha);C.r=l.color.r*ha.r;C.g=l.color.g*ha.g;C.b=l.color.b*ha.b;C.updateStyleString();
+l.wireframe?xa(C.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(C.__styleString)}else l.wireframe?xa(l.color.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(l.color.__styleString)}else if(l instanceof THREE.MeshDepthMaterial){da=ma.near;ia=ma.far;F.r=F.g=F.b=1-Ca(m.positionScreen.z,da,ia);I.r=I.g=I.b=1-Ca(y.positionScreen.z,da,ia);M.r=M.g=M.b=1-Ca(s.positionScreen.z,da,ia);G.r=(I.r+M.r)*0.5;G.g=(I.g+M.g)*0.5;G.b=(I.b+M.b)*0.5;ja=Qa(F,I,
+M,G);sa(P,x,t,K,N,Q,ja,0,0,1,0,0,1)}else if(l instanceof THREE.MeshNormalMaterial){C.r=Fa(v.normalWorld.x);C.g=Fa(v.normalWorld.y);C.b=Fa(v.normalWorld.z);C.updateStyleString();l.wireframe?xa(C.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(C.__styleString)}}function Za(m,y,s,r,L,J,v,l,X){a(l.opacity);b(l.blending);if(l.map||l.envMap){Pa(m,y,r,0,1,3,v,l,X);Pa(L,s,J,1,2,3,v,l,X)}else{P=m.positionScreen.x;x=m.positionScreen.y;t=y.positionScreen.x;K=y.positionScreen.y;
+N=s.positionScreen.x;Q=s.positionScreen.y;T=r.positionScreen.x;E=r.positionScreen.y;R=L.positionScreen.x;S=L.positionScreen.y;W=J.positionScreen.x;H=J.positionScreen.y;if(l instanceof THREE.MeshBasicMaterial){Ra(P,x,t,K,N,Q,T,E);l.wireframe?xa(l.color.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(l.color.__styleString)}else if(l instanceof THREE.MeshLambertMaterial)if(Ua)if(!l.wireframe&&l.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==4){F.r=I.r=M.r=G.r=
+ga.r;F.g=I.g=M.g=G.g=ga.g;F.b=I.b=M.b=G.b=ga.b;ra(X,v.v1.positionWorld,v.vertexNormalsWorld[0],F);ra(X,v.v2.positionWorld,v.vertexNormalsWorld[1],I);ra(X,v.v4.positionWorld,v.vertexNormalsWorld[3],M);ra(X,v.v3.positionWorld,v.vertexNormalsWorld[2],G);ja=Qa(F,I,M,G);Ka(P,x,t,K,T,E);sa(P,x,t,K,T,E,ja,0,0,1,0,0,1);Ka(R,S,N,Q,W,H);sa(R,S,N,Q,W,H,ja,1,0,1,1,0,1)}else{ha.r=ga.r;ha.g=ga.g;ha.b=ga.b;ra(X,v.centroidWorld,v.normalWorld,ha);C.r=l.color.r*ha.r;C.g=l.color.g*ha.g;C.b=l.color.b*ha.b;C.updateStyleString();
+Ra(P,x,t,K,N,Q,T,E);l.wireframe?xa(C.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(C.__styleString)}else{Ra(P,x,t,K,N,Q,T,E);l.wireframe?xa(l.color.__styleString,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):ya(l.color.__styleString)}else if(l instanceof THREE.MeshNormalMaterial){C.r=Fa(v.normalWorld.x);C.g=Fa(v.normalWorld.y);C.b=Fa(v.normalWorld.z);C.updateStyleString();Ra(P,x,t,K,N,Q,T,E);l.wireframe?xa(C.__styleString,l.wireframeLinewidth,l.wireframeLinecap,
+l.wireframeLinejoin):ya(C.__styleString)}else if(l instanceof THREE.MeshDepthMaterial){da=ma.near;ia=ma.far;F.r=F.g=F.b=1-Ca(m.positionScreen.z,da,ia);I.r=I.g=I.b=1-Ca(y.positionScreen.z,da,ia);M.r=M.g=M.b=1-Ca(r.positionScreen.z,da,ia);G.r=G.g=G.b=1-Ca(s.positionScreen.z,da,ia);ja=Qa(F,I,M,G);Ka(P,x,t,K,T,E);sa(P,x,t,K,T,E,ja,0,0,1,0,0,1);Ka(R,S,N,Q,W,H);sa(R,S,N,Q,W,H,ja,1,0,1,1,0,1)}}}function Ka(m,y,s,r,L,J){k.beginPath();k.moveTo(m,y);k.lineTo(s,r);k.lineTo(L,J);k.lineTo(m,y);k.closePath()}function Ra(m,
+y,s,r,L,J,v,l){k.beginPath();k.moveTo(m,y);k.lineTo(s,r);k.lineTo(L,J);k.lineTo(v,l);k.lineTo(m,y);k.closePath()}function xa(m,y,s,r){if(A!=y)k.lineWidth=A=y;if(U!=s)k.lineCap=U=s;if(V!=r)k.lineJoin=V=r;c(m);k.stroke();ea.inflate(y*2)}function ya(m){if(D!=m)k.fillStyle=D=m;k.fill()}function sa(m,y,s,r,L,J,v,l,X,ta,na,ua,La){var qa,va;qa=v.width-1;va=v.height-1;l*=qa;X*=va;ta*=qa;na*=va;ua*=qa;La*=va;s-=m;r-=y;L-=m;J-=y;ta-=l;na-=X;ua-=l;La-=X;qa=ta*La-ua*na;if(qa!=0){va=1/qa;qa=(La*s-na*L)*va;na=
+(La*r-na*J)*va;s=(ta*L-ua*s)*va;r=(ta*J-ua*r)*va;m=m-qa*l-s*X;y=y-na*l-r*X;k.save();k.transform(qa,na,s,r,m,y);k.clip();k.drawImage(v,0,0);k.restore()}}function Qa(m,y,s,r){var L=~~(m.r*255),J=~~(m.g*255);m=~~(m.b*255);var v=~~(y.r*255),l=~~(y.g*255);y=~~(y.b*255);var X=~~(s.r*255),ta=~~(s.g*255);s=~~(s.b*255);var na=~~(r.r*255),ua=~~(r.g*255);r=~~(r.b*255);la[0]=L<0?0:L>255?255:L;la[1]=J<0?0:J>255?255:J;la[2]=m<0?0:m>255?255:m;la[4]=v<0?0:v>255?255:v;la[5]=l<0?0:l>255?255:l;la[6]=y<0?0:y>255?255:
+y;la[8]=X<0?0:X>255?255:X;la[9]=ta<0?0:ta>255?255:ta;la[10]=s<0?0:s>255?255:s;la[12]=na<0?0:na>255?255:na;la[13]=ua<0?0:ua>255?255:ua;la[14]=r<0?0:r>255?255:r;Ia.putImageData(Va,0,0);Oa.drawImage(Ha,0,0);return Ja}function Ca(m,y,s){m=(m-y)/(s-y);return m*m*(3-2*m)}function Fa(m){m=(m+1)*0.5;return m<0?0:m>1?1:m}function za(m,y){var s=y.x-m.x,r=y.y-m.y,L=1/Math.sqrt(s*s+r*r);s*=L;r*=L;y.x+=s;y.y+=r;m.x-=s;m.y-=r}var Sa,$a,O,oa,Aa,Ga,Ta,ca;this.autoClear?this.clear():k.setTransform(1,0,0,-1,h,j);e=
+d.projectScene($,ma,this.sortElements);(Ua=$.lights.length>0)&&ab($);Sa=0;for($a=e.length;Sa<$a;Sa++){O=e[Sa];ea.empty();if(O instanceof THREE.RenderableParticle){B=O;B.x*=h;B.y*=j;oa=0;for(Aa=O.materials.length;oa<Aa;){ca=O.materials[oa++];ca.opacity!=0&&bb(B,O,ca,$)}}else if(O instanceof THREE.RenderableLine){B=O.v1;u=O.v2;B.positionScreen.x*=h;B.positionScreen.y*=j;u.positionScreen.x*=h;u.positionScreen.y*=j;ea.addPoint(B.positionScreen.x,B.positionScreen.y);ea.addPoint(u.positionScreen.x,u.positionScreen.y);
+if(Ba.instersects(ea)){oa=0;for(Aa=O.materials.length;oa<Aa;){ca=O.materials[oa++];ca.opacity!=0&&cb(B,u,O,ca,$)}}}else if(O instanceof THREE.RenderableFace3){B=O.v1;u=O.v2;p=O.v3;B.positionScreen.x*=h;B.positionScreen.y*=j;u.positionScreen.x*=h;u.positionScreen.y*=j;p.positionScreen.x*=h;p.positionScreen.y*=j;if(O.overdraw){za(B.positionScreen,u.positionScreen);za(u.positionScreen,p.positionScreen);za(p.positionScreen,B.positionScreen)}ea.add3Points(B.positionScreen.x,B.positionScreen.y,u.positionScreen.x,
+u.positionScreen.y,p.positionScreen.x,p.positionScreen.y);if(Ba.instersects(ea)){oa=0;for(Aa=O.meshMaterials.length;oa<Aa;){ca=O.meshMaterials[oa++];if(ca instanceof THREE.MeshFaceMaterial){Ga=0;for(Ta=O.faceMaterials.length;Ga<Ta;)(ca=O.faceMaterials[Ga++])&&ca.opacity!=0&&Pa(B,u,p,0,1,2,O,ca,$)}else ca.opacity!=0&&Pa(B,u,p,0,1,2,O,ca,$)}}}else if(O instanceof THREE.RenderableFace4){B=O.v1;u=O.v2;p=O.v3;Y=O.v4;B.positionScreen.x*=h;B.positionScreen.y*=j;u.positionScreen.x*=h;u.positionScreen.y*=
+j;p.positionScreen.x*=h;p.positionScreen.y*=j;Y.positionScreen.x*=h;Y.positionScreen.y*=j;Z.positionScreen.copy(u.positionScreen);aa.positionScreen.copy(Y.positionScreen);if(O.overdraw){za(B.positionScreen,u.positionScreen);za(u.positionScreen,Y.positionScreen);za(Y.positionScreen,B.positionScreen);za(p.positionScreen,Z.positionScreen);za(p.positionScreen,aa.positionScreen)}ea.addPoint(B.positionScreen.x,B.positionScreen.y);ea.addPoint(u.positionScreen.x,u.positionScreen.y);ea.addPoint(p.positionScreen.x,
+p.positionScreen.y);ea.addPoint(Y.positionScreen.x,Y.positionScreen.y);if(Ba.instersects(ea)){oa=0;for(Aa=O.meshMaterials.length;oa<Aa;){ca=O.meshMaterials[oa++];if(ca instanceof THREE.MeshFaceMaterial){Ga=0;for(Ta=O.faceMaterials.length;Ga<Ta;)(ca=O.faceMaterials[Ga++])&&ca.opacity!=0&&Za(B,u,p,Y,Z,aa,O,ca,$)}else ca.opacity!=0&&Za(B,u,p,Y,Z,aa,O,ca,$)}}}ka.addRectangle(ea)}k.setTransform(1,0,0,1,0,0)}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var e,d=c.length;for(e=0;e<d;e++){a=c[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var e,d=c.length;for(e=0;e<d;e++){a=c[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};

+ 4 - 3
build/custom/ThreeDOM.js

@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var g=Math.cos(c);c=Math.sin(c);var f=a*b,i=e*d;this.w=f*g-i*c;this.x=f*c+i*g;this.y=e*b*g+a*d*c;this.z=a*d*g-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var g=Math.cos(c);c=Math.sin(c);var f=a*b,i=e*d;this.w=f*g-i*c;this.x=f*c+i*g;this.y=e*b*g+a*d*c;this.z=a*d*g-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,g=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+d*g+c*i-e*f;this.y=c*a+d*f+e*g-b*i;this.z=e*a+d*i+b*f-c*g;this.w=d*a-b*g-c*f-e*i;return this},
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,g=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+d*g+c*i-e*f;this.y=c*a+d*f+e*g-b*i;this.z=e*a+d*i+b*f-c*g;this.w=d*a-b*g-c*f-e*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,g=this.x,f=this.y,i=this.z,h=this.w,j=h*c+f*d-i*e,m=h*e+i*c-g*d,l=h*d+g*e-f*c;c=-g*c-f*e-i*d;b.x=j*h+c*-g+m*-i-l*-f;b.y=m*h+c*-f+l*-g-j*-i;b.z=l*h+c*-i+j*-f-m*-g;return b}};
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,g=this.x,f=this.y,i=this.z,h=this.w,j=h*c+f*d-i*e,m=h*e+i*c-g*d,l=h*d+g*e-f*c;c=-g*c-f*e-i*d;b.x=j*h+c*-g+m*-i-l*-f;b.y=m*h+c*-f+l*-g-j*-i;b.z=l*h+c*-i+j*-f-m*-g;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.Face4=function(a,b,c,e,d,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
 THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
@@ -71,8 +71,9 @@ THREE.Animation.prototype.interpolate=function(a,b,c,e,d,g,f){a=(c-a)*0.5;e=(e-b
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
 THREE.Camera=function(a,b,c,e,d){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=e||2E3;this.target=d||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera=function(a,b,c,e,d){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=e||2E3;this.target=d||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
-THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position)}a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0;for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};
-THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
+THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
+!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
+THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,d=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<d;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(e=0;e<d;e++)this.children[e].update(this.skinMatrix,
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,d=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<d;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(e=0;e<d;e++)this.children[e].update(this.skinMatrix,
 b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};
 b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};
 THREE.Sound=function(a,b,c,e){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==undefined?e:!0;this.sources=a instanceof Array?a:[a];var d;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)d=
 THREE.Sound=function(a,b,c,e){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==undefined?e:!0;this.sources=a instanceof Array?a:[a];var d;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)d=

+ 6 - 6
build/custom/ThreeExtras.js

@@ -24,17 +24,17 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var e,b,c,d,f=2*Math.ceil(a*3)+1;f>25&&(f=25);d=(f-1)*0.5;b=Array(f);for(e=c=0;e<f;++e){b[e]=Math.exp(-((e-d)*(e-d))/(2*a*a));c+=b[e]}for(e=0;e<f;++e)b[e]/=c;return b}};
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var e,b,c,d,f=2*Math.ceil(a*3)+1;f>25&&(f=25);d=(f-1)*0.5;b=Array(f);for(e=c=0;e<f;++e){b[e]=Math.exp(-((e-d)*(e-d))/(2*a*a));c+=b[e]}for(e=0;e<f;++e)b[e]/=c;return b}};
-THREE.QuakeCamera=function(a){function e(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
-a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
-this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=
+THREE.QuakeCamera=function(a){function e(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
+a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.activeLook!==undefined)this.activeLook=a.activeLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
+this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=
 !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
 !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
 !1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);
 !1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);
-var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;b=this.target.position;var c=this.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
+var b=this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;b=this.target.position;var c=this.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
 !1);this.domElement.addEventListener("mousemove",e(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",e(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",e(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",e(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",e(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
 !1);this.domElement.addEventListener("mousemove",e(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",e(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",e(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",e(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",e(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
 THREE.QuakeCamera.prototype.translate=function(a,e){this.matrix.rotateAxis(e);if(this.noFly)e.y=0;this.position.addSelf(e.multiplyScalar(a));this.target.position.addSelf(e.multiplyScalar(a))};
 THREE.QuakeCamera.prototype.translate=function(a,e){this.matrix.rotateAxis(e);if(this.noFly)e.y=0;this.position.addSelf(e.multiplyScalar(a));this.target.position.addSelf(e.multiplyScalar(a))};
 THREE.PathCamera=function(a){function e(k,j,m,p){var w={name:m,fps:0.6,length:p,hierarchy:[]},t,z=j.getControlPointsArray(),y=j.getLength(),A=z.length,C=0;t=A-1;j={parent:-1,keys:[]};j.keys[0]={time:0,pos:z[0],rot:[0,0,0,1],scl:[1,1,1]};j.keys[t]={time:p,pos:z[t],rot:[0,0,0,1],scl:[1,1,1]};for(t=1;t<A-1;t++){C=p*y.chunks[t]/y.total;j.keys[t]={time:C,pos:z[t]}}w.hierarchy[0]=j;THREE.AnimationHandler.add(w);return new THREE.Animation(k,m,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(k,j){var m,
 THREE.PathCamera=function(a){function e(k,j,m,p){var w={name:m,fps:0.6,length:p,hierarchy:[]},t,z=j.getControlPointsArray(),y=j.getLength(),A=z.length,C=0;t=A-1;j={parent:-1,keys:[]};j.keys[0]={time:0,pos:z[0],rot:[0,0,0,1],scl:[1,1,1]};j.keys[t]={time:p,pos:z[t],rot:[0,0,0,1],scl:[1,1,1]};for(t=1;t<A-1;t++){C=p*y.chunks[t]/y.total;j.keys[t]={time:C,pos:z[t]}}w.hierarchy[0]=j;THREE.AnimationHandler.add(w);return new THREE.Animation(k,m,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(k,j){var m,
 p,w=new THREE.Geometry;for(m=0;m<k.points.length*j;m++){p=m/(k.points.length*j);p=k.getPoint(p);w.vertices[m]=new THREE.Vertex(new THREE.Vector3(p.x,p.y,p.z))}return w}function c(k,j){var m=b(j,10),p=b(j,10),w=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(m,w);particleObj=new THREE.ParticleSystem(p,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);k.addChild(lineObj);particleObj.scale.set(1,1,1);k.addChild(particleObj);p=new Sphere(1,
 p,w=new THREE.Geometry;for(m=0;m<k.points.length*j;m++){p=m/(k.points.length*j);p=k.getPoint(p);w.vertices[m]=new THREE.Vertex(new THREE.Vector3(p.x,p.y,p.z))}return w}function c(k,j){var m=b(j,10),p=b(j,10),w=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(m,w);particleObj=new THREE.ParticleSystem(p,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);k.addChild(lineObj);particleObj.scale.set(1,1,1);k.addChild(particleObj);p=new Sphere(1,
-16,8);w=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<j.points.length;i++){m=new THREE.Mesh(p,w);m.position.copy(j.points[i]);m.updateMatrix();k.addChild(m)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=
+16,8);w=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<j.points.length;i++){m=new THREE.Mesh(p,w);m.position.copy(j.points[i]);m.updateMatrix();k.addChild(m)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
 !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
 this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var d=Math.PI*2,f=Math.PI/180;this.update=function(k,j,m){var p,w;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*f;this.theta=this.lon*f;p=this.phi%d;this.phi=p>=0?p:p+d;p=this.verticalAngleMap.srcRange;w=this.verticalAngleMap.dstRange;
 this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var d=Math.PI*2,f=Math.PI/180;this.update=function(k,j,m){var p,w;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*f;this.theta=this.lon*f;p=this.phi%d;this.phi=p>=0?p:p+d;p=this.verticalAngleMap.srcRange;w=this.verticalAngleMap.dstRange;
@@ -50,7 +50,7 @@ for(c=a+a/2;c<2*a;c++)h.faces.push(new THREE.Face4(2*a+1,(2*c-2*a+2)%a+a,(2*c-2*
 var Icosahedron=function(a){function e(m,p,w){var t=Math.sqrt(m*m+p*p+w*w);return d.vertices.push(new THREE.Vertex(new THREE.Vector3(m/t,p/t,w/t)))-1}function b(m,p,w,t){t.faces.push(new THREE.Face3(m,p,w))}function c(m,p){var w=d.vertices[m].position,t=d.vertices[p].position;return e((w.x+t.x)/2,(w.y+t.y)/2,(w.z+t.z)/2)}var d=this,f=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;e(-1,a,0);e(1,a,0);e(-1,-a,0);e(1,-a,0);e(0,-1,a);e(0,1,a);e(0,-1,-a);e(0,
 var Icosahedron=function(a){function e(m,p,w){var t=Math.sqrt(m*m+p*p+w*w);return d.vertices.push(new THREE.Vertex(new THREE.Vector3(m/t,p/t,w/t)))-1}function b(m,p,w,t){t.faces.push(new THREE.Face3(m,p,w))}function c(m,p){var w=d.vertices[m].position,t=d.vertices[p].position;return e((w.x+t.x)/2,(w.y+t.y)/2,(w.z+t.z)/2)}var d=this,f=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;e(-1,a,0);e(1,a,0);e(-1,-a,0);e(1,-a,0);e(0,-1,a);e(0,1,a);e(0,-1,-a);e(0,
 1,-a);e(a,0,-1);e(a,0,1);e(-a,0,-1);e(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(a=0;a<this.subdivisions;a++){g=new THREE.Geometry;for(var h in f.faces){var l=c(f.faces[h].a,f.faces[h].b),k=c(f.faces[h].b,f.faces[h].c),j=c(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,l,j,g);b(f.faces[h].b,k,l,g);b(f.faces[h].c,
 1,-a);e(a,0,-1);e(a,0,1);e(-a,0,-1);e(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(a=0;a<this.subdivisions;a++){g=new THREE.Geometry;for(var h in f.faces){var l=c(f.faces[h].a,f.faces[h].b),k=c(f.faces[h].b,f.faces[h].c),j=c(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,l,j,g);b(f.faces[h].b,k,l,g);b(f.faces[h].c,
 j,k,g);b(l,k,j,g)}f.faces=g.faces}d.faces=f.faces;delete f;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
 j,k,g);b(l,k,j,g)}f.faces=g.faces}d.faces=f.faces;delete f;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function Lathe(a,e,b){THREE.Geometry.call(this);this.steps=e||12;this.angle=b||2*Math.PI;e=this.angle/this.steps;for(var c=[],d=[],f=[],g=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));c[h]=a[h].clone();d[h]=this.vertices.length-1}for(var l=(new THREE.Matrix4).setRotationZ(e),k=0;k<=this.angle+0.001;k+=e){for(h=0;h<c.length;h++)if(k<this.angle){c[h]=l.multiplyVector3(c[h].clone());this.vertices.push(new THREE.Vertex(c[h]));f[h]=this.vertices.length-1}else f=g;k==0&&(g=d);for(h=
+function Lathe(a,e,b){THREE.Geometry.call(this);this.steps=e||12;this.angle=b||2*Math.PI;e=this.angle/this.steps;for(var c=[],d=[],f=[],g=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));c[h]=a[h].clone();d[h]=this.vertices.length-1}for(var l=(new THREE.Matrix4).setRotationZ(e),k=0;k<=this.angle+0.0010;k+=e){for(h=0;h<c.length;h++)if(k<this.angle){c[h]=l.multiplyVector3(c[h].clone());this.vertices.push(new THREE.Vertex(c[h]));f[h]=this.vertices.length-1}else f=g;k==0&&(g=d);for(h=
 0;h<d.length-1;h++){this.faces.push(new THREE.Face4(f[h],f[h+1],d[h+1],d[h]));this.faceVertexUvs[0].push([new THREE.UV(k/b,h/a.length),new THREE.UV(k/b,(h+1)/a.length),new THREE.UV((k-e)/b,(h+1)/a.length),new THREE.UV((k-e)/b,h/a.length)])}d=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
 0;h<d.length-1;h++){this.faces.push(new THREE.Face4(f[h],f[h+1],d[h+1],d[h]));this.faceVertexUvs[0].push([new THREE.UV(k/b,h/a.length),new THREE.UV(k/b,(h+1)/a.length),new THREE.UV((k-e)/b,(h+1)/a.length),new THREE.UV((k-e)/b,h/a.length)])}d=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
 var Plane=function(a,e,b,c){THREE.Geometry.call(this);var d,f=a/2,g=e/2;b=b||1;c=c||1;var h=b+1,l=c+1;a/=b;var k=e/c;for(d=0;d<l;d++)for(e=0;e<h;e++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(e*a-f,-(d*k-g),0)));for(d=0;d<c;d++)for(e=0;e<b;e++){this.faces.push(new THREE.Face4(e+h*d,e+h*(d+1),e+1+h*(d+1),e+1+h*d));this.faceVertexUvs[0].push([new THREE.UV(e/b,d/c),new THREE.UV(e/b,(d+1)/c),new THREE.UV((e+1)/b,(d+1)/c),new THREE.UV((e+1)/b,d/c)])}this.computeCentroids();this.computeFaceNormals()};
 var Plane=function(a,e,b,c){THREE.Geometry.call(this);var d,f=a/2,g=e/2;b=b||1;c=c||1;var h=b+1,l=c+1;a/=b;var k=e/c;for(d=0;d<l;d++)for(e=0;e<h;e++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(e*a-f,-(d*k-g),0)));for(d=0;d<c;d++)for(e=0;e<b;e++){this.faces.push(new THREE.Face4(e+h*d,e+h*(d+1),e+1+h*(d+1),e+1+h*d));this.faceVertexUvs[0].push([new THREE.UV(e/b,d/c),new THREE.UV(e/b,(d+1)/c),new THREE.UV((e+1)/b,(d+1)/c),new THREE.UV((e+1)/b,d/c)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;

+ 5 - 5
build/custom/ThreeSVG.js

@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=e*d;this.w=g*f-i*c;this.x=g*c+i*f;this.y=e*b*f+a*d*c;this.z=a*d*f-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=e*d;this.w=g*f-i*c;this.x=g*c+i*f;this.y=e*b*f+a*d*c;this.z=a*d*f-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+d*f+c*i-e*g;this.y=c*a+d*g+e*f-b*i;this.z=e*a+d*i+b*g-c*f;this.w=d*a-b*f-c*g-e*i;return this},
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+d*f+c*i-e*g;this.y=c*a+d*g+e*f-b*i;this.z=e*a+d*i+b*g-c*f;this.w=d*a-b*f-c*g-e*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*d-i*e,m=h*e+i*c-f*d,l=h*d+f*e-g*c;c=-f*c-g*e-i*d;b.x=j*h+c*-f+m*-i-l*-g;b.y=m*h+c*-g+l*-f-j*-i;b.z=l*h+c*-i+j*-g-m*-f;return b}};
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*d-i*e,m=h*e+i*c-f*d,l=h*d+f*e-g*c;c=-f*c-g*e-i*d;b.x=j*h+c*-f+m*-i-l*-g;b.y=m*h+c*-g+l*-f-j*-i;b.z=l*h+c*-i+j*-g-m*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,f,g){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.Face4=function(a,b,c,e,d,f,g){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -80,10 +80,10 @@ THREE.Animation.prototype.interpolate=function(a,b,c,e,d,f,g){a=(c-a)*0.5;e=(e-b
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
 THREE.Camera=function(a,b,c,e,d){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=e||2E3;this.target=d||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera=function(a,b,c,e,d){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=e||2E3;this.target=d||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
-THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position)}a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0;for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};
-THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1;this.distance=c||0};THREE.DirectionalLight.prototype=new THREE.Light;
-THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1;this.distance=c||0};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
-THREE.MultiplyBlending=3;THREE.MaterialCounter={value:0};
+THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
+!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
+THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1;this.distance=c||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1;this.distance=c||0};THREE.PointLight.prototype=new THREE.Light;
+THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.MaterialCounter={value:0};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;

+ 6 - 5
build/custom/ThreeWebGL.js

@@ -48,7 +48,7 @@ c,d)}};THREE.Quaternion=function(a,c,d,g){this.set(a||0,c||0,d||0,g!==undefined?
 THREE.Quaternion.prototype={set:function(a,c,d,g){this.x=a;this.y=c;this.z=d;this.w=g;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,d=a.x*c,g=a.y*c,f=a.z*c;a=Math.cos(g);g=Math.sin(g);c=Math.cos(-f);f=Math.sin(-f);var h=Math.cos(d);d=Math.sin(d);var i=a*c,n=g*f;this.w=i*h-n*d;this.x=i*d+n*h;this.y=g*c*h+a*f*d;this.z=a*f*h-g*c*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 THREE.Quaternion.prototype={set:function(a,c,d,g){this.x=a;this.y=c;this.z=d;this.w=g;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,d=a.x*c,g=a.y*c,f=a.z*c;a=Math.cos(g);g=Math.sin(g);c=Math.cos(-f);f=Math.sin(-f);var h=Math.cos(d);d=Math.sin(d);var i=a*c,n=g*f;this.w=i*h-n*d;this.x=i*d+n*h;this.y=g*c*h+a*f*d;this.z=a*f*h-g*c*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,d=this.y,g=this.z,f=this.w,h=a.x,i=a.y,n=a.z;a=a.w;this.x=c*a+f*h+d*n-g*i;this.y=d*a+f*i+g*h-c*n;this.z=g*a+f*n+c*i-d*h;this.w=f*a-c*h-d*i-g*n;return this},
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,d=this.y,g=this.z,f=this.w,h=a.x,i=a.y,n=a.z;a=a.w;this.x=c*a+f*h+d*n-g*i;this.y=d*a+f*i+g*h-c*n;this.z=g*a+f*n+c*i-d*h;this.w=f*a-c*h-d*i-g*n;return this},
 multiplyVector3:function(a,c){c||(c=a);var d=a.x,g=a.y,f=a.z,h=this.x,i=this.y,n=this.z,o=this.w,t=o*d+i*f-n*g,x=o*g+n*d-h*f,y=o*f+h*g-i*d;d=-h*d-i*g-n*f;c.x=t*o+d*-h+x*-n-y*-i;c.y=x*o+d*-i+y*-h-t*-n;c.z=y*o+d*-n+t*-i-x*-h;return c}};
 multiplyVector3:function(a,c){c||(c=a);var d=a.x,g=a.y,f=a.z,h=this.x,i=this.y,n=this.z,o=this.w,t=o*d+i*f-n*g,x=o*g+n*d-h*f,y=o*f+h*g-i*d;d=-h*d-i*g-n*f;c.x=t*o+d*-h+x*-n-y*-i;c.y=x*o+d*-i+y*-h-t*-n;c.z=y*o+d*-n+t*-i-x*-h;return c}};
-THREE.Quaternion.slerp=function(a,c,d,g){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<0.001){d.w=0.5*(a.w+c.w);d.x=0.5*(a.x+c.x);d.y=0.5*(a.y+c.y);d.z=0.5*(a.z+c.z);return d}f=Math.sin((1-g)*h)/i;g=Math.sin(g*h)/i;d.w=a.w*f+c.w*g;d.x=a.x*f+c.x*g;d.y=a.y*f+c.y*g;d.z=a.z*f+c.z*g;return d};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,c,d,g){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<0.0010){d.w=0.5*(a.w+c.w);d.x=0.5*(a.x+c.x);d.y=0.5*(a.y+c.y);d.z=0.5*(a.z+c.z);return d}f=Math.sin((1-g)*h)/i;g=Math.sin(g*h)/i;d.w=a.w*f+c.w*g;d.x=a.x*f+c.x*g;d.y=a.y*f+c.y*g;d.z=a.z*f+c.z*g;return d};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,c,d,g,f,h){this.a=a;this.b=c;this.c=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face3=function(a,c,d,g,f,h){this.a=a;this.b=c;this.c=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,c,d,g,f,h,i){this.a=a;this.b=c;this.c=d;this.d=g;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};
 THREE.Face4=function(a,c,d,g,f,h,i){this.a=a;this.b=c;this.c=d;this.d=g;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};
 THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -81,10 +81,11 @@ THREE.Animation.prototype.interpolate=function(a,c,d,g,f,h,i){a=(d-a)*0.5;g=(g-c
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,d){var g=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+g.length;d>=0;d--)if(g[d][a]!==undefined)return g[d];return this.data.hierarchy[c].keys[g.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,d){var g=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+g.length;d>=0;d--)if(g[d][a]!==undefined)return g[d];return this.data.hierarchy[c].keys[g.length-1]};
 THREE.Camera=function(a,c,d,g,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=d||0.1;this.far=g||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera=function(a,c,d,g,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=d||0.1;this.far=g||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
-THREE.Camera.prototype.update=function(a,c,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position)}a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0;for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};
-THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c,d){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=d||0};THREE.DirectionalLight.prototype=new THREE.Light;
-THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c,d){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=d||0};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
-THREE.MultiplyBlending=3;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
+THREE.Camera.prototype.update=function(a,c,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
+!1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
+THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c,d){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=d||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c,d){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=d||0};THREE.PointLight.prototype=new THREE.Light;
+THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
+THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;

+ 0 - 1
examples/webgl_lights_pointlights.html

@@ -77,7 +77,6 @@
 
 
 					object = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial( { ambient: 0x555555, color: 0x555555, specular: 0xffffff, shininess: 50, shading: THREE.SmoothShading }  )  );
 					object = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial( { ambient: 0x555555, color: 0x555555, specular: 0xffffff, shininess: 50, shading: THREE.SmoothShading }  )  );
 					object.scale.x = object.scale.y = object.scale.z = 0.80;
 					object.scale.x = object.scale.y = object.scale.z = 0.80;
-					object.overdraw = true;
 					scene.addObject( object );
 					scene.addObject( object );
 
 
 					loader.statusDomElement.style.display = "none";
 					loader.statusDomElement.style.display = "none";

+ 18 - 7
src/cameras/Camera.js

@@ -77,19 +77,30 @@ THREE.Camera.prototype.update = function ( parentMatrixWorld, forceUpdate, camer
 
 
 	} else {
 	} else {
 
 
-		if ( parentMatrixWorld ) {
+		if ( this.matrixAutoUpdate ) {
 
 
-			this.matrixWorld.multiply( parentMatrixWorld, this.matrix );
+			forceUpdate |= this.updateMatrix();
 
 
-		} else {
+		}
 
 
-			this.matrixWorld.copy( this.matrix );
+		if ( forceUpdate || this.matrixWorldNeedsUpdate ) {
 
 
-		}
+			if ( parentMatrixWorld ) {
 
 
-		THREE.Matrix4.makeInvert( this.matrixWorld, this.matrixWorldInverse );
+				this.matrixWorld.multiply( parentMatrixWorld, this.matrix );
 
 
-		forceUpdate = true;
+			} else {
+
+				this.matrixWorld.copy( this.matrix );
+
+			}
+
+			this.matrixWorldNeedsUpdate = false;
+			forceUpdate = true;
+
+			THREE.Matrix4.makeInvert( this.matrixWorld, this.matrixWorldInverse );
+
+		}
 
 
 	}
 	}
 
 

+ 5 - 5
src/extras/cameras/QuakeCamera.js

@@ -37,7 +37,7 @@ THREE.QuakeCamera = function ( parameters ) {
 	this.lookVertical = true;
 	this.lookVertical = true;
 	this.autoForward = false;
 	this.autoForward = false;
 
 
-	this.dragToLook = false;
+	this.activeLook = true;
 
 
 	this.heightSpeed = false;
 	this.heightSpeed = false;
 	this.heightCoef = 1.0;
 	this.heightCoef = 1.0;
@@ -54,7 +54,7 @@ THREE.QuakeCamera = function ( parameters ) {
 
 
 		if ( parameters.autoForward !== undefined ) this.autoForward = parameters.autoForward;
 		if ( parameters.autoForward !== undefined ) this.autoForward = parameters.autoForward;
 
 
-		if ( parameters.dragToLook !== undefined ) this.dragToLook = parameters.dragToLook;
+		if ( parameters.activeLook !== undefined ) this.activeLook = parameters.activeLook;
 
 
 		if ( parameters.heightSpeed !== undefined ) this.heightSpeed = parameters.heightSpeed;
 		if ( parameters.heightSpeed !== undefined ) this.heightSpeed = parameters.heightSpeed;
 		if ( parameters.heightCoef !== undefined ) this.heightCoef = parameters.heightCoef;
 		if ( parameters.heightCoef !== undefined ) this.heightCoef = parameters.heightCoef;
@@ -90,7 +90,7 @@ THREE.QuakeCamera = function ( parameters ) {
 		event.preventDefault();
 		event.preventDefault();
 		event.stopPropagation();
 		event.stopPropagation();
 
 
-		if ( !this.dragToLook ) {
+		if ( this.activeLook ) {
 
 
 			switch ( event.button ) {
 			switch ( event.button ) {
 
 
@@ -110,7 +110,7 @@ THREE.QuakeCamera = function ( parameters ) {
 		event.preventDefault();
 		event.preventDefault();
 		event.stopPropagation();
 		event.stopPropagation();
 
 
-		if ( !this.dragToLook ) {
+		if ( this.activeLook ) {
 
 
 			switch ( event.button ) {
 			switch ( event.button ) {
 
 
@@ -194,7 +194,7 @@ THREE.QuakeCamera = function ( parameters ) {
 
 
 		var actualLookSpeed = this.lookSpeed;
 		var actualLookSpeed = this.lookSpeed;
 
 
-		if ( this.dragToLook && !this.mouseDragOn ) {
+		if ( !this.activeLook ) {
 
 
 			actualLookSpeed = 0;
 			actualLookSpeed = 0;
 
 

+ 1 - 1
src/materials/MeshBasicMaterial.js

@@ -53,7 +53,7 @@ THREE.MeshBasicMaterial = function ( parameters ) {
 	this.wireframeLinejoin = 'round'; // implemented just in CanvasRenderer
 	this.wireframeLinejoin = 'round'; // implemented just in CanvasRenderer
 
 
 	this.vertexColors = false;
 	this.vertexColors = false;
-	
+
 	this.skinning = false;
 	this.skinning = false;
 	this.morphTargets = false;
 	this.morphTargets = false;
 
 

+ 49 - 12
src/renderers/CanvasRenderer.js

@@ -18,7 +18,9 @@ THREE.CanvasRenderer = function () {
 	_contextGlobalCompositeOperation = 0,
 	_contextGlobalCompositeOperation = 0,
 	_contextStrokeStyle = null,
 	_contextStrokeStyle = null,
 	_contextFillStyle = null,
 	_contextFillStyle = null,
-	_contextLineWidth = 1,
+	_contextLineWidth = null,
+	_contextLineCap = null,
+	_contextLineJoin = null,
 
 
 	_v1, _v2, _v3, _v4,
 	_v1, _v2, _v3, _v4,
 	_v5 = new THREE.RenderableVertex(),
 	_v5 = new THREE.RenderableVertex(),
@@ -95,7 +97,9 @@ THREE.CanvasRenderer = function () {
 		_contextGlobalCompositeOperation = 0;
 		_contextGlobalCompositeOperation = 0;
 		_contextStrokeStyle = null;
 		_contextStrokeStyle = null;
 		_contextFillStyle = null;
 		_contextFillStyle = null;
-		_contextLineWidth = 1;
+		_contextLineWidth = null;
+		_contextLineCap = null;
+		_contextLineJoin = null;
 
 
 	};
 	};
 
 
@@ -521,6 +525,8 @@ THREE.CanvasRenderer = function () {
 				_color.__styleString = material.color.__styleString;
 				_color.__styleString = material.color.__styleString;
 
 
 				setLineWidth( material.linewidth );
 				setLineWidth( material.linewidth );
+				setLineCap( material.linecap );
+				setLineJoin( material.linejoin );
 				setStrokeStyle( _color.__styleString );
 				setStrokeStyle( _color.__styleString );
 
 
 				_context.stroke();
 				_context.stroke();
@@ -583,7 +589,7 @@ THREE.CanvasRenderer = function () {
 
 
 				} else {
 				} else {
 
 
-					material.wireframe ? strokePath( material.color.__styleString, material.wireframeLinewidth ) : fillPath( material.color.__styleString );
+					material.wireframe ? strokePath( material.color.__styleString, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( material.color.__styleString );
 
 
 				}
 				}
 
 
@@ -635,13 +641,14 @@ THREE.CanvasRenderer = function () {
 						_color.b = material.color.b * _light.b;
 						_color.b = material.color.b * _light.b;
 
 
 						_color.updateStyleString();
 						_color.updateStyleString();
-						material.wireframe ? strokePath( _color.__styleString, material.wireframeLinewidth ) : fillPath( _color.__styleString );
+
+						material.wireframe ? strokePath( _color.__styleString, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( _color.__styleString );
 
 
 					}
 					}
 
 
 				} else {
 				} else {
 
 
-					material.wireframe ? strokePath( material.color.__styleString, material.wireframeLinewidth ) : fillPath( material.color.__styleString );
+					material.wireframe ? strokePath( material.color.__styleString, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( material.color.__styleString );
 
 
 				}
 				}
 
 
@@ -669,7 +676,7 @@ THREE.CanvasRenderer = function () {
 				_color.b = normalToComponent( element.normalWorld.z );
 				_color.b = normalToComponent( element.normalWorld.z );
 				_color.updateStyleString();
 				_color.updateStyleString();
 
 
-				material.wireframe ? strokePath( _color.__styleString, material.wireframeLinewidth ) : fillPath( _color.__styleString );
+				material.wireframe ? strokePath( _color.__styleString, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( _color.__styleString );
 
 
 			}
 			}
 
 
@@ -701,7 +708,8 @@ THREE.CanvasRenderer = function () {
 			if ( material instanceof THREE.MeshBasicMaterial ) {
 			if ( material instanceof THREE.MeshBasicMaterial ) {
 
 
 				drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
 				drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
-				material.wireframe ? strokePath( material.color.__styleString, material.wireframeLinewidth ) : fillPath( material.color.__styleString );
+
+				material.wireframe ? strokePath( material.color.__styleString, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( material.color.__styleString );
 
 
 			} else if ( material instanceof THREE.MeshLambertMaterial ) {
 			} else if ( material instanceof THREE.MeshLambertMaterial ) {
 
 
@@ -743,14 +751,16 @@ THREE.CanvasRenderer = function () {
 						_color.updateStyleString();
 						_color.updateStyleString();
 
 
 						drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
 						drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
-						material.wireframe ? strokePath( _color.__styleString, material.wireframeLinewidth ) : fillPath( _color.__styleString );
+
+						material.wireframe ? strokePath( _color.__styleString, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( _color.__styleString );
 
 
 					}
 					}
 
 
 				} else {
 				} else {
 
 
 					drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
 					drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
-					material.wireframe ? strokePath( material.color.__styleString, material.wireframeLinewidth ) : fillPath( material.color.__styleString );
+
+					material.wireframe ? strokePath( material.color.__styleString, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( material.color.__styleString );
 
 
 				}
 				}
 
 
@@ -762,7 +772,8 @@ THREE.CanvasRenderer = function () {
 				_color.updateStyleString();
 				_color.updateStyleString();
 
 
 				drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
 				drawQuad( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _v4x, _v4y );
-				material.wireframe ? strokePath( _color.__styleString, material.wireframeLinewidth ) : fillPath( _color.__styleString );
+
+				material.wireframe ? strokePath( _color.__styleString, material.wireframeLinewidth, material.wireframeLinecap, material.wireframeLinejoin ) : fillPath( _color.__styleString );
 
 
 			} else if ( material instanceof THREE.MeshDepthMaterial ) {
 			} else if ( material instanceof THREE.MeshDepthMaterial ) {
 
 
@@ -813,10 +824,12 @@ THREE.CanvasRenderer = function () {
 
 
 		}
 		}
 
 
-		function strokePath( color, linewidth ) {
+		function strokePath( color, linewidth, linecap, linejoin ) {
 
 
-			setStrokeStyle( color );
 			setLineWidth( linewidth );
 			setLineWidth( linewidth );
+			setLineCap( linecap );
+			setLineJoin( linejoin );
+			setStrokeStyle( color );
 
 
 			_context.stroke();
 			_context.stroke();
 
 
@@ -1023,6 +1036,30 @@ THREE.CanvasRenderer = function () {
 
 
 	}
 	}
 
 
+	function setLineCap( value ) {
+
+		// "butt", "round", "square"
+
+		if ( _contextLineCap != value ) {
+
+			_context.lineCap = _contextLineCap = value;
+
+		}
+
+	}
+
+	function setLineJoin( value ) {
+
+		// "round", "bevel", "miter"
+
+		if ( _contextLineJoin != value ) {
+
+			_context.lineJoin = _contextLineJoin = value;
+
+		}
+
+	}
+
 	function setStrokeStyle( value ) {
 	function setStrokeStyle( value ) {
 
 
 		if ( _contextStrokeStyle != value ) {
 		if ( _contextStrokeStyle != value ) {

+ 5 - 8
src/renderers/WebGLRenderer.js

@@ -24,6 +24,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	_canvas = document.createElement( 'canvas' ),
 	_canvas = document.createElement( 'canvas' ),
 	_currentProgram = null,
 	_currentProgram = null,
 	_currentFramebuffer = null,
 	_currentFramebuffer = null,
+	_currentDepthMask = true,
 
 
 	_this = this,
 	_this = this,
 
 
@@ -236,6 +237,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	this.enableDepthBufferWrite = function ( enable ) {
 	this.enableDepthBufferWrite = function ( enable ) {
 
 
+		_currentDepthMask = enable;
 		_gl.depthMask( enable );
 		_gl.depthMask( enable );
 
 
 	};
 	};
@@ -2811,7 +2813,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 		_gl.vertexAttribPointer( _stencilShadow.vertexLocation, 3, _gl.FLOAT, false, 0, 0 );
 		_gl.vertexAttribPointer( _stencilShadow.vertexLocation, 3, _gl.FLOAT, false, 0, 0 );
 		_gl.enableVertexAttribArray( _stencilShadow.vertexLocation );
 		_gl.enableVertexAttribArray( _stencilShadow.vertexLocation );
 
 
-		_gl.enable( _gl.BLEND );
 		_gl.blendFunc( _gl.ONE, _gl.ONE_MINUS_SRC_ALPHA );
 		_gl.blendFunc( _gl.ONE, _gl.ONE_MINUS_SRC_ALPHA );
 		_gl.blendEquation( _gl.FUNC_ADD );
 		_gl.blendEquation( _gl.FUNC_ADD );
 			
 			
@@ -2823,8 +2824,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	    _gl.disable	 ( _gl.STENCIL_TEST );
 	    _gl.disable	 ( _gl.STENCIL_TEST );
 	    _gl.enable	 ( _gl.DEPTH_TEST );
 	    _gl.enable	 ( _gl.DEPTH_TEST );
-		_gl.disable  ( _gl.BLEND );
-	    _gl.depthMask( true );
+	    _gl.depthMask( _currentDepthMask );
 	}
 	}
 
 
 	/*
 	/*
@@ -2944,7 +2944,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 			// sample read back pixels
 			// sample read back pixels
 
 
-			sampleDistance = parseInt( 6 * ( 1 - Math.max( 0, Math.min( -objectZ, camera.far )) / camera.far ), 10 ) + 1;
+			sampleDistance = parseInt( 5 * ( 1 - Math.max( 0, Math.min( -objectZ, camera.far )) / camera.far ), 10 ) + 2;
 			sampleX = sampleDistance * 4;
 			sampleX = sampleDistance * 4;
 			sampleY = sampleDistance * 4 * 16;
 			sampleY = sampleDistance * 4 * 16;
 
 
@@ -3002,8 +3002,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 		// loop through all lens flares and draw their flares
 		// loop through all lens flares and draw their flares
 		// setup gl
 		// setup gl
 		
 		
-		_gl.enable( _gl.BLEND );
-		
 		for( o = 0; o < ol; o++ ) {
 		for( o = 0; o < ol; o++ ) {
 		
 		
 			object = scene.__webglLensFlares[ o ].object;
 			object = scene.__webglLensFlares[ o ].object;
@@ -3045,8 +3043,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	
 	
 		_gl.enable( _gl.CULL_FACE );
 		_gl.enable( _gl.CULL_FACE );
 		_gl.enable( _gl.DEPTH_TEST );
 		_gl.enable( _gl.DEPTH_TEST );
-		_gl.depthMask( true );
-		_gl.disable( _gl.BLEND );
+		_gl.depthMask( _currentDepthMask );
 	}
 	}
 
 
 
 

+ 19 - 0
utils/exporters/blender/2.56/scripts/op/io_mesh_threejs/__init__.py

@@ -42,6 +42,8 @@ from io_utils import ExportHelper, ImportHelper
 bpy.types.Object.THREE_castsShadow = bpy.props.BoolProperty()
 bpy.types.Object.THREE_castsShadow = bpy.props.BoolProperty()
 bpy.types.Object.THREE_meshCollider = bpy.props.BoolProperty()
 bpy.types.Object.THREE_meshCollider = bpy.props.BoolProperty()
 
 
+bpy.types.Material.THREE_useVertexColors = bpy.props.BoolProperty()
+
 class OBJECT_PT_hello( bpy.types.Panel ):
 class OBJECT_PT_hello( bpy.types.Panel ):
     
     
     bl_label = "THREE"
     bl_label = "THREE"
@@ -62,7 +64,24 @@ class OBJECT_PT_hello( bpy.types.Panel ):
         row = layout.row()
         row = layout.row()
         row.prop( obj, "THREE_meshCollider", text="Mesh collider" )
         row.prop( obj, "THREE_meshCollider", text="Mesh collider" )
 
 
+
+class MATERIAL_PT_hello( bpy.types.Panel ):
+    
+    bl_label = "THREE"
+    bl_space_type = "PROPERTIES"
+    bl_region_type = "WINDOW"
+    bl_context = "material"
+ 
+    def draw(self, context):
+        layout = self.layout
+        mat = context.material
         
         
+        row = layout.row()
+        row.label(text="Selected material: " + mat.name )
+
+        row = layout.row()
+        row.prop( mat, "THREE_useVertexColors", text="Use vertex colors" )
+
 # ################################################################
 # ################################################################
 # Importer
 # Importer
 # ################################################################
 # ################################################################

+ 28 - 24
utils/exporters/blender/2.56/scripts/op/io_mesh_threejs/export_threejs.py

@@ -165,20 +165,20 @@ TEMPLATE_CAMERA_ORTHO = """\
     }"""
     }"""
 
 
 TEMPLATE_LIGHT_DIRECTIONAL = """\
 TEMPLATE_LIGHT_DIRECTIONAL = """\
-	%(light_id)s: {
-		"type"		 : "directional",
-		"direction"	 : %(direction)s,
-		"color" 	 : %(color)d,
-		"intensity"	 : %(intensity).2f
-	}"""
+    %(light_id)s: {
+        "type"		 : "directional",
+        "direction"	 : %(direction)s,
+        "color" 	 : %(color)d,
+        "intensity"	 : %(intensity).2f
+    }"""
 
 
 TEMPLATE_LIGHT_POINT = """\
 TEMPLATE_LIGHT_POINT = """\
-	%(light_id)s: {
-		"type"	     : "point",
-		"position"   : %(position)s,
-		"color"      : %(color)d,
-		"intensity"	 : %(intensity).3f
-	}"""
+    %(light_id)s: {
+        "type"	     : "point",
+        "position"   : %(position)s,
+        "color"      : %(color)d,
+        "intensity"	 : %(intensity).3f
+    }"""
 
 
 TEMPLATE_VEC4 = '[ %f, %f, %f, %f ]'
 TEMPLATE_VEC4 = '[ %f, %f, %f, %f ]'
 TEMPLATE_VEC3 = '[ %f, %f, %f ]'
 TEMPLATE_VEC3 = '[ %f, %f, %f ]'
@@ -628,7 +628,7 @@ def generate_mtl(materials):
     return mtl
     return mtl
 
 
 def value2string(v):
 def value2string(v):
-    if type(v) == str and v[0] != "0":
+    if type(v) == str and v[0:2] != "0x":
         return '"%s"' % v
         return '"%s"' % v
     elif type(v) == bool:
     elif type(v) == bool:
         return str(v).lower()
         return str(v).lower()
@@ -649,7 +649,7 @@ def generate_materials(mtl, materials, use_colors, draw_type):
         mtl[m]['DbgName'] = m
         mtl[m]['DbgName'] = m
         mtl[m]['DbgIndex'] = index
         mtl[m]['DbgIndex'] = index
         mtl[m]['DbgColor'] = generate_color(index)
         mtl[m]['DbgColor'] = generate_color(index)
-        mtl[m]['vertexColors'] = use_colors
+        mtl[m]['vertexColors'] = use_colors and mtl[m]["useVertexColors"]
 
 
         if draw_type in [ "BOUNDS", "WIRE" ]:
         if draw_type in [ "BOUNDS", "WIRE" ]:
             mtl[m]['wireframe'] = True
             mtl[m]['wireframe'] = True
@@ -671,16 +671,16 @@ def extract_materials(mesh, scene):
             material = materials[m.name]
             material = materials[m.name]
             
             
             material['colorDiffuse'] = [m.diffuse_intensity * m.diffuse_color[0],
             material['colorDiffuse'] = [m.diffuse_intensity * m.diffuse_color[0],
-                                       m.diffuse_intensity * m.diffuse_color[1],
-                                       m.diffuse_intensity * m.diffuse_color[2]]
+                                        m.diffuse_intensity * m.diffuse_color[1],
+                                        m.diffuse_intensity * m.diffuse_color[2]]
 
 
             material['colorSpecular'] = [m.specular_intensity * m.specular_color[0],
             material['colorSpecular'] = [m.specular_intensity * m.specular_color[0],
-                                        m.specular_intensity * m.specular_color[1],
-                                        m.specular_intensity * m.specular_color[2]]
+                                         m.specular_intensity * m.specular_color[1],
+                                         m.specular_intensity * m.specular_color[2]]
 
 
             material['colorAmbient'] = [m.ambient * world.ambient_color[0],
             material['colorAmbient'] = [m.ambient * world.ambient_color[0],
-                                       m.ambient * world.ambient_color[1],
-                                       m.ambient * world.ambient_color[2]]
+                                        m.ambient * world.ambient_color[1],
+                                        m.ambient * world.ambient_color[2]]
 
 
             material['transparency'] = m.alpha
             material['transparency'] = m.alpha
 
 
@@ -695,10 +695,14 @@ def extract_materials(mesh, scene):
                 fn_strip = os.path.basename(fn)
                 fn_strip = os.path.basename(fn)
                 material['mapDiffuse'] = fn_strip
                 material['mapDiffuse'] = fn_strip
                 
                 
-            if m.specular_intensity > 0.0 and (m.specular_color[0] > 0 or m.specular_color[1] > 0 or m.specular_color[2] > 0):
-                material['shading'] = "Phong"
-            else:
-                material['shading'] = "Lambert"
+            material["useVertexColors"] = m.THREE_useVertexColors
+            
+            # can't really use this reliably to tell apart Phong from Lambert
+            # as Blender defaults to non-zero specular color
+            #if m.specular_intensity > 0.0 and (m.specular_color[0] > 0 or m.specular_color[1] > 0 or m.specular_color[2] > 0):
+            #    material['shading'] = "Phong"
+            #else:
+            #    material['shading'] = "Lambert"
 
 
     return materials
     return materials
 
 

+ 116 - 11
utils/exporters/blender/2.56/scripts/op/io_mesh_threejs/import_threejs.py

@@ -36,13 +36,83 @@ from io_utils import load_image, unpack_list, unpack_face_list
 # #####################################################
 # #####################################################
 # Generators
 # Generators
 # #####################################################
 # #####################################################
+def setColor(c, t):
+    c.r = t[0]
+    c.g = t[1]
+    c.b = t[2]
+
+def create_texture(filename, modelpath):
+    name = filename
+    texture = bpy.data.textures.new(name, type='IMAGE')
+    
+    image = load_image(filename, modelpath)
+    has_data = False
+
+    if image:
+        texture.image = image
+        has_data = image.has_data
+    
+    return texture
+    
+def create_materials(data, modelpath):
+    materials = []
+    materials_data = data.get("materials", [])
+    
+    for i, m in enumerate(materials_data):
 
 
-def create_mesh_object(name, vertices, face_data, flipYZ, recalculate_normals):
+        name = m.get("DbgName", "material_%d" % i)
+        
+        colorAmbient = m.get("colorAmbient", None)
+        colorDiffuse = m.get("colorDiffuse", None)
+        colorSpecular = m.get("colorSpecular", None)
+        alpha = m.get("transparency", 1.0)
+        specular_hardness = m.get("specularCoef", 0)
+        
+        mapDiffuse = m.get("mapDiffuse", None)
+        mapLightmap = m.get("mapLightmap", None)
+        
+        useVertexColors = m.get("vertexColors", False)
+        
+        material = bpy.data.materials.new(name)
+        
+        material.THREE_useVertexColors = useVertexColors
+        
+        if colorDiffuse:
+            setColor(material.diffuse_color, colorDiffuse)
+            material.diffuse_intensity = 1.0
+
+        if colorSpecular:
+            setColor(material.specular_color, colorSpecular)
+            material.specular_intensity = 1.0
+            
+        if alpha < 1.0:
+            material.alpha = alpha
+            material.use_transparency = True
+            
+        if specular_hardness:
+            material.specular_hardness = specular_hardness
+            
+        if mapDiffuse:
+            texture = create_texture(mapDiffuse, modelpath)
+            mtex = material.texture_slots.add()
+            mtex.texture = texture
+            mtex.texture_coords = 'UV'
+            mtex.use = True
+            mtex.use_map_color_diffuse = True
+            
+            material.active_texture = texture
+
+        materials.append(material)
+        
+    return materials
+    
+def create_mesh_object(name, vertices, materials, face_data, flipYZ, recalculate_normals):
 
 
     faces   = face_data["faces"]
     faces   = face_data["faces"]
     vertexNormals = face_data["vertexNormals"]
     vertexNormals = face_data["vertexNormals"]
     vertexColors = face_data["vertexColors"]
     vertexColors = face_data["vertexColors"]
     vertexUVs = face_data["vertexUVs"]
     vertexUVs = face_data["vertexUVs"]
+    faceMaterials = face_data["materials"]
     
     
     edges = []
     edges = []
     
     
@@ -88,14 +158,14 @@ def create_mesh_object(name, vertices, face_data, flipYZ, recalculate_normals):
                         
                         
                         if flipYZ:
                         if flipYZ:
                             tmp = y
                             tmp = y
-                            y = z
+                            y = -z
                             z = tmp
                             z = tmp
 
 
                             # flip normals (this make them look consistent with the original before export)
                             # flip normals (this make them look consistent with the original before export)
 
 
-                            x = -x
-                            y = -y
-                            z = -z
+                            #x = -x
+                            #y = -y
+                            #z = -z
 
 
                         vi = me.faces[fi].vertices[j]
                         vi = me.faces[fi].vertices[j]
                         
                         
@@ -146,8 +216,8 @@ def create_mesh_object(name, vertices, face_data, flipYZ, recalculate_normals):
 
 
                 if layer[fi]:
                 if layer[fi]:
                     
                     
-                    face_uvs = me.uv_textures[li].data[fi]
-                    face_uvs = face_uvs.uv1, face_uvs.uv2, face_uvs.uv3, face_uvs.uv4
+                    uv_face = me.uv_textures[li].data[fi]
+                    face_uvs = uv_face.uv1, uv_face.uv2, uv_face.uv3, uv_face.uv4
                     
                     
                     for vi in range(len(layer[fi])):
                     for vi in range(len(layer[fi])):
                         
                         
@@ -156,13 +226,39 @@ def create_mesh_object(name, vertices, face_data, flipYZ, recalculate_normals):
                     
                     
                         face_uvs[vi].x = u
                         face_uvs[vi].x = u
                         face_uvs[vi].y = 1.0 - v
                         face_uvs[vi].y = 1.0 - v
+                        
+                    active_texture = materials[faceMaterials[fi]].active_texture
+                    
+                    if active_texture:
+                        uv_face.use_image = True
+                        uv_face.image = active_texture.image
+
+
+    # Handle materials # 1
+    
+    if face_data["hasMaterials"]:
+        
 
 
+        print("setting materials (mesh)")
+    
+        for m in materials:
+            
+            me.materials.append(m)
+
+        print("setting materials (faces)")    
+
+        for fi in range(len(faces)):
+            
+            if faceMaterials[fi] >= 0:
+                
+                me.faces[fi].material_index = faceMaterials[fi]
 
 
     # Create a new object
     # Create a new object
     
     
     ob = bpy.data.objects.new(name, me) 
     ob = bpy.data.objects.new(name, me) 
     ob.data = me                                # link the mesh data to the object
     ob.data = me                                # link the mesh data to the object
 
 
+
     scene = bpy.context.scene                   # get the current scene
     scene = bpy.context.scene                   # get the current scene
     scene.objects.link(ob)                      # link the object into the scene
     scene.objects.link(ob)                      # link the object into the scene
 
 
@@ -187,7 +283,8 @@ def extract_faces(data):
     
     
     "hasVertexNormals"  : False,
     "hasVertexNormals"  : False,
     "hasVertexUVs"      : False,
     "hasVertexUVs"      : False,
-    "hasVertexColors"   : False
+    "hasVertexColors"   : False,
+    "hasMaterials"      : False
     }
     }
     
     
     faces = data.get("faces", [])
     faces = data.get("faces", [])
@@ -228,6 +325,7 @@ def extract_faces(data):
         result["hasVertexUVs"] = result["hasVertexUVs"] or hasFaceVertexUv
         result["hasVertexUVs"] = result["hasVertexUVs"] or hasFaceVertexUv
         result["hasVertexNormals"] = result["hasVertexNormals"] or hasFaceVertexNormal
         result["hasVertexNormals"] = result["hasVertexNormals"] or hasFaceVertexNormal
         result["hasVertexColors"] = result["hasVertexColors"] or hasFaceVertexColor
         result["hasVertexColors"] = result["hasVertexColors"] or hasFaceVertexColor
+        result["hasMaterials"] = result["hasMaterials"] or hasMaterial
         
         
         # vertices
         # vertices
         
         
@@ -431,7 +529,10 @@ def extract_json_string(text):
 
 
 def get_name(filepath):
 def get_name(filepath):
     return os.path.splitext(os.path.basename(filepath))[0]
     return os.path.splitext(os.path.basename(filepath))[0]
-    
+
+def get_path(filepath):
+    return os.path.dirname(filepath)
+
 # #####################################################
 # #####################################################
 # Parser
 # Parser
 # #####################################################
 # #####################################################
@@ -464,7 +565,7 @@ def load(operator, context, filepath, option_flip_yz = True, recalculate_normals
     vertices = splitArray(data["vertices"], 3)
     vertices = splitArray(data["vertices"], 3)
     
     
     if option_flip_yz:
     if option_flip_yz:
-        vertices[:] = [(v[0], v[2], v[1]) for v in vertices]        
+        vertices[:] = [(v[0], -v[2], v[1]) for v in vertices]        
 
 
     # extract faces
     # extract faces
     
     
@@ -484,9 +585,13 @@ def load(operator, context, filepath, option_flip_yz = True, recalculate_normals
     print('\tbuilding geometry...\n\tfaces:%i, vertices:%i, vertex normals: %i, vertex uvs: %i, vertex colors: %i, materials: %i ...' % ( 
     print('\tbuilding geometry...\n\tfaces:%i, vertices:%i, vertex normals: %i, vertex uvs: %i, vertex colors: %i, materials: %i ...' % ( 
         nfaces, nvertices, nnormals, nuvs, ncolors, nmaterials ))
         nfaces, nvertices, nnormals, nuvs, ncolors, nmaterials ))
 
 
+    # Create materials
+    
+    materials = create_materials(data, get_path(filepath))
+    
     # Create new obj
     # Create new obj
     
     
-    create_mesh_object(get_name(filepath), vertices, face_data, option_flip_yz, recalculate_normals)
+    create_mesh_object(get_name(filepath), vertices, materials, face_data, option_flip_yz, recalculate_normals)
 
 
     scene = bpy.context.scene 
     scene = bpy.context.scene 
     scene.update()
     scene.update()