Forráskód Böngészése

Fixed update of PathCamera.

No more need for manual update hack.

Problems with keeping constant speed are still there. Added debug particles sampled along the spline - seems problems come from spline, samples have weird distribution.
alteredq 14 éve
szülő
commit
09a10f7b2c

+ 201 - 201
build/Three.js

@@ -12,33 +12,33 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,b,d){this.set(a||0,c||0,b||0,d||1)};
 THREE.Vector4.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,e=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(b)))}e.sort(function(g,h){return g.distance-h.distance});return e},intersectObject:function(a){function c(D,w,F,x){x=x.clone().subSelf(w);F=F.clone().subSelf(w);var N=D.clone().subSelf(w);D=x.dot(x);w=x.dot(F);x=x.dot(N);var L=F.dot(F);F=F.dot(N);N=1/(D*L-w*w);L=(L*x-w*F)*N;D=(D*F-w*x)*N;return L>0&&D>0&&L+D<1}var b,d,e,g,h,j,k,l,o,v,
-u,t=a.geometry,y=t.vertices,A=[];b=0;for(d=t.faces.length;b<d;b++){e=t.faces[b];v=this.origin.clone();u=this.direction.clone();k=a.matrixWorld;g=k.multiplyVector3(y[e.a].position.clone());h=k.multiplyVector3(y[e.b].position.clone());j=k.multiplyVector3(y[e.c].position.clone());k=e instanceof THREE.Face4?k.multiplyVector3(y[e.d].position.clone()):null;l=a.matrixRotationWorld.multiplyVector3(e.normal.clone());o=u.dot(l);if(o<0){l=l.dot((new THREE.Vector3).sub(g,v))/o;v=v.addSelf(u.multiplyScalar(l));
-if(e instanceof THREE.Face3){if(c(v,g,h,j)){e={distance:this.origin.distanceTo(v),point:v,face:e,object:a};A.push(e)}}else if(e instanceof THREE.Face4&&(c(v,g,h,k)||c(v,h,j,k))){e={distance:this.origin.distanceTo(v),point:v,face:e,object:a};A.push(e)}}}return A}};
-THREE.Rectangle=function(){function a(){g=d-c;h=e-b}var c,b,d,e,g,h,j=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(k,l,o,v){j=!1;c=k;b=l;d=o;e=v;a()};this.addPoint=function(k,l){if(j){j=!1;c=k;b=l;d=k;e=l}else{c=c<k?c:k;b=b<l?b:l;d=d>k?d:k;e=e>l?e:l}a()};
-this.add3Points=function(k,l,o,v,u,t){if(j){j=!1;c=k<o?k<u?k:u:o<u?o:u;b=l<v?l<t?l:t:v<t?v:t;d=k>o?k>u?k:u:o>u?o:u;e=l>v?l>t?l:t:v>t?v:t}else{c=k<o?k<u?k<c?k:c:u<c?u:c:o<u?o<c?o:c:u<c?u:c;b=l<v?l<t?l<b?l:b:t<b?t:b:v<t?v<b?v:b:t<b?t:b;d=k>o?k>u?k>d?k:d:u>d?u:d:o>u?o>d?o:d:u>d?u:d;e=l>v?l>t?l>e?l:e:t>e?t:e:v>t?v>e?v:e:t>e?t:e}a()};this.addRectangle=function(k){if(j){j=!1;c=k.getLeft();b=k.getTop();d=k.getRight();e=k.getBottom()}else{c=c<k.getLeft()?c:k.getLeft();b=b<k.getTop()?b:k.getTop();d=d>k.getRight()?
+THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,e=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(b)))}e.sort(function(g,h){return g.distance-h.distance});return e},intersectObject:function(a){function c(F,v,D,w){w=w.clone().subSelf(v);D=D.clone().subSelf(v);var N=F.clone().subSelf(v);F=w.dot(w);v=w.dot(D);w=w.dot(N);var M=D.dot(D);D=D.dot(N);N=1/(F*M-v*v);M=(M*w-v*D)*N;F=(F*D-v*w)*N;return M>0&&F>0&&M+F<1}var b,d,e,g,h,j,k,n,p,x,
+u,q=a.geometry,y=q.vertices,A=[];b=0;for(d=q.faces.length;b<d;b++){e=q.faces[b];x=this.origin.clone();u=this.direction.clone();k=a.matrixWorld;g=k.multiplyVector3(y[e.a].position.clone());h=k.multiplyVector3(y[e.b].position.clone());j=k.multiplyVector3(y[e.c].position.clone());k=e instanceof THREE.Face4?k.multiplyVector3(y[e.d].position.clone()):null;n=a.matrixRotationWorld.multiplyVector3(e.normal.clone());p=u.dot(n);if(p<0){n=n.dot((new THREE.Vector3).sub(g,x))/p;x=x.addSelf(u.multiplyScalar(n));
+if(e instanceof THREE.Face3){if(c(x,g,h,j)){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};A.push(e)}}else if(e instanceof THREE.Face4&&(c(x,g,h,k)||c(x,h,j,k))){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};A.push(e)}}}return A}};
+THREE.Rectangle=function(){function a(){g=d-c;h=e-b}var c,b,d,e,g,h,j=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(k,n,p,x){j=!1;c=k;b=n;d=p;e=x;a()};this.addPoint=function(k,n){if(j){j=!1;c=k;b=n;d=k;e=n}else{c=c<k?c:k;b=b<n?b:n;d=d>k?d:k;e=e>n?e:n}a()};
+this.add3Points=function(k,n,p,x,u,q){if(j){j=!1;c=k<p?k<u?k:u:p<u?p:u;b=n<x?n<q?n:q:x<q?x:q;d=k>p?k>u?k:u:p>u?p:u;e=n>x?n>q?n:q:x>q?x:q}else{c=k<p?k<u?k<c?k:c:u<c?u:c:p<u?p<c?p:c:u<c?u:c;b=n<x?n<q?n<b?n:b:q<b?q:b:x<q?x<b?x:b:q<b?q:b;d=k>p?k>u?k>d?k:d:u>d?u:d:p>u?p>d?p:d:u>d?u:d;e=n>x?n>q?n>e?n:e:q>e?q:e:x>q?x>e?x:e:q>e?q:e}a()};this.addRectangle=function(k){if(j){j=!1;c=k.getLeft();b=k.getTop();d=k.getRight();e=k.getBottom()}else{c=c<k.getLeft()?c:k.getLeft();b=b<k.getTop()?b:k.getTop();d=d>k.getRight()?
 d:k.getRight();e=e>k.getBottom()?e:k.getBottom()}a()};this.inflate=function(k){c-=k;b-=k;d+=k;e+=k;a()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();b=b>k.getTop()?b:k.getTop();d=d<k.getRight()?d:k.getRight();e=e<k.getBottom()?e:k.getBottom();a()};this.instersects=function(k){return Math.min(d,k.getRight())-Math.max(c,k.getLeft())>=0&&Math.min(e,k.getBottom())-Math.max(b,k.getTop())>=0};this.empty=function(){j=!0;e=d=b=c=0;a()};this.isEmpty=function(){return j}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
-THREE.Matrix4=function(a,c,b,d,e,g,h,j,k,l,o,v,u,t,y,A){this.set(a||1,c||0,b||0,d||0,e||0,g||1,h||0,j||0,k||0,l||0,o||1,v||0,u||0,t||0,y||0,A||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,c,b,d,e,g,h,j,k,l,o,v,u,t,y,A){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=l;this.n33=o;this.n34=v;this.n41=u;this.n42=t;this.n43=y;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var d=THREE.Matrix4.__v1,
+THREE.Matrix4=function(a,c,b,d,e,g,h,j,k,n,p,x,u,q,y,A){this.set(a||1,c||0,b||0,d||0,e||0,g||1,h||0,j||0,k||0,n||0,p||1,x||0,u||0,q||0,y||0,A||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,c,b,d,e,g,h,j,k,n,p,x,u,q,y,A){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=n;this.n33=p;this.n34=x;this.n41=u;this.n42=q;this.n43=y;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var d=THREE.Matrix4.__v1,
 e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;d.cross(b,g).normalize();if(d.length()===0){g.x+=1.0E-4;d.cross(b,g).normalize()}e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,e=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*e;a.y=(this.n21*c+this.n22*b+this.n23*
 d+this.n24)*e;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,e=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*e;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*e;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*e;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();
-return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,l=a.n24,o=a.n31,v=a.n32,u=a.n33,t=a.n34,y=a.n41,A=a.n42,D=a.n43,w=a.n44,F=c.n11,x=c.n12,N=c.n13,L=c.n14,Z=c.n21,M=c.n22,
-f=c.n23,V=c.n24,T=c.n31,da=c.n32,fa=c.n33,I=c.n34;this.n11=b*F+d*Z+e*T;this.n12=b*x+d*M+e*da;this.n13=b*N+d*f+e*fa;this.n14=b*L+d*V+e*I+g;this.n21=h*F+j*Z+k*T;this.n22=h*x+j*M+k*da;this.n23=h*N+j*f+k*fa;this.n24=h*L+j*V+k*I+l;this.n31=o*F+v*Z+u*T;this.n32=o*x+v*M+u*da;this.n33=o*N+v*f+u*fa;this.n34=o*L+v*V+u*I+t;this.n41=y*F+A*Z+D*T;this.n42=y*x+A*M+D*da;this.n43=y*N+A*f+D*fa;this.n44=y*L+A*V+D*I+w;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;
+return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,n=a.n24,p=a.n31,x=a.n32,u=a.n33,q=a.n34,y=a.n41,A=a.n42,F=a.n43,v=a.n44,D=c.n11,w=c.n12,N=c.n13,M=c.n14,W=c.n21,K=c.n22,
+f=c.n23,V=c.n24,T=c.n31,da=c.n32,fa=c.n33,I=c.n34;this.n11=b*D+d*W+e*T;this.n12=b*w+d*K+e*da;this.n13=b*N+d*f+e*fa;this.n14=b*M+d*V+e*I+g;this.n21=h*D+j*W+k*T;this.n22=h*w+j*K+k*da;this.n23=h*N+j*f+k*fa;this.n24=h*M+j*V+k*I+n;this.n31=p*D+x*W+u*T;this.n32=p*w+x*K+u*da;this.n33=p*N+x*f+u*fa;this.n34=p*M+x*V+u*I+q;this.n41=y*D+A*W+F*T;this.n42=y*w+A*K+F*da;this.n43=y*N+A*f+F*fa;this.n44=y*M+A*V+F*I+v;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;
 b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,c=this.n12,b=this.n13,d=this.n14,e=this.n21,g=this.n22,h=this.n23,j=this.n24,k=this.n31,l=this.n32,o=this.n33,v=this.n34,u=this.n41,t=this.n42,y=this.n43,A=this.n44;return d*h*l*u-b*j*l*u-d*g*o*u+c*j*o*u+b*g*v*u-c*h*v*u-d*h*k*t+b*j*k*t+d*e*o*t-a*j*o*t-b*e*v*t+a*h*v*t+d*g*k*y-c*j*k*y-d*e*l*y+a*j*l*y+c*e*v*y-a*g*v*y-b*g*k*A+c*h*k*A+b*e*l*A-a*h*l*A-c*e*o*A+a*g*o*A},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,c=this.n12,b=this.n13,d=this.n14,e=this.n21,g=this.n22,h=this.n23,j=this.n24,k=this.n31,n=this.n32,p=this.n33,x=this.n34,u=this.n41,q=this.n42,y=this.n43,A=this.n44;return d*h*n*u-b*j*n*u-d*g*p*u+c*j*p*u+b*g*x*u-c*h*x*u-d*h*k*q+b*j*k*q+d*e*p*q-a*j*p*q-b*e*x*q+a*h*x*q+d*g*k*y-c*j*k*y-d*e*n*y+a*j*n*y+c*e*x*y-a*g*x*y-b*g*k*A+c*h*k*A+b*e*n*A-a*h*n*A-c*e*p*A+a*g*p*A},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,
-c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),e=1-b,g=a.x,h=a.y,j=a.z,k=e*g,l=e*h;this.set(k*
-g+b,k*h-d*j,k*j+d*h,0,k*h+d*j,l*h+b,l*j-d*g,0,k*j-d*h,l*j+d*g,e*j*j+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var e=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var h=a*b,j=c*b;this.n11=e*g;this.n12=-e*d;this.n13=b;this.n21=j*g+a*d;this.n22=-j*d+a*g;this.n23=-c*e;this.n31=-h*g+c*d;this.n32=h*d+c*g;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var c=
-a.x,b=a.y,d=a.z,e=a.w,g=c+c,h=b+b,j=d+d;a=c*g;var k=c*h;c*=j;var l=b*h;b*=j;d*=j;g*=e;h*=e;e*=j;this.n11=1-(l+d);this.n12=k-e;this.n13=c+h;this.n21=k+e;this.n22=1-(a+d);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+l);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=
+c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),e=1-b,g=a.x,h=a.y,j=a.z,k=e*g,n=e*h;this.set(k*
+g+b,k*h-d*j,k*j+d*h,0,k*h+d*j,n*h+b,n*j-d*g,0,k*j-d*h,n*j+d*g,e*j*j+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var e=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var h=a*b,j=c*b;this.n11=e*g;this.n12=-e*d;this.n13=b;this.n21=j*g+a*d;this.n22=-j*d+a*g;this.n23=-c*e;this.n31=-h*g+c*d;this.n32=h*d+c*g;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var c=
+a.x,b=a.y,d=a.z,e=a.w,g=c+c,h=b+b,j=d+d;a=c*g;var k=c*h;c*=j;var n=b*h;b*=j;d*=j;g*=e;h*=e;e*=j;this.n11=1-(n+d);this.n12=k-e;this.n13=c+h;this.n21=k+e;this.n22=1-(a+d);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+n);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
 a.n34},extractRotation:function(a,c){var b=1/c.x,d=1/c.y,e=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
-THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,l=a.n24,o=a.n31,v=a.n32,u=a.n33,t=a.n34,y=a.n41,A=a.n42,D=a.n43,w=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=k*t*A-l*u*A+l*v*D-j*t*D-k*v*w+j*u*w;c.n12=g*u*A-e*t*A-g*v*D+d*t*D+e*v*w-d*u*w;c.n13=e*l*A-g*k*A+g*j*D-d*l*D-e*j*w+d*k*w;c.n14=g*k*v-e*l*v-g*j*u+d*l*u+e*j*t-d*k*t;c.n21=l*u*y-k*t*y-l*o*D+h*t*D+k*o*w-h*u*w;c.n22=e*t*y-g*u*y+g*o*D-b*t*D-e*o*w+b*u*w;c.n23=g*k*y-e*l*y-g*h*D+b*l*D+e*h*w-b*k*w;
-c.n24=e*l*o-g*k*o+g*h*u-b*l*u-e*h*t+b*k*t;c.n31=j*t*y-l*v*y+l*o*A-h*t*A-j*o*w+h*v*w;c.n32=g*v*y-d*t*y-g*o*A+b*t*A+d*o*w-b*v*w;c.n33=e*l*y-g*j*y+g*h*A-b*l*A-d*h*w+b*j*w;c.n34=g*j*o-d*l*o-g*h*v+b*l*v+d*h*t-b*j*t;c.n41=k*v*y-j*u*y-k*o*A+h*u*A+j*o*D-h*v*D;c.n42=d*u*y-e*v*y+e*o*A-b*u*A-d*o*D+b*v*D;c.n43=e*j*y-d*k*y-e*h*A+b*k*A+d*h*D-b*j*D;c.n44=d*k*o-e*j*o+e*h*v-b*k*v-d*h*u+b*j*u;c.multiplyScalar(1/a.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,v=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*l;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*e;b[2]=a*g;b[3]=a*h;b[4]=a*j;b[5]=a*k;b[6]=a*l;b[7]=a*o;b[8]=a*v;return c};
+THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,n=a.n24,p=a.n31,x=a.n32,u=a.n33,q=a.n34,y=a.n41,A=a.n42,F=a.n43,v=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=k*q*A-n*u*A+n*x*F-j*q*F-k*x*v+j*u*v;c.n12=g*u*A-e*q*A-g*x*F+d*q*F+e*x*v-d*u*v;c.n13=e*n*A-g*k*A+g*j*F-d*n*F-e*j*v+d*k*v;c.n14=g*k*x-e*n*x-g*j*u+d*n*u+e*j*q-d*k*q;c.n21=n*u*y-k*q*y-n*p*F+h*q*F+k*p*v-h*u*v;c.n22=e*q*y-g*u*y+g*p*F-b*q*F-e*p*v+b*u*v;c.n23=g*k*y-e*n*y-g*h*F+b*n*F+e*h*v-b*k*v;
+c.n24=e*n*p-g*k*p+g*h*u-b*n*u-e*h*q+b*k*q;c.n31=j*q*y-n*x*y+n*p*A-h*q*A-j*p*v+h*x*v;c.n32=g*x*y-d*q*y-g*p*A+b*q*A+d*p*v-b*x*v;c.n33=e*n*y-g*j*y+g*h*A-b*n*A-d*h*v+b*j*v;c.n34=g*j*p-d*n*p-g*h*x+b*n*x+d*h*q-b*j*q;c.n41=k*x*y-j*u*y-k*p*A+h*u*A+j*p*F-h*x*F;c.n42=d*u*y-e*x*y+e*p*A-b*u*A-d*p*F+b*x*F;c.n43=e*j*y-d*k*y-e*h*A+b*k*A+d*h*F-b*j*F;c.n44=d*k*p-e*j*p+e*h*x-b*k*x-d*h*u+b*j*u;c.multiplyScalar(1/a.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,p=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*n;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*e;b[2]=a*g;b[3]=a*h;b[4]=a*j;b[5]=a*k;b[6]=a*n;b[7]=a*p;b[8]=a*x;return c};
 THREE.Matrix4.makeFrustum=function(a,c,b,d,e,g){var h;h=new THREE.Matrix4;h.n11=2*e/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*e/(d-b);h.n23=(d+b)/(d-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+e)/(g-e);h.n34=-2*g*e/(g-e);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,d){var e;a=b*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*c,a*c,e,a,b,d)};
-THREE.Matrix4.makeOrtho=function(a,c,b,d,e,g){var h,j,k,l;h=new THREE.Matrix4;j=c-a;k=b-d;l=g-e;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((c+a)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((b+d)/k);h.n31=0;h.n32=0;h.n33=-2/l;h.n34=-((g+e)/l);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,d,e,g){var h,j,k,n;h=new THREE.Matrix4;j=c-a;k=b-d;n=g-e;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((c+a)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((b+d)/k);h.n31=0;h.n32=0;h.n33=-2/n;h.n34=-((g+e)/n);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
@@ -47,8 +47,8 @@ undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c
 c,b)}}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==undefined?d:1)};
 THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,e=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-e);e=Math.sin(-e);var g=Math.cos(b);b=Math.sin(b);var h=a*c,j=d*e;this.w=h*g-j*b;this.x=h*b+j*g;this.y=d*c*g+a*e*b;this.z=a*e*g-d*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,d=this.z,e=this.w,g=a.x,h=a.y,j=a.z;a=a.w;this.x=c*a+e*g+b*j-d*h;this.y=b*a+e*h+d*g-c*j;this.z=d*a+e*j+c*h-b*g;this.w=e*a-c*g-b*h-d*j;return this},
-multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,e=a.z,g=this.x,h=this.y,j=this.z,k=this.w,l=k*b+h*e-j*d,o=k*d+j*b-g*e,v=k*e+g*d-h*b;b=-g*b-h*d-j*e;c.x=l*k+b*-g+o*-j-v*-h;c.y=o*k+b*-h+v*-g-l*-j;c.z=v*k+b*-j+l*-h-o*-g;return c}};
-THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.001){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};
+multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,e=a.z,g=this.x,h=this.y,j=this.z,k=this.w,n=k*b+h*e-j*d,p=k*d+j*b-g*e,x=k*e+g*d-h*b;b=-g*b-h*d-j*e;c.x=n*k+b*-g+p*-j-x*-h;c.y=p*k+b*-h+x*-g-n*-j;c.z=x*k+b*-j+n*-h-p*-g;return c}};
+THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.0010){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};
 THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,c,b,d,e){this.a=a;this.b=c;this.c=b;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,c,b,d,e,g){this.a=a;this.b=c;this.c=b;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};
 THREE.UV=function(a,c){this.set(a||0,c||0)};THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -56,13 +56,13 @@ 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,d,e,g,h,j=new THREE.Vector3,k=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){g=this.faces[d];if(a&&g.vertexNormals.length){j.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)j.addSelf(g.vertexNormals[c]);j.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];j.sub(h.position,
 b.position);k.sub(c.position,b.position);j.crossSelf(k)}j.isZero()||j.normalize();g.normal.copy(j)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal);d[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<
-c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c]);b.vertexNormals[3].copy(d[b.d])}}},computeTangents:function(){function a(I,ca,xa,ea,va,ia,ga){g=I.vertices[ca].position;h=I.vertices[xa].position;j=I.vertices[ea].position;k=e[va];l=e[ia];o=e[ga];v=h.x-g.x;u=j.x-g.x;t=h.y-g.y;
-y=j.y-g.y;A=h.z-g.z;D=j.z-g.z;w=l.u-k.u;F=o.u-k.u;x=l.v-k.v;N=o.v-k.v;L=1/(w*N-F*x);f.set((N*v-x*u)*L,(N*t-x*y)*L,(N*A-x*D)*L);V.set((w*u-F*v)*L,(w*y-F*t)*L,(w*D-F*A)*L);Z[ca].addSelf(f);Z[xa].addSelf(f);Z[ea].addSelf(f);M[ca].addSelf(V);M[xa].addSelf(V);M[ea].addSelf(V)}var c,b,d,e,g,h,j,k,l,o,v,u,t,y,A,D,w,F,x,N,L,Z=[],M=[],f=new THREE.Vector3,V=new THREE.Vector3,T=new THREE.Vector3,da=new THREE.Vector3,fa=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){Z[c]=new THREE.Vector3;M[c]=new THREE.Vector3}c=
+c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c]);b.vertexNormals[3].copy(d[b.d])}}},computeTangents:function(){function a(I,ca,xa,ea,va,ia,ga){g=I.vertices[ca].position;h=I.vertices[xa].position;j=I.vertices[ea].position;k=e[va];n=e[ia];p=e[ga];x=h.x-g.x;u=j.x-g.x;q=h.y-g.y;
+y=j.y-g.y;A=h.z-g.z;F=j.z-g.z;v=n.u-k.u;D=p.u-k.u;w=n.v-k.v;N=p.v-k.v;M=1/(v*N-D*w);f.set((N*x-w*u)*M,(N*q-w*y)*M,(N*A-w*F)*M);V.set((v*u-D*x)*M,(v*y-D*q)*M,(v*F-D*A)*M);W[ca].addSelf(f);W[xa].addSelf(f);W[ea].addSelf(f);K[ca].addSelf(V);K[xa].addSelf(V);K[ea].addSelf(V)}var c,b,d,e,g,h,j,k,n,p,x,u,q,y,A,F,v,D,w,N,M,W=[],K=[],f=new THREE.Vector3,V=new THREE.Vector3,T=new THREE.Vector3,da=new THREE.Vector3,fa=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){W[c]=new THREE.Vector3;K[c]=new THREE.Vector3}c=
 0;for(b=this.faces.length;c<b;c++){d=this.faces[c];e=this.uvs[c];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
-this.vertices[d.d].normal.copy(d.vertexNormals[3])}}c=0;for(b=this.vertices.length;c<b;c++){fa.copy(this.vertices[c].normal);d=Z[c];T.copy(d);T.subSelf(fa.multiplyScalar(fa.dot(d))).normalize();da.cross(this.vertices[c].normal,d);d=da.dot(M[c]);d=d<0?-1:1;this.vertices[c].tangent.set(T.x,T.y,T.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
+this.vertices[d.d].normal.copy(d.vertexNormals[3])}}c=0;for(b=this.vertices.length;c<b;c++){fa.copy(this.vertices[c].normal);d=W[c];T.copy(d);T.subSelf(fa.multiplyScalar(fa.dot(d))).normalize();da.cross(this.vertices[c].normal,d);d=da.dot(K[c]);d=d<0?-1:1;this.vertices[c].tangent.set(T.x,T.y,T.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(){function a(u,t,y,A,D,w,F){u=(y-u)*0.5;A=(A-t)*0.5;return(2*(t-y)+u+A)*F+(-3*(t-y)-2*u-A)*w+u*D+t}var c=[],b={x:0,y:0,z:0},d,e,g,h,j,k,l,o,v;this.getPoint=function(u,t){d=(u.length-1)*t;e=Math.floor(d);g=d-e;c[0]=e==0?e:e-1;c[1]=e;c[2]=e>u.length-2?e:e+1;c[3]=e>u.length-3?e:e+2;k=u[c[0]];l=u[c[1]];o=u[c[2]];v=u[c[3]];h=g*g;j=g*h;b.x=a(k.x,l.x,o.x,v.x,g,h,j);b.y=a(k.y,l.y,o.y,v.y,g,h,j);b.z=a(k.z,l.z,o.z,v.z,g,h,j);return b}};
+THREE.Spline=function(){function a(u,q,y,A,F,v,D){u=(y-u)*0.5;A=(A-q)*0.5;return(2*(q-y)+u+A)*D+(-3*(q-y)-2*u-A)*v+u*F+q}var c=[],b={x:0,y:0,z:0},d,e,g,h,j,k,n,p,x;this.getPoint=function(u,q){d=(u.length-1)*q;e=Math.floor(d);g=d-e;c[0]=e==0?e:e-1;c[1]=e;c[2]=e>u.length-2?e:e+1;c[3]=e>u.length-3?e:e+2;k=u[c[0]];n=u[c[1]];p=u[c[2]];x=u[c[3]];h=g*g;j=g*h;b.x=a(k.x,n.x,p.x,x.x,g,h,j);b.y=a(k.y,n.y,p.y,x.y,g,h,j);b.z=a(k.z,n.z,p.z,x.z,g,h,j);return b}};
 THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(e){for(var g=0;g<a.length;g++)a[g].update(e)};b.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};b.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};b.add=function(e){c[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");c[e.name]=e;if(e.initialized!==!0){for(var g=0;g<e.hierarchy.length;g++){for(var h=0;h<e.hierarchy[g].keys.length;h++){if(e.hierarchy[g].keys[h].time<
 0)e.hierarchy[g].keys[h].time=0;if(e.hierarchy[g].keys[h].rot!==undefined&&!(e.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var j=e.hierarchy[g].keys[h].rot;e.hierarchy[g].keys[h].rot=new THREE.Quaternion(j[0],j[1],j[2],j[3])}}for(h=1;h<e.hierarchy[g].keys.length;h++)if(e.hierarchy[g].keys[h].time===e.hierarchy[g].keys[h-1].time){e.hierarchy[g].keys.splice(h,1);h--}for(h=1;h<e.hierarchy[g].keys.length;h++)e.hierarchy[g].keys[h].index=h}h=parseInt(e.length*e.fps,10);e.JIT={};e.JIT.hierarchy=
 [];for(g=0;g<e.hierarchy.length;g++)e.JIT.hierarchy.push(Array(h));e.initialized=!0}};b.get=function(e){if(typeof e==="string")if(c[e])return c[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};b.parse=function(e){var g=[];if(e instanceof THREE.SkinnedMesh)for(var h=0;h<e.bones.length;h++)g.push(e.bones[h]);else d(e,g);return g};var d=function(e,g){g.push(e);for(var h=0;h<e.children.length;h++)d(e.children[h],g)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
@@ -71,19 +71,19 @@ THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=
 e instanceof THREE.Bone?e.skinMatrix:e.matrix}var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];e.pos=this.getNextKeyWith("pos",b,1);e.rot=this.getNextKeyWith("rot",b,1);e.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,e,g,h,j,k,l,o=this.data.JIT.hierarchy,v,u;this.currentTime+=a;u=this.currentTime;v=this.currentTime%=this.data.length;l=parseInt(Math.min(v*this.data.fps,this.data.length*this.data.fps),10);for(var t=0,y=this.hierarchy.length;t<y;t++){a=this.hierarchy[t];k=a.animationCache;if(this.JITCompile&&o[t][l]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=o[t][l];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=o[t][l];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 A=0;A<3;A++){b=c[A];h=k.prevKey[b];j=k.nextKey[b];if(j.time<=u){if(v<u)if(this.loop){h=this.data.hierarchy[t].keys[0];for(j=this.getNextKeyWith(b,t,1);j.time<v;){h=j;j=this.getNextKeyWith(b,t,j.index+1)}}else{this.stop();return}else{do{h=j;j=this.getNextKeyWith(b,t,j.index+1)}while(j.time<
-v)}k.prevKey[b]=h;k.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(v-h.time)/(j.time-h.time);e=h[b];g=j[b];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+t);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",t,h.index-1).pos;this.points[1]=e;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",t,j.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);b.x=e[0];b.y=e[1];b.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(b===
-"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}}}}if(this.JITCompile&&o[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(t=0;t<this.hierarchy.length;t++)o[t][l]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],e,g,h,j,k,l;e=(a.length-1)*c;g=Math.floor(e);e-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];j=a[b[1]];k=a[b[2]];l=a[b[3]];b=e*e;h=e*b;d[0]=this.interpolate(g[0],j[0],k[0],l[0],e,b,h);d[1]=this.interpolate(g[1],j[1],k[1],l[1],e,b,h);d[2]=this.interpolate(g[2],j[2],k[2],l[2],e,b,h);return d};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,e,g,h,j,k,n,p=this.data.JIT.hierarchy,x,u;this.currentTime+=a;u=this.currentTime;x=this.currentTime%=this.data.length;n=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var q=0,y=this.hierarchy.length;q<y;q++){a=this.hierarchy[q];k=a.animationCache;if(this.JITCompile&&p[q][n]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=p[q][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=p[q][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var A=0;A<3;A++){b=c[A];h=k.prevKey[b];j=k.nextKey[b];if(j.time<=u){if(x<u)if(this.loop){h=this.data.hierarchy[q].keys[0];for(j=this.getNextKeyWith(b,q,1);j.time<x;){h=j;j=this.getNextKeyWith(b,q,j.index+1)}}else{this.stop();return}else{do{h=j;j=this.getNextKeyWith(b,q,j.index+1)}while(j.time<
+x)}k.prevKey[b]=h;k.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(x-h.time)/(j.time-h.time);e=h[b];g=j[b];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+q);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",q,h.index-1).pos;this.points[1]=e;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",q,j.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);b.x=e[0];b.y=e[1];b.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(b===
+"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}}}}if(this.JITCompile&&p[0][n]===undefined){this.hierarchy[0].update(undefined,!0);for(q=0;q<this.hierarchy.length;q++)p[q][n]=this.hierarchy[q]instanceof THREE.Bone?this.hierarchy[q].skinMatrix.clone():this.hierarchy[q].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],e,g,h,j,k,n;e=(a.length-1)*c;g=Math.floor(e);e-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];j=a[b[1]];k=a[b[2]];n=a[b[3]];b=e*e;h=e*b;d[0]=this.interpolate(g[0],j[0],k[0],n[0],e,b,h);d[1]=this.interpolate(g[1],j[1],k[1],n[1],e,b,h);d[2]=this.interpolate(g[2],j[2],k[2],n[2],e,b,h);return d};
 THREE.Animation.prototype.interpolate=function(a,c,b,d,e,g,h){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*h+(-3*(c-b)-2*a-d)*g+a*e+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<d.length-1?b:d.length-1;else b%=d.length;for(;b<d.length;b++)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
 THREE.Camera=function(a,c,b,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.update=function(a,c,b){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !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.QuakeCamera=function(a){function c(b,d){return function(){d.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
+THREE.QuakeCamera=function(a){function c(b,d){return function(){d.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
 a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
 this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=
 !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
@@ -91,18 +91,18 @@ this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBack
 var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;b=this.target.position;var d=this.position;b.x=d.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=d.y+100*Math.cos(this.phi);b.z=d.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
 !1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
 THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
-THREE.PathCamera=function(a){function c(l,o){var v=l[0]-o[0],u=l[1]-o[1],t=l[2]-o[2];return Math.sqrt(v*v+u*u+t*t)}function b(l,o,v,u){var t={name:v,fps:0.6,length:u,hierarchy:[]},y,A;y=o.length;var D,w,F=[];A=new THREE.Spline;var x=0;for(D=0;D<o.length;D++){w=o[D];F[D]={x:w[0],y:w[1],z:w[2]}}var N=[o[0][0],o[0][1],o[0][2]];for(D=1;D<F.length*100;D++){w=D/(F.length*100);position=A.getPoint(F,w);x+=c([position.x,position.y,position.z],N);N=[position.x,position.y,position.z]}D=x;F=0;x=y-1;A={parent:-1,
-keys:[]};A.keys[0]={time:0,pos:o[0],rot:[0,0,0,1],scl:[1,1,1]};A.keys[x]={time:u,pos:o[x],rot:[0,0,0,1],scl:[1,1,1]};console.log("path totalLength: ",D);for(y=1;y<x;y++){F+=u*c(o[y],o[y-1])/D;A.keys[y]={time:F,pos:o[y]}}t.hierarchy[0]=A;THREE.AnimationHandler.add(t);return new THREE.Animation(l,v,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function d(l,o){var v,u,t=new THREE.Geometry,y=new THREE.Spline,A=[];for(v=0;v<o.length;v++){u=o[v];A[v]={x:u[0],y:u[1],z:u[2]}}for(v=0;v<A.length*10;v++){u=
-v/(A.length*10);u=y.getPoint(A,u);t.vertices[v]=new THREE.Vertex(new THREE.Vector3(u.x,u.y,u.z))}v=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(t,v);lineObj.scale.set(1,1,1);l.addChild(lineObj);v=new Sphere(1,16,8);y=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.length;i++){t=new THREE.Mesh(v,y);t.position.set(o[i][0],o[i][1],o[i][2]);t.updateMatrix();l.addChild(t)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.duration=1E4;this.waypoints=
-[];this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=!0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
-if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
-this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,g=Math.PI/180;this.updateManual=function(){var l,o;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;l=this.phi%e;this.phi=l>=0?l:l+e;l=this.verticalAngleMap.srcRange;o=this.verticalAngleMap.dstRange;
-this.phi=(this.phi-l[0])*(o[1]-o[0])/(l[1]-l[0])+o[0];l=this.horizontalAngleMap.srcRange;o=this.horizontalAngleMap.dstRange;this.theta=(this.theta-l[0])*(o[1]-o[0])/(l[1]-l[0])+o[0];l=this.target.position;o=this.position;l.x=o.x+100*Math.sin(this.phi)*Math.cos(this.theta);l.y=o.y+100*Math.cos(this.phi);l.z=o.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.onMouseMove=function(l){this.mouseX=l.clientX-this.windowHalfX;this.mouseY=l.clientY-this.windowHalfY};if(this.createDebugDummy){a=
-new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),j=new Cube(10,10,20),k=new Cube(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(k,h);a.position.set(0,10,0);this.animation=b(this.animationParent,this.waypoints,"cameraPath01",this.duration);this.animationParent.addChild(this);this.animationParent.addChild(a)}else{this.animation=b(this.animationParent,this.waypoints,"cameraPath01",this.duration);this.animationParent.addChild(this)}this.createDebugPath&&
-d(this.debugPath,this.waypoints);this.domElement.addEventListener("mousemove",function(l,o){return function(){o.apply(l,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;
-THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;
-THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};
-THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
+THREE.PathCamera=function(a){function c(n,p,x,u){var q={name:x,fps:0.6,length:u,hierarchy:[]},y,A,F=p.length,v,D,w;v=[];y=new THREE.Spline;var N=D=D=0,M=[0],W=0;for(A=0;A<p.length;A++){w=p[A];v[A]={x:w[0],y:w[1],z:w[2]}}w=[p[0][0],p[0][1],p[0][2]];for(A=1;A<v.length*100;A++){D=A/(v.length*100);position=y.getPoint(v,D);var K=[position.x,position.y,position.z],f=K[0]-w[0],V=K[1]-w[1];w=K[2]-w[2];W+=Math.sqrt(f*f+V*V+w*w);w=[position.x,position.y,position.z];D*=v.length-1;D=Math.floor(D);if(D!=N){M[D]=
+W;N=D}}v={chunks:M,total:W};N=0;y=F-1;A={parent:-1,keys:[]};A.keys[0]={time:0,pos:p[0],rot:[0,0,0,1],scl:[1,1,1]};A.keys[y]={time:u,pos:p[y],rot:[0,0,0,1],scl:[1,1,1]};console.log("path length total:",v.total,"chunks:",v.chunks);for(y=1;y<F-1;y++){N=u*v.chunks[y]/v.total;A.keys[y]={time:N,pos:p[y]};console.log(y,N/1E3)}q.hierarchy[0]=A;THREE.AnimationHandler.add(q);return new THREE.Animation(n,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(n,p){var x,u,q=new THREE.Geometry,y=new THREE.Spline,
+A=[];for(x=0;x<n.length;x++){u=n[x];A[x]={x:u[0],y:u[1],z:u[2]}}for(x=0;x<A.length*p;x++){u=x/(A.length*p);u=y.getPoint(A,u);q.vertices[x]=new THREE.Vertex(new THREE.Vector3(u.x,u.y,u.z))}return q}function d(n,p){var x=b(p,10),u=b(p,10),q=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,q);particleObj=new THREE.ParticleSystem(u,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);n.addChild(lineObj);particleObj.scale.set(1,1,1);n.addChild(particleObj);
+u=new Sphere(1,16,8);q=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<p.length;i++){x=new THREE.Mesh(u,q);x.position.set(p[i][0],p[i][1],p[i][2]);x.updateMatrix();n.addChild(x)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.duration=1E4;this.waypoints=[];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.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=
+a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,g=Math.PI/180;this.update=function(n,p,x){var u,q;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&
+(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;u=this.phi%e;this.phi=u>=0?u:u+e;u=this.verticalAngleMap.srcRange;q=this.verticalAngleMap.dstRange;this.phi=(this.phi-u[0])*(q[1]-q[0])/(u[1]-u[0])+q[0];u=this.horizontalAngleMap.srcRange;q=this.horizontalAngleMap.dstRange;this.theta=(this.theta-u[0])*(q[1]-q[0])/(u[1]-u[0])+q[0];u=this.target.position;q=this.position;u.x=q.x+
+100*Math.sin(this.phi)*Math.cos(this.theta);u.y=q.y+100*Math.cos(this.phi);u.z=q.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,n,p,x)};this.onMouseMove=function(n){this.mouseX=n.clientX-this.windowHalfX;this.mouseY=n.clientY-this.windowHalfY};if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),j=new Cube(10,10,20),k=new Cube(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(k,h);a.position.set(0,
+10,0);this.animation=c(this.animationParent,this.waypoints,"cameraPath01",this.duration);this.animationParent.addChild(this);this.animationParent.addChild(a)}else{this.animation=c(this.animationParent,this.waypoints,"cameraPath01",this.duration);this.animationParent.addChild(this)}this.createDebugPath&&d(this.debugPath,this.waypoints);this.domElement.addEventListener("mousemove",function(n,p){return function(){p.apply(n,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;
+THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
+THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
+THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.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}};
 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;if(a){a.color!==undefined&&
@@ -152,53 +152,53 @@ THREE.LOD.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updat
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c||1;this.far=b||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
-THREE.Projector=function(){function a(M,f){return f.z-M.z}function c(M,f){var V=0,T=1,da=M.z+M.w,fa=f.z+f.w,I=-M.z+M.w,ca=-f.z+f.w;if(da>=0&&fa>=0&&I>=0&&ca>=0)return!0;else if(da<0&&fa<0||I<0&&ca<0)return!1;else{if(da<0)V=Math.max(V,da/(da-fa));else fa<0&&(T=Math.min(T,da/(da-fa)));if(I<0)V=Math.max(V,I/(I-ca));else ca<0&&(T=Math.min(T,I/(I-ca)));if(T<V)return!1;else{M.lerpSelf(f,V);f.lerpSelf(M,1-T);return!0}}}var b,d,e=[],g,h,j,k=[],l,o,v=[],u,t,y=[],A=new THREE.Vector4,D=new THREE.Vector4,w=new THREE.Matrix4,
-F=new THREE.Matrix4,x=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,L=new THREE.Vector4,Z;this.projectObjects=function(M,f,V){f=[];var T,da,fa;d=0;da=M.objects;M=0;for(T=da.length;M<T;M++){fa=da[M];var I;if(!(I=!fa.visible))if(I=fa instanceof THREE.Mesh){a:{I=void 0;for(var ca=fa.matrixWorld,xa=-fa.geometry.boundingSphere.radius*Math.max(fa.scale.x,Math.max(fa.scale.y,fa.scale.z)),ea=0;ea<6;ea++){I=x[ea].x*ca.n14+
-x[ea].y*ca.n24+x[ea].z*ca.n34+x[ea].w;if(I<=xa){I=!1;break a}}I=!0}I=!I}if(!I){b=e[d]=e[d]||new THREE.RenderableObject;A.copy(fa.position);w.multiplyVector3(A);b.object=fa;b.z=A.z;f.push(b);d++}}V&&f.sort(a);return f};this.projectScene=function(M,f,V){var T=[],da=f.near,fa=f.far,I,ca,xa,ea,va,ia,ga,ta,ya,ha,aa,ma,na,R,ja,qa;j=o=t=0;f.matrixAutoUpdate&&f.update();w.multiply(f.projectionMatrix,f.matrixWorldInverse);x[0].set(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);x[1].set(w.n41+w.n11,w.n42+
-w.n12,w.n43+w.n13,w.n44+w.n14);x[2].set(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);x[3].set(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);x[4].set(w.n41-w.n31,w.n42-w.n32,w.n43-w.n33,w.n44-w.n34);x[5].set(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);for(I=0;I<6;I++){ia=x[I];ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z))}M.update(undefined,!1,f);ia=this.projectObjects(M,f,!0);M=0;for(I=ia.length;M<I;M++){ga=ia[M].object;if(ga.visible){ta=ga.matrixWorld;aa=ga.matrixRotationWorld;
-ya=ga.materials;ha=ga.overdraw;if(ga instanceof THREE.Mesh){ma=ga.geometry;na=ma.vertices;ca=0;for(xa=na.length;ca<xa;ca++){R=na[ca];R.positionWorld.copy(R.position);ta.multiplyVector3(R.positionWorld);ea=R.positionScreen;ea.copy(R.positionWorld);w.multiplyVector4(ea);ea.x/=ea.w;ea.y/=ea.w;R.__visible=ea.z>da&&ea.z<fa}ma=ma.faces;ca=0;for(xa=ma.length;ca<xa;ca++){R=ma[ca];if(R instanceof THREE.Face3){ea=na[R.a];va=na[R.b];ja=na[R.c];if(ea.__visible&&va.__visible&&ja.__visible&&(ga.doubleSided||ga.flipSided!=
+THREE.Projector=function(){function a(K,f){return f.z-K.z}function c(K,f){var V=0,T=1,da=K.z+K.w,fa=f.z+f.w,I=-K.z+K.w,ca=-f.z+f.w;if(da>=0&&fa>=0&&I>=0&&ca>=0)return!0;else if(da<0&&fa<0||I<0&&ca<0)return!1;else{if(da<0)V=Math.max(V,da/(da-fa));else fa<0&&(T=Math.min(T,da/(da-fa)));if(I<0)V=Math.max(V,I/(I-ca));else ca<0&&(T=Math.min(T,I/(I-ca)));if(T<V)return!1;else{K.lerpSelf(f,V);f.lerpSelf(K,1-T);return!0}}}var b,d,e=[],g,h,j,k=[],n,p,x=[],u,q,y=[],A=new THREE.Vector4,F=new THREE.Vector4,v=new THREE.Matrix4,
+D=new THREE.Matrix4,w=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,M=new THREE.Vector4,W;this.projectObjects=function(K,f,V){f=[];var T,da,fa;d=0;da=K.objects;K=0;for(T=da.length;K<T;K++){fa=da[K];var I;if(!(I=!fa.visible))if(I=fa instanceof THREE.Mesh){a:{I=void 0;for(var ca=fa.matrixWorld,xa=-fa.geometry.boundingSphere.radius*Math.max(fa.scale.x,Math.max(fa.scale.y,fa.scale.z)),ea=0;ea<6;ea++){I=w[ea].x*ca.n14+
+w[ea].y*ca.n24+w[ea].z*ca.n34+w[ea].w;if(I<=xa){I=!1;break a}}I=!0}I=!I}if(!I){b=e[d]=e[d]||new THREE.RenderableObject;A.copy(fa.position);v.multiplyVector3(A);b.object=fa;b.z=A.z;f.push(b);d++}}V&&f.sort(a);return f};this.projectScene=function(K,f,V){var T=[],da=f.near,fa=f.far,I,ca,xa,ea,va,ia,ga,ta,ya,ha,aa,ma,na,R,ja,qa;j=p=q=0;f.matrixAutoUpdate&&f.update();v.multiply(f.projectionMatrix,f.matrixWorldInverse);w[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);w[1].set(v.n41+v.n11,v.n42+
+v.n12,v.n43+v.n13,v.n44+v.n14);w[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);w[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);w[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);w[5].set(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(I=0;I<6;I++){ia=w[I];ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z))}K.update(undefined,!1,f);ia=this.projectObjects(K,f,!0);K=0;for(I=ia.length;K<I;K++){ga=ia[K].object;if(ga.visible){ta=ga.matrixWorld;aa=ga.matrixRotationWorld;
+ya=ga.materials;ha=ga.overdraw;if(ga instanceof THREE.Mesh){ma=ga.geometry;na=ma.vertices;ca=0;for(xa=na.length;ca<xa;ca++){R=na[ca];R.positionWorld.copy(R.position);ta.multiplyVector3(R.positionWorld);ea=R.positionScreen;ea.copy(R.positionWorld);v.multiplyVector4(ea);ea.x/=ea.w;ea.y/=ea.w;R.__visible=ea.z>da&&ea.z<fa}ma=ma.faces;ca=0;for(xa=ma.length;ca<xa;ca++){R=ma[ca];if(R instanceof THREE.Face3){ea=na[R.a];va=na[R.b];ja=na[R.c];if(ea.__visible&&va.__visible&&ja.__visible&&(ga.doubleSided||ga.flipSided!=
 (ja.positionScreen.x-ea.positionScreen.x)*(va.positionScreen.y-ea.positionScreen.y)-(ja.positionScreen.y-ea.positionScreen.y)*(va.positionScreen.x-ea.positionScreen.x)<0)){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ea.positionWorld);g.v2.positionWorld.copy(va.positionWorld);g.v3.positionWorld.copy(ja.positionWorld);g.v1.positionScreen.copy(ea.positionScreen);g.v2.positionScreen.copy(va.positionScreen);g.v3.positionScreen.copy(ja.positionScreen);g.normalWorld.copy(R.normal);aa.multiplyVector3(g.normalWorld);
-g.centroidWorld.copy(R.centroid);ta.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);w.multiplyVector3(g.centroidScreen);ja=R.vertexNormals;Z=g.vertexNormalsWorld;ea=0;for(va=ja.length;ea<va;ea++){qa=Z[ea]=Z[ea]||new THREE.Vector3;qa.copy(ja[ea]);aa.multiplyVector3(qa)}g.z=g.centroidScreen.z;g.meshMaterials=ya;g.faceMaterials=R.materials;g.overdraw=ha;if(ga.geometry.uvs[ca]){g.uvs[0]=ga.geometry.uvs[ca][0];g.uvs[1]=ga.geometry.uvs[ca][1];g.uvs[2]=ga.geometry.uvs[ca][2]}T.push(g);
+g.centroidWorld.copy(R.centroid);ta.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);ja=R.vertexNormals;W=g.vertexNormalsWorld;ea=0;for(va=ja.length;ea<va;ea++){qa=W[ea]=W[ea]||new THREE.Vector3;qa.copy(ja[ea]);aa.multiplyVector3(qa)}g.z=g.centroidScreen.z;g.meshMaterials=ya;g.faceMaterials=R.materials;g.overdraw=ha;if(ga.geometry.uvs[ca]){g.uvs[0]=ga.geometry.uvs[ca][0];g.uvs[1]=ga.geometry.uvs[ca][1];g.uvs[2]=ga.geometry.uvs[ca][2]}T.push(g);
 j++}}else if(R instanceof THREE.Face4){ea=na[R.a];va=na[R.b];ja=na[R.c];qa=na[R.d];if(ea.__visible&&va.__visible&&ja.__visible&&qa.__visible&&(ga.doubleSided||ga.flipSided!=((qa.positionScreen.x-ea.positionScreen.x)*(va.positionScreen.y-ea.positionScreen.y)-(qa.positionScreen.y-ea.positionScreen.y)*(va.positionScreen.x-ea.positionScreen.x)<0||(va.positionScreen.x-ja.positionScreen.x)*(qa.positionScreen.y-ja.positionScreen.y)-(va.positionScreen.y-ja.positionScreen.y)*(qa.positionScreen.x-ja.positionScreen.x)<
-0))){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ea.positionWorld);g.v2.positionWorld.copy(va.positionWorld);g.v3.positionWorld.copy(qa.positionWorld);g.v1.positionScreen.copy(ea.positionScreen);g.v2.positionScreen.copy(va.positionScreen);g.v3.positionScreen.copy(qa.positionScreen);g.normalWorld.copy(R.normal);aa.multiplyVector3(g.normalWorld);g.centroidWorld.copy(R.centroid);ta.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);w.multiplyVector3(g.centroidScreen);
+0))){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ea.positionWorld);g.v2.positionWorld.copy(va.positionWorld);g.v3.positionWorld.copy(qa.positionWorld);g.v1.positionScreen.copy(ea.positionScreen);g.v2.positionScreen.copy(va.positionScreen);g.v3.positionScreen.copy(qa.positionScreen);g.normalWorld.copy(R.normal);aa.multiplyVector3(g.normalWorld);g.centroidWorld.copy(R.centroid);ta.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);
 g.z=g.centroidScreen.z;g.meshMaterials=ya;g.faceMaterials=R.materials;g.overdraw=ha;if(ga.geometry.uvs[ca]){g.uvs[0]=ga.geometry.uvs[ca][0];g.uvs[1]=ga.geometry.uvs[ca][1];g.uvs[2]=ga.geometry.uvs[ca][3]}T.push(g);j++;h=k[j]=k[j]||new THREE.RenderableFace3;h.v1.positionWorld.copy(va.positionWorld);h.v2.positionWorld.copy(ja.positionWorld);h.v3.positionWorld.copy(qa.positionWorld);h.v1.positionScreen.copy(va.positionScreen);h.v2.positionScreen.copy(ja.positionScreen);h.v3.positionScreen.copy(qa.positionScreen);
-h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=ya;h.faceMaterials=R.materials;h.overdraw=ha;if(ga.geometry.uvs[ca]){h.uvs[0]=ga.geometry.uvs[ca][1];h.uvs[1]=ga.geometry.uvs[ca][2];h.uvs[2]=ga.geometry.uvs[ca][3]}T.push(h);j++}}}}else if(ga instanceof THREE.Line){F.multiply(w,ta);na=ga.geometry.vertices;R=na[0];R.positionScreen.copy(R.position);F.multiplyVector4(R.positionScreen);ca=1;for(xa=na.length;ca<
-xa;ca++){ea=na[ca];ea.positionScreen.copy(ea.position);F.multiplyVector4(ea.positionScreen);va=na[ca-1];N.copy(ea.positionScreen);L.copy(va.positionScreen);if(c(N,L)){N.multiplyScalar(1/N.w);L.multiplyScalar(1/L.w);l=v[o]=v[o]||new THREE.RenderableLine;l.v1.positionScreen.copy(N);l.v2.positionScreen.copy(L);l.z=Math.max(N.z,L.z);l.materials=ga.materials;T.push(l);o++}}}else if(ga instanceof THREE.Particle){D.set(ga.position.x,ga.position.y,ga.position.z,1);w.multiplyVector4(D);D.z/=D.w;if(D.z>0&&
-D.z<1){u=y[t]=y[t]||new THREE.RenderableParticle;u.x=D.x/D.w;u.y=D.y/D.w;u.z=D.z;u.rotation=ga.rotation.z;u.scale.x=ga.scale.x*Math.abs(u.x-(D.x+f.projectionMatrix.n11)/(D.w+f.projectionMatrix.n14));u.scale.y=ga.scale.y*Math.abs(u.y-(D.y+f.projectionMatrix.n22)/(D.w+f.projectionMatrix.n24));u.materials=ga.materials;T.push(u);t++}}}}V&&T.sort(a);return T};this.unprojectVector=function(M,f){var V=f.matrixWorld.clone();V.multiplySelf(THREE.Matrix4.makeInvert(f.projectionMatrix));V.multiplyVector3(M);
-return M}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,e,g;this.domElement=document.createElement("div");this.setSize=function(h,j){b=h;d=j;e=b/2;g=d/2};this.render=function(h,j){var k,l,o,v,u,t,y,A;a=c.projectScene(h,j);k=0;for(l=a.length;k<l;k++){u=a[k];if(u instanceof THREE.RenderableParticle){y=u.x*e+e;A=u.y*g+g;o=0;for(v=u.material.length;o<v;o++){t=u.material[o];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=y+"px";t.style.top=A+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(ka){if(u!=ka)l.globalAlpha=u=ka}function c(ka){if(t!=ka){switch(ka){case THREE.NormalBlending:l.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:l.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:l.globalCompositeOperation="darker"}t=ka}}var b=null,d=new THREE.Projector,e=document.createElement("canvas"),g,h,j,k,l=e.getContext("2d"),o=new THREE.Color(0),v=0,u=1,t=0,y=null,A=null,D=1,w,F,x,N,L,Z,M,f,V,T=new THREE.Color,
-da=new THREE.Color,fa=new THREE.Color,I=new THREE.Color,ca=new THREE.Color,xa,ea,va,ia,ga,ta,ya,ha,aa,ma=new THREE.Rectangle,na=new THREE.Rectangle,R=new THREE.Rectangle,ja=!1,qa=new THREE.Color,m=new THREE.Color,z=new THREE.Color,q=new THREE.Color,n=Math.PI*2,p=new THREE.Vector3,B,C,G,Q,H,O,la=16;B=document.createElement("canvas");B.width=B.height=2;C=B.getContext("2d");C.fillStyle="rgba(0,0,0,1)";C.fillRect(0,0,2,2);G=C.getImageData(0,0,2,2);Q=G.data;H=document.createElement("canvas");H.width=H.height=
-la;O=H.getContext("2d");O.translate(-la/2,-la/2);O.scale(la,la);la--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ka,ra){g=ka;h=ra;j=g/2;k=h/2;e.width=g;e.height=h;ma.set(-j,-k,j,k);u=1;t=0;A=y=null;D=1};this.setClearColor=function(ka,ra){o=ka;v=ra};this.setClearColorHex=function(ka,ra){o.setHex(ka);v=ra};this.clear=function(){l.setTransform(1,0,0,-1,j,k);if(!na.isEmpty()){na.inflate(1);na.minSelf(ma);if(o.hex==0&&v==0)l.clearRect(na.getX(),na.getY(),
-na.getWidth(),na.getHeight());else{c(THREE.NormalBlending);a(1);l.fillStyle="rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+v+")";l.fillRect(na.getX(),na.getY(),na.getWidth(),na.getHeight())}na.empty()}};this.render=function(ka,ra){function sa(J){var Y,U,K,S=J.lights;m.setRGB(0,0,0);z.setRGB(0,0,0);q.setRGB(0,0,0);J=0;for(Y=S.length;J<Y;J++){U=S[J];K=U.color;if(U instanceof THREE.AmbientLight){m.r+=K.r;m.g+=K.g;m.b+=K.b}else if(U instanceof THREE.DirectionalLight){z.r+=
-K.r;z.g+=K.g;z.b+=K.b}else if(U instanceof THREE.PointLight){q.r+=K.r;q.g+=K.g;q.b+=K.b}}}function oa(J,Y,U,K){var S,ua,wa,Ia,za=J.lights;J=0;for(S=za.length;J<S;J++){ua=za[J];wa=ua.color;Ia=ua.intensity;if(ua instanceof THREE.DirectionalLight){ua=U.dot(ua.position)*Ia;if(ua>0){K.r+=wa.r*ua;K.g+=wa.g*ua;K.b+=wa.b*ua}}else if(ua instanceof THREE.PointLight){p.sub(ua.position,Y);p.normalize();ua=U.dot(p)*Ia;if(ua>0){K.r+=wa.r*ua;K.g+=wa.g*ua;K.b+=wa.b*ua}}}}function pa(J,Y,U){if(U.opacity!=0){a(U.opacity);
-c(U.blending);var K,S,ua,wa,Ia,za;if(U instanceof THREE.ParticleBasicMaterial){if(U.map){wa=U.map.image;Ia=wa.width>>1;za=wa.height>>1;S=Y.scale.x*j;ua=Y.scale.y*k;U=S*Ia;K=ua*za;R.set(J.x-U,J.y-K,J.x+U,J.y+K);if(ma.instersects(R)){l.save();l.translate(J.x,J.y);l.rotate(-Y.rotation);l.scale(S,-ua);l.translate(-Ia,-za);l.drawImage(wa,0,0);l.restore()}}}else if(U instanceof THREE.ParticleCircleMaterial){if(ja){qa.r=m.r+z.r+q.r;qa.g=m.g+z.g+q.g;qa.b=m.b+z.b+q.b;T.r=U.color.r*qa.r;T.g=U.color.g*qa.g;
-T.b=U.color.b*qa.b;T.updateStyleString()}else T.__styleString=U.color.__styleString;U=Y.scale.x*j;K=Y.scale.y*k;R.set(J.x-U,J.y-K,J.x+U,J.y+K);if(ma.instersects(R)){S=T.__styleString;if(A!=S)l.fillStyle=A=S;l.save();l.translate(J.x,J.y);l.rotate(-Y.rotation);l.scale(U,K);l.beginPath();l.arc(0,0,1,0,n,!0);l.closePath();l.fill();l.restore()}}}}function Ja(J,Y,U,K){if(K.opacity!=0){a(K.opacity);c(K.blending);l.beginPath();l.moveTo(J.positionScreen.x,J.positionScreen.y);l.lineTo(Y.positionScreen.x,Y.positionScreen.y);
-l.closePath();if(K instanceof THREE.LineBasicMaterial){T.__styleString=K.color.__styleString;J=K.linewidth;if(D!=J)l.lineWidth=D=J;J=T.__styleString;if(y!=J)l.strokeStyle=y=J;l.stroke();R.inflate(K.linewidth*2)}}}function P(J,Y,U,K,S,ua){if(S.opacity!=0){a(S.opacity);c(S.blending);N=J.positionScreen.x;L=J.positionScreen.y;Z=Y.positionScreen.x;M=Y.positionScreen.y;f=U.positionScreen.x;V=U.positionScreen.y;l.beginPath();l.moveTo(N,L);l.lineTo(Z,M);l.lineTo(f,V);l.lineTo(N,L);l.closePath();if(S instanceof
-THREE.MeshBasicMaterial)if(S.map)S.map.mapping instanceof THREE.UVMapping&&Fa(N,L,Z,M,f,V,S.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v);else if(S.envMap){if(S.envMap.mapping instanceof THREE.SphericalReflectionMapping){J=ra.matrixWorldInverse;p.copy(K.vertexNormalsWorld[0]);ia=(p.x*J.n11+p.y*J.n12+p.z*J.n13)*0.5+0.5;ga=-(p.x*J.n21+p.y*J.n22+p.z*J.n23)*0.5+0.5;p.copy(K.vertexNormalsWorld[1]);ta=(p.x*J.n11+p.y*J.n12+p.z*J.n13)*0.5+0.5;ya=-(p.x*J.n21+p.y*J.n22+p.z*J.n23)*
-0.5+0.5;p.copy(K.vertexNormalsWorld[2]);ha=(p.x*J.n11+p.y*J.n12+p.z*J.n13)*0.5+0.5;aa=-(p.x*J.n21+p.y*J.n22+p.z*J.n23)*0.5+0.5;Fa(N,L,Z,M,f,V,S.envMap.image,ia,ga,ta,ya,ha,aa)}}else S.wireframe?Ga(S.color.__styleString,S.wireframeLinewidth):Ea(S.color.__styleString);else if(S instanceof THREE.MeshLambertMaterial){if(S.map&&!S.wireframe){S.map.mapping instanceof THREE.UVMapping&&Fa(N,L,Z,M,f,V,S.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v);c(THREE.SubtractiveBlending)}if(ja)if(!S.wireframe&&
-S.shading==THREE.SmoothShading&&K.vertexNormalsWorld.length==3){da.r=fa.r=I.r=m.r;da.g=fa.g=I.g=m.g;da.b=fa.b=I.b=m.b;oa(ua,K.v1.positionWorld,K.vertexNormalsWorld[0],da);oa(ua,K.v2.positionWorld,K.vertexNormalsWorld[1],fa);oa(ua,K.v3.positionWorld,K.vertexNormalsWorld[2],I);ca.r=(fa.r+I.r)*0.5;ca.g=(fa.g+I.g)*0.5;ca.b=(fa.b+I.b)*0.5;va=W(da,fa,I,ca);Fa(N,L,Z,M,f,V,va,0,0,1,0,0,1)}else{qa.r=m.r;qa.g=m.g;qa.b=m.b;oa(ua,K.centroidWorld,K.normalWorld,qa);T.r=S.color.r*qa.r;T.g=S.color.g*qa.g;T.b=S.color.b*
-qa.b;T.updateStyleString();S.wireframe?Ga(T.__styleString,S.wireframeLinewidth):Ea(T.__styleString)}else S.wireframe?Ga(S.color.__styleString,S.wireframeLinewidth):Ea(S.color.__styleString)}else if(S instanceof THREE.MeshDepthMaterial){xa=ra.near;ea=ra.far;da.r=da.g=da.b=1-X(J.positionScreen.z,xa,ea);fa.r=fa.g=fa.b=1-X(Y.positionScreen.z,xa,ea);I.r=I.g=I.b=1-X(U.positionScreen.z,xa,ea);ca.r=(fa.r+I.r)*0.5;ca.g=(fa.g+I.g)*0.5;ca.b=(fa.b+I.b)*0.5;va=W(da,fa,I,ca);Fa(N,L,Z,M,f,V,va,0,0,1,0,0,1)}else if(S instanceof
-THREE.MeshNormalMaterial){T.r=$(K.normalWorld.x);T.g=$(K.normalWorld.y);T.b=$(K.normalWorld.z);T.updateStyleString();S.wireframe?Ga(T.__styleString,S.wireframeLinewidth):Ea(T.__styleString)}}}function Ga(J,Y){if(y!=J)l.strokeStyle=y=J;if(D!=Y)l.lineWidth=D=Y;l.stroke();R.inflate(Y*2)}function Ea(J){if(A!=J)l.fillStyle=A=J;l.fill()}function Fa(J,Y,U,K,S,ua,wa,Ia,za,Pa,Ka,La,Ta){var Na,Qa;Na=wa.width-1;Qa=wa.height-1;Ia*=Na;za*=Qa;Pa*=Na;Ka*=Qa;La*=Na;Ta*=Qa;U-=J;K-=Y;S-=J;ua-=Y;Pa-=Ia;Ka-=za;La-=Ia;
-Ta-=za;Na=Pa*Ta-La*Ka;if(Na!=0){Qa=1/Na;Na=(Ta*U-Ka*S)*Qa;Ka=(Ta*K-Ka*ua)*Qa;U=(Pa*S-La*U)*Qa;K=(Pa*ua-La*K)*Qa;J=J-Na*Ia-U*za;Y=Y-Ka*Ia-K*za;l.save();l.transform(Na,Ka,U,K,J,Y);l.clip();l.drawImage(wa,0,0);l.restore()}}function W(J,Y,U,K){var S=~~(J.r*255),ua=~~(J.g*255);J=~~(J.b*255);var wa=~~(Y.r*255),Ia=~~(Y.g*255);Y=~~(Y.b*255);var za=~~(U.r*255),Pa=~~(U.g*255);U=~~(U.b*255);var Ka=~~(K.r*255),La=~~(K.g*255);K=~~(K.b*255);Q[0]=S<0?0:S>255?255:S;Q[1]=ua<0?0:ua>255?255:ua;Q[2]=J<0?0:J>255?255:
-J;Q[4]=wa<0?0:wa>255?255:wa;Q[5]=Ia<0?0:Ia>255?255:Ia;Q[6]=Y<0?0:Y>255?255:Y;Q[8]=za<0?0:za>255?255:za;Q[9]=Pa<0?0:Pa>255?255:Pa;Q[10]=U<0?0:U>255?255:U;Q[12]=Ka<0?0:Ka>255?255:Ka;Q[13]=La<0?0:La>255?255:La;Q[14]=K<0?0:K>255?255:K;C.putImageData(G,0,0);O.drawImage(B,0,0);return H}function X(J,Y,U){J=(J-Y)/(U-Y);return J*J*(3-2*J)}function $(J){J=(J+1)*0.5;return J<0?0:J>1?1:J}function Aa(J,Y){var U=Y.x-J.x,K=Y.y-J.y,S=1/Math.sqrt(U*U+K*K);U*=S;K*=S;Y.x+=U;Y.y+=K;J.x-=U;J.y-=K}var Ha,Da,E,Ca,Ra,Ua,
-Ma,Ba;this.autoClear?this.clear():l.setTransform(1,0,0,-1,j,k);b=d.projectScene(ka,ra,this.sortElements);(ja=ka.lights.length>0)&&sa(ka);Ha=0;for(Da=b.length;Ha<Da;Ha++){E=b[Ha];R.empty();if(E instanceof THREE.RenderableParticle){w=E;w.x*=j;w.y*=k;Ca=0;for(Ra=E.materials.length;Ca<Ra;Ca++)pa(w,E,E.materials[Ca],ka)}else if(E instanceof THREE.RenderableLine){w=E.v1;F=E.v2;w.positionScreen.x*=j;w.positionScreen.y*=k;F.positionScreen.x*=j;F.positionScreen.y*=k;R.addPoint(w.positionScreen.x,w.positionScreen.y);
-R.addPoint(F.positionScreen.x,F.positionScreen.y);if(ma.instersects(R)){Ca=0;for(Ra=E.materials.length;Ca<Ra;)Ja(w,F,E,E.materials[Ca++],ka)}}else if(E instanceof THREE.RenderableFace3){w=E.v1;F=E.v2;x=E.v3;w.positionScreen.x*=j;w.positionScreen.y*=k;F.positionScreen.x*=j;F.positionScreen.y*=k;x.positionScreen.x*=j;x.positionScreen.y*=k;if(E.overdraw){Aa(w.positionScreen,F.positionScreen);Aa(F.positionScreen,x.positionScreen);Aa(x.positionScreen,w.positionScreen)}R.add3Points(w.positionScreen.x,w.positionScreen.y,
-F.positionScreen.x,F.positionScreen.y,x.positionScreen.x,x.positionScreen.y);if(ma.instersects(R)){Ca=0;for(Ra=E.meshMaterials.length;Ca<Ra;){Ba=E.meshMaterials[Ca++];if(Ba instanceof THREE.MeshFaceMaterial){Ua=0;for(Ma=E.faceMaterials.length;Ua<Ma;)(Ba=E.faceMaterials[Ua++])&&P(w,F,x,E,Ba,ka)}else P(w,F,x,E,Ba,ka)}}}na.addRectangle(R)}l.setTransform(1,0,0,1,0,0)}};
+h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=ya;h.faceMaterials=R.materials;h.overdraw=ha;if(ga.geometry.uvs[ca]){h.uvs[0]=ga.geometry.uvs[ca][1];h.uvs[1]=ga.geometry.uvs[ca][2];h.uvs[2]=ga.geometry.uvs[ca][3]}T.push(h);j++}}}}else if(ga instanceof THREE.Line){D.multiply(v,ta);na=ga.geometry.vertices;R=na[0];R.positionScreen.copy(R.position);D.multiplyVector4(R.positionScreen);ca=1;for(xa=na.length;ca<
+xa;ca++){ea=na[ca];ea.positionScreen.copy(ea.position);D.multiplyVector4(ea.positionScreen);va=na[ca-1];N.copy(ea.positionScreen);M.copy(va.positionScreen);if(c(N,M)){N.multiplyScalar(1/N.w);M.multiplyScalar(1/M.w);n=x[p]=x[p]||new THREE.RenderableLine;n.v1.positionScreen.copy(N);n.v2.positionScreen.copy(M);n.z=Math.max(N.z,M.z);n.materials=ga.materials;T.push(n);p++}}}else if(ga instanceof THREE.Particle){F.set(ga.position.x,ga.position.y,ga.position.z,1);v.multiplyVector4(F);F.z/=F.w;if(F.z>0&&
+F.z<1){u=y[q]=y[q]||new THREE.RenderableParticle;u.x=F.x/F.w;u.y=F.y/F.w;u.z=F.z;u.rotation=ga.rotation.z;u.scale.x=ga.scale.x*Math.abs(u.x-(F.x+f.projectionMatrix.n11)/(F.w+f.projectionMatrix.n14));u.scale.y=ga.scale.y*Math.abs(u.y-(F.y+f.projectionMatrix.n22)/(F.w+f.projectionMatrix.n24));u.materials=ga.materials;T.push(u);q++}}}}V&&T.sort(a);return T};this.unprojectVector=function(K,f){var V=f.matrixWorld.clone();V.multiplySelf(THREE.Matrix4.makeInvert(f.projectionMatrix));V.multiplyVector3(K);
+return K}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,e,g;this.domElement=document.createElement("div");this.setSize=function(h,j){b=h;d=j;e=b/2;g=d/2};this.render=function(h,j){var k,n,p,x,u,q,y,A;a=c.projectScene(h,j);k=0;for(n=a.length;k<n;k++){u=a[k];if(u instanceof THREE.RenderableParticle){y=u.x*e+e;A=u.y*g+g;p=0;for(x=u.material.length;p<x;p++){q=u.material[p];if(q instanceof THREE.ParticleDOMMaterial){q=q.domElement;q.style.left=y+"px";q.style.top=A+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(ka){if(u!=ka)n.globalAlpha=u=ka}function c(ka){if(q!=ka){switch(ka){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}q=ka}}var b=null,d=new THREE.Projector,e=document.createElement("canvas"),g,h,j,k,n=e.getContext("2d"),p=new THREE.Color(0),x=0,u=1,q=0,y=null,A=null,F=1,v,D,w,N,M,W,K,f,V,T=new THREE.Color,
+da=new THREE.Color,fa=new THREE.Color,I=new THREE.Color,ca=new THREE.Color,xa,ea,va,ia,ga,ta,ya,ha,aa,ma=new THREE.Rectangle,na=new THREE.Rectangle,R=new THREE.Rectangle,ja=!1,qa=new THREE.Color,l=new THREE.Color,z=new THREE.Color,t=new THREE.Color,m=Math.PI*2,o=new THREE.Vector3,B,C,G,Q,H,O,la=16;B=document.createElement("canvas");B.width=B.height=2;C=B.getContext("2d");C.fillStyle="rgba(0,0,0,1)";C.fillRect(0,0,2,2);G=C.getImageData(0,0,2,2);Q=G.data;H=document.createElement("canvas");H.width=H.height=
+la;O=H.getContext("2d");O.translate(-la/2,-la/2);O.scale(la,la);la--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ka,ra){g=ka;h=ra;j=g/2;k=h/2;e.width=g;e.height=h;ma.set(-j,-k,j,k);u=1;q=0;A=y=null;F=1};this.setClearColor=function(ka,ra){p=ka;x=ra};this.setClearColorHex=function(ka,ra){p.setHex(ka);x=ra};this.clear=function(){n.setTransform(1,0,0,-1,j,k);if(!na.isEmpty()){na.inflate(1);na.minSelf(ma);if(p.hex==0&&x==0)n.clearRect(na.getX(),na.getY(),
+na.getWidth(),na.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+x+")";n.fillRect(na.getX(),na.getY(),na.getWidth(),na.getHeight())}na.empty()}};this.render=function(ka,ra){function sa(J){var Z,U,L,S=J.lights;l.setRGB(0,0,0);z.setRGB(0,0,0);t.setRGB(0,0,0);J=0;for(Z=S.length;J<Z;J++){U=S[J];L=U.color;if(U instanceof THREE.AmbientLight){l.r+=L.r;l.g+=L.g;l.b+=L.b}else if(U instanceof THREE.DirectionalLight){z.r+=
+L.r;z.g+=L.g;z.b+=L.b}else if(U instanceof THREE.PointLight){t.r+=L.r;t.g+=L.g;t.b+=L.b}}}function oa(J,Z,U,L){var S,ua,wa,Ia,za=J.lights;J=0;for(S=za.length;J<S;J++){ua=za[J];wa=ua.color;Ia=ua.intensity;if(ua instanceof THREE.DirectionalLight){ua=U.dot(ua.position)*Ia;if(ua>0){L.r+=wa.r*ua;L.g+=wa.g*ua;L.b+=wa.b*ua}}else if(ua instanceof THREE.PointLight){o.sub(ua.position,Z);o.normalize();ua=U.dot(o)*Ia;if(ua>0){L.r+=wa.r*ua;L.g+=wa.g*ua;L.b+=wa.b*ua}}}}function pa(J,Z,U){if(U.opacity!=0){a(U.opacity);
+c(U.blending);var L,S,ua,wa,Ia,za;if(U instanceof THREE.ParticleBasicMaterial){if(U.map){wa=U.map.image;Ia=wa.width>>1;za=wa.height>>1;S=Z.scale.x*j;ua=Z.scale.y*k;U=S*Ia;L=ua*za;R.set(J.x-U,J.y-L,J.x+U,J.y+L);if(ma.instersects(R)){n.save();n.translate(J.x,J.y);n.rotate(-Z.rotation);n.scale(S,-ua);n.translate(-Ia,-za);n.drawImage(wa,0,0);n.restore()}}}else if(U instanceof THREE.ParticleCircleMaterial){if(ja){qa.r=l.r+z.r+t.r;qa.g=l.g+z.g+t.g;qa.b=l.b+z.b+t.b;T.r=U.color.r*qa.r;T.g=U.color.g*qa.g;
+T.b=U.color.b*qa.b;T.updateStyleString()}else T.__styleString=U.color.__styleString;U=Z.scale.x*j;L=Z.scale.y*k;R.set(J.x-U,J.y-L,J.x+U,J.y+L);if(ma.instersects(R)){S=T.__styleString;if(A!=S)n.fillStyle=A=S;n.save();n.translate(J.x,J.y);n.rotate(-Z.rotation);n.scale(U,L);n.beginPath();n.arc(0,0,1,0,m,!0);n.closePath();n.fill();n.restore()}}}}function Ja(J,Z,U,L){if(L.opacity!=0){a(L.opacity);c(L.blending);n.beginPath();n.moveTo(J.positionScreen.x,J.positionScreen.y);n.lineTo(Z.positionScreen.x,Z.positionScreen.y);
+n.closePath();if(L instanceof THREE.LineBasicMaterial){T.__styleString=L.color.__styleString;J=L.linewidth;if(F!=J)n.lineWidth=F=J;J=T.__styleString;if(y!=J)n.strokeStyle=y=J;n.stroke();R.inflate(L.linewidth*2)}}}function P(J,Z,U,L,S,ua){if(S.opacity!=0){a(S.opacity);c(S.blending);N=J.positionScreen.x;M=J.positionScreen.y;W=Z.positionScreen.x;K=Z.positionScreen.y;f=U.positionScreen.x;V=U.positionScreen.y;n.beginPath();n.moveTo(N,M);n.lineTo(W,K);n.lineTo(f,V);n.lineTo(N,M);n.closePath();if(S instanceof
+THREE.MeshBasicMaterial)if(S.map)S.map.mapping instanceof THREE.UVMapping&&Fa(N,M,W,K,f,V,S.map.image,L.uvs[0].u,L.uvs[0].v,L.uvs[1].u,L.uvs[1].v,L.uvs[2].u,L.uvs[2].v);else if(S.envMap){if(S.envMap.mapping instanceof THREE.SphericalReflectionMapping){J=ra.matrixWorldInverse;o.copy(L.vertexNormalsWorld[0]);ia=(o.x*J.n11+o.y*J.n12+o.z*J.n13)*0.5+0.5;ga=-(o.x*J.n21+o.y*J.n22+o.z*J.n23)*0.5+0.5;o.copy(L.vertexNormalsWorld[1]);ta=(o.x*J.n11+o.y*J.n12+o.z*J.n13)*0.5+0.5;ya=-(o.x*J.n21+o.y*J.n22+o.z*J.n23)*
+0.5+0.5;o.copy(L.vertexNormalsWorld[2]);ha=(o.x*J.n11+o.y*J.n12+o.z*J.n13)*0.5+0.5;aa=-(o.x*J.n21+o.y*J.n22+o.z*J.n23)*0.5+0.5;Fa(N,M,W,K,f,V,S.envMap.image,ia,ga,ta,ya,ha,aa)}}else S.wireframe?Ga(S.color.__styleString,S.wireframeLinewidth):Ea(S.color.__styleString);else if(S instanceof THREE.MeshLambertMaterial){if(S.map&&!S.wireframe){S.map.mapping instanceof THREE.UVMapping&&Fa(N,M,W,K,f,V,S.map.image,L.uvs[0].u,L.uvs[0].v,L.uvs[1].u,L.uvs[1].v,L.uvs[2].u,L.uvs[2].v);c(THREE.SubtractiveBlending)}if(ja)if(!S.wireframe&&
+S.shading==THREE.SmoothShading&&L.vertexNormalsWorld.length==3){da.r=fa.r=I.r=l.r;da.g=fa.g=I.g=l.g;da.b=fa.b=I.b=l.b;oa(ua,L.v1.positionWorld,L.vertexNormalsWorld[0],da);oa(ua,L.v2.positionWorld,L.vertexNormalsWorld[1],fa);oa(ua,L.v3.positionWorld,L.vertexNormalsWorld[2],I);ca.r=(fa.r+I.r)*0.5;ca.g=(fa.g+I.g)*0.5;ca.b=(fa.b+I.b)*0.5;va=X(da,fa,I,ca);Fa(N,M,W,K,f,V,va,0,0,1,0,0,1)}else{qa.r=l.r;qa.g=l.g;qa.b=l.b;oa(ua,L.centroidWorld,L.normalWorld,qa);T.r=S.color.r*qa.r;T.g=S.color.g*qa.g;T.b=S.color.b*
+qa.b;T.updateStyleString();S.wireframe?Ga(T.__styleString,S.wireframeLinewidth):Ea(T.__styleString)}else S.wireframe?Ga(S.color.__styleString,S.wireframeLinewidth):Ea(S.color.__styleString)}else if(S instanceof THREE.MeshDepthMaterial){xa=ra.near;ea=ra.far;da.r=da.g=da.b=1-Y(J.positionScreen.z,xa,ea);fa.r=fa.g=fa.b=1-Y(Z.positionScreen.z,xa,ea);I.r=I.g=I.b=1-Y(U.positionScreen.z,xa,ea);ca.r=(fa.r+I.r)*0.5;ca.g=(fa.g+I.g)*0.5;ca.b=(fa.b+I.b)*0.5;va=X(da,fa,I,ca);Fa(N,M,W,K,f,V,va,0,0,1,0,0,1)}else if(S instanceof
+THREE.MeshNormalMaterial){T.r=$(L.normalWorld.x);T.g=$(L.normalWorld.y);T.b=$(L.normalWorld.z);T.updateStyleString();S.wireframe?Ga(T.__styleString,S.wireframeLinewidth):Ea(T.__styleString)}}}function Ga(J,Z){if(y!=J)n.strokeStyle=y=J;if(F!=Z)n.lineWidth=F=Z;n.stroke();R.inflate(Z*2)}function Ea(J){if(A!=J)n.fillStyle=A=J;n.fill()}function Fa(J,Z,U,L,S,ua,wa,Ia,za,Pa,Ka,La,Ta){var Na,Qa;Na=wa.width-1;Qa=wa.height-1;Ia*=Na;za*=Qa;Pa*=Na;Ka*=Qa;La*=Na;Ta*=Qa;U-=J;L-=Z;S-=J;ua-=Z;Pa-=Ia;Ka-=za;La-=Ia;
+Ta-=za;Na=Pa*Ta-La*Ka;if(Na!=0){Qa=1/Na;Na=(Ta*U-Ka*S)*Qa;Ka=(Ta*L-Ka*ua)*Qa;U=(Pa*S-La*U)*Qa;L=(Pa*ua-La*L)*Qa;J=J-Na*Ia-U*za;Z=Z-Ka*Ia-L*za;n.save();n.transform(Na,Ka,U,L,J,Z);n.clip();n.drawImage(wa,0,0);n.restore()}}function X(J,Z,U,L){var S=~~(J.r*255),ua=~~(J.g*255);J=~~(J.b*255);var wa=~~(Z.r*255),Ia=~~(Z.g*255);Z=~~(Z.b*255);var za=~~(U.r*255),Pa=~~(U.g*255);U=~~(U.b*255);var Ka=~~(L.r*255),La=~~(L.g*255);L=~~(L.b*255);Q[0]=S<0?0:S>255?255:S;Q[1]=ua<0?0:ua>255?255:ua;Q[2]=J<0?0:J>255?255:
+J;Q[4]=wa<0?0:wa>255?255:wa;Q[5]=Ia<0?0:Ia>255?255:Ia;Q[6]=Z<0?0:Z>255?255:Z;Q[8]=za<0?0:za>255?255:za;Q[9]=Pa<0?0:Pa>255?255:Pa;Q[10]=U<0?0:U>255?255:U;Q[12]=Ka<0?0:Ka>255?255:Ka;Q[13]=La<0?0:La>255?255:La;Q[14]=L<0?0:L>255?255:L;C.putImageData(G,0,0);O.drawImage(B,0,0);return H}function Y(J,Z,U){J=(J-Z)/(U-Z);return J*J*(3-2*J)}function $(J){J=(J+1)*0.5;return J<0?0:J>1?1:J}function Aa(J,Z){var U=Z.x-J.x,L=Z.y-J.y,S=1/Math.sqrt(U*U+L*L);U*=S;L*=S;Z.x+=U;Z.y+=L;J.x-=U;J.y-=L}var Ha,Da,E,Ca,Ra,Ua,
+Ma,Ba;this.autoClear?this.clear():n.setTransform(1,0,0,-1,j,k);b=d.projectScene(ka,ra,this.sortElements);(ja=ka.lights.length>0)&&sa(ka);Ha=0;for(Da=b.length;Ha<Da;Ha++){E=b[Ha];R.empty();if(E instanceof THREE.RenderableParticle){v=E;v.x*=j;v.y*=k;Ca=0;for(Ra=E.materials.length;Ca<Ra;Ca++)pa(v,E,E.materials[Ca],ka)}else if(E instanceof THREE.RenderableLine){v=E.v1;D=E.v2;v.positionScreen.x*=j;v.positionScreen.y*=k;D.positionScreen.x*=j;D.positionScreen.y*=k;R.addPoint(v.positionScreen.x,v.positionScreen.y);
+R.addPoint(D.positionScreen.x,D.positionScreen.y);if(ma.instersects(R)){Ca=0;for(Ra=E.materials.length;Ca<Ra;)Ja(v,D,E,E.materials[Ca++],ka)}}else if(E instanceof THREE.RenderableFace3){v=E.v1;D=E.v2;w=E.v3;v.positionScreen.x*=j;v.positionScreen.y*=k;D.positionScreen.x*=j;D.positionScreen.y*=k;w.positionScreen.x*=j;w.positionScreen.y*=k;if(E.overdraw){Aa(v.positionScreen,D.positionScreen);Aa(D.positionScreen,w.positionScreen);Aa(w.positionScreen,v.positionScreen)}R.add3Points(v.positionScreen.x,v.positionScreen.y,
+D.positionScreen.x,D.positionScreen.y,w.positionScreen.x,w.positionScreen.y);if(ma.instersects(R)){Ca=0;for(Ra=E.meshMaterials.length;Ca<Ra;){Ba=E.meshMaterials[Ca++];if(Ba instanceof THREE.MeshFaceMaterial){Ua=0;for(Ma=E.faceMaterials.length;Ua<Ma;)(Ba=E.faceMaterials[Ua++])&&P(v,D,w,E,Ba,ka)}else P(v,D,w,E,Ba,ka)}}}na.addRectangle(R)}n.setTransform(1,0,0,1,0,0)}};
 THREE.SVGRenderer=function(){function a(ia,ga,ta){var ya,ha,aa,ma;ya=0;for(ha=ia.lights.length;ya<ha;ya++){aa=ia.lights[ya];if(aa instanceof THREE.DirectionalLight){ma=ga.normalWorld.dot(aa.position)*aa.intensity;if(ma>0){ta.r+=aa.color.r*ma;ta.g+=aa.color.g*ma;ta.b+=aa.color.b*ma}}else if(aa instanceof THREE.PointLight){V.sub(aa.position,ga.centroidWorld);V.normalize();ma=ga.normalWorld.dot(V)*aa.intensity;if(ma>0){ta.r+=aa.color.r*ma;ta.g+=aa.color.g*ma;ta.b+=aa.color.b*ma}}}}function c(ia,ga,ta,
-ya,ha,aa){I=d(ca++);I.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+"z");if(ha instanceof THREE.MeshBasicMaterial)x.__styleString=ha.color.__styleString;else if(ha instanceof THREE.MeshLambertMaterial)if(F){N.r=L.r;N.g=L.g;N.b=L.b;a(aa,ya,N);x.r=ha.color.r*N.r;x.g=ha.color.g*N.g;x.b=ha.color.b*N.b;x.updateStyleString()}else x.__styleString=ha.color.__styleString;else if(ha instanceof
-THREE.MeshDepthMaterial){f=1-ha.__2near/(ha.__farPlusNear-ya.z*ha.__farMinusNear);x.setRGB(f,f,f)}else ha instanceof THREE.MeshNormalMaterial&&x.setRGB(e(ya.normalWorld.x),e(ya.normalWorld.y),e(ya.normalWorld.z));ha.wireframe?I.setAttribute("style","fill: none; stroke: "+x.__styleString+"; stroke-width: "+ha.wireframeLinewidth+"; stroke-opacity: "+ha.opacity+"; stroke-linecap: "+ha.wireframeLinecap+"; stroke-linejoin: "+ha.wireframeLinejoin):I.setAttribute("style","fill: "+x.__styleString+"; fill-opacity: "+
-ha.opacity);j.appendChild(I)}function b(ia,ga,ta,ya,ha,aa,ma){I=d(ca++);I.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+" L "+ya.positionScreen.x+","+ya.positionScreen.y+"z");if(aa instanceof THREE.MeshBasicMaterial)x.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshLambertMaterial)if(F){N.r=L.r;N.g=L.g;N.b=L.b;a(ma,ha,N);x.r=aa.color.r*N.r;x.g=aa.color.g*N.g;
-x.b=aa.color.b*N.b;x.updateStyleString()}else x.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshDepthMaterial){f=1-aa.__2near/(aa.__farPlusNear-ha.z*aa.__farMinusNear);x.setRGB(f,f,f)}else aa instanceof THREE.MeshNormalMaterial&&x.setRGB(e(ha.normalWorld.x),e(ha.normalWorld.y),e(ha.normalWorld.z));aa.wireframe?I.setAttribute("style","fill: none; stroke: "+x.__styleString+"; stroke-width: "+aa.wireframeLinewidth+"; stroke-opacity: "+aa.opacity+"; stroke-linecap: "+aa.wireframeLinecap+
-"; stroke-linejoin: "+aa.wireframeLinejoin):I.setAttribute("style","fill: "+x.__styleString+"; fill-opacity: "+aa.opacity);j.appendChild(I)}function d(ia){if(T[ia]==null){T[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");va==0&&T[ia].setAttribute("shape-rendering","crispEdges")}return T[ia]}function e(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,o,v,u,t,y,A,D=
-new THREE.Rectangle,w=new THREE.Rectangle,F=!1,x=new THREE.Color(16777215),N=new THREE.Color(16777215),L=new THREE.Color(0),Z=new THREE.Color(0),M=new THREE.Color(0),f,V=new THREE.Vector3,T=[],da=[],fa=[],I,ca,xa,ea,va=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":va=1;break;case "low":va=0}};this.setSize=function(ia,ga){k=ia;l=ga;o=k/2;v=l/2;j.setAttribute("viewBox",-o+" "+-v+" "+k+" "+l);j.setAttribute("width",
-k);j.setAttribute("height",l);D.set(-o,-v,o,v)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(ia,ga){var ta,ya,ha,aa,ma,na,R,ja;this.autoClear&&this.clear();g=h.projectScene(ia,ga,this.sortElements);ea=xa=ca=0;if(F=ia.lights.length>0){R=ia.lights;L.setRGB(0,0,0);Z.setRGB(0,0,0);M.setRGB(0,0,0);ta=0;for(ya=R.length;ta<ya;ta++){ha=R[ta];aa=ha.color;if(ha instanceof THREE.AmbientLight){L.r+=aa.r;L.g+=aa.g;L.b+=aa.b}else if(ha instanceof THREE.DirectionalLight){Z.r+=
-aa.r;Z.g+=aa.g;Z.b+=aa.b}else if(ha instanceof THREE.PointLight){M.r+=aa.r;M.g+=aa.g;M.b+=aa.b}}}ta=0;for(ya=g.length;ta<ya;ta++){R=g[ta];w.empty();if(R instanceof THREE.RenderableParticle){u=R;u.x*=o;u.y*=-v;ha=0;for(aa=R.materials.length;ha<aa;ha++)if(ja=R.materials[ha]){ma=u;na=R;var qa=xa++;if(da[qa]==null){da[qa]=document.createElementNS("http://www.w3.org/2000/svg","circle");va==0&&da[qa].setAttribute("shape-rendering","crispEdges")}I=da[qa];I.setAttribute("cx",ma.x);I.setAttribute("cy",ma.y);
-I.setAttribute("r",na.scale.x*o);if(ja instanceof THREE.ParticleCircleMaterial){if(F){N.r=L.r+Z.r+M.r;N.g=L.g+Z.g+M.g;N.b=L.b+Z.b+M.b;x.r=ja.color.r*N.r;x.g=ja.color.g*N.g;x.b=ja.color.b*N.b;x.updateStyleString()}else x=ja.color;I.setAttribute("style","fill: "+x.__styleString)}j.appendChild(I)}}else if(R instanceof THREE.RenderableLine){u=R.v1;t=R.v2;u.positionScreen.x*=o;u.positionScreen.y*=-v;t.positionScreen.x*=o;t.positionScreen.y*=-v;w.addPoint(u.positionScreen.x,u.positionScreen.y);w.addPoint(t.positionScreen.x,
-t.positionScreen.y);if(D.instersects(w)){ha=0;for(aa=R.materials.length;ha<aa;)if(ja=R.materials[ha++]){ma=u;na=t;qa=ea++;if(fa[qa]==null){fa[qa]=document.createElementNS("http://www.w3.org/2000/svg","line");va==0&&fa[qa].setAttribute("shape-rendering","crispEdges")}I=fa[qa];I.setAttribute("x1",ma.positionScreen.x);I.setAttribute("y1",ma.positionScreen.y);I.setAttribute("x2",na.positionScreen.x);I.setAttribute("y2",na.positionScreen.y);if(ja instanceof THREE.LineBasicMaterial){x.__styleString=ja.color.__styleString;
-I.setAttribute("style","fill: none; stroke: "+x.__styleString+"; stroke-width: "+ja.linewidth+"; stroke-opacity: "+ja.opacity+"; stroke-linecap: "+ja.linecap+"; stroke-linejoin: "+ja.linejoin);j.appendChild(I)}}}}else if(R instanceof THREE.RenderableFace3){u=R.v1;t=R.v2;y=R.v3;u.positionScreen.x*=o;u.positionScreen.y*=-v;t.positionScreen.x*=o;t.positionScreen.y*=-v;y.positionScreen.x*=o;y.positionScreen.y*=-v;w.addPoint(u.positionScreen.x,u.positionScreen.y);w.addPoint(t.positionScreen.x,t.positionScreen.y);
-w.addPoint(y.positionScreen.x,y.positionScreen.y);if(D.instersects(w)){ha=0;for(aa=R.meshMaterials.length;ha<aa;){ja=R.meshMaterials[ha++];if(ja instanceof THREE.MeshFaceMaterial){ma=0;for(na=R.faceMaterials.length;ma<na;)(ja=R.faceMaterials[ma++])&&c(u,t,y,R,ja,ia)}else ja&&c(u,t,y,R,ja,ia)}}}else if(R instanceof THREE.RenderableFace4){u=R.v1;t=R.v2;y=R.v3;A=R.v4;u.positionScreen.x*=o;u.positionScreen.y*=-v;t.positionScreen.x*=o;t.positionScreen.y*=-v;y.positionScreen.x*=o;y.positionScreen.y*=-v;
-A.positionScreen.x*=o;A.positionScreen.y*=-v;w.addPoint(u.positionScreen.x,u.positionScreen.y);w.addPoint(t.positionScreen.x,t.positionScreen.y);w.addPoint(y.positionScreen.x,y.positionScreen.y);w.addPoint(A.positionScreen.x,A.positionScreen.y);if(D.instersects(w)){ha=0;for(aa=R.meshMaterials.length;ha<aa;){ja=R.meshMaterials[ha++];if(ja instanceof THREE.MeshFaceMaterial){ma=0;for(na=R.faceMaterials.length;ma<na;)(ja=R.faceMaterials[ma++])&&b(u,t,y,A,R,ja,ia)}else ja&&b(u,t,y,A,R,ja,ia)}}}}}};
+ya,ha,aa){I=d(ca++);I.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+"z");if(ha instanceof THREE.MeshBasicMaterial)w.__styleString=ha.color.__styleString;else if(ha instanceof THREE.MeshLambertMaterial)if(D){N.r=M.r;N.g=M.g;N.b=M.b;a(aa,ya,N);w.r=ha.color.r*N.r;w.g=ha.color.g*N.g;w.b=ha.color.b*N.b;w.updateStyleString()}else w.__styleString=ha.color.__styleString;else if(ha instanceof
+THREE.MeshDepthMaterial){f=1-ha.__2near/(ha.__farPlusNear-ya.z*ha.__farMinusNear);w.setRGB(f,f,f)}else ha instanceof THREE.MeshNormalMaterial&&w.setRGB(e(ya.normalWorld.x),e(ya.normalWorld.y),e(ya.normalWorld.z));ha.wireframe?I.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+ha.wireframeLinewidth+"; stroke-opacity: "+ha.opacity+"; stroke-linecap: "+ha.wireframeLinecap+"; stroke-linejoin: "+ha.wireframeLinejoin):I.setAttribute("style","fill: "+w.__styleString+"; fill-opacity: "+
+ha.opacity);j.appendChild(I)}function b(ia,ga,ta,ya,ha,aa,ma){I=d(ca++);I.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+" L "+ya.positionScreen.x+","+ya.positionScreen.y+"z");if(aa instanceof THREE.MeshBasicMaterial)w.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshLambertMaterial)if(D){N.r=M.r;N.g=M.g;N.b=M.b;a(ma,ha,N);w.r=aa.color.r*N.r;w.g=aa.color.g*N.g;
+w.b=aa.color.b*N.b;w.updateStyleString()}else w.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshDepthMaterial){f=1-aa.__2near/(aa.__farPlusNear-ha.z*aa.__farMinusNear);w.setRGB(f,f,f)}else aa instanceof THREE.MeshNormalMaterial&&w.setRGB(e(ha.normalWorld.x),e(ha.normalWorld.y),e(ha.normalWorld.z));aa.wireframe?I.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+aa.wireframeLinewidth+"; stroke-opacity: "+aa.opacity+"; stroke-linecap: "+aa.wireframeLinecap+
+"; stroke-linejoin: "+aa.wireframeLinejoin):I.setAttribute("style","fill: "+w.__styleString+"; fill-opacity: "+aa.opacity);j.appendChild(I)}function d(ia){if(T[ia]==null){T[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");va==0&&T[ia].setAttribute("shape-rendering","crispEdges")}return T[ia]}function e(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,n,p,x,u,q,y,A,F=
+new THREE.Rectangle,v=new THREE.Rectangle,D=!1,w=new THREE.Color(16777215),N=new THREE.Color(16777215),M=new THREE.Color(0),W=new THREE.Color(0),K=new THREE.Color(0),f,V=new THREE.Vector3,T=[],da=[],fa=[],I,ca,xa,ea,va=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":va=1;break;case "low":va=0}};this.setSize=function(ia,ga){k=ia;n=ga;p=k/2;x=n/2;j.setAttribute("viewBox",-p+" "+-x+" "+k+" "+n);j.setAttribute("width",
+k);j.setAttribute("height",n);F.set(-p,-x,p,x)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(ia,ga){var ta,ya,ha,aa,ma,na,R,ja;this.autoClear&&this.clear();g=h.projectScene(ia,ga,this.sortElements);ea=xa=ca=0;if(D=ia.lights.length>0){R=ia.lights;M.setRGB(0,0,0);W.setRGB(0,0,0);K.setRGB(0,0,0);ta=0;for(ya=R.length;ta<ya;ta++){ha=R[ta];aa=ha.color;if(ha instanceof THREE.AmbientLight){M.r+=aa.r;M.g+=aa.g;M.b+=aa.b}else if(ha instanceof THREE.DirectionalLight){W.r+=
+aa.r;W.g+=aa.g;W.b+=aa.b}else if(ha instanceof THREE.PointLight){K.r+=aa.r;K.g+=aa.g;K.b+=aa.b}}}ta=0;for(ya=g.length;ta<ya;ta++){R=g[ta];v.empty();if(R instanceof THREE.RenderableParticle){u=R;u.x*=p;u.y*=-x;ha=0;for(aa=R.materials.length;ha<aa;ha++)if(ja=R.materials[ha]){ma=u;na=R;var qa=xa++;if(da[qa]==null){da[qa]=document.createElementNS("http://www.w3.org/2000/svg","circle");va==0&&da[qa].setAttribute("shape-rendering","crispEdges")}I=da[qa];I.setAttribute("cx",ma.x);I.setAttribute("cy",ma.y);
+I.setAttribute("r",na.scale.x*p);if(ja instanceof THREE.ParticleCircleMaterial){if(D){N.r=M.r+W.r+K.r;N.g=M.g+W.g+K.g;N.b=M.b+W.b+K.b;w.r=ja.color.r*N.r;w.g=ja.color.g*N.g;w.b=ja.color.b*N.b;w.updateStyleString()}else w=ja.color;I.setAttribute("style","fill: "+w.__styleString)}j.appendChild(I)}}else if(R instanceof THREE.RenderableLine){u=R.v1;q=R.v2;u.positionScreen.x*=p;u.positionScreen.y*=-x;q.positionScreen.x*=p;q.positionScreen.y*=-x;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(q.positionScreen.x,
+q.positionScreen.y);if(F.instersects(v)){ha=0;for(aa=R.materials.length;ha<aa;)if(ja=R.materials[ha++]){ma=u;na=q;qa=ea++;if(fa[qa]==null){fa[qa]=document.createElementNS("http://www.w3.org/2000/svg","line");va==0&&fa[qa].setAttribute("shape-rendering","crispEdges")}I=fa[qa];I.setAttribute("x1",ma.positionScreen.x);I.setAttribute("y1",ma.positionScreen.y);I.setAttribute("x2",na.positionScreen.x);I.setAttribute("y2",na.positionScreen.y);if(ja instanceof THREE.LineBasicMaterial){w.__styleString=ja.color.__styleString;
+I.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+ja.linewidth+"; stroke-opacity: "+ja.opacity+"; stroke-linecap: "+ja.linecap+"; stroke-linejoin: "+ja.linejoin);j.appendChild(I)}}}}else if(R instanceof THREE.RenderableFace3){u=R.v1;q=R.v2;y=R.v3;u.positionScreen.x*=p;u.positionScreen.y*=-x;q.positionScreen.x*=p;q.positionScreen.y*=-x;y.positionScreen.x*=p;y.positionScreen.y*=-x;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(q.positionScreen.x,q.positionScreen.y);
+v.addPoint(y.positionScreen.x,y.positionScreen.y);if(F.instersects(v)){ha=0;for(aa=R.meshMaterials.length;ha<aa;){ja=R.meshMaterials[ha++];if(ja instanceof THREE.MeshFaceMaterial){ma=0;for(na=R.faceMaterials.length;ma<na;)(ja=R.faceMaterials[ma++])&&c(u,q,y,R,ja,ia)}else ja&&c(u,q,y,R,ja,ia)}}}else if(R instanceof THREE.RenderableFace4){u=R.v1;q=R.v2;y=R.v3;A=R.v4;u.positionScreen.x*=p;u.positionScreen.y*=-x;q.positionScreen.x*=p;q.positionScreen.y*=-x;y.positionScreen.x*=p;y.positionScreen.y*=-x;
+A.positionScreen.x*=p;A.positionScreen.y*=-x;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(q.positionScreen.x,q.positionScreen.y);v.addPoint(y.positionScreen.x,y.positionScreen.y);v.addPoint(A.positionScreen.x,A.positionScreen.y);if(F.instersects(v)){ha=0;for(aa=R.meshMaterials.length;ha<aa;){ja=R.meshMaterials[ha++];if(ja instanceof THREE.MeshFaceMaterial){ma=0;for(na=R.faceMaterials.length;ma<na;)(ja=R.faceMaterials[ma++])&&b(u,q,y,A,R,ja,ia)}else ja&&b(u,q,y,A,R,ja,ia)}}}}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -220,87 +220,87 @@ THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,
 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,"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,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
 THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(a){function c(m,z,q){var n,p,B,C=m.vertices,G=C.length,Q=m.colors,H=Q.length,O=m.__vertexArray,la=m.__colorArray,ka=m.__sortArray,ra=m.__dirtyVertices,sa=m.__dirtyColors;if(q.sortParticles){ya.multiplySelf(q.matrixWorld);for(n=0;n<G;n++){p=C[n].position;ma.copy(p);ya.multiplyVector3(ma);ka[n]=[ma.z,n]}ka.sort(function(oa,pa){return pa[0]-oa[0]});for(n=0;n<G;n++){p=C[ka[n][1]].position;B=n*3;O[B]=p.x;O[B+1]=p.y;O[B+2]=p.z}for(n=0;n<H;n++){B=n*3;color=Q[ka[n][1]];la[B]=
-color.r;la[B+1]=color.g;la[B+2]=color.b}}else{if(ra)for(n=0;n<G;n++){p=C[n].position;B=n*3;O[B]=p.x;O[B+1]=p.y;O[B+2]=p.z}if(sa)for(n=0;n<H;n++){color=Q[n];B=n*3;la[B]=color.r;la[B+1]=color.g;la[B+2]=color.b}}if(ra||q.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,m.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,O,z)}if(sa||q.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,m.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,la,z)}}function b(m,z){m.fragmentShader=z.fragmentShader;m.vertexShader=z.vertexShader;
-m.uniforms=Uniforms.clone(z.uniforms)}function d(m,z,q,n,p){n.program||da.initMaterial(n,z,q,p);var B=n.program,C=B.uniforms,G=n.uniforms;if(B!=V){f.useProgram(B);V=B}f.uniformMatrix4fv(C.projectionMatrix,!1,ha);if(q&&(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial||n instanceof THREE.LineBasicMaterial||n instanceof THREE.ParticleBasicMaterial)){G.fogColor.value.setHex(q.color.hex);if(q instanceof THREE.Fog){G.fogNear.value=q.near;
-G.fogFar.value=q.far}else if(q instanceof THREE.FogExp2)G.fogDensity.value=q.density}if(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial){var Q,H,O=0,la=0,ka=0,ra,sa,oa,pa=na,Ja=pa.directional.colors,P=pa.directional.positions,Ga=pa.point.colors,Ea=pa.point.positions,Fa=0,W=0;q=H=H=0;for(Q=z.length;q<Q;q++){H=z[q];ra=H.color;sa=H.position;oa=H.intensity;if(H instanceof THREE.AmbientLight){O+=ra.r;la+=ra.g;ka+=ra.b}else if(H instanceof THREE.DirectionalLight){H=Fa*3;Ja[H]=
-ra.r*oa;Ja[H+1]=ra.g*oa;Ja[H+2]=ra.b*oa;P[H]=sa.x;P[H+1]=sa.y;P[H+2]=sa.z;Fa+=1}else if(H instanceof THREE.PointLight){H=W*3;Ga[H]=ra.r*oa;Ga[H+1]=ra.g*oa;Ga[H+2]=ra.b*oa;Ea[H]=sa.x;Ea[H+1]=sa.y;Ea[H+2]=sa.z;W+=1}}for(q=Fa*3;q<Ja.length;q++)Ja[q]=0;for(q=W*3;q<Ga.length;q++)Ga[q]=0;pa.point.length=W;pa.directional.length=Fa;pa.ambient[0]=O;pa.ambient[1]=la;pa.ambient[2]=ka;z=na;G.enableLighting.value=z.directional.length+z.point.length;G.ambientLightColor.value=z.ambient;G.directionalLightColor.value=
-z.directional.colors;G.directionalLightDirection.value=z.directional.positions;G.pointLightColor.value=z.point.colors;G.pointLightPosition.value=z.point.positions}if(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial){G.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);G.opacity.value=n.opacity;G.map.texture=n.map;G.lightMap.texture=n.lightMap;G.envMap.texture=n.envMap;G.reflectivity.value=n.reflectivity;
-G.refractionRatio.value=n.refractionRatio;G.combine.value=n.combine;G.useRefract.value=n.envMap&&n.envMap.mapping instanceof THREE.CubeRefractionMapping}if(n instanceof THREE.LineBasicMaterial){G.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);G.opacity.value=n.opacity}else if(n instanceof THREE.ParticleBasicMaterial){G.psColor.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);G.opacity.value=n.opacity;G.size.value=n.size;G.scale.value=M.height/
-2;G.map.texture=n.map}else if(n instanceof THREE.MeshPhongMaterial){G.ambient.value.setRGB(n.ambient.r,n.ambient.g,n.ambient.b);G.specular.value.setRGB(n.specular.r,n.specular.g,n.specular.b);G.shininess.value=n.shininess}else if(n instanceof THREE.MeshDepthMaterial){G.mNear.value=m.near;G.mFar.value=m.far;G.opacity.value=n.opacity}else if(n instanceof THREE.MeshNormalMaterial)G.opacity.value=n.opacity;for(var X in G)if(O=B.uniforms[X]){q=G[X];Q=q.type;z=q.value;if(Q=="i")f.uniform1i(O,z);else if(Q==
-"f")f.uniform1f(O,z);else if(Q=="fv1")f.uniform1fv(O,z);else if(Q=="fv")f.uniform3fv(O,z);else if(Q=="v2")f.uniform2f(O,z.x,z.y);else if(Q=="v3")f.uniform3f(O,z.x,z.y,z.z);else if(Q=="c")f.uniform3f(O,z.r,z.g,z.b);else if(Q=="t"){f.uniform1i(O,z);if(q=q.texture)if(q.image instanceof Array&&q.image.length==6){if(q.image.length==6){if(q.needsUpdate){if(q.__wasSetOnce){f.bindTexture(f.TEXTURE_CUBE_MAP,q.image.__webGLTextureCube);for(Q=0;Q<6;++Q)f.texSubImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,0,0,f.RGBA,
-f.UNSIGNED_BYTE,q.image[Q])}else{q.image.__webGLTextureCube=f.createTexture();f.bindTexture(f.TEXTURE_CUBE_MAP,q.image.__webGLTextureCube);for(Q=0;Q<6;++Q)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,q.image[Q]);q.__wasSetOnce=!0}F(f.TEXTURE_CUBE_MAP,q,q.image[0]);f.bindTexture(f.TEXTURE_CUBE_MAP,null);q.needsUpdate=!1}f.activeTexture(f.TEXTURE0+z);f.bindTexture(f.TEXTURE_CUBE_MAP,q.image.__webGLTextureCube)}}else{if(q.needsUpdate){if(q.__wasSetOnce){f.bindTexture(f.TEXTURE_2D,
-q.__webGLTexture);f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,q.image)}else{q.__webGLTexture=f.createTexture();f.bindTexture(f.TEXTURE_2D,q.__webGLTexture);f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,q.image);q.__wasSetOnce=!0}F(f.TEXTURE_2D,q,q.image);f.bindTexture(f.TEXTURE_2D,null);q.needsUpdate=!1}f.activeTexture(f.TEXTURE0+z);f.bindTexture(f.TEXTURE_2D,q.__webGLTexture)}}}f.uniformMatrix4fv(C.modelViewMatrix,!1,p._modelViewMatrixArray);f.uniformMatrix3fv(C.normalMatrix,
-!1,p._normalMatrixArray);(n instanceof THREE.MeshShaderMaterial||n instanceof THREE.MeshPhongMaterial||n.envMap)&&f.uniform3f(C.cameraPosition,m.position.x,m.position.y,m.position.z);(n instanceof THREE.MeshShaderMaterial||n.envMap||n.skinning)&&f.uniformMatrix4fv(C.objectMatrix,!1,p._objectMatrixArray);(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshShaderMaterial||n.skinning)&&f.uniformMatrix4fv(C.viewMatrix,!1,aa);if(n.skinning){f.uniformMatrix4fv(C.cameraInverseMatrix,
-!1,aa);f.uniformMatrix4fv(C.boneGlobalMatrices,!1,p.boneMatrices)}return B}function e(m,z,q,n,p,B){if(n.opacity!=0){m=d(m,z,q,n,B).attributes;f.bindBuffer(f.ARRAY_BUFFER,p.__webGLVertexBuffer);f.vertexAttribPointer(m.position,3,f.FLOAT,!1,0,0);if(m.color>=0){f.bindBuffer(f.ARRAY_BUFFER,p.__webGLColorBuffer);f.vertexAttribPointer(m.color,3,f.FLOAT,!1,0,0)}if(m.normal>=0){f.bindBuffer(f.ARRAY_BUFFER,p.__webGLNormalBuffer);f.vertexAttribPointer(m.normal,3,f.FLOAT,!1,0,0)}if(m.tangent>=0){f.bindBuffer(f.ARRAY_BUFFER,
-p.__webGLTangentBuffer);f.vertexAttribPointer(m.tangent,4,f.FLOAT,!1,0,0)}if(m.uv>=0)if(p.__webGLUVBuffer){f.bindBuffer(f.ARRAY_BUFFER,p.__webGLUVBuffer);f.vertexAttribPointer(m.uv,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(m.uv)}else f.disableVertexAttribArray(m.uv);if(m.uv2>=0)if(p.__webGLUV2Buffer){f.bindBuffer(f.ARRAY_BUFFER,p.__webGLUV2Buffer);f.vertexAttribPointer(m.uv2,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(m.uv2)}else f.disableVertexAttribArray(m.uv2);if(n.skinning&&m.skinVertexA>=0&&
-m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0){f.bindBuffer(f.ARRAY_BUFFER,p.__webGLSkinVertexABuffer);f.vertexAttribPointer(m.skinVertexA,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,p.__webGLSkinVertexBBuffer);f.vertexAttribPointer(m.skinVertexB,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,p.__webGLSkinIndicesBuffer);f.vertexAttribPointer(m.skinIndex,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,p.__webGLSkinWeightsBuffer);f.vertexAttribPointer(m.skinWeight,4,f.FLOAT,!1,0,0)}if(B instanceof
-THREE.Mesh)if(n.wireframe){f.lineWidth(n.wireframeLinewidth);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);f.drawElements(f.LINES,p.__webGLLineCount,f.UNSIGNED_SHORT,0)}else{f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);f.drawElements(f.TRIANGLES,p.__webGLFaceCount,f.UNSIGNED_SHORT,0)}else if(B instanceof THREE.Line){B=B.type==THREE.LineStrip?f.LINE_STRIP:f.LINES;f.lineWidth(n.linewidth);f.drawArrays(B,0,p.__webGLLineCount)}else if(B instanceof THREE.ParticleSystem)f.drawArrays(f.POINTS,
-0,p.__webGLParticleCount);else B instanceof THREE.Ribbon&&f.drawArrays(f.TRIANGLE_STRIP,0,p.__webGLVertexCount)}}function g(m,z){if(!m.__webGLVertexBuffer)m.__webGLVertexBuffer=f.createBuffer();if(!m.__webGLNormalBuffer)m.__webGLNormalBuffer=f.createBuffer();if(m.hasPos){f.bindBuffer(f.ARRAY_BUFFER,m.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,m.positionArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(z.attributes.position);f.vertexAttribPointer(z.attributes.position,3,f.FLOAT,!1,0,0)}if(m.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,
-m.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,m.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(z.attributes.normal);f.vertexAttribPointer(z.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,m.count);m.count=0}function h(m){if(fa!=m.doubleSided){m.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);fa=m.doubleSided}if(I!=m.flipSided){m.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);I=m.flipSided}}function j(m){if(xa!=m){m?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST);
-xa=m}}function k(m){ta[0].set(m.n41-m.n11,m.n42-m.n12,m.n43-m.n13,m.n44-m.n14);ta[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);ta[2].set(m.n41+m.n21,m.n42+m.n22,m.n43+m.n23,m.n44+m.n24);ta[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);ta[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-m.n34);ta[5].set(m.n41+m.n31,m.n42+m.n32,m.n43+m.n33,m.n44+m.n34);var z;for(m=0;m<6;m++){z=ta[m];z.divideScalar(Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z))}}function l(m){for(var z=m.matrixWorld,q=-m.geometry.boundingSphere.radius*
-Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),n=0;n<6;n++){m=ta[n].x*z.n14+ta[n].y*z.n24+ta[n].z*z.n34+ta[n].w;if(m<=q)return!1}return!0}function o(m,z){m.list[m.count]=z;m.count+=1}function v(m){var z,q,n=m.object,p=m.opaque,B=m.transparent;B.count=0;m=p.count=0;for(z=n.materials.length;m<z;m++){q=n.materials[m];q.opacity&&q.opacity<1||q.blending!=THREE.NormalBlending?o(B,q):o(p,q)}}function u(m){var z,q,n,p,B=m.object,C=m.buffer,G=m.opaque,Q=m.transparent;Q.count=0;m=G.count=0;for(n=B.materials.length;m<
-n;m++){z=B.materials[m];if(z instanceof THREE.MeshFaceMaterial){z=0;for(q=C.materials.length;z<q;z++)(p=C.materials[z])&&(p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?o(Q,p):o(G,p))}else{p=z;p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?o(Q,p):o(G,p)}}}function t(m,z){return z.z-m.z}function y(m,z){m._modelViewMatrix.multiplyToArray(z.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}
-function A(m){function z(la){var ka=[];q=0;for(n=la.length;q<n;q++)la[q]==undefined?ka.push("undefined"):ka.push(la[q].id);return ka.join("_")}var q,n,p,B,C,G,Q,H,O={};m.geometryGroups={};p=0;for(B=m.faces.length;p<B;p++){C=m.faces[p];G=C.materials;Q=z(G);O[Q]==undefined&&(O[Q]={hash:Q,counter:0});H=O[Q].hash+"_"+O[Q].counter;m.geometryGroups[H]==undefined&&(m.geometryGroups[H]={faces:[],materials:G,vertices:0});C=C instanceof THREE.Face3?3:4;if(m.geometryGroups[H].vertices+C>65535){O[Q].counter+=
-1;H=O[Q].hash+"_"+O[Q].counter;m.geometryGroups[H]==undefined&&(m.geometryGroups[H]={faces:[],materials:G,vertices:0})}m.geometryGroups[H].faces.push(p);m.geometryGroups[H].vertices+=C}}function D(m,z,q){m.push({buffer:z,object:q,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function w(m){if(m!=ca){switch(m){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR,f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);
-f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA)}ca=m}}function F(m,z,q){if((q.width&q.width-1)==0&&(q.height&q.height-1)==0){f.texParameteri(m,f.TEXTURE_WRAP_S,Z(z.wrapS));f.texParameteri(m,f.TEXTURE_WRAP_T,Z(z.wrapT));f.texParameteri(m,f.TEXTURE_MAG_FILTER,Z(z.magFilter));f.texParameteri(m,f.TEXTURE_MIN_FILTER,
-Z(z.minFilter));f.generateMipmap(m)}else{f.texParameteri(m,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(m,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(m,f.TEXTURE_MAG_FILTER,L(z.magFilter));f.texParameteri(m,f.TEXTURE_MIN_FILTER,L(z.minFilter))}}function x(m){if(m&&!m.__webGLFramebuffer){m.__webGLFramebuffer=f.createFramebuffer();m.__webGLRenderbuffer=f.createRenderbuffer();m.__webGLTexture=f.createTexture();f.bindRenderbuffer(f.RENDERBUFFER,m.__webGLRenderbuffer);f.renderbufferStorage(f.RENDERBUFFER,
-f.DEPTH_COMPONENT16,m.width,m.height);f.bindTexture(f.TEXTURE_2D,m.__webGLTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,Z(m.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,Z(m.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,Z(m.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,Z(m.minFilter));f.texImage2D(f.TEXTURE_2D,0,Z(m.format),m.width,m.height,0,Z(m.format),Z(m.type),null);f.bindFramebuffer(f.FRAMEBUFFER,m.__webGLFramebuffer);f.framebufferTexture2D(f.FRAMEBUFFER,
-f.COLOR_ATTACHMENT0,f.TEXTURE_2D,m.__webGLTexture,0);f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,m.__webGLRenderbuffer);f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var z,q;if(m){z=m.__webGLFramebuffer;q=m.width;m=m.height}else{z=null;q=ia;m=ga}if(z!=T){f.bindFramebuffer(f.FRAMEBUFFER,z);f.viewport(ea,va,q,m);T=z}}function N(m,z){var q;if(m=="fragment")q=f.createShader(f.FRAGMENT_SHADER);else m=="vertex"&&
-(q=f.createShader(f.VERTEX_SHADER));f.shaderSource(q,z);f.compileShader(q);if(!f.getShaderParameter(q,f.COMPILE_STATUS)){alert(f.getShaderInfoLog(q));return null}return q}function L(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return f.LINEAR}}function Z(m){switch(m){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;
+THREE.WebGLRenderer=function(a){function c(l,z,t){var m,o,B,C=l.vertices,G=C.length,Q=l.colors,H=Q.length,O=l.__vertexArray,la=l.__colorArray,ka=l.__sortArray,ra=l.__dirtyVertices,sa=l.__dirtyColors;if(t.sortParticles){ya.multiplySelf(t.matrixWorld);for(m=0;m<G;m++){o=C[m].position;ma.copy(o);ya.multiplyVector3(ma);ka[m]=[ma.z,m]}ka.sort(function(oa,pa){return pa[0]-oa[0]});for(m=0;m<G;m++){o=C[ka[m][1]].position;B=m*3;O[B]=o.x;O[B+1]=o.y;O[B+2]=o.z}for(m=0;m<H;m++){B=m*3;color=Q[ka[m][1]];la[B]=
+color.r;la[B+1]=color.g;la[B+2]=color.b}}else{if(ra)for(m=0;m<G;m++){o=C[m].position;B=m*3;O[B]=o.x;O[B+1]=o.y;O[B+2]=o.z}if(sa)for(m=0;m<H;m++){color=Q[m];B=m*3;la[B]=color.r;la[B+1]=color.g;la[B+2]=color.b}}if(ra||t.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,l.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,O,z)}if(sa||t.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,l.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,la,z)}}function b(l,z){l.fragmentShader=z.fragmentShader;l.vertexShader=z.vertexShader;
+l.uniforms=Uniforms.clone(z.uniforms)}function d(l,z,t,m,o){m.program||da.initMaterial(m,z,t,o);var B=m.program,C=B.uniforms,G=m.uniforms;if(B!=V){f.useProgram(B);V=B}f.uniformMatrix4fv(C.projectionMatrix,!1,ha);if(t&&(m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial||m instanceof THREE.LineBasicMaterial||m instanceof THREE.ParticleBasicMaterial)){G.fogColor.value.setHex(t.color.hex);if(t instanceof THREE.Fog){G.fogNear.value=t.near;
+G.fogFar.value=t.far}else if(t instanceof THREE.FogExp2)G.fogDensity.value=t.density}if(m instanceof THREE.MeshPhongMaterial||m instanceof THREE.MeshLambertMaterial){var Q,H,O=0,la=0,ka=0,ra,sa,oa,pa=na,Ja=pa.directional.colors,P=pa.directional.positions,Ga=pa.point.colors,Ea=pa.point.positions,Fa=0,X=0;t=H=H=0;for(Q=z.length;t<Q;t++){H=z[t];ra=H.color;sa=H.position;oa=H.intensity;if(H instanceof THREE.AmbientLight){O+=ra.r;la+=ra.g;ka+=ra.b}else if(H instanceof THREE.DirectionalLight){H=Fa*3;Ja[H]=
+ra.r*oa;Ja[H+1]=ra.g*oa;Ja[H+2]=ra.b*oa;P[H]=sa.x;P[H+1]=sa.y;P[H+2]=sa.z;Fa+=1}else if(H instanceof THREE.PointLight){H=X*3;Ga[H]=ra.r*oa;Ga[H+1]=ra.g*oa;Ga[H+2]=ra.b*oa;Ea[H]=sa.x;Ea[H+1]=sa.y;Ea[H+2]=sa.z;X+=1}}for(t=Fa*3;t<Ja.length;t++)Ja[t]=0;for(t=X*3;t<Ga.length;t++)Ga[t]=0;pa.point.length=X;pa.directional.length=Fa;pa.ambient[0]=O;pa.ambient[1]=la;pa.ambient[2]=ka;z=na;G.enableLighting.value=z.directional.length+z.point.length;G.ambientLightColor.value=z.ambient;G.directionalLightColor.value=
+z.directional.colors;G.directionalLightDirection.value=z.directional.positions;G.pointLightColor.value=z.point.colors;G.pointLightPosition.value=z.point.positions}if(m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial){G.diffuse.value.setRGB(m.color.r*m.opacity,m.color.g*m.opacity,m.color.b*m.opacity);G.opacity.value=m.opacity;G.map.texture=m.map;G.lightMap.texture=m.lightMap;G.envMap.texture=m.envMap;G.reflectivity.value=m.reflectivity;
+G.refractionRatio.value=m.refractionRatio;G.combine.value=m.combine;G.useRefract.value=m.envMap&&m.envMap.mapping instanceof THREE.CubeRefractionMapping}if(m instanceof THREE.LineBasicMaterial){G.diffuse.value.setRGB(m.color.r*m.opacity,m.color.g*m.opacity,m.color.b*m.opacity);G.opacity.value=m.opacity}else if(m instanceof THREE.ParticleBasicMaterial){G.psColor.value.setRGB(m.color.r*m.opacity,m.color.g*m.opacity,m.color.b*m.opacity);G.opacity.value=m.opacity;G.size.value=m.size;G.scale.value=K.height/
+2;G.map.texture=m.map}else if(m instanceof THREE.MeshPhongMaterial){G.ambient.value.setRGB(m.ambient.r,m.ambient.g,m.ambient.b);G.specular.value.setRGB(m.specular.r,m.specular.g,m.specular.b);G.shininess.value=m.shininess}else if(m instanceof THREE.MeshDepthMaterial){G.mNear.value=l.near;G.mFar.value=l.far;G.opacity.value=m.opacity}else if(m instanceof THREE.MeshNormalMaterial)G.opacity.value=m.opacity;for(var Y in G)if(O=B.uniforms[Y]){t=G[Y];Q=t.type;z=t.value;if(Q=="i")f.uniform1i(O,z);else if(Q==
+"f")f.uniform1f(O,z);else if(Q=="fv1")f.uniform1fv(O,z);else if(Q=="fv")f.uniform3fv(O,z);else if(Q=="v2")f.uniform2f(O,z.x,z.y);else if(Q=="v3")f.uniform3f(O,z.x,z.y,z.z);else if(Q=="c")f.uniform3f(O,z.r,z.g,z.b);else if(Q=="t"){f.uniform1i(O,z);if(t=t.texture)if(t.image instanceof Array&&t.image.length==6){if(t.image.length==6){if(t.needsUpdate){if(t.__wasSetOnce){f.bindTexture(f.TEXTURE_CUBE_MAP,t.image.__webGLTextureCube);for(Q=0;Q<6;++Q)f.texSubImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,0,0,f.RGBA,
+f.UNSIGNED_BYTE,t.image[Q])}else{t.image.__webGLTextureCube=f.createTexture();f.bindTexture(f.TEXTURE_CUBE_MAP,t.image.__webGLTextureCube);for(Q=0;Q<6;++Q)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,t.image[Q]);t.__wasSetOnce=!0}D(f.TEXTURE_CUBE_MAP,t,t.image[0]);f.bindTexture(f.TEXTURE_CUBE_MAP,null);t.needsUpdate=!1}f.activeTexture(f.TEXTURE0+z);f.bindTexture(f.TEXTURE_CUBE_MAP,t.image.__webGLTextureCube)}}else{if(t.needsUpdate){if(t.__wasSetOnce){f.bindTexture(f.TEXTURE_2D,
+t.__webGLTexture);f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,t.image)}else{t.__webGLTexture=f.createTexture();f.bindTexture(f.TEXTURE_2D,t.__webGLTexture);f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,t.image);t.__wasSetOnce=!0}D(f.TEXTURE_2D,t,t.image);f.bindTexture(f.TEXTURE_2D,null);t.needsUpdate=!1}f.activeTexture(f.TEXTURE0+z);f.bindTexture(f.TEXTURE_2D,t.__webGLTexture)}}}f.uniformMatrix4fv(C.modelViewMatrix,!1,o._modelViewMatrixArray);f.uniformMatrix3fv(C.normalMatrix,
+!1,o._normalMatrixArray);(m instanceof THREE.MeshShaderMaterial||m instanceof THREE.MeshPhongMaterial||m.envMap)&&f.uniform3f(C.cameraPosition,l.position.x,l.position.y,l.position.z);(m instanceof THREE.MeshShaderMaterial||m.envMap||m.skinning)&&f.uniformMatrix4fv(C.objectMatrix,!1,o._objectMatrixArray);(m instanceof THREE.MeshPhongMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshShaderMaterial||m.skinning)&&f.uniformMatrix4fv(C.viewMatrix,!1,aa);if(m.skinning){f.uniformMatrix4fv(C.cameraInverseMatrix,
+!1,aa);f.uniformMatrix4fv(C.boneGlobalMatrices,!1,o.boneMatrices)}return B}function e(l,z,t,m,o,B){if(m.opacity!=0){l=d(l,z,t,m,B).attributes;f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.vertexAttribPointer(l.position,3,f.FLOAT,!1,0,0);if(l.color>=0){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLColorBuffer);f.vertexAttribPointer(l.color,3,f.FLOAT,!1,0,0)}if(l.normal>=0){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLNormalBuffer);f.vertexAttribPointer(l.normal,3,f.FLOAT,!1,0,0)}if(l.tangent>=0){f.bindBuffer(f.ARRAY_BUFFER,
+o.__webGLTangentBuffer);f.vertexAttribPointer(l.tangent,4,f.FLOAT,!1,0,0)}if(l.uv>=0)if(o.__webGLUVBuffer){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLUVBuffer);f.vertexAttribPointer(l.uv,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(l.uv)}else f.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(o.__webGLUV2Buffer){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLUV2Buffer);f.vertexAttribPointer(l.uv2,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(l.uv2)}else f.disableVertexAttribArray(l.uv2);if(m.skinning&&l.skinVertexA>=0&&
+l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLSkinVertexABuffer);f.vertexAttribPointer(l.skinVertexA,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);f.vertexAttribPointer(l.skinVertexB,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,o.__webGLSkinIndicesBuffer);f.vertexAttribPointer(l.skinIndex,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,o.__webGLSkinWeightsBuffer);f.vertexAttribPointer(l.skinWeight,4,f.FLOAT,!1,0,0)}if(B instanceof
+THREE.Mesh)if(m.wireframe){f.lineWidth(m.wireframeLinewidth);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);f.drawElements(f.LINES,o.__webGLLineCount,f.UNSIGNED_SHORT,0)}else{f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);f.drawElements(f.TRIANGLES,o.__webGLFaceCount,f.UNSIGNED_SHORT,0)}else if(B instanceof THREE.Line){B=B.type==THREE.LineStrip?f.LINE_STRIP:f.LINES;f.lineWidth(m.linewidth);f.drawArrays(B,0,o.__webGLLineCount)}else if(B instanceof THREE.ParticleSystem)f.drawArrays(f.POINTS,
+0,o.__webGLParticleCount);else B instanceof THREE.Ribbon&&f.drawArrays(f.TRIANGLE_STRIP,0,o.__webGLVertexCount)}}function g(l,z){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=f.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=f.createBuffer();if(l.hasPos){f.bindBuffer(f.ARRAY_BUFFER,l.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,l.positionArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(z.attributes.position);f.vertexAttribPointer(z.attributes.position,3,f.FLOAT,!1,0,0)}if(l.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,
+l.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,l.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(z.attributes.normal);f.vertexAttribPointer(z.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,l.count);l.count=0}function h(l){if(fa!=l.doubleSided){l.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);fa=l.doubleSided}if(I!=l.flipSided){l.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);I=l.flipSided}}function j(l){if(xa!=l){l?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST);
+xa=l}}function k(l){ta[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);ta[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);ta[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);ta[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);ta[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);ta[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var z;for(l=0;l<6;l++){z=ta[l];z.divideScalar(Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z))}}function n(l){for(var z=l.matrixWorld,t=-l.geometry.boundingSphere.radius*
+Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),m=0;m<6;m++){l=ta[m].x*z.n14+ta[m].y*z.n24+ta[m].z*z.n34+ta[m].w;if(l<=t)return!1}return!0}function p(l,z){l.list[l.count]=z;l.count+=1}function x(l){var z,t,m=l.object,o=l.opaque,B=l.transparent;B.count=0;l=o.count=0;for(z=m.materials.length;l<z;l++){t=m.materials[l];t.opacity&&t.opacity<1||t.blending!=THREE.NormalBlending?p(B,t):p(o,t)}}function u(l){var z,t,m,o,B=l.object,C=l.buffer,G=l.opaque,Q=l.transparent;Q.count=0;l=G.count=0;for(m=B.materials.length;l<
+m;l++){z=B.materials[l];if(z instanceof THREE.MeshFaceMaterial){z=0;for(t=C.materials.length;z<t;z++)(o=C.materials[z])&&(o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?p(Q,o):p(G,o))}else{o=z;o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?p(Q,o):p(G,o)}}}function q(l,z){return z.z-l.z}function y(l,z){l._modelViewMatrix.multiplyToArray(z.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}
+function A(l){function z(la){var ka=[];t=0;for(m=la.length;t<m;t++)la[t]==undefined?ka.push("undefined"):ka.push(la[t].id);return ka.join("_")}var t,m,o,B,C,G,Q,H,O={};l.geometryGroups={};o=0;for(B=l.faces.length;o<B;o++){C=l.faces[o];G=C.materials;Q=z(G);O[Q]==undefined&&(O[Q]={hash:Q,counter:0});H=O[Q].hash+"_"+O[Q].counter;l.geometryGroups[H]==undefined&&(l.geometryGroups[H]={faces:[],materials:G,vertices:0});C=C instanceof THREE.Face3?3:4;if(l.geometryGroups[H].vertices+C>65535){O[Q].counter+=
+1;H=O[Q].hash+"_"+O[Q].counter;l.geometryGroups[H]==undefined&&(l.geometryGroups[H]={faces:[],materials:G,vertices:0})}l.geometryGroups[H].faces.push(o);l.geometryGroups[H].vertices+=C}}function F(l,z,t){l.push({buffer:z,object:t,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function v(l){if(l!=ca){switch(l){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR,f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);
+f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA)}ca=l}}function D(l,z,t){if((t.width&t.width-1)==0&&(t.height&t.height-1)==0){f.texParameteri(l,f.TEXTURE_WRAP_S,W(z.wrapS));f.texParameteri(l,f.TEXTURE_WRAP_T,W(z.wrapT));f.texParameteri(l,f.TEXTURE_MAG_FILTER,W(z.magFilter));f.texParameteri(l,f.TEXTURE_MIN_FILTER,
+W(z.minFilter));f.generateMipmap(l)}else{f.texParameteri(l,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(l,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(l,f.TEXTURE_MAG_FILTER,M(z.magFilter));f.texParameteri(l,f.TEXTURE_MIN_FILTER,M(z.minFilter))}}function w(l){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=f.createFramebuffer();l.__webGLRenderbuffer=f.createRenderbuffer();l.__webGLTexture=f.createTexture();f.bindRenderbuffer(f.RENDERBUFFER,l.__webGLRenderbuffer);f.renderbufferStorage(f.RENDERBUFFER,
+f.DEPTH_COMPONENT16,l.width,l.height);f.bindTexture(f.TEXTURE_2D,l.__webGLTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,W(l.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,W(l.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,W(l.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,W(l.minFilter));f.texImage2D(f.TEXTURE_2D,0,W(l.format),l.width,l.height,0,W(l.format),W(l.type),null);f.bindFramebuffer(f.FRAMEBUFFER,l.__webGLFramebuffer);f.framebufferTexture2D(f.FRAMEBUFFER,
+f.COLOR_ATTACHMENT0,f.TEXTURE_2D,l.__webGLTexture,0);f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,l.__webGLRenderbuffer);f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var z,t;if(l){z=l.__webGLFramebuffer;t=l.width;l=l.height}else{z=null;t=ia;l=ga}if(z!=T){f.bindFramebuffer(f.FRAMEBUFFER,z);f.viewport(ea,va,t,l);T=z}}function N(l,z){var t;if(l=="fragment")t=f.createShader(f.FRAGMENT_SHADER);else l=="vertex"&&
+(t=f.createShader(f.VERTEX_SHADER));f.shaderSource(t,z);f.compileShader(t);if(!f.getShaderParameter(t,f.COMPILE_STATUS)){alert(f.getShaderInfoLog(t));return null}return t}function M(l){switch(l){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return f.LINEAR}}function W(l){switch(l){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;
 case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return f.BYTE;case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;
-case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}var M=document.createElement("canvas"),f,V=null,T=null,da=this,fa=null,I=null,ca=null,xa=null,ea=0,va=0,ia=0,
+case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}var K=document.createElement("canvas"),f,V=null,T=null,da=this,fa=null,I=null,ca=null,xa=null,ea=0,va=0,ia=0,
 ga=0,ta=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ya=new THREE.Matrix4,ha=new Float32Array(16),aa=new Float32Array(16),ma=new THREE.Vector4,na={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},R=!0,ja=new THREE.Color(0),qa=0;if(a){if(a.antialias!==undefined)R=a.antialias;a.clearColor!==undefined&&ja.setHex(a.clearColor);if(a.clearAlpha!==undefined)qa=a.clearAlpha}this.domElement=
-M;this.autoClear=!0;this.sortObjects=!0;(function(m,z,q){try{if(!(f=M.getContext("experimental-webgl",{antialias:m})))throw"Error creating WebGL context.";}catch(n){console.error(n)}f.clearColor(0,0,0,1);f.clearDepth(1);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA);f.clearColor(z.r,z.g,z.b,q);_cullEnabled=!0})(R,ja,qa);this.context=f;this.setSize=function(m,z){M.width=m;M.height=z;
-this.setViewport(0,0,M.width,M.height)};this.setViewport=function(m,z,q,n){ea=m;va=z;ia=q;ga=n;f.viewport(ea,va,ia,ga)};this.setScissor=function(m,z,q,n){f.scissor(m,z,q,n)};this.enableScissorTest=function(m){m?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){f.depthMask(m)};this.setClearColorHex=function(m,z){var q=new THREE.Color(m);f.clearColor(q.r,q.g,q.b,z)};this.setClearColor=function(m,z){f.clearColor(m.r,m.g,m.b,z)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|
-f.DEPTH_BUFFER_BIT)};this.initMaterial=function(m,z,q,n){var p;if(m instanceof THREE.MeshDepthMaterial)b(m,THREE.ShaderLib.depth);else if(m instanceof THREE.MeshNormalMaterial)b(m,THREE.ShaderLib.normal);else if(m instanceof THREE.MeshBasicMaterial)b(m,THREE.ShaderLib.basic);else if(m instanceof THREE.MeshLambertMaterial)b(m,THREE.ShaderLib.lambert);else if(m instanceof THREE.MeshPhongMaterial)b(m,THREE.ShaderLib.phong);else if(m instanceof THREE.LineBasicMaterial)b(m,THREE.ShaderLib.basic);else m instanceof
-THREE.ParticleBasicMaterial&&b(m,THREE.ShaderLib.particle_basic);var B,C,G,Q,H;B=Q=H=0;for(C=z.length;B<C;B++){G=z[B];G instanceof THREE.DirectionalLight&&Q++;G instanceof THREE.PointLight&&H++}if(H+Q<=4)z=Q;else{z=Math.ceil(4*Q/(H+Q));H=4-z}z={directional:z,point:H};B=50;if(n!==undefined&&n instanceof THREE.SkinnedMesh)B=n.bones.length;n=m.fragmentShader;H=m.vertexShader;B={fog:q,map:m.map,envMap:m.envMap,lightMap:m.lightMap,vertexColors:m.vertexColors,sizeAttenuation:m.sizeAttenuation,skinning:m.skinning,
-maxDirLights:z.directional,maxPointLights:z.point,maxBones:B};q=f.createProgram();z=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+B.maxPointLights,B.fog?"#define USE_FOG":"",B.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",B.map?"#define USE_MAP":"",B.envMap?"#define USE_ENVMAP":"",B.lightMap?"#define USE_LIGHTMAP":"",B.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
+K;this.autoClear=!0;this.sortObjects=!0;(function(l,z,t){try{if(!(f=K.getContext("experimental-webgl",{antialias:l})))throw"Error creating WebGL context.";}catch(m){console.error(m)}f.clearColor(0,0,0,1);f.clearDepth(1);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA);f.clearColor(z.r,z.g,z.b,t);_cullEnabled=!0})(R,ja,qa);this.context=f;this.setSize=function(l,z){K.width=l;K.height=z;
+this.setViewport(0,0,K.width,K.height)};this.setViewport=function(l,z,t,m){ea=l;va=z;ia=t;ga=m;f.viewport(ea,va,ia,ga)};this.setScissor=function(l,z,t,m){f.scissor(l,z,t,m)};this.enableScissorTest=function(l){l?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(l){f.depthMask(l)};this.setClearColorHex=function(l,z){var t=new THREE.Color(l);f.clearColor(t.r,t.g,t.b,z)};this.setClearColor=function(l,z){f.clearColor(l.r,l.g,l.b,z)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|
+f.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,z,t,m){var o;if(l instanceof THREE.MeshDepthMaterial)b(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)b(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)b(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)b(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)b(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)b(l,THREE.ShaderLib.basic);else l instanceof
+THREE.ParticleBasicMaterial&&b(l,THREE.ShaderLib.particle_basic);var B,C,G,Q,H;B=Q=H=0;for(C=z.length;B<C;B++){G=z[B];G instanceof THREE.DirectionalLight&&Q++;G instanceof THREE.PointLight&&H++}if(H+Q<=4)z=Q;else{z=Math.ceil(4*Q/(H+Q));H=4-z}z={directional:z,point:H};B=50;if(m!==undefined&&m instanceof THREE.SkinnedMesh)B=m.bones.length;m=l.fragmentShader;H=l.vertexShader;B={fog:t,map:l.map,envMap:l.envMap,lightMap:l.lightMap,vertexColors:l.vertexColors,sizeAttenuation:l.sizeAttenuation,skinning:l.skinning,
+maxDirLights:z.directional,maxPointLights:z.point,maxBones:B};t=f.createProgram();z=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+B.maxPointLights,B.fog?"#define USE_FOG":"",B.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",B.map?"#define USE_MAP":"",B.envMap?"#define USE_ENVMAP":"",B.lightMap?"#define USE_LIGHTMAP":"",B.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
 B=[f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+B.maxPointLights,"#define MAX_BONES "+B.maxBones,B.map?"#define USE_MAP":"",B.envMap?"#define USE_ENVMAP":"",B.lightMap?"#define USE_LIGHTMAP":"",B.vertexColors?"#define USE_COLOR":"",B.skinning?"#define USE_SKINNING":"",B.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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
-f.attachShader(q,N("fragment",z+n));f.attachShader(q,N("vertex",B+H));f.linkProgram(q);f.getProgramParameter(q,f.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+f.getProgramParameter(q,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");q.uniforms={};q.attributes={};m.program=q;q=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(p in m.uniforms)q.push(p);p=m.program;n=0;for(H=q.length;n<
-H;n++){z=q[n];p.uniforms[z]=f.getUniformLocation(p,z)}p=m.program;q=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];n=0;for(H=q.length;n<H;n++){z=q[n];p.attributes[z]=f.getAttribLocation(p,z)}p=m.program.attributes;f.enableVertexAttribArray(p.position);p.color>=0&&f.enableVertexAttribArray(p.color);p.normal>=0&&f.enableVertexAttribArray(p.normal);p.tangent>=0&&f.enableVertexAttribArray(p.tangent);if(m.skinning&&p.skinVertexA>=0&&p.skinVertexB>=
-0&&p.skinIndex>=0&&p.skinWeight>=0){f.enableVertexAttribArray(p.skinVertexA);f.enableVertexAttribArray(p.skinVertexB);f.enableVertexAttribArray(p.skinIndex);f.enableVertexAttribArray(p.skinWeight)}};this.render=function(m,z,q,n){var p,B,C,G,Q,H,O,la,ka=m.lights,ra=m.fog;z.matrixAutoUpdate&&z.updateMatrix();m.update(undefined,!1,z);z.matrixWorldInverse.flattenToArray(aa);z.projectionMatrix.flattenToArray(ha);ya.multiply(z.projectionMatrix,z.matrixWorldInverse);k(ya);this.initWebGLObjects(m);x(q);(this.autoClear||
-n)&&this.clear();Q=m.__webglObjects.length;for(n=0;n<Q;n++){p=m.__webglObjects[n];O=p.object;if(O.visible)if(!(O instanceof THREE.Mesh)||l(O)){O.matrixWorld.flattenToArray(O._objectMatrixArray);y(O,z);u(p);p.render=!0;if(this.sortObjects){ma.copy(O.position);ya.multiplyVector3(ma);p.z=ma.z}}else p.render=!1;else p.render=!1}this.sortObjects&&m.__webglObjects.sort(t);H=m.__webglObjectsImmediate.length;for(n=0;n<H;n++){p=m.__webglObjectsImmediate[n];O=p.object;if(O.visible){O.matrixAutoUpdate&&O.matrixWorld.flattenToArray(O._objectMatrixArray);
-y(O,z);v(p)}}w(THREE.NormalBlending);for(n=0;n<Q;n++){p=m.__webglObjects[n];if(p.render){O=p.object;la=p.buffer;C=p.opaque;h(O);for(p=0;p<C.count;p++){G=C.list[p];j(G.depthTest);e(z,ka,ra,G,la,O)}}}for(n=0;n<H;n++){p=m.__webglObjectsImmediate[n];O=p.object;if(O.visible){C=p.opaque;h(O);for(p=0;p<C.count;p++){G=C.list[p];j(G.depthTest);B=d(z,ka,ra,G,O);O.render(function(sa){g(sa,B)})}}}for(n=0;n<Q;n++){p=m.__webglObjects[n];if(p.render){O=p.object;la=p.buffer;C=p.transparent;h(O);for(p=0;p<C.count;p++){G=
-C.list[p];w(G.blending);j(G.depthTest);e(z,ka,ra,G,la,O)}}}for(n=0;n<H;n++){p=m.__webglObjectsImmediate[n];O=p.object;if(O.visible){C=p.transparent;h(O);for(p=0;p<C.count;p++){G=C.list[p];w(G.blending);j(G.depthTest);B=d(z,ka,ra,G,O);O.render(function(sa){g(sa,B)})}}}if(q&&q.minFilter!==THREE.NearestFilter&&q.minFilter!==THREE.LinearFilter){f.bindTexture(f.TEXTURE_2D,q.__webGLTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,null)}};this.initWebGLObjects=function(m){if(!m.__webglObjects){m.__webglObjects=
-[];m.__webglObjectsImmediate=[]}for(;m.__objectsAdded.length;){var z=m.__objectsAdded[0],q=m,n=void 0,p=void 0,B=void 0;if(z._modelViewMatrix==undefined){z._modelViewMatrix=new THREE.Matrix4;z._normalMatrixArray=new Float32Array(9);z._modelViewMatrixArray=new Float32Array(16);z._objectMatrixArray=new Float32Array(16);z.matrixWorld.flattenToArray(z._objectMatrixArray)}if(z instanceof THREE.Mesh){p=z.geometry;p.geometryGroups==undefined&&A(p);for(n in p.geometryGroups){B=p.geometryGroups[n];if(!B.__webGLVertexBuffer){var C=
+f.attachShader(t,N("fragment",z+m));f.attachShader(t,N("vertex",B+H));f.linkProgram(t);f.getProgramParameter(t,f.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+f.getProgramParameter(t,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");t.uniforms={};t.attributes={};l.program=t;t=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(o in l.uniforms)t.push(o);o=l.program;m=0;for(H=t.length;m<
+H;m++){z=t[m];o.uniforms[z]=f.getUniformLocation(o,z)}o=l.program;t=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];m=0;for(H=t.length;m<H;m++){z=t[m];o.attributes[z]=f.getAttribLocation(o,z)}o=l.program.attributes;f.enableVertexAttribArray(o.position);o.color>=0&&f.enableVertexAttribArray(o.color);o.normal>=0&&f.enableVertexAttribArray(o.normal);o.tangent>=0&&f.enableVertexAttribArray(o.tangent);if(l.skinning&&o.skinVertexA>=0&&o.skinVertexB>=
+0&&o.skinIndex>=0&&o.skinWeight>=0){f.enableVertexAttribArray(o.skinVertexA);f.enableVertexAttribArray(o.skinVertexB);f.enableVertexAttribArray(o.skinIndex);f.enableVertexAttribArray(o.skinWeight)}};this.render=function(l,z,t,m){var o,B,C,G,Q,H,O,la,ka=l.lights,ra=l.fog;z.matrixAutoUpdate&&z.updateMatrix();l.update(undefined,!1,z);z.matrixWorldInverse.flattenToArray(aa);z.projectionMatrix.flattenToArray(ha);ya.multiply(z.projectionMatrix,z.matrixWorldInverse);k(ya);this.initWebGLObjects(l);w(t);(this.autoClear||
+m)&&this.clear();Q=l.__webglObjects.length;for(m=0;m<Q;m++){o=l.__webglObjects[m];O=o.object;if(O.visible)if(!(O instanceof THREE.Mesh)||n(O)){O.matrixWorld.flattenToArray(O._objectMatrixArray);y(O,z);u(o);o.render=!0;if(this.sortObjects){ma.copy(O.position);ya.multiplyVector3(ma);o.z=ma.z}}else o.render=!1;else o.render=!1}this.sortObjects&&l.__webglObjects.sort(q);H=l.__webglObjectsImmediate.length;for(m=0;m<H;m++){o=l.__webglObjectsImmediate[m];O=o.object;if(O.visible){O.matrixAutoUpdate&&O.matrixWorld.flattenToArray(O._objectMatrixArray);
+y(O,z);x(o)}}v(THREE.NormalBlending);for(m=0;m<Q;m++){o=l.__webglObjects[m];if(o.render){O=o.object;la=o.buffer;C=o.opaque;h(O);for(o=0;o<C.count;o++){G=C.list[o];j(G.depthTest);e(z,ka,ra,G,la,O)}}}for(m=0;m<H;m++){o=l.__webglObjectsImmediate[m];O=o.object;if(O.visible){C=o.opaque;h(O);for(o=0;o<C.count;o++){G=C.list[o];j(G.depthTest);B=d(z,ka,ra,G,O);O.render(function(sa){g(sa,B)})}}}for(m=0;m<Q;m++){o=l.__webglObjects[m];if(o.render){O=o.object;la=o.buffer;C=o.transparent;h(O);for(o=0;o<C.count;o++){G=
+C.list[o];v(G.blending);j(G.depthTest);e(z,ka,ra,G,la,O)}}}for(m=0;m<H;m++){o=l.__webglObjectsImmediate[m];O=o.object;if(O.visible){C=o.transparent;h(O);for(o=0;o<C.count;o++){G=C.list[o];v(G.blending);j(G.depthTest);B=d(z,ka,ra,G,O);O.render(function(sa){g(sa,B)})}}}if(t&&t.minFilter!==THREE.NearestFilter&&t.minFilter!==THREE.LinearFilter){f.bindTexture(f.TEXTURE_2D,t.__webGLTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,null)}};this.initWebGLObjects=function(l){if(!l.__webglObjects){l.__webglObjects=
+[];l.__webglObjectsImmediate=[]}for(;l.__objectsAdded.length;){var z=l.__objectsAdded[0],t=l,m=void 0,o=void 0,B=void 0;if(z._modelViewMatrix==undefined){z._modelViewMatrix=new THREE.Matrix4;z._normalMatrixArray=new Float32Array(9);z._modelViewMatrixArray=new Float32Array(16);z._objectMatrixArray=new Float32Array(16);z.matrixWorld.flattenToArray(z._objectMatrixArray)}if(z instanceof THREE.Mesh){o=z.geometry;o.geometryGroups==undefined&&A(o);for(m in o.geometryGroups){B=o.geometryGroups[m];if(!B.__webGLVertexBuffer){var C=
 B;C.__webGLVertexBuffer=f.createBuffer();C.__webGLNormalBuffer=f.createBuffer();C.__webGLTangentBuffer=f.createBuffer();C.__webGLColorBuffer=f.createBuffer();C.__webGLUVBuffer=f.createBuffer();C.__webGLUV2Buffer=f.createBuffer();C.__webGLSkinVertexABuffer=f.createBuffer();C.__webGLSkinVertexBBuffer=f.createBuffer();C.__webGLSkinIndicesBuffer=f.createBuffer();C.__webGLSkinWeightsBuffer=f.createBuffer();C.__webGLFaceBuffer=f.createBuffer();C.__webGLLineBuffer=f.createBuffer();C=B;var G=z,Q=void 0,H=
 void 0,O=0,la=0,ka=0,ra=G.geometry.faces,sa=C.faces;Q=0;for(H=sa.length;Q<H;Q++){fi=sa[Q];face=ra[fi];if(face instanceof THREE.Face3){O+=3;la+=1;ka+=3}else if(face instanceof THREE.Face4){O+=4;la+=2;ka+=4}}C.__vertexArray=new Float32Array(O*3);C.__normalArray=new Float32Array(O*3);C.__tangentArray=new Float32Array(O*4);C.__colorArray=new Float32Array(O*3);C.__uvArray=new Float32Array(O*2);C.__uv2Array=new Float32Array(O*2);C.__skinVertexAArray=new Float32Array(O*4);C.__skinVertexBArray=new Float32Array(O*
 4);C.__skinIndexArray=new Float32Array(O*4);C.__skinWeightArray=new Float32Array(O*4);C.__faceArray=new Uint16Array(la*3);C.__lineArray=new Uint16Array(ka*2);H=Q=C;O=void 0;ra=void 0;var oa=void 0,pa=void 0;oa=void 0;sa=!1;O=0;for(ra=G.materials.length;O<ra;O++){oa=G.materials[O];if(oa instanceof THREE.MeshFaceMaterial){oa=0;for(pa=H.materials.length;oa<pa;oa++)if(H.materials[oa]&&H.materials[oa].shading!=undefined&&H.materials[oa].shading==THREE.SmoothShading){sa=!0;break}}else if(oa&&oa.shading!=
-undefined&&oa.shading==THREE.SmoothShading){sa=!0;break}if(sa)break}Q.__needsSmoothNormals=sa;C.__webGLFaceCount=la*3;C.__webGLLineCount=ka*2;p.__dirtyVertices=!0;p.__dirtyElements=!0;p.__dirtyUvs=!0;p.__dirtyNormals=!0;p.__dirtyTangents=!0;p.__dirtyColors=!0}D(q.__webglObjects,B,z)}}else if(z instanceof THREE.Ribbon){p=z.geometry;if(!p.__webGLVertexBuffer){n=p;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=p;B=n.vertices.length;n.__vertexArray=new Float32Array(B*3);
-n.__colorArray=new Float32Array(B*3);n.__webGLVertexCount=B;p.__dirtyVertices=!0;p.__dirtyColors=!0}D(q.__webglObjects,p,z)}else if(z instanceof THREE.Line){p=z.geometry;if(!p.__webGLVertexBuffer){n=p;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=p;B=n.vertices.length;n.__vertexArray=new Float32Array(B*3);n.__colorArray=new Float32Array(B*3);n.__webGLLineCount=B;p.__dirtyVertices=!0;p.__dirtyColors=!0}D(q.__webglObjects,p,z)}else if(z instanceof THREE.ParticleSystem){p=
-z.geometry;if(!p.__webGLVertexBuffer){n=p;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=p;B=n.vertices.length;n.__vertexArray=new Float32Array(B*3);n.__colorArray=new Float32Array(B*3);n.__sortArray=[];n.__webGLParticleCount=B;p.__dirtyVertices=!0;p.__dirtyColors=!0}D(q.__webglObjects,p,z)}else THREE.MarchingCubes!==undefined&&z instanceof THREE.MarchingCubes&&q.__webglObjectsImmediate.push({object:z,opaque:{list:[],count:0},transparent:{list:[],count:0}});m.__objectsAdded.splice(0,
-1)}for(;m.__objectsRemoved.length;){z=m.__objectsRemoved[0];q=m;p=void 0;n=void 0;for(p=q.__webglObjects.length-1;p>=0;p--){n=q.__webglObjects[p].object;z==n&&q.__webglObjects.splice(p,1)}m.__objectsRemoved.splice(0,1)}z=0;for(q=m.__webglObjects.length;z<q;z++){n=m.__webglObjects[z].object;B=void 0;p=void 0;C=void 0;if(n instanceof THREE.Mesh){p=n.geometry;for(B in p.geometryGroups){C=p.geometryGroups[B];if(p.__dirtyVertices||p.__dirtyElements||p.__dirtyUvs||p.__dirtyNormals||p.__dirtyColors||p.__dirtyTangents){la=
-f.DYNAMIC_DRAW;ka=void 0;Q=void 0;var Ja=void 0,P=void 0,Ga=void 0,Ea=void 0,Fa=void 0;Ja=void 0;var W=void 0,X=void 0,$=void 0,Aa=void 0;W=void 0;X=void 0;$=void 0;P=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;W=void 0;X=void 0;$=void 0;Aa=void 0;P=void 0;Ea=void 0;Ga=void 0;Fa=void 0;var Ha=pa=oa=sa=ra=O=G=H=0,Da=0,E=0,Ca=C.__vertexArray,Ra=C.__uvArray,Ua=C.__uv2Array,Ma=C.__normalArray,
-Ba=C.__tangentArray,J=C.__colorArray,Y=C.__skinVertexAArray,U=C.__skinVertexBArray,K=C.__skinIndexArray,S=C.__skinWeightArray,ua=C.__faceArray,wa=C.__lineArray,Ia=C.__needsSmoothNormals,za=n.geometry,Pa=za.__dirtyVertices,Ka=za.__dirtyElements,La=za.__dirtyUvs,Ta=za.__dirtyNormals,Na=za.__dirtyTangents,Qa=za.__dirtyColors,Oa=za.vertices,Za=C.faces,$a=za.faces,ab=za.uvs,bb=za.uvs2,Sa=za.colors,Wa=za.skinVerticesA,Xa=za.skinVerticesB,Ya=za.skinIndices,Va=za.skinWeights;ka=0;for(Q=Za.length;ka<Q;ka++){Ja=
-Za[ka];P=$a[Ja];Fa=ab[Ja];Ja=bb[Ja];Ga=P.vertexNormals;Ea=P.normal;if(P instanceof THREE.Face3){if(Pa){W=Oa[P.a].position;X=Oa[P.b].position;$=Oa[P.c].position;Ca[G]=W.x;Ca[G+1]=W.y;Ca[G+2]=W.z;Ca[G+3]=X.x;Ca[G+4]=X.y;Ca[G+5]=X.z;Ca[G+6]=$.x;Ca[G+7]=$.y;Ca[G+8]=$.z;G+=9}if(Va.length){W=Va[P.a];X=Va[P.b];$=Va[P.c];S[E]=W.x;S[E+1]=W.y;S[E+2]=W.z;S[E+3]=W.w;S[E+4]=X.x;S[E+5]=X.y;S[E+6]=X.z;S[E+7]=X.w;S[E+8]=$.x;S[E+9]=$.y;S[E+10]=$.z;S[E+11]=$.w;W=Ya[P.a];X=Ya[P.b];$=Ya[P.c];K[E]=W.x;K[E+1]=W.y;K[E+
-2]=W.z;K[E+3]=W.w;K[E+4]=X.x;K[E+5]=X.y;K[E+6]=X.z;K[E+7]=X.w;K[E+8]=$.x;K[E+9]=$.y;K[E+10]=$.z;K[E+11]=$.w;W=Wa[P.a];X=Wa[P.b];$=Wa[P.c];Y[E]=W.x;Y[E+1]=W.y;Y[E+2]=W.z;Y[E+3]=1;Y[E+4]=X.x;Y[E+5]=X.y;Y[E+6]=X.z;Y[E+7]=1;Y[E+8]=$.x;Y[E+9]=$.y;Y[E+10]=$.z;Y[E+11]=1;W=Xa[P.a];X=Xa[P.b];$=Xa[P.c];U[E]=W.x;U[E+1]=W.y;U[E+2]=W.z;U[E+3]=1;U[E+4]=X.x;U[E+5]=X.y;U[E+6]=X.z;U[E+7]=1;U[E+8]=$.x;U[E+9]=$.y;U[E+10]=$.z;U[E+11]=1;E+=12}if(Qa&&Sa.length){W=Sa[P.a];X=Sa[P.b];$=Sa[P.c];J[Da]=W.r;J[Da+1]=W.g;J[Da+
-2]=W.b;J[Da+3]=X.r;J[Da+4]=X.g;J[Da+5]=X.b;J[Da+6]=$.r;J[Da+7]=$.g;J[Da+8]=$.b;Da+=9}if(Na&&za.hasTangents){W=Oa[P.a].tangent;X=Oa[P.b].tangent;$=Oa[P.c].tangent;Ba[pa]=W.x;Ba[pa+1]=W.y;Ba[pa+2]=W.z;Ba[pa+3]=W.w;Ba[pa+4]=X.x;Ba[pa+5]=X.y;Ba[pa+6]=X.z;Ba[pa+7]=X.w;Ba[pa+8]=$.x;Ba[pa+9]=$.y;Ba[pa+10]=$.z;Ba[pa+11]=$.w;pa+=12}if(Ta)if(Ga.length==3&&Ia)for(P=0;P<3;P++){Ea=Ga[P];Ma[oa]=Ea.x;Ma[oa+1]=Ea.y;Ma[oa+2]=Ea.z;oa+=3}else for(P=0;P<3;P++){Ma[oa]=Ea.x;Ma[oa+1]=Ea.y;Ma[oa+2]=Ea.z;oa+=3}if(La&&Fa)for(P=
-0;P<3;P++){Ga=Fa[P];Ra[O]=Ga.u;Ra[O+1]=Ga.v;O+=2}if(La&&Ja)for(P=0;P<3;P++){Fa=Ja[P];Ua[ra]=Fa.u;Ua[ra+1]=Fa.v;ra+=2}if(Ka){ua[sa]=H;ua[sa+1]=H+1;ua[sa+2]=H+2;sa+=3;wa[Ha]=H;wa[Ha+1]=H+1;wa[Ha+2]=H;wa[Ha+3]=H+2;wa[Ha+4]=H+1;wa[Ha+5]=H+2;Ha+=6;H+=3}}else if(P instanceof THREE.Face4){if(Pa){W=Oa[P.a].position;X=Oa[P.b].position;$=Oa[P.c].position;Aa=Oa[P.d].position;Ca[G]=W.x;Ca[G+1]=W.y;Ca[G+2]=W.z;Ca[G+3]=X.x;Ca[G+4]=X.y;Ca[G+5]=X.z;Ca[G+6]=$.x;Ca[G+7]=$.y;Ca[G+8]=$.z;Ca[G+9]=Aa.x;Ca[G+10]=Aa.y;Ca[G+
-11]=Aa.z;G+=12}if(Va.length){W=Va[P.a];X=Va[P.b];$=Va[P.c];Aa=Va[P.d];S[E]=W.x;S[E+1]=W.y;S[E+2]=W.z;S[E+3]=W.w;S[E+4]=X.x;S[E+5]=X.y;S[E+6]=X.z;S[E+7]=X.w;S[E+8]=$.x;S[E+9]=$.y;S[E+10]=$.z;S[E+11]=$.w;S[E+12]=Aa.x;S[E+13]=Aa.y;S[E+14]=Aa.z;S[E+15]=Aa.w;W=Ya[P.a];X=Ya[P.b];$=Ya[P.c];Aa=Ya[P.d];K[E]=W.x;K[E+1]=W.y;K[E+2]=W.z;K[E+3]=W.w;K[E+4]=X.x;K[E+5]=X.y;K[E+6]=X.z;K[E+7]=X.w;K[E+8]=$.x;K[E+9]=$.y;K[E+10]=$.z;K[E+11]=$.w;K[E+12]=Aa.x;K[E+13]=Aa.y;K[E+14]=Aa.z;K[E+15]=Aa.w;W=Wa[P.a];X=Wa[P.b];$=
-Wa[P.c];Aa=Wa[P.d];Y[E]=W.x;Y[E+1]=W.y;Y[E+2]=W.z;Y[E+3]=1;Y[E+4]=X.x;Y[E+5]=X.y;Y[E+6]=X.z;Y[E+7]=1;Y[E+8]=$.x;Y[E+9]=$.y;Y[E+10]=$.z;Y[E+11]=1;Y[E+12]=Aa.x;Y[E+13]=Aa.y;Y[E+14]=Aa.z;Y[E+15]=1;W=Xa[P.a];X=Xa[P.b];$=Xa[P.c];Aa=Xa[P.d];U[E]=W.x;U[E+1]=W.y;U[E+2]=W.z;U[E+3]=1;U[E+4]=X.x;U[E+5]=X.y;U[E+6]=X.z;U[E+7]=1;U[E+8]=$.x;U[E+9]=$.y;U[E+10]=$.z;U[E+11]=1;U[E+12]=Aa.x;U[E+13]=Aa.y;U[E+14]=Aa.z;U[E+15]=1;E+=16}if(Qa&&Sa.length){W=Sa[P.a];X=Sa[P.b];$=Sa[P.c];Aa=Sa[P.d];J[Da]=W.r;J[Da+1]=W.g;J[Da+
-2]=W.b;J[Da+3]=X.r;J[Da+4]=X.g;J[Da+5]=X.b;J[Da+6]=$.r;J[Da+7]=$.g;J[Da+8]=$.b;J[Da+9]=Aa.r;J[Da+10]=Aa.g;J[Da+11]=Aa.b;Da+=12}if(Na&&za.hasTangents){W=Oa[P.a].tangent;X=Oa[P.b].tangent;$=Oa[P.c].tangent;P=Oa[P.d].tangent;Ba[pa]=W.x;Ba[pa+1]=W.y;Ba[pa+2]=W.z;Ba[pa+3]=W.w;Ba[pa+4]=X.x;Ba[pa+5]=X.y;Ba[pa+6]=X.z;Ba[pa+7]=X.w;Ba[pa+8]=$.x;Ba[pa+9]=$.y;Ba[pa+10]=$.z;Ba[pa+11]=$.w;Ba[pa+12]=P.x;Ba[pa+13]=P.y;Ba[pa+14]=P.z;Ba[pa+15]=P.w;pa+=16}if(Ta)if(Ga.length==4&&Ia)for(P=0;P<4;P++){Ea=Ga[P];Ma[oa]=Ea.x;
+undefined&&oa.shading==THREE.SmoothShading){sa=!0;break}if(sa)break}Q.__needsSmoothNormals=sa;C.__webGLFaceCount=la*3;C.__webGLLineCount=ka*2;o.__dirtyVertices=!0;o.__dirtyElements=!0;o.__dirtyUvs=!0;o.__dirtyNormals=!0;o.__dirtyTangents=!0;o.__dirtyColors=!0}F(t.__webglObjects,B,z)}}else if(z instanceof THREE.Ribbon){o=z.geometry;if(!o.__webGLVertexBuffer){m=o;m.__webGLVertexBuffer=f.createBuffer();m.__webGLColorBuffer=f.createBuffer();m=o;B=m.vertices.length;m.__vertexArray=new Float32Array(B*3);
+m.__colorArray=new Float32Array(B*3);m.__webGLVertexCount=B;o.__dirtyVertices=!0;o.__dirtyColors=!0}F(t.__webglObjects,o,z)}else if(z instanceof THREE.Line){o=z.geometry;if(!o.__webGLVertexBuffer){m=o;m.__webGLVertexBuffer=f.createBuffer();m.__webGLColorBuffer=f.createBuffer();m=o;B=m.vertices.length;m.__vertexArray=new Float32Array(B*3);m.__colorArray=new Float32Array(B*3);m.__webGLLineCount=B;o.__dirtyVertices=!0;o.__dirtyColors=!0}F(t.__webglObjects,o,z)}else if(z instanceof THREE.ParticleSystem){o=
+z.geometry;if(!o.__webGLVertexBuffer){m=o;m.__webGLVertexBuffer=f.createBuffer();m.__webGLColorBuffer=f.createBuffer();m=o;B=m.vertices.length;m.__vertexArray=new Float32Array(B*3);m.__colorArray=new Float32Array(B*3);m.__sortArray=[];m.__webGLParticleCount=B;o.__dirtyVertices=!0;o.__dirtyColors=!0}F(t.__webglObjects,o,z)}else THREE.MarchingCubes!==undefined&&z instanceof THREE.MarchingCubes&&t.__webglObjectsImmediate.push({object:z,opaque:{list:[],count:0},transparent:{list:[],count:0}});l.__objectsAdded.splice(0,
+1)}for(;l.__objectsRemoved.length;){z=l.__objectsRemoved[0];t=l;o=void 0;m=void 0;for(o=t.__webglObjects.length-1;o>=0;o--){m=t.__webglObjects[o].object;z==m&&t.__webglObjects.splice(o,1)}l.__objectsRemoved.splice(0,1)}z=0;for(t=l.__webglObjects.length;z<t;z++){m=l.__webglObjects[z].object;B=void 0;o=void 0;C=void 0;if(m instanceof THREE.Mesh){o=m.geometry;for(B in o.geometryGroups){C=o.geometryGroups[B];if(o.__dirtyVertices||o.__dirtyElements||o.__dirtyUvs||o.__dirtyNormals||o.__dirtyColors||o.__dirtyTangents){la=
+f.DYNAMIC_DRAW;ka=void 0;Q=void 0;var Ja=void 0,P=void 0,Ga=void 0,Ea=void 0,Fa=void 0;Ja=void 0;var X=void 0,Y=void 0,$=void 0,Aa=void 0;X=void 0;Y=void 0;$=void 0;P=void 0;X=void 0;Y=void 0;$=void 0;Aa=void 0;X=void 0;Y=void 0;$=void 0;Aa=void 0;X=void 0;Y=void 0;$=void 0;Aa=void 0;X=void 0;Y=void 0;$=void 0;Aa=void 0;X=void 0;Y=void 0;$=void 0;Aa=void 0;P=void 0;Ea=void 0;Ga=void 0;Fa=void 0;var Ha=pa=oa=sa=ra=O=G=H=0,Da=0,E=0,Ca=C.__vertexArray,Ra=C.__uvArray,Ua=C.__uv2Array,Ma=C.__normalArray,
+Ba=C.__tangentArray,J=C.__colorArray,Z=C.__skinVertexAArray,U=C.__skinVertexBArray,L=C.__skinIndexArray,S=C.__skinWeightArray,ua=C.__faceArray,wa=C.__lineArray,Ia=C.__needsSmoothNormals,za=m.geometry,Pa=za.__dirtyVertices,Ka=za.__dirtyElements,La=za.__dirtyUvs,Ta=za.__dirtyNormals,Na=za.__dirtyTangents,Qa=za.__dirtyColors,Oa=za.vertices,Za=C.faces,$a=za.faces,ab=za.uvs,bb=za.uvs2,Sa=za.colors,Wa=za.skinVerticesA,Xa=za.skinVerticesB,Ya=za.skinIndices,Va=za.skinWeights;ka=0;for(Q=Za.length;ka<Q;ka++){Ja=
+Za[ka];P=$a[Ja];Fa=ab[Ja];Ja=bb[Ja];Ga=P.vertexNormals;Ea=P.normal;if(P instanceof THREE.Face3){if(Pa){X=Oa[P.a].position;Y=Oa[P.b].position;$=Oa[P.c].position;Ca[G]=X.x;Ca[G+1]=X.y;Ca[G+2]=X.z;Ca[G+3]=Y.x;Ca[G+4]=Y.y;Ca[G+5]=Y.z;Ca[G+6]=$.x;Ca[G+7]=$.y;Ca[G+8]=$.z;G+=9}if(Va.length){X=Va[P.a];Y=Va[P.b];$=Va[P.c];S[E]=X.x;S[E+1]=X.y;S[E+2]=X.z;S[E+3]=X.w;S[E+4]=Y.x;S[E+5]=Y.y;S[E+6]=Y.z;S[E+7]=Y.w;S[E+8]=$.x;S[E+9]=$.y;S[E+10]=$.z;S[E+11]=$.w;X=Ya[P.a];Y=Ya[P.b];$=Ya[P.c];L[E]=X.x;L[E+1]=X.y;L[E+
+2]=X.z;L[E+3]=X.w;L[E+4]=Y.x;L[E+5]=Y.y;L[E+6]=Y.z;L[E+7]=Y.w;L[E+8]=$.x;L[E+9]=$.y;L[E+10]=$.z;L[E+11]=$.w;X=Wa[P.a];Y=Wa[P.b];$=Wa[P.c];Z[E]=X.x;Z[E+1]=X.y;Z[E+2]=X.z;Z[E+3]=1;Z[E+4]=Y.x;Z[E+5]=Y.y;Z[E+6]=Y.z;Z[E+7]=1;Z[E+8]=$.x;Z[E+9]=$.y;Z[E+10]=$.z;Z[E+11]=1;X=Xa[P.a];Y=Xa[P.b];$=Xa[P.c];U[E]=X.x;U[E+1]=X.y;U[E+2]=X.z;U[E+3]=1;U[E+4]=Y.x;U[E+5]=Y.y;U[E+6]=Y.z;U[E+7]=1;U[E+8]=$.x;U[E+9]=$.y;U[E+10]=$.z;U[E+11]=1;E+=12}if(Qa&&Sa.length){X=Sa[P.a];Y=Sa[P.b];$=Sa[P.c];J[Da]=X.r;J[Da+1]=X.g;J[Da+
+2]=X.b;J[Da+3]=Y.r;J[Da+4]=Y.g;J[Da+5]=Y.b;J[Da+6]=$.r;J[Da+7]=$.g;J[Da+8]=$.b;Da+=9}if(Na&&za.hasTangents){X=Oa[P.a].tangent;Y=Oa[P.b].tangent;$=Oa[P.c].tangent;Ba[pa]=X.x;Ba[pa+1]=X.y;Ba[pa+2]=X.z;Ba[pa+3]=X.w;Ba[pa+4]=Y.x;Ba[pa+5]=Y.y;Ba[pa+6]=Y.z;Ba[pa+7]=Y.w;Ba[pa+8]=$.x;Ba[pa+9]=$.y;Ba[pa+10]=$.z;Ba[pa+11]=$.w;pa+=12}if(Ta)if(Ga.length==3&&Ia)for(P=0;P<3;P++){Ea=Ga[P];Ma[oa]=Ea.x;Ma[oa+1]=Ea.y;Ma[oa+2]=Ea.z;oa+=3}else for(P=0;P<3;P++){Ma[oa]=Ea.x;Ma[oa+1]=Ea.y;Ma[oa+2]=Ea.z;oa+=3}if(La&&Fa)for(P=
+0;P<3;P++){Ga=Fa[P];Ra[O]=Ga.u;Ra[O+1]=Ga.v;O+=2}if(La&&Ja)for(P=0;P<3;P++){Fa=Ja[P];Ua[ra]=Fa.u;Ua[ra+1]=Fa.v;ra+=2}if(Ka){ua[sa]=H;ua[sa+1]=H+1;ua[sa+2]=H+2;sa+=3;wa[Ha]=H;wa[Ha+1]=H+1;wa[Ha+2]=H;wa[Ha+3]=H+2;wa[Ha+4]=H+1;wa[Ha+5]=H+2;Ha+=6;H+=3}}else if(P instanceof THREE.Face4){if(Pa){X=Oa[P.a].position;Y=Oa[P.b].position;$=Oa[P.c].position;Aa=Oa[P.d].position;Ca[G]=X.x;Ca[G+1]=X.y;Ca[G+2]=X.z;Ca[G+3]=Y.x;Ca[G+4]=Y.y;Ca[G+5]=Y.z;Ca[G+6]=$.x;Ca[G+7]=$.y;Ca[G+8]=$.z;Ca[G+9]=Aa.x;Ca[G+10]=Aa.y;Ca[G+
+11]=Aa.z;G+=12}if(Va.length){X=Va[P.a];Y=Va[P.b];$=Va[P.c];Aa=Va[P.d];S[E]=X.x;S[E+1]=X.y;S[E+2]=X.z;S[E+3]=X.w;S[E+4]=Y.x;S[E+5]=Y.y;S[E+6]=Y.z;S[E+7]=Y.w;S[E+8]=$.x;S[E+9]=$.y;S[E+10]=$.z;S[E+11]=$.w;S[E+12]=Aa.x;S[E+13]=Aa.y;S[E+14]=Aa.z;S[E+15]=Aa.w;X=Ya[P.a];Y=Ya[P.b];$=Ya[P.c];Aa=Ya[P.d];L[E]=X.x;L[E+1]=X.y;L[E+2]=X.z;L[E+3]=X.w;L[E+4]=Y.x;L[E+5]=Y.y;L[E+6]=Y.z;L[E+7]=Y.w;L[E+8]=$.x;L[E+9]=$.y;L[E+10]=$.z;L[E+11]=$.w;L[E+12]=Aa.x;L[E+13]=Aa.y;L[E+14]=Aa.z;L[E+15]=Aa.w;X=Wa[P.a];Y=Wa[P.b];$=
+Wa[P.c];Aa=Wa[P.d];Z[E]=X.x;Z[E+1]=X.y;Z[E+2]=X.z;Z[E+3]=1;Z[E+4]=Y.x;Z[E+5]=Y.y;Z[E+6]=Y.z;Z[E+7]=1;Z[E+8]=$.x;Z[E+9]=$.y;Z[E+10]=$.z;Z[E+11]=1;Z[E+12]=Aa.x;Z[E+13]=Aa.y;Z[E+14]=Aa.z;Z[E+15]=1;X=Xa[P.a];Y=Xa[P.b];$=Xa[P.c];Aa=Xa[P.d];U[E]=X.x;U[E+1]=X.y;U[E+2]=X.z;U[E+3]=1;U[E+4]=Y.x;U[E+5]=Y.y;U[E+6]=Y.z;U[E+7]=1;U[E+8]=$.x;U[E+9]=$.y;U[E+10]=$.z;U[E+11]=1;U[E+12]=Aa.x;U[E+13]=Aa.y;U[E+14]=Aa.z;U[E+15]=1;E+=16}if(Qa&&Sa.length){X=Sa[P.a];Y=Sa[P.b];$=Sa[P.c];Aa=Sa[P.d];J[Da]=X.r;J[Da+1]=X.g;J[Da+
+2]=X.b;J[Da+3]=Y.r;J[Da+4]=Y.g;J[Da+5]=Y.b;J[Da+6]=$.r;J[Da+7]=$.g;J[Da+8]=$.b;J[Da+9]=Aa.r;J[Da+10]=Aa.g;J[Da+11]=Aa.b;Da+=12}if(Na&&za.hasTangents){X=Oa[P.a].tangent;Y=Oa[P.b].tangent;$=Oa[P.c].tangent;P=Oa[P.d].tangent;Ba[pa]=X.x;Ba[pa+1]=X.y;Ba[pa+2]=X.z;Ba[pa+3]=X.w;Ba[pa+4]=Y.x;Ba[pa+5]=Y.y;Ba[pa+6]=Y.z;Ba[pa+7]=Y.w;Ba[pa+8]=$.x;Ba[pa+9]=$.y;Ba[pa+10]=$.z;Ba[pa+11]=$.w;Ba[pa+12]=P.x;Ba[pa+13]=P.y;Ba[pa+14]=P.z;Ba[pa+15]=P.w;pa+=16}if(Ta)if(Ga.length==4&&Ia)for(P=0;P<4;P++){Ea=Ga[P];Ma[oa]=Ea.x;
 Ma[oa+1]=Ea.y;Ma[oa+2]=Ea.z;oa+=3}else for(P=0;P<4;P++){Ma[oa]=Ea.x;Ma[oa+1]=Ea.y;Ma[oa+2]=Ea.z;oa+=3}if(La&&Fa)for(P=0;P<4;P++){Ga=Fa[P];Ra[O]=Ga.u;Ra[O+1]=Ga.v;O+=2}if(La&&Ja)for(P=0;P<4;P++){Fa=Ja[P];Ua[ra]=Fa.u;Ua[ra+1]=Fa.v;ra+=2}if(Ka){ua[sa]=H;ua[sa+1]=H+1;ua[sa+2]=H+2;ua[sa+3]=H;ua[sa+4]=H+2;ua[sa+5]=H+3;sa+=6;wa[Ha]=H;wa[Ha+1]=H+1;wa[Ha+2]=H;wa[Ha+3]=H+3;wa[Ha+4]=H+1;wa[Ha+5]=H+2;wa[Ha+6]=H+2;wa[Ha+7]=H+3;Ha+=8;H+=4}}}if(Pa){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,
 Ca,la)}if(Qa&&Sa.length){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,J,la)}if(Ta){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,Ma,la)}if(Na&&za.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,Ba,la)}if(La&&O>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,Ra,la)}if(La&&ra>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,Ua,la)}if(Ka){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,
-C.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,ua,la);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,wa,la)}if(E>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,Y,la);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,U,la);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,K,la);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,
-S,la)}}}p.__dirtyVertices=!1;p.__dirtyElements=!1;p.__dirtyUvs=!1;p.__dirtyNormals=!1;p.__dirtyTangents=!1;p.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){p=n.geometry;if(p.__dirtyVertices||p.__dirtyColors){n=p;B=f.DYNAMIC_DRAW;H=void 0;H=void 0;G=void 0;C=void 0;O=n.vertices;la=n.colors;ra=O.length;ka=la.length;sa=n.__vertexArray;Q=n.__colorArray;oa=n.__dirtyColors;if(n.__dirtyVertices){for(H=0;H<ra;H++){G=O[H].position;C=H*3;sa[C]=G.x;sa[C+1]=G.y;sa[C+2]=G.z}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);
-f.bufferData(f.ARRAY_BUFFER,sa,B)}if(oa){for(H=0;H<ka;H++){color=la[H];C=H*3;Q[C]=color.r;Q[C+1]=color.g;Q[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Q,B)}}p.__dirtyVertices=!1;p.__dirtyColors=!1}else if(n instanceof THREE.Line){p=n.geometry;if(p.__dirtyVertices||p.__dirtyColors){n=p;B=f.DYNAMIC_DRAW;H=void 0;H=void 0;G=void 0;C=void 0;O=n.vertices;la=n.colors;ra=O.length;ka=la.length;sa=n.__vertexArray;Q=n.__colorArray;oa=n.__dirtyColors;if(n.__dirtyVertices){for(H=
-0;H<ra;H++){G=O[H].position;C=H*3;sa[C]=G.x;sa[C+1]=G.y;sa[C+2]=G.z}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,sa,B)}if(oa){for(H=0;H<ka;H++){color=la[H];C=H*3;Q[C]=color.r;Q[C+1]=color.g;Q[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Q,B)}}p.__dirtyVertices=!1;p.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){p=n.geometry;(p.__dirtyVertices||p.__dirtyColors||n.sortParticles)&&c(p,f.DYNAMIC_DRAW,n);p.__dirtyVertices=
-!1;p.__dirtyColors=!1}}};this.setFaceCulling=function(m,z){if(m){!z||z=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW);if(m=="back")f.cullFace(f.BACK);else m=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};this.supportsVertexTextures=function(){return f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+C.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,ua,la);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,wa,la)}if(E>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,Z,la);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,U,la);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,L,la);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,
+S,la)}}}o.__dirtyVertices=!1;o.__dirtyElements=!1;o.__dirtyUvs=!1;o.__dirtyNormals=!1;o.__dirtyTangents=!1;o.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){o=m.geometry;if(o.__dirtyVertices||o.__dirtyColors){m=o;B=f.DYNAMIC_DRAW;H=void 0;H=void 0;G=void 0;C=void 0;O=m.vertices;la=m.colors;ra=O.length;ka=la.length;sa=m.__vertexArray;Q=m.__colorArray;oa=m.__dirtyColors;if(m.__dirtyVertices){for(H=0;H<ra;H++){G=O[H].position;C=H*3;sa[C]=G.x;sa[C+1]=G.y;sa[C+2]=G.z}f.bindBuffer(f.ARRAY_BUFFER,m.__webGLVertexBuffer);
+f.bufferData(f.ARRAY_BUFFER,sa,B)}if(oa){for(H=0;H<ka;H++){color=la[H];C=H*3;Q[C]=color.r;Q[C+1]=color.g;Q[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,m.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Q,B)}}o.__dirtyVertices=!1;o.__dirtyColors=!1}else if(m instanceof THREE.Line){o=m.geometry;if(o.__dirtyVertices||o.__dirtyColors){m=o;B=f.DYNAMIC_DRAW;H=void 0;H=void 0;G=void 0;C=void 0;O=m.vertices;la=m.colors;ra=O.length;ka=la.length;sa=m.__vertexArray;Q=m.__colorArray;oa=m.__dirtyColors;if(m.__dirtyVertices){for(H=
+0;H<ra;H++){G=O[H].position;C=H*3;sa[C]=G.x;sa[C+1]=G.y;sa[C+2]=G.z}f.bindBuffer(f.ARRAY_BUFFER,m.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,sa,B)}if(oa){for(H=0;H<ka;H++){color=la[H];C=H*3;Q[C]=color.r;Q[C+1]=color.g;Q[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,m.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Q,B)}}o.__dirtyVertices=!1;o.__dirtyColors=!1}else if(m instanceof THREE.ParticleSystem){o=m.geometry;(o.__dirtyVertices||o.__dirtyColors||m.sortParticles)&&c(o,f.DYNAMIC_DRAW,m);o.__dirtyVertices=
+!1;o.__dirtyColors=!1}}};this.setFaceCulling=function(l,z){if(l){!z||z=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW);if(l=="back")f.cullFace(f.BACK);else l=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};this.supportsVertexTextures=function(){return f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,e=b.length;for(d=0;d<e;d++){a=b[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
-var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,e=b?c.geometry:c,g=a.vertices,h=e.vertices,j=a.faces,k=e.faces,l=a.uvs;e=e.uvs;b&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,v=h.length;o<v;o++){var u=new THREE.Vertex(h[o].position.clone());b&&c.matrix.multiplyVector3(u.position);g.push(u)}o=0;for(v=k.length;o<v;o++){h=k[o];var t,y=h.vertexNormals;if(h instanceof THREE.Face3)t=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+
-d,h.b+d,h.c+d,h.d+d));t.centroid.copy(h.centroid);t.normal.copy(h.normal);b=0;for(g=y.length;b<g;b++){u=y[b];t.vertexNormals.push(u.clone())}t.materials=h.materials.slice();j.push(t)}o=0;for(v=e.length;o<v;o++){d=e[o];j=[];b=0;for(g=d.length;b<g;b++)j.push(new THREE.UV(d[b].u,d[b].v));l.push(j)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,e=new THREE.Texture(d,c);d.onload=function(){e.needsUpdate=!0;b&&b(this)};d.src=a;return e},loadTextureCube:function(a,c,b){var d,e=[],g=new THREE.Texture(e,
-c);c=e.loadCount=0;for(d=a.length;c<d;++c){e[c]=new Image;e[c].onload=function(){e.loadCount+=1;if(e.loadCount==6)g.needsUpdate=!0;b&&b(this)};e[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(e){function g(){for(o in M.objects)if(!I.objects[o]){A=M.objects[o];if(x=I.geometries[A.geometry]){Z=[];for(i=0;i<A.materials.length;i++)Z[i]=I.materials[A.materials[i]];D=A.position;r=A.rotation;s=A.scale;object=new THREE.Mesh(x,Z);object.position.set(D[0],
-D[1],D[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;I.scene.addObject(object);I.objects[o]=object}}}function h(ca){return function(xa){I.geometries[ca]=xa;g();V-=1;j()}}function j(){d({total_models:da,total_textures:fa,loaded_models:da-V,loaded_textures:fa-T},I);V==0&&T==0&&b(I)}var k,l,o,v,u,t,y,A,D,w,F,x,N,L,Z,M,f,V,T,da,fa,I;M=e.data;f=new THREE.Loader;T=V=0;I={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
-lights:{},fogs:{}};e=function(){T-=1;j()};for(u in M.cameras){w=M.cameras[u];if(w.type=="perspective")N=new THREE.Camera(w.fov,w.aspect,w.near,w.far);else if(w.type=="ortho"){N=new THREE.Camera;N.projectionMatrix=THREE.Matrix4.makeOrtho(w.left,w.right,w.top,w.bottom,w.near,w.far)}D=w.position;w=w.target;N.position.set(D[0],D[1],D[2]);N.target.position.set(w[0],w[1],w[2]);I.cameras[u]=N}for(v in M.lights){u=M.lights[v];if(u.type=="directional"){D=u.direction;light=new THREE.DirectionalLight;light.position.set(D[0],
-D[1],D[2]);light.position.normalize()}else if(u.type=="point"){D=u.position;light=new THREE.PointLight;light.position.set(D[0],D[1],D[2])}w=u.color;i=u.intensity||1;light.color.setRGB(w[0]*i,w[1]*i,w[2]*i);I.scene.addLight(light);I.lights[v]=light}for(t in M.fogs){v=M.fogs[t];if(v.type=="linear")L=new THREE.Fog(0,v.near,v.far);else v.type=="exp2"&&(L=new THREE.FogExp2(0,v.density));w=v.color;L.color.setRGB(w[0],w[1],w[2]);I.fogs[t]=L}if(I.cameras&&M.defaults.camera)I.currentCamera=I.cameras[M.defaults.camera];
-if(I.fogs&&M.defaults.fog)I.scene.fog=I.fogs[M.defaults.fog];w=M.defaults.bgcolor;I.bgColor=new THREE.Color;I.bgColor.setRGB(w[0],w[1],w[2]);I.bgColorAlpha=M.defaults.bgalpha;for(k in M.geometries){t=M.geometries[k];if(t.type=="bin_mesh"||t.type=="ascii_mesh")V+=1}da=V;for(k in M.geometries){t=M.geometries[k];if(t.type=="cube"){x=new Cube(t.width,t.height,t.depth,t.segmentsWidth,t.segmentsHeight,t.segmentsDepth,null,t.flipped,t.sides);I.geometries[k]=x}else if(t.type=="plane"){x=new Plane(t.width,
-t.height,t.segmentsWidth,t.segmentsHeight);I.geometries[k]=x}else if(t.type=="sphere"){x=new Sphere(t.radius,t.segmentsWidth,t.segmentsHeight);I.geometries[k]=x}else if(t.type=="cylinder"){x=new Cylinder(t.numSegs,t.topRad,t.botRad,t.height,t.topOffset,t.botOffset);I.geometries[k]=x}else if(t.type=="torus"){x=new Torus(t.radius,t.tube,t.segmentsR,t.segmentsT);I.geometries[k]=x}else if(t.type=="icosahedron"){x=new Icosahedron(t.subdivisions);I.geometries[k]=x}else if(t.type=="bin_mesh")f.loadBinary({model:t.url,
-callback:h(k)});else t.type=="ascii_mesh"&&f.loadAscii({model:t.url,callback:h(k)})}for(y in M.textures){k=M.textures[y];T+=k.url instanceof Array?k.url.length:1}fa=T;for(y in M.textures){k=M.textures[y];if(k.mapping!=undefined&&THREE[k.mapping]!=undefined)k.mapping=new THREE[k.mapping];if(k.url instanceof Array)t=ImageUtils.loadTextureCube(k.url,k.mapping,e);else{t=ImageUtils.loadTexture(k.url,k.mapping,e);if(THREE[k.minFilter]!=undefined)t.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=undefined)t.magFilter=
-THREE[k.magFilter]}I.textures[y]=t}for(l in M.materials){y=M.materials[l];for(F in y.parameters)if(F=="envMap"||F=="map"||F=="lightMap")y.parameters[F]=I.textures[y.parameters[F]];else if(F=="shading")y.parameters[F]=y.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")y.parameters[F]=THREE[y.parameters[F]]?THREE[y.parameters[F]]:THREE.NormalBlending;else F=="combine"&&(y.parameters[F]=y.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);y=new THREE[y.type](y.parameters);
-I.materials[l]=y}g();c(I)}},addMesh:function(a,c,b,d,e,g,h,j,k,l){c=new THREE.Mesh(c,l);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=e;c.position.z=g;c.rotation.x=h;c.rotation.y=j;c.rotation.z=k;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);
+var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,e=b?c.geometry:c,g=a.vertices,h=e.vertices,j=a.faces,k=e.faces,n=a.uvs;e=e.uvs;b&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,x=h.length;p<x;p++){var u=new THREE.Vertex(h[p].position.clone());b&&c.matrix.multiplyVector3(u.position);g.push(u)}p=0;for(x=k.length;p<x;p++){h=k[p];var q,y=h.vertexNormals;if(h instanceof THREE.Face3)q=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(q=new THREE.Face4(h.a+
+d,h.b+d,h.c+d,h.d+d));q.centroid.copy(h.centroid);q.normal.copy(h.normal);b=0;for(g=y.length;b<g;b++){u=y[b];q.vertexNormals.push(u.clone())}q.materials=h.materials.slice();j.push(q)}p=0;for(x=e.length;p<x;p++){d=e[p];j=[];b=0;for(g=d.length;b<g;b++)j.push(new THREE.UV(d[b].u,d[b].v));n.push(j)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,e=new THREE.Texture(d,c);d.onload=function(){e.needsUpdate=!0;b&&b(this)};d.src=a;return e},loadTextureCube:function(a,c,b){var d,e=[],g=new THREE.Texture(e,
+c);c=e.loadCount=0;for(d=a.length;c<d;++c){e[c]=new Image;e[c].onload=function(){e.loadCount+=1;if(e.loadCount==6)g.needsUpdate=!0;b&&b(this)};e[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(e){function g(){for(p in K.objects)if(!I.objects[p]){A=K.objects[p];if(w=I.geometries[A.geometry]){W=[];for(i=0;i<A.materials.length;i++)W[i]=I.materials[A.materials[i]];F=A.position;r=A.rotation;s=A.scale;object=new THREE.Mesh(w,W);object.position.set(F[0],
+F[1],F[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;I.scene.addObject(object);I.objects[p]=object}}}function h(ca){return function(xa){I.geometries[ca]=xa;g();V-=1;j()}}function j(){d({total_models:da,total_textures:fa,loaded_models:da-V,loaded_textures:fa-T},I);V==0&&T==0&&b(I)}var k,n,p,x,u,q,y,A,F,v,D,w,N,M,W,K,f,V,T,da,fa,I;K=e.data;f=new THREE.Loader;T=V=0;I={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
+lights:{},fogs:{}};e=function(){T-=1;j()};for(u in K.cameras){v=K.cameras[u];if(v.type=="perspective")N=new THREE.Camera(v.fov,v.aspect,v.near,v.far);else if(v.type=="ortho"){N=new THREE.Camera;N.projectionMatrix=THREE.Matrix4.makeOrtho(v.left,v.right,v.top,v.bottom,v.near,v.far)}F=v.position;v=v.target;N.position.set(F[0],F[1],F[2]);N.target.position.set(v[0],v[1],v[2]);I.cameras[u]=N}for(x in K.lights){u=K.lights[x];if(u.type=="directional"){F=u.direction;light=new THREE.DirectionalLight;light.position.set(F[0],
+F[1],F[2]);light.position.normalize()}else if(u.type=="point"){F=u.position;light=new THREE.PointLight;light.position.set(F[0],F[1],F[2])}v=u.color;i=u.intensity||1;light.color.setRGB(v[0]*i,v[1]*i,v[2]*i);I.scene.addLight(light);I.lights[x]=light}for(q in K.fogs){x=K.fogs[q];if(x.type=="linear")M=new THREE.Fog(0,x.near,x.far);else x.type=="exp2"&&(M=new THREE.FogExp2(0,x.density));v=x.color;M.color.setRGB(v[0],v[1],v[2]);I.fogs[q]=M}if(I.cameras&&K.defaults.camera)I.currentCamera=I.cameras[K.defaults.camera];
+if(I.fogs&&K.defaults.fog)I.scene.fog=I.fogs[K.defaults.fog];v=K.defaults.bgcolor;I.bgColor=new THREE.Color;I.bgColor.setRGB(v[0],v[1],v[2]);I.bgColorAlpha=K.defaults.bgalpha;for(k in K.geometries){q=K.geometries[k];if(q.type=="bin_mesh"||q.type=="ascii_mesh")V+=1}da=V;for(k in K.geometries){q=K.geometries[k];if(q.type=="cube"){w=new Cube(q.width,q.height,q.depth,q.segmentsWidth,q.segmentsHeight,q.segmentsDepth,null,q.flipped,q.sides);I.geometries[k]=w}else if(q.type=="plane"){w=new Plane(q.width,
+q.height,q.segmentsWidth,q.segmentsHeight);I.geometries[k]=w}else if(q.type=="sphere"){w=new Sphere(q.radius,q.segmentsWidth,q.segmentsHeight);I.geometries[k]=w}else if(q.type=="cylinder"){w=new Cylinder(q.numSegs,q.topRad,q.botRad,q.height,q.topOffset,q.botOffset);I.geometries[k]=w}else if(q.type=="torus"){w=new Torus(q.radius,q.tube,q.segmentsR,q.segmentsT);I.geometries[k]=w}else if(q.type=="icosahedron"){w=new Icosahedron(q.subdivisions);I.geometries[k]=w}else if(q.type=="bin_mesh")f.loadBinary({model:q.url,
+callback:h(k)});else q.type=="ascii_mesh"&&f.loadAscii({model:q.url,callback:h(k)})}for(y in K.textures){k=K.textures[y];T+=k.url instanceof Array?k.url.length:1}fa=T;for(y in K.textures){k=K.textures[y];if(k.mapping!=undefined&&THREE[k.mapping]!=undefined)k.mapping=new THREE[k.mapping];if(k.url instanceof Array)q=ImageUtils.loadTextureCube(k.url,k.mapping,e);else{q=ImageUtils.loadTexture(k.url,k.mapping,e);if(THREE[k.minFilter]!=undefined)q.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=undefined)q.magFilter=
+THREE[k.magFilter]}I.textures[y]=q}for(n in K.materials){y=K.materials[n];for(D in y.parameters)if(D=="envMap"||D=="map"||D=="lightMap")y.parameters[D]=I.textures[y.parameters[D]];else if(D=="shading")y.parameters[D]=y.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(D=="blending")y.parameters[D]=THREE[y.parameters[D]]?THREE[y.parameters[D]]:THREE.NormalBlending;else D=="combine"&&(y.parameters[D]=y.parameters[D]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);y=new THREE[y.type](y.parameters);
+I.materials[n]=y}g();c(I)}},addMesh:function(a,c,b,d,e,g,h,j,k,n){c=new THREE.Mesh(c,n);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=e;c.position.z=g;c.rotation.x=h;c.rotation.y=j;c.rotation.z=k;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);
 return c},addPanoramaCube:function(a,c,b){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,d,!0),new THREE.MeshFaceMaterial);
 a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var d=c/2;c=new Plane(c,c);var e=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,c,1,0,d,0,g,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));
 SceneUtils.addMesh(a,c,1,0,-d,0,-g,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
@@ -312,39 +312,39 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,d,e,g=2*Math.ceil(a*3)+1;g>25&&(g=25);e=(g-1)*0.5;b=Array(g);for(c=d=0;c<g;++c){b[c]=Math.exp(-((c-e)*(c-e))/(2*a*a));d+=b[c]}for(c=0;c<g;++c)b[c]/=d;return b}},Cube=function(a,c,b,d,e,g,h,j,k){function l(D,w,F,x,N,L,Z,M){var f,V,T=d||1,da=e||1,fa=N/2,I=L/2,ca=o.vertices.length;if(D=="x"&&w=="y"||D=="y"&&w=="x")f="z";else if(D=="x"&&w=="z"||D=="z"&&w=="x"){f="y";da=g||1}else if(D=="z"&&
-w=="y"||D=="y"&&w=="z"){f="x";T=g||1}var xa=T+1,ea=da+1;N/=T;var va=L/da;for(V=0;V<ea;V++)for(L=0;L<xa;L++){var ia=new THREE.Vector3;ia[D]=(L*N-fa)*F;ia[w]=(V*va-I)*x;ia[f]=Z;o.vertices.push(new THREE.Vertex(ia))}for(V=0;V<da;V++)for(L=0;L<T;L++){o.faces.push(new THREE.Face4(L+xa*V+ca,L+xa*(V+1)+ca,L+1+xa*(V+1)+ca,L+1+xa*V+ca,null,M));o.uvs.push([new THREE.UV(L/T,V/da),new THREE.UV(L/T,(V+1)/da),new THREE.UV((L+1)/T,(V+1)/da),new THREE.UV((L+1)/T,V/da)])}}THREE.Geometry.call(this);var o=this,v=a/
-2,u=c/2,t=b/2;j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var A in k)this.sides[A]!=undefined&&(this.sides[A]=k[A]);this.sides.px&&l("z","y",1*j,-1,b,c,-v,this.materials[0]);this.sides.nx&&l("z","y",-1*j,-1,b,c,v,this.materials[1]);this.sides.py&&l("x","z",1*j,1,a,b,u,this.materials[2]);this.sides.ny&&l("x","z",1*j,-1,
-a,b,-u,this.materials[3]);this.sides.pz&&l("x","y",1*j,-1,a,c,t,this.materials[4]);this.sides.nz&&l("x","y",-1*j,-1,a,c,-t,this.materials[5]);(function(){for(var D=[],w=[],F=0,x=o.vertices.length;F<x;F++){for(var N=o.vertices[F],L=!1,Z=0,M=D.length;Z<M;Z++){var f=D[Z];if(N.position.x==f.position.x&&N.position.y==f.position.y&&N.position.z==f.position.z){w[F]=Z;L=!0;break}}if(!L){w[F]=D.length;D.push(new THREE.Vertex(N.position.clone()))}}F=0;for(x=o.faces.length;F<x;F++){N=o.faces[F];N.a=w[N.a];N.b=
-w[N.b];N.c=w[N.c];N.d=w[N.d]}o.vertices=D})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
-var Cylinder=function(a,c,b,d,e){function g(l,o,v){h.vertices.push(new THREE.Vertex(new THREE.Vector3(l,o,v)))}THREE.Geometry.call(this);var h=this,j=Math.PI,k;for(k=0;k<a;k++)g(Math.sin(2*j*k/a)*c,Math.cos(2*j*k/a)*c,0);for(k=0;k<a;k++)g(Math.sin(2*j*k/a)*b,Math.cos(2*j*k/a)*b,d);for(k=0;k<a;k++)h.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(b!=0){g(0,0,-e);for(k=a;k<a+a/2;k++)h.faces.push(new THREE.Face4(2*a,(2*k-2*a)%a,(2*k-2*a+1)%a,(2*k-2*a+2)%a))}if(c!=0){g(0,0,d+e);for(k=a+a/2;k<
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,d,e,g=2*Math.ceil(a*3)+1;g>25&&(g=25);e=(g-1)*0.5;b=Array(g);for(c=d=0;c<g;++c){b[c]=Math.exp(-((c-e)*(c-e))/(2*a*a));d+=b[c]}for(c=0;c<g;++c)b[c]/=d;return b}},Cube=function(a,c,b,d,e,g,h,j,k){function n(F,v,D,w,N,M,W,K){var f,V,T=d||1,da=e||1,fa=N/2,I=M/2,ca=p.vertices.length;if(F=="x"&&v=="y"||F=="y"&&v=="x")f="z";else if(F=="x"&&v=="z"||F=="z"&&v=="x"){f="y";da=g||1}else if(F=="z"&&
+v=="y"||F=="y"&&v=="z"){f="x";T=g||1}var xa=T+1,ea=da+1;N/=T;var va=M/da;for(V=0;V<ea;V++)for(M=0;M<xa;M++){var ia=new THREE.Vector3;ia[F]=(M*N-fa)*D;ia[v]=(V*va-I)*w;ia[f]=W;p.vertices.push(new THREE.Vertex(ia))}for(V=0;V<da;V++)for(M=0;M<T;M++){p.faces.push(new THREE.Face4(M+xa*V+ca,M+xa*(V+1)+ca,M+1+xa*(V+1)+ca,M+1+xa*V+ca,null,K));p.uvs.push([new THREE.UV(M/T,V/da),new THREE.UV(M/T,(V+1)/da),new THREE.UV((M+1)/T,(V+1)/da),new THREE.UV((M+1)/T,V/da)])}}THREE.Geometry.call(this);var p=this,x=a/
+2,u=c/2,q=b/2;j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var A in k)this.sides[A]!=undefined&&(this.sides[A]=k[A]);this.sides.px&&n("z","y",1*j,-1,b,c,-x,this.materials[0]);this.sides.nx&&n("z","y",-1*j,-1,b,c,x,this.materials[1]);this.sides.py&&n("x","z",1*j,1,a,b,u,this.materials[2]);this.sides.ny&&n("x","z",1*j,-1,
+a,b,-u,this.materials[3]);this.sides.pz&&n("x","y",1*j,-1,a,c,q,this.materials[4]);this.sides.nz&&n("x","y",-1*j,-1,a,c,-q,this.materials[5]);(function(){for(var F=[],v=[],D=0,w=p.vertices.length;D<w;D++){for(var N=p.vertices[D],M=!1,W=0,K=F.length;W<K;W++){var f=F[W];if(N.position.x==f.position.x&&N.position.y==f.position.y&&N.position.z==f.position.z){v[D]=W;M=!0;break}}if(!M){v[D]=F.length;F.push(new THREE.Vertex(N.position.clone()))}}D=0;for(w=p.faces.length;D<w;D++){N=p.faces[D];N.a=v[N.a];N.b=
+v[N.b];N.c=v[N.c];N.d=v[N.d]}p.vertices=F})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+var Cylinder=function(a,c,b,d,e){function g(n,p,x){h.vertices.push(new THREE.Vertex(new THREE.Vector3(n,p,x)))}THREE.Geometry.call(this);var h=this,j=Math.PI,k;for(k=0;k<a;k++)g(Math.sin(2*j*k/a)*c,Math.cos(2*j*k/a)*c,0);for(k=0;k<a;k++)g(Math.sin(2*j*k/a)*b,Math.cos(2*j*k/a)*b,d);for(k=0;k<a;k++)h.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(b!=0){g(0,0,-e);for(k=a;k<a+a/2;k++)h.faces.push(new THREE.Face4(2*a,(2*k-2*a)%a,(2*k-2*a+1)%a,(2*k-2*a+2)%a))}if(c!=0){g(0,0,d+e);for(k=a+a/2;k<
 2*a;k++)h.faces.push(new THREE.Face4((2*k-2*a+2)%a+a,(2*k-2*a+1)%a+a,(2*k-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
-var Plane=function(a,c,b,d){THREE.Geometry.call(this);var e,g=a/2,h=c/2;b=b||1;d=d||1;var j=b+1,k=d+1;a/=b;var l=c/d;for(e=0;e<k;e++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(e*l-h),0)));for(e=0;e<d;e++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+j*e,c+j*(e+1),c+1+j*(e+1),c+1+j*e));this.uvs.push([new THREE.UV(c/b,e/d),new THREE.UV(c/b,(e+1)/d),new THREE.UV((c+1)/b,(e+1)/d),new THREE.UV((c+1)/b,e/d)])}this.computeCentroids();this.computeFaceNormals()};
+var Plane=function(a,c,b,d){THREE.Geometry.call(this);var e,g=a/2,h=c/2;b=b||1;d=d||1;var j=b+1,k=d+1;a/=b;var n=c/d;for(e=0;e<k;e++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(e*n-h),0)));for(e=0;e<d;e++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+j*e,c+j*(e+1),c+1+j*(e+1),c+1+j*e));this.uvs.push([new THREE.UV(c/b,e/d),new THREE.UV(c/b,(e+1)/d),new THREE.UV((c+1)/b,(e+1)/d),new THREE.UV((c+1)/b,e/d)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
-var Sphere=function(a,c,b){THREE.Geometry.call(this);var d,e=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){d=b/h;var j=a*Math.cos(d*e),k=a*Math.sin(d*e),l=[],o=0;for(d=0;d<g;d++){var v=2*d/g,u=k*Math.sin(v*e);v=k*Math.cos(v*e);(b==0||b==h)&&d>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,j,u)))-1);l.push(o)}c.push(l)}var t,y,A;e=c.length;for(b=0;b<e;b++){g=c[b].length;if(b>0)for(d=0;d<g;d++){l=d==g-1;h=c[b][l?0:d+1];j=c[b][l?g-1:d];k=c[b-1][l?g-1:d];l=c[b-1][l?
-0:d+1];u=b/(e-1);t=(b-1)/(e-1);y=(d+1)/g;v=d/g;o=new THREE.UV(1-y,u);u=new THREE.UV(1-v,u);v=new THREE.UV(1-v,t);var D=new THREE.UV(1-y,t);if(b<c.length-1){t=this.vertices[h].position.clone();y=this.vertices[j].position.clone();A=this.vertices[k].position.clone();t.normalize();y.normalize();A.normalize();this.faces.push(new THREE.Face3(h,j,k,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([o,u,v])}if(b>1){t=this.vertices[h].position.clone();
-y=this.vertices[k].position.clone();A=this.vertices[l].position.clone();t.normalize();y.normalize();A.normalize();this.faces.push(new THREE.Face3(h,k,l,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([o,v,D])}}}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 d,e=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){d=b/h;var j=a*Math.cos(d*e),k=a*Math.sin(d*e),n=[],p=0;for(d=0;d<g;d++){var x=2*d/g,u=k*Math.sin(x*e);x=k*Math.cos(x*e);(b==0||b==h)&&d>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,j,u)))-1);n.push(p)}c.push(n)}var q,y,A;e=c.length;for(b=0;b<e;b++){g=c[b].length;if(b>0)for(d=0;d<g;d++){n=d==g-1;h=c[b][n?0:d+1];j=c[b][n?g-1:d];k=c[b-1][n?g-1:d];n=c[b-1][n?
+0:d+1];u=b/(e-1);q=(b-1)/(e-1);y=(d+1)/g;x=d/g;p=new THREE.UV(1-y,u);u=new THREE.UV(1-x,u);x=new THREE.UV(1-x,q);var F=new THREE.UV(1-y,q);if(b<c.length-1){q=this.vertices[h].position.clone();y=this.vertices[j].position.clone();A=this.vertices[k].position.clone();q.normalize();y.normalize();A.normalize();this.faces.push(new THREE.Face3(h,j,k,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([p,u,x])}if(b>1){q=this.vertices[h].position.clone();
+y=this.vertices[k].position.clone();A=this.vertices[n].position.clone();q.normalize();y.normalize();A.normalize();this.faces.push(new THREE.Face3(h,k,n,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([p,x,F])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
 var Torus=function(a,c,b,d){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){d=b/this.segmentsT*2*Math.PI;var e=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(e))*Math.cos(d),(this.radius+this.tube*Math.cos(e))*Math.sin(d),this.tube*Math.sin(e))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
 1;b<=this.segmentsT;++b){d=(this.segmentsT+1)*c+b;e=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(d,e,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
-var Icosahedron=function(a){function c(v,u,t){var y=Math.sqrt(v*v+u*u+t*t);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(v/y,u/y,t/y)))-1}function b(v,u,t,y){y.faces.push(new THREE.Face3(v,u,t))}function d(v,u){var t=e.vertices[v].position,y=e.vertices[u].position;return c((t.x+y.x)/2,(t.y+y.y)/2,(t.z+y.z)/2)}var e=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
-1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var k=d(g.faces[j].a,g.faces[j].b),l=d(g.faces[j].b,g.faces[j].c),o=d(g.faces[j].c,g.faces[j].a);b(g.faces[j].a,k,o,h);b(g.faces[j].b,l,k,h);b(g.faces[j].c,
-o,l,h);b(k,l,o,h)}g.faces=h.faces}e.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function LathedObject(a,c,b){THREE.Geometry.call(this);this.nsteps=c||12;this.latheAngle=b||2*Math.PI;c=this.latheAngle/this.nsteps;for(var d=[],e=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));e[j]=this.vertices.length-1;d[j]=new THREE.Vector3(a[j].x,a[j].y,a[j].z)}for(var k=THREE.Matrix4.rotationZMatrix(this.stepSize),l=0;l<=this.latheAngle+0.001;l+=this.stepSize){for(j=0;j<d.length;j++)if(l<b){d[j]=k.multiplyVector3(d[j].clone());this.vertices.push(new THREE.Vertex(d[j]));
-g[j]=this.vertices.length-1}else g=h;l==0&&(h=e);for(j=0;j<e.length-1;j++){this.faces.push(new THREE.Face4(g[j],g[j+1],e[j+1],e[j]));this.uvs.push([new THREE.UV(l/b,j/a.length),new THREE.UV(l/b,(j+1)/a.length),new THREE.UV((l-c)/b,(j+1)/a.length),new THREE.UV((l-c)/b,j/a.length)])}e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
+var Icosahedron=function(a){function c(x,u,q){var y=Math.sqrt(x*x+u*u+q*q);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(x/y,u/y,q/y)))-1}function b(x,u,q,y){y.faces.push(new THREE.Face3(x,u,q))}function d(x,u){var q=e.vertices[x].position,y=e.vertices[u].position;return c((q.x+y.x)/2,(q.y+y.y)/2,(q.z+y.z)/2)}var e=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
+1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var k=d(g.faces[j].a,g.faces[j].b),n=d(g.faces[j].b,g.faces[j].c),p=d(g.faces[j].c,g.faces[j].a);b(g.faces[j].a,k,p,h);b(g.faces[j].b,n,k,h);b(g.faces[j].c,
+p,n,h);b(k,n,p,h)}g.faces=h.faces}e.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
+function LathedObject(a,c,b){THREE.Geometry.call(this);this.nsteps=c||12;this.latheAngle=b||2*Math.PI;c=this.latheAngle/this.nsteps;for(var d=[],e=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));e[j]=this.vertices.length-1;d[j]=new THREE.Vector3(a[j].x,a[j].y,a[j].z)}for(var k=THREE.Matrix4.rotationZMatrix(this.stepSize),n=0;n<=this.latheAngle+0.0010;n+=this.stepSize){for(j=0;j<d.length;j++)if(n<b){d[j]=k.multiplyVector3(d[j].clone());this.vertices.push(new THREE.Vertex(d[j]));
+g[j]=this.vertices.length-1}else g=h;n==0&&(h=e);for(j=0;j<e.length-1;j++){this.faces.push(new THREE.Face4(g[j],g[j+1],e[j+1],e[j]));this.uvs.push([new THREE.UV(n/b,j/a.length),new THREE.UV(n/b,(j+1)/a.length),new THREE.UV((n-c)/b,(j+1)/a.length),new THREE.UV((n-c)/b,j/a.length)])}e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
 if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,d,e){return b+(d-b)*e};this.VIntX=function(b,d,e,g,h,j,k,l,o,v){h=(h-o)/(v-o);o=this.normal_cache;d[g]=j+h*this.delta;d[g+1]=k;d[g+2]=l;e[g]=this.lerp(o[b],o[b+3],h);e[g+1]=this.lerp(o[b+1],o[b+4],h);e[g+2]=this.lerp(o[b+2],o[b+5],h)};this.VIntY=function(b,d,e,g,h,j,k,l,o,v){h=(h-o)/(v-o);o=this.normal_cache;d[g]=j;d[g+1]=k+h*this.delta;d[g+
-2]=l;d=b+this.yd*3;e[g]=this.lerp(o[b],o[d],h);e[g+1]=this.lerp(o[b+1],o[d+1],h);e[g+2]=this.lerp(o[b+2],o[d+2],h)};this.VIntZ=function(b,d,e,g,h,j,k,l,o,v){h=(h-o)/(v-o);o=this.normal_cache;d[g]=j;d[g+1]=k;d[g+2]=l+h*this.delta;d=b+this.zd*3;e[g]=this.lerp(o[b],o[d],h);e[g+1]=this.lerp(o[b+1],o[d+1],h);e[g+2]=this.lerp(o[b+2],o[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
-this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,e,g,h,j){var k=g+1,l=g+this.yd,o=g+this.zd,v=k+this.yd,u=k+this.zd,t=g+this.yd+this.zd,y=k+this.yd+this.zd,A=0,D=this.field[g],w=this.field[k],F=this.field[l],x=this.field[v],N=this.field[o],L=this.field[u],Z=this.field[t],M=this.field[y];D<h&&(A|=1);w<h&&(A|=2);F<h&&(A|=8);x<h&&(A|=4);N<h&&(A|=16);L<h&&(A|=32);Z<h&&(A|=128);M<h&&(A|=64);var f=THREE.edgeTable[A];if(f==0)return 0;
-var V=this.delta,T=b+V,da=d+V;V=e+V;if(f&1){this.compNorm(g);this.compNorm(k);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,e,D,w)}if(f&2){this.compNorm(k);this.compNorm(v);this.VIntY(k*3,this.vlist,this.nlist,3,h,T,d,e,w,x)}if(f&4){this.compNorm(l);this.compNorm(v);this.VIntX(l*3,this.vlist,this.nlist,6,h,b,da,e,F,x)}if(f&8){this.compNorm(g);this.compNorm(l);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,e,D,F)}if(f&16){this.compNorm(o);this.compNorm(u);this.VIntX(o*3,this.vlist,this.nlist,12,h,b,d,
-V,N,L)}if(f&32){this.compNorm(u);this.compNorm(y);this.VIntY(u*3,this.vlist,this.nlist,15,h,T,d,V,L,M)}if(f&64){this.compNorm(t);this.compNorm(y);this.VIntX(t*3,this.vlist,this.nlist,18,h,b,da,V,Z,M)}if(f&128){this.compNorm(o);this.compNorm(t);this.VIntY(o*3,this.vlist,this.nlist,21,h,b,d,V,N,Z)}if(f&256){this.compNorm(g);this.compNorm(o);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,e,D,N)}if(f&512){this.compNorm(k);this.compNorm(u);this.VIntZ(k*3,this.vlist,this.nlist,27,h,T,d,e,w,L)}if(f&1024){this.compNorm(v);
-this.compNorm(y);this.VIntZ(v*3,this.vlist,this.nlist,30,h,T,da,e,x,M)}if(f&2048){this.compNorm(l);this.compNorm(t);this.VIntZ(l*3,this.vlist,this.nlist,33,h,b,da,e,F,Z)}A<<=4;for(h=g=0;THREE.triTable[A+h]!=-1;){b=A+h;d=b+1;e=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[e],j);h+=3;g++}return g};this.posnormtriv=function(b,d,e,g,h,j){var k=this.count*3;this.positionArray[k]=b[e];this.positionArray[k+1]=b[e+1];this.positionArray[k+2]=b[e+2];this.positionArray[k+
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,d,e){return b+(d-b)*e};this.VIntX=function(b,d,e,g,h,j,k,n,p,x){h=(h-p)/(x-p);p=this.normal_cache;d[g]=j+h*this.delta;d[g+1]=k;d[g+2]=n;e[g]=this.lerp(p[b],p[b+3],h);e[g+1]=this.lerp(p[b+1],p[b+4],h);e[g+2]=this.lerp(p[b+2],p[b+5],h)};this.VIntY=function(b,d,e,g,h,j,k,n,p,x){h=(h-p)/(x-p);p=this.normal_cache;d[g]=j;d[g+1]=k+h*this.delta;d[g+
+2]=n;d=b+this.yd*3;e[g]=this.lerp(p[b],p[d],h);e[g+1]=this.lerp(p[b+1],p[d+1],h);e[g+2]=this.lerp(p[b+2],p[d+2],h)};this.VIntZ=function(b,d,e,g,h,j,k,n,p,x){h=(h-p)/(x-p);p=this.normal_cache;d[g]=j;d[g+1]=k;d[g+2]=n+h*this.delta;d=b+this.zd*3;e[g]=this.lerp(p[b],p[d],h);e[g+1]=this.lerp(p[b+1],p[d+1],h);e[g+2]=this.lerp(p[b+2],p[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
+this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,e,g,h,j){var k=g+1,n=g+this.yd,p=g+this.zd,x=k+this.yd,u=k+this.zd,q=g+this.yd+this.zd,y=k+this.yd+this.zd,A=0,F=this.field[g],v=this.field[k],D=this.field[n],w=this.field[x],N=this.field[p],M=this.field[u],W=this.field[q],K=this.field[y];F<h&&(A|=1);v<h&&(A|=2);D<h&&(A|=8);w<h&&(A|=4);N<h&&(A|=16);M<h&&(A|=32);W<h&&(A|=128);K<h&&(A|=64);var f=THREE.edgeTable[A];if(f==0)return 0;
+var V=this.delta,T=b+V,da=d+V;V=e+V;if(f&1){this.compNorm(g);this.compNorm(k);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,e,F,v)}if(f&2){this.compNorm(k);this.compNorm(x);this.VIntY(k*3,this.vlist,this.nlist,3,h,T,d,e,v,w)}if(f&4){this.compNorm(n);this.compNorm(x);this.VIntX(n*3,this.vlist,this.nlist,6,h,b,da,e,D,w)}if(f&8){this.compNorm(g);this.compNorm(n);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,e,F,D)}if(f&16){this.compNorm(p);this.compNorm(u);this.VIntX(p*3,this.vlist,this.nlist,12,h,b,d,
+V,N,M)}if(f&32){this.compNorm(u);this.compNorm(y);this.VIntY(u*3,this.vlist,this.nlist,15,h,T,d,V,M,K)}if(f&64){this.compNorm(q);this.compNorm(y);this.VIntX(q*3,this.vlist,this.nlist,18,h,b,da,V,W,K)}if(f&128){this.compNorm(p);this.compNorm(q);this.VIntY(p*3,this.vlist,this.nlist,21,h,b,d,V,N,W)}if(f&256){this.compNorm(g);this.compNorm(p);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,e,F,N)}if(f&512){this.compNorm(k);this.compNorm(u);this.VIntZ(k*3,this.vlist,this.nlist,27,h,T,d,e,v,M)}if(f&1024){this.compNorm(x);
+this.compNorm(y);this.VIntZ(x*3,this.vlist,this.nlist,30,h,T,da,e,w,K)}if(f&2048){this.compNorm(n);this.compNorm(q);this.VIntZ(n*3,this.vlist,this.nlist,33,h,b,da,e,D,W)}A<<=4;for(h=g=0;THREE.triTable[A+h]!=-1;){b=A+h;d=b+1;e=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[e],j);h+=3;g++}return g};this.posnormtriv=function(b,d,e,g,h,j){var k=this.count*3;this.positionArray[k]=b[e];this.positionArray[k+1]=b[e+1];this.positionArray[k+2]=b[e+2];this.positionArray[k+
 3]=b[g];this.positionArray[k+4]=b[g+1];this.positionArray[k+5]=b[g+2];this.positionArray[k+6]=b[h];this.positionArray[k+7]=b[h+1];this.positionArray[k+8]=b[h+2];this.normalArray[k]=d[e];this.normalArray[k+1]=d[e+1];this.normalArray[k+2]=d[e+2];this.normalArray[k+3]=d[g];this.normalArray[k+4]=d[g+1];this.normalArray[k+5]=d[g+2];this.normalArray[k+6]=d[h];this.normalArray[k+7]=d[h+1];this.normalArray[k+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&j(this)};this.begin=
-function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,e,g,h){var j=this.size*Math.sqrt(g/h),k=e*this.size,l=d*this.size,o=b*this.size,v=Math.floor(k-j);v<1&&(v=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var u=Math.floor(l-j);u<1&&(u=1);l=Math.floor(l+j);l>this.size-1&&(l=this.size-1);var t=Math.floor(o-j);t<1&&(t=1);j=Math.floor(o+j);
-j>this.size-1&&(j=this.size-1);for(var y,A,D,w,F,x;v<k;v++){o=this.size2*v;A=v/this.size-e;F=A*A;for(A=u;A<l;A++){D=o+this.size*A;y=A/this.size-d;x=y*y;for(y=t;y<j;y++){w=y/this.size-b;w=g/(1.0E-6+w*w+x+F)-h;w>0&&(this.field[D+y]+=w)}}}};this.addPlaneX=function(b,d){var e,g,h,j,k,l=this.size,o=this.yd,v=this.zd,u=this.field,t=l*Math.sqrt(b/d);t>l&&(t=l);for(e=0;e<t;e++){g=e/l;g*=g;j=b/(1.0E-4+g)-d;if(j>0)for(g=0;g<l;g++){k=e+g*o;for(h=0;h<l;h++)u[v*h+k]+=j}}};this.addPlaneY=function(b,d){var e,g,
-h,j,k,l,o=this.size,v=this.yd,u=this.zd,t=this.field,y=o*Math.sqrt(b/d);y>o&&(y=o);for(g=0;g<y;g++){e=g/o;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=g*v;for(e=0;e<o;e++){l=k+e;for(h=0;h<o;h++)t[u*h+l]+=j}}}};this.addPlaneZ=function(b,d){var e,g,h,j,k,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/d);dist>size&&(dist=size);for(h=0;h<dist;h++){e=h/size;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=zd*h;for(g=0;g<size;g++){l=k+g*yd;for(e=0;e<size;e++)field[l+e]+=j}}}};this.reset=function(){var b;
-for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var d,e,g,h,j,k,l,o,v,u=this.size-2;for(h=1;h<u;h++){v=this.size2*h;l=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++){o=v+this.size*g;k=(g-this.halfsize)/this.halfsize;for(e=1;e<u;e++){j=(e-this.halfsize)/this.halfsize;d=o+e;this.polygonize(j,k,l,d,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,d=new THREE.Geometry;this.render(function(e){var g,h,j,k,l,o,v,u;for(g=
-0;g<e.count;g++){l=g*3;v=l+1;u=l+2;h=e.positionArray[l];j=e.positionArray[v];k=e.positionArray[u];o=new THREE.Vector3(h,j,k);h=e.normalArray[l];j=e.normalArray[v];k=e.normalArray[u];l=new THREE.Vector3(h,j,k);l.normalize();l=new THREE.Vertex(o,l);d.vertices.push(l)}nfaces=e.count/3;for(g=0;g<nfaces;g++){l=(b+g)*3;v=l+1;u=l+2;o=d.vertices[l].normal;h=d.vertices[v].normal;j=d.vertices[u].normal;l=new THREE.Face3(l,v,u,[o,h,j]);d.faces.push(l)}b+=nfaces;e.count=0});return d};this.init(a)};
+function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,e,g,h){var j=this.size*Math.sqrt(g/h),k=e*this.size,n=d*this.size,p=b*this.size,x=Math.floor(k-j);x<1&&(x=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var u=Math.floor(n-j);u<1&&(u=1);n=Math.floor(n+j);n>this.size-1&&(n=this.size-1);var q=Math.floor(p-j);q<1&&(q=1);j=Math.floor(p+j);
+j>this.size-1&&(j=this.size-1);for(var y,A,F,v,D,w;x<k;x++){p=this.size2*x;A=x/this.size-e;D=A*A;for(A=u;A<n;A++){F=p+this.size*A;y=A/this.size-d;w=y*y;for(y=q;y<j;y++){v=y/this.size-b;v=g/(1.0E-6+v*v+w+D)-h;v>0&&(this.field[F+y]+=v)}}}};this.addPlaneX=function(b,d){var e,g,h,j,k,n=this.size,p=this.yd,x=this.zd,u=this.field,q=n*Math.sqrt(b/d);q>n&&(q=n);for(e=0;e<q;e++){g=e/n;g*=g;j=b/(1.0E-4+g)-d;if(j>0)for(g=0;g<n;g++){k=e+g*p;for(h=0;h<n;h++)u[x*h+k]+=j}}};this.addPlaneY=function(b,d){var e,g,
+h,j,k,n,p=this.size,x=this.yd,u=this.zd,q=this.field,y=p*Math.sqrt(b/d);y>p&&(y=p);for(g=0;g<y;g++){e=g/p;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=g*x;for(e=0;e<p;e++){n=k+e;for(h=0;h<p;h++)q[u*h+n]+=j}}}};this.addPlaneZ=function(b,d){var e,g,h,j,k,n;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/d);dist>size&&(dist=size);for(h=0;h<dist;h++){e=h/size;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=zd*h;for(g=0;g<size;g++){n=k+g*yd;for(e=0;e<size;e++)field[n+e]+=j}}}};this.reset=function(){var b;
+for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var d,e,g,h,j,k,n,p,x,u=this.size-2;for(h=1;h<u;h++){x=this.size2*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++){p=x+this.size*g;k=(g-this.halfsize)/this.halfsize;for(e=1;e<u;e++){j=(e-this.halfsize)/this.halfsize;d=p+e;this.polygonize(j,k,n,d,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,d=new THREE.Geometry;this.render(function(e){var g,h,j,k,n,p,x,u;for(g=
+0;g<e.count;g++){n=g*3;x=n+1;u=n+2;h=e.positionArray[n];j=e.positionArray[x];k=e.positionArray[u];p=new THREE.Vector3(h,j,k);h=e.normalArray[n];j=e.normalArray[x];k=e.normalArray[u];n=new THREE.Vector3(h,j,k);n.normalize();n=new THREE.Vertex(p,n);d.vertices.push(n)}nfaces=e.count/3;for(g=0;g<nfaces;g++){n=(b+g)*3;x=n+1;u=n+2;p=d.vertices[n].normal;h=d.vertices[x].normal;j=d.vertices[u].normal;n=new THREE.Face3(n,x,u,[p,h,j]);d.faces.push(n)}b+=nfaces;e.count=0});return d};this.init(a)};
 THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
@@ -374,24 +374,24 @@ THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement
 c},loadAsciiOld:function(a,c){var b=document.createElement("script");b.type="text/javascript";b.onload=c;b.src=a;document.getElementsByTagName("head")[0].appendChild(b)},loadAscii:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(e){THREE.Loader.prototype.createModel(e.data,b,d)};c.postMessage(a)},loadBinary:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:
 THREE.Loader.prototype.extractUrlbase(c),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,e,d,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,e,g){var h=new XMLHttpRequest,j=d+"/"+a,k=0;
 h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,b,e,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(g){k==0&&(k=h.getResponseHeader("Content-Length"));g({total:k,loaded:h.responseText.length})}}else h.readyState==2&&(k=h.getResponseHeader("Content-Length"))};h.open("GET",j,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
-createBinModel:function(a,c,b,d){var e=function(g){function h(q,n){var p=o(q,n),B=o(q,n+1),C=o(q,n+2),G=o(q,n+3),Q=(G<<1&255|C>>7)-127;p|=(C&127)<<16|B<<8;if(p==0&&Q==-127)return 0;return(1-2*(G>>7))*(1+p*Math.pow(2,-23))*Math.pow(2,Q)}function j(q,n){var p=o(q,n),B=o(q,n+1),C=o(q,n+2);return(o(q,n+3)<<24)+(C<<16)+(B<<8)+p}function k(q,n){var p=o(q,n);return(o(q,n+1)<<8)+p}function l(q,n){var p=o(q,n);return p>127?p-256:p}function o(q,n){return q.charCodeAt(n)&255}function v(q){var n,p,B;n=j(a,q);
-p=j(a,q+Z);B=j(a,q+M);q=k(a,q+f);THREE.Loader.prototype.f3(w,n,p,B,q)}function u(q){var n,p,B,C,G,Q;n=j(a,q);p=j(a,q+Z);B=j(a,q+M);C=k(a,q+f);G=j(a,q+V);Q=j(a,q+T);q=j(a,q+da);THREE.Loader.prototype.f3n(w,N,n,p,B,C,G,Q,q)}function t(q){var n,p,B,C;n=j(a,q);p=j(a,q+fa);B=j(a,q+I);C=j(a,q+ca);q=k(a,q+xa);THREE.Loader.prototype.f4(w,n,p,B,C,q)}function y(q){var n,p,B,C,G,Q,H,O;n=j(a,q);p=j(a,q+fa);B=j(a,q+I);C=j(a,q+ca);G=k(a,q+xa);Q=j(a,q+ea);H=j(a,q+va);O=j(a,q+ia);q=j(a,q+ga);THREE.Loader.prototype.f4n(w,
-N,n,p,B,C,G,Q,H,O,q)}function A(q){var n,p;n=j(a,q);p=j(a,q+ta);q=j(a,q+ya);THREE.Loader.prototype.uv3(w.uvs,L[n*2],L[n*2+1],L[p*2],L[p*2+1],L[q*2],L[q*2+1])}function D(q){var n,p,B;n=j(a,q);p=j(a,q+ha);B=j(a,q+aa);q=j(a,q+ma);THREE.Loader.prototype.uv4(w.uvs,L[n*2],L[n*2+1],L[p*2],L[p*2+1],L[B*2],L[B*2+1],L[q*2],L[q*2+1])}var w=this,F=0,x,N=[],L=[],Z,M,f,V,T,da,fa,I,ca,xa,ea,va,ia,ga,ta,ya,ha,aa,ma,na,R,ja,qa,m,z;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,d,g);x={signature:a.substr(F,
-8),header_bytes:o(a,F+8),vertex_coordinate_bytes:o(a,F+9),normal_coordinate_bytes:o(a,F+10),uv_coordinate_bytes:o(a,F+11),vertex_index_bytes:o(a,F+12),normal_index_bytes:o(a,F+13),uv_index_bytes:o(a,F+14),material_index_bytes:o(a,F+15),nvertices:j(a,F+16),nnormals:j(a,F+16+4),nuvs:j(a,F+16+8),ntri_flat:j(a,F+16+12),ntri_smooth:j(a,F+16+16),ntri_flat_uv:j(a,F+16+20),ntri_smooth_uv:j(a,F+16+24),nquad_flat:j(a,F+16+28),nquad_smooth:j(a,F+16+32),nquad_flat_uv:j(a,F+16+36),nquad_smooth_uv:j(a,F+16+40)};
-F+=x.header_bytes;Z=x.vertex_index_bytes;M=x.vertex_index_bytes*2;f=x.vertex_index_bytes*3;V=x.vertex_index_bytes*3+x.material_index_bytes;T=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes;da=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*2;fa=x.vertex_index_bytes;I=x.vertex_index_bytes*2;ca=x.vertex_index_bytes*3;xa=x.vertex_index_bytes*4;ea=x.vertex_index_bytes*4+x.material_index_bytes;va=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes;ia=
-x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*2;ga=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*3;ta=x.uv_index_bytes;ya=x.uv_index_bytes*2;ha=x.uv_index_bytes;aa=x.uv_index_bytes*2;ma=x.uv_index_bytes*3;g=x.vertex_index_bytes*3+x.material_index_bytes;z=x.vertex_index_bytes*4+x.material_index_bytes;na=x.ntri_flat*g;R=x.ntri_smooth*(g+x.normal_index_bytes*3);ja=x.ntri_flat_uv*(g+x.uv_index_bytes*3);qa=x.ntri_smooth_uv*(g+x.normal_index_bytes*3+x.uv_index_bytes*
-3);m=x.nquad_flat*z;g=x.nquad_smooth*(z+x.normal_index_bytes*4);z=x.nquad_flat_uv*(z+x.uv_index_bytes*4);F+=function(q){for(var n,p,B,C=x.vertex_coordinate_bytes*3,G=q+x.nvertices*C;q<G;q+=C){n=h(a,q);p=h(a,q+x.vertex_coordinate_bytes);B=h(a,q+x.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(w,n,p,B)}return x.nvertices*C}(F);F+=function(q){for(var n,p,B,C=x.normal_coordinate_bytes*3,G=q+x.nnormals*C;q<G;q+=C){n=l(a,q);p=l(a,q+x.normal_coordinate_bytes);B=l(a,q+x.normal_coordinate_bytes*2);N.push(n/
-127,p/127,B/127)}return x.nnormals*C}(F);F+=function(q){for(var n,p,B=x.uv_coordinate_bytes*2,C=q+x.nuvs*B;q<C;q+=B){n=h(a,q);p=h(a,q+x.uv_coordinate_bytes);L.push(n,p)}return x.nuvs*B}(F);na=F+na;R=na+R;ja=R+ja;qa=ja+qa;m=qa+m;g=m+g;z=g+z;(function(q){var n,p=x.vertex_index_bytes*3+x.material_index_bytes,B=p+x.uv_index_bytes*3,C=q+x.ntri_flat_uv*B;for(n=q;n<C;n+=B){v(n);A(n+p)}return C-q})(R);(function(q){var n,p=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*3,B=p+x.uv_index_bytes*
-3,C=q+x.ntri_smooth_uv*B;for(n=q;n<C;n+=B){u(n);A(n+p)}return C-q})(ja);(function(q){var n,p=x.vertex_index_bytes*4+x.material_index_bytes,B=p+x.uv_index_bytes*4,C=q+x.nquad_flat_uv*B;for(n=q;n<C;n+=B){t(n);D(n+p)}return C-q})(g);(function(q){var n,p=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*4,B=p+x.uv_index_bytes*4,C=q+x.nquad_smooth_uv*B;for(n=q;n<C;n+=B){y(n);D(n+p)}return C-q})(z);(function(q){var n,p=x.vertex_index_bytes*3+x.material_index_bytes,B=q+x.ntri_flat*p;for(n=
-q;n<B;n+=p)v(n);return B-q})(F);(function(q){var n,p=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*3,B=q+x.ntri_smooth*p;for(n=q;n<B;n+=p)u(n);return B-q})(na);(function(q){var n,p=x.vertex_index_bytes*4+x.material_index_bytes,B=q+x.nquad_flat*p;for(n=q;n<B;n+=p)t(n);return B-q})(qa);(function(q){var n,p=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*4,B=q+x.nquad_smooth*p;for(n=q;n<B;n+=p)y(n);return B-q})(m);this.computeCentroids();this.computeFaceNormals()};
-e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},createModel:function(a,c,b){var d=function(e){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,e);(function(){var h,j,k,l,o;h=0;for(j=a.vertices.length;h<j;h+=3){k=a.vertices[h];l=a.vertices[h+1];o=a.vertices[h+2];THREE.Loader.prototype.v(g,k,l,o)}if(a.colors){h=0;for(j=a.colors.length;h<j;h+=3){k=a.colors[h];l=a.colors[h+1];o=a.colors[h+2];THREE.Loader.prototype.vc(g,k,l,o)}}})();(function(){function h(y,
-A){THREE.Loader.prototype.f3(g,y[A],y[A+1],y[A+2],y[A+3])}function j(y,A){THREE.Loader.prototype.f3n(g,a.normals,y[A],y[A+1],y[A+2],y[A+3],y[A+4],y[A+5],y[A+6])}function k(y,A){THREE.Loader.prototype.f4(g,y[A],y[A+1],y[A+2],y[A+3],y[A+4])}function l(y,A){THREE.Loader.prototype.f4n(g,a.normals,y[A],y[A+1],y[A+2],y[A+3],y[A+4],y[A+5],y[A+6],y[A+7],y[A+8])}function o(y,A){var D,w,F,x,N,L,Z,M,f;D=y[A];w=y[A+1];F=y[A+2];x=a.uvs[D*2];Z=a.uvs[D*2+1];N=a.uvs[w*2];M=a.uvs[w*2+1];L=a.uvs[F*2];f=a.uvs[F*2+1];
-THREE.Loader.prototype.uv3(g.uvs,x,Z,N,M,L,f);if(a.uvs2&&a.uvs2.length){x=a.uvs2[D*2];Z=a.uvs2[D*2+1];N=a.uvs2[w*2];M=a.uvs2[w*2+1];L=a.uvs2[F*2];f=a.uvs2[F*2+1];THREE.Loader.prototype.uv3(g.uvs2,x,1-Z,N,1-M,L,1-f)}}function v(y,A){var D,w,F,x,N,L,Z,M,f,V,T,da;D=y[A];w=y[A+1];F=y[A+2];x=y[A+3];N=a.uvs[D*2];f=a.uvs[D*2+1];L=a.uvs[w*2];V=a.uvs[w*2+1];Z=a.uvs[F*2];T=a.uvs[F*2+1];M=a.uvs[x*2];da=a.uvs[x*2+1];THREE.Loader.prototype.uv4(g.uvs,N,f,L,V,Z,T,M,da);if(a.uvs2){N=a.uvs2[D*2];f=a.uvs2[D*2+1];L=
-a.uvs2[w*2];V=a.uvs2[w*2+1];Z=a.uvs2[F*2];T=a.uvs2[F*2+1];M=a.uvs2[x*2];da=a.uvs2[x*2+1];THREE.Loader.prototype.uv4(g.uvs2,N,1-f,L,1-V,Z,1-T,M,1-da)}}var u,t;u=0;for(t=a.trianglesUvs.length;u<t;u+=7){h(a.trianglesUvs,u);o(a.trianglesUvs,u+4)}u=0;for(t=a.trianglesNormalsUvs.length;u<t;u+=10){j(a.trianglesNormalsUvs,u);o(a.trianglesNormalsUvs,u+7)}u=0;for(t=a.quadsUvs.length;u<t;u+=9){k(a.quadsUvs,u);v(a.quadsUvs,u+5)}u=0;for(t=a.quadsNormalsUvs.length;u<t;u+=13){l(a.quadsNormalsUvs,u);v(a.quadsNormalsUvs,
-u+9)}u=0;for(t=a.triangles.length;u<t;u+=4)h(a.triangles,u);u=0;for(t=a.trianglesNormals.length;u<t;u+=7)j(a.trianglesNormals,u);u=0;for(t=a.quads.length;u<t;u+=5)k(a.quads,u);u=0;for(t=a.quadsNormals.length;u<t;u+=9)l(a.quadsNormals,u)})();(function(){var h,j,k,l;if(a.skinWeights){h=0;for(j=a.skinWeights.length;h<j;h+=2){k=a.skinWeights[h];l=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,k,l,0,0)}}if(a.skinIndices){h=0;for(j=a.skinIndices.length;h<j;h+=2){k=a.skinIndices[h];l=a.skinIndices[h+1];
-THREE.Loader.prototype.si(g,k,l,0,0)}}THREE.Loader.prototype.bones(g,a.bones);THREE.Loader.prototype.animation(g,a.animation)})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;c(new d(b))},bones:function(a,c){a.bones=c},animation:function(a,c){a.animation=c},si:function(a,c,b,d,e){a.skinIndices.push(new THREE.Vector4(c,b,d,e))},sw:function(a,c,b,d,e){a.skinWeights.push(new THREE.Vector4(c,b,d,e))},v:function(a,c,b,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,
-b,d)))},vc:function(a,c,b,d){var e=new THREE.Color(16777215);e.setRGB(c,b,d);a.colors.push(e)},f3:function(a,c,b,d,e){a.faces.push(new THREE.Face3(c,b,d,null,a.materials[e]))},f4:function(a,c,b,d,e,g){a.faces.push(new THREE.Face4(c,b,d,e,null,a.materials[g]))},f3n:function(a,c,b,d,e,g,h,j,k){g=a.materials[g];var l=c[j*3],o=c[j*3+1];j=c[j*3+2];var v=c[k*3],u=c[k*3+1];k=c[k*3+2];a.faces.push(new THREE.Face3(b,d,e,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(l,o,j),new THREE.Vector3(v,
-u,k)],g))},f4n:function(a,c,b,d,e,g,h,j,k,l,o){h=a.materials[h];var v=c[k*3],u=c[k*3+1];k=c[k*3+2];var t=c[l*3],y=c[l*3+1];l=c[l*3+2];var A=c[o*3],D=c[o*3+1];o=c[o*3+2];a.faces.push(new THREE.Face4(b,d,e,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(v,u,k),new THREE.Vector3(t,y,l),new THREE.Vector3(A,D,o)],h))},uv3:function(a,c,b,d,e,g,h){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(d,e));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,c,b,d,e,g,h,j,k){var l=[];l.push(new THREE.UV(c,
-b));l.push(new THREE.UV(d,e));l.push(new THREE.UV(g,h));l.push(new THREE.UV(j,k));a.push(l)},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(j){j=Math.log(j)/Math.LN2;return Math.floor(j)==j}function d(j,k){var l=new Image;l.onload=function(){if(!b(this.width)||!b(this.height)){var o=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),v=Math.pow(2,Math.round(Math.log(this.height)/
-Math.LN2));j.image.width=o;j.image.height=v;j.image.getContext("2d").drawImage(this,0,0,o,v)}else j.image=this;j.needsUpdate=!0};l.src=k}var e,g,h;e="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(e="MeshPhongMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;d(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*
+createBinModel:function(a,c,b,d){var e=function(g){function h(t,m){var o=p(t,m),B=p(t,m+1),C=p(t,m+2),G=p(t,m+3),Q=(G<<1&255|C>>7)-127;o|=(C&127)<<16|B<<8;if(o==0&&Q==-127)return 0;return(1-2*(G>>7))*(1+o*Math.pow(2,-23))*Math.pow(2,Q)}function j(t,m){var o=p(t,m),B=p(t,m+1),C=p(t,m+2);return(p(t,m+3)<<24)+(C<<16)+(B<<8)+o}function k(t,m){var o=p(t,m);return(p(t,m+1)<<8)+o}function n(t,m){var o=p(t,m);return o>127?o-256:o}function p(t,m){return t.charCodeAt(m)&255}function x(t){var m,o,B;m=j(a,t);
+o=j(a,t+W);B=j(a,t+K);t=k(a,t+f);THREE.Loader.prototype.f3(v,m,o,B,t)}function u(t){var m,o,B,C,G,Q;m=j(a,t);o=j(a,t+W);B=j(a,t+K);C=k(a,t+f);G=j(a,t+V);Q=j(a,t+T);t=j(a,t+da);THREE.Loader.prototype.f3n(v,N,m,o,B,C,G,Q,t)}function q(t){var m,o,B,C;m=j(a,t);o=j(a,t+fa);B=j(a,t+I);C=j(a,t+ca);t=k(a,t+xa);THREE.Loader.prototype.f4(v,m,o,B,C,t)}function y(t){var m,o,B,C,G,Q,H,O;m=j(a,t);o=j(a,t+fa);B=j(a,t+I);C=j(a,t+ca);G=k(a,t+xa);Q=j(a,t+ea);H=j(a,t+va);O=j(a,t+ia);t=j(a,t+ga);THREE.Loader.prototype.f4n(v,
+N,m,o,B,C,G,Q,H,O,t)}function A(t){var m,o;m=j(a,t);o=j(a,t+ta);t=j(a,t+ya);THREE.Loader.prototype.uv3(v.uvs,M[m*2],M[m*2+1],M[o*2],M[o*2+1],M[t*2],M[t*2+1])}function F(t){var m,o,B;m=j(a,t);o=j(a,t+ha);B=j(a,t+aa);t=j(a,t+ma);THREE.Loader.prototype.uv4(v.uvs,M[m*2],M[m*2+1],M[o*2],M[o*2+1],M[B*2],M[B*2+1],M[t*2],M[t*2+1])}var v=this,D=0,w,N=[],M=[],W,K,f,V,T,da,fa,I,ca,xa,ea,va,ia,ga,ta,ya,ha,aa,ma,na,R,ja,qa,l,z;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,d,g);w={signature:a.substr(D,
+8),header_bytes:p(a,D+8),vertex_coordinate_bytes:p(a,D+9),normal_coordinate_bytes:p(a,D+10),uv_coordinate_bytes:p(a,D+11),vertex_index_bytes:p(a,D+12),normal_index_bytes:p(a,D+13),uv_index_bytes:p(a,D+14),material_index_bytes:p(a,D+15),nvertices:j(a,D+16),nnormals:j(a,D+16+4),nuvs:j(a,D+16+8),ntri_flat:j(a,D+16+12),ntri_smooth:j(a,D+16+16),ntri_flat_uv:j(a,D+16+20),ntri_smooth_uv:j(a,D+16+24),nquad_flat:j(a,D+16+28),nquad_smooth:j(a,D+16+32),nquad_flat_uv:j(a,D+16+36),nquad_smooth_uv:j(a,D+16+40)};
+D+=w.header_bytes;W=w.vertex_index_bytes;K=w.vertex_index_bytes*2;f=w.vertex_index_bytes*3;V=w.vertex_index_bytes*3+w.material_index_bytes;T=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;da=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;fa=w.vertex_index_bytes;I=w.vertex_index_bytes*2;ca=w.vertex_index_bytes*3;xa=w.vertex_index_bytes*4;ea=w.vertex_index_bytes*4+w.material_index_bytes;va=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;ia=
+w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;ga=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;ta=w.uv_index_bytes;ya=w.uv_index_bytes*2;ha=w.uv_index_bytes;aa=w.uv_index_bytes*2;ma=w.uv_index_bytes*3;g=w.vertex_index_bytes*3+w.material_index_bytes;z=w.vertex_index_bytes*4+w.material_index_bytes;na=w.ntri_flat*g;R=w.ntri_smooth*(g+w.normal_index_bytes*3);ja=w.ntri_flat_uv*(g+w.uv_index_bytes*3);qa=w.ntri_smooth_uv*(g+w.normal_index_bytes*3+w.uv_index_bytes*
+3);l=w.nquad_flat*z;g=w.nquad_smooth*(z+w.normal_index_bytes*4);z=w.nquad_flat_uv*(z+w.uv_index_bytes*4);D+=function(t){for(var m,o,B,C=w.vertex_coordinate_bytes*3,G=t+w.nvertices*C;t<G;t+=C){m=h(a,t);o=h(a,t+w.vertex_coordinate_bytes);B=h(a,t+w.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(v,m,o,B)}return w.nvertices*C}(D);D+=function(t){for(var m,o,B,C=w.normal_coordinate_bytes*3,G=t+w.nnormals*C;t<G;t+=C){m=n(a,t);o=n(a,t+w.normal_coordinate_bytes);B=n(a,t+w.normal_coordinate_bytes*2);N.push(m/
+127,o/127,B/127)}return w.nnormals*C}(D);D+=function(t){for(var m,o,B=w.uv_coordinate_bytes*2,C=t+w.nuvs*B;t<C;t+=B){m=h(a,t);o=h(a,t+w.uv_coordinate_bytes);M.push(m,o)}return w.nuvs*B}(D);na=D+na;R=na+R;ja=R+ja;qa=ja+qa;l=qa+l;g=l+g;z=g+z;(function(t){var m,o=w.vertex_index_bytes*3+w.material_index_bytes,B=o+w.uv_index_bytes*3,C=t+w.ntri_flat_uv*B;for(m=t;m<C;m+=B){x(m);A(m+o)}return C-t})(R);(function(t){var m,o=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,B=o+w.uv_index_bytes*
+3,C=t+w.ntri_smooth_uv*B;for(m=t;m<C;m+=B){u(m);A(m+o)}return C-t})(ja);(function(t){var m,o=w.vertex_index_bytes*4+w.material_index_bytes,B=o+w.uv_index_bytes*4,C=t+w.nquad_flat_uv*B;for(m=t;m<C;m+=B){q(m);F(m+o)}return C-t})(g);(function(t){var m,o=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,B=o+w.uv_index_bytes*4,C=t+w.nquad_smooth_uv*B;for(m=t;m<C;m+=B){y(m);F(m+o)}return C-t})(z);(function(t){var m,o=w.vertex_index_bytes*3+w.material_index_bytes,B=t+w.ntri_flat*o;for(m=
+t;m<B;m+=o)x(m);return B-t})(D);(function(t){var m,o=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,B=t+w.ntri_smooth*o;for(m=t;m<B;m+=o)u(m);return B-t})(na);(function(t){var m,o=w.vertex_index_bytes*4+w.material_index_bytes,B=t+w.nquad_flat*o;for(m=t;m<B;m+=o)q(m);return B-t})(qa);(function(t){var m,o=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,B=t+w.nquad_smooth*o;for(m=t;m<B;m+=o)y(m);return B-t})(l);this.computeCentroids();this.computeFaceNormals()};
+e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},createModel:function(a,c,b){var d=function(e){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,e);(function(){var h,j,k,n,p;h=0;for(j=a.vertices.length;h<j;h+=3){k=a.vertices[h];n=a.vertices[h+1];p=a.vertices[h+2];THREE.Loader.prototype.v(g,k,n,p)}if(a.colors){h=0;for(j=a.colors.length;h<j;h+=3){k=a.colors[h];n=a.colors[h+1];p=a.colors[h+2];THREE.Loader.prototype.vc(g,k,n,p)}}})();(function(){function h(y,
+A){THREE.Loader.prototype.f3(g,y[A],y[A+1],y[A+2],y[A+3])}function j(y,A){THREE.Loader.prototype.f3n(g,a.normals,y[A],y[A+1],y[A+2],y[A+3],y[A+4],y[A+5],y[A+6])}function k(y,A){THREE.Loader.prototype.f4(g,y[A],y[A+1],y[A+2],y[A+3],y[A+4])}function n(y,A){THREE.Loader.prototype.f4n(g,a.normals,y[A],y[A+1],y[A+2],y[A+3],y[A+4],y[A+5],y[A+6],y[A+7],y[A+8])}function p(y,A){var F,v,D,w,N,M,W,K,f;F=y[A];v=y[A+1];D=y[A+2];w=a.uvs[F*2];W=a.uvs[F*2+1];N=a.uvs[v*2];K=a.uvs[v*2+1];M=a.uvs[D*2];f=a.uvs[D*2+1];
+THREE.Loader.prototype.uv3(g.uvs,w,W,N,K,M,f);if(a.uvs2&&a.uvs2.length){w=a.uvs2[F*2];W=a.uvs2[F*2+1];N=a.uvs2[v*2];K=a.uvs2[v*2+1];M=a.uvs2[D*2];f=a.uvs2[D*2+1];THREE.Loader.prototype.uv3(g.uvs2,w,1-W,N,1-K,M,1-f)}}function x(y,A){var F,v,D,w,N,M,W,K,f,V,T,da;F=y[A];v=y[A+1];D=y[A+2];w=y[A+3];N=a.uvs[F*2];f=a.uvs[F*2+1];M=a.uvs[v*2];V=a.uvs[v*2+1];W=a.uvs[D*2];T=a.uvs[D*2+1];K=a.uvs[w*2];da=a.uvs[w*2+1];THREE.Loader.prototype.uv4(g.uvs,N,f,M,V,W,T,K,da);if(a.uvs2){N=a.uvs2[F*2];f=a.uvs2[F*2+1];M=
+a.uvs2[v*2];V=a.uvs2[v*2+1];W=a.uvs2[D*2];T=a.uvs2[D*2+1];K=a.uvs2[w*2];da=a.uvs2[w*2+1];THREE.Loader.prototype.uv4(g.uvs2,N,1-f,M,1-V,W,1-T,K,1-da)}}var u,q;u=0;for(q=a.trianglesUvs.length;u<q;u+=7){h(a.trianglesUvs,u);p(a.trianglesUvs,u+4)}u=0;for(q=a.trianglesNormalsUvs.length;u<q;u+=10){j(a.trianglesNormalsUvs,u);p(a.trianglesNormalsUvs,u+7)}u=0;for(q=a.quadsUvs.length;u<q;u+=9){k(a.quadsUvs,u);x(a.quadsUvs,u+5)}u=0;for(q=a.quadsNormalsUvs.length;u<q;u+=13){n(a.quadsNormalsUvs,u);x(a.quadsNormalsUvs,
+u+9)}u=0;for(q=a.triangles.length;u<q;u+=4)h(a.triangles,u);u=0;for(q=a.trianglesNormals.length;u<q;u+=7)j(a.trianglesNormals,u);u=0;for(q=a.quads.length;u<q;u+=5)k(a.quads,u);u=0;for(q=a.quadsNormals.length;u<q;u+=9)n(a.quadsNormals,u)})();(function(){var h,j,k,n;if(a.skinWeights){h=0;for(j=a.skinWeights.length;h<j;h+=2){k=a.skinWeights[h];n=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,k,n,0,0)}}if(a.skinIndices){h=0;for(j=a.skinIndices.length;h<j;h+=2){k=a.skinIndices[h];n=a.skinIndices[h+1];
+THREE.Loader.prototype.si(g,k,n,0,0)}}THREE.Loader.prototype.bones(g,a.bones);THREE.Loader.prototype.animation(g,a.animation)})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;c(new d(b))},bones:function(a,c){a.bones=c},animation:function(a,c){a.animation=c},si:function(a,c,b,d,e){a.skinIndices.push(new THREE.Vector4(c,b,d,e))},sw:function(a,c,b,d,e){a.skinWeights.push(new THREE.Vector4(c,b,d,e))},v:function(a,c,b,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,
+b,d)))},vc:function(a,c,b,d){var e=new THREE.Color(16777215);e.setRGB(c,b,d);a.colors.push(e)},f3:function(a,c,b,d,e){a.faces.push(new THREE.Face3(c,b,d,null,a.materials[e]))},f4:function(a,c,b,d,e,g){a.faces.push(new THREE.Face4(c,b,d,e,null,a.materials[g]))},f3n:function(a,c,b,d,e,g,h,j,k){g=a.materials[g];var n=c[j*3],p=c[j*3+1];j=c[j*3+2];var x=c[k*3],u=c[k*3+1];k=c[k*3+2];a.faces.push(new THREE.Face3(b,d,e,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(n,p,j),new THREE.Vector3(x,
+u,k)],g))},f4n:function(a,c,b,d,e,g,h,j,k,n,p){h=a.materials[h];var x=c[k*3],u=c[k*3+1];k=c[k*3+2];var q=c[n*3],y=c[n*3+1];n=c[n*3+2];var A=c[p*3],F=c[p*3+1];p=c[p*3+2];a.faces.push(new THREE.Face4(b,d,e,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(x,u,k),new THREE.Vector3(q,y,n),new THREE.Vector3(A,F,p)],h))},uv3:function(a,c,b,d,e,g,h){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(d,e));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,c,b,d,e,g,h,j,k){var n=[];n.push(new THREE.UV(c,
+b));n.push(new THREE.UV(d,e));n.push(new THREE.UV(g,h));n.push(new THREE.UV(j,k));a.push(n)},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(j){j=Math.log(j)/Math.LN2;return Math.floor(j)==j}function d(j,k){var n=new Image;n.onload=function(){if(!b(this.width)||!b(this.height)){var p=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/
+Math.LN2));j.image.width=p;j.image.height=x;j.image.getContext("2d").drawImage(this,0,0,p,x)}else j.image=this;j.needsUpdate=!0};n.src=k}var e,g,h;e="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(e="MeshPhongMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;d(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*
 255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;d(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[e](g)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -48,7 +48,7 @@ b,c)}}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,j=d*e;this.w=g*f-j*c;this.x=g*c+j*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,j=a.z;a=a.w;this.x=b*a+e*f+c*j-d*g;this.y=c*a+e*g+d*f-b*j;this.z=d*a+e*j+b*g-c*f;this.w=e*a-b*f-c*g-d*j;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,j=this.z,h=this.w,i=h*c+g*e-j*d,p=h*d+j*c-f*e,n=h*e+f*d-g*c;c=-f*c-g*d-j*e;b.x=i*h+c*-f+p*-j-n*-g;b.y=p*h+c*-g+n*-f-i*-j;b.z=n*h+c*-j+i*-g-p*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 1 - 1
build/custom/ThreeDOM.js

@@ -48,7 +48,7 @@ b,c)}}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*e-i*d,n=h*d+i*c-f*e,m=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+n*-i-m*-g;b.y=n*h+c*-g+m*-f-j*-i;b.z=m*h+c*-i+j*-g-n*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;

+ 1 - 1
build/custom/ThreeExtras.js

@@ -38,7 +38,7 @@ var Torus=function(a,d,b,f){this.radius=a||100;this.tube=d||40;this.segmentsR=b|
 var Icosahedron=function(a){function d(v,q,n){var p=Math.sqrt(v*v+q*q+n*n);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(v/p,q/p,n/p)))-1}function b(v,q,n,p){p.faces.push(new THREE.Face3(v,q,n))}function f(v,q){var n=h.vertices[v].position,p=h.vertices[q].position;return d((n.x+p.x)/2,(n.y+p.y)/2,(n.z+p.z)/2)}var h=this,c=new THREE.Geometry,e;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0,
 1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,c);b(0,5,1,c);b(0,1,7,c);b(0,7,10,c);b(0,10,11,c);b(1,5,9,c);b(5,11,4,c);b(11,10,2,c);b(10,7,6,c);b(7,1,8,c);b(3,9,4,c);b(3,4,2,c);b(3,2,6,c);b(3,6,8,c);b(3,8,9,c);b(4,9,5,c);b(2,4,11,c);b(6,2,10,c);b(8,6,7,c);b(9,8,1,c);for(a=0;a<this.subdivisions;a++){e=new THREE.Geometry;for(var g in c.faces){var j=f(c.faces[g].a,c.faces[g].b),m=f(c.faces[g].b,c.faces[g].c),k=f(c.faces[g].c,c.faces[g].a);b(c.faces[g].a,j,k,e);b(c.faces[g].b,m,j,e);b(c.faces[g].c,
 k,m,e);b(j,m,k,e)}c.faces=e.faces}h.faces=c.faces;delete c;delete e;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function LathedObject(a,d,b){THREE.Geometry.call(this);this.nsteps=d||12;this.latheAngle=b||2*Math.PI;d=this.latheAngle/this.nsteps;for(var f=[],h=[],c=[],e=[],g=0;g<a.length;g++){this.vertices.push(new THREE.Vertex(a[g]));h[g]=this.vertices.length-1;f[g]=new THREE.Vector3(a[g].x,a[g].y,a[g].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),m=0;m<=this.latheAngle+0.001;m+=this.stepSize){for(g=0;g<f.length;g++)if(m<b){f[g]=j.multiplyVector3(f[g].clone());this.vertices.push(new THREE.Vertex(f[g]));
+function LathedObject(a,d,b){THREE.Geometry.call(this);this.nsteps=d||12;this.latheAngle=b||2*Math.PI;d=this.latheAngle/this.nsteps;for(var f=[],h=[],c=[],e=[],g=0;g<a.length;g++){this.vertices.push(new THREE.Vertex(a[g]));h[g]=this.vertices.length-1;f[g]=new THREE.Vector3(a[g].x,a[g].y,a[g].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),m=0;m<=this.latheAngle+0.0010;m+=this.stepSize){for(g=0;g<f.length;g++)if(m<b){f[g]=j.multiplyVector3(f[g].clone());this.vertices.push(new THREE.Vertex(f[g]));
 c[g]=this.vertices.length-1}else c=e;m==0&&(e=h);for(g=0;g<h.length-1;g++){this.faces.push(new THREE.Face4(c[g],c[g+1],h[g+1],h[g]));this.uvs.push([new THREE.UV(m/b,g/a.length),new THREE.UV(m/b,(g+1)/a.length),new THREE.UV((m-d)/b,(g+1)/a.length),new THREE.UV((m-d)/b,g/a.length)])}h=c;c=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
 if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(a,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=

+ 1 - 1
build/custom/ThreeSVG.js

@@ -48,7 +48,7 @@ b,c)}}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,l=h*c+g*e-i*d,n=h*d+i*c-f*e,m=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=l*h+c*-f+n*-i-m*-g;b.y=n*h+c*-g+m*-f-l*-i;b.z=m*h+c*-i+l*-g-n*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 92 - 92
build/custom/ThreeWebGL.js

@@ -12,33 +12,33 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,d,e){this.set(a||0,b||0,d||0,e||1)};
 THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,g=[];a=0;for(b=e.length;a<b;a++){d=e[a];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(l,m){return l.distance-m.distance});return g},intersectObject:function(a){function b(I,J,P,S){S=S.clone().subSelf(J);P=P.clone().subSelf(J);var Z=I.clone().subSelf(J);I=S.dot(S);J=S.dot(P);S=S.dot(Z);var da=P.dot(P);P=P.dot(Z);Z=1/(I*da-J*J);da=(da*S-J*P)*Z;I=(I*P-J*S)*Z;return da>0&&I>0&&da+I<1}var d,e,g,l,m,p,o,
-q,u,x,A,B=a.geometry,G=B.vertices,H=[];d=0;for(e=B.faces.length;d<e;d++){g=B.faces[d];x=this.origin.clone();A=this.direction.clone();o=a.matrixWorld;l=o.multiplyVector3(G[g.a].position.clone());m=o.multiplyVector3(G[g.b].position.clone());p=o.multiplyVector3(G[g.c].position.clone());o=g instanceof THREE.Face4?o.multiplyVector3(G[g.d].position.clone()):null;q=a.matrixRotationWorld.multiplyVector3(g.normal.clone());u=A.dot(q);if(u<0){q=q.dot((new THREE.Vector3).sub(l,x))/u;x=x.addSelf(A.multiplyScalar(q));
-if(g instanceof THREE.Face3){if(b(x,l,m,p)){g={distance:this.origin.distanceTo(x),point:x,face:g,object:a};H.push(g)}}else if(g instanceof THREE.Face4&&(b(x,l,m,o)||b(x,m,p,o))){g={distance:this.origin.distanceTo(x),point:x,face:g,object:a};H.push(g)}}}return H}};
-THREE.Rectangle=function(){function a(){l=e-b;m=g-d}var b,d,e,g,l,m,p=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return l};this.getHeight=function(){return m};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(o,q,u,x){p=!1;b=o;d=q;e=u;g=x;a()};this.addPoint=function(o,q){if(p){p=!1;b=o;d=q;e=o;g=q}else{b=b<o?b:o;d=d<q?d:q;e=e>o?e:o;g=g>q?g:q}a()};
-this.add3Points=function(o,q,u,x,A,B){if(p){p=!1;b=o<u?o<A?o:A:u<A?u:A;d=q<x?q<B?q:B:x<B?x:B;e=o>u?o>A?o:A:u>A?u:A;g=q>x?q>B?q:B:x>B?x:B}else{b=o<u?o<A?o<b?o:b:A<b?A:b:u<A?u<b?u:b:A<b?A:b;d=q<x?q<B?q<d?q:d:B<d?B:d:x<B?x<d?x:d:B<d?B:d;e=o>u?o>A?o>e?o:e:A>e?A:e:u>A?u>e?u:e:A>e?A:e;g=q>x?q>B?q>g?q:g:B>g?B:g:x>B?x>g?x:g:B>g?B:g}a()};this.addRectangle=function(o){if(p){p=!1;b=o.getLeft();d=o.getTop();e=o.getRight();g=o.getBottom()}else{b=b<o.getLeft()?b:o.getLeft();d=d<o.getTop()?d:o.getTop();e=e>o.getRight()?
+THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,g=[];a=0;for(b=e.length;a<b;a++){d=e[a];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(l,m){return l.distance-m.distance});return g},intersectObject:function(a){function b(L,I,Q,O){O=O.clone().subSelf(I);Q=Q.clone().subSelf(I);var Y=L.clone().subSelf(I);L=O.dot(O);I=O.dot(Q);O=O.dot(Y);var $=Q.dot(Q);Q=Q.dot(Y);Y=1/(L*$-I*I);$=($*O-I*Q)*Y;L=(L*Q-I*O)*Y;return $>0&&L>0&&$+L<1}var d,e,g,l,m,p,o,u,y,x,
+v,B=a.geometry,H=B.vertices,G=[];d=0;for(e=B.faces.length;d<e;d++){g=B.faces[d];x=this.origin.clone();v=this.direction.clone();o=a.matrixWorld;l=o.multiplyVector3(H[g.a].position.clone());m=o.multiplyVector3(H[g.b].position.clone());p=o.multiplyVector3(H[g.c].position.clone());o=g instanceof THREE.Face4?o.multiplyVector3(H[g.d].position.clone()):null;u=a.matrixRotationWorld.multiplyVector3(g.normal.clone());y=v.dot(u);if(y<0){u=u.dot((new THREE.Vector3).sub(l,x))/y;x=x.addSelf(v.multiplyScalar(u));
+if(g instanceof THREE.Face3){if(b(x,l,m,p)){g={distance:this.origin.distanceTo(x),point:x,face:g,object:a};G.push(g)}}else if(g instanceof THREE.Face4&&(b(x,l,m,o)||b(x,m,p,o))){g={distance:this.origin.distanceTo(x),point:x,face:g,object:a};G.push(g)}}}return G}};
+THREE.Rectangle=function(){function a(){l=e-b;m=g-d}var b,d,e,g,l,m,p=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return l};this.getHeight=function(){return m};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(o,u,y,x){p=!1;b=o;d=u;e=y;g=x;a()};this.addPoint=function(o,u){if(p){p=!1;b=o;d=u;e=o;g=u}else{b=b<o?b:o;d=d<u?d:u;e=e>o?e:o;g=g>u?g:u}a()};
+this.add3Points=function(o,u,y,x,v,B){if(p){p=!1;b=o<y?o<v?o:v:y<v?y:v;d=u<x?u<B?u:B:x<B?x:B;e=o>y?o>v?o:v:y>v?y:v;g=u>x?u>B?u:B:x>B?x:B}else{b=o<y?o<v?o<b?o:b:v<b?v:b:y<v?y<b?y:b:v<b?v:b;d=u<x?u<B?u<d?u:d:B<d?B:d:x<B?x<d?x:d:B<d?B:d;e=o>y?o>v?o>e?o:e:v>e?v:e:y>v?y>e?y:e:v>e?v:e;g=u>x?u>B?u>g?u:g:B>g?B:g:x>B?x>g?x:g:B>g?B:g}a()};this.addRectangle=function(o){if(p){p=!1;b=o.getLeft();d=o.getTop();e=o.getRight();g=o.getBottom()}else{b=b<o.getLeft()?b:o.getLeft();d=d<o.getTop()?d:o.getTop();e=e>o.getRight()?
 e:o.getRight();g=g>o.getBottom()?g:o.getBottom()}a()};this.inflate=function(o){b-=o;d-=o;e+=o;g+=o;a()};this.minSelf=function(o){b=b>o.getLeft()?b:o.getLeft();d=d>o.getTop()?d:o.getTop();e=e<o.getRight()?e:o.getRight();g=g<o.getBottom()?g:o.getBottom();a()};this.instersects=function(o){return Math.min(e,o.getRight())-Math.max(b,o.getLeft())>=0&&Math.min(g,o.getBottom())-Math.max(d,o.getTop())>=0};this.empty=function(){p=!0;g=e=d=b=0;a()};this.isEmpty=function(){return p}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,d,e,g,l,m,p,o,q,u,x,A,B,G,H){this.set(a||1,b||0,d||0,e||0,g||0,l||1,m||0,p||0,o||0,q||0,u||1,x||0,A||0,B||0,G||0,H||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,d,e,g,l,m,p,o,q,u,x,A,B,G,H){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=g;this.n22=l;this.n23=m;this.n24=p;this.n31=o;this.n32=q;this.n33=u;this.n34=x;this.n41=A;this.n42=B;this.n43=G;this.n44=H;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__v1,
+THREE.Matrix4=function(a,b,d,e,g,l,m,p,o,u,y,x,v,B,H,G){this.set(a||1,b||0,d||0,e||0,g||0,l||1,m||0,p||0,o||0,u||0,y||1,x||0,v||0,B||0,H||0,G||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,d,e,g,l,m,p,o,u,y,x,v,B,H,G){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=g;this.n22=l;this.n23=m;this.n24=p;this.n31=o;this.n32=u;this.n33=y;this.n34=x;this.n41=v;this.n42=B;this.n43=H;this.n44=G;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__v1,
 g=THREE.Matrix4.__v2,l=THREE.Matrix4.__v3;l.sub(a,b).normalize();if(l.length()===0)l.z=1;e.cross(d,l).normalize();if(e.length()===0){l.x+=1.0E-4;e.cross(d,l).normalize()}g.cross(l,e).normalize();this.n11=e.x;this.n12=g.x;this.n13=l.x;this.n21=e.y;this.n22=g.y;this.n23=l.y;this.n31=e.z;this.n32=g.z;this.n33=l.z;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,g=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*d+this.n23*
 e+this.n24)*g;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*g;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*g;return a},rotateAxis:function(a){var b=a.x,d=a.y,e=a.z;a.x=b*this.n11+d*this.n12+e*this.n13;a.y=b*this.n21+d*this.n22+e*this.n23;a.z=b*this.n31+d*this.n32+e*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,g=a.n13,l=a.n14,m=a.n21,p=a.n22,o=a.n23,q=a.n24,u=a.n31,x=a.n32,A=a.n33,B=a.n34,G=a.n41,H=a.n42,I=a.n43,J=a.n44,P=b.n11,S=b.n12,Z=b.n13,da=b.n14,$=b.n21,fa=b.n22,
-c=b.n23,pa=b.n24,na=b.n31,va=b.n32,qa=b.n33,ra=b.n34;this.n11=d*P+e*$+g*na;this.n12=d*S+e*fa+g*va;this.n13=d*Z+e*c+g*qa;this.n14=d*da+e*pa+g*ra+l;this.n21=m*P+p*$+o*na;this.n22=m*S+p*fa+o*va;this.n23=m*Z+p*c+o*qa;this.n24=m*da+p*pa+o*ra+q;this.n31=u*P+x*$+A*na;this.n32=u*S+x*fa+A*va;this.n33=u*Z+x*c+A*qa;this.n34=u*da+x*pa+A*ra+B;this.n41=G*P+H*$+I*na;this.n42=G*S+H*fa+I*va;this.n43=G*Z+H*c+I*qa;this.n44=G*da+H*pa+I*ra+J;return this},multiplyToArray:function(a,b,d){this.multiply(a,b);d[0]=this.n11;
-d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=
-a;return this},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,e=this.n14,g=this.n21,l=this.n22,m=this.n23,p=this.n24,o=this.n31,q=this.n32,u=this.n33,x=this.n34,A=this.n41,B=this.n42,G=this.n43,H=this.n44;return e*m*q*A-d*p*q*A-e*l*u*A+b*p*u*A+d*l*x*A-b*m*x*A-e*m*o*B+d*p*o*B+e*g*u*B-a*p*u*B-d*g*x*B+a*m*x*B+e*l*o*G-b*p*o*G-e*g*q*G+a*p*q*G+b*g*x*G-a*l*x*G-d*l*o*H+b*m*o*H+d*g*q*H-a*m*q*H-b*g*u*H+a*l*u*H},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;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 d=a.n11,e=a.n12,g=a.n13,l=a.n14,m=a.n21,p=a.n22,o=a.n23,u=a.n24,y=a.n31,x=a.n32,v=a.n33,B=a.n34,H=a.n41,G=a.n42,L=a.n43,I=a.n44,Q=b.n11,O=b.n12,Y=b.n13,$=b.n14,Z=b.n21,ca=b.n22,
+c=b.n23,la=b.n24,oa=b.n31,va=b.n32,qa=b.n33,ra=b.n34;this.n11=d*Q+e*Z+g*oa;this.n12=d*O+e*ca+g*va;this.n13=d*Y+e*c+g*qa;this.n14=d*$+e*la+g*ra+l;this.n21=m*Q+p*Z+o*oa;this.n22=m*O+p*ca+o*va;this.n23=m*Y+p*c+o*qa;this.n24=m*$+p*la+o*ra+u;this.n31=y*Q+x*Z+v*oa;this.n32=y*O+x*ca+v*va;this.n33=y*Y+x*c+v*qa;this.n34=y*$+x*la+v*ra+B;this.n41=H*Q+G*Z+L*oa;this.n42=H*O+G*ca+L*va;this.n43=H*Y+G*c+L*qa;this.n44=H*$+G*la+L*ra+I;return this},multiplyToArray:function(a,b,d){this.multiply(a,b);d[0]=this.n11;d[1]=
+this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=
+a;return this},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,e=this.n14,g=this.n21,l=this.n22,m=this.n23,p=this.n24,o=this.n31,u=this.n32,y=this.n33,x=this.n34,v=this.n41,B=this.n42,H=this.n43,G=this.n44;return e*m*u*v-d*p*u*v-e*l*y*v+b*p*y*v+d*l*x*v-b*m*x*v-e*m*o*B+d*p*o*B+e*g*y*B-a*p*y*B-d*g*x*B+a*m*x*B+e*l*o*H-b*p*o*H-e*g*u*H+a*p*u*H+b*g*x*H-a*l*x*H-d*l*o*G+b*m*o*G+d*g*u*G-a*m*u*G-b*g*y*G+a*l*y*G},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
 this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=
 this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;
 a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,
 0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),g=
-1-d,l=a.x,m=a.y,p=a.z,o=g*l,q=g*m;this.set(o*l+d,o*m-e*p,o*p+e*m,0,o*m+e*p,q*m+d,q*p-e*l,0,o*p-e*m,q*p+e*l,g*p*p+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var l=Math.cos(e);e=Math.sin(e);var m=a*d,p=b*d;this.n11=g*l;this.n12=-g*e;this.n13=d;this.n21=p*l+a*e;this.n22=-p*e+a*l;this.n23=-b*g;this.n31=-m*l+b*e;this.n32=m*e+b*l;this.n33=
-a*g;return this},setRotationFromQuaternion:function(a){var b=a.x,d=a.y,e=a.z,g=a.w,l=b+b,m=d+d,p=e+e;a=b*l;var o=b*m;b*=p;var q=d*m;d*=p;e*=p;l*=g;m*=g;g*=p;this.n11=1-(q+e);this.n12=o-g;this.n13=b+m;this.n21=o+g;this.n22=1-(a+e);this.n23=d-l;this.n31=b-m;this.n32=d+l;this.n33=1-(a+q);return this},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=d;this.n13*=a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=
+1-d,l=a.x,m=a.y,p=a.z,o=g*l,u=g*m;this.set(o*l+d,o*m-e*p,o*p+e*m,0,o*m+e*p,u*m+d,u*p-e*l,0,o*p-e*m,u*p+e*l,g*p*p+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var l=Math.cos(e);e=Math.sin(e);var m=a*d,p=b*d;this.n11=g*l;this.n12=-g*e;this.n13=d;this.n21=p*l+a*e;this.n22=-p*e+a*l;this.n23=-b*g;this.n31=-m*l+b*e;this.n32=m*e+b*l;this.n33=
+a*g;return this},setRotationFromQuaternion:function(a){var b=a.x,d=a.y,e=a.z,g=a.w,l=b+b,m=d+d,p=e+e;a=b*l;var o=b*m;b*=p;var u=d*m;d*=p;e*=p;l*=g;m*=g;g*=p;this.n11=1-(u+e);this.n12=o-g;this.n13=b+m;this.n21=o+g;this.n22=1-(a+e);this.n23=d-l;this.n31=b-m;this.n32=d+l;this.n33=1-(a+u);return this},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=d;this.n13*=a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=
 a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var d=1/b.x,e=1/b.y,g=1/b.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*g;this.n23=a.n23*g;this.n33=a.n33*g}};
-THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,g=a.n13,l=a.n14,m=a.n21,p=a.n22,o=a.n23,q=a.n24,u=a.n31,x=a.n32,A=a.n33,B=a.n34,G=a.n41,H=a.n42,I=a.n43,J=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=o*B*H-q*A*H+q*x*I-p*B*I-o*x*J+p*A*J;b.n12=l*A*H-g*B*H-l*x*I+e*B*I+g*x*J-e*A*J;b.n13=g*q*H-l*o*H+l*p*I-e*q*I-g*p*J+e*o*J;b.n14=l*o*x-g*q*x-l*p*A+e*q*A+g*p*B-e*o*B;b.n21=q*A*G-o*B*G-q*u*I+m*B*I+o*u*J-m*A*J;b.n22=g*B*G-l*A*G+l*u*I-d*B*I-g*u*J+d*A*J;b.n23=l*o*G-g*q*G-l*m*I+d*q*I+g*m*J-d*o*J;
-b.n24=g*q*u-l*o*u+l*m*A-d*q*A-g*m*B+d*o*B;b.n31=p*B*G-q*x*G+q*u*H-m*B*H-p*u*J+m*x*J;b.n32=l*x*G-e*B*G-l*u*H+d*B*H+e*u*J-d*x*J;b.n33=g*q*G-l*p*G+l*m*H-d*q*H-e*m*J+d*p*J;b.n34=l*p*u-e*q*u-l*m*x+d*q*x+e*m*B-d*p*B;b.n41=o*x*G-p*A*G-o*u*H+m*A*H+p*u*I-m*x*I;b.n42=e*A*G-g*x*G+g*u*H-d*A*H-e*u*I+d*x*I;b.n43=g*p*G-e*o*G-g*m*H+d*o*H+e*m*I-d*p*I;b.n44=e*o*u-g*p*u+g*m*x-d*o*x-e*m*A+d*p*A;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,l=a.n32*a.n21-a.n31*a.n22,m=-a.n33*a.n12+a.n32*a.n13,p=a.n33*a.n11-a.n31*a.n13,o=-a.n32*a.n11+a.n31*a.n12,q=a.n23*a.n12-a.n22*a.n13,u=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*m+a.n31*q;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*g;d[2]=a*l;d[3]=a*m;d[4]=a*p;d[5]=a*o;d[6]=a*q;d[7]=a*u;d[8]=a*x;return b};
+THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,g=a.n13,l=a.n14,m=a.n21,p=a.n22,o=a.n23,u=a.n24,y=a.n31,x=a.n32,v=a.n33,B=a.n34,H=a.n41,G=a.n42,L=a.n43,I=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=o*B*G-u*v*G+u*x*L-p*B*L-o*x*I+p*v*I;b.n12=l*v*G-g*B*G-l*x*L+e*B*L+g*x*I-e*v*I;b.n13=g*u*G-l*o*G+l*p*L-e*u*L-g*p*I+e*o*I;b.n14=l*o*x-g*u*x-l*p*v+e*u*v+g*p*B-e*o*B;b.n21=u*v*H-o*B*H-u*y*L+m*B*L+o*y*I-m*v*I;b.n22=g*B*H-l*v*H+l*y*L-d*B*L-g*y*I+d*v*I;b.n23=l*o*H-g*u*H-l*m*L+d*u*L+g*m*I-d*o*I;
+b.n24=g*u*y-l*o*y+l*m*v-d*u*v-g*m*B+d*o*B;b.n31=p*B*H-u*x*H+u*y*G-m*B*G-p*y*I+m*x*I;b.n32=l*x*H-e*B*H-l*y*G+d*B*G+e*y*I-d*x*I;b.n33=g*u*H-l*p*H+l*m*G-d*u*G-e*m*I+d*p*I;b.n34=l*p*y-e*u*y-l*m*x+d*u*x+e*m*B-d*p*B;b.n41=o*x*H-p*v*H-o*y*G+m*v*G+p*y*L-m*x*L;b.n42=e*v*H-g*x*H+g*y*G-d*v*G-e*y*L+d*x*L;b.n43=g*p*H-e*o*H-g*m*G+d*o*G+e*m*L-d*p*L;b.n44=e*o*y-g*p*y+g*m*x-d*o*x-e*m*v+d*p*v;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,l=a.n32*a.n21-a.n31*a.n22,m=-a.n33*a.n12+a.n32*a.n13,p=a.n33*a.n11-a.n31*a.n13,o=-a.n32*a.n11+a.n31*a.n12,u=a.n23*a.n12-a.n22*a.n13,y=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*m+a.n31*u;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*g;d[2]=a*l;d[3]=a*m;d[4]=a*p;d[5]=a*o;d[6]=a*u;d[7]=a*y;d[8]=a*x;return b};
 THREE.Matrix4.makeFrustum=function(a,b,d,e,g,l){var m;m=new THREE.Matrix4;m.n11=2*g/(b-a);m.n12=0;m.n13=(b+a)/(b-a);m.n14=0;m.n21=0;m.n22=2*g/(e-d);m.n23=(e+d)/(e-d);m.n24=0;m.n31=0;m.n32=0;m.n33=-(l+g)/(l-g);m.n34=-2*l*g/(l-g);m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};THREE.Matrix4.makePerspective=function(a,b,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,d,e)};
-THREE.Matrix4.makeOrtho=function(a,b,d,e,g,l){var m,p,o,q;m=new THREE.Matrix4;p=b-a;o=d-e;q=l-g;m.n11=2/p;m.n12=0;m.n13=0;m.n14=-((b+a)/p);m.n21=0;m.n22=2/o;m.n23=0;m.n24=-((d+e)/o);m.n31=0;m.n32=0;m.n33=-2/q;m.n34=-((l+g)/q);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Matrix4.makeOrtho=function(a,b,d,e,g,l){var m,p,o,u;m=new THREE.Matrix4;p=b-a;o=d-e;u=l-g;m.n11=2/p;m.n12=0;m.n13=0;m.n14=-((b+a)/p);m.n21=0;m.n22=2/o;m.n23=0;m.n24=-((d+e)/o);m.n31=0;m.n32=0;m.n33=-2/u;m.n34=-((l+g)/u);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
@@ -47,8 +47,8 @@ undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b
 b,d)}}};THREE.Quaternion=function(a,b,d,e){this.set(a||0,b||0,d||0,e!==undefined?e:1)};
 THREE.Quaternion.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var l=Math.cos(d);d=Math.sin(d);var m=a*b,p=e*g;this.w=m*l-p*d;this.x=m*d+p*l;this.y=e*b*l+a*g*d;this.z=a*g*l-e*b*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,e=this.z,g=this.w,l=a.x,m=a.y,p=a.z;a=a.w;this.x=b*a+g*l+d*p-e*m;this.y=d*a+g*m+e*l-b*p;this.z=e*a+g*p+b*m-d*l;this.w=g*a-b*l-d*m-e*p;return this},
-multiplyVector3:function(a,b){b||(b=a);var d=a.x,e=a.y,g=a.z,l=this.x,m=this.y,p=this.z,o=this.w,q=o*d+m*g-p*e,u=o*e+p*d-l*g,x=o*g+l*e-m*d;d=-l*d-m*e-p*g;b.x=q*o+d*-l+u*-p-x*-m;b.y=u*o+d*-m+x*-l-q*-p;b.z=x*o+d*-p+q*-m-u*-l;return b}};
-THREE.Quaternion.slerp=function(a,b,d,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var l=Math.acos(g),m=Math.sqrt(1-g*g);if(Math.abs(m)<0.001){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}g=Math.sin((1-e)*l)/m;e=Math.sin(e*l)/m;d.w=a.w*g+b.w*e;d.x=a.x*g+b.x*e;d.y=a.y*g+b.y*e;d.z=a.z*g+b.z*e;return d};
+multiplyVector3:function(a,b){b||(b=a);var d=a.x,e=a.y,g=a.z,l=this.x,m=this.y,p=this.z,o=this.w,u=o*d+m*g-p*e,y=o*e+p*d-l*g,x=o*g+l*e-m*d;d=-l*d-m*e-p*g;b.x=u*o+d*-l+y*-p-x*-m;b.y=y*o+d*-m+x*-l-u*-p;b.z=x*o+d*-p+u*-m-y*-l;return b}};
+THREE.Quaternion.slerp=function(a,b,d,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var l=Math.acos(g),m=Math.sqrt(1-g*g);if(Math.abs(m)<0.0010){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}g=Math.sin((1-e)*l)/m;e=Math.sin(e*l)/m;d.w=a.w*g+b.w*e;d.x=a.x*g+b.x*e;d.y=a.y*g+b.y*e;d.z=a.z*g+b.z*e;return d};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,d,e,g){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face4=function(a,b,d,e,g,l){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=l instanceof Array?l:[l]};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -56,17 +56,17 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.f
 d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,g,l,m,p=new THREE.Vector3,o=new THREE.Vector3;e=0;for(g=this.vertices.length;e<g;e++){l=this.vertices[e];l.normal.set(0,0,0)}e=0;for(g=this.faces.length;e<g;e++){l=this.faces[e];if(a&&l.vertexNormals.length){p.set(0,0,0);b=0;for(d=l.vertexNormals.length;b<d;b++)p.addSelf(l.vertexNormals[b]);p.divideScalar(3)}else{b=this.vertices[l.a];d=this.vertices[l.b];m=this.vertices[l.c];p.sub(m.position,
 d.position);o.sub(b.position,d.position);p.crossSelf(o)}p.isZero()||p.normalize();l.normal.copy(p)}},computeVertexNormals:function(){var a,b,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<
-b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(ra,Ba,Ca,xa,Fa,Ga,Ha){l=ra.vertices[Ba].position;m=ra.vertices[Ca].position;p=ra.vertices[xa].position;o=g[Fa];q=g[Ga];u=g[Ha];x=m.x-l.x;A=p.x-l.x;B=m.y-
-l.y;G=p.y-l.y;H=m.z-l.z;I=p.z-l.z;J=q.u-o.u;P=u.u-o.u;S=q.v-o.v;Z=u.v-o.v;da=1/(J*Z-P*S);c.set((Z*x-S*A)*da,(Z*B-S*G)*da,(Z*H-S*I)*da);pa.set((J*A-P*x)*da,(J*G-P*B)*da,(J*I-P*H)*da);$[Ba].addSelf(c);$[Ca].addSelf(c);$[xa].addSelf(c);fa[Ba].addSelf(pa);fa[Ca].addSelf(pa);fa[xa].addSelf(pa)}var b,d,e,g,l,m,p,o,q,u,x,A,B,G,H,I,J,P,S,Z,da,$=[],fa=[],c=new THREE.Vector3,pa=new THREE.Vector3,na=new THREE.Vector3,va=new THREE.Vector3,qa=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){$[b]=new THREE.Vector3;
-fa[b]=new THREE.Vector3}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];g=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
-this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){qa.copy(this.vertices[b].normal);e=$[b];na.copy(e);na.subSelf(qa.multiplyScalar(qa.dot(e))).normalize();va.cross(this.vertices[b].normal,e);e=va.dot(fa[b]);e=e<0?-1:1;this.vertices[b].tangent.set(na.x,na.y,na.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
+b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(ra,Ba,Ca,xa,Fa,Ga,Ha){l=ra.vertices[Ba].position;m=ra.vertices[Ca].position;p=ra.vertices[xa].position;o=g[Fa];u=g[Ga];y=g[Ha];x=m.x-l.x;v=p.x-l.x;B=m.y-
+l.y;H=p.y-l.y;G=m.z-l.z;L=p.z-l.z;I=u.u-o.u;Q=y.u-o.u;O=u.v-o.v;Y=y.v-o.v;$=1/(I*Y-Q*O);c.set((Y*x-O*v)*$,(Y*B-O*H)*$,(Y*G-O*L)*$);la.set((I*v-Q*x)*$,(I*H-Q*B)*$,(I*L-Q*G)*$);Z[Ba].addSelf(c);Z[Ca].addSelf(c);Z[xa].addSelf(c);ca[Ba].addSelf(la);ca[Ca].addSelf(la);ca[xa].addSelf(la)}var b,d,e,g,l,m,p,o,u,y,x,v,B,H,G,L,I,Q,O,Y,$,Z=[],ca=[],c=new THREE.Vector3,la=new THREE.Vector3,oa=new THREE.Vector3,va=new THREE.Vector3,qa=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){Z[b]=new THREE.Vector3;
+ca[b]=new THREE.Vector3}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];g=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
+this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){qa.copy(this.vertices[b].normal);e=Z[b];oa.copy(e);oa.subSelf(qa.multiplyScalar(qa.dot(e))).normalize();va.cross(this.vertices[b].normal,e);e=va.dot(ca[b]);e=e<0?-1:1;this.vertices[b].tangent.set(oa.x,oa.y,oa.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,d=this.vertices.length;b<d;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
 THREE.Camera=function(a,b,d,e,g){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=d||0.1;this.far=e||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,d)};
-THREE.QuakeCamera=function(a){function b(d,e){return function(){e.apply(d,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
+THREE.QuakeCamera=function(a){function b(d,e){return function(){e.apply(d,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(d){d.preventDefault();d.stopPropagation();if(!this.dragToLook)switch(d.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(d){d.preventDefault();d.stopPropagation();if(!this.dragToLook)switch(d.button){case 0:this.moveForward=
 !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(d){this.mouseX=d.clientX-this.windowHalfX;this.mouseY=d.clientY-this.windowHalfY};this.onKeyDown=function(d){switch(d.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(d){switch(d.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
@@ -74,18 +74,18 @@ this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBack
 var d=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(d=0);this.lon+=this.mouseX*d;this.lookVertical&&(this.lat-=this.mouseY*d);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;d=this.target.position;var e=this.position;d.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);d.y=e.y+100*Math.cos(this.phi);d.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(d){d.preventDefault()},
 !1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(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,b){this.matrix.rotateAxis(b);if(this.noFly)b.y=0;this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};
-THREE.PathCamera=function(a){function b(q,u){var x=q[0]-u[0],A=q[1]-u[1],B=q[2]-u[2];return Math.sqrt(x*x+A*A+B*B)}function d(q,u,x,A){var B={name:x,fps:0.6,length:A,hierarchy:[]},G,H;G=u.length;var I,J,P=[];H=new THREE.Spline;var S=0;for(I=0;I<u.length;I++){J=u[I];P[I]={x:J[0],y:J[1],z:J[2]}}var Z=[u[0][0],u[0][1],u[0][2]];for(I=1;I<P.length*100;I++){J=I/(P.length*100);position=H.getPoint(P,J);S+=b([position.x,position.y,position.z],Z);Z=[position.x,position.y,position.z]}I=S;P=0;S=G-1;H={parent:-1,
-keys:[]};H.keys[0]={time:0,pos:u[0],rot:[0,0,0,1],scl:[1,1,1]};H.keys[S]={time:A,pos:u[S],rot:[0,0,0,1],scl:[1,1,1]};console.log("path totalLength: ",I);for(G=1;G<S;G++){P+=A*b(u[G],u[G-1])/I;H.keys[G]={time:P,pos:u[G]}}B.hierarchy[0]=H;THREE.AnimationHandler.add(B);return new THREE.Animation(q,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(q,u){var x,A,B=new THREE.Geometry,G=new THREE.Spline,H=[];for(x=0;x<u.length;x++){A=u[x];H[x]={x:A[0],y:A[1],z:A[2]}}for(x=0;x<H.length*10;x++){A=
-x/(H.length*10);A=G.getPoint(H,A);B.vertices[x]=new THREE.Vertex(new THREE.Vector3(A.x,A.y,A.z))}x=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(B,x);lineObj.scale.set(1,1,1);q.addChild(lineObj);x=new Sphere(1,16,8);G=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<u.length;i++){B=new THREE.Mesh(x,G);B.position.set(u[i][0],u[i][1],u[i][2]);B.updateMatrix();q.addChild(B)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.duration=1E4;this.waypoints=
-[];this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=!0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
-if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
-this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,l=Math.PI/180;this.updateManual=function(){var q,u;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)*l;this.theta=this.lon*l;q=this.phi%g;this.phi=q>=0?q:q+g;q=this.verticalAngleMap.srcRange;u=this.verticalAngleMap.dstRange;
-this.phi=(this.phi-q[0])*(u[1]-u[0])/(q[1]-q[0])+u[0];q=this.horizontalAngleMap.srcRange;u=this.horizontalAngleMap.dstRange;this.theta=(this.theta-q[0])*(u[1]-u[0])/(q[1]-q[0])+u[0];q=this.target.position;u=this.position;q.x=u.x+100*Math.sin(this.phi)*Math.cos(this.theta);q.y=u.y+100*Math.cos(this.phi);q.z=u.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.onMouseMove=function(q){this.mouseX=q.clientX-this.windowHalfX;this.mouseY=q.clientY-this.windowHalfY};if(this.createDebugDummy){a=
-new THREE.MeshLambertMaterial({color:30719});var m=new THREE.MeshLambertMaterial({color:65280}),p=new Cube(10,10,20),o=new Cube(2,2,10);this.animationParent=new THREE.Mesh(p,a);a=new THREE.Mesh(o,m);a.position.set(0,10,0);this.animation=d(this.animationParent,this.waypoints,"cameraPath01",this.duration);this.animationParent.addChild(this);this.animationParent.addChild(a)}else{this.animation=d(this.animationParent,this.waypoints,"cameraPath01",this.duration);this.animationParent.addChild(this)}this.createDebugPath&&
-e(this.debugPath,this.waypoints);this.domElement.addEventListener("mousemove",function(q,u){return function(){u.apply(q,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.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;
-THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;
-THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};
-THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
+THREE.PathCamera=function(a){function b(u,y,x,v){var B={name:x,fps:0.6,length:v,hierarchy:[]},H,G,L=y.length,I,Q,O;I=[];H=new THREE.Spline;var Y=Q=Q=0,$=[0],Z=0;for(G=0;G<y.length;G++){O=y[G];I[G]={x:O[0],y:O[1],z:O[2]}}O=[y[0][0],y[0][1],y[0][2]];for(G=1;G<I.length*100;G++){Q=G/(I.length*100);position=H.getPoint(I,Q);var ca=[position.x,position.y,position.z],c=ca[0]-O[0],la=ca[1]-O[1];O=ca[2]-O[2];Z+=Math.sqrt(c*c+la*la+O*O);O=[position.x,position.y,position.z];Q*=I.length-1;Q=Math.floor(Q);if(Q!=
+Y){$[Q]=Z;Y=Q}}I={chunks:$,total:Z};Y=0;H=L-1;G={parent:-1,keys:[]};G.keys[0]={time:0,pos:y[0],rot:[0,0,0,1],scl:[1,1,1]};G.keys[H]={time:v,pos:y[H],rot:[0,0,0,1],scl:[1,1,1]};console.log("path length total:",I.total,"chunks:",I.chunks);for(H=1;H<L-1;H++){Y=v*I.chunks[H]/I.total;G.keys[H]={time:Y,pos:y[H]};console.log(H,Y/1E3)}B.hierarchy[0]=G;THREE.AnimationHandler.add(B);return new THREE.Animation(u,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function d(u,y){var x,v,B=new THREE.Geometry,H=new THREE.Spline,
+G=[];for(x=0;x<u.length;x++){v=u[x];G[x]={x:v[0],y:v[1],z:v[2]}}for(x=0;x<G.length*y;x++){v=x/(G.length*y);v=H.getPoint(G,v);B.vertices[x]=new THREE.Vertex(new THREE.Vector3(v.x,v.y,v.z))}return B}function e(u,y){var x=d(y,10),v=d(y,10),B=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,B);particleObj=new THREE.ParticleSystem(v,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);u.addChild(lineObj);particleObj.scale.set(1,1,1);u.addChild(particleObj);
+v=new Sphere(1,16,8);B=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<y.length;i++){x=new THREE.Mesh(v,B);x.position.set(y[i][0],y[i][1],y[i][2]);x.updateMatrix();u.addChild(x)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.duration=1E4;this.waypoints=[];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.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=
+a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,l=Math.PI/180;this.update=function(u,y,x){var v,B;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)*l;this.theta=this.lon*l;v=this.phi%g;this.phi=v>=0?v:v+g;v=this.verticalAngleMap.srcRange;B=this.verticalAngleMap.dstRange;this.phi=(this.phi-v[0])*(B[1]-B[0])/(v[1]-v[0])+B[0];v=this.horizontalAngleMap.srcRange;B=this.horizontalAngleMap.dstRange;this.theta=(this.theta-v[0])*(B[1]-B[0])/(v[1]-v[0])+B[0];v=this.target.position;B=this.position;v.x=B.x+
+100*Math.sin(this.phi)*Math.cos(this.theta);v.y=B.y+100*Math.cos(this.phi);v.z=B.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,u,y,x)};this.onMouseMove=function(u){this.mouseX=u.clientX-this.windowHalfX;this.mouseY=u.clientY-this.windowHalfY};if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var m=new THREE.MeshLambertMaterial({color:65280}),p=new Cube(10,10,20),o=new Cube(2,2,10);this.animationParent=new THREE.Mesh(p,a);a=new THREE.Mesh(o,m);a.position.set(0,
+10,0);this.animation=b(this.animationParent,this.waypoints,"cameraPath01",this.duration);this.animationParent.addChild(this);this.animationParent.addChild(a)}else{this.animation=b(this.animationParent,this.waypoints,"cameraPath01",this.duration);this.animationParent.addChild(this)}this.createDebugPath&&e(this.debugPath,this.waypoints);this.domElement.addEventListener("mousemove",function(u,y){return function(){y.apply(u,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.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
+THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
+THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.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}};
 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;if(a){a.color!==undefined&&
@@ -157,70 +157,70 @@ THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,
 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,"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,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
 THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(a){function b(f,k,n){var h,j,w,r=f.vertices,v=r.length,D=f.colors,t=D.length,z=f.__vertexArray,M=f.__colorArray,R=f.__sortArray,O=f.__dirtyVertices,L=f.__dirtyColors;if(n.sortParticles){Ia.multiplySelf(n.matrixWorld);for(h=0;h<v;h++){j=r[h].position;Da.copy(j);Ia.multiplyVector3(Da);R[h]=[Da.z,h]}R.sort(function(N,K){return K[0]-N[0]});for(h=0;h<v;h++){j=r[R[h][1]].position;w=h*3;z[w]=j.x;z[w+1]=j.y;z[w+2]=j.z}for(h=0;h<t;h++){w=h*3;color=D[R[h][1]];M[w]=color.r;M[w+1]=
-color.g;M[w+2]=color.b}}else{if(O)for(h=0;h<v;h++){j=r[h].position;w=h*3;z[w]=j.x;z[w+1]=j.y;z[w+2]=j.z}if(L)for(h=0;h<t;h++){color=D[h];w=h*3;M[w]=color.r;M[w+1]=color.g;M[w+2]=color.b}}if(O||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,z,k)}if(L||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,M,k)}}function d(f,k){f.fragmentShader=k.fragmentShader;f.vertexShader=k.vertexShader;f.uniforms=Uniforms.clone(k.uniforms)}
-function e(f,k,n,h,j){h.program||va.initMaterial(h,k,n,j);var w=h.program,r=w.uniforms,v=h.uniforms;if(w!=pa){c.useProgram(w);pa=w}c.uniformMatrix4fv(r.projectionMatrix,!1,Ra);if(n&&(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial||h instanceof THREE.LineBasicMaterial||h instanceof THREE.ParticleBasicMaterial)){v.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){v.fogNear.value=n.near;v.fogFar.value=n.far}else if(n instanceof
-THREE.FogExp2)v.fogDensity.value=n.density}if(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial){var D,t,z=0,M=0,R=0,O,L,N,K=Sa,ja=K.directional.colors,y=K.directional.positions,ga=K.point.colors,ea=K.point.positions,ia=0,C=0;n=t=t=0;for(D=k.length;n<D;n++){t=k[n];O=t.color;L=t.position;N=t.intensity;if(t instanceof THREE.AmbientLight){z+=O.r;M+=O.g;R+=O.b}else if(t instanceof THREE.DirectionalLight){t=ia*3;ja[t]=O.r*N;ja[t+1]=O.g*N;ja[t+2]=O.b*N;y[t]=L.x;y[t+1]=L.y;y[t+
-2]=L.z;ia+=1}else if(t instanceof THREE.PointLight){t=C*3;ga[t]=O.r*N;ga[t+1]=O.g*N;ga[t+2]=O.b*N;ea[t]=L.x;ea[t+1]=L.y;ea[t+2]=L.z;C+=1}}for(n=ia*3;n<ja.length;n++)ja[n]=0;for(n=C*3;n<ga.length;n++)ga[n]=0;K.point.length=C;K.directional.length=ia;K.ambient[0]=z;K.ambient[1]=M;K.ambient[2]=R;k=Sa;v.enableLighting.value=k.directional.length+k.point.length;v.ambientLightColor.value=k.ambient;v.directionalLightColor.value=k.directional.colors;v.directionalLightDirection.value=k.directional.positions;
-v.pointLightColor.value=k.point.colors;v.pointLightPosition.value=k.point.positions}if(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial){v.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);v.opacity.value=h.opacity;v.map.texture=h.map;v.lightMap.texture=h.lightMap;v.envMap.texture=h.envMap;v.reflectivity.value=h.reflectivity;v.refractionRatio.value=h.refractionRatio;v.combine.value=h.combine;v.useRefract.value=
-h.envMap&&h.envMap.mapping instanceof THREE.CubeRefractionMapping}if(h instanceof THREE.LineBasicMaterial){v.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);v.opacity.value=h.opacity}else if(h instanceof THREE.ParticleBasicMaterial){v.psColor.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);v.opacity.value=h.opacity;v.size.value=h.size;v.scale.value=fa.height/2;v.map.texture=h.map}else if(h instanceof THREE.MeshPhongMaterial){v.ambient.value.setRGB(h.ambient.r,
-h.ambient.g,h.ambient.b);v.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);v.shininess.value=h.shininess}else if(h instanceof THREE.MeshDepthMaterial){v.mNear.value=f.near;v.mFar.value=f.far;v.opacity.value=h.opacity}else if(h instanceof THREE.MeshNormalMaterial)v.opacity.value=h.opacity;for(var E in v)if(z=w.uniforms[E]){n=v[E];D=n.type;k=n.value;if(D=="i")c.uniform1i(z,k);else if(D=="f")c.uniform1f(z,k);else if(D=="fv1")c.uniform1fv(z,k);else if(D=="fv")c.uniform3fv(z,k);else if(D==
-"v2")c.uniform2f(z,k.x,k.y);else if(D=="v3")c.uniform3f(z,k.x,k.y,k.z);else if(D=="c")c.uniform3f(z,k.r,k.g,k.b);else if(D=="t"){c.uniform1i(z,k);if(n=n.texture)if(n.image instanceof Array&&n.image.length==6){if(n.image.length==6){if(n.needsUpdate){if(n.__wasSetOnce){c.bindTexture(c.TEXTURE_CUBE_MAP,n.image.__webGLTextureCube);for(D=0;D<6;++D)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,n.image[D])}else{n.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,
-n.image.__webGLTextureCube);for(D=0;D<6;++D)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,n.image[D]);n.__wasSetOnce=!0}P(c.TEXTURE_CUBE_MAP,n,n.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);n.needsUpdate=!1}c.activeTexture(c.TEXTURE0+k);c.bindTexture(c.TEXTURE_CUBE_MAP,n.image.__webGLTextureCube)}}else{if(n.needsUpdate){if(n.__wasSetOnce){c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,n.image)}else{n.__webGLTexture=
-c.createTexture();c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,n.image);n.__wasSetOnce=!0}P(c.TEXTURE_2D,n,n.image);c.bindTexture(c.TEXTURE_2D,null);n.needsUpdate=!1}c.activeTexture(c.TEXTURE0+k);c.bindTexture(c.TEXTURE_2D,n.__webGLTexture)}}}c.uniformMatrix4fv(r.modelViewMatrix,!1,j._modelViewMatrixArray);c.uniformMatrix3fv(r.normalMatrix,!1,j._normalMatrixArray);(h instanceof THREE.MeshShaderMaterial||h instanceof THREE.MeshPhongMaterial||
-h.envMap)&&c.uniform3f(r.cameraPosition,f.position.x,f.position.y,f.position.z);(h instanceof THREE.MeshShaderMaterial||h.envMap||h.skinning)&&c.uniformMatrix4fv(r.objectMatrix,!1,j._objectMatrixArray);(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshShaderMaterial||h.skinning)&&c.uniformMatrix4fv(r.viewMatrix,!1,La);if(h.skinning){c.uniformMatrix4fv(r.cameraInverseMatrix,!1,La);c.uniformMatrix4fv(r.boneGlobalMatrices,!1,j.boneMatrices)}return w}
+THREE.WebGLRenderer=function(a){function b(f,k,n){var h,j,w,q=f.vertices,t=q.length,D=f.colors,s=D.length,A=f.__vertexArray,M=f.__colorArray,S=f.__sortArray,P=f.__dirtyVertices,K=f.__dirtyColors;if(n.sortParticles){Ia.multiplySelf(n.matrixWorld);for(h=0;h<t;h++){j=q[h].position;Da.copy(j);Ia.multiplyVector3(Da);S[h]=[Da.z,h]}S.sort(function(N,J){return J[0]-N[0]});for(h=0;h<t;h++){j=q[S[h][1]].position;w=h*3;A[w]=j.x;A[w+1]=j.y;A[w+2]=j.z}for(h=0;h<s;h++){w=h*3;color=D[S[h][1]];M[w]=color.r;M[w+1]=
+color.g;M[w+2]=color.b}}else{if(P)for(h=0;h<t;h++){j=q[h].position;w=h*3;A[w]=j.x;A[w+1]=j.y;A[w+2]=j.z}if(K)for(h=0;h<s;h++){color=D[h];w=h*3;M[w]=color.r;M[w+1]=color.g;M[w+2]=color.b}}if(P||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,A,k)}if(K||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,M,k)}}function d(f,k){f.fragmentShader=k.fragmentShader;f.vertexShader=k.vertexShader;f.uniforms=Uniforms.clone(k.uniforms)}
+function e(f,k,n,h,j){h.program||va.initMaterial(h,k,n,j);var w=h.program,q=w.uniforms,t=h.uniforms;if(w!=la){c.useProgram(w);la=w}c.uniformMatrix4fv(q.projectionMatrix,!1,Ra);if(n&&(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial||h instanceof THREE.LineBasicMaterial||h instanceof THREE.ParticleBasicMaterial)){t.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){t.fogNear.value=n.near;t.fogFar.value=n.far}else if(n instanceof
+THREE.FogExp2)t.fogDensity.value=n.density}if(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial){var D,s,A=0,M=0,S=0,P,K,N,J=Sa,ja=J.directional.colors,z=J.directional.positions,ga=J.point.colors,fa=J.point.positions,ia=0,C=0;n=s=s=0;for(D=k.length;n<D;n++){s=k[n];P=s.color;K=s.position;N=s.intensity;if(s instanceof THREE.AmbientLight){A+=P.r;M+=P.g;S+=P.b}else if(s instanceof THREE.DirectionalLight){s=ia*3;ja[s]=P.r*N;ja[s+1]=P.g*N;ja[s+2]=P.b*N;z[s]=K.x;z[s+1]=K.y;z[s+
+2]=K.z;ia+=1}else if(s instanceof THREE.PointLight){s=C*3;ga[s]=P.r*N;ga[s+1]=P.g*N;ga[s+2]=P.b*N;fa[s]=K.x;fa[s+1]=K.y;fa[s+2]=K.z;C+=1}}for(n=ia*3;n<ja.length;n++)ja[n]=0;for(n=C*3;n<ga.length;n++)ga[n]=0;J.point.length=C;J.directional.length=ia;J.ambient[0]=A;J.ambient[1]=M;J.ambient[2]=S;k=Sa;t.enableLighting.value=k.directional.length+k.point.length;t.ambientLightColor.value=k.ambient;t.directionalLightColor.value=k.directional.colors;t.directionalLightDirection.value=k.directional.positions;
+t.pointLightColor.value=k.point.colors;t.pointLightPosition.value=k.point.positions}if(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial){t.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);t.opacity.value=h.opacity;t.map.texture=h.map;t.lightMap.texture=h.lightMap;t.envMap.texture=h.envMap;t.reflectivity.value=h.reflectivity;t.refractionRatio.value=h.refractionRatio;t.combine.value=h.combine;t.useRefract.value=
+h.envMap&&h.envMap.mapping instanceof THREE.CubeRefractionMapping}if(h instanceof THREE.LineBasicMaterial){t.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);t.opacity.value=h.opacity}else if(h instanceof THREE.ParticleBasicMaterial){t.psColor.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);t.opacity.value=h.opacity;t.size.value=h.size;t.scale.value=ca.height/2;t.map.texture=h.map}else if(h instanceof THREE.MeshPhongMaterial){t.ambient.value.setRGB(h.ambient.r,
+h.ambient.g,h.ambient.b);t.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);t.shininess.value=h.shininess}else if(h instanceof THREE.MeshDepthMaterial){t.mNear.value=f.near;t.mFar.value=f.far;t.opacity.value=h.opacity}else if(h instanceof THREE.MeshNormalMaterial)t.opacity.value=h.opacity;for(var E in t)if(A=w.uniforms[E]){n=t[E];D=n.type;k=n.value;if(D=="i")c.uniform1i(A,k);else if(D=="f")c.uniform1f(A,k);else if(D=="fv1")c.uniform1fv(A,k);else if(D=="fv")c.uniform3fv(A,k);else if(D==
+"v2")c.uniform2f(A,k.x,k.y);else if(D=="v3")c.uniform3f(A,k.x,k.y,k.z);else if(D=="c")c.uniform3f(A,k.r,k.g,k.b);else if(D=="t"){c.uniform1i(A,k);if(n=n.texture)if(n.image instanceof Array&&n.image.length==6){if(n.image.length==6){if(n.needsUpdate){if(n.__wasSetOnce){c.bindTexture(c.TEXTURE_CUBE_MAP,n.image.__webGLTextureCube);for(D=0;D<6;++D)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,n.image[D])}else{n.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,
+n.image.__webGLTextureCube);for(D=0;D<6;++D)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,n.image[D]);n.__wasSetOnce=!0}Q(c.TEXTURE_CUBE_MAP,n,n.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);n.needsUpdate=!1}c.activeTexture(c.TEXTURE0+k);c.bindTexture(c.TEXTURE_CUBE_MAP,n.image.__webGLTextureCube)}}else{if(n.needsUpdate){if(n.__wasSetOnce){c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,n.image)}else{n.__webGLTexture=
+c.createTexture();c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,n.image);n.__wasSetOnce=!0}Q(c.TEXTURE_2D,n,n.image);c.bindTexture(c.TEXTURE_2D,null);n.needsUpdate=!1}c.activeTexture(c.TEXTURE0+k);c.bindTexture(c.TEXTURE_2D,n.__webGLTexture)}}}c.uniformMatrix4fv(q.modelViewMatrix,!1,j._modelViewMatrixArray);c.uniformMatrix3fv(q.normalMatrix,!1,j._normalMatrixArray);(h instanceof THREE.MeshShaderMaterial||h instanceof THREE.MeshPhongMaterial||
+h.envMap)&&c.uniform3f(q.cameraPosition,f.position.x,f.position.y,f.position.z);(h instanceof THREE.MeshShaderMaterial||h.envMap||h.skinning)&&c.uniformMatrix4fv(q.objectMatrix,!1,j._objectMatrixArray);(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshShaderMaterial||h.skinning)&&c.uniformMatrix4fv(q.viewMatrix,!1,La);if(h.skinning){c.uniformMatrix4fv(q.cameraInverseMatrix,!1,La);c.uniformMatrix4fv(q.boneGlobalMatrices,!1,j.boneMatrices)}return w}
 function g(f,k,n,h,j,w){if(h.opacity!=0){f=e(f,k,n,h,w).attributes;c.bindBuffer(c.ARRAY_BUFFER,j.__webGLVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0);if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLTangentBuffer);c.vertexAttribPointer(f.tangent,4,
 c.FLOAT,!1,0,0)}if(f.uv>=0)if(j.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLUVBuffer);c.vertexAttribPointer(f.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(j.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(h.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,
 j.__webGLSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,j.__webGLSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,j.__webGLSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,j.__webGLSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(w instanceof THREE.Mesh)if(h.wireframe){c.lineWidth(h.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
 j.__webGLLineBuffer);c.drawElements(c.LINES,j.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,j.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,j.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(w instanceof THREE.Line){w=w.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(h.linewidth);c.drawArrays(w,0,j.__webGLLineCount)}else if(w instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,j.__webGLParticleCount);else w instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,
 0,j.__webGLVertexCount)}}function l(f,k){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=c.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(k.attributes.position);c.vertexAttribPointer(k.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,
 f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(k.attributes.normal);c.vertexAttribPointer(k.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function m(f){if(qa!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);qa=f.doubleSided}if(ra!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);ra=f.flipSided}}function p(f){if(Ca!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);Ca=f}}function o(f){sa[0].set(f.n41-f.n11,f.n42-
-f.n12,f.n43-f.n13,f.n44-f.n14);sa[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);sa[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);sa[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);sa[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);sa[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var k;for(f=0;f<6;f++){k=sa[f];k.divideScalar(Math.sqrt(k.x*k.x+k.y*k.y+k.z*k.z))}}function q(f){for(var k=f.matrixWorld,n=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,
-Math.max(f.scale.y,f.scale.z)),h=0;h<6;h++){f=sa[h].x*k.n14+sa[h].y*k.n24+sa[h].z*k.n34+sa[h].w;if(f<=n)return!1}return!0}function u(f,k){f.list[f.count]=k;f.count+=1}function x(f){var k,n,h=f.object,j=f.opaque,w=f.transparent;w.count=0;f=j.count=0;for(k=h.materials.length;f<k;f++){n=h.materials[f];n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?u(w,n):u(j,n)}}function A(f){var k,n,h,j,w=f.object,r=f.buffer,v=f.opaque,D=f.transparent;D.count=0;f=v.count=0;for(h=w.materials.length;f<h;f++){k=
-w.materials[f];if(k instanceof THREE.MeshFaceMaterial){k=0;for(n=r.materials.length;k<n;k++)(j=r.materials[k])&&(j.opacity&&j.opacity<1||j.blending!=THREE.NormalBlending?u(D,j):u(v,j))}else{j=k;j.opacity&&j.opacity<1||j.blending!=THREE.NormalBlending?u(D,j):u(v,j)}}}function B(f,k){return k.z-f.z}function G(f,k){f._modelViewMatrix.multiplyToArray(k.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function H(f){function k(M){var R=
-[];n=0;for(h=M.length;n<h;n++)M[n]==undefined?R.push("undefined"):R.push(M[n].id);return R.join("_")}var n,h,j,w,r,v,D,t,z={};f.geometryGroups={};j=0;for(w=f.faces.length;j<w;j++){r=f.faces[j];v=r.materials;D=k(v);z[D]==undefined&&(z[D]={hash:D,counter:0});t=z[D].hash+"_"+z[D].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:v,vertices:0});r=r instanceof THREE.Face3?3:4;if(f.geometryGroups[t].vertices+r>65535){z[D].counter+=1;t=z[D].hash+"_"+z[D].counter;f.geometryGroups[t]==
-undefined&&(f.geometryGroups[t]={faces:[],materials:v,vertices:0})}f.geometryGroups[t].faces.push(j);f.geometryGroups[t].vertices+=r}}function I(f,k,n){f.push({buffer:k,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(f){if(f!=Ba){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,
-c.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}Ba=f}}function P(f,k,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,$(k.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,$(k.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,$(k.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,$(k.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,
-c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,da(k.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,da(k.minFilter))}}function S(f){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=c.createFramebuffer();f.__webGLRenderbuffer=c.createRenderbuffer();f.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,f.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.bindTexture(c.TEXTURE_2D,
-f.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,$(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,$(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,$(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,$(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,$(f.format),f.width,f.height,0,$(f.format),$(f.type),null);c.bindFramebuffer(c.FRAMEBUFFER,f.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webGLTexture,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,
-c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var k,n;if(f){k=f.__webGLFramebuffer;n=f.width;f=f.height}else{k=null;n=Ga;f=Ha}if(k!=na){c.bindFramebuffer(c.FRAMEBUFFER,k);c.viewport(xa,Fa,n,f);na=k}}function Z(f,k){var n;if(f=="fragment")n=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(n=c.createShader(c.VERTEX_SHADER));c.shaderSource(n,k);c.compileShader(n);if(!c.getShaderParameter(n,
-c.COMPILE_STATUS)){alert(c.getShaderInfoLog(n));return null}return n}function da(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return c.LINEAR}}function $(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;
+f.n12,f.n43-f.n13,f.n44-f.n14);sa[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);sa[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);sa[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);sa[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);sa[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var k;for(f=0;f<6;f++){k=sa[f];k.divideScalar(Math.sqrt(k.x*k.x+k.y*k.y+k.z*k.z))}}function u(f){for(var k=f.matrixWorld,n=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,
+Math.max(f.scale.y,f.scale.z)),h=0;h<6;h++){f=sa[h].x*k.n14+sa[h].y*k.n24+sa[h].z*k.n34+sa[h].w;if(f<=n)return!1}return!0}function y(f,k){f.list[f.count]=k;f.count+=1}function x(f){var k,n,h=f.object,j=f.opaque,w=f.transparent;w.count=0;f=j.count=0;for(k=h.materials.length;f<k;f++){n=h.materials[f];n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?y(w,n):y(j,n)}}function v(f){var k,n,h,j,w=f.object,q=f.buffer,t=f.opaque,D=f.transparent;D.count=0;f=t.count=0;for(h=w.materials.length;f<h;f++){k=
+w.materials[f];if(k instanceof THREE.MeshFaceMaterial){k=0;for(n=q.materials.length;k<n;k++)(j=q.materials[k])&&(j.opacity&&j.opacity<1||j.blending!=THREE.NormalBlending?y(D,j):y(t,j))}else{j=k;j.opacity&&j.opacity<1||j.blending!=THREE.NormalBlending?y(D,j):y(t,j)}}}function B(f,k){return k.z-f.z}function H(f,k){f._modelViewMatrix.multiplyToArray(k.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function G(f){function k(M){var S=
+[];n=0;for(h=M.length;n<h;n++)M[n]==undefined?S.push("undefined"):S.push(M[n].id);return S.join("_")}var n,h,j,w,q,t,D,s,A={};f.geometryGroups={};j=0;for(w=f.faces.length;j<w;j++){q=f.faces[j];t=q.materials;D=k(t);A[D]==undefined&&(A[D]={hash:D,counter:0});s=A[D].hash+"_"+A[D].counter;f.geometryGroups[s]==undefined&&(f.geometryGroups[s]={faces:[],materials:t,vertices:0});q=q instanceof THREE.Face3?3:4;if(f.geometryGroups[s].vertices+q>65535){A[D].counter+=1;s=A[D].hash+"_"+A[D].counter;f.geometryGroups[s]==
+undefined&&(f.geometryGroups[s]={faces:[],materials:t,vertices:0})}f.geometryGroups[s].faces.push(j);f.geometryGroups[s].vertices+=q}}function L(f,k,n){f.push({buffer:k,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function I(f){if(f!=Ba){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,
+c.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}Ba=f}}function Q(f,k,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,Z(k.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,Z(k.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,Z(k.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,Z(k.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,
+c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,$(k.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,$(k.minFilter))}}function O(f){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=c.createFramebuffer();f.__webGLRenderbuffer=c.createRenderbuffer();f.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,f.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.bindTexture(c.TEXTURE_2D,
+f.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,Z(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,Z(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,Z(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,Z(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,Z(f.format),f.width,f.height,0,Z(f.format),Z(f.type),null);c.bindFramebuffer(c.FRAMEBUFFER,f.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webGLTexture,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,
+c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var k,n;if(f){k=f.__webGLFramebuffer;n=f.width;f=f.height}else{k=null;n=Ga;f=Ha}if(k!=oa){c.bindFramebuffer(c.FRAMEBUFFER,k);c.viewport(xa,Fa,n,f);oa=k}}function Y(f,k){var n;if(f=="fragment")n=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(n=c.createShader(c.VERTEX_SHADER));c.shaderSource(n,k);c.compileShader(n);if(!c.getShaderParameter(n,
+c.COMPILE_STATUS)){alert(c.getShaderInfoLog(n));return null}return n}function $(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return c.LINEAR}}function Z(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;
 case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;
-case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var fa=document.createElement("canvas"),c,pa=null,na=null,va=this,qa=null,ra=null,Ba=null,Ca=null,xa=0,Fa=0,Ga=0,Ha=0,sa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ia=new THREE.Matrix4,Ra=new Float32Array(16),La=new Float32Array(16),Da=new THREE.Vector4,Sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Ta=!0,Ua=new THREE.Color(0),Va=0;if(a){if(a.antialias!==undefined)Ta=a.antialias;a.clearColor!==undefined&&Ua.setHex(a.clearColor);if(a.clearAlpha!==undefined)Va=a.clearAlpha}this.domElement=fa;this.autoClear=!0;this.sortObjects=!0;(function(f,k,n){try{if(!(c=
-fa.getContext("experimental-webgl",{antialias:f})))throw"Error creating WebGL context.";}catch(h){console.error(h)}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(k.r,k.g,k.b,n);_cullEnabled=!0})(Ta,Ua,Va);this.context=c;this.setSize=function(f,k){fa.width=f;fa.height=k;this.setViewport(0,0,fa.width,fa.height)};this.setViewport=function(f,
+case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var ca=document.createElement("canvas"),c,la=null,oa=null,va=this,qa=null,ra=null,Ba=null,Ca=null,xa=0,Fa=0,Ga=0,Ha=0,sa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ia=new THREE.Matrix4,Ra=new Float32Array(16),La=new Float32Array(16),Da=new THREE.Vector4,Sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Ta=!0,Ua=new THREE.Color(0),Va=0;if(a){if(a.antialias!==undefined)Ta=a.antialias;a.clearColor!==undefined&&Ua.setHex(a.clearColor);if(a.clearAlpha!==undefined)Va=a.clearAlpha}this.domElement=ca;this.autoClear=!0;this.sortObjects=!0;(function(f,k,n){try{if(!(c=
+ca.getContext("experimental-webgl",{antialias:f})))throw"Error creating WebGL context.";}catch(h){console.error(h)}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(k.r,k.g,k.b,n);_cullEnabled=!0})(Ta,Ua,Va);this.context=c;this.setSize=function(f,k){ca.width=f;ca.height=k;this.setViewport(0,0,ca.width,ca.height)};this.setViewport=function(f,
 k,n,h){xa=f;Fa=k;Ga=n;Ha=h;c.viewport(xa,Fa,Ga,Ha)};this.setScissor=function(f,k,n,h){c.scissor(f,k,n,h)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){c.depthMask(f)};this.setClearColorHex=function(f,k){var n=new THREE.Color(f);c.clearColor(n.r,n.g,n.b,k)};this.setClearColor=function(f,k){c.clearColor(f.r,f.g,f.b,k)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.initMaterial=function(f,
 k,n,h){var j;if(f instanceof THREE.MeshDepthMaterial)d(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)d(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)d(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)d(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)d(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)d(f,THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&d(f,THREE.ShaderLib.particle_basic);
-var w,r,v,D,t;w=D=t=0;for(r=k.length;w<r;w++){v=k[w];v instanceof THREE.DirectionalLight&&D++;v instanceof THREE.PointLight&&t++}if(t+D<=4)k=D;else{k=Math.ceil(4*D/(t+D));t=4-k}k={directional:k,point:t};w=50;if(h!==undefined&&h instanceof THREE.SkinnedMesh)w=h.bones.length;h=f.fragmentShader;t=f.vertexShader;w={fog:n,map:f.map,envMap:f.envMap,lightMap:f.lightMap,vertexColors:f.vertexColors,sizeAttenuation:f.sizeAttenuation,skinning:f.skinning,maxDirLights:k.directional,maxPointLights:k.point,maxBones:w};
+var w,q,t,D,s;w=D=s=0;for(q=k.length;w<q;w++){t=k[w];t instanceof THREE.DirectionalLight&&D++;t instanceof THREE.PointLight&&s++}if(s+D<=4)k=D;else{k=Math.ceil(4*D/(s+D));s=4-k}k={directional:k,point:s};w=50;if(h!==undefined&&h instanceof THREE.SkinnedMesh)w=h.bones.length;h=f.fragmentShader;s=f.vertexShader;w={fog:n,map:f.map,envMap:f.envMap,lightMap:f.lightMap,vertexColors:f.vertexColors,sizeAttenuation:f.sizeAttenuation,skinning:f.skinning,maxDirLights:k.directional,maxPointLights:k.point,maxBones:w};
 n=c.createProgram();k=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+w.maxDirLights,"#define MAX_POINT_LIGHTS "+w.maxPointLights,w.fog?"#define USE_FOG":"",w.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",w.map?"#define USE_MAP":"",w.envMap?"#define USE_ENVMAP":"",w.lightMap?"#define USE_LIGHTMAP":"",w.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");w=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":
 "","#define MAX_DIR_LIGHTS "+w.maxDirLights,"#define MAX_POINT_LIGHTS "+w.maxPointLights,"#define MAX_BONES "+w.maxBones,w.map?"#define USE_MAP":"",w.envMap?"#define USE_ENVMAP":"",w.lightMap?"#define USE_LIGHTMAP":"",w.vertexColors?"#define USE_COLOR":"",w.skinning?"#define USE_SKINNING":"",w.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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
-c.attachShader(n,Z("fragment",k+h));c.attachShader(n,Z("vertex",w+t));c.linkProgram(n);c.getProgramParameter(n,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(n,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");n.uniforms={};n.attributes={};f.program=n;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(j in f.uniforms)n.push(j);j=f.program;h=0;for(t=n.length;h<
-t;h++){k=n[h];j.uniforms[k]=c.getUniformLocation(j,k)}j=f.program;n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];h=0;for(t=n.length;h<t;h++){k=n[h];j.attributes[k]=c.getAttribLocation(j,k)}j=f.program.attributes;c.enableVertexAttribArray(j.position);j.color>=0&&c.enableVertexAttribArray(j.color);j.normal>=0&&c.enableVertexAttribArray(j.normal);j.tangent>=0&&c.enableVertexAttribArray(j.tangent);if(f.skinning&&j.skinVertexA>=0&&j.skinVertexB>=
-0&&j.skinIndex>=0&&j.skinWeight>=0){c.enableVertexAttribArray(j.skinVertexA);c.enableVertexAttribArray(j.skinVertexB);c.enableVertexAttribArray(j.skinIndex);c.enableVertexAttribArray(j.skinWeight)}};this.render=function(f,k,n,h){var j,w,r,v,D,t,z,M,R=f.lights,O=f.fog;k.matrixAutoUpdate&&k.updateMatrix();f.update(undefined,!1,k);k.matrixWorldInverse.flattenToArray(La);k.projectionMatrix.flattenToArray(Ra);Ia.multiply(k.projectionMatrix,k.matrixWorldInverse);o(Ia);this.initWebGLObjects(f);S(n);(this.autoClear||
-h)&&this.clear();D=f.__webglObjects.length;for(h=0;h<D;h++){j=f.__webglObjects[h];z=j.object;if(z.visible)if(!(z instanceof THREE.Mesh)||q(z)){z.matrixWorld.flattenToArray(z._objectMatrixArray);G(z,k);A(j);j.render=!0;if(this.sortObjects){Da.copy(z.position);Ia.multiplyVector3(Da);j.z=Da.z}}else j.render=!1;else j.render=!1}this.sortObjects&&f.__webglObjects.sort(B);t=f.__webglObjectsImmediate.length;for(h=0;h<t;h++){j=f.__webglObjectsImmediate[h];z=j.object;if(z.visible){z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray);
-G(z,k);x(j)}}J(THREE.NormalBlending);for(h=0;h<D;h++){j=f.__webglObjects[h];if(j.render){z=j.object;M=j.buffer;r=j.opaque;m(z);for(j=0;j<r.count;j++){v=r.list[j];p(v.depthTest);g(k,R,O,v,M,z)}}}for(h=0;h<t;h++){j=f.__webglObjectsImmediate[h];z=j.object;if(z.visible){r=j.opaque;m(z);for(j=0;j<r.count;j++){v=r.list[j];p(v.depthTest);w=e(k,R,O,v,z);z.render(function(L){l(L,w)})}}}for(h=0;h<D;h++){j=f.__webglObjects[h];if(j.render){z=j.object;M=j.buffer;r=j.transparent;m(z);for(j=0;j<r.count;j++){v=r.list[j];
-J(v.blending);p(v.depthTest);g(k,R,O,v,M,z)}}}for(h=0;h<t;h++){j=f.__webglObjectsImmediate[h];z=j.object;if(z.visible){r=j.transparent;m(z);for(j=0;j<r.count;j++){v=r.list[j];J(v.blending);p(v.depthTest);w=e(k,R,O,v,z);z.render(function(L){l(L,w)})}}}if(n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){if(!f.__webglObjects){f.__webglObjects=
-[];f.__webglObjectsImmediate=[]}for(;f.__objectsAdded.length;){var k=f.__objectsAdded[0],n=f,h=void 0,j=void 0,w=void 0;if(k._modelViewMatrix==undefined){k._modelViewMatrix=new THREE.Matrix4;k._normalMatrixArray=new Float32Array(9);k._modelViewMatrixArray=new Float32Array(16);k._objectMatrixArray=new Float32Array(16);k.matrixWorld.flattenToArray(k._objectMatrixArray)}if(k instanceof THREE.Mesh){j=k.geometry;j.geometryGroups==undefined&&H(j);for(h in j.geometryGroups){w=j.geometryGroups[h];if(!w.__webGLVertexBuffer){var r=
-w;r.__webGLVertexBuffer=c.createBuffer();r.__webGLNormalBuffer=c.createBuffer();r.__webGLTangentBuffer=c.createBuffer();r.__webGLColorBuffer=c.createBuffer();r.__webGLUVBuffer=c.createBuffer();r.__webGLUV2Buffer=c.createBuffer();r.__webGLSkinVertexABuffer=c.createBuffer();r.__webGLSkinVertexBBuffer=c.createBuffer();r.__webGLSkinIndicesBuffer=c.createBuffer();r.__webGLSkinWeightsBuffer=c.createBuffer();r.__webGLFaceBuffer=c.createBuffer();r.__webGLLineBuffer=c.createBuffer();r=w;var v=k,D=void 0,t=
-void 0,z=0,M=0,R=0,O=v.geometry.faces,L=r.faces;D=0;for(t=L.length;D<t;D++){fi=L[D];face=O[fi];if(face instanceof THREE.Face3){z+=3;M+=1;R+=3}else if(face instanceof THREE.Face4){z+=4;M+=2;R+=4}}r.__vertexArray=new Float32Array(z*3);r.__normalArray=new Float32Array(z*3);r.__tangentArray=new Float32Array(z*4);r.__colorArray=new Float32Array(z*3);r.__uvArray=new Float32Array(z*2);r.__uv2Array=new Float32Array(z*2);r.__skinVertexAArray=new Float32Array(z*4);r.__skinVertexBArray=new Float32Array(z*4);
-r.__skinIndexArray=new Float32Array(z*4);r.__skinWeightArray=new Float32Array(z*4);r.__faceArray=new Uint16Array(M*3);r.__lineArray=new Uint16Array(R*2);t=D=r;z=void 0;O=void 0;var N=void 0,K=void 0;N=void 0;L=!1;z=0;for(O=v.materials.length;z<O;z++){N=v.materials[z];if(N instanceof THREE.MeshFaceMaterial){N=0;for(K=t.materials.length;N<K;N++)if(t.materials[N]&&t.materials[N].shading!=undefined&&t.materials[N].shading==THREE.SmoothShading){L=!0;break}}else if(N&&N.shading!=undefined&&N.shading==THREE.SmoothShading){L=
-!0;break}if(L)break}D.__needsSmoothNormals=L;r.__webGLFaceCount=M*3;r.__webGLLineCount=R*2;j.__dirtyVertices=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=!0;j.__dirtyColors=!0}I(n.__webglObjects,w,k)}}else if(k instanceof THREE.Ribbon){j=k.geometry;if(!j.__webGLVertexBuffer){h=j;h.__webGLVertexBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=j;w=h.vertices.length;h.__vertexArray=new Float32Array(w*3);h.__colorArray=new Float32Array(w*3);h.__webGLVertexCount=
-w;j.__dirtyVertices=!0;j.__dirtyColors=!0}I(n.__webglObjects,j,k)}else if(k instanceof THREE.Line){j=k.geometry;if(!j.__webGLVertexBuffer){h=j;h.__webGLVertexBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=j;w=h.vertices.length;h.__vertexArray=new Float32Array(w*3);h.__colorArray=new Float32Array(w*3);h.__webGLLineCount=w;j.__dirtyVertices=!0;j.__dirtyColors=!0}I(n.__webglObjects,j,k)}else if(k instanceof THREE.ParticleSystem){j=k.geometry;if(!j.__webGLVertexBuffer){h=j;h.__webGLVertexBuffer=
-c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=j;w=h.vertices.length;h.__vertexArray=new Float32Array(w*3);h.__colorArray=new Float32Array(w*3);h.__sortArray=[];h.__webGLParticleCount=w;j.__dirtyVertices=!0;j.__dirtyColors=!0}I(n.__webglObjects,j,k)}else THREE.MarchingCubes!==undefined&&k instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:k,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,1)}for(;f.__objectsRemoved.length;){k=f.__objectsRemoved[0];
-n=f;j=void 0;h=void 0;for(j=n.__webglObjects.length-1;j>=0;j--){h=n.__webglObjects[j].object;k==h&&n.__webglObjects.splice(j,1)}f.__objectsRemoved.splice(0,1)}k=0;for(n=f.__webglObjects.length;k<n;k++){h=f.__webglObjects[k].object;w=void 0;j=void 0;r=void 0;if(h instanceof THREE.Mesh){j=h.geometry;for(w in j.geometryGroups){r=j.geometryGroups[w];if(j.__dirtyVertices||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents){M=c.DYNAMIC_DRAW;R=void 0;D=void 0;var ja=void 0,
-y=void 0,ga=void 0,ea=void 0,ia=void 0;ja=void 0;var C=void 0,E=void 0,F=void 0,Q=void 0;C=void 0;E=void 0;F=void 0;y=void 0;C=void 0;E=void 0;F=void 0;Q=void 0;C=void 0;E=void 0;F=void 0;Q=void 0;C=void 0;E=void 0;F=void 0;Q=void 0;C=void 0;E=void 0;F=void 0;Q=void 0;C=void 0;E=void 0;F=void 0;Q=void 0;y=void 0;ea=void 0;ga=void 0;ia=void 0;var ka=K=N=L=O=z=v=t=0,Y=0,s=0,aa=r.__vertexArray,Ja=r.__uvArray,Ka=r.__uv2Array,oa=r.__normalArray,T=r.__tangentArray,ca=r.__colorArray,U=r.__skinVertexAArray,
-V=r.__skinVertexBArray,W=r.__skinIndexArray,X=r.__skinWeightArray,ta=r.__faceArray,la=r.__lineArray,Wa=r.__needsSmoothNormals,ha=h.geometry,Ma=ha.__dirtyVertices,Na=ha.__dirtyElements,Ea=ha.__dirtyUvs,Oa=ha.__dirtyNormals,Pa=ha.__dirtyTangents,Qa=ha.__dirtyColors,ma=ha.vertices,Xa=r.faces,Ya=ha.faces,Za=ha.uvs,$a=ha.uvs2,ua=ha.colors,ya=ha.skinVerticesA,za=ha.skinVerticesB,Aa=ha.skinIndices,wa=ha.skinWeights;R=0;for(D=Xa.length;R<D;R++){ja=Xa[R];y=Ya[ja];ia=Za[ja];ja=$a[ja];ga=y.vertexNormals;ea=
-y.normal;if(y instanceof THREE.Face3){if(Ma){C=ma[y.a].position;E=ma[y.b].position;F=ma[y.c].position;aa[v]=C.x;aa[v+1]=C.y;aa[v+2]=C.z;aa[v+3]=E.x;aa[v+4]=E.y;aa[v+5]=E.z;aa[v+6]=F.x;aa[v+7]=F.y;aa[v+8]=F.z;v+=9}if(wa.length){C=wa[y.a];E=wa[y.b];F=wa[y.c];X[s]=C.x;X[s+1]=C.y;X[s+2]=C.z;X[s+3]=C.w;X[s+4]=E.x;X[s+5]=E.y;X[s+6]=E.z;X[s+7]=E.w;X[s+8]=F.x;X[s+9]=F.y;X[s+10]=F.z;X[s+11]=F.w;C=Aa[y.a];E=Aa[y.b];F=Aa[y.c];W[s]=C.x;W[s+1]=C.y;W[s+2]=C.z;W[s+3]=C.w;W[s+4]=E.x;W[s+5]=E.y;W[s+6]=E.z;W[s+7]=
-E.w;W[s+8]=F.x;W[s+9]=F.y;W[s+10]=F.z;W[s+11]=F.w;C=ya[y.a];E=ya[y.b];F=ya[y.c];U[s]=C.x;U[s+1]=C.y;U[s+2]=C.z;U[s+3]=1;U[s+4]=E.x;U[s+5]=E.y;U[s+6]=E.z;U[s+7]=1;U[s+8]=F.x;U[s+9]=F.y;U[s+10]=F.z;U[s+11]=1;C=za[y.a];E=za[y.b];F=za[y.c];V[s]=C.x;V[s+1]=C.y;V[s+2]=C.z;V[s+3]=1;V[s+4]=E.x;V[s+5]=E.y;V[s+6]=E.z;V[s+7]=1;V[s+8]=F.x;V[s+9]=F.y;V[s+10]=F.z;V[s+11]=1;s+=12}if(Qa&&ua.length){C=ua[y.a];E=ua[y.b];F=ua[y.c];ca[Y]=C.r;ca[Y+1]=C.g;ca[Y+2]=C.b;ca[Y+3]=E.r;ca[Y+4]=E.g;ca[Y+5]=E.b;ca[Y+6]=F.r;ca[Y+
-7]=F.g;ca[Y+8]=F.b;Y+=9}if(Pa&&ha.hasTangents){C=ma[y.a].tangent;E=ma[y.b].tangent;F=ma[y.c].tangent;T[K]=C.x;T[K+1]=C.y;T[K+2]=C.z;T[K+3]=C.w;T[K+4]=E.x;T[K+5]=E.y;T[K+6]=E.z;T[K+7]=E.w;T[K+8]=F.x;T[K+9]=F.y;T[K+10]=F.z;T[K+11]=F.w;K+=12}if(Oa)if(ga.length==3&&Wa)for(y=0;y<3;y++){ea=ga[y];oa[N]=ea.x;oa[N+1]=ea.y;oa[N+2]=ea.z;N+=3}else for(y=0;y<3;y++){oa[N]=ea.x;oa[N+1]=ea.y;oa[N+2]=ea.z;N+=3}if(Ea&&ia)for(y=0;y<3;y++){ga=ia[y];Ja[z]=ga.u;Ja[z+1]=ga.v;z+=2}if(Ea&&ja)for(y=0;y<3;y++){ia=ja[y];Ka[O]=
-ia.u;Ka[O+1]=ia.v;O+=2}if(Na){ta[L]=t;ta[L+1]=t+1;ta[L+2]=t+2;L+=3;la[ka]=t;la[ka+1]=t+1;la[ka+2]=t;la[ka+3]=t+2;la[ka+4]=t+1;la[ka+5]=t+2;ka+=6;t+=3}}else if(y instanceof THREE.Face4){if(Ma){C=ma[y.a].position;E=ma[y.b].position;F=ma[y.c].position;Q=ma[y.d].position;aa[v]=C.x;aa[v+1]=C.y;aa[v+2]=C.z;aa[v+3]=E.x;aa[v+4]=E.y;aa[v+5]=E.z;aa[v+6]=F.x;aa[v+7]=F.y;aa[v+8]=F.z;aa[v+9]=Q.x;aa[v+10]=Q.y;aa[v+11]=Q.z;v+=12}if(wa.length){C=wa[y.a];E=wa[y.b];F=wa[y.c];Q=wa[y.d];X[s]=C.x;X[s+1]=C.y;X[s+2]=C.z;
-X[s+3]=C.w;X[s+4]=E.x;X[s+5]=E.y;X[s+6]=E.z;X[s+7]=E.w;X[s+8]=F.x;X[s+9]=F.y;X[s+10]=F.z;X[s+11]=F.w;X[s+12]=Q.x;X[s+13]=Q.y;X[s+14]=Q.z;X[s+15]=Q.w;C=Aa[y.a];E=Aa[y.b];F=Aa[y.c];Q=Aa[y.d];W[s]=C.x;W[s+1]=C.y;W[s+2]=C.z;W[s+3]=C.w;W[s+4]=E.x;W[s+5]=E.y;W[s+6]=E.z;W[s+7]=E.w;W[s+8]=F.x;W[s+9]=F.y;W[s+10]=F.z;W[s+11]=F.w;W[s+12]=Q.x;W[s+13]=Q.y;W[s+14]=Q.z;W[s+15]=Q.w;C=ya[y.a];E=ya[y.b];F=ya[y.c];Q=ya[y.d];U[s]=C.x;U[s+1]=C.y;U[s+2]=C.z;U[s+3]=1;U[s+4]=E.x;U[s+5]=E.y;U[s+6]=E.z;U[s+7]=1;U[s+8]=F.x;
-U[s+9]=F.y;U[s+10]=F.z;U[s+11]=1;U[s+12]=Q.x;U[s+13]=Q.y;U[s+14]=Q.z;U[s+15]=1;C=za[y.a];E=za[y.b];F=za[y.c];Q=za[y.d];V[s]=C.x;V[s+1]=C.y;V[s+2]=C.z;V[s+3]=1;V[s+4]=E.x;V[s+5]=E.y;V[s+6]=E.z;V[s+7]=1;V[s+8]=F.x;V[s+9]=F.y;V[s+10]=F.z;V[s+11]=1;V[s+12]=Q.x;V[s+13]=Q.y;V[s+14]=Q.z;V[s+15]=1;s+=16}if(Qa&&ua.length){C=ua[y.a];E=ua[y.b];F=ua[y.c];Q=ua[y.d];ca[Y]=C.r;ca[Y+1]=C.g;ca[Y+2]=C.b;ca[Y+3]=E.r;ca[Y+4]=E.g;ca[Y+5]=E.b;ca[Y+6]=F.r;ca[Y+7]=F.g;ca[Y+8]=F.b;ca[Y+9]=Q.r;ca[Y+10]=Q.g;ca[Y+11]=Q.b;Y+=
-12}if(Pa&&ha.hasTangents){C=ma[y.a].tangent;E=ma[y.b].tangent;F=ma[y.c].tangent;y=ma[y.d].tangent;T[K]=C.x;T[K+1]=C.y;T[K+2]=C.z;T[K+3]=C.w;T[K+4]=E.x;T[K+5]=E.y;T[K+6]=E.z;T[K+7]=E.w;T[K+8]=F.x;T[K+9]=F.y;T[K+10]=F.z;T[K+11]=F.w;T[K+12]=y.x;T[K+13]=y.y;T[K+14]=y.z;T[K+15]=y.w;K+=16}if(Oa)if(ga.length==4&&Wa)for(y=0;y<4;y++){ea=ga[y];oa[N]=ea.x;oa[N+1]=ea.y;oa[N+2]=ea.z;N+=3}else for(y=0;y<4;y++){oa[N]=ea.x;oa[N+1]=ea.y;oa[N+2]=ea.z;N+=3}if(Ea&&ia)for(y=0;y<4;y++){ga=ia[y];Ja[z]=ga.u;Ja[z+1]=ga.v;
-z+=2}if(Ea&&ja)for(y=0;y<4;y++){ia=ja[y];Ka[O]=ia.u;Ka[O+1]=ia.v;O+=2}if(Na){ta[L]=t;ta[L+1]=t+1;ta[L+2]=t+2;ta[L+3]=t;ta[L+4]=t+2;ta[L+5]=t+3;L+=6;la[ka]=t;la[ka+1]=t+1;la[ka+2]=t;la[ka+3]=t+3;la[ka+4]=t+1;la[ka+5]=t+2;la[ka+6]=t+2;la[ka+7]=t+3;ka+=8;t+=4}}}if(Ma){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,aa,M)}if(Qa&&ua.length){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,ca,M)}if(Oa){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLNormalBuffer);
-c.bufferData(c.ARRAY_BUFFER,oa,M)}if(Pa&&ha.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,T,M)}if(Ea&&z>0){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Ja,M)}if(Ea&&O>0){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ka,M)}if(Na){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,ta,M);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,
-la,M)}if(s>0){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,U,M);c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,V,M);c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,W,M);c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,X,M)}}}j.__dirtyVertices=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=!1;j.__dirtyColors=!1}else if(h instanceof
-THREE.Ribbon){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;w=c.DYNAMIC_DRAW;t=void 0;t=void 0;v=void 0;r=void 0;z=h.vertices;M=h.colors;O=z.length;R=M.length;L=h.__vertexArray;D=h.__colorArray;N=h.__dirtyColors;if(h.__dirtyVertices){for(t=0;t<O;t++){v=z[t].position;r=t*3;L[r]=v.x;L[r+1]=v.y;L[r+2]=v.z}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,L,w)}if(N){for(t=0;t<R;t++){color=M[t];r=t*3;D[r]=color.r;D[r+1]=color.g;D[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,
-h.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,D,w)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(h instanceof THREE.Line){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;w=c.DYNAMIC_DRAW;t=void 0;t=void 0;v=void 0;r=void 0;z=h.vertices;M=h.colors;O=z.length;R=M.length;L=h.__vertexArray;D=h.__colorArray;N=h.__dirtyColors;if(h.__dirtyVertices){for(t=0;t<O;t++){v=z[t].position;r=t*3;L[r]=v.x;L[r+1]=v.y;L[r+2]=v.z}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,
-L,w)}if(N){for(t=0;t<R;t++){color=M[t];r=t*3;D[r]=color.r;D[r+1]=color.g;D[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,D,w)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem){j=h.geometry;(j.__dirtyVertices||j.__dirtyColors||h.sortParticles)&&b(j,c.DYNAMIC_DRAW,h);j.__dirtyVertices=!1;j.__dirtyColors=!1}}};this.setFaceCulling=function(f,k){if(f){!k||k=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);
-else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+c.attachShader(n,Y("fragment",k+h));c.attachShader(n,Y("vertex",w+s));c.linkProgram(n);c.getProgramParameter(n,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(n,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");n.uniforms={};n.attributes={};f.program=n;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(j in f.uniforms)n.push(j);j=f.program;h=0;for(s=n.length;h<
+s;h++){k=n[h];j.uniforms[k]=c.getUniformLocation(j,k)}j=f.program;n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];h=0;for(s=n.length;h<s;h++){k=n[h];j.attributes[k]=c.getAttribLocation(j,k)}j=f.program.attributes;c.enableVertexAttribArray(j.position);j.color>=0&&c.enableVertexAttribArray(j.color);j.normal>=0&&c.enableVertexAttribArray(j.normal);j.tangent>=0&&c.enableVertexAttribArray(j.tangent);if(f.skinning&&j.skinVertexA>=0&&j.skinVertexB>=
+0&&j.skinIndex>=0&&j.skinWeight>=0){c.enableVertexAttribArray(j.skinVertexA);c.enableVertexAttribArray(j.skinVertexB);c.enableVertexAttribArray(j.skinIndex);c.enableVertexAttribArray(j.skinWeight)}};this.render=function(f,k,n,h){var j,w,q,t,D,s,A,M,S=f.lights,P=f.fog;k.matrixAutoUpdate&&k.updateMatrix();f.update(undefined,!1,k);k.matrixWorldInverse.flattenToArray(La);k.projectionMatrix.flattenToArray(Ra);Ia.multiply(k.projectionMatrix,k.matrixWorldInverse);o(Ia);this.initWebGLObjects(f);O(n);(this.autoClear||
+h)&&this.clear();D=f.__webglObjects.length;for(h=0;h<D;h++){j=f.__webglObjects[h];A=j.object;if(A.visible)if(!(A instanceof THREE.Mesh)||u(A)){A.matrixWorld.flattenToArray(A._objectMatrixArray);H(A,k);v(j);j.render=!0;if(this.sortObjects){Da.copy(A.position);Ia.multiplyVector3(Da);j.z=Da.z}}else j.render=!1;else j.render=!1}this.sortObjects&&f.__webglObjects.sort(B);s=f.__webglObjectsImmediate.length;for(h=0;h<s;h++){j=f.__webglObjectsImmediate[h];A=j.object;if(A.visible){A.matrixAutoUpdate&&A.matrixWorld.flattenToArray(A._objectMatrixArray);
+H(A,k);x(j)}}I(THREE.NormalBlending);for(h=0;h<D;h++){j=f.__webglObjects[h];if(j.render){A=j.object;M=j.buffer;q=j.opaque;m(A);for(j=0;j<q.count;j++){t=q.list[j];p(t.depthTest);g(k,S,P,t,M,A)}}}for(h=0;h<s;h++){j=f.__webglObjectsImmediate[h];A=j.object;if(A.visible){q=j.opaque;m(A);for(j=0;j<q.count;j++){t=q.list[j];p(t.depthTest);w=e(k,S,P,t,A);A.render(function(K){l(K,w)})}}}for(h=0;h<D;h++){j=f.__webglObjects[h];if(j.render){A=j.object;M=j.buffer;q=j.transparent;m(A);for(j=0;j<q.count;j++){t=q.list[j];
+I(t.blending);p(t.depthTest);g(k,S,P,t,M,A)}}}for(h=0;h<s;h++){j=f.__webglObjectsImmediate[h];A=j.object;if(A.visible){q=j.transparent;m(A);for(j=0;j<q.count;j++){t=q.list[j];I(t.blending);p(t.depthTest);w=e(k,S,P,t,A);A.render(function(K){l(K,w)})}}}if(n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){if(!f.__webglObjects){f.__webglObjects=
+[];f.__webglObjectsImmediate=[]}for(;f.__objectsAdded.length;){var k=f.__objectsAdded[0],n=f,h=void 0,j=void 0,w=void 0;if(k._modelViewMatrix==undefined){k._modelViewMatrix=new THREE.Matrix4;k._normalMatrixArray=new Float32Array(9);k._modelViewMatrixArray=new Float32Array(16);k._objectMatrixArray=new Float32Array(16);k.matrixWorld.flattenToArray(k._objectMatrixArray)}if(k instanceof THREE.Mesh){j=k.geometry;j.geometryGroups==undefined&&G(j);for(h in j.geometryGroups){w=j.geometryGroups[h];if(!w.__webGLVertexBuffer){var q=
+w;q.__webGLVertexBuffer=c.createBuffer();q.__webGLNormalBuffer=c.createBuffer();q.__webGLTangentBuffer=c.createBuffer();q.__webGLColorBuffer=c.createBuffer();q.__webGLUVBuffer=c.createBuffer();q.__webGLUV2Buffer=c.createBuffer();q.__webGLSkinVertexABuffer=c.createBuffer();q.__webGLSkinVertexBBuffer=c.createBuffer();q.__webGLSkinIndicesBuffer=c.createBuffer();q.__webGLSkinWeightsBuffer=c.createBuffer();q.__webGLFaceBuffer=c.createBuffer();q.__webGLLineBuffer=c.createBuffer();q=w;var t=k,D=void 0,s=
+void 0,A=0,M=0,S=0,P=t.geometry.faces,K=q.faces;D=0;for(s=K.length;D<s;D++){fi=K[D];face=P[fi];if(face instanceof THREE.Face3){A+=3;M+=1;S+=3}else if(face instanceof THREE.Face4){A+=4;M+=2;S+=4}}q.__vertexArray=new Float32Array(A*3);q.__normalArray=new Float32Array(A*3);q.__tangentArray=new Float32Array(A*4);q.__colorArray=new Float32Array(A*3);q.__uvArray=new Float32Array(A*2);q.__uv2Array=new Float32Array(A*2);q.__skinVertexAArray=new Float32Array(A*4);q.__skinVertexBArray=new Float32Array(A*4);
+q.__skinIndexArray=new Float32Array(A*4);q.__skinWeightArray=new Float32Array(A*4);q.__faceArray=new Uint16Array(M*3);q.__lineArray=new Uint16Array(S*2);s=D=q;A=void 0;P=void 0;var N=void 0,J=void 0;N=void 0;K=!1;A=0;for(P=t.materials.length;A<P;A++){N=t.materials[A];if(N instanceof THREE.MeshFaceMaterial){N=0;for(J=s.materials.length;N<J;N++)if(s.materials[N]&&s.materials[N].shading!=undefined&&s.materials[N].shading==THREE.SmoothShading){K=!0;break}}else if(N&&N.shading!=undefined&&N.shading==THREE.SmoothShading){K=
+!0;break}if(K)break}D.__needsSmoothNormals=K;q.__webGLFaceCount=M*3;q.__webGLLineCount=S*2;j.__dirtyVertices=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=!0;j.__dirtyColors=!0}L(n.__webglObjects,w,k)}}else if(k instanceof THREE.Ribbon){j=k.geometry;if(!j.__webGLVertexBuffer){h=j;h.__webGLVertexBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=j;w=h.vertices.length;h.__vertexArray=new Float32Array(w*3);h.__colorArray=new Float32Array(w*3);h.__webGLVertexCount=
+w;j.__dirtyVertices=!0;j.__dirtyColors=!0}L(n.__webglObjects,j,k)}else if(k instanceof THREE.Line){j=k.geometry;if(!j.__webGLVertexBuffer){h=j;h.__webGLVertexBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=j;w=h.vertices.length;h.__vertexArray=new Float32Array(w*3);h.__colorArray=new Float32Array(w*3);h.__webGLLineCount=w;j.__dirtyVertices=!0;j.__dirtyColors=!0}L(n.__webglObjects,j,k)}else if(k instanceof THREE.ParticleSystem){j=k.geometry;if(!j.__webGLVertexBuffer){h=j;h.__webGLVertexBuffer=
+c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=j;w=h.vertices.length;h.__vertexArray=new Float32Array(w*3);h.__colorArray=new Float32Array(w*3);h.__sortArray=[];h.__webGLParticleCount=w;j.__dirtyVertices=!0;j.__dirtyColors=!0}L(n.__webglObjects,j,k)}else THREE.MarchingCubes!==undefined&&k instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:k,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,1)}for(;f.__objectsRemoved.length;){k=f.__objectsRemoved[0];
+n=f;j=void 0;h=void 0;for(j=n.__webglObjects.length-1;j>=0;j--){h=n.__webglObjects[j].object;k==h&&n.__webglObjects.splice(j,1)}f.__objectsRemoved.splice(0,1)}k=0;for(n=f.__webglObjects.length;k<n;k++){h=f.__webglObjects[k].object;w=void 0;j=void 0;q=void 0;if(h instanceof THREE.Mesh){j=h.geometry;for(w in j.geometryGroups){q=j.geometryGroups[w];if(j.__dirtyVertices||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents){M=c.DYNAMIC_DRAW;S=void 0;D=void 0;var ja=void 0,
+z=void 0,ga=void 0,fa=void 0,ia=void 0;ja=void 0;var C=void 0,E=void 0,F=void 0,R=void 0;C=void 0;E=void 0;F=void 0;z=void 0;C=void 0;E=void 0;F=void 0;R=void 0;C=void 0;E=void 0;F=void 0;R=void 0;C=void 0;E=void 0;F=void 0;R=void 0;C=void 0;E=void 0;F=void 0;R=void 0;C=void 0;E=void 0;F=void 0;R=void 0;z=void 0;fa=void 0;ga=void 0;ia=void 0;var ka=J=N=K=P=A=t=s=0,aa=0,r=0,da=q.__vertexArray,Ja=q.__uvArray,Ka=q.__uv2Array,pa=q.__normalArray,T=q.__tangentArray,ea=q.__colorArray,U=q.__skinVertexAArray,
+V=q.__skinVertexBArray,W=q.__skinIndexArray,X=q.__skinWeightArray,ta=q.__faceArray,ma=q.__lineArray,Wa=q.__needsSmoothNormals,ha=h.geometry,Ma=ha.__dirtyVertices,Na=ha.__dirtyElements,Ea=ha.__dirtyUvs,Oa=ha.__dirtyNormals,Pa=ha.__dirtyTangents,Qa=ha.__dirtyColors,na=ha.vertices,Xa=q.faces,Ya=ha.faces,Za=ha.uvs,$a=ha.uvs2,ua=ha.colors,ya=ha.skinVerticesA,za=ha.skinVerticesB,Aa=ha.skinIndices,wa=ha.skinWeights;S=0;for(D=Xa.length;S<D;S++){ja=Xa[S];z=Ya[ja];ia=Za[ja];ja=$a[ja];ga=z.vertexNormals;fa=
+z.normal;if(z instanceof THREE.Face3){if(Ma){C=na[z.a].position;E=na[z.b].position;F=na[z.c].position;da[t]=C.x;da[t+1]=C.y;da[t+2]=C.z;da[t+3]=E.x;da[t+4]=E.y;da[t+5]=E.z;da[t+6]=F.x;da[t+7]=F.y;da[t+8]=F.z;t+=9}if(wa.length){C=wa[z.a];E=wa[z.b];F=wa[z.c];X[r]=C.x;X[r+1]=C.y;X[r+2]=C.z;X[r+3]=C.w;X[r+4]=E.x;X[r+5]=E.y;X[r+6]=E.z;X[r+7]=E.w;X[r+8]=F.x;X[r+9]=F.y;X[r+10]=F.z;X[r+11]=F.w;C=Aa[z.a];E=Aa[z.b];F=Aa[z.c];W[r]=C.x;W[r+1]=C.y;W[r+2]=C.z;W[r+3]=C.w;W[r+4]=E.x;W[r+5]=E.y;W[r+6]=E.z;W[r+7]=
+E.w;W[r+8]=F.x;W[r+9]=F.y;W[r+10]=F.z;W[r+11]=F.w;C=ya[z.a];E=ya[z.b];F=ya[z.c];U[r]=C.x;U[r+1]=C.y;U[r+2]=C.z;U[r+3]=1;U[r+4]=E.x;U[r+5]=E.y;U[r+6]=E.z;U[r+7]=1;U[r+8]=F.x;U[r+9]=F.y;U[r+10]=F.z;U[r+11]=1;C=za[z.a];E=za[z.b];F=za[z.c];V[r]=C.x;V[r+1]=C.y;V[r+2]=C.z;V[r+3]=1;V[r+4]=E.x;V[r+5]=E.y;V[r+6]=E.z;V[r+7]=1;V[r+8]=F.x;V[r+9]=F.y;V[r+10]=F.z;V[r+11]=1;r+=12}if(Qa&&ua.length){C=ua[z.a];E=ua[z.b];F=ua[z.c];ea[aa]=C.r;ea[aa+1]=C.g;ea[aa+2]=C.b;ea[aa+3]=E.r;ea[aa+4]=E.g;ea[aa+5]=E.b;ea[aa+6]=
+F.r;ea[aa+7]=F.g;ea[aa+8]=F.b;aa+=9}if(Pa&&ha.hasTangents){C=na[z.a].tangent;E=na[z.b].tangent;F=na[z.c].tangent;T[J]=C.x;T[J+1]=C.y;T[J+2]=C.z;T[J+3]=C.w;T[J+4]=E.x;T[J+5]=E.y;T[J+6]=E.z;T[J+7]=E.w;T[J+8]=F.x;T[J+9]=F.y;T[J+10]=F.z;T[J+11]=F.w;J+=12}if(Oa)if(ga.length==3&&Wa)for(z=0;z<3;z++){fa=ga[z];pa[N]=fa.x;pa[N+1]=fa.y;pa[N+2]=fa.z;N+=3}else for(z=0;z<3;z++){pa[N]=fa.x;pa[N+1]=fa.y;pa[N+2]=fa.z;N+=3}if(Ea&&ia)for(z=0;z<3;z++){ga=ia[z];Ja[A]=ga.u;Ja[A+1]=ga.v;A+=2}if(Ea&&ja)for(z=0;z<3;z++){ia=
+ja[z];Ka[P]=ia.u;Ka[P+1]=ia.v;P+=2}if(Na){ta[K]=s;ta[K+1]=s+1;ta[K+2]=s+2;K+=3;ma[ka]=s;ma[ka+1]=s+1;ma[ka+2]=s;ma[ka+3]=s+2;ma[ka+4]=s+1;ma[ka+5]=s+2;ka+=6;s+=3}}else if(z instanceof THREE.Face4){if(Ma){C=na[z.a].position;E=na[z.b].position;F=na[z.c].position;R=na[z.d].position;da[t]=C.x;da[t+1]=C.y;da[t+2]=C.z;da[t+3]=E.x;da[t+4]=E.y;da[t+5]=E.z;da[t+6]=F.x;da[t+7]=F.y;da[t+8]=F.z;da[t+9]=R.x;da[t+10]=R.y;da[t+11]=R.z;t+=12}if(wa.length){C=wa[z.a];E=wa[z.b];F=wa[z.c];R=wa[z.d];X[r]=C.x;X[r+1]=C.y;
+X[r+2]=C.z;X[r+3]=C.w;X[r+4]=E.x;X[r+5]=E.y;X[r+6]=E.z;X[r+7]=E.w;X[r+8]=F.x;X[r+9]=F.y;X[r+10]=F.z;X[r+11]=F.w;X[r+12]=R.x;X[r+13]=R.y;X[r+14]=R.z;X[r+15]=R.w;C=Aa[z.a];E=Aa[z.b];F=Aa[z.c];R=Aa[z.d];W[r]=C.x;W[r+1]=C.y;W[r+2]=C.z;W[r+3]=C.w;W[r+4]=E.x;W[r+5]=E.y;W[r+6]=E.z;W[r+7]=E.w;W[r+8]=F.x;W[r+9]=F.y;W[r+10]=F.z;W[r+11]=F.w;W[r+12]=R.x;W[r+13]=R.y;W[r+14]=R.z;W[r+15]=R.w;C=ya[z.a];E=ya[z.b];F=ya[z.c];R=ya[z.d];U[r]=C.x;U[r+1]=C.y;U[r+2]=C.z;U[r+3]=1;U[r+4]=E.x;U[r+5]=E.y;U[r+6]=E.z;U[r+7]=1;
+U[r+8]=F.x;U[r+9]=F.y;U[r+10]=F.z;U[r+11]=1;U[r+12]=R.x;U[r+13]=R.y;U[r+14]=R.z;U[r+15]=1;C=za[z.a];E=za[z.b];F=za[z.c];R=za[z.d];V[r]=C.x;V[r+1]=C.y;V[r+2]=C.z;V[r+3]=1;V[r+4]=E.x;V[r+5]=E.y;V[r+6]=E.z;V[r+7]=1;V[r+8]=F.x;V[r+9]=F.y;V[r+10]=F.z;V[r+11]=1;V[r+12]=R.x;V[r+13]=R.y;V[r+14]=R.z;V[r+15]=1;r+=16}if(Qa&&ua.length){C=ua[z.a];E=ua[z.b];F=ua[z.c];R=ua[z.d];ea[aa]=C.r;ea[aa+1]=C.g;ea[aa+2]=C.b;ea[aa+3]=E.r;ea[aa+4]=E.g;ea[aa+5]=E.b;ea[aa+6]=F.r;ea[aa+7]=F.g;ea[aa+8]=F.b;ea[aa+9]=R.r;ea[aa+10]=
+R.g;ea[aa+11]=R.b;aa+=12}if(Pa&&ha.hasTangents){C=na[z.a].tangent;E=na[z.b].tangent;F=na[z.c].tangent;z=na[z.d].tangent;T[J]=C.x;T[J+1]=C.y;T[J+2]=C.z;T[J+3]=C.w;T[J+4]=E.x;T[J+5]=E.y;T[J+6]=E.z;T[J+7]=E.w;T[J+8]=F.x;T[J+9]=F.y;T[J+10]=F.z;T[J+11]=F.w;T[J+12]=z.x;T[J+13]=z.y;T[J+14]=z.z;T[J+15]=z.w;J+=16}if(Oa)if(ga.length==4&&Wa)for(z=0;z<4;z++){fa=ga[z];pa[N]=fa.x;pa[N+1]=fa.y;pa[N+2]=fa.z;N+=3}else for(z=0;z<4;z++){pa[N]=fa.x;pa[N+1]=fa.y;pa[N+2]=fa.z;N+=3}if(Ea&&ia)for(z=0;z<4;z++){ga=ia[z];Ja[A]=
+ga.u;Ja[A+1]=ga.v;A+=2}if(Ea&&ja)for(z=0;z<4;z++){ia=ja[z];Ka[P]=ia.u;Ka[P+1]=ia.v;P+=2}if(Na){ta[K]=s;ta[K+1]=s+1;ta[K+2]=s+2;ta[K+3]=s;ta[K+4]=s+2;ta[K+5]=s+3;K+=6;ma[ka]=s;ma[ka+1]=s+1;ma[ka+2]=s;ma[ka+3]=s+3;ma[ka+4]=s+1;ma[ka+5]=s+2;ma[ka+6]=s+2;ma[ka+7]=s+3;ka+=8;s+=4}}}if(Ma){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,da,M)}if(Qa&&ua.length){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,ea,M)}if(Oa){c.bindBuffer(c.ARRAY_BUFFER,
+q.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,pa,M)}if(Pa&&ha.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,T,M)}if(Ea&&A>0){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Ja,M)}if(Ea&&P>0){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ka,M)}if(Na){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,ta,M);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);
+c.bufferData(c.ELEMENT_ARRAY_BUFFER,ma,M)}if(r>0){c.bindBuffer(c.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,U,M);c.bindBuffer(c.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,V,M);c.bindBuffer(c.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,W,M);c.bindBuffer(c.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,X,M)}}}j.__dirtyVertices=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=
+!1;j.__dirtyColors=!1}else if(h instanceof THREE.Ribbon){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;w=c.DYNAMIC_DRAW;s=void 0;s=void 0;t=void 0;q=void 0;A=h.vertices;M=h.colors;P=A.length;S=M.length;K=h.__vertexArray;D=h.__colorArray;N=h.__dirtyColors;if(h.__dirtyVertices){for(s=0;s<P;s++){t=A[s].position;q=s*3;K[q]=t.x;K[q+1]=t.y;K[q+2]=t.z}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,K,w)}if(N){for(s=0;s<S;s++){color=M[s];q=s*3;D[q]=color.r;D[q+1]=
+color.g;D[q+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,D,w)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(h instanceof THREE.Line){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;w=c.DYNAMIC_DRAW;s=void 0;s=void 0;t=void 0;q=void 0;A=h.vertices;M=h.colors;P=A.length;S=M.length;K=h.__vertexArray;D=h.__colorArray;N=h.__dirtyColors;if(h.__dirtyVertices){for(s=0;s<P;s++){t=A[s].position;q=s*3;K[q]=t.x;K[q+1]=t.y;K[q+2]=t.z}c.bindBuffer(c.ARRAY_BUFFER,
+h.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,K,w)}if(N){for(s=0;s<S;s++){color=M[s];q=s*3;D[q]=color.r;D[q+1]=color.g;D[q+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,D,w)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem){j=h.geometry;(j.__dirtyVertices||j.__dirtyColors||h.sortParticles)&&b(j,c.DYNAMIC_DRAW,h);j.__dirtyVertices=!1;j.__dirtyColors=!1}}};this.setFaceCulling=function(f,k){if(f){!k||k=="ccw"?c.frontFace(c.CCW):
+c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};

+ 82 - 56
src/cameras/PathCamera.js

@@ -27,31 +27,31 @@
 THREE.PathCamera = function ( parameters ) {
 
 	THREE.Camera.call( this, parameters.fov, parameters.aspect, parameters.near, parameters.far, parameters.target );
-	
+
 	this.duration = 10 * 1000; // milliseconds
 	this.waypoints = [];
 	
 	this.debugPath = new THREE.Object3D();
 	this.debugDummy = new THREE.Object3D();
-	
+
 	this.animationParent = new THREE.Object3D();
-	
+
 	this.lookSpeed = 0.005;
 	this.lookVertical = true;
 	this.lookHorizontal = true;
 	this.verticalAngleMap   = { srcRange: [ 0, 6.28 ], dstRange: [ 0, 6.28 ] };
 	this.horizontalAngleMap = { srcRange: [ 0, 6.28 ], dstRange: [ 0, 6.28 ] };
-	
+
 	this.domElement = document;
 
 	if ( parameters ) {
 
 		if ( parameters.duration !== undefined ) this.duration = parameters.duration * 1000;
 		if ( parameters.waypoints !== undefined ) this.waypoints = parameters.waypoints;
-		
+
 		if ( parameters.createDebugPath !== undefined ) this.createDebugPath = parameters.createDebugPath;
 		if ( parameters.createDebugDummy !== undefined ) this.createDebugDummy = parameters.createDebugDummy;
-		
+
 		if ( parameters.lookSpeed !== undefined ) this.lookSpeed = parameters.lookSpeed;
 		if ( parameters.lookVertical !== undefined ) this.lookVertical = parameters.lookVertical;
 		if ( parameters.lookHorizontal !== undefined ) this.lookHorizontal = parameters.lookHorizontal;
@@ -67,24 +67,24 @@ THREE.PathCamera = function ( parameters ) {
 
 	this.lat = 0;
 	this.lon = 0;
-	
+
 	this.phi = 0;
 	this.theta = 0;
-	
+
 	this.windowHalfX = window.innerWidth / 2;
 	this.windowHalfY = window.innerHeight / 2;
-	
+
 	var PI2 = Math.PI * 2,
 		PI180 = Math.PI / 180;
-	
+
 	// methods
-	
-	this.updateManual = function () {
+
+	this.update = function ( parentMatrixWorld, forceUpdate, camera ) {
 
 		var srcRange, dstRange;
 		
 		if( this.lookHorizontal ) this.lon += this.mouseX * this.lookSpeed;
-		if( this.lookVertical )   this.lat -= this.mouseY * this.lookSpeed;		
+		if( 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 ) );
@@ -117,7 +117,7 @@ THREE.PathCamera = function ( parameters ) {
 		targetPosition.y = position.y + 100 * Math.cos( this.phi );
 		targetPosition.z = position.z + 100 * Math.sin( this.phi ) * Math.sin( this.theta );
 		
-		this.supr.update.call( this );
+		this.supr.update.call( this, parentMatrixWorld, forceUpdate, camera );
 
 	};
 	
@@ -148,8 +148,8 @@ THREE.PathCamera = function ( parameters ) {
 		return ( x  - sa ) * ( eb - ea ) / ( sb - sa ) + ea;
 		
 	};
-	
-	
+
+
 	function distance( a, b ) {
 	
 		var dx = a[ 0 ] - b[ 0 ],
@@ -157,7 +157,7 @@ THREE.PathCamera = function ( parameters ) {
 			dz = a[ 2 ] - b[ 2 ];
 		
 		return Math.sqrt( dx * dx + dy * dy + dz * dz );
-		
+
 	};
 
 	function bind( scope, fn ) {
@@ -171,7 +171,7 @@ THREE.PathCamera = function ( parameters ) {
 	};
 
 	function initAnimationPath( parent, path, name, duration ) {
-		
+
 		var animationData = {
 
 		   name: name,
@@ -179,28 +179,31 @@ THREE.PathCamera = function ( parameters ) {
 		   length: duration,
 
 		   hierarchy: []
-		   
+
 		};
-		
+
 		var i, 
 			parentAnimation, childAnimation,
 			pl = path.length,
-			totalLength = splineLength( path ),
+			sl = splineLength( path ),
 			t = 0,
 			first = 0,
 			last  = pl - 1;
-		
+
 		parentAnimation = { parent: -1, keys: [] };
 		parentAnimation.keys[ first ] = { time: 0,        pos: path[ first ], rot: [ 0, 0, 0, 1 ], scl: [ 1, 1, 1 ] };
-		parentAnimation.keys[ last  ] = { time: duration, pos: path[ last ],  rot: [ 0, 0, 0, 1 ], scl: [ 1, 1, 1 ] };				
-		
-		console.log( "path totalLength: ", totalLength );
+		parentAnimation.keys[ last  ] = { time: duration, pos: path[ last ],  rot: [ 0, 0, 0, 1 ], scl: [ 1, 1, 1 ] };
 		
-		for ( i = first + 1; i < last; i++ ) {
+		console.log( "path length total:", sl.total, "chunks:", sl.chunks );
 		
-			t += duration * distance( path[ i ], path[ i - 1 ] ) / totalLength;
+		for ( i = 1; i < pl-1; i++ ) {
+
+			t = duration * sl.chunks[ i ] / sl.total;
 			
+			//t += duration * distance( path[ i ], path[ i - 1 ] ) / sl.total;
+
 			parentAnimation.keys[ i ] = { time: t, pos: path[ i ] };
+			console.log( i, t/1000 );
 
 		}
 
@@ -209,66 +212,84 @@ THREE.PathCamera = function ( parameters ) {
 		THREE.AnimationHandler.add( animationData );
 		
 		return new THREE.Animation( parent, name, THREE.AnimationHandler.CATMULLROM_FORWARD, false );
+		//return new THREE.Animation( parent, name, THREE.AnimationHandler.CATMULLROM, false );
+		//return new THREE.Animation( parent, name, THREE.AnimationHandler.LINEAR, false );
 
 	};
 
-	function createSplineGeometryFromPoints( points, n_sub ) {
-	
-		var i, index, position,
-			geometry = new THREE.Geometry(),
+	function splineLength( points ) {
+
+		var i, index, p, coords = [], 
 			spline = new THREE.Spline(),
-			p, coords = [];
-		
+			n_sub = 100, 
+			c = 0,
+			point = 0, intPoint = 0, oldIntPoint = 0,
+			chunkLengths = [ 0 ],
+			totalLength = 0;
+
 		for ( i = 0; i < points.length; i ++ ) {
 			
 			p = points[ i ];
 			coords[ i ] = { x: p[ 0 ], y: p[ 1 ], z: p[ 2 ] };
 
 		}
-		
-		for ( i = 0; i < coords.length * n_sub; i ++ ) {
-		
+
+		var oldPosition = [ points[ 0 ][ 0 ], points[ 0 ][ 1 ], points[ 0 ][ 2 ] ];
+
+		for ( i = 1; i < coords.length * n_sub; i ++ ) {
+
 			index = i / ( coords.length * n_sub );
 			position = spline.getPoint( coords, index );
+
+			totalLength += distance( [ position.x, position.y, position.z ], oldPosition );
+			oldPosition = [ position.x, position.y, position.z ];
+
+			point = ( coords.length - 1 ) * index;
+			intPoint = Math.floor( point );
 			
-			geometry.vertices[ i ] = new THREE.Vertex( new THREE.Vector3( position.x, position.y, position.z ) );
-			
+			if ( intPoint != oldIntPoint ) {
+
+				chunkLengths[ intPoint ] = totalLength;
+				oldIntPoint = intPoint;
+
+			}
+
+			//console.log( intPoint, i, index, totalLength );
+
 		}
-		
-		return geometry;
-	
+
+		return { chunks: chunkLengths, total: totalLength };
+
 	};
-			
-	function splineLength( points ) {
 
-		var i, index, p, coords = [], 
-			spline = new THREE.Spline(),
-			n_sub = 100, totalLength = 0;
 
+	function createSplineGeometryFromPoints( points, n_sub ) {
+	
+		var i, index, position,
+			geometry = new THREE.Geometry(),
+			spline = new THREE.Spline(),
+			p, coords = [];
+		
 		for ( i = 0; i < points.length; i ++ ) {
 			
 			p = points[ i ];
 			coords[ i ] = { x: p[ 0 ], y: p[ 1 ], z: p[ 2 ] };
 
 		}
-
-		var oldPosition = [ points[ 0 ][ 0 ], points[ 0 ][ 1 ], points[ 0 ][ 2 ] ];
 		
-		for ( i = 1; i < coords.length * n_sub; i ++ ) {
+		for ( i = 0; i < coords.length * n_sub; i ++ ) {
 		
 			index = i / ( coords.length * n_sub );
 			position = spline.getPoint( coords, index );
 			
-			totalLength += distance( [ position.x, position.y, position.z ], oldPosition );
-			oldPosition = [ position.x, position.y, position.z ];
+			geometry.vertices[ i ] = new THREE.Vertex( new THREE.Vector3( position.x, position.y, position.z ) );
 			
-		}				
-
+		}
 		
-		return totalLength;
+		return geometry;
 	
 	};
-			
+
 	function createWaypointGeometryFromPoints( points ) {
 		
 		var i, position,
@@ -288,12 +309,17 @@ THREE.PathCamera = function ( parameters ) {
 	function createPath( parent, path ) {
 
 		var lineGeo = createSplineGeometryFromPoints( path, 10 ),
+			particleGeo = createSplineGeometryFromPoints( path, 10 ),
 			lineMat = new THREE.LineBasicMaterial( { color: 0xff0000, linewidth: 3 } );
 			lineObj = new THREE.Line( lineGeo, lineMat );
+			particleObj = new THREE.ParticleSystem( particleGeo, new THREE.ParticleBasicMaterial( { color: 0xffaa00, size: 3 } ) );
 			
 		lineObj.scale.set( 1, 1, 1 );
 		parent.addChild( lineObj );
-		
+
+		particleObj.scale.set( 1, 1, 1 );
+		parent.addChild( particleObj );
+			
 		var waypoint,
 			geo = new Sphere( 1, 16, 8 ),
 			mat = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );