Kaynağa Gözat

Optimised Ray a bit more
Removed some clone() calls while still keeping the code somewhat pretty.

Mr.doob 14 yıl önce
ebeveyn
işleme
dad6911bb0

+ 362 - 362
build/Three.js

@@ -14,39 +14,39 @@ cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y
 Math.abs(c)>1.0E-5?(this.x=Math.atan2(-a.n23/c,a.n33/c),this.z=Math.atan2(-a.n12/c,a.n11/c)):(this.x=0,this.z=Math.atan2(a.n21,a.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(a,c,b,d){this.x=a||0;this.y=c||0;this.z=b||0;this.w=d!==void 0?d:1};
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-
 c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
-normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,c){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;return this}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var c,b,d=[];c=0;for(b=a.length;c<b;c++)Array.prototype.push.apply(d,this.intersectObject(a[c]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function c(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function b(a,b,c,p){d.copy(p).subSelf(b);
-g.copy(c).subSelf(b);e.copy(a).subSelf(b);f=d.dot(d);h=d.dot(g);i=d.dot(e);k=g.dot(g);l=g.dot(e);m=1/(f*k-h*h);q=(k*i-h*l)*m;n=(f*l-h*i)*m;return q>=0&&n>=0&&q+n<1}for(var d=new THREE.Vector3,g=new THREE.Vector3,e=new THREE.Vector3,f,h,i,k,l,m,q,n,t,p=[],o=0,v=a.children.length;o<v;o++)Array.prototype.push.apply(p,this.intersectObject(a.children[o]));if(a instanceof THREE.Particle){o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o===null||o>a.scale.x)return[];t={distance:o,point:a.position,
-face:null,object:a};p.push(t)}else if(a instanceof THREE.Mesh){o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o===null||o>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return p;var w,r,s,u,x,H,G,F,y=a.geometry,C=y.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);o=0;for(v=y.faces.length;o<v;o++)if(t=y.faces[o],G=this.origin.clone(),F=this.direction.clone(),u=a.matrixWorld,w=u.multiplyVector3(t.centroid.clone()).subSelf(G),H=w.dot(F),
-!(H<=0)&&(w=u.multiplyVector3(C[t.a].position.clone()),r=u.multiplyVector3(C[t.b].position.clone()),s=u.multiplyVector3(C[t.c].position.clone()),u=t instanceof THREE.Face4?u.multiplyVector3(C[t.d].position.clone()):null,x=a.matrixRotationWorld.multiplyVector3(t.normal.clone()),H=F.dot(x),a.doubleSided||(a.flipSided?H>0:H<0)))if(H=x.dot((new THREE.Vector3).sub(w,G))/H,G=G.addSelf(F.multiplyScalar(H)),t instanceof THREE.Face3)b(G,w,r,s)&&(t={distance:this.origin.distanceTo(G),point:G,face:t,object:a},
-p.push(t));else if(t instanceof THREE.Face4&&(b(G,w,r,u)||b(G,r,s,u)))t={distance:this.origin.distanceTo(G),point:G,face:t,object:a},p.push(t)}return p}};
-THREE.Rectangle=function(){function a(){e=d-c;f=g-b}var c,b,d,g,e,f,h=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return e};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return g};this.set=function(e,f,l,m){h=!1;c=e;b=f;d=l;g=m;a()};this.addPoint=function(e,f){h?(h=!1,c=e,b=f,d=e,g=f):(c=c<e?c:e,b=b<f?b:f,d=d>e?d:e,g=g>f?g:f);a()};this.add3Points=
-function(e,f,l,m,q,n){h?(h=!1,c=e<l?e<q?e:q:l<q?l:q,b=f<m?f<n?f:n:m<n?m:n,d=e>l?e>q?e:q:l>q?l:q,g=f>m?f>n?f:n:m>n?m:n):(c=e<l?e<q?e<c?e:c:q<c?q:c:l<q?l<c?l:c:q<c?q:c,b=f<m?f<n?f<b?f:b:n<b?n:b:m<n?m<b?m:b:n<b?n:b,d=e>l?e>q?e>d?e:d:q>d?q:d:l>q?l>d?l:d:q>d?q:d,g=f>m?f>n?f>g?f:g:n>g?n:g:m>n?m>g?m:g:n>g?n:g);a()};this.addRectangle=function(e){h?(h=!1,c=e.getLeft(),b=e.getTop(),d=e.getRight(),g=e.getBottom()):(c=c<e.getLeft()?c:e.getLeft(),b=b<e.getTop()?b:e.getTop(),d=d>e.getRight()?d:e.getRight(),g=g>
+normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,c){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;return this}};
+THREE.Ray=function(a,c){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function d(a,b,c,d){k.copy(d).subSelf(b);l.copy(c).subSelf(b);n.copy(a).subSelf(b);o=k.dot(k);m=k.dot(l);s=k.dot(n);p=l.dot(l);r=l.dot(n);t=1/(o*p-m*m);w=(p*s-m*r)*t;q=(o*r-m*s)*t;return w>=0&&q>=0&&w+q<1}this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};
+this.intersectObjects=function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var g=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,c=new THREE.Vector3,i=new THREE.Vector3;this.intersectObject=function(a){for(var c,m=[],k=0,l=a.children.length;k<l;k++)Array.prototype.push.apply(m,this.intersectObject(a.children[k]));if(a instanceof THREE.Particle){k=
+b(this.origin,this.direction,a.matrixWorld.getPosition());if(k===null||k>a.scale.x)return[];c={distance:k,point:a.position,face:null,object:a};m.push(c)}else if(a instanceof THREE.Mesh){k=b(this.origin,this.direction,a.matrixWorld.getPosition());if(k===null||k>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return m;var n,p,o,s,r=a.geometry,q=r.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);k=0;for(l=r.faces.length;k<l;k++)if(c=r.faces[k],o=this.origin.clone(),
+s=this.direction.clone(),p=a.matrixWorld,n=p.multiplyVector3(c.centroid.clone()).subSelf(o),n=n.dot(s),!(n<=0)&&(g=p.multiplyVector3(g.copy(q[c.a].position)),e=p.multiplyVector3(e.copy(q[c.b].position)),f=p.multiplyVector3(f.copy(q[c.c].position)),h=c instanceof THREE.Face4?p.multiplyVector3(h.copy(q[c.d].position)):null,i=a.matrixRotationWorld.multiplyVector3(i.copy(c.normal)),n=s.dot(i),a.doubleSided||(a.flipSided?n>0:n<0)))if(p=i.dot((new THREE.Vector3).sub(g,o))/n,o=o.addSelf(s.multiplyScalar(p)),
+c instanceof THREE.Face3)d(o,g,e,f)&&(c={distance:this.origin.distanceTo(o),point:o,face:c,object:a},m.push(c));else if(c instanceof THREE.Face4&&(d(o,g,e,h)||d(o,e,f,h)))c={distance:this.origin.distanceTo(o),point:o,face:c,object:a},m.push(c)}return m};var k=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,o,m,s,p,r,t,w,q};
+THREE.Rectangle=function(){function a(){e=d-c;f=g-b}var c,b,d,g,e,f,h=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return e};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return g};this.set=function(e,f,l,n){h=!1;c=e;b=f;d=l;g=n;a()};this.addPoint=function(e,f){h?(h=!1,c=e,b=f,d=e,g=f):(c=c<e?c:e,b=b<f?b:f,d=d>e?d:e,g=g>f?g:f);a()};this.add3Points=
+function(e,f,l,n,o,m){h?(h=!1,c=e<l?e<o?e:o:l<o?l:o,b=f<n?f<m?f:m:n<m?n:m,d=e>l?e>o?e:o:l>o?l:o,g=f>n?f>m?f:m:n>m?n:m):(c=e<l?e<o?e<c?e:c:o<c?o:c:l<o?l<c?l:c:o<c?o:c,b=f<n?f<m?f<b?f:b:m<b?m:b:n<m?n<b?n:b:m<b?m:b,d=e>l?e>o?e>d?e:d:o>d?o:d:l>o?l>d?l:d:o>d?o:d,g=f>n?f>m?f>g?f:g:m>g?m:g:n>m?n>g?n:g:m>g?m:g);a()};this.addRectangle=function(e){h?(h=!1,c=e.getLeft(),b=e.getTop(),d=e.getRight(),g=e.getBottom()):(c=c<e.getLeft()?c:e.getLeft(),b=b<e.getTop()?b:e.getTop(),d=d>e.getRight()?d:e.getRight(),g=g>
 e.getBottom()?g:e.getBottom());a()};this.inflate=function(e){c-=e;b-=e;d+=e;g+=e;a()};this.minSelf=function(e){c=c>e.getLeft()?c:e.getLeft();b=b>e.getTop()?b:e.getTop();d=d<e.getRight()?d:e.getRight();g=g<e.getBottom()?g:e.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(c,a.getLeft())>=0&&Math.min(g,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){h=!0;g=d=b=c=0;a()};this.isEmpty=function(){return h}};
 THREE.Math={clamp:function(a,c,b){return a<c?c:a>b?b:a},clampBottom:function(a,c){return a<c?c:a},mapLinear:function(a,c,b,d,g){return d+(a-c)*(g-d)/(b-c)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,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,g,e,f,h,i,k,l,m,q,n,t,p){this.set(a!==void 0?a:1,c||0,b||0,d||0,g||0,e!==void 0?e:1,f||0,h||0,i||0,k||0,l!==void 0?l:1,m||0,q||0,n||0,t||0,p!==void 0?p:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,d,g,e,f,h,i,k,l,m,q,n,t,p){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=g;this.n22=e;this.n23=f;this.n24=h;this.n31=i;this.n32=k;this.n33=l;this.n34=m;this.n41=q;this.n42=n;this.n43=t;this.n44=p;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,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,c).normalize();if(e.length()===0)e.z=1;d.cross(b,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(b,e).normalize());g.cross(e,d).normalize();this.n11=d.x;this.n12=g.x;this.n13=e.x;this.n21=d.y;this.n22=g.y;this.n23=e.y;this.n31=d.z;this.n32=g.z;this.n33=e.z;return this},multiply:function(a,c){var b=a.n11,d=a.n12,g=a.n13,e=a.n14,f=a.n21,h=a.n22,i=a.n23,k=a.n24,l=a.n31,m=a.n32,q=a.n33,n=a.n34,t=a.n41,p=a.n42,o=a.n43,
-v=a.n44,w=c.n11,r=c.n12,s=c.n13,u=c.n14,x=c.n21,H=c.n22,G=c.n23,F=c.n24,y=c.n31,C=c.n32,O=c.n33,J=c.n34,$=c.n41,L=c.n42,P=c.n43,da=c.n44;this.n11=b*w+d*x+g*y+e*$;this.n12=b*r+d*H+g*C+e*L;this.n13=b*s+d*G+g*O+e*P;this.n14=b*u+d*F+g*J+e*da;this.n21=f*w+h*x+i*y+k*$;this.n22=f*r+h*H+i*C+k*L;this.n23=f*s+h*G+i*O+k*P;this.n24=f*u+h*F+i*J+k*da;this.n31=l*w+m*x+q*y+n*$;this.n32=l*r+m*H+q*C+n*L;this.n33=l*s+m*G+q*O+n*P;this.n34=l*u+m*F+q*J+n*da;this.n41=t*w+p*x+o*y+v*$;this.n42=t*r+p*H+o*C+v*L;this.n43=t*
-s+p*G+o*O+v*P;this.n44=t*u+p*F+o*J+v*da;return this},multiplySelf:function(a){return this.multiply(this,a)},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},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},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,g=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)*g;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*g;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,g=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*g;a.y=this.n21*
-c+this.n22*b+this.n23*d+this.n24*g;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*g;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*g;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},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,g=this.n21,e=this.n22,f=this.n23,h=this.n24,i=this.n31,k=this.n32,l=this.n33,m=this.n34,q=this.n41,n=this.n42,t=this.n43,p=this.n44;return d*f*k*q-b*h*k*q-d*e*l*q+c*h*l*q+b*e*m*q-c*f*m*q-d*f*i*n+b*h*i*n+d*g*l*n-a*h*l*n-b*g*m*n+a*f*m*n+d*e*i*t-c*h*i*t-d*g*k*t+a*h*k*t+c*g*m*t-a*e*m*t-b*e*i*p+c*f*i*p+b*g*k*p-a*f*k*p-c*g*l*p+a*e*l*
-p},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),g=1-b,e=a.x,f=a.y,h=a.z,i=g*e,k=g*f;this.set(i*e+b,i*f-d*h,i*h+d*f,0,i*f+d*h,k*f+b,k*h-d*e,0,i*h-d*f,k*h+d*e,g*h*h+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},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,d=a.n13,g=a.n14,e=a.n21,f=a.n22,h=a.n23,i=a.n24,k=a.n31,l=a.n32,m=a.n33,q=a.n34,n=a.n41,t=a.n42,p=a.n43,o=a.n44;this.n11=h*q*t-i*m*t+i*l*p-f*q*p-h*l*o+f*m*o;this.n12=g*m*t-d*q*t-g*l*p+b*q*p+d*l*o-b*m*o;this.n13=d*i*t-g*h*t+g*f*p-b*i*p-d*f*o+b*h*o;this.n14=g*h*l-d*i*l-g*f*m+b*i*m+d*f*q-b*h*q;this.n21=i*m*n-h*q*n-i*k*p+e*q*p+h*k*o-e*m*o;this.n22=d*q*n-g*m*n+
-g*k*p-c*q*p-d*k*o+c*m*o;this.n23=g*h*n-d*i*n-g*e*p+c*i*p+d*e*o-c*h*o;this.n24=d*i*k-g*h*k+g*e*m-c*i*m-d*e*q+c*h*q;this.n31=f*q*n-i*l*n+i*k*t-e*q*t-f*k*o+e*l*o;this.n32=g*l*n-b*q*n-g*k*t+c*q*t+b*k*o-c*l*o;this.n33=d*i*n-g*f*n+g*e*t-c*i*t-b*e*o+c*f*o;this.n34=g*f*k-b*i*k-g*e*l+c*i*l+b*e*q-c*f*q;this.n41=h*l*n-f*m*n-h*k*t+e*m*t+f*k*p-e*l*p;this.n42=b*m*n-d*l*n+d*k*t-c*m*t-b*k*p+c*l*p;this.n43=d*f*n-b*h*n-d*e*t+c*h*t+b*e*p-c*f*p;this.n44=b*h*k-d*f*k+d*e*l-c*h*l-b*e*m+c*f*m;this.multiplyScalar(1/a.determinant());
-return this},setRotationFromEuler:function(a,c){var b=a.x,d=a.y,g=a.z,e=Math.cos(b),b=Math.sin(b),f=Math.cos(d),d=Math.sin(d),h=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var i=f*h,k=f*g,l=d*h,m=d*g;this.n11=i+m*b;this.n12=l*b-k;this.n13=e*d;this.n21=e*g;this.n22=e*h;this.n23=-b;this.n31=k*b-l;this.n32=m+i*b;this.n33=e*f;break;case "ZXY":i=f*h;k=f*g;l=d*h;m=d*g;this.n11=i-m*b;this.n12=-e*g;this.n13=l+k*b;this.n21=k+l*b;this.n22=e*h;this.n23=m-i*b;this.n31=-e*d;this.n32=b;this.n33=e*f;break;case "ZYX":i=
-e*h;k=e*g;l=b*h;m=b*g;this.n11=f*h;this.n12=l*d-k;this.n13=i*d+m;this.n21=f*g;this.n22=m*d+i;this.n23=k*d-l;this.n31=-d;this.n32=b*f;this.n33=e*f;break;case "YZX":i=e*f;k=e*d;l=b*f;m=b*d;this.n11=f*h;this.n12=m-i*g;this.n13=l*g+k;this.n21=g;this.n22=e*h;this.n23=-b*h;this.n31=-d*h;this.n32=k*g+l;this.n33=i-m*g;break;case "XZY":i=e*f;k=e*d;l=b*f;m=b*d;this.n11=f*h;this.n12=-g;this.n13=d*h;this.n21=i*g+m;this.n22=e*h;this.n23=k*g-l;this.n31=l*g-k;this.n32=b*h;this.n33=m*g+i;break;default:i=e*h,k=e*
-g,l=b*h,m=b*g,this.n11=f*h,this.n12=-f*g,this.n13=d,this.n21=k+l*d,this.n22=i-m*d,this.n23=-b*f,this.n31=m-i*d,this.n32=l+k*d,this.n33=e*f}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,d=a.z,g=a.w,e=c+c,f=b+b,h=d+d,a=c*e,i=c*f;c*=h;var k=b*f;b*=h;d*=h;e*=g;f*=g;g*=h;this.n11=1-(k+d);this.n12=i-g;this.n13=c+f;this.n21=i+g;this.n22=1-(a+d);this.n23=b-e;this.n31=c-f;this.n32=b+e;this.n33=1-(a+k);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
+THREE.Matrix4=function(a,c,b,d,g,e,f,h,i,k,l,n,o,m,s,p){this.set(a!==void 0?a:1,c||0,b||0,d||0,g||0,e!==void 0?e:1,f||0,h||0,i||0,k||0,l!==void 0?l:1,n||0,o||0,m||0,s||0,p!==void 0?p:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,d,g,e,f,h,i,k,l,n,o,m,s,p){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=g;this.n22=e;this.n23=f;this.n24=h;this.n31=i;this.n32=k;this.n33=l;this.n34=n;this.n41=o;this.n42=m;this.n43=s;this.n44=p;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,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,c).normalize();if(e.length()===0)e.z=1;d.cross(b,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(b,e).normalize());g.cross(e,d).normalize();this.n11=d.x;this.n12=g.x;this.n13=e.x;this.n21=d.y;this.n22=g.y;this.n23=e.y;this.n31=d.z;this.n32=g.z;this.n33=e.z;return this},multiply:function(a,c){var b=a.n11,d=a.n12,g=a.n13,e=a.n14,f=a.n21,h=a.n22,i=a.n23,k=a.n24,l=a.n31,n=a.n32,o=a.n33,m=a.n34,s=a.n41,p=a.n42,r=a.n43,
+t=a.n44,w=c.n11,q=c.n12,C=c.n13,v=c.n14,x=c.n21,I=c.n22,K=c.n23,G=c.n24,y=c.n31,D=c.n32,Q=c.n33,H=c.n34,aa=c.n41,M=c.n42,R=c.n43,da=c.n44;this.n11=b*w+d*x+g*y+e*aa;this.n12=b*q+d*I+g*D+e*M;this.n13=b*C+d*K+g*Q+e*R;this.n14=b*v+d*G+g*H+e*da;this.n21=f*w+h*x+i*y+k*aa;this.n22=f*q+h*I+i*D+k*M;this.n23=f*C+h*K+i*Q+k*R;this.n24=f*v+h*G+i*H+k*da;this.n31=l*w+n*x+o*y+m*aa;this.n32=l*q+n*I+o*D+m*M;this.n33=l*C+n*K+o*Q+m*R;this.n34=l*v+n*G+o*H+m*da;this.n41=s*w+p*x+r*y+t*aa;this.n42=s*q+p*I+r*D+t*M;this.n43=
+s*C+p*K+r*Q+t*R;this.n44=s*v+p*G+r*H+t*da;return this},multiplySelf:function(a){return this.multiply(this,a)},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},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},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,g=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)*g;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*g;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,g=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*g;a.y=
+this.n21*c+this.n22*b+this.n23*d+this.n24*g;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*g;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*g;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},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,g=this.n21,e=this.n22,f=this.n23,h=this.n24,i=this.n31,k=this.n32,l=this.n33,n=this.n34,o=this.n41,m=this.n42,s=this.n43,p=this.n44;return d*f*k*o-b*h*k*o-d*e*l*o+c*h*l*o+b*e*n*o-c*f*n*o-d*f*i*m+b*h*i*m+d*g*l*m-a*h*l*m-b*g*n*m+a*f*n*m+d*e*i*s-c*h*i*s-d*g*k*s+a*h*k*s+c*g*n*s-a*e*n*s-b*e*i*p+c*f*i*p+b*g*k*p-a*f*k*p-
+c*g*l*p+a*e*l*p},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),g=1-b,e=a.x,f=a.y,h=a.z,i=g*e,k=g*f;this.set(i*e+b,i*f-d*h,i*h+d*f,0,i*f+d*h,k*f+b,k*h-d*e,0,i*h-d*f,k*h+d*e,g*h*h+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},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,d=a.n13,g=a.n14,e=a.n21,f=a.n22,h=a.n23,i=a.n24,k=a.n31,l=a.n32,n=a.n33,o=a.n34,m=a.n41,s=a.n42,p=a.n43,r=a.n44;this.n11=h*o*s-i*n*s+i*l*p-f*o*p-h*l*r+f*n*r;this.n12=g*n*s-d*o*s-g*l*p+b*o*p+d*l*r-b*n*r;this.n13=d*i*s-g*h*s+g*f*p-b*i*p-d*f*r+b*h*r;this.n14=g*h*l-d*i*l-g*f*n+b*i*n+d*f*o-b*h*o;this.n21=i*n*m-h*o*m-i*k*p+e*o*p+h*k*r-e*n*r;this.n22=d*o*m-g*n*m+
+g*k*p-c*o*p-d*k*r+c*n*r;this.n23=g*h*m-d*i*m-g*e*p+c*i*p+d*e*r-c*h*r;this.n24=d*i*k-g*h*k+g*e*n-c*i*n-d*e*o+c*h*o;this.n31=f*o*m-i*l*m+i*k*s-e*o*s-f*k*r+e*l*r;this.n32=g*l*m-b*o*m-g*k*s+c*o*s+b*k*r-c*l*r;this.n33=d*i*m-g*f*m+g*e*s-c*i*s-b*e*r+c*f*r;this.n34=g*f*k-b*i*k-g*e*l+c*i*l+b*e*o-c*f*o;this.n41=h*l*m-f*n*m-h*k*s+e*n*s+f*k*p-e*l*p;this.n42=b*n*m-d*l*m+d*k*s-c*n*s-b*k*p+c*l*p;this.n43=d*f*m-b*h*m-d*e*s+c*h*s+b*e*p-c*f*p;this.n44=b*h*k-d*f*k+d*e*l-c*h*l-b*e*n+c*f*n;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,c){var b=a.x,d=a.y,g=a.z,e=Math.cos(b),b=Math.sin(b),f=Math.cos(d),d=Math.sin(d),h=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var i=f*h,k=f*g,l=d*h,n=d*g;this.n11=i+n*b;this.n12=l*b-k;this.n13=e*d;this.n21=e*g;this.n22=e*h;this.n23=-b;this.n31=k*b-l;this.n32=n+i*b;this.n33=e*f;break;case "ZXY":i=f*h;k=f*g;l=d*h;n=d*g;this.n11=i-n*b;this.n12=-e*g;this.n13=l+k*b;this.n21=k+l*b;this.n22=e*h;this.n23=n-i*b;this.n31=-e*d;this.n32=b;this.n33=e*f;break;case "ZYX":i=
+e*h;k=e*g;l=b*h;n=b*g;this.n11=f*h;this.n12=l*d-k;this.n13=i*d+n;this.n21=f*g;this.n22=n*d+i;this.n23=k*d-l;this.n31=-d;this.n32=b*f;this.n33=e*f;break;case "YZX":i=e*f;k=e*d;l=b*f;n=b*d;this.n11=f*h;this.n12=n-i*g;this.n13=l*g+k;this.n21=g;this.n22=e*h;this.n23=-b*h;this.n31=-d*h;this.n32=k*g+l;this.n33=i-n*g;break;case "XZY":i=e*f;k=e*d;l=b*f;n=b*d;this.n11=f*h;this.n12=-g;this.n13=d*h;this.n21=i*g+n;this.n22=e*h;this.n23=k*g-l;this.n31=l*g-k;this.n32=b*h;this.n33=n*g+i;break;default:i=e*h,k=e*
+g,l=b*h,n=b*g,this.n11=f*h,this.n12=-f*g,this.n13=d,this.n21=k+l*d,this.n22=i-n*d,this.n23=-b*f,this.n31=n-i*d,this.n32=l+k*d,this.n33=e*f}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,d=a.z,g=a.w,e=c+c,f=b+b,h=d+d,a=c*e,i=c*f;c*=h;var k=b*f;b*=h;d*=h;e*=g;f*=g;g*=h;this.n11=1-(k+d);this.n12=i-g;this.n13=c+f;this.n21=i+g;this.n22=1-(a+d);this.n23=b-e;this.n31=c-f;this.n32=b+e;this.n33=1-(a+k);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},compose:function(a,c,b){var d=THREE.Matrix4.__m1,g=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(c);g.setScale(b.x,b.y,b.z);this.multiply(d,g);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,c,b){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);g.set(this.n12,this.n22,this.n32);e.set(this.n13,
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;b=b instanceof THREE.Vector3?b:new THREE.Vector3;b.x=d.length();b.y=g.length();b.z=e.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=b.x;d.n21/=b.x;d.n31/=b.x;d.n12/=b.y;d.n22/=b.y;d.n32/=b.y;d.n13/=b.z;d.n23/=b.z;d.n33/=b.z;c.setFromRotationMatrix(d);return[a,c,b]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 return this},extractRotation:function(a){var c=THREE.Matrix4.__v1,b=1/c.set(a.n11,a.n21,a.n31).length(),d=1/c.set(a.n12,a.n22,a.n32).length(),c=1/c.set(a.n13,a.n23,a.n33).length();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*c;this.n23=a.n23*c;this.n33=a.n33*c;return this}};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*k;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*d;b[1]=a*g;b[2]=a*e;b[3]=a*f;b[4]=a*h;b[5]=a*i;b[6]=a*k;b[7]=a*l;b[8]=a*m;return c};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*k;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*d;b[1]=a*g;b[2]=a*e;b[3]=a*f;b[4]=a*h;b[5]=a*i;b[6]=a*k;b[7]=a*l;b[8]=a*n;return c};
 THREE.Matrix4.makeFrustum=function(a,c,b,d,g,e){var f;f=new THREE.Matrix4;f.n11=2*g/(c-a);f.n12=0;f.n13=(c+a)/(c-a);f.n14=0;f.n21=0;f.n22=2*g/(d-b);f.n23=(d+b)/(d-b);f.n24=0;f.n31=0;f.n32=0;f.n33=-(e+g)/(e-g);f.n34=-2*e*g/(e-g);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,c,b,d){var g,a=b*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*c,a*c,g,a,b,d)};
 THREE.Matrix4.makeOrtho=function(a,c,b,d,g,e){var f,h,i,k;f=new THREE.Matrix4;h=c-a;i=b-d;k=e-g;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((c+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((b+d)/i);f.n31=0;f.n32=0;f.n33=-2/k;f.n34=-((e+g)/k);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
@@ -56,23 +56,23 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){thi
 if(c&&(g=g.getChildByName(a,c),g!==void 0))return g}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var c=0,b=this.children.length;c<b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function a(){var a=f[e]=f[e]||new THREE.RenderableObject;e++;return a}function c(){var a=k[i]=k[i]||new THREE.RenderableVertex;i++;return a}function b(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;return e>=0&&g>=0&&f>=0&&h>=0?!0:e<0&&g<0||f<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g))),f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var g,e,f=[],h,i,k=[],
-l,m,q=[],n,t=[],p,o,v=[],w,r,s=[],u={objects:[],sprites:[],lights:[],elements:[]},x=new THREE.Vector3,H=new THREE.Vector4,G=new THREE.Matrix4,F=new THREE.Matrix4,y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,O=new THREE.Vector4;this.computeFrustum=function(a){y[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);y[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);y[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);y[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);y[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);y[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=y[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);G.multiply(b.projectionMatrix,b.matrixWorldInverse);G.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-G.multiply(b.matrixWorld,b.projectionMatrixInverse);G.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,d){e=0;u.objects.length=0;u.sprites.length=0;u.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
-e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=y[h].x*d.n14+y[h].y*d.n24+y[h].z*d.n34+y[h].w,c<=e){c=!1;break a}c=!0}c?(G.multiplyVector3(x.copy(b.position)),g=a(),g.object=b,g.z=x.z,u.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(G.multiplyVector3(x.copy(b.position)),g=a(),g.object=b,g.z=x.z,u.sprites.push(g)):b instanceof THREE.Light&&u.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
-u.objects.sort(b);return u};this.projectScene=function(a,e,g){var f=e.near,x=e.far,y,R,z,B,I,j,N,ga,X,Q,M,ea,U,ca,Z,fa;r=o=n=m=0;u.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);G.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(G);u=this.projectGraph(a,!1);a=0;for(y=u.objects.length;a<y;a++)if(X=u.objects[a].object,Q=X.matrixWorld,
-ea=X.material,i=0,X instanceof THREE.Mesh){M=X.geometry;U=X.geometry.materials;B=M.vertices;ca=M.faces;Z=M.faceVertexUvs;M=X.matrixRotationWorld.extractRotation(Q);R=0;for(z=B.length;R<z;R++)h=c(),h.positionWorld.copy(B[R].position),Q.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),G.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<x;B=0;for(R=ca.length;B<R;B++){z=
-ca[B];if(z instanceof THREE.Face3)if(I=k[z.a],j=k[z.b],N=k[z.c],I.visible&&j.visible&&N.visible&&(X.doubleSided||X.flipSided!=(N.positionScreen.x-I.positionScreen.x)*(j.positionScreen.y-I.positionScreen.y)-(N.positionScreen.y-I.positionScreen.y)*(j.positionScreen.x-I.positionScreen.x)<0))ga=q[m]=q[m]||new THREE.RenderableFace3,m++,l=ga,l.v1.copy(I),l.v2.copy(j),l.v3.copy(N);else continue;else if(z instanceof THREE.Face4)if(I=k[z.a],j=k[z.b],N=k[z.c],ga=k[z.d],I.visible&&j.visible&&N.visible&&ga.visible&&
-(X.doubleSided||X.flipSided!=((ga.positionScreen.x-I.positionScreen.x)*(j.positionScreen.y-I.positionScreen.y)-(ga.positionScreen.y-I.positionScreen.y)*(j.positionScreen.x-I.positionScreen.x)<0||(j.positionScreen.x-N.positionScreen.x)*(ga.positionScreen.y-N.positionScreen.y)-(j.positionScreen.y-N.positionScreen.y)*(ga.positionScreen.x-N.positionScreen.x)<0)))fa=t[n]=t[n]||new THREE.RenderableFace4,n++,l=fa,l.v1.copy(I),l.v2.copy(j),l.v3.copy(N),l.v4.copy(ga);else continue;l.normalWorld.copy(z.normal);
-M.multiplyVector3(l.normalWorld);l.centroidWorld.copy(z.centroid);Q.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);G.multiplyVector3(l.centroidScreen);N=z.vertexNormals;I=0;for(j=N.length;I<j;I++)ga=l.vertexNormalsWorld[I],ga.copy(N[I]),M.multiplyVector3(ga);I=0;for(j=Z.length;I<j;I++)if(fa=Z[I][B]){N=0;for(ga=fa.length;N<ga;N++)l.uvs[I][N]=fa[N]}l.material=ea;l.faceMaterial=z.materialIndex!==null?U[z.materialIndex]:null;l.z=l.centroidScreen.z;u.elements.push(l)}}else if(X instanceof
-THREE.Line){F.multiply(G,Q);B=X.geometry.vertices;I=c();I.positionScreen.copy(B[0].position);F.multiplyVector4(I.positionScreen);R=1;for(z=B.length;R<z;R++)if(I=c(),I.positionScreen.copy(B[R].position),F.multiplyVector4(I.positionScreen),j=k[i-2],C.copy(I.positionScreen),O.copy(j.positionScreen),d(C,O))C.multiplyScalar(1/C.w),O.multiplyScalar(1/O.w),X=v[o]=v[o]||new THREE.RenderableLine,o++,p=X,p.v1.positionScreen.copy(C),p.v2.positionScreen.copy(O),p.z=Math.max(C.z,O.z),p.material=ea,u.elements.push(p)}a=
-0;for(y=u.sprites.length;a<y;a++)if(X=u.sprites[a].object,Q=X.matrixWorld,X instanceof THREE.Particle&&(H.set(Q.n14,Q.n24,Q.n34,1),G.multiplyVector4(H),H.z/=H.w,H.z>0&&H.z<1))f=s[r]=s[r]||new THREE.RenderableParticle,r++,w=f,w.x=H.x/H.w,w.y=H.y/H.w,w.z=H.z,w.rotation=X.rotation.z,w.scale.x=X.scale.x*Math.abs(w.x-(H.x+e.projectionMatrix.n11)/(H.w+e.projectionMatrix.n14)),w.scale.y=X.scale.y*Math.abs(w.y-(H.y+e.projectionMatrix.n22)/(H.w+e.projectionMatrix.n24)),w.material=X.material,u.elements.push(w);
-g&&u.elements.sort(b);return u}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)};
+l,n,o=[],m,s=[],p,r,t=[],w,q,C=[],v={objects:[],sprites:[],lights:[],elements:[]},x=new THREE.Vector3,I=new THREE.Vector4,K=new THREE.Matrix4,G=new THREE.Matrix4,y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,Q=new THREE.Vector4;this.computeFrustum=function(a){y[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);y[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);y[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+a.n23,a.n44+a.n24);y[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);y[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);y[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=y[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);K.multiply(b.projectionMatrix,b.matrixWorldInverse);K.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+K.multiply(b.matrixWorld,b.projectionMatrixInverse);K.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,d){e=0;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
+e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=y[h].x*d.n14+y[h].y*d.n24+y[h].z*d.n34+y[h].w,c<=e){c=!1;break a}c=!0}c?(K.multiplyVector3(x.copy(b.position)),g=a(),g.object=b,g.z=x.z,v.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(K.multiplyVector3(x.copy(b.position)),g=a(),g.object=b,g.z=x.z,v.sprites.push(g)):b instanceof THREE.Light&&v.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
+v.objects.sort(b);return v};this.projectScene=function(a,e,g){var f=e.near,x=e.far,y,T,z,B,L,j,P,fa,Z,S,O,ea,V,ca,$,Y;q=r=m=n=0;v.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);K.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(K);v=this.projectGraph(a,!1);a=0;for(y=v.objects.length;a<y;a++)if(Z=v.objects[a].object,S=Z.matrixWorld,
+ea=Z.material,i=0,Z instanceof THREE.Mesh){O=Z.geometry;V=Z.geometry.materials;B=O.vertices;ca=O.faces;$=O.faceVertexUvs;O=Z.matrixRotationWorld.extractRotation(S);T=0;for(z=B.length;T<z;T++)h=c(),h.positionWorld.copy(B[T].position),S.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),K.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<x;B=0;for(T=ca.length;B<T;B++){z=
+ca[B];if(z instanceof THREE.Face3)if(L=k[z.a],j=k[z.b],P=k[z.c],L.visible&&j.visible&&P.visible&&(Z.doubleSided||Z.flipSided!=(P.positionScreen.x-L.positionScreen.x)*(j.positionScreen.y-L.positionScreen.y)-(P.positionScreen.y-L.positionScreen.y)*(j.positionScreen.x-L.positionScreen.x)<0))fa=o[n]=o[n]||new THREE.RenderableFace3,n++,l=fa,l.v1.copy(L),l.v2.copy(j),l.v3.copy(P);else continue;else if(z instanceof THREE.Face4)if(L=k[z.a],j=k[z.b],P=k[z.c],fa=k[z.d],L.visible&&j.visible&&P.visible&&fa.visible&&
+(Z.doubleSided||Z.flipSided!=((fa.positionScreen.x-L.positionScreen.x)*(j.positionScreen.y-L.positionScreen.y)-(fa.positionScreen.y-L.positionScreen.y)*(j.positionScreen.x-L.positionScreen.x)<0||(j.positionScreen.x-P.positionScreen.x)*(fa.positionScreen.y-P.positionScreen.y)-(j.positionScreen.y-P.positionScreen.y)*(fa.positionScreen.x-P.positionScreen.x)<0)))Y=s[m]=s[m]||new THREE.RenderableFace4,m++,l=Y,l.v1.copy(L),l.v2.copy(j),l.v3.copy(P),l.v4.copy(fa);else continue;l.normalWorld.copy(z.normal);
+O.multiplyVector3(l.normalWorld);l.centroidWorld.copy(z.centroid);S.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);K.multiplyVector3(l.centroidScreen);P=z.vertexNormals;L=0;for(j=P.length;L<j;L++)fa=l.vertexNormalsWorld[L],fa.copy(P[L]),O.multiplyVector3(fa);L=0;for(j=$.length;L<j;L++)if(Y=$[L][B]){P=0;for(fa=Y.length;P<fa;P++)l.uvs[L][P]=Y[P]}l.material=ea;l.faceMaterial=z.materialIndex!==null?V[z.materialIndex]:null;l.z=l.centroidScreen.z;v.elements.push(l)}}else if(Z instanceof
+THREE.Line){G.multiply(K,S);B=Z.geometry.vertices;L=c();L.positionScreen.copy(B[0].position);G.multiplyVector4(L.positionScreen);T=1;for(z=B.length;T<z;T++)if(L=c(),L.positionScreen.copy(B[T].position),G.multiplyVector4(L.positionScreen),j=k[i-2],D.copy(L.positionScreen),Q.copy(j.positionScreen),d(D,Q))D.multiplyScalar(1/D.w),Q.multiplyScalar(1/Q.w),Z=t[r]=t[r]||new THREE.RenderableLine,r++,p=Z,p.v1.positionScreen.copy(D),p.v2.positionScreen.copy(Q),p.z=Math.max(D.z,Q.z),p.material=ea,v.elements.push(p)}a=
+0;for(y=v.sprites.length;a<y;a++)if(Z=v.sprites[a].object,S=Z.matrixWorld,Z instanceof THREE.Particle&&(I.set(S.n14,S.n24,S.n34,1),K.multiplyVector4(I),I.z/=I.w,I.z>0&&I.z<1))f=C[q]=C[q]||new THREE.RenderableParticle,q++,w=f,w.x=I.x/I.w,w.y=I.y/I.w,w.z=I.z,w.rotation=Z.rotation.z,w.scale.x=Z.scale.x*Math.abs(w.x-(I.x+e.projectionMatrix.n11)/(I.w+e.projectionMatrix.n14)),w.scale.y=Z.scale.y*Math.abs(w.y-(I.y+e.projectionMatrix.n22)/(I.w+e.projectionMatrix.n24)),w.material=Z.material,v.elements.push(w);
+g&&v.elements.sort(b);return v}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var c=Math.PI/360,b=a.x*c,d=a.y*c,g=a.z*c,a=Math.cos(d),d=Math.sin(d),c=Math.cos(-g),g=Math.sin(-g),e=Math.cos(b),b=Math.sin(b),f=a*c,h=d*g;this.w=f*e-h*b;this.x=f*b+h*e;this.y=d*c*e+a*g*b;this.z=a*g*e-d*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,d=Math.sin(b);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();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);a===0?this.w=this.z=this.y=this.x=0:(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,g=this.w,e=a.x,f=a.y,h=a.z,a=a.w;this.x=c*a+g*e+b*h-d*f;this.y=b*a+g*f+d*e-c*h;this.z=d*a+g*h+c*f-b*e;this.w=g*a-c*e-b*f-d*h;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,g=a.z,e=this.x,f=this.y,h=this.z,i=this.w,k=i*b+f*g-h*d,l=i*d+h*b-e*g,m=i*g+e*d-f*b,b=-e*
-b-f*d-h*g;c.x=k*i+b*-e+l*-h-m*-f;c.y=l*i+b*-f+m*-e-k*-h;c.z=m*i+b*-h+k*-f-l*-e;return c}};
+this.x,b=this.y,d=this.z,g=this.w,e=a.x,f=a.y,h=a.z,a=a.w;this.x=c*a+g*e+b*h-d*f;this.y=b*a+g*f+d*e-c*h;this.z=d*a+g*h+c*f-b*e;this.w=g*a-c*e-b*f-d*h;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,g=a.z,e=this.x,f=this.y,h=this.z,i=this.w,k=i*b+f*g-h*d,l=i*d+h*b-e*g,n=i*g+e*d-f*b,b=-e*
+b-f*d-h*g;c.x=k*i+b*-e+l*-h-n*-f;c.y=l*i+b*-f+n*-e-k*-h;c.z=n*i+b*-h+k*-f-l*-e;return c}};
 THREE.Quaternion.slerp=function(a,c,b,d){var g=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;g<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,g=-g):b.copy(c);if(Math.abs(g)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var e=Math.acos(g),g=Math.sqrt(1-g*g);if(Math.abs(g)<0.001)return 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),b;c=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;b.w=a.w*c+b.w*d;b.x=a.x*c+b.x*d;b.y=a.y*c+b.y*d;b.z=a.z*c+b.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,c,b,d,g,e){this.a=a;this.b=c;this.c=b;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,c,b,d,g,e,f){this.a=a;this.b=c;this.c=b;this.d=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
@@ -83,14 +83,14 @@ c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid
 b,d,g,e,f,h=new THREE.Vector3,i=new THREE.Vector3;d=0;for(g=this.faces.length;d<g;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);c=0;for(b=e.vertexNormals.length;c<b;c++)h.addSelf(e.vertexNormals[c]);h.divideScalar(3)}else c=this.vertices[e.a],b=this.vertices[e.b],f=this.vertices[e.c],h.sub(f.position,b.position),i.sub(c.position,b.position),h.crossSelf(i);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices===void 0){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++)if(b=this.faces[a],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],b instanceof
 THREE.Face3?(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal)):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],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])):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(a,b,c,d,e,g,j){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;l=f[e];m=f[g];q=f[j];n=i.x-h.x;t=k.x-h.x;p=i.y-h.y;o=k.y-h.y;v=i.z-h.z;w=k.z-h.z;r=m.u-l.u;s=q.u-l.u;u=m.v-l.v;x=q.v-l.v;H=1/(r*x-s*u);C.set((x*n-u*t)*H,(x*p-u*o)*H,(x*v-u*w)*H);O.set((r*t-s*n)*H,(r*o-s*p)*H,(r*w-s*v)*H);F[b].addSelf(C);F[c].addSelf(C);F[d].addSelf(C);y[b].addSelf(O);
-y[c].addSelf(O);y[d].addSelf(O)}var c,b,d,g,e,f,h,i,k,l,m,q,n,t,p,o,v,w,r,s,u,x,H,G,F=[],y=[],C=new THREE.Vector3,O=new THREE.Vector3,J=new THREE.Vector3,$=new THREE.Vector3,L=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)F[c]=new THREE.Vector3,y[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)e=this.faces[c],f=this.faceVertexUvs[0][c],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):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));var P=["a","b",
-"c","d"];c=0;for(b=this.faces.length;c<b;c++){e=this.faces[c];for(d=0;d<e.vertexNormals.length;d++)L.copy(e.vertexNormals[d]),g=e[P[d]],G=F[g],J.copy(G),J.subSelf(L.multiplyScalar(L.dot(G))).normalize(),$.cross(e.vertexNormals[d],G),g=$.dot(y[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(J.x,J.y,J.z,g)}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,
+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(a,b,c,d,e,g,j){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;l=f[e];n=f[g];o=f[j];m=i.x-h.x;s=k.x-h.x;p=i.y-h.y;r=k.y-h.y;t=i.z-h.z;w=k.z-h.z;q=n.u-l.u;C=o.u-l.u;v=n.v-l.v;x=o.v-l.v;I=1/(q*x-C*v);D.set((x*m-v*s)*I,(x*p-v*r)*I,(x*t-v*w)*I);Q.set((q*s-C*m)*I,(q*r-C*p)*I,(q*w-C*t)*I);G[b].addSelf(D);G[c].addSelf(D);G[d].addSelf(D);y[b].addSelf(Q);
+y[c].addSelf(Q);y[d].addSelf(Q)}var c,b,d,g,e,f,h,i,k,l,n,o,m,s,p,r,t,w,q,C,v,x,I,K,G=[],y=[],D=new THREE.Vector3,Q=new THREE.Vector3,H=new THREE.Vector3,aa=new THREE.Vector3,M=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)G[c]=new THREE.Vector3,y[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)e=this.faces[c],f=this.faceVertexUvs[0][c],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):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));var R=["a",
+"b","c","d"];c=0;for(b=this.faces.length;c<b;c++){e=this.faces[c];for(d=0;d<e.vertexNormals.length;d++)M.copy(e.vertexNormals[d]),g=e[R[d]],K=G[g],H.copy(K),H.subSelf(M.multiplyScalar(M.dot(K))).normalize(),aa.cross(e.vertexNormals[d],K),g=aa.dot(y[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(H.x,H.y,H.z,g)}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=0,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],d,g=Math.pow(10,4),e,f;e=0;for(f=this.vertices.length;e<f;e++)d=this.vertices[e].position,d=[Math.round(d.x*g),Math.round(d.y*g),Math.round(d.z*g)].join("_"),a[d]===void 0?(a[d]=e,c.push(this.vertices[e]),
 b[e]=c.length-1):b[e]=b[a[d]];e=0;for(f=this.faces.length;e<f;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function c(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var b=[],d={x:0,y:0,z:0},g,e,f,h,i,k,l,m,q;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){g=(this.points.length-1)*a;e=Math.floor(g);f=g-e;b[0]=e===0?e:e-1;b[1]=e;b[2]=e>this.points.length-2?e:e+1;b[3]=e>this.points.length-3?e:e+2;k=this.points[b[0]];l=this.points[b[1]];
-m=this.points[b[2]];q=this.points[b[3]];h=f*f;i=f*h;d.x=c(k.x,l.x,m.x,q.x,f,h,i);d.y=c(k.y,l.y,m.y,q.y,f,h,i);d.z=c(k.z,l.z,m.z,q.z,f,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,g=new THREE.Vector3,f=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),f.copy(d),i+=f.distanceTo(g),
+THREE.Spline=function(a){function c(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var b=[],d={x:0,y:0,z:0},g,e,f,h,i,k,l,n,o;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){g=(this.points.length-1)*a;e=Math.floor(g);f=g-e;b[0]=e===0?e:e-1;b[1]=e;b[2]=e>this.points.length-2?e:e+1;b[3]=e>this.points.length-3?e:e+2;k=this.points[b[0]];l=this.points[b[1]];
+n=this.points[b[2]];o=this.points[b[3]];h=f*f;i=f*h;d.x=c(k.x,l.x,n.x,o.x,f,h,i);d.y=c(k.y,l.y,n.y,o.y,f,h,i);d.z=c(k.z,l.z,n.z,o.z,f,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,g=new THREE.Vector3,f=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),f.copy(d),i+=f.distanceTo(g),
 g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,g,f,h=[],i=new THREE.Vector3,k=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];f=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<f-1;c++)d=e+c*(1/f)*(g-e),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
 h}};THREE.Edge=function(a,c,b,d){this.vertices=[a,c];this.vertexIndices=[b,d];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};
 THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,c,b,d,g,e){THREE.Camera.call(this);this.left=a;this.right=c;this.top=b;this.bottom=d;this.near=g!==void 0?g:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
@@ -148,46 +148,46 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.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);var c=this.__objectsRemoved.indexOf(a);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<a.children.length;c++)this.addObject(a.children[c])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else a instanceof THREE.Camera||(c=this.objects.indexOf(a),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(a),c=this.__objectsAdded.indexOf(a),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<a.children.length;c++)this.removeObject(a.children[c])};
 THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,g,e;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;d=c;g=b/2;e=d/2};this.render=function(b,d){var i,k,l,m,q,n,t,p;a=c.projectScene(b,d);i=0;for(k=a.length;i<k;i++)if(q=a[i],q instanceof THREE.RenderableParticle){t=q.x*g+g;p=q.y*e+e;l=0;for(m=q.material.length;l<m;l++)if(n=q.material[l],n instanceof THREE.ParticleDOMMaterial)n=n.domElement,n.style.left=t+"px",n.style.top=p+"px"}}};
-THREE.CanvasRenderer=function(a){function c(a){if(w!=a)p.globalAlpha=w=a}function b(a){if(r!=a){switch(a){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}r=a}}function d(a){if(s!=a)p.strokeStyle=s=a}function g(a){if(u!=a)p.fillStyle=u=a}var e=this,f,h,i,k=new THREE.Projector,a=a||{},l=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-m,q,n,t,p=l.getContext("2d"),o=new THREE.Color(0),v=0,w=1,r=0,s=null,u=null,x=null,H=null,G=null,F,y,C,O,J=new THREE.RenderableVertex,$=new THREE.RenderableVertex,L,P,da,ja,R,z,B,I,j,N,ga,X,Q=new THREE.Color,M=new THREE.Color,ea=new THREE.Color,U=new THREE.Color,ca=new THREE.Color,Z=[],fa,la,qa,ma,sa,ua,pa,ra,wa,S,D=new THREE.Rectangle,Y=new THREE.Rectangle,ba=new THREE.Rectangle,ia=!1,ka=new THREE.Color,V=new THREE.Color,T=new THREE.Color,aa=new THREE.Vector3,ha,xa,K,na,ta,W,a=16;ha=document.createElement("canvas");
-ha.width=ha.height=2;xa=ha.getContext("2d");xa.fillStyle="rgba(0,0,0,1)";xa.fillRect(0,0,2,2);K=xa.getImageData(0,0,2,2);na=K.data;ta=document.createElement("canvas");ta.width=ta.height=a;W=ta.getContext("2d");W.translate(-a/2,-a/2);W.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){m=a;q=b;n=Math.floor(m/2);t=Math.floor(q/2);l.width=m;l.height=q;D.set(-n,-t,n,t);Y.set(-n,-t,n,t);w=1;r=0;G=H=x=
-u=s=null};this.setClearColor=function(a,b){o.copy(a);v=b;Y.set(-n,-t,n,t)};this.setClearColorHex=function(a,b){o.setHex(a);v=b;Y.set(-n,-t,n,t)};this.clear=function(){p.setTransform(1,0,0,-1,n,t);Y.isEmpty()||(Y.minSelf(D),Y.inflate(2),v<1&&p.clearRect(Math.floor(Y.getX()),Math.floor(Y.getY()),Math.floor(Y.getWidth()),Math.floor(Y.getHeight())),v>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+v+")"),p.fillRect(Math.floor(Y.getX()),
-Math.floor(Y.getY()),Math.floor(Y.getWidth()),Math.floor(Y.getHeight()))),Y.empty())};this.render=function(a,l){function m(a){var b,c,d,e;ka.setRGB(0,0,0);V.setRGB(0,0,0);T.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(ka.r+=e.r,ka.g+=e.g,ka.b+=e.b):d instanceof THREE.DirectionalLight?(V.r+=e.r,V.g+=e.g,V.b+=e.b):d instanceof THREE.PointLight&&(T.r+=e.r,T.g+=e.g,T.b+=e.b)}function q(a,b,c,d){var e,g,f,j,h,i;e=0;for(g=a.length;e<g;e++)f=a[e],j=f.color,f instanceof
-THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(aa.sub(h,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function o(a,e,f){c(f.opacity);b(f.blending);var j,h,i,k,l,W;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)k=f.map.image,l=k.width>>1,W=k.height>>1,f=e.scale.x*
-n,i=e.scale.y*t,j=f*l,h=i*W,ba.set(a.x-j,a.y-h,a.x+j,a.y+h),D.intersects(ba)&&(p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(f,-i),p.translate(-l,-W),p.drawImage(k,0,0),p.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*n,h=e.scale.y*t,ba.set(a.x-j,a.y-h,a.x+j,a.y+h),D.intersects(ba)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(j,h),f.program(p),p.restore()))}function r(a,e,g,f){c(f.opacity);
-b(f.blending);p.beginPath();p.moveTo(a.positionScreen.x,a.positionScreen.y);p.lineTo(e.positionScreen.x,e.positionScreen.y);p.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(x!=a)p.lineWidth=x=a;a=f.linecap;if(H!=a)p.lineCap=H=a;a=f.linejoin;if(G!=a)p.lineJoin=G=a;d(f.color.getContextStyle());p.stroke();ba.inflate(f.linewidth*2)}}function v(a,d,f,g,j,h,k,n){e.info.render.vertices+=3;e.info.render.faces++;c(n.opacity);b(n.blending);L=a.positionScreen.x;P=a.positionScreen.y;da=
-d.positionScreen.x;ja=d.positionScreen.y;R=f.positionScreen.x;z=f.positionScreen.y;s(L,P,da,ja,R,z);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(ma=k.uvs[0],Ga(L,P,da,ja,R,z,ma[g].u,ma[g].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,n.map));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,aa.copy(k.vertexNormalsWorld[g]),sa=(aa.x*a.n11+aa.y*a.n12+aa.z*a.n13)*0.5+0.5,ua=-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)*0.5+
-0.5,aa.copy(k.vertexNormalsWorld[j]),pa=(aa.x*a.n11+aa.y*a.n12+aa.z*a.n13)*0.5+0.5,ra=-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)*0.5+0.5,aa.copy(k.vertexNormalsWorld[h]),wa=(aa.x*a.n11+aa.y*a.n12+aa.z*a.n13)*0.5+0.5,S=-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)*0.5+0.5,Ga(L,P,da,ja,R,z,sa,ua,pa,ra,wa,S,n.envMap)}else n.wireframe?ya(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):u(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&
-(ma=k.uvs[0],Ga(L,P,da,ja,R,z,ma[g].u,ma[g].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,n.map)),b(THREE.SubtractiveBlending)),ia?!n.wireframe&&n.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==3?(M.r=ea.r=U.r=ka.r,M.g=ea.g=U.g=ka.g,M.b=ea.b=U.b=ka.b,q(i,k.v1.positionWorld,k.vertexNormalsWorld[0],M),q(i,k.v2.positionWorld,k.vertexNormalsWorld[1],ea),q(i,k.v3.positionWorld,k.vertexNormalsWorld[2],U),M.r=Math.max(0,Math.min(n.color.r*M.r,1)),M.g=Math.max(0,Math.min(n.color.g*M.g,1)),M.b=Math.max(0,
-Math.min(n.color.b*M.b,1)),ea.r=Math.max(0,Math.min(n.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(n.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(n.color.b*ea.b,1)),U.r=Math.max(0,Math.min(n.color.r*U.r,1)),U.g=Math.max(0,Math.min(n.color.g*U.g,1)),U.b=Math.max(0,Math.min(n.color.b*U.b,1)),ca.r=(ea.r+U.r)*0.5,ca.g=(ea.g+U.g)*0.5,ca.b=(ea.b+U.b)*0.5,qa=Da(M,ea,U,ca),Ba(L,P,da,ja,R,z,0,0,1,0,0,1,qa)):(Q.r=ka.r,Q.g=ka.g,Q.b=ka.b,q(i,k.centroidWorld,k.normalWorld,Q),Q.r=Math.max(0,Math.min(n.color.r*Q.r,1)),
-Q.g=Math.max(0,Math.min(n.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(n.color.b*Q.b,1)),n.wireframe?ya(Q,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):u(Q)):n.wireframe?ya(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):u(n.color);else if(n instanceof THREE.MeshDepthMaterial)fa=l.near,la=l.far,M.r=M.g=M.b=1-Aa(a.positionScreen.z,fa,la),ea.r=ea.g=ea.b=1-Aa(d.positionScreen.z,fa,la),U.r=U.g=U.b=1-Aa(f.positionScreen.z,fa,la),ca.r=(ea.r+U.r)*0.5,ca.g=(ea.g+U.g)*0.5,ca.b=
-(ea.b+U.b)*0.5,qa=Da(M,ea,U,ca),Ba(L,P,da,ja,R,z,0,0,1,0,0,1,qa);else if(n instanceof THREE.MeshNormalMaterial)Q.r=Ca(k.normalWorld.x),Q.g=Ca(k.normalWorld.y),Q.b=Ca(k.normalWorld.z),n.wireframe?ya(Q,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):u(Q)}function w(a,d,f,g,h,n,k,W,m){e.info.render.vertices+=4;e.info.render.faces++;c(W.opacity);b(W.blending);if(W.map||W.envMap)v(a,d,g,0,1,3,k,W,m),v(h,f,n,1,2,3,k,W,m);else if(L=a.positionScreen.x,P=a.positionScreen.y,da=d.positionScreen.x,
-ja=d.positionScreen.y,R=f.positionScreen.x,z=f.positionScreen.y,B=g.positionScreen.x,I=g.positionScreen.y,j=h.positionScreen.x,N=h.positionScreen.y,ga=n.positionScreen.x,X=n.positionScreen.y,W instanceof THREE.MeshBasicMaterial)Ea(L,P,da,ja,R,z,B,I),W.wireframe?ya(W.color,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):u(W.color);else if(W instanceof THREE.MeshLambertMaterial)ia?!W.wireframe&&W.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==4?(M.r=ea.r=U.r=ca.r=ka.r,M.g=ea.g=
-U.g=ca.g=ka.g,M.b=ea.b=U.b=ca.b=ka.b,q(i,k.v1.positionWorld,k.vertexNormalsWorld[0],M),q(i,k.v2.positionWorld,k.vertexNormalsWorld[1],ea),q(i,k.v4.positionWorld,k.vertexNormalsWorld[3],U),q(i,k.v3.positionWorld,k.vertexNormalsWorld[2],ca),M.r=Math.max(0,Math.min(W.color.r*M.r,1)),M.g=Math.max(0,Math.min(W.color.g*M.g,1)),M.b=Math.max(0,Math.min(W.color.b*M.b,1)),ea.r=Math.max(0,Math.min(W.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(W.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(W.color.b*ea.b,1)),U.r=
-Math.max(0,Math.min(W.color.r*U.r,1)),U.g=Math.max(0,Math.min(W.color.g*U.g,1)),U.b=Math.max(0,Math.min(W.color.b*U.b,1)),ca.r=Math.max(0,Math.min(W.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(W.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(W.color.b*ca.b,1)),qa=Da(M,ea,U,ca),s(L,P,da,ja,B,I),Ba(L,P,da,ja,B,I,0,0,1,0,0,1,qa),s(j,N,R,z,ga,X),Ba(j,N,R,z,ga,X,1,0,1,1,0,1,qa)):(Q.r=ka.r,Q.g=ka.g,Q.b=ka.b,q(i,k.centroidWorld,k.normalWorld,Q),Q.r=Math.max(0,Math.min(W.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(W.color.g*
-Q.g,1)),Q.b=Math.max(0,Math.min(W.color.b*Q.b,1)),Ea(L,P,da,ja,R,z,B,I),W.wireframe?ya(Q,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):u(Q)):(Ea(L,P,da,ja,R,z,B,I),W.wireframe?ya(W.color,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):u(W.color));else if(W instanceof THREE.MeshNormalMaterial)Q.r=Ca(k.normalWorld.x),Q.g=Ca(k.normalWorld.y),Q.b=Ca(k.normalWorld.z),Ea(L,P,da,ja,R,z,B,I),W.wireframe?ya(Q,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):u(Q);else if(W instanceof
-THREE.MeshDepthMaterial)fa=l.near,la=l.far,M.r=M.g=M.b=1-Aa(a.positionScreen.z,fa,la),ea.r=ea.g=ea.b=1-Aa(d.positionScreen.z,fa,la),U.r=U.g=U.b=1-Aa(g.positionScreen.z,fa,la),ca.r=ca.g=ca.b=1-Aa(f.positionScreen.z,fa,la),qa=Da(M,ea,U,ca),s(L,P,da,ja,B,I),Ba(L,P,da,ja,B,I,0,0,1,0,0,1,qa),s(j,N,R,z,ga,X),Ba(j,N,R,z,ga,X,1,0,1,1,0,1,qa)}function s(a,b,c,d,e,f){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.lineTo(a,b);p.closePath()}function Ea(a,b,c,d,e,f,g,j){p.beginPath();p.moveTo(a,b);
-p.lineTo(c,d);p.lineTo(e,f);p.lineTo(g,j);p.lineTo(a,b);p.closePath()}function ya(a,b,c,e){if(x!=b)p.lineWidth=x=b;if(H!=c)p.lineCap=H=c;if(G!=e)p.lineJoin=G=e;d(a.getContextStyle());p.stroke();ba.inflate(b*2)}function u(a){g(a.getContextStyle());p.fill()}function Ga(a,b,c,d,e,f,j,h,i,n,k,W,l){if(l.image.width!=0){if(l.needsUpdate==!0||Z[l.id]==void 0){var m=l.wrapS==THREE.RepeatWrapping,q=l.wrapT==THREE.RepeatWrapping;Z[l.id]=p.createPattern(l.image,m&&q?"repeat":m&&!q?"repeat-x":!m&&q?"repeat-y":
-"no-repeat");l.needsUpdate=!1}g(Z[l.id]);var m=l.offset.x/l.repeat.x,q=l.offset.y/l.repeat.y,S=(l.image.width-1)*l.repeat.x,l=(l.image.height-1)*l.repeat.y,j=(j+m)*S,h=(h+q)*l,i=(i+m)*S,n=(n+q)*l,k=(k+m)*S,W=(W+q)*l;c-=a;d-=b;e-=a;f-=b;i-=j;n-=h;k-=j;W-=h;m=1/(i*W-k*n);l=(W*c-n*e)*m;n=(W*d-n*f)*m;c=(i*e-k*c)*m;d=(i*f-k*d)*m;a=a-l*j-c*h;b=b-n*j-d*h;p.save();p.transform(l,n,c,d,a,b);p.fill();p.restore()}}function Ba(a,b,c,d,e,f,g,j,h,i,n,k,l){var W,m;W=l.width-1;m=l.height-1;g*=W;j*=m;h*=W;i*=m;n*=
-W;k*=m;c-=a;d-=b;e-=a;f-=b;h-=g;i-=j;n-=g;k-=j;m=1/(h*k-n*i);W=(k*c-i*e)*m;i=(k*d-i*f)*m;c=(h*e-n*c)*m;d=(h*f-n*d)*m;a=a-W*g-c*j;b=b-i*g-d*j;p.save();p.transform(W,i,c,d,a,b);p.clip();p.drawImage(l,0,0);p.restore()}function Da(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),n=~~(d.r*255),k=~~(d.g*255),d=~~(d.b*255);na[0]=e<0?0:e>255?255:e;na[1]=f<0?0:f>255?255:f;na[2]=a<0?0:a>255?255:a;na[4]=g<0?0:g>255?255:
-g;na[5]=j<0?0:j>255?255:j;na[6]=b<0?0:b>255?255:b;na[8]=h<0?0:h>255?255:h;na[9]=i<0?0:i>255?255:i;na[10]=c<0?0:c>255?255:c;na[12]=n<0?0:n>255?255:n;na[13]=k<0?0:k>255?255:k;na[14]=d<0?0:d>255?255:d;xa.putImageData(K,0,0);W.drawImage(ha,0,0);return ta}function Aa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ca(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function za(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Fa,Ha,oa,va;this.autoClear?this.clear():
-p.setTransform(1,0,0,-1,n,t);e.info.render.vertices=0;e.info.render.faces=0;f=k.projectScene(a,l,this.sortElements);h=f.elements;i=f.lights;(ia=i.length>0)&&m(i);Fa=0;for(Ha=h.length;Fa<Ha;Fa++)if(oa=h[Fa],va=oa.material,va=va instanceof THREE.MeshFaceMaterial?oa.faceMaterial:va,!(va==null||va.opacity==0)){ba.empty();if(oa instanceof THREE.RenderableParticle)F=oa,F.x*=n,F.y*=t,o(F,oa,va,a);else if(oa instanceof THREE.RenderableLine)F=oa.v1,y=oa.v2,F.positionScreen.x*=n,F.positionScreen.y*=t,y.positionScreen.x*=
-n,y.positionScreen.y*=t,ba.addPoint(F.positionScreen.x,F.positionScreen.y),ba.addPoint(y.positionScreen.x,y.positionScreen.y),D.intersects(ba)&&r(F,y,oa,va,a);else if(oa instanceof THREE.RenderableFace3)F=oa.v1,y=oa.v2,C=oa.v3,F.positionScreen.x*=n,F.positionScreen.y*=t,y.positionScreen.x*=n,y.positionScreen.y*=t,C.positionScreen.x*=n,C.positionScreen.y*=t,va.overdraw&&(za(F.positionScreen,y.positionScreen),za(y.positionScreen,C.positionScreen),za(C.positionScreen,F.positionScreen)),ba.add3Points(F.positionScreen.x,
-F.positionScreen.y,y.positionScreen.x,y.positionScreen.y,C.positionScreen.x,C.positionScreen.y),D.intersects(ba)&&v(F,y,C,0,1,2,oa,va,a);else if(oa instanceof THREE.RenderableFace4)F=oa.v1,y=oa.v2,C=oa.v3,O=oa.v4,F.positionScreen.x*=n,F.positionScreen.y*=t,y.positionScreen.x*=n,y.positionScreen.y*=t,C.positionScreen.x*=n,C.positionScreen.y*=t,O.positionScreen.x*=n,O.positionScreen.y*=t,J.positionScreen.copy(y.positionScreen),$.positionScreen.copy(O.positionScreen),va.overdraw&&(za(F.positionScreen,
-y.positionScreen),za(y.positionScreen,O.positionScreen),za(O.positionScreen,F.positionScreen),za(C.positionScreen,J.positionScreen),za(C.positionScreen,$.positionScreen)),ba.addPoint(F.positionScreen.x,F.positionScreen.y),ba.addPoint(y.positionScreen.x,y.positionScreen.y),ba.addPoint(C.positionScreen.x,C.positionScreen.y),ba.addPoint(O.positionScreen.x,O.positionScreen.y),D.intersects(ba)&&w(F,y,C,O,J,$,oa,va,a);Y.addRectangle(ba)}p.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,j,h,i;e=0;for(f=a.length;e<f;e++)g=a[e],j=g.color,g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),i=c.dot(F.sub(h,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(h)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function c(a){y[a]==null&&(y[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),L==0&&y[a].setAttribute("shape-rendering","crispEdges"));return y[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,m,q,n,t,p,o,v=new THREE.Rectangle,w=new THREE.Rectangle,r=!1,s=new THREE.Color,u=new THREE.Color,x=new THREE.Color,H=new THREE.Color,G,F=new THREE.Vector3,y=[],C=[],O,J,$,L=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
-faces:0}};this.setQuality=function(a){switch(a){case "high":L=1;break;case "low":L=0}};this.setSize=function(a,b){k=a;l=b;m=k/2;q=l/2;i.setAttribute("viewBox",-m+" "+-q+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);v.set(-m,-q,m,q)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var F,y,z,B;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(k,l,this.sortElements);e=g.elements;
-f=g.lights;$=J=0;if(r=f.length>0){u.setRGB(0,0,0);x.setRGB(0,0,0);H.setRGB(0,0,0);F=0;for(y=f.length;F<y;F++)B=f[F],z=B.color,B instanceof THREE.AmbientLight?(u.r+=z.r,u.g+=z.g,u.b+=z.b):B instanceof THREE.DirectionalLight?(x.r+=z.r,x.g+=z.g,x.b+=z.b):B instanceof THREE.PointLight&&(H.r+=z.r,H.g+=z.g,H.b+=z.b)}F=0;for(y=e.length;F<y;F++)if(z=e[F],B=z.material,B=B instanceof THREE.MeshFaceMaterial?z.faceMaterial:B,!(B==null||B.opacity==0))if(w.empty(),z instanceof THREE.RenderableParticle)n=z,n.x*=
-m,n.y*=-q;else if(z instanceof THREE.RenderableLine){if(n=z.v1,t=z.v2,n.positionScreen.x*=m,n.positionScreen.y*=-q,t.positionScreen.x*=m,t.positionScreen.y*=-q,w.addPoint(n.positionScreen.x,n.positionScreen.y),w.addPoint(t.positionScreen.x,t.positionScreen.y),v.intersects(w)){z=n;var I=t,j=$++;C[j]==null&&(C[j]=document.createElementNS("http://www.w3.org/2000/svg","line"),L==0&&C[j].setAttribute("shape-rendering","crispEdges"));O=C[j];O.setAttribute("x1",z.positionScreen.x);O.setAttribute("y1",z.positionScreen.y);
-O.setAttribute("x2",I.positionScreen.x);O.setAttribute("y2",I.positionScreen.y);B instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: "+B.color.getContextStyle()+"; stroke-width: "+B.linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.linecap+"; stroke-linejoin: "+B.linejoin),i.appendChild(O))}}else if(z instanceof THREE.RenderableFace3){if(n=z.v1,t=z.v2,p=z.v3,n.positionScreen.x*=m,n.positionScreen.y*=-q,t.positionScreen.x*=m,t.positionScreen.y*=-q,p.positionScreen.x*=
-m,p.positionScreen.y*=-q,w.addPoint(n.positionScreen.x,n.positionScreen.y),w.addPoint(t.positionScreen.x,t.positionScreen.y),w.addPoint(p.positionScreen.x,p.positionScreen.y),v.intersects(w)){var I=n,j=t,N=p;d.info.render.vertices+=3;d.info.render.faces++;O=c(J++);O.setAttribute("d","M "+I.positionScreen.x+" "+I.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+N.positionScreen.x+","+N.positionScreen.y+"z");B instanceof THREE.MeshBasicMaterial?s.copy(B.color):B instanceof THREE.MeshLambertMaterial?
-r?(s.r=u.r,s.g=u.g,s.b=u.b,a(f,z.centroidWorld,z.normalWorld,s),s.r=Math.max(0,Math.min(B.color.r*s.r,1)),s.g=Math.max(0,Math.min(B.color.g*s.g,1)),s.b=Math.max(0,Math.min(B.color.b*s.b,1))):s.copy(B.color):B instanceof THREE.MeshDepthMaterial?(G=1-B.__2near/(B.__farPlusNear-z.z*B.__farMinusNear),s.setRGB(G,G,G)):B instanceof THREE.MeshNormalMaterial&&s.setRGB(b(z.normalWorld.x),b(z.normalWorld.y),b(z.normalWorld.z));B.wireframe?O.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+
-B.wireframeLinewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframeLinecap+"; stroke-linejoin: "+B.wireframeLinejoin):O.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+B.opacity);i.appendChild(O)}}else if(z instanceof THREE.RenderableFace4&&(n=z.v1,t=z.v2,p=z.v3,o=z.v4,n.positionScreen.x*=m,n.positionScreen.y*=-q,t.positionScreen.x*=m,t.positionScreen.y*=-q,p.positionScreen.x*=m,p.positionScreen.y*=-q,o.positionScreen.x*=m,o.positionScreen.y*=-q,w.addPoint(n.positionScreen.x,
-n.positionScreen.y),w.addPoint(t.positionScreen.x,t.positionScreen.y),w.addPoint(p.positionScreen.x,p.positionScreen.y),w.addPoint(o.positionScreen.x,o.positionScreen.y),v.intersects(w))){var I=n,j=t,N=p,ga=o;d.info.render.vertices+=4;d.info.render.faces++;O=c(J++);O.setAttribute("d","M "+I.positionScreen.x+" "+I.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+N.positionScreen.x+","+N.positionScreen.y+" L "+ga.positionScreen.x+","+ga.positionScreen.y+"z");B instanceof THREE.MeshBasicMaterial?
-s.copy(B.color):B instanceof THREE.MeshLambertMaterial?r?(s.r=u.r,s.g=u.g,s.b=u.b,a(f,z.centroidWorld,z.normalWorld,s),s.r=Math.max(0,Math.min(B.color.r*s.r,1)),s.g=Math.max(0,Math.min(B.color.g*s.g,1)),s.b=Math.max(0,Math.min(B.color.b*s.b,1))):s.copy(B.color):B instanceof THREE.MeshDepthMaterial?(G=1-B.__2near/(B.__farPlusNear-z.z*B.__farMinusNear),s.setRGB(G,G,G)):B instanceof THREE.MeshNormalMaterial&&s.setRGB(b(z.normalWorld.x),b(z.normalWorld.y),b(z.normalWorld.z));B.wireframe?O.setAttribute("style",
-"fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+B.wireframeLinewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframeLinecap+"; stroke-linejoin: "+B.wireframeLinejoin):O.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+B.opacity);i.appendChild(O)}}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,g,e;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;d=c;g=b/2;e=d/2};this.render=function(b,d){var i,k,l,n,o,m,s,p;a=c.projectScene(b,d);i=0;for(k=a.length;i<k;i++)if(o=a[i],o instanceof THREE.RenderableParticle){s=o.x*g+g;p=o.y*e+e;l=0;for(n=o.material.length;l<n;l++)if(m=o.material[l],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=s+"px",m.style.top=p+"px"}}};
+THREE.CanvasRenderer=function(a){function c(a){if(w!=a)p.globalAlpha=w=a}function b(a){if(q!=a){switch(a){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}q=a}}function d(a){if(C!=a)p.strokeStyle=C=a}function g(a){if(v!=a)p.fillStyle=v=a}var e=this,f,h,i,k=new THREE.Projector,a=a||{},l=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+n,o,m,s,p=l.getContext("2d"),r=new THREE.Color(0),t=0,w=1,q=0,C=null,v=null,x=null,I=null,K=null,G,y,D,Q,H=new THREE.RenderableVertex,aa=new THREE.RenderableVertex,M,R,da,ja,T,z,B,L,j,P,fa,Z,S=new THREE.Color,O=new THREE.Color,ea=new THREE.Color,V=new THREE.Color,ca=new THREE.Color,$=[],Y,ka,qa,ma,sa,ua,pa,ra,wa,U,u=new THREE.Rectangle,J=new THREE.Rectangle,E=new THREE.Rectangle,ga=!1,la=new THREE.Color,W=new THREE.Color,ha=new THREE.Color,ba=new THREE.Vector3,ia,xa,N,na,ta,X,a=16;ia=document.createElement("canvas");
+ia.width=ia.height=2;xa=ia.getContext("2d");xa.fillStyle="rgba(0,0,0,1)";xa.fillRect(0,0,2,2);N=xa.getImageData(0,0,2,2);na=N.data;ta=document.createElement("canvas");ta.width=ta.height=a;X=ta.getContext("2d");X.translate(-a/2,-a/2);X.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a;o=b;m=Math.floor(n/2);s=Math.floor(o/2);l.width=n;l.height=o;u.set(-m,-s,m,s);J.set(-m,-s,m,s);w=1;q=0;K=I=x=
+v=C=null};this.setClearColor=function(a,b){r.copy(a);t=b;J.set(-m,-s,m,s)};this.setClearColorHex=function(a,b){r.setHex(a);t=b;J.set(-m,-s,m,s)};this.clear=function(){p.setTransform(1,0,0,-1,m,s);J.isEmpty()||(J.minSelf(u),J.inflate(2),t<1&&p.clearRect(Math.floor(J.getX()),Math.floor(J.getY()),Math.floor(J.getWidth()),Math.floor(J.getHeight())),t>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*255)+","+t+")"),p.fillRect(Math.floor(J.getX()),
+Math.floor(J.getY()),Math.floor(J.getWidth()),Math.floor(J.getHeight()))),J.empty())};this.render=function(a,l){function n(a){var b,c,d,e;la.setRGB(0,0,0);W.setRGB(0,0,0);ha.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(la.r+=e.r,la.g+=e.g,la.b+=e.b):d instanceof THREE.DirectionalLight?(W.r+=e.r,W.g+=e.g,W.b+=e.b):d instanceof THREE.PointLight&&(ha.r+=e.r,ha.g+=e.g,ha.b+=e.b)}function o(a,b,c,d){var e,g,f,j,h,i;e=0;for(g=a.length;e<g;e++)f=a[e],j=f.color,
+f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(ba.sub(h,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function q(a,e,f){c(f.opacity);b(f.blending);var j,h,i,k,l,X;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)k=f.map.image,l=k.width>>1,X=k.height>>
+1,f=e.scale.x*m,i=e.scale.y*s,j=f*l,h=i*X,E.set(a.x-j,a.y-h,a.x+j,a.y+h),u.intersects(E)&&(p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(f,-i),p.translate(-l,-X),p.drawImage(k,0,0),p.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*m,h=e.scale.y*s,E.set(a.x-j,a.y-h,a.x+j,a.y+h),u.intersects(E)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(j,h),f.program(p),p.restore()))}function r(a,e,g,
+f){c(f.opacity);b(f.blending);p.beginPath();p.moveTo(a.positionScreen.x,a.positionScreen.y);p.lineTo(e.positionScreen.x,e.positionScreen.y);p.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(x!=a)p.lineWidth=x=a;a=f.linecap;if(I!=a)p.lineCap=I=a;a=f.linejoin;if(K!=a)p.lineJoin=K=a;d(f.color.getContextStyle());p.stroke();E.inflate(f.linewidth*2)}}function t(a,d,f,g,j,h,k,m){e.info.render.vertices+=3;e.info.render.faces++;c(m.opacity);b(m.blending);M=a.positionScreen.x;R=a.positionScreen.y;
+da=d.positionScreen.x;ja=d.positionScreen.y;T=f.positionScreen.x;z=f.positionScreen.y;C(M,R,da,ja,T,z);if(m instanceof THREE.MeshBasicMaterial)if(m.map)m.map.mapping instanceof THREE.UVMapping&&(ma=k.uvs[0],Ga(M,R,da,ja,T,z,ma[g].u,ma[g].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,m.map));else if(m.envMap){if(m.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,ba.copy(k.vertexNormalsWorld[g]),sa=(ba.x*a.n11+ba.y*a.n12+ba.z*a.n13)*0.5+0.5,ua=-(ba.x*a.n21+ba.y*a.n22+ba.z*a.n23)*
+0.5+0.5,ba.copy(k.vertexNormalsWorld[j]),pa=(ba.x*a.n11+ba.y*a.n12+ba.z*a.n13)*0.5+0.5,ra=-(ba.x*a.n21+ba.y*a.n22+ba.z*a.n23)*0.5+0.5,ba.copy(k.vertexNormalsWorld[h]),wa=(ba.x*a.n11+ba.y*a.n12+ba.z*a.n13)*0.5+0.5,U=-(ba.x*a.n21+ba.y*a.n22+ba.z*a.n23)*0.5+0.5,Ga(M,R,da,ja,T,z,sa,ua,pa,ra,wa,U,m.envMap)}else m.wireframe?ya(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):v(m.color);else if(m instanceof THREE.MeshLambertMaterial)m.map&&!m.wireframe&&(m.map.mapping instanceof THREE.UVMapping&&
+(ma=k.uvs[0],Ga(M,R,da,ja,T,z,ma[g].u,ma[g].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,m.map)),b(THREE.SubtractiveBlending)),ga?!m.wireframe&&m.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==3?(O.r=ea.r=V.r=la.r,O.g=ea.g=V.g=la.g,O.b=ea.b=V.b=la.b,o(i,k.v1.positionWorld,k.vertexNormalsWorld[0],O),o(i,k.v2.positionWorld,k.vertexNormalsWorld[1],ea),o(i,k.v3.positionWorld,k.vertexNormalsWorld[2],V),O.r=Math.max(0,Math.min(m.color.r*O.r,1)),O.g=Math.max(0,Math.min(m.color.g*O.g,1)),O.b=Math.max(0,
+Math.min(m.color.b*O.b,1)),ea.r=Math.max(0,Math.min(m.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(m.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(m.color.b*ea.b,1)),V.r=Math.max(0,Math.min(m.color.r*V.r,1)),V.g=Math.max(0,Math.min(m.color.g*V.g,1)),V.b=Math.max(0,Math.min(m.color.b*V.b,1)),ca.r=(ea.r+V.r)*0.5,ca.g=(ea.g+V.g)*0.5,ca.b=(ea.b+V.b)*0.5,qa=Da(O,ea,V,ca),Ba(M,R,da,ja,T,z,0,0,1,0,0,1,qa)):(S.r=la.r,S.g=la.g,S.b=la.b,o(i,k.centroidWorld,k.normalWorld,S),S.r=Math.max(0,Math.min(m.color.r*S.r,1)),
+S.g=Math.max(0,Math.min(m.color.g*S.g,1)),S.b=Math.max(0,Math.min(m.color.b*S.b,1)),m.wireframe?ya(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):v(S)):m.wireframe?ya(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):v(m.color);else if(m instanceof THREE.MeshDepthMaterial)Y=l.near,ka=l.far,O.r=O.g=O.b=1-Aa(a.positionScreen.z,Y,ka),ea.r=ea.g=ea.b=1-Aa(d.positionScreen.z,Y,ka),V.r=V.g=V.b=1-Aa(f.positionScreen.z,Y,ka),ca.r=(ea.r+V.r)*0.5,ca.g=(ea.g+V.g)*0.5,ca.b=(ea.b+
+V.b)*0.5,qa=Da(O,ea,V,ca),Ba(M,R,da,ja,T,z,0,0,1,0,0,1,qa);else if(m instanceof THREE.MeshNormalMaterial)S.r=Ca(k.normalWorld.x),S.g=Ca(k.normalWorld.y),S.b=Ca(k.normalWorld.z),m.wireframe?ya(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):v(S)}function w(a,d,f,g,h,m,k,X,n){e.info.render.vertices+=4;e.info.render.faces++;c(X.opacity);b(X.blending);if(X.map||X.envMap)t(a,d,g,0,1,3,k,X,n),t(h,f,m,1,2,3,k,X,n);else if(M=a.positionScreen.x,R=a.positionScreen.y,da=d.positionScreen.x,ja=
+d.positionScreen.y,T=f.positionScreen.x,z=f.positionScreen.y,B=g.positionScreen.x,L=g.positionScreen.y,j=h.positionScreen.x,P=h.positionScreen.y,fa=m.positionScreen.x,Z=m.positionScreen.y,X instanceof THREE.MeshBasicMaterial)Ea(M,R,da,ja,T,z,B,L),X.wireframe?ya(X.color,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):v(X.color);else if(X instanceof THREE.MeshLambertMaterial)ga?!X.wireframe&&X.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==4?(O.r=ea.r=V.r=ca.r=la.r,O.g=ea.g=
+V.g=ca.g=la.g,O.b=ea.b=V.b=ca.b=la.b,o(i,k.v1.positionWorld,k.vertexNormalsWorld[0],O),o(i,k.v2.positionWorld,k.vertexNormalsWorld[1],ea),o(i,k.v4.positionWorld,k.vertexNormalsWorld[3],V),o(i,k.v3.positionWorld,k.vertexNormalsWorld[2],ca),O.r=Math.max(0,Math.min(X.color.r*O.r,1)),O.g=Math.max(0,Math.min(X.color.g*O.g,1)),O.b=Math.max(0,Math.min(X.color.b*O.b,1)),ea.r=Math.max(0,Math.min(X.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(X.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(X.color.b*ea.b,1)),V.r=
+Math.max(0,Math.min(X.color.r*V.r,1)),V.g=Math.max(0,Math.min(X.color.g*V.g,1)),V.b=Math.max(0,Math.min(X.color.b*V.b,1)),ca.r=Math.max(0,Math.min(X.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(X.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(X.color.b*ca.b,1)),qa=Da(O,ea,V,ca),C(M,R,da,ja,B,L),Ba(M,R,da,ja,B,L,0,0,1,0,0,1,qa),C(j,P,T,z,fa,Z),Ba(j,P,T,z,fa,Z,1,0,1,1,0,1,qa)):(S.r=la.r,S.g=la.g,S.b=la.b,o(i,k.centroidWorld,k.normalWorld,S),S.r=Math.max(0,Math.min(X.color.r*S.r,1)),S.g=Math.max(0,Math.min(X.color.g*
+S.g,1)),S.b=Math.max(0,Math.min(X.color.b*S.b,1)),Ea(M,R,da,ja,T,z,B,L),X.wireframe?ya(S,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):v(S)):(Ea(M,R,da,ja,T,z,B,L),X.wireframe?ya(X.color,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):v(X.color));else if(X instanceof THREE.MeshNormalMaterial)S.r=Ca(k.normalWorld.x),S.g=Ca(k.normalWorld.y),S.b=Ca(k.normalWorld.z),Ea(M,R,da,ja,T,z,B,L),X.wireframe?ya(S,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):v(S);else if(X instanceof
+THREE.MeshDepthMaterial)Y=l.near,ka=l.far,O.r=O.g=O.b=1-Aa(a.positionScreen.z,Y,ka),ea.r=ea.g=ea.b=1-Aa(d.positionScreen.z,Y,ka),V.r=V.g=V.b=1-Aa(g.positionScreen.z,Y,ka),ca.r=ca.g=ca.b=1-Aa(f.positionScreen.z,Y,ka),qa=Da(O,ea,V,ca),C(M,R,da,ja,B,L),Ba(M,R,da,ja,B,L,0,0,1,0,0,1,qa),C(j,P,T,z,fa,Z),Ba(j,P,T,z,fa,Z,1,0,1,1,0,1,qa)}function C(a,b,c,d,e,f){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.lineTo(a,b);p.closePath()}function Ea(a,b,c,d,e,f,g,j){p.beginPath();p.moveTo(a,b);p.lineTo(c,
+d);p.lineTo(e,f);p.lineTo(g,j);p.lineTo(a,b);p.closePath()}function ya(a,b,c,e){if(x!=b)p.lineWidth=x=b;if(I!=c)p.lineCap=I=c;if(K!=e)p.lineJoin=K=e;d(a.getContextStyle());p.stroke();E.inflate(b*2)}function v(a){g(a.getContextStyle());p.fill()}function Ga(a,b,c,d,e,f,j,h,i,m,k,X,l){if(l.image.width!=0){if(l.needsUpdate==!0||$[l.id]==void 0){var n=l.wrapS==THREE.RepeatWrapping,o=l.wrapT==THREE.RepeatWrapping;$[l.id]=p.createPattern(l.image,n&&o?"repeat":n&&!o?"repeat-x":!n&&o?"repeat-y":"no-repeat");
+l.needsUpdate=!1}g($[l.id]);var n=l.offset.x/l.repeat.x,o=l.offset.y/l.repeat.y,U=(l.image.width-1)*l.repeat.x,l=(l.image.height-1)*l.repeat.y,j=(j+n)*U,h=(h+o)*l,i=(i+n)*U,m=(m+o)*l,k=(k+n)*U,X=(X+o)*l;c-=a;d-=b;e-=a;f-=b;i-=j;m-=h;k-=j;X-=h;n=1/(i*X-k*m);l=(X*c-m*e)*n;m=(X*d-m*f)*n;c=(i*e-k*c)*n;d=(i*f-k*d)*n;a=a-l*j-c*h;b=b-m*j-d*h;p.save();p.transform(l,m,c,d,a,b);p.fill();p.restore()}}function Ba(a,b,c,d,e,f,g,j,h,i,m,k,l){var X,n;X=l.width-1;n=l.height-1;g*=X;j*=n;h*=X;i*=n;m*=X;k*=n;c-=a;d-=
+b;e-=a;f-=b;h-=g;i-=j;m-=g;k-=j;n=1/(h*k-m*i);X=(k*c-i*e)*n;i=(k*d-i*f)*n;c=(h*e-m*c)*n;d=(h*f-m*d)*n;a=a-X*g-c*j;b=b-i*g-d*j;p.save();p.transform(X,i,c,d,a,b);p.clip();p.drawImage(l,0,0);p.restore()}function Da(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),m=~~(d.r*255),k=~~(d.g*255),d=~~(d.b*255);na[0]=e<0?0:e>255?255:e;na[1]=f<0?0:f>255?255:f;na[2]=a<0?0:a>255?255:a;na[4]=g<0?0:g>255?255:g;na[5]=j<0?0:
+j>255?255:j;na[6]=b<0?0:b>255?255:b;na[8]=h<0?0:h>255?255:h;na[9]=i<0?0:i>255?255:i;na[10]=c<0?0:c>255?255:c;na[12]=m<0?0:m>255?255:m;na[13]=k<0?0:k>255?255:k;na[14]=d<0?0:d>255?255:d;xa.putImageData(N,0,0);X.drawImage(ia,0,0);return ta}function Aa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ca(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function za(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Fa,Ha,oa,va;this.autoClear?this.clear():p.setTransform(1,
+0,0,-1,m,s);e.info.render.vertices=0;e.info.render.faces=0;f=k.projectScene(a,l,this.sortElements);h=f.elements;i=f.lights;(ga=i.length>0)&&n(i);Fa=0;for(Ha=h.length;Fa<Ha;Fa++)if(oa=h[Fa],va=oa.material,va=va instanceof THREE.MeshFaceMaterial?oa.faceMaterial:va,!(va==null||va.opacity==0)){E.empty();if(oa instanceof THREE.RenderableParticle)G=oa,G.x*=m,G.y*=s,q(G,oa,va,a);else if(oa instanceof THREE.RenderableLine)G=oa.v1,y=oa.v2,G.positionScreen.x*=m,G.positionScreen.y*=s,y.positionScreen.x*=m,y.positionScreen.y*=
+s,E.addPoint(G.positionScreen.x,G.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),u.intersects(E)&&r(G,y,oa,va,a);else if(oa instanceof THREE.RenderableFace3)G=oa.v1,y=oa.v2,D=oa.v3,G.positionScreen.x*=m,G.positionScreen.y*=s,y.positionScreen.x*=m,y.positionScreen.y*=s,D.positionScreen.x*=m,D.positionScreen.y*=s,va.overdraw&&(za(G.positionScreen,y.positionScreen),za(y.positionScreen,D.positionScreen),za(D.positionScreen,G.positionScreen)),E.add3Points(G.positionScreen.x,G.positionScreen.y,
+y.positionScreen.x,y.positionScreen.y,D.positionScreen.x,D.positionScreen.y),u.intersects(E)&&t(G,y,D,0,1,2,oa,va,a);else if(oa instanceof THREE.RenderableFace4)G=oa.v1,y=oa.v2,D=oa.v3,Q=oa.v4,G.positionScreen.x*=m,G.positionScreen.y*=s,y.positionScreen.x*=m,y.positionScreen.y*=s,D.positionScreen.x*=m,D.positionScreen.y*=s,Q.positionScreen.x*=m,Q.positionScreen.y*=s,H.positionScreen.copy(y.positionScreen),aa.positionScreen.copy(Q.positionScreen),va.overdraw&&(za(G.positionScreen,y.positionScreen),
+za(y.positionScreen,Q.positionScreen),za(Q.positionScreen,G.positionScreen),za(D.positionScreen,H.positionScreen),za(D.positionScreen,aa.positionScreen)),E.addPoint(G.positionScreen.x,G.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(D.positionScreen.x,D.positionScreen.y),E.addPoint(Q.positionScreen.x,Q.positionScreen.y),u.intersects(E)&&w(G,y,D,Q,H,aa,oa,va,a);J.addRectangle(E)}p.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,j,h,i;e=0;for(f=a.length;e<f;e++)g=a[e],j=g.color,g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),i=c.dot(G.sub(h,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(h)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function c(a){y[a]==null&&(y[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),M==0&&y[a].setAttribute("shape-rendering","crispEdges"));return y[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,n,o,m,s,p,r,t=new THREE.Rectangle,w=new THREE.Rectangle,q=!1,C=new THREE.Color,v=new THREE.Color,x=new THREE.Color,I=new THREE.Color,K,G=new THREE.Vector3,y=[],D=[],Q,H,aa,M=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
+faces:0}};this.setQuality=function(a){switch(a){case "high":M=1;break;case "low":M=0}};this.setSize=function(a,b){k=a;l=b;n=k/2;o=l/2;i.setAttribute("viewBox",-n+" "+-o+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);t.set(-n,-o,n,o)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var G,y,z,B;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(k,l,this.sortElements);e=g.elements;
+f=g.lights;aa=H=0;if(q=f.length>0){v.setRGB(0,0,0);x.setRGB(0,0,0);I.setRGB(0,0,0);G=0;for(y=f.length;G<y;G++)B=f[G],z=B.color,B instanceof THREE.AmbientLight?(v.r+=z.r,v.g+=z.g,v.b+=z.b):B instanceof THREE.DirectionalLight?(x.r+=z.r,x.g+=z.g,x.b+=z.b):B instanceof THREE.PointLight&&(I.r+=z.r,I.g+=z.g,I.b+=z.b)}G=0;for(y=e.length;G<y;G++)if(z=e[G],B=z.material,B=B instanceof THREE.MeshFaceMaterial?z.faceMaterial:B,!(B==null||B.opacity==0))if(w.empty(),z instanceof THREE.RenderableParticle)m=z,m.x*=
+n,m.y*=-o;else if(z instanceof THREE.RenderableLine){if(m=z.v1,s=z.v2,m.positionScreen.x*=n,m.positionScreen.y*=-o,s.positionScreen.x*=n,s.positionScreen.y*=-o,w.addPoint(m.positionScreen.x,m.positionScreen.y),w.addPoint(s.positionScreen.x,s.positionScreen.y),t.intersects(w)){z=m;var L=s,j=aa++;D[j]==null&&(D[j]=document.createElementNS("http://www.w3.org/2000/svg","line"),M==0&&D[j].setAttribute("shape-rendering","crispEdges"));Q=D[j];Q.setAttribute("x1",z.positionScreen.x);Q.setAttribute("y1",z.positionScreen.y);
+Q.setAttribute("x2",L.positionScreen.x);Q.setAttribute("y2",L.positionScreen.y);B instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: "+B.color.getContextStyle()+"; stroke-width: "+B.linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.linecap+"; stroke-linejoin: "+B.linejoin),i.appendChild(Q))}}else if(z instanceof THREE.RenderableFace3){if(m=z.v1,s=z.v2,p=z.v3,m.positionScreen.x*=n,m.positionScreen.y*=-o,s.positionScreen.x*=n,s.positionScreen.y*=-o,p.positionScreen.x*=
+n,p.positionScreen.y*=-o,w.addPoint(m.positionScreen.x,m.positionScreen.y),w.addPoint(s.positionScreen.x,s.positionScreen.y),w.addPoint(p.positionScreen.x,p.positionScreen.y),t.intersects(w)){var L=m,j=s,P=p;d.info.render.vertices+=3;d.info.render.faces++;Q=c(H++);Q.setAttribute("d","M "+L.positionScreen.x+" "+L.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+"z");B instanceof THREE.MeshBasicMaterial?C.copy(B.color):B instanceof THREE.MeshLambertMaterial?
+q?(C.r=v.r,C.g=v.g,C.b=v.b,a(f,z.centroidWorld,z.normalWorld,C),C.r=Math.max(0,Math.min(B.color.r*C.r,1)),C.g=Math.max(0,Math.min(B.color.g*C.g,1)),C.b=Math.max(0,Math.min(B.color.b*C.b,1))):C.copy(B.color):B instanceof THREE.MeshDepthMaterial?(K=1-B.__2near/(B.__farPlusNear-z.z*B.__farMinusNear),C.setRGB(K,K,K)):B instanceof THREE.MeshNormalMaterial&&C.setRGB(b(z.normalWorld.x),b(z.normalWorld.y),b(z.normalWorld.z));B.wireframe?Q.setAttribute("style","fill: none; stroke: "+C.getContextStyle()+"; stroke-width: "+
+B.wireframeLinewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframeLinecap+"; stroke-linejoin: "+B.wireframeLinejoin):Q.setAttribute("style","fill: "+C.getContextStyle()+"; fill-opacity: "+B.opacity);i.appendChild(Q)}}else if(z instanceof THREE.RenderableFace4&&(m=z.v1,s=z.v2,p=z.v3,r=z.v4,m.positionScreen.x*=n,m.positionScreen.y*=-o,s.positionScreen.x*=n,s.positionScreen.y*=-o,p.positionScreen.x*=n,p.positionScreen.y*=-o,r.positionScreen.x*=n,r.positionScreen.y*=-o,w.addPoint(m.positionScreen.x,
+m.positionScreen.y),w.addPoint(s.positionScreen.x,s.positionScreen.y),w.addPoint(p.positionScreen.x,p.positionScreen.y),w.addPoint(r.positionScreen.x,r.positionScreen.y),t.intersects(w))){var L=m,j=s,P=p,fa=r;d.info.render.vertices+=4;d.info.render.faces++;Q=c(H++);Q.setAttribute("d","M "+L.positionScreen.x+" "+L.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");B instanceof THREE.MeshBasicMaterial?
+C.copy(B.color):B instanceof THREE.MeshLambertMaterial?q?(C.r=v.r,C.g=v.g,C.b=v.b,a(f,z.centroidWorld,z.normalWorld,C),C.r=Math.max(0,Math.min(B.color.r*C.r,1)),C.g=Math.max(0,Math.min(B.color.g*C.g,1)),C.b=Math.max(0,Math.min(B.color.b*C.b,1))):C.copy(B.color):B instanceof THREE.MeshDepthMaterial?(K=1-B.__2near/(B.__farPlusNear-z.z*B.__farMinusNear),C.setRGB(K,K,K)):B instanceof THREE.MeshNormalMaterial&&C.setRGB(b(z.normalWorld.x),b(z.normalWorld.y),b(z.normalWorld.z));B.wireframe?Q.setAttribute("style",
+"fill: none; stroke: "+C.getContextStyle()+"; stroke-width: "+B.wireframeLinewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframeLinecap+"; stroke-linejoin: "+B.wireframeLinejoin):Q.setAttribute("style","fill: "+C.getContextStyle()+"; fill-opacity: "+B.opacity);i.appendChild(Q)}}};
 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 float flipEnvMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
@@ -222,123 +222,123 @@ THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_
 THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var g=d.attributes[e];if(!g.__webglInitialized||g.createUniqueBuffers){g.__webglInitialized=!0;var f=1;g.type==="v2"?f=2:g.type==="v3"?f=3:g.type==="v4"?f=4:g.type==="c"&&(f=3);g.size=f;g.array=new Float32Array(c*f);g.buffer=j.createBuffer();g.buffer.belongsToAttribute=e;g.needsUpdate=!0}a.__webglCustomAttributesList.push(g)}}}
-function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a,b,c){var d,e,g,f,h=a.vertices;f=h.length;var i=a.colors,n=i.length,k=a.__vertexArray,l=a.__colorArray,m=a.__sortArray,p=a.__dirtyVertices,q=a.__dirtyColors,S=a.__webglCustomAttributesList;if(c.sortParticles){Y.multiplySelf(c.matrixWorld);for(d=0;d<f;d++)e=h[d].position,ka.copy(e),Y.multiplyVector3(ka),m[d]=[ka.z,d];m.sort(function(a,
-b){return b[0]-a[0]});for(d=0;d<f;d++)e=h[m[d][1]].position,g=d*3,k[g]=e.x,k[g+1]=e.y,k[g+2]=e.z;for(d=0;d<n;d++)g=d*3,e=i[m[d][1]],l[g]=e.r,l[g+1]=e.g,l[g+2]=e.b;if(S){i=0;for(n=S.length;i<n;i++)if(h=S[i],h.boundTo===void 0||h.boundTo==="vertices")if(g=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)f=m[d][1],h.array[d]=h.value[f];else if(h.size===2)for(d=0;d<e;d++)f=m[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=m[d][1],f=h.value[f],
-h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=m[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=m[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,g+=4}}else{if(p)for(d=0;d<f;d++)e=h[d].position,g=d*3,k[g]=e.x,k[g+1]=e.y,k[g+2]=e.z;if(q)for(d=0;d<n;d++)e=i[d],g=d*3,l[g]=e.r,l[g+1]=e.g,l[g+2]=e.b;if(S){i=0;for(n=S.length;i<n;i++)if(h=S[i],h.needsUpdate&&(h.boundTo===void 0||
+function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a,b,c){var d,e,g,f,h=a.vertices;f=h.length;var i=a.colors,m=i.length,k=a.__vertexArray,l=a.__colorArray,n=a.__sortArray,p=a.__dirtyVertices,o=a.__dirtyColors,U=a.__webglCustomAttributesList;if(c.sortParticles){J.multiplySelf(c.matrixWorld);for(d=0;d<f;d++)e=h[d].position,la.copy(e),J.multiplyVector3(la),n[d]=[la.z,d];n.sort(function(a,
+b){return b[0]-a[0]});for(d=0;d<f;d++)e=h[n[d][1]].position,g=d*3,k[g]=e.x,k[g+1]=e.y,k[g+2]=e.z;for(d=0;d<m;d++)g=d*3,e=i[n[d][1]],l[g]=e.r,l[g+1]=e.g,l[g+2]=e.b;if(U){i=0;for(m=U.length;i<m;i++)if(h=U[i],h.boundTo===void 0||h.boundTo==="vertices")if(g=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)f=n[d][1],h.array[d]=h.value[f];else if(h.size===2)for(d=0;d<e;d++)f=n[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=n[d][1],f=h.value[f],
+h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=n[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=n[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,g+=4}}else{if(p)for(d=0;d<f;d++)e=h[d].position,g=d*3,k[g]=e.x,k[g+1]=e.y,k[g+2]=e.z;if(o)for(d=0;d<m;d++)e=i[d],g=d*3,l[g]=e.r,l[g+1]=e.g,l[g+2]=e.b;if(U){i=0;for(m=U.length;i<m;i++)if(h=U[i],h.needsUpdate&&(h.boundTo===void 0||
 h.boundTo==="vertices"))if(e=h.value.length,g=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,
-g+=4}}if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(q||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(S){i=0;for(n=S.length;i<n;i++)if(h=S[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}}function g(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
-a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,g,f,h,i,n,k,l,m,p=a.count*3;for(m=0;m<p;m+=9)c=a.normalArray,d=c[m],e=c[m+1],g=c[m+2],f=c[m+3],i=c[m+4],k=c[m+5],h=c[m+6],n=c[m+7],l=c[m+8],d=(d+f+h)/3,e=(e+i+n)/3,g=
-(g+k+l)/3,c[m]=d,c[m+1]=e,c[m+2]=g,c[m+3]=d,c[m+4]=e,c[m+5]=g,c[m+6]=d,c[m+7]=e,c[m+8]=g}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function e(a,b,c,d,e,g){if(d.opacity!==0){var f,h,c=o(a,b,c,d,g),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==M&&(M=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,
+g+=4}}if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(U){i=0;for(m=U.length;i<m;i++)if(h=U[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}}function g(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
+a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,g,f,h,i,m,k,l,n,p=a.count*3;for(n=0;n<p;n+=9)c=a.normalArray,d=c[n],e=c[n+1],g=c[n+2],f=c[n+3],i=c[n+4],k=c[n+5],h=c[n+6],m=c[n+7],l=c[n+8],d=(d+f+h)/3,e=(e+i+m)/3,g=
+(g+k+l)/3,c[n]=d,c[n+1]=e,c[n+2]=g,c[n+3]=d,c[n+4]=e,c[n+5]=g,c[n+6]=d,c[n+7]=e,c[n+8]=g}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function e(a,b,c,d,e,g){if(d.opacity!==0){var f,h,c=r(a,b,c,d,g),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==O&&(O=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,
 e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;g.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[g.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){f=0;var i=g.morphTargetForcedOrder;for(h=g.morphTargetInfluences;f<d.numSupportedMorphTargets&&
-f<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[f]=h[i[f]],f++}else{var i=[],n=-1,k=0;h=g.morphTargetInfluences;var l,m=h.length;f=0;for(g.morphTargetBase!==-1&&(i[g.morphTargetBase]=!0);f<d.numSupportedMorphTargets;){for(l=0;l<m;l++)!i[l]&&h[l]>n&&(k=l,n=h[k]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[f]=
-n;i[k]=1;n=-1;f++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){f=0;for(h=e.__webglCustomAttributesList.length;f<h;f++)c=e.__webglCustomAttributesList[f],b[c.buffer.belongsToAttribute]>=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,
+f<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[f]=h[i[f]],f++}else{var i=[],m=-1,k=0;h=g.morphTargetInfluences;var l,n=h.length;f=0;for(g.morphTargetBase!==-1&&(i[g.morphTargetBase]=!0);f<d.numSupportedMorphTargets;){for(l=0;l<n;l++)!i[l]&&h[l]>m&&(k=l,m=h[k]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[f]=
+m;i[k]=1;m=-1;f++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){f=0;for(h=e.__webglCustomAttributesList.length;f<h;f++)c=e.__webglCustomAttributesList[f],b[c.buffer.belongsToAttribute]>=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,
 3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),
 j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,
-4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ua&&(j.lineWidth(d),ua=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),I.info.render.calls++,I.info.render.vertices+=
-e.__webglFaceCount,I.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==ua&&(j.lineWidth(d),ua=d),j.drawArrays(g,0,e.__webglLineCount),I.info.render.calls++):g instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),I.info.render.calls++):g instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),I.info.render.calls++)}}function f(a){D[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
-a.n13,a.n44-a.n14);D[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);D[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);D[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);D[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);D[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=D[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
-a.scale.z)),d=0;d<6;d++)if(a=D[d].x*b.n14+D[d].y*b.n24+D[d].z*b.n34+D[d].w,a<=c)return!1;return!0}function i(a,b){return b.z-a.z}function k(a){var b,c,d,i,n,k,l,m,p=0,q=a.lights;T||(T=new THREE.PerspectiveCamera(I.shadowCameraFov,I.shadowMapWidth/I.shadowMapHeight,I.shadowCameraNear,I.shadowCameraFar));b=0;for(c=q.length;b<c;b++)if(m=q[b],m.castShadow&&m instanceof THREE.SpotLight){Q=-1;I.shadowMap[p]||(I.shadowMap[p]=new THREE.WebGLRenderTarget(I.shadowMapWidth,I.shadowMapHeight,{minFilter:THREE.LinearFilter,
-magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),aa[p]=new THREE.Matrix4);d=I.shadowMap[p];i=aa[p];T.position.copy(m.position);T.lookAt(m.target.position);T.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(T));this.autoUpdateScene&&a.updateMatrixWorld();T.matrixWorldInverse.getInverse(T.matrixWorld);i.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);i.multiplySelf(T.projectionMatrix);i.multiplySelf(T.matrixWorldInverse);T.matrixWorldInverse.flattenToArray(ia);T.projectionMatrix.flattenToArray(ba);
-Y.multiply(T.projectionMatrix,T.matrixWorldInverse);f(Y);C(d);j.clearColor(1,1,1,1);I.clear();j.clearColor(R.r,R.g,R.b,z);i=a.__webglObjects.length;for(d=0;d<i;d++)if(k=a.__webglObjects[d],m=k.object,k.render=!1,m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||h(m)))m.matrixWorld.flattenToArray(m._objectMatrixArray),v(m,T,!1),k.render=!0;r(!0);x(THREE.NormalBlending);for(d=0;d<i;d++)if(k=a.__webglObjects[d],k.render)m=k.object,k=k.buffer,w(m),l=m.customDepthMaterial?m.customDepthMaterial:
-m.geometry.morphTargets.length?xa:ha,e(T,q,null,l,k,m);i=a.__webglObjectsImmediate.length;for(d=0;d<i;d++)k=a.__webglObjectsImmediate[d],m=k.object,m.visible&&m.castShadow&&(m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),M=-1,v(m,T,!1),w(m),n=o(T,q,null,ha,m),m.immediateRenderCallback?m.immediateRenderCallback(n,j,D):m.render(function(a){g(a,n,ha.shading)}));p++}}function l(a,b,c,d,g,f,h,j){var i,n,k,l;b?(n=a.length-1,l=b=-1):(n=0,b=a.length,l=1);for(var m=n;m!==b;m+=l)if(i=
-a[m],i.render){n=i.object;k=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;h&&x(i.blending);r(i.depthTest);s(i.depthWrite);u(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}w(n);e(d,g,f,i,k,n)}}function m(a,b,c,d,e,f,h){for(var i,n,k,l,m=0,p=a.length;m<p;m++)if(i=a[m],n=i.object,n.visible){M=-1;if(h)k=h;else{k=i[b];if(!k)continue;f&&x(k.blending);r(k.depthTest);s(k.depthWrite);u(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}w(n);l=o(c,d,e,k,n);n.immediateRenderCallback?n.immediateRenderCallback(l,
-j,D):n.render(function(a){g(a,l,k.shading)})}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function p(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function o(a,b,c,d,e){d.program||I.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(I.maxMorphTargets);
-for(var g=0,f=I.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==ga&&(j.useProgram(g),ga=g,h=!0);if(d.id!==Q)Q=d.id,h=!0;if(h){j.uniformMatrix4fv(f.projectionMatrix,!1,ba);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var n,
-k,l=0,m=0,p=0,q,S,t,Y=V,o=Y.directional.colors,r=Y.directional.positions,D=Y.point.colors,v=Y.point.positions,w=Y.point.distances,s=0,B=0,c=n=t=0,h=b.length;c<h;c++)if(n=b[c],k=n.color,q=n.position,S=n.intensity,t=n.distance,n instanceof THREE.AmbientLight)I.gammaInput?(l+=k.r*k.r,m+=k.g*k.g,p+=k.b*k.b):(l+=k.r,m+=k.g,p+=k.b);else if(n instanceof THREE.DirectionalLight)t=s*3,I.gammaInput?(o[t]=k.r*k.r*S*S,o[t+1]=k.g*k.g*S*S,o[t+2]=k.b*k.b*S*S):(o[t]=k.r*S,o[t+1]=k.g*S,o[t+2]=k.b*S),r[t]=q.x,r[t+1]=
-q.y,r[t+2]=q.z,s+=1;else if(n instanceof THREE.SpotLight)t=s*3,I.gammaInput?(o[t]=k.r*k.r*S*S,o[t+1]=k.g*k.g*S*S,o[t+2]=k.b*k.b*S*S):(o[t]=k.r*S,o[t+1]=k.g*S,o[t+2]=k.b*S),k=1/q.length(),r[t]=q.x*k,r[t+1]=q.y*k,r[t+2]=q.z*k,s+=1;else if(n instanceof THREE.PointLight)n=B*3,I.gammaInput?(D[n]=k.r*k.r*S*S,D[n+1]=k.g*k.g*S*S,D[n+2]=k.b*k.b*S*S):(D[n]=k.r*S,D[n+1]=k.g*S,D[n+2]=k.b*S),v[n]=q.x,v[n+1]=q.y,v[n+2]=q.z,w[B]=t,B+=1;c=s*3;for(h=o.length;c<h;c++)o[c]=0;c=B*3;for(h=D.length;c<h;c++)D[c]=0;Y.point.length=
-B;Y.directional.length=s;Y.ambient[0]=l;Y.ambient[1]=m;Y.ambient[2]=p;b=V;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,I.gammaInput?
-i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof
-THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=$.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,I.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof THREE.MeshLambertMaterial)I.gammaInput?
-i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<aa.length;b++)i.shadowMatrix.value[b]=aa[b],i.shadowMap.texture[b]=I.shadowMap[b];i.shadowDarkness.value=I.shadowMapDarkness;i.shadowBias.value=I.shadowMapBias}b=d.uniformsList;i=0;for(c=
-b.length;i<c;i++)if(m=g.uniforms[b[i][1]])if(l=b[i][0],p=l.type,h=l.value,p==="i")j.uniform1i(m,h);else if(p==="f")j.uniform1f(m,h);else if(p==="v2")j.uniform2f(m,h.x,h.y);else if(p==="v3")j.uniform3f(m,h.x,h.y,h.z);else if(p==="v4")j.uniform4f(m,h.x,h.y,h.z,h.w);else if(p==="c")j.uniform3f(m,h.r,h.g,h.b);else if(p==="fv1")j.uniform1fv(m,h);else if(p==="fv")j.uniform3fv(m,h);else if(p==="v3v"){if(!l._array)l._array=new Float32Array(3*h.length);p=0;for(q=h.length;p<q;p++)Y=p*3,l._array[Y]=h[p].x,l._array[Y+
-1]=h[p].y,l._array[Y+2]=h[p].z;j.uniform3fv(m,l._array)}else if(p==="m4"){if(!l._array)l._array=new Float32Array(16);h.flattenToArray(l._array);j.uniformMatrix4fv(m,!1,l._array)}else if(p==="m4v"){if(!l._array)l._array=new Float32Array(16*h.length);p=0;for(q=h.length;p<q;p++)h[p].flattenToArrayOffset(l._array,p*16);j.uniformMatrix4fv(m,!1,l._array)}else if(p==="t"){if(j.uniform1i(m,h),m=l.texture)if(m.image instanceof Array&&m.image.length===6){if(l=m,l.image.length===6)if(l.needsUpdate){if(!l.image.__webglTextureCube)l.image.__webglTextureCube=
-j.createTexture();j.activeTexture(j.TEXTURE0+h);j.bindTexture(j.TEXTURE_CUBE_MAP,l.image.__webglTextureCube);for(h=0;h<6;h++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,l.image[h]);G(j.TEXTURE_CUBE_MAP,l,l.image[0]);l.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,l.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(l=m,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,l.__webglTexture)):F(m,h)}else if(p===
-"tv"){if(!l._array){l._array=[];p=0;for(q=l.texture.length;p<q;p++)l._array[p]=h+p}j.uniform1iv(m,l._array);p=0;for(q=l.texture.length;p<q;p++)(m=l.texture[p])&&F(m,l._array[p])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&f.cameraPosition!==null&&j.uniform3f(f.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&f.viewMatrix!==null&&
-j.uniformMatrix4fv(f.viewMatrix,!1,ia);d.skinning&&(j.uniformMatrix4fv(f.cameraInverseMatrix,!1,ia),j.uniformMatrix4fv(f.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(f.modelViewMatrix,!1,e._modelViewMatrixArray);f.normalMatrix&&j.uniformMatrix3fv(f.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&f.objectMatrix!==null&&j.uniformMatrix4fv(f.objectMatrix,!1,e._objectMatrixArray);return g}function v(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,
-a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function w(a){if(U!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),U=a.doubleSided;if(ca!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ca=a.flipSided}function r(a){fa!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),fa=a)}function s(a){la!==a&&(j.depthMask(a),la=a)}function u(a,b,c){qa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):
-j.disable(j.POLYGON_OFFSET_FILL),qa=a);if(a&&(ma!==b||sa!==c))j.polygonOffset(b,c),ma=b,sa=c}function x(a){if(a!==Z){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,
-j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}Z=a}}function H(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(b),null;return c}function G(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,J(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,J(b.wrapT)),
-j.texParameteri(a,j.TEXTURE_MAG_FILTER,J(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,J(b.minFilter)),j.generateMipmap(a)):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,O(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,O(b.minFilter)))}function F(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),I.info.memory.textures++;j.activeTexture(j.TEXTURE0+
-b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,J(a.format),a.image.width,a.image.height,0,J(a.format),j.UNSIGNED_BYTE,a.image.data):j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,a.image);G(j.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)}function y(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,
-j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function C(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;
-if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);G(j.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,J(a.format),a.width,a.height,0,J(a.format),J(a.type),null);var d=a,e=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,
-a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,e,d.__webglTexture,0);y(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),G(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,J(a.format),a.width,a.height,0,J(a.format),J(a.type),null),c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,
-c,a.__webglTexture,0),j.bindRenderbuffer(j.RENDERBUFFER,a.__webglRenderbuffer),y(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=wa,a=S,d=pa,e=ra);b!==X&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),X=b)}function O(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;
-default:return j.LINEAR}}function J(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;
-case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}
-var a=a||{},$=a.canvas!==void 0?a.canvas:document.createElement("canvas"),L=a.precision!==void 0?a.precision:"highp",P=a.antialias!==void 0?a.antialias:!1,da=a.stencil!==void 0?a.stencil:!0,ja=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,R=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),z=a.clearAlpha!==void 0?a.clearAlpha:0,B=a.maxLights!==void 0?a.maxLights:4;this.domElement=$;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
-this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var I=
-this,j,N=[],ga=null,X=null,Q=-1,M=null,ea=0,U=null,ca=null,Z=null,fa=null,la=null,qa=null,ma=null,sa=null,ua=null,pa=0,ra=0,wa=0,S=0,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Y=new THREE.Matrix4,ba=new Float32Array(16),ia=new Float32Array(16),ka=new THREE.Vector4,V={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},T,aa=[],ha,xa,K={},na=!1;j=function(){var a;try{if(!(a=
-$.getContext("experimental-webgl",{antialias:P,stencil:da,preserveDrawingBuffer:ja})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);
-j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(R.r,R.g,R.b,z);(function(){K.vertices=new Float32Array(16);K.faces=new Uint16Array(6);var a=0;K.vertices[a++]=-1;K.vertices[a++]=-1;K.vertices[a++]=0;K.vertices[a++]=1;K.vertices[a++]=1;K.vertices[a++]=-1;K.vertices[a++]=1;K.vertices[a++]=1;K.vertices[a++]=1;K.vertices[a++]=1;K.vertices[a++]=1;K.vertices[a++]=0;K.vertices[a++]=-1;K.vertices[a++]=1;K.vertices[a++]=0;a=K.vertices[a++]=0;K.faces[a++]=0;K.faces[a++]=
-1;K.faces[a++]=2;K.faces[a++]=0;K.faces[a++]=2;K.faces[a++]=3;K.vertexBuffer=j.createBuffer();K.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,K.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,K.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,K.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,K.faces,j.STATIC_DRAW);K.program=j.createProgram();j.attachShader(K.program,H("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(K.program,H("vertex",THREE.ShaderLib.sprite.vertexShader));
-j.linkProgram(K.program);K.attributes={};K.uniforms={};K.attributes.position=j.getAttribLocation(K.program,"position");K.attributes.uv=j.getAttribLocation(K.program,"uv");K.uniforms.uvOffset=j.getUniformLocation(K.program,"uvOffset");K.uniforms.uvScale=j.getUniformLocation(K.program,"uvScale");K.uniforms.rotation=j.getUniformLocation(K.program,"rotation");K.uniforms.scale=j.getUniformLocation(K.program,"scale");K.uniforms.alignment=j.getUniformLocation(K.program,"alignment");K.uniforms.color=j.getUniformLocation(K.program,
-"color");K.uniforms.map=j.getUniformLocation(K.program,"map");K.uniforms.opacity=j.getUniformLocation(K.program,"opacity");K.uniforms.useScreenCoordinates=j.getUniformLocation(K.program,"useScreenCoordinates");K.uniforms.affectedByDistance=j.getUniformLocation(K.program,"affectedByDistance");K.uniforms.screenPosition=j.getUniformLocation(K.program,"screenPosition");K.uniforms.modelViewMatrix=j.getUniformLocation(K.program,"modelViewMatrix");K.uniforms.projectionMatrix=j.getUniformLocation(K.program,
-"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);ha=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});xa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});ha._shadowPass=!0;xa._shadowPass=!0})();this.context=j;var ta=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=
-function(){return ta};this.setSize=function(a,b){$.width=a;$.height=b;this.setViewport(0,0,$.width,$.height)};this.setViewport=function(a,b,c,d){pa=a;ra=b;wa=c;S=d;j.viewport(pa,ra,wa,S)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){R.setHex(a);z=b;j.clearColor(R.r,R.g,R.b,z)};this.setClearColor=function(a,b){R.copy(a);z=b;j.clearColor(R.r,R.g,R.b,z)};this.getClearColor=
-function(){return R};this.getClearAlpha=function(){return z};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){C(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=
-a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=
-0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);I.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),I.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),I.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),
-I.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),I.info.memory.textures--};this.updateShadowMap=function(a,b){k(a,b)};this.render=function(a,b,c,d){var e,g,n,p,q=a.lights,t=a.fog;Q=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&k(a,b);I.info.render.calls=0;I.info.render.vertices=0;I.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(ia);b.projectionMatrix.flattenToArray(ba);Y.multiply(b.projectionMatrix,b.matrixWorldInverse);f(Y);C(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);p=a.__webglObjects;d=0;for(e=p.length;d<e;d++)if(g=p[d],n=g.object,g.render=!1,n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||h(n))){n.matrixWorld.flattenToArray(n._objectMatrixArray);
-v(n,b,!0);var o=g,D=o.object,w=o.buffer,B=void 0,B=B=void 0,B=D.material;if(B instanceof THREE.MeshFaceMaterial){if(B=w.materialIndex,B>=0)B=D.geometry.materials[B],B.transparent?(o.transparent=B,o.opaque=null):(o.opaque=B,o.transparent=null)}else if(B)B.transparent?(o.transparent=B,o.opaque=null):(o.opaque=B,o.transparent=null);g.render=!0;if(this.sortObjects)n.renderDepth?g.z=n.renderDepth:(ka.copy(n.position),Y.multiplyVector3(ka),g.z=ka.z)}this.sortObjects&&p.sort(i);p=a.__webglObjectsImmediate;
-d=0;for(e=p.length;d<e;d++)if(g=p[d],n=g.object,n.visible)n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),v(n,b,!0),n=g.object.material,n.transparent?(g.transparent=n,g.opaque=null):(g.opaque=n,g.transparent=null);a.overrideMaterial?(x(a.overrideMaterial.blending),r(a.overrideMaterial.depthTest),s(a.overrideMaterial.depthWrite),u(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,q,t,!0,a.overrideMaterial),
-m(a.__webglObjectsImmediate,"",b,q,t,!1,a.overrideMaterial)):(x(THREE.NormalBlending),l(a.__webglObjects,!0,"opaque",b,q,t,!1),m(a.__webglObjectsImmediate,"opaque",b,q,t,!1),l(a.__webglObjects,!1,"transparent",b,q,t,!0),m(a.__webglObjectsImmediate,"transparent",b,q,t,!0));if(a.__webglSprites.length){n=K.attributes;q=K.uniforms;t=S/wa;d=[];e=wa*0.5;p=S*0.5;g=!0;j.useProgram(K.program);ga=K.program;M=fa=Z=-1;na||(j.enableVertexAttribArray(K.attributes.position),j.enableVertexAttribArray(K.attributes.uv),
-na=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,K.vertexBuffer);j.vertexAttribPointer(n.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(n.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,K.elementBuffer);j.uniformMatrix4fv(q.projectionMatrix,!1,ba);j.activeTexture(j.TEXTURE0);j.uniform1i(q.map,0);n=0;for(o=a.__webglSprites.length;n<o;n++)if(D=a.__webglSprites[n],D.visible&&D.opacity!==0)D.useScreenCoordinates?D.z=-D.position.z:(D._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,
-D.matrixWorld,D._modelViewMatrixArray),D.z=-D._modelViewMatrix.n34);a.__webglSprites.sort(i);n=0;for(o=a.__webglSprites.length;n<o;n++)D=a.__webglSprites[n],D.visible&&D.opacity!==0&&D.map&&D.map.image&&D.map.image.width&&(D.useScreenCoordinates?(j.uniform1i(q.useScreenCoordinates,1),j.uniform3f(q.screenPosition,(D.position.x-e)/e,(p-D.position.y)/p,Math.max(0,Math.min(1,D.position.z)))):(j.uniform1i(q.useScreenCoordinates,0),j.uniform1i(q.affectedByDistance,D.affectedByDistance?1:0),j.uniformMatrix4fv(q.modelViewMatrix,
-!1,D._modelViewMatrixArray)),b=D.map.image.width/(D.scaleByViewport?S:1),d[0]=b*t*D.scale.x,d[1]=b*D.scale.y,j.uniform2f(q.uvScale,D.uvScale.x,D.uvScale.y),j.uniform2f(q.uvOffset,D.uvOffset.x,D.uvOffset.y),j.uniform2f(q.alignment,D.alignment.x,D.alignment.y),j.uniform1f(q.opacity,D.opacity),j.uniform3f(q.color,D.color.r,D.color.g,D.color.b),j.uniform1f(q.rotation,D.rotation),j.uniform2fv(q.scale,d),D.mergeWith3D&&!g?(j.enable(j.DEPTH_TEST),g=!0):!D.mergeWith3D&&g&&(j.disable(j.DEPTH_TEST),g=!1),x(D.blending),
-F(D.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(la)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=
-[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],g=a,f=void 0,h=void 0,i=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups===void 0){var i=h,k=void 0,l=void 0,m=void 0,S=void 0,
-o=void 0,D=void 0,Y=void 0,r={},v=i.morphTargets.length;i.geometryGroups={};k=0;for(l=i.faces.length;k<l;k++)m=i.faces[k],S=m.materialIndex,D=S!==void 0?S:-1,r[D]===void 0&&(r[D]={hash:D,counter:0}),Y=r[D].hash+"_"+r[D].counter,i.geometryGroups[Y]===void 0&&(i.geometryGroups[Y]={faces3:[],faces4:[],materialIndex:S,vertices:0,numMorphTargets:v}),o=m instanceof THREE.Face3?3:4,i.geometryGroups[Y].vertices+o>65535&&(r[D].counter+=1,Y=r[D].hash+"_"+r[D].counter,i.geometryGroups[Y]===void 0&&(i.geometryGroups[Y]=
-{faces3:[],faces4:[],materialIndex:S,vertices:0,numMorphTargets:v})),m instanceof THREE.Face3?i.geometryGroups[Y].faces3.push(k):i.geometryGroups[Y].faces4.push(k),i.geometryGroups[Y].vertices+=o;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id=ea++,i.geometryGroupsList.push(i.geometryGroups[k])}for(f in h.geometryGroups)if(i=h.geometryGroups[f],!i.__webglVertexBuffer){k=i;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer=
-j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){m=l=void 0;k.__webglMorphTargetsBuffers=[];l=0;for(m=k.numMorphTargets;l<m;l++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}I.info.memory.geometries++;
-S=e;o=S.geometry;l=i.faces3;D=i.faces4;k=l.length*3+D.length*4;m=l.length*1+D.length*2;D=l.length*3+D.length*4;l=b(S,i);Y=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;r=l instanceof THREE.MeshBasicMaterial&&!l.envMap||l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;v=l.vertexColors?l.vertexColors:!1;i.__vertexArray=new Float32Array(k*3);if(r)i.__normalArray=new Float32Array(k*3);if(o.hasTangents)i.__tangentArray=
-new Float32Array(k*4);if(v)i.__colorArray=new Float32Array(k*3);if(Y){if(o.faceUvs.length>0||o.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(o.faceUvs.length>1||o.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(S.geometry.skinWeights.length&&S.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(m*3);
-i.__lineArray=new Uint16Array(D*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];S=0;for(o=i.numMorphTargets;S<o;S++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=r===THREE.SmoothShading;i.__uvType=Y;i.__vertexColorType=v;i.__normalType=r;i.__webglFaceCount=m*3;i.__webglLineCount=D*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];m=void 0;for(m in l.attributes){var S=l.attributes[m],o={},w;for(w in S)o[w]=S[w];if(!o.__webglInitialized||
-o.createUniqueBuffers)o.__webglInitialized=!0,D=1,o.type==="v2"?D=2:o.type==="v3"?D=3:o.type==="v4"?D=4:o.type==="c"&&(D=3),o.size=D,o.array=new Float32Array(k*D),o.buffer=j.createBuffer(),o.buffer.belongsToAttribute=m,S.needsUpdate=!0,o.__original=S;i.__webglCustomAttributesList.push(o)}}i.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,
-!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),I.info.memory.geometries++,i=h,k=i.vertices.length,i.__vertexArray=new Float32Array(k*3),i.__colorArray=new Float32Array(k*3),i.__webglVertexCount=k,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),I.info.memory.geometries++,i=h,k=e,l=i.vertices.length,
-i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__webglLineCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer))i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),I.info.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__sortArray=[],i.__webglParticleCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=
-!0;if(!e.__webglActive){if(e instanceof THREE.Mesh)for(f in h=e.geometry,h.geometryGroups)i=h.geometryGroups[f],q(g.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(h=e.geometry,q(g.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?g.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&g.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,
-1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];g=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)p(g.__webglObjects,e);else if(e instanceof THREE.Sprite){g=g.__webglSprites;f=e;for(h=g.length-1;h>=0;h--)g[h]===f&&g.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&p(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e<g;e++)if(w=
-a.__webglObjects[e].object,f=w.geometry,h=m=l=void 0,w instanceof THREE.Mesh){i=0;for(k=f.geometryGroupsList.length;i<k;i++)if(l=f.geometryGroupsList[i],h=b(w,l),m=h.attributes&&n(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||m)if(m=j.DYNAMIC_DRAW,S=!f.dynamic,l.__inittedArrays){var B=D=o=void 0,s=void 0,ba=void 0,ca=void 0,u=void 0,C=void 0,F=void 0,H=void 0,ka=void 0,Z=B=ca=void 0,x=void 0,z=void 0,y=void 0,G=
-s=void 0,ia=void 0,K=s=F=ka=void 0,N=void 0,fa=y=z=x=u=void 0,T=s=y=z=x=fa=y=z=x=fa=y=z=x=void 0,J=void 0,L=ca=void 0,O=void 0,Q=void 0,la=void 0,P=void 0,V=Z=Q=J=0,X=0,aa=T=B=0,M=u=G=0,E=0,R=void 0,M=l.__vertexArray,O=l.__uvArray,E=l.__uv2Array,L=l.__normalArray,ba=l.__tangentArray,ia=l.__colorArray,K=l.__skinVertexAArray,N=l.__skinVertexBArray,C=l.__skinIndexArray,U=l.__skinWeightArray,fa=l.__morphTargetsArrays,Y=l.__webglCustomAttributesList,A=void 0,A=l.__faceArray,R=l.__lineArray,da=l.__needsSmoothNormals,
-ka=l.__vertexColorType,H=l.__uvType,ca=l.__normalType,F=w.geometry,ga=F.__dirtyElements,$=F.__dirtyUvs,qa=F.__dirtyNormals,ja=F.__dirtyTangents,xa=F.__dirtyColors,la=F.__dirtyMorphTargets,P=F.vertices,r=l.faces3,v=l.faces4,ha=F.faces,ma=F.faceVertexUvs[0],ua=F.faceVertexUvs[1],ta=F.skinVerticesA,sa=F.skinVerticesB,ra=F.skinIndices,na=F.skinWeights,pa=F.morphTargets;if(F.__dirtyVertices){o=0;for(D=r.length;o<D;o++)s=ha[r[o]],x=P[s.a].position,z=P[s.b].position,y=P[s.c].position,M[Q]=x.x,M[Q+1]=x.y,
-M[Q+2]=x.z,M[Q+3]=z.x,M[Q+4]=z.y,M[Q+5]=z.z,M[Q+6]=y.x,M[Q+7]=y.y,M[Q+8]=y.z,Q+=9;o=0;for(D=v.length;o<D;o++)s=ha[v[o]],x=P[s.a].position,z=P[s.b].position,y=P[s.c].position,s=P[s.d].position,M[Q]=x.x,M[Q+1]=x.y,M[Q+2]=x.z,M[Q+3]=z.x,M[Q+4]=z.y,M[Q+5]=z.z,M[Q+6]=y.x,M[Q+7]=y.y,M[Q+8]=y.z,M[Q+9]=s.x,M[Q+10]=s.y,M[Q+11]=s.z,Q+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,M,m)}if(la){Q=0;for(la=pa.length;Q<la;Q++){o=M=0;for(D=r.length;o<D;o++)s=ha[r[o]],x=pa[Q].vertices[s.a].position,
-z=pa[Q].vertices[s.b].position,y=pa[Q].vertices[s.c].position,P=fa[Q],P[M]=x.x,P[M+1]=x.y,P[M+2]=x.z,P[M+3]=z.x,P[M+4]=z.y,P[M+5]=z.z,P[M+6]=y.x,P[M+7]=y.y,P[M+8]=y.z,M+=9;o=0;for(D=v.length;o<D;o++)s=ha[v[o]],x=pa[Q].vertices[s.a].position,z=pa[Q].vertices[s.b].position,y=pa[Q].vertices[s.c].position,s=pa[Q].vertices[s.d].position,P=fa[Q],P[M]=x.x,P[M+1]=x.y,P[M+2]=x.z,P[M+3]=z.x,P[M+4]=z.y,P[M+5]=z.z,P[M+6]=y.x,P[M+7]=y.y,P[M+8]=y.z,P[M+9]=s.x,P[M+10]=s.y,P[M+11]=s.z,M+=12;j.bindBuffer(j.ARRAY_BUFFER,
-l.__webglMorphTargetsBuffers[Q]);j.bufferData(j.ARRAY_BUFFER,fa[Q],m)}}if(na.length){o=0;for(D=r.length;o<D;o++)s=ha[r[o]],x=na[s.a],z=na[s.b],y=na[s.c],U[u]=x.x,U[u+1]=x.y,U[u+2]=x.z,U[u+3]=x.w,U[u+4]=z.x,U[u+5]=z.y,U[u+6]=z.z,U[u+7]=z.w,U[u+8]=y.x,U[u+9]=y.y,U[u+10]=y.z,U[u+11]=y.w,x=ra[s.a],z=ra[s.b],y=ra[s.c],C[u]=x.x,C[u+1]=x.y,C[u+2]=x.z,C[u+3]=x.w,C[u+4]=z.x,C[u+5]=z.y,C[u+6]=z.z,C[u+7]=z.w,C[u+8]=y.x,C[u+9]=y.y,C[u+10]=y.z,C[u+11]=y.w,x=ta[s.a],z=ta[s.b],y=ta[s.c],K[u]=x.x,K[u+1]=x.y,K[u+
-2]=x.z,K[u+3]=1,K[u+4]=z.x,K[u+5]=z.y,K[u+6]=z.z,K[u+7]=1,K[u+8]=y.x,K[u+9]=y.y,K[u+10]=y.z,K[u+11]=1,x=sa[s.a],z=sa[s.b],y=sa[s.c],N[u]=x.x,N[u+1]=x.y,N[u+2]=x.z,N[u+3]=1,N[u+4]=z.x,N[u+5]=z.y,N[u+6]=z.z,N[u+7]=1,N[u+8]=y.x,N[u+9]=y.y,N[u+10]=y.z,N[u+11]=1,u+=12;o=0;for(D=v.length;o<D;o++)s=ha[v[o]],x=na[s.a],z=na[s.b],y=na[s.c],fa=na[s.d],U[u]=x.x,U[u+1]=x.y,U[u+2]=x.z,U[u+3]=x.w,U[u+4]=z.x,U[u+5]=z.y,U[u+6]=z.z,U[u+7]=z.w,U[u+8]=y.x,U[u+9]=y.y,U[u+10]=y.z,U[u+11]=y.w,U[u+12]=fa.x,U[u+13]=fa.y,
-U[u+14]=fa.z,U[u+15]=fa.w,x=ra[s.a],z=ra[s.b],y=ra[s.c],fa=ra[s.d],C[u]=x.x,C[u+1]=x.y,C[u+2]=x.z,C[u+3]=x.w,C[u+4]=z.x,C[u+5]=z.y,C[u+6]=z.z,C[u+7]=z.w,C[u+8]=y.x,C[u+9]=y.y,C[u+10]=y.z,C[u+11]=y.w,C[u+12]=fa.x,C[u+13]=fa.y,C[u+14]=fa.z,C[u+15]=fa.w,x=ta[s.a],z=ta[s.b],y=ta[s.c],fa=ta[s.d],K[u]=x.x,K[u+1]=x.y,K[u+2]=x.z,K[u+3]=1,K[u+4]=z.x,K[u+5]=z.y,K[u+6]=z.z,K[u+7]=1,K[u+8]=y.x,K[u+9]=y.y,K[u+10]=y.z,K[u+11]=1,K[u+12]=fa.x,K[u+13]=fa.y,K[u+14]=fa.z,K[u+15]=1,x=sa[s.a],z=sa[s.b],y=sa[s.c],s=sa[s.d],
-N[u]=x.x,N[u+1]=x.y,N[u+2]=x.z,N[u+3]=1,N[u+4]=z.x,N[u+5]=z.y,N[u+6]=z.z,N[u+7]=1,N[u+8]=y.x,N[u+9]=y.y,N[u+10]=y.z,N[u+11]=1,N[u+12]=s.x,N[u+13]=s.y,N[u+14]=s.z,N[u+15]=1,u+=16;u>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,K,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,N,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,C,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),
-j.bufferData(j.ARRAY_BUFFER,U,m))}if(xa&&ka){o=0;for(D=r.length;o<D;o++)s=ha[r[o]],u=s.vertexColors,C=s.color,u.length===3&&ka===THREE.VertexColors?(s=u[0],K=u[1],N=u[2]):N=K=s=C,ia[G]=s.r,ia[G+1]=s.g,ia[G+2]=s.b,ia[G+3]=K.r,ia[G+4]=K.g,ia[G+5]=K.b,ia[G+6]=N.r,ia[G+7]=N.g,ia[G+8]=N.b,G+=9;o=0;for(D=v.length;o<D;o++)s=ha[v[o]],u=s.vertexColors,C=s.color,u.length===4&&ka===THREE.VertexColors?(s=u[0],K=u[1],N=u[2],u=u[3]):u=N=K=s=C,ia[G]=s.r,ia[G+1]=s.g,ia[G+2]=s.b,ia[G+3]=K.r,ia[G+4]=K.g,ia[G+5]=K.b,
-ia[G+6]=N.r,ia[G+7]=N.g,ia[G+8]=N.b,ia[G+9]=u.r,ia[G+10]=u.g,ia[G+11]=u.b,G+=12;G>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,ia,m))}if(ja&&F.hasTangents){o=0;for(D=r.length;o<D;o++)s=ha[r[o]],F=s.vertexTangents,G=F[0],ia=F[1],ka=F[2],ba[T]=G.x,ba[T+1]=G.y,ba[T+2]=G.z,ba[T+3]=G.w,ba[T+4]=ia.x,ba[T+5]=ia.y,ba[T+6]=ia.z,ba[T+7]=ia.w,ba[T+8]=ka.x,ba[T+9]=ka.y,ba[T+10]=ka.z,ba[T+11]=ka.w,T+=12;o=0;for(D=v.length;o<D;o++)s=ha[v[o]],F=s.vertexTangents,G=F[0],ia=F[1],
-ka=F[2],F=F[3],ba[T]=G.x,ba[T+1]=G.y,ba[T+2]=G.z,ba[T+3]=G.w,ba[T+4]=ia.x,ba[T+5]=ia.y,ba[T+6]=ia.z,ba[T+7]=ia.w,ba[T+8]=ka.x,ba[T+9]=ka.y,ba[T+10]=ka.z,ba[T+11]=ka.w,ba[T+12]=F.x,ba[T+13]=F.y,ba[T+14]=F.z,ba[T+15]=F.w,T+=16;j.bindBuffer(j.ARRAY_BUFFER,l.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,ba,m)}if(qa&&ca){o=0;for(D=r.length;o<D;o++)if(s=ha[r[o]],ba=s.vertexNormals,ca=s.normal,ba.length===3&&da)for(T=0;T<3;T++)ca=ba[T],L[B]=ca.x,L[B+1]=ca.y,L[B+2]=ca.z,B+=3;else for(T=0;T<3;T++)L[B]=
-ca.x,L[B+1]=ca.y,L[B+2]=ca.z,B+=3;o=0;for(D=v.length;o<D;o++)if(s=ha[v[o]],ba=s.vertexNormals,ca=s.normal,ba.length===4&&da)for(T=0;T<4;T++)ca=ba[T],L[B]=ca.x,L[B+1]=ca.y,L[B+2]=ca.z,B+=3;else for(T=0;T<4;T++)L[B]=ca.x,L[B+1]=ca.y,L[B+2]=ca.z,B+=3;j.bindBuffer(j.ARRAY_BUFFER,l.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,L,m)}if($&&ma&&H){o=0;for(D=r.length;o<D;o++)if(B=r[o],B=ma[B],B!==void 0)for(T=0;T<3;T++)L=B[T],O[Z]=L.u,O[Z+1]=L.v,Z+=2;o=0;for(D=v.length;o<D;o++)if(B=v[o],B=ma[B],B!==void 0)for(T=
-0;T<4;T++)L=B[T],O[Z]=L.u,O[Z+1]=L.v,Z+=2;Z>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,O,m))}if($&&ua&&H){o=0;for(D=r.length;o<D;o++)if(B=r[o],Z=ua[B],Z!==void 0)for(T=0;T<3;T++)O=Z[T],E[V]=O.u,E[V+1]=O.v,V+=2;o=0;for(D=v.length;o<D;o++)if(B=v[o],Z=ua[B],Z!==void 0)for(T=0;T<4;T++)O=Z[T],E[V]=O.u,E[V+1]=O.v,V+=2;V>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,E,m))}if(ga){o=0;for(D=r.length;o<D;o++)A[X]=J,A[X+1]=J+1,A[X+2]=J+2,
-X+=3,R[aa]=J,R[aa+1]=J+1,R[aa+2]=J,R[aa+3]=J+2,R[aa+4]=J+1,R[aa+5]=J+2,aa+=6,J+=3;o=0;for(D=v.length;o<D;o++)A[X]=J,A[X+1]=J+1,A[X+2]=J+3,A[X+3]=J+1,A[X+4]=J+2,A[X+5]=J+3,X+=6,R[aa]=J,R[aa+1]=J+1,R[aa+2]=J,R[aa+3]=J+3,R[aa+4]=J+1,R[aa+5]=J+2,R[aa+6]=J+2,R[aa+7]=J+3,aa+=8,J+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,A,m);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,R,m)}if(Y){T=0;for(J=Y.length;T<J;T++)if(A=
-Y[T],A.__original.needsUpdate){E=0;if(A.size===1)if(A.boundTo===void 0||A.boundTo==="vertices"){o=0;for(D=r.length;o<D;o++)s=ha[r[o]],A.array[E]=A.value[s.a],A.array[E+1]=A.value[s.b],A.array[E+2]=A.value[s.c],E+=3;o=0;for(D=v.length;o<D;o++)s=ha[v[o]],A.array[E]=A.value[s.a],A.array[E+1]=A.value[s.b],A.array[E+2]=A.value[s.c],A.array[E+3]=A.value[s.d],E+=4}else{if(A.boundTo==="faces"){o=0;for(D=r.length;o<D;o++)R=A.value[r[o]],A.array[E]=R,A.array[E+1]=R,A.array[E+2]=R,E+=3;o=0;for(D=v.length;o<
-D;o++)R=A.value[v[o]],A.array[E]=R,A.array[E+1]=R,A.array[E+2]=R,A.array[E+3]=R,E+=4}}else if(A.size===2)if(A.boundTo===void 0||A.boundTo==="vertices"){o=0;for(D=r.length;o<D;o++)s=ha[r[o]],x=A.value[s.a],z=A.value[s.b],y=A.value[s.c],A.array[E]=x.x,A.array[E+1]=x.y,A.array[E+2]=z.x,A.array[E+3]=z.y,A.array[E+4]=y.x,A.array[E+5]=y.y,E+=6;o=0;for(D=v.length;o<D;o++)s=ha[v[o]],x=A.value[s.a],z=A.value[s.b],y=A.value[s.c],s=A.value[s.d],A.array[E]=x.x,A.array[E+1]=x.y,A.array[E+2]=z.x,A.array[E+3]=z.y,
-A.array[E+4]=y.x,A.array[E+5]=y.y,A.array[E+6]=s.x,A.array[E+7]=s.y,E+=8}else{if(A.boundTo==="faces"){o=0;for(D=r.length;o<D;o++)y=z=x=R=A.value[r[o]],A.array[E]=x.x,A.array[E+1]=x.y,A.array[E+2]=z.x,A.array[E+3]=z.y,A.array[E+4]=y.x,A.array[E+5]=y.y,E+=6;o=0;for(D=v.length;o<D;o++)s=y=z=x=R=A.value[v[o]],A.array[E]=x.x,A.array[E+1]=x.y,A.array[E+2]=z.x,A.array[E+3]=z.y,A.array[E+4]=y.x,A.array[E+5]=y.y,A.array[E+6]=s.x,A.array[E+7]=s.y,E+=8}}else if(A.size===3)if(V=A.type==="c"?["r","g","b"]:["x",
-"y","z"],A.boundTo===void 0||A.boundTo==="vertices"){o=0;for(D=r.length;o<D;o++)s=ha[r[o]],x=A.value[s.a],z=A.value[s.b],y=A.value[s.c],A.array[E]=x[V[0]],A.array[E+1]=x[V[1]],A.array[E+2]=x[V[2]],A.array[E+3]=z[V[0]],A.array[E+4]=z[V[1]],A.array[E+5]=z[V[2]],A.array[E+6]=y[V[0]],A.array[E+7]=y[V[1]],A.array[E+8]=y[V[2]],E+=9;o=0;for(D=v.length;o<D;o++)s=ha[v[o]],x=A.value[s.a],z=A.value[s.b],y=A.value[s.c],s=A.value[s.d],A.array[E]=x[V[0]],A.array[E+1]=x[V[1]],A.array[E+2]=x[V[2]],A.array[E+3]=z[V[0]],
-A.array[E+4]=z[V[1]],A.array[E+5]=z[V[2]],A.array[E+6]=y[V[0]],A.array[E+7]=y[V[1]],A.array[E+8]=y[V[2]],A.array[E+9]=s[V[0]],A.array[E+10]=s[V[1]],A.array[E+11]=s[V[2]],E+=12}else{if(A.boundTo==="faces"){o=0;for(D=r.length;o<D;o++)y=z=x=R=A.value[r[o]],A.array[E]=x[V[0]],A.array[E+1]=x[V[1]],A.array[E+2]=x[V[2]],A.array[E+3]=z[V[0]],A.array[E+4]=z[V[1]],A.array[E+5]=z[V[2]],A.array[E+6]=y[V[0]],A.array[E+7]=y[V[1]],A.array[E+8]=y[V[2]],E+=9;o=0;for(D=v.length;o<D;o++)s=y=z=x=R=A.value[v[o]],A.array[E]=
-x[V[0]],A.array[E+1]=x[V[1]],A.array[E+2]=x[V[2]],A.array[E+3]=z[V[0]],A.array[E+4]=z[V[1]],A.array[E+5]=z[V[2]],A.array[E+6]=y[V[0]],A.array[E+7]=y[V[1]],A.array[E+8]=y[V[2]],A.array[E+9]=s[V[0]],A.array[E+10]=s[V[1]],A.array[E+11]=s[V[2]],E+=12}}else if(A.size===4)if(A.boundTo===void 0||A.boundTo==="vertices"){o=0;for(D=r.length;o<D;o++)s=ha[r[o]],x=A.value[s.a],z=A.value[s.b],y=A.value[s.c],A.array[E]=x.x,A.array[E+1]=x.y,A.array[E+2]=x.z,A.array[E+3]=x.w,A.array[E+4]=z.x,A.array[E+5]=z.y,A.array[E+
-6]=z.z,A.array[E+7]=z.w,A.array[E+8]=y.x,A.array[E+9]=y.y,A.array[E+10]=y.z,A.array[E+11]=y.w,E+=12;o=0;for(D=v.length;o<D;o++)s=ha[v[o]],x=A.value[s.a],z=A.value[s.b],y=A.value[s.c],s=A.value[s.d],A.array[E]=x.x,A.array[E+1]=x.y,A.array[E+2]=x.z,A.array[E+3]=x.w,A.array[E+4]=z.x,A.array[E+5]=z.y,A.array[E+6]=z.z,A.array[E+7]=z.w,A.array[E+8]=y.x,A.array[E+9]=y.y,A.array[E+10]=y.z,A.array[E+11]=y.w,A.array[E+12]=s.x,A.array[E+13]=s.y,A.array[E+14]=s.z,A.array[E+15]=s.w,E+=16}else if(A.boundTo==="faces"){o=
-0;for(D=r.length;o<D;o++)y=z=x=R=A.value[r[o]],A.array[E]=x.x,A.array[E+1]=x.y,A.array[E+2]=x.z,A.array[E+3]=x.w,A.array[E+4]=z.x,A.array[E+5]=z.y,A.array[E+6]=z.z,A.array[E+7]=z.w,A.array[E+8]=y.x,A.array[E+9]=y.y,A.array[E+10]=y.z,A.array[E+11]=y.w,E+=12;o=0;for(D=v.length;o<D;o++)s=y=z=x=R=A.value[v[o]],A.array[E]=x.x,A.array[E+1]=x.y,A.array[E+2]=x.z,A.array[E+3]=x.w,A.array[E+4]=z.x,A.array[E+5]=z.y,A.array[E+6]=z.z,A.array[E+7]=z.w,A.array[E+8]=y.x,A.array[E+9]=y.y,A.array[E+10]=y.z,A.array[E+
-11]=y.w,A.array[E+12]=s.x,A.array[E+13]=s.y,A.array[E+14]=s.z,A.array[E+15]=s.w,E+=16}j.bindBuffer(j.ARRAY_BUFFER,A.buffer);j.bufferData(j.ARRAY_BUFFER,A.array,m)}}S&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}f.__dirtyVertices=!1;f.__dirtyMorphTargets=
-!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyColors=!1;f.__dirtyTangents=!1;h.attributes&&t(h)}else if(w instanceof THREE.Ribbon){if(f.__dirtyVertices||f.__dirtyColors){h=f;w=j.DYNAMIC_DRAW;o=i=o=S=S=void 0;D=h.vertices;k=h.colors;Y=D.length;l=k.length;r=h.__vertexArray;m=h.__colorArray;v=h.__dirtyColors;if(h.__dirtyVertices){for(S=0;S<Y;S++)o=D[S].position,i=S*3,r[i]=o.x,r[i+1]=o.y,r[i+2]=o.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,r,
-w)}if(v){for(S=0;S<l;S++)o=k[S],i=S*3,m[i]=o.r,m[i+1]=o.g,m[i+2]=o.b;j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,m,w)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(w instanceof THREE.Line){h=b(w,l);m=h.attributes&&n(h);if(f.__dirtyVertices||f.__dirtyColors||m){w=f;i=j.DYNAMIC_DRAW;Y=k=J=D=ha=void 0;D=w.vertices;l=w.colors;Y=D.length;m=l.length;r=w.__vertexArray;S=w.__colorArray;v=w.__dirtyColors;o=w.__webglCustomAttributesList;Z=aa=X=V=J=ha=void 0;if(w.__dirtyVertices){for(ha=
-0;ha<Y;ha++)J=D[ha].position,k=ha*3,r[k]=J.x,r[k+1]=J.y,r[k+2]=J.z;j.bindBuffer(j.ARRAY_BUFFER,w.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,r,i)}if(v){for(D=0;D<m;D++)Y=l[D],k=D*3,S[k]=Y.r,S[k+1]=Y.g,S[k+2]=Y.b;j.bindBuffer(j.ARRAY_BUFFER,w.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,S,i)}if(o){ha=0;for(J=o.length;ha<J;ha++)if(Z=o[ha],Z.needsUpdate&&(Z.boundTo===void 0||Z.boundTo==="vertices")){k=0;X=Z.value.length;if(Z.size===1)for(V=0;V<X;V++)Z.array[V]=Z.value[V];else if(Z.size===2)for(V=
-0;V<X;V++)aa=Z.value[V],Z.array[k]=aa.x,Z.array[k+1]=aa.y,k+=2;else if(Z.size===3)if(Z.type==="c")for(V=0;V<X;V++)aa=Z.value[V],Z.array[k]=aa.r,Z.array[k+1]=aa.g,Z.array[k+2]=aa.b,k+=3;else for(V=0;V<X;V++)aa=Z.value[V],Z.array[k]=aa.x,Z.array[k+1]=aa.y,Z.array[k+2]=aa.z,k+=3;else if(Z.size===4)for(V=0;V<X;V++)aa=Z.value[V],Z.array[k]=aa.x,Z.array[k+1]=aa.y,Z.array[k+2]=aa.z,Z.array[k+3]=aa.w,k+=4;j.bindBuffer(j.ARRAY_BUFFER,Z.buffer);j.bufferData(j.ARRAY_BUFFER,Z.array,i)}}}f.__dirtyVertices=!1;
-f.__dirtyColors=!1;h.attributes&&t(h)}else if(w instanceof THREE.ParticleSystem)h=b(w,l),m=h.attributes&&n(h),(f.__dirtyVertices||f.__dirtyColors||w.sortParticles||m)&&d(f,j.DYNAMIC_DRAW,w),f.__dirtyVertices=!1,f.__dirtyColors=!1,h.attributes&&t(h)};this.initMaterial=function(a,b,c,d){var e,g,f,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof
-THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var k,l,n;k=n=i=0;for(l=b.length;k<l;k++)f=b[k],f instanceof THREE.SpotLight&&n++,f instanceof THREE.DirectionalLight&&n++,f instanceof THREE.PointLight&&i++;i+n<=B?k=n:(k=Math.ceil(B*n/(i+n)),i=B-k);f={directional:k,
-point:i};i=n=0;for(k=b.length;i<k;i++)l=b[i],l instanceof THREE.SpotLight&&l.castShadow&&n++;var m=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)m=d.bones.length;var o;a:{k=a.fragmentShader;l=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:f.directional,maxPointLights:f.point,
-maxBones:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(k),d.push(l));for(p in c)d.push(p),d.push(c[p]);h=d.join();p=0;for(d=N.length;p<d;p++)if(N[p].code===h){o=N[p].program;break a}p=j.createProgram();d=[ta?"#define VERTEX_TEXTURES":"",I.gammaInput?"#define GAMMA_INPUT":"",I.gammaOutput?
-"#define GAMMA_OUTPUT":"",I.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?
-"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-f=["#ifdef GL_ES","precision "+L+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",I.gammaInput?"#define GAMMA_INPUT":"",I.gammaOutput?"#define GAMMA_OUTPUT":"",I.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
-"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(p,H("fragment",f+k));j.attachShader(p,
-H("vertex",d+l));j.linkProgram(p);j.getProgramParameter(p,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(p,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");p.uniforms={};p.attributes={};var q,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in i)d.push(q);q=d;d=0;for(i=q.length;d<i;d++)k=q[d],p.uniforms[k]=j.getUniformLocation(p,
-k);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<c.maxMorphTargets;q++)d.push("morphTarget"+q);for(o in b)d.push(o);o=d;q=0;for(b=o.length;q<b;q++)c=o[q],p.attributes[c]=j.getAttribLocation(p,c);p.id=N.length;N.push({program:p,code:h});I.info.memory.programs=N.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=0&&j.enableVertexAttribArray(o.normal);
-o.tangent>=0&&j.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(j.enableVertexAttribArray(o.skinVertexA),j.enableVertexAttribArray(o.skinVertexB),j.enableVertexAttribArray(o.skinIndex),j.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(g in a.attributes)o[g]!==void 0&&o[g]>=0&&j.enableVertexAttribArray(o[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)q="morphTarget"+g,o[q]>=0&&(j.enableVertexAttribArray(o[q]),
+4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ua&&(j.lineWidth(d),ua=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),L.info.render.calls++,L.info.render.vertices+=
+e.__webglFaceCount,L.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==ua&&(j.lineWidth(d),ua=d),j.drawArrays(g,0,e.__webglLineCount),L.info.render.calls++):g instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),L.info.render.calls++):g instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),L.info.render.calls++)}}function f(a){u[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
+a.n13,a.n44-a.n14);u[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);u[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);u[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);u[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);u[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=u[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
+a.scale.z)),d=0;d<6;d++)if(a=u[d].x*b.n14+u[d].y*b.n24+u[d].z*b.n34+u[d].w,a<=c)return!1;return!0}function i(a,b){return b.z-a.z}function k(a){var b,c,d,i,m,k,l,n,p=0,o=a.lights;ha||(ha=new THREE.PerspectiveCamera(L.shadowCameraFov,L.shadowMapWidth/L.shadowMapHeight,L.shadowCameraNear,L.shadowCameraFar));b=0;for(c=o.length;b<c;b++)if(n=o[b],n.castShadow&&n instanceof THREE.SpotLight){S=-1;L.shadowMap[p]||(L.shadowMap[p]=new THREE.WebGLRenderTarget(L.shadowMapWidth,L.shadowMapHeight,{minFilter:THREE.LinearFilter,
+magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),ba[p]=new THREE.Matrix4);d=L.shadowMap[p];i=ba[p];ha.position.copy(n.position);ha.lookAt(n.target.position);ha.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ha));this.autoUpdateScene&&a.updateMatrixWorld();ha.matrixWorldInverse.getInverse(ha.matrixWorld);i.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);i.multiplySelf(ha.projectionMatrix);i.multiplySelf(ha.matrixWorldInverse);ha.matrixWorldInverse.flattenToArray(ga);
+ha.projectionMatrix.flattenToArray(E);J.multiply(ha.projectionMatrix,ha.matrixWorldInverse);f(J);D(d);j.clearColor(1,1,1,1);L.clear();j.clearColor(T.r,T.g,T.b,z);i=a.__webglObjects.length;for(d=0;d<i;d++)if(k=a.__webglObjects[d],n=k.object,k.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||h(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),t(n,ha,!1),k.render=!0;q(!0);x(THREE.NormalBlending);for(d=0;d<i;d++)if(k=a.__webglObjects[d],k.render)n=k.object,k=k.buffer,
+w(n),l=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?xa:ia,e(ha,o,null,l,k,n);i=a.__webglObjectsImmediate.length;for(d=0;d<i;d++)k=a.__webglObjectsImmediate[d],n=k.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),O=-1,t(n,ha,!1),w(n),m=r(ha,o,null,ia,n),n.immediateRenderCallback?n.immediateRenderCallback(m,j,u):n.render(function(a){g(a,m,ia.shading)}));p++}}function l(a,b,c,d,g,f,h,j){var i,k,m,l;b?(k=a.length-1,l=
+b=-1):(k=0,b=a.length,l=1);for(var n=k;n!==b;n+=l)if(i=a[n],i.render){k=i.object;m=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;h&&x(i.blending);q(i.depthTest);C(i.depthWrite);v(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}w(k);e(d,g,f,i,m,k)}}function n(a,b,c,d,e,f,h){for(var i,k,m,l,n=0,p=a.length;n<p;n++)if(i=a[n],k=i.object,k.visible){O=-1;if(h)m=h;else{m=i[b];if(!m)continue;f&&x(m.blending);q(m.depthTest);C(m.depthWrite);v(m.polygonOffset,m.polygonOffsetFactor,m.polygonOffsetUnits)}w(k);
+l=r(c,d,e,m,k);k.immediateRenderCallback?k.immediateRenderCallback(l,j,u):k.render(function(a){g(a,l,m.shading)})}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function s(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function p(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function r(a,b,c,d,e){d.program||L.initMaterial(d,b,c,e);if(d.morphTargets&&
+!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(L.maxMorphTargets);for(var g=0,f=L.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==fa&&(j.useProgram(g),fa=g,h=!0);if(d.id!==S)S=d.id,h=!0;if(h){j.uniformMatrix4fv(f.projectionMatrix,!1,E);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;
+if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var k,m,l=0,n=0,p=0,o,U,s,J=W,q=J.directional.colors,r=J.directional.positions,u=J.point.colors,t=J.point.positions,w=J.point.distances,C=0,B=0,c=k=s=0,h=b.length;c<h;c++)if(k=b[c],m=k.color,o=k.position,U=k.intensity,s=k.distance,k instanceof THREE.AmbientLight)L.gammaInput?(l+=m.r*m.r,n+=m.g*m.g,p+=m.b*m.b):(l+=m.r,n+=m.g,p+=m.b);else if(k instanceof THREE.DirectionalLight)s=C*3,L.gammaInput?(q[s]=m.r*
+m.r*U*U,q[s+1]=m.g*m.g*U*U,q[s+2]=m.b*m.b*U*U):(q[s]=m.r*U,q[s+1]=m.g*U,q[s+2]=m.b*U),r[s]=o.x,r[s+1]=o.y,r[s+2]=o.z,C+=1;else if(k instanceof THREE.SpotLight)s=C*3,L.gammaInput?(q[s]=m.r*m.r*U*U,q[s+1]=m.g*m.g*U*U,q[s+2]=m.b*m.b*U*U):(q[s]=m.r*U,q[s+1]=m.g*U,q[s+2]=m.b*U),m=1/o.length(),r[s]=o.x*m,r[s+1]=o.y*m,r[s+2]=o.z*m,C+=1;else if(k instanceof THREE.PointLight)k=B*3,L.gammaInput?(u[k]=m.r*m.r*U*U,u[k+1]=m.g*m.g*U*U,u[k+2]=m.b*m.b*U*U):(u[k]=m.r*U,u[k+1]=m.g*U,u[k+2]=m.b*U),t[k]=o.x,t[k+1]=o.y,
+t[k+2]=o.z,w[B]=s,B+=1;c=C*3;for(h=q.length;c<h;c++)q[c]=0;c=B*3;for(h=u.length;c<h;c++)u[c]=0;J.point.length=B;J.directional.length=C;J.ambient[0]=l;J.ambient[1]=n;J.ambient[2]=p;b=W;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof
+THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,L.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=
+d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=aa.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,L.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):
+(i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof THREE.MeshLambertMaterial)L.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<ba.length;b++)i.shadowMatrix.value[b]=ba[b],i.shadowMap.texture[b]=L.shadowMap[b];
+i.shadowDarkness.value=L.shadowMapDarkness;i.shadowBias.value=L.shadowMapBias}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(n=g.uniforms[b[i][1]])if(l=b[i][0],p=l.type,h=l.value,p==="i")j.uniform1i(n,h);else if(p==="f")j.uniform1f(n,h);else if(p==="v2")j.uniform2f(n,h.x,h.y);else if(p==="v3")j.uniform3f(n,h.x,h.y,h.z);else if(p==="v4")j.uniform4f(n,h.x,h.y,h.z,h.w);else if(p==="c")j.uniform3f(n,h.r,h.g,h.b);else if(p==="fv1")j.uniform1fv(n,h);else if(p==="fv")j.uniform3fv(n,h);else if(p==="v3v"){if(!l._array)l._array=
+new Float32Array(3*h.length);p=0;for(o=h.length;p<o;p++)J=p*3,l._array[J]=h[p].x,l._array[J+1]=h[p].y,l._array[J+2]=h[p].z;j.uniform3fv(n,l._array)}else if(p==="m4"){if(!l._array)l._array=new Float32Array(16);h.flattenToArray(l._array);j.uniformMatrix4fv(n,!1,l._array)}else if(p==="m4v"){if(!l._array)l._array=new Float32Array(16*h.length);p=0;for(o=h.length;p<o;p++)h[p].flattenToArrayOffset(l._array,p*16);j.uniformMatrix4fv(n,!1,l._array)}else if(p==="t"){if(j.uniform1i(n,h),n=l.texture)if(n.image instanceof
+Array&&n.image.length===6){if(l=n,l.image.length===6)if(l.needsUpdate){if(!l.image.__webglTextureCube)l.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+h);j.bindTexture(j.TEXTURE_CUBE_MAP,l.image.__webglTextureCube);for(h=0;h<6;h++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,l.image[h]);K(j.TEXTURE_CUBE_MAP,l,l.image[0]);l.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,l.image.__webglTextureCube)}else n instanceof
+THREE.WebGLRenderTargetCube?(l=n,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,l.__webglTexture)):G(n,h)}else if(p==="tv"){if(!l._array){l._array=[];p=0;for(o=l.texture.length;p<o;p++)l._array[p]=h+p}j.uniform1iv(n,l._array);p=0;for(o=l.texture.length;p<o;p++)(n=l.texture[p])&&G(n,l._array[p])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&f.cameraPosition!==null&&j.uniform3f(f.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof
+THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&f.viewMatrix!==null&&j.uniformMatrix4fv(f.viewMatrix,!1,ga);d.skinning&&(j.uniformMatrix4fv(f.cameraInverseMatrix,!1,ga),j.uniformMatrix4fv(f.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(f.modelViewMatrix,!1,e._modelViewMatrixArray);f.normalMatrix&&j.uniformMatrix3fv(f.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&
+f.objectMatrix!==null&&j.uniformMatrix4fv(f.objectMatrix,!1,e._objectMatrixArray);return g}function t(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function w(a){if(V!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),V=a.doubleSided;if(ca!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ca=a.flipSided}function q(a){Y!==
+a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),Y=a)}function C(a){ka!==a&&(j.depthMask(a),ka=a)}function v(a,b,c){qa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),qa=a);if(a&&(ma!==b||sa!==c))j.polygonOffset(b,c),ma=b,sa=c}function x(a){if(a!==$){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);
+j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}$=a}}function I(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(b),null;return c}function K(a,b,c){(c.width&c.width-1)===
+0&&(c.height&c.height-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,H(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,H(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,H(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,H(b.minFilter)),j.generateMipmap(a)):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,Q(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,Q(b.minFilter)))}function G(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
+!0,a.__webglTexture=j.createTexture(),L.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,H(a.format),a.image.width,a.image.height,0,H(a.format),j.UNSIGNED_BYTE,a.image.data):j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,a.image);K(j.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)}function y(a,b){j.bindRenderbuffer(j.RENDERBUFFER,
+a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function D(a){var b=a instanceof THREE.WebGLRenderTargetCube;
+if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);K(j.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,H(a.format),a.width,a.height,0,H(a.format),H(a.type),
+null);var d=a,e=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,e,d.__webglTexture,0);y(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),K(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,H(a.format),a.width,a.height,0,H(a.format),H(a.type),null),c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,
+a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,c,a.__webglTexture,0),j.bindRenderbuffer(j.RENDERBUFFER,a.__webglRenderbuffer),y(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=wa,a=U,d=pa,e=ra);b!==Z&&(j.bindFramebuffer(j.FRAMEBUFFER,b),
+j.viewport(d,e,c,a),Z=b)}function Q(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function H(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;
+case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;
+case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var a=a||{},aa=a.canvas!==void 0?a.canvas:document.createElement("canvas"),M=a.precision!==void 0?a.precision:"highp",R=a.antialias!==void 0?a.antialias:!1,da=a.stencil!==void 0?a.stencil:!0,ja=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,T=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),
+z=a.clearAlpha!==void 0?a.clearAlpha:0,B=a.maxLights!==void 0?a.maxLights:4;this.domElement=aa;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=
+[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var L=this,j,P=[],fa=null,Z=null,S=-1,O=null,ea=0,V=null,ca=null,$=null,Y=null,ka=null,qa=null,ma=null,sa=null,ua=null,pa=0,ra=0,wa=0,U=0,u=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Matrix4,E=new Float32Array(16),ga=new Float32Array(16),
+la=new THREE.Vector4,W={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},ha,ba=[],ia,xa,N={},na=!1;j=function(){var a;try{if(!(a=aa.getContext("experimental-webgl",{antialias:R,stencil:da,preserveDrawingBuffer:ja})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();
+j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(T.r,T.g,T.b,z);(function(){N.vertices=new Float32Array(16);N.faces=new Uint16Array(6);var a=0;N.vertices[a++]=-1;N.vertices[a++]=-1;N.vertices[a++]=0;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=-1;N.vertices[a++]=1;N.vertices[a++]=
+1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=0;N.vertices[a++]=-1;N.vertices[a++]=1;N.vertices[a++]=0;a=N.vertices[a++]=0;N.faces[a++]=0;N.faces[a++]=1;N.faces[a++]=2;N.faces[a++]=0;N.faces[a++]=2;N.faces[a++]=3;N.vertexBuffer=j.createBuffer();N.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,N.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,N.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,N.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,N.faces,j.STATIC_DRAW);
+N.program=j.createProgram();j.attachShader(N.program,I("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(N.program,I("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(N.program);N.attributes={};N.uniforms={};N.attributes.position=j.getAttribLocation(N.program,"position");N.attributes.uv=j.getAttribLocation(N.program,"uv");N.uniforms.uvOffset=j.getUniformLocation(N.program,"uvOffset");N.uniforms.uvScale=j.getUniformLocation(N.program,"uvScale");N.uniforms.rotation=j.getUniformLocation(N.program,
+"rotation");N.uniforms.scale=j.getUniformLocation(N.program,"scale");N.uniforms.alignment=j.getUniformLocation(N.program,"alignment");N.uniforms.color=j.getUniformLocation(N.program,"color");N.uniforms.map=j.getUniformLocation(N.program,"map");N.uniforms.opacity=j.getUniformLocation(N.program,"opacity");N.uniforms.useScreenCoordinates=j.getUniformLocation(N.program,"useScreenCoordinates");N.uniforms.affectedByDistance=j.getUniformLocation(N.program,"affectedByDistance");N.uniforms.screenPosition=
+j.getUniformLocation(N.program,"screenPosition");N.uniforms.modelViewMatrix=j.getUniformLocation(N.program,"modelViewMatrix");N.uniforms.projectionMatrix=j.getUniformLocation(N.program,"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);ia=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});xa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});
+ia._shadowPass=!0;xa._shadowPass=!0})();this.context=j;var ta=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=function(){return ta};this.setSize=function(a,b){aa.width=a;aa.height=b;this.setViewport(0,0,aa.width,aa.height)};this.setViewport=function(a,b,c,d){pa=a;ra=b;wa=c;U=d;j.viewport(pa,ra,wa,U)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};
+this.setClearColorHex=function(a,b){T.setHex(a);z=b;j.clearColor(T.r,T.g,T.b,z)};this.setClearColor=function(a,b){T.copy(a);z=b;j.clearColor(T.r,T.g,T.b,z)};this.getClearColor=function(){return T};this.getClearAlpha=function(){return z};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){D(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=
+!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);
+j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);L.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),L.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),
+j.deleteBuffer(a.__webglColorBuffer),L.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),L.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),L.info.memory.textures--};this.updateShadowMap=function(a,b){k(a,b)};this.render=function(a,b,c,d){var e,g,m,p,o=a.lights,s=a.fog;S=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);
+this.shadowMapEnabled&&this.shadowMapAutoUpdate&&k(a,b);L.info.render.calls=0;L.info.render.vertices=0;L.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(ga);b.projectionMatrix.flattenToArray(E);J.multiply(b.projectionMatrix,b.matrixWorldInverse);f(J);D(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
+this.autoClearDepth,this.autoClearStencil);p=a.__webglObjects;d=0;for(e=p.length;d<e;d++)if(g=p[d],m=g.object,g.render=!1,m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||h(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);t(m,b,!0);var r=g,u=r.object,w=r.buffer,B=void 0,B=B=void 0,B=u.material;if(B instanceof THREE.MeshFaceMaterial){if(B=w.materialIndex,B>=0)B=u.geometry.materials[B],B.transparent?(r.transparent=B,r.opaque=null):(r.opaque=B,r.transparent=null)}else if(B)B.transparent?
+(r.transparent=B,r.opaque=null):(r.opaque=B,r.transparent=null);g.render=!0;if(this.sortObjects)m.renderDepth?g.z=m.renderDepth:(la.copy(m.position),J.multiplyVector3(la),g.z=la.z)}this.sortObjects&&p.sort(i);p=a.__webglObjectsImmediate;d=0;for(e=p.length;d<e;d++)if(g=p[d],m=g.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),t(m,b,!0),m=g.object.material,m.transparent?(g.transparent=m,g.opaque=null):(g.opaque=m,g.transparent=null);a.overrideMaterial?(x(a.overrideMaterial.blending),
+q(a.overrideMaterial.depthTest),C(a.overrideMaterial.depthWrite),v(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,o,s,!0,a.overrideMaterial),n(a.__webglObjectsImmediate,"",b,o,s,!1,a.overrideMaterial)):(x(THREE.NormalBlending),l(a.__webglObjects,!0,"opaque",b,o,s,!1),n(a.__webglObjectsImmediate,"opaque",b,o,s,!1),l(a.__webglObjects,!1,"transparent",b,o,s,!0),n(a.__webglObjectsImmediate,"transparent",b,o,s,!0));
+if(a.__webglSprites.length){m=N.attributes;o=N.uniforms;s=U/wa;d=[];e=wa*0.5;p=U*0.5;g=!0;j.useProgram(N.program);fa=N.program;O=Y=$=-1;na||(j.enableVertexAttribArray(N.attributes.position),j.enableVertexAttribArray(N.attributes.uv),na=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,N.vertexBuffer);j.vertexAttribPointer(m.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(m.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,N.elementBuffer);j.uniformMatrix4fv(o.projectionMatrix,
+!1,E);j.activeTexture(j.TEXTURE0);j.uniform1i(o.map,0);m=0;for(r=a.__webglSprites.length;m<r;m++)if(u=a.__webglSprites[m],u.visible&&u.opacity!==0)u.useScreenCoordinates?u.z=-u.position.z:(u._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,u.matrixWorld,u._modelViewMatrixArray),u.z=-u._modelViewMatrix.n34);a.__webglSprites.sort(i);m=0;for(r=a.__webglSprites.length;m<r;m++)u=a.__webglSprites[m],u.visible&&u.opacity!==0&&u.map&&u.map.image&&u.map.image.width&&(u.useScreenCoordinates?(j.uniform1i(o.useScreenCoordinates,
+1),j.uniform3f(o.screenPosition,(u.position.x-e)/e,(p-u.position.y)/p,Math.max(0,Math.min(1,u.position.z)))):(j.uniform1i(o.useScreenCoordinates,0),j.uniform1i(o.affectedByDistance,u.affectedByDistance?1:0),j.uniformMatrix4fv(o.modelViewMatrix,!1,u._modelViewMatrixArray)),b=u.map.image.width/(u.scaleByViewport?U:1),d[0]=b*s*u.scale.x,d[1]=b*u.scale.y,j.uniform2f(o.uvScale,u.uvScale.x,u.uvScale.y),j.uniform2f(o.uvOffset,u.uvOffset.x,u.uvOffset.y),j.uniform2f(o.alignment,u.alignment.x,u.alignment.y),
+j.uniform1f(o.opacity,u.opacity),j.uniform3f(o.color,u.color.r,u.color.g,u.color.b),j.uniform1f(o.rotation,u.rotation),j.uniform2fv(o.scale,d),u.mergeWith3D&&!g?(j.enable(j.DEPTH_TEST),g=!0):!u.mergeWith3D&&g&&(j.disable(j.DEPTH_TEST),g=!1),x(u.blending),G(u.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(ka)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,
+c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],g=a,f=void 0,h=void 0,i=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=
+new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups===void 0){var i=h,k=void 0,l=void 0,n=void 0,U=void 0,u=void 0,J=void 0,q=void 0,r={},t=i.morphTargets.length;i.geometryGroups={};k=0;for(l=i.faces.length;k<l;k++)n=i.faces[k],U=n.materialIndex,J=U!==void 0?U:-1,r[J]===void 0&&(r[J]={hash:J,counter:0}),q=r[J].hash+"_"+r[J].counter,i.geometryGroups[q]===
+void 0&&(i.geometryGroups[q]={faces3:[],faces4:[],materialIndex:U,vertices:0,numMorphTargets:t}),u=n instanceof THREE.Face3?3:4,i.geometryGroups[q].vertices+u>65535&&(r[J].counter+=1,q=r[J].hash+"_"+r[J].counter,i.geometryGroups[q]===void 0&&(i.geometryGroups[q]={faces3:[],faces4:[],materialIndex:U,vertices:0,numMorphTargets:t})),n instanceof THREE.Face3?i.geometryGroups[q].faces3.push(k):i.geometryGroups[q].faces4.push(k),i.geometryGroups[q].vertices+=u;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id=
+ea++,i.geometryGroupsList.push(i.geometryGroups[k])}for(f in h.geometryGroups)if(i=h.geometryGroups[f],!i.__webglVertexBuffer){k=i;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=
+j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){n=l=void 0;k.__webglMorphTargetsBuffers=[];l=0;for(n=k.numMorphTargets;l<n;l++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}L.info.memory.geometries++;U=e;u=U.geometry;l=i.faces3;J=i.faces4;k=l.length*3+J.length*4;n=l.length*1+J.length*2;J=l.length*3+J.length*4;l=b(U,i);q=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;r=l instanceof THREE.MeshBasicMaterial&&!l.envMap||
+l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;t=l.vertexColors?l.vertexColors:!1;i.__vertexArray=new Float32Array(k*3);if(r)i.__normalArray=new Float32Array(k*3);if(u.hasTangents)i.__tangentArray=new Float32Array(k*4);if(t)i.__colorArray=new Float32Array(k*3);if(q){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*
+2)}if(U.geometry.skinWeights.length&&U.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(n*3);i.__lineArray=new Uint16Array(J*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];U=0;for(u=i.numMorphTargets;U<u;U++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=r===THREE.SmoothShading;i.__uvType=q;
+i.__vertexColorType=t;i.__normalType=r;i.__webglFaceCount=n*3;i.__webglLineCount=J*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];n=void 0;for(n in l.attributes){var U=l.attributes[n],u={},w;for(w in U)u[w]=U[w];if(!u.__webglInitialized||u.createUniqueBuffers)u.__webglInitialized=!0,J=1,u.type==="v2"?J=2:u.type==="v3"?J=3:u.type==="v4"?J=4:u.type==="c"&&(J=3),u.size=J,u.array=new Float32Array(k*J),u.buffer=j.createBuffer(),u.buffer.belongsToAttribute=
+n,U.needsUpdate=!0,u.__original=U;i.__webglCustomAttributesList.push(u)}}i.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),L.info.memory.geometries++,i=h,k=i.vertices.length,i.__vertexArray=new Float32Array(k*3),i.__colorArray=new Float32Array(k*
+3),i.__webglVertexCount=k,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),L.info.memory.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__webglLineCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer))i=h,
+i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),L.info.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__sortArray=[],i.__webglParticleCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!e.__webglActive){if(e instanceof THREE.Mesh)for(f in h=e.geometry,h.geometryGroups)i=h.geometryGroups[f],o(g.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?
+(h=e.geometry,o(g.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?g.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&g.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];g=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)p(g.__webglObjects,e);else if(e instanceof
+THREE.Sprite){g=g.__webglSprites;f=e;for(h=g.length-1;h>=0;h--)g[h]===f&&g.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&p(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e<g;e++)if(w=a.__webglObjects[e].object,f=w.geometry,h=n=l=void 0,w instanceof THREE.Mesh){i=0;for(k=f.geometryGroupsList.length;i<k;i++)if(l=f.geometryGroupsList[i],h=b(w,l),n=h.attributes&&m(h),f.__dirtyVertices||f.__dirtyMorphTargets||
+f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||n)if(n=j.DYNAMIC_DRAW,U=!f.dynamic,l.__inittedArrays){var B=J=u=void 0,E=void 0,C=void 0,ca=void 0,v=void 0,D=void 0,G=void 0,la=void 0,I=void 0,$=B=ca=void 0,z=void 0,x=void 0,y=void 0,ga=E=void 0,N=void 0,P=E=G=I=void 0,Y=void 0,ha=y=x=z=v=void 0,H=E=y=x=z=ha=y=x=z=ha=y=x=z=void 0,K=void 0,M=ca=void 0,Q=void 0,S=void 0,ka=void 0,R=void 0,W=$=S=K=0,Z=0,ba=H=B=0,O=v=ga=0,F=0,T=void 0,O=l.__vertexArray,Q=l.__uvArray,
+F=l.__uv2Array,M=l.__normalArray,C=l.__tangentArray,N=l.__colorArray,P=l.__skinVertexAArray,Y=l.__skinVertexBArray,D=l.__skinIndexArray,V=l.__skinWeightArray,ha=l.__morphTargetsArrays,q=l.__webglCustomAttributesList,A=void 0,A=l.__faceArray,T=l.__lineArray,da=l.__needsSmoothNormals,I=l.__vertexColorType,la=l.__uvType,ca=l.__normalType,G=w.geometry,fa=G.__dirtyElements,aa=G.__dirtyUvs,qa=G.__dirtyNormals,ja=G.__dirtyTangents,xa=G.__dirtyColors,ka=G.__dirtyMorphTargets,R=G.vertices,r=l.faces3,t=l.faces4,
+ia=G.faces,ma=G.faceVertexUvs[0],ua=G.faceVertexUvs[1],ta=G.skinVerticesA,sa=G.skinVerticesB,ra=G.skinIndices,na=G.skinWeights,pa=G.morphTargets;if(G.__dirtyVertices){u=0;for(J=r.length;u<J;u++)E=ia[r[u]],z=R[E.a].position,x=R[E.b].position,y=R[E.c].position,O[S]=z.x,O[S+1]=z.y,O[S+2]=z.z,O[S+3]=x.x,O[S+4]=x.y,O[S+5]=x.z,O[S+6]=y.x,O[S+7]=y.y,O[S+8]=y.z,S+=9;u=0;for(J=t.length;u<J;u++)E=ia[t[u]],z=R[E.a].position,x=R[E.b].position,y=R[E.c].position,E=R[E.d].position,O[S]=z.x,O[S+1]=z.y,O[S+2]=z.z,
+O[S+3]=x.x,O[S+4]=x.y,O[S+5]=x.z,O[S+6]=y.x,O[S+7]=y.y,O[S+8]=y.z,O[S+9]=E.x,O[S+10]=E.y,O[S+11]=E.z,S+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,O,n)}if(ka){S=0;for(ka=pa.length;S<ka;S++){u=O=0;for(J=r.length;u<J;u++)E=ia[r[u]],z=pa[S].vertices[E.a].position,x=pa[S].vertices[E.b].position,y=pa[S].vertices[E.c].position,R=ha[S],R[O]=z.x,R[O+1]=z.y,R[O+2]=z.z,R[O+3]=x.x,R[O+4]=x.y,R[O+5]=x.z,R[O+6]=y.x,R[O+7]=y.y,R[O+8]=y.z,O+=9;u=0;for(J=t.length;u<J;u++)E=
+ia[t[u]],z=pa[S].vertices[E.a].position,x=pa[S].vertices[E.b].position,y=pa[S].vertices[E.c].position,E=pa[S].vertices[E.d].position,R=ha[S],R[O]=z.x,R[O+1]=z.y,R[O+2]=z.z,R[O+3]=x.x,R[O+4]=x.y,R[O+5]=x.z,R[O+6]=y.x,R[O+7]=y.y,R[O+8]=y.z,R[O+9]=E.x,R[O+10]=E.y,R[O+11]=E.z,O+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[S]);j.bufferData(j.ARRAY_BUFFER,ha[S],n)}}if(na.length){u=0;for(J=r.length;u<J;u++)E=ia[r[u]],z=na[E.a],x=na[E.b],y=na[E.c],V[v]=z.x,V[v+1]=z.y,V[v+2]=z.z,V[v+3]=z.w,
+V[v+4]=x.x,V[v+5]=x.y,V[v+6]=x.z,V[v+7]=x.w,V[v+8]=y.x,V[v+9]=y.y,V[v+10]=y.z,V[v+11]=y.w,z=ra[E.a],x=ra[E.b],y=ra[E.c],D[v]=z.x,D[v+1]=z.y,D[v+2]=z.z,D[v+3]=z.w,D[v+4]=x.x,D[v+5]=x.y,D[v+6]=x.z,D[v+7]=x.w,D[v+8]=y.x,D[v+9]=y.y,D[v+10]=y.z,D[v+11]=y.w,z=ta[E.a],x=ta[E.b],y=ta[E.c],P[v]=z.x,P[v+1]=z.y,P[v+2]=z.z,P[v+3]=1,P[v+4]=x.x,P[v+5]=x.y,P[v+6]=x.z,P[v+7]=1,P[v+8]=y.x,P[v+9]=y.y,P[v+10]=y.z,P[v+11]=1,z=sa[E.a],x=sa[E.b],y=sa[E.c],Y[v]=z.x,Y[v+1]=z.y,Y[v+2]=z.z,Y[v+3]=1,Y[v+4]=x.x,Y[v+5]=x.y,Y[v+
+6]=x.z,Y[v+7]=1,Y[v+8]=y.x,Y[v+9]=y.y,Y[v+10]=y.z,Y[v+11]=1,v+=12;u=0;for(J=t.length;u<J;u++)E=ia[t[u]],z=na[E.a],x=na[E.b],y=na[E.c],ha=na[E.d],V[v]=z.x,V[v+1]=z.y,V[v+2]=z.z,V[v+3]=z.w,V[v+4]=x.x,V[v+5]=x.y,V[v+6]=x.z,V[v+7]=x.w,V[v+8]=y.x,V[v+9]=y.y,V[v+10]=y.z,V[v+11]=y.w,V[v+12]=ha.x,V[v+13]=ha.y,V[v+14]=ha.z,V[v+15]=ha.w,z=ra[E.a],x=ra[E.b],y=ra[E.c],ha=ra[E.d],D[v]=z.x,D[v+1]=z.y,D[v+2]=z.z,D[v+3]=z.w,D[v+4]=x.x,D[v+5]=x.y,D[v+6]=x.z,D[v+7]=x.w,D[v+8]=y.x,D[v+9]=y.y,D[v+10]=y.z,D[v+11]=y.w,
+D[v+12]=ha.x,D[v+13]=ha.y,D[v+14]=ha.z,D[v+15]=ha.w,z=ta[E.a],x=ta[E.b],y=ta[E.c],ha=ta[E.d],P[v]=z.x,P[v+1]=z.y,P[v+2]=z.z,P[v+3]=1,P[v+4]=x.x,P[v+5]=x.y,P[v+6]=x.z,P[v+7]=1,P[v+8]=y.x,P[v+9]=y.y,P[v+10]=y.z,P[v+11]=1,P[v+12]=ha.x,P[v+13]=ha.y,P[v+14]=ha.z,P[v+15]=1,z=sa[E.a],x=sa[E.b],y=sa[E.c],E=sa[E.d],Y[v]=z.x,Y[v+1]=z.y,Y[v+2]=z.z,Y[v+3]=1,Y[v+4]=x.x,Y[v+5]=x.y,Y[v+6]=x.z,Y[v+7]=1,Y[v+8]=y.x,Y[v+9]=y.y,Y[v+10]=y.z,Y[v+11]=1,Y[v+12]=E.x,Y[v+13]=E.y,Y[v+14]=E.z,Y[v+15]=1,v+=16;v>0&&(j.bindBuffer(j.ARRAY_BUFFER,
+l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,P,n),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,Y,n),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,D,n),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,V,n))}if(xa&&I){u=0;for(J=r.length;u<J;u++)E=ia[r[u]],v=E.vertexColors,D=E.color,v.length===3&&I===THREE.VertexColors?(E=v[0],P=v[1],Y=v[2]):Y=P=E=D,N[ga]=E.r,N[ga+1]=E.g,N[ga+2]=
+E.b,N[ga+3]=P.r,N[ga+4]=P.g,N[ga+5]=P.b,N[ga+6]=Y.r,N[ga+7]=Y.g,N[ga+8]=Y.b,ga+=9;u=0;for(J=t.length;u<J;u++)E=ia[t[u]],v=E.vertexColors,D=E.color,v.length===4&&I===THREE.VertexColors?(E=v[0],P=v[1],Y=v[2],v=v[3]):v=Y=P=E=D,N[ga]=E.r,N[ga+1]=E.g,N[ga+2]=E.b,N[ga+3]=P.r,N[ga+4]=P.g,N[ga+5]=P.b,N[ga+6]=Y.r,N[ga+7]=Y.g,N[ga+8]=Y.b,N[ga+9]=v.r,N[ga+10]=v.g,N[ga+11]=v.b,ga+=12;ga>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,N,n))}if(ja&&G.hasTangents){u=0;for(J=r.length;u<
+J;u++)E=ia[r[u]],G=E.vertexTangents,ga=G[0],N=G[1],I=G[2],C[H]=ga.x,C[H+1]=ga.y,C[H+2]=ga.z,C[H+3]=ga.w,C[H+4]=N.x,C[H+5]=N.y,C[H+6]=N.z,C[H+7]=N.w,C[H+8]=I.x,C[H+9]=I.y,C[H+10]=I.z,C[H+11]=I.w,H+=12;u=0;for(J=t.length;u<J;u++)E=ia[t[u]],G=E.vertexTangents,ga=G[0],N=G[1],I=G[2],G=G[3],C[H]=ga.x,C[H+1]=ga.y,C[H+2]=ga.z,C[H+3]=ga.w,C[H+4]=N.x,C[H+5]=N.y,C[H+6]=N.z,C[H+7]=N.w,C[H+8]=I.x,C[H+9]=I.y,C[H+10]=I.z,C[H+11]=I.w,C[H+12]=G.x,C[H+13]=G.y,C[H+14]=G.z,C[H+15]=G.w,H+=16;j.bindBuffer(j.ARRAY_BUFFER,
+l.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,C,n)}if(qa&&ca){u=0;for(J=r.length;u<J;u++)if(E=ia[r[u]],C=E.vertexNormals,ca=E.normal,C.length===3&&da)for(H=0;H<3;H++)ca=C[H],M[B]=ca.x,M[B+1]=ca.y,M[B+2]=ca.z,B+=3;else for(H=0;H<3;H++)M[B]=ca.x,M[B+1]=ca.y,M[B+2]=ca.z,B+=3;u=0;for(J=t.length;u<J;u++)if(E=ia[t[u]],C=E.vertexNormals,ca=E.normal,C.length===4&&da)for(H=0;H<4;H++)ca=C[H],M[B]=ca.x,M[B+1]=ca.y,M[B+2]=ca.z,B+=3;else for(H=0;H<4;H++)M[B]=ca.x,M[B+1]=ca.y,M[B+2]=ca.z,B+=3;j.bindBuffer(j.ARRAY_BUFFER,
+l.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,M,n)}if(aa&&ma&&la){u=0;for(J=r.length;u<J;u++)if(B=r[u],B=ma[B],B!==void 0)for(H=0;H<3;H++)M=B[H],Q[$]=M.u,Q[$+1]=M.v,$+=2;u=0;for(J=t.length;u<J;u++)if(B=t[u],B=ma[B],B!==void 0)for(H=0;H<4;H++)M=B[H],Q[$]=M.u,Q[$+1]=M.v,$+=2;$>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,Q,n))}if(aa&&ua&&la){u=0;for(J=r.length;u<J;u++)if(B=r[u],$=ua[B],$!==void 0)for(H=0;H<3;H++)Q=$[H],F[W]=Q.u,F[W+1]=Q.v,W+=2;u=0;for(J=t.length;u<
+J;u++)if(B=t[u],$=ua[B],$!==void 0)for(H=0;H<4;H++)Q=$[H],F[W]=Q.u,F[W+1]=Q.v,W+=2;W>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,F,n))}if(fa){u=0;for(J=r.length;u<J;u++)A[Z]=K,A[Z+1]=K+1,A[Z+2]=K+2,Z+=3,T[ba]=K,T[ba+1]=K+1,T[ba+2]=K,T[ba+3]=K+2,T[ba+4]=K+1,T[ba+5]=K+2,ba+=6,K+=3;u=0;for(J=t.length;u<J;u++)A[Z]=K,A[Z+1]=K+1,A[Z+2]=K+3,A[Z+3]=K+1,A[Z+4]=K+2,A[Z+5]=K+3,Z+=6,T[ba]=K,T[ba+1]=K+1,T[ba+2]=K,T[ba+3]=K+3,T[ba+4]=K+1,T[ba+5]=K+2,T[ba+6]=K+2,T[ba+7]=K+3,ba+=
+8,K+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,A,n);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,T,n)}if(q){H=0;for(K=q.length;H<K;H++)if(A=q[H],A.__original.needsUpdate){F=0;if(A.size===1)if(A.boundTo===void 0||A.boundTo==="vertices"){u=0;for(J=r.length;u<J;u++)E=ia[r[u]],A.array[F]=A.value[E.a],A.array[F+1]=A.value[E.b],A.array[F+2]=A.value[E.c],F+=3;u=0;for(J=t.length;u<J;u++)E=ia[t[u]],A.array[F]=
+A.value[E.a],A.array[F+1]=A.value[E.b],A.array[F+2]=A.value[E.c],A.array[F+3]=A.value[E.d],F+=4}else{if(A.boundTo==="faces"){u=0;for(J=r.length;u<J;u++)T=A.value[r[u]],A.array[F]=T,A.array[F+1]=T,A.array[F+2]=T,F+=3;u=0;for(J=t.length;u<J;u++)T=A.value[t[u]],A.array[F]=T,A.array[F+1]=T,A.array[F+2]=T,A.array[F+3]=T,F+=4}}else if(A.size===2)if(A.boundTo===void 0||A.boundTo==="vertices"){u=0;for(J=r.length;u<J;u++)E=ia[r[u]],z=A.value[E.a],x=A.value[E.b],y=A.value[E.c],A.array[F]=z.x,A.array[F+1]=z.y,
+A.array[F+2]=x.x,A.array[F+3]=x.y,A.array[F+4]=y.x,A.array[F+5]=y.y,F+=6;u=0;for(J=t.length;u<J;u++)E=ia[t[u]],z=A.value[E.a],x=A.value[E.b],y=A.value[E.c],E=A.value[E.d],A.array[F]=z.x,A.array[F+1]=z.y,A.array[F+2]=x.x,A.array[F+3]=x.y,A.array[F+4]=y.x,A.array[F+5]=y.y,A.array[F+6]=E.x,A.array[F+7]=E.y,F+=8}else{if(A.boundTo==="faces"){u=0;for(J=r.length;u<J;u++)y=x=z=T=A.value[r[u]],A.array[F]=z.x,A.array[F+1]=z.y,A.array[F+2]=x.x,A.array[F+3]=x.y,A.array[F+4]=y.x,A.array[F+5]=y.y,F+=6;u=0;for(J=
+t.length;u<J;u++)E=y=x=z=T=A.value[t[u]],A.array[F]=z.x,A.array[F+1]=z.y,A.array[F+2]=x.x,A.array[F+3]=x.y,A.array[F+4]=y.x,A.array[F+5]=y.y,A.array[F+6]=E.x,A.array[F+7]=E.y,F+=8}}else if(A.size===3)if(W=A.type==="c"?["r","g","b"]:["x","y","z"],A.boundTo===void 0||A.boundTo==="vertices"){u=0;for(J=r.length;u<J;u++)E=ia[r[u]],z=A.value[E.a],x=A.value[E.b],y=A.value[E.c],A.array[F]=z[W[0]],A.array[F+1]=z[W[1]],A.array[F+2]=z[W[2]],A.array[F+3]=x[W[0]],A.array[F+4]=x[W[1]],A.array[F+5]=x[W[2]],A.array[F+
+6]=y[W[0]],A.array[F+7]=y[W[1]],A.array[F+8]=y[W[2]],F+=9;u=0;for(J=t.length;u<J;u++)E=ia[t[u]],z=A.value[E.a],x=A.value[E.b],y=A.value[E.c],E=A.value[E.d],A.array[F]=z[W[0]],A.array[F+1]=z[W[1]],A.array[F+2]=z[W[2]],A.array[F+3]=x[W[0]],A.array[F+4]=x[W[1]],A.array[F+5]=x[W[2]],A.array[F+6]=y[W[0]],A.array[F+7]=y[W[1]],A.array[F+8]=y[W[2]],A.array[F+9]=E[W[0]],A.array[F+10]=E[W[1]],A.array[F+11]=E[W[2]],F+=12}else{if(A.boundTo==="faces"){u=0;for(J=r.length;u<J;u++)y=x=z=T=A.value[r[u]],A.array[F]=
+z[W[0]],A.array[F+1]=z[W[1]],A.array[F+2]=z[W[2]],A.array[F+3]=x[W[0]],A.array[F+4]=x[W[1]],A.array[F+5]=x[W[2]],A.array[F+6]=y[W[0]],A.array[F+7]=y[W[1]],A.array[F+8]=y[W[2]],F+=9;u=0;for(J=t.length;u<J;u++)E=y=x=z=T=A.value[t[u]],A.array[F]=z[W[0]],A.array[F+1]=z[W[1]],A.array[F+2]=z[W[2]],A.array[F+3]=x[W[0]],A.array[F+4]=x[W[1]],A.array[F+5]=x[W[2]],A.array[F+6]=y[W[0]],A.array[F+7]=y[W[1]],A.array[F+8]=y[W[2]],A.array[F+9]=E[W[0]],A.array[F+10]=E[W[1]],A.array[F+11]=E[W[2]],F+=12}}else if(A.size===
+4)if(A.boundTo===void 0||A.boundTo==="vertices"){u=0;for(J=r.length;u<J;u++)E=ia[r[u]],z=A.value[E.a],x=A.value[E.b],y=A.value[E.c],A.array[F]=z.x,A.array[F+1]=z.y,A.array[F+2]=z.z,A.array[F+3]=z.w,A.array[F+4]=x.x,A.array[F+5]=x.y,A.array[F+6]=x.z,A.array[F+7]=x.w,A.array[F+8]=y.x,A.array[F+9]=y.y,A.array[F+10]=y.z,A.array[F+11]=y.w,F+=12;u=0;for(J=t.length;u<J;u++)E=ia[t[u]],z=A.value[E.a],x=A.value[E.b],y=A.value[E.c],E=A.value[E.d],A.array[F]=z.x,A.array[F+1]=z.y,A.array[F+2]=z.z,A.array[F+3]=
+z.w,A.array[F+4]=x.x,A.array[F+5]=x.y,A.array[F+6]=x.z,A.array[F+7]=x.w,A.array[F+8]=y.x,A.array[F+9]=y.y,A.array[F+10]=y.z,A.array[F+11]=y.w,A.array[F+12]=E.x,A.array[F+13]=E.y,A.array[F+14]=E.z,A.array[F+15]=E.w,F+=16}else if(A.boundTo==="faces"){u=0;for(J=r.length;u<J;u++)y=x=z=T=A.value[r[u]],A.array[F]=z.x,A.array[F+1]=z.y,A.array[F+2]=z.z,A.array[F+3]=z.w,A.array[F+4]=x.x,A.array[F+5]=x.y,A.array[F+6]=x.z,A.array[F+7]=x.w,A.array[F+8]=y.x,A.array[F+9]=y.y,A.array[F+10]=y.z,A.array[F+11]=y.w,
+F+=12;u=0;for(J=t.length;u<J;u++)E=y=x=z=T=A.value[t[u]],A.array[F]=z.x,A.array[F+1]=z.y,A.array[F+2]=z.z,A.array[F+3]=z.w,A.array[F+4]=x.x,A.array[F+5]=x.y,A.array[F+6]=x.z,A.array[F+7]=x.w,A.array[F+8]=y.x,A.array[F+9]=y.y,A.array[F+10]=y.z,A.array[F+11]=y.w,A.array[F+12]=E.x,A.array[F+13]=E.y,A.array[F+14]=E.z,A.array[F+15]=E.w,F+=16}j.bindBuffer(j.ARRAY_BUFFER,A.buffer);j.bufferData(j.ARRAY_BUFFER,A.array,n)}}U&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,
+delete l.__uvArray,delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyColors=!1;f.__dirtyTangents=!1;h.attributes&&s(h)}else if(w instanceof THREE.Ribbon){if(f.__dirtyVertices||f.__dirtyColors){h=f;w=j.DYNAMIC_DRAW;u=i=u=U=U=void 0;J=h.vertices;
+k=h.colors;q=J.length;l=k.length;r=h.__vertexArray;n=h.__colorArray;t=h.__dirtyColors;if(h.__dirtyVertices){for(U=0;U<q;U++)u=J[U].position,i=U*3,r[i]=u.x,r[i+1]=u.y,r[i+2]=u.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,r,w)}if(t){for(U=0;U<l;U++)u=k[U],i=U*3,n[i]=u.r,n[i+1]=u.g,n[i+2]=u.b;j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,n,w)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(w instanceof THREE.Line){h=b(w,l);n=h.attributes&&
+m(h);if(f.__dirtyVertices||f.__dirtyColors||n){w=f;i=j.DYNAMIC_DRAW;q=k=K=J=ia=void 0;J=w.vertices;l=w.colors;q=J.length;n=l.length;r=w.__vertexArray;U=w.__colorArray;t=w.__dirtyColors;u=w.__webglCustomAttributesList;$=ba=Z=W=K=ia=void 0;if(w.__dirtyVertices){for(ia=0;ia<q;ia++)K=J[ia].position,k=ia*3,r[k]=K.x,r[k+1]=K.y,r[k+2]=K.z;j.bindBuffer(j.ARRAY_BUFFER,w.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,r,i)}if(t){for(J=0;J<n;J++)q=l[J],k=J*3,U[k]=q.r,U[k+1]=q.g,U[k+2]=q.b;j.bindBuffer(j.ARRAY_BUFFER,
+w.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,U,i)}if(u){ia=0;for(K=u.length;ia<K;ia++)if($=u[ia],$.needsUpdate&&($.boundTo===void 0||$.boundTo==="vertices")){k=0;Z=$.value.length;if($.size===1)for(W=0;W<Z;W++)$.array[W]=$.value[W];else if($.size===2)for(W=0;W<Z;W++)ba=$.value[W],$.array[k]=ba.x,$.array[k+1]=ba.y,k+=2;else if($.size===3)if($.type==="c")for(W=0;W<Z;W++)ba=$.value[W],$.array[k]=ba.r,$.array[k+1]=ba.g,$.array[k+2]=ba.b,k+=3;else for(W=0;W<Z;W++)ba=$.value[W],$.array[k]=ba.x,$.array[k+
+1]=ba.y,$.array[k+2]=ba.z,k+=3;else if($.size===4)for(W=0;W<Z;W++)ba=$.value[W],$.array[k]=ba.x,$.array[k+1]=ba.y,$.array[k+2]=ba.z,$.array[k+3]=ba.w,k+=4;j.bindBuffer(j.ARRAY_BUFFER,$.buffer);j.bufferData(j.ARRAY_BUFFER,$.array,i)}}}f.__dirtyVertices=!1;f.__dirtyColors=!1;h.attributes&&s(h)}else if(w instanceof THREE.ParticleSystem)h=b(w,l),n=h.attributes&&m(h),(f.__dirtyVertices||f.__dirtyColors||w.sortParticles||n)&&d(f,j.DYNAMIC_DRAW,w),f.__dirtyVertices=!1,f.__dirtyColors=!1,h.attributes&&s(h)};
+this.initMaterial=function(a,b,c,d){var e,g,f,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;
+a.fragmentShader=i.fragmentShader}var k,l,m;k=m=i=0;for(l=b.length;k<l;k++)f=b[k],f instanceof THREE.SpotLight&&m++,f instanceof THREE.DirectionalLight&&m++,f instanceof THREE.PointLight&&i++;i+m<=B?k=m:(k=Math.ceil(B*m/(i+m)),i=B-k);f={directional:k,point:i};i=m=0;for(k=b.length;i<k;i++)l=b[i],l instanceof THREE.SpotLight&&l.castShadow&&m++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var u;a:{k=a.fragmentShader;l=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,
+envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:f.directional,maxPointLights:f.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=
+[];h?d.push(h):(d.push(k),d.push(l));for(p in c)d.push(p),d.push(c[p]);h=d.join();p=0;for(d=P.length;p<d;p++)if(P[p].code===h){u=P[p].program;break a}p=j.createProgram();d=[ta?"#define VERTEX_TEXTURES":"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?
+"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+f=["#ifdef GL_ES","precision "+M+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
+"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(p,I("fragment",f+k));j.attachShader(p,
+I("vertex",d+l));j.linkProgram(p);j.getProgramParameter(p,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(p,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");p.uniforms={};p.attributes={};var o,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(o in i)d.push(o);o=d;d=0;for(i=o.length;d<i;d++)k=o[d],p.uniforms[k]=j.getUniformLocation(p,
+k);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(o=0;o<c.maxMorphTargets;o++)d.push("morphTarget"+o);for(u in b)d.push(u);u=d;o=0;for(b=u.length;o<b;o++)c=u[o],p.attributes[c]=j.getAttribLocation(p,c);p.id=P.length;P.push({program:p,code:h});L.info.memory.programs=P.length;u=p}a.program=u;u=a.program.attributes;u.position>=0&&j.enableVertexAttribArray(u.position);u.color>=0&&j.enableVertexAttribArray(u.color);u.normal>=0&&j.enableVertexAttribArray(u.normal);
+u.tangent>=0&&j.enableVertexAttribArray(u.tangent);a.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(j.enableVertexAttribArray(u.skinVertexA),j.enableVertexAttribArray(u.skinVertexB),j.enableVertexAttribArray(u.skinIndex),j.enableVertexAttribArray(u.skinWeight));if(a.attributes)for(g in a.attributes)u[g]!==void 0&&u[g]>=0&&j.enableVertexAttribArray(u[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)o="morphTarget"+g,u[o]>=0&&(j.enableVertexAttribArray(u[o]),
 a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),a==="back"?j.cullFace(j.BACK):a==="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)}};
 THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type:
 THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.stencilBuffer:!0};
@@ -349,19 +349,19 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.ColorUtils={adjustHSV:function(a,c,b,d){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.Math.clamp(g.h+c,0,1);g.s=THREE.Math.clamp(g.s+b,0,1);g.v=THREE.Math.clamp(g.v+d,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,d=a.g,g=a.b,e=Math.max(Math.max(b,d),g),f=Math.min(Math.min(b,d),g);if(f===e)f=b=0;else{var h=e-f,f=h/e,b=b===e?(d-g)/h:d===e?2+(g-b)/h:4+(b-d)/h;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=f;c.v=e;return c}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,e=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,h=e.vertices,i=a.faces,k=e.faces,l=a.faceVertexUvs[0],m=e.faceVertexUvs[0],q={},n=0;n<a.materials.length;n++)q[a.materials[n].id]=n;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var n=0,t=h.length;n<t;n++){var p=new THREE.Vertex(h[n].position.clone());b&&b.multiplyVector3(p.position);f.push(p)}n=
-0;for(t=k.length;n<t;n++){var f=k[n],o,v,w=f.vertexNormals,r=f.vertexColors;f instanceof THREE.Face3?o=new THREE.Face3(f.a+g,f.b+g,f.c+g):f instanceof THREE.Face4&&(o=new THREE.Face4(f.a+g,f.b+g,f.c+g,f.d+g));o.normal.copy(f.normal);d&&d.multiplyVector3(o.normal);h=0;for(p=w.length;h<p;h++)v=w[h].clone(),d&&d.multiplyVector3(v),o.vertexNormals.push(v);o.color.copy(f.color);h=0;for(p=r.length;h<p;h++)v=r[h],o.vertexColors.push(v.clone());if(f.materialIndex!==void 0){h=e.materials[f.materialIndex];
-p=q[h.id];if(p===void 0)p=a.materials.length,a.materials.push(h);o.materialIndex=p}o.centroid.copy(f.centroid);b&&b.multiplyVector3(o.centroid);i.push(o)}n=0;for(t=m.length;n<t;n++){b=m[n];d=[];h=0;for(p=b.length;h<p;h++)d.push(new THREE.UV(b[h].u,b[h].v));l.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,e=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var f=new THREE.Vertex(d[a].position.clone());c.vertices.push(f)}a=0;
-for(b=g.length;a<b;a++){var h=g[a],i,k,l=h.vertexNormals,m=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(f=l.length;d<f;d++)k=l[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(f=m.length;d<f;d++)k=m[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=e.length;a<b;a++){g=e[a];i=[];d=0;for(f=g.length;d<
+THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,e=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,h=e.vertices,i=a.faces,k=e.faces,l=a.faceVertexUvs[0],n=e.faceVertexUvs[0],o={},m=0;m<a.materials.length;m++)o[a.materials[m].id]=m;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var m=0,s=h.length;m<s;m++){var p=new THREE.Vertex(h[m].position.clone());b&&b.multiplyVector3(p.position);f.push(p)}m=
+0;for(s=k.length;m<s;m++){var f=k[m],r,t,w=f.vertexNormals,q=f.vertexColors;f instanceof THREE.Face3?r=new THREE.Face3(f.a+g,f.b+g,f.c+g):f instanceof THREE.Face4&&(r=new THREE.Face4(f.a+g,f.b+g,f.c+g,f.d+g));r.normal.copy(f.normal);d&&d.multiplyVector3(r.normal);h=0;for(p=w.length;h<p;h++)t=w[h].clone(),d&&d.multiplyVector3(t),r.vertexNormals.push(t);r.color.copy(f.color);h=0;for(p=q.length;h<p;h++)t=q[h],r.vertexColors.push(t.clone());if(f.materialIndex!==void 0){h=e.materials[f.materialIndex];
+p=o[h.id];if(p===void 0)p=a.materials.length,a.materials.push(h);r.materialIndex=p}r.centroid.copy(f.centroid);b&&b.multiplyVector3(r.centroid);i.push(r)}m=0;for(s=n.length;m<s;m++){b=n[m];d=[];h=0;for(p=b.length;h<p;h++)d.push(new THREE.UV(b[h].u,b[h].v));l.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,e=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var f=new THREE.Vertex(d[a].position.clone());c.vertices.push(f)}a=0;
+for(b=g.length;a<b;a++){var h=g[a],i,k,l=h.vertexNormals,n=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(f=l.length;d<f;d++)k=l[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(f=n.length;d<f;d++)k=n[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=e.length;a<b;a++){g=e[a];i=[];d=0;for(f=g.length;d<
 f;d++)i.push(new THREE.UV(g[d].u,g[d].v));c.faceVertexUvs[0].push(i)}return c},randomPointInTriangle:function(a,c,b){var d,g,e,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();d+g>1&&(d=1-d,g=1-g);e=1-d-g;f.copy(a);f.multiplyScalar(d);h.copy(c);h.multiplyScalar(g);f.addSelf(h);h.copy(b);h.multiplyScalar(e);f.addSelf(h);return f},randomPointInFace:function(a,c,b){var d,g,e;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,g=c.vertices[a.b].position,
 e=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,g,e);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;g=c.vertices[a.b].position;e=c.vertices[a.c].position;var c=c.vertices[a.d].position,f;b?a._area1&&a._area2?(b=a._area1,f=a._area2):(b=THREE.GeometryUtils.triangleArea(d,g,c),f=THREE.GeometryUtils.triangleArea(g,e,c),a._area1=b,a._area2=f):(b=THREE.GeometryUtils.triangleArea(d,g,c),f=THREE.GeometryUtils.triangleArea(g,e,c));return THREE.GeometryUtils.random()*(b+
-f)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,e,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,g,e=a.faces,f=a.vertices,h=e.length,i=0,k=[],l,m,q,n;for(g=0;g<h;g++){d=e[g];if(d instanceof THREE.Face3)l=f[d.a].position,m=f[d.b].position,q=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(l,m,q);else if(d instanceof
-THREE.Face4)l=f[d.a].position,m=f[d.b].position,q=f[d.c].position,n=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(l,m,n),d._area2=THREE.GeometryUtils.triangleArea(m,q,n),d._area=d._area1+d._area2;i+=d._area;k[g]=i}d=[];f={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(e[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,c,b){var d,g=THREE.GeometryUtils.__v1;g.sub(a,c);d=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
+f)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,e,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,g,e=a.faces,f=a.vertices,h=e.length,i=0,k=[],l,n,o,m;for(g=0;g<h;g++){d=e[g];if(d instanceof THREE.Face3)l=f[d.a].position,n=f[d.b].position,o=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(l,n,o);else if(d instanceof
+THREE.Face4)l=f[d.a].position,n=f[d.b].position,o=f[d.c].position,m=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(l,n,m),d._area2=THREE.GeometryUtils.triangleArea(n,o,m),d._area=d._area1+d._area2;i+=d._area;k[g]=i}d=[];f={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(e[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,c,b){var d,g=THREE.GeometryUtils.__v1;g.sub(a,c);d=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
 c=0.5*(d+a+b);return Math.sqrt(c*(c-d)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(a,c,b){var d=new Image,g=new THREE.Texture(d,c);d.onload=function(){g.needsUpdate=!0;b&&b(this)};d.crossOrigin="";d.src=a;return g},loadTextureCube:function(a,c,b){var d,g=[],e=new THREE.Texture(g,c),c=g.loadCount=0;for(d=a.length;c<d;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount===6)e.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return e},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,g=a.height,e=document.createElement("canvas");e.width=d;e.height=g;var f=e.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,g).data,i=f.createImageData(d,g),k=i.data,l=0;l<d;l++)for(var m=1;m<g;m++){var q=m-1<0?g-1:m-1,n=(m+1)%g,t=l-1<0?d-1:l-1,p=(l+1)%d,o=[],v=[0,0,h[(m*d+l)*4]/255*c];o.push([-1,0,h[(m*d+t)*4]/255*c]);o.push([-1,-1,h[(q*d+t)*4]/255*c]);o.push([0,-1,h[(q*d+l)*4]/255*c]);o.push([1,-1,h[(q*d+p)*4]/255*c]);
-o.push([1,0,h[(m*d+p)*4]/255*c]);o.push([1,1,h[(n*d+p)*4]/255*c]);o.push([0,1,h[(n*d+l)*4]/255*c]);o.push([-1,1,h[(n*d+t)*4]/255*c]);q=[];t=o.length;for(n=0;n<t;n++){var p=o[n],w=o[(n+1)%t],p=[p[0]-v[0],p[1]-v[1],p[2]-v[2]],w=[w[0]-v[0],w[1]-v[1],w[2]-v[2]];q.push(b([p[1]*w[2]-p[2]*w[1],p[2]*w[0]-p[0]*w[2],p[0]*w[1]-p[1]*w[0]]))}o=[0,0,0];for(n=0;n<q.length;n++)o[0]+=q[n][0],o[1]+=q[n][1],o[2]+=q[n][2];o[0]/=q.length;o[1]/=q.length;o[2]/=q.length;v=(m*d+l)*4;k[v]=(o[0]+1)/2*255|0;k[v+1]=(o[1]+0.5)*
-255|0;k[v+2]=o[2]*255|0;k[v+3]=255}f.putImageData(i,0,0);return e}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,g=a.children.length;for(d=0;d<g;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,g=new THREE.Object3D;for(b=0;b<d;b++){var e=new THREE.Mesh(a,c[b]);g.add(e)}return g}};
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,g=a.height,e=document.createElement("canvas");e.width=d;e.height=g;var f=e.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,g).data,i=f.createImageData(d,g),k=i.data,l=0;l<d;l++)for(var n=1;n<g;n++){var o=n-1<0?g-1:n-1,m=(n+1)%g,s=l-1<0?d-1:l-1,p=(l+1)%d,r=[],t=[0,0,h[(n*d+l)*4]/255*c];r.push([-1,0,h[(n*d+s)*4]/255*c]);r.push([-1,-1,h[(o*d+s)*4]/255*c]);r.push([0,-1,h[(o*d+l)*4]/255*c]);r.push([1,-1,h[(o*d+p)*4]/255*c]);
+r.push([1,0,h[(n*d+p)*4]/255*c]);r.push([1,1,h[(m*d+p)*4]/255*c]);r.push([0,1,h[(m*d+l)*4]/255*c]);r.push([-1,1,h[(m*d+s)*4]/255*c]);o=[];s=r.length;for(m=0;m<s;m++){var p=r[m],w=r[(m+1)%s],p=[p[0]-t[0],p[1]-t[1],p[2]-t[2]],w=[w[0]-t[0],w[1]-t[1],w[2]-t[2]];o.push(b([p[1]*w[2]-p[2]*w[1],p[2]*w[0]-p[0]*w[2],p[0]*w[1]-p[1]*w[0]]))}r=[0,0,0];for(m=0;m<o.length;m++)r[0]+=o[m][0],r[1]+=o[m][1],r[2]+=o[m][2];r[0]/=o.length;r[1]/=o.length;r[2]/=o.length;t=(n*d+l)*4;k[t]=(r[0]+1)/2*255|0;k[t+1]=(r[1]+0.5)*
+255|0;k[t+2]=r[2]*255|0;k[t+3]=255}f.putImageData(i,0,0);return e}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,g=a.children.length;for(d=0;d<g;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,g=new THREE.Object3D;for(b=0;b<d;b++){var e=new THREE.Mesh(a,c[b]);g.add(e)}return g}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
@@ -400,19 +400,19 @@ THREE.Path.prototype.quadraticCurveTo=function(a,c,b,d){var g=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,c,b,d,g,e){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d),new THREE.Vector2(g,e)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
 THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
 THREE.Path.prototype.arc=function(a,c,b,d,g,e){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,d,g,e));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,g,e,f,h,i,k,l,m,q,n,t,p;d=0;for(g=this.actions.length;d<g;d++)switch(e=this.actions[d],f=e.action,e=e.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];i=e[3];m=e[0];q=e[1];b.length>0?(f=b[b.length-1],n=f.x,t=f.y):(f=this.actions[d-1].args,n=f[f.length-2],t=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b2(p,n,m,h),p=THREE.Shape.Utils.b2(p,t,q,
-i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];m=e[0];q=e[1];k=e[2];l=e[3];b.length>0?(f=b[b.length-1],n=f.x,t=f.y):(f=this.actions[d-1].args,n=f[f.length-2],t=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b3(p,n,m,k,h),p=THREE.Shape.Utils.b3(p,t,q,l,i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];p=a*e[0].length;f=f.concat(e[0]);e=new THREE.SplineCurve(f);
-for(f=1;f<=p;f++)b.push(e.getPointAt(f/p));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=e[0];i=e[1];k=e[2];m=e[3];p=e[4];q=!!e[5];l=f[f.length-2];n=f[f.length-1];f.length==0&&(l=n=0);t=p-m;var o=a*2;for(f=1;f<=o;f++)p=f/o,q||(p=1-p),p=m+p*t,e=l+h+k*Math.cos(p),p=n+i+k*Math.sin(p),b.push(new THREE.Vector2(e,p))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
-THREE.Path.prototype.nltransform=function(a,c,b,d,g,e){var f=this.getPoints(),h,i,k,l,m;h=0;for(i=f.length;h<i;h++)k=f[h],l=k.x,m=k.y,k.x=a*l+c*m+b,k.y=d*m+g*l+e;return f};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,g,e,f,h,i,k,l,n,o,m,s,p;d=0;for(g=this.actions.length;d<g;d++)switch(e=this.actions[d],f=e.action,e=e.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];i=e[3];n=e[0];o=e[1];b.length>0?(f=b[b.length-1],m=f.x,s=f.y):(f=this.actions[d-1].args,m=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b2(p,m,n,h),p=THREE.Shape.Utils.b2(p,s,o,
+i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];n=e[0];o=e[1];k=e[2];l=e[3];b.length>0?(f=b[b.length-1],m=f.x,s=f.y):(f=this.actions[d-1].args,m=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b3(p,m,n,k,h),p=THREE.Shape.Utils.b3(p,s,o,l,i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];p=a*e[0].length;f=f.concat(e[0]);e=new THREE.SplineCurve(f);
+for(f=1;f<=p;f++)b.push(e.getPointAt(f/p));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=e[0];i=e[1];k=e[2];n=e[3];p=e[4];o=!!e[5];l=f[f.length-2];m=f[f.length-1];f.length==0&&(l=m=0);s=p-n;var r=a*2;for(f=1;f<=r;f++)p=f/r,o||(p=1-p),p=n+p*s,e=l+h+k*Math.cos(p),p=m+i+k*Math.sin(p),b.push(new THREE.Vector2(e,p))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
+THREE.Path.prototype.nltransform=function(a,c,b,d,g,e){var f=this.getPoints(),h,i,k,l,n;h=0;for(i=f.length;h<i;h++)k=f[h],l=k.x,n=k.y,k.x=a*l+c*n+b,k.y=d*n+g*l+e;return f};
 THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,d,g,a=0;for(b=this.actions.length;a<b;a++)d=this.actions[a],g=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&c[d].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";d=
 this.getPoints();a=0;for(b=d.length;a<b;a++)g=d[a],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
 THREE.Path.prototype.toShapes=function(){var a,c,b,d,g=[],e=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],d=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&e.actions.length!=0&&(g.push(e),e=new THREE.Path),e[b].apply(e,d);e.actions.length!=0&&g.push(e);if(g.length==0)return[];var f,e=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f&&e.push(f),f=new THREE.Shape,f.actions=d.actions,f.curves=
 d.curves):f.holes.push(d);e.push(f)}else{f=new THREE.Shape;a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f.actions=d.actions,f.curves=d.curves,e.push(f),f=new THREE.Shape):f.holes.push(d)}return e};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),g,e,f,h,i,k,l,m,q,n,t=[];for(i=0;i<c.length;i++){k=c[i];Array.prototype.push.apply(d,k);e=Number.POSITIVE_INFINITY;for(g=0;g<k.length;g++){q=k[g];n=[];for(m=0;m<b.length;m++)l=b[m],l=q.distanceToSquared(l),n.push(l),l<e&&(e=l,f=g,h=m)}g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;var p=[k[f],b[h],b[g]];m=THREE.FontUtils.Triangulate.area(p);var o=[k[f],k[e],b[h]];q=THREE.FontUtils.Triangulate.area(o);n=h;l=f;h+=1;f+=-1;h<
-0&&(h+=b.length);h%=b.length;f<0&&(f+=k.length);f%=k.length;g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;p=[k[f],b[h],b[g]];p=THREE.FontUtils.Triangulate.area(p);o=[k[f],k[e],b[h]];o=THREE.FontUtils.Triangulate.area(o);m+q>p+o&&(h=n,f=l,h<0&&(h+=b.length),h%=b.length,f<0&&(f+=k.length),f%=k.length,g=h-1>=0?h-1:b.length-1,e=f-1>=0?f-1:k.length-1);m=b.slice(0,h);q=b.slice(h);n=k.slice(f);l=k.slice(0,f);e=[k[f],k[e],b[h]];t.push([k[f],b[h],b[g]]);t.push(e);b=m.concat(n).concat(l).concat(q)}return{shape:b,
-isolatedPts:t,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),e,f,h,i,k={};e=0;for(f=d.length;e<f;e++)i=d[e].x+":"+d[e].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=e;e=0;for(f=b.length;e<f;e++){h=b[e];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}e=0;for(f=g.length;e<f;e++){h=g[e];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}return b.concat(g)},
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),g,e,f,h,i,k,l,n,o,m,s=[];for(i=0;i<c.length;i++){k=c[i];Array.prototype.push.apply(d,k);e=Number.POSITIVE_INFINITY;for(g=0;g<k.length;g++){o=k[g];m=[];for(n=0;n<b.length;n++)l=b[n],l=o.distanceToSquared(l),m.push(l),l<e&&(e=l,f=g,h=n)}g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;var p=[k[f],b[h],b[g]];n=THREE.FontUtils.Triangulate.area(p);var r=[k[f],k[e],b[h]];o=THREE.FontUtils.Triangulate.area(r);m=h;l=f;h+=1;f+=-1;h<
+0&&(h+=b.length);h%=b.length;f<0&&(f+=k.length);f%=k.length;g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;p=[k[f],b[h],b[g]];p=THREE.FontUtils.Triangulate.area(p);r=[k[f],k[e],b[h]];r=THREE.FontUtils.Triangulate.area(r);n+o>p+r&&(h=m,f=l,h<0&&(h+=b.length),h%=b.length,f<0&&(f+=k.length),f%=k.length,g=h-1>=0?h-1:b.length-1,e=f-1>=0?f-1:k.length-1);n=b.slice(0,h);o=b.slice(h);m=k.slice(f);l=k.slice(0,f);e=[k[f],k[e],b[h]];s.push([k[f],b[h],b[g]]);s.push(e);b=n.concat(m).concat(l).concat(o)}return{shape:b,
+isolatedPts:s,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),e,f,h,i,k={};e=0;for(f=d.length;e<f;e++)i=d[e].x+":"+d[e].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=e;e=0;for(f=b.length;e<f;e++){h=b[e];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}e=0;for(f=g.length;e<f;e++){h=g[e];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}return b.concat(g)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,d){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,d)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,d,g){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,d)+
 this.b3p3(a,g)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,d=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",e=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=d;THREE.FontUtils.weight=g;THREE.FontUtils.style=e};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,d=a.length;b<d;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
@@ -425,11 +425,11 @@ THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=
 THREE.Bone?g.skinMatrix:g.matrix;var e=g.animationCache.prevKey;g=g.animationCache.nextKey;e.pos=this.data.hierarchy[b].keys[0];e.rot=this.data.hierarchy[b].keys[0];e.scl=this.data.hierarchy[b].keys[0];g.pos=this.getNextKeyWith("pos",b,1);g.rot=this.getNextKeyWith("rot",b,1);g.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.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix: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,g,e,f,h,i,k,l=this.data.JIT.hierarchy,m,q;this.currentTime+=a*this.timeScale;q=this.currentTime;m=this.currentTime%=this.data.length;k=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,t=this.hierarchy.length;n<t;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&l[n][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=l[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=l[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var p=0;p<3;p++){b=c[p];f=i.prevKey[b];h=i.nextKey[b];if(h.time<=q){if(m<q)if(this.loop){f=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<m;)f=h,h=this.getNextKeyWith(b,n,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(b,n,h.index+1);while(h.time<
-m)}i.prevKey[b]=f;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(m-f.time)/(h.time-f.time);g=f[b];e=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",n,f.index-1).pos,this.points[1]=g,this.points[2]=e,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=d*0.33+0.33,g=this.interpolateCatmullRom(this.points,d),b.x=g[0],b.y=g[1],b.z=g[2],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(g,e,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d}}if(this.JITCompile&&l[0][k]===void 0){this.hierarchy[0].update(null,!0);for(n=0;n<this.hierarchy.length;n++)l[n][k]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,g,e,f,h,i,k,l=this.data.JIT.hierarchy,n,o;this.currentTime+=a*this.timeScale;o=this.currentTime;n=this.currentTime%=this.data.length;k=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,s=this.hierarchy.length;m<s;m++)if(a=this.hierarchy[m],i=a.animationCache,this.JITCompile&&l[m][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=l[m][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=l[m][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var p=0;p<3;p++){b=c[p];f=i.prevKey[b];h=i.nextKey[b];if(h.time<=o){if(n<o)if(this.loop){f=this.data.hierarchy[m].keys[0];for(h=this.getNextKeyWith(b,m,1);h.time<n;)f=h,h=this.getNextKeyWith(b,m,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(b,m,h.index+1);while(h.time<
+n)}i.prevKey[b]=f;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(n-f.time)/(h.time-f.time);g=f[b];e=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",m,f.index-1).pos,this.points[1]=g,this.points[2]=e,this.points[3]=this.getNextKeyWith("pos",m,h.index+1).pos,d=d*0.33+0.33,g=this.interpolateCatmullRom(this.points,d),b.x=g[0],b.y=g[1],b.z=g[2],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(g,e,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d}}if(this.JITCompile&&l[0][k]===void 0){this.hierarchy[0].update(null,!0);for(m=0;m<this.hierarchy.length;m++)l[m][k]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],g,e,f,h,i,k;g=(a.length-1)*c;e=Math.floor(g);g-=e;b[0]=e===0?e:e-1;b[1]=e;b[2]=e>a.length-2?e:e+1;b[3]=e>a.length-3?e:e+2;e=a[b[0]];h=a[b[1]];i=a[b[2]];k=a[b[3]];b=g*g;f=g*b;d[0]=this.interpolate(e[0],h[0],i[0],k[0],g,b,f);d[1]=this.interpolate(e[1],h[1],i[1],k[1],g,b,f);d[2]=this.interpolate(e[2],h[2],i[2],k[2],g,b,f);return d};
 THREE.Animation.prototype.interpolate=function(a,c,b,d,g,e,f){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*f+(-3*(c-b)-2*a-d)*e+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<d.length-1?b:d.length-1:b%=d.length;b<d.length;b++)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var d=this.data.hierarchy[c].keys,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]!==void 0)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
@@ -452,14 +452,14 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
 (a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
 this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.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.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),o=g.length,v=0;f=o-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<o-1;f++)v=d*h.chunks[f]/h.total,b.keys[f]={time:v,pos:g[f]};e.hierarchy[0]=
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),r=g.length,t=0;f=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<r-1;f++)t=d*h.chunks[f]/h.total,b.keys[f]={time:t,pos:g[f]};e.hierarchy[0]=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,h=Math.PI/180;this.update=function(a){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%f;this.phi=a>=0?a:a+f;c=this.verticalAngleMap.srcRange;
 a=this.verticalAngleMap.dstRange;c=THREE.Math.mapLinear(this.phi,c[0],c[1],a[0],a[1]);var d=a[1]-a[0];this.phi=b((c-a[0])/d)*d+a[0];c=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;c=THREE.Math.mapLinear(this.theta,c[0],c[1],a[0],a[1]);d=a[1]-a[0];this.theta=b((c-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
-this.debugPath,b=this.spline,f=e(b,10),c=e(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),n=0;n<b.points.length;n++)c=new THREE.Mesh(f,h),c.position.copy(b.points[n]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
+this.debugPath,b=this.spline,f=e(b,10),c=e(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),m=0;m<b.points.length;m++)c=new THREE.Mesh(f,h),c.position.copy(b.points[m]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
 !1)}};THREE.PathControlsIdCounter=0;
 THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
@@ -470,37 +470,37 @@ THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,argu
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,d=new THREE.Vector3,g=new THREE.Vector3,e=new THREE.Matrix4,f=!1,h=1,i=0,k=0,l=0,m=0,q=0,n=window.innerWidth/2,t=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
-this.rotateHorizontally(c*m);this.rotateVertically(c*q)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*k);this.object.translateY(c*l);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);d.set(0,1,0);b.cross(d,
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,d=new THREE.Vector3,g=new THREE.Vector3,e=new THREE.Matrix4,f=!1,h=1,i=0,k=0,l=0,n=0,o=0,m=window.innerWidth/2,s=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
+this.rotateHorizontally(c*n);this.rotateVertically(c*o)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*k);this.object.translateY(c*l);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);d.set(0,1,0);b.cross(d,
 g).normalize();d.cross(g,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=d.x;this.object.matrix.n13=g.x;this.object.matrix.n21=b.y;this.object.matrix.n22=d.y;this.object.matrix.n23=g.y;this.object.matrix.n31=b.z;this.object.matrix.n32=d.z;this.object.matrix.n33=g.z;e.identity();e.n11=Math.cos(this.roll);e.n12=-Math.sin(this.roll);e.n21=Math.sin(this.roll);e.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(e);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){m=(a.clientX-n)/window.innerWidth;q=(a.clientY-t)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){n=(a.clientX-m)/window.innerWidth;o=(a.clientY-s)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
 function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:l=1;break;case 70:l=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:l=0;break;case 70:l=0}},!1)};
 THREE.TrackballControls=function(a,c){var b=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
-new THREE.Vector3(0,0,0);var g=!1,e=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,l=new THREE.Vector2,m=new THREE.Vector2,q=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var d=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
+new THREE.Vector3(0,0,0);var g=!1,e=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,l=new THREE.Vector2,n=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var d=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
 b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(b.object.position).subSelf(b.target);e=b.object.up.clone().setLength(d.y);e.addSelf(b.object.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var c=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c,-a);d.multiplyVector3(f);
-d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(l.y-k.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?k=l:k.y+=(l.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=q.clone().subSelf(m);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
-b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?m=q:m.addSelf(a.sub(q,m).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
-b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),k=l=b.getMouseOnScreen(a.clientX,a.clientY),m=q=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),e!==d.NONE&&(e===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?l=b.getMouseOnScreen(a.clientX,
-a.clientY):e===d.PAN&&!b.noPan&&(q=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),e===d.NONE))e=a.button,e===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?k=l=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(m=q=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
+d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(l.y-k.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?k=l:k.y+=(l.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(n);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
+b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?n=o:n.addSelf(a.sub(o,n).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
+b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),k=l=b.getMouseOnScreen(a.clientX,a.clientY),n=o=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),e!==d.NONE&&(e===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?l=b.getMouseOnScreen(a.clientX,
+a.clientY):e===d.PAN&&!b.noPan&&(o=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),e===d.NONE))e=a.button,e===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?k=l=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(n=o=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
 e=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&e===d.NONE){if(a.keyCode===b.keys[d.ROTATE])e=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)e=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)e=d.PAN;e!==d.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&e!==d.NONE)e=d.NONE},!1)};
-THREE.CubeGeometry=function(a,c,b,d,g,e,f,h){function i(a,b,c,f,h,i,l,n){var m,o,q=d||1,p=g||1,t=h/2,r=i/2,v=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")m="y",p=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")m="x",q=e||1;var w=q+1,z=p+1;h/=q;var B=i/p;for(o=0;o<z;o++)for(i=0;i<w;i++){var I=new THREE.Vector3;I[a]=(i*h-t)*c;I[b]=(o*B-r)*f;I[m]=l;k.vertices.push(new THREE.Vertex(I))}for(o=0;o<p;o++)for(i=0;i<q;i++)k.faces.push(new THREE.Face4(i+
-w*o+v,i+w*(o+1)+v,i+1+w*(o+1)+v,i+1+w*o+v,null,null,n)),k.faceVertexUvs[0].push([new THREE.UV(i/q,o/p),new THREE.UV(i/q,(o+1)/p),new THREE.UV((i+1)/q,(o+1)/p),new THREE.UV((i+1)/q,o/p)])}THREE.Geometry.call(this);var k=this,l=a/2,m=c/2,q=b/2,n,t,p,o,v,w;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(f)}n=0;o=1;t=2;v=3;p=4;w=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var r in h)this.sides[r]!=
-void 0&&(this.sides[r]=h[r]);this.sides.px&&i("z","y",-1,-1,b,c,l,n);this.sides.nx&&i("z","y",1,-1,b,c,-l,o);this.sides.py&&i("x","z",1,1,a,b,m,t);this.sides.ny&&i("x","z",1,-1,a,b,-m,v);this.sides.pz&&i("x","y",1,-1,a,c,q,p);this.sides.nz&&i("x","y",-1,-1,a,c,-q,w);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,c,b,d,g,e){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,d=d||8,g=g||1,h,i,k=[],l=[];for(i=0;i<=g;i++){var m=[],q=[],n=i/g,t=n*(c-a)+a;for(h=0;h<=d;h++){var p=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(t*Math.sin(p*Math.PI*2),-n*b+f,t*Math.cos(p*Math.PI*2))));m.push(this.vertices.length-1);q.push(new THREE.UV(p,n))}k.push(m);l.push(q)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=k[i][h],m=k[i+1][h],q=k[i+1][h+1],n=k[i][h+1],t=
-this.vertices[b].position.clone().setY(0).normalize(),p=this.vertices[m].position.clone().setY(0).normalize(),o=this.vertices[q].position.clone().setY(0).normalize(),v=this.vertices[n].position.clone().setY(0).normalize(),w=l[i][h].clone(),r=l[i+1][h].clone(),s=l[i+1][h+1].clone(),u=l[i][h+1].clone();this.faces.push(new THREE.Face4(b,m,q,n,[t,p,o,v]));this.faceVertexUvs[0].push([w,r,s,u])}if(!e&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)b=k[0][h],m=k[0][h+
-1],q=this.vertices.length-1,t=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),o=new THREE.Vector3(0,1,0),w=l[0][h].clone(),r=l[0][h+1].clone(),s=new THREE.UV(r.u,0),this.faces.push(new THREE.Face3(b,m,q,[t,p,o])),this.faceVertexUvs[0].push([w,r,s])}if(!e&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)b=k[i][h+1],m=k[i][h],q=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),o=new THREE.Vector3(0,-1,0),w=l[i][h+1].clone(),r=l[i][h].clone(),
-s=new THREE.UV(r.u,1),this.faces.push(new THREE.Face3(b,m,q,[t,p,o])),this.faceVertexUvs[0].push([w,r,s])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CubeGeometry=function(a,c,b,d,g,e,f,h){function i(a,b,c,f,h,i,l,m){var n,o,p=d||1,r=g||1,s=h/2,q=i/2,t=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",r=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",p=e||1;var w=p+1,z=r+1;h/=p;var B=i/r;for(o=0;o<z;o++)for(i=0;i<w;i++){var L=new THREE.Vector3;L[a]=(i*h-s)*c;L[b]=(o*B-q)*f;L[n]=l;k.vertices.push(new THREE.Vertex(L))}for(o=0;o<r;o++)for(i=0;i<p;i++)k.faces.push(new THREE.Face4(i+
+w*o+t,i+w*(o+1)+t,i+1+w*(o+1)+t,i+1+w*o+t,null,null,m)),k.faceVertexUvs[0].push([new THREE.UV(i/p,o/r),new THREE.UV(i/p,(o+1)/r),new THREE.UV((i+1)/p,(o+1)/r),new THREE.UV((i+1)/p,o/r)])}THREE.Geometry.call(this);var k=this,l=a/2,n=c/2,o=b/2,m,s,p,r,t,w;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;r=1;s=2;t=3;p=4;w=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var q in h)this.sides[q]!=
+void 0&&(this.sides[q]=h[q]);this.sides.px&&i("z","y",-1,-1,b,c,l,m);this.sides.nx&&i("z","y",1,-1,b,c,-l,r);this.sides.py&&i("x","z",1,1,a,b,n,s);this.sides.ny&&i("x","z",1,-1,a,b,-n,t);this.sides.pz&&i("x","y",1,-1,a,c,o,p);this.sides.nz&&i("x","y",-1,-1,a,c,-o,w);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(a,c,b,d,g,e){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,d=d||8,g=g||1,h,i,k=[],l=[];for(i=0;i<=g;i++){var n=[],o=[],m=i/g,s=m*(c-a)+a;for(h=0;h<=d;h++){var p=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(s*Math.sin(p*Math.PI*2),-m*b+f,s*Math.cos(p*Math.PI*2))));n.push(this.vertices.length-1);o.push(new THREE.UV(p,m))}k.push(n);l.push(o)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=k[i][h],n=k[i+1][h],o=k[i+1][h+1],m=k[i][h+1],s=
+this.vertices[b].position.clone().setY(0).normalize(),p=this.vertices[n].position.clone().setY(0).normalize(),r=this.vertices[o].position.clone().setY(0).normalize(),t=this.vertices[m].position.clone().setY(0).normalize(),w=l[i][h].clone(),q=l[i+1][h].clone(),C=l[i+1][h+1].clone(),v=l[i][h+1].clone();this.faces.push(new THREE.Face4(b,n,o,m,[s,p,r,t]));this.faceVertexUvs[0].push([w,q,C,v])}if(!e&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)b=k[0][h],n=k[0][h+
+1],o=this.vertices.length-1,s=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),w=l[0][h].clone(),q=l[0][h+1].clone(),C=new THREE.UV(q.u,0),this.faces.push(new THREE.Face3(b,n,o,[s,p,r])),this.faceVertexUvs[0].push([w,q,C])}if(!e&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)b=k[i][h+1],n=k[i][h],o=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),w=l[i][h+1].clone(),q=l[i][h].clone(),
+C=new THREE.UV(q.u,1),this.faces.push(new THREE.Face3(b,n,o,[s,p,r])),this.faceVertexUvs[0].push([w,q,C])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,d=a.length,g;this.shapebb=a[d-1].getBoundingBox();for(b=0;b<d;b++)g=a[b],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
-h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(C=a.length;--C>=0;){j=C;N=C-1;N<0&&(N=a.length-1);for(var b=
-0,c=n+l*2,b=0;b<c;b++){var d=da*b,e=da*(b+1),f=ga+j+d,g=ga+j+e,k=f,d=ga+N+d,e=ga+N+e,m=g;k+=y;d+=y;e+=y;m+=y;F.faces.push(new THREE.Face4(k,d,e,m,null,null,s));s&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(F.vertices[f].position.z+i)/e,g=(F.vertices[g].position.z+i)/e,F.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function e(a,b,c){F.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=y;b+=y;c+=y;F.faces.push(new THREE.Face3(a,b,c,
-null,null,r));if(r){var d=u.maxY,e=u.maxX,f=F.vertices[b].position.x,b=F.vertices[b].position.y,g=F.vertices[c].position.x,c=F.vertices[c].position.y;F.faceVertexUvs[0].push([new THREE.UV(F.vertices[a].position.x/e,F.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,k=c.bevelSize!==void 0?c.bevelSize:i-2,l=c.bevelSegments!==void 0?c.bevelSegments:3,m=c.bevelEnabled!==void 0?c.bevelEnabled:!0,
-q=c.curveSegments!==void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,t=c.bendPath,p=c.extrudePath,o,v=!1,w=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,r=c.material,s=c.extrudeMaterial,u=this.shapebb;if(p)o=p.getPoints(q),n=o.length,v=!0,m=!1;m||(k=i=l=0);var x,H,G,F=this,y=this.vertices.length;t&&a.addWrapPath(t);q=w?a.extractAllSpacedPoints(q):a.extractAllPoints(q);t=q.shape;q=q.holes;if(p=!THREE.Shape.Utils.isClockWise(t)){t=t.reverse();H=0;for(G=q.length;H<G;H++)x=q[H],THREE.Shape.Utils.isClockWise(x)&&
-(q[H]=x.reverse());p=!1}p=THREE.Shape.Utils.triangulateShape(t,q);w=t;H=0;for(G=q.length;H<G;H++)x=q[H],t=t.concat(x);var C,O,J,$,L,P,da=t.length,ja=p.length,R=[];C=0;O=w.length;j=O-1;for(N=C+1;C<O;C++,j++,N++)j===O&&(j=0),N===O&&(N=0),R[C]=d(w[C],w[j],w[N]);var z=[],B,I=R.concat();H=0;for(G=q.length;H<G;H++){x=q[H];B=[];C=0;O=x.length;j=O-1;for(N=C+1;C<O;C++,j++,N++)j===O&&(j=0),N===O&&(N=0),B[C]=d(x[C],x[j],x[N]);z.push(B);I=I.concat(B)}for(J=0;J<l;J++){$=J/l;L=i*(1-$);$=k*Math.sin($*Math.PI/2);
-C=0;for(O=w.length;C<O;C++)P=b(w[C],R[C],$),e(P.x,P.y,-L);H=0;for(G=q.length;H<G;H++){x=q[H];B=z[H];C=0;for(O=x.length;C<O;C++)P=b(x[C],B[C],$),e(P.x,P.y,-L)}}$=k;for(C=0;C<da;C++)P=m?b(t[C],I[C],$):t[C],v?e(P.x,P.y+o[0].y,o[0].x):e(P.x,P.y,0);for(J=1;J<=n;J++)for(C=0;C<da;C++)P=m?b(t[C],I[C],$):t[C],v?e(P.x,P.y+o[J-1].y,o[J-1].x):e(P.x,P.y,h/n*J);for(J=l-1;J>=0;J--){$=J/l;L=i*(1-$);$=k*Math.sin($*Math.PI/2);C=0;for(O=w.length;C<O;C++)P=b(w[C],R[C],$),e(P.x,P.y,h+L);H=0;for(G=q.length;H<G;H++){x=
-q[H];B=z[H];C=0;for(O=x.length;C<O;C++)P=b(x[C],B[C],$),v?e(P.x,P.y+o[n-1].y,o[n-1].x+L):e(P.x,P.y,h+L)}}if(m){m=da*0;for(C=0;C<ja;C++)k=p[C],f(k[2]+m,k[1]+m,k[0]+m);m=da*(n+l*2);for(C=0;C<ja;C++)k=p[C],f(k[0]+m,k[1]+m,k[2]+m)}else{for(C=0;C<ja;C++)k=p[C],f(k[2],k[1],k[0]);for(C=0;C<ja;C++)k=p[C],f(k[0]+da*n,k[1]+da*n,k[2]+da*n)}var j,N,ga=0;g(w);ga+=w.length;H=0;for(G=q.length;H<G;H++)x=q[H],g(x),ga+=x.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(D=a.length;--D>=0;){j=D;P=D-1;P<0&&(P=a.length-1);for(var b=
+0,c=m+l*2,b=0;b<c;b++){var d=da*b,e=da*(b+1),f=fa+j+d,g=fa+j+e,k=f,d=fa+P+d,e=fa+P+e,n=g;k+=y;d+=y;e+=y;n+=y;G.faces.push(new THREE.Face4(k,d,e,n,null,null,C));C&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(G.vertices[f].position.z+i)/e,g=(G.vertices[g].position.z+i)/e,G.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function e(a,b,c){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=y;b+=y;c+=y;G.faces.push(new THREE.Face3(a,b,c,
+null,null,q));if(q){var d=v.maxY,e=v.maxX,f=G.vertices[b].position.x,b=G.vertices[b].position.y,g=G.vertices[c].position.x,c=G.vertices[c].position.y;G.faceVertexUvs[0].push([new THREE.UV(G.vertices[a].position.x/e,G.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,k=c.bevelSize!==void 0?c.bevelSize:i-2,l=c.bevelSegments!==void 0?c.bevelSegments:3,n=c.bevelEnabled!==void 0?c.bevelEnabled:!0,
+o=c.curveSegments!==void 0?c.curveSegments:12,m=c.steps!==void 0?c.steps:1,s=c.bendPath,p=c.extrudePath,r,t=!1,w=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,q=c.material,C=c.extrudeMaterial,v=this.shapebb;if(p)r=p.getPoints(o),m=r.length,t=!0,n=!1;n||(k=i=l=0);var x,I,K,G=this,y=this.vertices.length;s&&a.addWrapPath(s);o=w?a.extractAllSpacedPoints(o):a.extractAllPoints(o);s=o.shape;o=o.holes;if(p=!THREE.Shape.Utils.isClockWise(s)){s=s.reverse();I=0;for(K=o.length;I<K;I++)x=o[I],THREE.Shape.Utils.isClockWise(x)&&
+(o[I]=x.reverse());p=!1}p=THREE.Shape.Utils.triangulateShape(s,o);w=s;I=0;for(K=o.length;I<K;I++)x=o[I],s=s.concat(x);var D,Q,H,aa,M,R,da=s.length,ja=p.length,T=[];D=0;Q=w.length;j=Q-1;for(P=D+1;D<Q;D++,j++,P++)j===Q&&(j=0),P===Q&&(P=0),T[D]=d(w[D],w[j],w[P]);var z=[],B,L=T.concat();I=0;for(K=o.length;I<K;I++){x=o[I];B=[];D=0;Q=x.length;j=Q-1;for(P=D+1;D<Q;D++,j++,P++)j===Q&&(j=0),P===Q&&(P=0),B[D]=d(x[D],x[j],x[P]);z.push(B);L=L.concat(B)}for(H=0;H<l;H++){aa=H/l;M=i*(1-aa);aa=k*Math.sin(aa*Math.PI/
+2);D=0;for(Q=w.length;D<Q;D++)R=b(w[D],T[D],aa),e(R.x,R.y,-M);I=0;for(K=o.length;I<K;I++){x=o[I];B=z[I];D=0;for(Q=x.length;D<Q;D++)R=b(x[D],B[D],aa),e(R.x,R.y,-M)}}aa=k;for(D=0;D<da;D++)R=n?b(s[D],L[D],aa):s[D],t?e(R.x,R.y+r[0].y,r[0].x):e(R.x,R.y,0);for(H=1;H<=m;H++)for(D=0;D<da;D++)R=n?b(s[D],L[D],aa):s[D],t?e(R.x,R.y+r[H-1].y,r[H-1].x):e(R.x,R.y,h/m*H);for(H=l-1;H>=0;H--){aa=H/l;M=i*(1-aa);aa=k*Math.sin(aa*Math.PI/2);D=0;for(Q=w.length;D<Q;D++)R=b(w[D],T[D],aa),e(R.x,R.y,h+M);I=0;for(K=o.length;I<
+K;I++){x=o[I];B=z[I];D=0;for(Q=x.length;D<Q;D++)R=b(x[D],B[D],aa),t?e(R.x,R.y+r[m-1].y,r[m-1].x+M):e(R.x,R.y,h+M)}}if(n){n=da*0;for(D=0;D<ja;D++)k=p[D],f(k[2]+n,k[1]+n,k[0]+n);n=da*(m+l*2);for(D=0;D<ja;D++)k=p[D],f(k[0]+n,k[1]+n,k[2]+n)}else{for(D=0;D<ja;D++)k=p[D],f(k[2],k[1],k[0]);for(D=0;D<ja;D++)k=p[D],f(k[0]+da*m,k[1]+da*m,k[2]+da*m)}var j,P,fa=0;g(w);fa+=w.length;I=0;for(K=o.length;I<K;I++)x=o[I],g(x),fa+=x.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){d.faces.push(new THREE.Face3(a,b,c))}function d(a,b){var d=g.vertices[a].position,e=g.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var g=this,e=new THREE.Geometry;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,e);b(0,5,1,e);b(0,1,7,e);b(0,7,10,e);b(0,10,11,e);b(1,5,9,e);b(5,11,4,e);b(11,10,2,e);b(10,7,6,e);b(7,1,8,e);b(3,9,4,e);b(3,4,2,e);b(3,2,6,e);b(3,6,8,e);b(3,8,9,e);b(4,9,5,e);b(2,4,11,e);b(6,2,10,e);b(8,6,7,e);b(9,8,1,e);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in e.faces){var i=d(e.faces[h].a,e.faces[h].b),k=d(e.faces[h].b,e.faces[h].c),l=d(e.faces[h].c,e.faces[h].a);b(e.faces[h].a,i,l,a);b(e.faces[h].b,k,
@@ -513,19 +513,19 @@ f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);var g,e=a/2,f=c/2,b=b||1,d=d||1,h=b+1,i=d+1;a/=b;var k=c/d;for(g=0;g<i;g++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-e,-(g*k-f),0)));for(g=0;g<d;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+h*g,c+h*(g+1),c+1+h*(g+1),c+1+h*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/d),new THREE.UV(c/b,(g+1)/d),new THREE.UV((c+1)/b,(g+1)/d),new THREE.UV((c+1)/b,g/d)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,d,g=Math.PI,e=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){d=b/f;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),k=[],l=0;for(d=0;d<e;d++){var m=2*d/e,q=i*Math.sin(m*g),m=i*Math.cos(m*g);(b==0||b==f)&&d>0||(l=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,h,q)))-1);k.push(l)}c.push(k)}for(var n,t,p,g=c.length,b=0;b<g;b++)if(e=c[b].length,b>0)for(d=0;d<e;d++){k=d==e-1;f=c[b][k?0:d+1];h=c[b][k?e-1:d];i=c[b-1][k?
-e-1:d];k=c[b-1][k?0:d+1];q=b/(g-1);n=(b-1)/(g-1);t=(d+1)/e;var m=d/e,l=new THREE.UV(1-t,q),q=new THREE.UV(1-m,q),m=new THREE.UV(1-m,n),o=new THREE.UV(1-t,n);b<c.length-1&&(n=this.vertices[f].position.clone(),t=this.vertices[h].position.clone(),p=this.vertices[i].position.clone(),n.normalize(),t.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,h,i,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([l,q,m]));b>1&&(n=
-this.vertices[f].position.clone(),t=this.vertices[i].position.clone(),p=this.vertices[k].position.clone(),n.normalize(),t.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,i,k,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([l,m,o]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,d,g=Math.PI,e=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){d=b/f;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),k=[],l=0;for(d=0;d<e;d++){var n=2*d/e,o=i*Math.sin(n*g),n=i*Math.cos(n*g);(b==0||b==f)&&d>0||(l=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,h,o)))-1);k.push(l)}c.push(k)}for(var m,s,p,g=c.length,b=0;b<g;b++)if(e=c[b].length,b>0)for(d=0;d<e;d++){k=d==e-1;f=c[b][k?0:d+1];h=c[b][k?e-1:d];i=c[b-1][k?
+e-1:d];k=c[b-1][k?0:d+1];o=b/(g-1);m=(b-1)/(g-1);s=(d+1)/e;var n=d/e,l=new THREE.UV(1-s,o),o=new THREE.UV(1-n,o),n=new THREE.UV(1-n,m),r=new THREE.UV(1-s,m);b<c.length-1&&(m=this.vertices[f].position.clone(),s=this.vertices[h].position.clone(),p=this.vertices[i].position.clone(),m.normalize(),s.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,h,i,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(s.x,s.y,s.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([l,o,n]));b>1&&(m=
+this.vertices[f].position.clone(),s=this.vertices[i].position.clone(),p=this.vertices[k].position.clone(),m.normalize(),s.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,i,k,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(s.x,s.y,s.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([l,n,r]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var d=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=this.getFace(),b=this.size/c.resolution,d=
-0,g=String(a).split(""),e=g.length,f=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var e=[],f,h,i,k,l,m,q,n,t,p,o,v=c.glyphs[a]||c.glyphs["?"];if(v){if(v.o){c=v._cachedOutline||(v._cachedOutline=v.o.split(" "));k=c.length;for(a=0;a<k;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;l=c[a++]*b;e.push(new THREE.Vector2(i,l));g.moveTo(i,l);break;case "l":i=c[a++]*b+d;l=c[a++]*b;e.push(new THREE.Vector2(i,
-l));g.lineTo(i,l);break;case "q":i=c[a++]*b+d;l=c[a++]*b;n=c[a++]*b+d;t=c[a++]*b;g.quadraticCurveTo(n,t,i,l);if(f=e[e.length-1]){m=f.x;q=f.y;f=1;for(h=this.divisions;f<=h;f++){var w=f/h,r=THREE.Shape.Utils.b2(w,m,n,i),w=THREE.Shape.Utils.b2(w,q,t,l);e.push(new THREE.Vector2(r,w))}}break;case "b":if(i=c[a++]*b+d,l=c[a++]*b,n=c[a++]*b+d,t=c[a++]*-b,p=c[a++]*b+d,o=c[a++]*-b,g.bezierCurveTo(i,l,n,t,p,o),f=e[e.length-1]){m=f.x;q=f.y;f=1;for(h=this.divisions;f<=h;f++)w=f/h,r=THREE.Shape.Utils.b3(w,m,n,
-p,i),w=THREE.Shape.Utils.b3(w,q,t,o,l),e.push(new THREE.Vector2(r,w))}}}return{offset:v.ha*b,points:e,path:g}}}};
-(function(a){var c=function(a){for(var c=a.length,g=0,e=c-1,f=0;f<c;e=f++)g+=a[e].x*a[f].y-a[f].x*a[e].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var e=[],f=[],h=[],i,k,l;if(c(a)>0)for(k=0;k<g;k++)f[k]=k;else for(k=0;k<g;k++)f[k]=g-1-k;var m=2*g;for(k=g-1;g>2;){if(m--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);l=k+1;g<=l&&(l=0);var q;a:{q=a;var n=i,t=k,p=l,o=g,v=f,w=void 0,r=void 0,s=void 0,
-u=void 0,x=void 0,H=void 0,G=void 0,F=void 0,y=void 0,r=q[v[n]].x,s=q[v[n]].y,u=q[v[t]].x,x=q[v[t]].y,H=q[v[p]].x,G=q[v[p]].y;if(1.0E-10>(u-r)*(G-s)-(x-s)*(H-r))q=!1;else{for(w=0;w<o;w++)if(!(w==n||w==t||w==p)){var F=q[v[w]].x,y=q[v[w]].y,C=void 0,O=void 0,J=void 0,$=void 0,L=void 0,P=void 0,da=void 0,ja=void 0,R=void 0,z=void 0,B=void 0,I=void 0,C=J=L=void 0,C=H-u,O=G-x,J=r-H,$=s-G,L=u-r,P=x-s,da=F-r,ja=y-s,R=F-u,z=y-x,B=F-H,I=y-G,C=C*z-O*R,L=L*ja-P*da,J=J*I-$*B;if(C>=0&&J>=0&&L>=0){q=!1;break a}}q=
-!0}}if(q){e.push([a[f[i]],a[f[k]],a[f[l]]]);h.push([f[i],f[k],f[l]]);i=k;for(l=k+1;l<g;i++,l++)f[i]=f[l];g--;m=2*g}}if(d)return h;return e};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+0,g=String(a).split(""),e=g.length,f=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var e=[],f,h,i,k,l,n,o,m,s,p,r,t=c.glyphs[a]||c.glyphs["?"];if(t){if(t.o){c=t._cachedOutline||(t._cachedOutline=t.o.split(" "));k=c.length;for(a=0;a<k;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;l=c[a++]*b;e.push(new THREE.Vector2(i,l));g.moveTo(i,l);break;case "l":i=c[a++]*b+d;l=c[a++]*b;e.push(new THREE.Vector2(i,
+l));g.lineTo(i,l);break;case "q":i=c[a++]*b+d;l=c[a++]*b;m=c[a++]*b+d;s=c[a++]*b;g.quadraticCurveTo(m,s,i,l);if(f=e[e.length-1]){n=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++){var w=f/h,q=THREE.Shape.Utils.b2(w,n,m,i),w=THREE.Shape.Utils.b2(w,o,s,l);e.push(new THREE.Vector2(q,w))}}break;case "b":if(i=c[a++]*b+d,l=c[a++]*b,m=c[a++]*b+d,s=c[a++]*-b,p=c[a++]*b+d,r=c[a++]*-b,g.bezierCurveTo(i,l,m,s,p,r),f=e[e.length-1]){n=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++)w=f/h,q=THREE.Shape.Utils.b3(w,n,m,
+p,i),w=THREE.Shape.Utils.b3(w,o,s,r,l),e.push(new THREE.Vector2(q,w))}}}return{offset:t.ha*b,points:e,path:g}}}};
+(function(a){var c=function(a){for(var c=a.length,g=0,e=c-1,f=0;f<c;e=f++)g+=a[e].x*a[f].y-a[f].x*a[e].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var e=[],f=[],h=[],i,k,l;if(c(a)>0)for(k=0;k<g;k++)f[k]=k;else for(k=0;k<g;k++)f[k]=g-1-k;var n=2*g;for(k=g-1;g>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);l=k+1;g<=l&&(l=0);var o;a:{o=a;var m=i,s=k,p=l,r=g,t=f,w=void 0,q=void 0,C=void 0,
+v=void 0,x=void 0,I=void 0,K=void 0,G=void 0,y=void 0,q=o[t[m]].x,C=o[t[m]].y,v=o[t[s]].x,x=o[t[s]].y,I=o[t[p]].x,K=o[t[p]].y;if(1.0E-10>(v-q)*(K-C)-(x-C)*(I-q))o=!1;else{for(w=0;w<r;w++)if(!(w==m||w==s||w==p)){var G=o[t[w]].x,y=o[t[w]].y,D=void 0,Q=void 0,H=void 0,aa=void 0,M=void 0,R=void 0,da=void 0,ja=void 0,T=void 0,z=void 0,B=void 0,L=void 0,D=H=M=void 0,D=I-v,Q=K-x,H=q-I,aa=C-K,M=v-q,R=x-C,da=G-q,ja=y-C,T=G-v,z=y-x,B=G-I,L=y-K,D=D*z-Q*T,M=M*ja-R*da,H=H*L-aa*B;if(D>=0&&H>=0&&M>=0){o=!1;break a}}o=
+!0}}if(o){e.push([a[f[i]],a[f[k]],a[f[l]]]);h.push([f[i],f[k],f[l]]);i=k;for(l=k+1;l<g;i++,l++)f[i]=f[l];g--;n=2*g}}if(d)return h;return e};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,c,b,d,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var e=d/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(e);g.y=this.radius*Math.sin(e);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(e);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(e);h.z=
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(h.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var g=(this.segmentsT+1)*b+d-1,e=(this.segmentsT+1)*(b-1)+d-1,f=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(g,e,f,h,[c[g],c[e],c[f],c[h]]);i.normal.addSelf(c[g]);i.normal.addSelf(c[e]);i.normal.addSelf(c[f]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[g].clone(),a[e].clone(),a[f].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
@@ -533,13 +533,13 @@ THREE.TorusKnotGeometry=function(a,c,b,d,g,e,f){function h(a,b,c,d,e,f){b=c/d*a;
 this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,g=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=i.x-g.x;b.y=i.y-g.y;b.z=i.z-g.z;d.x=i.x+g.x;d.y=i.y+g.y;d.z=i.z+g.z;e.cross(b,d);d.cross(e,b);e.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=i*d.x+f*e.x;g.y+=i*d.y+f*e.y;g.z+=i*d.z+f*e.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
 g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,e=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][e],e=this.grid[a][e],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),l=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,e));this.faceVertexUvs[0].push([f,i,k,l])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){k.vertexColors=[];for(var j,l,n,m=0;m<4;m++){n=i[m];j=new THREE.Color;j.setRGB(0,0,0);for(var o=0;o<n.length;o++)l=h.vertexColors[n[o]-1],j.r+=l.r,j.g+=l.g,j.b+=l.b;j.r/=n.length;j.g/=n.length;j.b/=n.length;k.vertexColors[m]=j}}g.push(k);(!f.supportUVs||q.length!=0)&&e.push([q[a],q[b],q[c],q[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],g=[],e=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],l={},m={},q=[],n,t,p,o,v,w=a.faceVertexUvs[0];n=0;for(t=w.length;n<t;n++){p=0;for(o=w[n].length;p<o;p++)v=d[n]["abcd".charAt(p)],q[v]||(q[v]=w[n][p])}var r;n=0;for(t=d.length;n<t;n++)if(v=d[n],k.push(v.centroid),i.push(new THREE.Vertex(v.centroid)),f.supportUVs&&q.length!=0){r=new THREE.UV;if(v instanceof THREE.Face3)r.u=q[v.a].u+q[v.b].u+q[v.c].u,r.v=q[v.a].v+q[v.b].v+q[v.c].v,r.u/=3,r.v/=3;else if(v instanceof THREE.Face4)r.u=
-q[v.a].u+q[v.b].u+q[v.c].u+q[v.d].u,r.v=q[v.a].v+q[v.b].v+q[v.c].v+q[v.d].v,r.u/=4,r.v/=4;q.push(r)}t=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var s=0,w=h.length,u,x,H={},G={},F=function(a,
-b){H[a]===void 0&&(H[a]=[]);H[a].push(b)},y=function(a,b){G[a]===void 0&&(G[a]={});G[a][b]=null};for(n in t){r=t[n];u=n.split("_");x=u[0];u=u[1];F(x,[x,u]);F(u,[x,u]);p=0;for(o=r.length;p<o;p++)v=r[p],y(x,v,n),y(u,v,n);r.length<2&&(m[n]=!0)}for(n in t)if(r=t[n],v=r[0],r=r[1],u=n.split("_"),x=u[0],u=u[1],o=new THREE.Vector3,m[n]?(o.addSelf(h[x].position),o.addSelf(h[u].position),o.multiplyScalar(0.5)):(o.addSelf(k[v]),o.addSelf(k[r]),o.addSelf(h[x].position),o.addSelf(h[u].position),o.multiplyScalar(0.25)),
-l[n]=w+d.length+s,i.push(new THREE.Vertex(o)),s++,f.supportUVs&&q.length!=0)r=new THREE.UV,r.u=q[x].u+q[u].u,r.v=q[x].v+q[u].v,r.u/=2,r.v/=2,q.push(r);var C,O;u=["123","12","2","23"];o=["123","23","3","31"];var F=["123","31","1","12"],y=["1234","12","2","23"],J=["1234","23","3","34"],$=["1234","34","4","41"],L=["1234","41","1","12"];n=0;for(t=k.length;n<t;n++)v=d[n],r=w+n,v instanceof THREE.Face3?(s=b(v.a,v.b),x=b(v.b,v.c),C=b(v.c,v.a),c(r,l[s],v.b,l[x],v,u),c(r,l[x],v.c,l[C],v,o),c(r,l[C],v.a,l[s],
-v,F)):v instanceof THREE.Face4?(s=b(v.a,v.b),x=b(v.b,v.c),C=b(v.c,v.d),O=b(v.d,v.a),c(r,l[s],v.b,l[x],v,y),c(r,l[x],v.c,l[C],v,J),c(r,l[C],v.d,l[O],v,$),c(r,l[O],v.a,l[s],v,L)):console.log("face should be a face!",v);d=i;i=new THREE.Vector3;l=new THREE.Vector3;n=0;for(t=h.length;n<t;n++)if(H[n]!==void 0){i.set(0,0,0);l.set(0,0,0);v=new THREE.Vector3(0,0,0);r=0;for(p in G[n])i.addSelf(k[p]),r++;s=0;w=H[n].length;for(p=0;p<w;p++)m[b(H[n][p][0],H[n][p][1])]&&s++;if(s!=2){i.divideScalar(r);for(p=0;p<
-w;p++)r=H[n][p],r=h[r[0]].position.clone().addSelf(h[r[1]].position).divideScalar(2),l.addSelf(r);l.divideScalar(w);v.addSelf(h[n].position);v.multiplyScalar(w-3);v.addSelf(i);v.addSelf(l.multiplyScalar(2));v.divideScalar(w);d[n].position=v}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=e;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){k.vertexColors=[];for(var j,l,m,n=0;n<4;n++){m=i[n];j=new THREE.Color;j.setRGB(0,0,0);for(var p=0;p<m.length;p++)l=h.vertexColors[m[p]-1],j.r+=l.r,j.g+=l.g,j.b+=l.b;j.r/=m.length;j.g/=m.length;j.b/=m.length;k.vertexColors[n]=j}}g.push(k);(!f.supportUVs||o.length!=0)&&e.push([o[a],o[b],o[c],o[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],g=[],e=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],l={},n={},o=[],m,s,p,r,t,w=a.faceVertexUvs[0];m=0;for(s=w.length;m<s;m++){p=0;for(r=w[m].length;p<r;p++)t=d[m]["abcd".charAt(p)],o[t]||(o[t]=w[m][p])}var q;m=0;for(s=d.length;m<s;m++)if(t=d[m],k.push(t.centroid),i.push(new THREE.Vertex(t.centroid)),f.supportUVs&&o.length!=0){q=new THREE.UV;if(t instanceof THREE.Face3)q.u=o[t.a].u+o[t.b].u+o[t.c].u,q.v=o[t.a].v+o[t.b].v+o[t.c].v,q.u/=3,q.v/=3;else if(t instanceof THREE.Face4)q.u=
+o[t.a].u+o[t.b].u+o[t.c].u+o[t.d].u,q.v=o[t.a].v+o[t.b].v+o[t.c].v+o[t.d].v,q.u/=4,q.v/=4;o.push(q)}s=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var C=0,w=h.length,v,x,I={},K={},G=function(a,
+b){I[a]===void 0&&(I[a]=[]);I[a].push(b)},y=function(a,b){K[a]===void 0&&(K[a]={});K[a][b]=null};for(m in s){q=s[m];v=m.split("_");x=v[0];v=v[1];G(x,[x,v]);G(v,[x,v]);p=0;for(r=q.length;p<r;p++)t=q[p],y(x,t,m),y(v,t,m);q.length<2&&(n[m]=!0)}for(m in s)if(q=s[m],t=q[0],q=q[1],v=m.split("_"),x=v[0],v=v[1],r=new THREE.Vector3,n[m]?(r.addSelf(h[x].position),r.addSelf(h[v].position),r.multiplyScalar(0.5)):(r.addSelf(k[t]),r.addSelf(k[q]),r.addSelf(h[x].position),r.addSelf(h[v].position),r.multiplyScalar(0.25)),
+l[m]=w+d.length+C,i.push(new THREE.Vertex(r)),C++,f.supportUVs&&o.length!=0)q=new THREE.UV,q.u=o[x].u+o[v].u,q.v=o[x].v+o[v].v,q.u/=2,q.v/=2,o.push(q);var D,Q;v=["123","12","2","23"];r=["123","23","3","31"];var G=["123","31","1","12"],y=["1234","12","2","23"],H=["1234","23","3","34"],aa=["1234","34","4","41"],M=["1234","41","1","12"];m=0;for(s=k.length;m<s;m++)t=d[m],q=w+m,t instanceof THREE.Face3?(C=b(t.a,t.b),x=b(t.b,t.c),D=b(t.c,t.a),c(q,l[C],t.b,l[x],t,v),c(q,l[x],t.c,l[D],t,r),c(q,l[D],t.a,l[C],
+t,G)):t instanceof THREE.Face4?(C=b(t.a,t.b),x=b(t.b,t.c),D=b(t.c,t.d),Q=b(t.d,t.a),c(q,l[C],t.b,l[x],t,y),c(q,l[x],t.c,l[D],t,H),c(q,l[D],t.d,l[Q],t,aa),c(q,l[Q],t.a,l[C],t,M)):console.log("face should be a face!",t);d=i;i=new THREE.Vector3;l=new THREE.Vector3;m=0;for(s=h.length;m<s;m++)if(I[m]!==void 0){i.set(0,0,0);l.set(0,0,0);t=new THREE.Vector3(0,0,0);q=0;for(p in K[m])i.addSelf(k[p]),q++;C=0;w=I[m].length;for(p=0;p<w;p++)n[b(I[m][p][0],I[m][p][1])]&&C++;if(C!=2){i.divideScalar(q);for(p=0;p<
+w;p++)q=I[m][p],q=h[q[0]].position.clone().addSelf(h[q[1]].position).divideScalar(2),l.addSelf(q);l.divideScalar(w);t.addSelf(h[m].position);t.multiplyScalar(w-3);t.addSelf(i);t.addSelf(l.multiplyScalar(2));t.divideScalar(w);d[m].position=t}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=e;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
 THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(c[d],b)},hasNormals:function(a){var c,b,d=a.materials.length;for(b=0;b<d;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
@@ -547,121 +547,121 @@ a}function d(a,c){var d=new Image;d.onload=function(){if(!b(this.width)||!b(this
 if(f[1]!=1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[b].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[b].wrapT=f[h[1]]}d(a[b],c+"/"+e)}function e(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,h,i;h="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
 if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=e(a.colorDiffuse);
 else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=e(a.colorSpecular);if(a.colorAmbient)f.ambient=e(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&c&&g(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&c&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var k=THREE.ShaderUtils.lib.normal,l=THREE.UniformsUtils.clone(k.uniforms),m=f.color;h=f.specular;i=f.ambient;var q=f.shininess;l.tNormal.texture=f.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(f.map)l.tDiffuse.texture=f.map,l.enableDiffuse.value=!0;if(f.specularMap)l.tSpecular.texture=f.specularMap,l.enableSpecular.value=!0;if(f.lightMap)l.tAO.texture=
-f.lightMap,l.enableAO.value=!0;l.uDiffuseColor.value.setHex(m);l.uSpecularColor.value.setHex(h);l.uAmbientColor.value.setHex(i);l.uShininess.value=q;if(f.opacity)l.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:l,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+a.mapSpecular&&c&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var k=THREE.ShaderUtils.lib.normal,l=THREE.UniformsUtils.clone(k.uniforms),n=f.color;h=f.specular;i=f.ambient;var o=f.shininess;l.tNormal.texture=f.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(f.map)l.tDiffuse.texture=f.map,l.enableDiffuse.value=!0;if(f.specularMap)l.tSpecular.texture=f.specularMap,l.enableSpecular.value=!0;if(f.lightMap)l.tAO.texture=
+f.lightMap,l.enableAO.value=!0;l.uDiffuseColor.value.setHex(n);l.uSpecularColor.value.setHex(h);l.uAmbientColor.value.setHex(i);l.uShininess.value=o;if(f.opacity)l.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:l,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
 THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype.load=function(a,c,b,d){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var g=a,a=g.model,c=g.callback,b=g.texture_path,d=g.bin_path}var b=b?b:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),g=Date.now(),a=new Worker(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
 c,d,b,e)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(g)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g,e){var f=new XMLHttpRequest,h=d+"/"+a,i=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,g,c):alert("Couldn't load ["+h+"] ["+f.status+"]"):f.readyState==3?e&&(i==0&&(i=f.getResponseHeader("Content-Length")),e({total:i,loaded:f.responseText.length})):f.readyState==2&&(i=f.getResponseHeader("Content-Length"))};f.open("GET",h,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
 f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a,b){var d=l(a,b),e=l(a,b+1),f=l(a,b+2),g=l(a,b+3),h=(g<<1&255|f>>7)-127;d|=(f&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(g>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function g(a,b){var c=l(a,b),d=l(a,b+1),e=l(a,b+2);return(l(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=l(a,b);return(l(a,b+1)<<8)+c}function k(a,b){var c=l(a,b);return c>127?c-256:c}function l(a,b){return a.charCodeAt(b)&255}function m(b){var c,
-d,e;c=g(a,b);d=g(a,b+x);e=g(a,b+H);b=i(a,b+G);v.faces.push(new THREE.Face3(c,d,e,null,null,b))}function q(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+x);e=g(a,b+H);f=i(a,b+G);j=g(a,b+F);k=g(a,b+y);l=g(a,b+C);var b=s[k*3],n=s[k*3+1];k=s[k*3+2];var m=s[l*3],o=s[l*3+1];l=s[l*3+2];v.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(s[j*3],s[j*3+1],s[j*3+2]),new THREE.Vector3(b,n,k),new THREE.Vector3(m,o,l)],null,f))}function n(b){var c,d,e,f;c=g(a,b);d=g(a,b+O);e=g(a,b+J);f=g(a,b+$);b=i(a,b+L);v.faces.push(new THREE.Face4(c,
-d,e,f,null,null,b))}function t(b){var c,d,e,f,j,k,l,n,m;c=g(a,b);d=g(a,b+O);e=g(a,b+J);f=g(a,b+$);j=i(a,b+L);k=g(a,b+P);l=g(a,b+da);n=g(a,b+ja);m=g(a,b+R);var b=s[l*3],o=s[l*3+1];l=s[l*3+2];var p=s[n*3],D=s[n*3+1];n=s[n*3+2];var q=s[m*3],r=s[m*3+1];m=s[m*3+2];v.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(s[k*3],s[k*3+1],s[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(p,D,n),new THREE.Vector3(q,r,m)],null,j))}function p(b){var c,d,e,f;c=g(a,b);d=g(a,b+z);e=g(a,b+B);b=u[c*2];f=u[c*2+
-1];c=u[d*2];var i=v.faceVertexUvs[0];d=u[d*2+1];var j=u[e*2];e=u[e*2+1];var k=[];k.push(new THREE.UV(b,f));k.push(new THREE.UV(c,d));k.push(new THREE.UV(j,e));i.push(k)}function o(b){var c,d,e,f,i,k;c=g(a,b);d=g(a,b+I);e=g(a,b+j);f=g(a,b+N);b=u[c*2];i=u[c*2+1];c=u[d*2];k=u[d*2+1];d=u[e*2];var l=v.faceVertexUvs[0];e=u[e*2+1];var n=u[f*2];f=u[f*2+1];var m=[];m.push(new THREE.UV(b,i));m.push(new THREE.UV(c,k));m.push(new THREE.UV(d,e));m.push(new THREE.UV(n,f));l.push(m)}var v=this,w=0,r,s=[],u=[],x,
-H,G,F,y,C,O,J,$,L,P,da,ja,R,z,B,I,j,N,ga,X,Q,M,ea,U;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(v,d,b);r={signature:a.substr(w,8),header_bytes:l(a,w+8),vertex_coordinate_bytes:l(a,w+9),normal_coordinate_bytes:l(a,w+10),uv_coordinate_bytes:l(a,w+11),vertex_index_bytes:l(a,w+12),normal_index_bytes:l(a,w+13),uv_index_bytes:l(a,w+14),material_index_bytes:l(a,w+15),nvertices:g(a,w+16),nnormals:g(a,w+16+4),nuvs:g(a,w+16+8),ntri_flat:g(a,w+16+12),ntri_smooth:g(a,w+16+16),ntri_flat_uv:g(a,
-w+16+20),ntri_smooth_uv:g(a,w+16+24),nquad_flat:g(a,w+16+28),nquad_smooth:g(a,w+16+32),nquad_flat_uv:g(a,w+16+36),nquad_smooth_uv:g(a,w+16+40)};w+=r.header_bytes;x=r.vertex_index_bytes;H=r.vertex_index_bytes*2;G=r.vertex_index_bytes*3;F=r.vertex_index_bytes*3+r.material_index_bytes;y=r.vertex_index_bytes*3+r.material_index_bytes+r.normal_index_bytes;C=r.vertex_index_bytes*3+r.material_index_bytes+r.normal_index_bytes*2;O=r.vertex_index_bytes;J=r.vertex_index_bytes*2;$=r.vertex_index_bytes*3;L=r.vertex_index_bytes*
-4;P=r.vertex_index_bytes*4+r.material_index_bytes;da=r.vertex_index_bytes*4+r.material_index_bytes+r.normal_index_bytes;ja=r.vertex_index_bytes*4+r.material_index_bytes+r.normal_index_bytes*2;R=r.vertex_index_bytes*4+r.material_index_bytes+r.normal_index_bytes*3;z=r.uv_index_bytes;B=r.uv_index_bytes*2;I=r.uv_index_bytes;j=r.uv_index_bytes*2;N=r.uv_index_bytes*3;b=r.vertex_index_bytes*3+r.material_index_bytes;U=r.vertex_index_bytes*4+r.material_index_bytes;ga=r.ntri_flat*b;X=r.ntri_smooth*(b+r.normal_index_bytes*
-3);Q=r.ntri_flat_uv*(b+r.uv_index_bytes*3);M=r.ntri_smooth_uv*(b+r.normal_index_bytes*3+r.uv_index_bytes*3);ea=r.nquad_flat*U;b=r.nquad_smooth*(U+r.normal_index_bytes*4);U=r.nquad_flat_uv*(U+r.uv_index_bytes*4);w+=function(b){for(var d,e,g,h=r.vertex_coordinate_bytes*3,i=b+r.nvertices*h;b<i;b+=h)d=c(a,b),e=c(a,b+r.vertex_coordinate_bytes),g=c(a,b+r.vertex_coordinate_bytes*2),v.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,g)));return r.nvertices*h}(w);w+=function(b){for(var c,d,e,f=r.normal_coordinate_bytes*
-3,g=b+r.nnormals*f;b<g;b+=f)c=k(a,b),d=k(a,b+r.normal_coordinate_bytes),e=k(a,b+r.normal_coordinate_bytes*2),s.push(c/127,d/127,e/127);return r.nnormals*f}(w);w+=function(b){for(var d,e,g=r.uv_coordinate_bytes*2,h=b+r.nuvs*g;b<h;b+=g)d=c(a,b),e=c(a,b+r.uv_coordinate_bytes),u.push(d,e);return r.nuvs*g}(w);ga=w+ga;X=ga+X;Q=X+Q;M=Q+M;ea=M+ea;b=ea+b;U=b+U;(function(a){var b,c=r.vertex_index_bytes*3+r.material_index_bytes,d=c+r.uv_index_bytes*3,e=a+r.ntri_flat_uv*d;for(b=a;b<e;b+=d)m(b),p(b+c);return e-
-a})(X);(function(a){var b,c=r.vertex_index_bytes*3+r.material_index_bytes+r.normal_index_bytes*3,d=c+r.uv_index_bytes*3,e=a+r.ntri_smooth_uv*d;for(b=a;b<e;b+=d)q(b),p(b+c);return e-a})(Q);(function(a){var b,c=r.vertex_index_bytes*4+r.material_index_bytes,d=c+r.uv_index_bytes*4,e=a+r.nquad_flat_uv*d;for(b=a;b<e;b+=d)n(b),o(b+c);return e-a})(b);(function(a){var b,c=r.vertex_index_bytes*4+r.material_index_bytes+r.normal_index_bytes*4,d=c+r.uv_index_bytes*4,e=a+r.nquad_smooth_uv*d;for(b=a;b<e;b+=d)t(b),
-o(b+c);return e-a})(U);(function(a){var b,c=r.vertex_index_bytes*3+r.material_index_bytes,d=a+r.ntri_flat*c;for(b=a;b<d;b+=c)m(b);return d-a})(w);(function(a){var b,c=r.vertex_index_bytes*3+r.material_index_bytes+r.normal_index_bytes*3,d=a+r.ntri_smooth*c;for(b=a;b<d;b+=c)q(b);return d-a})(ga);(function(a){var b,c=r.vertex_index_bytes*4+r.material_index_bytes,d=a+r.nquad_flat*c;for(b=a;b<d;b+=c)n(b);return d-a})(M);(function(a){var b,c=r.vertex_index_bytes*4+r.material_index_bytes+r.normal_index_bytes*
-4,d=a+r.nquad_smooth*c;for(b=a;b<d;b+=c)t(b);return d-a})(ea);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
-THREE.ColladaLoader=function(){function a(a,d,g){X=a;d=d||ea;g!==void 0&&(a=g.split("/"),a.pop(),ua=a.length<1?"":a.join("/")+"/");ca=c("//dae:library_images/dae:image",f,"image");qa=c("//dae:library_materials/dae:material",G,"material");ma=c("//dae:library_effects/dae:effect",J,"effect");la=c("//dae:library_geometries/dae:geometry",o,"geometry");fa=c("//dae:library_controllers/dae:controller",h,"controller");Z=c("//dae:library_animations/dae:animation",L,"animation");sa=c(".//dae:library_visual_scenes/dae:visual_scene",
-l,"visual_scene");pa=[];ra=[];(a=X.evaluate(".//dae:scene/dae:instance_visual_scene",X,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),M=sa[a]):M=null;Q=new THREE.Object3D;for(a=0;a<M.nodes.length;a++)Q.add(e(M.nodes[a]));b();for(var i in Z);i={scene:Q,morphs:pa,skins:ra,dae:{images:ca,materials:qa,effects:ma,geometries:la,controllers:fa,animations:Z,visualScenes:sa,scene:M}};d&&d(i);return i}function c(a,b,c){for(var a=X.evaluate(a,X,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in Z)for(var e=Z[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof
-THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=fa[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=M.getChildById(c.skeleton[0],!0)||M.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
-for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var r=i.weights[p][q];r.joint==m&&j.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
-j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function e(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=fa[a.controllers[f].url];switch(i.type){case "skin":if(la[i.skin.source]){var j=
-new p;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(fa[i.skin.source]&&(d=i=fa[i.skin.source],i.morph&&la[i.morph.source]))j=new p,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(la[i.morph.source])j=new p,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
-0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=la[i.url],k={},l=0,m;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){m=j[h];var o=ma[qa[m.target].instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;m=k[m.symbol]=o.material;l++}j=m||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=
-i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=fa[c.url],j.skinInstanceController=c,j.name="skin_"+ra.length,ra.push(j);else if(d!==void 0){h=i;k=d instanceof n?fa[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(o=la[k.targets[l]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a,b){var d=l(a,b),e=l(a,b+1),f=l(a,b+2),g=l(a,b+3),h=(g<<1&255|f>>7)-127;d|=(f&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(g>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function g(a,b){var c=l(a,b),d=l(a,b+1),e=l(a,b+2);return(l(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=l(a,b);return(l(a,b+1)<<8)+c}function k(a,b){var c=l(a,b);return c>127?c-256:c}function l(a,b){return a.charCodeAt(b)&255}function n(b){var c,
+d,e;c=g(a,b);d=g(a,b+x);e=g(a,b+I);b=i(a,b+K);t.faces.push(new THREE.Face3(c,d,e,null,null,b))}function o(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+x);e=g(a,b+I);f=i(a,b+K);j=g(a,b+G);k=g(a,b+y);l=g(a,b+D);var b=C[k*3],m=C[k*3+1];k=C[k*3+2];var n=C[l*3],o=C[l*3+1];l=C[l*3+2];t.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(C[j*3],C[j*3+1],C[j*3+2]),new THREE.Vector3(b,m,k),new THREE.Vector3(n,o,l)],null,f))}function m(b){var c,d,e,f;c=g(a,b);d=g(a,b+Q);e=g(a,b+H);f=g(a,b+aa);b=i(a,b+M);t.faces.push(new THREE.Face4(c,
+d,e,f,null,null,b))}function s(b){var c,d,e,f,j,k,l,m,n;c=g(a,b);d=g(a,b+Q);e=g(a,b+H);f=g(a,b+aa);j=i(a,b+M);k=g(a,b+R);l=g(a,b+da);m=g(a,b+ja);n=g(a,b+T);var b=C[l*3],o=C[l*3+1];l=C[l*3+2];var p=C[m*3],u=C[m*3+1];m=C[m*3+2];var J=C[n*3],r=C[n*3+1];n=C[n*3+2];t.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(C[k*3],C[k*3+1],C[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(p,u,m),new THREE.Vector3(J,r,n)],null,j))}function p(b){var c,d,e,f;c=g(a,b);d=g(a,b+z);e=g(a,b+B);b=v[c*2];f=v[c*2+
+1];c=v[d*2];var i=t.faceVertexUvs[0];d=v[d*2+1];var j=v[e*2];e=v[e*2+1];var k=[];k.push(new THREE.UV(b,f));k.push(new THREE.UV(c,d));k.push(new THREE.UV(j,e));i.push(k)}function r(b){var c,d,e,f,i,k;c=g(a,b);d=g(a,b+L);e=g(a,b+j);f=g(a,b+P);b=v[c*2];i=v[c*2+1];c=v[d*2];k=v[d*2+1];d=v[e*2];var l=t.faceVertexUvs[0];e=v[e*2+1];var m=v[f*2];f=v[f*2+1];var n=[];n.push(new THREE.UV(b,i));n.push(new THREE.UV(c,k));n.push(new THREE.UV(d,e));n.push(new THREE.UV(m,f));l.push(n)}var t=this,w=0,q,C=[],v=[],x,
+I,K,G,y,D,Q,H,aa,M,R,da,ja,T,z,B,L,j,P,fa,Z,S,O,ea,V;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(t,d,b);q={signature:a.substr(w,8),header_bytes:l(a,w+8),vertex_coordinate_bytes:l(a,w+9),normal_coordinate_bytes:l(a,w+10),uv_coordinate_bytes:l(a,w+11),vertex_index_bytes:l(a,w+12),normal_index_bytes:l(a,w+13),uv_index_bytes:l(a,w+14),material_index_bytes:l(a,w+15),nvertices:g(a,w+16),nnormals:g(a,w+16+4),nuvs:g(a,w+16+8),ntri_flat:g(a,w+16+12),ntri_smooth:g(a,w+16+16),ntri_flat_uv:g(a,
+w+16+20),ntri_smooth_uv:g(a,w+16+24),nquad_flat:g(a,w+16+28),nquad_smooth:g(a,w+16+32),nquad_flat_uv:g(a,w+16+36),nquad_smooth_uv:g(a,w+16+40)};w+=q.header_bytes;x=q.vertex_index_bytes;I=q.vertex_index_bytes*2;K=q.vertex_index_bytes*3;G=q.vertex_index_bytes*3+q.material_index_bytes;y=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;D=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;Q=q.vertex_index_bytes;H=q.vertex_index_bytes*2;aa=q.vertex_index_bytes*3;M=q.vertex_index_bytes*
+4;R=q.vertex_index_bytes*4+q.material_index_bytes;da=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes;ja=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*2;T=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;z=q.uv_index_bytes;B=q.uv_index_bytes*2;L=q.uv_index_bytes;j=q.uv_index_bytes*2;P=q.uv_index_bytes*3;b=q.vertex_index_bytes*3+q.material_index_bytes;V=q.vertex_index_bytes*4+q.material_index_bytes;fa=q.ntri_flat*b;Z=q.ntri_smooth*(b+q.normal_index_bytes*
+3);S=q.ntri_flat_uv*(b+q.uv_index_bytes*3);O=q.ntri_smooth_uv*(b+q.normal_index_bytes*3+q.uv_index_bytes*3);ea=q.nquad_flat*V;b=q.nquad_smooth*(V+q.normal_index_bytes*4);V=q.nquad_flat_uv*(V+q.uv_index_bytes*4);w+=function(b){for(var d,e,g,h=q.vertex_coordinate_bytes*3,i=b+q.nvertices*h;b<i;b+=h)d=c(a,b),e=c(a,b+q.vertex_coordinate_bytes),g=c(a,b+q.vertex_coordinate_bytes*2),t.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,g)));return q.nvertices*h}(w);w+=function(b){for(var c,d,e,f=q.normal_coordinate_bytes*
+3,g=b+q.nnormals*f;b<g;b+=f)c=k(a,b),d=k(a,b+q.normal_coordinate_bytes),e=k(a,b+q.normal_coordinate_bytes*2),C.push(c/127,d/127,e/127);return q.nnormals*f}(w);w+=function(b){for(var d,e,g=q.uv_coordinate_bytes*2,h=b+q.nuvs*g;b<h;b+=g)d=c(a,b),e=c(a,b+q.uv_coordinate_bytes),v.push(d,e);return q.nuvs*g}(w);fa=w+fa;Z=fa+Z;S=Z+S;O=S+O;ea=O+ea;b=ea+b;V=b+V;(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes,d=c+q.uv_index_bytes*3,e=a+q.ntri_flat_uv*d;for(b=a;b<e;b+=d)n(b),p(b+c);return e-
+a})(Z);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,d=c+q.uv_index_bytes*3,e=a+q.ntri_smooth_uv*d;for(b=a;b<e;b+=d)o(b),p(b+c);return e-a})(S);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes,d=c+q.uv_index_bytes*4,e=a+q.nquad_flat_uv*d;for(b=a;b<e;b+=d)m(b),r(b+c);return e-a})(b);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*4,d=c+q.uv_index_bytes*4,e=a+q.nquad_smooth_uv*d;for(b=a;b<e;b+=d)s(b),
+r(b+c);return e-a})(V);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes,d=a+q.ntri_flat*c;for(b=a;b<d;b+=c)n(b);return d-a})(w);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,d=a+q.ntri_smooth*c;for(b=a;b<d;b+=c)o(b);return d-a})(fa);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes,d=a+q.nquad_flat*c;for(b=a;b<d;b+=c)m(b);return d-a})(O);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*
+4,d=a+q.nquad_smooth*c;for(b=a;b<d;b+=c)s(b);return d-a})(ea);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
+THREE.ColladaLoader=function(){function a(a,d,g){Z=a;d=d||ea;g!==void 0&&(a=g.split("/"),a.pop(),ua=a.length<1?"":a.join("/")+"/");ca=c("//dae:library_images/dae:image",f,"image");qa=c("//dae:library_materials/dae:material",K,"material");ma=c("//dae:library_effects/dae:effect",H,"effect");ka=c("//dae:library_geometries/dae:geometry",r,"geometry");Y=c("//dae:library_controllers/dae:controller",h,"controller");$=c("//dae:library_animations/dae:animation",M,"animation");sa=c(".//dae:library_visual_scenes/dae:visual_scene",
+l,"visual_scene");pa=[];ra=[];(a=Z.evaluate(".//dae:scene/dae:instance_visual_scene",Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),O=sa[a]):O=null;S=new THREE.Object3D;for(a=0;a<O.nodes.length;a++)S.add(e(O.nodes[a]));b();for(var i in $);i={scene:S,morphs:pa,skins:ra,dae:{images:ca,materials:qa,effects:ma,geometries:ka,controllers:Y,animations:$,visualScenes:sa,scene:O}};d&&d(i);return i}function c(a,b,c){for(var a=Z.evaluate(a,Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in $)for(var e=$[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof
+THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=Y[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=O.getChildById(c.skeleton[0],!0)||O.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
+for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var r=0;r<i.weights[p].length;r++){var q=i.weights[p][r];q.joint==m&&j.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+
+j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function e(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=Y[a.controllers[f].url];switch(i.type){case "skin":if(ka[i.skin.source]){var j=
+new p;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(Y[i.skin.source]&&(d=i=Y[i.skin.source],i.morph&&ka[i.morph.source]))j=new p,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(ka[i.morph.source])j=new p,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
+0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=ka[i.url],k={},l=0,n;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){n=j[h];var o=ma[qa[n.target].instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;n=k[n.symbol]=o.material;l++}j=n||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=
+i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=Y[c.url],j.skinInstanceController=c,j.name="skin_"+ra.length,ra.push(j);else if(d!==void 0){h=i;k=d instanceof m?Y[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(o=ka[k.targets[l]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===
 h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+pa.length;pa.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(f=0;f<a.nodes.length;f++)b.add(e(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
-null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function l(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function m(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function q(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){this.url=
-"";this.skeleton=[];this.instance_material=[]}function t(){this.target=this.symbol=""}function p(){this.url="";this.instance_material=[]}function o(){this.id="";this.mesh=null}function v(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function w(){}function r(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function s(){this.source="";this.stride=this.count=0;this.params=[]}function u(){this.input={}}function x(){this.semantic=
-"";this.offset=0;this.source="";this.set=0}function H(a){this.id=a;this.type=null}function G(){this.name=this.id="";this.instance_effect=null}function F(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function y(a,b){this.type=a;this.effect=b;this.material=null}function C(a){this.effect=a;this.format=this.init_from=null}function O(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
-this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function $(){this.url=""}function L(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function P(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function da(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ja(a){var b=a.getAttribute("id");
-if(U[b]!=void 0)return U[b];U[b]=(new H(b)).parse(a);return U[b]}function R(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function z(a){for(var a=I(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function B(a){for(var a=I(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function I(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function j(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function N(a,b){if(a===
-void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function ga(a,b){var c="";c+=N(a.x,b)+",";c+=N(a.y,b)+",";c+=N(a.z,b);return c}var X=null,Q=null,M,ea=null,U={},ca={},Z={},fa={},la={},qa={},ma={},sa,ua,pa,ra,wa=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
-c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
-0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new H).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new x).parse(d))}}return b};
-k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=z(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new H).parse(f);b[f.id]=f;break;case "joints":c=
-f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new x).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=
-a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new x).parse(g));break;case "v":c=B(g.textContent);break;case "vcount":d=B(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};l.prototype.getChildById=function(a,b){for(var c=
-0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};l.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new m).parse(c))}}return this};m.prototype.getChannelForTransform=
-function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};m.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
-b);if(d)return d}return null};m.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};m.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};m.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
-this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new m).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new p).parse(b));break;case "instance_light":break;case "instance_node":b=
-b.getAttribute("url").replace(/^#/,"");(b=X.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",X,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new m).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new q).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in Z)for(var e=Z[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
-if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=
-this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};m.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
-this.transforms[a].matrix)};q.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=z(a.textContent);this.updateMatrix();return this};q.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
-case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=X.evaluate(".//dae:instance_material",c,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new t).parse(d)),d=c.iterateNext()}}return this};t.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};p.prototype.parse=function(a){this.url=
-a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=X.evaluate(".//dae:instance_material",c,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new t).parse(b)),b=a.iterateNext();break}}return this};o.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
-(new v(this)).parse(c)}}return this};v.prototype.parse=function(a){function b(a,c){var d=ga(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":ja(d);break;case "vertices":this.vertices=(new u).parse(d);break;case "triangles":this.primitives.push((new r).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new w).parse(d))}}var e=
-{};this.geometry3js=new THREE.Geometry;d=U[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
-return this};v.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,m=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],q=[],r={},t=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=U[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=ga(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],
-l.data[k+1],l.data[k+2]));break;case "TEXCOORD":r[i.set]===void 0&&(r[i.set]=[]);r[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":t.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var s;n==3?s=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],t.length?t:new THREE.Color):n==4&&(s=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],t.length?t:new THREE.Color));s.daeMaterial=a.material;b.faces.push(s);for(f=0;f<o.length;f++)e=r[o[f]],b.faceVertexUvs[f].push([e[0],
-e[1],e[2]]);d+=h.length*n}};w.prototype=new r;w.prototype.constructor=w;r.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};r.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=j(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new x).parse(a.childNodes[b]));break;case "vcount":this.vcount=
-B(c.textContent);break;case "p":this.p=B(c.textContent)}}return this};s.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=j(a,"count",0);this.stride=j(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};u.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
-"input"){var c=(new x).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};x.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=j(a,"set",-1);this.offset=j(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};H.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=I(c.textContent),
-e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=z(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=B(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=I(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new s).parse(c.childNodes[d]);break}}}return this};
-H.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};G.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new $).parse(a.childNodes[b]);break}return this};F.prototype.isColor=function(){return this.texture==null};F.prototype.isTexture=function(){return this.texture!=null};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=z(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
-c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};y.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new F).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=X.evaluate(".//dae:float",c,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};y.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof F)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=ca[this.effect.surface.init_from]))a.map=
-THREE.ImageUtils.loadTexture(ua+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=wa;return this.material=new THREE.MeshLambertMaterial(a)};C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};O.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
-c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};J.prototype.create=function(){if(this.shader==null)return null};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
-J.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new C(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new O(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
-break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};J.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new y(c.nodeName,this)).parse(c)}}};$.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};L.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new H).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new da(this)).parse(c));break;case "channel":this.channel.push((new P(this)).parse(c))}}return this};P.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
+null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function l(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function n(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function m(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function s(){this.target=this.symbol=""}function p(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function t(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function w(){}function q(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function C(){this.source="";this.stride=this.count=0;this.params=[]}function v(){this.input={}}function x(){this.semantic=
+"";this.offset=0;this.source="";this.set=0}function I(a){this.id=a;this.type=null}function K(){this.name=this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function y(a,b){this.type=a;this.effect=b;this.material=null}function D(a){this.effect=a;this.format=this.init_from=null}function Q(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
+this.source=null}function H(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function aa(){this.url=""}function M(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function R(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function da(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ja(a){var b=
+a.getAttribute("id");if(V[b]!=void 0)return V[b];V[b]=(new I(b)).parse(a);return V[b]}function T(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function z(a){for(var a=L(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function B(a){for(var a=L(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function L(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function j(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}
+function P(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function fa(a,b){var c="";c+=P(a.x,b)+",";c+=P(a.y,b)+",";c+=P(a.z,b);return c}var Z=null,S=null,O,ea=null,V={},ca={},$={},Y={},ka={},qa={},ma={},sa,ua,pa,ra,wa=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName==
+"init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,
+"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new I).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==
+1)switch(d.nodeName){case "input":b.push((new x).parse(d))}}return b};k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=z(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],
+f[14],f[15]);break;case "source":f=(new I).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new x).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=
+e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new x).parse(g));break;case "v":c=B(g.textContent);break;case "vcount":d=B(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=
+0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};l.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};l.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new n).parse(c))}}return this};n.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},
+c}return null};n.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};n.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};n.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};
+n.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new n).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).parse(b));
+break;case "instance_geometry":this.geometries.push((new p).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=Z.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new n).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=
+[];c=1E6;b=-1E6;for(var d in $)for(var e=$[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=
+a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();
+return this};n.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=z(a.textContent);this.updateMatrix();return this};o.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],
+this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};m.prototype.parse=function(a){this.url=
+a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Z.evaluate(".//dae:instance_material",c,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new s).parse(d)),d=c.iterateNext()}}return this};s.prototype.parse=function(a){this.symbol=
+a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};p.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=Z.evaluate(".//dae:instance_material",c,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new s).parse(b)),b=a.iterateNext();break}}return this};
+r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new t(this)).parse(c)}}return this};t.prototype.parse=function(a){function b(a,c){var d=fa(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":ja(d);break;case "vertices":this.vertices=(new v).parse(d);break;case "triangles":this.primitives.push((new q).parse(d));
+break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new w).parse(d))}}var e={};this.geometry3js=new THREE.Geometry;d=V[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();
+this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};t.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,m=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],r=[],q={},s=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=V[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=
+fa(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":r.push(new THREE.Vector3(l.data[k],l.data[k+1],l.data[k+2]));break;case "TEXCOORD":q[i.set]===void 0&&(q[i.set]=[]);q[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;n==3?t=new THREE.Face3(p[0],p[1],p[2],[r[0],r[1],r[2]],s.length?s:new THREE.Color):n==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[r[0],r[1],r[2],r[3]],s.length?s:new THREE.Color));
+t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=q[o[f]],b.faceVertexUvs[f].push([e[0],e[1],e[2]]);d+=h.length*n}};w.prototype=new q;w.prototype.constructor=w;q.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};q.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=j(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new x).parse(a.childNodes[b]));
+break;case "vcount":this.vcount=B(c.textContent);break;case "p":this.p=B(c.textContent)}}return this};C.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=j(a,"count",0);this.stride=j(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
+"input"){var c=(new x).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};x.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=j(a,"set",-1);this.offset=j(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};I.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=L(c.textContent),
+e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=z(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=B(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=L(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new C).parse(c.childNodes[d]);break}}}return this};
+I.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};K.prototype.parse=function(a){this.id=a.getAttribute("id");
+this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new aa).parse(a.childNodes[b]);break}return this};G.prototype.isColor=function(){return this.texture==null};G.prototype.isTexture=function(){return this.texture!=null};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=z(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
+c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};y.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new G).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=Z.evaluate(".//dae:float",c,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};y.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof G)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=ca[this.effect.surface.init_from]))a.map=
+THREE.ImageUtils.loadTexture(ua+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=wa;return this.material=new THREE.MeshLambertMaterial(a)};D.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};Q.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
+c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};H.prototype.create=function(){if(this.shader==null)return null};H.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
+H.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new D(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new Q(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};H.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};H.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new y(c.nodeName,this)).parse(c)}}};aa.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};M.prototype.parse=function(a){this.id=a.getAttribute("id");
+this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new I).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new da(this)).parse(c));break;case "channel":this.channel.push((new R(this)).parse(c))}}return this};R.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
 b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};da.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new x).parse(c))}}return this};
 da.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
 Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==
-200))ea=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){wa=a},applySkin:g,geometries:la}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+200))ea=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){wa=a},applySkin:g,geometries:ka}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a,c,b){var d,g=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),d=a,a=d.model,c=d.callback,b=d.texture_path;d=new Worker(a);b=b?b:this.extractUrlbase(a);d.onmessage=function(a){g.createModel(a.data,c,b);g.onLoadComplete()};this.onLoadStart();d.postMessage(Date.now())};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,g,i,k,l,m,q,n,t,p,o,v,w,r,s=a.faces;m=a.vertices;var u=a.normals,x=a.colors,H=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&H++;for(c=0;c<H;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(l=m.length;k<l;)q=new THREE.Vertex,q.position.x=m[k++]*b,q.position.y=
-m[k++]*b,q.position.z=m[k++]*b,d.vertices.push(q);k=0;for(l=s.length;k<l;){b=s[k++];m=b&1;i=b&2;c=b&4;g=b&8;n=b&16;q=b&32;p=b&64;b&=128;m?(o=new THREE.Face4,o.a=s[k++],o.b=s[k++],o.c=s[k++],o.d=s[k++],m=4):(o=new THREE.Face3,o.a=s[k++],o.b=s[k++],o.c=s[k++],m=3);if(i)i=s[k++],o.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<H;c++)v=a.uvs[c],t=s[k++],r=v[t*2],t=v[t*2+1],d.faceUvs[c][i]=new THREE.UV(r,t);if(g)for(c=0;c<H;c++){v=a.uvs[c];w=[];for(g=0;g<m;g++)t=s[k++],r=v[t*2],t=v[t*2+1],w[g]=new THREE.UV(r,
-t);d.faceVertexUvs[c][i]=w}if(n)n=s[k++]*3,g=new THREE.Vector3,g.x=u[n++],g.y=u[n++],g.z=u[n],o.normal=g;if(q)for(c=0;c<m;c++)n=s[k++]*3,g=new THREE.Vector3,g.x=u[n++],g.y=u[n++],g.z=u[n],o.vertexNormals.push(g);if(p)q=s[k++],q=new THREE.Color(x[q]),o.color=q;if(b)for(c=0;c<m;c++)q=s[k++],q=new THREE.Color(x[q]),o.vertexColors.push(q);d.faces.push(o)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)g=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,
-i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,i,k,l,m,q,n,t;c=0;for(g=a.morphTargets.length;c<g;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;t=a.morphTargets[c].vertices;i=0;for(k=t.length;i<k;i+=3)l=t[i]*b,m=t[i+1]*
-b,q=t[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(l,m,q)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;l=a.morphColors[c].colors;b=0;for(i=l.length;b<i;b+=3)m=new THREE.Color(16755200),m.setRGB(l[b],l[b+1],l[b+2]),k.push(m)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();c(d)};
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,g,i,k,l,n,o,m,s,p,r,t,w,q,C=a.faces;n=a.vertices;var v=a.normals,x=a.colors,I=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&I++;for(c=0;c<I;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(l=n.length;k<l;)o=new THREE.Vertex,o.position.x=n[k++]*b,o.position.y=
+n[k++]*b,o.position.z=n[k++]*b,d.vertices.push(o);k=0;for(l=C.length;k<l;){b=C[k++];n=b&1;i=b&2;c=b&4;g=b&8;m=b&16;o=b&32;p=b&64;b&=128;n?(r=new THREE.Face4,r.a=C[k++],r.b=C[k++],r.c=C[k++],r.d=C[k++],n=4):(r=new THREE.Face3,r.a=C[k++],r.b=C[k++],r.c=C[k++],n=3);if(i)i=C[k++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<I;c++)t=a.uvs[c],s=C[k++],q=t[s*2],s=t[s*2+1],d.faceUvs[c][i]=new THREE.UV(q,s);if(g)for(c=0;c<I;c++){t=a.uvs[c];w=[];for(g=0;g<n;g++)s=C[k++],q=t[s*2],s=t[s*2+1],w[g]=new THREE.UV(q,
+s);d.faceVertexUvs[c][i]=w}if(m)m=C[k++]*3,g=new THREE.Vector3,g.x=v[m++],g.y=v[m++],g.z=v[m],r.normal=g;if(o)for(c=0;c<n;c++)m=C[k++]*3,g=new THREE.Vector3,g.x=v[m++],g.y=v[m++],g.z=v[m],r.vertexNormals.push(g);if(p)o=C[k++],o=new THREE.Color(x[o]),r.color=o;if(b)for(c=0;c<n;c++)o=C[k++],o=new THREE.Color(x[o]),r.vertexColors.push(o);d.faces.push(r)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)g=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,
+i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,i,k,l,n,o,m,s;c=0;for(g=a.morphTargets.length;c<g;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];m=d.morphTargets[c].vertices;s=a.morphTargets[c].vertices;i=0;for(k=s.length;i<k;i+=3)l=s[i]*b,n=s[i+1]*
+b,o=s[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(l,n,o)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;l=a.morphColors[c].colors;b=0;for(i=l.length;b<i;b+=3)n=new THREE.Color(16755200),n.setRGB(l[b],l[b+1],l[b+2]),k.push(n)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();c(d)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,c){var b=this,d=new Worker(a);d.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(a){function d(a,b){return b=="relativeToHTML"?a:g+"/"+a}function h(){var a;for(n in L.objects)if(!B.objects[n])if(w=L.objects[n],w.geometry!==void 0){if(y=B.geometries[w.geometry]){a=!1;for(j=0;j<w.materials.length;j++)$=B.materials[w.materials[j]],a=$ instanceof THREE.ShaderMaterial;a&&y.computeTangents();u=w.position;x=w.rotation;H=w.quaternion;
-G=w.scale;H=0;$.length==0&&($=new THREE.MeshFaceMaterial);$.length>1&&($=new THREE.MeshFaceMaterial);a=new THREE.Mesh(y,$);a.name=n;a.position.set(u[0],u[1],u[2]);H?(a.quaternion.set(H[0],H[1],H[2],H[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[2]);a.scale.set(G[0],G[1],G[2]);a.visible=w.visible;B.scene.add(a);B.objects[n]=a;if(w.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);B.scene.collisions.colliders.push(b)}if(w.castsShadow)b=new THREE.ShadowVolume(y),B.scene.add(b),b.position=
-a.position,b.rotation=a.rotation,b.scale=a.scale;w.trigger&&w.trigger.toLowerCase()!="none"&&(b={type:w.trigger,object:w},B.triggers[a.name]=b)}}else u=w.position,x=w.rotation,H=w.quaternion,G=w.scale,H=0,a=new THREE.Object3D,a.name=n,a.position.set(u[0],u[1],u[2]),H?(a.quaternion.set(H[0],H[1],H[2],H[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[2]),a.scale.set(G[0],G[1],G[2]),a.visible=w.visible!==void 0?w.visible:!1,B.scene.add(a),B.objects[n]=a,B.empties[n]=a,w.trigger&&w.trigger.toLowerCase()!=
-"none"&&(b={type:w.trigger,object:w},B.triggers[a.name]=b)}function i(a){return function(c){B.geometries[a]=c;h();da-=1;b.onLoadComplete();l()}}function k(a){return function(b){B.geometries[a]=b}}function l(){b.callbackProgress({totalModels:R,totalTextures:z,loadedModels:R-da,loadedTextures:z-ja},B);b.onLoadProgress();da==0&&ja==0&&c(B)}var m,q,n,t,p,o,v,w,r,s,u,x,H,G,F,y,C,O,J,$,L,P,da,ja,R,z,B;L=a.data;J=new THREE.BinaryLoader;P=new THREE.JSONLoader;ja=da=0;B={scene:new THREE.Scene,geometries:{},
-materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(n in L.objects)if(w=L.objects[n],w.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(L.transform){a=L.transform.position;r=L.transform.rotation;var I=L.transform.scale;a&&B.scene.position.set(a[0],a[1],a[2]);r&&B.scene.rotation.set(r[0],r[1],r[2]);I&&B.scene.scale.set(I[0],I[1],I[2]);(a||r||I)&&B.scene.updateMatrix()}a=function(){ja-=1;l();b.onLoadComplete()};for(p in L.cameras)r=
-L.cameras[p],r.type=="perspective"?C=new THREE.PerspectiveCamera(r.fov,r.aspect,r.near,r.far):r.type=="ortho"&&(C=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),u=r.position,r=r.target,C.position.set(u[0],u[1],u[2]),C.target=new THREE.Vector3(r[0],r[1],r[2]),B.cameras[p]=C;for(t in L.lights)r=L.lights[t],p=r.color!==void 0?r.color:16777215,C=r.intensity!==void 0?r.intensity:1,r.type=="directional"?(u=r.direction,s=new THREE.DirectionalLight(p,C),s.position.set(u[0],u[1],
-u[2]),s.position.normalize()):r.type=="point"?(u=r.position,s=r.distance,s=new THREE.PointLight(p,C,s),s.position.set(u[0],u[1],u[2])):r.type=="ambient"&&(s=new THREE.AmbientLight(p)),B.scene.add(s),B.lights[t]=s;for(o in L.fogs)t=L.fogs[o],t.type=="linear"?O=new THREE.Fog(0,t.near,t.far):t.type=="exp2"&&(O=new THREE.FogExp2(0,t.density)),r=t.color,O.color.setRGB(r[0],r[1],r[2]),B.fogs[o]=O;if(B.cameras&&L.defaults.camera)B.currentCamera=B.cameras[L.defaults.camera];if(B.fogs&&L.defaults.fog)B.scene.fog=
-B.fogs[L.defaults.fog];r=L.defaults.bgcolor;B.bgColor=new THREE.Color;B.bgColor.setRGB(r[0],r[1],r[2]);B.bgColorAlpha=L.defaults.bgalpha;for(m in L.geometries)if(o=L.geometries[m],o.type=="bin_mesh"||o.type=="ascii_mesh")da+=1,b.onLoadStart();R=da;for(m in L.geometries)o=L.geometries[m],o.type=="cube"?(y=new THREE.CubeGeometry(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides),B.geometries[m]=y):o.type=="plane"?(y=new THREE.PlaneGeometry(o.width,o.height,
-o.segmentsWidth,o.segmentsHeight),B.geometries[m]=y):o.type=="sphere"?(y=new THREE.SphereGeometry(o.radius,o.segmentsWidth,o.segmentsHeight),B.geometries[m]=y):o.type=="cylinder"?(y=new THREE.CylinderGeometry(o.topRad,o.botRad,o.height,o.radSegs,o.heightSegs),B.geometries[m]=y):o.type=="torus"?(y=new THREE.TorusGeometry(o.radius,o.tube,o.segmentsR,o.segmentsT),B.geometries[m]=y):o.type=="icosahedron"?(y=new THREE.IcosahedronGeometry(o.subdivisions),B.geometries[m]=y):o.type=="bin_mesh"?J.load(d(o.url,
-L.urlBaseType),i(m)):o.type=="ascii_mesh"?P.load(d(o.url,L.urlBaseType),i(m)):o.type=="embedded_mesh"&&(o=L.embeds[o.id])&&P.createModel(o,k(m),"");for(v in L.textures)if(m=L.textures[v],m.url instanceof Array){ja+=m.url.length;for(J=0;J<m.url.length;J++)b.onLoadStart()}else ja+=1,b.onLoadStart();z=ja;for(v in L.textures){m=L.textures[v];if(m.mapping!=void 0&&THREE[m.mapping]!=void 0)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){J=[];for(var j=0;j<m.url.length;j++)J[j]=d(m.url[j],L.urlBaseType);
-J=THREE.ImageUtils.loadTextureCube(J,m.mapping,a)}else{J=THREE.ImageUtils.loadTexture(d(m.url,L.urlBaseType),m.mapping,a);if(THREE[m.minFilter]!=void 0)J.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!=void 0)J.magFilter=THREE[m.magFilter];if(m.repeat){J.repeat.set(m.repeat[0],m.repeat[1]);if(m.repeat[0]!=1)J.wrapS=THREE.RepeatWrapping;if(m.repeat[1]!=1)J.wrapT=THREE.RepeatWrapping}m.offset&&J.offset.set(m.offset[0],m.offset[1]);if(m.wrap){P={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};
-if(P[m.wrap[0]]!==void 0)J.wrapS=P[m.wrap[0]];if(P[m.wrap[1]]!==void 0)J.wrapT=P[m.wrap[1]]}}B.textures[v]=J}for(q in L.materials){v=L.materials[q];for(F in v.parameters)if(F=="envMap"||F=="map"||F=="lightMap")v.parameters[F]=B.textures[v.parameters[F]];else if(F=="shading")v.parameters[F]=v.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")v.parameters[F]=THREE[v.parameters[F]]?THREE[v.parameters[F]]:THREE.NormalBlending;else if(F=="combine")v.parameters[F]=v.parameters[F]==
-"MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(F=="vertexColors")if(v.parameters[F]=="face")v.parameters[F]=THREE.FaceColors;else if(v.parameters[F])v.parameters[F]=THREE.VertexColors;if(v.parameters.opacity!==void 0&&v.parameters.opacity<1)v.parameters.transparent=!0;if(v.parameters.normalMap){m=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(m.uniforms);J=v.parameters.color;P=v.parameters.specular;o=v.parameters.ambient;O=v.parameters.shininess;a.tNormal.texture=B.textures[v.parameters.normalMap];
-if(v.parameters.normalMapFactor)a.uNormalScale.value=v.parameters.normalMapFactor;if(v.parameters.map)a.tDiffuse.texture=v.parameters.map,a.enableDiffuse.value=!0;if(v.parameters.lightMap)a.tAO.texture=v.parameters.lightMap,a.enableAO.value=!0;if(v.parameters.specularMap)a.tSpecular.texture=B.textures[v.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(J);a.uSpecularColor.value.setHex(P);a.uAmbientColor.value.setHex(o);a.uShininess.value=O;if(v.parameters.opacity)a.uOpacity.value=
-v.parameters.opacity;v=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:a,lights:!0,fog:!0})}else v=new THREE[v.type](v.parameters);B.materials[q]=v}h();b.callbackSync(B);l()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,d=new Worker(a);d.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(a){function d(a,b){return b=="relativeToHTML"?a:g+"/"+a}function h(){var a;for(m in M.objects)if(!B.objects[m])if(w=M.objects[m],w.geometry!==void 0){if(y=B.geometries[w.geometry]){a=!1;for(j=0;j<w.materials.length;j++)aa=B.materials[w.materials[j]],a=aa instanceof THREE.ShaderMaterial;a&&y.computeTangents();v=w.position;x=w.rotation;I=w.quaternion;
+K=w.scale;I=0;aa.length==0&&(aa=new THREE.MeshFaceMaterial);aa.length>1&&(aa=new THREE.MeshFaceMaterial);a=new THREE.Mesh(y,aa);a.name=m;a.position.set(v[0],v[1],v[2]);I?(a.quaternion.set(I[0],I[1],I[2],I[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[2]);a.scale.set(K[0],K[1],K[2]);a.visible=w.visible;B.scene.add(a);B.objects[m]=a;if(w.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);B.scene.collisions.colliders.push(b)}if(w.castsShadow)b=new THREE.ShadowVolume(y),B.scene.add(b),
+b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;w.trigger&&w.trigger.toLowerCase()!="none"&&(b={type:w.trigger,object:w},B.triggers[a.name]=b)}}else v=w.position,x=w.rotation,I=w.quaternion,K=w.scale,I=0,a=new THREE.Object3D,a.name=m,a.position.set(v[0],v[1],v[2]),I?(a.quaternion.set(I[0],I[1],I[2],I[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[2]),a.scale.set(K[0],K[1],K[2]),a.visible=w.visible!==void 0?w.visible:!1,B.scene.add(a),B.objects[m]=a,B.empties[m]=a,w.trigger&&w.trigger.toLowerCase()!=
+"none"&&(b={type:w.trigger,object:w},B.triggers[a.name]=b)}function i(a){return function(c){B.geometries[a]=c;h();da-=1;b.onLoadComplete();l()}}function k(a){return function(b){B.geometries[a]=b}}function l(){b.callbackProgress({totalModels:T,totalTextures:z,loadedModels:T-da,loadedTextures:z-ja},B);b.onLoadProgress();da==0&&ja==0&&c(B)}var n,o,m,s,p,r,t,w,q,C,v,x,I,K,G,y,D,Q,H,aa,M,R,da,ja,T,z,B;M=a.data;H=new THREE.BinaryLoader;R=new THREE.JSONLoader;ja=da=0;B={scene:new THREE.Scene,geometries:{},
+materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(m in M.objects)if(w=M.objects[m],w.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(M.transform){a=M.transform.position;q=M.transform.rotation;var L=M.transform.scale;a&&B.scene.position.set(a[0],a[1],a[2]);q&&B.scene.rotation.set(q[0],q[1],q[2]);L&&B.scene.scale.set(L[0],L[1],L[2]);(a||q||L)&&B.scene.updateMatrix()}a=function(){ja-=1;l();b.onLoadComplete()};for(p in M.cameras)q=
+M.cameras[p],q.type=="perspective"?D=new THREE.PerspectiveCamera(q.fov,q.aspect,q.near,q.far):q.type=="ortho"&&(D=new THREE.OrthographicCamera(q.left,q.right,q.top,q.bottom,q.near,q.far)),v=q.position,q=q.target,D.position.set(v[0],v[1],v[2]),D.target=new THREE.Vector3(q[0],q[1],q[2]),B.cameras[p]=D;for(s in M.lights)q=M.lights[s],p=q.color!==void 0?q.color:16777215,D=q.intensity!==void 0?q.intensity:1,q.type=="directional"?(v=q.direction,C=new THREE.DirectionalLight(p,D),C.position.set(v[0],v[1],
+v[2]),C.position.normalize()):q.type=="point"?(v=q.position,C=q.distance,C=new THREE.PointLight(p,D,C),C.position.set(v[0],v[1],v[2])):q.type=="ambient"&&(C=new THREE.AmbientLight(p)),B.scene.add(C),B.lights[s]=C;for(r in M.fogs)s=M.fogs[r],s.type=="linear"?Q=new THREE.Fog(0,s.near,s.far):s.type=="exp2"&&(Q=new THREE.FogExp2(0,s.density)),q=s.color,Q.color.setRGB(q[0],q[1],q[2]),B.fogs[r]=Q;if(B.cameras&&M.defaults.camera)B.currentCamera=B.cameras[M.defaults.camera];if(B.fogs&&M.defaults.fog)B.scene.fog=
+B.fogs[M.defaults.fog];q=M.defaults.bgcolor;B.bgColor=new THREE.Color;B.bgColor.setRGB(q[0],q[1],q[2]);B.bgColorAlpha=M.defaults.bgalpha;for(n in M.geometries)if(r=M.geometries[n],r.type=="bin_mesh"||r.type=="ascii_mesh")da+=1,b.onLoadStart();T=da;for(n in M.geometries)r=M.geometries[n],r.type=="cube"?(y=new THREE.CubeGeometry(r.width,r.height,r.depth,r.segmentsWidth,r.segmentsHeight,r.segmentsDepth,null,r.flipped,r.sides),B.geometries[n]=y):r.type=="plane"?(y=new THREE.PlaneGeometry(r.width,r.height,
+r.segmentsWidth,r.segmentsHeight),B.geometries[n]=y):r.type=="sphere"?(y=new THREE.SphereGeometry(r.radius,r.segmentsWidth,r.segmentsHeight),B.geometries[n]=y):r.type=="cylinder"?(y=new THREE.CylinderGeometry(r.topRad,r.botRad,r.height,r.radSegs,r.heightSegs),B.geometries[n]=y):r.type=="torus"?(y=new THREE.TorusGeometry(r.radius,r.tube,r.segmentsR,r.segmentsT),B.geometries[n]=y):r.type=="icosahedron"?(y=new THREE.IcosahedronGeometry(r.subdivisions),B.geometries[n]=y):r.type=="bin_mesh"?H.load(d(r.url,
+M.urlBaseType),i(n)):r.type=="ascii_mesh"?R.load(d(r.url,M.urlBaseType),i(n)):r.type=="embedded_mesh"&&(r=M.embeds[r.id])&&R.createModel(r,k(n),"");for(t in M.textures)if(n=M.textures[t],n.url instanceof Array){ja+=n.url.length;for(H=0;H<n.url.length;H++)b.onLoadStart()}else ja+=1,b.onLoadStart();z=ja;for(t in M.textures){n=M.textures[t];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){H=[];for(var j=0;j<n.url.length;j++)H[j]=d(n.url[j],M.urlBaseType);
+H=THREE.ImageUtils.loadTextureCube(H,n.mapping,a)}else{H=THREE.ImageUtils.loadTexture(d(n.url,M.urlBaseType),n.mapping,a);if(THREE[n.minFilter]!=void 0)H.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)H.magFilter=THREE[n.magFilter];if(n.repeat){H.repeat.set(n.repeat[0],n.repeat[1]);if(n.repeat[0]!=1)H.wrapS=THREE.RepeatWrapping;if(n.repeat[1]!=1)H.wrapT=THREE.RepeatWrapping}n.offset&&H.offset.set(n.offset[0],n.offset[1]);if(n.wrap){R={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};
+if(R[n.wrap[0]]!==void 0)H.wrapS=R[n.wrap[0]];if(R[n.wrap[1]]!==void 0)H.wrapT=R[n.wrap[1]]}}B.textures[t]=H}for(o in M.materials){t=M.materials[o];for(G in t.parameters)if(G=="envMap"||G=="map"||G=="lightMap")t.parameters[G]=B.textures[t.parameters[G]];else if(G=="shading")t.parameters[G]=t.parameters[G]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(G=="blending")t.parameters[G]=THREE[t.parameters[G]]?THREE[t.parameters[G]]:THREE.NormalBlending;else if(G=="combine")t.parameters[G]=t.parameters[G]==
+"MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(G=="vertexColors")if(t.parameters[G]=="face")t.parameters[G]=THREE.FaceColors;else if(t.parameters[G])t.parameters[G]=THREE.VertexColors;if(t.parameters.opacity!==void 0&&t.parameters.opacity<1)t.parameters.transparent=!0;if(t.parameters.normalMap){n=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(n.uniforms);H=t.parameters.color;R=t.parameters.specular;r=t.parameters.ambient;Q=t.parameters.shininess;a.tNormal.texture=B.textures[t.parameters.normalMap];
+if(t.parameters.normalMapFactor)a.uNormalScale.value=t.parameters.normalMapFactor;if(t.parameters.map)a.tDiffuse.texture=t.parameters.map,a.enableDiffuse.value=!0;if(t.parameters.lightMap)a.tAO.texture=t.parameters.lightMap,a.enableAO.value=!0;if(t.parameters.specularMap)a.tSpecular.texture=B.textures[t.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(H);a.uSpecularColor.value.setHex(R);a.uAmbientColor.value.setHex(r);a.uShininess.value=Q;if(t.parameters.opacity)a.uOpacity.value=
+t.parameters.opacity;t=new THREE.ShaderMaterial({fragmentShader:n.fragmentShader,vertexShader:n.vertexShader,uniforms:a,lights:!0,fog:!0})}else t=new THREE[t.type](t.parameters);B.materials[o]=t}h();b.callbackSync(B);l()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var d=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,e=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,h=b.offsetZ!==void 0?b.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 c,g,e,f,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,g=0;g<8;g++){for(var e=0,f=0;f<c;++f){var h=a.charCodeAt(f+d);e+=h>>1^-(h&1);b[8*f+g]=e}d+=c}c=a.length-d;e=new Uint16Array(c);for(g=f=0;g<c;g++)h=a.charCodeAt(g+d),e[g]=f-h,h==0&&f++;return[b,e]};
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,e){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],l=[];(function(a,f,i){for(var k,l,o,v=a.length;i<v;i+=f)k=a[i],l=a[i+1],o=a[i+2],k=k/16383*b,l=l/16383*b,o=o/16383*b,k+=d,l+=g,o+=e,c.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,o)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,l.push(d,1-e)})(f[0],8,3);(function(a,
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,k.push(d,e,f)})(f[0],8,5);(function(a){var b,d,e,f,g,i,w,r,s,u=a.length;for(b=0;b<u;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;r=d;s=e;i=f;w=d;var x=e,H=f,G=g.materials[0],F=k[x*3],y=k[x*3+1],x=k[x*3+2],C=k[H*3],O=k[H*3+1],H=k[H*3+2];w=new THREE.Vector3(k[w*3],k[w*3+1],k[w*3+2]);x=new THREE.Vector3(F,y,x);H=new THREE.Vector3(C,O,H);g.faces.push(new THREE.Face3(r,s,i,[w,x,H],null,G));g=l[d*2];d=l[d*2+
-1];i=l[e*2];w=l[e*2+1];r=l[f*2];s=l[f*2+1];f=c.faceVertexUvs[0];e=i;i=w;w=[];w.push(new THREE.UV(g,d));w.push(new THREE.UV(e,i));w.push(new THREE.UV(r,s));f.push(w)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,e){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],l=[];(function(a,f,i){for(var k,l,r,t=a.length;i<t;i+=f)k=a[i],l=a[i+1],r=a[i+2],k=k/16383*b,l=l/16383*b,r=r/16383*b,k+=d,l+=g,r+=e,c.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,r)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,l.push(d,1-e)})(f[0],8,3);(function(a,
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,k.push(d,e,f)})(f[0],8,5);(function(a){var b,d,e,f,g,i,w,q,C,v=a.length;for(b=0;b<v;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;q=d;C=e;i=f;w=d;var x=e,I=f,K=g.materials[0],G=k[x*3],y=k[x*3+1],x=k[x*3+2],D=k[I*3],Q=k[I*3+1],I=k[I*3+2];w=new THREE.Vector3(k[w*3],k[w*3+1],k[w*3+2]);x=new THREE.Vector3(G,y,x);I=new THREE.Vector3(D,Q,I);g.faces.push(new THREE.Face3(q,C,i,[w,x,I],null,K));g=l[d*2];d=l[d*2+
+1];i=l[e*2];w=l[e*2+1];q=l[f*2];C=l[f*2+1];f=c.faceVertexUvs[0];e=i;i=w;w=[];w.push(new THREE.UV(g,d));w.push(new THREE.UV(e,i));w.push(new THREE.UV(q,C));f.push(w)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
 b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,g){return a+(c-a)*g};this.VIntX=function(a,c,g,e,f,h,i,k,l,m){f=(f-l)/(m-l);l=this.normal_cache;c[e]=h+f*this.delta;c[e+1]=i;c[e+2]=k;g[e]=this.lerp(l[a],l[a+3],f);g[e+1]=this.lerp(l[a+1],l[a+4],f);g[e+2]=this.lerp(l[a+2],l[a+5],f)};this.VIntY=function(a,c,g,e,f,h,i,k,l,m){f=(f-l)/(m-l);l=this.normal_cache;c[e]=h;c[e+1]=i+f*this.delta;c[e+
-2]=k;c=a+this.yd*3;g[e]=this.lerp(l[a],l[c],f);g[e+1]=this.lerp(l[a+1],l[c+1],f);g[e+2]=this.lerp(l[a+2],l[c+2],f)};this.VIntZ=function(a,c,g,e,f,h,i,k,l,m){f=(f-l)/(m-l);l=this.normal_cache;c[e]=h;c[e+1]=i;c[e+2]=k+f*this.delta;c=a+this.zd*3;g[e]=this.lerp(l[a],l[c],f);g[e+1]=this.lerp(l[a+1],l[c+1],f);g[e+2]=this.lerp(l[a+2],l[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
-this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,e,f,h){var i=e+1,k=e+this.yd,l=e+this.zd,m=i+this.yd,q=i+this.zd,n=e+this.yd+this.zd,t=i+this.yd+this.zd,p=0,o=this.field[e],v=this.field[i],w=this.field[k],r=this.field[m],s=this.field[l],u=this.field[q],x=this.field[n],H=this.field[t];o<f&&(p|=1);v<f&&(p|=2);w<f&&(p|=8);r<f&&(p|=4);s<f&&(p|=16);u<f&&(p|=32);x<f&&(p|=128);H<f&&(p|=64);var G=THREE.edgeTable[p];if(G===0)return 0;
-var F=this.delta,y=a+F,C=c+F,F=g+F;G&1&&(this.compNorm(e),this.compNorm(i),this.VIntX(e*3,this.vlist,this.nlist,0,f,a,c,g,o,v));G&2&&(this.compNorm(i),this.compNorm(m),this.VIntY(i*3,this.vlist,this.nlist,3,f,y,c,g,v,r));G&4&&(this.compNorm(k),this.compNorm(m),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,C,g,w,r));G&8&&(this.compNorm(e),this.compNorm(k),this.VIntY(e*3,this.vlist,this.nlist,9,f,a,c,g,o,w));G&16&&(this.compNorm(l),this.compNorm(q),this.VIntX(l*3,this.vlist,this.nlist,12,f,a,c,F,s,u));
-G&32&&(this.compNorm(q),this.compNorm(t),this.VIntY(q*3,this.vlist,this.nlist,15,f,y,c,F,u,H));G&64&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,18,f,a,C,F,x,H));G&128&&(this.compNorm(l),this.compNorm(n),this.VIntY(l*3,this.vlist,this.nlist,21,f,a,c,F,s,x));G&256&&(this.compNorm(e),this.compNorm(l),this.VIntZ(e*3,this.vlist,this.nlist,24,f,a,c,g,o,s));G&512&&(this.compNorm(i),this.compNorm(q),this.VIntZ(i*3,this.vlist,this.nlist,27,f,y,c,g,v,u));G&1024&&(this.compNorm(m),
-this.compNorm(t),this.VIntZ(m*3,this.vlist,this.nlist,30,f,y,C,g,r,H));G&2048&&(this.compNorm(k),this.compNorm(n),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,C,g,w,x));p<<=4;for(f=e=0;THREE.triTable[p+f]!=-1;)a=p+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],h),f+=3,e++;return e};this.posnormtriv=function(a,c,g,e,f,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,g){return a+(c-a)*g};this.VIntX=function(a,c,g,e,f,h,i,k,l,n){f=(f-l)/(n-l);l=this.normal_cache;c[e]=h+f*this.delta;c[e+1]=i;c[e+2]=k;g[e]=this.lerp(l[a],l[a+3],f);g[e+1]=this.lerp(l[a+1],l[a+4],f);g[e+2]=this.lerp(l[a+2],l[a+5],f)};this.VIntY=function(a,c,g,e,f,h,i,k,l,n){f=(f-l)/(n-l);l=this.normal_cache;c[e]=h;c[e+1]=i+f*this.delta;c[e+
+2]=k;c=a+this.yd*3;g[e]=this.lerp(l[a],l[c],f);g[e+1]=this.lerp(l[a+1],l[c+1],f);g[e+2]=this.lerp(l[a+2],l[c+2],f)};this.VIntZ=function(a,c,g,e,f,h,i,k,l,n){f=(f-l)/(n-l);l=this.normal_cache;c[e]=h;c[e+1]=i;c[e+2]=k+f*this.delta;c=a+this.zd*3;g[e]=this.lerp(l[a],l[c],f);g[e+1]=this.lerp(l[a+1],l[c+1],f);g[e+2]=this.lerp(l[a+2],l[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
+this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,e,f,h){var i=e+1,k=e+this.yd,l=e+this.zd,n=i+this.yd,o=i+this.zd,m=e+this.yd+this.zd,s=i+this.yd+this.zd,p=0,r=this.field[e],t=this.field[i],w=this.field[k],q=this.field[n],C=this.field[l],v=this.field[o],x=this.field[m],I=this.field[s];r<f&&(p|=1);t<f&&(p|=2);w<f&&(p|=8);q<f&&(p|=4);C<f&&(p|=16);v<f&&(p|=32);x<f&&(p|=128);I<f&&(p|=64);var K=THREE.edgeTable[p];if(K===0)return 0;
+var G=this.delta,y=a+G,D=c+G,G=g+G;K&1&&(this.compNorm(e),this.compNorm(i),this.VIntX(e*3,this.vlist,this.nlist,0,f,a,c,g,r,t));K&2&&(this.compNorm(i),this.compNorm(n),this.VIntY(i*3,this.vlist,this.nlist,3,f,y,c,g,t,q));K&4&&(this.compNorm(k),this.compNorm(n),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,D,g,w,q));K&8&&(this.compNorm(e),this.compNorm(k),this.VIntY(e*3,this.vlist,this.nlist,9,f,a,c,g,r,w));K&16&&(this.compNorm(l),this.compNorm(o),this.VIntX(l*3,this.vlist,this.nlist,12,f,a,c,G,C,v));
+K&32&&(this.compNorm(o),this.compNorm(s),this.VIntY(o*3,this.vlist,this.nlist,15,f,y,c,G,v,I));K&64&&(this.compNorm(m),this.compNorm(s),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,D,G,x,I));K&128&&(this.compNorm(l),this.compNorm(m),this.VIntY(l*3,this.vlist,this.nlist,21,f,a,c,G,C,x));K&256&&(this.compNorm(e),this.compNorm(l),this.VIntZ(e*3,this.vlist,this.nlist,24,f,a,c,g,r,C));K&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,f,y,c,g,t,v));K&1024&&(this.compNorm(n),
+this.compNorm(s),this.VIntZ(n*3,this.vlist,this.nlist,30,f,y,D,g,q,I));K&2048&&(this.compNorm(k),this.compNorm(m),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,D,g,w,x));p<<=4;for(f=e=0;THREE.triTable[p+f]!=-1;)a=p+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],h),f+=3,e++;return e};this.posnormtriv=function(a,c,g,e,f,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
 3]=a[e];this.positionArray[i+4]=a[e+1];this.positionArray[i+5]=a[e+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=c[g];this.normalArray[i+1]=c[g+1];this.normalArray[i+2]=c[g+2];this.normalArray[i+3]=c[e];this.normalArray[i+4]=c[e+1];this.normalArray[i+5]=c[e+2];this.normalArray[i+6]=c[f];this.normalArray[i+7]=c[f+1];this.normalArray[i+8]=c[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
-function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,g,e,f){var h=this.size*Math.sqrt(e/f),i=g*this.size,k=c*this.size,l=a*this.size,m=Math.floor(i-h);m<1&&(m=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var q=Math.floor(k-h);q<1&&(q=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var n=Math.floor(l-h);n<1&&(n=1);h=Math.floor(l+h);
-h>this.size-1&&(h=this.size-1);for(var t,p,o,v,w,r;m<i;m++){l=this.size2*m;p=m/this.size-g;w=p*p;for(p=q;p<k;p++){o=l+this.size*p;t=p/this.size-c;r=t*t;for(t=n;t<h;t++)v=t/this.size-a,v=e/(1.0E-6+v*v+r+w)-f,v>0&&(this.field[o+t]+=v)}}};this.addPlaneX=function(a,c){var g,e,f,h,i,k=this.size,l=this.yd,m=this.zd,q=this.field,n=k*Math.sqrt(a/c);n>k&&(n=k);for(g=0;g<n;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-c,h>0)for(e=0;e<k;e++){i=g+e*l;for(f=0;f<k;f++)q[m*f+i]+=h}};this.addPlaneY=function(a,c){var g,e,f,h,
-i,k,l=this.size,m=this.yd,q=this.zd,n=this.field,t=l*Math.sqrt(a/c);t>l&&(t=l);for(e=0;e<t;e++)if(g=e/l,g*=g,h=a/(1.0E-4+g)-c,h>0){i=e*m;for(g=0;g<l;g++){k=i+g;for(f=0;f<l;f++)n[q*f+k]+=h}}};this.addPlaneZ=function(a,c){var g,e,f,h,i,k,l=this.size,m=this.yd,q=this.zd,n=this.field,t=l*Math.sqrt(a/c);t>l&&(t=l);for(f=0;f<t;f++)if(g=f/l,g*=g,h=a/(1.0E-4+g)-c,h>0){i=q*f;for(e=0;e<l;e++){k=i+e*m;for(g=0;g<l;g++)n[k+g]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,
-this.field[a]=0};this.render=function(a){this.begin();var c,g,e,f,h,i,k,l,m,q=this.size-2;for(f=1;f<q;f++){m=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(e=1;e<q;e++){l=m+this.size*e;i=(e-this.halfsize)/this.halfsize;for(g=1;g<q;g++)h=(g-this.halfsize)/this.halfsize,c=l+g,this.polygonize(h,i,k,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(e){var f,h,i,k,l,m,q,n;for(f=0;f<e.count;f++)q=f*3,l=q+1,n=q+2,h=e.positionArray[q],
-i=e.positionArray[l],k=e.positionArray[n],m=new THREE.Vector3(h,i,k),h=e.normalArray[q],i=e.normalArray[l],k=e.normalArray[n],q=new THREE.Vector3(h,i,k),q.normalize(),l=new THREE.Vertex(m),c.vertices.push(l),g.push(q);m=e.count/3;for(f=0;f<m;f++)q=(a+f)*3,l=q+1,n=q+2,h=g[q],i=g[l],k=g[n],q=new THREE.Face3(q,l,n,[h,i,k]),c.faces.push(q);a+=m;e.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,g,e,f){var h=this.size*Math.sqrt(e/f),i=g*this.size,k=c*this.size,l=a*this.size,n=Math.floor(i-h);n<1&&(n=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(k-h);o<1&&(o=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var m=Math.floor(l-h);m<1&&(m=1);h=Math.floor(l+h);
+h>this.size-1&&(h=this.size-1);for(var s,p,r,t,w,q;n<i;n++){l=this.size2*n;p=n/this.size-g;w=p*p;for(p=o;p<k;p++){r=l+this.size*p;s=p/this.size-c;q=s*s;for(s=m;s<h;s++)t=s/this.size-a,t=e/(1.0E-6+t*t+q+w)-f,t>0&&(this.field[r+s]+=t)}}};this.addPlaneX=function(a,c){var g,e,f,h,i,k=this.size,l=this.yd,n=this.zd,o=this.field,m=k*Math.sqrt(a/c);m>k&&(m=k);for(g=0;g<m;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-c,h>0)for(e=0;e<k;e++){i=g+e*l;for(f=0;f<k;f++)o[n*f+i]+=h}};this.addPlaneY=function(a,c){var g,e,f,h,
+i,k,l=this.size,n=this.yd,o=this.zd,m=this.field,s=l*Math.sqrt(a/c);s>l&&(s=l);for(e=0;e<s;e++)if(g=e/l,g*=g,h=a/(1.0E-4+g)-c,h>0){i=e*n;for(g=0;g<l;g++){k=i+g;for(f=0;f<l;f++)m[o*f+k]+=h}}};this.addPlaneZ=function(a,c){var g,e,f,h,i,k,l=this.size,n=this.yd,o=this.zd,m=this.field,s=l*Math.sqrt(a/c);s>l&&(s=l);for(f=0;f<s;f++)if(g=f/l,g*=g,h=a/(1.0E-4+g)-c,h>0){i=o*f;for(e=0;e<l;e++){k=i+e*n;for(g=0;g<l;g++)m[k+g]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,
+this.field[a]=0};this.render=function(a){this.begin();var c,g,e,f,h,i,k,l,n,o=this.size-2;for(f=1;f<o;f++){n=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(e=1;e<o;e++){l=n+this.size*e;i=(e-this.halfsize)/this.halfsize;for(g=1;g<o;g++)h=(g-this.halfsize)/this.halfsize,c=l+g,this.polygonize(h,i,k,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(e){var f,h,i,k,l,n,o,m;for(f=0;f<e.count;f++)o=f*3,l=o+1,m=o+2,h=e.positionArray[o],
+i=e.positionArray[l],k=e.positionArray[m],n=new THREE.Vector3(h,i,k),h=e.normalArray[o],i=e.normalArray[l],k=e.normalArray[m],o=new THREE.Vector3(h,i,k),o.normalize(),l=new THREE.Vertex(n),c.vertices.push(l),g.push(o);n=e.count/3;for(f=0;f<n;f++)o=(a+f)*3,l=o+1,m=o+2,h=g[o],i=g[l],k=g[m],o=new THREE.Face3(o,l,m,[h,i,k]),c.faces.push(o);a+=n;e.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -701,9 +701,9 @@ d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case
 THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var d=b.dot(a.direction.clone());if(d<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-d*d);if(b>=0)return Math.abs(d)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,l,m;g.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},q=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.PerspectiveCamera(53,
-1,1,1E4);t.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:q},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
-p=new THREE.Scene;p.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));p.add(t);this.setSize=function(a,d){b.call(c,a,d);q.width=a;q.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||l!==b.far||m!==b.fov){i=b.aspect;k=b.near;l=b.far;m=b.fov;var w=b.projectionMatrix.clone(),r=125/30*0.5,s=r*k/125,u=k*Math.tan(m*Math.PI/360),x;f.n14=r;h.n14=-r;r=-u*i+s;x=u*i+s;w.n11=2*k/(x-r);w.n13=(x+r)/(x-r);g.projectionMatrix.copy(w);r=-u*i-s;x=u*i-s;w.n11=
-2*k/(x-r);w.n13=(x+r)/(x-r);e.projectionMatrix.copy(w)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,q,!0);e.matrixWorld.copy(b.matrixWorld).multiplySelf(f);e.position.copy(b.position);e.near=b.near;e.far=b.far;d.call(c,a,e,n,!0);p.updateMatrixWorld();d.call(c,p,t)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,l,n;g.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),s=new THREE.PerspectiveCamera(53,
+1,1,1E4);s.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:m}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
+p=new THREE.Scene;p.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));p.add(s);this.setSize=function(a,d){b.call(c,a,d);o.width=a;o.height=d;m.width=a;m.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||l!==b.far||n!==b.fov){i=b.aspect;k=b.near;l=b.far;n=b.fov;var w=b.projectionMatrix.clone(),q=125/30*0.5,C=q*k/125,v=k*Math.tan(n*Math.PI/360),x;f.n14=q;h.n14=-q;q=-v*i+C;x=v*i+C;w.n11=2*k/(x-q);w.n13=(x+q)/(x-q);g.projectionMatrix.copy(w);q=-v*i-C;x=v*i-C;w.n11=
+2*k/(x-q);w.n13=(x+q)/(x-q);e.projectionMatrix.copy(w)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,o,!0);e.matrixWorld.copy(b.matrixWorld).multiplySelf(f);e.position.copy(b.position);e.near=b.near;e.far=b.far;d.call(c,a,e,m,!0);p.updateMatrixWorld();d.call(c,p,s)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,d=this.render,g,e,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,d){b.call(c,a,d);g=a/2;e=d};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far=
 b.far;f.updateProjectionMatrix();f.position.copy(b.position);f.target.copy(b.target);f.translateX(c.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,g,e);d.call(c,a,f);this.setViewport(g,0,g,e);d.call(c,a,h,!1)}};

+ 70 - 70
build/custom/ThreeCanvas.js

@@ -13,39 +13,39 @@ cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y
 Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12/b,a.n11/b)):(this.x=0,this.z=Math.atan2(a.n21,a.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
-normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){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;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,k){d.copy(k).subSelf(b);
-f.copy(c).subSelf(b);e.copy(a).subSelf(b);g=d.dot(d);h=d.dot(f);l=d.dot(e);n=f.dot(f);j=f.dot(e);i=1/(g*n-h*h);p=(n*l-h*j)*i;o=(g*j-h*l)*i;return p>=0&&o>=0&&p+o<1}for(var d=new THREE.Vector3,f=new THREE.Vector3,e=new THREE.Vector3,g,h,l,n,j,i,p,o,m,k=[],r=0,H=a.children.length;r<H;r++)Array.prototype.push.apply(k,this.intersectObject(a.children[r]));if(a instanceof THREE.Particle){r=b(this.origin,this.direction,a.matrixWorld.getPosition());if(r===null||r>a.scale.x)return[];m={distance:r,point:a.position,
-face:null,object:a};k.push(m)}else if(a instanceof THREE.Mesh){r=b(this.origin,this.direction,a.matrixWorld.getPosition());if(r===null||r>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return k;var E,L,M,t,F,w,x,u,s=a.geometry,B=s.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);r=0;for(H=s.faces.length;r<H;r++)if(m=s.faces[r],x=this.origin.clone(),u=this.direction.clone(),t=a.matrixWorld,E=t.multiplyVector3(m.centroid.clone()).subSelf(x),w=E.dot(u),
-!(w<=0)&&(E=t.multiplyVector3(B[m.a].position.clone()),L=t.multiplyVector3(B[m.b].position.clone()),M=t.multiplyVector3(B[m.c].position.clone()),t=m instanceof THREE.Face4?t.multiplyVector3(B[m.d].position.clone()):null,F=a.matrixRotationWorld.multiplyVector3(m.normal.clone()),w=u.dot(F),a.doubleSided||(a.flipSided?w>0:w<0)))if(w=F.dot((new THREE.Vector3).sub(E,x))/w,x=x.addSelf(u.multiplyScalar(w)),m instanceof THREE.Face3)c(x,E,L,M)&&(m={distance:this.origin.distanceTo(x),point:x,face:m,object:a},
-k.push(m));else if(m instanceof THREE.Face4&&(c(x,E,L,t)||c(x,L,M,t)))m={distance:this.origin.distanceTo(x),point:x,face:m,object:a},k.push(m)}return k}};
-THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b,c,d,f,e,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,j,i){h=!1;b=e;c=g;d=j;f=i;a()};this.addPoint=function(e,g){h?(h=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
-function(e,g,j,i,p,o){h?(h=!1,b=e<j?e<p?e:p:j<p?j:p,c=g<i?g<o?g:o:i<o?i:o,d=e>j?e>p?e:p:j>p?j:p,f=g>i?g>o?g:o:i>o?i:o):(b=e<j?e<p?e<b?e:b:p<b?p:b:j<p?j<b?j:b:p<b?p:b,c=g<i?g<o?g<c?g:c:o<c?o:c:i<o?i<c?i:c:o<c?o:c,d=e>j?e>p?e>d?e:d:p>d?p:d:j>p?j>d?j:d:p>d?p:d,f=g>i?g>o?g>f?g:f:o>f?o:f:i>o?i>f?i:f:o>f?o:f);a()};this.addRectangle=function(e){h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
+normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){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;return this}};
+THREE.Ray=function(a,b){function c(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function d(a,b,c,d){n.copy(d).subSelf(b);i.copy(c).subSelf(b);j.copy(a).subSelf(b);m=n.dot(n);o=n.dot(i);q=n.dot(j);k=i.dot(i);s=i.dot(j);H=1/(m*k-o*o);E=(k*q-o*s)*H;M=(m*s-o*q)*H;return E>=0&&M>=0&&E+M<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};
+this.intersectObjects=function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var f=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,l=new THREE.Vector3;this.intersectObject=function(a){for(var b,n=[],i=0,k=a.children.length;i<k;i++)Array.prototype.push.apply(n,this.intersectObject(a.children[i]));if(a instanceof THREE.Particle){i=
+c(this.origin,this.direction,a.matrixWorld.getPosition());if(i===null||i>a.scale.x)return[];b={distance:i,point:a.position,face:null,object:a};n.push(b)}else if(a instanceof THREE.Mesh){i=c(this.origin,this.direction,a.matrixWorld.getPosition());if(i===null||i>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return n;var o,j,m,q,W=a.geometry,Y=W.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);i=0;for(k=W.faces.length;i<k;i++)if(b=W.faces[i],m=this.origin.clone(),
+q=this.direction.clone(),j=a.matrixWorld,o=j.multiplyVector3(b.centroid.clone()).subSelf(m),o=o.dot(q),!(o<=0)&&(f=j.multiplyVector3(f.copy(Y[b.a].position)),e=j.multiplyVector3(e.copy(Y[b.b].position)),g=j.multiplyVector3(g.copy(Y[b.c].position)),h=b instanceof THREE.Face4?j.multiplyVector3(h.copy(Y[b.d].position)):null,l=a.matrixRotationWorld.multiplyVector3(l.copy(b.normal)),o=q.dot(l),a.doubleSided||(a.flipSided?o>0:o<0)))if(j=l.dot((new THREE.Vector3).sub(f,m))/o,m=m.addSelf(q.multiplyScalar(j)),
+b instanceof THREE.Face3)d(m,f,e,g)&&(b={distance:this.origin.distanceTo(m),point:m,face:b,object:a},n.push(b));else if(b instanceof THREE.Face4&&(d(m,f,e,h)||d(m,e,g,h)))b={distance:this.origin.distanceTo(m),point:m,face:b,object:a},n.push(b)}return n};var n=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,m,o,q,k,s,H,E,M};
+THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b,c,d,f,e,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,i,j){h=!1;b=e;c=g;d=i;f=j;a()};this.addPoint=function(e,g){h?(h=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
+function(e,g,i,j,m,o){h?(h=!1,b=e<i?e<m?e:m:i<m?i:m,c=g<j?g<o?g:o:j<o?j:o,d=e>i?e>m?e:m:i>m?i:m,f=g>j?g>o?g:o:j>o?j:o):(b=e<i?e<m?e<b?e:b:m<b?m:b:i<m?i<b?i:b:m<b?m:b,c=g<j?g<o?g<c?g:c:o<c?o:c:j<o?j<c?j:c:o<c?o:c,d=e>i?e>m?e>d?e:d:m>d?m:d:i>m?i>d?i:d:m>d?m:d,f=g>j?g>o?g>f?g:f:o>f?o:f:j>o?j>f?j:f:o>f?o:f);a()};this.addRectangle=function(e){h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
 e.getBottom()?f:e.getBottom());a()};this.inflate=function(e){b-=e;c-=e;d+=e;f+=e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;f=d=c=b=0;a()};this.isEmpty=function(){return h}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,f){return d+(a-b)*(f-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,f,e,g,h,l,n,j,i,p,o,m,k){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,l||0,n||0,j!==void 0?j:1,i||0,p||0,o||0,m||0,k!==void 0?k:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,l,n,j,i,p,o,m,k){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=h;this.n31=l;this.n32=n;this.n33=j;this.n34=i;this.n41=p;this.n42=o;this.n43=m;this.n44=k;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,h=a.n22,l=a.n23,n=a.n24,j=a.n31,i=a.n32,p=a.n33,o=a.n34,m=a.n41,k=a.n42,r=a.n43,
-H=a.n44,E=b.n11,L=b.n12,M=b.n13,t=b.n14,F=b.n21,w=b.n22,x=b.n23,u=b.n24,s=b.n31,B=b.n32,K=b.n33,aa=b.n34,ea=b.n41,O=b.n42,Q=b.n43,T=b.n44;this.n11=c*E+d*F+f*s+e*ea;this.n12=c*L+d*w+f*B+e*O;this.n13=c*M+d*x+f*K+e*Q;this.n14=c*t+d*u+f*aa+e*T;this.n21=g*E+h*F+l*s+n*ea;this.n22=g*L+h*w+l*B+n*O;this.n23=g*M+h*x+l*K+n*Q;this.n24=g*t+h*u+l*aa+n*T;this.n31=j*E+i*F+p*s+o*ea;this.n32=j*L+i*w+p*B+o*O;this.n33=j*M+i*x+p*K+o*Q;this.n34=j*t+i*u+p*aa+o*T;this.n41=m*E+k*F+r*s+H*ea;this.n42=m*L+k*w+r*B+H*O;this.n43=
-m*M+k*x+r*K+H*Q;this.n44=m*t+k*u+r*aa+H*T;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},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},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=
-this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,e=this.n22,g=this.n23,h=this.n24,l=this.n31,n=this.n32,j=this.n33,i=this.n34,p=this.n41,o=this.n42,m=this.n43,k=this.n44;return d*g*n*p-c*h*n*p-d*e*j*p+b*h*j*p+c*e*i*p-b*g*i*p-d*g*l*o+c*h*l*o+d*f*j*o-a*h*j*o-c*f*i*o+a*g*i*o+d*e*l*m-b*h*l*m-d*f*n*m+a*h*n*m+b*f*i*m-a*e*i*m-c*e*l*k+b*g*l*k+c*f*n*k-a*g*n*k-
-b*f*j*k+a*e*j*k},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;
-a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.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,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,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 c=Math.cos(b),d=Math.sin(b),f=1-c,e=a.x,g=a.y,h=a.z,l=f*e,n=f*g;this.set(l*e+c,l*g-d*h,l*h+d*g,0,l*g+d*h,n*g+c,n*h-d*e,0,l*h-d*g,n*h+d*e,f*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,f=a.n14,e=a.n21,g=a.n22,h=a.n23,l=a.n24,n=a.n31,j=a.n32,i=a.n33,p=a.n34,o=a.n41,m=a.n42,k=a.n43,r=a.n44;this.n11=h*p*m-l*i*m+l*j*k-g*p*k-h*j*r+g*i*r;this.n12=f*i*m-d*p*m-f*j*k+c*p*k+d*j*r-c*i*r;this.n13=d*l*m-f*h*m+f*g*k-c*l*k-d*g*r+c*h*r;this.n14=f*h*j-d*l*j-f*g*i+c*l*i+d*g*p-c*h*p;this.n21=l*i*o-h*p*o-l*n*k+e*p*k+h*n*r-e*i*r;this.n22=d*p*o-f*i*o+
-f*n*k-b*p*k-d*n*r+b*i*r;this.n23=f*h*o-d*l*o-f*e*k+b*l*k+d*e*r-b*h*r;this.n24=d*l*n-f*h*n+f*e*i-b*l*i-d*e*p+b*h*p;this.n31=g*p*o-l*j*o+l*n*m-e*p*m-g*n*r+e*j*r;this.n32=f*j*o-c*p*o-f*n*m+b*p*m+c*n*r-b*j*r;this.n33=d*l*o-f*g*o+f*e*m-b*l*m-c*e*r+b*g*r;this.n34=f*g*n-c*l*n-f*e*j+b*l*j+c*e*p-b*g*p;this.n41=h*j*o-g*i*o-h*n*m+e*i*m+g*n*k-e*j*k;this.n42=c*i*o-d*j*o+d*n*m-b*i*m-c*n*k+b*j*k;this.n43=d*g*o-c*h*o-d*e*m+b*h*m+c*e*k-b*g*k;this.n44=c*h*n-d*g*n+d*e*j-b*h*j-c*e*i+b*g*i;this.multiplyScalar(1/a.determinant());
-return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var l=g*h,n=g*f,j=d*h,i=d*f;this.n11=l+i*c;this.n12=j*c-n;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=n*c-j;this.n32=i+l*c;this.n33=e*g;break;case "ZXY":l=g*h;n=g*f;j=d*h;i=d*f;this.n11=l-i*c;this.n12=-e*f;this.n13=j+n*c;this.n21=n+j*c;this.n22=e*h;this.n23=i-l*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":l=
-e*h;n=e*f;j=c*h;i=c*f;this.n11=g*h;this.n12=j*d-n;this.n13=l*d+i;this.n21=g*f;this.n22=i*d+l;this.n23=n*d-j;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":l=e*g;n=e*d;j=c*g;i=c*d;this.n11=g*h;this.n12=i-l*f;this.n13=j*f+n;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=n*f+j;this.n33=l-i*f;break;case "XZY":l=e*g;n=e*d;j=c*g;i=c*d;this.n11=g*h;this.n12=-f;this.n13=d*h;this.n21=l*f+i;this.n22=e*h;this.n23=n*f-j;this.n31=j*f-n;this.n32=c*h;this.n33=i*f+l;break;default:l=e*h,n=e*
-f,j=c*h,i=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=n+j*d,this.n22=l-i*d,this.n23=-c*g,this.n31=i-l*d,this.n32=j+n*d,this.n33=e*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,e=b+b,g=c+c,h=d+d,a=b*e,l=b*g;b*=h;var n=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(n+d);this.n12=l-f;this.n13=b+g;this.n21=l+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-g;this.n32=c+e;this.n33=1-(a+n);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
+THREE.Matrix4=function(a,b,c,d,f,e,g,h,l,n,i,j,m,o,q,k){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,l||0,n||0,i!==void 0?i:1,j||0,m||0,o||0,q||0,k!==void 0?k:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,l,n,i,j,m,o,q,k){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=h;this.n31=l;this.n32=n;this.n33=i;this.n34=j;this.n41=m;this.n42=o;this.n43=q;this.n44=k;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,h=a.n22,l=a.n23,n=a.n24,i=a.n31,j=a.n32,m=a.n33,o=a.n34,q=a.n41,k=a.n42,s=a.n43,
+H=a.n44,E=b.n11,M=b.n12,Q=b.n13,z=b.n14,A=b.n21,C=b.n22,F=b.n23,u=b.n24,r=b.n31,D=b.n32,K=b.n33,W=b.n34,Y=b.n41,N=b.n42,P=b.n43,T=b.n44;this.n11=c*E+d*A+f*r+e*Y;this.n12=c*M+d*C+f*D+e*N;this.n13=c*Q+d*F+f*K+e*P;this.n14=c*z+d*u+f*W+e*T;this.n21=g*E+h*A+l*r+n*Y;this.n22=g*M+h*C+l*D+n*N;this.n23=g*Q+h*F+l*K+n*P;this.n24=g*z+h*u+l*W+n*T;this.n31=i*E+j*A+m*r+o*Y;this.n32=i*M+j*C+m*D+o*N;this.n33=i*Q+j*F+m*K+o*P;this.n34=i*z+j*u+m*W+o*T;this.n41=q*E+k*A+s*r+H*Y;this.n42=q*M+k*C+s*D+H*N;this.n43=q*Q+k*
+F+s*K+H*P;this.n44=q*z+k*u+s*W+H*T;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},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},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*
+c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,e=this.n22,g=this.n23,h=this.n24,l=this.n31,n=this.n32,i=this.n33,j=this.n34,m=this.n41,o=this.n42,q=this.n43,k=this.n44;return d*g*n*m-c*h*n*m-d*e*i*m+b*h*i*m+c*e*j*m-b*g*j*m-d*g*l*o+c*h*l*o+d*f*i*o-a*h*i*o-c*f*j*o+a*g*j*o+d*e*l*q-b*h*l*q-d*f*n*q+a*h*n*q+b*f*j*q-a*e*j*q-c*e*l*k+b*g*l*k+c*f*n*k-a*g*n*k-b*f*i*k+a*e*i*k},transpose:function(){var a;
+a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;
+a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.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,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,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 c=Math.cos(b),d=Math.sin(b),f=1-c,e=a.x,g=a.y,h=a.z,l=f*e,n=f*g;this.set(l*e+c,l*g-d*h,l*h+d*g,0,l*g+d*h,n*g+c,n*h-d*e,0,l*h-d*g,n*h+d*e,f*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,f=a.n14,e=a.n21,g=a.n22,h=a.n23,l=a.n24,n=a.n31,i=a.n32,j=a.n33,m=a.n34,o=a.n41,q=a.n42,k=a.n43,s=a.n44;this.n11=h*m*q-l*j*q+l*i*k-g*m*k-h*i*s+g*j*s;this.n12=f*j*q-d*m*q-f*i*k+c*m*k+d*i*s-c*j*s;this.n13=d*l*q-f*h*q+f*g*k-c*l*k-d*g*s+c*h*s;this.n14=f*h*i-d*l*i-f*g*j+c*l*j+d*g*m-c*h*m;this.n21=l*j*o-h*m*o-l*n*k+e*m*k+h*n*s-e*j*s;this.n22=d*m*o-f*j*o+
+f*n*k-b*m*k-d*n*s+b*j*s;this.n23=f*h*o-d*l*o-f*e*k+b*l*k+d*e*s-b*h*s;this.n24=d*l*n-f*h*n+f*e*j-b*l*j-d*e*m+b*h*m;this.n31=g*m*o-l*i*o+l*n*q-e*m*q-g*n*s+e*i*s;this.n32=f*i*o-c*m*o-f*n*q+b*m*q+c*n*s-b*i*s;this.n33=d*l*o-f*g*o+f*e*q-b*l*q-c*e*s+b*g*s;this.n34=f*g*n-c*l*n-f*e*i+b*l*i+c*e*m-b*g*m;this.n41=h*i*o-g*j*o-h*n*q+e*j*q+g*n*k-e*i*k;this.n42=c*j*o-d*i*o+d*n*q-b*j*q-c*n*k+b*i*k;this.n43=d*g*o-c*h*o-d*e*q+b*h*q+c*e*k-b*g*k;this.n44=c*h*n-d*g*n+d*e*i-b*h*i-c*e*j+b*g*j;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var l=g*h,n=g*f,i=d*h,j=d*f;this.n11=l+j*c;this.n12=i*c-n;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=n*c-i;this.n32=j+l*c;this.n33=e*g;break;case "ZXY":l=g*h;n=g*f;i=d*h;j=d*f;this.n11=l-j*c;this.n12=-e*f;this.n13=i+n*c;this.n21=n+i*c;this.n22=e*h;this.n23=j-l*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":l=
+e*h;n=e*f;i=c*h;j=c*f;this.n11=g*h;this.n12=i*d-n;this.n13=l*d+j;this.n21=g*f;this.n22=j*d+l;this.n23=n*d-i;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":l=e*g;n=e*d;i=c*g;j=c*d;this.n11=g*h;this.n12=j-l*f;this.n13=i*f+n;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=n*f+i;this.n33=l-j*f;break;case "XZY":l=e*g;n=e*d;i=c*g;j=c*d;this.n11=g*h;this.n12=-f;this.n13=d*h;this.n21=l*f+j;this.n22=e*h;this.n23=n*f-i;this.n31=i*f-n;this.n32=c*h;this.n33=j*f+l;break;default:l=e*h,n=e*
+f,i=c*h,j=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=n+i*d,this.n22=l-j*d,this.n23=-c*g,this.n31=j-l*d,this.n32=i+n*d,this.n33=e*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,e=b+b,g=c+c,h=d+d,a=b*e,l=b*g;b*=h;var n=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(n+d);this.n12=l-f;this.n13=b+g;this.n21=l+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-g;this.n32=c+e;this.n33=1-(a+n);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
 a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(d,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);e.set(this.n13,
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=f.length();c.z=e.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this}};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,i=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*n;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*h;c[5]=a*l;c[6]=a*n;c[7]=a*j;c[8]=a*i;return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,i=-a.n23*a.n11+a.n21*a.n13,j=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*n;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*h;c[5]=a*l;c[6]=a*n;c[7]=a*i;c[8]=a*j;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,f,e){var g;g=new THREE.Matrix4;g.n11=2*f/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*f/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(e+f)/(e-f);g.n34=-2*e*f/(e-f);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,f,e){var g,h,l,n;g=new THREE.Matrix4;h=b-a;l=c-d;n=e-f;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/l;g.n23=0;g.n24=-((c+d)/l);g.n31=0;g.n32=0;g.n33=-2/n;g.n34=-((e+f)/n);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
@@ -55,23 +55,23 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableObject;e++;return a}function b(){var a=n[l]=n[l]||new THREE.RenderableVertex;l++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var f,e,g=[],h,l,n=[],
-j,i,p=[],o,m=[],k,r,H=[],E,L,M=[],t={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,w=new THREE.Vector4,x=new THREE.Matrix4,u=new THREE.Matrix4,s=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],B=new THREE.Vector4,K=new THREE.Vector4;this.computeFrustum=function(a){s[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);s[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);s[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);s[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);s[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);s[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=s[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);x.multiply(b.projectionMatrix,b.matrixWorldInverse);x.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-x.multiply(b.matrixWorld,b.projectionMatrixInverse);x.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){e=0;t.objects.length=0;t.sprites.length=0;t.lights.length=0;var g=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
-e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=s[h].x*d.n14+s[h].y*d.n24+s[h].z*d.n34+s[h].w,c<=e){c=!1;break a}c=!0}c?(x.multiplyVector3(F.copy(b.position)),f=a(),f.object=b,f.z=F.z,t.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(x.multiplyVector3(F.copy(b.position)),f=a(),f.object=b,f.z=F.z,t.sprites.push(f)):b instanceof THREE.Light&&t.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
-t.objects.sort(c);return t};this.projectScene=function(a,e,f){var g=e.near,s=e.far,F,I,D,R,y,P,N,V,G,v,C,z,A,J,ka,$;L=r=o=i=0;t.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);x.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(x);t=this.projectGraph(a,!1);a=0;for(F=t.objects.length;a<F;a++)if(G=t.objects[a].object,v=G.matrixWorld,z=
-G.material,l=0,G instanceof THREE.Mesh){C=G.geometry;A=G.geometry.materials;R=C.vertices;J=C.faces;ka=C.faceVertexUvs;C=G.matrixRotationWorld.extractRotation(v);I=0;for(D=R.length;I<D;I++)h=b(),h.positionWorld.copy(R[I].position),v.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),x.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<s;R=0;for(I=J.length;R<I;R++){D=
-J[R];if(D instanceof THREE.Face3)if(y=n[D.a],P=n[D.b],N=n[D.c],y.visible&&P.visible&&N.visible&&(G.doubleSided||G.flipSided!=(N.positionScreen.x-y.positionScreen.x)*(P.positionScreen.y-y.positionScreen.y)-(N.positionScreen.y-y.positionScreen.y)*(P.positionScreen.x-y.positionScreen.x)<0))V=p[i]=p[i]||new THREE.RenderableFace3,i++,j=V,j.v1.copy(y),j.v2.copy(P),j.v3.copy(N);else continue;else if(D instanceof THREE.Face4)if(y=n[D.a],P=n[D.b],N=n[D.c],V=n[D.d],y.visible&&P.visible&&N.visible&&V.visible&&
-(G.doubleSided||G.flipSided!=((V.positionScreen.x-y.positionScreen.x)*(P.positionScreen.y-y.positionScreen.y)-(V.positionScreen.y-y.positionScreen.y)*(P.positionScreen.x-y.positionScreen.x)<0||(P.positionScreen.x-N.positionScreen.x)*(V.positionScreen.y-N.positionScreen.y)-(P.positionScreen.y-N.positionScreen.y)*(V.positionScreen.x-N.positionScreen.x)<0)))$=m[o]=m[o]||new THREE.RenderableFace4,o++,j=$,j.v1.copy(y),j.v2.copy(P),j.v3.copy(N),j.v4.copy(V);else continue;j.normalWorld.copy(D.normal);C.multiplyVector3(j.normalWorld);
-j.centroidWorld.copy(D.centroid);v.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);x.multiplyVector3(j.centroidScreen);N=D.vertexNormals;y=0;for(P=N.length;y<P;y++)V=j.vertexNormalsWorld[y],V.copy(N[y]),C.multiplyVector3(V);y=0;for(P=ka.length;y<P;y++)if($=ka[y][R]){N=0;for(V=$.length;N<V;N++)j.uvs[y][N]=$[N]}j.material=z;j.faceMaterial=D.materialIndex!==null?A[D.materialIndex]:null;j.z=j.centroidScreen.z;t.elements.push(j)}}else if(G instanceof THREE.Line){u.multiply(x,v);
-R=G.geometry.vertices;y=b();y.positionScreen.copy(R[0].position);u.multiplyVector4(y.positionScreen);I=1;for(D=R.length;I<D;I++)if(y=b(),y.positionScreen.copy(R[I].position),u.multiplyVector4(y.positionScreen),P=n[l-2],B.copy(y.positionScreen),K.copy(P.positionScreen),d(B,K))B.multiplyScalar(1/B.w),K.multiplyScalar(1/K.w),G=H[r]=H[r]||new THREE.RenderableLine,r++,k=G,k.v1.positionScreen.copy(B),k.v2.positionScreen.copy(K),k.z=Math.max(B.z,K.z),k.material=z,t.elements.push(k)}a=0;for(F=t.sprites.length;a<
-F;a++)if(G=t.sprites[a].object,v=G.matrixWorld,G instanceof THREE.Particle&&(w.set(v.n14,v.n24,v.n34,1),x.multiplyVector4(w),w.z/=w.w,w.z>0&&w.z<1))g=M[L]=M[L]||new THREE.RenderableParticle,L++,E=g,E.x=w.x/w.w,E.y=w.y/w.w,E.z=w.z,E.rotation=G.rotation.z,E.scale.x=G.scale.x*Math.abs(E.x-(w.x+e.projectionMatrix.n11)/(w.w+e.projectionMatrix.n14)),E.scale.y=G.scale.y*Math.abs(E.y-(w.y+e.projectionMatrix.n22)/(w.w+e.projectionMatrix.n24)),E.material=G.material,t.elements.push(E);f&&t.elements.sort(c);
-return t}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+i,j,m=[],o,q=[],k,s,H=[],E,M,Q=[],z={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,C=new THREE.Vector4,F=new THREE.Matrix4,u=new THREE.Matrix4,r=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,K=new THREE.Vector4;this.computeFrustum=function(a){r[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);r[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);r[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+a.n23,a.n44+a.n24);r[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);r[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);r[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=r[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);F.multiply(b.projectionMatrix,b.matrixWorldInverse);F.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+F.multiply(b.matrixWorld,b.projectionMatrixInverse);F.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){e=0;z.objects.length=0;z.sprites.length=0;z.lights.length=0;var g=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
+e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=r[h].x*d.n14+r[h].y*d.n24+r[h].z*d.n34+r[h].w,c<=e){c=!1;break a}c=!0}c?(F.multiplyVector3(A.copy(b.position)),f=a(),f.object=b,f.z=A.z,z.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(F.multiplyVector3(A.copy(b.position)),f=a(),f.object=b,f.z=A.z,z.sprites.push(f)):b instanceof THREE.Light&&z.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
+z.objects.sort(c);return z};this.projectScene=function(a,e,f){var g=e.near,r=e.far,U,I,B,R,v,O,L,A,G,t,y,w,x,J,ja,aa;M=s=o=j=0;z.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);F.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(F);z=this.projectGraph(a,!1);a=0;for(U=z.objects.length;a<U;a++)if(G=z.objects[a].object,t=G.matrixWorld,
+w=G.material,l=0,G instanceof THREE.Mesh){y=G.geometry;x=G.geometry.materials;R=y.vertices;J=y.faces;ja=y.faceVertexUvs;y=G.matrixRotationWorld.extractRotation(t);I=0;for(B=R.length;I<B;I++)h=b(),h.positionWorld.copy(R[I].position),t.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),F.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<r;R=0;for(I=J.length;R<I;R++){B=
+J[R];if(B instanceof THREE.Face3)if(v=n[B.a],O=n[B.b],L=n[B.c],v.visible&&O.visible&&L.visible&&(G.doubleSided||G.flipSided!=(L.positionScreen.x-v.positionScreen.x)*(O.positionScreen.y-v.positionScreen.y)-(L.positionScreen.y-v.positionScreen.y)*(O.positionScreen.x-v.positionScreen.x)<0))A=m[j]=m[j]||new THREE.RenderableFace3,j++,i=A,i.v1.copy(v),i.v2.copy(O),i.v3.copy(L);else continue;else if(B instanceof THREE.Face4)if(v=n[B.a],O=n[B.b],L=n[B.c],A=n[B.d],v.visible&&O.visible&&L.visible&&A.visible&&
+(G.doubleSided||G.flipSided!=((A.positionScreen.x-v.positionScreen.x)*(O.positionScreen.y-v.positionScreen.y)-(A.positionScreen.y-v.positionScreen.y)*(O.positionScreen.x-v.positionScreen.x)<0||(O.positionScreen.x-L.positionScreen.x)*(A.positionScreen.y-L.positionScreen.y)-(O.positionScreen.y-L.positionScreen.y)*(A.positionScreen.x-L.positionScreen.x)<0)))aa=q[o]=q[o]||new THREE.RenderableFace4,o++,i=aa,i.v1.copy(v),i.v2.copy(O),i.v3.copy(L),i.v4.copy(A);else continue;i.normalWorld.copy(B.normal);
+y.multiplyVector3(i.normalWorld);i.centroidWorld.copy(B.centroid);t.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);F.multiplyVector3(i.centroidScreen);L=B.vertexNormals;v=0;for(O=L.length;v<O;v++)A=i.vertexNormalsWorld[v],A.copy(L[v]),y.multiplyVector3(A);v=0;for(O=ja.length;v<O;v++)if(aa=ja[v][R]){L=0;for(A=aa.length;L<A;L++)i.uvs[v][L]=aa[L]}i.material=w;i.faceMaterial=B.materialIndex!==null?x[B.materialIndex]:null;i.z=i.centroidScreen.z;z.elements.push(i)}}else if(G instanceof
+THREE.Line){u.multiply(F,t);R=G.geometry.vertices;v=b();v.positionScreen.copy(R[0].position);u.multiplyVector4(v.positionScreen);I=1;for(B=R.length;I<B;I++)if(v=b(),v.positionScreen.copy(R[I].position),u.multiplyVector4(v.positionScreen),O=n[l-2],D.copy(v.positionScreen),K.copy(O.positionScreen),d(D,K))D.multiplyScalar(1/D.w),K.multiplyScalar(1/K.w),G=H[s]=H[s]||new THREE.RenderableLine,s++,k=G,k.v1.positionScreen.copy(D),k.v2.positionScreen.copy(K),k.z=Math.max(D.z,K.z),k.material=w,z.elements.push(k)}a=
+0;for(U=z.sprites.length;a<U;a++)if(G=z.sprites[a].object,t=G.matrixWorld,G instanceof THREE.Particle&&(C.set(t.n14,t.n24,t.n34,1),F.multiplyVector4(C),C.z/=C.w,C.z>0&&C.z<1))g=Q[M]=Q[M]||new THREE.RenderableParticle,M++,E=g,E.x=C.x/C.w,E.y=C.y/C.w,E.z=C.z,E.rotation=G.rotation.z,E.scale.x=G.scale.x*Math.abs(E.x-(C.x+e.projectionMatrix.n11)/(C.w+e.projectionMatrix.n14)),E.scale.y=G.scale.y*Math.abs(E.y-(C.y+e.projectionMatrix.n22)/(C.w+e.projectionMatrix.n24)),E.material=G.material,z.elements.push(E);
+f&&z.elements.sort(c);return z}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),e=Math.cos(c),c=Math.sin(c),g=a*b,h=d*f;this.w=g*e-h*c;this.x=g*c+h*e;this.y=d*b*e+a*f*c;this.z=a*f*e-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();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);a===0?this.w=this.z=this.y=this.x=0:(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,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,n=l*c+g*f-h*d,j=l*d+h*c-e*f,i=l*f+e*d-g*c,c=-e*
-c-g*d-h*f;b.x=n*l+c*-e+j*-h-i*-g;b.y=j*l+c*-g+i*-e-n*-h;b.z=i*l+c*-h+n*-g-j*-e;return b}};
+this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,n=l*c+g*f-h*d,i=l*d+h*c-e*f,j=l*f+e*d-g*c,c=-e*
+c-g*d-h*f;b.x=n*l+c*-e+i*-h-j*-g;b.y=i*l+c*-g+j*-e-n*-h;b.z=j*l+c*-h+n*-g-i*-e;return b}};
 THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return 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),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
@@ -82,9 +82,9 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 c,d,f,e,g,h=new THREE.Vector3,l=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)h.addSelf(e.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],h.sub(g.position,c.position),l.sub(b.position,c.position),h.crossSelf(l);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=
 Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
 THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),
-c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,b,c,d,e,f,x){h=a.vertices[b].position;l=a.vertices[c].position;n=a.vertices[d].position;j=g[e];i=g[f];p=g[x];o=l.x-h.x;m=n.x-h.x;k=l.y-h.y;r=n.y-h.y;H=l.z-h.z;E=n.z-h.z;L=i.u-j.u;M=p.u-j.u;t=i.v-j.v;F=p.v-j.v;w=1/(L*F-M*t);B.set((F*o-t*m)*w,(F*k-t*r)*w,(F*H-t*E)*w);K.set((L*m-M*o)*w,(L*r-M*k)*w,(L*E-M*H)*w);u[b].addSelf(B);u[c].addSelf(B);u[d].addSelf(B);s[b].addSelf(K);
-s[c].addSelf(K);s[d].addSelf(K)}var b,c,d,f,e,g,h,l,n,j,i,p,o,m,k,r,H,E,L,M,t,F,w,x,u=[],s=[],B=new THREE.Vector3,K=new THREE.Vector3,aa=new THREE.Vector3,ea=new THREE.Vector3,O=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)u[b]=new THREE.Vector3,s[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):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));var Q=["a",
-"b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)O.copy(e.vertexNormals[d]),f=e[Q[d]],x=u[f],aa.copy(x),aa.subSelf(O.multiplyScalar(O.dot(x))).normalize(),ea.cross(e.vertexNormals[d],x),f=ea.dot(s[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(aa.x,aa.y,aa.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
+c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,b,c,d,e,f,F){h=a.vertices[b].position;l=a.vertices[c].position;n=a.vertices[d].position;i=g[e];j=g[f];m=g[F];o=l.x-h.x;q=n.x-h.x;k=l.y-h.y;s=n.y-h.y;H=l.z-h.z;E=n.z-h.z;M=j.u-i.u;Q=m.u-i.u;z=j.v-i.v;A=m.v-i.v;C=1/(M*A-Q*z);D.set((A*o-z*q)*C,(A*k-z*s)*C,(A*H-z*E)*C);K.set((M*q-Q*o)*C,(M*s-Q*k)*C,(M*E-Q*H)*C);u[b].addSelf(D);u[c].addSelf(D);u[d].addSelf(D);r[b].addSelf(K);
+r[c].addSelf(K);r[d].addSelf(K)}var b,c,d,f,e,g,h,l,n,i,j,m,o,q,k,s,H,E,M,Q,z,A,C,F,u=[],r=[],D=new THREE.Vector3,K=new THREE.Vector3,W=new THREE.Vector3,Y=new THREE.Vector3,N=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)u[b]=new THREE.Vector3,r[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):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));var P=["a","b",
+"c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)N.copy(e.vertexNormals[d]),f=e[P[d]],F=u[f],W.copy(F),W.subSelf(N.multiplyScalar(N.dot(F))).normalize(),Y.cross(e.vertexNormals[d],F),f=Y.dot(r[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(W.x,W.y,W.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g;e=0;for(g=this.vertices.length;e<g;e++)d=this.vertices[e].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=e,b.push(this.vertices[e]),
 c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
@@ -128,33 +128,33 @@ THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.ce
 THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.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);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
-THREE.CanvasRenderer=function(a){function b(a){if(E!=a)k.globalAlpha=E=a}function c(a){if(L!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}L=a}}function d(a){if(M!=a)k.strokeStyle=M=a}function f(a){if(t!=a)k.fillStyle=t=a}var e=this,g,h,l,n=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-i,p,o,m,k=j.getContext("2d"),r=new THREE.Color(0),H=0,E=1,L=0,M=null,t=null,F=null,w=null,x=null,u,s,B,K,aa=new THREE.RenderableVertex,ea=new THREE.RenderableVertex,O,Q,T,X,I,D,R,y,P,N,V,G,v=new THREE.Color,C=new THREE.Color,z=new THREE.Color,A=new THREE.Color,J=new THREE.Color,ka=[],$,ga,fa,ba,Aa,Ba,Ca,Da,Ea,Fa,la=new THREE.Rectangle,Y=new THREE.Rectangle,W=new THREE.Rectangle,xa=!1,Z=new THREE.Color,sa=new THREE.Color,ta=new THREE.Color,S=new THREE.Vector3,pa,qa,ya,ca,ra,ua,a=16;pa=document.createElement("canvas");
-pa.width=pa.height=2;qa=pa.getContext("2d");qa.fillStyle="rgba(0,0,0,1)";qa.fillRect(0,0,2,2);ya=qa.getImageData(0,0,2,2);ca=ya.data;ra=document.createElement("canvas");ra.width=ra.height=a;ua=ra.getContext("2d");ua.translate(-a/2,-a/2);ua.scale(a,a);a--;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){i=a;p=b;o=Math.floor(i/2);m=Math.floor(p/2);j.width=i;j.height=p;la.set(-o,-m,o,m);Y.set(-o,-m,o,m);E=1;L=0;
-x=w=F=t=M=null};this.setClearColor=function(a,b){r.copy(a);H=b;Y.set(-o,-m,o,m)};this.setClearColorHex=function(a,b){r.setHex(a);H=b;Y.set(-o,-m,o,m)};this.clear=function(){k.setTransform(1,0,0,-1,o,m);Y.isEmpty()||(Y.minSelf(la),Y.inflate(2),H<1&&k.clearRect(Math.floor(Y.getX()),Math.floor(Y.getY()),Math.floor(Y.getWidth()),Math.floor(Y.getHeight())),H>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*255)+","+H+")"),k.fillRect(Math.floor(Y.getX()),
-Math.floor(Y.getY()),Math.floor(Y.getWidth()),Math.floor(Y.getHeight()))),Y.empty())};this.render=function(a,j){function i(a){var b,c,d,e;Z.setRGB(0,0,0);sa.setRGB(0,0,0);ta.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(Z.r+=e.r,Z.g+=e.g,Z.b+=e.b):d instanceof THREE.DirectionalLight?(sa.r+=e.r,sa.g+=e.g,sa.b+=e.b):d instanceof THREE.PointLight&&(ta.r+=e.r,ta.g+=e.g,ta.b+=e.b)}function p(a,b,c,d){var e,f,g,h,j,k;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,
-g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),k=c.dot(j),k<=0||(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),k=c.dot(S.sub(j,b).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(b.distanceTo(j)/g.distance,1),k!=0&&(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)))}function r(a,e,g){b(g.opacity);c(g.blending);var h,j,l,i,q,n;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)i=g.map.image,q=i.width>>1,n=i.height>>
-1,g=e.scale.x*o,l=e.scale.y*m,h=g*q,j=l*n,W.set(a.x-h,a.y-j,a.x+h,a.y+j),la.intersects(W)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-l),k.translate(-q,-n),k.drawImage(i,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*o,j=e.scale.y*m,W.set(a.x-h,a.y-j,a.x+h,a.y+j),la.intersects(W)&&(d(g.color.getContextStyle()),f(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(h,j),g.program(k),k.restore()))}function t(a,e,
-f,g){b(g.opacity);c(g.blending);k.beginPath();k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(F!=a)k.lineWidth=F=a;a=g.linecap;if(w!=a)k.lineCap=w=a;a=g.linejoin;if(x!=a)k.lineJoin=x=a;d(g.color.getContextStyle());k.stroke();W.inflate(g.linewidth*2)}}function E(a,d,f,g,h,k,i,q){e.info.render.vertices+=3;e.info.render.faces++;b(q.opacity);c(q.blending);O=a.positionScreen.x;Q=a.positionScreen.y;
-T=d.positionScreen.x;X=d.positionScreen.y;I=f.positionScreen.x;D=f.positionScreen.y;H(O,Q,T,X,I,D);if(q instanceof THREE.MeshBasicMaterial)if(q.map)q.map.mapping instanceof THREE.UVMapping&&(ba=i.uvs[0],za(O,Q,T,X,I,D,ba[g].u,ba[g].v,ba[h].u,ba[h].v,ba[k].u,ba[k].v,q.map));else if(q.envMap){if(q.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,S.copy(i.vertexNormalsWorld[g]),Aa=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ba=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(i.vertexNormalsWorld[h]),
-Ca=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Da=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(i.vertexNormalsWorld[k]),Ea=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Fa=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,za(O,Q,T,X,I,D,Aa,Ba,Ca,Da,Ea,Fa,q.envMap)}else q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)q.map&&!q.wireframe&&(q.map.mapping instanceof THREE.UVMapping&&(ba=i.uvs[0],za(O,Q,T,X,I,D,ba[g].u,ba[g].v,
-ba[h].u,ba[h].v,ba[k].u,ba[k].v,q.map)),c(THREE.SubtractiveBlending)),xa?!q.wireframe&&q.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(C.r=z.r=A.r=Z.r,C.g=z.g=A.g=Z.g,C.b=z.b=A.b=Z.b,p(l,i.v1.positionWorld,i.vertexNormalsWorld[0],C),p(l,i.v2.positionWorld,i.vertexNormalsWorld[1],z),p(l,i.v3.positionWorld,i.vertexNormalsWorld[2],A),C.r=Math.max(0,Math.min(q.color.r*C.r,1)),C.g=Math.max(0,Math.min(q.color.g*C.g,1)),C.b=Math.max(0,Math.min(q.color.b*C.b,1)),z.r=Math.max(0,Math.min(q.color.r*
-z.r,1)),z.g=Math.max(0,Math.min(q.color.g*z.g,1)),z.b=Math.max(0,Math.min(q.color.b*z.b,1)),A.r=Math.max(0,Math.min(q.color.r*A.r,1)),A.g=Math.max(0,Math.min(q.color.g*A.g,1)),A.b=Math.max(0,Math.min(q.color.b*A.b,1)),J.r=(z.r+A.r)*0.5,J.g=(z.g+A.g)*0.5,J.b=(z.b+A.b)*0.5,fa=va(C,z,A,J),na(O,Q,T,X,I,D,0,0,1,0,0,1,fa)):(v.r=Z.r,v.g=Z.g,v.b=Z.b,p(l,i.centroidWorld,i.normalWorld,v),v.r=Math.max(0,Math.min(q.color.r*v.r,1)),v.g=Math.max(0,Math.min(q.color.g*v.g,1)),v.b=Math.max(0,Math.min(q.color.b*v.b,
-1)),q.wireframe?ha(v,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(v)):q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshDepthMaterial)$=j.near,ga=j.far,C.r=C.g=C.b=1-ma(a.positionScreen.z,$,ga),z.r=z.g=z.b=1-ma(d.positionScreen.z,$,ga),A.r=A.g=A.b=1-ma(f.positionScreen.z,$,ga),J.r=(z.r+A.r)*0.5,J.g=(z.g+A.g)*0.5,J.b=(z.b+A.b)*0.5,fa=va(C,z,A,J),na(O,Q,T,X,I,D,0,0,1,0,0,1,fa);else if(q instanceof THREE.MeshNormalMaterial)v.r=
-oa(i.normalWorld.x),v.g=oa(i.normalWorld.y),v.b=oa(i.normalWorld.z),q.wireframe?ha(v,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(v)}function L(a,d,f,g,h,k,i,q,n){e.info.render.vertices+=4;e.info.render.faces++;b(q.opacity);c(q.blending);if(q.map||q.envMap)E(a,d,g,0,1,3,i,q,n),E(h,f,k,1,2,3,i,q,n);else if(O=a.positionScreen.x,Q=a.positionScreen.y,T=d.positionScreen.x,X=d.positionScreen.y,I=f.positionScreen.x,D=f.positionScreen.y,R=g.positionScreen.x,y=g.positionScreen.y,P=h.positionScreen.x,
-N=h.positionScreen.y,V=k.positionScreen.x,G=k.positionScreen.y,q instanceof THREE.MeshBasicMaterial)M(O,Q,T,X,I,D,R,y),q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)xa?!q.wireframe&&q.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(C.r=z.r=A.r=J.r=Z.r,C.g=z.g=A.g=J.g=Z.g,C.b=z.b=A.b=J.b=Z.b,p(l,i.v1.positionWorld,i.vertexNormalsWorld[0],C),p(l,i.v2.positionWorld,i.vertexNormalsWorld[1],z),
-p(l,i.v4.positionWorld,i.vertexNormalsWorld[3],A),p(l,i.v3.positionWorld,i.vertexNormalsWorld[2],J),C.r=Math.max(0,Math.min(q.color.r*C.r,1)),C.g=Math.max(0,Math.min(q.color.g*C.g,1)),C.b=Math.max(0,Math.min(q.color.b*C.b,1)),z.r=Math.max(0,Math.min(q.color.r*z.r,1)),z.g=Math.max(0,Math.min(q.color.g*z.g,1)),z.b=Math.max(0,Math.min(q.color.b*z.b,1)),A.r=Math.max(0,Math.min(q.color.r*A.r,1)),A.g=Math.max(0,Math.min(q.color.g*A.g,1)),A.b=Math.max(0,Math.min(q.color.b*A.b,1)),J.r=Math.max(0,Math.min(q.color.r*
-J.r,1)),J.g=Math.max(0,Math.min(q.color.g*J.g,1)),J.b=Math.max(0,Math.min(q.color.b*J.b,1)),fa=va(C,z,A,J),H(O,Q,T,X,R,y),na(O,Q,T,X,R,y,0,0,1,0,0,1,fa),H(P,N,I,D,V,G),na(P,N,I,D,V,G,1,0,1,1,0,1,fa)):(v.r=Z.r,v.g=Z.g,v.b=Z.b,p(l,i.centroidWorld,i.normalWorld,v),v.r=Math.max(0,Math.min(q.color.r*v.r,1)),v.g=Math.max(0,Math.min(q.color.g*v.g,1)),v.b=Math.max(0,Math.min(q.color.b*v.b,1)),M(O,Q,T,X,I,D,R,y),q.wireframe?ha(v,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(v)):(M(O,Q,T,
-X,I,D,R,y),q.wireframe?ha(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color));else if(q instanceof THREE.MeshNormalMaterial)v.r=oa(i.normalWorld.x),v.g=oa(i.normalWorld.y),v.b=oa(i.normalWorld.z),M(O,Q,T,X,I,D,R,y),q.wireframe?ha(v,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(v);else if(q instanceof THREE.MeshDepthMaterial)$=j.near,ga=j.far,C.r=C.g=C.b=1-ma(a.positionScreen.z,$,ga),z.r=z.g=z.b=1-ma(d.positionScreen.z,$,ga),A.r=A.g=A.b=1-ma(g.positionScreen.z,
-$,ga),J.r=J.g=J.b=1-ma(f.positionScreen.z,$,ga),fa=va(C,z,A,J),H(O,Q,T,X,R,y),na(O,Q,T,X,R,y,0,0,1,0,0,1,fa),H(P,N,I,D,V,G),na(P,N,I,D,V,G,1,0,1,1,0,1,fa)}function H(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function M(a,b,c,d,e,f,g,h){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function ha(a,b,c,e){if(F!=b)k.lineWidth=F=b;if(w!=c)k.lineCap=w=c;if(x!=e)k.lineJoin=x=e;d(a.getContextStyle());
-k.stroke();W.inflate(b*2)}function ia(a){f(a.getContextStyle());k.fill()}function za(a,b,c,d,e,g,h,j,i,l,n,o,m){if(m.image.width!=0){if(m.needsUpdate==!0||ka[m.id]==void 0){var p=m.wrapS==THREE.RepeatWrapping,r=m.wrapT==THREE.RepeatWrapping;ka[m.id]=k.createPattern(m.image,p&&r?"repeat":p&&!r?"repeat-x":!p&&r?"repeat-y":"no-repeat");m.needsUpdate=!1}f(ka[m.id]);var p=m.offset.x/m.repeat.x,r=m.offset.y/m.repeat.y,s=(m.image.width-1)*m.repeat.x,m=(m.image.height-1)*m.repeat.y,h=(h+p)*s,j=(j+r)*m,i=
-(i+p)*s,l=(l+r)*m,n=(n+p)*s,o=(o+r)*m;c-=a;d-=b;e-=a;g-=b;i-=h;l-=j;n-=h;o-=j;p=1/(i*o-n*l);m=(o*c-l*e)*p;l=(o*d-l*g)*p;c=(i*e-n*c)*p;d=(i*g-n*d)*p;a=a-m*h-c*j;b=b-l*h-d*j;k.save();k.transform(m,l,c,d,a,b);k.fill();k.restore()}}function na(a,b,c,d,e,f,g,h,j,i,l,m,n){var o,p;o=n.width-1;p=n.height-1;g*=o;h*=p;j*=o;i*=p;l*=o;m*=p;c-=a;d-=b;e-=a;f-=b;j-=g;i-=h;l-=g;m-=h;p=1/(j*m-l*i);o=(m*c-i*e)*p;i=(m*d-i*f)*p;c=(j*e-l*c)*p;d=(j*f-l*d)*p;a=a-o*g-c*h;b=b-i*g-d*h;k.save();k.transform(o,i,c,d,a,b);k.clip();
+THREE.CanvasRenderer=function(a){function b(a){if(E!=a)k.globalAlpha=E=a}function c(a){if(M!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}M=a}}function d(a){if(Q!=a)k.strokeStyle=Q=a}function f(a){if(z!=a)k.fillStyle=z=a}var e=this,g,h,l,n=new THREE.Projector,a=a||{},i=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+j,m,o,q,k=i.getContext("2d"),s=new THREE.Color(0),H=0,E=1,M=0,Q=null,z=null,A=null,C=null,F=null,u,r,D,K,W=new THREE.RenderableVertex,Y=new THREE.RenderableVertex,N,P,T,U,I,B,R,v,O,L,oa,G,t=new THREE.Color,y=new THREE.Color,w=new THREE.Color,x=new THREE.Color,J=new THREE.Color,ja=[],aa,fa,ea,ba,Aa,Ba,Ca,Da,Ea,Fa,ka=new THREE.Rectangle,Z=new THREE.Rectangle,X=new THREE.Rectangle,xa=!1,$=new THREE.Color,sa=new THREE.Color,ta=new THREE.Color,S=new THREE.Vector3,pa,qa,ya,ca,ra,ua,a=16;pa=document.createElement("canvas");
+pa.width=pa.height=2;qa=pa.getContext("2d");qa.fillStyle="rgba(0,0,0,1)";qa.fillRect(0,0,2,2);ya=qa.getImageData(0,0,2,2);ca=ya.data;ra=document.createElement("canvas");ra.width=ra.height=a;ua=ra.getContext("2d");ua.translate(-a/2,-a/2);ua.scale(a,a);a--;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){j=a;m=b;o=Math.floor(j/2);q=Math.floor(m/2);i.width=j;i.height=m;ka.set(-o,-q,o,q);Z.set(-o,-q,o,q);E=1;M=0;
+F=C=A=z=Q=null};this.setClearColor=function(a,b){s.copy(a);H=b;Z.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){s.setHex(a);H=b;Z.set(-o,-q,o,q)};this.clear=function(){k.setTransform(1,0,0,-1,o,q);Z.isEmpty()||(Z.minSelf(ka),Z.inflate(2),H<1&&k.clearRect(Math.floor(Z.getX()),Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight())),H>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+H+")"),k.fillRect(Math.floor(Z.getX()),
+Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight()))),Z.empty())};this.render=function(a,i){function j(a){var b,c,d,e;$.setRGB(0,0,0);sa.setRGB(0,0,0);ta.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?($.r+=e.r,$.g+=e.g,$.b+=e.b):d instanceof THREE.DirectionalLight?(sa.r+=e.r,sa.g+=e.g,sa.b+=e.b):d instanceof THREE.PointLight&&(ta.r+=e.r,ta.g+=e.g,ta.b+=e.b)}function m(a,b,c,d){var e,f,g,h,i,k;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,
+g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),k=c.dot(i),k<=0||(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),k=c.dot(S.sub(i,b).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,1),k!=0&&(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)))}function s(a,e,g){b(g.opacity);c(g.blending);var h,i,l,j,p,n;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)j=g.map.image,p=j.width>>1,n=j.height>>
+1,g=e.scale.x*o,l=e.scale.y*q,h=g*p,i=l*n,X.set(a.x-h,a.y-i,a.x+h,a.y+i),ka.intersects(X)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-l),k.translate(-p,-n),k.drawImage(j,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*o,i=e.scale.y*q,X.set(a.x-h,a.y-i,a.x+h,a.y+i),ka.intersects(X)&&(d(g.color.getContextStyle()),f(g.color.getContextStyle()),k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(h,i),g.program(k),k.restore()))}function z(a,e,
+f,g){b(g.opacity);c(g.blending);k.beginPath();k.moveTo(a.positionScreen.x,a.positionScreen.y);k.lineTo(e.positionScreen.x,e.positionScreen.y);k.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(A!=a)k.lineWidth=A=a;a=g.linecap;if(C!=a)k.lineCap=C=a;a=g.linejoin;if(F!=a)k.lineJoin=F=a;d(g.color.getContextStyle());k.stroke();X.inflate(g.linewidth*2)}}function E(a,d,f,g,h,k,j,p){e.info.render.vertices+=3;e.info.render.faces++;b(p.opacity);c(p.blending);N=a.positionScreen.x;P=a.positionScreen.y;
+T=d.positionScreen.x;U=d.positionScreen.y;I=f.positionScreen.x;B=f.positionScreen.y;H(N,P,T,U,I,B);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ba=j.uvs[0],za(N,P,T,U,I,B,ba[g].u,ba[g].v,ba[h].u,ba[h].v,ba[k].u,ba[k].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=i.matrixWorldInverse,S.copy(j.vertexNormalsWorld[g]),Aa=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ba=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(j.vertexNormalsWorld[h]),
+Ca=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Da=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(j.vertexNormalsWorld[k]),Ea=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Fa=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,za(N,P,T,U,I,B,Aa,Ba,Ca,Da,Ea,Fa,p.envMap)}else p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(ba=j.uvs[0],za(N,P,T,U,I,B,ba[g].u,ba[g].v,
+ba[h].u,ba[h].v,ba[k].u,ba[k].v,p.map)),c(THREE.SubtractiveBlending)),xa?!p.wireframe&&p.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==3?(y.r=w.r=x.r=$.r,y.g=w.g=x.g=$.g,y.b=w.b=x.b=$.b,m(l,j.v1.positionWorld,j.vertexNormalsWorld[0],y),m(l,j.v2.positionWorld,j.vertexNormalsWorld[1],w),m(l,j.v3.positionWorld,j.vertexNormalsWorld[2],x),y.r=Math.max(0,Math.min(p.color.r*y.r,1)),y.g=Math.max(0,Math.min(p.color.g*y.g,1)),y.b=Math.max(0,Math.min(p.color.b*y.b,1)),w.r=Math.max(0,Math.min(p.color.r*
+w.r,1)),w.g=Math.max(0,Math.min(p.color.g*w.g,1)),w.b=Math.max(0,Math.min(p.color.b*w.b,1)),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),J.r=(w.r+x.r)*0.5,J.g=(w.g+x.g)*0.5,J.b=(w.b+x.b)*0.5,ea=va(y,w,x,J),ma(N,P,T,U,I,B,0,0,1,0,0,1,ea)):(t.r=$.r,t.g=$.g,t.b=$.b,m(l,j.centroidWorld,j.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,
+1)),p.wireframe?ga(t,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(t)):p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshDepthMaterial)aa=i.near,fa=i.far,y.r=y.g=y.b=1-la(a.positionScreen.z,aa,fa),w.r=w.g=w.b=1-la(d.positionScreen.z,aa,fa),x.r=x.g=x.b=1-la(f.positionScreen.z,aa,fa),J.r=(w.r+x.r)*0.5,J.g=(w.g+x.g)*0.5,J.b=(w.b+x.b)*0.5,ea=va(y,w,x,J),ma(N,P,T,U,I,B,0,0,1,0,0,1,ea);else if(p instanceof THREE.MeshNormalMaterial)t.r=
+na(j.normalWorld.x),t.g=na(j.normalWorld.y),t.b=na(j.normalWorld.z),p.wireframe?ga(t,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(t)}function M(a,d,f,g,h,k,j,p,n){e.info.render.vertices+=4;e.info.render.faces++;b(p.opacity);c(p.blending);if(p.map||p.envMap)E(a,d,g,0,1,3,j,p,n),E(h,f,k,1,2,3,j,p,n);else if(N=a.positionScreen.x,P=a.positionScreen.y,T=d.positionScreen.x,U=d.positionScreen.y,I=f.positionScreen.x,B=f.positionScreen.y,R=g.positionScreen.x,v=g.positionScreen.y,O=h.positionScreen.x,
+L=h.positionScreen.y,oa=k.positionScreen.x,G=k.positionScreen.y,p instanceof THREE.MeshBasicMaterial)Q(N,P,T,U,I,B,R,v),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)xa?!p.wireframe&&p.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==4?(y.r=w.r=x.r=J.r=$.r,y.g=w.g=x.g=J.g=$.g,y.b=w.b=x.b=J.b=$.b,m(l,j.v1.positionWorld,j.vertexNormalsWorld[0],y),m(l,j.v2.positionWorld,j.vertexNormalsWorld[1],
+w),m(l,j.v4.positionWorld,j.vertexNormalsWorld[3],x),m(l,j.v3.positionWorld,j.vertexNormalsWorld[2],J),y.r=Math.max(0,Math.min(p.color.r*y.r,1)),y.g=Math.max(0,Math.min(p.color.g*y.g,1)),y.b=Math.max(0,Math.min(p.color.b*y.b,1)),w.r=Math.max(0,Math.min(p.color.r*w.r,1)),w.g=Math.max(0,Math.min(p.color.g*w.g,1)),w.b=Math.max(0,Math.min(p.color.b*w.b,1)),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),J.r=Math.max(0,Math.min(p.color.r*
+J.r,1)),J.g=Math.max(0,Math.min(p.color.g*J.g,1)),J.b=Math.max(0,Math.min(p.color.b*J.b,1)),ea=va(y,w,x,J),H(N,P,T,U,R,v),ma(N,P,T,U,R,v,0,0,1,0,0,1,ea),H(O,L,I,B,oa,G),ma(O,L,I,B,oa,G,1,0,1,1,0,1,ea)):(t.r=$.r,t.g=$.g,t.b=$.b,m(l,j.centroidWorld,j.normalWorld,t),t.r=Math.max(0,Math.min(p.color.r*t.r,1)),t.g=Math.max(0,Math.min(p.color.g*t.g,1)),t.b=Math.max(0,Math.min(p.color.b*t.b,1)),Q(N,P,T,U,I,B,R,v),p.wireframe?ga(t,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(t)):(Q(N,P,
+T,U,I,B,R,v),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color));else if(p instanceof THREE.MeshNormalMaterial)t.r=na(j.normalWorld.x),t.g=na(j.normalWorld.y),t.b=na(j.normalWorld.z),Q(N,P,T,U,I,B,R,v),p.wireframe?ga(t,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(t);else if(p instanceof THREE.MeshDepthMaterial)aa=i.near,fa=i.far,y.r=y.g=y.b=1-la(a.positionScreen.z,aa,fa),w.r=w.g=w.b=1-la(d.positionScreen.z,aa,fa),x.r=x.g=x.b=1-la(g.positionScreen.z,
+aa,fa),J.r=J.g=J.b=1-la(f.positionScreen.z,aa,fa),ea=va(y,w,x,J),H(N,P,T,U,R,v),ma(N,P,T,U,R,v,0,0,1,0,0,1,ea),H(O,L,I,B,oa,G),ma(O,L,I,B,oa,G,1,0,1,1,0,1,ea)}function H(a,b,c,d,e,f){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(a,b);k.closePath()}function Q(a,b,c,d,e,f,g,h){k.beginPath();k.moveTo(a,b);k.lineTo(c,d);k.lineTo(e,f);k.lineTo(g,h);k.lineTo(a,b);k.closePath()}function ga(a,b,c,e){if(A!=b)k.lineWidth=A=b;if(C!=c)k.lineCap=C=c;if(F!=e)k.lineJoin=F=e;d(a.getContextStyle());
+k.stroke();X.inflate(b*2)}function ha(a){f(a.getContextStyle());k.fill()}function za(a,b,c,d,e,g,h,i,j,l,n,o,m){if(m.image.width!=0){if(m.needsUpdate==!0||ja[m.id]==void 0){var q=m.wrapS==THREE.RepeatWrapping,r=m.wrapT==THREE.RepeatWrapping;ja[m.id]=k.createPattern(m.image,q&&r?"repeat":q&&!r?"repeat-x":!q&&r?"repeat-y":"no-repeat");m.needsUpdate=!1}f(ja[m.id]);var q=m.offset.x/m.repeat.x,r=m.offset.y/m.repeat.y,s=(m.image.width-1)*m.repeat.x,m=(m.image.height-1)*m.repeat.y,h=(h+q)*s,i=(i+r)*m,j=
+(j+q)*s,l=(l+r)*m,n=(n+q)*s,o=(o+r)*m;c-=a;d-=b;e-=a;g-=b;j-=h;l-=i;n-=h;o-=i;q=1/(j*o-n*l);m=(o*c-l*e)*q;l=(o*d-l*g)*q;c=(j*e-n*c)*q;d=(j*g-n*d)*q;a=a-m*h-c*i;b=b-l*h-d*i;k.save();k.transform(m,l,c,d,a,b);k.fill();k.restore()}}function ma(a,b,c,d,e,f,g,h,i,j,l,m,n){var o,q;o=n.width-1;q=n.height-1;g*=o;h*=q;i*=o;j*=q;l*=o;m*=q;c-=a;d-=b;e-=a;f-=b;i-=g;j-=h;l-=g;m-=h;q=1/(i*m-l*j);o=(m*c-j*e)*q;j=(m*d-j*f)*q;c=(i*e-l*c)*q;d=(i*f-l*d)*q;a=a-o*g-c*h;b=b-j*g-d*h;k.save();k.transform(o,j,c,d,a,b);k.clip();
 k.drawImage(n,0,0);k.restore()}function va(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ca[0]=e<0?0:e>255?255:e;ca[1]=f<0?0:f>255?255:f;ca[2]=a<0?0:a>255?255:a;ca[4]=g<0?0:g>255?255:g;ca[5]=h<0?0:h>255?255:h;ca[6]=b<0?0:b>255?255:b;ca[8]=i<0?0:i>255?255:i;ca[9]=j<0?0:j>255?255:j;ca[10]=c<0?0:c>255?255:c;ca[12]=k<0?0:k>255?255:k;ca[13]=l<0?0:l>255?255:l;ca[14]=d<0?
-0:d>255?255:d;qa.putImageData(ya,0,0);ua.drawImage(pa,0,0);return ra}function ma(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function oa(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ja(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var wa,Ga,U,da;this.autoClear?this.clear():k.setTransform(1,0,0,-1,o,m);e.info.render.vertices=0;e.info.render.faces=0;g=n.projectScene(a,j,this.sortElements);h=g.elements;l=g.lights;(xa=l.length>0)&&i(l);wa=0;for(Ga=h.length;wa<
-Ga;wa++)if(U=h[wa],da=U.material,da=da instanceof THREE.MeshFaceMaterial?U.faceMaterial:da,!(da==null||da.opacity==0)){W.empty();if(U instanceof THREE.RenderableParticle)u=U,u.x*=o,u.y*=m,r(u,U,da,a);else if(U instanceof THREE.RenderableLine)u=U.v1,s=U.v2,u.positionScreen.x*=o,u.positionScreen.y*=m,s.positionScreen.x*=o,s.positionScreen.y*=m,W.addPoint(u.positionScreen.x,u.positionScreen.y),W.addPoint(s.positionScreen.x,s.positionScreen.y),la.intersects(W)&&t(u,s,U,da,a);else if(U instanceof THREE.RenderableFace3)u=
-U.v1,s=U.v2,B=U.v3,u.positionScreen.x*=o,u.positionScreen.y*=m,s.positionScreen.x*=o,s.positionScreen.y*=m,B.positionScreen.x*=o,B.positionScreen.y*=m,da.overdraw&&(ja(u.positionScreen,s.positionScreen),ja(s.positionScreen,B.positionScreen),ja(B.positionScreen,u.positionScreen)),W.add3Points(u.positionScreen.x,u.positionScreen.y,s.positionScreen.x,s.positionScreen.y,B.positionScreen.x,B.positionScreen.y),la.intersects(W)&&E(u,s,B,0,1,2,U,da,a);else if(U instanceof THREE.RenderableFace4)u=U.v1,s=U.v2,
-B=U.v3,K=U.v4,u.positionScreen.x*=o,u.positionScreen.y*=m,s.positionScreen.x*=o,s.positionScreen.y*=m,B.positionScreen.x*=o,B.positionScreen.y*=m,K.positionScreen.x*=o,K.positionScreen.y*=m,aa.positionScreen.copy(s.positionScreen),ea.positionScreen.copy(K.positionScreen),da.overdraw&&(ja(u.positionScreen,s.positionScreen),ja(s.positionScreen,K.positionScreen),ja(K.positionScreen,u.positionScreen),ja(B.positionScreen,aa.positionScreen),ja(B.positionScreen,ea.positionScreen)),W.addPoint(u.positionScreen.x,
-u.positionScreen.y),W.addPoint(s.positionScreen.x,s.positionScreen.y),W.addPoint(B.positionScreen.x,B.positionScreen.y),W.addPoint(K.positionScreen.x,K.positionScreen.y),la.intersects(W)&&L(u,s,B,K,aa,ea,U,da,a);Y.addRectangle(W)}k.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
+0:d>255?255:d;qa.putImageData(ya,0,0);ua.drawImage(pa,0,0);return ra}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ia(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var wa,Ga,V,da;this.autoClear?this.clear():k.setTransform(1,0,0,-1,o,q);e.info.render.vertices=0;e.info.render.faces=0;g=n.projectScene(a,i,this.sortElements);h=g.elements;l=g.lights;(xa=l.length>0)&&j(l);wa=0;for(Ga=h.length;wa<
+Ga;wa++)if(V=h[wa],da=V.material,da=da instanceof THREE.MeshFaceMaterial?V.faceMaterial:da,!(da==null||da.opacity==0)){X.empty();if(V instanceof THREE.RenderableParticle)u=V,u.x*=o,u.y*=q,s(u,V,da,a);else if(V instanceof THREE.RenderableLine)u=V.v1,r=V.v2,u.positionScreen.x*=o,u.positionScreen.y*=q,r.positionScreen.x*=o,r.positionScreen.y*=q,X.addPoint(u.positionScreen.x,u.positionScreen.y),X.addPoint(r.positionScreen.x,r.positionScreen.y),ka.intersects(X)&&z(u,r,V,da,a);else if(V instanceof THREE.RenderableFace3)u=
+V.v1,r=V.v2,D=V.v3,u.positionScreen.x*=o,u.positionScreen.y*=q,r.positionScreen.x*=o,r.positionScreen.y*=q,D.positionScreen.x*=o,D.positionScreen.y*=q,da.overdraw&&(ia(u.positionScreen,r.positionScreen),ia(r.positionScreen,D.positionScreen),ia(D.positionScreen,u.positionScreen)),X.add3Points(u.positionScreen.x,u.positionScreen.y,r.positionScreen.x,r.positionScreen.y,D.positionScreen.x,D.positionScreen.y),ka.intersects(X)&&E(u,r,D,0,1,2,V,da,a);else if(V instanceof THREE.RenderableFace4)u=V.v1,r=V.v2,
+D=V.v3,K=V.v4,u.positionScreen.x*=o,u.positionScreen.y*=q,r.positionScreen.x*=o,r.positionScreen.y*=q,D.positionScreen.x*=o,D.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,W.positionScreen.copy(r.positionScreen),Y.positionScreen.copy(K.positionScreen),da.overdraw&&(ia(u.positionScreen,r.positionScreen),ia(r.positionScreen,K.positionScreen),ia(K.positionScreen,u.positionScreen),ia(D.positionScreen,W.positionScreen),ia(D.positionScreen,Y.positionScreen)),X.addPoint(u.positionScreen.x,
+u.positionScreen.y),X.addPoint(r.positionScreen.x,r.positionScreen.y),X.addPoint(D.positionScreen.x,D.positionScreen.y),X.addPoint(K.positionScreen.x,K.positionScreen.y),ka.intersects(X)&&M(u,r,D,K,W,Y,V,da,a);Z.addRectangle(X)}k.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};

+ 40 - 40
build/custom/ThreeDOM.js

@@ -13,65 +13,65 @@ cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y
 Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12/b,a.n11/b)):(this.x=0,this.z=Math.atan2(a.n21,a.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
-normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){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;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,o){d.copy(o).subSelf(b);
-e.copy(c).subSelf(b);f.copy(a).subSelf(b);g=d.dot(d);h=d.dot(e);j=d.dot(f);k=e.dot(e);i=e.dot(f);l=1/(g*k-h*h);n=(k*j-h*i)*l;m=(g*i-h*j)*l;return n>=0&&m>=0&&n+m<1}for(var d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,g,h,j,k,i,l,n,m,o,p=[],q=0,I=a.children.length;q<I;q++)Array.prototype.push.apply(p,this.intersectObject(a.children[q]));if(a instanceof THREE.Particle){q=b(this.origin,this.direction,a.matrixWorld.getPosition());if(q===null||q>a.scale.x)return[];o={distance:q,point:a.position,
-face:null,object:a};p.push(o)}else if(a instanceof THREE.Mesh){q=b(this.origin,this.direction,a.matrixWorld.getPosition());if(q===null||q>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return p;var v,D,J,r,A,u,t,F,w=a.geometry,C=w.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);q=0;for(I=w.faces.length;q<I;q++)if(o=w.faces[q],t=this.origin.clone(),F=this.direction.clone(),r=a.matrixWorld,v=r.multiplyVector3(o.centroid.clone()).subSelf(t),u=v.dot(F),
-!(u<=0)&&(v=r.multiplyVector3(C[o.a].position.clone()),D=r.multiplyVector3(C[o.b].position.clone()),J=r.multiplyVector3(C[o.c].position.clone()),r=o instanceof THREE.Face4?r.multiplyVector3(C[o.d].position.clone()):null,A=a.matrixRotationWorld.multiplyVector3(o.normal.clone()),u=F.dot(A),a.doubleSided||(a.flipSided?u>0:u<0)))if(u=A.dot((new THREE.Vector3).sub(v,t))/u,t=t.addSelf(F.multiplyScalar(u)),o instanceof THREE.Face3)c(t,v,D,J)&&(o={distance:this.origin.distanceTo(t),point:t,face:o,object:a},
-p.push(o));else if(o instanceof THREE.Face4&&(c(t,v,D,r)||c(t,D,J,r)))o={distance:this.origin.distanceTo(t),point:t,face:o,object:a},p.push(o)}return p}};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(j,f,g,l){h=!1;b=j;c=f;d=g;e=l;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
-function(f,g,i,l,n,m){h?(h=!1,b=f<i?f<n?f:n:i<n?i:n,c=g<l?g<m?g:m:l<m?l:m,d=f>i?f>n?f:n:i>n?i:n,e=g>l?g>m?g:m:l>m?l:m):(b=f<i?f<n?f<b?f:b:n<b?n:b:i<n?i<b?i:b:n<b?n:b,c=g<l?g<m?g<c?g:c:m<c?m:c:l<m?l<c?l:c:m<c?m:c,d=f>i?f>n?f>d?f:d:n>d?n:d:i>n?i>d?i:d:n>d?n:d,e=g>l?g>m?g>e?g:e:m>e?m:e:l>m?l>e?l:e:m>e?m:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
-f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
+normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){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;return this}};
+THREE.Ray=function(a,b){function c(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function d(a,b,c,d){j.copy(d).subSelf(b);h.copy(c).subSelf(b);l.copy(a).subSelf(b);n=j.dot(j);m=j.dot(h);p=j.dot(l);o=h.dot(h);q=h.dot(l);F=1/(n*o-m*m);v=(o*p-m*q)*F;D=(n*q-m*p)*F;return v>=0&&D>=0&&v+D<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};
+this.intersectObjects=function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,i=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,k=new THREE.Vector3;this.intersectObject=function(a){for(var b,j=[],h=0,l=a.children.length;h<l;h++)Array.prototype.push.apply(j,this.intersectObject(a.children[h]));if(a instanceof THREE.Particle){h=
+c(this.origin,this.direction,a.matrixWorld.getPosition());if(h===null||h>a.scale.x)return[];b={distance:h,point:a.position,face:null,object:a};j.push(b)}else if(a instanceof THREE.Mesh){h=c(this.origin,this.direction,a.matrixWorld.getPosition());if(h===null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return j;var m,n,o,p,M=a.geometry,J=M.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);h=0;for(l=M.faces.length;h<l;h++)if(b=M.faces[h],o=this.origin.clone(),
+p=this.direction.clone(),n=a.matrixWorld,m=n.multiplyVector3(b.centroid.clone()).subSelf(o),m=m.dot(p),!(m<=0)&&(e=n.multiplyVector3(e.copy(J[b.a].position)),f=n.multiplyVector3(f.copy(J[b.b].position)),g=n.multiplyVector3(g.copy(J[b.c].position)),i=b instanceof THREE.Face4?n.multiplyVector3(i.copy(J[b.d].position)):null,k=a.matrixRotationWorld.multiplyVector3(k.copy(b.normal)),m=p.dot(k),a.doubleSided||(a.flipSided?m>0:m<0)))if(n=k.dot((new THREE.Vector3).sub(e,o))/m,o=o.addSelf(p.multiplyScalar(n)),
+b instanceof THREE.Face3)d(o,e,f,g)&&(b={distance:this.origin.distanceTo(o),point:o,face:b,object:a},j.push(b));else if(b instanceof THREE.Face4&&(d(o,e,f,i)||d(o,f,g,i)))b={distance:this.origin.distanceTo(o),point:o,face:b,object:a},j.push(b)}return j};var j=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,n,m,p,o,q,F,v,D};
+THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(k,f,g,l){i=!1;b=k;c=f;d=g;e=l;a()};this.addPoint=function(f,g){i?(i=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
+function(f,g,h,l,n,m){i?(i=!1,b=f<h?f<n?f:n:h<n?h:n,c=g<l?g<m?g:m:l<m?l:m,d=f>h?f>n?f:n:h>n?h:n,e=g>l?g>m?g:m:l>m?l:m):(b=f<h?f<n?f<b?f:b:n<b?n:b:h<n?h<b?h:b:n<b?n:b,c=g<l?g<m?g<c?g:c:m<c?m:c:l<m?l<c?l:c:m<c?m:c,d=f>h?f>n?f>d?f:d:n>d?n:d:h>n?h>d?h:d:n>d?n:d,e=g>l?g>m?g>e?g:e:m>e?m:e:l>m?l>e?l:e:m>e?m:e);a()};this.addRectangle=function(f){i?(i=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
+f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,e,f,g,h,j,k,i,l,n,m,o,p){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,j||0,k||0,i!==void 0?i:1,l||0,n||0,m||0,o||0,p!==void 0?p:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,j,k,i,l,n,m,o,p){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=j;this.n32=k;this.n33=i;this.n34=l;this.n41=n;this.n42=m;this.n43=o;this.n44=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;d.cross(c,f).normalize();d.length()===0&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,j=a.n23,k=a.n24,i=a.n31,l=a.n32,n=a.n33,m=a.n34,o=a.n41,p=a.n42,q=a.n43,
-I=a.n44,v=b.n11,D=b.n12,J=b.n13,r=b.n14,A=b.n21,u=b.n22,t=b.n23,F=b.n24,w=b.n31,C=b.n32,H=b.n33,O=b.n34,P=b.n41,Q=b.n42,R=b.n43,S=b.n44;this.n11=c*v+d*A+e*w+f*P;this.n12=c*D+d*u+e*C+f*Q;this.n13=c*J+d*t+e*H+f*R;this.n14=c*r+d*F+e*O+f*S;this.n21=g*v+h*A+j*w+k*P;this.n22=g*D+h*u+j*C+k*Q;this.n23=g*J+h*t+j*H+k*R;this.n24=g*r+h*F+j*O+k*S;this.n31=i*v+l*A+n*w+m*P;this.n32=i*D+l*u+n*C+m*Q;this.n33=i*J+l*t+n*H+m*R;this.n34=i*r+l*F+n*O+m*S;this.n41=o*v+p*A+q*w+I*P;this.n42=o*D+p*u+q*C+I*Q;this.n43=o*J+p*
-t+q*H+I*R;this.n44=o*r+p*F+q*O+I*S;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
+THREE.Matrix4=function(a,b,c,d,e,f,g,i,k,j,h,l,n,m,p,o){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,i||0,k||0,j||0,h!==void 0?h:1,l||0,n||0,m||0,p||0,o!==void 0?o:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,i,k,j,h,l,n,m,p,o){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=i;this.n31=k;this.n32=j;this.n33=h;this.n34=l;this.n41=n;this.n42=m;this.n43=p;this.n44=o;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;d.cross(c,f).normalize();d.length()===0&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,k=a.n23,j=a.n24,h=a.n31,l=a.n32,n=a.n33,m=a.n34,p=a.n41,o=a.n42,q=a.n43,
+F=a.n44,v=b.n11,D=b.n12,N=b.n13,s=b.n14,B=b.n21,u=b.n22,A=b.n23,L=b.n24,y=b.n31,G=b.n32,H=b.n33,M=b.n34,J=b.n41,Q=b.n42,R=b.n43,S=b.n44;this.n11=c*v+d*B+e*y+f*J;this.n12=c*D+d*u+e*G+f*Q;this.n13=c*N+d*A+e*H+f*R;this.n14=c*s+d*L+e*M+f*S;this.n21=g*v+i*B+k*y+j*J;this.n22=g*D+i*u+k*G+j*Q;this.n23=g*N+i*A+k*H+j*R;this.n24=g*s+i*L+k*M+j*S;this.n31=h*v+l*B+n*y+m*J;this.n32=h*D+l*u+n*G+m*Q;this.n33=h*N+l*A+n*H+m*R;this.n34=h*s+l*L+n*M+m*S;this.n41=p*v+o*B+q*y+F*J;this.n42=p*D+o*u+q*G+F*Q;this.n43=p*N+o*
+A+q*H+F*R;this.n44=p*s+o*L+q*M+F*S;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},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},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*
 c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,j=this.n31,k=this.n32,i=this.n33,l=this.n34,n=this.n41,m=this.n42,o=this.n43,p=this.n44;return d*g*k*n-c*h*k*n-d*f*i*n+b*h*i*n+c*f*l*n-b*g*l*n-d*g*j*m+c*h*j*m+d*e*i*m-a*h*i*m-c*e*l*m+a*g*l*m+d*f*j*o-b*h*j*o-d*e*k*o+a*h*k*o+b*e*l*o-a*f*l*o-c*f*j*p+b*g*j*p+c*e*k*p-a*g*k*p-b*e*i*p+a*f*i*p},transpose:function(){var a;
+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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,i=this.n24,k=this.n31,j=this.n32,h=this.n33,l=this.n34,n=this.n41,m=this.n42,p=this.n43,o=this.n44;return d*g*j*n-c*i*j*n-d*f*h*n+b*i*h*n+c*f*l*n-b*g*l*n-d*g*k*m+c*i*k*m+d*e*h*m-a*i*h*m-c*e*l*m+a*g*l*m+d*f*k*p-b*i*k*p-d*e*j*p+a*i*j*p+b*e*l*p-a*f*l*p-c*f*k*o+b*g*k*o+c*e*j*o-a*g*j*o-b*e*h*o+a*f*h*o},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,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,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 c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,j=e*f,k=e*g;this.set(j*f+c,j*g-d*h,j*h+d*g,0,j*g+d*h,k*g+c,k*h-d*f,0,j*h-d*g,k*h+d*f,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,j=a.n24,k=a.n31,i=a.n32,l=a.n33,n=a.n34,m=a.n41,o=a.n42,p=a.n43,q=a.n44;this.n11=h*n*o-j*l*o+j*i*p-g*n*p-h*i*q+g*l*q;this.n12=e*l*o-d*n*o-e*i*p+c*n*p+d*i*q-c*l*q;this.n13=d*j*o-e*h*o+e*g*p-c*j*p-d*g*q+c*h*q;this.n14=e*h*i-d*j*i-e*g*l+c*j*l+d*g*n-c*h*n;this.n21=j*l*m-h*n*m-j*k*p+f*n*p+h*k*q-f*l*q;this.n22=d*n*m-e*l*m+
-e*k*p-b*n*p-d*k*q+b*l*q;this.n23=e*h*m-d*j*m-e*f*p+b*j*p+d*f*q-b*h*q;this.n24=d*j*k-e*h*k+e*f*l-b*j*l-d*f*n+b*h*n;this.n31=g*n*m-j*i*m+j*k*o-f*n*o-g*k*q+f*i*q;this.n32=e*i*m-c*n*m-e*k*o+b*n*o+c*k*q-b*i*q;this.n33=d*j*m-e*g*m+e*f*o-b*j*o-c*f*q+b*g*q;this.n34=e*g*k-c*j*k-e*f*i+b*j*i+c*f*n-b*g*n;this.n41=h*i*m-g*l*m-h*k*o+f*l*o+g*k*p-f*i*p;this.n42=c*l*m-d*i*m+d*k*o-b*l*o-c*k*p+b*i*p;this.n43=d*g*m-c*h*m-d*f*o+b*h*o+c*f*p-b*g*p;this.n44=c*h*k-d*g*k+d*f*i-b*h*i-c*f*l+b*g*l;this.multiplyScalar(1/a.determinant());
-return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var j=g*h,k=g*e,i=d*h,l=d*e;this.n11=j+l*c;this.n12=i*c-k;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=k*c-i;this.n32=l+j*c;this.n33=f*g;break;case "ZXY":j=g*h;k=g*e;i=d*h;l=d*e;this.n11=j-l*c;this.n12=-f*e;this.n13=i+k*c;this.n21=k+i*c;this.n22=f*h;this.n23=l-j*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":j=
-f*h;k=f*e;i=c*h;l=c*e;this.n11=g*h;this.n12=i*d-k;this.n13=j*d+l;this.n21=g*e;this.n22=l*d+j;this.n23=k*d-i;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":j=f*g;k=f*d;i=c*g;l=c*d;this.n11=g*h;this.n12=l-j*e;this.n13=i*e+k;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=k*e+i;this.n33=j-l*e;break;case "XZY":j=f*g;k=f*d;i=c*g;l=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=j*e+l;this.n22=f*h;this.n23=k*e-i;this.n31=i*e-k;this.n32=c*h;this.n33=l*e+j;break;default:j=f*h,k=f*
-e,i=c*h,l=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=k+i*d,this.n22=j-l*d,this.n23=-c*g,this.n31=l-j*d,this.n32=i+k*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,j=b*g;b*=h;var k=c*g;c*=h;d*=h;f*=e;g*=e;e*=h;this.n11=1-(k+d);this.n12=j-e;this.n13=b+g;this.n21=j+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+k);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
+setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,i=a.z,k=e*f,j=e*g;this.set(k*f+c,k*g-d*i,k*i+d*g,0,k*g+d*i,j*g+c,j*i-d*f,0,k*i-d*g,j*i+d*f,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,i=a.n23,k=a.n24,j=a.n31,h=a.n32,l=a.n33,n=a.n34,m=a.n41,p=a.n42,o=a.n43,q=a.n44;this.n11=i*n*p-k*l*p+k*h*o-g*n*o-i*h*q+g*l*q;this.n12=e*l*p-d*n*p-e*h*o+c*n*o+d*h*q-c*l*q;this.n13=d*k*p-e*i*p+e*g*o-c*k*o-d*g*q+c*i*q;this.n14=e*i*h-d*k*h-e*g*l+c*k*l+d*g*n-c*i*n;this.n21=k*l*m-i*n*m-k*j*o+f*n*o+i*j*q-f*l*q;this.n22=d*n*m-e*l*m+
+e*j*o-b*n*o-d*j*q+b*l*q;this.n23=e*i*m-d*k*m-e*f*o+b*k*o+d*f*q-b*i*q;this.n24=d*k*j-e*i*j+e*f*l-b*k*l-d*f*n+b*i*n;this.n31=g*n*m-k*h*m+k*j*p-f*n*p-g*j*q+f*h*q;this.n32=e*h*m-c*n*m-e*j*p+b*n*p+c*j*q-b*h*q;this.n33=d*k*m-e*g*m+e*f*p-b*k*p-c*f*q+b*g*q;this.n34=e*g*j-c*k*j-e*f*h+b*k*h+c*f*n-b*g*n;this.n41=i*h*m-g*l*m-i*j*p+f*l*p+g*j*o-f*h*o;this.n42=c*l*m-d*h*m+d*j*p-b*l*p-c*j*o+b*h*o;this.n43=d*g*m-c*i*m-d*f*p+b*i*p+c*f*o-b*g*o;this.n44=c*i*j-d*g*j+d*f*h-b*i*h-c*f*l+b*g*l;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),i=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var k=g*i,j=g*e,h=d*i,l=d*e;this.n11=k+l*c;this.n12=h*c-j;this.n13=f*d;this.n21=f*e;this.n22=f*i;this.n23=-c;this.n31=j*c-h;this.n32=l+k*c;this.n33=f*g;break;case "ZXY":k=g*i;j=g*e;h=d*i;l=d*e;this.n11=k-l*c;this.n12=-f*e;this.n13=h+j*c;this.n21=j+h*c;this.n22=f*i;this.n23=l-k*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":k=
+f*i;j=f*e;h=c*i;l=c*e;this.n11=g*i;this.n12=h*d-j;this.n13=k*d+l;this.n21=g*e;this.n22=l*d+k;this.n23=j*d-h;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":k=f*g;j=f*d;h=c*g;l=c*d;this.n11=g*i;this.n12=l-k*e;this.n13=h*e+j;this.n21=e;this.n22=f*i;this.n23=-c*i;this.n31=-d*i;this.n32=j*e+h;this.n33=k-l*e;break;case "XZY":k=f*g;j=f*d;h=c*g;l=c*d;this.n11=g*i;this.n12=-e;this.n13=d*i;this.n21=k*e+l;this.n22=f*i;this.n23=j*e-h;this.n31=h*e-j;this.n32=c*i;this.n33=l*e+k;break;default:k=f*i,j=f*
+e,h=c*i,l=c*e,this.n11=g*i,this.n12=-g*e,this.n13=d,this.n21=j+h*d,this.n22=k-l*d,this.n23=-c*g,this.n31=l-k*d,this.n32=h+j*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,i=d+d,a=b*f,k=b*g;b*=i;var j=c*g;c*=i;d*=i;f*=e;g*=e;e*=i;this.n11=1-(j+d);this.n12=k-e;this.n13=b+g;this.n21=k+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
 a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.set(this.n13,
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this}};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,i=-a.n23*a.n11+a.n21*a.n13,l=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*k;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*j;c[6]=a*k;c[7]=a*i;c[8]=a*l;return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,h=-a.n23*a.n11+a.n21*a.n13,l=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*j;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*i;c[5]=a*k;c[6]=a*j;c[7]=a*h;c[8]=a*l;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,h,j,k;g=new THREE.Matrix4;h=b-a;j=c-d;k=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/j;g.n23=0;g.n24=-((c+d)/j);g.n31=0;g.n32=0;g.n33=-2/k;g.n34=-((f+e)/k);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,i,k,j;g=new THREE.Matrix4;i=b-a;k=c-d;j=f-e;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/k;g.n23=0;g.n24=-((c+d)/k);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+e)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,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(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
 -1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;
 if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=k[j]=k[j]||new THREE.RenderableVertex;j++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var e,f,g=[],h,j,k=[],
-i,l,n=[],m,o=[],p,q,I=[],v,D,J=[],r={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,u=new THREE.Vector4,t=new THREE.Matrix4,F=new THREE.Matrix4,w=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,H=new THREE.Vector4;this.computeFrustum=function(a){w[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);w[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);w[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);w[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);w[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);w[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=w[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);t.multiply(b.projectionMatrix,b.matrixWorldInverse);t.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-t.multiply(b.matrixWorld,b.projectionMatrixInverse);t.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;r.objects.length=0;r.sprites.length=0;r.lights.length=0;var g=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
-f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=w[h].x*d.n14+w[h].y*d.n24+w[h].z*d.n34+w[h].w,c<=f){c=!1;break a}c=!0}c?(t.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,r.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(t.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,r.sprites.push(e)):b instanceof THREE.Light&&r.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
-r.objects.sort(c);return r};this.projectScene=function(a,e,f){var g=e.near,w=e.far,A,K,z,G,s,B,y,E,x,L,M,T,W,U,V,N;D=q=m=l=0;r.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);t.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(t);r=this.projectGraph(a,!1);a=0;for(A=r.objects.length;a<A;a++)if(x=r.objects[a].object,L=x.matrixWorld,T=
-x.material,j=0,x instanceof THREE.Mesh){M=x.geometry;W=x.geometry.materials;G=M.vertices;U=M.faces;V=M.faceVertexUvs;M=x.matrixRotationWorld.extractRotation(L);K=0;for(z=G.length;K<z;K++)h=b(),h.positionWorld.copy(G[K].position),L.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),t.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<w;G=0;for(K=U.length;G<K;G++){z=U[G];
-if(z instanceof THREE.Face3)if(s=k[z.a],B=k[z.b],y=k[z.c],s.visible&&B.visible&&y.visible&&(x.doubleSided||x.flipSided!=(y.positionScreen.x-s.positionScreen.x)*(B.positionScreen.y-s.positionScreen.y)-(y.positionScreen.y-s.positionScreen.y)*(B.positionScreen.x-s.positionScreen.x)<0))E=n[l]=n[l]||new THREE.RenderableFace3,l++,i=E,i.v1.copy(s),i.v2.copy(B),i.v3.copy(y);else continue;else if(z instanceof THREE.Face4)if(s=k[z.a],B=k[z.b],y=k[z.c],E=k[z.d],s.visible&&B.visible&&y.visible&&E.visible&&(x.doubleSided||
-x.flipSided!=((E.positionScreen.x-s.positionScreen.x)*(B.positionScreen.y-s.positionScreen.y)-(E.positionScreen.y-s.positionScreen.y)*(B.positionScreen.x-s.positionScreen.x)<0||(B.positionScreen.x-y.positionScreen.x)*(E.positionScreen.y-y.positionScreen.y)-(B.positionScreen.y-y.positionScreen.y)*(E.positionScreen.x-y.positionScreen.x)<0)))N=o[m]=o[m]||new THREE.RenderableFace4,m++,i=N,i.v1.copy(s),i.v2.copy(B),i.v3.copy(y),i.v4.copy(E);else continue;i.normalWorld.copy(z.normal);M.multiplyVector3(i.normalWorld);
-i.centroidWorld.copy(z.centroid);L.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);t.multiplyVector3(i.centroidScreen);y=z.vertexNormals;s=0;for(B=y.length;s<B;s++)E=i.vertexNormalsWorld[s],E.copy(y[s]),M.multiplyVector3(E);s=0;for(B=V.length;s<B;s++)if(N=V[s][G]){y=0;for(E=N.length;y<E;y++)i.uvs[s][y]=N[y]}i.material=T;i.faceMaterial=z.materialIndex!==null?W[z.materialIndex]:null;i.z=i.centroidScreen.z;r.elements.push(i)}}else if(x instanceof THREE.Line){F.multiply(t,L);G=
-x.geometry.vertices;s=b();s.positionScreen.copy(G[0].position);F.multiplyVector4(s.positionScreen);K=1;for(z=G.length;K<z;K++)if(s=b(),s.positionScreen.copy(G[K].position),F.multiplyVector4(s.positionScreen),B=k[j-2],C.copy(s.positionScreen),H.copy(B.positionScreen),d(C,H))C.multiplyScalar(1/C.w),H.multiplyScalar(1/H.w),x=I[q]=I[q]||new THREE.RenderableLine,q++,p=x,p.v1.positionScreen.copy(C),p.v2.positionScreen.copy(H),p.z=Math.max(C.z,H.z),p.material=T,r.elements.push(p)}a=0;for(A=r.sprites.length;a<
-A;a++)if(x=r.sprites[a].object,L=x.matrixWorld,x instanceof THREE.Particle&&(u.set(L.n14,L.n24,L.n34,1),t.multiplyVector4(u),u.z/=u.w,u.z>0&&u.z<1))g=J[D]=J[D]||new THREE.RenderableParticle,D++,v=g,v.x=u.x/u.w,v.y=u.y/u.w,v.z=u.z,v.rotation=x.rotation.z,v.scale.x=x.scale.x*Math.abs(v.x-(u.x+e.projectionMatrix.n11)/(u.w+e.projectionMatrix.n14)),v.scale.y=x.scale.y*Math.abs(v.y-(u.y+e.projectionMatrix.n22)/(u.w+e.projectionMatrix.n24)),v.material=x.material,r.elements.push(v);f&&r.elements.sort(c);
-return r}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=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),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
+THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=j[k]=j[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var e,f,g=[],i,k,j=[],
+h,l,n=[],m,p=[],o,q,F=[],v,D,N=[],s={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,u=new THREE.Vector4,A=new THREE.Matrix4,L=new THREE.Matrix4,y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],G=new THREE.Vector4,H=new THREE.Vector4;this.computeFrustum=function(a){y[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);y[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);y[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+a.n23,a.n44+a.n24);y[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);y[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);y[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=y[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);A.multiply(b.projectionMatrix,b.matrixWorldInverse);A.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+A.multiply(b.matrixWorld,b.projectionMatrixInverse);A.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;s.objects.length=0;s.sprites.length=0;s.lights.length=0;var g=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
+f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=y[h].x*d.n14+y[h].y*d.n24+y[h].z*d.n34+y[h].w,c<=f){c=!1;break a}c=!0}c?(A.multiplyVector3(B.copy(b.position)),e=a(),e.object=b,e.z=B.z,s.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(A.multiplyVector3(B.copy(b.position)),e=a(),e.object=b,e.z=B.z,s.sprites.push(e)):b instanceof THREE.Light&&s.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
+s.objects.sort(c);return s};this.projectScene=function(a,e,f){var g=e.near,y=e.far,B,I,x,E,r,z,w,C,t,K,O,T,W,U,V,P;D=q=m=l=0;s.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);A.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(A);s=this.projectGraph(a,!1);a=0;for(B=s.objects.length;a<B;a++)if(t=s.objects[a].object,K=t.matrixWorld,T=
+t.material,k=0,t instanceof THREE.Mesh){O=t.geometry;W=t.geometry.materials;E=O.vertices;U=O.faces;V=O.faceVertexUvs;O=t.matrixRotationWorld.extractRotation(K);I=0;for(x=E.length;I<x;I++)i=b(),i.positionWorld.copy(E[I].position),K.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),A.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>g&&i.positionScreen.z<y;E=0;for(I=U.length;E<I;E++){x=U[E];
+if(x instanceof THREE.Face3)if(r=j[x.a],z=j[x.b],w=j[x.c],r.visible&&z.visible&&w.visible&&(t.doubleSided||t.flipSided!=(w.positionScreen.x-r.positionScreen.x)*(z.positionScreen.y-r.positionScreen.y)-(w.positionScreen.y-r.positionScreen.y)*(z.positionScreen.x-r.positionScreen.x)<0))C=n[l]=n[l]||new THREE.RenderableFace3,l++,h=C,h.v1.copy(r),h.v2.copy(z),h.v3.copy(w);else continue;else if(x instanceof THREE.Face4)if(r=j[x.a],z=j[x.b],w=j[x.c],C=j[x.d],r.visible&&z.visible&&w.visible&&C.visible&&(t.doubleSided||
+t.flipSided!=((C.positionScreen.x-r.positionScreen.x)*(z.positionScreen.y-r.positionScreen.y)-(C.positionScreen.y-r.positionScreen.y)*(z.positionScreen.x-r.positionScreen.x)<0||(z.positionScreen.x-w.positionScreen.x)*(C.positionScreen.y-w.positionScreen.y)-(z.positionScreen.y-w.positionScreen.y)*(C.positionScreen.x-w.positionScreen.x)<0)))P=p[m]=p[m]||new THREE.RenderableFace4,m++,h=P,h.v1.copy(r),h.v2.copy(z),h.v3.copy(w),h.v4.copy(C);else continue;h.normalWorld.copy(x.normal);O.multiplyVector3(h.normalWorld);
+h.centroidWorld.copy(x.centroid);K.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);A.multiplyVector3(h.centroidScreen);w=x.vertexNormals;r=0;for(z=w.length;r<z;r++)C=h.vertexNormalsWorld[r],C.copy(w[r]),O.multiplyVector3(C);r=0;for(z=V.length;r<z;r++)if(P=V[r][E]){w=0;for(C=P.length;w<C;w++)h.uvs[r][w]=P[w]}h.material=T;h.faceMaterial=x.materialIndex!==null?W[x.materialIndex]:null;h.z=h.centroidScreen.z;s.elements.push(h)}}else if(t instanceof THREE.Line){L.multiply(A,K);E=
+t.geometry.vertices;r=b();r.positionScreen.copy(E[0].position);L.multiplyVector4(r.positionScreen);I=1;for(x=E.length;I<x;I++)if(r=b(),r.positionScreen.copy(E[I].position),L.multiplyVector4(r.positionScreen),z=j[k-2],G.copy(r.positionScreen),H.copy(z.positionScreen),d(G,H))G.multiplyScalar(1/G.w),H.multiplyScalar(1/H.w),t=F[q]=F[q]||new THREE.RenderableLine,q++,o=t,o.v1.positionScreen.copy(G),o.v2.positionScreen.copy(H),o.z=Math.max(G.z,H.z),o.material=T,s.elements.push(o)}a=0;for(B=s.sprites.length;a<
+B;a++)if(t=s.sprites[a].object,K=t.matrixWorld,t instanceof THREE.Particle&&(u.set(K.n14,K.n24,K.n34,1),A.multiplyVector4(u),u.z/=u.w,u.z>0&&u.z<1))g=N[D]=N[D]||new THREE.RenderableParticle,D++,v=g,v.x=u.x/u.w,v.y=u.y/u.w,v.z=u.z,v.rotation=t.rotation.z,v.scale.x=t.scale.x*Math.abs(v.x-(u.x+e.projectionMatrix.n11)/(u.w+e.projectionMatrix.n14)),v.scale.y=t.scale.y*Math.abs(v.y-(u.y+e.projectionMatrix.n22)/(u.w+e.projectionMatrix.n24)),v.material=t.material,s.elements.push(v);f&&s.elements.sort(c);
+return s}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=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),f=Math.cos(c),c=Math.sin(c),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},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();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);a===0?this.w=this.z=this.y=this.x=0:(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,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;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,h=this.z,j=this.w,k=j*c+g*e-h*d,i=j*d+h*c-f*e,l=j*e+f*d-g*c,c=-f*
-c-g*d-h*e;b.x=k*j+c*-f+i*-h-l*-g;b.y=i*j+c*-g+l*-f-k*-h;b.z=l*j+c*-h+k*-g-i*-f;return 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},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;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,k=this.w,j=k*c+g*e-i*d,h=k*d+i*c-f*e,l=k*e+f*d-g*c,c=-f*
+c-g*d-i*e;b.x=j*k+c*-f+h*-i-l*-g;b.y=h*k+c*-g+l*-f-j*-i;b.z=l*k+c*-i+j*-g-h*-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;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001)return 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),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
@@ -90,5 +90,5 @@ THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.ce
 THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.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);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,f;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var j,k,i,l,n,m,o,p;a=b.projectScene(c,d);j=0;for(k=a.length;j<k;j++)if(n=a[j],n instanceof THREE.RenderableParticle){o=n.x*e+e;p=n.y*f+f;i=0;for(l=n.material.length;i<l;i++)if(m=n.material[i],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=o+"px",m.style.top=p+"px"}}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,f;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var k,j,h,l,n,m,p,o;a=b.projectScene(c,d);k=0;for(j=a.length;k<j;k++)if(n=a[k],n instanceof THREE.RenderableParticle){p=n.x*e+e;o=n.y*f+f;h=0;for(l=n.material.length;h<l;h++)if(m=n.material[h],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=p+"px",m.style.top=o+"px"}}};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};

+ 53 - 53
build/custom/ThreeSVG.js

@@ -13,65 +13,65 @@ cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y
 Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12/b,a.n11/b)):(this.x=0,this.z=Math.atan2(a.n21,a.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
-normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){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;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function b(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function c(a,b,c,o){d.copy(o).subSelf(b);
-f.copy(c).subSelf(b);e.copy(a).subSelf(b);g=d.dot(d);h=d.dot(f);j=d.dot(e);l=f.dot(f);i=f.dot(e);k=1/(g*l-h*h);n=(l*j-h*i)*k;m=(g*i-h*j)*k;return n>=0&&m>=0&&n+m<1}for(var d=new THREE.Vector3,f=new THREE.Vector3,e=new THREE.Vector3,g,h,j,l,i,k,n,m,o,p=[],s=0,I=a.children.length;s<I;s++)Array.prototype.push.apply(p,this.intersectObject(a.children[s]));if(a instanceof THREE.Particle){s=b(this.origin,this.direction,a.matrixWorld.getPosition());if(s===null||s>a.scale.x)return[];o={distance:s,point:a.position,
-face:null,object:a};p.push(o)}else if(a instanceof THREE.Mesh){s=b(this.origin,this.direction,a.matrixWorld.getPosition());if(s===null||s>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return p;var y,G,u,t,B,w,v,D,x=a.geometry,E=x.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);s=0;for(I=x.faces.length;s<I;s++)if(o=x.faces[s],v=this.origin.clone(),D=this.direction.clone(),t=a.matrixWorld,y=t.multiplyVector3(o.centroid.clone()).subSelf(v),w=y.dot(D),
-!(w<=0)&&(y=t.multiplyVector3(E[o.a].position.clone()),G=t.multiplyVector3(E[o.b].position.clone()),u=t.multiplyVector3(E[o.c].position.clone()),t=o instanceof THREE.Face4?t.multiplyVector3(E[o.d].position.clone()):null,B=a.matrixRotationWorld.multiplyVector3(o.normal.clone()),w=D.dot(B),a.doubleSided||(a.flipSided?w>0:w<0)))if(w=B.dot((new THREE.Vector3).sub(y,v))/w,v=v.addSelf(D.multiplyScalar(w)),o instanceof THREE.Face3)c(v,y,G,u)&&(o={distance:this.origin.distanceTo(v),point:v,face:o,object:a},
-p.push(o));else if(o instanceof THREE.Face4&&(c(v,y,G,t)||c(v,G,u,t)))o={distance:this.origin.distanceTo(v),point:v,face:o,object:a},p.push(o)}return p}};
-THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b,c,d,f,e,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,i,k){h=!1;b=e;c=g;d=i;f=k;a()};this.addPoint=function(e,g){h?(h=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
-function(e,g,i,k,n,m){h?(h=!1,b=e<i?e<n?e:n:i<n?i:n,c=g<k?g<m?g:m:k<m?k:m,d=e>i?e>n?e:n:i>n?i:n,f=g>k?g>m?g:m:k>m?k:m):(b=e<i?e<n?e<b?e:b:n<b?n:b:i<n?i<b?i:b:n<b?n:b,c=g<k?g<m?g<c?g:c:m<c?m:c:k<m?k<c?k:c:m<c?m:c,d=e>i?e>n?e>d?e:d:n>d?n:d:i>n?i>d?i:d:n>d?n:d,f=g>k?g>m?g>f?g:f:m>f?m:f:k>m?k>f?k:f:m>f?m:f);a()};this.addRectangle=function(e){h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
+normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){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;return this}};
+THREE.Ray=function(a,b){function c(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function d(a,b,c,d){k.copy(d).subSelf(b);i.copy(c).subSelf(b);j.copy(a).subSelf(b);n=k.dot(k);m=k.dot(i);o=k.dot(j);p=i.dot(i);t=i.dot(j);I=1/(n*p-m*m);w=(p*o-m*t)*I;E=(n*t-m*o)*I;return w>=0&&E>=0&&w+E<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};
+this.intersectObjects=function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var f=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,l=new THREE.Vector3;this.intersectObject=function(a){for(var b,k=[],i=0,j=a.children.length;i<j;i++)Array.prototype.push.apply(k,this.intersectObject(a.children[i]));if(a instanceof THREE.Particle){i=
+c(this.origin,this.direction,a.matrixWorld.getPosition());if(i===null||i>a.scale.x)return[];b={distance:i,point:a.position,face:null,object:a};k.push(b)}else if(a instanceof THREE.Mesh){i=c(this.origin,this.direction,a.matrixWorld.getPosition());if(i===null||i>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return k;var m,n,o,p,J=a.geometry,L=J.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);i=0;for(j=J.faces.length;i<j;i++)if(b=J.faces[i],o=this.origin.clone(),
+p=this.direction.clone(),n=a.matrixWorld,m=n.multiplyVector3(b.centroid.clone()).subSelf(o),m=m.dot(p),!(m<=0)&&(f=n.multiplyVector3(f.copy(L[b.a].position)),e=n.multiplyVector3(e.copy(L[b.b].position)),g=n.multiplyVector3(g.copy(L[b.c].position)),h=b instanceof THREE.Face4?n.multiplyVector3(h.copy(L[b.d].position)):null,l=a.matrixRotationWorld.multiplyVector3(l.copy(b.normal)),m=p.dot(l),a.doubleSided||(a.flipSided?m>0:m<0)))if(n=l.dot((new THREE.Vector3).sub(f,o))/m,o=o.addSelf(p.multiplyScalar(n)),
+b instanceof THREE.Face3)d(o,f,e,g)&&(b={distance:this.origin.distanceTo(o),point:o,face:b,object:a},k.push(b));else if(b instanceof THREE.Face4&&(d(o,f,e,h)||d(o,e,g,h)))b={distance:this.origin.distanceTo(o),point:o,face:b,object:a},k.push(b)}return k};var k=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,n,m,o,p,t,I,w,E};
+THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b,c,d,f,e,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,i,j){h=!1;b=e;c=g;d=i;f=j;a()};this.addPoint=function(e,g){h?(h=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>g?f:g);a()};this.add3Points=
+function(e,g,i,j,n,m){h?(h=!1,b=e<i?e<n?e:n:i<n?i:n,c=g<j?g<m?g:m:j<m?j:m,d=e>i?e>n?e:n:i>n?i:n,f=g>j?g>m?g:m:j>m?j:m):(b=e<i?e<n?e<b?e:b:n<b?n:b:i<n?i<b?i:b:n<b?n:b,c=g<j?g<m?g<c?g:c:m<c?m:c:j<m?j<c?j:c:m<c?m:c,d=e>i?e>n?e>d?e:d:n>d?n:d:i>n?i>d?i:d:n>d?n:d,f=g>j?g>m?g>f?g:f:m>f?m:f:j>m?j>f?j:f:m>f?m:f);a()};this.addRectangle=function(e){h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),d=d>e.getRight()?d:e.getRight(),f=f>
 e.getBottom()?f:e.getBottom());a()};this.inflate=function(e){b-=e;c-=e;d+=e;f+=e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;f=d=c=b=0;a()};this.isEmpty=function(){return h}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,f){return d+(a-b)*(f-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,f,e,g,h,j,l,i,k,n,m,o,p){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,j||0,l||0,i!==void 0?i:1,k||0,n||0,m||0,o||0,p!==void 0?p:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,j,l,i,k,n,m,o,p){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=h;this.n31=j;this.n32=l;this.n33=i;this.n34=k;this.n41=n;this.n42=m;this.n43=o;this.n44=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,h=a.n22,j=a.n23,l=a.n24,i=a.n31,k=a.n32,n=a.n33,m=a.n34,o=a.n41,p=a.n42,s=a.n43,
-I=a.n44,y=b.n11,G=b.n12,u=b.n13,t=b.n14,B=b.n21,w=b.n22,v=b.n23,D=b.n24,x=b.n31,E=b.n32,A=b.n33,K=b.n34,M=b.n41,L=b.n42,Q=b.n43,S=b.n44;this.n11=c*y+d*B+f*x+e*M;this.n12=c*G+d*w+f*E+e*L;this.n13=c*u+d*v+f*A+e*Q;this.n14=c*t+d*D+f*K+e*S;this.n21=g*y+h*B+j*x+l*M;this.n22=g*G+h*w+j*E+l*L;this.n23=g*u+h*v+j*A+l*Q;this.n24=g*t+h*D+j*K+l*S;this.n31=i*y+k*B+n*x+m*M;this.n32=i*G+k*w+n*E+m*L;this.n33=i*u+k*v+n*A+m*Q;this.n34=i*t+k*D+n*K+m*S;this.n41=o*y+p*B+s*x+I*M;this.n42=o*G+p*w+s*E+I*L;this.n43=o*u+p*
-v+s*A+I*Q;this.n44=o*t+p*D+s*K+I*S;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
+THREE.Matrix4=function(a,b,c,d,f,e,g,h,l,k,i,j,n,m,o,p){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,l||0,k||0,i!==void 0?i:1,j||0,n||0,m||0,o||0,p!==void 0?p:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,l,k,i,j,n,m,o,p){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=e;this.n23=g;this.n24=h;this.n31=l;this.n32=k;this.n33=i;this.n34=j;this.n41=n;this.n42=m;this.n43=o;this.n44=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,h=a.n22,l=a.n23,k=a.n24,i=a.n31,j=a.n32,n=a.n33,m=a.n34,o=a.n41,p=a.n42,t=a.n43,
+I=a.n44,w=b.n11,E=b.n12,s=b.n13,u=b.n14,D=b.n21,z=b.n22,A=b.n23,G=b.n24,x=b.n31,H=b.n32,y=b.n33,J=b.n34,L=b.n41,M=b.n42,Q=b.n43,S=b.n44;this.n11=c*w+d*D+f*x+e*L;this.n12=c*E+d*z+f*H+e*M;this.n13=c*s+d*A+f*y+e*Q;this.n14=c*u+d*G+f*J+e*S;this.n21=g*w+h*D+l*x+k*L;this.n22=g*E+h*z+l*H+k*M;this.n23=g*s+h*A+l*y+k*Q;this.n24=g*u+h*G+l*J+k*S;this.n31=i*w+j*D+n*x+m*L;this.n32=i*E+j*z+n*H+m*M;this.n33=i*s+j*A+n*y+m*Q;this.n34=i*u+j*G+n*J+m*S;this.n41=o*w+p*D+t*x+I*L;this.n42=o*E+p*z+t*H+I*M;this.n43=o*s+p*
+A+t*y+I*Q;this.n44=o*u+p*G+t*J+I*S;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},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},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*
 c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,e=this.n22,g=this.n23,h=this.n24,j=this.n31,l=this.n32,i=this.n33,k=this.n34,n=this.n41,m=this.n42,o=this.n43,p=this.n44;return d*g*l*n-c*h*l*n-d*e*i*n+b*h*i*n+c*e*k*n-b*g*k*n-d*g*j*m+c*h*j*m+d*f*i*m-a*h*i*m-c*f*k*m+a*g*k*m+d*e*j*o-b*h*j*o-d*f*l*o+a*h*l*o+b*f*k*o-a*e*k*o-c*e*j*p+b*g*j*p+c*f*l*p-a*g*l*p-b*f*i*p+a*e*i*p},transpose:function(){var a;
+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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,e=this.n22,g=this.n23,h=this.n24,l=this.n31,k=this.n32,i=this.n33,j=this.n34,n=this.n41,m=this.n42,o=this.n43,p=this.n44;return d*g*k*n-c*h*k*n-d*e*i*n+b*h*i*n+c*e*j*n-b*g*j*n-d*g*l*m+c*h*l*m+d*f*i*m-a*h*i*m-c*f*j*m+a*g*j*m+d*e*l*o-b*h*l*o-d*f*k*o+a*h*k*o+b*f*j*o-a*e*j*o-c*e*l*p+b*g*l*p+c*f*k*p-a*g*k*p-b*f*i*p+a*e*i*p},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,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,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 c=Math.cos(b),d=Math.sin(b),f=1-c,e=a.x,g=a.y,h=a.z,j=f*e,l=f*g;this.set(j*e+c,j*g-d*h,j*h+d*g,0,j*g+d*h,l*g+c,l*h-d*e,0,j*h-d*g,l*h+d*e,f*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,f=a.n14,e=a.n21,g=a.n22,h=a.n23,j=a.n24,l=a.n31,i=a.n32,k=a.n33,n=a.n34,m=a.n41,o=a.n42,p=a.n43,s=a.n44;this.n11=h*n*o-j*k*o+j*i*p-g*n*p-h*i*s+g*k*s;this.n12=f*k*o-d*n*o-f*i*p+c*n*p+d*i*s-c*k*s;this.n13=d*j*o-f*h*o+f*g*p-c*j*p-d*g*s+c*h*s;this.n14=f*h*i-d*j*i-f*g*k+c*j*k+d*g*n-c*h*n;this.n21=j*k*m-h*n*m-j*l*p+e*n*p+h*l*s-e*k*s;this.n22=d*n*m-f*k*m+
-f*l*p-b*n*p-d*l*s+b*k*s;this.n23=f*h*m-d*j*m-f*e*p+b*j*p+d*e*s-b*h*s;this.n24=d*j*l-f*h*l+f*e*k-b*j*k-d*e*n+b*h*n;this.n31=g*n*m-j*i*m+j*l*o-e*n*o-g*l*s+e*i*s;this.n32=f*i*m-c*n*m-f*l*o+b*n*o+c*l*s-b*i*s;this.n33=d*j*m-f*g*m+f*e*o-b*j*o-c*e*s+b*g*s;this.n34=f*g*l-c*j*l-f*e*i+b*j*i+c*e*n-b*g*n;this.n41=h*i*m-g*k*m-h*l*o+e*k*o+g*l*p-e*i*p;this.n42=c*k*m-d*i*m+d*l*o-b*k*o-c*l*p+b*i*p;this.n43=d*g*m-c*h*m-d*e*o+b*h*o+c*e*p-b*g*p;this.n44=c*h*l-d*g*l+d*e*i-b*h*i-c*e*k+b*g*k;this.multiplyScalar(1/a.determinant());
-return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var j=g*h,l=g*f,i=d*h,k=d*f;this.n11=j+k*c;this.n12=i*c-l;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=l*c-i;this.n32=k+j*c;this.n33=e*g;break;case "ZXY":j=g*h;l=g*f;i=d*h;k=d*f;this.n11=j-k*c;this.n12=-e*f;this.n13=i+l*c;this.n21=l+i*c;this.n22=e*h;this.n23=k-j*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":j=
-e*h;l=e*f;i=c*h;k=c*f;this.n11=g*h;this.n12=i*d-l;this.n13=j*d+k;this.n21=g*f;this.n22=k*d+j;this.n23=l*d-i;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":j=e*g;l=e*d;i=c*g;k=c*d;this.n11=g*h;this.n12=k-j*f;this.n13=i*f+l;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*f+i;this.n33=j-k*f;break;case "XZY":j=e*g;l=e*d;i=c*g;k=c*d;this.n11=g*h;this.n12=-f;this.n13=d*h;this.n21=j*f+k;this.n22=e*h;this.n23=l*f-i;this.n31=i*f-l;this.n32=c*h;this.n33=k*f+j;break;default:j=e*h,l=e*
-f,i=c*h,k=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=l+i*d,this.n22=j-k*d,this.n23=-c*g,this.n31=k-j*d,this.n32=i+l*d,this.n33=e*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,e=b+b,g=c+c,h=d+d,a=b*e,j=b*g;b*=h;var l=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(l+d);this.n12=j-f;this.n13=b+g;this.n21=j+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-g;this.n32=c+e;this.n33=1-(a+l);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
+setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,e=a.x,g=a.y,h=a.z,l=f*e,k=f*g;this.set(l*e+c,l*g-d*h,l*h+d*g,0,l*g+d*h,k*g+c,k*h-d*e,0,l*h-d*g,k*h+d*e,f*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,f=a.n14,e=a.n21,g=a.n22,h=a.n23,l=a.n24,k=a.n31,i=a.n32,j=a.n33,n=a.n34,m=a.n41,o=a.n42,p=a.n43,t=a.n44;this.n11=h*n*o-l*j*o+l*i*p-g*n*p-h*i*t+g*j*t;this.n12=f*j*o-d*n*o-f*i*p+c*n*p+d*i*t-c*j*t;this.n13=d*l*o-f*h*o+f*g*p-c*l*p-d*g*t+c*h*t;this.n14=f*h*i-d*l*i-f*g*j+c*l*j+d*g*n-c*h*n;this.n21=l*j*m-h*n*m-l*k*p+e*n*p+h*k*t-e*j*t;this.n22=d*n*m-f*j*m+
+f*k*p-b*n*p-d*k*t+b*j*t;this.n23=f*h*m-d*l*m-f*e*p+b*l*p+d*e*t-b*h*t;this.n24=d*l*k-f*h*k+f*e*j-b*l*j-d*e*n+b*h*n;this.n31=g*n*m-l*i*m+l*k*o-e*n*o-g*k*t+e*i*t;this.n32=f*i*m-c*n*m-f*k*o+b*n*o+c*k*t-b*i*t;this.n33=d*l*m-f*g*m+f*e*o-b*l*o-c*e*t+b*g*t;this.n34=f*g*k-c*l*k-f*e*i+b*l*i+c*e*n-b*g*n;this.n41=h*i*m-g*j*m-h*k*o+e*j*o+g*k*p-e*i*p;this.n42=c*j*m-d*i*m+d*k*o-b*j*o-c*k*p+b*i*p;this.n43=d*g*m-c*h*m-d*e*o+b*h*o+c*e*p-b*g*p;this.n44=c*h*k-d*g*k+d*e*i-b*h*i-c*e*j+b*g*j;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,e=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var l=g*h,k=g*f,i=d*h,j=d*f;this.n11=l+j*c;this.n12=i*c-k;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=k*c-i;this.n32=j+l*c;this.n33=e*g;break;case "ZXY":l=g*h;k=g*f;i=d*h;j=d*f;this.n11=l-j*c;this.n12=-e*f;this.n13=i+k*c;this.n21=k+i*c;this.n22=e*h;this.n23=j-l*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":l=
+e*h;k=e*f;i=c*h;j=c*f;this.n11=g*h;this.n12=i*d-k;this.n13=l*d+j;this.n21=g*f;this.n22=j*d+l;this.n23=k*d-i;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":l=e*g;k=e*d;i=c*g;j=c*d;this.n11=g*h;this.n12=j-l*f;this.n13=i*f+k;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=k*f+i;this.n33=l-j*f;break;case "XZY":l=e*g;k=e*d;i=c*g;j=c*d;this.n11=g*h;this.n12=-f;this.n13=d*h;this.n21=l*f+j;this.n22=e*h;this.n23=k*f-i;this.n31=i*f-k;this.n32=c*h;this.n33=j*f+l;break;default:l=e*h,k=e*
+f,i=c*h,j=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=k+i*d,this.n22=l-j*d,this.n23=-c*g,this.n31=j-l*d,this.n32=i+k*d,this.n33=e*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,e=b+b,g=c+c,h=d+d,a=b*e,l=b*g;b*=h;var k=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(k+d);this.n12=l-f;this.n13=b+g;this.n21=l+f;this.n22=1-(a+d);this.n23=c-e;this.n31=b-g;this.n32=c+e;this.n33=1-(a+k);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
 a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(d,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);e.set(this.n13,
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=f.length();c.z=e.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this}};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,i=-a.n23*a.n11+a.n21*a.n13,k=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*l;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*h;c[5]=a*j;c[6]=a*l;c[7]=a*i;c[8]=a*k;return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,i=-a.n23*a.n11+a.n21*a.n13,j=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*k;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*e;c[3]=a*g;c[4]=a*h;c[5]=a*l;c[6]=a*k;c[7]=a*i;c[8]=a*j;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,f,e){var g;g=new THREE.Matrix4;g.n11=2*f/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*f/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(e+f)/(e-f);g.n34=-2*e*f/(e-f);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,f,e){var g,h,j,l;g=new THREE.Matrix4;h=b-a;j=c-d;l=e-f;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/j;g.n23=0;g.n24=-((c+d)/j);g.n31=0;g.n32=0;g.n33=-2/l;g.n34=-((e+f)/l);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,f,e){var g,h,l,k;g=new THREE.Matrix4;h=b-a;l=c-d;k=e-f;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/l;g.n23=0;g.n24=-((c+d)/l);g.n31=0;g.n32=0;g.n33=-2/k;g.n34=-((e+f)/k);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,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(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
 -1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeObject(a)}},getChildByName:function(a,b){var c,d,f;c=0;for(d=this.children.length;c<d;c++){f=this.children[c];if(f.name===a)return f;
 if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableObject;e++;return a}function b(){var a=l[j]=l[j]||new THREE.RenderableVertex;j++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var f,e,g=[],h,j,l=[],
-i,k,n=[],m,o=[],p,s,I=[],y,G,u=[],t={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,w=new THREE.Vector4,v=new THREE.Matrix4,D=new THREE.Matrix4,x=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,A=new THREE.Vector4;this.computeFrustum=function(a){x[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);x[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);x[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);x[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);x[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);x[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=x[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);v.multiply(b.projectionMatrix,b.matrixWorldInverse);v.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-v.multiply(b.matrixWorld,b.projectionMatrixInverse);v.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){e=0;t.objects.length=0;t.sprites.length=0;t.lights.length=0;var g=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
-e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=x[h].x*d.n14+x[h].y*d.n24+x[h].z*d.n34+x[h].w,c<=e){c=!1;break a}c=!0}c?(v.multiplyVector3(B.copy(b.position)),f=a(),f.object=b,f.z=B.z,t.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(v.multiplyVector3(B.copy(b.position)),f=a(),f.object=b,f.z=B.z,t.sprites.push(f)):b instanceof THREE.Light&&t.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
-t.objects.sort(c);return t};this.projectScene=function(a,e,f){var g=e.near,x=e.far,B,N,r,q,z,C,F,J,H,O,P,T,W,U,V,R;G=s=m=k=0;t.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);v.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(v);t=this.projectGraph(a,!1);a=0;for(B=t.objects.length;a<B;a++)if(H=t.objects[a].object,O=H.matrixWorld,T=
-H.material,j=0,H instanceof THREE.Mesh){P=H.geometry;W=H.geometry.materials;q=P.vertices;U=P.faces;V=P.faceVertexUvs;P=H.matrixRotationWorld.extractRotation(O);N=0;for(r=q.length;N<r;N++)h=b(),h.positionWorld.copy(q[N].position),O.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),v.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<x;q=0;for(N=U.length;q<N;q++){r=U[q];
-if(r instanceof THREE.Face3)if(z=l[r.a],C=l[r.b],F=l[r.c],z.visible&&C.visible&&F.visible&&(H.doubleSided||H.flipSided!=(F.positionScreen.x-z.positionScreen.x)*(C.positionScreen.y-z.positionScreen.y)-(F.positionScreen.y-z.positionScreen.y)*(C.positionScreen.x-z.positionScreen.x)<0))J=n[k]=n[k]||new THREE.RenderableFace3,k++,i=J,i.v1.copy(z),i.v2.copy(C),i.v3.copy(F);else continue;else if(r instanceof THREE.Face4)if(z=l[r.a],C=l[r.b],F=l[r.c],J=l[r.d],z.visible&&C.visible&&F.visible&&J.visible&&(H.doubleSided||
-H.flipSided!=((J.positionScreen.x-z.positionScreen.x)*(C.positionScreen.y-z.positionScreen.y)-(J.positionScreen.y-z.positionScreen.y)*(C.positionScreen.x-z.positionScreen.x)<0||(C.positionScreen.x-F.positionScreen.x)*(J.positionScreen.y-F.positionScreen.y)-(C.positionScreen.y-F.positionScreen.y)*(J.positionScreen.x-F.positionScreen.x)<0)))R=o[m]=o[m]||new THREE.RenderableFace4,m++,i=R,i.v1.copy(z),i.v2.copy(C),i.v3.copy(F),i.v4.copy(J);else continue;i.normalWorld.copy(r.normal);P.multiplyVector3(i.normalWorld);
-i.centroidWorld.copy(r.centroid);O.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);v.multiplyVector3(i.centroidScreen);F=r.vertexNormals;z=0;for(C=F.length;z<C;z++)J=i.vertexNormalsWorld[z],J.copy(F[z]),P.multiplyVector3(J);z=0;for(C=V.length;z<C;z++)if(R=V[z][q]){F=0;for(J=R.length;F<J;F++)i.uvs[z][F]=R[F]}i.material=T;i.faceMaterial=r.materialIndex!==null?W[r.materialIndex]:null;i.z=i.centroidScreen.z;t.elements.push(i)}}else if(H instanceof THREE.Line){D.multiply(v,O);q=
-H.geometry.vertices;z=b();z.positionScreen.copy(q[0].position);D.multiplyVector4(z.positionScreen);N=1;for(r=q.length;N<r;N++)if(z=b(),z.positionScreen.copy(q[N].position),D.multiplyVector4(z.positionScreen),C=l[j-2],E.copy(z.positionScreen),A.copy(C.positionScreen),d(E,A))E.multiplyScalar(1/E.w),A.multiplyScalar(1/A.w),H=I[s]=I[s]||new THREE.RenderableLine,s++,p=H,p.v1.positionScreen.copy(E),p.v2.positionScreen.copy(A),p.z=Math.max(E.z,A.z),p.material=T,t.elements.push(p)}a=0;for(B=t.sprites.length;a<
-B;a++)if(H=t.sprites[a].object,O=H.matrixWorld,H instanceof THREE.Particle&&(w.set(O.n14,O.n24,O.n34,1),v.multiplyVector4(w),w.z/=w.w,w.z>0&&w.z<1))g=u[G]=u[G]||new THREE.RenderableParticle,G++,y=g,y.x=w.x/w.w,y.y=w.y/w.w,y.z=w.z,y.rotation=H.rotation.z,y.scale.x=H.scale.x*Math.abs(y.x-(w.x+e.projectionMatrix.n11)/(w.w+e.projectionMatrix.n14)),y.scale.y=H.scale.y*Math.abs(y.y-(w.y+e.projectionMatrix.n22)/(w.w+e.projectionMatrix.n24)),y.material=H.material,t.elements.push(y);f&&t.elements.sort(c);
-return t}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableObject;e++;return a}function b(){var a=k[l]=k[l]||new THREE.RenderableVertex;l++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var f,e,g=[],h,l,k=[],
+i,j,n=[],m,o=[],p,t,I=[],w,E,s=[],u={objects:[],sprites:[],lights:[],elements:[]},D=new THREE.Vector3,z=new THREE.Vector4,A=new THREE.Matrix4,G=new THREE.Matrix4,x=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,y=new THREE.Vector4;this.computeFrustum=function(a){x[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);x[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);x[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+a.n23,a.n44+a.n24);x[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);x[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);x[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=x[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);A.multiply(b.projectionMatrix,b.matrixWorldInverse);A.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+A.multiply(b.matrixWorld,b.projectionMatrixInverse);A.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){e=0;u.objects.length=0;u.sprites.length=0;u.lights.length=0;var g=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
+e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=x[h].x*d.n14+x[h].y*d.n24+x[h].z*d.n34+x[h].w,c<=e){c=!1;break a}c=!0}c?(A.multiplyVector3(D.copy(b.position)),f=a(),f.object=b,f.z=D.z,u.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(A.multiplyVector3(D.copy(b.position)),f=a(),f.object=b,f.z=D.z,u.sprites.push(f)):b instanceof THREE.Light&&u.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
+u.objects.sort(c);return u};this.projectScene=function(a,e,f){var g=e.near,x=e.far,D,N,r,q,v,B,C,K,F,O,P,T,W,U,V,R;E=t=m=j=0;u.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);A.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(A);u=this.projectGraph(a,!1);a=0;for(D=u.objects.length;a<D;a++)if(F=u.objects[a].object,O=F.matrixWorld,T=
+F.material,l=0,F instanceof THREE.Mesh){P=F.geometry;W=F.geometry.materials;q=P.vertices;U=P.faces;V=P.faceVertexUvs;P=F.matrixRotationWorld.extractRotation(O);N=0;for(r=q.length;N<r;N++)h=b(),h.positionWorld.copy(q[N].position),O.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),A.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<x;q=0;for(N=U.length;q<N;q++){r=U[q];
+if(r instanceof THREE.Face3)if(v=k[r.a],B=k[r.b],C=k[r.c],v.visible&&B.visible&&C.visible&&(F.doubleSided||F.flipSided!=(C.positionScreen.x-v.positionScreen.x)*(B.positionScreen.y-v.positionScreen.y)-(C.positionScreen.y-v.positionScreen.y)*(B.positionScreen.x-v.positionScreen.x)<0))K=n[j]=n[j]||new THREE.RenderableFace3,j++,i=K,i.v1.copy(v),i.v2.copy(B),i.v3.copy(C);else continue;else if(r instanceof THREE.Face4)if(v=k[r.a],B=k[r.b],C=k[r.c],K=k[r.d],v.visible&&B.visible&&C.visible&&K.visible&&(F.doubleSided||
+F.flipSided!=((K.positionScreen.x-v.positionScreen.x)*(B.positionScreen.y-v.positionScreen.y)-(K.positionScreen.y-v.positionScreen.y)*(B.positionScreen.x-v.positionScreen.x)<0||(B.positionScreen.x-C.positionScreen.x)*(K.positionScreen.y-C.positionScreen.y)-(B.positionScreen.y-C.positionScreen.y)*(K.positionScreen.x-C.positionScreen.x)<0)))R=o[m]=o[m]||new THREE.RenderableFace4,m++,i=R,i.v1.copy(v),i.v2.copy(B),i.v3.copy(C),i.v4.copy(K);else continue;i.normalWorld.copy(r.normal);P.multiplyVector3(i.normalWorld);
+i.centroidWorld.copy(r.centroid);O.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);A.multiplyVector3(i.centroidScreen);C=r.vertexNormals;v=0;for(B=C.length;v<B;v++)K=i.vertexNormalsWorld[v],K.copy(C[v]),P.multiplyVector3(K);v=0;for(B=V.length;v<B;v++)if(R=V[v][q]){C=0;for(K=R.length;C<K;C++)i.uvs[v][C]=R[C]}i.material=T;i.faceMaterial=r.materialIndex!==null?W[r.materialIndex]:null;i.z=i.centroidScreen.z;u.elements.push(i)}}else if(F instanceof THREE.Line){G.multiply(A,O);q=
+F.geometry.vertices;v=b();v.positionScreen.copy(q[0].position);G.multiplyVector4(v.positionScreen);N=1;for(r=q.length;N<r;N++)if(v=b(),v.positionScreen.copy(q[N].position),G.multiplyVector4(v.positionScreen),B=k[l-2],H.copy(v.positionScreen),y.copy(B.positionScreen),d(H,y))H.multiplyScalar(1/H.w),y.multiplyScalar(1/y.w),F=I[t]=I[t]||new THREE.RenderableLine,t++,p=F,p.v1.positionScreen.copy(H),p.v2.positionScreen.copy(y),p.z=Math.max(H.z,y.z),p.material=T,u.elements.push(p)}a=0;for(D=u.sprites.length;a<
+D;a++)if(F=u.sprites[a].object,O=F.matrixWorld,F instanceof THREE.Particle&&(z.set(O.n14,O.n24,O.n34,1),A.multiplyVector4(z),z.z/=z.w,z.z>0&&z.z<1))g=s[E]=s[E]||new THREE.RenderableParticle,E++,w=g,w.x=z.x/z.w,w.y=z.y/z.w,w.z=z.z,w.rotation=F.rotation.z,w.scale.x=F.scale.x*Math.abs(w.x-(z.x+e.projectionMatrix.n11)/(z.w+e.projectionMatrix.n14)),w.scale.y=F.scale.y*Math.abs(w.y-(z.y+e.projectionMatrix.n22)/(z.w+e.projectionMatrix.n24)),w.material=F.material,u.elements.push(w);f&&u.elements.sort(c);
+return u}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),e=Math.cos(c),c=Math.sin(c),g=a*b,h=d*f;this.w=g*e-h*c;this.x=g*c+h*e;this.y=d*b*e+a*f*c;this.z=a*f*e-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();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);a===0?this.w=this.z=this.y=this.x=0:(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,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,j=this.w,l=j*c+g*f-h*d,i=j*d+h*c-e*f,k=j*f+e*d-g*c,c=-e*
-c-g*d-h*f;b.x=l*j+c*-e+i*-h-k*-g;b.y=i*j+c*-g+k*-e-l*-h;b.z=k*j+c*-h+l*-g-i*-e;return b}};
+this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,k=l*c+g*f-h*d,i=l*d+h*c-e*f,j=l*f+e*d-g*c,c=-e*
+c-g*d-h*f;b.x=k*l+c*-e+i*-h-j*-g;b.y=i*l+c*-g+j*-e-k*-h;b.z=j*l+c*-h+k*-g-i*-e;return b}};
 THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return 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),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
@@ -79,12 +79,12 @@ THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;ret
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var e=0,g=f.vertexNormals.length;e<g;e++)b.multiplyVector3(f.vertexNormals[e]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
-c,d,f,e,g,h=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)h.addSelf(e.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],h.sub(g.position,c.position),j.sub(b.position,c.position),h.crossSelf(j);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=
+c,d,f,e,g,h=new THREE.Vector3,l=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);b=0;for(c=e.vertexNormals.length;b<c;b++)h.addSelf(e.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[e.a],c=this.vertices[e.b],g=this.vertices[e.c],h.sub(g.position,c.position),l.sub(b.position,c.position),h.crossSelf(l);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=
 Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
 THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),
-c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,b,c,d,e,f,v){h=a.vertices[b].position;j=a.vertices[c].position;l=a.vertices[d].position;i=g[e];k=g[f];n=g[v];m=j.x-h.x;o=l.x-h.x;p=j.y-h.y;s=l.y-h.y;I=j.z-h.z;y=l.z-h.z;G=k.u-i.u;u=n.u-i.u;t=k.v-i.v;B=n.v-i.v;w=1/(G*B-u*t);E.set((B*m-t*o)*w,(B*p-t*s)*w,(B*I-t*y)*w);A.set((G*o-u*m)*w,(G*s-u*p)*w,(G*y-u*I)*w);D[b].addSelf(E);D[c].addSelf(E);D[d].addSelf(E);x[b].addSelf(A);
-x[c].addSelf(A);x[d].addSelf(A)}var b,c,d,f,e,g,h,j,l,i,k,n,m,o,p,s,I,y,G,u,t,B,w,v,D=[],x=[],E=new THREE.Vector3,A=new THREE.Vector3,K=new THREE.Vector3,M=new THREE.Vector3,L=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)D[b]=new THREE.Vector3,x[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):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));var Q=["a","b",
-"c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)L.copy(e.vertexNormals[d]),f=e[Q[d]],v=D[f],K.copy(v),K.subSelf(L.multiplyScalar(L.dot(v))).normalize(),M.cross(e.vertexNormals[d],v),f=M.dot(x[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(K.x,K.y,K.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
+c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,b,c,d,e,f,B){h=a.vertices[b].position;l=a.vertices[c].position;k=a.vertices[d].position;i=g[e];j=g[f];n=g[B];m=l.x-h.x;o=k.x-h.x;p=l.y-h.y;t=k.y-h.y;I=l.z-h.z;w=k.z-h.z;E=j.u-i.u;s=n.u-i.u;u=j.v-i.v;D=n.v-i.v;z=1/(E*D-s*u);H.set((D*m-u*o)*z,(D*p-u*t)*z,(D*I-u*w)*z);y.set((E*o-s*m)*z,(E*t-s*p)*z,(E*w-s*I)*z);G[b].addSelf(H);G[c].addSelf(H);G[d].addSelf(H);x[b].addSelf(y);
+x[c].addSelf(y);x[d].addSelf(y)}var b,c,d,f,e,g,h,l,k,i,j,n,m,o,p,t,I,w,E,s,u,D,z,A,G=[],x=[],H=new THREE.Vector3,y=new THREE.Vector3,J=new THREE.Vector3,L=new THREE.Vector3,M=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,x[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):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));var Q=["a","b",
+"c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++)M.copy(e.vertexNormals[d]),f=e[Q[d]],A=G[f],J.copy(A),J.subSelf(M.multiplyScalar(M.dot(A))).normalize(),L.cross(e.vertexNormals[d],A),f=L.dot(x[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(J.x,J.y,J.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g;e=0;for(g=this.vertices.length;e<g;e++)d=this.vertices[e].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=e,b.push(this.vertices[e]),
 c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
@@ -123,18 +123,18 @@ THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.ce
 THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.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);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,j;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),j=c.dot(i),j<=0||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),j=c.dot(D.sub(i,b).normalize()),j<=0||(j*=g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,1),j!=0&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function b(a){x[a]==null&&(x[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),L==0&&x[a].setAttribute("shape-rendering","crispEdges"));return x[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,f,e,g,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,i,k,n,m,o,p,s,I=new THREE.Rectangle,y=new THREE.Rectangle,G=!1,u=new THREE.Color,t=new THREE.Color,B=new THREE.Color,w=new THREE.Color,v,D=new THREE.Vector3,x=[],E=[],A,K,M,L=1;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
-faces:0}};this.setQuality=function(a){switch(a){case "high":L=1;break;case "low":L=0}};this.setSize=function(a,b){l=a;i=b;k=l/2;n=i/2;j.setAttribute("viewBox",-k+" "+-n+" "+l+" "+i);j.setAttribute("width",l);j.setAttribute("height",i);I.set(-k,-n,k,n)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(i,l){var x,D,r,q;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;f=h.projectScene(i,l,this.sortElements);e=f.elements;
-g=f.lights;M=K=0;if(G=g.length>0){t.setRGB(0,0,0);B.setRGB(0,0,0);w.setRGB(0,0,0);x=0;for(D=g.length;x<D;x++)q=g[x],r=q.color,q instanceof THREE.AmbientLight?(t.r+=r.r,t.g+=r.g,t.b+=r.b):q instanceof THREE.DirectionalLight?(B.r+=r.r,B.g+=r.g,B.b+=r.b):q instanceof THREE.PointLight&&(w.r+=r.r,w.g+=r.g,w.b+=r.b)}x=0;for(D=e.length;x<D;x++)if(r=e[x],q=r.material,q=q instanceof THREE.MeshFaceMaterial?r.faceMaterial:q,!(q==null||q.opacity==0))if(y.empty(),r instanceof THREE.RenderableParticle)m=r,m.x*=
-k,m.y*=-n;else if(r instanceof THREE.RenderableLine){if(m=r.v1,o=r.v2,m.positionScreen.x*=k,m.positionScreen.y*=-n,o.positionScreen.x*=k,o.positionScreen.y*=-n,y.addPoint(m.positionScreen.x,m.positionScreen.y),y.addPoint(o.positionScreen.x,o.positionScreen.y),I.intersects(y)){r=m;var z=o,C=M++;E[C]==null&&(E[C]=document.createElementNS("http://www.w3.org/2000/svg","line"),L==0&&E[C].setAttribute("shape-rendering","crispEdges"));A=E[C];A.setAttribute("x1",r.positionScreen.x);A.setAttribute("y1",r.positionScreen.y);
-A.setAttribute("x2",z.positionScreen.x);A.setAttribute("y2",z.positionScreen.y);q instanceof THREE.LineBasicMaterial&&(A.setAttribute("style","fill: none; stroke: "+q.color.getContextStyle()+"; stroke-width: "+q.linewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.linecap+"; stroke-linejoin: "+q.linejoin),j.appendChild(A))}}else if(r instanceof THREE.RenderableFace3){if(m=r.v1,o=r.v2,p=r.v3,m.positionScreen.x*=k,m.positionScreen.y*=-n,o.positionScreen.x*=k,o.positionScreen.y*=-n,p.positionScreen.x*=
-k,p.positionScreen.y*=-n,y.addPoint(m.positionScreen.x,m.positionScreen.y),y.addPoint(o.positionScreen.x,o.positionScreen.y),y.addPoint(p.positionScreen.x,p.positionScreen.y),I.intersects(y)){var z=m,C=o,F=p;d.info.render.vertices+=3;d.info.render.faces++;A=b(K++);A.setAttribute("d","M "+z.positionScreen.x+" "+z.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+"z");q instanceof THREE.MeshBasicMaterial?u.copy(q.color):q instanceof THREE.MeshLambertMaterial?
-G?(u.r=t.r,u.g=t.g,u.b=t.b,a(g,r.centroidWorld,r.normalWorld,u),u.r=Math.max(0,Math.min(q.color.r*u.r,1)),u.g=Math.max(0,Math.min(q.color.g*u.g,1)),u.b=Math.max(0,Math.min(q.color.b*u.b,1))):u.copy(q.color):q instanceof THREE.MeshDepthMaterial?(v=1-q.__2near/(q.__farPlusNear-r.z*q.__farMinusNear),u.setRGB(v,v,v)):q instanceof THREE.MeshNormalMaterial&&u.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));q.wireframe?A.setAttribute("style","fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+
-q.wireframeLinewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframeLinecap+"; stroke-linejoin: "+q.wireframeLinejoin):A.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+q.opacity);j.appendChild(A)}}else if(r instanceof THREE.RenderableFace4&&(m=r.v1,o=r.v2,p=r.v3,s=r.v4,m.positionScreen.x*=k,m.positionScreen.y*=-n,o.positionScreen.x*=k,o.positionScreen.y*=-n,p.positionScreen.x*=k,p.positionScreen.y*=-n,s.positionScreen.x*=k,s.positionScreen.y*=-n,y.addPoint(m.positionScreen.x,
-m.positionScreen.y),y.addPoint(o.positionScreen.x,o.positionScreen.y),y.addPoint(p.positionScreen.x,p.positionScreen.y),y.addPoint(s.positionScreen.x,s.positionScreen.y),I.intersects(y))){var z=m,C=o,F=p,J=s;d.info.render.vertices+=4;d.info.render.faces++;A=b(K++);A.setAttribute("d","M "+z.positionScreen.x+" "+z.positionScreen.y+" L "+C.positionScreen.x+" "+C.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+" L "+J.positionScreen.x+","+J.positionScreen.y+"z");q instanceof THREE.MeshBasicMaterial?
-u.copy(q.color):q instanceof THREE.MeshLambertMaterial?G?(u.r=t.r,u.g=t.g,u.b=t.b,a(g,r.centroidWorld,r.normalWorld,u),u.r=Math.max(0,Math.min(q.color.r*u.r,1)),u.g=Math.max(0,Math.min(q.color.g*u.g,1)),u.b=Math.max(0,Math.min(q.color.b*u.b,1))):u.copy(q.color):q instanceof THREE.MeshDepthMaterial?(v=1-q.__2near/(q.__farPlusNear-r.z*q.__farMinusNear),u.setRGB(v,v,v)):q instanceof THREE.MeshNormalMaterial&&u.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));q.wireframe?A.setAttribute("style",
-"fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+q.wireframeLinewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframeLinecap+"; stroke-linejoin: "+q.wireframeLinejoin):A.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+q.opacity);j.appendChild(A)}}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,j;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),j=c.dot(i),j<=0||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),j=c.dot(G.sub(i,b).normalize()),j<=0||(j*=g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,1),j!=0&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function b(a){x[a]==null&&(x[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),M==0&&x[a].setAttribute("shape-rendering","crispEdges"));return x[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,f,e,g,h=new THREE.Projector,l=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,i,j,n,m,o,p,t,I=new THREE.Rectangle,w=new THREE.Rectangle,E=!1,s=new THREE.Color,u=new THREE.Color,D=new THREE.Color,z=new THREE.Color,A,G=new THREE.Vector3,x=[],H=[],y,J,L,M=1;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
+faces:0}};this.setQuality=function(a){switch(a){case "high":M=1;break;case "low":M=0}};this.setSize=function(a,b){k=a;i=b;j=k/2;n=i/2;l.setAttribute("viewBox",-j+" "+-n+" "+k+" "+i);l.setAttribute("width",k);l.setAttribute("height",i);I.set(-j,-n,j,n)};this.clear=function(){for(;l.childNodes.length>0;)l.removeChild(l.childNodes[0])};this.render=function(i,k){var x,G,r,q;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;f=h.projectScene(i,k,this.sortElements);e=f.elements;
+g=f.lights;L=J=0;if(E=g.length>0){u.setRGB(0,0,0);D.setRGB(0,0,0);z.setRGB(0,0,0);x=0;for(G=g.length;x<G;x++)q=g[x],r=q.color,q instanceof THREE.AmbientLight?(u.r+=r.r,u.g+=r.g,u.b+=r.b):q instanceof THREE.DirectionalLight?(D.r+=r.r,D.g+=r.g,D.b+=r.b):q instanceof THREE.PointLight&&(z.r+=r.r,z.g+=r.g,z.b+=r.b)}x=0;for(G=e.length;x<G;x++)if(r=e[x],q=r.material,q=q instanceof THREE.MeshFaceMaterial?r.faceMaterial:q,!(q==null||q.opacity==0))if(w.empty(),r instanceof THREE.RenderableParticle)m=r,m.x*=
+j,m.y*=-n;else if(r instanceof THREE.RenderableLine){if(m=r.v1,o=r.v2,m.positionScreen.x*=j,m.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,w.addPoint(m.positionScreen.x,m.positionScreen.y),w.addPoint(o.positionScreen.x,o.positionScreen.y),I.intersects(w)){r=m;var v=o,B=L++;H[B]==null&&(H[B]=document.createElementNS("http://www.w3.org/2000/svg","line"),M==0&&H[B].setAttribute("shape-rendering","crispEdges"));y=H[B];y.setAttribute("x1",r.positionScreen.x);y.setAttribute("y1",r.positionScreen.y);
+y.setAttribute("x2",v.positionScreen.x);y.setAttribute("y2",v.positionScreen.y);q instanceof THREE.LineBasicMaterial&&(y.setAttribute("style","fill: none; stroke: "+q.color.getContextStyle()+"; stroke-width: "+q.linewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.linecap+"; stroke-linejoin: "+q.linejoin),l.appendChild(y))}}else if(r instanceof THREE.RenderableFace3){if(m=r.v1,o=r.v2,p=r.v3,m.positionScreen.x*=j,m.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,p.positionScreen.x*=
+j,p.positionScreen.y*=-n,w.addPoint(m.positionScreen.x,m.positionScreen.y),w.addPoint(o.positionScreen.x,o.positionScreen.y),w.addPoint(p.positionScreen.x,p.positionScreen.y),I.intersects(w)){var v=m,B=o,C=p;d.info.render.vertices+=3;d.info.render.faces++;y=b(J++);y.setAttribute("d","M "+v.positionScreen.x+" "+v.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+C.positionScreen.x+","+C.positionScreen.y+"z");q instanceof THREE.MeshBasicMaterial?s.copy(q.color):q instanceof THREE.MeshLambertMaterial?
+E?(s.r=u.r,s.g=u.g,s.b=u.b,a(g,r.centroidWorld,r.normalWorld,s),s.r=Math.max(0,Math.min(q.color.r*s.r,1)),s.g=Math.max(0,Math.min(q.color.g*s.g,1)),s.b=Math.max(0,Math.min(q.color.b*s.b,1))):s.copy(q.color):q instanceof THREE.MeshDepthMaterial?(A=1-q.__2near/(q.__farPlusNear-r.z*q.__farMinusNear),s.setRGB(A,A,A)):q instanceof THREE.MeshNormalMaterial&&s.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));q.wireframe?y.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+
+q.wireframeLinewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframeLinecap+"; stroke-linejoin: "+q.wireframeLinejoin):y.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+q.opacity);l.appendChild(y)}}else if(r instanceof THREE.RenderableFace4&&(m=r.v1,o=r.v2,p=r.v3,t=r.v4,m.positionScreen.x*=j,m.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,p.positionScreen.x*=j,p.positionScreen.y*=-n,t.positionScreen.x*=j,t.positionScreen.y*=-n,w.addPoint(m.positionScreen.x,
+m.positionScreen.y),w.addPoint(o.positionScreen.x,o.positionScreen.y),w.addPoint(p.positionScreen.x,p.positionScreen.y),w.addPoint(t.positionScreen.x,t.positionScreen.y),I.intersects(w))){var v=m,B=o,C=p,K=t;d.info.render.vertices+=4;d.info.render.faces++;y=b(J++);y.setAttribute("d","M "+v.positionScreen.x+" "+v.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+C.positionScreen.x+","+C.positionScreen.y+" L "+K.positionScreen.x+","+K.positionScreen.y+"z");q instanceof THREE.MeshBasicMaterial?
+s.copy(q.color):q instanceof THREE.MeshLambertMaterial?E?(s.r=u.r,s.g=u.g,s.b=u.b,a(g,r.centroidWorld,r.normalWorld,s),s.r=Math.max(0,Math.min(q.color.r*s.r,1)),s.g=Math.max(0,Math.min(q.color.g*s.g,1)),s.b=Math.max(0,Math.min(q.color.b*s.b,1))):s.copy(q.color):q instanceof THREE.MeshDepthMaterial?(A=1-q.__2near/(q.__farPlusNear-r.z*q.__farMinusNear),s.setRGB(A,A,A)):q instanceof THREE.MeshNormalMaterial&&s.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));q.wireframe?y.setAttribute("style",
+"fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+q.wireframeLinewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframeLinecap+"; stroke-linejoin: "+q.wireframeLinejoin):y.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+q.opacity);l.appendChild(y)}}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};
 THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};

+ 171 - 171
build/custom/ThreeWebGL.js

@@ -13,84 +13,84 @@ cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y
 Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12/b,a.n11/b)):(this.x=0,this.z=Math.atan2(a.n21,a.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e!==void 0?e:1};
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
-normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){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;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(e,this.intersectObject(a[b]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function b(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function c(a,b,c,I){e.copy(I).subSelf(b);
-f.copy(c).subSelf(b);g.copy(a).subSelf(b);i=e.dot(e);h=e.dot(f);o=e.dot(g);p=f.dot(f);j=f.dot(g);r=1/(i*p-h*h);x=(p*o-h*j)*r;F=(i*j-h*o)*r;return x>=0&&F>=0&&x+F<1}for(var e=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,i,h,o,p,j,r,x,F,I,M=[],C=0,ma=a.children.length;C<ma;C++)Array.prototype.push.apply(M,this.intersectObject(a.children[C]));if(a instanceof THREE.Particle){C=b(this.origin,this.direction,a.matrixWorld.getPosition());if(C===null||C>a.scale.x)return[];I={distance:C,point:a.position,
-face:null,object:a};M.push(I)}else if(a instanceof THREE.Mesh){C=b(this.origin,this.direction,a.matrixWorld.getPosition());if(C===null||C>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return M;var X,ea,la,D,R,L,G,ha,J=a.geometry,S=J.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);C=0;for(ma=J.faces.length;C<ma;C++)if(I=J.faces[C],G=this.origin.clone(),ha=this.direction.clone(),D=a.matrixWorld,X=D.multiplyVector3(I.centroid.clone()).subSelf(G),L=X.dot(ha),
-!(L<=0)&&(X=D.multiplyVector3(S[I.a].position.clone()),ea=D.multiplyVector3(S[I.b].position.clone()),la=D.multiplyVector3(S[I.c].position.clone()),D=I instanceof THREE.Face4?D.multiplyVector3(S[I.d].position.clone()):null,R=a.matrixRotationWorld.multiplyVector3(I.normal.clone()),L=ha.dot(R),a.doubleSided||(a.flipSided?L>0:L<0)))if(L=R.dot((new THREE.Vector3).sub(X,G))/L,G=G.addSelf(ha.multiplyScalar(L)),I instanceof THREE.Face3)c(G,X,ea,la)&&(I={distance:this.origin.distanceTo(G),point:G,face:I,object:a},
-M.push(I));else if(I instanceof THREE.Face4&&(c(G,X,ea,D)||c(G,ea,la,D)))I={distance:this.origin.distanceTo(G),point:G,face:I,object:a},M.push(I)}return M}};
-THREE.Rectangle=function(){function a(){g=e-b;i=f-c}var b,c,e,f,g,i,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(g,i,j,r){h=!1;b=g;c=i;e=j;f=r;a()};this.addPoint=function(g,i){h?(h=!1,b=g,c=i,e=g,f=i):(b=b<g?b:g,c=c<i?c:i,e=e>g?e:g,f=f>i?f:i);a()};this.add3Points=
-function(g,i,j,r,x,F){h?(h=!1,b=g<j?g<x?g:x:j<x?j:x,c=i<r?i<F?i:F:r<F?r:F,e=g>j?g>x?g:x:j>x?j:x,f=i>r?i>F?i:F:r>F?r:F):(b=g<j?g<x?g<b?g:b:x<b?x:b:j<x?j<b?j:b:x<b?x:b,c=i<r?i<F?i<c?i:c:F<c?F:c:r<F?r<c?r:c:F<c?F:c,e=g>j?g>x?g>e?g:e:x>e?x:e:j>x?j>e?j:e:x>e?x:e,f=i>r?i>F?i>f?i:f:F>f?F:f:r>F?r>f?r:f:F>f?F:f);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),e=g.getRight(),f=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),e=e>g.getRight()?e:g.getRight(),f=f>
+normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){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;return this}};
+THREE.Ray=function(a,b){function c(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function e(a,b,c,e){p.copy(e).subSelf(b);i.copy(c).subSelf(b);o.copy(a).subSelf(b);u=p.dot(p);C=p.dot(i);I=p.dot(o);J=i.dot(i);E=i.dot(o);pa=1/(u*J-C*C);O=(J*I-C*E)*pa;ha=(u*E-C*I)*pa;return O>=0&&ha>=0&&O+ha<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};
+this.intersectObjects=function(a){var b,c,e=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(e,this.intersectObject(a[b]));e.sort(function(a,b){return a.distance-b.distance});return e};var f=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,r=new THREE.Vector3;this.intersectObject=function(a){for(var b,p=[],i=0,C=a.children.length;i<C;i++)Array.prototype.push.apply(p,this.intersectObject(a.children[i]));if(a instanceof THREE.Particle){i=
+c(this.origin,this.direction,a.matrixWorld.getPosition());if(i===null||i>a.scale.x)return[];b={distance:i,point:a.position,face:null,object:a};p.push(b)}else if(a instanceof THREE.Mesh){i=c(this.origin,this.direction,a.matrixWorld.getPosition());if(i===null||i>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return p;var o,I,u,J,M=a.geometry,sa=M.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);i=0;for(C=M.faces.length;i<C;i++)if(b=M.faces[i],u=this.origin.clone(),
+J=this.direction.clone(),I=a.matrixWorld,o=I.multiplyVector3(b.centroid.clone()).subSelf(u),o=o.dot(J),!(o<=0)&&(f=I.multiplyVector3(f.copy(sa[b.a].position)),g=I.multiplyVector3(g.copy(sa[b.b].position)),j=I.multiplyVector3(j.copy(sa[b.c].position)),h=b instanceof THREE.Face4?I.multiplyVector3(h.copy(sa[b.d].position)):null,r=a.matrixRotationWorld.multiplyVector3(r.copy(b.normal)),o=J.dot(r),a.doubleSided||(a.flipSided?o>0:o<0)))if(I=r.dot((new THREE.Vector3).sub(f,u))/o,u=u.addSelf(J.multiplyScalar(I)),
+b instanceof THREE.Face3)e(u,f,g,j)&&(b={distance:this.origin.distanceTo(u),point:u,face:b,object:a},p.push(b));else if(b instanceof THREE.Face4&&(e(u,f,g,h)||e(u,g,j,h)))b={distance:this.origin.distanceTo(u),point:u,face:b,object:a},p.push(b)}return p};var p=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Vector3,u,C,I,J,E,pa,O,ha};
+THREE.Rectangle=function(){function a(){g=e-b;j=f-c}var b,c,e,f,g,j,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return j};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(g,j,i,o){h=!1;b=g;c=j;e=i;f=o;a()};this.addPoint=function(g,j){h?(h=!1,b=g,c=j,e=g,f=j):(b=b<g?b:g,c=c<j?c:j,e=e>g?e:g,f=f>j?f:j);a()};this.add3Points=
+function(g,j,i,o,u,C){h?(h=!1,b=g<i?g<u?g:u:i<u?i:u,c=j<o?j<C?j:C:o<C?o:C,e=g>i?g>u?g:u:i>u?i:u,f=j>o?j>C?j:C:o>C?o:C):(b=g<i?g<u?g<b?g:b:u<b?u:b:i<u?i<b?i:b:u<b?u:b,c=j<o?j<C?j<c?j:c:C<c?C:c:o<C?o<c?o:c:C<c?C:c,e=g>i?g>u?g>e?g:e:u>e?u:e:i>u?i>e?i:e:u>e?u:e,f=j>o?j>C?j>f?j:f:C>f?C:f:o>C?o>f?o:f:C>f?C:f);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),e=g.getRight(),f=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),e=e>g.getRight()?e:g.getRight(),f=f>
 g.getBottom()?f:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;e+=g;f+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();e=e<g.getRight()?e:g.getRight();f=f<g.getBottom()?f:g.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;f=e=c=b=0;a()};this.isEmpty=function(){return h}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,e,f){return e+(a-b)*(f-e)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,e,f,g,i,h,o,p,j,r,x,F,I,M){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,g!==void 0?g:1,i||0,h||0,o||0,p||0,j!==void 0?j:1,r||0,x||0,F||0,I||0,M!==void 0?M:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,g,i,h,o,p,j,r,x,F,I,M){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=g;this.n23=i;this.n24=h;this.n31=o;this.n32=p;this.n33=j;this.n34=r;this.n41=x;this.n42=F;this.n43=I;this.n44=M;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();e.length()===0&&(g.x+=1.0E-4,e.cross(c,g).normalize());f.cross(g,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=g.x;this.n21=e.y;this.n22=f.y;this.n23=g.y;this.n31=e.z;this.n32=f.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,g=a.n14,i=a.n21,h=a.n22,o=a.n23,p=a.n24,j=a.n31,r=a.n32,x=a.n33,F=a.n34,I=a.n41,M=a.n42,C=a.n43,
-ma=a.n44,X=b.n11,ea=b.n12,la=b.n13,D=b.n14,R=b.n21,L=b.n22,G=b.n23,ha=b.n24,J=b.n31,S=b.n32,sa=b.n33,ia=b.n34,ka=b.n41,ta=b.n42,va=b.n43,ya=b.n44;this.n11=c*X+e*R+f*J+g*ka;this.n12=c*ea+e*L+f*S+g*ta;this.n13=c*la+e*G+f*sa+g*va;this.n14=c*D+e*ha+f*ia+g*ya;this.n21=i*X+h*R+o*J+p*ka;this.n22=i*ea+h*L+o*S+p*ta;this.n23=i*la+h*G+o*sa+p*va;this.n24=i*D+h*ha+o*ia+p*ya;this.n31=j*X+r*R+x*J+F*ka;this.n32=j*ea+r*L+x*S+F*ta;this.n33=j*la+r*G+x*sa+F*va;this.n34=j*D+r*ha+x*ia+F*ya;this.n41=I*X+M*R+C*J+ma*ka;this.n42=
-I*ea+M*L+C*S+ma*ta;this.n43=I*la+M*G+C*sa+ma*va;this.n44=I*D+M*ha+C*ia+ma*ya;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},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},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*
-c+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*
-a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,g=this.n22,i=this.n23,h=this.n24,o=this.n31,p=this.n32,j=this.n33,r=this.n34,x=this.n41,F=this.n42,I=this.n43,M=this.n44;return e*i*p*x-c*h*p*x-e*g*j*x+b*h*j*x+c*g*r*x-b*i*r*x-e*i*o*F+c*h*o*F+e*f*j*F-a*h*j*F-c*f*r*F+a*i*r*F+e*g*o*I-b*h*o*I-e*f*p*I+a*h*p*I+b*f*r*I-a*g*r*I-c*
-g*o*M+b*i*o*M+c*f*p*M-a*i*p*M-b*f*j*M+a*g*j*M},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,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,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 c=Math.cos(b),e=Math.sin(b),f=1-c,g=a.x,i=a.y,h=a.z,o=f*g,p=f*i;this.set(o*g+c,o*i-e*h,o*h+e*i,0,o*i+e*h,p*i+c,p*h-e*g,0,o*h-e*i,p*h+e*g,f*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,
-this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,o=a.n24,p=a.n31,j=a.n32,r=a.n33,x=a.n34,F=a.n41,I=a.n42,M=a.n43,C=a.n44;this.n11=h*x*I-o*r*I+o*j*M-i*x*M-h*j*C+i*r*C;this.n12=f*r*I-e*x*I-f*j*M+c*x*M+e*j*C-c*r*C;this.n13=e*o*I-f*h*I+f*i*M-c*o*M-e*i*C+c*h*C;this.n14=f*h*j-e*o*j-f*i*r+c*o*r+e*i*x-
-c*h*x;this.n21=o*r*F-h*x*F-o*p*M+g*x*M+h*p*C-g*r*C;this.n22=e*x*F-f*r*F+f*p*M-b*x*M-e*p*C+b*r*C;this.n23=f*h*F-e*o*F-f*g*M+b*o*M+e*g*C-b*h*C;this.n24=e*o*p-f*h*p+f*g*r-b*o*r-e*g*x+b*h*x;this.n31=i*x*F-o*j*F+o*p*I-g*x*I-i*p*C+g*j*C;this.n32=f*j*F-c*x*F-f*p*I+b*x*I+c*p*C-b*j*C;this.n33=e*o*F-f*i*F+f*g*I-b*o*I-c*g*C+b*i*C;this.n34=f*i*p-c*o*p-f*g*j+b*o*j+c*g*x-b*i*x;this.n41=h*j*F-i*r*F-h*p*I+g*r*I+i*p*M-g*j*M;this.n42=c*r*F-e*j*F+e*p*I-b*r*I-c*p*M+b*j*M;this.n43=e*i*F-c*h*F-e*g*I+b*h*I+c*g*M-b*i*M;
-this.n44=c*h*p-e*i*p+e*g*j-b*h*j-c*g*r+b*i*r;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,e=a.y,f=a.z,g=Math.cos(c),c=Math.sin(c),i=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var o=i*h,p=i*f,j=e*h,r=e*f;this.n11=o+r*c;this.n12=j*c-p;this.n13=g*e;this.n21=g*f;this.n22=g*h;this.n23=-c;this.n31=p*c-j;this.n32=r+o*c;this.n33=g*i;break;case "ZXY":o=i*h;p=i*f;j=e*h;r=e*f;this.n11=o-r*c;this.n12=-g*f;this.n13=j+p*c;this.n21=
-p+j*c;this.n22=g*h;this.n23=r-o*c;this.n31=-g*e;this.n32=c;this.n33=g*i;break;case "ZYX":o=g*h;p=g*f;j=c*h;r=c*f;this.n11=i*h;this.n12=j*e-p;this.n13=o*e+r;this.n21=i*f;this.n22=r*e+o;this.n23=p*e-j;this.n31=-e;this.n32=c*i;this.n33=g*i;break;case "YZX":o=g*i;p=g*e;j=c*i;r=c*e;this.n11=i*h;this.n12=r-o*f;this.n13=j*f+p;this.n21=f;this.n22=g*h;this.n23=-c*h;this.n31=-e*h;this.n32=p*f+j;this.n33=o-r*f;break;case "XZY":o=g*i;p=g*e;j=c*i;r=c*e;this.n11=i*h;this.n12=-f;this.n13=e*h;this.n21=o*f+r;this.n22=
-g*h;this.n23=p*f-j;this.n31=j*f-p;this.n32=c*h;this.n33=r*f+o;break;default:o=g*h,p=g*f,j=c*h,r=c*f,this.n11=i*h,this.n12=-i*f,this.n13=e,this.n21=p+j*e,this.n22=o-r*e,this.n23=-c*i,this.n31=r-o*e,this.n32=j+p*e,this.n33=g*i}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,e=a.z,f=a.w,g=b+b,i=c+c,h=e+e,a=b*g,o=b*i;b*=h;var p=c*i;c*=h;e*=h;g*=f;i*=f;f*=h;this.n11=1-(p+e);this.n12=o-f;this.n13=b+i;this.n21=o+f;this.n22=1-(a+e);this.n23=c-g;this.n31=b-i;this.n32=c+g;this.n33=1-(a+p);
-return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(e,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;
-e.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);g.set(this.n13,this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=e.length();c.y=f.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=c.x;e.n21/=c.x;e.n31/=c.x;e.n12/=c.y;e.n22/=c.y;e.n32/=c.y;e.n13/=c.z;e.n23/=c.z;e.n33/=c.z;b.setFromRotationMatrix(e);return[a,
-b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),e=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this}};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,o=-a.n32*a.n11+a.n31*a.n12,p=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,r=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*i+a.n31*p;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*g;c[3]=a*i;c[4]=a*h;c[5]=a*o;c[6]=a*p;c[7]=a*j;c[8]=a*r;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,e,f,g){var i;i=new THREE.Matrix4;i.n11=2*f/(b-a);i.n12=0;i.n13=(b+a)/(b-a);i.n14=0;i.n21=0;i.n22=2*f/(e-c);i.n23=(e+c)/(e-c);i.n24=0;i.n31=0;i.n32=0;i.n33=-(g+f)/(g-f);i.n34=-2*g*f/(g-f);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(a,b,c,e){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)};
-THREE.Matrix4.makeOrtho=function(a,b,c,e,f,g){var i,h,o,p;i=new THREE.Matrix4;h=b-a;o=c-e;p=g-f;i.n11=2/h;i.n12=0;i.n13=0;i.n14=-((b+a)/h);i.n21=0;i.n22=2/o;i.n23=0;i.n24=-((c+e)/o);i.n31=0;i.n32=0;i.n33=-2/p;i.n34=-((g+f)/p);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4=function(a,b,c,e,f,g,j,h,r,p,i,o,u,C,I,J){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,g!==void 0?g:1,j||0,h||0,r||0,p||0,i!==void 0?i:1,o||0,u||0,C||0,I||0,J!==void 0?J:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,g,j,h,r,p,i,o,u,C,I,J){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=g;this.n23=j;this.n24=h;this.n31=r;this.n32=p;this.n33=i;this.n34=o;this.n41=u;this.n42=C;this.n43=I;this.n44=J;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();e.length()===0&&(g.x+=1.0E-4,e.cross(c,g).normalize());f.cross(g,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=g.x;this.n21=e.y;this.n22=f.y;this.n23=g.y;this.n31=e.z;this.n32=f.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,g=a.n14,j=a.n21,h=a.n22,r=a.n23,p=a.n24,i=a.n31,o=a.n32,u=a.n33,C=a.n34,I=a.n41,J=a.n42,E=a.n43,
+pa=a.n44,O=b.n11,ha=b.n12,la=b.n13,F=b.n14,ia=b.n21,K=b.n22,L=b.n23,qa=b.n24,X=b.n31,ra=b.n32,na=b.n33,M=b.n34,sa=b.n41,va=b.n42,xa=b.n43,Aa=b.n44;this.n11=c*O+e*ia+f*X+g*sa;this.n12=c*ha+e*K+f*ra+g*va;this.n13=c*la+e*L+f*na+g*xa;this.n14=c*F+e*qa+f*M+g*Aa;this.n21=j*O+h*ia+r*X+p*sa;this.n22=j*ha+h*K+r*ra+p*va;this.n23=j*la+h*L+r*na+p*xa;this.n24=j*F+h*qa+r*M+p*Aa;this.n31=i*O+o*ia+u*X+C*sa;this.n32=i*ha+o*K+u*ra+C*va;this.n33=i*la+o*L+u*na+C*xa;this.n34=i*F+o*qa+u*M+C*Aa;this.n41=I*O+J*ia+E*X+pa*
+sa;this.n42=I*ha+J*K+E*ra+pa*va;this.n43=I*la+J*L+E*na+pa*xa;this.n44=I*F+J*qa+E*M+pa*Aa;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},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},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*
+b+this.n12*c+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+
+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,g=this.n22,j=this.n23,h=this.n24,r=this.n31,p=this.n32,i=this.n33,o=this.n34,u=this.n41,C=this.n42,I=this.n43,J=this.n44;return e*j*p*u-c*h*p*u-e*g*i*u+b*h*i*u+c*g*o*u-b*j*o*u-e*j*r*C+c*h*r*C+e*f*i*C-a*h*i*C-c*f*o*C+a*j*o*C+e*g*r*I-b*h*r*I-e*f*p*I+a*h*p*I+b*f*o*I-a*
+g*o*I-c*g*r*J+b*j*r*J+c*f*p*J-a*j*p*J-b*f*i*J+a*g*i*J},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,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,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 c=Math.cos(b),e=Math.sin(b),f=1-c,g=a.x,j=a.y,h=a.z,r=f*g,p=f*j;this.set(r*g+c,r*j-e*h,r*h+e*j,0,r*j+e*h,p*j+c,p*h-e*g,0,r*h-e*j,p*h+e*g,f*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,
+this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,e=a.n13,f=a.n14,g=a.n21,j=a.n22,h=a.n23,r=a.n24,p=a.n31,i=a.n32,o=a.n33,u=a.n34,C=a.n41,I=a.n42,J=a.n43,E=a.n44;this.n11=h*u*I-r*o*I+r*i*J-j*u*J-h*i*E+j*o*E;this.n12=f*o*I-e*u*I-f*i*J+c*u*J+e*i*E-c*o*E;this.n13=e*r*I-f*h*I+f*j*J-c*r*J-e*j*E+c*h*E;this.n14=f*h*i-e*r*i-f*j*o+c*
+r*o+e*j*u-c*h*u;this.n21=r*o*C-h*u*C-r*p*J+g*u*J+h*p*E-g*o*E;this.n22=e*u*C-f*o*C+f*p*J-b*u*J-e*p*E+b*o*E;this.n23=f*h*C-e*r*C-f*g*J+b*r*J+e*g*E-b*h*E;this.n24=e*r*p-f*h*p+f*g*o-b*r*o-e*g*u+b*h*u;this.n31=j*u*C-r*i*C+r*p*I-g*u*I-j*p*E+g*i*E;this.n32=f*i*C-c*u*C-f*p*I+b*u*I+c*p*E-b*i*E;this.n33=e*r*C-f*j*C+f*g*I-b*r*I-c*g*E+b*j*E;this.n34=f*j*p-c*r*p-f*g*i+b*r*i+c*g*u-b*j*u;this.n41=h*i*C-j*o*C-h*p*I+g*o*I+j*p*J-g*i*J;this.n42=c*o*C-e*i*C+e*p*I-b*o*I-c*p*J+b*i*J;this.n43=e*j*C-c*h*C-e*g*I+b*h*I+c*
+g*J-b*j*J;this.n44=c*h*p-e*j*p+e*g*i-b*h*i-c*g*o+b*j*o;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,e=a.y,f=a.z,g=Math.cos(c),c=Math.sin(c),j=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var r=j*h,p=j*f,i=e*h,o=e*f;this.n11=r+o*c;this.n12=i*c-p;this.n13=g*e;this.n21=g*f;this.n22=g*h;this.n23=-c;this.n31=p*c-i;this.n32=o+r*c;this.n33=g*j;break;case "ZXY":r=j*h;p=j*f;i=e*h;o=e*f;this.n11=r-o*c;this.n12=-g*f;this.n13=i+
+p*c;this.n21=p+i*c;this.n22=g*h;this.n23=o-r*c;this.n31=-g*e;this.n32=c;this.n33=g*j;break;case "ZYX":r=g*h;p=g*f;i=c*h;o=c*f;this.n11=j*h;this.n12=i*e-p;this.n13=r*e+o;this.n21=j*f;this.n22=o*e+r;this.n23=p*e-i;this.n31=-e;this.n32=c*j;this.n33=g*j;break;case "YZX":r=g*j;p=g*e;i=c*j;o=c*e;this.n11=j*h;this.n12=o-r*f;this.n13=i*f+p;this.n21=f;this.n22=g*h;this.n23=-c*h;this.n31=-e*h;this.n32=p*f+i;this.n33=r-o*f;break;case "XZY":r=g*j;p=g*e;i=c*j;o=c*e;this.n11=j*h;this.n12=-f;this.n13=e*h;this.n21=
+r*f+o;this.n22=g*h;this.n23=p*f-i;this.n31=i*f-p;this.n32=c*h;this.n33=o*f+r;break;default:r=g*h,p=g*f,i=c*h,o=c*f,this.n11=j*h,this.n12=-j*f,this.n13=e,this.n21=p+i*e,this.n22=r-o*e,this.n23=-c*j,this.n31=o-r*e,this.n32=i+p*e,this.n33=g*j}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,e=a.z,f=a.w,g=b+b,j=c+c,h=e+e,a=b*g,r=b*j;b*=h;var p=c*j;c*=h;e*=h;g*=f;j*=f;f*=h;this.n11=1-(p+e);this.n12=r-f;this.n13=b+j;this.n21=r+f;this.n22=1-(a+e);this.n23=c-g;this.n31=b-j;this.n32=c+g;
+this.n33=1-(a+p);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(e,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,
+g=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);g.set(this.n13,this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=e.length();c.y=f.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=c.x;e.n21/=c.x;e.n31/=c.x;e.n12/=c.y;e.n22/=c.y;e.n32/=c.y;e.n13/=c.z;e.n23/=c.z;e.n33/=c.z;b.setFromRotationMatrix(e);
+return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),e=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this}};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,r=-a.n32*a.n11+a.n31*a.n12,p=a.n23*a.n12-a.n22*a.n13,i=-a.n23*a.n11+a.n21*a.n13,o=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*j+a.n31*p;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*g;c[3]=a*j;c[4]=a*h;c[5]=a*r;c[6]=a*p;c[7]=a*i;c[8]=a*o;return b};
+THREE.Matrix4.makeFrustum=function(a,b,c,e,f,g){var j;j=new THREE.Matrix4;j.n11=2*f/(b-a);j.n12=0;j.n13=(b+a)/(b-a);j.n14=0;j.n21=0;j.n22=2*f/(e-c);j.n23=(e+c)/(e-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(g+f)/(g-f);j.n34=-2*g*f/(g-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,b,c,e){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)};
+THREE.Matrix4.makeOrtho=function(a,b,c,e,f,g){var j,h,r,p;j=new THREE.Matrix4;h=b-a;r=c-e;p=g-f;j.n11=2/h;j.n12=0;j.n13=0;j.n14=-((b+a)/h);j.n21=0;j.n22=2/r;j.n23=0;j.n24=-((c+e)/r);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((g+f)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,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(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
 -1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeObject(a)}},getChildByName:function(a,b){var c,e,f;c=0;for(e=this.children.length;c<e;c++){f=this.children[c];if(f.name===a)return f;
 if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=i[g]=i[g]||new THREE.RenderableObject;g++;return a}function b(){var a=p[o]=p[o]||new THREE.RenderableVertex;o++;return a}function c(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,g=a.z+a.w,f=b.z+b.w,i=-a.z+a.w,h=-b.z+b.w;return g>=0&&f>=0&&i>=0&&h>=0?!0:g<0&&f<0||i<0&&h<0?!1:(g<0?c=Math.max(c,g/(g-f)):f<0&&(e=Math.min(e,g/(g-f))),i<0?c=Math.max(c,i/(i-h)):h<0&&(e=Math.min(e,i/(i-h))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var f,g,i=[],h,o,p=[],
-j,r,x=[],F,I=[],M,C,ma=[],X,ea,la=[],D={objects:[],sprites:[],lights:[],elements:[]},R=new THREE.Vector3,L=new THREE.Vector4,G=new THREE.Matrix4,ha=new THREE.Matrix4,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],S=new THREE.Vector4,sa=new THREE.Vector4;this.computeFrustum=function(a){J[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);J[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);J[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);J[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);J[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);J[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=J[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);G.multiply(b.projectionMatrix,b.matrixWorldInverse);G.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-G.multiply(b.matrixWorld,b.projectionMatrixInverse);G.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,e){g=0;D.objects.length=0;D.sprites.length=0;D.lights.length=0;var i=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var e=b.matrixWorld,
-g=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=J[h].x*e.n14+J[h].y*e.n24+J[h].z*e.n34+J[h].w,c<=g){c=!1;break a}c=!0}c?(G.multiplyVector3(R.copy(b.position)),f=a(),f.object=b,f.z=R.z,D.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(G.multiplyVector3(R.copy(b.position)),f=a(),f.object=b,f.z=R.z,D.sprites.push(f)):b instanceof THREE.Light&&D.lights.push(b);c=0;for(e=b.children.length;c<e;c++)i(b.children[c])}};i(b);e&&
-D.objects.sort(c);return D};this.projectScene=function(a,g,f){var i=g.near,R=g.far,J,V,N,ja,E,d,O,na,ga,oa,pa,Da,Ea,za,wa,ua;ea=C=F=r=0;D.elements.length=0;g.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(g));a.updateMatrixWorld();g.matrixWorldInverse.getInverse(g.matrixWorld);G.multiply(g.projectionMatrix,g.matrixWorldInverse);this.computeFrustum(G);D=this.projectGraph(a,!1);a=0;for(J=D.objects.length;a<J;a++)if(ga=D.objects[a].object,oa=ga.matrixWorld,
-Da=ga.material,o=0,ga instanceof THREE.Mesh){pa=ga.geometry;Ea=ga.geometry.materials;ja=pa.vertices;za=pa.faces;wa=pa.faceVertexUvs;pa=ga.matrixRotationWorld.extractRotation(oa);V=0;for(N=ja.length;V<N;V++)h=b(),h.positionWorld.copy(ja[V].position),oa.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),G.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>i&&h.positionScreen.z<R;ja=0;for(V=
-za.length;ja<V;ja++){N=za[ja];if(N instanceof THREE.Face3)if(E=p[N.a],d=p[N.b],O=p[N.c],E.visible&&d.visible&&O.visible&&(ga.doubleSided||ga.flipSided!=(O.positionScreen.x-E.positionScreen.x)*(d.positionScreen.y-E.positionScreen.y)-(O.positionScreen.y-E.positionScreen.y)*(d.positionScreen.x-E.positionScreen.x)<0))na=x[r]=x[r]||new THREE.RenderableFace3,r++,j=na,j.v1.copy(E),j.v2.copy(d),j.v3.copy(O);else continue;else if(N instanceof THREE.Face4)if(E=p[N.a],d=p[N.b],O=p[N.c],na=p[N.d],E.visible&&
-d.visible&&O.visible&&na.visible&&(ga.doubleSided||ga.flipSided!=((na.positionScreen.x-E.positionScreen.x)*(d.positionScreen.y-E.positionScreen.y)-(na.positionScreen.y-E.positionScreen.y)*(d.positionScreen.x-E.positionScreen.x)<0||(d.positionScreen.x-O.positionScreen.x)*(na.positionScreen.y-O.positionScreen.y)-(d.positionScreen.y-O.positionScreen.y)*(na.positionScreen.x-O.positionScreen.x)<0)))ua=I[F]=I[F]||new THREE.RenderableFace4,F++,j=ua,j.v1.copy(E),j.v2.copy(d),j.v3.copy(O),j.v4.copy(na);else continue;
-j.normalWorld.copy(N.normal);pa.multiplyVector3(j.normalWorld);j.centroidWorld.copy(N.centroid);oa.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);G.multiplyVector3(j.centroidScreen);O=N.vertexNormals;E=0;for(d=O.length;E<d;E++)na=j.vertexNormalsWorld[E],na.copy(O[E]),pa.multiplyVector3(na);E=0;for(d=wa.length;E<d;E++)if(ua=wa[E][ja]){O=0;for(na=ua.length;O<na;O++)j.uvs[E][O]=ua[O]}j.material=Da;j.faceMaterial=N.materialIndex!==null?Ea[N.materialIndex]:null;j.z=j.centroidScreen.z;
-D.elements.push(j)}}else if(ga instanceof THREE.Line){ha.multiply(G,oa);ja=ga.geometry.vertices;E=b();E.positionScreen.copy(ja[0].position);ha.multiplyVector4(E.positionScreen);V=1;for(N=ja.length;V<N;V++)if(E=b(),E.positionScreen.copy(ja[V].position),ha.multiplyVector4(E.positionScreen),d=p[o-2],S.copy(E.positionScreen),sa.copy(d.positionScreen),e(S,sa))S.multiplyScalar(1/S.w),sa.multiplyScalar(1/sa.w),ga=ma[C]=ma[C]||new THREE.RenderableLine,C++,M=ga,M.v1.positionScreen.copy(S),M.v2.positionScreen.copy(sa),
-M.z=Math.max(S.z,sa.z),M.material=Da,D.elements.push(M)}a=0;for(J=D.sprites.length;a<J;a++)if(ga=D.sprites[a].object,oa=ga.matrixWorld,ga instanceof THREE.Particle&&(L.set(oa.n14,oa.n24,oa.n34,1),G.multiplyVector4(L),L.z/=L.w,L.z>0&&L.z<1))i=la[ea]=la[ea]||new THREE.RenderableParticle,ea++,X=i,X.x=L.x/L.w,X.y=L.y/L.w,X.z=L.z,X.rotation=ga.rotation.z,X.scale.x=ga.scale.x*Math.abs(X.x-(L.x+g.projectionMatrix.n11)/(L.w+g.projectionMatrix.n14)),X.scale.y=ga.scale.y*Math.abs(X.y-(L.y+g.projectionMatrix.n22)/
-(L.w+g.projectionMatrix.n24)),X.material=ga.material,D.elements.push(X);f&&D.elements.sort(c);return D}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),g=Math.cos(c),c=Math.sin(c),i=a*b,h=e*f;this.w=i*g-h*c;this.x=i*c+h*g;this.y=e*b*g+a*f*c;this.z=a*f*g-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
+THREE.Projector=function(){function a(){var a=j[g]=j[g]||new THREE.RenderableObject;g++;return a}function b(){var a=p[r]=p[r]||new THREE.RenderableVertex;r++;return a}function c(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,g=a.z+a.w,f=b.z+b.w,j=-a.z+a.w,h=-b.z+b.w;return g>=0&&f>=0&&j>=0&&h>=0?!0:g<0&&f<0||j<0&&h<0?!1:(g<0?c=Math.max(c,g/(g-f)):f<0&&(e=Math.min(e,g/(g-f))),j<0?c=Math.max(c,j/(j-h)):h<0&&(e=Math.min(e,j/(j-h))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var f,g,j=[],h,r,p=[],
+i,o,u=[],C,I=[],J,E,pa=[],O,ha,la=[],F={objects:[],sprites:[],lights:[],elements:[]},ia=new THREE.Vector3,K=new THREE.Vector4,L=new THREE.Matrix4,qa=new THREE.Matrix4,X=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ra=new THREE.Vector4,na=new THREE.Vector4;this.computeFrustum=function(a){X[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);X[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);X[2].set(a.n41+a.n21,a.n42+a.n22,
+a.n43+a.n23,a.n44+a.n24);X[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);X[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);X[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=X[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);L.multiply(b.projectionMatrix,b.matrixWorldInverse);L.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+L.multiply(b.matrixWorld,b.projectionMatrixInverse);L.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,e){g=0;F.objects.length=0;F.sprites.length=0;F.lights.length=0;var j=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var e=b.matrixWorld,
+g=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=X[h].x*e.n14+X[h].y*e.n24+X[h].z*e.n34+X[h].w,c<=g){c=!1;break a}c=!0}c?(L.multiplyVector3(ia.copy(b.position)),f=a(),f.object=b,f.z=ia.z,F.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(L.multiplyVector3(ia.copy(b.position)),f=a(),f.object=b,f.z=ia.z,F.sprites.push(f)):b instanceof THREE.Light&&F.lights.push(b);c=0;for(e=b.children.length;c<e;c++)j(b.children[c])}};j(b);
+e&&F.objects.sort(c);return F};this.projectScene=function(a,g,f){var j=g.near,ia=g.far,X,P,R,ma,D,d,ba,ja,ga,oa,ta,Ea,Fa,Ba,ya,wa;ha=E=C=o=0;F.elements.length=0;g.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(g));a.updateMatrixWorld();g.matrixWorldInverse.getInverse(g.matrixWorld);L.multiply(g.projectionMatrix,g.matrixWorldInverse);this.computeFrustum(L);F=this.projectGraph(a,!1);a=0;for(X=F.objects.length;a<X;a++)if(ga=F.objects[a].object,oa=
+ga.matrixWorld,Ea=ga.material,r=0,ga instanceof THREE.Mesh){ta=ga.geometry;Fa=ga.geometry.materials;ma=ta.vertices;Ba=ta.faces;ya=ta.faceVertexUvs;ta=ga.matrixRotationWorld.extractRotation(oa);P=0;for(R=ma.length;P<R;P++)h=b(),h.positionWorld.copy(ma[P].position),oa.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),L.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>j&&h.positionScreen.z<
+ia;ma=0;for(P=Ba.length;ma<P;ma++){R=Ba[ma];if(R instanceof THREE.Face3)if(D=p[R.a],d=p[R.b],ba=p[R.c],D.visible&&d.visible&&ba.visible&&(ga.doubleSided||ga.flipSided!=(ba.positionScreen.x-D.positionScreen.x)*(d.positionScreen.y-D.positionScreen.y)-(ba.positionScreen.y-D.positionScreen.y)*(d.positionScreen.x-D.positionScreen.x)<0))ja=u[o]=u[o]||new THREE.RenderableFace3,o++,i=ja,i.v1.copy(D),i.v2.copy(d),i.v3.copy(ba);else continue;else if(R instanceof THREE.Face4)if(D=p[R.a],d=p[R.b],ba=p[R.c],ja=
+p[R.d],D.visible&&d.visible&&ba.visible&&ja.visible&&(ga.doubleSided||ga.flipSided!=((ja.positionScreen.x-D.positionScreen.x)*(d.positionScreen.y-D.positionScreen.y)-(ja.positionScreen.y-D.positionScreen.y)*(d.positionScreen.x-D.positionScreen.x)<0||(d.positionScreen.x-ba.positionScreen.x)*(ja.positionScreen.y-ba.positionScreen.y)-(d.positionScreen.y-ba.positionScreen.y)*(ja.positionScreen.x-ba.positionScreen.x)<0)))wa=I[C]=I[C]||new THREE.RenderableFace4,C++,i=wa,i.v1.copy(D),i.v2.copy(d),i.v3.copy(ba),
+i.v4.copy(ja);else continue;i.normalWorld.copy(R.normal);ta.multiplyVector3(i.normalWorld);i.centroidWorld.copy(R.centroid);oa.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);L.multiplyVector3(i.centroidScreen);ba=R.vertexNormals;D=0;for(d=ba.length;D<d;D++)ja=i.vertexNormalsWorld[D],ja.copy(ba[D]),ta.multiplyVector3(ja);D=0;for(d=ya.length;D<d;D++)if(wa=ya[D][ma]){ba=0;for(ja=wa.length;ba<ja;ba++)i.uvs[D][ba]=wa[ba]}i.material=Ea;i.faceMaterial=R.materialIndex!==null?Fa[R.materialIndex]:
+null;i.z=i.centroidScreen.z;F.elements.push(i)}}else if(ga instanceof THREE.Line){qa.multiply(L,oa);ma=ga.geometry.vertices;D=b();D.positionScreen.copy(ma[0].position);qa.multiplyVector4(D.positionScreen);P=1;for(R=ma.length;P<R;P++)if(D=b(),D.positionScreen.copy(ma[P].position),qa.multiplyVector4(D.positionScreen),d=p[r-2],ra.copy(D.positionScreen),na.copy(d.positionScreen),e(ra,na))ra.multiplyScalar(1/ra.w),na.multiplyScalar(1/na.w),ga=pa[E]=pa[E]||new THREE.RenderableLine,E++,J=ga,J.v1.positionScreen.copy(ra),
+J.v2.positionScreen.copy(na),J.z=Math.max(ra.z,na.z),J.material=Ea,F.elements.push(J)}a=0;for(X=F.sprites.length;a<X;a++)if(ga=F.sprites[a].object,oa=ga.matrixWorld,ga instanceof THREE.Particle&&(K.set(oa.n14,oa.n24,oa.n34,1),L.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))j=la[ha]=la[ha]||new THREE.RenderableParticle,ha++,O=j,O.x=K.x/K.w,O.y=K.y/K.w,O.z=K.z,O.rotation=ga.rotation.z,O.scale.x=ga.scale.x*Math.abs(O.x-(K.x+g.projectionMatrix.n11)/(K.w+g.projectionMatrix.n14)),O.scale.y=ga.scale.y*Math.abs(O.y-
+(K.y+g.projectionMatrix.n22)/(K.w+g.projectionMatrix.n24)),O.material=ga.material,F.elements.push(O);f&&F.elements.sort(c);return F}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),g=Math.cos(c),c=Math.sin(c),j=a*b,h=e*f;this.w=j*g-h*c;this.x=j*c+h*g;this.y=e*b*g+a*f*c;this.z=a*f*g-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
 this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();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);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
-this.x,c=this.y,e=this.z,f=this.w,g=a.x,i=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-e*i;this.y=c*a+f*i+e*g-b*h;this.z=e*a+f*h+b*i-c*g;this.w=f*a-b*g-c*i-e*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,g=this.x,i=this.y,h=this.z,o=this.w,p=o*c+i*f-h*e,j=o*e+h*c-g*f,r=o*f+g*e-i*c,c=-g*
-c-i*e-h*f;b.x=p*o+c*-g+j*-h-r*-i;b.y=j*o+c*-i+r*-g-p*-h;b.z=r*o+c*-h+p*-i-j*-g;return b}};
+this.x,c=this.y,e=this.z,f=this.w,g=a.x,j=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-e*j;this.y=c*a+f*j+e*g-b*h;this.z=e*a+f*h+b*j-c*g;this.w=f*a-b*g-c*j-e*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,g=this.x,j=this.y,h=this.z,r=this.w,p=r*c+j*f-h*e,i=r*e+h*c-g*f,o=r*f+g*e-j*c,c=-g*
+c-j*e-h*f;b.x=p*r+c*-g+i*-h-o*-j;b.y=i*r+c*-j+o*-g-p*-h;b.z=o*r+c*-h+p*-j-i*-g;return b}};
 THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return 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),c;b=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*b+c.w*e;c.x=a.x*b+c.x*e;c.y=a.y*b+c.y*e;c.z=a.z*b+c.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,f,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,b,c,e,f,g,i){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=i;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
+THREE.Face4=function(a,b,c,e,f,g,j){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=j;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
-THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,e=this.vertices.length;c<e;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(e=this.faces.length;c<e;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var g=0,i=f.vertexNormals.length;g<i;g++)b.multiplyVector3(f.vertexNormals[g]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
+THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,e=this.vertices.length;c<e;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(e=this.faces.length;c<e;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var g=0,j=f.vertexNormals.length;g<j;g++)b.multiplyVector3(f.vertexNormals[g]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
-c,e,f,g,i,h=new THREE.Vector3,o=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){g=this.faces[e];if(a&&g.vertexNormals.length){h.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)h.addSelf(g.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[g.a],c=this.vertices[g.b],i=this.vertices[g.c],h.sub(i.position,c.position),o.sub(b.position,c.position),h.crossSelf(o);h.isZero()||h.normalize();g.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
+c,e,f,g,j,h=new THREE.Vector3,r=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){g=this.faces[e];if(a&&g.vertexNormals.length){h.set(0,0,0);b=0;for(c=g.vertexNormals.length;b<c;b++)h.addSelf(g.vertexNormals[b]);h.divideScalar(3)}else b=this.vertices[g.a],c=this.vertices[g.b],j=this.vertices[g.c],h.sub(j.position,c.position),r.sub(b.position,c.position),h.crossSelf(r);h.isZero()||h.normalize();g.normal.copy(h)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){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++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
 THREE.Face3?(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal),e[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(e[c.a]),
-c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,b,c,e,g,f,d){h=a.vertices[b].position;o=a.vertices[c].position;p=a.vertices[e].position;j=i[g];r=i[f];x=i[d];F=o.x-h.x;I=p.x-h.x;M=o.y-h.y;C=p.y-h.y;ma=o.z-h.z;X=p.z-h.z;ea=r.u-j.u;la=x.u-j.u;D=r.v-j.v;R=x.v-j.v;L=1/(ea*R-la*D);S.set((R*F-D*I)*L,(R*M-D*C)*L,(R*ma-D*X)*L);sa.set((ea*I-la*F)*L,(ea*C-la*M)*L,(ea*X-la*ma)*L);ha[b].addSelf(S);ha[c].addSelf(S);ha[e].addSelf(S);
-J[b].addSelf(sa);J[c].addSelf(sa);J[e].addSelf(sa)}var b,c,e,f,g,i,h,o,p,j,r,x,F,I,M,C,ma,X,ea,la,D,R,L,G,ha=[],J=[],S=new THREE.Vector3,sa=new THREE.Vector3,ia=new THREE.Vector3,ka=new THREE.Vector3,ta=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)ha[b]=new THREE.Vector3,J[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],i=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,
-g.b,g.d,0,1,3));var va=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(e=0;e<g.vertexNormals.length;e++)ta.copy(g.vertexNormals[e]),f=g[va[e]],G=ha[f],ia.copy(G),ia.subSelf(ta.multiplyScalar(ta.dot(G))).normalize(),ka.cross(g.vertexNormals[e],G),f=ka.dot(J[f]),f=f<0?-1:1,g.vertexTangents[e]=new THREE.Vector4(ia.x,ia.y,ia.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
-y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<
-this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),g,i;g=0;for(i=this.vertices.length;g<i;g++)e=this.vertices[g].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),
-a[e]===void 0?(a[e]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[e]];g=0;for(i=this.faces.length;g<i;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,e,g,f,i){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*i+(-3*(b-c)-2*a-e)*f+a*g+b}this.points=a;var c=[],e={x:0,y:0,z:0},f,g,i,h,o,p,j,r,x;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;g=Math.floor(f);i=f-g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>this.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;p=this.points[c[0]];j=this.points[c[1]];
-r=this.points[c[2]];x=this.points[c[3]];h=i*i;o=i*h;e.x=b(p.x,j.x,r.x,x.x,i,h,o);e.y=b(p.y,j.y,r.y,x.y,i,h,o);e.z=b(p.z,j.z,r.z,x.z,i,h,o);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e,g=b=b=0,f=new THREE.Vector3,i=new THREE.Vector3,h=[],j=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,e=this.getPoint(b),i.copy(e),j+=i.distanceTo(f),
-f.copy(e),b*=this.points.length-1,b=Math.floor(b),b!=g&&(h[b]=j,g=b);h[h.length]=j;return{chunks:h,total:j}};this.reparametrizeByArcLength=function(a){var b,c,e,g,f,i,h=[],j=new THREE.Vector3,o=this.getLength();h.push(j.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=o.chunks[b]-o.chunks[b-1];i=Math.ceil(a*c/o.total);g=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<i-1;c++)e=g+c*(1/i)*(f-g),e=this.getPoint(e),h.push(j.copy(e).clone());h.push(j.copy(this.points[b]).clone())}this.points=
+c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,b,c,e,g,f,d){h=a.vertices[b].position;r=a.vertices[c].position;p=a.vertices[e].position;i=j[g];o=j[f];u=j[d];C=r.x-h.x;I=p.x-h.x;J=r.y-h.y;E=p.y-h.y;pa=r.z-h.z;O=p.z-h.z;ha=o.u-i.u;la=u.u-i.u;F=o.v-i.v;ia=u.v-i.v;K=1/(ha*ia-la*F);ra.set((ia*C-F*I)*K,(ia*J-F*E)*K,(ia*pa-F*O)*K);na.set((ha*I-la*C)*K,(ha*E-la*J)*K,(ha*O-la*pa)*K);qa[b].addSelf(ra);qa[c].addSelf(ra);
+qa[e].addSelf(ra);X[b].addSelf(na);X[c].addSelf(na);X[e].addSelf(na)}var b,c,e,f,g,j,h,r,p,i,o,u,C,I,J,E,pa,O,ha,la,F,ia,K,L,qa=[],X=[],ra=new THREE.Vector3,na=new THREE.Vector3,M=new THREE.Vector3,sa=new THREE.Vector3,va=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)qa[b]=new THREE.Vector3,X[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],j=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,
+0,1,2),a(this,g.a,g.b,g.d,0,1,3));var xa=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(e=0;e<g.vertexNormals.length;e++)va.copy(g.vertexNormals[e]),f=g[xa[e]],L=qa[f],M.copy(L),M.subSelf(va.multiplyScalar(va.dot(L))).normalize(),sa.cross(g.vertexNormals[e],L),f=sa.dot(X[f]),f=f<0?-1:1,g.vertexTangents[e]=new THREE.Vector4(M.x,M.y,M.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,
+this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=
+a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),g,j;g=0;for(j=this.vertices.length;g<j;g++)e=this.vertices[g].position,e=[Math.round(e.x*f),Math.round(e.y*f),
+Math.round(e.z*f)].join("_"),a[e]===void 0?(a[e]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[e]];g=0;for(j=this.faces.length;g<j;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
+THREE.Spline=function(a){function b(a,b,c,e,g,f,j){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*j+(-3*(b-c)-2*a-e)*f+a*g+b}this.points=a;var c=[],e={x:0,y:0,z:0},f,g,j,h,r,p,i,o,u;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;g=Math.floor(f);j=f-g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>this.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;p=this.points[c[0]];i=this.points[c[1]];
+o=this.points[c[2]];u=this.points[c[3]];h=j*j;r=j*h;e.x=b(p.x,i.x,o.x,u.x,j,h,r);e.y=b(p.y,i.y,o.y,u.y,j,h,r);e.z=b(p.z,i.z,o.z,u.z,j,h,r);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e,g=b=b=0,f=new THREE.Vector3,j=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,e=this.getPoint(b),j.copy(e),i+=j.distanceTo(f),
+f.copy(e),b*=this.points.length-1,b=Math.floor(b),b!=g&&(h[b]=i,g=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,e,g,f,j,h=[],i=new THREE.Vector3,p=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=p.chunks[b]-p.chunks[b-1];j=Math.ceil(a*c/p.total);g=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<j-1;c++)e=g+c*(1/j)*(f-g),e=this.getPoint(e),h.push(i.copy(e).clone());h.push(i.copy(this.points[b]).clone())}this.points=
 h}};THREE.Edge=function(a,b,c,e){this.vertices=[a,b];this.vertexIndices=[c,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};
 THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,e,f,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=e;this.near=f!==void 0?f:0.1;this.far=g!==void 0?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
 THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,e){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
@@ -120,14 +120,14 @@ void 0?a.fog:!1;this.lights=a.lights!==void 0?a.lights:!1;this.vertexColors=a.ve
 THREE.Texture=function(a,b,c,e,f,g){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=g!==void 0?g:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
 THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
-THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,e,f,g,i,h,o){THREE.Texture.call(this,null,f,g,i,h,o);this.image={data:a,width:b,height:c};this.format=e!==void 0?e:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,e,f,g,j,h,r){THREE.Texture.call(this,null,f,g,j,h,r);this.image={data:a,width:b,height:c};this.format=e!==void 0?e:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.sortParticles=!1};
 THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};
 for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
 THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var c,e=this.children.length;for(c=0;c<e;c++)this.children[c].update(this.skinMatrix,b)};
-THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,e,f,g,i,h;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++)f=this.geometry.bones[c],g=f.pos,i=f.rotq,h=f.scl,e=this.addBone(),e.name=f.name,e.position.set(g[0],g[1],g[2]),e.quaternion.set(i[0],i[1],i[2],i[3]),e.useQuaternion=!0,h!==void 0?e.scale.set(h[0],h[1],h[2]):e.scale.set(1,1,1);for(c=0;c<this.bones.length;c++)f=this.geometry.bones[c],
+THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,e,f,g,j,h;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++)f=this.geometry.bones[c],g=f.pos,j=f.rotq,h=f.scl,e=this.addBone(),e.name=f.name,e.position.set(g[0],g[1],g[2]),e.quaternion.set(j[0],j[1],j[2],j[3]),e.useQuaternion=!0,h!==void 0?e.scale.set(h[0],h[1],h[2]):e.scale.set(1,1,1);for(c=0;c<this.bones.length;c++)f=this.geometry.bones[c],
 e=this.bones[c],f.parent===-1?this.add(e):this.bones[f.parent].add(e);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 THREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1;for(var a=0,b=this.children.length;a<b;a++){var c=this.children[a];c instanceof THREE.Bone?c.update(this.identityMatrix,!1):c.updateMatrixWorld(!0)}for(var b=this.bones.length,c=this.bones,e=this.boneMatrices,a=0;a<b;a++)c[a].skinMatrix.flattenToArrayOffset(e,
 a*16)};
@@ -177,122 +177,122 @@ THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_
 THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,e=b.material;if(e.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var g in e.attributes){var f=e.attributes[g];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var q=1;f.type==="v2"?q=2:f.type==="v3"?q=3:f.type==="v4"?q=4:f.type==="c"&&(q=3);f.size=q;f.array=new Float32Array(c*q);f.buffer=d.createBuffer();f.buffer.belongsToAttribute=g;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
-function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function e(a,b,c){var e,g,f,q,l=a.vertices;q=l.length;var i=a.colors,h=i.length,k=a.__vertexArray,m=a.__colorArray,j=a.__sortArray,y=a.__dirtyVertices,o=a.__dirtyColors,p=a.__webglCustomAttributesList;if(c.sortParticles){xa.multiplySelf(c.matrixWorld);for(e=0;e<q;e++)g=l[e].position,Ba.copy(g),xa.multiplyVector3(Ba),j[e]=[Ba.z,e];
-j.sort(function(a,b){return b[0]-a[0]});for(e=0;e<q;e++)g=l[j[e][1]].position,f=e*3,k[f]=g.x,k[f+1]=g.y,k[f+2]=g.z;for(e=0;e<h;e++)f=e*3,g=i[j[e][1]],m[f]=g.r,m[f+1]=g.g,m[f+2]=g.b;if(p){i=0;for(h=p.length;i<h;i++)if(l=p[i],l.boundTo===void 0||l.boundTo==="vertices")if(f=0,g=l.value.length,l.size===1)for(e=0;e<g;e++)q=j[e][1],l.array[e]=l.value[q];else if(l.size===2)for(e=0;e<g;e++)q=j[e][1],q=l.value[q],l.array[f]=q.x,l.array[f+1]=q.y,f+=2;else if(l.size===3)if(l.type==="c")for(e=0;e<g;e++)q=j[e][1],
-q=l.value[q],l.array[f]=q.r,l.array[f+1]=q.g,l.array[f+2]=q.b,f+=3;else for(e=0;e<g;e++)q=j[e][1],q=l.value[q],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,f+=3;else if(l.size===4)for(e=0;e<g;e++)q=j[e][1],q=l.value[q],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,l.array[f+3]=q.w,f+=4}}else{if(y)for(e=0;e<q;e++)g=l[e].position,f=e*3,k[f]=g.x,k[f+1]=g.y,k[f+2]=g.z;if(o)for(e=0;e<h;e++)g=i[e],f=e*3,m[f]=g.r,m[f+1]=g.g,m[f+2]=g.b;if(p){i=0;for(h=p.length;i<h;i++)if(l=p[i],l.needsUpdate&&(l.boundTo===
+function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function e(a,b,c){var e,g,f,q,l=a.vertices;q=l.length;var j=a.colors,h=j.length,k=a.__vertexArray,m=a.__colorArray,i=a.__sortArray,y=a.__dirtyVertices,p=a.__dirtyColors,o=a.__webglCustomAttributesList;if(c.sortParticles){za.multiplySelf(c.matrixWorld);for(e=0;e<q;e++)g=l[e].position,Ca.copy(g),za.multiplyVector3(Ca),i[e]=[Ca.z,e];
+i.sort(function(a,b){return b[0]-a[0]});for(e=0;e<q;e++)g=l[i[e][1]].position,f=e*3,k[f]=g.x,k[f+1]=g.y,k[f+2]=g.z;for(e=0;e<h;e++)f=e*3,g=j[i[e][1]],m[f]=g.r,m[f+1]=g.g,m[f+2]=g.b;if(o){j=0;for(h=o.length;j<h;j++)if(l=o[j],l.boundTo===void 0||l.boundTo==="vertices")if(f=0,g=l.value.length,l.size===1)for(e=0;e<g;e++)q=i[e][1],l.array[e]=l.value[q];else if(l.size===2)for(e=0;e<g;e++)q=i[e][1],q=l.value[q],l.array[f]=q.x,l.array[f+1]=q.y,f+=2;else if(l.size===3)if(l.type==="c")for(e=0;e<g;e++)q=i[e][1],
+q=l.value[q],l.array[f]=q.r,l.array[f+1]=q.g,l.array[f+2]=q.b,f+=3;else for(e=0;e<g;e++)q=i[e][1],q=l.value[q],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,f+=3;else if(l.size===4)for(e=0;e<g;e++)q=i[e][1],q=l.value[q],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,l.array[f+3]=q.w,f+=4}}else{if(y)for(e=0;e<q;e++)g=l[e].position,f=e*3,k[f]=g.x,k[f+1]=g.y,k[f+2]=g.z;if(p)for(e=0;e<h;e++)g=j[e],f=e*3,m[f]=g.r,m[f+1]=g.g,m[f+2]=g.b;if(o){j=0;for(h=o.length;j<h;j++)if(l=o[j],l.needsUpdate&&(l.boundTo===
 void 0||l.boundTo==="vertices"))if(g=l.value.length,f=0,l.size===1)for(e=0;e<g;e++)l.array[e]=l.value[e];else if(l.size===2)for(e=0;e<g;e++)q=l.value[e],l.array[f]=q.x,l.array[f+1]=q.y,f+=2;else if(l.size===3)if(l.type==="c")for(e=0;e<g;e++)q=l.value[e],l.array[f]=q.r,l.array[f+1]=q.g,l.array[f+2]=q.b,f+=3;else for(e=0;e<g;e++)q=l.value[e],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,f+=3;else if(l.size===4)for(e=0;e<g;e++)q=l.value[e],l.array[f]=q.x,l.array[f+1]=q.y,l.array[f+2]=q.z,l.array[f+
-3]=q.w,f+=4}}if(y||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,k,b);if(o||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,m,b);if(p){i=0;for(h=p.length;i<h;i++)if(l=p[i],l.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,l.buffer),d.bufferData(d.ARRAY_BUFFER,l.array,b)}}function f(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=d.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=
-d.createBuffer();a.hasPos&&(d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,a.positionArray,d.DYNAMIC_DRAW),d.enableVertexAttribArray(b.attributes.position),d.vertexAttribPointer(b.attributes.position,3,d.FLOAT,!1,0,0));if(a.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,g,i,l,w,h,k,m,j,y=a.count*3;for(j=0;j<y;j+=9)c=a.normalArray,e=c[j],f=c[j+1],g=c[j+2],i=c[j+3],w=c[j+4],k=c[j+5],l=c[j+6],h=c[j+7],m=c[j+8],e=(e+i+l)/
-3,f=(f+w+h)/3,g=(g+k+m)/3,c[j]=e,c[j+1]=f,c[j+2]=g,c[j+3]=e,c[j+4]=f,c[j+5]=g,c[j+6]=e,c[j+7]=f,c[j+8]=g}d.bufferData(d.ARRAY_BUFFER,a.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(b.attributes.normal);d.vertexAttribPointer(b.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,a.count);a.count=0}function g(a,b,c,e,f,g){if(e.opacity!==0){var i,l,c=C(a,b,c,e,g),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==pa&&(pa=c,a=!0);if(!e.morphTargets&&b.position>=0)a&&(d.bindBuffer(d.ARRAY_BUFFER,
-f.__webglVertexBuffer),d.vertexAttribPointer(b.position,3,d.FLOAT,!1,0,0));else if(g.morphTargetBase){c=e.program.attributes;g.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[g.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){i=0;var w=g.morphTargetForcedOrder;for(l=g.morphTargetInfluences;i<e.numSupportedMorphTargets&&
-i<w.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[w[i]]),d.vertexAttribPointer(c["morphTarget"+i],3,d.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[i]=l[w[i]],i++}else{var w=[],h=-1,k=0;l=g.morphTargetInfluences;var m,j=l.length;i=0;for(g.morphTargetBase!==-1&&(w[g.morphTargetBase]=!0);i<e.numSupportedMorphTargets;){for(m=0;m<j;m++)!w[m]&&l[m]>h&&(k=m,h=l[k]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);d.vertexAttribPointer(c["morphTarget"+i],3,d.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[i]=
-h;w[k]=1;h=-1;i++}}e.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(e.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){i=0;for(l=f.__webglCustomAttributesList.length;i<l;i++)c=f.__webglCustomAttributesList[i],b[c.buffer.belongsToAttribute]>=0&&(d.bindBuffer(d.ARRAY_BUFFER,c.buffer),d.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,d.FLOAT,!1,0,0))}b.color>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglColorBuffer),d.vertexAttribPointer(b.color,
+3]=q.w,f+=4}}if(y||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,k,b);if(p||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,m,b);if(o){j=0;for(h=o.length;j<h;j++)if(l=o[j],l.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,l.buffer),d.bufferData(d.ARRAY_BUFFER,l.array,b)}}function f(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=d.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=
+d.createBuffer();a.hasPos&&(d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,a.positionArray,d.DYNAMIC_DRAW),d.enableVertexAttribArray(b.attributes.position),d.vertexAttribPointer(b.attributes.position,3,d.FLOAT,!1,0,0));if(a.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,g,j,l,w,h,k,m,i,y=a.count*3;for(i=0;i<y;i+=9)c=a.normalArray,e=c[i],f=c[i+1],g=c[i+2],j=c[i+3],w=c[i+4],k=c[i+5],l=c[i+6],h=c[i+7],m=c[i+8],e=(e+j+l)/
+3,f=(f+w+h)/3,g=(g+k+m)/3,c[i]=e,c[i+1]=f,c[i+2]=g,c[i+3]=e,c[i+4]=f,c[i+5]=g,c[i+6]=e,c[i+7]=f,c[i+8]=g}d.bufferData(d.ARRAY_BUFFER,a.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(b.attributes.normal);d.vertexAttribPointer(b.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,a.count);a.count=0}function g(a,b,c,e,f,g){if(e.opacity!==0){var j,l,c=E(a,b,c,e,g),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==ta&&(ta=c,a=!0);if(!e.morphTargets&&b.position>=0)a&&(d.bindBuffer(d.ARRAY_BUFFER,
+f.__webglVertexBuffer),d.vertexAttribPointer(b.position,3,d.FLOAT,!1,0,0));else if(g.morphTargetBase){c=e.program.attributes;g.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[g.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){j=0;var w=g.morphTargetForcedOrder;for(l=g.morphTargetInfluences;j<e.numSupportedMorphTargets&&
+j<w.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[w[j]]),d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[j]=l[w[j]],j++}else{var w=[],h=-1,k=0;l=g.morphTargetInfluences;var m,i=l.length;j=0;for(g.morphTargetBase!==-1&&(w[g.morphTargetBase]=!0);j<e.numSupportedMorphTargets;){for(m=0;m<i;m++)!w[m]&&l[m]>h&&(k=m,h=l[k]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[j]=
+h;w[k]=1;h=-1;j++}}e.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(e.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){j=0;for(l=f.__webglCustomAttributesList.length;j<l;j++)c=f.__webglCustomAttributesList[j],b[c.buffer.belongsToAttribute]>=0&&(d.bindBuffer(d.ARRAY_BUFFER,c.buffer),d.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,d.FLOAT,!1,0,0))}b.color>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglColorBuffer),d.vertexAttribPointer(b.color,
 3,d.FLOAT,!1,0,0));b.normal>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglNormalBuffer),d.vertexAttribPointer(b.normal,3,d.FLOAT,!1,0,0));b.tangent>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglTangentBuffer),d.vertexAttribPointer(b.tangent,4,d.FLOAT,!1,0,0));b.uv>=0&&(f.__webglUVBuffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUVBuffer),d.vertexAttribPointer(b.uv,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(b.uv)):d.disableVertexAttribArray(b.uv));b.uv2>=0&&(f.__webglUV2Buffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUV2Buffer),
 d.vertexAttribPointer(b.uv2,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(b.uv2)):d.disableVertexAttribArray(b.uv2));e.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexABuffer),d.vertexAttribPointer(b.skinVertexA,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),d.vertexAttribPointer(b.skinVertexB,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),d.vertexAttribPointer(b.skinIndex,
-4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),d.vertexAttribPointer(b.skinWeight,4,d.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(e.wireframe?(e=e.wireframeLinewidth,e!==Ha&&(d.lineWidth(e),Ha=e),a&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),d.drawElements(d.LINES,f.__webglLineCount,d.UNSIGNED_SHORT,0)):(a&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),E.info.render.calls++,E.info.render.vertices+=
-f.__webglFaceCount,E.info.render.faces+=f.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?d.LINE_STRIP:d.LINES,e=e.linewidth,e!==Ha&&(d.lineWidth(e),Ha=e),d.drawArrays(g,0,f.__webglLineCount),E.info.render.calls++):g instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),E.info.render.calls++):g instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),E.info.render.calls++)}}function i(a){qa[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
-a.n13,a.n44-a.n14);qa[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);qa[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);qa[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);qa[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);qa[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=qa[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,d=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
-a.scale.z)),c=0;c<6;c++)if(a=qa[c].x*b.n14+qa[c].y*b.n24+qa[c].z*b.n34+qa[c].w,a<=d)return!1;return!0}function o(a,b){return b.z-a.z}function p(a){var b,c,e,j,La,q,l,w,Aa=0,k=a.lights;ra||(ra=new THREE.PerspectiveCamera(E.shadowCameraFov,E.shadowMapWidth/E.shadowMapHeight,E.shadowCameraNear,E.shadowCameraFar));b=0;for(c=k.length;b<c;b++)if(w=k[b],w.castShadow&&w instanceof THREE.SpotLight){oa=-1;E.shadowMap[Aa]||(E.shadowMap[Aa]=new THREE.WebGLRenderTarget(E.shadowMapWidth,E.shadowMapHeight,{minFilter:THREE.LinearFilter,
-magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),Ia[Aa]=new THREE.Matrix4);e=E.shadowMap[Aa];j=Ia[Aa];ra.position.copy(w.position);ra.lookAt(w.target.position);ra.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ra));this.autoUpdateScene&&a.updateMatrixWorld();ra.matrixWorldInverse.getInverse(ra.matrixWorld);j.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);j.multiplySelf(ra.projectionMatrix);j.multiplySelf(ra.matrixWorldInverse);ra.matrixWorldInverse.flattenToArray(Ja);
-ra.projectionMatrix.flattenToArray(Ka);xa.multiply(ra.projectionMatrix,ra.matrixWorldInverse);i(xa);S(e);d.clearColor(1,1,1,1);E.clear();d.clearColor(V.r,V.g,V.b,N);j=a.__webglObjects.length;for(e=0;e<j;e++)if(q=a.__webglObjects[e],w=q.object,q.render=!1,w.visible&&w.castShadow&&(!(w instanceof THREE.Mesh)||!w.frustumCulled||h(w)))w.matrixWorld.flattenToArray(w._objectMatrixArray),ma(w,ra,!1),q.render=!0;ea(!0);R(THREE.NormalBlending);for(e=0;e<j;e++)if(q=a.__webglObjects[e],q.render)w=q.object,q=
-q.buffer,X(w),l=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?Ma:Fa,g(ra,k,null,l,q,w);j=a.__webglObjectsImmediate.length;for(e=0;e<j;e++)q=a.__webglObjectsImmediate[e],w=q.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),pa=-1,ma(w,ra,!1),X(w),La=C(ra,k,null,Fa,w),w.immediateRenderCallback?w.immediateRenderCallback(La,d,qa):w.render(function(a){f(a,La,Fa.shading)}));Aa++}}function j(a,b,d,c,e,f,i,l){var w,h,k,m;b?
-(h=a.length-1,m=b=-1):(h=0,b=a.length,m=1);for(var j=h;j!==b;j+=m)if(w=a[j],w.render){h=w.object;k=w.buffer;if(l)w=l;else{w=w[d];if(!w)continue;i&&R(w.blending);ea(w.depthTest);la(w.depthWrite);D(w.polygonOffset,w.polygonOffsetFactor,w.polygonOffsetUnits)}X(h);g(c,e,f,w,k,h)}}function r(a,b,c,e,g,i,q){for(var l,h,j,k,m=0,o=a.length;m<o;m++)if(l=a[m],h=l.object,h.visible){pa=-1;if(q)j=q;else{j=l[b];if(!j)continue;i&&R(j.blending);ea(j.depthTest);la(j.depthWrite);D(j.polygonOffset,j.polygonOffsetFactor,
-j.polygonOffsetUnits)}X(h);k=C(c,e,g,j,h);h.immediateRenderCallback?h.immediateRenderCallback(k,d,qa):h.render(function(a){f(a,k,j.shading)})}}function x(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function F(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function I(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function M(a,b){for(var d=a.length-1;d>=0;d--)a[d].object===b&&a.splice(d,1)}function C(a,b,c,e,f){e.program||E.initMaterial(e,
-b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets);for(var g=0,i=E.maxMorphTargets;g<i;g++)f.__webglMorphTargetInfluences[g]=0}var l=!1,g=e.program,i=g.uniforms,h=e.uniforms;g!==na&&(d.useProgram(g),na=g,l=!0);if(e.id!==oa)oa=e.id,l=!0;if(l){d.uniformMatrix4fv(i.projectionMatrix,!1,Ka);if(c&&e.fog)if(h.fogColor.value=c.color,c instanceof THREE.Fog)h.fogNear.value=c.near,h.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)h.fogDensity.value=
-c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var j,k,m=0,o=0,y=0,p,r,x,s=Qa,v=s.directional.colors,F=s.directional.positions,u=s.point.colors,I=s.point.positions,M=s.point.distances,C=0,D=0,c=j=x=0,l=b.length;c<l;c++)if(j=b[c],k=j.color,p=j.position,r=j.intensity,x=j.distance,j instanceof THREE.AmbientLight)E.gammaInput?(m+=k.r*k.r,o+=k.g*k.g,y+=k.b*k.b):(m+=k.r,o+=k.g,y+=k.b);else if(j instanceof THREE.DirectionalLight)x=C*3,E.gammaInput?
-(v[x]=k.r*k.r*r*r,v[x+1]=k.g*k.g*r*r,v[x+2]=k.b*k.b*r*r):(v[x]=k.r*r,v[x+1]=k.g*r,v[x+2]=k.b*r),F[x]=p.x,F[x+1]=p.y,F[x+2]=p.z,C+=1;else if(j instanceof THREE.SpotLight)x=C*3,E.gammaInput?(v[x]=k.r*k.r*r*r,v[x+1]=k.g*k.g*r*r,v[x+2]=k.b*k.b*r*r):(v[x]=k.r*r,v[x+1]=k.g*r,v[x+2]=k.b*r),k=1/p.length(),F[x]=p.x*k,F[x+1]=p.y*k,F[x+2]=p.z*k,C+=1;else if(j instanceof THREE.PointLight)j=D*3,E.gammaInput?(u[j]=k.r*k.r*r*r,u[j+1]=k.g*k.g*r*r,u[j+2]=k.b*k.b*r*r):(u[j]=k.r*r,u[j+1]=k.g*r,u[j+2]=k.b*r),I[j]=p.x,
-I[j+1]=p.y,I[j+2]=p.z,M[D]=x,D+=1;c=C*3;for(l=v.length;c<l;c++)v[c]=0;c=D*3;for(l=u.length;c<l;c++)u[c]=0;s.point.length=D;s.directional.length=C;s.ambient[0]=m;s.ambient[1]=o;s.ambient[2]=y;b=Qa;h.ambientLightColor.value=b.ambient;h.directionalLightColor.value=b.directional.colors;h.directionalLightDirection.value=b.directional.positions;h.pointLightColor.value=b.point.colors;h.pointLightPosition.value=b.point.positions;h.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||
-e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)h.opacity.value=e.opacity,E.gammaInput?h.diffuse.value.copyGammaToLinear(e.color):h.diffuse.value=e.color,(h.map.texture=e.map)&&h.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),h.lightMap.texture=e.lightMap,h.envMap.texture=e.envMap,h.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,h.reflectivity.value=e.reflectivity,h.refractionRatio.value=e.refractionRatio,h.combine.value=
-e.combine,h.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)h.diffuse.value=e.color,h.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)h.psColor.value=e.color,h.opacity.value=e.opacity,h.size.value=e.size,h.scale.value=ka.height/2,h.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)h.shininess.value=e.shininess,E.gammaInput?(h.ambient.value.copyGammaToLinear(e.ambient),h.specular.value.copyGammaToLinear(e.specular)):
-(h.ambient.value=e.ambient,h.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)E.gammaInput?h.ambient.value.copyGammaToLinear(e.ambient):h.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)h.mNear.value=a.near,h.mFar.value=a.far,h.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)h.opacity.value=e.opacity;if(f.receiveShadow&&!e._shadowPass&&h.shadowMatrix){for(b=0;b<Ia.length;b++)h.shadowMatrix.value[b]=Ia[b],h.shadowMap.texture[b]=E.shadowMap[b];
-h.shadowDarkness.value=E.shadowMapDarkness;h.shadowBias.value=E.shadowMapBias}b=e.uniformsList;h=0;for(c=b.length;h<c;h++)if(o=g.uniforms[b[h][1]])if(m=b[h][0],y=m.type,l=m.value,y==="i")d.uniform1i(o,l);else if(y==="f")d.uniform1f(o,l);else if(y==="v2")d.uniform2f(o,l.x,l.y);else if(y==="v3")d.uniform3f(o,l.x,l.y,l.z);else if(y==="v4")d.uniform4f(o,l.x,l.y,l.z,l.w);else if(y==="c")d.uniform3f(o,l.r,l.g,l.b);else if(y==="fv1")d.uniform1fv(o,l);else if(y==="fv")d.uniform3fv(o,l);else if(y==="v3v"){if(!m._array)m._array=
+4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),d.vertexAttribPointer(b.skinWeight,4,d.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(e.wireframe?(e=e.wireframeLinewidth,e!==Ia&&(d.lineWidth(e),Ia=e),a&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),d.drawElements(d.LINES,f.__webglLineCount,d.UNSIGNED_SHORT,0)):(a&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),D.info.render.calls++,D.info.render.vertices+=
+f.__webglFaceCount,D.info.render.faces+=f.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?d.LINE_STRIP:d.LINES,e=e.linewidth,e!==Ia&&(d.lineWidth(e),Ia=e),d.drawArrays(g,0,f.__webglLineCount),D.info.render.calls++):g instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),D.info.render.calls++):g instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),D.info.render.calls++)}}function j(a){ua[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
+a.n13,a.n44-a.n14);ua[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ua[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ua[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ua[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ua[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=ua[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,d=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
+a.scale.z)),c=0;c<6;c++)if(a=ua[c].x*b.n14+ua[c].y*b.n24+ua[c].z*b.n34+ua[c].w,a<=d)return!1;return!0}function r(a,b){return b.z-a.z}function p(a){var b,c,e,i,Ma,q,l,w,o=0,k=a.lights;ka||(ka=new THREE.PerspectiveCamera(D.shadowCameraFov,D.shadowMapWidth/D.shadowMapHeight,D.shadowCameraNear,D.shadowCameraFar));b=0;for(c=k.length;b<c;b++)if(w=k[b],w.castShadow&&w instanceof THREE.SpotLight){oa=-1;D.shadowMap[o]||(D.shadowMap[o]=new THREE.WebGLRenderTarget(D.shadowMapWidth,D.shadowMapHeight,{minFilter:THREE.LinearFilter,
+magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),Ja[o]=new THREE.Matrix4);e=D.shadowMap[o];i=Ja[o];ka.position.copy(w.position);ka.lookAt(w.target.position);ka.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ka));this.autoUpdateScene&&a.updateMatrixWorld();ka.matrixWorldInverse.getInverse(ka.matrixWorld);i.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);i.multiplySelf(ka.projectionMatrix);i.multiplySelf(ka.matrixWorldInverse);ka.matrixWorldInverse.flattenToArray(Ka);
+ka.projectionMatrix.flattenToArray(La);za.multiply(ka.projectionMatrix,ka.matrixWorldInverse);j(za);ra(e);d.clearColor(1,1,1,1);D.clear();d.clearColor(P.r,P.g,P.b,R);i=a.__webglObjects.length;for(e=0;e<i;e++)if(q=a.__webglObjects[e],w=q.object,q.render=!1,w.visible&&w.castShadow&&(!(w instanceof THREE.Mesh)||!w.frustumCulled||h(w)))w.matrixWorld.flattenToArray(w._objectMatrixArray),pa(w,ka,!1),q.render=!0;ha(!0);ia(THREE.NormalBlending);for(e=0;e<i;e++)if(q=a.__webglObjects[e],q.render)w=q.object,
+q=q.buffer,O(w),l=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?Na:Ga,g(ka,k,null,l,q,w);i=a.__webglObjectsImmediate.length;for(e=0;e<i;e++)q=a.__webglObjectsImmediate[e],w=q.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),ta=-1,pa(w,ka,!1),O(w),Ma=E(ka,k,null,Ga,w),w.immediateRenderCallback?w.immediateRenderCallback(Ma,d,ua):w.render(function(a){f(a,Ma,Ga.shading)}));o++}}function i(a,b,d,c,e,f,j,l){var w,h,k,m;
+b?(h=a.length-1,m=b=-1):(h=0,b=a.length,m=1);for(var i=h;i!==b;i+=m)if(w=a[i],w.render){h=w.object;k=w.buffer;if(l)w=l;else{w=w[d];if(!w)continue;j&&ia(w.blending);ha(w.depthTest);la(w.depthWrite);F(w.polygonOffset,w.polygonOffsetFactor,w.polygonOffsetUnits)}O(h);g(c,e,f,w,k,h)}}function o(a,b,c,e,g,j,q){for(var l,w,h,k,m=0,i=a.length;m<i;m++)if(l=a[m],w=l.object,w.visible){ta=-1;if(q)h=q;else{h=l[b];if(!h)continue;j&&ia(h.blending);ha(h.depthTest);la(h.depthWrite);F(h.polygonOffset,h.polygonOffsetFactor,
+h.polygonOffsetUnits)}O(w);k=E(c,e,g,h,w);w.immediateRenderCallback?w.immediateRenderCallback(k,d,ua):w.render(function(a){f(a,k,h.shading)})}}function u(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function C(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function I(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function J(a,b){for(var d=a.length-1;d>=0;d--)a[d].object===b&&a.splice(d,1)}function E(a,b,c,e,f){e.program||D.initMaterial(e,
+b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(D.maxMorphTargets);for(var g=0,j=D.maxMorphTargets;g<j;g++)f.__webglMorphTargetInfluences[g]=0}var l=!1,g=e.program,j=g.uniforms,h=e.uniforms;g!==ja&&(d.useProgram(g),ja=g,l=!0);if(e.id!==oa)oa=e.id,l=!0;if(l){d.uniformMatrix4fv(j.projectionMatrix,!1,La);if(c&&e.fog)if(h.fogColor.value=c.color,c instanceof THREE.Fog)h.fogNear.value=c.near,h.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)h.fogDensity.value=
+c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var i,k,m=0,o=0,y=0,p,r,u,s=Ra,C=s.directional.colors,x=s.directional.positions,v=s.point.colors,I=s.point.positions,J=s.point.distances,E=0,F=0,c=i=u=0,l=b.length;c<l;c++)if(i=b[c],k=i.color,p=i.position,r=i.intensity,u=i.distance,i instanceof THREE.AmbientLight)D.gammaInput?(m+=k.r*k.r,o+=k.g*k.g,y+=k.b*k.b):(m+=k.r,o+=k.g,y+=k.b);else if(i instanceof THREE.DirectionalLight)u=E*3,D.gammaInput?
+(C[u]=k.r*k.r*r*r,C[u+1]=k.g*k.g*r*r,C[u+2]=k.b*k.b*r*r):(C[u]=k.r*r,C[u+1]=k.g*r,C[u+2]=k.b*r),x[u]=p.x,x[u+1]=p.y,x[u+2]=p.z,E+=1;else if(i instanceof THREE.SpotLight)u=E*3,D.gammaInput?(C[u]=k.r*k.r*r*r,C[u+1]=k.g*k.g*r*r,C[u+2]=k.b*k.b*r*r):(C[u]=k.r*r,C[u+1]=k.g*r,C[u+2]=k.b*r),k=1/p.length(),x[u]=p.x*k,x[u+1]=p.y*k,x[u+2]=p.z*k,E+=1;else if(i instanceof THREE.PointLight)i=F*3,D.gammaInput?(v[i]=k.r*k.r*r*r,v[i+1]=k.g*k.g*r*r,v[i+2]=k.b*k.b*r*r):(v[i]=k.r*r,v[i+1]=k.g*r,v[i+2]=k.b*r),I[i]=p.x,
+I[i+1]=p.y,I[i+2]=p.z,J[F]=u,F+=1;c=E*3;for(l=C.length;c<l;c++)C[c]=0;c=F*3;for(l=v.length;c<l;c++)v[c]=0;s.point.length=F;s.directional.length=E;s.ambient[0]=m;s.ambient[1]=o;s.ambient[2]=y;b=Ra;h.ambientLightColor.value=b.ambient;h.directionalLightColor.value=b.directional.colors;h.directionalLightDirection.value=b.directional.positions;h.pointLightColor.value=b.point.colors;h.pointLightPosition.value=b.point.positions;h.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||
+e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)h.opacity.value=e.opacity,D.gammaInput?h.diffuse.value.copyGammaToLinear(e.color):h.diffuse.value=e.color,(h.map.texture=e.map)&&h.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),h.lightMap.texture=e.lightMap,h.envMap.texture=e.envMap,h.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,h.reflectivity.value=e.reflectivity,h.refractionRatio.value=e.refractionRatio,h.combine.value=
+e.combine,h.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)h.diffuse.value=e.color,h.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)h.psColor.value=e.color,h.opacity.value=e.opacity,h.size.value=e.size,h.scale.value=sa.height/2,h.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)h.shininess.value=e.shininess,D.gammaInput?(h.ambient.value.copyGammaToLinear(e.ambient),h.specular.value.copyGammaToLinear(e.specular)):
+(h.ambient.value=e.ambient,h.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)D.gammaInput?h.ambient.value.copyGammaToLinear(e.ambient):h.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)h.mNear.value=a.near,h.mFar.value=a.far,h.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)h.opacity.value=e.opacity;if(f.receiveShadow&&!e._shadowPass&&h.shadowMatrix){for(b=0;b<Ja.length;b++)h.shadowMatrix.value[b]=Ja[b],h.shadowMap.texture[b]=D.shadowMap[b];
+h.shadowDarkness.value=D.shadowMapDarkness;h.shadowBias.value=D.shadowMapBias}b=e.uniformsList;h=0;for(c=b.length;h<c;h++)if(o=g.uniforms[b[h][1]])if(m=b[h][0],y=m.type,l=m.value,y==="i")d.uniform1i(o,l);else if(y==="f")d.uniform1f(o,l);else if(y==="v2")d.uniform2f(o,l.x,l.y);else if(y==="v3")d.uniform3f(o,l.x,l.y,l.z);else if(y==="v4")d.uniform4f(o,l.x,l.y,l.z,l.w);else if(y==="c")d.uniform3f(o,l.r,l.g,l.b);else if(y==="fv1")d.uniform1fv(o,l);else if(y==="fv")d.uniform3fv(o,l);else if(y==="v3v"){if(!m._array)m._array=
 new Float32Array(3*l.length);y=0;for(p=l.length;y<p;y++)s=y*3,m._array[s]=l[y].x,m._array[s+1]=l[y].y,m._array[s+2]=l[y].z;d.uniform3fv(o,m._array)}else if(y==="m4"){if(!m._array)m._array=new Float32Array(16);l.flattenToArray(m._array);d.uniformMatrix4fv(o,!1,m._array)}else if(y==="m4v"){if(!m._array)m._array=new Float32Array(16*l.length);y=0;for(p=l.length;y<p;y++)l[y].flattenToArrayOffset(m._array,y*16);d.uniformMatrix4fv(o,!1,m._array)}else if(y==="t"){if(d.uniform1i(o,l),o=m.texture)if(o.image instanceof
-Array&&o.image.length===6){if(m=o,m.image.length===6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=d.createTexture();d.activeTexture(d.TEXTURE0+l);d.bindTexture(d.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(l=0;l<6;l++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,m.image[l]);G(d.TEXTURE_CUBE_MAP,m,m.image[0]);m.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+l),d.bindTexture(d.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else o instanceof
-THREE.WebGLRenderTargetCube?(m=o,d.activeTexture(d.TEXTURE0+l),d.bindTexture(d.TEXTURE_CUBE_MAP,m.__webglTexture)):ha(o,l)}else if(y==="tv"){if(!m._array){m._array=[];y=0;for(p=m.texture.length;y<p;y++)m._array[y]=l+y}d.uniform1iv(o,m._array);y=0;for(p=m.texture.length;y<p;y++)(o=m.texture[y])&&ha(o,m._array[y])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&i.cameraPosition!==null&&d.uniform3f(i.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof
-THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&i.viewMatrix!==null&&d.uniformMatrix4fv(i.viewMatrix,!1,Ja);e.skinning&&(d.uniformMatrix4fv(i.cameraInverseMatrix,!1,Ja),d.uniformMatrix4fv(i.boneGlobalMatrices,!1,f.boneMatrices))}d.uniformMatrix4fv(i.modelViewMatrix,!1,f._modelViewMatrixArray);i.normalMatrix&&d.uniformMatrix3fv(i.normalMatrix,!1,f._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||f.receiveShadow)&&
-i.objectMatrix!==null&&d.uniformMatrix4fv(i.objectMatrix,!1,f._objectMatrixArray);return g}function ma(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function X(a){if(Ea!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),Ea=a.doubleSided;if(za!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),za=a.flipSided}function ea(a){ua!==
-a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),ua=a)}function la(a){Na!==a&&(d.depthMask(a),Na=a)}function D(a,b,c){Ra!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),Ra=a);if(a&&(Sa!==b||Ta!==c))d.polygonOffset(b,c),Sa=b,Ta=c}function R(a){if(a!==wa){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);
-d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}wa=a}}function L(a,b){var c;a==="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a==="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function G(a,b,c){(c.width&c.width-1)===
-0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,ia(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,ia(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,ia(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,ia(b.minFilter)),d.generateMipmap(a)):(d.texParameteri(a,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_MAG_FILTER,sa(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,sa(b.minFilter)))}function ha(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
-!0,a.__webglTexture=d.createTexture(),E.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0,ia(a.format),a.image.width,a.image.height,0,ia(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);G(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}function J(a,b){d.bindRenderbuffer(d.RENDERBUFFER,
-a);b.depthBuffer&&!b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_STENCIL,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,a)):d.renderbufferStorage(d.RENDERBUFFER,d.RGBA4,b.width,b.height)}function S(a){var b=a instanceof THREE.WebGLRenderTargetCube;
-if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=d.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);G(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=d.createFramebuffer();a.__webglRenderbuffer[c]=d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,ia(a.format),a.width,a.height,0,ia(a.format),ia(a.type),
-null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,f,e.__webglTexture,0);J(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),G(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,ia(a.format),a.width,a.height,0,ia(a.format),ia(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,
-a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),d.bindRenderbuffer(d.RENDERBUFFER,a.__webglRenderbuffer),J(a.__webglRenderbuffer,a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=Ga,a=Ca,e=Oa,f=Pa);b!==ga&&(d.bindFramebuffer(d.FRAMEBUFFER,
-b),d.viewport(e,f,c,a),ga=b)}function sa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function ia(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;
+Array&&o.image.length===6){if(m=o,m.image.length===6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=d.createTexture();d.activeTexture(d.TEXTURE0+l);d.bindTexture(d.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(l=0;l<6;l++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,m.image[l]);L(d.TEXTURE_CUBE_MAP,m,m.image[0]);m.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+l),d.bindTexture(d.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else o instanceof
+THREE.WebGLRenderTargetCube?(m=o,d.activeTexture(d.TEXTURE0+l),d.bindTexture(d.TEXTURE_CUBE_MAP,m.__webglTexture)):qa(o,l)}else if(y==="tv"){if(!m._array){m._array=[];y=0;for(p=m.texture.length;y<p;y++)m._array[y]=l+y}d.uniform1iv(o,m._array);y=0;for(p=m.texture.length;y<p;y++)(o=m.texture[y])&&qa(o,m._array[y])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&j.cameraPosition!==null&&d.uniform3f(j.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof
+THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&j.viewMatrix!==null&&d.uniformMatrix4fv(j.viewMatrix,!1,Ka);e.skinning&&(d.uniformMatrix4fv(j.cameraInverseMatrix,!1,Ka),d.uniformMatrix4fv(j.boneGlobalMatrices,!1,f.boneMatrices))}d.uniformMatrix4fv(j.modelViewMatrix,!1,f._modelViewMatrixArray);j.normalMatrix&&d.uniformMatrix3fv(j.normalMatrix,!1,f._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||f.receiveShadow)&&
+j.objectMatrix!==null&&d.uniformMatrix4fv(j.objectMatrix,!1,f._objectMatrixArray);return g}function pa(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function O(a){if(Fa!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),Fa=a.doubleSided;if(Ba!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),Ba=a.flipSided}function ha(a){wa!==
+a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),wa=a)}function la(a){Oa!==a&&(d.depthMask(a),Oa=a)}function F(a,b,c){Sa!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),Sa=a);if(a&&(Ta!==b||Ua!==c))d.polygonOffset(b,c),Ta=b,Ua=c}function ia(a){if(a!==ya){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);
+d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}ya=a}}function K(a,b){var c;a==="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a==="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function L(a,b,c){(c.width&c.width-1)===
+0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,M(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,M(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,M(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,M(b.minFilter)),d.generateMipmap(a)):(d.texParameteri(a,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_MAG_FILTER,na(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,na(b.minFilter)))}function qa(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
+!0,a.__webglTexture=d.createTexture(),D.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0,M(a.format),a.image.width,a.image.height,0,M(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);L(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}function X(a,b){d.bindRenderbuffer(d.RENDERBUFFER,
+a);b.depthBuffer&&!b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_STENCIL,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,a)):d.renderbufferStorage(d.RENDERBUFFER,d.RGBA4,b.width,b.height)}function ra(a){var b=a instanceof THREE.WebGLRenderTargetCube;
+if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=d.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);L(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=d.createFramebuffer();a.__webglRenderbuffer[c]=d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,M(a.format),a.width,a.height,0,M(a.format),M(a.type),
+null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,f,e.__webglTexture,0);X(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),L(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,M(a.format),a.width,a.height,0,M(a.format),M(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,
+a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),d.bindRenderbuffer(d.RENDERBUFFER,a.__webglRenderbuffer),X(a.__webglRenderbuffer,a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=Ha,a=Da,e=Pa,f=Qa);b!==ga&&(d.bindFramebuffer(d.FRAMEBUFFER,
+b),d.viewport(e,f,c,a),ga=b)}function na(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function M(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;
 case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;
-case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var a=a||{},ka=a.canvas!==void 0?a.canvas:document.createElement("canvas"),ta=a.precision!==void 0?a.precision:"highp",va=a.antialias!==void 0?a.antialias:!1,ya=a.stencil!==void 0?a.stencil:!0,Wa=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,V=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),
-N=a.clearAlpha!==void 0?a.clearAlpha:0,ja=a.maxLights!==void 0?a.maxLights:4;this.domElement=ka;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=
-[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var E=this,d,O=[],na=null,ga=null,oa=-1,pa=null,Da=0,Ea=null,za=null,wa=null,ua=null,Na=null,Ra=null,Sa=null,Ta=null,Ha=null,Oa=0,Pa=0,Ga=0,Ca=0,qa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],xa=new THREE.Matrix4,Ka=new Float32Array(16),Ja=new Float32Array(16),
-Ba=new THREE.Vector4,Qa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},ra,Ia=[],Fa,Ma,v={},Ua=!1;d=function(){var a;try{if(!(a=ka.getContext("experimental-webgl",{antialias:va,stencil:ya,preserveDrawingBuffer:Wa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();
-d.clearColor(0,0,0,1);d.clearDepth(1);d.clearStencil(0);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(V.r,V.g,V.b,N);(function(){v.vertices=new Float32Array(16);v.faces=new Uint16Array(6);var a=0;v.vertices[a++]=-1;v.vertices[a++]=-1;v.vertices[a++]=0;v.vertices[a++]=1;v.vertices[a++]=1;v.vertices[a++]=-1;v.vertices[a++]=1;v.vertices[a++]=
-1;v.vertices[a++]=1;v.vertices[a++]=1;v.vertices[a++]=1;v.vertices[a++]=0;v.vertices[a++]=-1;v.vertices[a++]=1;v.vertices[a++]=0;a=v.vertices[a++]=0;v.faces[a++]=0;v.faces[a++]=1;v.faces[a++]=2;v.faces[a++]=0;v.faces[a++]=2;v.faces[a++]=3;v.vertexBuffer=d.createBuffer();v.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,v.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,v.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,v.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,v.faces,d.STATIC_DRAW);
-v.program=d.createProgram();d.attachShader(v.program,L("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(v.program,L("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(v.program);v.attributes={};v.uniforms={};v.attributes.position=d.getAttribLocation(v.program,"position");v.attributes.uv=d.getAttribLocation(v.program,"uv");v.uniforms.uvOffset=d.getUniformLocation(v.program,"uvOffset");v.uniforms.uvScale=d.getUniformLocation(v.program,"uvScale");v.uniforms.rotation=d.getUniformLocation(v.program,
-"rotation");v.uniforms.scale=d.getUniformLocation(v.program,"scale");v.uniforms.alignment=d.getUniformLocation(v.program,"alignment");v.uniforms.color=d.getUniformLocation(v.program,"color");v.uniforms.map=d.getUniformLocation(v.program,"map");v.uniforms.opacity=d.getUniformLocation(v.program,"opacity");v.uniforms.useScreenCoordinates=d.getUniformLocation(v.program,"useScreenCoordinates");v.uniforms.affectedByDistance=d.getUniformLocation(v.program,"affectedByDistance");v.uniforms.screenPosition=
-d.getUniformLocation(v.program,"screenPosition");v.uniforms.modelViewMatrix=d.getUniformLocation(v.program,"modelViewMatrix");v.uniforms.projectionMatrix=d.getUniformLocation(v.program,"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);Fa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});Ma=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});
-Fa._shadowPass=!0;Ma._shadowPass=!0})();this.context=d;var Va=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return d};this.supportsVertexTextures=function(){return Va};this.setSize=function(a,b){ka.width=a;ka.height=b;this.setViewport(0,0,ka.width,ka.height)};this.setViewport=function(a,b,c,e){Oa=a;Pa=b;Ga=c;Ca=e;d.viewport(Oa,Pa,Ga,Ca)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};
-this.setClearColorHex=function(a,b){V.setHex(a);N=b;d.clearColor(V.r,V.g,V.b,N)};this.setClearColor=function(a,b){V.copy(a);N=b;d.clearColor(V.r,V.g,V.b,N)};this.getClearColor=function(){return V};this.getClearAlpha=function(){return N};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.clearTarget=function(a,b,c,d){S(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=
+case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var a=a||{},sa=a.canvas!==void 0?a.canvas:document.createElement("canvas"),va=a.precision!==void 0?a.precision:"highp",xa=a.antialias!==void 0?a.antialias:!1,Aa=a.stencil!==void 0?a.stencil:!0,Xa=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,P=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),
+R=a.clearAlpha!==void 0?a.clearAlpha:0,ma=a.maxLights!==void 0?a.maxLights:4;this.domElement=sa;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=
+[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var D=this,d,ba=[],ja=null,ga=null,oa=-1,ta=null,Ea=0,Fa=null,Ba=null,ya=null,wa=null,Oa=null,Sa=null,Ta=null,Ua=null,Ia=null,Pa=0,Qa=0,Ha=0,Da=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],za=new THREE.Matrix4,La=new Float32Array(16),Ka=new Float32Array(16),
+Ca=new THREE.Vector4,Ra={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},ka,Ja=[],Ga,Na,x={},Va=!1;d=function(){var a;try{if(!(a=sa.getContext("experimental-webgl",{antialias:xa,stencil:Aa,preserveDrawingBuffer:Xa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();
+d.clearColor(0,0,0,1);d.clearDepth(1);d.clearStencil(0);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(P.r,P.g,P.b,R);(function(){x.vertices=new Float32Array(16);x.faces=new Uint16Array(6);var a=0;x.vertices[a++]=-1;x.vertices[a++]=-1;x.vertices[a++]=0;x.vertices[a++]=1;x.vertices[a++]=1;x.vertices[a++]=-1;x.vertices[a++]=1;x.vertices[a++]=
+1;x.vertices[a++]=1;x.vertices[a++]=1;x.vertices[a++]=1;x.vertices[a++]=0;x.vertices[a++]=-1;x.vertices[a++]=1;x.vertices[a++]=0;a=x.vertices[a++]=0;x.faces[a++]=0;x.faces[a++]=1;x.faces[a++]=2;x.faces[a++]=0;x.faces[a++]=2;x.faces[a++]=3;x.vertexBuffer=d.createBuffer();x.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,x.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,x.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,x.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,x.faces,d.STATIC_DRAW);
+x.program=d.createProgram();d.attachShader(x.program,K("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(x.program,K("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(x.program);x.attributes={};x.uniforms={};x.attributes.position=d.getAttribLocation(x.program,"position");x.attributes.uv=d.getAttribLocation(x.program,"uv");x.uniforms.uvOffset=d.getUniformLocation(x.program,"uvOffset");x.uniforms.uvScale=d.getUniformLocation(x.program,"uvScale");x.uniforms.rotation=d.getUniformLocation(x.program,
+"rotation");x.uniforms.scale=d.getUniformLocation(x.program,"scale");x.uniforms.alignment=d.getUniformLocation(x.program,"alignment");x.uniforms.color=d.getUniformLocation(x.program,"color");x.uniforms.map=d.getUniformLocation(x.program,"map");x.uniforms.opacity=d.getUniformLocation(x.program,"opacity");x.uniforms.useScreenCoordinates=d.getUniformLocation(x.program,"useScreenCoordinates");x.uniforms.affectedByDistance=d.getUniformLocation(x.program,"affectedByDistance");x.uniforms.screenPosition=
+d.getUniformLocation(x.program,"screenPosition");x.uniforms.modelViewMatrix=d.getUniformLocation(x.program,"modelViewMatrix");x.uniforms.projectionMatrix=d.getUniformLocation(x.program,"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);Ga=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});Na=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});
+Ga._shadowPass=!0;Na._shadowPass=!0})();this.context=d;var Wa=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return d};this.supportsVertexTextures=function(){return Wa};this.setSize=function(a,b){sa.width=a;sa.height=b;this.setViewport(0,0,sa.width,sa.height)};this.setViewport=function(a,b,c,e){Pa=a;Qa=b;Ha=c;Da=e;d.viewport(Pa,Qa,Ha,Da)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};
+this.setClearColorHex=function(a,b){P.setHex(a);R=b;d.clearColor(P.r,P.g,P.b,R)};this.setClearColor=function(a,b){P.copy(a);R=b;d.clearColor(P.r,P.g,P.b,R)};this.getClearColor=function(){return P};this.getClearAlpha=function(){return R};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.clearTarget=function(a,b,c,d){ra(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=
 !1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];d.deleteBuffer(c.__webglVertexBuffer);d.deleteBuffer(c.__webglNormalBuffer);d.deleteBuffer(c.__webglTangentBuffer);d.deleteBuffer(c.__webglColorBuffer);d.deleteBuffer(c.__webglUVBuffer);d.deleteBuffer(c.__webglUV2Buffer);d.deleteBuffer(c.__webglSkinVertexABuffer);d.deleteBuffer(c.__webglSkinVertexBBuffer);
-d.deleteBuffer(c.__webglSkinIndicesBuffer);d.deleteBuffer(c.__webglSkinWeightsBuffer);d.deleteBuffer(c.__webglFaceBuffer);d.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e<f;e++)d.deleteBuffer(c.__webglMorphTargetsBuffers[e]);E.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),
-d.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),E.info.memory.textures--};this.updateShadowMap=function(a,b){p(a,b)};this.render=function(a,b,c,e){var f,g,q,l,w=a.lights,x=a.fog;oa=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);
-this.shadowMapEnabled&&this.shadowMapAutoUpdate&&p(a,b);E.info.render.calls=0;E.info.render.vertices=0;E.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ja);b.projectionMatrix.flattenToArray(Ka);xa.multiply(b.projectionMatrix,b.matrixWorldInverse);i(xa);S(c);(this.autoClear||e)&&this.clear(this.autoClearColor,
-this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;e=0;for(f=l.length;e<f;e++)if(g=l[e],q=g.object,g.render=!1,q.visible&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||h(q))){q.matrixWorld.flattenToArray(q._objectMatrixArray);ma(q,b,!0);var k=g,m=k.object,F=k.buffer,y=void 0,y=y=void 0,y=m.material;if(y instanceof THREE.MeshFaceMaterial){if(y=F.materialIndex,y>=0)y=m.geometry.materials[y],y.transparent?(k.transparent=y,k.opaque=null):(k.opaque=y,k.transparent=null)}else if(y)y.transparent?
-(k.transparent=y,k.opaque=null):(k.opaque=y,k.transparent=null);g.render=!0;if(this.sortObjects)q.renderDepth?g.z=q.renderDepth:(Ba.copy(q.position),xa.multiplyVector3(Ba),g.z=Ba.z)}this.sortObjects&&l.sort(o);l=a.__webglObjectsImmediate;e=0;for(f=l.length;e<f;e++)if(g=l[e],q=g.object,q.visible)q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),ma(q,b,!0),q=g.object.material,q.transparent?(g.transparent=q,g.opaque=null):(g.opaque=q,g.transparent=null);a.overrideMaterial?(R(a.overrideMaterial.blending),
-ea(a.overrideMaterial.depthTest),la(a.overrideMaterial.depthWrite),D(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),j(a.__webglObjects,!1,"",b,w,x,!0,a.overrideMaterial),r(a.__webglObjectsImmediate,"",b,w,x,!1,a.overrideMaterial)):(R(THREE.NormalBlending),j(a.__webglObjects,!0,"opaque",b,w,x,!1),r(a.__webglObjectsImmediate,"opaque",b,w,x,!1),j(a.__webglObjects,!1,"transparent",b,w,x,!0),r(a.__webglObjectsImmediate,"transparent",b,w,x,
-!0));if(a.__webglSprites.length){q=v.attributes;w=v.uniforms;x=Ca/Ga;e=[];f=Ga*0.5;l=Ca*0.5;g=!0;d.useProgram(v.program);na=v.program;pa=ua=wa=-1;Ua||(d.enableVertexAttribArray(v.attributes.position),d.enableVertexAttribArray(v.attributes.uv),Ua=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,v.vertexBuffer);d.vertexAttribPointer(q.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(q.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,v.elementBuffer);
-d.uniformMatrix4fv(w.projectionMatrix,!1,Ka);d.activeTexture(d.TEXTURE0);d.uniform1i(w.map,0);q=0;for(k=a.__webglSprites.length;q<k;q++)if(m=a.__webglSprites[q],m.visible&&m.opacity!==0)m.useScreenCoordinates?m.z=-m.position.z:(m._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),m.z=-m._modelViewMatrix.n34);a.__webglSprites.sort(o);q=0;for(k=a.__webglSprites.length;q<k;q++)m=a.__webglSprites[q],m.visible&&m.opacity!==0&&m.map&&m.map.image&&m.map.image.width&&
-(m.useScreenCoordinates?(d.uniform1i(w.useScreenCoordinates,1),d.uniform3f(w.screenPosition,(m.position.x-f)/f,(l-m.position.y)/l,Math.max(0,Math.min(1,m.position.z)))):(d.uniform1i(w.useScreenCoordinates,0),d.uniform1i(w.affectedByDistance,m.affectedByDistance?1:0),d.uniformMatrix4fv(w.modelViewMatrix,!1,m._modelViewMatrixArray)),b=m.map.image.width/(m.scaleByViewport?Ca:1),e[0]=b*x*m.scale.x,e[1]=b*m.scale.y,d.uniform2f(w.uvScale,m.uvScale.x,m.uvScale.y),d.uniform2f(w.uvOffset,m.uvOffset.x,m.uvOffset.y),
-d.uniform2f(w.alignment,m.alignment.x,m.alignment.y),d.uniform1f(w.opacity,m.opacity),d.uniform3f(w.color,m.color.r,m.color.g,m.color.b),d.uniform1f(w.rotation,m.rotation),d.uniform2fv(w.scale,e),m.mergeWith3D&&!g?(d.enable(d.DEPTH_TEST),g=!0):!m.mergeWith3D&&g&&(d.disable(d.DEPTH_TEST),g=!1),R(m.blending),ha(m.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(Na)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&
-(c instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,c.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP,null)):(d.bindTexture(d.TEXTURE_2D,c.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],g=a,i=void 0,h=void 0,j=void 0;if(!f.__webglInit)if(f.__webglInit=
-!0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),f instanceof THREE.Mesh){h=f.geometry;if(h.geometryGroups===void 0){var j=h,q=void 0,l=void 0,w=void 0,o=void 0,k=void 0,m=void 0,p=void 0,y={},r=j.morphTargets.length;j.geometryGroups={};q=0;for(l=j.faces.length;q<l;q++)w=j.faces[q],o=w.materialIndex,m=o!==void 0?o:-1,y[m]===void 0&&
-(y[m]={hash:m,counter:0}),p=y[m].hash+"_"+y[m].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]={faces3:[],faces4:[],materialIndex:o,vertices:0,numMorphTargets:r}),k=w instanceof THREE.Face3?3:4,j.geometryGroups[p].vertices+k>65535&&(y[m].counter+=1,p=y[m].hash+"_"+y[m].counter,j.geometryGroups[p]===void 0&&(j.geometryGroups[p]={faces3:[],faces4:[],materialIndex:o,vertices:0,numMorphTargets:r})),w instanceof THREE.Face3?j.geometryGroups[p].faces3.push(q):j.geometryGroups[p].faces4.push(q),
-j.geometryGroups[p].vertices+=k;j.geometryGroupsList=[];q=void 0;for(q in j.geometryGroups)j.geometryGroups[q].id=Da++,j.geometryGroupsList.push(j.geometryGroups[q])}for(i in h.geometryGroups)if(j=h.geometryGroups[i],!j.__webglVertexBuffer){q=j;q.__webglVertexBuffer=d.createBuffer();q.__webglNormalBuffer=d.createBuffer();q.__webglTangentBuffer=d.createBuffer();q.__webglColorBuffer=d.createBuffer();q.__webglUVBuffer=d.createBuffer();q.__webglUV2Buffer=d.createBuffer();q.__webglSkinVertexABuffer=d.createBuffer();
-q.__webglSkinVertexBBuffer=d.createBuffer();q.__webglSkinIndicesBuffer=d.createBuffer();q.__webglSkinWeightsBuffer=d.createBuffer();q.__webglFaceBuffer=d.createBuffer();q.__webglLineBuffer=d.createBuffer();if(q.numMorphTargets){w=l=void 0;q.__webglMorphTargetsBuffers=[];l=0;for(w=q.numMorphTargets;l<w;l++)q.__webglMorphTargetsBuffers.push(d.createBuffer())}E.info.memory.geometries++;o=f;k=o.geometry;l=j.faces3;m=j.faces4;q=l.length*3+m.length*4;w=l.length*1+m.length*2;m=l.length*3+m.length*4;l=c(o,
-j);p=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;y=l instanceof THREE.MeshBasicMaterial&&!l.envMap||l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;r=l.vertexColors?l.vertexColors:!1;j.__vertexArray=new Float32Array(q*3);if(y)j.__normalArray=new Float32Array(q*3);if(k.hasTangents)j.__tangentArray=new Float32Array(q*4);if(r)j.__colorArray=new Float32Array(q*3);if(p){if(k.faceUvs.length>0||k.faceVertexUvs.length>
-0)j.__uvArray=new Float32Array(q*2);if(k.faceUvs.length>1||k.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(q*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(q*4),j.__skinVertexBArray=new Float32Array(q*4),j.__skinIndexArray=new Float32Array(q*4),j.__skinWeightArray=new Float32Array(q*4);j.__faceArray=new Uint16Array(w*3);j.__lineArray=new Uint16Array(m*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];o=0;for(k=j.numMorphTargets;o<k;o++)j.__morphTargetsArrays.push(new Float32Array(q*
-3))}j.__needsSmoothNormals=y===THREE.SmoothShading;j.__uvType=p;j.__vertexColorType=r;j.__normalType=y;j.__webglFaceCount=w*3;j.__webglLineCount=m*2;if(l.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];w=void 0;for(w in l.attributes){var o=l.attributes[w],k={},v;for(v in o)k[v]=o[v];if(!k.__webglInitialized||k.createUniqueBuffers)k.__webglInitialized=!0,m=1,k.type==="v2"?m=2:k.type==="v3"?m=3:k.type==="v4"?m=4:k.type==="c"&&(m=3),k.size=m,k.array=new Float32Array(q*
-m),k.buffer=d.createBuffer(),k.buffer.belongsToAttribute=w,o.needsUpdate=!0,k.__original=o;j.__webglCustomAttributesList.push(k)}}j.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(f instanceof THREE.Ribbon){if(h=f.geometry,!h.__webglVertexBuffer)j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),E.info.memory.geometries++,j=h,q=j.vertices.length,
-j.__vertexArray=new Float32Array(q*3),j.__colorArray=new Float32Array(q*3),j.__webglVertexCount=q,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof THREE.Line){if(h=f.geometry,!h.__webglVertexBuffer)j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),E.info.memory.geometries++,j=h,q=f,l=j.vertices.length,j.__vertexArray=new Float32Array(l*3),j.__colorArray=new Float32Array(l*3),j.__webglLineCount=l,b(j,q),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof
-THREE.ParticleSystem&&(h=f.geometry,!h.__webglVertexBuffer))j=h,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),E.info.geometries++,j=h,q=f,l=j.vertices.length,j.__vertexArray=new Float32Array(l*3),j.__colorArray=new Float32Array(l*3),j.__sortArray=[],j.__webglParticleCount=l,b(j,q),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(i in h=f.geometry,h.geometryGroups)j=h.geometryGroups[i],x(g.__webglObjects,j,f);else f instanceof
-THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(h=f.geometry,x(g.__webglObjects,h,f)):THREE.MarchingCubes!==void 0&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?g.__webglObjectsImmediate.push({object:f,opaque:null,transparent:null}):f instanceof THREE.Sprite&&g.__webglSprites.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){f=a.__objectsRemoved[0];g=a;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof
-THREE.Ribbon||f instanceof THREE.Line)M(g.__webglObjects,f);else if(f instanceof THREE.Sprite){g=g.__webglSprites;i=f;for(h=g.length-1;h>=0;h--)g[h]===i&&g.splice(h,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&M(g.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(g=a.__webglObjects.length;f<g;f++)if(v=a.__webglObjects[f].object,i=v.geometry,h=w=l=void 0,v instanceof THREE.Mesh){j=0;for(q=i.geometryGroupsList.length;j<q;j++)if(l=i.geometryGroupsList[j],
-h=c(v,l),w=h.attributes&&F(h),i.__dirtyVertices||i.__dirtyMorphTargets||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents||w)if(w=d.DYNAMIC_DRAW,o=!i.dynamic,l.__inittedArrays){var C=m=k=void 0,s=void 0,D=void 0,L=void 0,u=void 0,G=void 0,J=void 0,X=void 0,R=void 0,Q=C=L=void 0,z=void 0,A=void 0,B=void 0,Z=s=void 0,$=void 0,T=s=J=R=void 0,U=void 0,N=B=A=z=u=void 0,K=s=B=A=z=N=B=A=z=N=B=A=z=void 0,Y=void 0,O=L=void 0,V=void 0,W=void 0,ea=void 0,ba=void 0,H=Q=W=Y=
-0,S=0,aa=K=C=0,P=u=Z=0,t=0,ca=void 0,P=l.__vertexArray,V=l.__uvArray,t=l.__uv2Array,O=l.__normalArray,D=l.__tangentArray,$=l.__colorArray,T=l.__skinVertexAArray,U=l.__skinVertexBArray,G=l.__skinIndexArray,fa=l.__skinWeightArray,N=l.__morphTargetsArrays,p=l.__webglCustomAttributesList,n=void 0,n=l.__faceArray,ca=l.__lineArray,ga=l.__needsSmoothNormals,R=l.__vertexColorType,X=l.__uvType,L=l.__normalType,J=v.geometry,ia=J.__dirtyElements,ha=J.__dirtyUvs,la=J.__dirtyNormals,ma=J.__dirtyTangents,sa=J.__dirtyColors,
-ea=J.__dirtyMorphTargets,ba=J.vertices,y=l.faces3,r=l.faces4,da=J.faces,na=J.faceVertexUvs[0],ra=J.faceVertexUvs[1],ja=J.skinVerticesA,ka=J.skinVerticesB,oa=J.skinIndices,pa=J.skinWeights,qa=J.morphTargets;if(J.__dirtyVertices){k=0;for(m=y.length;k<m;k++)s=da[y[k]],z=ba[s.a].position,A=ba[s.b].position,B=ba[s.c].position,P[W]=z.x,P[W+1]=z.y,P[W+2]=z.z,P[W+3]=A.x,P[W+4]=A.y,P[W+5]=A.z,P[W+6]=B.x,P[W+7]=B.y,P[W+8]=B.z,W+=9;k=0;for(m=r.length;k<m;k++)s=da[r[k]],z=ba[s.a].position,A=ba[s.b].position,
-B=ba[s.c].position,s=ba[s.d].position,P[W]=z.x,P[W+1]=z.y,P[W+2]=z.z,P[W+3]=A.x,P[W+4]=A.y,P[W+5]=A.z,P[W+6]=B.x,P[W+7]=B.y,P[W+8]=B.z,P[W+9]=s.x,P[W+10]=s.y,P[W+11]=s.z,W+=12;d.bindBuffer(d.ARRAY_BUFFER,l.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,P,w)}if(ea){W=0;for(ea=qa.length;W<ea;W++){k=P=0;for(m=y.length;k<m;k++)s=da[y[k]],z=qa[W].vertices[s.a].position,A=qa[W].vertices[s.b].position,B=qa[W].vertices[s.c].position,ba=N[W],ba[P]=z.x,ba[P+1]=z.y,ba[P+2]=z.z,ba[P+3]=A.x,ba[P+4]=A.y,ba[P+
-5]=A.z,ba[P+6]=B.x,ba[P+7]=B.y,ba[P+8]=B.z,P+=9;k=0;for(m=r.length;k<m;k++)s=da[r[k]],z=qa[W].vertices[s.a].position,A=qa[W].vertices[s.b].position,B=qa[W].vertices[s.c].position,s=qa[W].vertices[s.d].position,ba=N[W],ba[P]=z.x,ba[P+1]=z.y,ba[P+2]=z.z,ba[P+3]=A.x,ba[P+4]=A.y,ba[P+5]=A.z,ba[P+6]=B.x,ba[P+7]=B.y,ba[P+8]=B.z,ba[P+9]=s.x,ba[P+10]=s.y,ba[P+11]=s.z,P+=12;d.bindBuffer(d.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[W]);d.bufferData(d.ARRAY_BUFFER,N[W],w)}}if(pa.length){k=0;for(m=y.length;k<
-m;k++)s=da[y[k]],z=pa[s.a],A=pa[s.b],B=pa[s.c],fa[u]=z.x,fa[u+1]=z.y,fa[u+2]=z.z,fa[u+3]=z.w,fa[u+4]=A.x,fa[u+5]=A.y,fa[u+6]=A.z,fa[u+7]=A.w,fa[u+8]=B.x,fa[u+9]=B.y,fa[u+10]=B.z,fa[u+11]=B.w,z=oa[s.a],A=oa[s.b],B=oa[s.c],G[u]=z.x,G[u+1]=z.y,G[u+2]=z.z,G[u+3]=z.w,G[u+4]=A.x,G[u+5]=A.y,G[u+6]=A.z,G[u+7]=A.w,G[u+8]=B.x,G[u+9]=B.y,G[u+10]=B.z,G[u+11]=B.w,z=ja[s.a],A=ja[s.b],B=ja[s.c],T[u]=z.x,T[u+1]=z.y,T[u+2]=z.z,T[u+3]=1,T[u+4]=A.x,T[u+5]=A.y,T[u+6]=A.z,T[u+7]=1,T[u+8]=B.x,T[u+9]=B.y,T[u+10]=B.z,T[u+
-11]=1,z=ka[s.a],A=ka[s.b],B=ka[s.c],U[u]=z.x,U[u+1]=z.y,U[u+2]=z.z,U[u+3]=1,U[u+4]=A.x,U[u+5]=A.y,U[u+6]=A.z,U[u+7]=1,U[u+8]=B.x,U[u+9]=B.y,U[u+10]=B.z,U[u+11]=1,u+=12;k=0;for(m=r.length;k<m;k++)s=da[r[k]],z=pa[s.a],A=pa[s.b],B=pa[s.c],N=pa[s.d],fa[u]=z.x,fa[u+1]=z.y,fa[u+2]=z.z,fa[u+3]=z.w,fa[u+4]=A.x,fa[u+5]=A.y,fa[u+6]=A.z,fa[u+7]=A.w,fa[u+8]=B.x,fa[u+9]=B.y,fa[u+10]=B.z,fa[u+11]=B.w,fa[u+12]=N.x,fa[u+13]=N.y,fa[u+14]=N.z,fa[u+15]=N.w,z=oa[s.a],A=oa[s.b],B=oa[s.c],N=oa[s.d],G[u]=z.x,G[u+1]=z.y,
-G[u+2]=z.z,G[u+3]=z.w,G[u+4]=A.x,G[u+5]=A.y,G[u+6]=A.z,G[u+7]=A.w,G[u+8]=B.x,G[u+9]=B.y,G[u+10]=B.z,G[u+11]=B.w,G[u+12]=N.x,G[u+13]=N.y,G[u+14]=N.z,G[u+15]=N.w,z=ja[s.a],A=ja[s.b],B=ja[s.c],N=ja[s.d],T[u]=z.x,T[u+1]=z.y,T[u+2]=z.z,T[u+3]=1,T[u+4]=A.x,T[u+5]=A.y,T[u+6]=A.z,T[u+7]=1,T[u+8]=B.x,T[u+9]=B.y,T[u+10]=B.z,T[u+11]=1,T[u+12]=N.x,T[u+13]=N.y,T[u+14]=N.z,T[u+15]=1,z=ka[s.a],A=ka[s.b],B=ka[s.c],s=ka[s.d],U[u]=z.x,U[u+1]=z.y,U[u+2]=z.z,U[u+3]=1,U[u+4]=A.x,U[u+5]=A.y,U[u+6]=A.z,U[u+7]=1,U[u+8]=
-B.x,U[u+9]=B.y,U[u+10]=B.z,U[u+11]=1,U[u+12]=s.x,U[u+13]=s.y,U[u+14]=s.z,U[u+15]=1,u+=16;u>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,T,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,U,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,G,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,fa,w))}if(sa&&R){k=0;for(m=y.length;k<m;k++)s=da[y[k]],
-u=s.vertexColors,G=s.color,u.length===3&&R===THREE.VertexColors?(s=u[0],T=u[1],U=u[2]):U=T=s=G,$[Z]=s.r,$[Z+1]=s.g,$[Z+2]=s.b,$[Z+3]=T.r,$[Z+4]=T.g,$[Z+5]=T.b,$[Z+6]=U.r,$[Z+7]=U.g,$[Z+8]=U.b,Z+=9;k=0;for(m=r.length;k<m;k++)s=da[r[k]],u=s.vertexColors,G=s.color,u.length===4&&R===THREE.VertexColors?(s=u[0],T=u[1],U=u[2],u=u[3]):u=U=T=s=G,$[Z]=s.r,$[Z+1]=s.g,$[Z+2]=s.b,$[Z+3]=T.r,$[Z+4]=T.g,$[Z+5]=T.b,$[Z+6]=U.r,$[Z+7]=U.g,$[Z+8]=U.b,$[Z+9]=u.r,$[Z+10]=u.g,$[Z+11]=u.b,Z+=12;Z>0&&(d.bindBuffer(d.ARRAY_BUFFER,
-l.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,$,w))}if(ma&&J.hasTangents){k=0;for(m=y.length;k<m;k++)s=da[y[k]],J=s.vertexTangents,Z=J[0],$=J[1],R=J[2],D[K]=Z.x,D[K+1]=Z.y,D[K+2]=Z.z,D[K+3]=Z.w,D[K+4]=$.x,D[K+5]=$.y,D[K+6]=$.z,D[K+7]=$.w,D[K+8]=R.x,D[K+9]=R.y,D[K+10]=R.z,D[K+11]=R.w,K+=12;k=0;for(m=r.length;k<m;k++)s=da[r[k]],J=s.vertexTangents,Z=J[0],$=J[1],R=J[2],J=J[3],D[K]=Z.x,D[K+1]=Z.y,D[K+2]=Z.z,D[K+3]=Z.w,D[K+4]=$.x,D[K+5]=$.y,D[K+6]=$.z,D[K+7]=$.w,D[K+8]=R.x,D[K+9]=R.y,D[K+10]=R.z,D[K+
-11]=R.w,D[K+12]=J.x,D[K+13]=J.y,D[K+14]=J.z,D[K+15]=J.w,K+=16;d.bindBuffer(d.ARRAY_BUFFER,l.__webglTangentBuffer);d.bufferData(d.ARRAY_BUFFER,D,w)}if(la&&L){k=0;for(m=y.length;k<m;k++)if(s=da[y[k]],D=s.vertexNormals,L=s.normal,D.length===3&&ga)for(K=0;K<3;K++)L=D[K],O[C]=L.x,O[C+1]=L.y,O[C+2]=L.z,C+=3;else for(K=0;K<3;K++)O[C]=L.x,O[C+1]=L.y,O[C+2]=L.z,C+=3;k=0;for(m=r.length;k<m;k++)if(s=da[r[k]],D=s.vertexNormals,L=s.normal,D.length===4&&ga)for(K=0;K<4;K++)L=D[K],O[C]=L.x,O[C+1]=L.y,O[C+2]=L.z,
-C+=3;else for(K=0;K<4;K++)O[C]=L.x,O[C+1]=L.y,O[C+2]=L.z,C+=3;d.bindBuffer(d.ARRAY_BUFFER,l.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,O,w)}if(ha&&na&&X){k=0;for(m=y.length;k<m;k++)if(C=y[k],C=na[C],C!==void 0)for(K=0;K<3;K++)O=C[K],V[Q]=O.u,V[Q+1]=O.v,Q+=2;k=0;for(m=r.length;k<m;k++)if(C=r[k],C=na[C],C!==void 0)for(K=0;K<4;K++)O=C[K],V[Q]=O.u,V[Q+1]=O.v,Q+=2;Q>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,V,w))}if(ha&&ra&&X){k=0;for(m=y.length;k<m;k++)if(C=
-y[k],Q=ra[C],Q!==void 0)for(K=0;K<3;K++)V=Q[K],t[H]=V.u,t[H+1]=V.v,H+=2;k=0;for(m=r.length;k<m;k++)if(C=r[k],Q=ra[C],Q!==void 0)for(K=0;K<4;K++)V=Q[K],t[H]=V.u,t[H+1]=V.v,H+=2;H>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,t,w))}if(ia){k=0;for(m=y.length;k<m;k++)n[S]=Y,n[S+1]=Y+1,n[S+2]=Y+2,S+=3,ca[aa]=Y,ca[aa+1]=Y+1,ca[aa+2]=Y,ca[aa+3]=Y+2,ca[aa+4]=Y+1,ca[aa+5]=Y+2,aa+=6,Y+=3;k=0;for(m=r.length;k<m;k++)n[S]=Y,n[S+1]=Y+1,n[S+2]=Y+3,n[S+3]=Y+1,n[S+4]=Y+2,n[S+5]=Y+
-3,S+=6,ca[aa]=Y,ca[aa+1]=Y+1,ca[aa+2]=Y,ca[aa+3]=Y+3,ca[aa+4]=Y+1,ca[aa+5]=Y+2,ca[aa+6]=Y+2,ca[aa+7]=Y+3,aa+=8,Y+=4;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,n,w);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ca,w)}if(p){K=0;for(Y=p.length;K<Y;K++)if(n=p[K],n.__original.needsUpdate){t=0;if(n.size===1)if(n.boundTo===void 0||n.boundTo==="vertices"){k=0;for(m=y.length;k<m;k++)s=da[y[k]],n.array[t]=n.value[s.a],
-n.array[t+1]=n.value[s.b],n.array[t+2]=n.value[s.c],t+=3;k=0;for(m=r.length;k<m;k++)s=da[r[k]],n.array[t]=n.value[s.a],n.array[t+1]=n.value[s.b],n.array[t+2]=n.value[s.c],n.array[t+3]=n.value[s.d],t+=4}else{if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)ca=n.value[y[k]],n.array[t]=ca,n.array[t+1]=ca,n.array[t+2]=ca,t+=3;k=0;for(m=r.length;k<m;k++)ca=n.value[r[k]],n.array[t]=ca,n.array[t+1]=ca,n.array[t+2]=ca,n.array[t+3]=ca,t+=4}}else if(n.size===2)if(n.boundTo===void 0||n.boundTo==="vertices"){k=
-0;for(m=y.length;k<m;k++)s=da[y[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=A.x,n.array[t+3]=A.y,n.array[t+4]=B.x,n.array[t+5]=B.y,t+=6;k=0;for(m=r.length;k<m;k++)s=da[r[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],s=n.value[s.d],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=A.x,n.array[t+3]=A.y,n.array[t+4]=B.x,n.array[t+5]=B.y,n.array[t+6]=s.x,n.array[t+7]=s.y,t+=8}else{if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)B=A=z=ca=n.value[y[k]],
-n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=A.x,n.array[t+3]=A.y,n.array[t+4]=B.x,n.array[t+5]=B.y,t+=6;k=0;for(m=r.length;k<m;k++)s=B=A=z=ca=n.value[r[k]],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=A.x,n.array[t+3]=A.y,n.array[t+4]=B.x,n.array[t+5]=B.y,n.array[t+6]=s.x,n.array[t+7]=s.y,t+=8}}else if(n.size===3)if(H=n.type==="c"?["r","g","b"]:["x","y","z"],n.boundTo===void 0||n.boundTo==="vertices"){k=0;for(m=y.length;k<m;k++)s=da[y[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],n.array[t]=z[H[0]],
-n.array[t+1]=z[H[1]],n.array[t+2]=z[H[2]],n.array[t+3]=A[H[0]],n.array[t+4]=A[H[1]],n.array[t+5]=A[H[2]],n.array[t+6]=B[H[0]],n.array[t+7]=B[H[1]],n.array[t+8]=B[H[2]],t+=9;k=0;for(m=r.length;k<m;k++)s=da[r[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],s=n.value[s.d],n.array[t]=z[H[0]],n.array[t+1]=z[H[1]],n.array[t+2]=z[H[2]],n.array[t+3]=A[H[0]],n.array[t+4]=A[H[1]],n.array[t+5]=A[H[2]],n.array[t+6]=B[H[0]],n.array[t+7]=B[H[1]],n.array[t+8]=B[H[2]],n.array[t+9]=s[H[0]],n.array[t+10]=s[H[1]],
-n.array[t+11]=s[H[2]],t+=12}else{if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)B=A=z=ca=n.value[y[k]],n.array[t]=z[H[0]],n.array[t+1]=z[H[1]],n.array[t+2]=z[H[2]],n.array[t+3]=A[H[0]],n.array[t+4]=A[H[1]],n.array[t+5]=A[H[2]],n.array[t+6]=B[H[0]],n.array[t+7]=B[H[1]],n.array[t+8]=B[H[2]],t+=9;k=0;for(m=r.length;k<m;k++)s=B=A=z=ca=n.value[r[k]],n.array[t]=z[H[0]],n.array[t+1]=z[H[1]],n.array[t+2]=z[H[2]],n.array[t+3]=A[H[0]],n.array[t+4]=A[H[1]],n.array[t+5]=A[H[2]],n.array[t+6]=B[H[0]],n.array[t+
-7]=B[H[1]],n.array[t+8]=B[H[2]],n.array[t+9]=s[H[0]],n.array[t+10]=s[H[1]],n.array[t+11]=s[H[2]],t+=12}}else if(n.size===4)if(n.boundTo===void 0||n.boundTo==="vertices"){k=0;for(m=y.length;k<m;k++)s=da[y[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=z.z,n.array[t+3]=z.w,n.array[t+4]=A.x,n.array[t+5]=A.y,n.array[t+6]=A.z,n.array[t+7]=A.w,n.array[t+8]=B.x,n.array[t+9]=B.y,n.array[t+10]=B.z,n.array[t+11]=B.w,t+=12;k=0;for(m=r.length;k<m;k++)s=da[r[k]],
-z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],s=n.value[s.d],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=z.z,n.array[t+3]=z.w,n.array[t+4]=A.x,n.array[t+5]=A.y,n.array[t+6]=A.z,n.array[t+7]=A.w,n.array[t+8]=B.x,n.array[t+9]=B.y,n.array[t+10]=B.z,n.array[t+11]=B.w,n.array[t+12]=s.x,n.array[t+13]=s.y,n.array[t+14]=s.z,n.array[t+15]=s.w,t+=16}else if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)B=A=z=ca=n.value[y[k]],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=z.z,n.array[t+3]=z.w,n.array[t+4]=A.x,
-n.array[t+5]=A.y,n.array[t+6]=A.z,n.array[t+7]=A.w,n.array[t+8]=B.x,n.array[t+9]=B.y,n.array[t+10]=B.z,n.array[t+11]=B.w,t+=12;k=0;for(m=r.length;k<m;k++)s=B=A=z=ca=n.value[r[k]],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=z.z,n.array[t+3]=z.w,n.array[t+4]=A.x,n.array[t+5]=A.y,n.array[t+6]=A.z,n.array[t+7]=A.w,n.array[t+8]=B.x,n.array[t+9]=B.y,n.array[t+10]=B.z,n.array[t+11]=B.w,n.array[t+12]=s.x,n.array[t+13]=s.y,n.array[t+14]=s.z,n.array[t+15]=s.w,t+=16}d.bindBuffer(d.ARRAY_BUFFER,n.buffer);d.bufferData(d.ARRAY_BUFFER,
-n.array,w)}}o&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}i.__dirtyVertices=!1;i.__dirtyMorphTargets=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyColors=!1;i.__dirtyTangents=!1;h.attributes&&I(h)}else if(v instanceof
-THREE.Ribbon){if(i.__dirtyVertices||i.__dirtyColors){h=i;v=d.DYNAMIC_DRAW;k=j=k=o=o=void 0;m=h.vertices;q=h.colors;p=m.length;l=q.length;y=h.__vertexArray;w=h.__colorArray;r=h.__dirtyColors;if(h.__dirtyVertices){for(o=0;o<p;o++)k=m[o].position,j=o*3,y[j]=k.x,y[j+1]=k.y,y[j+2]=k.z;d.bindBuffer(d.ARRAY_BUFFER,h.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,y,v)}if(r){for(o=0;o<l;o++)k=q[o],j=o*3,w[j]=k.r,w[j+1]=k.g,w[j+2]=k.b;d.bindBuffer(d.ARRAY_BUFFER,h.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,
-w,v)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(v instanceof THREE.Line){h=c(v,l);w=h.attributes&&F(h);if(i.__dirtyVertices||i.__dirtyColors||w){v=i;j=d.DYNAMIC_DRAW;p=q=Y=m=da=void 0;m=v.vertices;l=v.colors;p=m.length;w=l.length;y=v.__vertexArray;o=v.__colorArray;r=v.__dirtyColors;k=v.__webglCustomAttributesList;Q=aa=S=H=Y=da=void 0;if(v.__dirtyVertices){for(da=0;da<p;da++)Y=m[da].position,q=da*3,y[q]=Y.x,y[q+1]=Y.y,y[q+2]=Y.z;d.bindBuffer(d.ARRAY_BUFFER,v.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,
-y,j)}if(r){for(m=0;m<w;m++)p=l[m],q=m*3,o[q]=p.r,o[q+1]=p.g,o[q+2]=p.b;d.bindBuffer(d.ARRAY_BUFFER,v.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,o,j)}if(k){da=0;for(Y=k.length;da<Y;da++)if(Q=k[da],Q.needsUpdate&&(Q.boundTo===void 0||Q.boundTo==="vertices")){q=0;S=Q.value.length;if(Q.size===1)for(H=0;H<S;H++)Q.array[H]=Q.value[H];else if(Q.size===2)for(H=0;H<S;H++)aa=Q.value[H],Q.array[q]=aa.x,Q.array[q+1]=aa.y,q+=2;else if(Q.size===3)if(Q.type==="c")for(H=0;H<S;H++)aa=Q.value[H],Q.array[q]=aa.r,
-Q.array[q+1]=aa.g,Q.array[q+2]=aa.b,q+=3;else for(H=0;H<S;H++)aa=Q.value[H],Q.array[q]=aa.x,Q.array[q+1]=aa.y,Q.array[q+2]=aa.z,q+=3;else if(Q.size===4)for(H=0;H<S;H++)aa=Q.value[H],Q.array[q]=aa.x,Q.array[q+1]=aa.y,Q.array[q+2]=aa.z,Q.array[q+3]=aa.w,q+=4;d.bindBuffer(d.ARRAY_BUFFER,Q.buffer);d.bufferData(d.ARRAY_BUFFER,Q.array,j)}}}i.__dirtyVertices=!1;i.__dirtyColors=!1;h.attributes&&I(h)}else if(v instanceof THREE.ParticleSystem)h=c(v,l),w=h.attributes&&F(h),(i.__dirtyVertices||i.__dirtyColors||
-v.sortParticles||w)&&e(i,d.DYNAMIC_DRAW,v),i.__dirtyVertices=!1,i.__dirtyColors=!1,h.attributes&&I(h)};this.initMaterial=function(a,b,c,e){var f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");
-if(i){var j=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(j.uniforms);a.vertexShader=j.vertexShader;a.fragmentShader=j.fragmentShader}var o,k,m;o=m=j=0;for(k=b.length;o<k;o++)h=b[o],h instanceof THREE.SpotLight&&m++,h instanceof THREE.DirectionalLight&&m++,h instanceof THREE.PointLight&&j++;j+m<=ja?o=m:(o=Math.ceil(ja*m/(j+m)),j=ja-o);h={directional:o,point:j};j=m=0;for(o=b.length;j<o;j++)k=b[j],k instanceof THREE.SpotLight&&k.castShadow&&m++;var r=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)r=
-e.bones.length;var p;a:{o=a.fragmentShader;k=a.vertexShader;var j=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:r,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,
-maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},v,e=[];i?e.push(i):(e.push(o),e.push(k));for(v in c)e.push(v),e.push(c[v]);i=e.join();v=0;for(e=O.length;v<e;v++)if(O[v].code===i){p=O[v].program;break a}v=d.createProgram();e=[Va?"#define VERTEX_TEXTURES":"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,
+d.deleteBuffer(c.__webglSkinIndicesBuffer);d.deleteBuffer(c.__webglSkinWeightsBuffer);d.deleteBuffer(c.__webglFaceBuffer);d.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e<f;e++)d.deleteBuffer(c.__webglMorphTargetsBuffers[e]);D.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),
+d.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),D.info.memory.textures--};this.updateShadowMap=function(a,b){p(a,b)};this.render=function(a,b,c,e){var f,g,q,l,w=a.lights,u=a.fog;oa=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);
+this.shadowMapEnabled&&this.shadowMapAutoUpdate&&p(a,b);D.info.render.calls=0;D.info.render.vertices=0;D.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ka);b.projectionMatrix.flattenToArray(La);za.multiply(b.projectionMatrix,b.matrixWorldInverse);j(za);ra(c);(this.autoClear||e)&&this.clear(this.autoClearColor,
+this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;e=0;for(f=l.length;e<f;e++)if(g=l[e],q=g.object,g.render=!1,q.visible&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||h(q))){q.matrixWorld.flattenToArray(q._objectMatrixArray);pa(q,b,!0);var k=g,m=k.object,C=k.buffer,y=void 0,y=y=void 0,y=m.material;if(y instanceof THREE.MeshFaceMaterial){if(y=C.materialIndex,y>=0)y=m.geometry.materials[y],y.transparent?(k.transparent=y,k.opaque=null):(k.opaque=y,k.transparent=null)}else if(y)y.transparent?
+(k.transparent=y,k.opaque=null):(k.opaque=y,k.transparent=null);g.render=!0;if(this.sortObjects)q.renderDepth?g.z=q.renderDepth:(Ca.copy(q.position),za.multiplyVector3(Ca),g.z=Ca.z)}this.sortObjects&&l.sort(r);l=a.__webglObjectsImmediate;e=0;for(f=l.length;e<f;e++)if(g=l[e],q=g.object,q.visible)q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),pa(q,b,!0),q=g.object.material,q.transparent?(g.transparent=q,g.opaque=null):(g.opaque=q,g.transparent=null);a.overrideMaterial?(ia(a.overrideMaterial.blending),
+ha(a.overrideMaterial.depthTest),la(a.overrideMaterial.depthWrite),F(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,w,u,!0,a.overrideMaterial),o(a.__webglObjectsImmediate,"",b,w,u,!1,a.overrideMaterial)):(ia(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,w,u,!1),o(a.__webglObjectsImmediate,"opaque",b,w,u,!1),i(a.__webglObjects,!1,"transparent",b,w,u,!0),o(a.__webglObjectsImmediate,"transparent",b,w,
+u,!0));if(a.__webglSprites.length){q=x.attributes;w=x.uniforms;u=Da/Ha;e=[];f=Ha*0.5;l=Da*0.5;g=!0;d.useProgram(x.program);ja=x.program;ta=wa=ya=-1;Va||(d.enableVertexAttribArray(x.attributes.position),d.enableVertexAttribArray(x.attributes.uv),Va=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,x.vertexBuffer);d.vertexAttribPointer(q.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(q.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,x.elementBuffer);
+d.uniformMatrix4fv(w.projectionMatrix,!1,La);d.activeTexture(d.TEXTURE0);d.uniform1i(w.map,0);q=0;for(k=a.__webglSprites.length;q<k;q++)if(m=a.__webglSprites[q],m.visible&&m.opacity!==0)m.useScreenCoordinates?m.z=-m.position.z:(m._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),m.z=-m._modelViewMatrix.n34);a.__webglSprites.sort(r);q=0;for(k=a.__webglSprites.length;q<k;q++)m=a.__webglSprites[q],m.visible&&m.opacity!==0&&m.map&&m.map.image&&m.map.image.width&&
+(m.useScreenCoordinates?(d.uniform1i(w.useScreenCoordinates,1),d.uniform3f(w.screenPosition,(m.position.x-f)/f,(l-m.position.y)/l,Math.max(0,Math.min(1,m.position.z)))):(d.uniform1i(w.useScreenCoordinates,0),d.uniform1i(w.affectedByDistance,m.affectedByDistance?1:0),d.uniformMatrix4fv(w.modelViewMatrix,!1,m._modelViewMatrixArray)),b=m.map.image.width/(m.scaleByViewport?Da:1),e[0]=b*u*m.scale.x,e[1]=b*m.scale.y,d.uniform2f(w.uvScale,m.uvScale.x,m.uvScale.y),d.uniform2f(w.uvOffset,m.uvOffset.x,m.uvOffset.y),
+d.uniform2f(w.alignment,m.alignment.x,m.alignment.y),d.uniform1f(w.opacity,m.opacity),d.uniform3f(w.color,m.color.r,m.color.g,m.color.b),d.uniform1f(w.rotation,m.rotation),d.uniform2fv(w.scale,e),m.mergeWith3D&&!g?(d.enable(d.DEPTH_TEST),g=!0):!m.mergeWith3D&&g&&(d.disable(d.DEPTH_TEST),g=!1),ia(m.blending),qa(m.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(Oa)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&
+(c instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,c.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP,null)):(d.bindTexture(d.TEXTURE_2D,c.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],g=a,j=void 0,h=void 0,i=void 0;if(!f.__webglInit)if(f.__webglInit=
+!0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),f instanceof THREE.Mesh){h=f.geometry;if(h.geometryGroups===void 0){var i=h,q=void 0,l=void 0,w=void 0,o=void 0,k=void 0,m=void 0,p=void 0,y={},r=i.morphTargets.length;i.geometryGroups={};q=0;for(l=i.faces.length;q<l;q++)w=i.faces[q],o=w.materialIndex,m=o!==void 0?o:-1,y[m]===void 0&&
+(y[m]={hash:m,counter:0}),p=y[m].hash+"_"+y[m].counter,i.geometryGroups[p]===void 0&&(i.geometryGroups[p]={faces3:[],faces4:[],materialIndex:o,vertices:0,numMorphTargets:r}),k=w instanceof THREE.Face3?3:4,i.geometryGroups[p].vertices+k>65535&&(y[m].counter+=1,p=y[m].hash+"_"+y[m].counter,i.geometryGroups[p]===void 0&&(i.geometryGroups[p]={faces3:[],faces4:[],materialIndex:o,vertices:0,numMorphTargets:r})),w instanceof THREE.Face3?i.geometryGroups[p].faces3.push(q):i.geometryGroups[p].faces4.push(q),
+i.geometryGroups[p].vertices+=k;i.geometryGroupsList=[];q=void 0;for(q in i.geometryGroups)i.geometryGroups[q].id=Ea++,i.geometryGroupsList.push(i.geometryGroups[q])}for(j in h.geometryGroups)if(i=h.geometryGroups[j],!i.__webglVertexBuffer){q=i;q.__webglVertexBuffer=d.createBuffer();q.__webglNormalBuffer=d.createBuffer();q.__webglTangentBuffer=d.createBuffer();q.__webglColorBuffer=d.createBuffer();q.__webglUVBuffer=d.createBuffer();q.__webglUV2Buffer=d.createBuffer();q.__webglSkinVertexABuffer=d.createBuffer();
+q.__webglSkinVertexBBuffer=d.createBuffer();q.__webglSkinIndicesBuffer=d.createBuffer();q.__webglSkinWeightsBuffer=d.createBuffer();q.__webglFaceBuffer=d.createBuffer();q.__webglLineBuffer=d.createBuffer();if(q.numMorphTargets){w=l=void 0;q.__webglMorphTargetsBuffers=[];l=0;for(w=q.numMorphTargets;l<w;l++)q.__webglMorphTargetsBuffers.push(d.createBuffer())}D.info.memory.geometries++;o=f;k=o.geometry;l=i.faces3;m=i.faces4;q=l.length*3+m.length*4;w=l.length*1+m.length*2;m=l.length*3+m.length*4;l=c(o,
+i);p=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;y=l instanceof THREE.MeshBasicMaterial&&!l.envMap||l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;r=l.vertexColors?l.vertexColors:!1;i.__vertexArray=new Float32Array(q*3);if(y)i.__normalArray=new Float32Array(q*3);if(k.hasTangents)i.__tangentArray=new Float32Array(q*4);if(r)i.__colorArray=new Float32Array(q*3);if(p){if(k.faceUvs.length>0||k.faceVertexUvs.length>
+0)i.__uvArray=new Float32Array(q*2);if(k.faceUvs.length>1||k.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(q*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(q*4),i.__skinVertexBArray=new Float32Array(q*4),i.__skinIndexArray=new Float32Array(q*4),i.__skinWeightArray=new Float32Array(q*4);i.__faceArray=new Uint16Array(w*3);i.__lineArray=new Uint16Array(m*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];o=0;for(k=i.numMorphTargets;o<k;o++)i.__morphTargetsArrays.push(new Float32Array(q*
+3))}i.__needsSmoothNormals=y===THREE.SmoothShading;i.__uvType=p;i.__vertexColorType=r;i.__normalType=y;i.__webglFaceCount=w*3;i.__webglLineCount=m*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];w=void 0;for(w in l.attributes){var o=l.attributes[w],k={},x;for(x in o)k[x]=o[x];if(!k.__webglInitialized||k.createUniqueBuffers)k.__webglInitialized=!0,m=1,k.type==="v2"?m=2:k.type==="v3"?m=3:k.type==="v4"?m=4:k.type==="c"&&(m=3),k.size=m,k.array=new Float32Array(q*
+m),k.buffer=d.createBuffer(),k.buffer.belongsToAttribute=w,o.needsUpdate=!0,k.__original=o;i.__webglCustomAttributesList.push(k)}}i.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(f instanceof THREE.Ribbon){if(h=f.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=d.createBuffer(),i.__webglColorBuffer=d.createBuffer(),D.info.memory.geometries++,i=h,q=i.vertices.length,
+i.__vertexArray=new Float32Array(q*3),i.__colorArray=new Float32Array(q*3),i.__webglVertexCount=q,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof THREE.Line){if(h=f.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=d.createBuffer(),i.__webglColorBuffer=d.createBuffer(),D.info.memory.geometries++,i=h,q=f,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__webglLineCount=l,b(i,q),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(f instanceof
+THREE.ParticleSystem&&(h=f.geometry,!h.__webglVertexBuffer))i=h,i.__webglVertexBuffer=d.createBuffer(),i.__webglColorBuffer=d.createBuffer(),D.info.geometries++,i=h,q=f,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__sortArray=[],i.__webglParticleCount=l,b(i,q),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(j in h=f.geometry,h.geometryGroups)i=h.geometryGroups[j],u(g.__webglObjects,i,f);else f instanceof
+THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(h=f.geometry,u(g.__webglObjects,h,f)):THREE.MarchingCubes!==void 0&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?g.__webglObjectsImmediate.push({object:f,opaque:null,transparent:null}):f instanceof THREE.Sprite&&g.__webglSprites.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){f=a.__objectsRemoved[0];g=a;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof
+THREE.Ribbon||f instanceof THREE.Line)J(g.__webglObjects,f);else if(f instanceof THREE.Sprite){g=g.__webglSprites;j=f;for(h=g.length-1;h>=0;h--)g[h]===j&&g.splice(h,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&J(g.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(g=a.__webglObjects.length;f<g;f++)if(x=a.__webglObjects[f].object,j=x.geometry,h=w=l=void 0,x instanceof THREE.Mesh){i=0;for(q=j.geometryGroupsList.length;i<q;i++)if(l=j.geometryGroupsList[i],
+h=c(x,l),w=h.attributes&&C(h),j.__dirtyVertices||j.__dirtyMorphTargets||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents||w)if(w=d.DYNAMIC_DRAW,o=!j.dynamic,l.__inittedArrays){var E=m=k=void 0,s=void 0,F=void 0,K=void 0,v=void 0,Y=void 0,Z=void 0,X=void 0,O=void 0,Q=E=K=void 0,z=void 0,A=void 0,B=void 0,W=s=void 0,$=void 0,S=s=Z=O=void 0,T=void 0,L=B=A=z=v=void 0,H=s=B=A=z=L=B=A=z=L=B=A=z=void 0,V=void 0,M=K=void 0,R=void 0,U=void 0,ba=void 0,ca=void 0,G=Q=U=V=
+0,P=0,aa=H=E=0,N=v=W=0,t=0,da=void 0,N=l.__vertexArray,R=l.__uvArray,t=l.__uv2Array,M=l.__normalArray,F=l.__tangentArray,$=l.__colorArray,S=l.__skinVertexAArray,T=l.__skinVertexBArray,Y=l.__skinIndexArray,fa=l.__skinWeightArray,L=l.__morphTargetsArrays,p=l.__webglCustomAttributesList,n=void 0,n=l.__faceArray,da=l.__lineArray,ga=l.__needsSmoothNormals,O=l.__vertexColorType,X=l.__uvType,K=l.__normalType,Z=x.geometry,ia=Z.__dirtyElements,ha=Z.__dirtyUvs,pa=Z.__dirtyNormals,ra=Z.__dirtyTangents,sa=Z.__dirtyColors,
+ba=Z.__dirtyMorphTargets,ca=Z.vertices,y=l.faces3,r=l.faces4,ea=Z.faces,na=Z.faceVertexUvs[0],qa=Z.faceVertexUvs[1],ja=Z.skinVerticesA,ka=Z.skinVerticesB,la=Z.skinIndices,ma=Z.skinWeights,oa=Z.morphTargets;if(Z.__dirtyVertices){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],z=ca[s.a].position,A=ca[s.b].position,B=ca[s.c].position,N[U]=z.x,N[U+1]=z.y,N[U+2]=z.z,N[U+3]=A.x,N[U+4]=A.y,N[U+5]=A.z,N[U+6]=B.x,N[U+7]=B.y,N[U+8]=B.z,U+=9;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],z=ca[s.a].position,A=ca[s.b].position,
+B=ca[s.c].position,s=ca[s.d].position,N[U]=z.x,N[U+1]=z.y,N[U+2]=z.z,N[U+3]=A.x,N[U+4]=A.y,N[U+5]=A.z,N[U+6]=B.x,N[U+7]=B.y,N[U+8]=B.z,N[U+9]=s.x,N[U+10]=s.y,N[U+11]=s.z,U+=12;d.bindBuffer(d.ARRAY_BUFFER,l.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,N,w)}if(ba){U=0;for(ba=oa.length;U<ba;U++){k=N=0;for(m=y.length;k<m;k++)s=ea[y[k]],z=oa[U].vertices[s.a].position,A=oa[U].vertices[s.b].position,B=oa[U].vertices[s.c].position,ca=L[U],ca[N]=z.x,ca[N+1]=z.y,ca[N+2]=z.z,ca[N+3]=A.x,ca[N+4]=A.y,ca[N+
+5]=A.z,ca[N+6]=B.x,ca[N+7]=B.y,ca[N+8]=B.z,N+=9;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],z=oa[U].vertices[s.a].position,A=oa[U].vertices[s.b].position,B=oa[U].vertices[s.c].position,s=oa[U].vertices[s.d].position,ca=L[U],ca[N]=z.x,ca[N+1]=z.y,ca[N+2]=z.z,ca[N+3]=A.x,ca[N+4]=A.y,ca[N+5]=A.z,ca[N+6]=B.x,ca[N+7]=B.y,ca[N+8]=B.z,ca[N+9]=s.x,ca[N+10]=s.y,ca[N+11]=s.z,N+=12;d.bindBuffer(d.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[U]);d.bufferData(d.ARRAY_BUFFER,L[U],w)}}if(ma.length){k=0;for(m=y.length;k<
+m;k++)s=ea[y[k]],z=ma[s.a],A=ma[s.b],B=ma[s.c],fa[v]=z.x,fa[v+1]=z.y,fa[v+2]=z.z,fa[v+3]=z.w,fa[v+4]=A.x,fa[v+5]=A.y,fa[v+6]=A.z,fa[v+7]=A.w,fa[v+8]=B.x,fa[v+9]=B.y,fa[v+10]=B.z,fa[v+11]=B.w,z=la[s.a],A=la[s.b],B=la[s.c],Y[v]=z.x,Y[v+1]=z.y,Y[v+2]=z.z,Y[v+3]=z.w,Y[v+4]=A.x,Y[v+5]=A.y,Y[v+6]=A.z,Y[v+7]=A.w,Y[v+8]=B.x,Y[v+9]=B.y,Y[v+10]=B.z,Y[v+11]=B.w,z=ja[s.a],A=ja[s.b],B=ja[s.c],S[v]=z.x,S[v+1]=z.y,S[v+2]=z.z,S[v+3]=1,S[v+4]=A.x,S[v+5]=A.y,S[v+6]=A.z,S[v+7]=1,S[v+8]=B.x,S[v+9]=B.y,S[v+10]=B.z,S[v+
+11]=1,z=ka[s.a],A=ka[s.b],B=ka[s.c],T[v]=z.x,T[v+1]=z.y,T[v+2]=z.z,T[v+3]=1,T[v+4]=A.x,T[v+5]=A.y,T[v+6]=A.z,T[v+7]=1,T[v+8]=B.x,T[v+9]=B.y,T[v+10]=B.z,T[v+11]=1,v+=12;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],z=ma[s.a],A=ma[s.b],B=ma[s.c],L=ma[s.d],fa[v]=z.x,fa[v+1]=z.y,fa[v+2]=z.z,fa[v+3]=z.w,fa[v+4]=A.x,fa[v+5]=A.y,fa[v+6]=A.z,fa[v+7]=A.w,fa[v+8]=B.x,fa[v+9]=B.y,fa[v+10]=B.z,fa[v+11]=B.w,fa[v+12]=L.x,fa[v+13]=L.y,fa[v+14]=L.z,fa[v+15]=L.w,z=la[s.a],A=la[s.b],B=la[s.c],L=la[s.d],Y[v]=z.x,Y[v+1]=z.y,
+Y[v+2]=z.z,Y[v+3]=z.w,Y[v+4]=A.x,Y[v+5]=A.y,Y[v+6]=A.z,Y[v+7]=A.w,Y[v+8]=B.x,Y[v+9]=B.y,Y[v+10]=B.z,Y[v+11]=B.w,Y[v+12]=L.x,Y[v+13]=L.y,Y[v+14]=L.z,Y[v+15]=L.w,z=ja[s.a],A=ja[s.b],B=ja[s.c],L=ja[s.d],S[v]=z.x,S[v+1]=z.y,S[v+2]=z.z,S[v+3]=1,S[v+4]=A.x,S[v+5]=A.y,S[v+6]=A.z,S[v+7]=1,S[v+8]=B.x,S[v+9]=B.y,S[v+10]=B.z,S[v+11]=1,S[v+12]=L.x,S[v+13]=L.y,S[v+14]=L.z,S[v+15]=1,z=ka[s.a],A=ka[s.b],B=ka[s.c],s=ka[s.d],T[v]=z.x,T[v+1]=z.y,T[v+2]=z.z,T[v+3]=1,T[v+4]=A.x,T[v+5]=A.y,T[v+6]=A.z,T[v+7]=1,T[v+8]=
+B.x,T[v+9]=B.y,T[v+10]=B.z,T[v+11]=1,T[v+12]=s.x,T[v+13]=s.y,T[v+14]=s.z,T[v+15]=1,v+=16;v>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,S,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,T,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,Y,w),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,fa,w))}if(sa&&O){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],
+v=s.vertexColors,Y=s.color,v.length===3&&O===THREE.VertexColors?(s=v[0],S=v[1],T=v[2]):T=S=s=Y,$[W]=s.r,$[W+1]=s.g,$[W+2]=s.b,$[W+3]=S.r,$[W+4]=S.g,$[W+5]=S.b,$[W+6]=T.r,$[W+7]=T.g,$[W+8]=T.b,W+=9;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],v=s.vertexColors,Y=s.color,v.length===4&&O===THREE.VertexColors?(s=v[0],S=v[1],T=v[2],v=v[3]):v=T=S=s=Y,$[W]=s.r,$[W+1]=s.g,$[W+2]=s.b,$[W+3]=S.r,$[W+4]=S.g,$[W+5]=S.b,$[W+6]=T.r,$[W+7]=T.g,$[W+8]=T.b,$[W+9]=v.r,$[W+10]=v.g,$[W+11]=v.b,W+=12;W>0&&(d.bindBuffer(d.ARRAY_BUFFER,
+l.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,$,w))}if(ra&&Z.hasTangents){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],Z=s.vertexTangents,W=Z[0],$=Z[1],O=Z[2],F[H]=W.x,F[H+1]=W.y,F[H+2]=W.z,F[H+3]=W.w,F[H+4]=$.x,F[H+5]=$.y,F[H+6]=$.z,F[H+7]=$.w,F[H+8]=O.x,F[H+9]=O.y,F[H+10]=O.z,F[H+11]=O.w,H+=12;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],Z=s.vertexTangents,W=Z[0],$=Z[1],O=Z[2],Z=Z[3],F[H]=W.x,F[H+1]=W.y,F[H+2]=W.z,F[H+3]=W.w,F[H+4]=$.x,F[H+5]=$.y,F[H+6]=$.z,F[H+7]=$.w,F[H+8]=O.x,F[H+9]=O.y,F[H+10]=O.z,F[H+
+11]=O.w,F[H+12]=Z.x,F[H+13]=Z.y,F[H+14]=Z.z,F[H+15]=Z.w,H+=16;d.bindBuffer(d.ARRAY_BUFFER,l.__webglTangentBuffer);d.bufferData(d.ARRAY_BUFFER,F,w)}if(pa&&K){k=0;for(m=y.length;k<m;k++)if(s=ea[y[k]],F=s.vertexNormals,K=s.normal,F.length===3&&ga)for(H=0;H<3;H++)K=F[H],M[E]=K.x,M[E+1]=K.y,M[E+2]=K.z,E+=3;else for(H=0;H<3;H++)M[E]=K.x,M[E+1]=K.y,M[E+2]=K.z,E+=3;k=0;for(m=r.length;k<m;k++)if(s=ea[r[k]],F=s.vertexNormals,K=s.normal,F.length===4&&ga)for(H=0;H<4;H++)K=F[H],M[E]=K.x,M[E+1]=K.y,M[E+2]=K.z,
+E+=3;else for(H=0;H<4;H++)M[E]=K.x,M[E+1]=K.y,M[E+2]=K.z,E+=3;d.bindBuffer(d.ARRAY_BUFFER,l.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,M,w)}if(ha&&na&&X){k=0;for(m=y.length;k<m;k++)if(E=y[k],E=na[E],E!==void 0)for(H=0;H<3;H++)M=E[H],R[Q]=M.u,R[Q+1]=M.v,Q+=2;k=0;for(m=r.length;k<m;k++)if(E=r[k],E=na[E],E!==void 0)for(H=0;H<4;H++)M=E[H],R[Q]=M.u,R[Q+1]=M.v,Q+=2;Q>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,R,w))}if(ha&&qa&&X){k=0;for(m=y.length;k<m;k++)if(E=
+y[k],Q=qa[E],Q!==void 0)for(H=0;H<3;H++)R=Q[H],t[G]=R.u,t[G+1]=R.v,G+=2;k=0;for(m=r.length;k<m;k++)if(E=r[k],Q=qa[E],Q!==void 0)for(H=0;H<4;H++)R=Q[H],t[G]=R.u,t[G+1]=R.v,G+=2;G>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,t,w))}if(ia){k=0;for(m=y.length;k<m;k++)n[P]=V,n[P+1]=V+1,n[P+2]=V+2,P+=3,da[aa]=V,da[aa+1]=V+1,da[aa+2]=V,da[aa+3]=V+2,da[aa+4]=V+1,da[aa+5]=V+2,aa+=6,V+=3;k=0;for(m=r.length;k<m;k++)n[P]=V,n[P+1]=V+1,n[P+2]=V+3,n[P+3]=V+1,n[P+4]=V+2,n[P+5]=V+
+3,P+=6,da[aa]=V,da[aa+1]=V+1,da[aa+2]=V,da[aa+3]=V+3,da[aa+4]=V+1,da[aa+5]=V+2,da[aa+6]=V+2,da[aa+7]=V+3,aa+=8,V+=4;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,n,w);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,da,w)}if(p){H=0;for(V=p.length;H<V;H++)if(n=p[H],n.__original.needsUpdate){t=0;if(n.size===1)if(n.boundTo===void 0||n.boundTo==="vertices"){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],n.array[t]=n.value[s.a],
+n.array[t+1]=n.value[s.b],n.array[t+2]=n.value[s.c],t+=3;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],n.array[t]=n.value[s.a],n.array[t+1]=n.value[s.b],n.array[t+2]=n.value[s.c],n.array[t+3]=n.value[s.d],t+=4}else{if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)da=n.value[y[k]],n.array[t]=da,n.array[t+1]=da,n.array[t+2]=da,t+=3;k=0;for(m=r.length;k<m;k++)da=n.value[r[k]],n.array[t]=da,n.array[t+1]=da,n.array[t+2]=da,n.array[t+3]=da,t+=4}}else if(n.size===2)if(n.boundTo===void 0||n.boundTo==="vertices"){k=
+0;for(m=y.length;k<m;k++)s=ea[y[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=A.x,n.array[t+3]=A.y,n.array[t+4]=B.x,n.array[t+5]=B.y,t+=6;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],s=n.value[s.d],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=A.x,n.array[t+3]=A.y,n.array[t+4]=B.x,n.array[t+5]=B.y,n.array[t+6]=s.x,n.array[t+7]=s.y,t+=8}else{if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)B=A=z=da=n.value[y[k]],
+n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=A.x,n.array[t+3]=A.y,n.array[t+4]=B.x,n.array[t+5]=B.y,t+=6;k=0;for(m=r.length;k<m;k++)s=B=A=z=da=n.value[r[k]],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=A.x,n.array[t+3]=A.y,n.array[t+4]=B.x,n.array[t+5]=B.y,n.array[t+6]=s.x,n.array[t+7]=s.y,t+=8}}else if(n.size===3)if(G=n.type==="c"?["r","g","b"]:["x","y","z"],n.boundTo===void 0||n.boundTo==="vertices"){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],n.array[t]=z[G[0]],
+n.array[t+1]=z[G[1]],n.array[t+2]=z[G[2]],n.array[t+3]=A[G[0]],n.array[t+4]=A[G[1]],n.array[t+5]=A[G[2]],n.array[t+6]=B[G[0]],n.array[t+7]=B[G[1]],n.array[t+8]=B[G[2]],t+=9;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],s=n.value[s.d],n.array[t]=z[G[0]],n.array[t+1]=z[G[1]],n.array[t+2]=z[G[2]],n.array[t+3]=A[G[0]],n.array[t+4]=A[G[1]],n.array[t+5]=A[G[2]],n.array[t+6]=B[G[0]],n.array[t+7]=B[G[1]],n.array[t+8]=B[G[2]],n.array[t+9]=s[G[0]],n.array[t+10]=s[G[1]],
+n.array[t+11]=s[G[2]],t+=12}else{if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)B=A=z=da=n.value[y[k]],n.array[t]=z[G[0]],n.array[t+1]=z[G[1]],n.array[t+2]=z[G[2]],n.array[t+3]=A[G[0]],n.array[t+4]=A[G[1]],n.array[t+5]=A[G[2]],n.array[t+6]=B[G[0]],n.array[t+7]=B[G[1]],n.array[t+8]=B[G[2]],t+=9;k=0;for(m=r.length;k<m;k++)s=B=A=z=da=n.value[r[k]],n.array[t]=z[G[0]],n.array[t+1]=z[G[1]],n.array[t+2]=z[G[2]],n.array[t+3]=A[G[0]],n.array[t+4]=A[G[1]],n.array[t+5]=A[G[2]],n.array[t+6]=B[G[0]],n.array[t+
+7]=B[G[1]],n.array[t+8]=B[G[2]],n.array[t+9]=s[G[0]],n.array[t+10]=s[G[1]],n.array[t+11]=s[G[2]],t+=12}}else if(n.size===4)if(n.boundTo===void 0||n.boundTo==="vertices"){k=0;for(m=y.length;k<m;k++)s=ea[y[k]],z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=z.z,n.array[t+3]=z.w,n.array[t+4]=A.x,n.array[t+5]=A.y,n.array[t+6]=A.z,n.array[t+7]=A.w,n.array[t+8]=B.x,n.array[t+9]=B.y,n.array[t+10]=B.z,n.array[t+11]=B.w,t+=12;k=0;for(m=r.length;k<m;k++)s=ea[r[k]],
+z=n.value[s.a],A=n.value[s.b],B=n.value[s.c],s=n.value[s.d],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=z.z,n.array[t+3]=z.w,n.array[t+4]=A.x,n.array[t+5]=A.y,n.array[t+6]=A.z,n.array[t+7]=A.w,n.array[t+8]=B.x,n.array[t+9]=B.y,n.array[t+10]=B.z,n.array[t+11]=B.w,n.array[t+12]=s.x,n.array[t+13]=s.y,n.array[t+14]=s.z,n.array[t+15]=s.w,t+=16}else if(n.boundTo==="faces"){k=0;for(m=y.length;k<m;k++)B=A=z=da=n.value[y[k]],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=z.z,n.array[t+3]=z.w,n.array[t+4]=A.x,
+n.array[t+5]=A.y,n.array[t+6]=A.z,n.array[t+7]=A.w,n.array[t+8]=B.x,n.array[t+9]=B.y,n.array[t+10]=B.z,n.array[t+11]=B.w,t+=12;k=0;for(m=r.length;k<m;k++)s=B=A=z=da=n.value[r[k]],n.array[t]=z.x,n.array[t+1]=z.y,n.array[t+2]=z.z,n.array[t+3]=z.w,n.array[t+4]=A.x,n.array[t+5]=A.y,n.array[t+6]=A.z,n.array[t+7]=A.w,n.array[t+8]=B.x,n.array[t+9]=B.y,n.array[t+10]=B.z,n.array[t+11]=B.w,n.array[t+12]=s.x,n.array[t+13]=s.y,n.array[t+14]=s.z,n.array[t+15]=s.w,t+=16}d.bindBuffer(d.ARRAY_BUFFER,n.buffer);d.bufferData(d.ARRAY_BUFFER,
+n.array,w)}}o&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyColors=!1;j.__dirtyTangents=!1;h.attributes&&I(h)}else if(x instanceof
+THREE.Ribbon){if(j.__dirtyVertices||j.__dirtyColors){h=j;x=d.DYNAMIC_DRAW;k=i=k=o=o=void 0;m=h.vertices;q=h.colors;p=m.length;l=q.length;y=h.__vertexArray;w=h.__colorArray;r=h.__dirtyColors;if(h.__dirtyVertices){for(o=0;o<p;o++)k=m[o].position,i=o*3,y[i]=k.x,y[i+1]=k.y,y[i+2]=k.z;d.bindBuffer(d.ARRAY_BUFFER,h.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,y,x)}if(r){for(o=0;o<l;o++)k=q[o],i=o*3,w[i]=k.r,w[i+1]=k.g,w[i+2]=k.b;d.bindBuffer(d.ARRAY_BUFFER,h.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,
+w,x)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(x instanceof THREE.Line){h=c(x,l);w=h.attributes&&C(h);if(j.__dirtyVertices||j.__dirtyColors||w){x=j;i=d.DYNAMIC_DRAW;p=q=V=m=ea=void 0;m=x.vertices;l=x.colors;p=m.length;w=l.length;y=x.__vertexArray;o=x.__colorArray;r=x.__dirtyColors;k=x.__webglCustomAttributesList;Q=aa=P=G=V=ea=void 0;if(x.__dirtyVertices){for(ea=0;ea<p;ea++)V=m[ea].position,q=ea*3,y[q]=V.x,y[q+1]=V.y,y[q+2]=V.z;d.bindBuffer(d.ARRAY_BUFFER,x.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,
+y,i)}if(r){for(m=0;m<w;m++)p=l[m],q=m*3,o[q]=p.r,o[q+1]=p.g,o[q+2]=p.b;d.bindBuffer(d.ARRAY_BUFFER,x.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,o,i)}if(k){ea=0;for(V=k.length;ea<V;ea++)if(Q=k[ea],Q.needsUpdate&&(Q.boundTo===void 0||Q.boundTo==="vertices")){q=0;P=Q.value.length;if(Q.size===1)for(G=0;G<P;G++)Q.array[G]=Q.value[G];else if(Q.size===2)for(G=0;G<P;G++)aa=Q.value[G],Q.array[q]=aa.x,Q.array[q+1]=aa.y,q+=2;else if(Q.size===3)if(Q.type==="c")for(G=0;G<P;G++)aa=Q.value[G],Q.array[q]=aa.r,
+Q.array[q+1]=aa.g,Q.array[q+2]=aa.b,q+=3;else for(G=0;G<P;G++)aa=Q.value[G],Q.array[q]=aa.x,Q.array[q+1]=aa.y,Q.array[q+2]=aa.z,q+=3;else if(Q.size===4)for(G=0;G<P;G++)aa=Q.value[G],Q.array[q]=aa.x,Q.array[q+1]=aa.y,Q.array[q+2]=aa.z,Q.array[q+3]=aa.w,q+=4;d.bindBuffer(d.ARRAY_BUFFER,Q.buffer);d.bufferData(d.ARRAY_BUFFER,Q.array,i)}}}j.__dirtyVertices=!1;j.__dirtyColors=!1;h.attributes&&I(h)}else if(x instanceof THREE.ParticleSystem)h=c(x,l),w=h.attributes&&C(h),(j.__dirtyVertices||j.__dirtyColors||
+x.sortParticles||w)&&e(j,d.DYNAMIC_DRAW,x),j.__dirtyVertices=!1,j.__dirtyColors=!1,h.attributes&&I(h)};this.initMaterial=function(a,b,c,e){var f,g,h,j;a instanceof THREE.MeshDepthMaterial?j="depth":a instanceof THREE.MeshNormalMaterial?j="normal":a instanceof THREE.MeshBasicMaterial?j="basic":a instanceof THREE.MeshLambertMaterial?j="lambert":a instanceof THREE.MeshPhongMaterial?j="phong":a instanceof THREE.LineBasicMaterial?j="basic":a instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");
+if(j){var i=THREE.ShaderLib[j];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var o,k,m;o=m=i=0;for(k=b.length;o<k;o++)h=b[o],h instanceof THREE.SpotLight&&m++,h instanceof THREE.DirectionalLight&&m++,h instanceof THREE.PointLight&&i++;i+m<=ma?o=m:(o=Math.ceil(ma*m/(i+m)),i=ma-o);h={directional:o,point:i};i=m=0;for(o=b.length;i<o;i++)k=b[i],k instanceof THREE.SpotLight&&k.castShadow&&m++;var r=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)r=
+e.bones.length;var p;a:{o=a.fragmentShader;k=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:r,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,
+maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},u,e=[];j?e.push(j):(e.push(o),e.push(k));for(u in c)e.push(u),e.push(c[u]);j=e.join();u=0;for(e=ba.length;u<e;u++)if(ba[u].code===j){p=ba[u].program;break a}u=d.createProgram();e=[Wa?"#define VERTEX_TEXTURES":"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,
 "#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-h=["#ifdef GL_ES","precision "+ta+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
-"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");d.attachShader(v,L("fragment",h+o));d.attachShader(v,
-L("vertex",e+k));d.linkProgram(v);d.getProgramParameter(v,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(v,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");v.uniforms={};v.attributes={};var x,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in j)e.push(x);x=e;e=0;for(j=x.length;e<j;e++)o=x[e],v.uniforms[o]=d.getUniformLocation(v,
-o);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<c.maxMorphTargets;x++)e.push("morphTarget"+x);for(p in b)e.push(p);p=e;x=0;for(b=p.length;x<b;x++)c=p[x],v.attributes[c]=d.getAttribLocation(v,c);v.id=O.length;O.push({program:v,code:i});E.info.memory.programs=O.length;p=v}a.program=p;p=a.program.attributes;p.position>=0&&d.enableVertexAttribArray(p.position);p.color>=0&&d.enableVertexAttribArray(p.color);p.normal>=0&&d.enableVertexAttribArray(p.normal);
+h=["#ifdef GL_ES","precision "+va+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
+"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");d.attachShader(u,K("fragment",h+o));d.attachShader(u,
+K("vertex",e+k));d.linkProgram(u);d.getProgramParameter(u,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(u,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");u.uniforms={};u.attributes={};var x,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in i)e.push(x);x=e;e=0;for(i=x.length;e<i;e++)o=x[e],u.uniforms[o]=d.getUniformLocation(u,
+o);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<c.maxMorphTargets;x++)e.push("morphTarget"+x);for(p in b)e.push(p);p=e;x=0;for(b=p.length;x<b;x++)c=p[x],u.attributes[c]=d.getAttribLocation(u,c);u.id=ba.length;ba.push({program:u,code:j});D.info.memory.programs=ba.length;p=u}a.program=p;p=a.program.attributes;p.position>=0&&d.enableVertexAttribArray(p.position);p.color>=0&&d.enableVertexAttribArray(p.color);p.normal>=0&&d.enableVertexAttribArray(p.normal);
 p.tangent>=0&&d.enableVertexAttribArray(p.tangent);a.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(d.enableVertexAttribArray(p.skinVertexA),d.enableVertexAttribArray(p.skinVertexB),d.enableVertexAttribArray(p.skinIndex),d.enableVertexAttribArray(p.skinWeight));if(a.attributes)for(g in a.attributes)p[g]!==void 0&&p[g]>=0&&d.enableVertexAttribArray(p[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)x="morphTarget"+g,p[x]>=0&&(d.enableVertexAttribArray(p[x]),
 a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW),a==="back"?d.cullFace(d.BACK):a==="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK),d.enable(d.CULL_FACE)):d.disable(d.CULL_FACE)}};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:

+ 1 - 1
examples/webgl_interactive_cubes.html

@@ -130,7 +130,7 @@
 
 				// find intersections
 
-				var vector = new THREE.Vector3( mouse.x, mouse.y, 0.5 );
+				var vector = new THREE.Vector3( mouse.x, mouse.y, 1 );
 				projector.unprojectVector( vector, camera );
 
 				var ray = new THREE.Ray( camera.position, vector.subSelf( camera.position ).normalize() );

+ 58 - 58
src/core/Ray.js

@@ -7,19 +7,13 @@ THREE.Ray = function ( origin, direction ) {
 	this.origin = origin || new THREE.Vector3();
 	this.direction = direction || new THREE.Vector3();
 
-}
-
-THREE.Ray.prototype = {
-
-	constructor: THREE.Ray,
-
-	intersectScene: function ( scene ) {
+	this.intersectScene = function ( scene ) {
 
 		return this.intersectObjects( scene.children );
 
-	},
+	};
 
-	intersectObjects: function ( objects ) {
+	this.intersectObjects = function ( objects ) {
 
 		var i, l, object,
 		intersects = [];
@@ -34,52 +28,18 @@ THREE.Ray.prototype = {
 
 		return intersects;
 
-	},
-
-	intersectObject: function ( object ) {
-
-		function distanceFromIntersection( origin, direction, position ) {
-
-			var vector, dot, intersect, distance;
-
-			vector = position.clone().subSelf( origin );
-			dot = vector.dot( direction );
-
-			if ( dot <= 0 ) return null; // check if position behind origin.
-
-			intersect = origin.clone().addSelf( direction.clone().multiplyScalar( dot ) );
-			distance = position.distanceTo( intersect );
-
-			return distance;
-
-		}
-
-		// http://www.blackpawn.com/texts/pointinpoly/default.html
-
-		var v0 = new THREE.Vector3(), v1 = new THREE.Vector3(), v2 = new THREE.Vector3();
-		var dot00, dot01, dot02, dot11, dot12, invDenom, u, v;
-
-		function pointInFace3( p, a, b, c ) {
-
-			v0.copy( c ).subSelf( a );
-			v1.copy( b ).subSelf( a );
-			v2.copy( p ).subSelf( a );
-
-			dot00 = v0.dot( v0 );
-			dot01 = v0.dot( v1 );
-			dot02 = v0.dot( v2 );
-			dot11 = v1.dot( v1 );
-			dot12 = v1.dot( v2 );
-
-			invDenom = 1 / ( dot00 * dot11 - dot01 * dot01 );
-			u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;
-			v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;
+	};
 
-			return ( u >= 0 ) && ( v >= 0 ) && ( u + v < 1 );
+	var a = new THREE.Vector3();
+	var b = new THREE.Vector3();
+	var c = new THREE.Vector3();
+	var d = new THREE.Vector3();
 
-		}
+	var origin = new THREE.Vector3();
+	var direction = new THREE.Vector3();
+	var normal = new THREE.Vector3();
 
-		//
+	this.intersectObject = function ( object ) {
 
 		var intersect, intersects = [];
 
@@ -125,7 +85,6 @@ THREE.Ray.prototype = {
 			// Checking faces
 
 			var f, fl, face,
-			a, b, c, d, normal,
 			vector, dot, scalar,
 			origin, direction,
 			geometry = object.geometry,
@@ -153,12 +112,12 @@ THREE.Ray.prototype = {
 
 				//
 
-				a = objMatrix.multiplyVector3( vertices[ face.a ].position.clone() );
-				b = objMatrix.multiplyVector3( vertices[ face.b ].position.clone() );
-				c = objMatrix.multiplyVector3( vertices[ face.c ].position.clone() );
-				d = face instanceof THREE.Face4 ? objMatrix.multiplyVector3( vertices[ face.d ].position.clone() ) : null;
+				a = objMatrix.multiplyVector3( a.copy( vertices[ face.a ].position ) );
+				b = objMatrix.multiplyVector3( b.copy( vertices[ face.b ].position ) );
+				c = objMatrix.multiplyVector3( c.copy( vertices[ face.c ].position ) );
+				d = face instanceof THREE.Face4 ? objMatrix.multiplyVector3( d.copy( vertices[ face.d ].position ) ) : null;
 
-				normal = object.matrixRotationWorld.multiplyVector3( face.normal.clone() );
+				normal = object.matrixRotationWorld.multiplyVector3( normal.copy( face.normal ) );
 				dot = direction.dot( normal );
 
 				if ( object.doubleSided || ( object.flipSided ? dot > 0 : dot < 0 ) ) { // Math.abs( dot ) > 0.0001
@@ -212,4 +171,45 @@ THREE.Ray.prototype = {
 
 	}
 
+	function distanceFromIntersection( origin, direction, position ) {
+
+		var vector, dot, intersect, distance;
+
+		vector = position.clone().subSelf( origin );
+		dot = vector.dot( direction );
+
+		if ( dot <= 0 ) return null; // check if position behind origin.
+
+		intersect = origin.clone().addSelf( direction.clone().multiplyScalar( dot ) );
+		distance = position.distanceTo( intersect );
+
+		return distance;
+
+	}
+
+	// http://www.blackpawn.com/texts/pointinpoly/default.html
+
+	var v0 = new THREE.Vector3(), v1 = new THREE.Vector3(), v2 = new THREE.Vector3();
+	var dot00, dot01, dot02, dot11, dot12, invDenom, u, v;
+
+	function pointInFace3( p, a, b, c ) {
+
+		v0.copy( c ).subSelf( a );
+		v1.copy( b ).subSelf( a );
+		v2.copy( p ).subSelf( a );
+
+		dot00 = v0.dot( v0 );
+		dot01 = v0.dot( v1 );
+		dot02 = v0.dot( v2 );
+		dot11 = v1.dot( v1 );
+		dot12 = v1.dot( v2 );
+
+		invDenom = 1 / ( dot00 * dot11 - dot01 * dot01 );
+		u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;
+		v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;
+
+		return ( u >= 0 ) && ( v >= 0 ) && ( u + v < 1 );
+
+	}
+
 };