Browse Source

Updated builds.

Mr.doob 13 years ago
parent
commit
032c511220
6 changed files with 1044 additions and 1004 deletions
  1. 472 458
      build/Three.js
  2. 74 70
      build/custom/ThreeCanvas.js
  3. 44 40
      build/custom/ThreeDOM.js
  4. 190 180
      build/custom/ThreeExtras.js
  5. 55 51
      build/custom/ThreeSVG.js
  6. 209 205
      build/custom/ThreeWebGL.js

File diff suppressed because it is too large
+ 472 - 458
build/Three.js


+ 74 - 70
build/custom/ThreeCanvas.js

@@ -1,4 +1,4 @@
-// ThreeCanvas.js r46 - http://github.com/mrdoob/three.js
+// ThreeCanvas.js r47dev - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
 THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,f,e;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),f=a*6-d,a=c*(1-b),e=c*(1-
 b*f),b=c*(1-b*(1-f)),d){case 1:this.r=e;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=e;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=e;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
@@ -14,64 +14,68 @@ this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),
 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){function c(a,b,c){i.sub(c,a);p=i.dot(b);if(p<=0)return null;k=n.add(a,o.copy(b).multiplyScalar(p));return s=c.distanceTo(k)}function d(a,b,c,d){i.sub(d,b);n.sub(c,b);o.sub(a,b);K=i.dot(i);C=i.dot(n);Q=i.dot(o);O=n.dot(n);w=n.dot(o);F=1/(K*O-C*C);z=(O*Q-C*w)*F;D=(K*w-C*Q)*F;return z>=0&&D>=0&&z+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 f=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,m=new THREE.Vector3,l=new THREE.Vector3,j=new THREE.Vector3;this.intersectObject=function(k){for(var i,o=[],n=0,W=k.children.length;n<W;n++)Array.prototype.push.apply(o,this.intersectObject(k.children[n]));if(k instanceof THREE.Particle){n=
-c(this.origin,this.direction,k.matrixWorld.getPosition());if(n===null||n>k.scale.x)return[];i={distance:n,point:k.position,face:null,object:k};o.push(i)}else if(k instanceof THREE.Mesh){n=c(this.origin,this.direction,k.matrixWorld.getPosition());if(n===null||n>k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)))return o;var p,G=k.geometry,H=G.vertices,I;k.matrixRotationWorld.extractRotation(k.matrixWorld);n=0;for(W=G.faces.length;n<W;n++)if(i=G.faces[n],a.copy(this.origin),
-b.copy(this.direction),I=k.matrixWorld,m=I.multiplyVector3(m.copy(i.centroid)).subSelf(a),p=m.dot(b),!(p<=0)&&(f=I.multiplyVector3(f.copy(H[i.a].position)),e=I.multiplyVector3(e.copy(H[i.b].position)),g=I.multiplyVector3(g.copy(H[i.c].position)),i instanceof THREE.Face4&&(h=I.multiplyVector3(h.copy(H[i.d].position))),l=k.matrixRotationWorld.multiplyVector3(l.copy(i.normal)),p=b.dot(l),k.doubleSided||(k.flipSided?p>0:p<0)))if(p=l.dot(m.sub(f,a))/p,j.add(a,b.multiplyScalar(p)),i instanceof THREE.Face3)d(j,
-f,e,g)&&(i={distance:a.distanceTo(j),point:j.clone(),face:i,object:k},o.push(i));else if(i instanceof THREE.Face4&&(d(j,f,e,h)||d(j,e,g,h)))i={distance:a.distanceTo(j),point:j.clone(),face:i,object:k},o.push(i)}return o};var i=new THREE.Vector3,n=new THREE.Vector3,o=new THREE.Vector3,p,k,s,K,C,Q,O,w,F,z,D};
-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,n,o){h?(h=!1,b=e<j?e<n?e:n:j<n?j:n,c=g<i?g<o?g:o:i<o?i:o,d=e>j?e>n?e:n:j>n?j:n,f=g>i?g>o?g:o:i>o?i:o):(b=e<j?e<n?e<b?e:b:n<b?n:b:j<n?j<b?j:b:n<b?n: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>n?e>d?e:d:n>d?n:d:j>n?j>d?j:d:n>d?n: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>
+THREE.Ray=function(a,b){function c(a,b,c){i.sub(c,a);p=i.dot(b);if(p<=0)return null;j=m.add(a,o.copy(b).multiplyScalar(p));return r=c.distanceTo(j)}function d(a,b,c,d){i.sub(d,b);m.sub(c,b);o.sub(a,b);F=i.dot(i);y=i.dot(m);H=i.dot(o);G=m.dot(m);s=m.dot(o);C=1/(F*G-y*y);z=(G*H-y*s)*C;D=(F*s-y*H)*C;return z>=0&&D>=0&&z+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 f=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,n=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.intersectObject=function(j){for(var i,o=[],m=0,V=j.children.length;m<V;m++)Array.prototype.push.apply(o,this.intersectObject(j.children[m]));if(j instanceof THREE.Particle){m=
+c(this.origin,this.direction,j.matrixWorld.getPosition());if(m===null||m>j.scale.x)return[];i={distance:m,point:j.position,face:null,object:j};o.push(i)}else if(j instanceof THREE.Mesh){m=c(this.origin,this.direction,j.matrixWorld.getPosition());if(m===null||m>j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)))return o;var p,I=j.geometry,J=I.vertices,K;j.matrixRotationWorld.extractRotation(j.matrixWorld);m=0;for(V=I.faces.length;m<V;m++)if(i=I.faces[m],a.copy(this.origin),
+b.copy(this.direction),K=j.matrixWorld,n=K.multiplyVector3(n.copy(i.centroid)).subSelf(a),p=n.dot(b),!(p<=0)&&(f=K.multiplyVector3(f.copy(J[i.a].position)),e=K.multiplyVector3(e.copy(J[i.b].position)),g=K.multiplyVector3(g.copy(J[i.c].position)),i instanceof THREE.Face4&&(h=K.multiplyVector3(h.copy(J[i.d].position))),k=j.matrixRotationWorld.multiplyVector3(k.copy(i.normal)),p=b.dot(k),j.doubleSided||(j.flipSided?p>0:p<0)))if(p=k.dot(n.sub(f,a))/p,l.add(a,b.multiplyScalar(p)),i instanceof THREE.Face3)d(l,
+f,e,g)&&(i={distance:a.distanceTo(l),point:l.clone(),face:i,object:j},o.push(i));else if(i instanceof THREE.Face4&&(d(l,f,e,h)||d(l,e,g,h)))i={distance:a.distanceTo(l),point:l.clone(),face:i,object:j},o.push(i)}return o};var i=new THREE.Vector3,m=new THREE.Vector3,o=new THREE.Vector3,p,j,r,F,y,H,G,s,C,z,D};
+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,l,i){h=!1;b=e;c=g;d=l;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,l,i,m,o){h?(h=!1,b=e<l?e<m?e:m:l<m?l:m,c=g<i?g<o?g:o:i<o?i:o,d=e>l?e>m?e:m:l>m?l:m,f=g>i?g>o?g:o:i>o?i:o):(b=e<l?e<m?e<b?e:b:m<b?m:b:l<m?l<b?l:b:m<b?m: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>l?e>m?e>d?e:d:m>d?m:d:l>m?l>d?l:d:m>d?m: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>
 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,m,l,j,i,n,o,p,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,m||0,l||0,j!==void 0?j:1,i||0,n||0,o||0,p||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,m,l,j,i,n,o,p,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=m;this.n32=l;this.n33=j;this.n34=i;this.n41=n;this.n42=o;this.n43=p;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,m=a.n23,l=a.n24,j=a.n31,i=a.n32,n=a.n33,o=a.n34,p=a.n41,k=a.n42,s=a.n43,
-K=a.n44,C=b.n11,Q=b.n12,O=b.n13,w=b.n14,F=b.n21,z=b.n22,D=b.n23,u=b.n24,r=b.n31,E=b.n32,N=b.n33,W=b.n34,da=b.n41,G=b.n42,H=b.n43,I=b.n44;this.n11=c*C+d*F+f*r+e*da;this.n12=c*Q+d*z+f*E+e*G;this.n13=c*O+d*D+f*N+e*H;this.n14=c*w+d*u+f*W+e*I;this.n21=g*C+h*F+m*r+l*da;this.n22=g*Q+h*z+m*E+l*G;this.n23=g*O+h*D+m*N+l*H;this.n24=g*w+h*u+m*W+l*I;this.n31=j*C+i*F+n*r+o*da;this.n32=j*Q+i*z+n*E+o*G;this.n33=j*O+i*D+n*N+o*H;this.n34=j*w+i*u+n*W+o*I;this.n41=p*C+k*F+s*r+K*da;this.n42=p*Q+k*z+s*E+K*G;this.n43=p*
-O+k*D+s*N+K*H;this.n44=p*w+k*u+s*W+K*I;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,n,k,l,i,m,o,p,j){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,n||0,k||0,l!==void 0?l:1,i||0,m||0,o||0,p||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,d,f,e,g,h,n,k,l,i,m,o,p,j){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=n;this.n32=k;this.n33=l;this.n34=i;this.n41=m;this.n42=o;this.n43=p;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 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,n=a.n23,k=a.n24,l=a.n31,i=a.n32,m=a.n33,o=a.n34,p=a.n41,j=a.n42,r=a.n43,
+F=a.n44,y=b.n11,H=b.n12,G=b.n13,s=b.n14,C=b.n21,z=b.n22,D=b.n23,u=b.n24,q=b.n31,E=b.n32,O=b.n33,V=b.n34,ca=b.n41,I=b.n42,J=b.n43,K=b.n44;this.n11=c*y+d*C+f*q+e*ca;this.n12=c*H+d*z+f*E+e*I;this.n13=c*G+d*D+f*O+e*J;this.n14=c*s+d*u+f*V+e*K;this.n21=g*y+h*C+n*q+k*ca;this.n22=g*H+h*z+n*E+k*I;this.n23=g*G+h*D+n*O+k*J;this.n24=g*s+h*u+n*V+k*K;this.n31=l*y+i*C+m*q+o*ca;this.n32=l*H+i*z+m*E+o*I;this.n33=l*G+i*D+m*O+o*J;this.n34=l*s+i*u+m*V+o*K;this.n41=p*y+j*C+r*q+F*ca;this.n42=p*H+j*z+r*E+F*I;this.n43=p*
+G+j*D+r*O+F*J;this.n44=p*s+j*u+r*V+F*K;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,m=this.n31,l=this.n32,j=this.n33,i=this.n34,n=this.n41,o=this.n42,p=this.n43,k=this.n44;return d*g*l*n-c*h*l*n-d*e*j*n+b*h*j*n+c*e*i*n-b*g*i*n-d*g*m*o+c*h*m*o+d*f*j*o-a*h*j*o-c*f*i*o+a*g*i*o+d*e*m*p-b*h*m*p-d*f*l*p+a*h*l*p+b*f*i*p-a*e*i*p-c*e*m*k+b*g*m*k+c*f*l*k-a*g*l*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.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,n=this.n31,k=this.n32,l=this.n33,i=this.n34,m=this.n41,o=this.n42,p=this.n43,j=this.n44;return d*g*k*m-c*h*k*m-d*e*l*m+b*h*l*m+c*e*i*m-b*g*i*m-d*g*n*o+c*h*n*o+d*f*l*o-a*h*l*o-c*f*i*o+a*g*i*o+d*e*n*p-b*h*n*p-d*f*k*p+a*h*k*p+b*f*i*p-a*e*i*p-c*e*n*j+b*g*n*j+c*f*k*j-a*g*k*j-b*f*l*j+a*e*l*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.n34=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,m=f*e,l=f*g;this.set(m*e+c,m*g-d*h,m*h+d*g,0,m*g+d*h,l*g+c,l*h-d*e,0,m*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,m=a.n24,l=a.n31,j=a.n32,i=a.n33,n=a.n34,o=a.n41,p=a.n42,k=a.n43,s=a.n44;this.n11=h*n*p-m*i*p+m*j*k-g*n*k-h*j*s+g*i*s;this.n12=f*i*p-d*n*p-f*j*k+c*n*k+d*j*s-c*i*s;this.n13=d*m*p-f*h*p+f*g*k-c*m*k-d*g*s+c*h*s;this.n14=f*h*j-d*m*j-f*g*i+c*m*i+d*g*n-c*h*n;this.n21=m*i*o-h*n*o-m*l*k+e*n*k+h*l*s-e*i*s;this.n22=d*n*o-f*i*o+
-f*l*k-b*n*k-d*l*s+b*i*s;this.n23=f*h*o-d*m*o-f*e*k+b*m*k+d*e*s-b*h*s;this.n24=d*m*l-f*h*l+f*e*i-b*m*i-d*e*n+b*h*n;this.n31=g*n*o-m*j*o+m*l*p-e*n*p-g*l*s+e*j*s;this.n32=f*j*o-c*n*o-f*l*p+b*n*p+c*l*s-b*j*s;this.n33=d*m*o-f*g*o+f*e*p-b*m*p-c*e*s+b*g*s;this.n34=f*g*l-c*m*l-f*e*j+b*m*j+c*e*n-b*g*n;this.n41=h*j*o-g*i*o-h*l*p+e*i*p+g*l*k-e*j*k;this.n42=c*i*o-d*j*o+d*l*p-b*i*p-c*l*k+b*j*k;this.n43=d*g*o-c*h*o-d*e*p+b*h*p+c*e*k-b*g*k;this.n44=c*h*l-d*g*l+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 m=g*h,l=g*f,j=d*h,i=d*f;this.n11=m+i*c;this.n12=j*c-l;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=l*c-j;this.n32=i+m*c;this.n33=e*g;break;case "ZXY":m=g*h;l=g*f;j=d*h;i=d*f;this.n11=m-i*c;this.n12=-e*f;this.n13=j+l*c;this.n21=l+j*c;this.n22=e*h;this.n23=i-m*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":m=
-e*h;l=e*f;j=c*h;i=c*f;this.n11=g*h;this.n12=j*d-l;this.n13=m*d+i;this.n21=g*f;this.n22=i*d+m;this.n23=l*d-j;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":m=e*g;l=e*d;j=c*g;i=c*d;this.n11=g*h;this.n12=i-m*f;this.n13=j*f+l;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*f+j;this.n33=m-i*f;break;case "XZY":m=e*g;l=e*d;j=c*g;i=c*d;this.n11=g*h;this.n12=-f;this.n13=d*h;this.n21=m*f+i;this.n22=e*h;this.n23=l*f-j;this.n31=j*f-l;this.n32=c*h;this.n33=i*f+m;break;default:m=e*h,l=e*
-f,j=c*h,i=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=l+j*d,this.n22=m-i*d,this.n23=-c*g,this.n31=i-m*d,this.n32=j+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,m=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=m-f;this.n13=b+g;this.n21=m+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,n=f*e,k=f*g;this.set(n*e+c,n*g-d*h,n*h+d*g,0,n*g+d*h,k*g+c,k*h-d*e,0,n*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,n=a.n24,k=a.n31,l=a.n32,i=a.n33,m=a.n34,o=a.n41,p=a.n42,j=a.n43,r=a.n44;this.n11=h*m*p-n*i*p+n*l*j-g*m*j-h*l*r+g*i*r;this.n12=f*i*p-d*m*p-f*l*j+c*m*j+d*l*r-c*i*r;this.n13=d*n*p-f*h*p+f*g*j-c*n*j-d*g*r+c*h*r;this.n14=f*h*l-d*n*l-f*g*i+c*n*i+d*g*m-c*h*m;this.n21=n*i*o-h*m*o-n*k*j+e*m*j+h*k*r-e*i*r;this.n22=d*m*o-f*i*o+
+f*k*j-b*m*j-d*k*r+b*i*r;this.n23=f*h*o-d*n*o-f*e*j+b*n*j+d*e*r-b*h*r;this.n24=d*n*k-f*h*k+f*e*i-b*n*i-d*e*m+b*h*m;this.n31=g*m*o-n*l*o+n*k*p-e*m*p-g*k*r+e*l*r;this.n32=f*l*o-c*m*o-f*k*p+b*m*p+c*k*r-b*l*r;this.n33=c*n*o-f*g*o+f*e*p-b*n*p-c*e*r+b*g*r;this.n34=f*g*k-c*n*k-f*e*l+b*n*l+c*e*m-b*g*m;this.n41=h*l*o-g*i*o-h*k*p+e*i*p+g*k*j-e*l*j;this.n42=c*i*o-d*l*o+d*k*p-b*i*p-c*k*j+b*l*j;this.n43=d*g*o-c*h*o-d*e*p+b*h*p+c*e*j-b*g*j;this.n44=c*h*k-d*g*k+d*e*l-b*h*l-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 n=g*h,k=g*f,l=d*h,i=d*f;this.n11=n+i*c;this.n12=l*c-k;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=k*c-l;this.n32=i+n*c;this.n33=e*g;break;case "ZXY":n=g*h;k=g*f;l=d*h;i=d*f;this.n11=n-i*c;this.n12=-e*f;this.n13=l+k*c;this.n21=k+l*c;this.n22=e*h;this.n23=i-n*c;this.n31=-e*d;this.n32=c;this.n33=e*g;break;case "ZYX":n=
+e*h;k=e*f;l=c*h;i=c*f;this.n11=g*h;this.n12=l*d-k;this.n13=n*d+i;this.n21=g*f;this.n22=i*d+n;this.n23=k*d-l;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":n=e*g;k=e*d;l=c*g;i=c*d;this.n11=g*h;this.n12=i-n*f;this.n13=l*f+k;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=k*f+l;this.n33=n-i*f;break;case "XZY":n=e*g;k=e*d;l=c*g;i=c*d;this.n11=g*h;this.n12=-f;this.n13=d*h;this.n21=n*f+i;this.n22=e*h;this.n23=k*f-l;this.n31=l*f-k;this.n32=c*h;this.n33=i*f+n;break;default:n=e*h,k=e*
+f,l=c*h,i=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=k+l*d,this.n22=n-i*d,this.n23=-c*g,this.n31=i-n*d,this.n32=l+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,n=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=n-f;this.n13=b+g;this.n21=n+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,m=-a.n32*a.n11+a.n31*a.n12,l=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*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*m;c[6]=a*l;c[7]=a*j;c[8]=a*i;return b};
+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},rotateByAxis:function(a,b){if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);else if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);else if(a.x===0&&a.y===
+0&&a.z===1)return this.rotateZ(b);var c=a.x,d=a.y,f=a.z,e=Math.sqrt(c*c+d*d+f*f);c/=e;d/=e;f/=e;var e=c*c,g=d*d,h=f*f,n=Math.cos(b),k=Math.sin(b),l=1-n,i=c*d*l,m=c*f*l;l*=d*f;c*=k;var o=d*k;k*=f;f=e+(1-e)*n;e=i+k;d=m-o;i-=k;g+=(1-g)*n;k=l+c;m+=o;l-=c;h+=(1-h)*n;var n=this.n11,c=this.n21,o=this.n31,p=this.n41,j=this.n12,r=this.n22,F=this.n32,y=this.n42,H=this.n13,G=this.n23,s=this.n33,C=this.n43;this.n11=f*n+e*j+d*H;this.n21=f*c+e*r+d*G;this.n31=f*o+e*F+d*s;this.n41=f*p+e*y+d*C;this.n12=i*n+g*j+k*
+H;this.n22=i*c+g*r+k*G;this.n32=i*o+g*F+k*s;this.n42=i*p+g*y+k*C;this.n13=m*n+l*j+h*H;this.n23=m*c+l*r+h*G;this.n33=m*o+l*F+h*s;this.n43=m*p+l*y+h*C;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,f=this.n42,e=this.n13,g=this.n23,h=this.n33,n=this.n43,k=Math.cos(a),a=Math.sin(a);this.n12=k*b+a*e;this.n22=k*c+a*g;this.n32=k*d+a*h;this.n42=k*f+a*n;this.n13=k*e-a*b;this.n23=k*g-a*c;this.n33=k*h-a*d;this.n43=k*n-a*f;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,
+f=this.n41,e=this.n13,g=this.n23,h=this.n33,n=this.n43,k=Math.cos(a),a=Math.sin(a);this.n11=k*b-a*e;this.n21=k*c-a*g;this.n31=k*d-a*h;this.n41=k*f-a*n;this.n13=k*e+a*b;this.n23=k*g+a*c;this.n33=k*h+a*d;this.n43=k*n+a*f;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,f=this.n41,e=this.n12,g=this.n22,h=this.n32,n=this.n42,k=Math.cos(a),a=Math.sin(a);this.n11=k*b+a*e;this.n21=k*c+a*g;this.n31=k*d+a*h;this.n41=k*f+a*n;this.n12=k*e-a*b;this.n22=k*g-a*c;this.n32=k*h-a*d;this.n42=k*
+n-a*f;return this},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;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,n=-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,i=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*k;if(a===0)return null;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*n;c[6]=a*k;c[7]=a*l;c[8]=a*i;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,m,l;g=new THREE.Matrix4;h=b-a;m=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/m;g.n23=0;g.n24=-((c+d)/m);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,n,k;g=new THREE.Matrix4;h=b-a;n=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/n;g.n23=0;g.n24=-((c+d)/n);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[m]=l[m]||new THREE.RenderableVertex;m++;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,m,l=[],
-j,i,n=[],o,p=[],k,s,K=[],C,Q,O=[],w={objects:[],sprites:[],lights:[],elements:[]},F=new THREE.Vector3,z=new THREE.Vector4,D=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],E=new THREE.Vector4,N=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);D.multiply(b.projectionMatrix,b.matrixWorldInverse);D.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-D.multiply(b.matrixWorld,b.projectionMatrixInverse);D.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;w.objects.length=0;w.sprites.length=0;w.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?(D.multiplyVector3(F.copy(b.position)),f=a(),f.object=b,f.z=F.z,w.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(D.multiplyVector3(F.copy(b.position)),f=a(),f.object=b,f.z=F.z,w.sprites.push(f)):b instanceof THREE.Light&&w.lights.push(b);c=0;for(d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&
-w.objects.sort(c);return w};this.projectScene=function(a,e,f){var g=e.near,r=e.far,F,L,B,S,v,R,P,V,J,t,A,x,y,M,la,fa;Q=s=o=i=0;w.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);D.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(D);w=this.projectGraph(a,!1);a=0;for(F=w.objects.length;a<F;a++)if(J=w.objects[a].object,t=J.matrixWorld,
-x=J.material,m=0,J instanceof THREE.Mesh){A=J.geometry;y=J.geometry.materials;S=A.vertices;M=A.faces;la=A.faceVertexUvs;A=J.matrixRotationWorld.extractRotation(t);L=0;for(B=S.length;L<B;L++)h=b(),h.positionWorld.copy(S[L].position),t.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),D.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;S=0;for(L=M.length;S<L;S++){B=
-M[S];if(B instanceof THREE.Face3)if(v=l[B.a],R=l[B.b],P=l[B.c],v.visible&&R.visible&&P.visible&&(J.doubleSided||J.flipSided!=(P.positionScreen.x-v.positionScreen.x)*(R.positionScreen.y-v.positionScreen.y)-(P.positionScreen.y-v.positionScreen.y)*(R.positionScreen.x-v.positionScreen.x)<0))V=n[i]=n[i]||new THREE.RenderableFace3,i++,j=V,j.v1.copy(v),j.v2.copy(R),j.v3.copy(P);else continue;else if(B instanceof THREE.Face4)if(v=l[B.a],R=l[B.b],P=l[B.c],V=l[B.d],v.visible&&R.visible&&P.visible&&V.visible&&
-(J.doubleSided||J.flipSided!=((V.positionScreen.x-v.positionScreen.x)*(R.positionScreen.y-v.positionScreen.y)-(V.positionScreen.y-v.positionScreen.y)*(R.positionScreen.x-v.positionScreen.x)<0||(R.positionScreen.x-P.positionScreen.x)*(V.positionScreen.y-P.positionScreen.y)-(R.positionScreen.y-P.positionScreen.y)*(V.positionScreen.x-P.positionScreen.x)<0)))fa=p[o]=p[o]||new THREE.RenderableFace4,o++,j=fa,j.v1.copy(v),j.v2.copy(R),j.v3.copy(P),j.v4.copy(V);else continue;j.normalWorld.copy(B.normal);
-A.multiplyVector3(j.normalWorld);j.centroidWorld.copy(B.centroid);t.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);D.multiplyVector3(j.centroidScreen);P=B.vertexNormals;v=0;for(R=P.length;v<R;v++)V=j.vertexNormalsWorld[v],V.copy(P[v]),A.multiplyVector3(V);v=0;for(R=la.length;v<R;v++)if(fa=la[v][S]){P=0;for(V=fa.length;P<V;P++)j.uvs[v][P]=fa[P]}j.material=x;j.faceMaterial=B.materialIndex!==null?y[B.materialIndex]:null;j.z=j.centroidScreen.z;w.elements.push(j)}}else if(J instanceof
-THREE.Line){u.multiply(D,t);S=J.geometry.vertices;v=b();v.positionScreen.copy(S[0].position);u.multiplyVector4(v.positionScreen);L=1;for(B=S.length;L<B;L++)if(v=b(),v.positionScreen.copy(S[L].position),u.multiplyVector4(v.positionScreen),R=l[m-2],E.copy(v.positionScreen),N.copy(R.positionScreen),d(E,N))E.multiplyScalar(1/E.w),N.multiplyScalar(1/N.w),J=K[s]=K[s]||new THREE.RenderableLine,s++,k=J,k.v1.positionScreen.copy(E),k.v2.positionScreen.copy(N),k.z=Math.max(E.z,N.z),k.material=x,w.elements.push(k)}a=
-0;for(F=w.sprites.length;a<F;a++)if(J=w.sprites[a].object,t=J.matrixWorld,J instanceof THREE.Particle&&(z.set(t.n14,t.n24,t.n34,1),D.multiplyVector4(z),z.z/=z.w,z.z>0&&z.z<1))g=O[Q]=O[Q]||new THREE.RenderableParticle,Q++,C=g,C.x=z.x/z.w,C.y=z.y/z.w,C.z=z.z,C.rotation=J.rotation.z,C.scale.x=J.scale.x*Math.abs(C.x-(z.x+e.projectionMatrix.n11)/(z.w+e.projectionMatrix.n14)),C.scale.y=J.scale.y*Math.abs(C.y-(z.y+e.projectionMatrix.n22)/(z.w+e.projectionMatrix.n24)),C.material=J.material,w.elements.push(C);
-f&&w.elements.sort(c);return w}};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[n]=k[n]||new THREE.RenderableVertex;n++;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,n,k=[],
+l,i,m=[],o,p=[],j,r,F=[],y,H,G=[],s={objects:[],sprites:[],lights:[],elements:[]},C=new THREE.Vector3,z=new THREE.Vector4,D=new THREE.Matrix4,u=new THREE.Matrix4,q=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,O=new THREE.Vector4;this.computeFrustum=function(a){q[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);q[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);q[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+a.n23,a.n44+a.n24);q[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);q[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);q[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=q[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);D.multiply(b.projectionMatrix,b.matrixWorldInverse);D.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+D.multiply(b.matrixWorld,b.projectionMatrixInverse);D.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;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,
+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=q[h].x*d.n14+q[h].y*d.n24+q[h].z*d.n34+q[h].w,c<=e){c=!1;break a}c=!0}c?(D.multiplyVector3(C.copy(b.position)),f=a(),f.object=b,f.z=C.z,s.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(D.multiplyVector3(C.copy(b.position)),f=a(),f.object=b,f.z=C.z,s.sprites.push(f)):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,q=e.far,C,M,B,R,v,Q,P,U,L,t,A,w,x,N,ka,ea;H=r=o=i=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);D.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(D);s=this.projectGraph(a,!1);a=0;for(C=s.objects.length;a<C;a++)if(L=s.objects[a].object,t=L.matrixWorld,
+w=L.material,n=0,L instanceof THREE.Mesh){A=L.geometry;x=L.geometry.materials;R=A.vertices;N=A.faces;ka=A.faceVertexUvs;A=L.matrixRotationWorld.extractRotation(t);M=0;for(B=R.length;M<B;M++)h=b(),h.positionWorld.copy(R[M].position),t.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),D.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<q;R=0;for(M=N.length;R<M;R++){B=
+N[R];if(B instanceof THREE.Face3)if(v=k[B.a],Q=k[B.b],P=k[B.c],v.visible&&Q.visible&&P.visible&&(L.doubleSided||L.flipSided!=(P.positionScreen.x-v.positionScreen.x)*(Q.positionScreen.y-v.positionScreen.y)-(P.positionScreen.y-v.positionScreen.y)*(Q.positionScreen.x-v.positionScreen.x)<0))U=m[i]=m[i]||new THREE.RenderableFace3,i++,l=U,l.v1.copy(v),l.v2.copy(Q),l.v3.copy(P);else continue;else if(B instanceof THREE.Face4)if(v=k[B.a],Q=k[B.b],P=k[B.c],U=k[B.d],v.visible&&Q.visible&&P.visible&&U.visible&&
+(L.doubleSided||L.flipSided!=((U.positionScreen.x-v.positionScreen.x)*(Q.positionScreen.y-v.positionScreen.y)-(U.positionScreen.y-v.positionScreen.y)*(Q.positionScreen.x-v.positionScreen.x)<0||(Q.positionScreen.x-P.positionScreen.x)*(U.positionScreen.y-P.positionScreen.y)-(Q.positionScreen.y-P.positionScreen.y)*(U.positionScreen.x-P.positionScreen.x)<0)))ea=p[o]=p[o]||new THREE.RenderableFace4,o++,l=ea,l.v1.copy(v),l.v2.copy(Q),l.v3.copy(P),l.v4.copy(U);else continue;l.normalWorld.copy(B.normal);
+A.multiplyVector3(l.normalWorld);l.centroidWorld.copy(B.centroid);t.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);D.multiplyVector3(l.centroidScreen);P=B.vertexNormals;v=0;for(Q=P.length;v<Q;v++)U=l.vertexNormalsWorld[v],U.copy(P[v]),A.multiplyVector3(U);v=0;for(Q=ka.length;v<Q;v++)if(ea=ka[v][R]){P=0;for(U=ea.length;P<U;P++)l.uvs[v][P]=ea[P]}l.material=w;l.faceMaterial=B.materialIndex!==null?x[B.materialIndex]:null;l.z=l.centroidScreen.z;s.elements.push(l)}}else if(L instanceof
+THREE.Line){u.multiply(D,t);R=L.geometry.vertices;v=b();v.positionScreen.copy(R[0].position);u.multiplyVector4(v.positionScreen);M=1;for(B=R.length;M<B;M++)if(v=b(),v.positionScreen.copy(R[M].position),u.multiplyVector4(v.positionScreen),Q=k[n-2],E.copy(v.positionScreen),O.copy(Q.positionScreen),d(E,O))E.multiplyScalar(1/E.w),O.multiplyScalar(1/O.w),L=F[r]=F[r]||new THREE.RenderableLine,r++,j=L,j.v1.positionScreen.copy(E),j.v2.positionScreen.copy(O),j.z=Math.max(E.z,O.z),j.material=w,s.elements.push(j)}a=
+0;for(C=s.sprites.length;a<C;a++)if(L=s.sprites[a].object,t=L.matrixWorld,L instanceof THREE.Particle&&(z.set(t.n14,t.n24,t.n34,1),D.multiplyVector4(z),z.z/=z.w,z.z>0&&z.z<1))g=G[H]=G[H]||new THREE.RenderableParticle,H++,y=g,y.x=z.x/z.w,y.y=z.y/z.w,y.z=z.z,y.rotation=L.rotation.z,y.scale.x=L.scale.x*Math.abs(y.x-(z.x+e.projectionMatrix.n11)/(z.w+e.projectionMatrix.n14)),y.scale.y=L.scale.y*Math.abs(y.y-(z.y+e.projectionMatrix.n22)/(z.w+e.projectionMatrix.n24)),y.material=L.material,s.elements.push(y);
+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,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,m=this.w,l=m*c+g*f-h*d,j=m*d+h*c-e*f,i=m*f+e*d-g*c,c=-e*
-c-g*d-h*f;b.x=l*m+c*-e+j*-h-i*-g;b.y=j*m+c*-g+i*-e-l*-h;b.z=i*m+c*-h+l*-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,n=this.w,k=n*c+g*f-h*d,l=n*d+h*c-e*f,i=n*f+e*d-g*c,c=-e*
+c-g*d-h*f;b.x=k*n+c*-e+l*-h-i*-g;b.y=l*n+c*-g+i*-e-k*-h;b.z=i*n+c*-h+k*-g-l*-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 +86,9 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 b,c,d,f,e,g=new THREE.Vector3,h=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],f=this.vertices[c.b],e=this.vertices[c.c],g.sub(e.position,f.position),h.sub(d.position,f.position),g.crossSelf(h),g.isZero()||g.normalize(),c.normal.copy(g)},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,D){h=a.vertices[b].position;m=a.vertices[c].position;l=a.vertices[d].position;j=g[e];i=g[f];n=g[D];o=m.x-h.x;p=l.x-h.x;k=m.y-h.y;s=l.y-h.y;K=m.z-h.z;C=l.z-h.z;Q=i.u-j.u;O=n.u-j.u;w=i.v-j.v;F=n.v-j.v;z=1/(Q*F-O*w);E.set((F*o-w*p)*z,(F*k-w*s)*z,(F*K-w*C)*z);N.set((Q*p-O*o)*z,(Q*s-O*k)*z,(Q*C-O*K)*z);u[b].addSelf(E);u[c].addSelf(E);u[d].addSelf(E);r[b].addSelf(N);r[c].addSelf(N);r[d].addSelf(N)}var b,c,d,f,e,g,h,m,l,j,i,n,o,p,k,s,K,C,Q,O,w,F,z,D,u=[],r=[],E=new THREE.Vector3,N=new THREE.Vector3,
-W=new THREE.Vector3,da=new THREE.Vector3,G=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 H=["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++)G.copy(e.vertexNormals[d]),f=e[H[d]],
-D=u[f],W.copy(D),W.subSelf(G.multiplyScalar(G.dot(D))).normalize(),da.cross(e.vertexNormals[d],D),f=da.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=
+b,c,d,e,f,D){h=a.vertices[b].position;n=a.vertices[c].position;k=a.vertices[d].position;l=g[e];i=g[f];m=g[D];o=n.x-h.x;p=k.x-h.x;j=n.y-h.y;r=k.y-h.y;F=n.z-h.z;y=k.z-h.z;H=i.u-l.u;G=m.u-l.u;s=i.v-l.v;C=m.v-l.v;z=1/(H*C-G*s);E.set((C*o-s*p)*z,(C*j-s*r)*z,(C*F-s*y)*z);O.set((H*p-G*o)*z,(H*r-G*j)*z,(H*y-G*F)*z);u[b].addSelf(E);u[c].addSelf(E);u[d].addSelf(E);q[b].addSelf(O);q[c].addSelf(O);q[d].addSelf(O)}var b,c,d,f,e,g,h,n,k,l,i,m,o,p,j,r,F,y,H,G,s,C,z,D,u=[],q=[],E=new THREE.Vector3,O=new THREE.Vector3,
+V=new THREE.Vector3,ca=new THREE.Vector3,I=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)u[b]=new THREE.Vector3,q[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 J=["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++)I.copy(e.vertexNormals[d]),f=e[J[d]],
+D=u[f],V.copy(D),V.subSelf(I.multiplyScalar(I.dot(D))).normalize(),ca.cross(e.vertexNormals[d],D),f=ca.dot(q[f]),f=f<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(V.x,V.y,V.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;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};
@@ -127,34 +131,34 @@ 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(C!=a)k.globalAlpha=C=a}function c(a){if(Q!=a){switch(a){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}Q=a}}function d(a){if(O!=a)k.strokeStyle=O=a}function f(a){if(w!=a)k.fillStyle=w=a}var e=this,g,h,m,l=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-i,n,o,p,k=j.getContext("2d"),s=new THREE.Color(0),K=0,C=1,Q=0,O=null,w=null,F=null,z=null,D=null,u,r,E,N,W=new THREE.RenderableVertex,da=new THREE.RenderableVertex,G,H,I,Y,L,B,S,v,R,P,V,J,t=new THREE.Color,A=new THREE.Color,x=new THREE.Color,y=new THREE.Color,M=new THREE.Color,la=[],fa=[],ga,ha,ea,aa,Ba,Ca,Da,Ea,Fa,Ga,ma=new THREE.Rectangle,Z=new THREE.Rectangle,X=new THREE.Rectangle,ya=!1,$=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,T=new THREE.Vector3,qa,ra,za,ba,sa,va,a=16;qa=document.createElement("canvas");
-qa.width=qa.height=2;ra=qa.getContext("2d");ra.fillStyle="rgba(0,0,0,1)";ra.fillRect(0,0,2,2);za=ra.getImageData(0,0,2,2);ba=za.data;sa=document.createElement("canvas");sa.width=sa.height=a;va=sa.getContext("2d");va.translate(-a/2,-a/2);va.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;n=b;o=Math.floor(i/2);p=Math.floor(n/2);j.width=i;j.height=n;ma.set(-o,-p,o,p);Z.set(-o,-p,o,p);C=1;Q=0;
-D=z=F=w=O=null};this.setClearColor=function(a,b){s.copy(a);K=b;Z.set(-o,-p,o,p)};this.setClearColorHex=function(a,b){s.setHex(a);K=b;Z.set(-o,-p,o,p)};this.clear=function(){k.setTransform(1,0,0,-1,o,p);Z.isEmpty()||(Z.minSelf(ma),Z.inflate(2),K<1&&k.clearRect(Math.floor(Z.getX()),Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight())),K>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+K+")"),k.fillRect(Math.floor(Z.getX()),
-Math.floor(Z.getY()),Math.floor(Z.getWidth()),Math.floor(Z.getHeight()))),Z.empty())};this.render=function(a,j){function i(a){var b,c,d,e;$.setRGB(0,0,0);ta.setRGB(0,0,0);ua.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?(ta.r+=e.r,ta.g+=e.g,ta.b+=e.b):d instanceof THREE.PointLight&&(ua.r+=e.r,ua.g+=e.g,ua.b+=e.b)}function n(a,b,c,d){var e,f,g,h,k,j;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,
-g instanceof THREE.DirectionalLight?(k=g.matrixWorld.getPosition(),j=c.dot(k),j<=0||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(k=g.matrixWorld.getPosition(),j=c.dot(T.sub(k,b).normalize()),j<=0||(j*=g.distance==0?1:1-Math.min(b.distanceTo(k)/g.distance,1),j!=0&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function s(a,e,g){b(g.opacity);c(g.blending);var h,j,i,m,q,n;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)m=g.map.image,q=m.width>>1,n=m.height>>
-1,g=e.scale.x*o,i=e.scale.y*p,h=g*q,j=i*n,X.set(a.x-h,a.y-j,a.x+h,a.y+j),ma.intersects(X)&&(k.save(),k.translate(a.x,a.y),k.rotate(-e.rotation),k.scale(g,-i),k.translate(-q,-n),k.drawImage(m,0,0),k.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*o,j=e.scale.y*p,X.set(a.x-h,a.y-j,a.x+h,a.y+j),ma.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,j),g.program(k),k.restore()))}function w(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(z!=a)k.lineCap=z=a;a=g.linejoin;if(D!=a)k.lineJoin=D=a;d(g.color.getContextStyle());k.stroke();X.inflate(g.linewidth*2)}}function C(a,d,f,g,h,k,i,q){e.info.render.vertices+=3;e.info.render.faces++;b(q.opacity);c(q.blending);G=a.positionScreen.x;H=a.positionScreen.y;
-I=d.positionScreen.x;Y=d.positionScreen.y;L=f.positionScreen.x;B=f.positionScreen.y;K(G,H,I,Y,L,B);if(q instanceof THREE.MeshBasicMaterial)if(q.map)q.map.mapping instanceof THREE.UVMapping&&(aa=i.uvs[0],Aa(G,H,I,Y,L,B,aa[g].u,aa[g].v,aa[h].u,aa[h].v,aa[k].u,aa[k].v,q.map));else if(q.envMap){if(q.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,T.copy(i.vertexNormalsWorld[g]),Ba=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Ca=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,T.copy(i.vertexNormalsWorld[h]),
-Da=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Ea=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,T.copy(i.vertexNormalsWorld[k]),Fa=(T.x*a.n11+T.y*a.n12+T.z*a.n13)*0.5+0.5,Ga=-(T.x*a.n21+T.y*a.n22+T.z*a.n23)*0.5+0.5,Aa(G,H,I,Y,L,B,Ba,Ca,Da,Ea,Fa,Ga,q.envMap)}else q.wireframe?ja(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&&(aa=i.uvs[0],Aa(G,H,I,Y,L,B,aa[g].u,aa[g].v,
-aa[h].u,aa[h].v,aa[k].u,aa[k].v,q.map)),c(THREE.SubtractiveBlending)),ya?!q.wireframe&&q.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(A.r=x.r=y.r=$.r,A.g=x.g=y.g=$.g,A.b=x.b=y.b=$.b,n(m,i.v1.positionWorld,i.vertexNormalsWorld[0],A),n(m,i.v2.positionWorld,i.vertexNormalsWorld[1],x),n(m,i.v3.positionWorld,i.vertexNormalsWorld[2],y),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)),x.r=Math.max(0,Math.min(q.color.r*
-x.r,1)),x.g=Math.max(0,Math.min(q.color.g*x.g,1)),x.b=Math.max(0,Math.min(q.color.b*x.b,1)),y.r=Math.max(0,Math.min(q.color.r*y.r,1)),y.g=Math.max(0,Math.min(q.color.g*y.g,1)),y.b=Math.max(0,Math.min(q.color.b*y.b,1)),M.r=(x.r+y.r)*0.5,M.g=(x.g+y.g)*0.5,M.b=(x.b+y.b)*0.5,ea=wa(A,x,y,M),oa(G,H,I,Y,L,B,0,0,1,0,0,1,ea)):(t.r=$.r,t.g=$.g,t.b=$.b,n(m,i.centroidWorld,i.normalWorld,t),t.r=Math.max(0,Math.min(q.color.r*t.r,1)),t.g=Math.max(0,Math.min(q.color.g*t.g,1)),t.b=Math.max(0,Math.min(q.color.b*t.b,
-1)),q.wireframe?ja(t,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(t)):q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshDepthMaterial)ga=j.near,ha=j.far,A.r=A.g=A.b=1-na(a.positionScreen.z,ga,ha),x.r=x.g=x.b=1-na(d.positionScreen.z,ga,ha),y.r=y.g=y.b=1-na(f.positionScreen.z,ga,ha),M.r=(x.r+y.r)*0.5,M.g=(x.g+y.g)*0.5,M.b=(x.b+y.b)*0.5,ea=wa(A,x,y,M),oa(G,H,I,Y,L,B,0,0,1,0,0,1,ea);else if(q instanceof THREE.MeshNormalMaterial)t.r=
-pa(i.normalWorld.x),t.g=pa(i.normalWorld.y),t.b=pa(i.normalWorld.z),q.wireframe?ja(t,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(t)}function Q(a,d,f,g,h,k,i,q,o){e.info.render.vertices+=4;e.info.render.faces++;b(q.opacity);c(q.blending);if(q.map||q.envMap)C(a,d,g,0,1,3,i,q,o),C(h,f,k,1,2,3,i,q,o);else if(G=a.positionScreen.x,H=a.positionScreen.y,I=d.positionScreen.x,Y=d.positionScreen.y,L=f.positionScreen.x,B=f.positionScreen.y,S=g.positionScreen.x,v=g.positionScreen.y,R=h.positionScreen.x,
-P=h.positionScreen.y,V=k.positionScreen.x,J=k.positionScreen.y,q instanceof THREE.MeshBasicMaterial)O(G,H,I,Y,L,B,S,v),q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color);else if(q instanceof THREE.MeshLambertMaterial)ya?!q.wireframe&&q.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(A.r=x.r=y.r=M.r=$.r,A.g=x.g=y.g=M.g=$.g,A.b=x.b=y.b=M.b=$.b,n(m,i.v1.positionWorld,i.vertexNormalsWorld[0],A),n(m,i.v2.positionWorld,i.vertexNormalsWorld[1],x),
-n(m,i.v4.positionWorld,i.vertexNormalsWorld[3],y),n(m,i.v3.positionWorld,i.vertexNormalsWorld[2],M),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)),x.r=Math.max(0,Math.min(q.color.r*x.r,1)),x.g=Math.max(0,Math.min(q.color.g*x.g,1)),x.b=Math.max(0,Math.min(q.color.b*x.b,1)),y.r=Math.max(0,Math.min(q.color.r*y.r,1)),y.g=Math.max(0,Math.min(q.color.g*y.g,1)),y.b=Math.max(0,Math.min(q.color.b*y.b,1)),M.r=Math.max(0,Math.min(q.color.r*
-M.r,1)),M.g=Math.max(0,Math.min(q.color.g*M.g,1)),M.b=Math.max(0,Math.min(q.color.b*M.b,1)),ea=wa(A,x,y,M),K(G,H,I,Y,S,v),oa(G,H,I,Y,S,v,0,0,1,0,0,1,ea),K(R,P,L,B,V,J),oa(R,P,L,B,V,J,1,0,1,1,0,1,ea)):(t.r=$.r,t.g=$.g,t.b=$.b,n(m,i.centroidWorld,i.normalWorld,t),t.r=Math.max(0,Math.min(q.color.r*t.r,1)),t.g=Math.max(0,Math.min(q.color.g*t.g,1)),t.b=Math.max(0,Math.min(q.color.b*t.b,1)),O(G,H,I,Y,L,B,S,v),q.wireframe?ja(t,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(t)):(O(G,H,I,
-Y,L,B,S,v),q.wireframe?ja(q.color,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(q.color));else if(q instanceof THREE.MeshNormalMaterial)t.r=pa(i.normalWorld.x),t.g=pa(i.normalWorld.y),t.b=pa(i.normalWorld.z),O(G,H,I,Y,L,B,S,v),q.wireframe?ja(t,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):ia(t);else if(q instanceof THREE.MeshDepthMaterial)ga=j.near,ha=j.far,A.r=A.g=A.b=1-na(a.positionScreen.z,ga,ha),x.r=x.g=x.b=1-na(d.positionScreen.z,ga,ha),y.r=y.g=y.b=1-na(g.positionScreen.z,
-ga,ha),M.r=M.g=M.b=1-na(f.positionScreen.z,ga,ha),ea=wa(A,x,y,M),K(G,H,I,Y,S,v),oa(G,H,I,Y,S,v,0,0,1,0,0,1,ea),K(R,P,L,B,V,J),oa(R,P,L,B,V,J,1,0,1,1,0,1,ea)}function K(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 O(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 ja(a,b,c,e){if(F!=b)k.lineWidth=F=b;if(z!=c)k.lineCap=z=c;if(D!=e)k.lineJoin=D=e;d(a.getContextStyle());
-k.stroke();X.inflate(b*2)}function ia(a){f(a.getContextStyle());k.fill()}function Aa(a,b,c,d,e,g,h,i,j,m,o,n,l){if(l.image.width!=0){if(l.needsUpdate==!0||la[l.id]==void 0){var p=l.wrapS==THREE.RepeatWrapping,r=l.wrapT==THREE.RepeatWrapping;la[l.id]=k.createPattern(l.image,p&&r?"repeat":p&&!r?"repeat-x":!p&&r?"repeat-y":"no-repeat");l.needsUpdate=!1}f(la[l.id]);var p=l.offset.x/l.repeat.x,r=l.offset.y/l.repeat.y,s=l.image.width*l.repeat.x,u=l.image.height*l.repeat.y,h=(h+p)*s,i=(i+r)*u,j=(j+p)*s,
-m=(m+r)*u,o=(o+p)*s,n=(n+r)*u;c-=a;d-=b;e-=a;g-=b;j-=h;m-=i;o-=h;n-=i;p=j*n-o*m;if(p==0){if(fa[l.id]==void 0)b=document.createElement("canvas"),b.width=l.image.width,b.height=l.image.height,a=b.getContext("2d"),a.drawImage(l.image,0,0),fa[l.id]=a.getImageData(0,0,l.image.width,l.image.height).data,delete b;b=fa[l.id];h=(Math.floor(h)+Math.floor(i)*l.image.width)*4;t.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);ia(t)}else p=1/p,l=(n*c-m*e)*p,m=(n*d-m*g)*p,c=(j*e-o*c)*p,d=(j*g-o*d)*p,a=a-l*h-c*i,h=b-m*h-
-d*i,k.save(),k.transform(l,m,c,d,a,h),k.fill(),k.restore()}}function oa(a,b,c,d,e,f,g,h,i,j,l,m,o){var n,p;n=o.width-1;p=o.height-1;g*=n;h*=p;i*=n;j*=p;l*=n;m*=p;c-=a;d-=b;e-=a;f-=b;i-=g;j-=h;l-=g;m-=h;p=1/(i*m-l*j);n=(m*c-j*e)*p;j=(m*d-j*f)*p;c=(i*e-l*c)*p;d=(i*f-l*d)*p;a=a-n*g-c*h;b=b-j*g-d*h;k.save();k.transform(n,j,c,d,a,b);k.clip();k.drawImage(o,0,0);k.restore()}function wa(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);ba[0]=e<0?0:e>255?255:e;ba[1]=f<0?0:f>255?255:f;ba[2]=a<0?0:a>255?255:a;ba[4]=g<0?0:g>255?255:g;ba[5]=h<0?0:h>255?255:h;ba[6]=b<0?0:b>255?255:b;ba[8]=i<0?0:i>255?255:i;ba[9]=j<0?0:j>255?255:j;ba[10]=c<0?0:c>255?255:c;ba[12]=k<0?0:k>255?255:k;ba[13]=l<0?0:l>255?255:l;ba[14]=d<0?0:d>255?255:d;ra.putImageData(za,0,0);va.drawImage(qa,0,0);return sa}function na(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function pa(a){a=(a+1)*0.5;return a<0?0:a>
-1?1:a}function ka(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 xa,Ha,U,ca;this.autoClear?this.clear():k.setTransform(1,0,0,-1,o,p);e.info.render.vertices=0;e.info.render.faces=0;g=l.projectScene(a,j,this.sortElements);h=g.elements;m=g.lights;(ya=m.length>0)&&i(m);xa=0;for(Ha=h.length;xa<Ha;xa++)if(U=h[xa],ca=U.material,ca=ca instanceof THREE.MeshFaceMaterial?U.faceMaterial:ca,!(ca==null||ca.opacity==0)){X.empty();if(U instanceof THREE.RenderableParticle)u=
-U,u.x*=o,u.y*=p,s(u,U,ca,a);else if(U instanceof THREE.RenderableLine)u=U.v1,r=U.v2,u.positionScreen.x*=o,u.positionScreen.y*=p,r.positionScreen.x*=o,r.positionScreen.y*=p,X.addPoint(u.positionScreen.x,u.positionScreen.y),X.addPoint(r.positionScreen.x,r.positionScreen.y),ma.intersects(X)&&w(u,r,U,ca,a);else if(U instanceof THREE.RenderableFace3)u=U.v1,r=U.v2,E=U.v3,u.positionScreen.x*=o,u.positionScreen.y*=p,r.positionScreen.x*=o,r.positionScreen.y*=p,E.positionScreen.x*=o,E.positionScreen.y*=p,ca.overdraw&&
-(ka(u.positionScreen,r.positionScreen),ka(r.positionScreen,E.positionScreen),ka(E.positionScreen,u.positionScreen)),X.add3Points(u.positionScreen.x,u.positionScreen.y,r.positionScreen.x,r.positionScreen.y,E.positionScreen.x,E.positionScreen.y),ma.intersects(X)&&C(u,r,E,0,1,2,U,ca,a);else if(U instanceof THREE.RenderableFace4)u=U.v1,r=U.v2,E=U.v3,N=U.v4,u.positionScreen.x*=o,u.positionScreen.y*=p,r.positionScreen.x*=o,r.positionScreen.y*=p,E.positionScreen.x*=o,E.positionScreen.y*=p,N.positionScreen.x*=
-o,N.positionScreen.y*=p,W.positionScreen.copy(r.positionScreen),da.positionScreen.copy(N.positionScreen),ca.overdraw&&(ka(u.positionScreen,r.positionScreen),ka(r.positionScreen,N.positionScreen),ka(N.positionScreen,u.positionScreen),ka(E.positionScreen,W.positionScreen),ka(E.positionScreen,da.positionScreen)),X.addPoint(u.positionScreen.x,u.positionScreen.y),X.addPoint(r.positionScreen.x,r.positionScreen.y),X.addPoint(E.positionScreen.x,E.positionScreen.y),X.addPoint(N.positionScreen.x,N.positionScreen.y),
-ma.intersects(X)&&Q(u,r,E,N,W,da,U,ca,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.CanvasRenderer=function(a){function b(a){if(y!=a)j.globalAlpha=y=a}function c(a){if(H!=a){switch(a){case THREE.NormalBlending:j.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:j.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:j.globalCompositeOperation="darker"}H=a}}function d(a){if(G!=a)j.strokeStyle=G=a}function f(a){if(s!=a)j.fillStyle=s=a}var e=this,g,h,n,k=new THREE.Projector,a=a||{},l=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+i,m,o,p,j=l.getContext("2d"),r=new THREE.Color(0),F=0,y=1,H=0,G=null,s=null,C=null,z=null,D=null,u,q,E,O,V=new THREE.RenderableVertex,ca=new THREE.RenderableVertex,I,J,K,X,M,B,R,v,Q,P,U,L,t=new THREE.Color,A=new THREE.Color,w=new THREE.Color,x=new THREE.Color,N=new THREE.Color,ka=[],ea=[],fa,ga,da,$,Ba,Ca,Da,Ea,Fa,Ga,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,aa,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);aa=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=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){i=a;m=b;o=Math.floor(i/2);p=Math.floor(m/2);l.width=i;l.height=m;la.set(-o,-p,o,p);Y.set(-o,-p,o,p);y=1;H=0;
+D=z=C=s=G=null};this.setClearColor=function(a,b){r.copy(a);F=b;Y.set(-o,-p,o,p)};this.setClearColorHex=function(a,b){r.setHex(a);F=b;Y.set(-o,-p,o,p)};this.clear=function(){j.setTransform(1,0,0,-1,o,p);Y.isEmpty()||(Y.minSelf(la),Y.inflate(2),F<1&&j.clearRect(Math.floor(Y.getX()),Math.floor(Y.getY()),Math.floor(Y.getWidth()),Math.floor(Y.getHeight())),F>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*255)+","+F+")"),j.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 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 m(a,b,c,d){var e,f,g,h,j,l;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,
+g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),l=c.dot(j),l<=0||(l*=g.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),l=c.dot(S.sub(j,b).normalize()),l<=0||(l*=g.distance==0?1:1-Math.min(b.distanceTo(j)/g.distance,1),l!=0&&(l*=g.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)))}function r(a,e,g){b(g.opacity);c(g.blending);var h,l,k,i,za,n;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)i=g.map.image,za=i.width>>1,n=i.height>>
+1,g=e.scale.x*o,k=e.scale.y*p,h=g*za,l=k*n,W.set(a.x-h,a.y-l,a.x+h,a.y+l),la.intersects(W)&&(j.save(),j.translate(a.x,a.y),j.rotate(-e.rotation),j.scale(g,-k),j.translate(-za,-n),j.drawImage(i,0,0),j.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*o,l=e.scale.y*p,W.set(a.x-h,a.y-l,a.x+h,a.y+l),la.intersects(W)&&(d(g.color.getContextStyle()),f(g.color.getContextStyle()),j.save(),j.translate(a.x,a.y),j.rotate(-e.rotation),j.scale(h,l),g.program(j),j.restore()))}function s(a,
+e,f,g){b(g.opacity);c(g.blending);j.beginPath();j.moveTo(a.positionScreen.x,a.positionScreen.y);j.lineTo(e.positionScreen.x,e.positionScreen.y);j.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(C!=a)j.lineWidth=C=a;a=g.linecap;if(z!=a)j.lineCap=z=a;a=g.linejoin;if(D!=a)j.lineJoin=D=a;d(g.color.getContextStyle());j.stroke();W.inflate(g.linewidth*2)}}function y(a,d,f,g,h,j,k,i){e.info.render.vertices+=3;e.info.render.faces++;b(i.opacity);c(i.blending);I=a.positionScreen.x;J=a.positionScreen.y;
+K=d.positionScreen.x;X=d.positionScreen.y;M=f.positionScreen.x;B=f.positionScreen.y;F(I,J,K,X,M,B);if(i instanceof THREE.MeshBasicMaterial)if(i.map)i.map.mapping instanceof THREE.UVMapping&&($=k.uvs[0],Aa(I,J,K,X,M,B,$[g].u,$[g].v,$[h].u,$[h].v,$[j].u,$[j].v,i.map));else if(i.envMap){if(i.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,S.copy(k.vertexNormalsWorld[g]),Ba=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ca=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(k.vertexNormalsWorld[h]),
+Da=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ea=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(k.vertexNormalsWorld[j]),Fa=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ga=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,Aa(I,J,K,X,M,B,Ba,Ca,Da,Ea,Fa,Ga,i.envMap)}else i.wireframe?ia(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(i.color);else if(i instanceof THREE.MeshLambertMaterial)i.map&&!i.wireframe&&(i.map.mapping instanceof THREE.UVMapping&&($=k.uvs[0],Aa(I,J,K,X,M,B,$[g].u,$[g].v,
+$[h].u,$[h].v,$[j].u,$[j].v,i.map)),c(THREE.SubtractiveBlending)),xa?!i.wireframe&&i.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==3?(A.r=w.r=x.r=Z.r,A.g=w.g=x.g=Z.g,A.b=w.b=x.b=Z.b,m(n,k.v1.positionWorld,k.vertexNormalsWorld[0],A),m(n,k.v2.positionWorld,k.vertexNormalsWorld[1],w),m(n,k.v3.positionWorld,k.vertexNormalsWorld[2],x),A.r=Math.max(0,Math.min(i.color.r*A.r,1)),A.g=Math.max(0,Math.min(i.color.g*A.g,1)),A.b=Math.max(0,Math.min(i.color.b*A.b,1)),w.r=Math.max(0,Math.min(i.color.r*
+w.r,1)),w.g=Math.max(0,Math.min(i.color.g*w.g,1)),w.b=Math.max(0,Math.min(i.color.b*w.b,1)),x.r=Math.max(0,Math.min(i.color.r*x.r,1)),x.g=Math.max(0,Math.min(i.color.g*x.g,1)),x.b=Math.max(0,Math.min(i.color.b*x.b,1)),N.r=(w.r+x.r)*0.5,N.g=(w.g+x.g)*0.5,N.b=(w.b+x.b)*0.5,da=va(A,w,x,N),na(I,J,K,X,M,B,0,0,1,0,0,1,da)):(t.r=Z.r,t.g=Z.g,t.b=Z.b,m(n,k.centroidWorld,k.normalWorld,t),t.r=Math.max(0,Math.min(i.color.r*t.r,1)),t.g=Math.max(0,Math.min(i.color.g*t.g,1)),t.b=Math.max(0,Math.min(i.color.b*t.b,
+1)),i.wireframe?ia(t,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(t)):i.wireframe?ia(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(i.color);else if(i instanceof THREE.MeshDepthMaterial)fa=l.near,ga=l.far,A.r=A.g=A.b=1-ma(a.positionScreen.z,fa,ga),w.r=w.g=w.b=1-ma(d.positionScreen.z,fa,ga),x.r=x.g=x.b=1-ma(f.positionScreen.z,fa,ga),N.r=(w.r+x.r)*0.5,N.g=(w.g+x.g)*0.5,N.b=(w.b+x.b)*0.5,da=va(A,w,x,N),na(I,J,K,X,M,B,0,0,1,0,0,1,da);else if(i instanceof THREE.MeshNormalMaterial)t.r=
+oa(k.normalWorld.x),t.g=oa(k.normalWorld.y),t.b=oa(k.normalWorld.z),i.wireframe?ia(t,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):ha(t)}function H(a,d,f,g,h,i,k,j,o){e.info.render.vertices+=4;e.info.render.faces++;b(j.opacity);c(j.blending);if(j.map||j.envMap)y(a,d,g,0,1,3,k,j,o),y(h,f,i,1,2,3,k,j,o);else if(I=a.positionScreen.x,J=a.positionScreen.y,K=d.positionScreen.x,X=d.positionScreen.y,M=f.positionScreen.x,B=f.positionScreen.y,R=g.positionScreen.x,v=g.positionScreen.y,Q=h.positionScreen.x,
+P=h.positionScreen.y,U=i.positionScreen.x,L=i.positionScreen.y,j instanceof THREE.MeshBasicMaterial)G(I,J,K,X,M,B,R,v),j.wireframe?ia(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(j.color);else if(j instanceof THREE.MeshLambertMaterial)xa?!j.wireframe&&j.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==4?(A.r=w.r=x.r=N.r=Z.r,A.g=w.g=x.g=N.g=Z.g,A.b=w.b=x.b=N.b=Z.b,m(n,k.v1.positionWorld,k.vertexNormalsWorld[0],A),m(n,k.v2.positionWorld,k.vertexNormalsWorld[1],w),
+m(n,k.v4.positionWorld,k.vertexNormalsWorld[3],x),m(n,k.v3.positionWorld,k.vertexNormalsWorld[2],N),A.r=Math.max(0,Math.min(j.color.r*A.r,1)),A.g=Math.max(0,Math.min(j.color.g*A.g,1)),A.b=Math.max(0,Math.min(j.color.b*A.b,1)),w.r=Math.max(0,Math.min(j.color.r*w.r,1)),w.g=Math.max(0,Math.min(j.color.g*w.g,1)),w.b=Math.max(0,Math.min(j.color.b*w.b,1)),x.r=Math.max(0,Math.min(j.color.r*x.r,1)),x.g=Math.max(0,Math.min(j.color.g*x.g,1)),x.b=Math.max(0,Math.min(j.color.b*x.b,1)),N.r=Math.max(0,Math.min(j.color.r*
+N.r,1)),N.g=Math.max(0,Math.min(j.color.g*N.g,1)),N.b=Math.max(0,Math.min(j.color.b*N.b,1)),da=va(A,w,x,N),F(I,J,K,X,R,v),na(I,J,K,X,R,v,0,0,1,0,0,1,da),F(Q,P,M,B,U,L),na(Q,P,M,B,U,L,1,0,1,1,0,1,da)):(t.r=Z.r,t.g=Z.g,t.b=Z.b,m(n,k.centroidWorld,k.normalWorld,t),t.r=Math.max(0,Math.min(j.color.r*t.r,1)),t.g=Math.max(0,Math.min(j.color.g*t.g,1)),t.b=Math.max(0,Math.min(j.color.b*t.b,1)),G(I,J,K,X,M,B,R,v),j.wireframe?ia(t,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(t)):(G(I,J,K,
+X,M,B,R,v),j.wireframe?ia(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(j.color));else if(j instanceof THREE.MeshNormalMaterial)t.r=oa(k.normalWorld.x),t.g=oa(k.normalWorld.y),t.b=oa(k.normalWorld.z),G(I,J,K,X,M,B,R,v),j.wireframe?ia(t,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):ha(t);else if(j instanceof THREE.MeshDepthMaterial)fa=l.near,ga=l.far,A.r=A.g=A.b=1-ma(a.positionScreen.z,fa,ga),w.r=w.g=w.b=1-ma(d.positionScreen.z,fa,ga),x.r=x.g=x.b=1-ma(g.positionScreen.z,
+fa,ga),N.r=N.g=N.b=1-ma(f.positionScreen.z,fa,ga),da=va(A,w,x,N),F(I,J,K,X,R,v),na(I,J,K,X,R,v,0,0,1,0,0,1,da),F(Q,P,M,B,U,L),na(Q,P,M,B,U,L,1,0,1,1,0,1,da)}function F(a,b,c,d,e,f){j.beginPath();j.moveTo(a,b);j.lineTo(c,d);j.lineTo(e,f);j.lineTo(a,b);j.closePath()}function G(a,b,c,d,e,f,g,h){j.beginPath();j.moveTo(a,b);j.lineTo(c,d);j.lineTo(e,f);j.lineTo(g,h);j.lineTo(a,b);j.closePath()}function ia(a,b,c,e){if(C!=b)j.lineWidth=C=b;if(z!=c)j.lineCap=z=c;if(D!=e)j.lineJoin=D=e;d(a.getContextStyle());
+j.stroke();W.inflate(b*2)}function ha(a){f(a.getContextStyle());j.fill()}function Aa(a,b,c,d,e,g,h,i,k,l,n,o,m){if(m.image.width!=0){if(m.needsUpdate==!0||ka[m.id]==void 0){var p=m.wrapS==THREE.RepeatWrapping,q=m.wrapT==THREE.RepeatWrapping;ka[m.id]=j.createPattern(m.image,p&&q?"repeat":p&&!q?"repeat-x":!p&&q?"repeat-y":"no-repeat");m.needsUpdate=!1}f(ka[m.id]);var p=m.offset.x/m.repeat.x,q=m.offset.y/m.repeat.y,r=m.image.width*m.repeat.x,s=m.image.height*m.repeat.y,h=(h+p)*r,i=(i+q)*s,k=(k+p)*r,
+l=(l+q)*s,n=(n+p)*r,o=(o+q)*s;c-=a;d-=b;e-=a;g-=b;k-=h;l-=i;n-=h;o-=i;p=k*o-n*l;if(p==0){if(ea[m.id]==void 0)b=document.createElement("canvas"),b.width=m.image.width,b.height=m.image.height,a=b.getContext("2d"),a.drawImage(m.image,0,0),ea[m.id]=a.getImageData(0,0,m.image.width,m.image.height).data,delete b;b=ea[m.id];h=(Math.floor(h)+Math.floor(i)*m.image.width)*4;t.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);ha(t)}else p=1/p,m=(o*c-l*e)*p,l=(o*d-l*g)*p,c=(k*e-n*c)*p,d=(k*g-n*d)*p,a=a-m*h-c*i,h=b-l*h-
+d*i,j.save(),j.transform(m,l,c,d,a,h),j.fill(),j.restore()}}function na(a,b,c,d,e,f,g,h,i,k,l,m,n){var o,p;o=n.width-1;p=n.height-1;g*=o;h*=p;i*=o;k*=p;l*=o;m*=p;c-=a;d-=b;e-=a;f-=b;i-=g;k-=h;l-=g;m-=h;p=1/(i*m-l*k);o=(m*c-k*e)*p;k=(m*d-k*f)*p;c=(i*e-l*c)*p;d=(i*f-l*d)*p;a=a-o*g-c*h;b=b-k*g-d*h;j.save();j.transform(o,k,c,d,a,b);j.clip();j.drawImage(n,0,0);j.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);aa[0]=e<0?0:e>255?255:e;aa[1]=f<0?0:f>255?255:f;aa[2]=a<0?0:a>255?255:a;aa[4]=g<0?0:g>255?255:g;aa[5]=h<0?0:h>255?255:h;aa[6]=b<0?0:b>255?255:b;aa[8]=i<0?0:i>255?255:i;aa[9]=j<0?0:j>255?255:j;aa[10]=c<0?0:c>255?255:c;aa[12]=k<0?0:k>255?255:k;aa[13]=l<0?0:l>255?255:l;aa[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,Ha,T,ba;this.autoClear?this.clear():j.setTransform(1,0,0,-1,o,p);e.info.render.vertices=0;e.info.render.faces=0;g=k.projectScene(a,l,this.sortElements);h=g.elements;n=g.lights;(xa=n.length>0)&&i(n);wa=0;for(Ha=h.length;wa<Ha;wa++)if(T=h[wa],ba=T.material,ba=ba instanceof THREE.MeshFaceMaterial?T.faceMaterial:ba,!(ba==null||ba.opacity==0)){W.empty();if(T instanceof THREE.RenderableParticle)u=
+T,u.x*=o,u.y*=p,r(u,T,ba,a);else if(T instanceof THREE.RenderableLine)u=T.v1,q=T.v2,u.positionScreen.x*=o,u.positionScreen.y*=p,q.positionScreen.x*=o,q.positionScreen.y*=p,W.addPoint(u.positionScreen.x,u.positionScreen.y),W.addPoint(q.positionScreen.x,q.positionScreen.y),la.intersects(W)&&s(u,q,T,ba,a);else if(T instanceof THREE.RenderableFace3)u=T.v1,q=T.v2,E=T.v3,u.positionScreen.x*=o,u.positionScreen.y*=p,q.positionScreen.x*=o,q.positionScreen.y*=p,E.positionScreen.x*=o,E.positionScreen.y*=p,ba.overdraw&&
+(ja(u.positionScreen,q.positionScreen),ja(q.positionScreen,E.positionScreen),ja(E.positionScreen,u.positionScreen)),W.add3Points(u.positionScreen.x,u.positionScreen.y,q.positionScreen.x,q.positionScreen.y,E.positionScreen.x,E.positionScreen.y),la.intersects(W)&&y(u,q,E,0,1,2,T,ba,a);else if(T instanceof THREE.RenderableFace4)u=T.v1,q=T.v2,E=T.v3,O=T.v4,u.positionScreen.x*=o,u.positionScreen.y*=p,q.positionScreen.x*=o,q.positionScreen.y*=p,E.positionScreen.x*=o,E.positionScreen.y*=p,O.positionScreen.x*=
+o,O.positionScreen.y*=p,V.positionScreen.copy(q.positionScreen),ca.positionScreen.copy(O.positionScreen),ba.overdraw&&(ja(u.positionScreen,q.positionScreen),ja(q.positionScreen,O.positionScreen),ja(O.positionScreen,u.positionScreen),ja(E.positionScreen,V.positionScreen),ja(E.positionScreen,ca.positionScreen)),W.addPoint(u.positionScreen.x,u.positionScreen.y),W.addPoint(q.positionScreen.x,q.positionScreen.y),W.addPoint(E.positionScreen.x,E.positionScreen.y),W.addPoint(O.positionScreen.x,O.positionScreen.y),
+la.intersects(W)&&H(u,q,E,O,V,ca,T,ba,a);Y.addRectangle(W)}j.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};

+ 44 - 40
build/custom/ThreeDOM.js

@@ -1,4 +1,4 @@
-// ThreeDOM.js r46 - http://github.com/mrdoob/three.js
+// ThreeDOM.js r47dev - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
 THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,e,f;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),e=a*6-d,a=c*(1-b),f=c*(1-
 b*e),b=c*(1-b*(1-e)),d){case 1:this.r=f;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=f;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=f;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
@@ -14,64 +14,68 @@ this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),
 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){function c(a,b,c){i.sub(c,a);p=i.dot(b);if(p<=0)return null;o=l.add(a,n.copy(b).multiplyScalar(p));return r=c.distanceTo(o)}function d(a,b,c,d){i.sub(d,b);l.sub(c,b);n.sub(a,b);I=i.dot(i);u=i.dot(l);D=i.dot(n);J=l.dot(l);s=l.dot(n);A=1/(I*J-u*u);t=(J*D-u*s)*A;w=(I*s-u*D)*A;return t>=0&&w>=0&&t+w<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,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3,j=new THREE.Vector3;this.intersectObject=function(i){for(var l,n=[],o=0,P=i.children.length;o<P;o++)Array.prototype.push.apply(n,this.intersectObject(i.children[o]));if(i instanceof THREE.Particle){o=
-c(this.origin,this.direction,i.matrixWorld.getPosition());if(o===null||o>i.scale.x)return[];l={distance:o,point:i.position,face:null,object:i};n.push(l)}else if(i instanceof THREE.Mesh){o=c(this.origin,this.direction,i.matrixWorld.getPosition());if(o===null||o>i.geometry.boundingSphere.radius*Math.max(i.scale.x,Math.max(i.scale.y,i.scale.z)))return n;var E,p=i.geometry,M=p.vertices,K;i.matrixRotationWorld.extractRotation(i.matrixWorld);o=0;for(P=p.faces.length;o<P;o++)if(l=p.faces[o],a.copy(this.origin),
-b.copy(this.direction),K=i.matrixWorld,k=K.multiplyVector3(k.copy(l.centroid)).subSelf(a),E=k.dot(b),!(E<=0)&&(e=K.multiplyVector3(e.copy(M[l.a].position)),f=K.multiplyVector3(f.copy(M[l.b].position)),g=K.multiplyVector3(g.copy(M[l.c].position)),l instanceof THREE.Face4&&(h=K.multiplyVector3(h.copy(M[l.d].position))),m=i.matrixRotationWorld.multiplyVector3(m.copy(l.normal)),E=b.dot(m),i.doubleSided||(i.flipSided?E>0:E<0)))if(E=m.dot(k.sub(e,a))/E,j.add(a,b.multiplyScalar(E)),l instanceof THREE.Face3)d(j,
-e,f,g)&&(l={distance:a.distanceTo(j),point:j.clone(),face:l,object:i},n.push(l));else if(l instanceof THREE.Face4&&(d(j,e,f,h)||d(j,f,g,h)))l={distance:a.distanceTo(j),point:j.clone(),face:l,object:i},n.push(l)}return n};var i=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,p,o,r,I,u,D,J,s,A,t,w};
-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(k,f,g,i){h=!1;b=k;c=f;d=g;e=i;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,j,i,l,n){h?(h=!1,b=f<j?f<l?f:l:j<l?j:l,c=g<i?g<n?g:n:i<n?i:n,d=f>j?f>l?f:l:j>l?j:l,e=g>i?g>n?g:n:i>n?i:n):(b=f<j?f<l?f<b?f:b:l<b?l:b:j<l?j<b?j:b:l<b?l:b,c=g<i?g<n?g<c?g:c:n<c?n:c:i<n?i<c?i:c:n<c?n:c,d=f>j?f>l?f>d?f:d:l>d?l:d:j>l?j>d?j:d:l>d?l:d,e=g>i?g>n?g>e?g:e:n>e?n:e:i>n?i>e?i:e:n>e?n: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>
+THREE.Ray=function(a,b){function c(a,b,c){k.sub(c,a);p=k.dot(b);if(p<=0)return null;o=m.add(a,n.copy(b).multiplyScalar(p));return q=c.distanceTo(o)}function d(a,b,c,d){k.sub(d,b);m.sub(c,b);n.sub(a,b);D=k.dot(k);t=k.dot(m);C=k.dot(n);E=m.dot(m);r=m.dot(n);z=1/(D*E-t*t);u=(E*C-t*r)*z;x=(D*r-t*C)*z;return u>=0&&x>=0&&u+x<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,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,l=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3;this.intersectObject=function(k){for(var m,n=[],o=0,O=k.children.length;o<O;o++)Array.prototype.push.apply(n,this.intersectObject(k.children[o]));if(k instanceof THREE.Particle){o=
+c(this.origin,this.direction,k.matrixWorld.getPosition());if(o===null||o>k.scale.x)return[];m={distance:o,point:k.position,face:null,object:k};n.push(m)}else if(k instanceof THREE.Mesh){o=c(this.origin,this.direction,k.matrixWorld.getPosition());if(o===null||o>k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)))return n;var G,p=k.geometry,L=p.vertices,q;k.matrixRotationWorld.extractRotation(k.matrixWorld);o=0;for(O=p.faces.length;o<O;o++)if(m=p.faces[o],a.copy(this.origin),
+b.copy(this.direction),q=k.matrixWorld,l=q.multiplyVector3(l.copy(m.centroid)).subSelf(a),G=l.dot(b),!(G<=0)&&(e=q.multiplyVector3(e.copy(L[m.a].position)),f=q.multiplyVector3(f.copy(L[m.b].position)),g=q.multiplyVector3(g.copy(L[m.c].position)),m instanceof THREE.Face4&&(h=q.multiplyVector3(h.copy(L[m.d].position))),i=k.matrixRotationWorld.multiplyVector3(i.copy(m.normal)),G=b.dot(i),k.doubleSided||(k.flipSided?G>0:G<0)))if(G=i.dot(l.sub(e,a))/G,j.add(a,b.multiplyScalar(G)),m instanceof THREE.Face3)d(j,
+e,f,g)&&(m={distance:a.distanceTo(j),point:j.clone(),face:m,object:k},n.push(m));else if(m instanceof THREE.Face4&&(d(j,e,f,h)||d(j,f,g,h)))m={distance:a.distanceTo(j),point:j.clone(),face:m,object:k},n.push(m)}return n};var k=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3,p,o,q,D,t,C,E,r,z,u,x};
+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(f,g,j,k){h=!1;b=f;c=g;d=j;e=k;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,j,k,m,n){h?(h=!1,b=f<j?f<m?f:m:j<m?j:m,c=g<k?g<n?g:n:k<n?k:n,d=f>j?f>m?f:m:j>m?j:m,e=g>k?g>n?g:n:k>n?k:n):(b=f<j?f<m?f<b?f:b:m<b?m:b:j<m?j<b?j:b:m<b?m:b,c=g<k?g<n?g<c?g:c:n<c?n:c:k<n?k<c?k:c:n<c?n:c,d=f>j?f>m?f>d?f:d:m>d?m:d:j>m?j>d?j:d:m>d?m:d,e=g>k?g>n?g>e?g:e:n>e?n:e:k>n?k>e?k:e:n>e?n: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}};
 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,k,m,j,i,l,n,p,o){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,k||0,m||0,j!==void 0?j:1,i||0,l||0,n||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,h,k,m,j,i,l,n,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=h;this.n31=k;this.n32=m;this.n33=j;this.n34=i;this.n41=l;this.n42=n;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,h=a.n22,k=a.n23,m=a.n24,j=a.n31,i=a.n32,l=a.n33,n=a.n34,p=a.n41,o=a.n42,r=a.n43,
-I=a.n44,u=b.n11,D=b.n12,J=b.n13,s=b.n14,A=b.n21,t=b.n22,w=b.n23,O=b.n24,z=b.n31,G=b.n32,H=b.n33,P=b.n34,E=b.n41,S=b.n42,M=b.n43,K=b.n44;this.n11=c*u+d*A+e*z+f*E;this.n12=c*D+d*t+e*G+f*S;this.n13=c*J+d*w+e*H+f*M;this.n14=c*s+d*O+e*P+f*K;this.n21=g*u+h*A+k*z+m*E;this.n22=g*D+h*t+k*G+m*S;this.n23=g*J+h*w+k*H+m*M;this.n24=g*s+h*O+k*P+m*K;this.n31=j*u+i*A+l*z+n*E;this.n32=j*D+i*t+l*G+n*S;this.n33=j*J+i*w+l*H+n*M;this.n34=j*s+i*O+l*P+n*K;this.n41=p*u+o*A+r*z+I*E;this.n42=p*D+o*t+r*G+I*S;this.n43=p*J+o*
-w+r*H+I*M;this.n44=p*s+o*O+r*P+I*K;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,h,l,i,j,k,m,n,p,o){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,l||0,i||0,j!==void 0?j:1,k||0,m||0,n||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,h,l,i,j,k,m,n,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=h;this.n31=l;this.n32=i;this.n33=j;this.n34=k;this.n41=m;this.n42=n;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,h=a.n22,l=a.n23,i=a.n24,j=a.n31,k=a.n32,m=a.n33,n=a.n34,p=a.n41,o=a.n42,q=a.n43,
+D=a.n44,t=b.n11,C=b.n12,E=b.n13,r=b.n14,z=b.n21,u=b.n22,x=b.n23,N=b.n24,w=b.n31,I=b.n32,J=b.n33,O=b.n34,G=b.n41,R=b.n42,L=b.n43,S=b.n44;this.n11=c*t+d*z+e*w+f*G;this.n12=c*C+d*u+e*I+f*R;this.n13=c*E+d*x+e*J+f*L;this.n14=c*r+d*N+e*O+f*S;this.n21=g*t+h*z+l*w+i*G;this.n22=g*C+h*u+l*I+i*R;this.n23=g*E+h*x+l*J+i*L;this.n24=g*r+h*N+l*O+i*S;this.n31=j*t+k*z+m*w+n*G;this.n32=j*C+k*u+m*I+n*R;this.n33=j*E+k*x+m*J+n*L;this.n34=j*r+k*N+m*O+n*S;this.n41=p*t+o*z+q*w+D*G;this.n42=p*C+o*u+q*I+D*R;this.n43=p*E+o*
+x+q*J+D*L;this.n44=p*r+o*N+q*O+D*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,k=this.n31,m=this.n32,j=this.n33,i=this.n34,l=this.n41,n=this.n42,p=this.n43,o=this.n44;return d*g*m*l-c*h*m*l-d*f*j*l+b*h*j*l+c*f*i*l-b*g*i*l-d*g*k*n+c*h*k*n+d*e*j*n-a*h*j*n-c*e*i*n+a*g*i*n+d*f*k*p-b*h*k*p-d*e*m*p+a*h*m*p+b*e*i*p-a*f*i*p-c*f*k*o+b*g*k*o+c*e*m*o-a*g*m*o-b*e*j*o+a*f*j*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.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,l=this.n31,i=this.n32,j=this.n33,k=this.n34,m=this.n41,n=this.n42,p=this.n43,o=this.n44;return d*g*i*m-c*h*i*m-d*f*j*m+b*h*j*m+c*f*k*m-b*g*k*m-d*g*l*n+c*h*l*n+d*e*j*n-a*h*j*n-c*e*k*n+a*g*k*n+d*f*l*p-b*h*l*p-d*e*i*p+a*h*i*p+b*e*k*p-a*f*k*p-c*f*l*o+b*g*l*o+c*e*i*o-a*g*i*o-b*e*j*o+a*f*j*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.n34=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,k=e*f,m=e*g;this.set(k*f+c,k*g-d*h,k*h+d*g,0,k*g+d*h,m*g+c,m*h-d*f,0,k*h-d*g,m*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,k=a.n24,m=a.n31,j=a.n32,i=a.n33,l=a.n34,n=a.n41,p=a.n42,o=a.n43,r=a.n44;this.n11=h*l*p-k*i*p+k*j*o-g*l*o-h*j*r+g*i*r;this.n12=e*i*p-d*l*p-e*j*o+c*l*o+d*j*r-c*i*r;this.n13=d*k*p-e*h*p+e*g*o-c*k*o-d*g*r+c*h*r;this.n14=e*h*j-d*k*j-e*g*i+c*k*i+d*g*l-c*h*l;this.n21=k*i*n-h*l*n-k*m*o+f*l*o+h*m*r-f*i*r;this.n22=d*l*n-e*i*n+
-e*m*o-b*l*o-d*m*r+b*i*r;this.n23=e*h*n-d*k*n-e*f*o+b*k*o+d*f*r-b*h*r;this.n24=d*k*m-e*h*m+e*f*i-b*k*i-d*f*l+b*h*l;this.n31=g*l*n-k*j*n+k*m*p-f*l*p-g*m*r+f*j*r;this.n32=e*j*n-c*l*n-e*m*p+b*l*p+c*m*r-b*j*r;this.n33=d*k*n-e*g*n+e*f*p-b*k*p-c*f*r+b*g*r;this.n34=e*g*m-c*k*m-e*f*j+b*k*j+c*f*l-b*g*l;this.n41=h*j*n-g*i*n-h*m*p+f*i*p+g*m*o-f*j*o;this.n42=c*i*n-d*j*n+d*m*p-b*i*p-c*m*o+b*j*o;this.n43=d*g*n-c*h*n-d*f*p+b*h*p+c*f*o-b*g*o;this.n44=c*h*m-d*g*m+d*f*j-b*h*j-c*f*i+b*g*i;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 k=g*h,m=g*e,j=d*h,i=d*e;this.n11=k+i*c;this.n12=j*c-m;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=m*c-j;this.n32=i+k*c;this.n33=f*g;break;case "ZXY":k=g*h;m=g*e;j=d*h;i=d*e;this.n11=k-i*c;this.n12=-f*e;this.n13=j+m*c;this.n21=m+j*c;this.n22=f*h;this.n23=i-k*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":k=
-f*h;m=f*e;j=c*h;i=c*e;this.n11=g*h;this.n12=j*d-m;this.n13=k*d+i;this.n21=g*e;this.n22=i*d+k;this.n23=m*d-j;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":k=f*g;m=f*d;j=c*g;i=c*d;this.n11=g*h;this.n12=i-k*e;this.n13=j*e+m;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=m*e+j;this.n33=k-i*e;break;case "XZY":k=f*g;m=f*d;j=c*g;i=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=k*e+i;this.n22=f*h;this.n23=m*e-j;this.n31=j*e-m;this.n32=c*h;this.n33=i*e+k;break;default:k=f*h,m=f*
-e,j=c*h,i=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=m+j*d,this.n22=k-i*d,this.n23=-c*g,this.n31=i-k*d,this.n32=j+m*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,k=b*g;b*=h;var m=c*g;c*=h;d*=h;f*=e;g*=e;e*=h;this.n11=1-(m+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+m);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,h=a.z,l=e*f,i=e*g;this.set(l*f+c,l*g-d*h,l*h+d*g,0,l*g+d*h,i*g+c,i*h-d*f,0,l*h-d*g,i*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,l=a.n24,i=a.n31,j=a.n32,k=a.n33,m=a.n34,n=a.n41,p=a.n42,o=a.n43,q=a.n44;this.n11=h*m*p-l*k*p+l*j*o-g*m*o-h*j*q+g*k*q;this.n12=e*k*p-d*m*p-e*j*o+c*m*o+d*j*q-c*k*q;this.n13=d*l*p-e*h*p+e*g*o-c*l*o-d*g*q+c*h*q;this.n14=e*h*j-d*l*j-e*g*k+c*l*k+d*g*m-c*h*m;this.n21=l*k*n-h*m*n-l*i*o+f*m*o+h*i*q-f*k*q;this.n22=d*m*n-e*k*n+
+e*i*o-b*m*o-d*i*q+b*k*q;this.n23=e*h*n-d*l*n-e*f*o+b*l*o+d*f*q-b*h*q;this.n24=d*l*i-e*h*i+e*f*k-b*l*k-d*f*m+b*h*m;this.n31=g*m*n-l*j*n+l*i*p-f*m*p-g*i*q+f*j*q;this.n32=e*j*n-c*m*n-e*i*p+b*m*p+c*i*q-b*j*q;this.n33=c*l*n-e*g*n+e*f*p-b*l*p-c*f*q+b*g*q;this.n34=e*g*i-c*l*i-e*f*j+b*l*j+c*f*m-b*g*m;this.n41=h*j*n-g*k*n-h*i*p+f*k*p+g*i*o-f*j*o;this.n42=c*k*n-d*j*n+d*i*p-b*k*p-c*i*o+b*j*o;this.n43=d*g*n-c*h*n-d*f*p+b*h*p+c*f*o-b*g*o;this.n44=c*h*i-d*g*i+d*f*j-b*h*j-c*f*k+b*g*k;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 l=g*h,i=g*e,j=d*h,k=d*e;this.n11=l+k*c;this.n12=j*c-i;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=i*c-j;this.n32=k+l*c;this.n33=f*g;break;case "ZXY":l=g*h;i=g*e;j=d*h;k=d*e;this.n11=l-k*c;this.n12=-f*e;this.n13=j+i*c;this.n21=i+j*c;this.n22=f*h;this.n23=k-l*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":l=
+f*h;i=f*e;j=c*h;k=c*e;this.n11=g*h;this.n12=j*d-i;this.n13=l*d+k;this.n21=g*e;this.n22=k*d+l;this.n23=i*d-j;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":l=f*g;i=f*d;j=c*g;k=c*d;this.n11=g*h;this.n12=k-l*e;this.n13=j*e+i;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=i*e+j;this.n33=l-k*e;break;case "XZY":l=f*g;i=f*d;j=c*g;k=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=l*e+k;this.n22=f*h;this.n23=i*e-j;this.n31=j*e-i;this.n32=c*h;this.n33=k*e+l;break;default:l=f*h,i=f*
+e,j=c*h,k=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=i+j*d,this.n22=l-k*d,this.n23=-c*g,this.n31=k-l*d,this.n32=j+i*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,l=b*g;b*=h;var i=c*g;c*=h;d*=h;f*=e;g*=e;e*=h;this.n11=1-(i+d);this.n12=l-e;this.n13=b+g;this.n21=l+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+i);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,k=-a.n32*a.n11+a.n31*a.n12,m=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*m;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*k;c[6]=a*m;c[7]=a*j;c[8]=a*i;return b};
+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},rotateByAxis:function(a,b){if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);else if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);else if(a.x===0&&a.y===
+0&&a.z===1)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e);c/=f;d/=f;e/=f;var f=c*c,g=d*d,h=e*e,l=Math.cos(b),i=Math.sin(b),j=1-l,k=c*d*j,m=c*e*j;j*=d*e;c*=i;var n=d*i;i*=e;e=f+(1-f)*l;f=k+i;d=m-n;k-=i;g+=(1-g)*l;i=j+c;m+=n;j-=c;h+=(1-h)*l;var l=this.n11,c=this.n21,n=this.n31,p=this.n41,o=this.n12,q=this.n22,D=this.n32,t=this.n42,C=this.n13,E=this.n23,r=this.n33,z=this.n43;this.n11=e*l+f*o+d*C;this.n21=e*c+f*q+d*E;this.n31=e*n+f*D+d*r;this.n41=e*p+f*t+d*z;this.n12=k*l+g*o+i*
+C;this.n22=k*c+g*q+i*E;this.n32=k*n+g*D+i*r;this.n42=k*p+g*t+i*z;this.n13=m*l+j*o+h*C;this.n23=m*c+j*q+h*E;this.n33=m*n+j*D+h*r;this.n43=m*p+j*t+h*z;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,l=this.n43,i=Math.cos(a),a=Math.sin(a);this.n12=i*b+a*f;this.n22=i*c+a*g;this.n32=i*d+a*h;this.n42=i*e+a*l;this.n13=i*f-a*b;this.n23=i*g-a*c;this.n33=i*h-a*d;this.n43=i*l-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,
+e=this.n41,f=this.n13,g=this.n23,h=this.n33,l=this.n43,i=Math.cos(a),a=Math.sin(a);this.n11=i*b-a*f;this.n21=i*c-a*g;this.n31=i*d-a*h;this.n41=i*e-a*l;this.n13=i*f+a*b;this.n23=i*g+a*c;this.n33=i*h+a*d;this.n43=i*l+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,l=this.n42,i=Math.cos(a),a=Math.sin(a);this.n11=i*b+a*f;this.n21=i*c+a*g;this.n31=i*d+a*h;this.n41=i*e+a*l;this.n12=i*f-a*b;this.n22=i*g-a*c;this.n32=i*h-a*d;this.n42=i*
+l-a*e;return this},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;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,l=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,j=-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*i;if(a===0)return null;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*l;c[6]=a*i;c[7]=a*j;c[8]=a*k;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,k,m;g=new THREE.Matrix4;h=b-a;k=c-d;m=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/k;g.n23=0;g.n24=-((c+d)/k);g.n31=0;g.n32=0;g.n33=-2/m;g.n34=-((f+e)/m);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,h,l,i;g=new THREE.Matrix4;h=b-a;l=c-d;i=f-e;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/i;g.n34=-((f+e)/i);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=m[k]=m[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=[],h,k,m=[],
-j,i,l=[],n,p=[],o,r,I=[],u,D,J=[],s={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,t=new THREE.Vector4,w=new THREE.Matrix4,O=new THREE.Matrix4,z=[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){z[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);z[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);z[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);z[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);z[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);z[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=z[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);w.multiply(b.projectionMatrix,b.matrixWorldInverse);w.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-w.multiply(b.matrixWorld,b.projectionMatrixInverse);w.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=z[h].x*d.n14+z[h].y*d.n24+z[h].z*d.n34+z[h].w,c<=f){c=!1;break a}c=!0}c?(w.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,s.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(w.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.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,z=e.far,A,L,y,F,q,B,x,C,v,N,Q,T,W,U,V,R;D=r=n=i=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);w.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(w);s=this.projectGraph(a,!1);a=0;for(A=s.objects.length;a<A;a++)if(v=s.objects[a].object,N=v.matrixWorld,T=
-v.material,k=0,v instanceof THREE.Mesh){Q=v.geometry;W=v.geometry.materials;F=Q.vertices;U=Q.faces;V=Q.faceVertexUvs;Q=v.matrixRotationWorld.extractRotation(N);L=0;for(y=F.length;L<y;L++)h=b(),h.positionWorld.copy(F[L].position),N.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),w.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<z;F=0;for(L=U.length;F<L;F++){y=U[F];
-if(y instanceof THREE.Face3)if(q=m[y.a],B=m[y.b],x=m[y.c],q.visible&&B.visible&&x.visible&&(v.doubleSided||v.flipSided!=(x.positionScreen.x-q.positionScreen.x)*(B.positionScreen.y-q.positionScreen.y)-(x.positionScreen.y-q.positionScreen.y)*(B.positionScreen.x-q.positionScreen.x)<0))C=l[i]=l[i]||new THREE.RenderableFace3,i++,j=C,j.v1.copy(q),j.v2.copy(B),j.v3.copy(x);else continue;else if(y instanceof THREE.Face4)if(q=m[y.a],B=m[y.b],x=m[y.c],C=m[y.d],q.visible&&B.visible&&x.visible&&C.visible&&(v.doubleSided||
-v.flipSided!=((C.positionScreen.x-q.positionScreen.x)*(B.positionScreen.y-q.positionScreen.y)-(C.positionScreen.y-q.positionScreen.y)*(B.positionScreen.x-q.positionScreen.x)<0||(B.positionScreen.x-x.positionScreen.x)*(C.positionScreen.y-x.positionScreen.y)-(B.positionScreen.y-x.positionScreen.y)*(C.positionScreen.x-x.positionScreen.x)<0)))R=p[n]=p[n]||new THREE.RenderableFace4,n++,j=R,j.v1.copy(q),j.v2.copy(B),j.v3.copy(x),j.v4.copy(C);else continue;j.normalWorld.copy(y.normal);Q.multiplyVector3(j.normalWorld);
-j.centroidWorld.copy(y.centroid);N.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);w.multiplyVector3(j.centroidScreen);x=y.vertexNormals;q=0;for(B=x.length;q<B;q++)C=j.vertexNormalsWorld[q],C.copy(x[q]),Q.multiplyVector3(C);q=0;for(B=V.length;q<B;q++)if(R=V[q][F]){x=0;for(C=R.length;x<C;x++)j.uvs[q][x]=R[x]}j.material=T;j.faceMaterial=y.materialIndex!==null?W[y.materialIndex]:null;j.z=j.centroidScreen.z;s.elements.push(j)}}else if(v instanceof THREE.Line){O.multiply(w,N);F=
-v.geometry.vertices;q=b();q.positionScreen.copy(F[0].position);O.multiplyVector4(q.positionScreen);L=1;for(y=F.length;L<y;L++)if(q=b(),q.positionScreen.copy(F[L].position),O.multiplyVector4(q.positionScreen),B=m[k-2],G.copy(q.positionScreen),H.copy(B.positionScreen),d(G,H))G.multiplyScalar(1/G.w),H.multiplyScalar(1/H.w),v=I[r]=I[r]||new THREE.RenderableLine,r++,o=v,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(A=s.sprites.length;a<
-A;a++)if(v=s.sprites[a].object,N=v.matrixWorld,v instanceof THREE.Particle&&(t.set(N.n14,N.n24,N.n34,1),w.multiplyVector4(t),t.z/=t.w,t.z>0&&t.z<1))g=J[D]=J[D]||new THREE.RenderableParticle,D++,u=g,u.x=t.x/t.w,u.y=t.y/t.w,u.z=t.z,u.rotation=v.rotation.z,u.scale.x=v.scale.x*Math.abs(u.x-(t.x+e.projectionMatrix.n11)/(t.w+e.projectionMatrix.n14)),u.scale.y=v.scale.y*Math.abs(u.y-(t.y+e.projectionMatrix.n22)/(t.w+e.projectionMatrix.n24)),u.material=v.material,s.elements.push(u);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.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=i[l]=i[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 e,f,g=[],h,l,i=[],
+j,k,m=[],n,p=[],o,q,D=[],t,C,E=[],r={objects:[],sprites:[],lights:[],elements:[]},z=new THREE.Vector3,u=new THREE.Vector4,x=new THREE.Matrix4,N=new THREE.Matrix4,w=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,J=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);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){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?(x.multiplyVector3(z.copy(b.position)),e=a(),e.object=b,e.z=z.z,r.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(x.multiplyVector3(z.copy(b.position)),e=a(),e.object=b,e.z=z.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,z=e.far,w,K,A,H,s,B,y,F,v,M,P,T,W,U,V,Q;C=q=n=k=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);x.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(x);r=this.projectGraph(a,!1);a=0;for(w=r.objects.length;a<w;a++)if(v=r.objects[a].object,M=v.matrixWorld,T=
+v.material,l=0,v instanceof THREE.Mesh){P=v.geometry;W=v.geometry.materials;H=P.vertices;U=P.faces;V=P.faceVertexUvs;P=v.matrixRotationWorld.extractRotation(M);K=0;for(A=H.length;K<A;K++)h=b(),h.positionWorld.copy(H[K].position),M.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<z;H=0;for(K=U.length;H<K;H++){A=U[H];
+if(A instanceof THREE.Face3)if(s=i[A.a],B=i[A.b],y=i[A.c],s.visible&&B.visible&&y.visible&&(v.doubleSided||v.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))F=m[k]=m[k]||new THREE.RenderableFace3,k++,j=F,j.v1.copy(s),j.v2.copy(B),j.v3.copy(y);else continue;else if(A instanceof THREE.Face4)if(s=i[A.a],B=i[A.b],y=i[A.c],F=i[A.d],s.visible&&B.visible&&y.visible&&F.visible&&(v.doubleSided||
+v.flipSided!=((F.positionScreen.x-s.positionScreen.x)*(B.positionScreen.y-s.positionScreen.y)-(F.positionScreen.y-s.positionScreen.y)*(B.positionScreen.x-s.positionScreen.x)<0||(B.positionScreen.x-y.positionScreen.x)*(F.positionScreen.y-y.positionScreen.y)-(B.positionScreen.y-y.positionScreen.y)*(F.positionScreen.x-y.positionScreen.x)<0)))Q=p[n]=p[n]||new THREE.RenderableFace4,n++,j=Q,j.v1.copy(s),j.v2.copy(B),j.v3.copy(y),j.v4.copy(F);else continue;j.normalWorld.copy(A.normal);P.multiplyVector3(j.normalWorld);
+j.centroidWorld.copy(A.centroid);M.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);x.multiplyVector3(j.centroidScreen);y=A.vertexNormals;s=0;for(B=y.length;s<B;s++)F=j.vertexNormalsWorld[s],F.copy(y[s]),P.multiplyVector3(F);s=0;for(B=V.length;s<B;s++)if(Q=V[s][H]){y=0;for(F=Q.length;y<F;y++)j.uvs[s][y]=Q[y]}j.material=T;j.faceMaterial=A.materialIndex!==null?W[A.materialIndex]:null;j.z=j.centroidScreen.z;r.elements.push(j)}}else if(v instanceof THREE.Line){N.multiply(x,M);H=
+v.geometry.vertices;s=b();s.positionScreen.copy(H[0].position);N.multiplyVector4(s.positionScreen);K=1;for(A=H.length;K<A;K++)if(s=b(),s.positionScreen.copy(H[K].position),N.multiplyVector4(s.positionScreen),B=i[l-2],I.copy(s.positionScreen),J.copy(B.positionScreen),d(I,J))I.multiplyScalar(1/I.w),J.multiplyScalar(1/J.w),v=D[q]=D[q]||new THREE.RenderableLine,q++,o=v,o.v1.positionScreen.copy(I),o.v2.positionScreen.copy(J),o.z=Math.max(I.z,J.z),o.material=T,r.elements.push(o)}a=0;for(w=r.sprites.length;a<
+w;a++)if(v=r.sprites[a].object,M=v.matrixWorld,v instanceof THREE.Particle&&(u.set(M.n14,M.n24,M.n34,1),x.multiplyVector4(u),u.z/=u.w,u.z>0&&u.z<1))g=E[C]=E[C]||new THREE.RenderableParticle,C++,t=g,t.x=u.x/u.w,t.y=u.y/u.w,t.z=u.z,t.rotation=v.rotation.z,t.scale.x=v.scale.x*Math.abs(t.x-(u.x+e.projectionMatrix.n11)/(u.w+e.projectionMatrix.n14)),t.scale.y=v.scale.y*Math.abs(t.y-(u.y+e.projectionMatrix.n22)/(u.w+e.projectionMatrix.n24)),t.material=v.material,r.elements.push(t);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);
 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,k=this.w,m=k*c+g*e-h*d,j=k*d+h*c-f*e,i=k*e+f*d-g*c,c=-f*
-c-g*d-h*e;b.x=m*k+c*-f+j*-h-i*-g;b.y=j*k+c*-g+i*-f-m*-h;b.z=i*k+c*-h+m*-g-j*-f;return 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,l=this.w,i=l*c+g*e-h*d,j=l*d+h*c-f*e,k=l*e+f*d-g*c,c=-f*
+c-g*d-h*e;b.x=i*l+c*-f+j*-h-k*-g;b.y=j*l+c*-g+k*-f-i*-h;b.z=k*l+c*-h+i*-g-j*-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 +94,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 k,m,j,i,l,n,p,o;a=b.projectScene(c,d);k=0;for(m=a.length;k<m;k++)if(l=a[k],l instanceof THREE.RenderableParticle){p=l.x*e+e;o=l.y*f+f;j=0;for(i=l.material.length;j<i;j++)if(n=l.material[j],n instanceof THREE.ParticleDOMMaterial)n=n.domElement,n.style.left=p+"px",n.style.top=o+"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 l,i,j,k,m,n,p,o;a=b.projectScene(c,d);l=0;for(i=a.length;l<i;l++)if(m=a[l],m instanceof THREE.RenderableParticle){p=m.x*e+e;o=m.y*f+f;j=0;for(k=m.material.length;j<k;j++)if(n=m.material[j],n instanceof THREE.ParticleDOMMaterial)n=n.domElement,n.style.left=p+"px",n.style.top=o+"px"}}};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};

+ 190 - 180
build/custom/ThreeExtras.js

@@ -1,18 +1,18 @@
-// ThreeExtras.js r46 - http://github.com/mrdoob/three.js
+// ThreeExtras.js r47dev - http://github.com/mrdoob/three.js
 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,f=Math.max(Math.max(b,d),g),e=Math.min(Math.min(b,d),g);if(e===f)e=b=0;else{var h=f-e,e=h/f,b=b===f?(d-g)/h:d===f?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=e;c.v=f;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,f=c instanceof THREE.Mesh?c.geometry:c,e=a.vertices,h=f.vertices,i=a.faces,k=f.faces,j=a.faceVertexUvs[0],q=f.faceVertexUvs[0],o={},n=0;n<a.materials.length;n++)o[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,s=h.length;n<s;n++){var m=new THREE.Vertex(h[n].position.clone());b&&b.multiplyVector3(m.position);e.push(m)}n=
-0;for(s=k.length;n<s;n++){var e=k[n],p,l,r=e.vertexNormals,t=e.vertexColors;e instanceof THREE.Face3?p=new THREE.Face3(e.a+g,e.b+g,e.c+g):e instanceof THREE.Face4&&(p=new THREE.Face4(e.a+g,e.b+g,e.c+g,e.d+g));p.normal.copy(e.normal);d&&d.multiplyVector3(p.normal);h=0;for(m=r.length;h<m;h++)l=r[h].clone(),d&&d.multiplyVector3(l),p.vertexNormals.push(l);p.color.copy(e.color);h=0;for(m=t.length;h<m;h++)l=t[h],p.vertexColors.push(l.clone());if(e.materialIndex!==void 0){h=f.materials[e.materialIndex];
-m=o[h.id];if(m===void 0)m=a.materials.length,a.materials.push(h);p.materialIndex=m}p.centroid.copy(e.centroid);b&&b.multiplyVector3(p.centroid);i.push(p)}n=0;for(s=q.length;n<s;n++){b=q[n];d=[];h=0;for(m=b.length;h<m;h++)d.push(new THREE.UV(b[h].u,b[h].v));j.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,f=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var e=new THREE.Vertex(d[a].position.clone());c.vertices.push(e)}a=0;
-for(b=g.length;a<b;a++){var h=g[a],i,k,j=h.vertexNormals,q=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(e=j.length;d<e;d++)k=j[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(e=q.length;d<e;d++)k=q[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=f.length;a<b;a++){g=f[a];i=[];d=0;for(e=g.length;d<
+THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,f=c instanceof THREE.Mesh?c.geometry:c,e=a.vertices,h=f.vertices,i=a.faces,k=f.faces,j=a.faceVertexUvs[0],r=f.faceVertexUvs[0],m={},o=0;o<a.materials.length;o++)m[a.materials[o].id]=o;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var o=0,s=h.length;o<s;o++){var n=new THREE.Vertex(h[o].position.clone());b&&b.multiplyVector3(n.position);e.push(n)}o=
+0;for(s=k.length;o<s;o++){var e=k[o],p,l,q=e.vertexNormals,t=e.vertexColors;e instanceof THREE.Face3?p=new THREE.Face3(e.a+g,e.b+g,e.c+g):e instanceof THREE.Face4&&(p=new THREE.Face4(e.a+g,e.b+g,e.c+g,e.d+g));p.normal.copy(e.normal);d&&d.multiplyVector3(p.normal);h=0;for(n=q.length;h<n;h++)l=q[h].clone(),d&&d.multiplyVector3(l),p.vertexNormals.push(l);p.color.copy(e.color);h=0;for(n=t.length;h<n;h++)l=t[h],p.vertexColors.push(l.clone());if(e.materialIndex!==void 0){h=f.materials[e.materialIndex];
+n=m[h.id];if(n===void 0)n=a.materials.length,a.materials.push(h);p.materialIndex=n}p.centroid.copy(e.centroid);b&&b.multiplyVector3(p.centroid);i.push(p)}o=0;for(s=r.length;o<s;o++){b=r[o];d=[];h=0;for(n=b.length;h<n;h++)d.push(new THREE.UV(b[h].u,b[h].v));j.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,f=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var e=new THREE.Vertex(d[a].position.clone());c.vertices.push(e)}a=0;
+for(b=g.length;a<b;a++){var h=g[a],i,k,j=h.vertexNormals,r=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(e=j.length;d<e;d++)k=j[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(e=r.length;d<e;d++)k=r[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=f.length;a<b;a++){g=f[a];i=[];d=0;for(e=g.length;d<
 e;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,f,e=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();d+g>1&&(d=1-d,g=1-g);f=1-d-g;e.copy(a);e.multiplyScalar(d);h.copy(c);h.multiplyScalar(g);e.addSelf(h);h.copy(b);h.multiplyScalar(f);e.addSelf(h);return e},randomPointInFace:function(a,c,b){var d,g,f;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,g=c.vertices[a.b].position,
 f=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,g,f);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;g=c.vertices[a.b].position;f=c.vertices[a.c].position;var c=c.vertices[a.d].position,e;b?a._area1&&a._area2?(b=a._area1,e=a._area2):(b=THREE.GeometryUtils.triangleArea(d,g,c),e=THREE.GeometryUtils.triangleArea(g,f,c),a._area1=b,a._area2=e):(b=THREE.GeometryUtils.triangleArea(d,g,c),e=THREE.GeometryUtils.triangleArea(g,f,c));return THREE.GeometryUtils.random()*(b+
-e)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,f,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(d,c){if(c<d)return d;var e=d+Math.floor((c-d)/2);return k[e]>a?b(d,e-1):k[e]<a?b(e+1,c):e}return b(0,k.length-1)}var d,g,f=a.faces,e=a.vertices,h=f.length,i=0,k=[],j,q,o,n;for(g=0;g<h;g++){d=f[g];if(d instanceof THREE.Face3)j=e[d.a].position,q=e[d.b].position,o=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,q,o);else if(d instanceof
-THREE.Face4)j=e[d.a].position,q=e[d.b].position,o=e[d.c].position,n=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,q,n),d._area2=THREE.GeometryUtils.triangleArea(q,o,n),d._area=d._area1+d._area2;i+=d._area;k[g]=i}d=[];e={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(f[h],a,!0),e[h]?e[h]+=1:e[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();
+e)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,f,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,f=a.faces,e=a.vertices,h=f.length,i=0,k=[],j,r,m,o;for(g=0;g<h;g++){d=f[g];if(d instanceof THREE.Face3)j=e[d.a].position,r=e[d.b].position,m=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,r,m);else if(d instanceof
+THREE.Face4)j=e[d.a].position,r=e[d.b].position,m=e[d.c].position,o=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,r,o),d._area2=THREE.GeometryUtils.triangleArea(r,m,o),d._area=d._area1+d._area2;i+=d._area;k[g]=i}d=[];e={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(f[h],a,!0),e[h]?e[h]+=1:e[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=[],f=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)f.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return f},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,f=document.createElement("canvas");f.width=d;f.height=g;var e=f.getContext("2d");e.drawImage(a,0,0);for(var h=e.getImageData(0,0,d,g).data,i=e.createImageData(d,g),k=i.data,j=0;j<d;j++)for(var q=1;q<g;q++){var o=q-1<0?g-1:q-1,n=(q+1)%g,s=j-1<0?d-1:j-1,m=(j+1)%d,p=[],l=[0,0,h[(q*d+j)*4]/255*c];p.push([-1,0,h[(q*d+s)*4]/255*c]);p.push([-1,-1,h[(o*d+s)*4]/255*c]);p.push([0,-1,h[(o*d+j)*4]/255*c]);p.push([1,-1,h[(o*d+m)*4]/255*c]);
-p.push([1,0,h[(q*d+m)*4]/255*c]);p.push([1,1,h[(n*d+m)*4]/255*c]);p.push([0,1,h[(n*d+j)*4]/255*c]);p.push([-1,1,h[(n*d+s)*4]/255*c]);o=[];s=p.length;for(n=0;n<s;n++){var m=p[n],r=p[(n+1)%s],m=[m[0]-l[0],m[1]-l[1],m[2]-l[2]],r=[r[0]-l[0],r[1]-l[1],r[2]-l[2]];o.push(b([m[1]*r[2]-m[2]*r[1],m[2]*r[0]-m[0]*r[2],m[0]*r[1]-m[1]*r[0]]))}p=[0,0,0];for(n=0;n<o.length;n++)p[0]+=o[n][0],p[1]+=o[n][1],p[2]+=o[n][2];p[0]/=o.length;p[1]/=o.length;p[2]/=o.length;l=(q*d+j)*4;k[l]=(p[0]+1)/2*255|0;k[l+1]=(p[1]+0.5)*
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,g=a.height,f=document.createElement("canvas");f.width=d;f.height=g;var e=f.getContext("2d");e.drawImage(a,0,0);for(var h=e.getImageData(0,0,d,g).data,i=e.createImageData(d,g),k=i.data,j=0;j<d;j++)for(var r=1;r<g;r++){var m=r-1<0?g-1:r-1,o=(r+1)%g,s=j-1<0?d-1:j-1,n=(j+1)%d,p=[],l=[0,0,h[(r*d+j)*4]/255*c];p.push([-1,0,h[(r*d+s)*4]/255*c]);p.push([-1,-1,h[(m*d+s)*4]/255*c]);p.push([0,-1,h[(m*d+j)*4]/255*c]);p.push([1,-1,h[(m*d+n)*4]/255*c]);
+p.push([1,0,h[(r*d+n)*4]/255*c]);p.push([1,1,h[(o*d+n)*4]/255*c]);p.push([0,1,h[(o*d+j)*4]/255*c]);p.push([-1,1,h[(o*d+s)*4]/255*c]);m=[];s=p.length;for(o=0;o<s;o++){var n=p[o],q=p[(o+1)%s],n=[n[0]-l[0],n[1]-l[1],n[2]-l[2]],q=[q[0]-l[0],q[1]-l[1],q[2]-l[2]];m.push(b([n[1]*q[2]-n[2]*q[1],n[2]*q[0]-n[0]*q[2],n[0]*q[1]-n[1]*q[0]]))}p=[0,0,0];for(o=0;o<m.length;o++)p[0]+=m[o][0],p[1]+=m[o][1],p[2]+=m[o][2];p[0]/=m.length;p[1]/=m.length;p[2]/=m.length;l=(r*d+j)*4;k[l]=(p[0]+1)/2*255|0;k[l+1]=(p[1]+0.5)*
 255|0;k[l+2]=p[2]*255|0;k[l+3]=255}e.putImageData(i,0,0);return f}};
 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 f=new THREE.Mesh(a,c[b]);g.add(f)}return g},cloneObject:function(a){var c;a instanceof THREE.MorphAnimMesh?(c=new THREE.MorphAnimMesh(a.geometry,a.material),
 c.duration=a.duration,c.mirroredLoop=a.mirroredLoop,c.time=a.time,c.lastKeyframe=a.lastKeyframe,c.currentKeyframe=a.currentKeyframe,c.direction=a.direction,c.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?c=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?c=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?c=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?c=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
@@ -58,44 +58,44 @@ THREE.Path.prototype.quadraticCurveTo=function(a,c,b,d){var g=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,c,b,d,g,f){var e=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,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e})};
 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,f){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,d,g,f));this.actions.push({action:THREE.PathActions.ARC,args:e})};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,f,e,h,i,k,j,q,o,n,s,m;d=0;for(g=this.actions.length;d<g;d++)switch(f=this.actions[d],e=f.action,f=f.args,e){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];q=f[0];o=f[1];b.length>0?(e=b[b.length-1],n=e.x,s=e.y):(e=this.actions[d-1].args,n=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,f=THREE.Shape.Utils.b2(m,n,q,h),m=THREE.Shape.Utils.b2(m,s,o,
-i),b.push(new THREE.Vector2(f,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];q=f[0];o=f[1];k=f[2];j=f[3];b.length>0?(e=b[b.length-1],n=e.x,s=e.y):(e=this.actions[d-1].args,n=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,f=THREE.Shape.Utils.b3(m,n,q,k,h),m=THREE.Shape.Utils.b3(m,s,o,j,i),b.push(new THREE.Vector2(f,m));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];m=a*f[0].length;e=e.concat(f[0]);f=new THREE.SplineCurve(e);
-for(e=1;e<=m;e++)b.push(f.getPointAt(e/m));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=f[0];i=f[1];k=f[2];q=f[3];m=f[4];o=!!f[5];j=e[e.length-2];n=e[e.length-1];e.length==0&&(j=n=0);s=m-q;var p=a*2;for(e=1;e<=p;e++)m=e/p,o||(m=1-m),m=q+m*s,f=j+h+k*Math.cos(m),m=n+i+k*Math.sin(m),b.push(new THREE.Vector2(f,m))}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,f){var e=this.getPoints(),h,i,k,j,q;h=0;for(i=e.length;h<i;h++)k=e[h],j=k.x,q=k.y,k.x=a*j+c*q+b,k.y=d*q+g*j+f;return e};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,g,f,e,h,i,k,j,r,m,o,s,n;d=0;for(g=this.actions.length;d<g;d++)switch(f=this.actions[d],e=f.action,f=f.args,e){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];r=f[0];m=f[1];b.length>0?(e=b[b.length-1],o=e.x,s=e.y):(e=this.actions[d-1].args,o=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)n=e/a,f=THREE.Shape.Utils.b2(n,o,r,h),n=THREE.Shape.Utils.b2(n,s,m,
+i),b.push(new THREE.Vector2(f,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];r=f[0];m=f[1];k=f[2];j=f[3];b.length>0?(e=b[b.length-1],o=e.x,s=e.y):(e=this.actions[d-1].args,o=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)n=e/a,f=THREE.Shape.Utils.b3(n,o,r,k,h),n=THREE.Shape.Utils.b3(n,s,m,j,i),b.push(new THREE.Vector2(f,n));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];n=a*f[0].length;e=e.concat(f[0]);f=new THREE.SplineCurve(e);
+for(e=1;e<=n;e++)b.push(f.getPointAt(e/n));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=f[0];i=f[1];k=f[2];r=f[3];n=f[4];m=!!f[5];j=e[e.length-2];o=e[e.length-1];e.length==0&&(j=o=0);s=n-r;var p=a*2;for(e=1;e<=p;e++)n=e/p,m||(n=1-n),n=r+n*s,f=j+h+k*Math.cos(n),n=o+i+k*Math.sin(n),b.push(new THREE.Vector2(f,n))}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,f){var e=this.getPoints(),h,i,k,j,r;h=0;for(i=e.length;h<i;h++)k=e[h],j=k.x,r=k.y,k.x=a*j+c*r+b,k.y=d*r+g*j+f;return e};
 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=[],f=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&&f.actions.length!=0&&(g.push(f),f=new THREE.Path),f[b].apply(f,d);f.actions.length!=0&&g.push(f);if(g.length==0)return[];var e,f=[];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())?(e&&f.push(e),e=new THREE.Shape,e.actions=d.actions,e.curves=
 d.curves):e.holes.push(d);f.push(e)}else{e=new THREE.Shape;a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e.actions=d.actions,e.curves=d.curves,f.push(e),e=new THREE.Shape):e.holes.push(d)}return f};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,f,e,h,i,k,j,q,o,n,s=[];for(i=0;i<c.length;i++){k=c[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(g=0;g<k.length;g++){o=k[g];n=[];for(q=0;q<b.length;q++)j=b[q],j=o.distanceToSquared(j),n.push(j),j<f&&(f=j,e=g,h=q)}g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:k.length-1;var m=[k[e],b[h],b[g]];q=THREE.FontUtils.Triangulate.area(m);var p=[k[e],k[f],b[h]];o=THREE.FontUtils.Triangulate.area(p);n=h;j=e;h+=1;e+=-1;h<
-0&&(h+=b.length);h%=b.length;e<0&&(e+=k.length);e%=k.length;g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:k.length-1;m=[k[e],b[h],b[g]];m=THREE.FontUtils.Triangulate.area(m);p=[k[e],k[f],b[h]];p=THREE.FontUtils.Triangulate.area(p);q+o>m+p&&(h=n,e=j,h<0&&(h+=b.length),h%=b.length,e<0&&(e+=k.length),e%=k.length,g=h-1>=0?h-1:b.length-1,f=e-1>=0?e-1:k.length-1);q=b.slice(0,h);o=b.slice(h);n=k.slice(e);j=k.slice(0,e);f=[k[e],k[f],b[h]];s.push([k[e],b[h],b[g]]);s.push(f);b=q.concat(n).concat(j).concat(o)}return{shape:b,
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),g,f,e,h,i,k,j,r,m,o,s=[];for(i=0;i<c.length;i++){k=c[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(g=0;g<k.length;g++){m=k[g];o=[];for(r=0;r<b.length;r++)j=b[r],j=m.distanceToSquared(j),o.push(j),j<f&&(f=j,e=g,h=r)}g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:k.length-1;var n=[k[e],b[h],b[g]];r=THREE.FontUtils.Triangulate.area(n);var p=[k[e],k[f],b[h]];m=THREE.FontUtils.Triangulate.area(p);o=h;j=e;h+=1;e+=-1;h<
+0&&(h+=b.length);h%=b.length;e<0&&(e+=k.length);e%=k.length;g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:k.length-1;n=[k[e],b[h],b[g]];n=THREE.FontUtils.Triangulate.area(n);p=[k[e],k[f],b[h]];p=THREE.FontUtils.Triangulate.area(p);r+m>n+p&&(h=o,e=j,h<0&&(h+=b.length),h%=b.length,e<0&&(e+=k.length),e%=k.length,g=h-1>=0?h-1:b.length-1,f=e-1>=0?e-1:k.length-1);r=b.slice(0,h);m=b.slice(h);o=k.slice(e);j=k.slice(0,e);f=[k[e],k[f],b[h]];s.push([k[e],b[h],b[g]]);s.push(f);b=r.concat(o).concat(j).concat(m)}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),f,e,h,i,k={};f=0;for(e=d.length;f<e;f++)i=d[f].x+":"+d[f].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=f;f=0;for(e=b.length;f<e;f++){h=b[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}f=0;for(e=g.length;f<e;f++){h=g[f];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",f=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=f};
 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};
-THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var d=0;d<a.length;d++)a[d].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var d=0;d<a.hierarchy[b].keys.length;d++){if(a.hierarchy[b].keys[d].time<
-0)a.hierarchy[b].keys[d].time=0;if(a.hierarchy[b].keys[d].rot!==void 0&&!(a.hierarchy[b].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++){var k=a.hierarchy[b].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[b].usedMorphTargets=h;for(d=0;d<a.hierarchy[b].keys.length;d++){var j=
-{};for(k in h){for(i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++)if(a.hierarchy[b].keys[d].morphTargets[i]===k){j[k]=a.hierarchy[b].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[b].keys[d].morphTargets.length&&(j[k]=0)}a.hierarchy[b].keys[d].morphTargetsInfluences=j}}for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].time===a.hierarchy[b].keys[d-1].time&&(a.hierarchy[b].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].index=d}d=parseInt(a.length*
-a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
-2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,d=this.hierarchy.length,g;for(b=0;b<d;b++){g=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
-THREE.Bone?g.skinMatrix:g.matrix;var f=g.animationCache.prevKey;g=g.animationCache.nextKey;f.pos=this.data.hierarchy[b].keys[0];f.rot=this.data.hierarchy[b].keys[0];f.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.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var d=0;d<a.hierarchy[b].keys.length;d++){if(a.hierarchy[b].keys[d].time<
+0)a.hierarchy[b].keys[d].time=0;if(a.hierarchy[b].keys[d].rot!==void 0&&!(a.hierarchy[b].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[b].keys.length&&a.hierarchy[b].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++){var k=a.hierarchy[b].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[b].usedMorphTargets=
+h;for(d=0;d<a.hierarchy[b].keys.length;d++){var j={};for(k in h){for(i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++)if(a.hierarchy[b].keys[d].morphTargets[i]===k){j[k]=a.hierarchy[b].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[b].keys[d].morphTargets.length&&(j[k]=0)}a.hierarchy[b].keys[d].morphTargetsInfluences=j}}for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].time===a.hierarchy[b].keys[d-1].time&&(a.hierarchy[b].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].index=
+d}d=parseInt(a.length*a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};b.LINEAR=
+0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();
+THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3;a=0;for(c=this.hierarchy.length;a<c;a++)if(b=this.data.hierarchy[a].sids,d=this.hierarchy[a],this.data.hierarchy[a].keys.length){for(var g=0;g<
+b.length;g++){var f=b[g],e=this.getNextKeyWith(f,a,0);e&&e.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}};
+THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;this.startTimeMs=c;this.startTime=1E7;this.endTime=-this.startTime;var b,d=this.hierarchy.length,g,f;for(b=0;b<d;b++){g=this.hierarchy[b];f=this.data.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;if(f.animationCache===void 0)f.animationCache={},f.animationCache.prevKey=null,f.animationCache.nextKey=null,
+f.animationCache.originalMatrix=g instanceof THREE.Bone?g.skinMatrix:g.matrix;g=this.data.hierarchy[b].keys;if(g.length)f.animationCache.prevKey=g[0],f.animationCache.nextKey=g[1],this.startTime=Math.min(g[0].time,this.startTime),this.endTime=Math.max(g[g.length-1].time,this.endTime)}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,f,e,h,i,k,j=this.data.JIT.hierarchy,q,o;this.currentTime+=a*this.timeScale;o=this.currentTime;q=this.currentTime%=this.data.length;k=parseInt(Math.min(q*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,s=this.hierarchy.length;n<s;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&j[n][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=j[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 m=0;m<3;m++){b=c[m];e=i.prevKey[b];h=i.nextKey[b];if(h.time<=o){if(q<o)if(this.loop){e=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<q;)e=h,h=this.getNextKeyWith(b,n,h.index+1)}else{this.stop();return}else{do e=h,h=this.getNextKeyWith(b,n,h.index+1);while(h.time<
-q)}i.prevKey[b]=e;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(q-e.time)/(h.time-e.time);g=e[b];f=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]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[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,e.index-1).pos,this.points[1]=g,this.points[2]=f,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,f,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d}}if(this.JITCompile&&j[0][k]===void 0){this.hierarchy[0].update(null,!0);for(n=0;n<this.hierarchy.length;n++)j[n][k]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],g,f,e,h,i,k;g=(a.length-1)*c;f=Math.floor(g);g-=f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];h=a[b[1]];i=a[b[2]];k=a[b[3]];b=g*g;e=g*b;d[0]=this.interpolate(f[0],h[0],i[0],k[0],g,b,e);d[1]=this.interpolate(f[1],h[1],i[1],k[1],g,b,e);d[2]=this.interpolate(f[2],h[2],i[2],k[2],g,b,e);return d};
-THREE.Animation.prototype.interpolate=function(a,c,b,d,g,f,e){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*e+(-3*(c-b)-2*a-d)*f+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]};
+THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++){var c=this.hierarchy[a];if(c.animationCache!==void 0){var b=c.animationCache.originalMatrix;c instanceof THREE.Bone?(b.copy(c.skinMatrix),c.skinMatrix=b):(b.copy(c.matrix),c.matrix=b);delete c.animationCache}}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c,b,d,g,f=this.data.JIT.hierarchy,e,h,i;this.currentTime+=a*this.timeScale;h=this.currentTime;e=this.currentTime%=this.data.length;if(e<this.startTimeMs)e=this.currentTime=this.startTimeMs+e;g=parseInt(Math.min(e*this.data.fps,this.data.length*this.data.fps),10);if((i=e<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var j=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=j.length-1;g=this.hierarchy[a];if(j.length){for(j=
+0;j<f.length;j++)e=f[j],(h=this.getPrevKeyWith(e,a,d))&&h.apply(e);this.data.hierarchy[a].node.updateMatrix();g.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(e<this.startTime)){a=0;for(k=this.hierarchy.length;a<k;a++){d=this.hierarchy[a];c=this.data.hierarchy[a];var j=c.keys,r=c.animationCache;if(this.JITCompile&&f[a][g]!==void 0)d instanceof THREE.Bone?(d.skinMatrix=f[a][g],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][g],d.matrixWorldNeedsUpdate=!0);else if(j.length){if(this.JITCompile&&r)d instanceof
+THREE.Bone?d.skinMatrix=r.originalMatrix:d.matrix=r.originalMatrix;c=r.prevKey;b=r.nextKey;if(c&&b){if(b.time<=h){if(i&&this.loop){c=j[0];for(b=j[1];b.time<e;)c=b,b=j[c.index+1]}else if(!i)for(var m=j.length-1;b.time<e&&b.index!==m;)c=b,b=j[c.index+1];r.prevKey=c;r.nextKey=b}c.interpolate(b,e)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&f[0][g]===void 0){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][g]=this.hierarchy[a]instanceof
+THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],g,f,e,h,i,k;g=(a.length-1)*c;f=Math.floor(g);g-=f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];h=a[b[1]];i=a[b[2]];k=a[b[3]];b=g*g;e=g*b;d[0]=this.interpolate(f[0],h[0],i[0],k[0],g,b,e);d[1]=this.interpolate(f[1],h[1],i[1],k[1],g,b,e);d[2]=this.interpolate(f[2],h[2],i[2],k[2],g,b,e);return d};
+THREE.Animation.prototype.interpolate=function(a,c,b,d,g,f,e){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*e+(-3*(c-b)-2*a-d)*f+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){c=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<c.length-1?b:c.length-1:b%=c.length;b<c.length;b++)if(c[b].hasTarget(a))return c[b];return c[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){c=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+c.length;b>=0;b--)if(c[b].hasTarget(a))return c[b];return c[c.length-1]};
 THREE.CubeCamera=function(a,c,b,d){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
 this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
 new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(d,d,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
-1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var d=this.renderTarget;d.activeCubeFace=0;a.render(b,this.cameraPX,d);d.activeCubeFace=1;a.render(b,this.cameraNX,d);d.activeCubeFace=2;a.render(b,this.cameraPY,d);d.activeCubeFace=3;a.render(b,
-this.cameraNY,d);d.activeCubeFace=4;a.render(b,this.cameraPZ,d);d.activeCubeFace=5;a.render(b,this.cameraNZ,d)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
+1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var c=this.renderTarget;c.activeCubeFace=0;a.render(b,this.cameraPX,c);c.activeCubeFace=1;a.render(b,this.cameraNX,c);c.activeCubeFace=2;a.render(b,this.cameraPY,c);c.activeCubeFace=3;a.render(b,
+this.cameraNY,c);c.activeCubeFace=4;a.render(b,this.cameraPZ,c);c.activeCubeFace=5;a.render(b,this.cameraNZ,c)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
 THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,c,b,d,g,f,e){THREE.Camera.call(this);this.fov=b;this.left=-a/2;this.right=a/2;this.top=c/2;this.bottom=-c/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,c/2,c/-2,f,e);this.cameraP=new THREE.PerspectiveCamera(b,a/c,d,g);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
 THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPersepectiveMode=!0;this.inOrthographicMode=!1};
 THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov/2)*((this.cameraP.near+this.cameraP.far)/2),c=2*a*this.cameraP.aspect/2;a/=this.zoom;c/=this.zoom;this.cameraO.left=-c;this.cameraO.right=c;this.cameraO.top=a;this.cameraO.bottom=-a;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0};
@@ -110,14 +110,14 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.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*c;this.lookVertical&&(this.lat-=this.mouseY*c*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;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.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,d,c){var e={name:d,fps:0.6,length:c,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),p=g.length,l=0;f=p-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:c,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<p-1;f++)l=c*h.chunks[f]/h.total,b.keys[f]={time:l,pos:g[f]};e.hierarchy[0]=
-b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,d,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var d,c,e=new THREE.Geometry;for(d=0;d<a.points.length*b;d++)c=d/(a.points.length*b),c=a.getPoint(c),e.vertices[d]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.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=
+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(),p=g.length,l=0;f=p-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<p-1;f++)l=d*h.chunks[f]/h.total,b.keys[f]={time:l,pos:g[f]};e.hierarchy[0]=
+b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(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 e=Math.PI*2,h=Math.PI/180;this.update=function(a){var d;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%e;this.phi=a>=0?a:a+e;d=this.verticalAngleMap.srcRange;
-a=this.verticalAngleMap.dstRange;d=THREE.Math.mapLinear(this.phi,d[0],d[1],a[0],a[1]);var c=a[1]-a[0];this.phi=b((d-a[0])/c)*c+a[0];d=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;d=THREE.Math.mapLinear(this.theta,d[0],d[1],a[0],a[1]);c=a[1]-a[0];this.theta=b((d-a[0])/c)*c+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=
+this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var e=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%e;this.phi=a>=0?a:a+e;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),e=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(e,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,e=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),e=new THREE.Line(e,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));e.scale.set(1,1,1);a.add(e);c.scale.set(1,1,1);a.add(c);for(var e=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),n=0;n<b.points.length;n++)c=new THREE.Mesh(e,h),c.position.copy(b.points[n]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
+this.debugPath,b=this.spline,e=f(b,10),c=f(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),e=new THREE.Line(e,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));e.scale.set(1,1,1);a.add(e);c.scale.set(1,1,1);a.add(c);for(var e=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),o=0;o<b.points.length;o++)c=new THREE.Mesh(e,h),c.position.copy(b.points[o]),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=
@@ -128,38 +128,38 @@ 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,f=new THREE.Matrix4,e=!1,h=1,i=0,k=0,j=0,q=0,o=0,n=window.innerWidth/2,s=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
-this.rotateHorizontally(c*q);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*j);e&&(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,f=new THREE.Matrix4,e=!1,h=1,i=0,k=0,j=0,r=0,m=0,o=window.innerWidth/2,s=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
+this.rotateHorizontally(c*r);this.rotateVertically(c*m)}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*j);e&&(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;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);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){q=(a.clientX-n)/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){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){r=(a.clientX-o)/window.innerWidth;m=(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:e=!0;h=1;break;case 69:e=!0;h=-1;break;case 82:j=1;break;case 70:j=-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:e=!1;break;case 69:e=!1;break;case 82:j=0;break;case 70:j=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=this.noRotate=!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,f=d.NONE,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,q=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-
+this.target=new THREE.Vector3(0,0,0);var g=!1,f=d.NONE,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,r=new THREE.Vector2,m=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),f=d.length();f>1?d.normalize():d.z=Math.sqrt(1-f*f);e.copy(b.object.position).subSelf(b.target);f=b.object.up.clone().setLength(d.y);f.addSelf(b.object.up.clone().crossSelf(e).setLength(d.x));f.addSelf(e.setLength(d.z));return f};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(e);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+(j.y-k.y)*b.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),b.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(q);if(a.lengthSq()){a.multiplyScalar(e.length()*b.panSpeed);var c=e.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?q=o:q.addSelf(a.sub(o,q).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),e.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,e.setLength(b.minDistance))};this.update=function(){e.copy(b.object.position).subSelf(this.target);b.noRotate||b.rotateCamera();b.noZoom||b.zoomCamera();
-b.noPan||b.panCamera();b.object.position.add(b.target,e);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=j=b.getMouseOnScreen(a.clientX,a.clientY),q=o=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),f!==d.NONE&&(f===d.ROTATE&&!b.noRotate?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&
-!b.noZoom?j=b.getMouseOnScreen(a.clientX,a.clientY):f===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(),f===d.NONE))f=a.button,f===d.ROTATE&&!b.noRotate?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?k=j=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(q=o=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
+-a);d.multiplyVector3(e);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+(j.y-k.y)*b.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),b.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=m.clone().subSelf(r);if(a.lengthSq()){a.multiplyScalar(e.length()*b.panSpeed);var c=e.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?r=m:r.addSelf(a.sub(m,r).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),e.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,e.setLength(b.minDistance))};this.update=function(){e.copy(b.object.position).subSelf(this.target);b.noRotate||b.rotateCamera();b.noZoom||b.zoomCamera();
+b.noPan||b.panCamera();b.object.position.add(b.target,e);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=j=b.getMouseOnScreen(a.clientX,a.clientY),r=m=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),f!==d.NONE&&(f===d.ROTATE&&!b.noRotate?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&
+!b.noZoom?j=b.getMouseOnScreen(a.clientX,a.clientY):f===d.PAN&&!b.noPan&&(m=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),f===d.NONE))f=a.button,f===d.ROTATE&&!b.noRotate?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?k=j=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(r=m=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
 function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),f=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&f===d.NONE){if(a.keyCode===b.keys[d.ROTATE]&&!b.noRotate)f=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)f=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)f=d.PAN;f!==d.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&f!==d.NONE)f=d.NONE},!1)};
-THREE.CubeGeometry=function(a,c,b,d,g,f,e,h){function i(a,b,c,e,h,i,j,n){var m,o=d||1,l=g||1,p=h/2,q=i/2,s=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",l=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")m="x",o=f||1;var r=o+1,t=l+1,L=h/o,H=i/l,M=new THREE.Vector3;M[m]=j>0?1:-1;for(h=0;h<t;h++)for(i=0;i<r;i++){var J=new THREE.Vector3;J[a]=(i*L-p)*c;J[b]=(h*H-q)*e;J[m]=j;k.vertices.push(new THREE.Vertex(J))}for(h=0;h<l;h++)for(i=0;i<o;i++)a=
-new THREE.Face4(i+r*h+s,i+r*(h+1)+s,i+1+r*(h+1)+s,i+1+r*h+s),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=n,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/o,h/l),new THREE.UV(i/o,(h+1)/l),new THREE.UV((i+1)/o,(h+1)/l),new THREE.UV((i+1)/o,h/l)])}THREE.Geometry.call(this);var k=this,j=a/2,q=c/2,o=b/2,n,s,m,p,l,r;if(e!==void 0){if(e instanceof Array)this.materials=e;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(e)}n=0;p=1;s=2;l=
-3;m=4;r=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var t in h)this.sides[t]!=void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,b,c,j,n);this.sides.nx&&i("z","y",1,-1,b,c,-j,p);this.sides.py&&i("x","z",1,1,a,b,q,s);this.sides.ny&&i("x","z",1,-1,a,b,-q,l);this.sides.pz&&i("x","y",1,-1,a,c,o,m);this.sides.nz&&i("x","y",-1,-1,a,c,-o,r);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,c,b,d,g,f,e,h){function i(a,b,c,e,h,i,j,o){var n,m=d||1,l=g||1,p=h/2,r=i/2,s=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",l=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",m=f||1;var q=m+1,t=l+1,M=h/m,H=i/l,N=new THREE.Vector3;N[n]=j>0?1:-1;for(h=0;h<t;h++)for(i=0;i<q;i++){var K=new THREE.Vector3;K[a]=(i*M-p)*c;K[b]=(h*H-r)*e;K[n]=j;k.vertices.push(new THREE.Vertex(K))}for(h=0;h<l;h++)for(i=0;i<m;i++)a=
+new THREE.Face4(i+q*h+s,i+q*(h+1)+s,i+1+q*(h+1)+s,i+1+q*h+s),a.normal.copy(N),a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone()),a.materialIndex=o,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/m,h/l),new THREE.UV(i/m,(h+1)/l),new THREE.UV((i+1)/m,(h+1)/l),new THREE.UV((i+1)/m,h/l)])}THREE.Geometry.call(this);var k=this,j=a/2,r=c/2,m=b/2,o,s,n,p,l,q;if(e!==void 0){if(e instanceof Array)this.materials=e;else{this.materials=[];for(o=0;o<6;o++)this.materials.push(e)}o=0;p=1;s=2;l=
+3;n=4;q=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var t in h)this.sides[t]!=void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,b,c,j,o);this.sides.nx&&i("z","y",1,-1,b,c,-j,p);this.sides.py&&i("x","z",1,1,a,b,r,s);this.sides.ny&&i("x","z",1,-1,a,b,-r,l);this.sides.pz&&i("x","y",1,-1,a,c,m,n);this.sides.nz&&i("x","y",-1,-1,a,c,-m,q);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,c,b,d,g,f){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,e=b/2,d=d||8,g=g||1,h,i,k=[],j=[];for(i=0;i<=g;i++){var q=[],o=[],n=i/g,s=n*(c-a)+a;for(h=0;h<=d;h++){var m=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(s*Math.sin(m*Math.PI*2),-n*b+e,s*Math.cos(m*Math.PI*2))));q.push(this.vertices.length-1);o.push(new THREE.UV(m,n))}k.push(q);j.push(o)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=k[i][h],q=k[i+1][h],o=k[i+1][h+1],n=k[i][h+1],s=
-this.vertices[b].position.clone().setY(0).normalize(),m=this.vertices[q].position.clone().setY(0).normalize(),p=this.vertices[o].position.clone().setY(0).normalize(),l=this.vertices[n].position.clone().setY(0).normalize(),r=j[i][h].clone(),t=j[i+1][h].clone(),w=j[i+1][h+1].clone(),z=j[i][h+1].clone();this.faces.push(new THREE.Face4(b,q,o,n,[s,m,p,l]));this.faceVertexUvs[0].push([r,t,w,z])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=0;h<d;h++)b=k[0][h],q=k[0][h+
-1],o=this.vertices.length-1,s=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),r=j[0][h].clone(),t=j[0][h+1].clone(),w=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(b,q,o,[s,m,p])),this.faceVertexUvs[0].push([r,t,w])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)b=k[i][h+1],q=k[i][h],o=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),r=j[i][h+1].clone(),t=j[i][h].clone(),
-w=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(b,q,o,[s,m,p])),this.faceVertexUvs[0].push([r,t,w])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(a,c,b,d,g,f){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,e=b/2,d=d||8,g=g||1,h,i,k=[],j=[];for(i=0;i<=g;i++){var r=[],m=[],o=i/g,s=o*(c-a)+a;for(h=0;h<=d;h++){var n=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(s*Math.sin(n*Math.PI*2),-o*b+e,s*Math.cos(n*Math.PI*2))));r.push(this.vertices.length-1);m.push(new THREE.UV(n,o))}k.push(r);j.push(m)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=k[i][h],r=k[i+1][h],m=k[i+1][h+1],o=k[i][h+1],s=
+this.vertices[b].position.clone().setY(0).normalize(),n=this.vertices[r].position.clone().setY(0).normalize(),p=this.vertices[m].position.clone().setY(0).normalize(),l=this.vertices[o].position.clone().setY(0).normalize(),q=j[i][h].clone(),t=j[i+1][h].clone(),w=j[i+1][h+1].clone(),A=j[i][h+1].clone();this.faces.push(new THREE.Face4(b,r,m,o,[s,n,p,l]));this.faceVertexUvs[0].push([q,t,w,A])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=0;h<d;h++)b=k[0][h],r=k[0][h+
+1],m=this.vertices.length-1,s=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),q=j[0][h].clone(),t=j[0][h+1].clone(),w=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(b,r,m,[s,n,p])),this.faceVertexUvs[0].push([q,t,w])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)b=k[i][h+1],r=k[i][h],m=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),q=j[i][h+1].clone(),t=j[i][h].clone(),
+w=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(b,r,m,[s,n,p])),this.faceVertexUvs[0].push([q,t,w])}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(u=a.length;--u>=0;){J=u;N=u-1;N<0&&(N=a.length-1);for(var b=
-0,c=n+j*2,b=0;b<c;b++){var d=K*b,e=K*(b+1),f=Q+J+d,g=Q+J+e,k=f,d=Q+N+d,e=Q+N+e,m=g;k+=F;d+=F;e+=F;m+=F;A.faces.push(new THREE.Face4(k,d,e,m,null,null,w));w&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(A.vertices[f].position.z+i)/e,g=(A.vertices[g].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=F;b+=F;c+=F;A.faces.push(new THREE.Face3(a,b,c,null,
-null,t));if(t){var d=z.maxY,e=z.maxX,f=A.vertices[b].position.x,b=A.vertices[b].position.y,g=A.vertices[c].position.x,c=A.vertices[c].position.y;A.faceVertexUvs[0].push([new THREE.UV(A.vertices[a].position.x/e,A.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,j=c.bevelSegments!==void 0?c.bevelSegments:3,q=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.curveSegments!==
-void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,s=c.bendPath,m=c.extrudePath,p,l=!1,r=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,t=c.material,w=c.extrudeMaterial,z=this.shapebb;if(m)p=m.getPoints(o),n=p.length,l=!0,q=!1;q||(k=i=j=0);var v,x,y,A=this,F=this.vertices.length;s&&a.addWrapPath(s);o=r?a.extractAllSpacedPoints(o):a.extractAllPoints(o);s=o.shape;o=o.holes;if(m=!THREE.Shape.Utils.isClockWise(s)){s=s.reverse();x=0;for(y=o.length;x<y;x++)v=o[x],THREE.Shape.Utils.isClockWise(v)&&
-(o[x]=v.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(s,o);r=s;x=0;for(y=o.length;x<y;x++)v=o[x],s=s.concat(v);var u,D,B,G,I,E,K=s.length,O=m.length,C=[];u=0;D=r.length;J=D-1;for(N=u+1;u<D;u++,J++,N++)J===D&&(J=0),N===D&&(N=0),C[u]=d(r[u],r[J],r[N]);var L=[],H,M=C.concat();x=0;for(y=o.length;x<y;x++){v=o[x];H=[];u=0;D=v.length;J=D-1;for(N=u+1;u<D;u++,J++,N++)J===D&&(J=0),N===D&&(N=0),H[u]=d(v[u],v[J],v[N]);L.push(H);M=M.concat(H)}for(B=0;B<j;B++){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);u=
-0;for(D=r.length;u<D;u++)E=b(r[u],C[u],G),f(E.x,E.y,-I);x=0;for(y=o.length;x<y;x++){v=o[x];H=L[x];u=0;for(D=v.length;u<D;u++)E=b(v[u],H[u],G),f(E.x,E.y,-I)}}G=k;for(u=0;u<K;u++)E=q?b(s[u],M[u],G):s[u],l?f(E.x,E.y+p[0].y,p[0].x):f(E.x,E.y,0);for(B=1;B<=n;B++)for(u=0;u<K;u++)E=q?b(s[u],M[u],G):s[u],l?f(E.x,E.y+p[B-1].y,p[B-1].x):f(E.x,E.y,h/n*B);for(B=j-1;B>=0;B--){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);u=0;for(D=r.length;u<D;u++)E=b(r[u],C[u],G),f(E.x,E.y,h+I);x=0;for(y=o.length;x<y;x++){v=o[x];
-H=L[x];u=0;for(D=v.length;u<D;u++)E=b(v[u],H[u],G),l?f(E.x,E.y+p[n-1].y,p[n-1].x+I):f(E.x,E.y,h+I)}}if(q){q=K*0;for(u=0;u<O;u++)k=m[u],e(k[2]+q,k[1]+q,k[0]+q);q=K*(n+j*2);for(u=0;u<O;u++)k=m[u],e(k[0]+q,k[1]+q,k[2]+q)}else{for(u=0;u<O;u++)k=m[u],e(k[2],k[1],k[0]);for(u=0;u<O;u++)k=m[u],e(k[0]+K*n,k[1]+K*n,k[2]+K*n)}var J,N,Q=0;g(r);Q+=r.length;x=0;for(y=o.length;x<y;x++)v=o[x],g(v),Q+=v.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(u=a.length;--u>=0;){K=u;I=u-1;I<0&&(I=a.length-1);for(var b=
+0,c=o+j*2,b=0;b<c;b++){var d=L*b,e=L*(b+1),f=R+K+d,g=R+K+e,k=f,d=R+I+d,e=R+I+e,m=g;k+=F;d+=F;e+=F;m+=F;z.faces.push(new THREE.Face4(k,d,e,m,null,null,w));w&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(z.vertices[f].position.z+i)/e,g=(z.vertices[g].position.z+i)/e,z.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){z.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=F;b+=F;c+=F;z.faces.push(new THREE.Face3(a,b,c,null,
+null,t));if(t){var d=A.maxY,e=A.maxX,f=z.vertices[b].position.x,b=z.vertices[b].position.y,g=z.vertices[c].position.x,c=z.vertices[c].position.y;z.faceVertexUvs[0].push([new THREE.UV(z.vertices[a].position.x/e,z.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,j=c.bevelSegments!==void 0?c.bevelSegments:3,r=c.bevelEnabled!==void 0?c.bevelEnabled:!0,m=c.curveSegments!==
+void 0?c.curveSegments:12,o=c.steps!==void 0?c.steps:1,s=c.bendPath,n=c.extrudePath,p,l=!1,q=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,t=c.material,w=c.extrudeMaterial,A=this.shapebb;if(n)p=n.getPoints(m),o=p.length,l=!0,r=!1;r||(k=i=j=0);var v,x,y,z=this,F=this.vertices.length;s&&a.addWrapPath(s);m=q?a.extractAllSpacedPoints(m):a.extractAllPoints(m);s=m.shape;m=m.holes;if(n=!THREE.Shape.Utils.isClockWise(s)){s=s.reverse();x=0;for(y=m.length;x<y;x++)v=m[x],THREE.Shape.Utils.isClockWise(v)&&
+(m[x]=v.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(s,m);q=s;x=0;for(y=m.length;x<y;x++)v=m[x],s=s.concat(v);var u,D,B,G,J,E,L=s.length,O=n.length,C=[];u=0;D=q.length;K=D-1;for(I=u+1;u<D;u++,K++,I++)K===D&&(K=0),I===D&&(I=0),C[u]=d(q[u],q[K],q[I]);var M=[],H,N=C.concat();x=0;for(y=m.length;x<y;x++){v=m[x];H=[];u=0;D=v.length;K=D-1;for(I=u+1;u<D;u++,K++,I++)K===D&&(K=0),I===D&&(I=0),H[u]=d(v[u],v[K],v[I]);M.push(H);N=N.concat(H)}for(B=0;B<j;B++){G=B/j;J=i*(1-G);G=k*Math.sin(G*Math.PI/2);u=
+0;for(D=q.length;u<D;u++)E=b(q[u],C[u],G),f(E.x,E.y,-J);x=0;for(y=m.length;x<y;x++){v=m[x];H=M[x];u=0;for(D=v.length;u<D;u++)E=b(v[u],H[u],G),f(E.x,E.y,-J)}}G=k;for(u=0;u<L;u++)E=r?b(s[u],N[u],G):s[u],l?f(E.x,E.y+p[0].y,p[0].x):f(E.x,E.y,0);for(B=1;B<=o;B++)for(u=0;u<L;u++)E=r?b(s[u],N[u],G):s[u],l?f(E.x,E.y+p[B-1].y,p[B-1].x):f(E.x,E.y,h/o*B);for(B=j-1;B>=0;B--){G=B/j;J=i*(1-G);G=k*Math.sin(G*Math.PI/2);u=0;for(D=q.length;u<D;u++)E=b(q[u],C[u],G),f(E.x,E.y,h+J);x=0;for(y=m.length;x<y;x++){v=m[x];
+H=M[x];u=0;for(D=v.length;u<D;u++)E=b(v[u],H[u],G),l?f(E.x,E.y+p[o-1].y,p[o-1].x+J):f(E.x,E.y,h+J)}}if(r){r=L*0;for(u=0;u<O;u++)k=n[u],e(k[2]+r,k[1]+r,k[0]+r);r=L*(o+j*2);for(u=0;u<O;u++)k=n[u],e(k[0]+r,k[1]+r,k[2]+r)}else{for(u=0;u<O;u++)k=n[u],e(k[2],k[1],k[0]);for(u=0;u<O;u++)k=n[u],e(k[0]+L*o,k[1]+L*o,k[2]+L*o)}var K,I,R=0;g(q);R+=q.length;x=0;for(y=m.length;x<y;x++)v=m[x],g(v),R+=v.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){var e=g.vertices[a].position,f=g.vertices[b].position,h=g.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(e.clone().normalize(),f.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(e.z,e.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-e.y/2),new THREE.UV(1-
 (Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}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,f=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,f);b(0,5,1,f);b(0,
@@ -173,18 +173,18 @@ e.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),e.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);for(var g=a/2,f=c/2,b=b||1,d=d||1,e=b+1,h=d+1,i=a/b,k=c/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(c=0;c<e;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*i-g,-(a*k-f),0)));for(a=0;a<d;a++)for(c=0;c<b;c++)g=new THREE.Face4(c+e*a,c+e*(a+1),c+1+e*(a+1),c+1+e*a),g.normal.copy(j),g.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.clone()),this.faces.push(g),this.faceVertexUvs[0].push([new THREE.UV(c/b,a/d),new THREE.UV(c/
 b,(a+1)/d),new THREE.UV((c+1)/b,(a+1)/d),new THREE.UV((c+1)/b,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,c,b,d,g,f,e){THREE.Geometry.call(this);var a=a||50,c=Math.max(3,Math.floor(c)||8),b=Math.max(2,Math.floor(b)||6),d=d!=void 0?d:0,g=g!=void 0?g:Math.PI*2,f=f!=void 0?f:0,e=e!=void 0?e:Math.PI,h,i,k=[],j=[];for(i=0;i<=b;i++){var q=[],o=[];for(h=0;h<=c;h++){var n=h/c,s=i/b;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+n*g)*Math.sin(f+s*e),a*Math.cos(f+s*e),a*Math.sin(d+n*g)*Math.sin(f+s*e))));q.push(this.vertices.length-1);o.push(new THREE.UV(n,s))}k.push(q);
-j.push(o)}for(i=0;i<b;i++)for(h=0;h<c;h++){var d=k[i][h+1],g=k[i][h],f=k[i+1][h],e=k[i+1][h+1],q=this.vertices[d].position.clone().normalize(),o=this.vertices[g].position.clone().normalize(),n=this.vertices[f].position.clone().normalize(),s=this.vertices[e].position.clone().normalize(),m=j[i][h+1].clone(),p=j[i][h].clone(),l=j[i+1][h].clone(),r=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,f,e,[q,n,s])),this.faceVertexUvs[0].push([m,l,r])):Math.abs(this.vertices[f].position.y)==
-a?(this.faces.push(new THREE.Face3(d,g,f,[q,o,n])),this.faceVertexUvs[0].push([m,p,l])):(this.faces.push(new THREE.Face4(d,g,f,e,[q,o,n,s])),this.faceVertexUvs[0].push([m,p,l,r]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
+THREE.SphereGeometry=function(a,c,b,d,g,f,e){THREE.Geometry.call(this);var a=a||50,c=Math.max(3,Math.floor(c)||8),b=Math.max(2,Math.floor(b)||6),d=d!=void 0?d:0,g=g!=void 0?g:Math.PI*2,f=f!=void 0?f:0,e=e!=void 0?e:Math.PI,h,i,k=[],j=[];for(i=0;i<=b;i++){var r=[],m=[];for(h=0;h<=c;h++){var o=h/c,s=i/b;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+o*g)*Math.sin(f+s*e),a*Math.cos(f+s*e),a*Math.sin(d+o*g)*Math.sin(f+s*e))));r.push(this.vertices.length-1);m.push(new THREE.UV(o,s))}k.push(r);
+j.push(m)}for(i=0;i<b;i++)for(h=0;h<c;h++){var d=k[i][h+1],g=k[i][h],f=k[i+1][h],e=k[i+1][h+1],r=this.vertices[d].position.clone().normalize(),m=this.vertices[g].position.clone().normalize(),o=this.vertices[f].position.clone().normalize(),s=this.vertices[e].position.clone().normalize(),n=j[i][h+1].clone(),p=j[i][h].clone(),l=j[i+1][h].clone(),q=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,f,e,[r,o,s])),this.faceVertexUvs[0].push([n,l,q])):Math.abs(this.vertices[f].position.y)==
+a?(this.faces.push(new THREE.Face3(d,g,f,[r,m,o])),this.faceVertexUvs[0].push([n,p,l])):(this.faces.push(new THREE.Face4(d,g,f,e,[r,m,o,s])),this.faceVertexUvs[0].push([n,p,l,q]))}this.computeCentroids();this.computeFaceNormals();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(""),f=g.length,e=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;e.push(h.path)}return{paths:e,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var f=[],e,h,i,k,j,q,o,n,s,m,p,l=c.glyphs[a]||c.glyphs["?"];if(l){if(l.o){c=l._cachedOutline||(l._cachedOutline=l.o.split(" "));k=c.length;for(a=0;a<k;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;j=c[a++]*b;f.push(new THREE.Vector2(i,j));g.moveTo(i,j);break;case "l":i=c[a++]*b+d;j=c[a++]*b;f.push(new THREE.Vector2(i,
-j));g.lineTo(i,j);break;case "q":i=c[a++]*b+d;j=c[a++]*b;n=c[a++]*b+d;s=c[a++]*b;g.quadraticCurveTo(n,s,i,j);if(e=f[f.length-1]){q=e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++){var r=e/h,t=THREE.Shape.Utils.b2(r,q,n,i),r=THREE.Shape.Utils.b2(r,o,s,j);f.push(new THREE.Vector2(t,r))}}break;case "b":if(i=c[a++]*b+d,j=c[a++]*b,n=c[a++]*b+d,s=c[a++]*-b,m=c[a++]*b+d,p=c[a++]*-b,g.bezierCurveTo(i,j,n,s,m,p),e=f[f.length-1]){q=e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++)r=e/h,t=THREE.Shape.Utils.b3(r,q,n,
-m,i),r=THREE.Shape.Utils.b3(r,o,s,p,j),f.push(new THREE.Vector2(t,r))}}}return{offset:l.ha*b,points:f,path:g}}}};
-(function(a){var c=function(a){for(var c=a.length,g=0,f=c-1,e=0;e<c;f=e++)g+=a[f].x*a[e].y-a[e].x*a[f].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var f=[],e=[],h=[],i,k,j;if(c(a)>0)for(k=0;k<g;k++)e[k]=k;else for(k=0;k<g;k++)e[k]=g-1-k;var q=2*g;for(k=g-1;g>2;){if(q--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return f}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);j=k+1;g<=j&&(j=0);var o;a:{o=a;var n=i,s=k,m=j,p=g,l=e,r=void 0,t=void 0,w=void 0,
-z=void 0,v=void 0,x=void 0,y=void 0,A=void 0,F=void 0,t=o[l[n]].x,w=o[l[n]].y,z=o[l[s]].x,v=o[l[s]].y,x=o[l[m]].x,y=o[l[m]].y;if(1.0E-10>(z-t)*(y-w)-(v-w)*(x-t))o=!1;else{for(r=0;r<p;r++)if(!(r==n||r==s||r==m)){var A=o[l[r]].x,F=o[l[r]].y,u=void 0,D=void 0,B=void 0,G=void 0,I=void 0,E=void 0,K=void 0,O=void 0,C=void 0,L=void 0,H=void 0,M=void 0,u=B=I=void 0,u=x-z,D=y-v,B=t-x,G=w-y,I=z-t,E=v-w,K=A-t,O=F-w,C=A-z,L=F-v,H=A-x,M=F-y,u=u*L-D*C,I=I*O-E*K,B=B*M-G*H;if(u>=0&&B>=0&&I>=0){o=!1;break a}}o=!0}}if(o){f.push([a[e[i]],
-a[e[k]],a[e[j]]]);h.push([e[i],e[k],e[j]]);i=k;for(j=k+1;j<g;i++,j++)e[i]=e[j];g--;q=2*g}}if(d)return h;return f};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+0,g=String(a).split(""),f=g.length,e=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;e.push(h.path)}return{paths:e,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var f=[],e,h,i,k,j,r,m,o,s,n,p,l=c.glyphs[a]||c.glyphs["?"];if(l){if(l.o){c=l._cachedOutline||(l._cachedOutline=l.o.split(" "));k=c.length;for(a=0;a<k;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;j=c[a++]*b;f.push(new THREE.Vector2(i,j));g.moveTo(i,j);break;case "l":i=c[a++]*b+d;j=c[a++]*b;f.push(new THREE.Vector2(i,
+j));g.lineTo(i,j);break;case "q":i=c[a++]*b+d;j=c[a++]*b;o=c[a++]*b+d;s=c[a++]*b;g.quadraticCurveTo(o,s,i,j);if(e=f[f.length-1]){r=e.x;m=e.y;e=1;for(h=this.divisions;e<=h;e++){var q=e/h,t=THREE.Shape.Utils.b2(q,r,o,i),q=THREE.Shape.Utils.b2(q,m,s,j);f.push(new THREE.Vector2(t,q))}}break;case "b":if(i=c[a++]*b+d,j=c[a++]*b,o=c[a++]*b+d,s=c[a++]*-b,n=c[a++]*b+d,p=c[a++]*-b,g.bezierCurveTo(i,j,o,s,n,p),e=f[f.length-1]){r=e.x;m=e.y;e=1;for(h=this.divisions;e<=h;e++)q=e/h,t=THREE.Shape.Utils.b3(q,r,o,
+n,i),q=THREE.Shape.Utils.b3(q,m,s,p,j),f.push(new THREE.Vector2(t,q))}}}return{offset:l.ha*b,points:f,path:g}}}};
+(function(a){var c=function(a){for(var c=a.length,g=0,f=c-1,e=0;e<c;f=e++)g+=a[f].x*a[e].y-a[e].x*a[f].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var f=[],e=[],h=[],i,k,j;if(c(a)>0)for(k=0;k<g;k++)e[k]=k;else for(k=0;k<g;k++)e[k]=g-1-k;var r=2*g;for(k=g-1;g>2;){if(r--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return f}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);j=k+1;g<=j&&(j=0);var m;a:{m=a;var o=i,s=k,n=j,p=g,l=e,q=void 0,t=void 0,w=void 0,
+A=void 0,v=void 0,x=void 0,y=void 0,z=void 0,F=void 0,t=m[l[o]].x,w=m[l[o]].y,A=m[l[s]].x,v=m[l[s]].y,x=m[l[n]].x,y=m[l[n]].y;if(1.0E-10>(A-t)*(y-w)-(v-w)*(x-t))m=!1;else{for(q=0;q<p;q++)if(!(q==o||q==s||q==n)){var z=m[l[q]].x,F=m[l[q]].y,u=void 0,D=void 0,B=void 0,G=void 0,J=void 0,E=void 0,L=void 0,O=void 0,C=void 0,M=void 0,H=void 0,N=void 0,u=B=J=void 0,u=x-A,D=y-v,B=t-x,G=w-y,J=A-t,E=v-w,L=z-t,O=F-w,C=z-A,M=F-v,H=z-x,N=F-y,u=u*M-D*C,J=J*O-E*L,B=B*N-G*H;if(u>=0&&B>=0&&J>=0){m=!1;break a}}m=!0}}if(m){f.push([a[e[i]],
+a[e[k]],a[e[j]]]);h.push([e[i],e[k],e[j]]);i=k;for(j=k+1;j<g;i++,j++)e[i]=e[j];g--;r=2*g}}if(d)return h;return f};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 f=d/this.segmentsT*this.arc,e=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(f);g.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(e))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(e))*Math.sin(f);h.z=
 this.tube*Math.sin(e);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,f=(this.segmentsT+1)*(b-1)+d-1,e=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(g,f,e,h,[c[g],c[f],c[e],c[h]]);i.normal.addSelf(c[g]);i.normal.addSelf(c[f]);i.normal.addSelf(c[e]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[g].clone(),a[f].clone(),a[e].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
@@ -192,13 +192,13 @@ THREE.TorusKnotGeometry=function(a,c,b,d,g,f,e){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,e=c/this.segmentsT*2*Math.PI,g=h(i,e,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,e,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;f.cross(b,d);d.cross(f,b);f.normalize();d.normalize();i=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);g.x+=i*d.x+e*f.x;g.y+=i*d.y+e*f.y;g.z+=i*d.z+e*f.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,f=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][f],f=this.grid[a][f],e=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),j=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,f));this.faceVertexUvs[0].push([e,i,k,j])}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 j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){j.vertexColors=[];for(var k,n,m,l=0;l<4;l++){m=i[l];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<m.length;p++)n=h.vertexColors[m[p]-1],k.r+=n.r,k.g+=n.g,k.b+=n.b;k.r/=m.length;k.g/=m.length;k.b/=m.length;j.vertexColors[l]=k}}g.push(j);(!e.supportUVs||o.length!=0)&&f.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=[],f=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},q={},o=[],n,s,m,p,l,r=a.faceVertexUvs[0];n=0;for(s=r.length;n<s;n++){m=0;for(p=r[n].length;m<p;m++)l=d[n]["abcd".charAt(m)],o[l]||(o[l]=r[n][m])}var t;n=0;for(s=d.length;n<s;n++)if(l=d[n],k.push(l.centroid),i.push(new THREE.Vertex(l.centroid)),e.supportUVs&&o.length!=0){t=new THREE.UV;if(l instanceof THREE.Face3)t.u=o[l.a].u+o[l.b].u+o[l.c].u,t.v=o[l.a].v+o[l.b].v+o[l.c].v,t.u/=3,t.v/=3;else if(l instanceof THREE.Face4)t.u=
-o[l.a].u+o[l.b].u+o[l.c].u+o[l.d].u,t.v=o[l.a].v+o[l.b].v+o[l.c].v+o[l.d].v,t.u/=4,t.v/=4;o.push(t)}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 w=0,r=h.length,z,v,x={},y={},A=function(a,
-b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},F=function(a,b){y[a]===void 0&&(y[a]={});y[a][b]=null};for(n in s){t=s[n];z=n.split("_");v=z[0];z=z[1];A(v,[v,z]);A(z,[v,z]);m=0;for(p=t.length;m<p;m++)l=t[m],F(v,l,n),F(z,l,n);t.length<2&&(q[n]=!0)}for(n in s)if(t=s[n],l=t[0],t=t[1],z=n.split("_"),v=z[0],z=z[1],p=new THREE.Vector3,q[n]?(p.addSelf(h[v].position),p.addSelf(h[z].position),p.multiplyScalar(0.5)):(p.addSelf(k[l]),p.addSelf(k[t]),p.addSelf(h[v].position),p.addSelf(h[z].position),p.multiplyScalar(0.25)),
-j[n]=r+d.length+w,i.push(new THREE.Vertex(p)),w++,e.supportUVs&&o.length!=0)t=new THREE.UV,t.u=o[v].u+o[z].u,t.v=o[v].v+o[z].v,t.u/=2,t.v/=2,o.push(t);var u,D;z=["123","12","2","23"];p=["123","23","3","31"];var A=["123","31","1","12"],F=["1234","12","2","23"],B=["1234","23","3","34"],G=["1234","34","4","41"],I=["1234","41","1","12"];n=0;for(s=k.length;n<s;n++)l=d[n],t=r+n,l instanceof THREE.Face3?(w=b(l.a,l.b),v=b(l.b,l.c),u=b(l.c,l.a),c(t,j[w],l.b,j[v],l,z),c(t,j[v],l.c,j[u],l,p),c(t,j[u],l.a,j[w],
-l,A)):l instanceof THREE.Face4?(w=b(l.a,l.b),v=b(l.b,l.c),u=b(l.c,l.d),D=b(l.d,l.a),c(t,j[w],l.b,j[v],l,F),c(t,j[v],l.c,j[u],l,B),c(t,j[u],l.d,j[D],l,G),c(t,j[D],l.a,j[w],l,I)):console.log("face should be a face!",l);d=i;i=new THREE.Vector3;j=new THREE.Vector3;n=0;for(s=h.length;n<s;n++)if(x[n]!==void 0){i.set(0,0,0);j.set(0,0,0);l=new THREE.Vector3(0,0,0);t=0;for(m in y[n])i.addSelf(k[m]),t++;w=0;r=x[n].length;for(m=0;m<r;m++)q[b(x[n][m][0],x[n][m][1])]&&w++;if(w!=2){i.divideScalar(t);for(m=0;m<
-r;m++)t=x[n][m],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(r);l.addSelf(h[n].position);l.multiplyScalar(r-3);l.addSelf(i);l.addSelf(j.multiplyScalar(2));l.divideScalar(r);d[n].position=l}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){j.vertexColors=[];for(var k,n,l,o=0;o<4;o++){l=i[o];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<l.length;p++)n=h.vertexColors[l[p]-1],k.r+=n.r,k.g+=n.g,k.b+=n.b;k.r/=l.length;k.g/=l.length;k.b/=l.length;j.vertexColors[o]=k}}g.push(j);(!e.supportUVs||m.length!=0)&&f.push([m[a],m[b],m[c],m[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],g=[],f=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},r={},m=[],o,s,n,p,l,q=a.faceVertexUvs[0];o=0;for(s=q.length;o<s;o++){n=0;for(p=q[o].length;n<p;n++)l=d[o]["abcd".charAt(n)],m[l]||(m[l]=q[o][n])}var t;o=0;for(s=d.length;o<s;o++)if(l=d[o],k.push(l.centroid),i.push(new THREE.Vertex(l.centroid)),e.supportUVs&&m.length!=0){t=new THREE.UV;if(l instanceof THREE.Face3)t.u=m[l.a].u+m[l.b].u+m[l.c].u,t.v=m[l.a].v+m[l.b].v+m[l.c].v,t.u/=3,t.v/=3;else if(l instanceof THREE.Face4)t.u=
+m[l.a].u+m[l.b].u+m[l.c].u+m[l.d].u,t.v=m[l.a].v+m[l.b].v+m[l.c].v+m[l.d].v,t.u/=4,t.v/=4;m.push(t)}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 w=0,q=h.length,A,v,x={},y={},z=function(a,
+b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},F=function(a,b){y[a]===void 0&&(y[a]={});y[a][b]=null};for(o in s){t=s[o];A=o.split("_");v=A[0];A=A[1];z(v,[v,A]);z(A,[v,A]);n=0;for(p=t.length;n<p;n++)l=t[n],F(v,l,o),F(A,l,o);t.length<2&&(r[o]=!0)}for(o in s)if(t=s[o],l=t[0],t=t[1],A=o.split("_"),v=A[0],A=A[1],p=new THREE.Vector3,r[o]?(p.addSelf(h[v].position),p.addSelf(h[A].position),p.multiplyScalar(0.5)):(p.addSelf(k[l]),p.addSelf(k[t]),p.addSelf(h[v].position),p.addSelf(h[A].position),p.multiplyScalar(0.25)),
+j[o]=q+d.length+w,i.push(new THREE.Vertex(p)),w++,e.supportUVs&&m.length!=0)t=new THREE.UV,t.u=m[v].u+m[A].u,t.v=m[v].v+m[A].v,t.u/=2,t.v/=2,m.push(t);var u,D;A=["123","12","2","23"];p=["123","23","3","31"];var z=["123","31","1","12"],F=["1234","12","2","23"],B=["1234","23","3","34"],G=["1234","34","4","41"],J=["1234","41","1","12"];o=0;for(s=k.length;o<s;o++)l=d[o],t=q+o,l instanceof THREE.Face3?(w=b(l.a,l.b),v=b(l.b,l.c),u=b(l.c,l.a),c(t,j[w],l.b,j[v],l,A),c(t,j[v],l.c,j[u],l,p),c(t,j[u],l.a,j[w],
+l,z)):l instanceof THREE.Face4?(w=b(l.a,l.b),v=b(l.b,l.c),u=b(l.c,l.d),D=b(l.d,l.a),c(t,j[w],l.b,j[v],l,F),c(t,j[v],l.c,j[u],l,B),c(t,j[u],l.d,j[D],l,G),c(t,j[D],l.a,j[w],l,J)):console.log("face should be a face!",l);d=i;i=new THREE.Vector3;j=new THREE.Vector3;o=0;for(s=h.length;o<s;o++)if(x[o]!==void 0){i.set(0,0,0);j.set(0,0,0);l=new THREE.Vector3(0,0,0);t=0;for(n in y[o])i.addSelf(k[n]),t++;w=0;q=x[o].length;for(n=0;n<q;n++)r[b(x[o][n][0],x[o][n][1])]&&w++;if(w!=2){i.divideScalar(t);for(n=0;n<
+q;n++)t=x[o][n],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(q);l.addSelf(h[o].position);l.multiplyScalar(q-3);l.addSelf(i);l.addSelf(j.multiplyScalar(2));l.divideScalar(q);d[o].position=l}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=f;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)==
@@ -206,124 +206,134 @@ 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 f(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var e,h,i;h="MeshLambertMaterial";e={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")e.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")e.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")e.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)e.transparent=a.transparent;if(a.depthTest!==void 0)e.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")e.vertexColors=THREE.FaceColors;else if(a.vertexColors)e.vertexColors=THREE.VertexColors;if(a.colorDiffuse)e.color=f(a.colorDiffuse);
 else if(a.DbgColor)e.color=a.DbgColor;if(a.colorSpecular)e.specular=f(a.colorSpecular);if(a.colorAmbient)e.ambient=f(a.colorAmbient);if(a.transparency)e.opacity=a.transparency;if(a.specularCoef)e.shininess=a.specularCoef;a.mapDiffuse&&c&&g(e,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(e,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(e,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&c&&g(e,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var k=THREE.ShaderUtils.lib.normal,j=THREE.UniformsUtils.clone(k.uniforms),q=e.color;h=e.specular;i=e.ambient;var o=e.shininess;j.tNormal.texture=e.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(e.map)j.tDiffuse.texture=e.map,j.enableDiffuse.value=!0;if(e.specularMap)j.tSpecular.texture=e.specularMap,j.enableSpecular.value=!0;if(e.lightMap)j.tAO.texture=
-e.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(q);j.uSpecularColor.value.setHex(h);j.uAmbientColor.value.setHex(i);j.uShininess.value=o;if(e.opacity)j.uOpacity.value=e.opacity;e=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:j,lights:!0,fog:!0})}else e=new THREE[h](e);return e}};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(e,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var k=THREE.ShaderUtils.lib.normal,j=THREE.UniformsUtils.clone(k.uniforms),r=e.color;h=e.specular;i=e.ambient;var m=e.shininess;j.tNormal.texture=e.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(e.map)j.tDiffuse.texture=e.map,j.enableDiffuse.value=!0;if(e.specularMap)j.tSpecular.texture=e.specularMap,j.enableSpecular.value=!0;if(e.lightMap)j.tAO.texture=
+e.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(r);j.uSpecularColor.value.setHex(h);j.uAmbientColor.value.setHex(i);j.uShininess.value=m;if(e.opacity)j.uOpacity.value=e.opacity;e=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:j,lights:!0,fog:!0})}else e=new THREE[h](e);return e}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
 THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,c,b,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,c=d.callback,b=d.texture_path,d=d.bin_path;var b=b?b:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,c,b,d,g)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,c,b,d,g,f){var e=new XMLHttpRequest;e.onreadystatechange=function(){if(e.readyState==4)if(e.status==200||e.status==0)try{var h=JSON.parse(e.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(h,b,g,d,f)}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+
 e.status+"]")};e.open("GET",c,!0);e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g){var f=new XMLHttpRequest,e=b+"/"+a.buffers,h=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.response,c,d,a.materials):console.error("Couldn't load ["+e+"] ["+f.status+"]"):f.readyState==3?g&&(h==0&&(h=f.getResponseHeader("Content-Length")),g({total:h,loaded:f.responseText.length})):f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",e,!0);
 f.responseType="arraybuffer";f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a){return a%4?4-a%4:0}function g(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function k(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=t[e*2];e=t[e*2+1];i=t[f*2];j=t[f*2+1];f=t[g*2];k=t[g*2+1];g=m.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,j));n.push(new THREE.UV(f,k));g.push(n)}}
-function j(b,c){var d,e,f,g,h,i,j,k,l,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[d*4];f=o[d*4+1];g=o[d*4+2];h=o[d*4+3];i=t[e*2];e=t[e*2+1];j=t[f*2];l=t[f*2+1];k=t[g*2];n=t[g*2+1];g=t[h*2];f=t[h*2+1];h=m.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(j,l));p.push(new THREE.UV(k,n));p.push(new THREE.UV(g,f));h.push(p)}}function q(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],m.faces.push(new THREE.Face3(e,
-f,g,null,null,h))}function o(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],m.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function n(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=n[e];var o=r[k*3],p=r[k*3+1];k=r[k*3+2];var q=r[l*3],s=r[l*3+1];l=r[l*3+2];m.faces.push(new THREE.Face3(f,
-g,h,[new THREE.Vector3(r[j*3],r[j*3+1],r[j*3+2]),new THREE.Vector3(o,p,k),new THREE.Vector3(q,s,l)],null,i))}}function s(b,c,d,e){for(var f,g,h,i,j,k,l,n,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];n=d[e*4+2];o=d[e*4+3];j=p[e];var q=r[l*3],s=r[l*3+1];l=r[l*3+2];var t=r[n*3],v=r[n*3+1];n=r[n*3+2];var w=r[o*3],x=r[o*3+1];o=r[o*3+2];m.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(r[k*
-3],r[k*3+1],r[k*3+2]),new THREE.Vector3(q,s,l),new THREE.Vector3(t,v,n),new THREE.Vector3(w,x,o)],null,j))}}var m=this,p=0,l,r=[],t=[],w,z,v,x,y,A;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(m,d,b);l={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,p,12),header_bytes:g(a,p+12),vertex_coordinate_bytes:g(a,p+13),normal_coordinate_bytes:g(a,p+14),uv_coordinate_bytes:g(a,p+15),vertex_index_bytes:g(a,p+16),normal_index_bytes:g(a,
-p+17),uv_index_bytes:g(a,p+18),material_index_bytes:g(a,p+19),nvertices:i(a,p+20),nnormals:i(a,p+20+4),nuvs:i(a,p+20+8),ntri_flat:i(a,p+20+12),ntri_smooth:i(a,p+20+16),ntri_flat_uv:i(a,p+20+20),ntri_smooth_uv:i(a,p+20+24),nquad_flat:i(a,p+20+28),nquad_smooth:i(a,p+20+32),nquad_flat_uv:i(a,p+20+36),nquad_smooth_uv:i(a,p+20+40)};l.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");p+=l.header_bytes;b=l.vertex_index_bytes*3+l.material_index_bytes;A=l.vertex_index_bytes*
-4+l.material_index_bytes;w=l.ntri_flat*b;z=l.ntri_smooth*(b+l.normal_index_bytes*3);v=l.ntri_flat_uv*(b+l.uv_index_bytes*3);x=l.ntri_smooth_uv*(b+l.normal_index_bytes*3+l.uv_index_bytes*3);y=l.nquad_flat*A;b=l.nquad_smooth*(A+l.normal_index_bytes*4);A=l.nquad_flat_uv*(A+l.uv_index_bytes*4);p+=function(b){var c=l.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],m.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(p);
-p+=function(b){var c=l.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],r.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(p);p+=c(l.nnormals*3);p+=function(b){var c=l.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],t.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(p);w=p+w+c(l.ntri_flat*2);z=w+z+c(l.ntri_smooth*2);v=z+v+c(l.ntri_flat_uv*2);x=v+x+c(l.ntri_smooth_uv*2);y=x+y+c(l.nquad_flat*2);
-b=y+b+c(l.nquad_smooth*2);A=b+A+c(l.nquad_flat_uv*2);(function(a){var b=l.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;q(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,c)}})(z);(function(a){var b=l.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;n(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,d)}})(v);(function(a){var b=l.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
-c)}})(b);(function(a){var b=l.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(A);(function(a){var b=l.ntri_flat;b&&q(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(p);(function(a){var b=l.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;n(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(w);(function(a){var b=l.nquad_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(x);(function(a){var b=
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a){return a%4?4-a%4:0}function g(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function k(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=t[e*2];e=t[e*2+1];i=t[f*2];j=t[f*2+1];f=t[g*2];k=t[g*2+1];g=n.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,j));m.push(new THREE.UV(f,k));g.push(m)}}
+function j(b,c){var d,e,f,g,h,i,j,k,l,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[d*4];f=o[d*4+1];g=o[d*4+2];h=o[d*4+3];i=t[e*2];e=t[e*2+1];j=t[f*2];l=t[f*2+1];k=t[g*2];m=t[g*2+1];g=t[h*2];f=t[h*2+1];h=n.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(j,l));p.push(new THREE.UV(k,m));p.push(new THREE.UV(g,f));h.push(p)}}function r(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],n.faces.push(new THREE.Face3(e,
+f,g,null,null,h))}function m(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],n.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function o(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=m[e];var o=q[k*3],p=q[k*3+1];k=q[k*3+2];var r=q[l*3],s=q[l*3+1];l=q[l*3+2];n.faces.push(new THREE.Face3(f,
+g,h,[new THREE.Vector3(q[j*3],q[j*3+1],q[j*3+2]),new THREE.Vector3(o,p,k),new THREE.Vector3(r,s,l)],null,i))}}function s(b,c,d,e){for(var f,g,h,i,j,k,l,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];m=d[e*4+2];o=d[e*4+3];j=p[e];var r=q[l*3],s=q[l*3+1];l=q[l*3+2];var t=q[m*3],v=q[m*3+1];m=q[m*3+2];var w=q[o*3],x=q[o*3+1];o=q[o*3+2];n.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(q[k*
+3],q[k*3+1],q[k*3+2]),new THREE.Vector3(r,s,l),new THREE.Vector3(t,v,m),new THREE.Vector3(w,x,o)],null,j))}}var n=this,p=0,l,q=[],t=[],w,A,v,x,y,z;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);l={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,p,12),header_bytes:g(a,p+12),vertex_coordinate_bytes:g(a,p+13),normal_coordinate_bytes:g(a,p+14),uv_coordinate_bytes:g(a,p+15),vertex_index_bytes:g(a,p+16),normal_index_bytes:g(a,
+p+17),uv_index_bytes:g(a,p+18),material_index_bytes:g(a,p+19),nvertices:i(a,p+20),nnormals:i(a,p+20+4),nuvs:i(a,p+20+8),ntri_flat:i(a,p+20+12),ntri_smooth:i(a,p+20+16),ntri_flat_uv:i(a,p+20+20),ntri_smooth_uv:i(a,p+20+24),nquad_flat:i(a,p+20+28),nquad_smooth:i(a,p+20+32),nquad_flat_uv:i(a,p+20+36),nquad_smooth_uv:i(a,p+20+40)};l.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");p+=l.header_bytes;b=l.vertex_index_bytes*3+l.material_index_bytes;z=l.vertex_index_bytes*
+4+l.material_index_bytes;w=l.ntri_flat*b;A=l.ntri_smooth*(b+l.normal_index_bytes*3);v=l.ntri_flat_uv*(b+l.uv_index_bytes*3);x=l.ntri_smooth_uv*(b+l.normal_index_bytes*3+l.uv_index_bytes*3);y=l.nquad_flat*z;b=l.nquad_smooth*(z+l.normal_index_bytes*4);z=l.nquad_flat_uv*(z+l.uv_index_bytes*4);p+=function(b){var c=l.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],n.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(p);
+p+=function(b){var c=l.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],q.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(p);p+=c(l.nnormals*3);p+=function(b){var c=l.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],t.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(p);w=p+w+c(l.ntri_flat*2);A=w+A+c(l.ntri_smooth*2);v=A+v+c(l.ntri_flat_uv*2);x=v+x+c(l.ntri_smooth_uv*2);y=x+y+c(l.nquad_flat*2);
+b=y+b+c(l.nquad_smooth*2);z=b+z+c(l.nquad_flat_uv*2);(function(a){var b=l.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;r(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,c)}})(A);(function(a){var b=l.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;o(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,d)}})(v);(function(a){var b=l.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;m(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
+c)}})(b);(function(a){var b=l.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(z);(function(a){var b=l.ntri_flat;b&&r(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(p);(function(a){var b=l.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;o(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(w);(function(a){var b=l.nquad_flat;b&&m(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(x);(function(a){var b=
 l.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(y);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){P=a;d=d||ca;g!==void 0&&(a=g.split("/"),a.pop(),da=a.length<1?"":a.join("/")+"/");Z=c("//dae:library_images/dae:image",e,"image");$=c("//dae:library_materials/dae:material",y,"material");aa=c("//dae:library_effects/dae:effect",B,"effect");S=c("//dae:library_geometries/dae:geometry",p,"geometry");R=c("//dae:library_controllers/dae:controller",h,"controller");U=c("//dae:library_animations/dae:animation",I,"animation");ba=c(".//dae:library_visual_scenes/dae:visual_scene",
-j,"visual_scene");W=[];X=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),T=ba[a]):T=null;Y=new THREE.Object3D;for(a=0;a<T.nodes.length;a++)Y.add(f(T.nodes[a]));b();for(var i in U);i={scene:Y,morphs:W,skins:X,dae:{images:Z,materials:$,effects:aa,geometries:S,controllers:R,animations:U,visualScenes:ba,scene:T}};d&&d(i);return i}function c(a,b,c){for(var a=P.evaluate(a,P,C,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 U)for(var e=U[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=R[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=T.getChildById(c.skeleton[0],!0)||T.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,n;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
-for(e=0;e<g.frames;e++){var m=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,m,e);h=m;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],n=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){n=p;break}if(n>=0){p=i.invBindMatrices[n];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==n&&j.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
-j.sid+"'.";}for(h=0;h<m.length;h++)if(m[h].type=="JOINT")for(i=0;i<m[h].weights.length;i++)j=m[h].weights[i],k=j.index,j=j.weight,n=a.vertices[k],k=o[k],l.x=n.position.x,l.y=n.position.y,l.z=n.position.z,m[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 f(a){var b=new THREE.Object3D,c,d,e,h;for(e=0;e<a.controllers.length;e++){var i=R[a.controllers[e].url];switch(i.type){case "skin":if(S[i.skin.source]){var j=
-new m;j.url=i.skin.source;j.instance_material=a.controllers[e].instance_material;a.geometries.push(j);c=a.controllers[e]}else if(R[i.skin.source]&&(d=i=R[i.skin.source],i.morph&&S[i.morph.source]))j=new m,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j);break;case "morph":if(S[i.morph.source])j=new m,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j),d=a.controllers[e];console.log("ColladaLoader: Morph-controller partially supported.")}}for(e=
-0;e<a.geometries.length;e++){var i=a.geometries[e],j=i.instance_material,i=S[i.url],k={},l=0,o;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++){o=j[h];var p=aa[$[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=k[o.symbol]=p.material;l++}j=o||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=R[c.url],j.skinInstanceController=c,j.name="skin_"+X.length,X.push(j);else if(d!==void 0){h=i;k=d instanceof n?R[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(p=S[k.targets[l]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
-h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+W.length;W.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(e=0;e<a.nodes.length;e++)b.add(f(a.nodes[e],a));return b}function e(){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 j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function q(){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 n(){this.url=
-"";this.skeleton=[];this.instance_material=[]}function s(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function l(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function r(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";this.stride=this.count=0;this.params=[]}function z(){this.input={}}function v(){this.semantic=
-"";this.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function y(){this.name=this.id="";this.instance_effect=null}function A(){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 F(a,b){this.type=a;this.effect=b;this.material=null}function u(a){this.effect=a;this.format=this.init_from=null}function D(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
-this.source=null}function B(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function G(){this.url=""}function I(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function E(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function K(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function O(a){var b=a.getAttribute("id");
-if(V[b]!=void 0)return V[b];V[b]=(new x(b)).parse(a);return V[b]}function C(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function L(a){for(var a=M(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=M(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function M(a){return a.replace(/^\s+/,"").replace(/\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 Q(a,b){var c="";c+=N(a.x,b)+",";c+=N(a.y,b)+",";c+=N(a.z,b);return c}var P=null,Y=null,T,ca=null,V={},Z={},U={},R={},S={},$={},aa={},ba,da,W,X,ea=THREE.SmoothShading;e.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 x).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 v).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=L(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 x).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 v).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 v).parse(g));break;case "v":c=H(g.textContent);break;case "vcount":d=H(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 n=e[l],m=c[g+n.offset];switch(n.semantic){case "JOINT":k.joint=m;break;case "WEIGHT":k.weight=b[n.source].data[m]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.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};j.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};j.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 q).parse(c))}}return this};q.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};q.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};q.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};q.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};q.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 q).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 m).parse(b));break;case "instance_light":break;case "instance_node":b=
-b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new q).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 U)for(var e=U[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};q.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=L(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};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=P.evaluate(".//dae:instance_material",c,C,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};m.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=P.evaluate(".//dae:instance_material",c,C,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};p.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 l(this)).parse(c)}}return this};l.prototype.parse=function(a){function b(a,c){var d=Q(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":O(d);break;case "vertices":this.vertices=(new z).parse(d);break;case "triangles":this.primitives.push((new t).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new r).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};l.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,n=0,m=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={},s=[];a.vcount&&(m=a.vcount[n++]);for(e=0;e<m;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=Q(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":s.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;m==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],s.length?s:new THREE.Color):m==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],s.length?s:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=r[o[f]],b.faceVertexUvs[f].push([e[0],
-e[1],e[2]]);d+=h.length*m}};r.prototype=new t;r.prototype.constructor=r;t.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};t.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 v).parse(a.childNodes[b]));break;case "vcount":this.vcount=
-H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};w.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};z.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 v).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};v.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};x.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=M(c.textContent).split(/\s+/),
-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=L(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=H(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=M(c.textContent).split(/\s+/);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 w).parse(c.childNodes[d]);break}}}return this};
-x.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};y.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 G).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return this.texture==null};A.prototype.isTexture=function(){return this.texture!=null};A.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=L(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};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 "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new A).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",c,C,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};F.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 A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=Z[this.effect.surface.init_from]))a.map=
-THREE.ImageUtils.loadTexture(da+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=ea;return this.material=new THREE.MeshLambertMaterial(a)};u.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};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 "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};B.prototype.create=function(){if(this.shader==null)return null};B.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};
-B.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 u(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new D(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};B.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};B.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 F(c.nodeName,this)).parse(c)}}};G.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};I.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 x).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new K(this)).parse(c));break;case "channel":this.channel.push((new E(this)).parse(c))}}return this};E.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};K.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 v).parse(c))}}return this};
-K.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))ca=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){ea=a},applySkin:g,geometries:S}};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.ColladaLoader=function(){function a(a,d,g){P=a;d=d||ia;g!==void 0&&(a=g.split("/"),a.pop(),ja=a.length<1?"":a.join("/")+"/");if((a=P.evaluate("//dae:asset",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.children)for(g=0;g<a.children.length;g++){var i=a.children[g];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":Z=i.textContent.charAt(0)}}if(!Q.convertUpAxis||Z===Q.upAxis)U=null;else switch(Z){case "X":U=Q.upAxis==="Y"?"XtoY":
+"XtoZ";break;case "Y":U=Q.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":U=Q.upAxis==="X"?"ZtoX":"ZtoY"}ca=c("//dae:library_images/dae:image",e,"image");da=c("//dae:library_materials/dae:material",y,"material");ea=c("//dae:library_effects/dae:effect",B,"effect");V=c("//dae:library_geometries/dae:geometry",p,"geometry");T=c("//dae:library_controllers/dae:controller",h,"controller");W=c("//dae:library_animations/dae:animation",J,"animation");fa=c(".//dae:library_visual_scenes/dae:visual_scene",j,"visual_scene");
+$=[];aa=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=fa[a]):S=null;X=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)X.add(f(S.nodes[a]));ga=[];b(X);a={scene:X,morphs:$,skins:aa,animations:ga,dae:{images:ca,materials:da,effects:ea,geometries:V,controllers:T,animations:W,visualScenes:fa,scene:S}};d&&d(a);return a}function c(a,b,c){for(var a=P.evaluate(a,P,C,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(a){var c=S.getChildById(a.name,!0),d=null;if(c&&c.keys){d={fps:60,hierarchy:[{node:c,keys:c.keys,sids:c.sids}],node:a,name:"animation_"+a.name,length:0};ga.push(d);for(var e=0,f=c.keys.length;e<f;e++)d.length=Math.max(d.length,c.keys[e].time)}else d={hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var c=0,g=b(a.children[e]).hierarchy.length;c<
+g;c++)d.hierarchy.push({keys:[],sids:[]});return d}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,b,c){var e=T[b.url];if(!e||!e.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");
+else{var f,c=1E6,g=-c,h=0;for(f in W)for(var i=W[f],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}f={start:c,end:g,frames:h};for(var b=S.getChildById(b.skeleton[0],!0)||S.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,n,j=0;j<a.vertices.length;j++)e.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);for(c=0;c<f.frames;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));
+d(b,h,c);j=h;k=e.skin;for(m=0;m<j.length;m++)if(l=j[m],n=-1,l.type=="JOINT"){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(n>=0){o=k.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<k.weights.length;o++)for(var p=0;p<k.weights[o].length;p++){var r=k.weights[o][p];r.joint==n&&l.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+l.sid+"'.";}for(j=0;j<h.length;j++)if(h[j].type==
+"JOINT")for(k=0;k<h[j].weights.length;k++)l=h[j].weights[k],m=l.index,l=l.weight,n=a.vertices[m],m=i[m],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*l,m.position.y+=g.y*l,m.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function f(a){var b=new THREE.Object3D,c,d,e,h;for(e=0;e<a.controllers.length;e++){var i=T[a.controllers[e].url];switch(i.type){case "skin":if(V[i.skin.source]){var j=new n;j.url=i.skin.source;j.instance_material=
+a.controllers[e].instance_material;a.geometries.push(j);c=a.controllers[e]}else if(T[i.skin.source]&&(d=i=T[i.skin.source],i.morph&&V[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j);break;case "morph":if(V[i.morph.source])j=new n,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j),d=a.controllers[e];console.log("ColladaLoader: Morph-controller partially supported.")}}for(e=0;e<a.geometries.length;e++){var i=
+a.geometries[e],j=i.instance_material,i=V[i.url],k={},l=[],m=0,p;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++){p=j[h];var r=ea[da[p.target].instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;k[p.symbol]=m;l.push(r.material);p=r.material;m++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(m>1){j=new THREE.MeshFaceMaterial;i.materials=l;for(h=0;h<i.faces.length;h++)l=
+i.faces[h],l.materialIndex=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=T[c.url],j.skinInstanceController=c,j.name="skin_"+aa.length,aa.push(j);else if(d!==void 0){h=i;k=d instanceof o?T[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(m=V[k.targets[l]],m.mesh&&m.mesh.primitives&&m.mesh.primitives.length)m=m.mesh.primitives[0].geometry,m.vertices.length===
+h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:m.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+$.length;$.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";b.matrix=a.matrix;c=a.matrix.decompose();b.position=c[0];b.quaternion=c[1];b.useQuaternion=!0;b.scale=c[2];for(e=0;e<a.nodes.length;e++)b.add(f(a.nodes[e],a));return b}function e(){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 j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function r(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function m(){this.type=this.sid="";this.data=
+[];this.obj=null}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function s(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function l(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function q(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";this.stride=this.count=0;this.params=[]}
+function A(){this.input={}}function v(){this.semantic="";this.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function y(){this.name=this.id="";this.instance_effect=null}function z(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function F(a,b){this.type=a;this.effect=b;this.material=null}function u(a){this.effect=a;this.format=this.init_from=null}function D(a){this.effect=
+a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function B(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function G(){this.url=""}function J(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function E(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function L(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=
+this.strideOut=this.output=this.input=null;this.duration=0}function O(a){this.targets=[];this.time=a}function C(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function M(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function N(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function K(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),
+10):c}function I(a,b){if(Q.convertUpAxis&&Z!==Q.upAxis)switch(U){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function R(a,b){var c=[a[b],a[b+1],a[b+2]];I(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ba(a){if(Q.convertUpAxis){var b=[a[0],a[4],a[8]];I(b,-1);
+a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];I(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];I(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];I(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];I(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];I(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];I(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var P=null,
+X=null,S,ia=null,Y={},ca={},W={},T={},V={},da={},ea={},ga,fa,ja,$,aa,ka=THREE.SmoothShading,Q={convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Z="Y",U=null,ha=Math.PI/180;e.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 x).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 v).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=M(f.textContent);this.bindShapeMatrix=ba(f);break;case "source":f=(new x).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 v).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 v).parse(g));break;case "v":c=H(g.textContent);break;case "vcount":d=H(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)}};j.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};j.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};j.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 r).parse(c))}}return this};r.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};r.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};r.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};r.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};r.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 r).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new o).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new r).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new m).parse(b));
+break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in W)for(var e=W[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=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(Q.convertUpAxis)switch(g){case "X":switch(U){case "XtoY":case "XtoZ":case "YtoX":g=
+"Y";break;case "ZtoX":g="Z"}break;case "Y":switch(U){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(U){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(var k=i.length;b<k;b++){var l=i[b],p=h.getData(j.type,b),q;q=null;for(var s=0,t=d.length;s<t&&q==null;s++){var u=d[s];if(u.time===l)q=u;else if(u.time>l)break}if(!q){q=
+new O(l);s=-1;t=0;for(u=d.length;t<u&&s==-1;t++)d[t].time>=l&&(s=t);l=s;d.splice(l==-1?d.length:l,0,q)}q.addTarget(f,j,g,p)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(q=d[b],!q.hasTarget(e)){h=d;f=q;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=i>=0?i:i+h.length;i>=0;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-
+i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;p=void 0;if(k.length){p=[];for(l=0;l<k.length;++l)p[l]=k[l]+(j[l]-k[l])*h}else p=k+(j-k)*h;f.addTarget(g,i.transform,i.member,p)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};r.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};m.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=M(a.textContent);this.convert();
+return this};m.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ba(this.data);break;case "rotate":this.angle=this.data[3]*ha;case "translate":I(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":I(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};m.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);
+break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};m.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=
+a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*ha;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*ha}}};o.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=P.evaluate(".//dae:instance_material",
+c,C,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};n.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=
+P.evaluate(".//dae:instance_material",c,C,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};p.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 l(this)).parse(c)}}return this};l.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+switch(c.nodeName){case "source":var d=c.getAttribute("id");Y[d]==void 0&&(Y[d]=(new x(d)).parse(c));break;case "vertices":this.vertices=(new A).parse(c);break;case "triangles":this.primitives.push((new t).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new q).parse(c))}}this.geometry3js=new THREE.Geometry;a=Y[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(R(a,
+b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};l.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,l=0,m=3,n=[];for(d=0;d<g.length;d++)switch(h=g[d],h.semantic){case "TEXCOORD":n.push(h.set)}for(;c<f.length;){var o=[],p=[],
+r={},q=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=Y[h.source],i=f[c+d*g.length+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":o.push(i);break;case "NORMAL":p.push(R(k.data,j));break;case "TEXCOORD":r[h.set]===void 0&&(r[h.set]=[]);r[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":q.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(m===3)d.push(new THREE.Face3(o[0],o[1],o[2],[p[0],p[1],
+p[2]],q.length?q:new THREE.Color));else if(m===4)d.push(new THREE.Face4(o[0],o[1],o[2],o[3],[p[0],p[1],p[2],p[3]],q.length?q:new THREE.Color));else if(m>4&&Q.subdivideFaces){q=q.length?q:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(o[0],o[e],o[e+1],[p[0],p[e++],p[e]],q))}if(d.length){o=0;for(p=d.length;o<p;o++){e=d[o];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<n.length;e++)q=r[n[e]],q=m>4?[q[0],q[o+1],q[o+2]]:m===4?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=
+[]),b.faceVertexUvs[e].push(q)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=g.length*m}};q.prototype=new t;q.prototype.constructor=q;t.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};t.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=K(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 v).parse(a.childNodes[b]));
+break;case "vcount":this.vcount=H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=K(a,"count",0);this.stride=K(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};A.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 v).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};v.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=K(a,"set",-1);this.offset=K(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};x.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=N(c.textContent).split(/\s+/),
+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=M(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=H(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=N(c.textContent).split(/\s+/);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 w).parse(c.childNodes[d]);break}}}return this};
+x.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),c=ba(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};y.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 G).parse(a.childNodes[b]);break}return this};z.prototype.isColor=function(){return this.texture==null};z.prototype.isTexture=function(){return this.texture!=null};z.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=M(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"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};z.prototype.parseTexture=function(a){if(!a.children)return this;a.children[0]&&a.children[0].nodeName==="extra"&&(a=a.children[0],a.children[0]&&a.children[0].nodeName==="technique"&&(a=a.children[0]));for(var b=0;b<a.children.length;b++){var c=a.children[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=
+parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};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 "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new z).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",
+c,C,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};F.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 z)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
+this.effect.surface.sid){var e=ca[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(ja+e.init_from),e.wrapS=d.texOpts.wrapU,e.wrapT=d.texOpts.wrapV,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}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=ka;return this.material=
+new THREE.MeshLambertMaterial(a)};u.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};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 "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};B.prototype.create=function(){if(this.shader==null)return null};B.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};B.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 u(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new D(this)).parse(d);this.sampler.sid=b;break;case "extra":break;
+default:console.log(d.nodeName)}}};B.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};B.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 F(c.nodeName,this)).parse(c)}}};G.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};J.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 x).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new L(this)).parse(c));break;case "channel":this.channel.push((new E(this)).parse(c))}}return this};
+E.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;if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};L.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 v).parse(c))}}return this};L.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();this.strideOut=c.accessor.stride;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}};L.prototype.getData=function(a,b){var c;if(this.strideOut>1){c=[];b*=this.strideOut;for(var d=0;d<this.strideOut;++d)c[d]=this.output[b+
+d];if(this.strideOut===3)switch(a){case "rotate":case "translate":I(c,-1);break;case "scale":I(c,1)}}else c=this.output[b];return c};O.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};O.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};O.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};
+O.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};O.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(a.time-this.time),g=e.data,h=d.data;if(f<0||f>1)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=f<0?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,
+d.member)}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==200))d.responseXML?(ia=c,a(d.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ka=a},applySkin:g,
+geometries:V,options:Q}};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){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),b=a,a=b.model,c=b.callback,b=b.texture_path;b=b?b:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,c,b)};
-THREE.JSONLoader.prototype.loadAjaxJSON=function(a,c,b,d,g){var f=new XMLHttpRequest,e=0;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);a.createModel(h,b,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+f.status+"]");else f.readyState==3?g&&(e==0&&(e=f.getResponseHeader("Content-Length")),g({total:e,loaded:f.responseText.length})):
+THREE.JSONLoader.prototype.loadAjaxJSON=function(a,c,b,d,g){var f=new XMLHttpRequest,e=0;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0){try{var h=JSON.parse(f.responseText)}catch(i){console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}a.createModel(h,b,d);a.onLoadComplete()}else console.error("Couldn't load ["+c+"] ["+f.status+"]");else f.readyState==3?g&&(e==0&&(e=f.getResponseHeader("Content-Length")),g({total:e,loaded:f.responseText.length})):
 f.readyState==2&&(e=f.getResponseHeader("Content-Length"))};f.open("GET",c,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-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.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,i,k,j,q,o,n,s,m,p,l,r,t,w=a.faces;q=a.vertices;var z=a.normals,v=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=q.length;k<
-j;)o=new THREE.Vertex,o.position.x=q[k++]*b,o.position.y=q[k++]*b,o.position.z=q[k++]*b,d.vertices.push(o);k=0;for(j=w.length;k<j;){b=w[k++];q=b&1;i=b&2;c=b&4;g=b&8;n=b&16;o=b&32;m=b&64;b&=128;q?(p=new THREE.Face4,p.a=w[k++],p.b=w[k++],p.c=w[k++],p.d=w[k++],q=4):(p=new THREE.Face3,p.a=w[k++],p.b=w[k++],p.c=w[k++],q=3);if(i)i=w[k++],p.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)l=a.uvs[c],s=w[k++],t=l[s*2],s=l[s*2+1],d.faceUvs[c][i]=new THREE.UV(t,s);if(g)for(c=0;c<x;c++){l=a.uvs[c];r=[];
-for(g=0;g<q;g++)s=w[k++],t=l[s*2],s=l[s*2+1],r[g]=new THREE.UV(t,s);d.faceVertexUvs[c][i]=r}if(n)n=w[k++]*3,g=new THREE.Vector3,g.x=z[n++],g.y=z[n++],g.z=z[n],p.normal=g;if(o)for(c=0;c<q;c++)n=w[k++]*3,g=new THREE.Vector3,g.x=z[n++],g.y=z[n++],g.z=z[n],p.vertexNormals.push(g);if(m)o=w[k++],o=new THREE.Color(v[o]),p.color=o;if(b)for(c=0;c<q;c++)o=w[k++],o=new THREE.Color(v[o]),p.vertexColors.push(o);d.faces.push(p)}}})(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,j,q,o,n,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=[];n=d.morphTargets[c].vertices;
-s=a.morphTargets[c].vertices;i=0;for(k=s.length;i<k;i+=3)j=s[i]*b,q=s[i+1]*b,o=s[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(j,q,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;j=a.morphColors[c].colors;b=0;for(i=j.length;b<i;b+=3)q=new THREE.Color(16755200),q.setRGB(j[b],j[b+1],j[b+2]),k.push(q)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(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.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,i,k,j,r,m,o,s,n,p,l,q,t,w=a.faces;r=a.vertices;var A=a.normals,v=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=r.length;k<
+j;)m=new THREE.Vertex,m.position.x=r[k++]*b,m.position.y=r[k++]*b,m.position.z=r[k++]*b,d.vertices.push(m);k=0;for(j=w.length;k<j;){b=w[k++];r=b&1;i=b&2;c=b&4;g=b&8;o=b&16;m=b&32;n=b&64;b&=128;r?(p=new THREE.Face4,p.a=w[k++],p.b=w[k++],p.c=w[k++],p.d=w[k++],r=4):(p=new THREE.Face3,p.a=w[k++],p.b=w[k++],p.c=w[k++],r=3);if(i)i=w[k++],p.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)l=a.uvs[c],s=w[k++],t=l[s*2],s=l[s*2+1],d.faceUvs[c][i]=new THREE.UV(t,s);if(g)for(c=0;c<x;c++){l=a.uvs[c];q=[];
+for(g=0;g<r;g++)s=w[k++],t=l[s*2],s=l[s*2+1],q[g]=new THREE.UV(t,s);d.faceVertexUvs[c][i]=q}if(o)o=w[k++]*3,g=new THREE.Vector3,g.x=A[o++],g.y=A[o++],g.z=A[o],p.normal=g;if(m)for(c=0;c<r;c++)o=w[k++]*3,g=new THREE.Vector3,g.x=A[o++],g.y=A[o++],g.z=A[o],p.vertexNormals.push(g);if(n)m=w[k++],m=new THREE.Color(v[m]),p.color=m;if(b)for(c=0;c<r;c++)m=w[k++],m=new THREE.Color(v[m]),p.vertexColors.push(m);d.faces.push(p)}}})(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,j,r,m,o,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=[];o=d.morphTargets[c].vertices;
+s=a.morphTargets[c].vertices;i=0;for(k=s.length;i<k;i+=3)j=s[i]*b,r=s[i+1]*b,m=s[i+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(j,r,m)))}}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;j=a.morphColors[c].colors;b=0;for(i=j.length;b<i;b+=3)r=new THREE.Color(16755200),r.setRGB(j[b],j[b+1],j[b+2]),k.push(r)}}})(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.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,c){var b=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var g=JSON.parse(d.responseText);g.metadata===void 0||g.metadata.formatVersion===void 0||g.metadata.formatVersion!==3?console.error("Deprecated file format."):b.createScene(g,c,a)}catch(f){console.error(f),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
 d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function g(){var a;for(o in B.objects)if(!C.objects[o])if(l=B.objects[o],l.geometry!==void 0){if(A=C.geometries[l.geometry]){a=!1;for(H=0;H<l.materials.length;H++)D=C.materials[l.materials[H]],a=D instanceof THREE.ShaderMaterial;a&&A.computeTangents();w=l.position;z=l.rotation;v=l.quaternion;x=l.scale;v=0;D.length==0&&(D=new THREE.MeshFaceMaterial);D.length>1&&(D=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(A,D);a.name=o;a.position.set(w[0],w[1],w[2]);v?(a.quaternion.set(v[0],v[1],v[2],v[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]);a.scale.set(x[0],x[1],x[2]);a.visible=l.visible;C.scene.add(a);C.objects[o]=a;if(l.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(l.castsShadow)b=new THREE.ShadowVolume(A),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;l.trigger&&l.trigger.toLowerCase()!="none"&&(b=
-{type:l.trigger,object:l},C.triggers[a.name]=b)}}else w=l.position,z=l.rotation,v=l.quaternion,x=l.scale,v=0,a=new THREE.Object3D,a.name=o,a.position.set(w[0],w[1],w[2]),v?(a.quaternion.set(v[0],v[1],v[2],v[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]),a.scale.set(x[0],x[1],x[2]),a.visible=l.visible!==void 0?l.visible:!1,C.scene.add(a),C.objects[o]=a,C.empties[o]=a,l.trigger&&l.trigger.toLowerCase()!="none"&&(b={type:l.trigger,object:l},C.triggers[a.name]=b)}function f(a){return function(b){C.geometries[a]=
-b;g();I-=1;i.onLoadComplete();h()}}function e(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:K,totalTextures:O,loadedModels:K-I,loadedTextures:O-E},C);i.onLoadProgress();I==0&&E==0&&c(C)}var i=this,k=THREE.Loader.prototype.extractUrlbase(b),j,q,o,n,s,m,p,l,r,t,w,z,v,x,y,A,F,u,D,B,G,I,E,K,O,C;B=a;b=new THREE.BinaryLoader;G=new THREE.JSONLoader;E=I=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
-empties:{}};a=!1;for(o in B.objects)if(l=B.objects[o],l.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(B.transform){a=B.transform.position;r=B.transform.rotation;var L=B.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);r&&C.scene.rotation.set(r[0],r[1],r[2]);L&&C.scene.scale.set(L[0],L[1],L[2]);(a||r||L)&&C.scene.updateMatrix()}a=function(){E-=1;h();i.onLoadComplete()};for(s in B.cameras)r=B.cameras[s],r.type=="perspective"?F=new THREE.PerspectiveCamera(r.fov,
-r.aspect,r.near,r.far):r.type=="ortho"&&(F=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),w=r.position,r=r.target,F.position.set(w[0],w[1],w[2]),F.target=new THREE.Vector3(r[0],r[1],r[2]),C.cameras[s]=F;for(n in B.lights)r=B.lights[n],s=r.color!==void 0?r.color:16777215,F=r.intensity!==void 0?r.intensity:1,r.type=="directional"?(w=r.direction,t=new THREE.DirectionalLight(s,F),t.position.set(w[0],w[1],w[2]),t.position.normalize()):r.type=="point"?(w=r.position,t=r.distance,
-t=new THREE.PointLight(s,F,t),t.position.set(w[0],w[1],w[2])):r.type=="ambient"&&(t=new THREE.AmbientLight(s)),C.scene.add(t),C.lights[n]=t;for(m in B.fogs)n=B.fogs[m],n.type=="linear"?u=new THREE.Fog(0,n.near,n.far):n.type=="exp2"&&(u=new THREE.FogExp2(0,n.density)),r=n.color,u.color.setRGB(r[0],r[1],r[2]),C.fogs[m]=u;if(C.cameras&&B.defaults.camera)C.currentCamera=C.cameras[B.defaults.camera];if(C.fogs&&B.defaults.fog)C.scene.fog=C.fogs[B.defaults.fog];r=B.defaults.bgcolor;C.bgColor=new THREE.Color;
-C.bgColor.setRGB(r[0],r[1],r[2]);C.bgColorAlpha=B.defaults.bgalpha;for(j in B.geometries)if(m=B.geometries[j],m.type=="bin_mesh"||m.type=="ascii_mesh")I+=1,i.onLoadStart();K=I;for(j in B.geometries)m=B.geometries[j],m.type=="cube"?(A=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),C.geometries[j]=A):m.type=="plane"?(A=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),C.geometries[j]=A):m.type=="sphere"?
-(A=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),C.geometries[j]=A):m.type=="cylinder"?(A=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),C.geometries[j]=A):m.type=="torus"?(A=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),C.geometries[j]=A):m.type=="icosahedron"?(A=new THREE.IcosahedronGeometry(m.subdivisions),C.geometries[j]=A):m.type=="bin_mesh"?b.load(d(m.url,B.urlBaseType),f(j)):m.type=="ascii_mesh"?G.load(d(m.url,B.urlBaseType),
-f(j)):m.type=="embedded_mesh"&&(m=B.embeds[m.id])&&G.createModel(m,e(j),"");for(p in B.textures)if(j=B.textures[p],j.url instanceof Array){E+=j.url.length;for(m=0;m<j.url.length;m++)i.onLoadStart()}else E+=1,i.onLoadStart();O=E;for(p in B.textures){j=B.textures[p];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){m=[];for(var H=0;H<j.url.length;H++)m[H]=d(j.url[H],B.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,j.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(j.url,
-B.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)m.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)m.magFilter=THREE[j.magFilter];if(j.repeat){m.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)m.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)m.wrapT=THREE.RepeatWrapping}j.offset&&m.offset.set(j.offset[0],j.offset[1]);if(j.wrap){u={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(u[j.wrap[0]]!==void 0)m.wrapS=u[j.wrap[0]];if(u[j.wrap[1]]!==void 0)m.wrapT=
-u[j.wrap[1]]}}C.textures[p]=m}for(q in B.materials){p=B.materials[q];for(y in p.parameters)if(y=="envMap"||y=="map"||y=="lightMap")p.parameters[y]=C.textures[p.parameters[y]];else if(y=="shading")p.parameters[y]=p.parameters[y]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(y=="blending")p.parameters[y]=THREE[p.parameters[y]]?THREE[p.parameters[y]]:THREE.NormalBlending;else if(y=="combine")p.parameters[y]=p.parameters[y]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(y==
-"vertexColors")if(p.parameters[y]=="face")p.parameters[y]=THREE.FaceColors;else if(p.parameters[y])p.parameters[y]=THREE.VertexColors;if(p.parameters.opacity!==void 0&&p.parameters.opacity<1)p.parameters.transparent=!0;if(p.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);m=p.parameters.color;u=p.parameters.specular;b=p.parameters.ambient;G=p.parameters.shininess;a.tNormal.texture=C.textures[p.parameters.normalMap];if(p.parameters.normalMapFactor)a.uNormalScale.value=
-p.parameters.normalMapFactor;if(p.parameters.map)a.tDiffuse.texture=p.parameters.map,a.enableDiffuse.value=!0;if(p.parameters.lightMap)a.tAO.texture=p.parameters.lightMap,a.enableAO.value=!0;if(p.parameters.specularMap)a.tSpecular.texture=C.textures[p.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(u);a.uAmbientColor.value.setHex(b);a.uShininess.value=G;if(p.parameters.opacity)a.uOpacity.value=p.parameters.opacity;p=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
-vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else p=new THREE[p.type](p.parameters);C.materials[q]=p}g();i.callbackSync(C);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function g(){var a;for(m in B.objects)if(!C.objects[m])if(l=B.objects[m],l.geometry!==void 0){if(z=C.geometries[l.geometry]){a=!1;for(H=0;H<l.materials.length;H++)D=C.materials[l.materials[H]],a=D instanceof THREE.ShaderMaterial;a&&z.computeTangents();w=l.position;A=l.rotation;v=l.quaternion;x=l.scale;v=0;D.length==0&&(D=new THREE.MeshFaceMaterial);D.length>1&&(D=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(z,D);a.name=m;a.position.set(w[0],w[1],w[2]);v?(a.quaternion.set(v[0],v[1],v[2],v[3]),a.useQuaternion=!0):a.rotation.set(A[0],A[1],A[2]);a.scale.set(x[0],x[1],x[2]);a.visible=l.visible;C.scene.add(a);C.objects[m]=a;if(l.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(l.castsShadow)b=new THREE.ShadowVolume(z),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;l.trigger&&l.trigger.toLowerCase()!="none"&&(b=
+{type:l.trigger,object:l},C.triggers[a.name]=b)}}else w=l.position,A=l.rotation,v=l.quaternion,x=l.scale,v=0,a=new THREE.Object3D,a.name=m,a.position.set(w[0],w[1],w[2]),v?(a.quaternion.set(v[0],v[1],v[2],v[3]),a.useQuaternion=!0):a.rotation.set(A[0],A[1],A[2]),a.scale.set(x[0],x[1],x[2]),a.visible=l.visible!==void 0?l.visible:!1,C.scene.add(a),C.objects[m]=a,C.empties[m]=a,l.trigger&&l.trigger.toLowerCase()!="none"&&(b={type:l.trigger,object:l},C.triggers[a.name]=b)}function f(a){return function(b){C.geometries[a]=
+b;g();J-=1;i.onLoadComplete();h()}}function e(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:L,totalTextures:O,loadedModels:L-J,loadedTextures:O-E},C);i.onLoadProgress();J==0&&E==0&&c(C)}var i=this,k=THREE.Loader.prototype.extractUrlbase(b),j,r,m,o,s,n,p,l,q,t,w,A,v,x,y,z,F,u,D,B,G,J,E,L,O,C;B=a;b=new THREE.BinaryLoader;G=new THREE.JSONLoader;E=J=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+empties:{}};a=!1;for(m in B.objects)if(l=B.objects[m],l.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(B.transform){a=B.transform.position;q=B.transform.rotation;var M=B.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);q&&C.scene.rotation.set(q[0],q[1],q[2]);M&&C.scene.scale.set(M[0],M[1],M[2]);(a||q||M)&&C.scene.updateMatrix()}a=function(){E-=1;h();i.onLoadComplete()};for(s in B.cameras)q=B.cameras[s],q.type=="perspective"?F=new THREE.PerspectiveCamera(q.fov,
+q.aspect,q.near,q.far):q.type=="ortho"&&(F=new THREE.OrthographicCamera(q.left,q.right,q.top,q.bottom,q.near,q.far)),w=q.position,q=q.target,F.position.set(w[0],w[1],w[2]),F.target=new THREE.Vector3(q[0],q[1],q[2]),C.cameras[s]=F;for(o in B.lights)q=B.lights[o],s=q.color!==void 0?q.color:16777215,F=q.intensity!==void 0?q.intensity:1,q.type=="directional"?(w=q.direction,t=new THREE.DirectionalLight(s,F),t.position.set(w[0],w[1],w[2]),t.position.normalize()):q.type=="point"?(w=q.position,t=q.distance,
+t=new THREE.PointLight(s,F,t),t.position.set(w[0],w[1],w[2])):q.type=="ambient"&&(t=new THREE.AmbientLight(s)),C.scene.add(t),C.lights[o]=t;for(n in B.fogs)o=B.fogs[n],o.type=="linear"?u=new THREE.Fog(0,o.near,o.far):o.type=="exp2"&&(u=new THREE.FogExp2(0,o.density)),q=o.color,u.color.setRGB(q[0],q[1],q[2]),C.fogs[n]=u;if(C.cameras&&B.defaults.camera)C.currentCamera=C.cameras[B.defaults.camera];if(C.fogs&&B.defaults.fog)C.scene.fog=C.fogs[B.defaults.fog];q=B.defaults.bgcolor;C.bgColor=new THREE.Color;
+C.bgColor.setRGB(q[0],q[1],q[2]);C.bgColorAlpha=B.defaults.bgalpha;for(j in B.geometries)if(n=B.geometries[j],n.type=="bin_mesh"||n.type=="ascii_mesh")J+=1,i.onLoadStart();L=J;for(j in B.geometries)n=B.geometries[j],n.type=="cube"?(z=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),C.geometries[j]=z):n.type=="plane"?(z=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),C.geometries[j]=z):n.type=="sphere"?
+(z=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),C.geometries[j]=z):n.type=="cylinder"?(z=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),C.geometries[j]=z):n.type=="torus"?(z=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),C.geometries[j]=z):n.type=="icosahedron"?(z=new THREE.IcosahedronGeometry(n.subdivisions),C.geometries[j]=z):n.type=="bin_mesh"?b.load(d(n.url,B.urlBaseType),f(j)):n.type=="ascii_mesh"?G.load(d(n.url,B.urlBaseType),
+f(j)):n.type=="embedded_mesh"&&(n=B.embeds[n.id])&&G.createModel(n,e(j),"");for(p in B.textures)if(j=B.textures[p],j.url instanceof Array){E+=j.url.length;for(n=0;n<j.url.length;n++)i.onLoadStart()}else E+=1,i.onLoadStart();O=E;for(p in B.textures){j=B.textures[p];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){n=[];for(var H=0;H<j.url.length;H++)n[H]=d(j.url[H],B.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,j.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(j.url,
+B.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)n.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)n.magFilter=THREE[j.magFilter];if(j.repeat){n.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}j.offset&&n.offset.set(j.offset[0],j.offset[1]);if(j.wrap){u={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(u[j.wrap[0]]!==void 0)n.wrapS=u[j.wrap[0]];if(u[j.wrap[1]]!==void 0)n.wrapT=
+u[j.wrap[1]]}}C.textures[p]=n}for(r in B.materials){p=B.materials[r];for(y in p.parameters)if(y=="envMap"||y=="map"||y=="lightMap")p.parameters[y]=C.textures[p.parameters[y]];else if(y=="shading")p.parameters[y]=p.parameters[y]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(y=="blending")p.parameters[y]=THREE[p.parameters[y]]?THREE[p.parameters[y]]:THREE.NormalBlending;else if(y=="combine")p.parameters[y]=p.parameters[y]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(y==
+"vertexColors")if(p.parameters[y]=="face")p.parameters[y]=THREE.FaceColors;else if(p.parameters[y])p.parameters[y]=THREE.VertexColors;if(p.parameters.opacity!==void 0&&p.parameters.opacity<1)p.parameters.transparent=!0;if(p.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);n=p.parameters.color;u=p.parameters.specular;b=p.parameters.ambient;G=p.parameters.shininess;a.tNormal.texture=C.textures[p.parameters.normalMap];if(p.parameters.normalMapFactor)a.uNormalScale.value=
+p.parameters.normalMapFactor;if(p.parameters.map)a.tDiffuse.texture=p.parameters.map,a.enableDiffuse.value=!0;if(p.parameters.lightMap)a.tAO.texture=p.parameters.lightMap,a.enableAO.value=!0;if(p.parameters.specularMap)a.tSpecular.texture=C.textures[p.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(u);a.uAmbientColor.value.setHex(b);a.uShininess.value=G;if(p.parameters.opacity)a.uOpacity.value=p.parameters.opacity;p=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
+vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else p=new THREE[p.type](p.parameters);C.materials[r]=p}g();i.callbackSync(C);h()};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,f=b.offsetX!==void 0?b.offsetX:0,e=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,f,e,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 f=0,e=0;e<c;++e){var h=a.charCodeAt(e+d);f+=h>>1^-(h&1);b[8*e+g]=f}d+=c}c=a.length-d;f=new Uint16Array(c);for(g=e=0;g<c;g++)h=a.charCodeAt(g+d),f[g]=e-h,h==0&&e++;return[b,f]};
 THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,f){var e=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var e=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,e,i){for(var j,k,p,l=a.length;i<l;i+=e)j=a[i],k=a[i+1],p=a[i+2],j=j/16383*b,k=k/16383*b,p=p/16383*b,j+=d,k+=g,p+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,p)))})(e[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,j.push(d,1-e)})(e[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)})(e[0],8,5);(function(a){var b,d,e,f,g,i,r,t,w,z=a.length;for(b=0;b<z;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;t=d;w=e;i=f;r=d;var v=e,x=f,y=g.materials[0],A=k[v*3],F=k[v*3+1],v=k[v*3+2],u=k[x*3],D=k[x*3+1],x=k[x*3+2];r=new THREE.Vector3(k[r*3],k[r*3+1],k[r*3+2]);v=new THREE.Vector3(A,F,v);x=new THREE.Vector3(u,D,x);g.faces.push(new THREE.Face3(t,w,i,[r,v,x],null,y));g=j[d*2];d=j[d*2+
-1];i=j[e*2];r=j[e*2+1];t=j[f*2];w=j[f*2+1];f=c.faceVertexUvs[0];e=i;i=r;r=[];r.push(new THREE.UV(g,d));r.push(new THREE.UV(e,i));r.push(new THREE.UV(t,w));f.push(r)}})(e[1]);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e)};
+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)})(e[0],8,5);(function(a){var b,d,e,f,g,i,q,t,w,A=a.length;for(b=0;b<A;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;t=d;w=e;i=f;q=d;var v=e,x=f,y=g.materials[0],z=k[v*3],F=k[v*3+1],v=k[v*3+2],u=k[x*3],D=k[x*3+1],x=k[x*3+2];q=new THREE.Vector3(k[q*3],k[q*3+1],k[q*3+2]);v=new THREE.Vector3(z,F,v);x=new THREE.Vector3(u,D,x);g.faces.push(new THREE.Face3(t,w,i,[q,v,x],null,y));g=j[d*2];d=j[d*2+
+1];i=j[e*2];q=j[e*2+1];t=j[f*2];w=j[f*2+1];f=c.faceVertexUvs[0];e=i;i=q;q=[];q.push(new THREE.UV(g,d));q.push(new THREE.UV(e,i));q.push(new THREE.UV(t,w));f.push(q)}})(e[1]);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e)};
 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.material=c;this.init=function(a){this.resolution=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,f,e,h,i,k,j,q){e=(e-j)/(q-j);j=this.normal_cache;c[f]=h+e*this.delta;c[f+1]=i;c[f+2]=k;g[f]=this.lerp(j[a],j[a+3],e);g[f+1]=this.lerp(j[a+1],j[a+4],e);g[f+2]=this.lerp(j[a+2],j[a+5],e)};this.VIntY=function(a,c,g,f,e,h,i,k,j,q){e=(e-j)/(q-j);j=this.normal_cache;c[f]=h;c[f+1]=i+e*this.delta;c[f+2]=k;c=a+this.yd*
-3;g[f]=this.lerp(j[a],j[c],e);g[f+1]=this.lerp(j[a+1],j[c+1],e);g[f+2]=this.lerp(j[a+2],j[c+2],e)};this.VIntZ=function(a,c,g,f,e,h,i,k,j,q){e=(e-j)/(q-j);j=this.normal_cache;c[f]=h;c[f+1]=i;c[f+2]=k+e*this.delta;c=a+this.zd*3;g[f]=this.lerp(j[a],j[c],e);g[f+1]=this.lerp(j[a+1],j[c+1],e);g[f+2]=this.lerp(j[a+2],j[c+2],e)};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,f,e,h){var i=f+1,k=f+this.yd,j=f+this.zd,q=i+this.yd,o=i+this.zd,n=f+this.yd+this.zd,s=i+this.yd+this.zd,m=0,p=this.field[f],l=this.field[i],r=this.field[k],t=this.field[q],w=this.field[j],z=this.field[o],v=this.field[n],x=this.field[s];p<e&&(m|=1);l<e&&(m|=2);r<e&&(m|=8);t<e&&(m|=4);w<e&&(m|=16);z<e&&(m|=32);v<e&&(m|=128);x<e&&(m|=64);var y=THREE.edgeTable[m];if(y===0)return 0;var A=this.delta,F=a+
-A,u=c+A,A=g+A;y&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(f*3,this.vlist,this.nlist,0,e,a,c,g,p,l));y&2&&(this.compNorm(i),this.compNorm(q),this.VIntY(i*3,this.vlist,this.nlist,3,e,F,c,g,l,t));y&4&&(this.compNorm(k),this.compNorm(q),this.VIntX(k*3,this.vlist,this.nlist,6,e,a,u,g,r,t));y&8&&(this.compNorm(f),this.compNorm(k),this.VIntY(f*3,this.vlist,this.nlist,9,e,a,c,g,p,r));y&16&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,12,e,a,c,A,w,z));y&32&&(this.compNorm(o),
-this.compNorm(s),this.VIntY(o*3,this.vlist,this.nlist,15,e,F,c,A,z,x));y&64&&(this.compNorm(n),this.compNorm(s),this.VIntX(n*3,this.vlist,this.nlist,18,e,a,u,A,v,x));y&128&&(this.compNorm(j),this.compNorm(n),this.VIntY(j*3,this.vlist,this.nlist,21,e,a,c,A,w,v));y&256&&(this.compNorm(f),this.compNorm(j),this.VIntZ(f*3,this.vlist,this.nlist,24,e,a,c,g,p,w));y&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,e,F,c,g,l,z));y&1024&&(this.compNorm(q),this.compNorm(s),this.VIntZ(q*
-3,this.vlist,this.nlist,30,e,F,u,g,t,x));y&2048&&(this.compNorm(k),this.compNorm(n),this.VIntZ(k*3,this.vlist,this.nlist,33,e,a,u,g,r,v));m<<=4;for(e=f=0;THREE.triTable[m+e]!=-1;)a=m+e,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),e+=3,f++;return f};this.posnormtriv=function(a,c,g,f,e,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[f];this.positionArray[i+
+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,f,e,h,i,k,j,r){e=(e-j)/(r-j);j=this.normal_cache;c[f]=h+e*this.delta;c[f+1]=i;c[f+2]=k;g[f]=this.lerp(j[a],j[a+3],e);g[f+1]=this.lerp(j[a+1],j[a+4],e);g[f+2]=this.lerp(j[a+2],j[a+5],e)};this.VIntY=function(a,c,g,f,e,h,i,k,j,r){e=(e-j)/(r-j);j=this.normal_cache;c[f]=h;c[f+1]=i+e*this.delta;c[f+2]=k;c=a+this.yd*
+3;g[f]=this.lerp(j[a],j[c],e);g[f+1]=this.lerp(j[a+1],j[c+1],e);g[f+2]=this.lerp(j[a+2],j[c+2],e)};this.VIntZ=function(a,c,g,f,e,h,i,k,j,r){e=(e-j)/(r-j);j=this.normal_cache;c[f]=h;c[f+1]=i;c[f+2]=k+e*this.delta;c=a+this.zd*3;g[f]=this.lerp(j[a],j[c],e);g[f+1]=this.lerp(j[a+1],j[c+1],e);g[f+2]=this.lerp(j[a+2],j[c+2],e)};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,f,e,h){var i=f+1,k=f+this.yd,j=f+this.zd,r=i+this.yd,m=i+this.zd,o=f+this.yd+this.zd,s=i+this.yd+this.zd,n=0,p=this.field[f],l=this.field[i],q=this.field[k],t=this.field[r],w=this.field[j],A=this.field[m],v=this.field[o],x=this.field[s];p<e&&(n|=1);l<e&&(n|=2);q<e&&(n|=8);t<e&&(n|=4);w<e&&(n|=16);A<e&&(n|=32);v<e&&(n|=128);x<e&&(n|=64);var y=THREE.edgeTable[n];if(y===0)return 0;var z=this.delta,F=a+
+z,u=c+z,z=g+z;y&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(f*3,this.vlist,this.nlist,0,e,a,c,g,p,l));y&2&&(this.compNorm(i),this.compNorm(r),this.VIntY(i*3,this.vlist,this.nlist,3,e,F,c,g,l,t));y&4&&(this.compNorm(k),this.compNorm(r),this.VIntX(k*3,this.vlist,this.nlist,6,e,a,u,g,q,t));y&8&&(this.compNorm(f),this.compNorm(k),this.VIntY(f*3,this.vlist,this.nlist,9,e,a,c,g,p,q));y&16&&(this.compNorm(j),this.compNorm(m),this.VIntX(j*3,this.vlist,this.nlist,12,e,a,c,z,w,A));y&32&&(this.compNorm(m),
+this.compNorm(s),this.VIntY(m*3,this.vlist,this.nlist,15,e,F,c,z,A,x));y&64&&(this.compNorm(o),this.compNorm(s),this.VIntX(o*3,this.vlist,this.nlist,18,e,a,u,z,v,x));y&128&&(this.compNorm(j),this.compNorm(o),this.VIntY(j*3,this.vlist,this.nlist,21,e,a,c,z,w,v));y&256&&(this.compNorm(f),this.compNorm(j),this.VIntZ(f*3,this.vlist,this.nlist,24,e,a,c,g,p,w));y&512&&(this.compNorm(i),this.compNorm(m),this.VIntZ(i*3,this.vlist,this.nlist,27,e,F,c,g,l,A));y&1024&&(this.compNorm(r),this.compNorm(s),this.VIntZ(r*
+3,this.vlist,this.nlist,30,e,F,u,g,t,x));y&2048&&(this.compNorm(k),this.compNorm(o),this.VIntZ(k*3,this.vlist,this.nlist,33,e,a,u,g,q,v));n<<=4;for(e=f=0;THREE.triTable[n+e]!=-1;)a=n+e,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),e+=3,f++;return f};this.posnormtriv=function(a,c,g,f,e,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[f];this.positionArray[i+
 4]=a[f+1];this.positionArray[i+5]=a[f+2];this.positionArray[i+6]=a[e];this.positionArray[i+7]=a[e+1];this.positionArray[i+8]=a[e+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[f];this.normalArray[i+4]=c[f+1];this.normalArray[i+5]=c[f+2];this.normalArray[i+6]=c[e];this.normalArray[i+7]=c[e+1];this.normalArray[i+8]=c[e+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,f,e){var h=this.size*Math.sqrt(f/e),i=g*this.size,k=c*this.size,j=a*this.size,q=Math.floor(i-h);q<1&&(q=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 n=Math.floor(j-h);n<1&&(n=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
-1);for(var s,m,p,l,r,t;q<i;q++){j=this.size2*q;m=q/this.size-g;r=m*m;for(m=o;m<k;m++){p=j+this.size*m;s=m/this.size-c;t=s*s;for(s=n;s<h;s++)l=s/this.size-a,l=f/(1.0E-6+l*l+t+r)-e,l>0&&(this.field[p+s]+=l)}}};this.addPlaneX=function(a,c){var g,f,e,h,i,k=this.size,j=this.yd,q=this.zd,o=this.field,n=k*Math.sqrt(a/c);n>k&&(n=k);for(g=0;g<n;g++)if(f=g/k,f*=f,h=a/(1.0E-4+f)-c,h>0)for(f=0;f<k;f++){i=g+f*j;for(e=0;e<k;e++)o[q*e+i]+=h}};this.addPlaneY=function(a,c){var g,f,e,h,i,k,j=this.size,q=this.yd,o=
-this.zd,n=this.field,s=j*Math.sqrt(a/c);s>j&&(s=j);for(f=0;f<s;f++)if(g=f/j,g*=g,h=a/(1.0E-4+g)-c,h>0){i=f*q;for(g=0;g<j;g++){k=i+g;for(e=0;e<j;e++)n[o*e+k]+=h}}};this.addPlaneZ=function(a,c){var g,f,e,h,i,k,j=this.size,q=this.yd,o=this.zd,n=this.field,s=j*Math.sqrt(a/c);s>j&&(s=j);for(e=0;e<s;e++)if(g=e/j,g*=g,h=a/(1.0E-4+g)-c,h>0){i=o*e;for(f=0;f<j;f++){k=i+f*q;for(g=0;g<j;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,f,e,h,i,k,j,q,o=this.size-2;for(e=1;e<o;e++){q=this.size2*e;k=(e-this.halfsize)/this.halfsize;for(f=1;f<o;f++){j=q+this.size*f;i=(f-this.halfsize)/this.halfsize;for(g=1;g<o;g++)h=(g-this.halfsize)/this.halfsize,c=j+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(f){var e,h,i,k,j,q,o,n;for(e=0;e<f.count;e++)o=e*3,j=o+1,n=o+2,h=f.positionArray[o],i=f.positionArray[j],k=
-f.positionArray[n],q=new THREE.Vector3(h,i,k),h=f.normalArray[o],i=f.normalArray[j],k=f.normalArray[n],o=new THREE.Vector3(h,i,k),o.normalize(),j=new THREE.Vertex(q),c.vertices.push(j),g.push(o);q=f.count/3;for(e=0;e<q;e++)o=(a+e)*3,j=o+1,n=o+2,h=g[o],i=g[j],k=g[n],o=new THREE.Face3(o,j,n,[h,i,k]),c.faces.push(o);a+=q;f.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+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,f,e){var h=this.size*Math.sqrt(f/e),i=g*this.size,k=c*this.size,j=a*this.size,r=Math.floor(i-h);r<1&&(r=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var m=Math.floor(k-h);m<1&&(m=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var o=Math.floor(j-h);o<1&&(o=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
+1);for(var s,n,p,l,q,t;r<i;r++){j=this.size2*r;n=r/this.size-g;q=n*n;for(n=m;n<k;n++){p=j+this.size*n;s=n/this.size-c;t=s*s;for(s=o;s<h;s++)l=s/this.size-a,l=f/(1.0E-6+l*l+t+q)-e,l>0&&(this.field[p+s]+=l)}}};this.addPlaneX=function(a,c){var g,f,e,h,i,k=this.size,j=this.yd,r=this.zd,m=this.field,o=k*Math.sqrt(a/c);o>k&&(o=k);for(g=0;g<o;g++)if(f=g/k,f*=f,h=a/(1.0E-4+f)-c,h>0)for(f=0;f<k;f++){i=g+f*j;for(e=0;e<k;e++)m[r*e+i]+=h}};this.addPlaneY=function(a,c){var g,f,e,h,i,k,j=this.size,r=this.yd,m=
+this.zd,o=this.field,s=j*Math.sqrt(a/c);s>j&&(s=j);for(f=0;f<s;f++)if(g=f/j,g*=g,h=a/(1.0E-4+g)-c,h>0){i=f*r;for(g=0;g<j;g++){k=i+g;for(e=0;e<j;e++)o[m*e+k]+=h}}};this.addPlaneZ=function(a,c){var g,f,e,h,i,k,j=this.size,r=this.yd,m=this.zd,o=this.field,s=j*Math.sqrt(a/c);s>j&&(s=j);for(e=0;e<s;e++)if(g=e/j,g*=g,h=a/(1.0E-4+g)-c,h>0){i=m*e;for(f=0;f<j;f++){k=i+f*r;for(g=0;g<j;g++)o[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,f,e,h,i,k,j,r,m=this.size-2;for(e=1;e<m;e++){r=this.size2*e;k=(e-this.halfsize)/this.halfsize;for(f=1;f<m;f++){j=r+this.size*f;i=(f-this.halfsize)/this.halfsize;for(g=1;g<m;g++)h=(g-this.halfsize)/this.halfsize,c=j+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(f){var e,h,i,k,j,r,m,o;for(e=0;e<f.count;e++)m=e*3,j=m+1,o=m+2,h=f.positionArray[m],i=f.positionArray[j],k=
+f.positionArray[o],r=new THREE.Vector3(h,i,k),h=f.normalArray[m],i=f.normalArray[j],k=f.normalArray[o],m=new THREE.Vector3(h,i,k),m.normalize(),j=new THREE.Vertex(r),c.vertices.push(j),g.push(m);r=f.count/3;for(e=0;e<r;e++)m=(a+e)*3,j=m+1,o=m+2,h=g[m],i=g[j],k=g[o],m=new THREE.Face3(m,j,o,[h,i,k]),c.faces.push(m);a+=r;f.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]);
@@ -348,9 +358,9 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
 4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);
-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,f=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,q;g.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),n=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: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}"}),
-m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(s);this.setSize=function(a,d){b.call(c,a,d);o.width=a;o.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||j!==b.far||q!==b.fov){i=b.aspect;k=b.near;j=b.far;q=b.fov;var r=b.projectionMatrix.clone(),t=125/30*0.5,w=t*k/125,z=k*Math.tan(q*Math.PI/360),v;e.n14=t;h.n14=-t;t=-z*i+w;v=z*i+w;r.n11=2*k/(v-t);r.n13=(v+t)/(v-t);g.projectionMatrix.copy(r);t=-z*i-w;v=z*i-w;r.n11=
-2*k/(v-t);r.n13=(v+t)/(v-t);f.projectionMatrix.copy(r)}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);f.matrixWorld.copy(b.matrixWorld).multiplySelf(e);f.position.copy(b.position);f.near=b.near;f.far=b.far;d.call(c,a,f,n,!0);m.updateMatrixWorld();d.call(c,m,s)}};
+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,f=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,r;g.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},m=new THREE.WebGLRenderTarget(512,512,a),o=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:m},mapRight:{type:"t",value:1,texture:o}},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}"}),
+n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(s);this.setSize=function(a,d){b.call(c,a,d);m.width=a;m.height=d;o.width=a;o.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||j!==b.far||r!==b.fov){i=b.aspect;k=b.near;j=b.far;r=b.fov;var q=b.projectionMatrix.clone(),t=125/30*0.5,w=t*k/125,A=k*Math.tan(r*Math.PI/360),v;e.n14=t;h.n14=-t;t=-A*i+w;v=A*i+w;q.n11=2*k/(v-t);q.n13=(v+t)/(v-t);g.projectionMatrix.copy(q);t=-A*i-w;v=A*i-w;q.n11=
+2*k/(v-t);q.n13=(v+t)/(v-t);f.projectionMatrix.copy(q)}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,m,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(e);f.position.copy(b.position);f.near=b.near;f.far=b.far;d.call(c,a,f,o,!0);n.updateMatrixWorld();d.call(c,n,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,f,e=new THREE.PerspectiveCamera;e.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;f=d};this.render=function(a,b){this.clear();e.fov=b.fov;e.aspect=0.5*b.aspect;e.near=b.near;e.far=
 b.far;e.updateProjectionMatrix();e.position.copy(b.position);e.target.copy(b.target);e.translateX(c.separation);e.lookAt(e.target);h.projectionMatrix=e.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,g,f);d.call(c,a,e);this.setViewport(g,0,g,f);d.call(c,a,h,!1)}};

+ 55 - 51
build/custom/ThreeSVG.js

@@ -1,4 +1,4 @@
-// ThreeSVG.js r46 - http://github.com/mrdoob/three.js
+// ThreeSVG.js r47dev - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
 THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,f,e;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),f=a*6-d,a=c*(1-b),e=c*(1-
 b*f),b=c*(1-b*(1-f)),d){case 1:this.r=e;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=e;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=e;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
@@ -14,64 +14,68 @@ this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),
 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){function c(a,b,c){j.sub(c,a);o=j.dot(b);if(o<=0)return null;p=n.add(a,k.copy(b).multiplyScalar(o));return u=c.distanceTo(p)}function d(a,b,c,d){j.sub(d,b);n.sub(c,b);k.sub(a,b);I=j.dot(j);v=j.dot(n);E=j.dot(k);s=n.dot(n);t=n.dot(k);C=1/(I*s-v*v);y=(s*E-v*t)*C;z=(I*t-v*E)*C;return y>=0&&z>=0&&y+z<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,m=new THREE.Vector3,i=new THREE.Vector3;this.intersectObject=function(j){for(var k,n=[],o=0,K=j.children.length;o<K;o++)Array.prototype.push.apply(n,this.intersectObject(j.children[o]));if(j instanceof THREE.Particle){o=
-c(this.origin,this.direction,j.matrixWorld.getPosition());if(o===null||o>j.scale.x)return[];k={distance:o,point:j.position,face:null,object:j};n.push(k)}else if(j instanceof THREE.Mesh){o=c(this.origin,this.direction,j.matrixWorld.getPosition());if(o===null||o>j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)))return n;var J,p=j.geometry,N=p.vertices,s;j.matrixRotationWorld.extractRotation(j.matrixWorld);o=0;for(K=p.faces.length;o<K;o++)if(k=p.faces[o],a.copy(this.origin),
-b.copy(this.direction),s=j.matrixWorld,l=s.multiplyVector3(l.copy(k.centroid)).subSelf(a),J=l.dot(b),!(J<=0)&&(f=s.multiplyVector3(f.copy(N[k.a].position)),e=s.multiplyVector3(e.copy(N[k.b].position)),g=s.multiplyVector3(g.copy(N[k.c].position)),k instanceof THREE.Face4&&(h=s.multiplyVector3(h.copy(N[k.d].position))),m=j.matrixRotationWorld.multiplyVector3(m.copy(k.normal)),J=b.dot(m),j.doubleSided||(j.flipSided?J>0:J<0)))if(J=m.dot(l.sub(f,a))/J,i.add(a,b.multiplyScalar(J)),k instanceof THREE.Face3)d(i,
-f,e,g)&&(k={distance:a.distanceTo(i),point:i.clone(),face:k,object:j},n.push(k));else if(k instanceof THREE.Face4&&(d(i,f,e,h)||d(i,e,g,h)))k={distance:a.distanceTo(i),point:i.clone(),face:k,object:j},n.push(k)}return n};var j=new THREE.Vector3,n=new THREE.Vector3,k=new THREE.Vector3,o,p,u,I,v,E,s,t,C,y,z};
-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,k){h?(h=!1,b=e<i?e<n?e:n:i<n?i:n,c=g<j?g<k?g:k:j<k?j:k,d=e>i?e>n?e:n:i>n?i:n,f=g>j?g>k?g:k:j>k?j:k):(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<k?g<c?g:c:k<c?k:c:j<k?j<c?j:c:k<c?k: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>k?g>f?g:f:k>f?k:f:j>k?j>f?j:f:k>f?k: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>
+THREE.Ray=function(a,b){function c(a,b,c){j.sub(c,a);o=j.dot(b);if(o<=0)return null;p=n.add(a,m.copy(b).multiplyScalar(o));return u=c.distanceTo(p)}function d(a,b,c,d){j.sub(d,b);n.sub(c,b);m.sub(a,b);F=j.dot(j);v=j.dot(n);D=j.dot(m);s=n.dot(n);t=n.dot(m);C=1/(F*s-v*v);y=(s*D-v*t)*C;z=(F*t-v*D)*C;return y>=0&&z>=0&&y+z<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,i=new THREE.Vector3,k=new THREE.Vector3;this.intersectObject=function(j){for(var m,n=[],o=0,J=j.children.length;o<J;o++)Array.prototype.push.apply(n,this.intersectObject(j.children[o]));if(j instanceof THREE.Particle){o=
+c(this.origin,this.direction,j.matrixWorld.getPosition());if(o===null||o>j.scale.x)return[];m={distance:o,point:j.position,face:null,object:j};n.push(m)}else if(j instanceof THREE.Mesh){o=c(this.origin,this.direction,j.matrixWorld.getPosition());if(o===null||o>j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)))return n;var p,s=j.geometry,M=s.vertices,t;j.matrixRotationWorld.extractRotation(j.matrixWorld);o=0;for(J=s.faces.length;o<J;o++)if(m=s.faces[o],a.copy(this.origin),
+b.copy(this.direction),t=j.matrixWorld,l=t.multiplyVector3(l.copy(m.centroid)).subSelf(a),p=l.dot(b),!(p<=0)&&(f=t.multiplyVector3(f.copy(M[m.a].position)),e=t.multiplyVector3(e.copy(M[m.b].position)),g=t.multiplyVector3(g.copy(M[m.c].position)),m instanceof THREE.Face4&&(h=t.multiplyVector3(h.copy(M[m.d].position))),i=j.matrixRotationWorld.multiplyVector3(i.copy(m.normal)),p=b.dot(i),j.doubleSided||(j.flipSided?p>0:p<0)))if(p=i.dot(l.sub(f,a))/p,k.add(a,b.multiplyScalar(p)),m instanceof THREE.Face3)d(k,
+f,e,g)&&(m={distance:a.distanceTo(k),point:k.clone(),face:m,object:j},n.push(m));else if(m instanceof THREE.Face4&&(d(k,f,e,h)||d(k,e,g,h)))m={distance:a.distanceTo(k),point:k.clone(),face:m,object:j},n.push(m)}return n};var j=new THREE.Vector3,n=new THREE.Vector3,m=new THREE.Vector3,o,p,u,F,v,D,s,t,C,y,z};
+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,k,j){h=!1;b=e;c=g;d=k;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,k,j,n,m){h?(h=!1,b=e<k?e<n?e:n:k<n?k:n,c=g<j?g<m?g:m:j<m?j:m,d=e>k?e>n?e:n:k>n?k:n,f=g>j?g>m?g:m:j>m?j:m):(b=e<k?e<n?e<b?e:b:n<b?n:b:k<n?k<b?k: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>k?e>n?e>d?e:d:n>d?n:d:k>n?k>d?k: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,l,m,i,j,n,k,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,m||0,i!==void 0?i:1,j||0,n||0,k||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,m,i,j,n,k,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=m;this.n33=i;this.n34=j;this.n41=n;this.n42=k;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,m=a.n24,i=a.n31,j=a.n32,n=a.n33,k=a.n34,o=a.n41,p=a.n42,u=a.n43,
-I=a.n44,v=b.n11,E=b.n12,s=b.n13,t=b.n14,C=b.n21,y=b.n22,z=b.n23,G=b.n24,x=b.n31,H=b.n32,A=b.n33,K=b.n34,J=b.n41,M=b.n42,N=b.n43,S=b.n44;this.n11=c*v+d*C+f*x+e*J;this.n12=c*E+d*y+f*H+e*M;this.n13=c*s+d*z+f*A+e*N;this.n14=c*t+d*G+f*K+e*S;this.n21=g*v+h*C+l*x+m*J;this.n22=g*E+h*y+l*H+m*M;this.n23=g*s+h*z+l*A+m*N;this.n24=g*t+h*G+l*K+m*S;this.n31=i*v+j*C+n*x+k*J;this.n32=i*E+j*y+n*H+k*M;this.n33=i*s+j*z+n*A+k*N;this.n34=i*t+j*G+n*K+k*S;this.n41=o*v+p*C+u*x+I*J;this.n42=o*E+p*y+u*H+I*M;this.n43=o*s+p*
-z+u*A+I*N;this.n44=o*t+p*G+u*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,i,k,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,i||0,k!==void 0?k: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,i,k,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=i;this.n33=k;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,i=a.n24,k=a.n31,j=a.n32,n=a.n33,m=a.n34,o=a.n41,p=a.n42,u=a.n43,
+F=a.n44,v=b.n11,D=b.n12,s=b.n13,t=b.n14,C=b.n21,y=b.n22,z=b.n23,H=b.n24,w=b.n31,I=b.n32,A=b.n33,J=b.n34,N=b.n41,L=b.n42,M=b.n43,S=b.n44;this.n11=c*v+d*C+f*w+e*N;this.n12=c*D+d*y+f*I+e*L;this.n13=c*s+d*z+f*A+e*M;this.n14=c*t+d*H+f*J+e*S;this.n21=g*v+h*C+l*w+i*N;this.n22=g*D+h*y+l*I+i*L;this.n23=g*s+h*z+l*A+i*M;this.n24=g*t+h*H+l*J+i*S;this.n31=k*v+j*C+n*w+m*N;this.n32=k*D+j*y+n*I+m*L;this.n33=k*s+j*z+n*A+m*M;this.n34=k*t+j*H+n*J+m*S;this.n41=o*v+p*C+u*w+F*N;this.n42=o*D+p*y+u*I+F*L;this.n43=o*s+p*
+z+u*A+F*M;this.n44=o*t+p*H+u*J+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,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,m=this.n32,i=this.n33,j=this.n34,n=this.n41,k=this.n42,o=this.n43,p=this.n44;return d*g*m*n-c*h*m*n-d*e*i*n+b*h*i*n+c*e*j*n-b*g*j*n-d*g*l*k+c*h*l*k+d*f*i*k-a*h*i*k-c*f*j*k+a*g*j*k+d*e*l*o-b*h*l*o-d*f*m*o+a*h*m*o+b*f*j*o-a*e*j*o-c*e*l*p+b*g*l*p+c*f*m*p-a*g*m*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.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,i=this.n32,k=this.n33,j=this.n34,n=this.n41,m=this.n42,o=this.n43,p=this.n44;return d*g*i*n-c*h*i*n-d*e*k*n+b*h*k*n+c*e*j*n-b*g*j*n-d*g*l*m+c*h*l*m+d*f*k*m-a*h*k*m-c*f*j*m+a*g*j*m+d*e*l*o-b*h*l*o-d*f*i*o+a*h*i*o+b*f*j*o-a*e*j*o-c*e*l*p+b*g*l*p+c*f*i*p-a*g*i*p-b*f*k*p+a*e*k*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.n34=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,m=f*g;this.set(l*e+c,l*g-d*h,l*h+d*g,0,l*g+d*h,m*g+c,m*h-d*e,0,l*h-d*g,m*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,m=a.n31,i=a.n32,j=a.n33,n=a.n34,k=a.n41,o=a.n42,p=a.n43,u=a.n44;this.n11=h*n*o-l*j*o+l*i*p-g*n*p-h*i*u+g*j*u;this.n12=f*j*o-d*n*o-f*i*p+c*n*p+d*i*u-c*j*u;this.n13=d*l*o-f*h*o+f*g*p-c*l*p-d*g*u+c*h*u;this.n14=f*h*i-d*l*i-f*g*j+c*l*j+d*g*n-c*h*n;this.n21=l*j*k-h*n*k-l*m*p+e*n*p+h*m*u-e*j*u;this.n22=d*n*k-f*j*k+
-f*m*p-b*n*p-d*m*u+b*j*u;this.n23=f*h*k-d*l*k-f*e*p+b*l*p+d*e*u-b*h*u;this.n24=d*l*m-f*h*m+f*e*j-b*l*j-d*e*n+b*h*n;this.n31=g*n*k-l*i*k+l*m*o-e*n*o-g*m*u+e*i*u;this.n32=f*i*k-c*n*k-f*m*o+b*n*o+c*m*u-b*i*u;this.n33=d*l*k-f*g*k+f*e*o-b*l*o-c*e*u+b*g*u;this.n34=f*g*m-c*l*m-f*e*i+b*l*i+c*e*n-b*g*n;this.n41=h*i*k-g*j*k-h*m*o+e*j*o+g*m*p-e*i*p;this.n42=c*j*k-d*i*k+d*m*o-b*j*o-c*m*p+b*i*p;this.n43=d*g*k-c*h*k-d*e*o+b*h*o+c*e*p-b*g*p;this.n44=c*h*m-d*g*m+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,m=g*f,i=d*h,j=d*f;this.n11=l+j*c;this.n12=i*c-m;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=m*c-i;this.n32=j+l*c;this.n33=e*g;break;case "ZXY":l=g*h;m=g*f;i=d*h;j=d*f;this.n11=l-j*c;this.n12=-e*f;this.n13=i+m*c;this.n21=m+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;m=e*f;i=c*h;j=c*f;this.n11=g*h;this.n12=i*d-m;this.n13=l*d+j;this.n21=g*f;this.n22=j*d+l;this.n23=m*d-i;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":l=e*g;m=e*d;i=c*g;j=c*d;this.n11=g*h;this.n12=j-l*f;this.n13=i*f+m;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=m*f+i;this.n33=l-j*f;break;case "XZY":l=e*g;m=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=m*f-i;this.n31=i*f-m;this.n32=c*h;this.n33=j*f+l;break;default:l=e*h,m=e*
-f,i=c*h,j=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=m+i*d,this.n22=l-j*d,this.n23=-c*g,this.n31=j-l*d,this.n32=i+m*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 m=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(m+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+m);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,i=f*g;this.set(l*e+c,l*g-d*h,l*h+d*g,0,l*g+d*h,i*g+c,i*h-d*e,0,l*h-d*g,i*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,i=a.n31,k=a.n32,j=a.n33,n=a.n34,m=a.n41,o=a.n42,p=a.n43,u=a.n44;this.n11=h*n*o-l*j*o+l*k*p-g*n*p-h*k*u+g*j*u;this.n12=f*j*o-d*n*o-f*k*p+c*n*p+d*k*u-c*j*u;this.n13=d*l*o-f*h*o+f*g*p-c*l*p-d*g*u+c*h*u;this.n14=f*h*k-d*l*k-f*g*j+c*l*j+d*g*n-c*h*n;this.n21=l*j*m-h*n*m-l*i*p+e*n*p+h*i*u-e*j*u;this.n22=d*n*m-f*j*m+
+f*i*p-b*n*p-d*i*u+b*j*u;this.n23=f*h*m-d*l*m-f*e*p+b*l*p+d*e*u-b*h*u;this.n24=d*l*i-f*h*i+f*e*j-b*l*j-d*e*n+b*h*n;this.n31=g*n*m-l*k*m+l*i*o-e*n*o-g*i*u+e*k*u;this.n32=f*k*m-c*n*m-f*i*o+b*n*o+c*i*u-b*k*u;this.n33=c*l*m-f*g*m+f*e*o-b*l*o-c*e*u+b*g*u;this.n34=f*g*i-c*l*i-f*e*k+b*l*k+c*e*n-b*g*n;this.n41=h*k*m-g*j*m-h*i*o+e*j*o+g*i*p-e*k*p;this.n42=c*j*m-d*k*m+d*i*o-b*j*o-c*i*p+b*k*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*i-d*g*i+d*e*k-b*h*k-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,i=g*f,k=d*h,j=d*f;this.n11=l+j*c;this.n12=k*c-i;this.n13=e*d;this.n21=e*f;this.n22=e*h;this.n23=-c;this.n31=i*c-k;this.n32=j+l*c;this.n33=e*g;break;case "ZXY":l=g*h;i=g*f;k=d*h;j=d*f;this.n11=l-j*c;this.n12=-e*f;this.n13=k+i*c;this.n21=i+k*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;i=e*f;k=c*h;j=c*f;this.n11=g*h;this.n12=k*d-i;this.n13=l*d+j;this.n21=g*f;this.n22=j*d+l;this.n23=i*d-k;this.n31=-d;this.n32=c*g;this.n33=e*g;break;case "YZX":l=e*g;i=e*d;k=c*g;j=c*d;this.n11=g*h;this.n12=j-l*f;this.n13=k*f+i;this.n21=f;this.n22=e*h;this.n23=-c*h;this.n31=-d*h;this.n32=i*f+k;this.n33=l-j*f;break;case "XZY":l=e*g;i=e*d;k=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=i*f-k;this.n31=k*f-i;this.n32=c*h;this.n33=j*f+l;break;default:l=e*h,i=e*
+f,k=c*h,j=c*f,this.n11=g*h,this.n12=-g*f,this.n13=d,this.n21=i+k*d,this.n22=l-j*d,this.n23=-c*g,this.n31=j-l*d,this.n32=k+i*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 i=c*g;c*=h;d*=h;e*=f;g*=f;f*=h;this.n11=1-(i+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+i);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,m=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*m;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*m;c[7]=a*i;c[8]=a*j;return b};
+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},rotateByAxis:function(a,b){if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);else if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);else if(a.x===0&&a.y===
+0&&a.z===1)return this.rotateZ(b);var c=a.x,d=a.y,f=a.z,e=Math.sqrt(c*c+d*d+f*f);c/=e;d/=e;f/=e;var e=c*c,g=d*d,h=f*f,l=Math.cos(b),i=Math.sin(b),k=1-l,j=c*d*k,n=c*f*k;k*=d*f;c*=i;var m=d*i;i*=f;f=e+(1-e)*l;e=j+i;d=n-m;j-=i;g+=(1-g)*l;i=k+c;n+=m;k-=c;h+=(1-h)*l;var l=this.n11,c=this.n21,m=this.n31,o=this.n41,p=this.n12,u=this.n22,F=this.n32,v=this.n42,D=this.n13,s=this.n23,t=this.n33,C=this.n43;this.n11=f*l+e*p+d*D;this.n21=f*c+e*u+d*s;this.n31=f*m+e*F+d*t;this.n41=f*o+e*v+d*C;this.n12=j*l+g*p+i*
+D;this.n22=j*c+g*u+i*s;this.n32=j*m+g*F+i*t;this.n42=j*o+g*v+i*C;this.n13=n*l+k*p+h*D;this.n23=n*c+k*u+h*s;this.n33=n*m+k*F+h*t;this.n43=n*o+k*v+h*C;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,f=this.n42,e=this.n13,g=this.n23,h=this.n33,l=this.n43,i=Math.cos(a),a=Math.sin(a);this.n12=i*b+a*e;this.n22=i*c+a*g;this.n32=i*d+a*h;this.n42=i*f+a*l;this.n13=i*e-a*b;this.n23=i*g-a*c;this.n33=i*h-a*d;this.n43=i*l-a*f;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,
+f=this.n41,e=this.n13,g=this.n23,h=this.n33,l=this.n43,i=Math.cos(a),a=Math.sin(a);this.n11=i*b-a*e;this.n21=i*c-a*g;this.n31=i*d-a*h;this.n41=i*f-a*l;this.n13=i*e+a*b;this.n23=i*g+a*c;this.n33=i*h+a*d;this.n43=i*l+a*f;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,f=this.n41,e=this.n12,g=this.n22,h=this.n32,l=this.n42,i=Math.cos(a),a=Math.sin(a);this.n11=i*b+a*e;this.n21=i*c+a*g;this.n31=i*d+a*h;this.n41=i*f+a*l;this.n12=i*e-a*b;this.n22=i*g-a*c;this.n32=i*h-a*d;this.n42=i*
+l-a*f;return this},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;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,i=a.n23*a.n12-a.n22*a.n13,k=-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*i;if(a===0)return null;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*i;c[7]=a*k;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,m;g=new THREE.Matrix4;h=b-a;l=c-d;m=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/m;g.n34=-((e+f)/m);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,i;g=new THREE.Matrix4;h=b-a;l=c-d;i=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/i;g.n34=-((e+f)/i);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=m[l]=m[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,m=[],
-i,j,n=[],k,o=[],p,u,I=[],v,E,s=[],t={objects:[],sprites:[],lights:[],elements:[]},C=new THREE.Vector3,y=new THREE.Vector4,z=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,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);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+THREE.Projector=function(){function a(){var a=g[e]=g[e]||new THREE.RenderableObject;e++;return a}function b(){var a=i[l]=i[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,i=[],
+k,j,n=[],m,o=[],p,u,F=[],v,D,s=[],t={objects:[],sprites:[],lights:[],elements:[]},C=new THREE.Vector3,y=new THREE.Vector4,z=new THREE.Matrix4,H=new THREE.Matrix4,w=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,A=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);z.multiply(b.projectionMatrix,b.matrixWorldInverse);z.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
 z.multiply(b.matrixWorld,b.projectionMatrixInverse);z.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?(z.multiplyVector3(C.copy(b.position)),f=a(),f.object=b,f.z=C.z,t.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(z.multiplyVector3(C.copy(b.position)),f=a(),f.object=b,f.z=C.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,C,O,r,q,w,B,D,L,F,P,Q,T,W,U,V,R;E=u=k=j=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);z.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(z);t=this.projectGraph(a,!1);a=0;for(C=t.objects.length;a<C;a++)if(F=t.objects[a].object,P=F.matrixWorld,T=
-F.material,l=0,F instanceof THREE.Mesh){Q=F.geometry;W=F.geometry.materials;q=Q.vertices;U=Q.faces;V=Q.faceVertexUvs;Q=F.matrixRotationWorld.extractRotation(P);O=0;for(r=q.length;O<r;O++)h=b(),h.positionWorld.copy(q[O].position),P.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),z.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(O=U.length;q<O;q++){r=U[q];
-if(r instanceof THREE.Face3)if(w=m[r.a],B=m[r.b],D=m[r.c],w.visible&&B.visible&&D.visible&&(F.doubleSided||F.flipSided!=(D.positionScreen.x-w.positionScreen.x)*(B.positionScreen.y-w.positionScreen.y)-(D.positionScreen.y-w.positionScreen.y)*(B.positionScreen.x-w.positionScreen.x)<0))L=n[j]=n[j]||new THREE.RenderableFace3,j++,i=L,i.v1.copy(w),i.v2.copy(B),i.v3.copy(D);else continue;else if(r instanceof THREE.Face4)if(w=m[r.a],B=m[r.b],D=m[r.c],L=m[r.d],w.visible&&B.visible&&D.visible&&L.visible&&(F.doubleSided||
-F.flipSided!=((L.positionScreen.x-w.positionScreen.x)*(B.positionScreen.y-w.positionScreen.y)-(L.positionScreen.y-w.positionScreen.y)*(B.positionScreen.x-w.positionScreen.x)<0||(B.positionScreen.x-D.positionScreen.x)*(L.positionScreen.y-D.positionScreen.y)-(B.positionScreen.y-D.positionScreen.y)*(L.positionScreen.x-D.positionScreen.x)<0)))R=o[k]=o[k]||new THREE.RenderableFace4,k++,i=R,i.v1.copy(w),i.v2.copy(B),i.v3.copy(D),i.v4.copy(L);else continue;i.normalWorld.copy(r.normal);Q.multiplyVector3(i.normalWorld);
-i.centroidWorld.copy(r.centroid);P.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);z.multiplyVector3(i.centroidScreen);D=r.vertexNormals;w=0;for(B=D.length;w<B;w++)L=i.vertexNormalsWorld[w],L.copy(D[w]),Q.multiplyVector3(L);w=0;for(B=V.length;w<B;w++)if(R=V[w][q]){D=0;for(L=R.length;D<L;D++)i.uvs[w][D]=R[D]}i.material=T;i.faceMaterial=r.materialIndex!==null?W[r.materialIndex]:null;i.z=i.centroidScreen.z;t.elements.push(i)}}else if(F instanceof THREE.Line){G.multiply(z,P);q=
-F.geometry.vertices;w=b();w.positionScreen.copy(q[0].position);G.multiplyVector4(w.positionScreen);O=1;for(r=q.length;O<r;O++)if(w=b(),w.positionScreen.copy(q[O].position),G.multiplyVector4(w.positionScreen),B=m[l-2],H.copy(w.positionScreen),A.copy(B.positionScreen),d(H,A))H.multiplyScalar(1/H.w),A.multiplyScalar(1/A.w),F=I[u]=I[u]||new THREE.RenderableLine,u++,p=F,p.v1.positionScreen.copy(H),p.v2.positionScreen.copy(A),p.z=Math.max(H.z,A.z),p.material=T,t.elements.push(p)}a=0;for(C=t.sprites.length;a<
-C;a++)if(F=t.sprites[a].object,P=F.matrixWorld,F instanceof THREE.Particle&&(y.set(P.n14,P.n24,P.n34,1),z.multiplyVector4(y),y.z/=y.w,y.z>0&&y.z<1))g=s[E]=s[E]||new THREE.RenderableParticle,E++,v=g,v.x=y.x/y.w,v.y=y.y/y.w,v.z=y.z,v.rotation=F.rotation.z,v.scale.x=F.scale.x*Math.abs(v.x-(y.x+e.projectionMatrix.n11)/(y.w+e.projectionMatrix.n14)),v.scale.y=F.scale.y*Math.abs(v.y-(y.y+e.projectionMatrix.n22)/(y.w+e.projectionMatrix.n24)),v.material=F.material,t.elements.push(v);f&&t.elements.sort(c);
+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=w[h].x*d.n14+w[h].y*d.n24+w[h].z*d.n34+w[h].w,c<=e){c=!1;break a}c=!0}c?(z.multiplyVector3(C.copy(b.position)),f=a(),f.object=b,f.z=C.z,t.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(z.multiplyVector3(C.copy(b.position)),f=a(),f.object=b,f.z=C.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,C=e.far,w,O,r,q,x,B,E,K,G,P,Q,T,W,U,V,R;D=u=m=j=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);z.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(z);t=this.projectGraph(a,!1);a=0;for(w=t.objects.length;a<w;a++)if(G=t.objects[a].object,P=G.matrixWorld,T=
+G.material,l=0,G instanceof THREE.Mesh){Q=G.geometry;W=G.geometry.materials;q=Q.vertices;U=Q.faces;V=Q.faceVertexUvs;Q=G.matrixRotationWorld.extractRotation(P);O=0;for(r=q.length;O<r;O++)h=b(),h.positionWorld.copy(q[O].position),P.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),z.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<C;q=0;for(O=U.length;q<O;q++){r=U[q];
+if(r instanceof THREE.Face3)if(x=i[r.a],B=i[r.b],E=i[r.c],x.visible&&B.visible&&E.visible&&(G.doubleSided||G.flipSided!=(E.positionScreen.x-x.positionScreen.x)*(B.positionScreen.y-x.positionScreen.y)-(E.positionScreen.y-x.positionScreen.y)*(B.positionScreen.x-x.positionScreen.x)<0))K=n[j]=n[j]||new THREE.RenderableFace3,j++,k=K,k.v1.copy(x),k.v2.copy(B),k.v3.copy(E);else continue;else if(r instanceof THREE.Face4)if(x=i[r.a],B=i[r.b],E=i[r.c],K=i[r.d],x.visible&&B.visible&&E.visible&&K.visible&&(G.doubleSided||
+G.flipSided!=((K.positionScreen.x-x.positionScreen.x)*(B.positionScreen.y-x.positionScreen.y)-(K.positionScreen.y-x.positionScreen.y)*(B.positionScreen.x-x.positionScreen.x)<0||(B.positionScreen.x-E.positionScreen.x)*(K.positionScreen.y-E.positionScreen.y)-(B.positionScreen.y-E.positionScreen.y)*(K.positionScreen.x-E.positionScreen.x)<0)))R=o[m]=o[m]||new THREE.RenderableFace4,m++,k=R,k.v1.copy(x),k.v2.copy(B),k.v3.copy(E),k.v4.copy(K);else continue;k.normalWorld.copy(r.normal);Q.multiplyVector3(k.normalWorld);
+k.centroidWorld.copy(r.centroid);P.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);z.multiplyVector3(k.centroidScreen);E=r.vertexNormals;x=0;for(B=E.length;x<B;x++)K=k.vertexNormalsWorld[x],K.copy(E[x]),Q.multiplyVector3(K);x=0;for(B=V.length;x<B;x++)if(R=V[x][q]){E=0;for(K=R.length;E<K;E++)k.uvs[x][E]=R[E]}k.material=T;k.faceMaterial=r.materialIndex!==null?W[r.materialIndex]:null;k.z=k.centroidScreen.z;t.elements.push(k)}}else if(G instanceof THREE.Line){H.multiply(z,P);q=
+G.geometry.vertices;x=b();x.positionScreen.copy(q[0].position);H.multiplyVector4(x.positionScreen);O=1;for(r=q.length;O<r;O++)if(x=b(),x.positionScreen.copy(q[O].position),H.multiplyVector4(x.positionScreen),B=i[l-2],I.copy(x.positionScreen),A.copy(B.positionScreen),d(I,A))I.multiplyScalar(1/I.w),A.multiplyScalar(1/A.w),G=F[u]=F[u]||new THREE.RenderableLine,u++,p=G,p.v1.positionScreen.copy(I),p.v2.positionScreen.copy(A),p.z=Math.max(I.z,A.z),p.material=T,t.elements.push(p)}a=0;for(w=t.sprites.length;a<
+w;a++)if(G=t.sprites[a].object,P=G.matrixWorld,G instanceof THREE.Particle&&(y.set(P.n14,P.n24,P.n34,1),z.multiplyVector4(y),y.z/=y.w,y.z>0&&y.z<1))g=s[D]=s[D]||new THREE.RenderableParticle,D++,v=g,v.x=y.x/y.w,v.y=y.y/y.w,v.z=y.z,v.rotation=G.rotation.z,v.scale.x=G.scale.x*Math.abs(v.x-(y.x+e.projectionMatrix.n11)/(y.w+e.projectionMatrix.n14)),v.scale.y=G.scale.y*Math.abs(v.y-(y.y+e.projectionMatrix.n22)/(y.w+e.projectionMatrix.n24)),v.material=G.material,t.elements.push(v);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.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,m=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=m*l+c*-e+i*-h-j*-g;b.y=i*l+c*-g+j*-e-m*-h;b.z=j*l+c*-h+m*-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,i=l*c+g*f-h*d,k=l*d+h*c-e*f,j=l*f+e*d-g*c,c=-e*
+c-g*d-h*f;b.x=i*l+c*-e+k*-h-j*-g;b.y=k*l+c*-g+j*-e-i*-h;b.z=j*l+c*-h+i*-g-k*-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 +86,9 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 b,c,d,f,e,g=new THREE.Vector3,h=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],f=this.vertices[c.b],e=this.vertices[c.c],g.sub(e.position,f.position),h.sub(d.position,f.position),g.crossSelf(h),g.isZero()||g.normalize(),c.normal.copy(g)},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,B){h=a.vertices[b].position;l=a.vertices[c].position;m=a.vertices[d].position;i=g[e];j=g[f];n=g[B];k=l.x-h.x;o=m.x-h.x;p=l.y-h.y;u=m.y-h.y;I=l.z-h.z;v=m.z-h.z;E=j.u-i.u;s=n.u-i.u;t=j.v-i.v;C=n.v-i.v;y=1/(E*C-s*t);H.set((C*k-t*o)*y,(C*p-t*u)*y,(C*I-t*v)*y);A.set((E*o-s*k)*y,(E*u-s*p)*y,(E*v-s*I)*y);G[b].addSelf(H);G[c].addSelf(H);G[d].addSelf(H);x[b].addSelf(A);x[c].addSelf(A);x[d].addSelf(A)}var b,c,d,f,e,g,h,l,m,i,j,n,k,o,p,u,I,v,E,s,t,C,y,z,G=[],x=[],H=new THREE.Vector3,A=new THREE.Vector3,
-K=new THREE.Vector3,J=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 N=["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[N[d]],
-z=G[f],K.copy(z),K.subSelf(M.multiplyScalar(M.dot(z))).normalize(),J.cross(e.vertexNormals[d],z),f=J.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,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=
+b,c,d,e,f,B){h=a.vertices[b].position;l=a.vertices[c].position;i=a.vertices[d].position;k=g[e];j=g[f];n=g[B];m=l.x-h.x;o=i.x-h.x;p=l.y-h.y;u=i.y-h.y;F=l.z-h.z;v=i.z-h.z;D=j.u-k.u;s=n.u-k.u;t=j.v-k.v;C=n.v-k.v;y=1/(D*C-s*t);I.set((C*m-t*o)*y,(C*p-t*u)*y,(C*F-t*v)*y);A.set((D*o-s*m)*y,(D*u-s*p)*y,(D*v-s*F)*y);H[b].addSelf(I);H[c].addSelf(I);H[d].addSelf(I);w[b].addSelf(A);w[c].addSelf(A);w[d].addSelf(A)}var b,c,d,f,e,g,h,l,i,k,j,n,m,o,p,u,F,v,D,s,t,C,y,z,H=[],w=[],I=new THREE.Vector3,A=new THREE.Vector3,
+J=new THREE.Vector3,N=new THREE.Vector3,L=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)H[b]=new THREE.Vector3,w[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 M=["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[M[d]],
+z=H[f],J.copy(z),J.subSelf(L.multiplyScalar(L.dot(z))).normalize(),N.cross(e.vertexNormals[d],z),f=N.dot(w[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;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};
@@ -122,17 +126,17 @@ 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,j,i;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),i=c.dot(j),i<=0||(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),i=c.dot(G.sub(j,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(j)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}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"),m,i,j,n,k,o,p,u,I=new THREE.Rectangle,v=new THREE.Rectangle,E=!1,s=new THREE.Color,t=new THREE.Color,C=new THREE.Color,y=new THREE.Color,z,G=new THREE.Vector3,x=[],H=[],A,K,J,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){m=a;i=b;j=m/2;n=i/2;l.setAttribute("viewBox",-j+" "+-n+" "+m+" "+i);l.setAttribute("width",m);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,m){var x,G,r,q;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;f=h.projectScene(i,m,this.sortElements);e=f.elements;
-g=f.lights;J=K=0;if(E=g.length>0){t.setRGB(0,0,0);C.setRGB(0,0,0);y.setRGB(0,0,0);x=0;for(G=g.length;x<G;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?(C.r+=r.r,C.g+=r.g,C.b+=r.b):q instanceof THREE.PointLight&&(y.r+=r.r,y.g+=r.g,y.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(v.empty(),r instanceof THREE.RenderableParticle)k=r,k.x*=
-j,k.y*=-n;else if(r instanceof THREE.RenderableLine){if(k=r.v1,o=r.v2,k.positionScreen.x*=j,k.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,v.addPoint(k.positionScreen.x,k.positionScreen.y),v.addPoint(o.positionScreen.x,o.positionScreen.y),I.intersects(v)){r=k;var w=o,B=J++;H[B]==null&&(H[B]=document.createElementNS("http://www.w3.org/2000/svg","line"),M==0&&H[B].setAttribute("shape-rendering","crispEdges"));A=H[B];A.setAttribute("x1",r.positionScreen.x);A.setAttribute("y1",r.positionScreen.y);
-A.setAttribute("x2",w.positionScreen.x);A.setAttribute("y2",w.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),l.appendChild(A))}}else if(r instanceof THREE.RenderableFace3){if(k=r.v1,o=r.v2,p=r.v3,k.positionScreen.x*=j,k.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,p.positionScreen.x*=
-j,p.positionScreen.y*=-n,v.addPoint(k.positionScreen.x,k.positionScreen.y),v.addPoint(o.positionScreen.x,o.positionScreen.y),v.addPoint(p.positionScreen.x,p.positionScreen.y),I.intersects(v)){var w=k,B=o,D=p;d.info.render.vertices+=3;d.info.render.faces++;A=b(K++);A.setAttribute("d","M "+w.positionScreen.x+" "+w.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+"z");q instanceof THREE.MeshBasicMaterial?s.copy(q.color):q instanceof THREE.MeshLambertMaterial?
-E?(s.r=t.r,s.g=t.g,s.b=t.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?(z=1-q.__2near/(q.__farPlusNear-r.z*q.__farMinusNear),s.setRGB(z,z,z)):q instanceof THREE.MeshNormalMaterial&&s.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));q.wireframe?A.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+
-q.wireframeLinewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframeLinecap+"; stroke-linejoin: "+q.wireframeLinejoin):A.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+q.opacity);l.appendChild(A)}}else if(r instanceof THREE.RenderableFace4&&(k=r.v1,o=r.v2,p=r.v3,u=r.v4,k.positionScreen.x*=j,k.positionScreen.y*=-n,o.positionScreen.x*=j,o.positionScreen.y*=-n,p.positionScreen.x*=j,p.positionScreen.y*=-n,u.positionScreen.x*=j,u.positionScreen.y*=-n,v.addPoint(k.positionScreen.x,
-k.positionScreen.y),v.addPoint(o.positionScreen.x,o.positionScreen.y),v.addPoint(p.positionScreen.x,p.positionScreen.y),v.addPoint(u.positionScreen.x,u.positionScreen.y),I.intersects(v))){var w=k,B=o,D=p,L=u;d.info.render.vertices+=4;d.info.render.faces++;A=b(K++);A.setAttribute("d","M "+w.positionScreen.x+" "+w.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+" L "+L.positionScreen.x+","+L.positionScreen.y+"z");q instanceof THREE.MeshBasicMaterial?
-s.copy(q.color):q instanceof THREE.MeshLambertMaterial?E?(s.r=t.r,s.g=t.g,s.b=t.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?(z=1-q.__2near/(q.__farPlusNear-r.z*q.__farMinusNear),s.setRGB(z,z,z)):q instanceof THREE.MeshNormalMaterial&&s.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));q.wireframe?A.setAttribute("style",
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,j,i;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),i=c.dot(j),i<=0||(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),i=c.dot(H.sub(j,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(j)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}function b(a){w[a]==null&&(w[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),L==0&&w[a].setAttribute("shape-rendering","crispEdges"));return w[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"),i,k,j,n,m,o,p,u,F=new THREE.Rectangle,v=new THREE.Rectangle,D=!1,s=new THREE.Color,t=new THREE.Color,C=new THREE.Color,y=new THREE.Color,z,H=new THREE.Vector3,w=[],I=[],A,J,N,L=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":L=1;break;case "low":L=0}};this.setSize=function(a,b){i=a;k=b;j=i/2;n=k/2;l.setAttribute("viewBox",-j+" "+-n+" "+i+" "+k);l.setAttribute("width",i);l.setAttribute("height",k);F.set(-j,-n,j,n)};this.clear=function(){for(;l.childNodes.length>0;)l.removeChild(l.childNodes[0])};this.render=function(i,k){var w,H,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;N=J=0;if(D=g.length>0){t.setRGB(0,0,0);C.setRGB(0,0,0);y.setRGB(0,0,0);w=0;for(H=g.length;w<H;w++)q=g[w],r=q.color,q instanceof THREE.AmbientLight?(t.r+=r.r,t.g+=r.g,t.b+=r.b):q instanceof THREE.DirectionalLight?(C.r+=r.r,C.g+=r.g,C.b+=r.b):q instanceof THREE.PointLight&&(y.r+=r.r,y.g+=r.g,y.b+=r.b)}w=0;for(H=e.length;w<H;w++)if(r=e[w],q=r.material,q=q instanceof THREE.MeshFaceMaterial?r.faceMaterial:q,!(q==null||q.opacity==0))if(v.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,v.addPoint(m.positionScreen.x,m.positionScreen.y),v.addPoint(o.positionScreen.x,o.positionScreen.y),F.intersects(v)){r=m;var x=o,B=N++;I[B]==null&&(I[B]=document.createElementNS("http://www.w3.org/2000/svg","line"),L==0&&I[B].setAttribute("shape-rendering","crispEdges"));A=I[B];A.setAttribute("x1",r.positionScreen.x);A.setAttribute("y1",r.positionScreen.y);
+A.setAttribute("x2",x.positionScreen.x);A.setAttribute("y2",x.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),l.appendChild(A))}}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,v.addPoint(m.positionScreen.x,m.positionScreen.y),v.addPoint(o.positionScreen.x,o.positionScreen.y),v.addPoint(p.positionScreen.x,p.positionScreen.y),F.intersects(v)){var x=m,B=o,E=p;d.info.render.vertices+=3;d.info.render.faces++;A=b(J++);A.setAttribute("d","M "+x.positionScreen.x+" "+x.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+E.positionScreen.x+","+E.positionScreen.y+"z");q instanceof THREE.MeshBasicMaterial?s.copy(q.color):q instanceof THREE.MeshLambertMaterial?
+D?(s.r=t.r,s.g=t.g,s.b=t.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?(z=1-q.__2near/(q.__farPlusNear-r.z*q.__farMinusNear),s.setRGB(z,z,z)):q instanceof THREE.MeshNormalMaterial&&s.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));q.wireframe?A.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+
+q.wireframeLinewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframeLinecap+"; stroke-linejoin: "+q.wireframeLinejoin):A.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+q.opacity);l.appendChild(A)}}else if(r instanceof THREE.RenderableFace4&&(m=r.v1,o=r.v2,p=r.v3,u=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,u.positionScreen.x*=j,u.positionScreen.y*=-n,v.addPoint(m.positionScreen.x,
+m.positionScreen.y),v.addPoint(o.positionScreen.x,o.positionScreen.y),v.addPoint(p.positionScreen.x,p.positionScreen.y),v.addPoint(u.positionScreen.x,u.positionScreen.y),F.intersects(v))){var x=m,B=o,E=p,K=u;d.info.render.vertices+=4;d.info.render.faces++;A=b(J++);A.setAttribute("d","M "+x.positionScreen.x+" "+x.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+E.positionScreen.x+","+E.positionScreen.y+" L "+K.positionScreen.x+","+K.positionScreen.y+"z");q instanceof THREE.MeshBasicMaterial?
+s.copy(q.color):q instanceof THREE.MeshLambertMaterial?D?(s.r=t.r,s.g=t.g,s.b=t.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?(z=1-q.__2near/(q.__farPlusNear-r.z*q.__farMinusNear),s.setRGB(z,z,z)):q instanceof THREE.MeshNormalMaterial&&s.setRGB(c(r.normalWorld.x),c(r.normalWorld.y),c(r.normalWorld.z));q.wireframe?A.setAttribute("style",
 "fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+q.wireframeLinewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframeLinecap+"; stroke-linejoin: "+q.wireframeLinejoin):A.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+q.opacity);l.appendChild(A)}}};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};

+ 209 - 205
build/custom/ThreeWebGL.js

@@ -1,7 +1,7 @@
-// ThreeWebGL.js r46 - http://github.com/mrdoob/three.js
+// ThreeWebGL.js r47dev - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
-THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var e,f,g;if(c===0)this.r=this.g=this.b=0;else switch(e=Math.floor(a*6),f=a*6-e,a=c*(1-b),g=c*(1-
-b*f),b=c*(1-b*(1-f)),e){case 1:this.r=g;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=g;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=g;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
+THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,g,f;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),g=a*6-d,a=c*(1-b),f=c*(1-
+b*g),b=c*(1-b*(1-g)),d){case 1:this.r=f;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=f;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=f;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
 divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
@@ -9,96 +9,100 @@ equals:function(a){return a.x===this.x&&a.y===this.y}};THREE.Vector3=function(a,
 THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
 addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
 divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},
-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-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,e=this.z;this.x=c*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){var b=Math.cos(this.y);
-this.y=Math.asin(a.n13);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-
+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-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){var b=Math.cos(this.y);
+this.y=Math.asin(a.n13);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){function c(a,b,c){p.sub(c,a);y=p.dot(b);if(y<=0)return null;I=A.add(a,r.copy(b).multiplyScalar(y));return R=c.distanceTo(I)}function e(a,b,c,e){p.sub(e,b);A.sub(c,b);r.sub(a,b);va=p.dot(p);ha=p.dot(A);ja=p.dot(r);ga=A.dot(A);L=A.dot(r);S=1/(va*ga-ha*ha);F=(ga*ja-ha*L)*S;N=(va*L-ha*ja)*S;return F>=0&&N>=0&&F+N<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,h=new THREE.Vector3,i=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,n=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.intersectObject=function(r){for(var p,y=[],A=0,oa=r.children.length;A<oa;A++)Array.prototype.push.apply(y,this.intersectObject(r.children[A]));
-if(r instanceof THREE.Particle){A=c(this.origin,this.direction,r.matrixWorld.getPosition());if(A===null||A>r.scale.x)return[];p={distance:A,point:r.position,face:null,object:r};y.push(p)}else if(r instanceof THREE.Mesh){A=c(this.origin,this.direction,r.matrixWorld.getPosition());if(A===null||A>r.geometry.boundingSphere.radius*Math.max(r.scale.x,Math.max(r.scale.y,r.scale.z)))return y;var I,R=r.geometry,Q=R.vertices,L;r.matrixRotationWorld.extractRotation(r.matrixWorld);A=0;for(oa=R.faces.length;A<
-oa;A++)if(p=R.faces[A],a.copy(this.origin),b.copy(this.direction),L=r.matrixWorld,n=L.multiplyVector3(n.copy(p.centroid)).subSelf(a),I=n.dot(b),!(I<=0)&&(f=L.multiplyVector3(f.copy(Q[p.a].position)),g=L.multiplyVector3(g.copy(Q[p.b].position)),h=L.multiplyVector3(h.copy(Q[p.c].position)),p instanceof THREE.Face4&&(i=L.multiplyVector3(i.copy(Q[p.d].position))),k=r.matrixRotationWorld.multiplyVector3(k.copy(p.normal)),I=b.dot(k),r.doubleSided||(r.flipSided?I>0:I<0)))if(I=k.dot(n.sub(f,a))/I,l.add(a,
-b.multiplyScalar(I)),p instanceof THREE.Face3)e(l,f,g,h)&&(p={distance:a.distanceTo(l),point:l.clone(),face:p,object:r},y.push(p));else if(p instanceof THREE.Face4&&(e(l,f,g,i)||e(l,g,h,i)))p={distance:a.distanceTo(l),point:l.clone(),face:p,object:r},y.push(p)}return y};var p=new THREE.Vector3,A=new THREE.Vector3,r=new THREE.Vector3,y,I,R,va,ha,ja,ga,L,S,F,N};
-THREE.Rectangle=function(){function a(){g=e-b;h=f-c}var b,c,e,f,g,h,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(g,h,l,p){i=!1;b=g;c=h;e=l;f=p;a()};this.addPoint=function(g,h){i?(i=!1,b=g,c=h,e=g,f=h):(b=b<g?b:g,c=c<h?c:h,e=e>g?e:g,f=f>h?f:h);a()};this.add3Points=
-function(g,h,l,p,A,r){i?(i=!1,b=g<l?g<A?g:A:l<A?l:A,c=h<p?h<r?h:r:p<r?p:r,e=g>l?g>A?g:A:l>A?l:A,f=h>p?h>r?h:r:p>r?p:r):(b=g<l?g<A?g<b?g:b:A<b?A:b:l<A?l<b?l:b:A<b?A:b,c=h<p?h<r?h<c?h:c:r<c?r:c:p<r?p<c?p:c:r<c?r:c,e=g>l?g>A?g>e?g:e:A>e?A:e:l>A?l>e?l:e:A>e?A:e,f=h>p?h>r?h>f?h:f:r>f?r:f:p>r?p>f?p:f:r>f?r:f);a()};this.addRectangle=function(g){i?(i=!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(){i=!0;f=e=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,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.Ray=function(a,b){function c(a,b,c){k.sub(c,a);z=k.dot(b);if(z<=0)return null;F=t.add(a,o.copy(b).multiplyScalar(z));return R=c.distanceTo(F)}function d(a,b,c,d){k.sub(d,b);t.sub(c,b);o.sub(a,b);ma=k.dot(k);da=k.dot(t);O=k.dot(o);P=t.dot(t);I=t.dot(o);S=1/(ma*P-da*da);E=(P*O-da*I)*S;N=(ma*I-da*O)*S;return E>=0&&N>=0&&E+N<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 g=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3;this.intersectObject=function(o){for(var k,z=[],t=0,pa=o.children.length;t<pa;t++)Array.prototype.push.apply(z,this.intersectObject(o.children[t]));if(o instanceof THREE.Particle){t=
+c(this.origin,this.direction,o.matrixWorld.getPosition());if(t===null||t>o.scale.x)return[];k={distance:t,point:o.position,face:null,object:o};z.push(k)}else if(o instanceof THREE.Mesh){t=c(this.origin,this.direction,o.matrixWorld.getPosition());if(t===null||t>o.geometry.boundingSphere.radius*Math.max(o.scale.x,Math.max(o.scale.y,o.scale.z)))return z;var F,R=o.geometry,ia=R.vertices,I;o.matrixRotationWorld.extractRotation(o.matrixWorld);t=0;for(pa=R.faces.length;t<pa;t++)if(k=R.faces[t],a.copy(this.origin),
+b.copy(this.direction),I=o.matrixWorld,j=I.multiplyVector3(j.copy(k.centroid)).subSelf(a),F=j.dot(b),!(F<=0)&&(g=I.multiplyVector3(g.copy(ia[k.a].position)),f=I.multiplyVector3(f.copy(ia[k.b].position)),h=I.multiplyVector3(h.copy(ia[k.c].position)),k instanceof THREE.Face4&&(i=I.multiplyVector3(i.copy(ia[k.d].position))),m=o.matrixRotationWorld.multiplyVector3(m.copy(k.normal)),F=b.dot(m),o.doubleSided||(o.flipSided?F>0:F<0)))if(F=m.dot(j.sub(g,a))/F,n.add(a,b.multiplyScalar(F)),k instanceof THREE.Face3)d(n,
+g,f,h)&&(k={distance:a.distanceTo(n),point:n.clone(),face:k,object:o},z.push(k));else if(k instanceof THREE.Face4&&(d(n,g,f,i)||d(n,f,h,i)))k={distance:a.distanceTo(n),point:n.clone(),face:k,object:o},z.push(k)}return z};var k=new THREE.Vector3,t=new THREE.Vector3,o=new THREE.Vector3,z,F,R,ma,da,O,P,I,S,E,N};
+THREE.Rectangle=function(){function a(){f=d-b;h=g-c}var b,c,d,g,f,h,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return g};this.set=function(f,h,n,k){i=!1;b=f;c=h;d=n;g=k;a()};this.addPoint=function(f,h){i?(i=!1,b=f,c=h,d=f,g=h):(b=b<f?b:f,c=c<h?c:h,d=d>f?d:f,g=g>h?g:h);a()};this.add3Points=
+function(f,h,n,k,t,o){i?(i=!1,b=f<n?f<t?f:t:n<t?n:t,c=h<k?h<o?h:o:k<o?k:o,d=f>n?f>t?f:t:n>t?n:t,g=h>k?h>o?h:o:k>o?k:o):(b=f<n?f<t?f<b?f:b:t<b?t:b:n<t?n<b?n:b:t<b?t:b,c=h<k?h<o?h<c?h:c:o<c?o:c:k<o?k<c?k:c:o<c?o:c,d=f>n?f>t?f>d?f:d:t>d?t:d:n>t?n>d?n:d:t>d?t:d,g=h>k?h>o?h>g?h:g:o>g?o:g:k>o?k>g?k:g:o>g?o:g);a()};this.addRectangle=function(f){i?(i=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),g=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),g=g>
+f.getBottom()?g:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;g+=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();g=g<f.getBottom()?g:f.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(g,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){i=!0;g=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,g){return d+(a-b)*(g-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,e,f,g,h,i,n,k,l,p,A,r,y,I){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,g!==void 0?g:1,h||0,i||0,n||0,k||0,l!==void 0?l:1,p||0,A||0,r||0,y||0,I!==void 0?I:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,g,h,i,n,k,l,p,A,r,y,I){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=g;this.n23=h;this.n24=i;this.n31=n;this.n32=k;this.n33=l;this.n34=p;this.n41=A;this.n42=r;this.n43=y;this.n44=I;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,h=a.n21,i=a.n22,n=a.n23,k=a.n24,l=a.n31,p=a.n32,A=a.n33,r=a.n34,y=a.n41,I=a.n42,R=a.n43,
-va=a.n44,ha=b.n11,ja=b.n12,ga=b.n13,L=b.n14,S=b.n21,F=b.n22,N=b.n23,ca=b.n24,M=b.n31,W=b.n32,la=b.n33,oa=b.n34,ra=b.n41,wa=b.n42,Q=b.n43,sa=b.n44;this.n11=c*ha+e*S+f*M+g*ra;this.n12=c*ja+e*F+f*W+g*wa;this.n13=c*ga+e*N+f*la+g*Q;this.n14=c*L+e*ca+f*oa+g*sa;this.n21=h*ha+i*S+n*M+k*ra;this.n22=h*ja+i*F+n*W+k*wa;this.n23=h*ga+i*N+n*la+k*Q;this.n24=h*L+i*ca+n*oa+k*sa;this.n31=l*ha+p*S+A*M+r*ra;this.n32=l*ja+p*F+A*W+r*wa;this.n33=l*ga+p*N+A*la+r*Q;this.n34=l*L+p*ca+A*oa+r*sa;this.n41=y*ha+I*S+R*M+va*ra;
-this.n42=y*ja+I*F+R*W+va*wa;this.n43=y*ga+I*N+R*la+va*Q;this.n44=y*L+I*ca+R*oa+va*sa;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,h=this.n23,i=this.n24,n=this.n31,k=this.n32,l=this.n33,p=this.n34,A=this.n41,r=this.n42,y=this.n43,I=this.n44;return e*h*k*A-c*i*k*A-e*g*l*A+b*i*l*A+c*g*p*A-b*h*p*A-e*h*n*r+c*i*n*r+e*f*l*r-a*i*l*r-c*f*p*r+a*h*p*r+e*g*n*y-b*i*n*y-e*f*k*y+a*i*k*y+b*f*p*y-a*g*p*y-c*
-g*n*I+b*h*n*I+c*f*k*I-a*h*k*I-b*f*l*I+a*g*l*I},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,h=a.y,i=a.z,n=f*g,k=f*h;this.set(n*g+c,n*h-e*i,n*i+e*h,0,n*h+e*i,k*h+c,k*i-e*g,0,n*i-e*h,k*i+e*g,f*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,e=a.n13,f=a.n14,g=a.n21,h=a.n22,i=a.n23,n=a.n24,k=a.n31,l=a.n32,p=a.n33,A=a.n34,r=a.n41,y=a.n42,I=a.n43,R=a.n44;this.n11=i*A*y-n*p*y+n*l*I-h*A*I-i*l*R+h*p*R;this.n12=f*p*y-e*A*y-f*l*I+c*A*I+e*l*R-c*p*R;this.n13=e*n*y-f*i*y+f*h*I-c*n*I-e*h*R+c*i*R;this.n14=f*i*l-e*n*l-f*h*p+c*n*p+e*h*A-
-c*i*A;this.n21=n*p*r-i*A*r-n*k*I+g*A*I+i*k*R-g*p*R;this.n22=e*A*r-f*p*r+f*k*I-b*A*I-e*k*R+b*p*R;this.n23=f*i*r-e*n*r-f*g*I+b*n*I+e*g*R-b*i*R;this.n24=e*n*k-f*i*k+f*g*p-b*n*p-e*g*A+b*i*A;this.n31=h*A*r-n*l*r+n*k*y-g*A*y-h*k*R+g*l*R;this.n32=f*l*r-c*A*r-f*k*y+b*A*y+c*k*R-b*l*R;this.n33=e*n*r-f*h*r+f*g*y-b*n*y-c*g*R+b*h*R;this.n34=f*h*k-c*n*k-f*g*l+b*n*l+c*g*A-b*h*A;this.n41=i*l*r-h*p*r-i*k*y+g*p*y+h*k*I-g*l*I;this.n42=c*p*r-e*l*r+e*k*y-b*p*y-c*k*I+b*l*I;this.n43=e*h*r-c*i*r-e*g*y+b*i*y+c*g*I-b*h*I;
-this.n44=c*i*k-e*h*k+e*g*l-b*i*l-c*g*p+b*h*p;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),h=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var n=h*i,k=h*f,l=e*i,p=e*f;this.n11=n+p*c;this.n12=l*c-k;this.n13=g*e;this.n21=g*f;this.n22=g*i;this.n23=-c;this.n31=k*c-l;this.n32=p+n*c;this.n33=g*h;break;case "ZXY":n=h*i;k=h*f;l=e*i;p=e*f;this.n11=n-p*c;this.n12=-g*f;this.n13=l+k*c;this.n21=
-k+l*c;this.n22=g*i;this.n23=p-n*c;this.n31=-g*e;this.n32=c;this.n33=g*h;break;case "ZYX":n=g*i;k=g*f;l=c*i;p=c*f;this.n11=h*i;this.n12=l*e-k;this.n13=n*e+p;this.n21=h*f;this.n22=p*e+n;this.n23=k*e-l;this.n31=-e;this.n32=c*h;this.n33=g*h;break;case "YZX":n=g*h;k=g*e;l=c*h;p=c*e;this.n11=h*i;this.n12=p-n*f;this.n13=l*f+k;this.n21=f;this.n22=g*i;this.n23=-c*i;this.n31=-e*i;this.n32=k*f+l;this.n33=n-p*f;break;case "XZY":n=g*h;k=g*e;l=c*h;p=c*e;this.n11=h*i;this.n12=-f;this.n13=e*i;this.n21=n*f+p;this.n22=
-g*i;this.n23=k*f-l;this.n31=l*f-k;this.n32=c*i;this.n33=p*f+n;break;default:n=g*i,k=g*f,l=c*i,p=c*f,this.n11=h*i,this.n12=-h*f,this.n13=e,this.n21=k+l*e,this.n22=n-p*e,this.n23=-c*h,this.n31=p-n*e,this.n32=l+k*e,this.n33=g*h}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,e=a.z,f=a.w,g=b+b,h=c+c,i=e+e,a=b*g,n=b*h;b*=i;var k=c*h;c*=i;e*=i;g*=f;h*=f;f*=i;this.n11=1-(k+e);this.n12=n-f;this.n13=b+h;this.n21=n+f;this.n22=1-(a+e);this.n23=c-g;this.n31=b-h;this.n32=c+g;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 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,h=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,n=-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,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*h+a.n31*k;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*h;c[4]=a*i;c[5]=a*n;c[6]=a*k;c[7]=a*l;c[8]=a*p;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,e,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*f/(e-c);h.n23=(e+c)/(e-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,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 h,i,n,k;h=new THREE.Matrix4;i=b-a;n=c-e;k=g-f;h.n11=2/i;h.n12=0;h.n13=0;h.n14=-((b+a)/i);h.n21=0;h.n22=2/n;h.n23=0;h.n24=-((c+e)/n);h.n31=0;h.n32=0;h.n33=-2/k;h.n34=-((g+f)/k);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4=function(a,b,c,d,g,f,h,i,j,m,n,k,t,o,z,F){this.set(a!==void 0?a:1,b||0,c||0,d||0,g||0,f!==void 0?f:1,h||0,i||0,j||0,m||0,n!==void 0?n:1,k||0,t||0,o||0,z||0,F!==void 0?F:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,g,f,h,i,j,m,n,k,t,o,z,F){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=g;this.n22=f;this.n23=h;this.n24=i;this.n31=j;this.n32=m;this.n33=n;this.n34=k;this.n41=t;this.n42=o;this.n43=z;this.n44=F;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var d=THREE.Matrix4.__v1,g=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());g.cross(f,d).normalize();this.n11=d.x;this.n12=g.x;this.n13=f.x;this.n21=d.y;this.n22=g.y;this.n23=f.y;this.n31=d.z;this.n32=g.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,g=a.n13,f=a.n14,h=a.n21,i=a.n22,j=a.n23,m=a.n24,n=a.n31,k=a.n32,t=a.n33,o=a.n34,z=a.n41,F=a.n42,R=a.n43,
+ma=a.n44,da=b.n11,O=b.n12,P=b.n13,I=b.n14,S=b.n21,E=b.n22,N=b.n23,ca=b.n24,M=b.n31,X=b.n32,la=b.n33,pa=b.n34,sa=b.n41,wa=b.n42,ia=b.n43,ta=b.n44;this.n11=c*da+d*S+g*M+f*sa;this.n12=c*O+d*E+g*X+f*wa;this.n13=c*P+d*N+g*la+f*ia;this.n14=c*I+d*ca+g*pa+f*ta;this.n21=h*da+i*S+j*M+m*sa;this.n22=h*O+i*E+j*X+m*wa;this.n23=h*P+i*N+j*la+m*ia;this.n24=h*I+i*ca+j*pa+m*ta;this.n31=n*da+k*S+t*M+o*sa;this.n32=n*O+k*E+t*X+o*wa;this.n33=n*P+k*N+t*la+o*ia;this.n34=n*I+k*ca+t*pa+o*ta;this.n41=z*da+F*S+R*M+ma*sa;this.n42=
+z*O+F*E+R*X+ma*wa;this.n43=z*P+F*N+R*la+ma*ia;this.n44=z*I+F*ca+R*pa+ma*ta;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,g=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)*g;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*g;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,g=a.w;a.x=this.n11*b+this.n12*c+this.n13*
+d+this.n14*g;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*g;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*g;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*g;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,g=this.n21,f=this.n22,h=this.n23,i=this.n24,j=this.n31,m=this.n32,n=this.n33,k=this.n34,t=this.n41,o=this.n42,z=this.n43,F=this.n44;return d*h*m*t-c*i*m*t-d*f*n*t+b*i*n*t+c*f*k*t-b*h*k*t-d*h*j*o+c*i*j*o+d*g*n*o-a*i*n*o-c*g*k*o+a*h*k*o+d*f*j*z-b*i*j*z-d*g*m*z+a*i*m*z+b*g*k*z-a*f*k*z-c*f*j*F+b*h*j*F+
+c*g*m*F-a*h*m*F-b*g*n*F+a*f*n*F},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=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.n34=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),g=1-c,f=a.x,h=a.y,i=a.z,j=g*f,m=g*h;this.set(j*f+c,j*h-d*i,j*i+d*h,0,j*h+d*i,m*h+c,m*i-d*f,0,j*i-d*h,m*i+d*f,g*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,g=a.n14,f=a.n21,h=a.n22,i=a.n23,j=a.n24,m=a.n31,n=a.n32,k=a.n33,t=a.n34,o=a.n41,z=a.n42,F=a.n43,R=a.n44;this.n11=i*t*z-j*k*z+j*n*F-h*t*F-i*n*R+h*k*R;this.n12=g*k*z-d*t*z-g*n*F+c*t*F+d*n*R-c*k*R;this.n13=d*j*z-g*i*z+g*h*F-c*j*F-d*h*R+c*i*R;this.n14=g*i*n-d*j*n-g*h*k+c*j*k+d*h*t-c*i*t;this.n21=j*k*o-i*t*o-j*m*F+f*t*F+i*m*R-f*k*R;this.n22=d*t*o-g*k*o+
+g*m*F-b*t*F-d*m*R+b*k*R;this.n23=g*i*o-d*j*o-g*f*F+b*j*F+d*f*R-b*i*R;this.n24=d*j*m-g*i*m+g*f*k-b*j*k-d*f*t+b*i*t;this.n31=h*t*o-j*n*o+j*m*z-f*t*z-h*m*R+f*n*R;this.n32=g*n*o-c*t*o-g*m*z+b*t*z+c*m*R-b*n*R;this.n33=c*j*o-g*h*o+g*f*z-b*j*z-c*f*R+b*h*R;this.n34=g*h*m-c*j*m-g*f*n+b*j*n+c*f*t-b*h*t;this.n41=i*n*o-h*k*o-i*m*z+f*k*z+h*m*F-f*n*F;this.n42=c*k*o-d*n*o+d*m*z-b*k*z-c*m*F+b*n*F;this.n43=d*h*o-c*i*o-d*f*z+b*i*z+c*f*F-b*h*F;this.n44=c*i*m-d*h*m+d*f*n-b*i*n-c*f*k+b*h*k;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,g=a.z,f=Math.cos(c),c=Math.sin(c),h=Math.cos(d),d=Math.sin(d),i=Math.cos(g),g=Math.sin(g);switch(b){case "YXZ":var j=h*i,m=h*g,n=d*i,k=d*g;this.n11=j+k*c;this.n12=n*c-m;this.n13=f*d;this.n21=f*g;this.n22=f*i;this.n23=-c;this.n31=m*c-n;this.n32=k+j*c;this.n33=f*h;break;case "ZXY":j=h*i;m=h*g;n=d*i;k=d*g;this.n11=j-k*c;this.n12=-f*g;this.n13=n+m*c;this.n21=m+n*c;this.n22=f*i;this.n23=k-j*c;this.n31=-f*d;this.n32=c;this.n33=f*h;break;case "ZYX":j=
+f*i;m=f*g;n=c*i;k=c*g;this.n11=h*i;this.n12=n*d-m;this.n13=j*d+k;this.n21=h*g;this.n22=k*d+j;this.n23=m*d-n;this.n31=-d;this.n32=c*h;this.n33=f*h;break;case "YZX":j=f*h;m=f*d;n=c*h;k=c*d;this.n11=h*i;this.n12=k-j*g;this.n13=n*g+m;this.n21=g;this.n22=f*i;this.n23=-c*i;this.n31=-d*i;this.n32=m*g+n;this.n33=j-k*g;break;case "XZY":j=f*h;m=f*d;n=c*h;k=c*d;this.n11=h*i;this.n12=-g;this.n13=d*i;this.n21=j*g+k;this.n22=f*i;this.n23=m*g-n;this.n31=n*g-m;this.n32=c*i;this.n33=k*g+j;break;default:j=f*i,m=f*
+g,n=c*i,k=c*g,this.n11=h*i,this.n12=-h*g,this.n13=d,this.n21=m+n*d,this.n22=j-k*d,this.n23=-c*h,this.n31=k-j*d,this.n32=n+m*d,this.n33=f*h}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,g=a.w,f=b+b,h=c+c,i=d+d,a=b*f,j=b*h;b*=i;var m=c*h;c*=i;d*=i;f*=g;h*=g;g*=i;this.n11=1-(m+d);this.n12=j-g;this.n13=b+h;this.n21=j+g;this.n22=1-(a+d);this.n23=c-f;this.n31=b-h;this.n32=c+f;this.n33=1-(a+m);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,g=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);g.setScale(c.x,c.y,c.z);this.multiply(d,g);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);g.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=g.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},rotateByAxis:function(a,b){if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);else if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);else if(a.x===0&&a.y===
+0&&a.z===1)return this.rotateZ(b);var c=a.x,d=a.y,g=a.z,f=Math.sqrt(c*c+d*d+g*g);c/=f;d/=f;g/=f;var f=c*c,h=d*d,i=g*g,j=Math.cos(b),m=Math.sin(b),n=1-j,k=c*d*n,t=c*g*n;n*=d*g;c*=m;var o=d*m;m*=g;g=f+(1-f)*j;f=k+m;d=t-o;k-=m;h+=(1-h)*j;m=n+c;t+=o;n-=c;i+=(1-i)*j;var j=this.n11,c=this.n21,o=this.n31,z=this.n41,F=this.n12,R=this.n22,ma=this.n32,da=this.n42,O=this.n13,P=this.n23,I=this.n33,S=this.n43;this.n11=g*j+f*F+d*O;this.n21=g*c+f*R+d*P;this.n31=g*o+f*ma+d*I;this.n41=g*z+f*da+d*S;this.n12=k*j+h*
+F+m*O;this.n22=k*c+h*R+m*P;this.n32=k*o+h*ma+m*I;this.n42=k*z+h*da+m*S;this.n13=t*j+n*F+i*O;this.n23=t*c+n*R+i*P;this.n33=t*o+n*ma+i*I;this.n43=t*z+n*da+i*S;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,g=this.n42,f=this.n13,h=this.n23,i=this.n33,j=this.n43,m=Math.cos(a),a=Math.sin(a);this.n12=m*b+a*f;this.n22=m*c+a*h;this.n32=m*d+a*i;this.n42=m*g+a*j;this.n13=m*f-a*b;this.n23=m*h-a*c;this.n33=m*i-a*d;this.n43=m*j-a*g;return this},rotateY:function(a){var b=this.n11,c=this.n21,
+d=this.n31,g=this.n41,f=this.n13,h=this.n23,i=this.n33,j=this.n43,m=Math.cos(a),a=Math.sin(a);this.n11=m*b-a*f;this.n21=m*c-a*h;this.n31=m*d-a*i;this.n41=m*g-a*j;this.n13=m*f+a*b;this.n23=m*h+a*c;this.n33=m*i+a*d;this.n43=m*j+a*g;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,g=this.n41,f=this.n12,h=this.n22,i=this.n32,j=this.n42,m=Math.cos(a),a=Math.sin(a);this.n11=m*b+a*f;this.n21=m*c+a*h;this.n31=m*d+a*i;this.n41=m*g+a*j;this.n12=m*f-a*b;this.n22=m*h-a*c;this.n32=m*i-a*d;
+this.n42=m*j-a*g;return this},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,k=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*h+a.n31*m;if(a===0)return null;a=1/a;c[0]=a*d;c[1]=a*g;c[2]=a*f;c[3]=a*h;c[4]=a*i;c[5]=a*j;c[6]=a*m;c[7]=a*n;c[8]=a*k;return b};
+THREE.Matrix4.makeFrustum=function(a,b,c,d,g,f){var h;h=new THREE.Matrix4;h.n11=2*g/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*g/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(f+g)/(f-g);h.n34=-2*f*g/(f-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var g,a=c*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,c,d)};
+THREE.Matrix4.makeOrtho=function(a,b,c,d,g,f){var h,i,j,m;h=new THREE.Matrix4;i=b-a;j=c-d;m=f-g;h.n11=2/i;h.n12=0;h.n13=0;h.n14=-((b+a)/i);h.n21=0;h.n22=2/j;h.n23=0;h.n24=-((c+d)/j);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((f+g)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__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&&
+-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,g;c=0;for(d=this.children.length;c<d;c++){g=this.children[c];if(g.name===a)return g;
+if(b&&(g=g.getChildByName(a,b),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 b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=h[g]=h[g]||new THREE.RenderableObject;g++;return a}function b(){var a=k[n]=k[n]||new THREE.RenderableVertex;n++;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,h=-a.z+a.w,i=-b.z+b.w;return g>=0&&f>=0&&h>=0&&i>=0?!0:g<0&&f<0||h<0&&i<0?!1:(g<0?c=Math.max(c,g/(g-f)):f<0&&(e=Math.min(e,g/(g-f))),h<0?c=Math.max(c,h/(h-i)):i<0&&(e=Math.min(e,h/(h-i))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var f,g,h=[],i,n,k=[],
-l,p,A=[],r,y=[],I,R,va=[],ha,ja,ga=[],L={objects:[],sprites:[],lights:[],elements:[]},S=new THREE.Vector3,F=new THREE.Vector4,N=new THREE.Matrix4,ca=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],W=new THREE.Vector4,la=new THREE.Vector4;this.computeFrustum=function(a){M[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);M[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);M[2].set(a.n41+a.n21,a.n42+a.n22,
-a.n43+a.n23,a.n44+a.n24);M[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);M[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);M[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=M[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);N.multiply(b.projectionMatrix,b.matrixWorldInverse);N.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-N.multiply(b.matrixWorld,b.projectionMatrixInverse);N.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;L.objects.length=0;L.sprites.length=0;L.lights.length=0;var h=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)),i=0;i<6;i++)if(c=M[i].x*e.n14+M[i].y*e.n24+M[i].z*e.n34+M[i].w,c<=g){c=!1;break a}c=!0}c?(N.multiplyVector3(S.copy(b.position)),f=a(),f.object=b,f.z=S.z,L.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(N.multiplyVector3(S.copy(b.position)),f=a(),f.object=b,f.z=S.z,L.sprites.push(f)):b instanceof THREE.Light&&L.lights.push(b);c=0;for(e=b.children.length;c<e;c++)h(b.children[c])}};h(b);e&&
-L.objects.sort(c);return L};this.projectScene=function(a,g,f){var h=g.near,S=g.far,M,pa,ma,na,J,O,Y,G,d,ta,xa,Ca,Aa,ya,Fa,za;ja=R=r=p=0;L.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);N.multiply(g.projectionMatrix,g.matrixWorldInverse);this.computeFrustum(N);L=this.projectGraph(a,!1);a=0;for(M=L.objects.length;a<M;a++)if(d=L.objects[a].object,ta=d.matrixWorld,
-Ca=d.material,n=0,d instanceof THREE.Mesh){xa=d.geometry;Aa=d.geometry.materials;na=xa.vertices;ya=xa.faces;Fa=xa.faceVertexUvs;xa=d.matrixRotationWorld.extractRotation(ta);pa=0;for(ma=na.length;pa<ma;pa++)i=b(),i.positionWorld.copy(na[pa].position),ta.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),N.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>h&&i.positionScreen.z<S;na=0;for(pa=
-ya.length;na<pa;na++){ma=ya[na];if(ma instanceof THREE.Face3)if(J=k[ma.a],O=k[ma.b],Y=k[ma.c],J.visible&&O.visible&&Y.visible&&(d.doubleSided||d.flipSided!=(Y.positionScreen.x-J.positionScreen.x)*(O.positionScreen.y-J.positionScreen.y)-(Y.positionScreen.y-J.positionScreen.y)*(O.positionScreen.x-J.positionScreen.x)<0))G=A[p]=A[p]||new THREE.RenderableFace3,p++,l=G,l.v1.copy(J),l.v2.copy(O),l.v3.copy(Y);else continue;else if(ma instanceof THREE.Face4)if(J=k[ma.a],O=k[ma.b],Y=k[ma.c],G=k[ma.d],J.visible&&
-O.visible&&Y.visible&&G.visible&&(d.doubleSided||d.flipSided!=((G.positionScreen.x-J.positionScreen.x)*(O.positionScreen.y-J.positionScreen.y)-(G.positionScreen.y-J.positionScreen.y)*(O.positionScreen.x-J.positionScreen.x)<0||(O.positionScreen.x-Y.positionScreen.x)*(G.positionScreen.y-Y.positionScreen.y)-(O.positionScreen.y-Y.positionScreen.y)*(G.positionScreen.x-Y.positionScreen.x)<0)))za=y[r]=y[r]||new THREE.RenderableFace4,r++,l=za,l.v1.copy(J),l.v2.copy(O),l.v3.copy(Y),l.v4.copy(G);else continue;
-l.normalWorld.copy(ma.normal);xa.multiplyVector3(l.normalWorld);l.centroidWorld.copy(ma.centroid);ta.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);N.multiplyVector3(l.centroidScreen);Y=ma.vertexNormals;J=0;for(O=Y.length;J<O;J++)G=l.vertexNormalsWorld[J],G.copy(Y[J]),xa.multiplyVector3(G);J=0;for(O=Fa.length;J<O;J++)if(za=Fa[J][na]){Y=0;for(G=za.length;Y<G;Y++)l.uvs[J][Y]=za[Y]}l.material=Ca;l.faceMaterial=ma.materialIndex!==null?Aa[ma.materialIndex]:null;l.z=l.centroidScreen.z;
-L.elements.push(l)}}else if(d instanceof THREE.Line){ca.multiply(N,ta);na=d.geometry.vertices;J=b();J.positionScreen.copy(na[0].position);ca.multiplyVector4(J.positionScreen);pa=1;for(ma=na.length;pa<ma;pa++)if(J=b(),J.positionScreen.copy(na[pa].position),ca.multiplyVector4(J.positionScreen),O=k[n-2],W.copy(J.positionScreen),la.copy(O.positionScreen),e(W,la))W.multiplyScalar(1/W.w),la.multiplyScalar(1/la.w),d=va[R]=va[R]||new THREE.RenderableLine,R++,I=d,I.v1.positionScreen.copy(W),I.v2.positionScreen.copy(la),
-I.z=Math.max(W.z,la.z),I.material=Ca,L.elements.push(I)}a=0;for(M=L.sprites.length;a<M;a++)if(d=L.sprites[a].object,ta=d.matrixWorld,d instanceof THREE.Particle&&(F.set(ta.n14,ta.n24,ta.n34,1),N.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))h=ga[ja]=ga[ja]||new THREE.RenderableParticle,ja++,ha=h,ha.x=F.x/F.w,ha.y=F.y/F.w,ha.z=F.z,ha.rotation=d.rotation.z,ha.scale.x=d.scale.x*Math.abs(ha.x-(F.x+g.projectionMatrix.n11)/(F.w+g.projectionMatrix.n14)),ha.scale.y=d.scale.y*Math.abs(ha.y-(F.y+g.projectionMatrix.n22)/
-(F.w+g.projectionMatrix.n24)),ha.material=d.material,L.elements.push(ha);f&&L.elements.sort(c);return L}};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),h=a*b,i=e*f;this.w=h*g-i*c;this.x=h*c+i*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);
+THREE.Projector=function(){function a(){var a=h[f]=h[f]||new THREE.RenderableObject;f++;return a}function b(){var a=m[j]=m[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,g=a.z+a.w,f=b.z+b.w,h=-a.z+a.w,i=-b.z+b.w;return g>=0&&f>=0&&h>=0&&i>=0?!0:g<0&&f<0||h<0&&i<0?!1:(g<0?c=Math.max(c,g/(g-f)):f<0&&(d=Math.min(d,g/(g-f))),h<0?c=Math.max(c,h/(h-i)):i<0&&(d=Math.min(d,h/(h-i))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var g,f,h=[],i,j,m=[],
+n,k,t=[],o,z=[],F,R,ma=[],da,O,P=[],I={objects:[],sprites:[],lights:[],elements:[]},S=new THREE.Vector3,E=new THREE.Vector4,N=new THREE.Matrix4,ca=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],X=new THREE.Vector4,la=new THREE.Vector4;this.computeFrustum=function(a){M[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);M[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);M[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+a.n23,a.n44+a.n24);M[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);M[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);M[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=M[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);N.multiply(b.projectionMatrix,b.matrixWorldInverse);N.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+N.multiply(b.matrixWorld,b.projectionMatrixInverse);N.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;I.objects.length=0;I.sprites.length=0;I.lights.length=0;var h=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)),i=0;i<6;i++)if(c=M[i].x*d.n14+M[i].y*d.n24+M[i].z*d.n34+M[i].w,c<=f){c=!1;break a}c=!0}c?(N.multiplyVector3(S.copy(b.position)),g=a(),g.object=b,g.z=S.z,I.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(N.multiplyVector3(S.copy(b.position)),g=a(),g.object=b,g.z=S.z,I.sprites.push(g)):b instanceof THREE.Light&&I.lights.push(b);c=0;for(d=b.children.length;c<d;c++)h(b.children[c])}};h(b);d&&
+I.objects.sort(c);return I};this.projectScene=function(a,g,f){var h=g.near,S=g.far,M,qa,na,oa,K,W,fa,G,e,ua,xa,Ca,Aa,ya,Fa,za;O=R=o=k=0;I.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);N.multiply(g.projectionMatrix,g.matrixWorldInverse);this.computeFrustum(N);I=this.projectGraph(a,!1);a=0;for(M=I.objects.length;a<M;a++)if(e=I.objects[a].object,ua=e.matrixWorld,
+Ca=e.material,j=0,e instanceof THREE.Mesh){xa=e.geometry;Aa=e.geometry.materials;oa=xa.vertices;ya=xa.faces;Fa=xa.faceVertexUvs;xa=e.matrixRotationWorld.extractRotation(ua);qa=0;for(na=oa.length;qa<na;qa++)i=b(),i.positionWorld.copy(oa[qa].position),ua.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),N.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>h&&i.positionScreen.z<S;oa=0;for(qa=
+ya.length;oa<qa;oa++){na=ya[oa];if(na instanceof THREE.Face3)if(K=m[na.a],W=m[na.b],fa=m[na.c],K.visible&&W.visible&&fa.visible&&(e.doubleSided||e.flipSided!=(fa.positionScreen.x-K.positionScreen.x)*(W.positionScreen.y-K.positionScreen.y)-(fa.positionScreen.y-K.positionScreen.y)*(W.positionScreen.x-K.positionScreen.x)<0))G=t[k]=t[k]||new THREE.RenderableFace3,k++,n=G,n.v1.copy(K),n.v2.copy(W),n.v3.copy(fa);else continue;else if(na instanceof THREE.Face4)if(K=m[na.a],W=m[na.b],fa=m[na.c],G=m[na.d],
+K.visible&&W.visible&&fa.visible&&G.visible&&(e.doubleSided||e.flipSided!=((G.positionScreen.x-K.positionScreen.x)*(W.positionScreen.y-K.positionScreen.y)-(G.positionScreen.y-K.positionScreen.y)*(W.positionScreen.x-K.positionScreen.x)<0||(W.positionScreen.x-fa.positionScreen.x)*(G.positionScreen.y-fa.positionScreen.y)-(W.positionScreen.y-fa.positionScreen.y)*(G.positionScreen.x-fa.positionScreen.x)<0)))za=z[o]=z[o]||new THREE.RenderableFace4,o++,n=za,n.v1.copy(K),n.v2.copy(W),n.v3.copy(fa),n.v4.copy(G);
+else continue;n.normalWorld.copy(na.normal);xa.multiplyVector3(n.normalWorld);n.centroidWorld.copy(na.centroid);ua.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);N.multiplyVector3(n.centroidScreen);fa=na.vertexNormals;K=0;for(W=fa.length;K<W;K++)G=n.vertexNormalsWorld[K],G.copy(fa[K]),xa.multiplyVector3(G);K=0;for(W=Fa.length;K<W;K++)if(za=Fa[K][oa]){fa=0;for(G=za.length;fa<G;fa++)n.uvs[K][fa]=za[fa]}n.material=Ca;n.faceMaterial=na.materialIndex!==null?Aa[na.materialIndex]:
+null;n.z=n.centroidScreen.z;I.elements.push(n)}}else if(e instanceof THREE.Line){ca.multiply(N,ua);oa=e.geometry.vertices;K=b();K.positionScreen.copy(oa[0].position);ca.multiplyVector4(K.positionScreen);qa=1;for(na=oa.length;qa<na;qa++)if(K=b(),K.positionScreen.copy(oa[qa].position),ca.multiplyVector4(K.positionScreen),W=m[j-2],X.copy(K.positionScreen),la.copy(W.positionScreen),d(X,la))X.multiplyScalar(1/X.w),la.multiplyScalar(1/la.w),e=ma[R]=ma[R]||new THREE.RenderableLine,R++,F=e,F.v1.positionScreen.copy(X),
+F.v2.positionScreen.copy(la),F.z=Math.max(X.z,la.z),F.material=Ca,I.elements.push(F)}a=0;for(M=I.sprites.length;a<M;a++)if(e=I.sprites[a].object,ua=e.matrixWorld,e instanceof THREE.Particle&&(E.set(ua.n14,ua.n24,ua.n34,1),N.multiplyVector4(E),E.z/=E.w,E.z>0&&E.z<1))h=P[O]=P[O]||new THREE.RenderableParticle,O++,da=h,da.x=E.x/E.w,da.y=E.y/E.w,da.z=E.z,da.rotation=e.rotation.z,da.scale.x=e.scale.x*Math.abs(da.x-(E.x+g.projectionMatrix.n11)/(E.w+g.projectionMatrix.n14)),da.scale.y=e.scale.y*Math.abs(da.y-
+(E.y+g.projectionMatrix.n22)/(E.w+g.projectionMatrix.n24)),da.material=e.material,I.elements.push(da);f&&I.elements.sort(c);return I}};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,g=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-g),g=Math.sin(-g),f=Math.cos(c),c=Math.sin(c),h=a*b,i=d*g;this.w=h*f-i*c;this.x=h*c+i*f;this.y=d*b*f+a*g*c;this.z=a*g*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,e=this.z,f=this.w,g=a.x,h=a.y,i=a.z,a=a.w;this.x=b*a+f*g+c*i-e*h;this.y=c*a+f*h+e*g-b*i;this.z=e*a+f*i+b*h-c*g;this.w=f*a-b*g-c*h-e*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,e=a.y,f=a.z,g=this.x,h=this.y,i=this.z,n=this.w,k=n*c+h*f-i*e,l=n*e+i*c-g*f,p=n*f+g*e-h*c,c=-g*
-c-h*e-i*f;b.x=k*n+c*-g+l*-i-p*-h;b.y=l*n+c*-h+p*-g-k*-i;b.z=p*n+c*-i+k*-h-l*-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,h){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=h;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
+this.x,c=this.y,d=this.z,g=this.w,f=a.x,h=a.y,i=a.z,a=a.w;this.x=b*a+g*f+c*i-d*h;this.y=c*a+g*h+d*f-b*i;this.z=d*a+g*i+b*h-c*f;this.w=g*a-b*f-c*h-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,g=a.z,f=this.x,h=this.y,i=this.z,j=this.w,m=j*c+h*g-i*d,n=j*d+i*c-f*g,k=j*g+f*d-h*c,c=-f*
+c-h*d-i*g;b.x=m*j+c*-f+n*-i-k*-h;b.y=n*j+c*-h+k*-f-m*-i;b.z=k*j+c*-i+m*-h-n*-f;return b}};
+THREE.Quaternion.slerp=function(a,b,c,d){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;g<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,g=-g):c.copy(b);if(Math.abs(g)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(g),g=Math.sqrt(1-g*g);if(Math.abs(g)<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)/g;d=Math.sin(d*f)/g;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,g,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=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,d,g,f,h){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;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,h=f.vertexNormals.length;g<h;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,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var g=this.faces[c];b.multiplyVector3(g.normal);for(var f=0,h=g.vertexNormals.length;f<h;f++)b.multiplyVector3(g.vertexNormals[f]);a.multiplyVector3(g.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(){var a,
-b,c,e,f,g,h=new THREE.Vector3,i=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],e=this.vertices[c.a],f=this.vertices[c.b],g=this.vertices[c.c],h.sub(g.position,f.position),i.sub(e.position,f.position),h.crossSelf(i),h.isZero()||h.normalize(),c.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,N){i=a.vertices[b].position;n=a.vertices[c].position;k=a.vertices[e].position;l=h[g];p=h[f];A=h[N];r=n.x-i.x;y=k.x-i.x;I=n.y-i.y;R=k.y-i.y;va=n.z-i.z;ha=k.z-i.z;ja=p.u-l.u;ga=A.u-l.u;L=p.v-l.v;S=A.v-l.v;F=1/(ja*S-ga*L);W.set((S*r-L*y)*F,(S*I-L*R)*F,(S*va-L*ha)*F);la.set((ja*y-ga*r)*F,(ja*R-ga*I)*F,(ja*ha-ga*va)*F);ca[b].addSelf(W);ca[c].addSelf(W);ca[e].addSelf(W);M[b].addSelf(la);M[c].addSelf(la);M[e].addSelf(la)}var b,c,e,f,g,h,i,n,k,l,p,A,r,y,I,R,va,ha,ja,ga,L,S,F,N,ca=[],M=[],W=new THREE.Vector3,
-la=new THREE.Vector3,oa=new THREE.Vector3,ra=new THREE.Vector3,wa=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)ca[b]=new THREE.Vector3,M[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],h=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 Q=["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++)wa.copy(g.vertexNormals[e]),
-f=g[Q[e]],N=ca[f],oa.copy(N),oa.subSelf(wa.multiplyScalar(wa.dot(N))).normalize(),ra.cross(g.vertexNormals[e],N),f=ra.dot(M[f]),f=f<0?-1:1,g.vertexTangents[e]=new THREE.Vector4(oa.x,oa.y,oa.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<
+b,c,d,g,f,h=new THREE.Vector3,i=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],g=this.vertices[c.b],f=this.vertices[c.c],h.sub(f.position,g.position),i.sub(d.position,g.position),h.crossSelf(i),h.isZero()||h.normalize(),c.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,g,f,N){i=a.vertices[b].position;j=a.vertices[c].position;m=a.vertices[d].position;n=h[g];k=h[f];t=h[N];o=j.x-i.x;z=m.x-i.x;F=j.y-i.y;R=m.y-i.y;ma=j.z-i.z;da=m.z-i.z;O=k.u-n.u;P=t.u-n.u;I=k.v-n.v;S=t.v-n.v;E=1/(O*S-P*I);X.set((S*o-I*z)*E,(S*F-I*R)*E,(S*ma-I*da)*E);la.set((O*z-P*o)*E,(O*R-P*F)*E,(O*da-P*ma)*E);ca[b].addSelf(X);ca[c].addSelf(X);ca[d].addSelf(X);M[b].addSelf(la);M[c].addSelf(la);M[d].addSelf(la)}var b,c,d,g,f,h,i,j,m,n,k,t,o,z,F,R,ma,da,O,P,I,S,E,N,ca=[],M=[],X=new THREE.Vector3,
+la=new THREE.Vector3,pa=new THREE.Vector3,sa=new THREE.Vector3,wa=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)ca[b]=new THREE.Vector3,M[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],h=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var ia=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)wa.copy(f.vertexNormals[d]),
+g=f[ia[d]],N=ca[g],pa.copy(N),pa.subSelf(wa.multiplyScalar(wa.dot(N))).normalize(),sa.cross(f.vertexNormals[d],N),g=sa.dot(M[g]),g=g<0?-1:1,f.vertexTangents[d]=new THREE.Vector4(pa.x,pa.y,pa.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 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,h;g=0;for(h=this.vertices.length;g<h;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(h=this.faces.length;g<h;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=
+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,g=Math.pow(10,4),f,h;f=0;for(h=this.vertices.length;f<h;f++)d=this.vertices[f].position,d=[Math.round(d.x*g),Math.round(d.y*g),Math.round(d.z*g)].join("_"),a[d]===void 0?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];f=0;for(h=this.faces.length;f<h;f++)if(a=this.faces[f],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,h){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*h+(-3*(b-c)-2*a-e)*f+a*g+b}this.points=a;var c=[],e={x:0,y:0,z:0},f,g,h,i,n,k,l,p,A;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);h=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;k=this.points[c[0]];l=this.points[c[1]];
-p=this.points[c[2]];A=this.points[c[3]];i=h*h;n=h*i;e.x=b(k.x,l.x,p.x,A.x,h,i,n);e.y=b(k.y,l.y,p.y,A.y,h,i,n);e.z=b(k.z,l.z,p.z,A.z,h,i,n);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,h=new THREE.Vector3,i=[],l=0;i[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),h.copy(e),l+=h.distanceTo(f),
-f.copy(e),b*=this.points.length-1,b=Math.floor(b),b!=g&&(i[b]=l,g=b);i[i.length]=l;return{chunks:i,total:l}};this.reparametrizeByArcLength=function(a){var b,c,e,g,f,h,i=[],l=new THREE.Vector3,p=this.getLength();i.push(l.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=p.chunks[b]-p.chunks[b-1];h=Math.ceil(a*c/p.total);g=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<h-1;c++)e=g+c*(1/h)*(f-g),e=this.getPoint(e),i.push(l.copy(e).clone());i.push(l.copy(this.points[b]).clone())}this.points=
-i}};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;
-THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,e,f,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=e;this.width=f;this.height=g;this.updateProjectionMatrix()};
-THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,e=a*c,a=Math.abs(a*b-e),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(e+this.x*a/this.fullWidth,e+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
+THREE.Spline=function(a){function b(a,b,c,d,g,f,h){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*f+a*g+b}this.points=a;var c=[],d={x:0,y:0,z:0},g,f,h,i,j,m,n,k,t;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;f=Math.floor(g);h=g-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?f:f+1;c[3]=f>this.points.length-3?f:f+2;m=this.points[c[0]];n=this.points[c[1]];
+k=this.points[c[2]];t=this.points[c[3]];i=h*h;j=h*i;d.x=b(m.x,n.x,k.x,t.x,h,i,j);d.y=b(m.y,n.y,k.y,t.y,h,i,j);d.z=b(m.z,n.z,k.z,t.z,h,i,j);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,g=b=b=0,f=new THREE.Vector3,h=new THREE.Vector3,i=[],m=0;i[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),h.copy(d),m+=h.distanceTo(f),
+f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=g&&(i[b]=m,g=b);i[i.length]=m;return{chunks:i,total:m}};this.reparametrizeByArcLength=function(a){var b,c,d,g,f,h,i=[],m=new THREE.Vector3,n=this.getLength();i.push(m.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=n.chunks[b]-n.chunks[b-1];h=Math.ceil(a*c/n.total);g=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<h-1;c++)d=g+c*(1/h)*(f-g),d=this.getPoint(d),i.push(m.copy(d).clone());i.push(m.copy(this.points[b]).clone())}this.points=
+i}};THREE.Edge=function(a,b,c,d){this.vertices=[a,b];this.vertexIndices=[c,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,b,c,d,g,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=g!==void 0?g:0.1;this.far=f!==void 0?f: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,d){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=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
+THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,g,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=g;this.height=f;this.updateProjectionMatrix()};
+THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;
-THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(a,b,c,e){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0;this.castShadow=e!==void 0?e:!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
+THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(a,b,c,d){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0;this.castShadow=d!==void 0?d:!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
 THREE.Material=function(a){this.name="";this.id=THREE.MaterialCount++;a=a||{};this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:!1;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==void 0?a.depthTest:!0;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:!0;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:!1;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
 a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:!1};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;
 THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
@@ -117,22 +121,22 @@ THREE.MeshShaderMaterial=function(a){console.warn("DEPRECATED: MeshShaderMateria
 THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=a.fog!==
 void 0?a.fog:!1;this.lights=a.lights!==void 0?a.lights:!1;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
-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;this.onUpdate=null};
+THREE.Texture=function(a,b,c,d,g,f){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=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=g!==void 0?g:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1;this.onUpdate=null};
 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,h,i,n){THREE.Texture.call(this,null,f,g,h,i,n);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,d,g,f,h,i,j){THREE.Texture.call(this,null,g,f,h,i,j);this.image={data:a,width:b,height:c};this.format=d!==void 0?d: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,h,i;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++)f=this.geometry.bones[c],g=f.pos,h=f.rotq,i=f.scl,e=this.addBone(),e.name=f.name,e.position.set(g[0],g[1],g[2]),e.quaternion.set(h[0],h[1],h[2],h[3]),e.useQuaternion=!0,i!==void 0?e.scale.set(i[0],i[1],i[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,
+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,d=this.children.length;for(c=0;c<d;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,d,g,f,h,i;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++)g=this.geometry.bones[c],f=g.pos,h=g.rotq,i=g.scl,d=this.addBone(),d.name=g.name,d.position.set(f[0],f[1],f[2]),d.quaternion.set(h[0],h[1],h[2],h[3]),d.useQuaternion=!0,i!==void 0?d.scale.set(i[0],i[1],i[2]):d.scale.set(1,1,1);for(c=0;c<this.bones.length;c++)g=this.geometry.bones[c],
+d=this.bones[c],g.parent===-1?this.add(d):this.bones[g.parent].add(d);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;THREE.SkinnedMesh.prototype.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,d=this.boneMatrices,a=0;a<b;a++)c[a].skinMatrix.flattenToArrayOffset(d,
 a*16)};
-THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var e=new THREE.Matrix4;e.getInverse(a.skinMatrix);b.push(e);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a].position,f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y,e=
-new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(e));e=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[g].multiplyVector3(e));this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1&&(c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5,this.geometry.skinWeights[a].x+=c,this.geometry.skinWeights[a].y+=c)}}};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};
+THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var d=new THREE.Matrix4;d.getInverse(a.skinMatrix);b.push(d);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a].position,g=this.geometry.skinIndices[a].x,f=this.geometry.skinIndices[a].y,d=
+new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[g].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[f].multiplyVector3(d));this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1&&(c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5,this.geometry.skinWeights[a].x+=c,this.geometry.skinWeights[a].y+=c)}}};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};
 THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.addLevel=function(a,b){b===void 0&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
 THREE.LOD.prototype.update=function(a){if(this.LODs.length>1){a.matrixWorldInverse.getInverse(a.matrixWorld);a=a.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var b=1;b<this.LODs.length;b++)if(a>=this.LODs[b].visibleAtDistance)this.LODs[b-1].object3D.visible=!1,this.LODs[b].object3D.visible=!0;else break;for(;b<this.LODs.length;b++)this.LODs[b].object3D.visible=!1}};
 THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map instanceof THREE.Texture?a.map:THREE.ImageUtils.loadTexture(a.map);this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.useScreenCoordinates=a.useScreenCoordinates!==void 0?a.useScreenCoordinates:!0;this.mergeWith3D=a.mergeWith3D!==void 0?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=a.affectedByDistance!==void 0?a.affectedByDistance:
@@ -156,7 +160,7 @@ morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInflu
 default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
 shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_SOFT\nconst float xPixelOffset = 1.0 / SHADOWMAP_WIDTH;\nconst float yPixelOffset = 1.0 / SHADOWMAP_HEIGHT;\n#endif\nvec3 shadowColor = vec3( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nshadowCoord.z += shadowBias;\nif ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( shadowDarkness );\n#endif\n}\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif",
 shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",linear_to_gamma_fragment:"#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"};
-THREE.UniformsUtils={merge:function(a){var b,c,e,f={};for(b=0;b<a.length;b++)for(c in e=this.clone(a[b]),e)f[c]=e[c];return f},clone:function(a){var b,c,e,f={};for(b in a)for(c in f[b]={},a[b])e=a[b][c],f[b][c]=e instanceof THREE.Color||e instanceof THREE.Vector2||e instanceof THREE.Vector3||e instanceof THREE.Vector4||e instanceof THREE.Matrix4||e instanceof THREE.Texture?e.clone():e instanceof Array?e.slice():e;return f}};
+THREE.UniformsUtils={merge:function(a){var b,c,d,g={};for(b=0;b<a.length;b++)for(c in d=this.clone(a[b]),d)g[c]=d[c];return g},clone:function(a){var b,c,d,g={};for(b in a)for(c in g[b]={},a[b])d=a[b][c],g[b][c]=d instanceof THREE.Color||d instanceof THREE.Vector2||d instanceof THREE.Vector3||d instanceof THREE.Vector4||d instanceof THREE.Matrix4||d instanceof THREE.Texture?d.clone():d instanceof Array?d.slice():d;return g}};
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",
 value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",
 value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:6,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
@@ -176,126 +180,126 @@ THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THR
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
 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 z=1;f.type==="v2"?z=2:f.type==="v3"?z=3:f.type==="v4"?z=4:f.type==="c"&&(z=3);f.size=z;f.array=new Float32Array(c*z);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){if(a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial)return!1;return a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){if(a.vertexColors)return a.vertexColors;return!1}function g(a){if(a.map||a.lightMap||a instanceof THREE.ShaderMaterial)return!0;
-return!1}function h(a,b,c){var e,g,f,z,m=a.vertices;z=m.length;var h=a.colors,i=h.length,s=a.__vertexArray,w=a.__colorArray,j=a.__sortArray,q=a.__dirtyVertices,l=a.__dirtyColors,p=a.__webglCustomAttributesList;if(c.sortParticles){Ba.multiplySelf(c.matrixWorld);for(e=0;e<z;e++)g=m[e].position,Da.copy(g),Ba.multiplyVector3(Da),j[e]=[Da.z,e];j.sort(function(a,b){return b[0]-a[0]});for(e=0;e<z;e++)g=m[j[e][1]].position,f=e*3,s[f]=g.x,s[f+1]=g.y,s[f+2]=g.z;for(e=0;e<i;e++)f=e*3,g=h[j[e][1]],w[f]=g.r,w[f+
-1]=g.g,w[f+2]=g.b;if(p){h=0;for(i=p.length;h<i;h++)if(m=p[h],m.boundTo===void 0||m.boundTo==="vertices")if(f=0,g=m.value.length,m.size===1)for(e=0;e<g;e++)z=j[e][1],m.array[e]=m.value[z];else if(m.size===2)for(e=0;e<g;e++)z=j[e][1],z=m.value[z],m.array[f]=z.x,m.array[f+1]=z.y,f+=2;else if(m.size===3)if(m.type==="c")for(e=0;e<g;e++)z=j[e][1],z=m.value[z],m.array[f]=z.r,m.array[f+1]=z.g,m.array[f+2]=z.b,f+=3;else for(e=0;e<g;e++)z=j[e][1],z=m.value[z],m.array[f]=z.x,m.array[f+1]=z.y,m.array[f+2]=z.z,
-f+=3;else if(m.size===4)for(e=0;e<g;e++)z=j[e][1],z=m.value[z],m.array[f]=z.x,m.array[f+1]=z.y,m.array[f+2]=z.z,m.array[f+3]=z.w,f+=4}}else{if(q)for(e=0;e<z;e++)g=m[e].position,f=e*3,s[f]=g.x,s[f+1]=g.y,s[f+2]=g.z;if(l)for(e=0;e<i;e++)g=h[e],f=e*3,w[f]=g.r,w[f+1]=g.g,w[f+2]=g.b;if(p){h=0;for(i=p.length;h<i;h++)if(m=p[h],m.needsUpdate&&(m.boundTo===void 0||m.boundTo==="vertices"))if(g=m.value.length,f=0,m.size===1)for(e=0;e<g;e++)m.array[e]=m.value[e];else if(m.size===2)for(e=0;e<g;e++)z=m.value[e],
-m.array[f]=z.x,m.array[f+1]=z.y,f+=2;else if(m.size===3)if(m.type==="c")for(e=0;e<g;e++)z=m.value[e],m.array[f]=z.r,m.array[f+1]=z.g,m.array[f+2]=z.b,f+=3;else for(e=0;e<g;e++)z=m.value[e],m.array[f]=z.x,m.array[f+1]=z.y,m.array[f+2]=z.z,f+=3;else if(m.size===4)for(e=0;e<g;e++)z=m.value[e],m.array[f]=z.x,m.array[f+1]=z.y,m.array[f+2]=z.z,m.array[f+3]=z.w,f+=4}}if(q||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,s,b);if(l||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,
-a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,w,b);if(p){h=0;for(i=p.length;h<i;h++)if(m=p[h],m.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,m.buffer),d.bufferData(d.ARRAY_BUFFER,m.array,b)}}function i(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,h,m,u,i,s,w,j,q=a.count*3;for(j=0;j<q;j+=9)c=a.normalArray,e=c[j],f=c[j+1],g=c[j+2],h=c[j+3],u=c[j+4],s=c[j+5],m=c[j+6],i=c[j+7],w=c[j+8],e=(e+h+m)/3,f=(f+u+i)/3,g=(g+s+w)/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 n(a,b,c,e,f,g){if(e.opacity!==0){var h,m,c=ja(a,b,c,e,g),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==ya&&(ya=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){h=0;var u=g.morphTargetForcedOrder;for(m=g.morphTargetInfluences;h<e.numSupportedMorphTargets&&h<u.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[u[h]]),d.vertexAttribPointer(c["morphTarget"+h],3,d.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[h]=m[u[h]],h++}else{var u=[],i=-1,
-s=0;m=g.morphTargetInfluences;var w,j=m.length;h=0;for(g.morphTargetBase!==-1&&(u[g.morphTargetBase]=!0);h<e.numSupportedMorphTargets;){for(w=0;w<j;w++)!u[w]&&m[w]>i&&(s=w,i=m[s]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[s]);d.vertexAttribPointer(c["morphTarget"+h],3,d.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[h]=i;u[s]=1;i=-1;h++}}e.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(e.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){h=
-0;for(m=f.__webglCustomAttributesList.length;h<m;h++)c=f.__webglCustomAttributesList[h],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!==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)),G.info.render.calls++,G.info.render.vertices+=f.__webglFaceCount,G.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),G.info.render.calls++):g instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),G.info.render.calls++):g instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),G.info.render.calls++)}}function k(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 l(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 p(a,b){return b.z-a.z}function A(a){var b,
-c,e,f,g,h,m,u,p=0,s=a.lights;ua||(ua=new THREE.PerspectiveCamera(G.shadowCameraFov,G.shadowMapWidth/G.shadowMapHeight,G.shadowCameraNear,G.shadowCameraFar));b=0;for(c=s.length;b<c;b++)if(u=s[b],u.castShadow&&u instanceof THREE.SpotLight){Aa=-1;G.shadowMap[p]||(G.shadowMap[p]=new THREE.WebGLRenderTarget(G.shadowMapWidth,G.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),Ja[p]=new THREE.Matrix4);e=G.shadowMap[p];f=Ja[p];ua.position.copy(u.position);
-ua.lookAt(u.target.position);ua.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ua),this.autoUpdateScene&&a.updateMatrixWorld());ua.matrixWorldInverse.getInverse(ua.matrixWorld);f.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);f.multiplySelf(ua.projectionMatrix);f.multiplySelf(ua.matrixWorldInverse);ua.matrixWorldInverse.flattenToArray(Ka);ua.projectionMatrix.flattenToArray(La);Ba.multiply(ua.projectionMatrix,ua.matrixWorldInverse);k(Ba);ra(e);d.clearColor(1,1,1,1);
-G.clear();d.clearColor(J.r,J.g,J.b,O);f=a.__webglObjects.length;for(e=0;e<f;e++)if(h=a.__webglObjects[e],u=h.object,h.render=!1,u.visible&&u.castShadow&&(!(u instanceof THREE.Mesh)||!u.frustumCulled||l(u)))u.matrixWorld.flattenToArray(u._objectMatrixArray),ga(u,ua,!1),h.render=!0;S(!0);ca(THREE.NormalBlending);for(e=0;e<f;e++)if(h=a.__webglObjects[e],h.render)u=h.object,h=h.buffer,L(u),m=u.customDepthMaterial?u.customDepthMaterial:u.geometry.morphTargets.length?Ma:Ga,n(ua,s,null,m,h,u);f=a.__webglObjectsImmediate.length;
-for(e=0;e<f;e++)h=a.__webglObjectsImmediate[e],u=h.object,u.visible&&u.castShadow&&(u.matrixAutoUpdate&&u.matrixWorld.flattenToArray(u._objectMatrixArray),ya=-1,ga(u,ua,!1),L(u),g=ja(ua,s,null,Ga,u),u.immediateRenderCallback?u.immediateRenderCallback(g,d,qa):u.render(function(a){i(a,g,Ga.shading)}));p++}}function r(a,b,d,c,e,f,g,h){var u,i,s,w;b?(i=a.length-1,w=b=-1):(i=0,b=a.length,w=1);for(var j=i;j!==b;j+=w)if(u=a[j],u.render){i=u.object;s=u.buffer;if(h)u=h;else{u=u[d];if(!u)continue;g&&ca(u.blending);
-S(u.depthTest);F(u.depthWrite);N(u.polygonOffset,u.polygonOffsetFactor,u.polygonOffsetUnits)}L(i);n(c,e,f,u,s,i)}}function y(a,b,c,e,f,g,h){for(var m,u,p,s,w=0,j=a.length;w<j;w++)if(m=a[w],u=m.object,u.visible){ya=-1;if(h)p=h;else{p=m[b];if(!p)continue;g&&ca(p.blending);S(p.depthTest);F(p.depthWrite);N(p.polygonOffset,p.polygonOffsetFactor,p.polygonOffsetUnits)}L(u);s=ja(c,e,f,p,u);u.immediateRenderCallback?u.immediateRenderCallback(s,d,qa):u.render(function(a){i(a,s,p.shading)})}}function I(a,b,
-d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function R(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function va(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function ha(a,b){for(var d=a.length-1;d>=0;d--)a[d].object===b&&a.splice(d,1)}function ja(a,b,c,e,f){e.program||G.initMaterial(e,b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(G.maxMorphTargets);for(var g=0,h=G.maxMorphTargets;g<
-h;g++)f.__webglMorphTargetInfluences[g]=0}var m=!1,g=e.program,h=g.uniforms,u=e.uniforms;g!==xa&&(d.useProgram(g),xa=g,m=!0);if(e.id!==Aa)Aa=e.id,m=!0;if(m){d.uniformMatrix4fv(h.projectionMatrix,!1,La);if(c&&e.fog)if(u.fogColor.value=c.color,c instanceof THREE.Fog)u.fogNear.value=c.near,u.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)u.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var i,s,w=0,j=0,q=0,p,l,n,k=Sa,r=
-k.directional.colors,A=k.directional.positions,v=k.point.colors,B=k.point.positions,I=k.point.distances,x=0,y=0,c=i=n=0,m=b.length;c<m;c++)if(i=b[c],s=i.color,p=i.position,l=i.intensity,n=i.distance,i instanceof THREE.AmbientLight)G.gammaInput?(w+=s.r*s.r,j+=s.g*s.g,q+=s.b*s.b):(w+=s.r,j+=s.g,q+=s.b);else if(i instanceof THREE.DirectionalLight)n=x*3,G.gammaInput?(r[n]=s.r*s.r*l*l,r[n+1]=s.g*s.g*l*l,r[n+2]=s.b*s.b*l*l):(r[n]=s.r*l,r[n+1]=s.g*l,r[n+2]=s.b*l),A[n]=p.x,A[n+1]=p.y,A[n+2]=p.z,x+=1;else if(i instanceof
-THREE.SpotLight)n=x*3,G.gammaInput?(r[n]=s.r*s.r*l*l,r[n+1]=s.g*s.g*l*l,r[n+2]=s.b*s.b*l*l):(r[n]=s.r*l,r[n+1]=s.g*l,r[n+2]=s.b*l),s=1/p.length(),A[n]=p.x*s,A[n+1]=p.y*s,A[n+2]=p.z*s,x+=1;else if(i instanceof THREE.PointLight)i=y*3,G.gammaInput?(v[i]=s.r*s.r*l*l,v[i+1]=s.g*s.g*l*l,v[i+2]=s.b*s.b*l*l):(v[i]=s.r*l,v[i+1]=s.g*l,v[i+2]=s.b*l),B[i]=p.x,B[i+1]=p.y,B[i+2]=p.z,I[y]=n,y+=1;c=x*3;for(m=r.length;c<m;c++)r[c]=0;c=y*3;for(m=v.length;c<m;c++)v[c]=0;k.point.length=y;k.directional.length=x;k.ambient[0]=
-w;k.ambient[1]=j;k.ambient[2]=q;b=Sa;u.ambientLightColor.value=b.ambient;u.directionalLightColor.value=b.directional.colors;u.directionalLightDirection.value=b.directional.positions;u.pointLightColor.value=b.point.colors;u.pointLightPosition.value=b.point.positions;u.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)u.opacity.value=e.opacity,G.gammaInput?u.diffuse.value.copyGammaToLinear(e.color):
-u.diffuse.value=e.color,(u.map.texture=e.map)&&u.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),u.lightMap.texture=e.lightMap,u.envMap.texture=e.envMap,u.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,u.reflectivity.value=e.reflectivity,u.refractionRatio.value=e.refractionRatio,u.combine.value=e.combine,u.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)u.diffuse.value=
-e.color,u.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)u.psColor.value=e.color,u.opacity.value=e.opacity,u.size.value=e.size,u.scale.value=sa.height/2,u.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)u.shininess.value=e.shininess,G.gammaInput?(u.ambient.value.copyGammaToLinear(e.ambient),u.specular.value.copyGammaToLinear(e.specular)):(u.ambient.value=e.ambient,u.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)G.gammaInput?u.ambient.value.copyGammaToLinear(e.ambient):
-u.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)u.mNear.value=a.near,u.mFar.value=a.far,u.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)u.opacity.value=e.opacity;if(f.receiveShadow&&!e._shadowPass&&u.shadowMatrix){for(b=0;b<Ja.length;b++)u.shadowMatrix.value[b]=Ja[b],u.shadowMap.texture[b]=G.shadowMap[b];u.shadowDarkness.value=G.shadowMapDarkness;u.shadowBias.value=G.shadowMapBias}b=e.uniformsList;u=0;for(c=b.length;u<c;u++)if(j=g.uniforms[b[u][1]])if(w=
-b[u][0],q=w.type,m=w.value,q==="i")d.uniform1i(j,m);else if(q==="f")d.uniform1f(j,m);else if(q==="v2")d.uniform2f(j,m.x,m.y);else if(q==="v3")d.uniform3f(j,m.x,m.y,m.z);else if(q==="v4")d.uniform4f(j,m.x,m.y,m.z,m.w);else if(q==="c")d.uniform3f(j,m.r,m.g,m.b);else if(q==="fv1")d.uniform1fv(j,m);else if(q==="fv")d.uniform3fv(j,m);else if(q==="v3v"){if(!w._array)w._array=new Float32Array(3*m.length);q=0;for(p=m.length;q<p;q++)k=q*3,w._array[k]=m[q].x,w._array[k+1]=m[q].y,w._array[k+2]=m[q].z;d.uniform3fv(j,
-w._array)}else if(q==="m4"){if(!w._array)w._array=new Float32Array(16);m.flattenToArray(w._array);d.uniformMatrix4fv(j,!1,w._array)}else if(q==="m4v"){if(!w._array)w._array=new Float32Array(16*m.length);q=0;for(p=m.length;q<p;q++)m[q].flattenToArrayOffset(w._array,q*16);d.uniformMatrix4fv(j,!1,w._array)}else if(q==="t"){if(d.uniform1i(j,m),j=w.texture)if(j.image instanceof Array&&j.image.length===6){if(w=j,w.image.length===6)if(w.needsUpdate){if(!w.image.__webglTextureCube)w.image.__webglTextureCube=
-d.createTexture();d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_CUBE_MAP,w.image.__webglTextureCube);m=W(d.TEXTURE_CUBE_MAP,w,w.image[0]);for(j=0;j<6;j++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,w.image[j]);m&&d.generateMipmap(d.TEXTURE_CUBE_MAP);w.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+m),d.bindTexture(d.TEXTURE_CUBE_MAP,w.image.__webglTextureCube)}else j instanceof THREE.WebGLRenderTargetCube?(w=j,d.activeTexture(d.TEXTURE0+m),d.bindTexture(d.TEXTURE_CUBE_MAP,
-w.__webglTexture)):la(j,m)}else if(q==="tv"){if(!w._array){w._array=[];q=0;for(p=w.texture.length;q<p;q++)w._array[q]=m+q}d.uniform1iv(j,w._array);q=0;for(p=w.texture.length;q<p;q++)(j=w.texture[q])&&la(j,w._array[q])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&h.cameraPosition!==null&&d.uniform3f(h.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||
-e.skinning)&&h.viewMatrix!==null&&d.uniformMatrix4fv(h.viewMatrix,!1,Ka);e.skinning&&(d.uniformMatrix4fv(h.cameraInverseMatrix,!1,Ka),d.uniformMatrix4fv(h.boneGlobalMatrices,!1,f.boneMatrices))}d.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray);h.normalMatrix&&d.uniformMatrix3fv(h.normalMatrix,!1,f._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||f.receiveShadow)&&h.objectMatrix!==null&&d.uniformMatrix4fv(h.objectMatrix,!1,f._objectMatrixArray);return g}
-function ga(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function L(a){if(za!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),za=a.doubleSided;if(Ta!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),Ta=a.flipSided}function S(a){Na!==a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),Na=a)}function F(a){Oa!==a&&
-(d.depthMask(a),Oa=a)}function N(a,b,c){Ua!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),Ua=a);if(a&&(Va!==b||Wa!==c))d.polygonOffset(b,c),Va=b,Wa=c}function ca(a){if(a!==Pa){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)}Pa=a}}function M(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 W(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0?
-(d.texParameteri(a,d.TEXTURE_WRAP_S,Q(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,Q(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,Q(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,Q(b.minFilter)),!0):(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,wa(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,wa(b.minFilter)),!1)}function la(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=
-d.createTexture(),G.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);var c=W(d.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0,Q(a.format),a.image.width,a.image.height,0,Q(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);c&&d.generateMipmap(d.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,
-a.__webglTexture)}function oa(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);W(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,Q(a.format),a.width,a.height,0,Q(a.format),Q(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);oa(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),W(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,Q(a.format),a.width,a.height,0,Q(a.format),
-Q(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),oa(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=Ea,e=Qa,f=Ra);b!==Ca&&(d.bindFramebuffer(d.FRAMEBUFFER,
-b),d.viewport(e,f,c,a),Ca=b)}function wa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function Q(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||{},sa=a.canvas!==void 0?a.canvas:document.createElement("canvas"),Za=a.precision!==void 0?a.precision:"highp",pa=a.antialias!==void 0?a.antialias:!1,ma=a.stencil!==void 0?a.stencil:!0,na=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,J=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),
-O=a.clearAlpha!==void 0?a.clearAlpha:0,Y=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 G=this,d,ta=[],xa=null,Ca=null,Aa=-1,ya=null,Fa=0,za=null,Ta=null,Pa=null,Na=null,Oa=null,Ua=null,Va=null,Wa=null,Ia=null,Qa=0,Ra=0,Ha=0,Ea=0,qa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ba=new THREE.Matrix4,La=new Float32Array(16),Ka=new Float32Array(16),
-Da=new THREE.Vector4,Sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},ua,Ja=[],Ga,Ma,B={},Xa=!1;d=function(){var a;try{if(!(a=sa.getContext("experimental-webgl",{antialias:pa,stencil:ma,preserveDrawingBuffer:na})))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(J.r,J.g,J.b,O);(function(){B.vertices=new Float32Array(16);B.faces=new Uint16Array(6);var a=0;B.vertices[a++]=-1;B.vertices[a++]=-1;B.vertices[a++]=0;B.vertices[a++]=1;B.vertices[a++]=1;B.vertices[a++]=-1;B.vertices[a++]=1;B.vertices[a++]=
-1;B.vertices[a++]=1;B.vertices[a++]=1;B.vertices[a++]=1;B.vertices[a++]=0;B.vertices[a++]=-1;B.vertices[a++]=1;B.vertices[a++]=0;a=B.vertices[a++]=0;B.faces[a++]=0;B.faces[a++]=1;B.faces[a++]=2;B.faces[a++]=0;B.faces[a++]=2;B.faces[a++]=3;B.vertexBuffer=d.createBuffer();B.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,B.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,B.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,B.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,B.faces,d.STATIC_DRAW);
-B.program=d.createProgram();d.attachShader(B.program,M("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(B.program,M("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(B.program);B.attributes={};B.uniforms={};B.attributes.position=d.getAttribLocation(B.program,"position");B.attributes.uv=d.getAttribLocation(B.program,"uv");B.uniforms.uvOffset=d.getUniformLocation(B.program,"uvOffset");B.uniforms.uvScale=d.getUniformLocation(B.program,"uvScale");B.uniforms.rotation=d.getUniformLocation(B.program,
-"rotation");B.uniforms.scale=d.getUniformLocation(B.program,"scale");B.uniforms.alignment=d.getUniformLocation(B.program,"alignment");B.uniforms.color=d.getUniformLocation(B.program,"color");B.uniforms.map=d.getUniformLocation(B.program,"map");B.uniforms.opacity=d.getUniformLocation(B.program,"opacity");B.uniforms.useScreenCoordinates=d.getUniformLocation(B.program,"useScreenCoordinates");B.uniforms.affectedByDistance=d.getUniformLocation(B.program,"affectedByDistance");B.uniforms.screenPosition=
-d.getUniformLocation(B.program,"screenPosition");B.uniforms.modelViewMatrix=d.getUniformLocation(B.program,"modelViewMatrix");B.uniforms.projectionMatrix=d.getUniformLocation(B.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});Ma=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});
-Ga._shadowPass=!0;Ma._shadowPass=!0})();this.context=d;var Ya=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return d};this.supportsVertexTextures=function(){return Ya};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){Qa=a;Ra=b;Ha=c;Ea=e;d.viewport(Qa,Ra,Ha,Ea)};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){J.setHex(a);O=b;d.clearColor(J.r,J.g,J.b,O)};this.setClearColor=function(a,b){J.copy(a);O=b;d.clearColor(J.r,J.g,J.b,O)};this.getClearColor=function(){return J};this.getClearAlpha=function(){return O};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]);if(c.__webglCustomAttributesList)for(e in e=void 0,c.__webglCustomAttributesList)d.deleteBuffer(c.__webglCustomAttributesList[e].buffer);G.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),
-d.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),G.info.memory.textures--};this.updateShadowMap=
-function(a,b){A(a,b)};this.render=function(a,b,c,e){var f,g,h,m,i=a.lights,n=a.fog;Aa=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();this.shadowMapEnabled&&this.shadowMapAutoUpdate&&A(a,b);G.info.render.calls=0;G.info.render.vertices=0;G.info.render.faces=0;b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ka);
-b.projectionMatrix.flattenToArray(La);Ba.multiply(b.projectionMatrix,b.matrixWorldInverse);k(Ba);ra(c);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;e=0;for(f=m.length;e<f;e++)if(g=m[e],h=g.object,g.render=!1,h.visible&&(!(h instanceof THREE.Mesh)||!h.frustumCulled||l(h))){h.matrixWorld.flattenToArray(h._objectMatrixArray);ga(h,b,!0);var s=g,w=s.object,j=s.buffer,q=void 0,q=q=void 0,q=w.material;if(q instanceof THREE.MeshFaceMaterial){if(q=
-j.materialIndex,q>=0)q=w.geometry.materials[q],q.transparent?(s.transparent=q,s.opaque=null):(s.opaque=q,s.transparent=null)}else if(q)q.transparent?(s.transparent=q,s.opaque=null):(s.opaque=q,s.transparent=null);g.render=!0;if(this.sortObjects)h.renderDepth?g.z=h.renderDepth:(Da.copy(h.position),Ba.multiplyVector3(Da),g.z=Da.z)}this.sortObjects&&m.sort(p);m=a.__webglObjectsImmediate;e=0;for(f=m.length;e<f;e++)if(g=m[e],h=g.object,h.visible)h.matrixAutoUpdate&&h.matrixWorld.flattenToArray(h._objectMatrixArray),
-ga(h,b,!0),h=g.object.material,h.transparent?(g.transparent=h,g.opaque=null):(g.opaque=h,g.transparent=null);a.overrideMaterial?(ca(a.overrideMaterial.blending),S(a.overrideMaterial.depthTest),F(a.overrideMaterial.depthWrite),N(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),r(a.__webglObjects,!1,"",b,i,n,!0,a.overrideMaterial),y(a.__webglObjectsImmediate,"",b,i,n,!1,a.overrideMaterial)):(ca(THREE.NormalBlending),r(a.__webglObjects,!0,
-"opaque",b,i,n,!1),y(a.__webglObjectsImmediate,"opaque",b,i,n,!1),r(a.__webglObjects,!1,"transparent",b,i,n,!0),y(a.__webglObjectsImmediate,"transparent",b,i,n,!0));if(a.__webglSprites.length){h=B.attributes;i=B.uniforms;n=Ea/Ha;e=[];f=Ha*0.5;m=Ea*0.5;g=!0;d.useProgram(B.program);xa=B.program;ya=Na=Pa=-1;Xa||(d.enableVertexAttribArray(B.attributes.position),d.enableVertexAttribArray(B.attributes.uv),Xa=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,B.vertexBuffer);
-d.vertexAttribPointer(h.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(h.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,B.elementBuffer);d.uniformMatrix4fv(i.projectionMatrix,!1,La);d.activeTexture(d.TEXTURE0);d.uniform1i(i.map,0);h=0;for(s=a.__webglSprites.length;h<s;h++)if(w=a.__webglSprites[h],w.visible&&w.opacity!==0)w.useScreenCoordinates?w.z=-w.position.z:(w._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,w.matrixWorld,w._modelViewMatrixArray),w.z=-w._modelViewMatrix.n34);
-a.__webglSprites.sort(p);h=0;for(s=a.__webglSprites.length;h<s;h++)w=a.__webglSprites[h],w.visible&&w.opacity!==0&&w.map&&w.map.image&&w.map.image.width&&(w.useScreenCoordinates?(d.uniform1i(i.useScreenCoordinates,1),d.uniform3f(i.screenPosition,(w.position.x-f)/f,(m-w.position.y)/m,Math.max(0,Math.min(1,w.position.z)))):(d.uniform1i(i.useScreenCoordinates,0),d.uniform1i(i.affectedByDistance,w.affectedByDistance?1:0),d.uniformMatrix4fv(i.modelViewMatrix,!1,w._modelViewMatrixArray)),b=w.map.image.width/
-(w.scaleByViewport?Ea:1),e[0]=b*n*w.scale.x,e[1]=b*w.scale.y,d.uniform2f(i.uvScale,w.uvScale.x,w.uvScale.y),d.uniform2f(i.uvOffset,w.uvOffset.x,w.uvOffset.y),d.uniform2f(i.alignment,w.alignment.x,w.alignment.y),d.uniform1f(i.opacity,w.opacity),d.uniform3f(i.color,w.color.r,w.color.g,w.color.b),d.uniform1f(i.rotation,w.rotation),d.uniform2fv(i.scale,e),w.mergeWith3D&&!g?(d.enable(d.DEPTH_TEST),g=!0):!w.mergeWith3D&&g&&(d.disable(d.DEPTH_TEST),g=!1),ca(w.blending),la(w.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 i=a.__objectsAdded[0],p=a,l=void 0,n=void 0,k=void 0;if(!i.__webglInit)if(i.__webglInit=!0,i._modelViewMatrix=new THREE.Matrix4,i._normalMatrixArray=new Float32Array(9),i._modelViewMatrixArray=new Float32Array(16),i._objectMatrixArray=new Float32Array(16),i.matrixWorld.flattenToArray(i._objectMatrixArray),i instanceof THREE.Mesh){n=i.geometry;if(n.geometryGroups===void 0){var k=n,z=void 0,m=void 0,u=void 0,r=void 0,
-s=void 0,w=void 0,j=void 0,q={},A=k.morphTargets.length;k.geometryGroups={};z=0;for(m=k.faces.length;z<m;z++)u=k.faces[z],r=u.materialIndex,w=r!==void 0?r:-1,q[w]===void 0&&(q[w]={hash:w,counter:0}),j=q[w].hash+"_"+q[w].counter,k.geometryGroups[j]===void 0&&(k.geometryGroups[j]={faces3:[],faces4:[],materialIndex:r,vertices:0,numMorphTargets:A}),s=u instanceof THREE.Face3?3:4,k.geometryGroups[j].vertices+s>65535&&(q[w].counter+=1,j=q[w].hash+"_"+q[w].counter,k.geometryGroups[j]===void 0&&(k.geometryGroups[j]=
-{faces3:[],faces4:[],materialIndex:r,vertices:0,numMorphTargets:A})),u instanceof THREE.Face3?k.geometryGroups[j].faces3.push(z):k.geometryGroups[j].faces4.push(z),k.geometryGroups[j].vertices+=s;k.geometryGroupsList=[];z=void 0;for(z in k.geometryGroups)k.geometryGroups[z].id=Fa++,k.geometryGroupsList.push(k.geometryGroups[z])}for(l in n.geometryGroups)if(k=n.geometryGroups[l],!k.__webglVertexBuffer){z=k;z.__webglVertexBuffer=d.createBuffer();z.__webglNormalBuffer=d.createBuffer();z.__webglTangentBuffer=
-d.createBuffer();z.__webglColorBuffer=d.createBuffer();z.__webglUVBuffer=d.createBuffer();z.__webglUV2Buffer=d.createBuffer();z.__webglSkinVertexABuffer=d.createBuffer();z.__webglSkinVertexBBuffer=d.createBuffer();z.__webglSkinIndicesBuffer=d.createBuffer();z.__webglSkinWeightsBuffer=d.createBuffer();z.__webglFaceBuffer=d.createBuffer();z.__webglLineBuffer=d.createBuffer();if(z.numMorphTargets){u=m=void 0;z.__webglMorphTargetsBuffers=[];m=0;for(u=z.numMorphTargets;m<u;m++)z.__webglMorphTargetsBuffers.push(d.createBuffer())}G.info.memory.geometries++;
-r=i;s=r.geometry;m=k.faces3;w=k.faces4;z=m.length*3+w.length*4;u=m.length*1+w.length*2;w=m.length*3+w.length*4;m=c(r,k);j=g(m);q=e(m);A=f(m);k.__vertexArray=new Float32Array(z*3);if(q)k.__normalArray=new Float32Array(z*3);if(s.hasTangents)k.__tangentArray=new Float32Array(z*4);if(A)k.__colorArray=new Float32Array(z*3);if(j){if(s.faceUvs.length>0||s.faceVertexUvs.length>0)k.__uvArray=new Float32Array(z*2);if(s.faceUvs.length>1||s.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(z*2)}if(r.geometry.skinWeights.length&&
-r.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(z*4),k.__skinVertexBArray=new Float32Array(z*4),k.__skinIndexArray=new Float32Array(z*4),k.__skinWeightArray=new Float32Array(z*4);k.__faceArray=new Uint16Array(u*3);k.__lineArray=new Uint16Array(w*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];r=0;for(s=k.numMorphTargets;r<s;r++)k.__morphTargetsArrays.push(new Float32Array(z*3))}k.__webglFaceCount=u*3;k.__webglLineCount=w*2;if(m.attributes){if(k.__webglCustomAttributesList===
-void 0)k.__webglCustomAttributesList=[];u=void 0;for(u in m.attributes){var r=m.attributes[u],s={},B;for(B in r)s[B]=r[B];if(!s.__webglInitialized||s.createUniqueBuffers)s.__webglInitialized=!0,w=1,s.type==="v2"?w=2:s.type==="v3"?w=3:s.type==="v4"?w=4:s.type==="c"&&(w=3),s.size=w,s.array=new Float32Array(z*w),s.buffer=d.createBuffer(),s.buffer.belongsToAttribute=u,r.needsUpdate=!0,s.__original=r;k.__webglCustomAttributesList.push(s)}}k.__inittedArrays=!0;n.__dirtyVertices=!0;n.__dirtyMorphTargets=
-!0;n.__dirtyElements=!0;n.__dirtyUvs=!0;n.__dirtyNormals=!0;n.__dirtyTangents=!0;n.__dirtyColors=!0}}else if(i instanceof THREE.Ribbon){if(n=i.geometry,!n.__webglVertexBuffer)k=n,k.__webglVertexBuffer=d.createBuffer(),k.__webglColorBuffer=d.createBuffer(),G.info.memory.geometries++,k=n,z=k.vertices.length,k.__vertexArray=new Float32Array(z*3),k.__colorArray=new Float32Array(z*3),k.__webglVertexCount=z,n.__dirtyVertices=!0,n.__dirtyColors=!0}else if(i instanceof THREE.Line){if(n=i.geometry,!n.__webglVertexBuffer)k=
-n,k.__webglVertexBuffer=d.createBuffer(),k.__webglColorBuffer=d.createBuffer(),G.info.memory.geometries++,k=n,z=i,m=k.vertices.length,k.__vertexArray=new Float32Array(m*3),k.__colorArray=new Float32Array(m*3),k.__webglLineCount=m,b(k,z),n.__dirtyVertices=!0,n.__dirtyColors=!0}else if(i instanceof THREE.ParticleSystem&&(n=i.geometry,!n.__webglVertexBuffer))k=n,k.__webglVertexBuffer=d.createBuffer(),k.__webglColorBuffer=d.createBuffer(),G.info.geometries++,k=n,z=i,m=k.vertices.length,k.__vertexArray=
-new Float32Array(m*3),k.__colorArray=new Float32Array(m*3),k.__sortArray=[],k.__webglParticleCount=m,b(k,z),n.__dirtyVertices=!0,n.__dirtyColors=!0;if(!i.__webglActive){if(i instanceof THREE.Mesh)for(l in n=i.geometry,n.geometryGroups)k=n.geometryGroups[l],I(p.__webglObjects,k,i);else i instanceof THREE.Ribbon||i instanceof THREE.Line||i instanceof THREE.ParticleSystem?(n=i.geometry,I(p.__webglObjects,n,i)):THREE.MarchingCubes!==void 0&&i instanceof THREE.MarchingCubes||i.immediateRenderCallback?
-p.__webglObjectsImmediate.push({object:i,opaque:null,transparent:null}):i instanceof THREE.Sprite&&p.__webglSprites.push(i);i.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){i=a.__objectsRemoved[0];p=a;if(i instanceof THREE.Mesh||i instanceof THREE.ParticleSystem||i instanceof THREE.Ribbon||i instanceof THREE.Line)ha(p.__webglObjects,i);else if(i instanceof THREE.Sprite){p=p.__webglSprites;l=i;for(n=p.length-1;n>=0;n--)p[n]===l&&p.splice(n,1)}else(i instanceof THREE.MarchingCubes||
-i.immediateRenderCallback)&&ha(p.__webglObjectsImmediate,i);i.__webglActive=!1;a.__objectsRemoved.splice(0,1)}i=0;for(p=a.__webglObjects.length;i<p;i++)if(B=a.__webglObjects[i].object,l=B.geometry,n=u=m=void 0,B instanceof THREE.Mesh){k=0;for(z=l.geometryGroupsList.length;k<z;k++)if(m=l.geometryGroupsList[k],n=c(B,m),u=n.attributes&&R(n),l.__dirtyVertices||l.__dirtyMorphTargets||l.__dirtyElements||l.__dirtyUvs||l.__dirtyNormals||l.__dirtyColors||l.__dirtyTangents||u){var y=B,u=d.DYNAMIC_DRAW,r=!l.dynamic,
-j=n;if(m.__inittedArrays){var s=e(j),w=f(j),J=g(j),L=s===THREE.SmoothShading,F=q=j=void 0,v=void 0,$=void 0,M=void 0,x=void 0,ba=void 0,N=void 0,S=F=void 0,C=void 0,D=void 0,E=void 0,aa=v=void 0,da=void 0,ka=void 0,T=v=N=void 0,U=void 0,O=E=D=C=x=void 0,H=v=E=D=C=O=E=D=C=O=E=D=C=void 0,K=void 0,Q=M=void 0,Y=void 0,X=void 0,ja=void 0,ea=void 0,ga=S=X=K=0,ca=0,W=H=F=0,P=x=aa=0,t=0,fa=void 0,P=m.__vertexArray,Y=m.__uvArray,t=m.__uv2Array,Q=m.__normalArray,$=m.__tangentArray,da=m.__colorArray,T=m.__skinVertexAArray,
-U=m.__skinVertexBArray,ba=m.__skinIndexArray,ia=m.__skinWeightArray,O=m.__morphTargetsArrays,A=m.__webglCustomAttributesList,o=void 0,o=m.__faceArray,fa=m.__lineArray,ka=y.geometry,ma=ka.__dirtyElements,la=ka.__dirtyUvs,M=ka.__dirtyNormals,N=ka.__dirtyTangents,ua=ka.__dirtyColors,ja=ka.__dirtyMorphTargets,ea=ka.vertices,y=m.faces3,V=m.faces4,Z=ka.faces,oa=ka.faceVertexUvs[0],ta=ka.faceVertexUvs[1],na=ka.skinVerticesA,qa=ka.skinVerticesB,sa=ka.skinIndices,pa=ka.skinWeights,ra=ka.morphTargets;if(ka.__dirtyVertices){j=
-0;for(q=y.length;j<q;j++)v=Z[y[j]],C=ea[v.a].position,D=ea[v.b].position,E=ea[v.c].position,P[X]=C.x,P[X+1]=C.y,P[X+2]=C.z,P[X+3]=D.x,P[X+4]=D.y,P[X+5]=D.z,P[X+6]=E.x,P[X+7]=E.y,P[X+8]=E.z,X+=9;j=0;for(q=V.length;j<q;j++)v=Z[V[j]],C=ea[v.a].position,D=ea[v.b].position,E=ea[v.c].position,v=ea[v.d].position,P[X]=C.x,P[X+1]=C.y,P[X+2]=C.z,P[X+3]=D.x,P[X+4]=D.y,P[X+5]=D.z,P[X+6]=E.x,P[X+7]=E.y,P[X+8]=E.z,P[X+9]=v.x,P[X+10]=v.y,P[X+11]=v.z,X+=12;d.bindBuffer(d.ARRAY_BUFFER,m.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,
-P,u)}if(ja){X=0;for(ja=ra.length;X<ja;X++){j=P=0;for(q=y.length;j<q;j++)v=Z[y[j]],C=ra[X].vertices[v.a].position,D=ra[X].vertices[v.b].position,E=ra[X].vertices[v.c].position,ea=O[X],ea[P]=C.x,ea[P+1]=C.y,ea[P+2]=C.z,ea[P+3]=D.x,ea[P+4]=D.y,ea[P+5]=D.z,ea[P+6]=E.x,ea[P+7]=E.y,ea[P+8]=E.z,P+=9;j=0;for(q=V.length;j<q;j++)v=Z[V[j]],C=ra[X].vertices[v.a].position,D=ra[X].vertices[v.b].position,E=ra[X].vertices[v.c].position,v=ra[X].vertices[v.d].position,ea=O[X],ea[P]=C.x,ea[P+1]=C.y,ea[P+2]=C.z,ea[P+
-3]=D.x,ea[P+4]=D.y,ea[P+5]=D.z,ea[P+6]=E.x,ea[P+7]=E.y,ea[P+8]=E.z,ea[P+9]=v.x,ea[P+10]=v.y,ea[P+11]=v.z,P+=12;d.bindBuffer(d.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[X]);d.bufferData(d.ARRAY_BUFFER,O[X],u)}}if(pa.length){j=0;for(q=y.length;j<q;j++)v=Z[y[j]],C=pa[v.a],D=pa[v.b],E=pa[v.c],ia[x]=C.x,ia[x+1]=C.y,ia[x+2]=C.z,ia[x+3]=C.w,ia[x+4]=D.x,ia[x+5]=D.y,ia[x+6]=D.z,ia[x+7]=D.w,ia[x+8]=E.x,ia[x+9]=E.y,ia[x+10]=E.z,ia[x+11]=E.w,C=sa[v.a],D=sa[v.b],E=sa[v.c],ba[x]=C.x,ba[x+1]=C.y,ba[x+2]=C.z,ba[x+
-3]=C.w,ba[x+4]=D.x,ba[x+5]=D.y,ba[x+6]=D.z,ba[x+7]=D.w,ba[x+8]=E.x,ba[x+9]=E.y,ba[x+10]=E.z,ba[x+11]=E.w,C=na[v.a],D=na[v.b],E=na[v.c],T[x]=C.x,T[x+1]=C.y,T[x+2]=C.z,T[x+3]=1,T[x+4]=D.x,T[x+5]=D.y,T[x+6]=D.z,T[x+7]=1,T[x+8]=E.x,T[x+9]=E.y,T[x+10]=E.z,T[x+11]=1,C=qa[v.a],D=qa[v.b],E=qa[v.c],U[x]=C.x,U[x+1]=C.y,U[x+2]=C.z,U[x+3]=1,U[x+4]=D.x,U[x+5]=D.y,U[x+6]=D.z,U[x+7]=1,U[x+8]=E.x,U[x+9]=E.y,U[x+10]=E.z,U[x+11]=1,x+=12;j=0;for(q=V.length;j<q;j++)v=Z[V[j]],C=pa[v.a],D=pa[v.b],E=pa[v.c],O=pa[v.d],ia[x]=
-C.x,ia[x+1]=C.y,ia[x+2]=C.z,ia[x+3]=C.w,ia[x+4]=D.x,ia[x+5]=D.y,ia[x+6]=D.z,ia[x+7]=D.w,ia[x+8]=E.x,ia[x+9]=E.y,ia[x+10]=E.z,ia[x+11]=E.w,ia[x+12]=O.x,ia[x+13]=O.y,ia[x+14]=O.z,ia[x+15]=O.w,C=sa[v.a],D=sa[v.b],E=sa[v.c],O=sa[v.d],ba[x]=C.x,ba[x+1]=C.y,ba[x+2]=C.z,ba[x+3]=C.w,ba[x+4]=D.x,ba[x+5]=D.y,ba[x+6]=D.z,ba[x+7]=D.w,ba[x+8]=E.x,ba[x+9]=E.y,ba[x+10]=E.z,ba[x+11]=E.w,ba[x+12]=O.x,ba[x+13]=O.y,ba[x+14]=O.z,ba[x+15]=O.w,C=na[v.a],D=na[v.b],E=na[v.c],O=na[v.d],T[x]=C.x,T[x+1]=C.y,T[x+2]=C.z,T[x+
-3]=1,T[x+4]=D.x,T[x+5]=D.y,T[x+6]=D.z,T[x+7]=1,T[x+8]=E.x,T[x+9]=E.y,T[x+10]=E.z,T[x+11]=1,T[x+12]=O.x,T[x+13]=O.y,T[x+14]=O.z,T[x+15]=1,C=qa[v.a],D=qa[v.b],E=qa[v.c],v=qa[v.d],U[x]=C.x,U[x+1]=C.y,U[x+2]=C.z,U[x+3]=1,U[x+4]=D.x,U[x+5]=D.y,U[x+6]=D.z,U[x+7]=1,U[x+8]=E.x,U[x+9]=E.y,U[x+10]=E.z,U[x+11]=1,U[x+12]=v.x,U[x+13]=v.y,U[x+14]=v.z,U[x+15]=1,x+=16;x>0&&(d.bindBuffer(d.ARRAY_BUFFER,m.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,T,u),d.bindBuffer(d.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),
-d.bufferData(d.ARRAY_BUFFER,U,u),d.bindBuffer(d.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,ba,u),d.bindBuffer(d.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ia,u))}if(ua&&w){j=0;for(q=y.length;j<q;j++)v=Z[y[j]],x=v.vertexColors,ba=v.color,x.length===3&&w===THREE.VertexColors?(v=x[0],T=x[1],U=x[2]):U=T=v=ba,da[aa]=v.r,da[aa+1]=v.g,da[aa+2]=v.b,da[aa+3]=T.r,da[aa+4]=T.g,da[aa+5]=T.b,da[aa+6]=U.r,da[aa+7]=U.g,da[aa+8]=U.b,aa+=9;j=0;for(q=V.length;j<q;j++)v=
-Z[V[j]],x=v.vertexColors,ba=v.color,x.length===4&&w===THREE.VertexColors?(v=x[0],T=x[1],U=x[2],x=x[3]):x=U=T=v=ba,da[aa]=v.r,da[aa+1]=v.g,da[aa+2]=v.b,da[aa+3]=T.r,da[aa+4]=T.g,da[aa+5]=T.b,da[aa+6]=U.r,da[aa+7]=U.g,da[aa+8]=U.b,da[aa+9]=x.r,da[aa+10]=x.g,da[aa+11]=x.b,aa+=12;aa>0&&(d.bindBuffer(d.ARRAY_BUFFER,m.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,da,u))}if(N&&ka.hasTangents){j=0;for(q=y.length;j<q;j++)v=Z[y[j]],N=v.vertexTangents,aa=N[0],da=N[1],ka=N[2],$[H]=aa.x,$[H+1]=aa.y,$[H+2]=aa.z,
-$[H+3]=aa.w,$[H+4]=da.x,$[H+5]=da.y,$[H+6]=da.z,$[H+7]=da.w,$[H+8]=ka.x,$[H+9]=ka.y,$[H+10]=ka.z,$[H+11]=ka.w,H+=12;j=0;for(q=V.length;j<q;j++)v=Z[V[j]],N=v.vertexTangents,aa=N[0],da=N[1],ka=N[2],N=N[3],$[H]=aa.x,$[H+1]=aa.y,$[H+2]=aa.z,$[H+3]=aa.w,$[H+4]=da.x,$[H+5]=da.y,$[H+6]=da.z,$[H+7]=da.w,$[H+8]=ka.x,$[H+9]=ka.y,$[H+10]=ka.z,$[H+11]=ka.w,$[H+12]=N.x,$[H+13]=N.y,$[H+14]=N.z,$[H+15]=N.w,H+=16;d.bindBuffer(d.ARRAY_BUFFER,m.__webglTangentBuffer);d.bufferData(d.ARRAY_BUFFER,$,u)}if(M&&s){j=0;for(q=
-y.length;j<q;j++)if(v=Z[y[j]],$=v.vertexNormals,M=v.normal,$.length===3&&L)for(H=0;H<3;H++)M=$[H],Q[F]=M.x,Q[F+1]=M.y,Q[F+2]=M.z,F+=3;else for(H=0;H<3;H++)Q[F]=M.x,Q[F+1]=M.y,Q[F+2]=M.z,F+=3;j=0;for(q=V.length;j<q;j++)if(v=Z[V[j]],$=v.vertexNormals,M=v.normal,$.length===4&&L)for(H=0;H<4;H++)M=$[H],Q[F]=M.x,Q[F+1]=M.y,Q[F+2]=M.z,F+=3;else for(H=0;H<4;H++)Q[F]=M.x,Q[F+1]=M.y,Q[F+2]=M.z,F+=3;d.bindBuffer(d.ARRAY_BUFFER,m.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Q,u)}if(la&&oa&&J){j=0;for(q=y.length;j<
-q;j++)if(F=y[j],F=oa[F],F!==void 0)for(H=0;H<3;H++)Q=F[H],Y[S]=Q.u,Y[S+1]=Q.v,S+=2;j=0;for(q=V.length;j<q;j++)if(F=V[j],F=oa[F],F!==void 0)for(H=0;H<4;H++)Q=F[H],Y[S]=Q.u,Y[S+1]=Q.v,S+=2;S>0&&(d.bindBuffer(d.ARRAY_BUFFER,m.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,Y,u))}if(la&&ta&&J){j=0;for(q=y.length;j<q;j++)if(F=y[j],S=ta[F],S!==void 0)for(H=0;H<3;H++)Y=S[H],t[ga]=Y.u,t[ga+1]=Y.v,ga+=2;j=0;for(q=V.length;j<q;j++)if(F=V[j],S=ta[F],S!==void 0)for(H=0;H<4;H++)Y=S[H],t[ga]=Y.u,t[ga+1]=Y.v,ga+=2;
-ga>0&&(d.bindBuffer(d.ARRAY_BUFFER,m.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,t,u))}if(ma){j=0;for(q=y.length;j<q;j++)o[ca]=K,o[ca+1]=K+1,o[ca+2]=K+2,ca+=3,fa[W]=K,fa[W+1]=K+1,fa[W+2]=K,fa[W+3]=K+2,fa[W+4]=K+1,fa[W+5]=K+2,W+=6,K+=3;j=0;for(q=V.length;j<q;j++)o[ca]=K,o[ca+1]=K+1,o[ca+2]=K+3,o[ca+3]=K+1,o[ca+4]=K+2,o[ca+5]=K+3,ca+=6,fa[W]=K,fa[W+1]=K+1,fa[W+2]=K,fa[W+3]=K+3,fa[W+4]=K+1,fa[W+5]=K+2,fa[W+6]=K+2,fa[W+7]=K+3,W+=8,K+=4;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,
-o,u);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,fa,u)}if(A){H=0;for(K=A.length;H<K;H++)if(o=A[H],o.__original.needsUpdate){t=0;if(o.size===1)if(o.boundTo===void 0||o.boundTo==="vertices"){j=0;for(q=y.length;j<q;j++)v=Z[y[j]],o.array[t]=o.value[v.a],o.array[t+1]=o.value[v.b],o.array[t+2]=o.value[v.c],t+=3;j=0;for(q=V.length;j<q;j++)v=Z[V[j]],o.array[t]=o.value[v.a],o.array[t+1]=o.value[v.b],o.array[t+2]=o.value[v.c],o.array[t+3]=o.value[v.d],t+=4}else{if(o.boundTo===
-"faces"){j=0;for(q=y.length;j<q;j++)fa=o.value[y[j]],o.array[t]=fa,o.array[t+1]=fa,o.array[t+2]=fa,t+=3;j=0;for(q=V.length;j<q;j++)fa=o.value[V[j]],o.array[t]=fa,o.array[t+1]=fa,o.array[t+2]=fa,o.array[t+3]=fa,t+=4}}else if(o.size===2)if(o.boundTo===void 0||o.boundTo==="vertices"){j=0;for(q=y.length;j<q;j++)v=Z[y[j]],C=o.value[v.a],D=o.value[v.b],E=o.value[v.c],o.array[t]=C.x,o.array[t+1]=C.y,o.array[t+2]=D.x,o.array[t+3]=D.y,o.array[t+4]=E.x,o.array[t+5]=E.y,t+=6;j=0;for(q=V.length;j<q;j++)v=Z[V[j]],
-C=o.value[v.a],D=o.value[v.b],E=o.value[v.c],v=o.value[v.d],o.array[t]=C.x,o.array[t+1]=C.y,o.array[t+2]=D.x,o.array[t+3]=D.y,o.array[t+4]=E.x,o.array[t+5]=E.y,o.array[t+6]=v.x,o.array[t+7]=v.y,t+=8}else{if(o.boundTo==="faces"){j=0;for(q=y.length;j<q;j++)E=D=C=fa=o.value[y[j]],o.array[t]=C.x,o.array[t+1]=C.y,o.array[t+2]=D.x,o.array[t+3]=D.y,o.array[t+4]=E.x,o.array[t+5]=E.y,t+=6;j=0;for(q=V.length;j<q;j++)v=E=D=C=fa=o.value[V[j]],o.array[t]=C.x,o.array[t+1]=C.y,o.array[t+2]=D.x,o.array[t+3]=D.y,
-o.array[t+4]=E.x,o.array[t+5]=E.y,o.array[t+6]=v.x,o.array[t+7]=v.y,t+=8}}else if(o.size===3)if(s=o.type==="c"?["r","g","b"]:["x","y","z"],o.boundTo===void 0||o.boundTo==="vertices"){j=0;for(q=y.length;j<q;j++)v=Z[y[j]],C=o.value[v.a],D=o.value[v.b],E=o.value[v.c],o.array[t]=C[s[0]],o.array[t+1]=C[s[1]],o.array[t+2]=C[s[2]],o.array[t+3]=D[s[0]],o.array[t+4]=D[s[1]],o.array[t+5]=D[s[2]],o.array[t+6]=E[s[0]],o.array[t+7]=E[s[1]],o.array[t+8]=E[s[2]],t+=9;j=0;for(q=V.length;j<q;j++)v=Z[V[j]],C=o.value[v.a],
-D=o.value[v.b],E=o.value[v.c],v=o.value[v.d],o.array[t]=C[s[0]],o.array[t+1]=C[s[1]],o.array[t+2]=C[s[2]],o.array[t+3]=D[s[0]],o.array[t+4]=D[s[1]],o.array[t+5]=D[s[2]],o.array[t+6]=E[s[0]],o.array[t+7]=E[s[1]],o.array[t+8]=E[s[2]],o.array[t+9]=v[s[0]],o.array[t+10]=v[s[1]],o.array[t+11]=v[s[2]],t+=12}else{if(o.boundTo==="faces"){j=0;for(q=y.length;j<q;j++)E=D=C=fa=o.value[y[j]],o.array[t]=C[s[0]],o.array[t+1]=C[s[1]],o.array[t+2]=C[s[2]],o.array[t+3]=D[s[0]],o.array[t+4]=D[s[1]],o.array[t+5]=D[s[2]],
-o.array[t+6]=E[s[0]],o.array[t+7]=E[s[1]],o.array[t+8]=E[s[2]],t+=9;j=0;for(q=V.length;j<q;j++)v=E=D=C=fa=o.value[V[j]],o.array[t]=C[s[0]],o.array[t+1]=C[s[1]],o.array[t+2]=C[s[2]],o.array[t+3]=D[s[0]],o.array[t+4]=D[s[1]],o.array[t+5]=D[s[2]],o.array[t+6]=E[s[0]],o.array[t+7]=E[s[1]],o.array[t+8]=E[s[2]],o.array[t+9]=v[s[0]],o.array[t+10]=v[s[1]],o.array[t+11]=v[s[2]],t+=12}}else if(o.size===4)if(o.boundTo===void 0||o.boundTo==="vertices"){j=0;for(q=y.length;j<q;j++)v=Z[y[j]],C=o.value[v.a],D=o.value[v.b],
-E=o.value[v.c],o.array[t]=C.x,o.array[t+1]=C.y,o.array[t+2]=C.z,o.array[t+3]=C.w,o.array[t+4]=D.x,o.array[t+5]=D.y,o.array[t+6]=D.z,o.array[t+7]=D.w,o.array[t+8]=E.x,o.array[t+9]=E.y,o.array[t+10]=E.z,o.array[t+11]=E.w,t+=12;j=0;for(q=V.length;j<q;j++)v=Z[V[j]],C=o.value[v.a],D=o.value[v.b],E=o.value[v.c],v=o.value[v.d],o.array[t]=C.x,o.array[t+1]=C.y,o.array[t+2]=C.z,o.array[t+3]=C.w,o.array[t+4]=D.x,o.array[t+5]=D.y,o.array[t+6]=D.z,o.array[t+7]=D.w,o.array[t+8]=E.x,o.array[t+9]=E.y,o.array[t+10]=
-E.z,o.array[t+11]=E.w,o.array[t+12]=v.x,o.array[t+13]=v.y,o.array[t+14]=v.z,o.array[t+15]=v.w,t+=16}else if(o.boundTo==="faces"){j=0;for(q=y.length;j<q;j++)E=D=C=fa=o.value[y[j]],o.array[t]=C.x,o.array[t+1]=C.y,o.array[t+2]=C.z,o.array[t+3]=C.w,o.array[t+4]=D.x,o.array[t+5]=D.y,o.array[t+6]=D.z,o.array[t+7]=D.w,o.array[t+8]=E.x,o.array[t+9]=E.y,o.array[t+10]=E.z,o.array[t+11]=E.w,t+=12;j=0;for(q=V.length;j<q;j++)v=E=D=C=fa=o.value[V[j]],o.array[t]=C.x,o.array[t+1]=C.y,o.array[t+2]=C.z,o.array[t+3]=
-C.w,o.array[t+4]=D.x,o.array[t+5]=D.y,o.array[t+6]=D.z,o.array[t+7]=D.w,o.array[t+8]=E.x,o.array[t+9]=E.y,o.array[t+10]=E.z,o.array[t+11]=E.w,o.array[t+12]=v.x,o.array[t+13]=v.y,o.array[t+14]=v.z,o.array[t+15]=v.w,t+=16}d.bindBuffer(d.ARRAY_BUFFER,o.buffer);d.bufferData(d.ARRAY_BUFFER,o.array,u)}}r&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,delete m.__tangentArray,delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,
-delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}}l.__dirtyVertices=!1;l.__dirtyMorphTargets=!1;l.__dirtyElements=!1;l.__dirtyUvs=!1;l.__dirtyNormals=!1;l.__dirtyColors=!1;l.__dirtyTangents=!1;n.attributes&&va(n)}else if(B instanceof THREE.Ribbon){if(l.__dirtyVertices||l.__dirtyColors){n=l;B=d.DYNAMIC_DRAW;s=k=s=r=r=void 0;w=n.vertices;z=n.colors;j=w.length;m=z.length;q=n.__vertexArray;u=n.__colorArray;A=n.__dirtyColors;if(n.__dirtyVertices){for(r=0;r<j;r++)s=w[r].position,
-k=r*3,q[k]=s.x,q[k+1]=s.y,q[k+2]=s.z;d.bindBuffer(d.ARRAY_BUFFER,n.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,q,B)}if(A){for(r=0;r<m;r++)s=z[r],k=r*3,u[k]=s.r,u[k+1]=s.g,u[k+2]=s.b;d.bindBuffer(d.ARRAY_BUFFER,n.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,u,B)}}l.__dirtyVertices=!1;l.__dirtyColors=!1}else if(B instanceof THREE.Line){n=c(B,m);u=n.attributes&&R(n);if(l.__dirtyVertices||l.__dirtyColors||u){B=l;k=d.DYNAMIC_DRAW;j=z=L=w=J=void 0;w=B.vertices;m=B.colors;j=w.length;u=m.length;q=
-B.__vertexArray;r=B.__colorArray;A=B.__dirtyColors;s=B.__webglCustomAttributesList;K=Z=V=y=L=J=void 0;if(B.__dirtyVertices){for(J=0;J<j;J++)L=w[J].position,z=J*3,q[z]=L.x,q[z+1]=L.y,q[z+2]=L.z;d.bindBuffer(d.ARRAY_BUFFER,B.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,q,k)}if(A){for(w=0;w<u;w++)j=m[w],z=w*3,r[z]=j.r,r[z+1]=j.g,r[z+2]=j.b;d.bindBuffer(d.ARRAY_BUFFER,B.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,r,k)}if(s){J=0;for(L=s.length;J<L;J++)if(K=s[J],K.needsUpdate&&(K.boundTo===void 0||
-K.boundTo==="vertices")){z=0;V=K.value.length;if(K.size===1)for(y=0;y<V;y++)K.array[y]=K.value[y];else if(K.size===2)for(y=0;y<V;y++)Z=K.value[y],K.array[z]=Z.x,K.array[z+1]=Z.y,z+=2;else if(K.size===3)if(K.type==="c")for(y=0;y<V;y++)Z=K.value[y],K.array[z]=Z.r,K.array[z+1]=Z.g,K.array[z+2]=Z.b,z+=3;else for(y=0;y<V;y++)Z=K.value[y],K.array[z]=Z.x,K.array[z+1]=Z.y,K.array[z+2]=Z.z,z+=3;else if(K.size===4)for(y=0;y<V;y++)Z=K.value[y],K.array[z]=Z.x,K.array[z+1]=Z.y,K.array[z+2]=Z.z,K.array[z+3]=Z.w,
-z+=4;d.bindBuffer(d.ARRAY_BUFFER,K.buffer);d.bufferData(d.ARRAY_BUFFER,K.array,k)}}}l.__dirtyVertices=!1;l.__dirtyColors=!1;n.attributes&&va(n)}else if(B instanceof THREE.ParticleSystem)n=c(B,m),u=n.attributes&&R(n),(l.__dirtyVertices||l.__dirtyColors||B.sortParticles||u)&&h(l,d.DYNAMIC_DRAW,B),l.__dirtyVertices=!1,l.__dirtyColors=!1,n.attributes&&va(n)};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 k=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var l,n,p;l=p=k=0;for(n=b.length;l<n;l++)h=b[l],h instanceof THREE.SpotLight&&p++,h instanceof THREE.DirectionalLight&&
-p++,h instanceof THREE.PointLight&&k++;k+p<=Y?l=p:(l=Math.ceil(Y*p/(k+p)),k=Y-l);h={directional:l,point:k};k=p=0;for(l=b.length;k<l;k++)n=b[k],n instanceof THREE.SpotLight&&n.castShadow&&p++;var j=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)j=e.bones.length;var q;a:{l=a.fragmentShader;n=a.vertexShader;var k=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:j,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},r,e=[];i?e.push(i):(e.push(l),e.push(n));for(r in c)e.push(r),e.push(c[r]);i=e.join();r=0;for(e=ta.length;r<e;r++)if(ta[r].code===i){q=ta[r].program;break a}r=d.createProgram();
-e=[Ya?"#define VERTEX_TEXTURES":"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.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":"",
+THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var g in d.attributes){var f=d.attributes[g];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var h=1;f.type==="v2"?h=2:f.type==="v3"?h=3:f.type==="v4"?h=4:f.type==="c"&&(h=3);f.size=h;f.array=new Float32Array(c*h);f.buffer=e.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 d(a){if(a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial)return!1;return a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function g(a){if(a.vertexColors)return a.vertexColors;return!1}function f(a){if(a.map||a.lightMap||a instanceof THREE.ShaderMaterial)return!0;
+return!1}function h(a,b,c){var d,g,f,h,q=a.vertices;h=q.length;var r=a.colors,i=r.length,s=a.__vertexArray,w=a.__colorArray,l=a.__sortArray,x=a.__dirtyVertices,m=a.__dirtyColors,n=a.__webglCustomAttributesList;if(c.sortParticles){Ba.multiplySelf(c.matrixWorld);for(d=0;d<h;d++)g=q[d].position,Da.copy(g),Ba.multiplyVector3(Da),l[d]=[Da.z,d];l.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++)g=q[l[d][1]].position,f=d*3,s[f]=g.x,s[f+1]=g.y,s[f+2]=g.z;for(d=0;d<i;d++)f=d*3,g=r[l[d][1]],w[f]=g.r,w[f+
+1]=g.g,w[f+2]=g.b;if(n){r=0;for(i=n.length;r<i;r++)if(q=n[r],q.boundTo===void 0||q.boundTo==="vertices")if(f=0,g=q.value.length,q.size===1)for(d=0;d<g;d++)h=l[d][1],q.array[d]=q.value[h];else if(q.size===2)for(d=0;d<g;d++)h=l[d][1],h=q.value[h],q.array[f]=h.x,q.array[f+1]=h.y,f+=2;else if(q.size===3)if(q.type==="c")for(d=0;d<g;d++)h=l[d][1],h=q.value[h],q.array[f]=h.r,q.array[f+1]=h.g,q.array[f+2]=h.b,f+=3;else for(d=0;d<g;d++)h=l[d][1],h=q.value[h],q.array[f]=h.x,q.array[f+1]=h.y,q.array[f+2]=h.z,
+f+=3;else if(q.size===4)for(d=0;d<g;d++)h=l[d][1],h=q.value[h],q.array[f]=h.x,q.array[f+1]=h.y,q.array[f+2]=h.z,q.array[f+3]=h.w,f+=4}}else{if(x)for(d=0;d<h;d++)g=q[d].position,f=d*3,s[f]=g.x,s[f+1]=g.y,s[f+2]=g.z;if(m)for(d=0;d<i;d++)g=r[d],f=d*3,w[f]=g.r,w[f+1]=g.g,w[f+2]=g.b;if(n){r=0;for(i=n.length;r<i;r++)if(q=n[r],q.needsUpdate&&(q.boundTo===void 0||q.boundTo==="vertices"))if(g=q.value.length,f=0,q.size===1)for(d=0;d<g;d++)q.array[d]=q.value[d];else if(q.size===2)for(d=0;d<g;d++)h=q.value[d],
+q.array[f]=h.x,q.array[f+1]=h.y,f+=2;else if(q.size===3)if(q.type==="c")for(d=0;d<g;d++)h=q.value[d],q.array[f]=h.r,q.array[f+1]=h.g,q.array[f+2]=h.b,f+=3;else for(d=0;d<g;d++)h=q.value[d],q.array[f]=h.x,q.array[f+1]=h.y,q.array[f+2]=h.z,f+=3;else if(q.size===4)for(d=0;d<g;d++)h=q.value[d],q.array[f]=h.x,q.array[f+1]=h.y,q.array[f+2]=h.z,q.array[f+3]=h.w,f+=4}}if(x||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,s,b);if(m||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
+a.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,w,b);if(n){r=0;for(i=n.length;r<i;r++)if(q=n[r],q.needsUpdate||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,q.buffer),e.bufferData(e.ARRAY_BUFFER,q.array,b)}}function i(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=e.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=e.createBuffer();a.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,a.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(b.attributes.position),
+e.vertexAttribPointer(b.attributes.position,3,e.FLOAT,!1,0,0));if(a.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,f,g,h,q,r,i,s,w,l,x=a.count*3;for(l=0;l<x;l+=9)c=a.normalArray,d=c[l],f=c[l+1],g=c[l+2],h=c[l+3],r=c[l+4],s=c[l+5],q=c[l+6],i=c[l+7],w=c[l+8],d=(d+h+q)/3,f=(f+r+i)/3,g=(g+s+w)/3,c[l]=d,c[l+1]=f,c[l+2]=g,c[l+3]=d,c[l+4]=f,c[l+5]=g,c[l+6]=d,c[l+7]=f,c[l+8]=g}e.bufferData(e.ARRAY_BUFFER,a.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(b.attributes.normal);
+e.vertexAttribPointer(b.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,a.count);a.count=0}function j(a,b,c,d,f,g){if(d.opacity!==0){var h,q,c=O(a,b,c,d,g),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(d.wireframe?1:0);c!==ya&&(ya=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;g.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[g.morphTargetBase]),
+e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0)):c.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglVertexBuffer),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){h=0;var r=g.morphTargetForcedOrder;for(q=g.morphTargetInfluences;h<d.numSupportedMorphTargets&&h<r.length;)e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[r[h]]),e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[h]=q[r[h]],h++}else{var r=[],i=-1,
+s=0;q=g.morphTargetInfluences;var w,l=q.length;h=0;for(g.morphTargetBase!==-1&&(r[g.morphTargetBase]=!0);h<d.numSupportedMorphTargets;){for(w=0;w<l;w++)!r[w]&&q[w]>i&&(s=w,i=q[s]);e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[s]);e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[h]=i;r[s]=1;i=-1;h++}}d.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){h=
+0;for(q=f.__webglCustomAttributesList.length;h<q;h++)c=f.__webglCustomAttributesList[h],b[c.buffer.belongsToAttribute]>=0&&(e.bindBuffer(e.ARRAY_BUFFER,c.buffer),e.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,e.FLOAT,!1,0,0))}b.color>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,
+f.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(f.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglUVBuffer),e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)):e.disableVertexAttribArray(b.uv));b.uv2>=0&&(f.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)):e.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
+0&&b.skinIndex>=0&&b.skinWeight>=0&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),e.vertexAttribPointer(b.skinWeight,4,e.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?
+(d=d.wireframeLinewidth,d!==Ia&&(e.lineWidth(d),Ia=d),a&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),e.drawElements(e.LINES,f.__webglLineCount,e.UNSIGNED_SHORT,0)):(a&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),e.drawElements(e.TRIANGLES,f.__webglFaceCount,e.UNSIGNED_SHORT,0)),G.info.render.calls++,G.info.render.vertices+=f.__webglFaceCount,G.info.render.faces+=f.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?e.LINE_STRIP:e.LINES,d=d.linewidth,d!==
+Ia&&(e.lineWidth(d),Ia=d),e.drawArrays(g,0,f.__webglLineCount),G.info.render.calls++):g instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,f.__webglParticleCount),G.info.render.calls++):g instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,f.__webglVertexCount),G.info.render.calls++)}}function m(a){ra[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ra[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ra[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ra[3].set(a.n41-
+a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ra[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ra[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=ra[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function n(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=ra[e].x*b.n14+ra[e].y*b.n24+ra[e].z*b.n34+ra[e].w,a<=c)return!1;return!0}function k(a,b){return b.z-a.z}function t(a){var b,
+c,d,f,g,h,q,r,k=0,s=a.lights;va||(va=new THREE.PerspectiveCamera(G.shadowCameraFov,G.shadowMapWidth/G.shadowMapHeight,G.shadowCameraNear,G.shadowCameraFar));b=0;for(c=s.length;b<c;b++)if(r=s[b],r.castShadow&&r instanceof THREE.SpotLight){Aa=-1;G.shadowMap[k]||(G.shadowMap[k]=new THREE.WebGLRenderTarget(G.shadowMapWidth,G.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),Ja[k]=new THREE.Matrix4);d=G.shadowMap[k];f=Ja[k];va.position.copy(r.position);
+va.lookAt(r.target.position);va.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(va),this.autoUpdateScene&&a.updateMatrixWorld());va.matrixWorldInverse.getInverse(va.matrixWorld);f.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);f.multiplySelf(va.projectionMatrix);f.multiplySelf(va.matrixWorldInverse);va.matrixWorldInverse.flattenToArray(Ka);va.projectionMatrix.flattenToArray(La);Ba.multiply(va.projectionMatrix,va.matrixWorldInverse);m(Ba);sa(d);e.clearColor(1,1,1,1);
+G.clear();e.clearColor(K.r,K.g,K.b,W);f=a.__webglObjects.length;for(d=0;d<f;d++)if(h=a.__webglObjects[d],r=h.object,h.render=!1,r.visible&&r.castShadow&&(!(r instanceof THREE.Mesh)||!r.frustumCulled||n(r)))r.matrixWorld.flattenToArray(r._objectMatrixArray),P(r,va,!1),h.render=!0;S(!0);ca(THREE.NormalBlending);for(d=0;d<f;d++)if(h=a.__webglObjects[d],h.render)r=h.object,h=h.buffer,I(r),q=r.customDepthMaterial?r.customDepthMaterial:r.geometry.morphTargets.length?Ma:Ga,j(va,s,null,q,h,r);f=a.__webglObjectsImmediate.length;
+for(d=0;d<f;d++)h=a.__webglObjectsImmediate[d],r=h.object,r.visible&&r.castShadow&&(r.matrixAutoUpdate&&r.matrixWorld.flattenToArray(r._objectMatrixArray),ya=-1,P(r,va,!1),I(r),g=O(va,s,null,Ga,r),r.immediateRenderCallback?r.immediateRenderCallback(g,e,ra):r.render(function(a){i(a,g,Ga.shading)}));k++}}function o(a,b,c,e,d,f,g,h){var r,i,s,w;b?(i=a.length-1,w=b=-1):(i=0,b=a.length,w=1);for(var l=i;l!==b;l+=w)if(r=a[l],r.render){i=r.object;s=r.buffer;if(h)r=h;else{r=r[c];if(!r)continue;g&&ca(r.blending);
+S(r.depthTest);E(r.depthWrite);N(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits)}I(i);j(e,d,f,r,s,i)}}function z(a,b,c,d,f,g,h){for(var q,r,m,s,w=0,l=a.length;w<l;w++)if(q=a[w],r=q.object,r.visible){ya=-1;if(h)m=h;else{m=q[b];if(!m)continue;g&&ca(m.blending);S(m.depthTest);E(m.depthWrite);N(m.polygonOffset,m.polygonOffsetFactor,m.polygonOffsetUnits)}I(r);s=O(c,d,f,m,r);r.immediateRenderCallback?r.immediateRenderCallback(s,e,ra):r.render(function(a){i(a,s,m.shading)})}}function F(a,b,c){a.push({buffer:b,
+object:c,opaque:null,transparent:null})}function R(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function ma(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function da(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,f){d.program||G.initMaterial(d,b,c,f);if(d.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(G.maxMorphTargets);for(var g=0,h=G.maxMorphTargets;g<h;g++)f.__webglMorphTargetInfluences[g]=
+0}var q=!1,g=d.program,h=g.uniforms,r=d.uniforms;g!==xa&&(e.useProgram(g),xa=g,q=!0);if(d.id!==Aa)Aa=d.id,q=!0;if(q){e.uniformMatrix4fv(h.projectionMatrix,!1,La);if(c&&d.fog)if(r.fogColor.value=c.color,c instanceof THREE.Fog)r.fogNear.value=c.near,r.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)r.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var i,s,w=0,l=0,x=0,m,n,k,j=Sa,o=j.directional.colors,t=j.directional.positions,
+v=j.point.colors,D=j.point.positions,F=j.point.distances,y=0,z=0,c=i=k=0,q=b.length;c<q;c++)if(i=b[c],s=i.color,m=i.position,n=i.intensity,k=i.distance,i instanceof THREE.AmbientLight)G.gammaInput?(w+=s.r*s.r,l+=s.g*s.g,x+=s.b*s.b):(w+=s.r,l+=s.g,x+=s.b);else if(i instanceof THREE.DirectionalLight)k=y*3,G.gammaInput?(o[k]=s.r*s.r*n*n,o[k+1]=s.g*s.g*n*n,o[k+2]=s.b*s.b*n*n):(o[k]=s.r*n,o[k+1]=s.g*n,o[k+2]=s.b*n),t[k]=m.x,t[k+1]=m.y,t[k+2]=m.z,y+=1;else if(i instanceof THREE.SpotLight)k=y*3,G.gammaInput?
+(o[k]=s.r*s.r*n*n,o[k+1]=s.g*s.g*n*n,o[k+2]=s.b*s.b*n*n):(o[k]=s.r*n,o[k+1]=s.g*n,o[k+2]=s.b*n),s=1/m.length(),t[k]=m.x*s,t[k+1]=m.y*s,t[k+2]=m.z*s,y+=1;else if(i instanceof THREE.PointLight)i=z*3,G.gammaInput?(v[i]=s.r*s.r*n*n,v[i+1]=s.g*s.g*n*n,v[i+2]=s.b*s.b*n*n):(v[i]=s.r*n,v[i+1]=s.g*n,v[i+2]=s.b*n),D[i]=m.x,D[i+1]=m.y,D[i+2]=m.z,F[z]=k,z+=1;c=y*3;for(q=o.length;c<q;c++)o[c]=0;c=z*3;for(q=v.length;c<q;c++)v[c]=0;j.point.length=z;j.directional.length=y;j.ambient[0]=w;j.ambient[1]=l;j.ambient[2]=
+x;b=Sa;r.ambientLightColor.value=b.ambient;r.directionalLightColor.value=b.directional.colors;r.directionalLightDirection.value=b.directional.positions;r.pointLightColor.value=b.point.colors;r.pointLightPosition.value=b.point.positions;r.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)r.opacity.value=d.opacity,G.gammaInput?r.diffuse.value.copyGammaToLinear(d.color):r.diffuse.value=d.color,
+(r.map.texture=d.map)&&r.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),r.lightMap.texture=d.lightMap,r.envMap.texture=d.envMap,r.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,r.reflectivity.value=d.reflectivity,r.refractionRatio.value=d.refractionRatio,r.combine.value=d.combine,r.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)r.diffuse.value=d.color,r.opacity.value=
+d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)r.psColor.value=d.color,r.opacity.value=d.opacity,r.size.value=d.size,r.scale.value=ta.height/2,r.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)r.shininess.value=d.shininess,G.gammaInput?(r.ambient.value.copyGammaToLinear(d.ambient),r.specular.value.copyGammaToLinear(d.specular)):(r.ambient.value=d.ambient,r.specular.value=d.specular);else if(d instanceof THREE.MeshLambertMaterial)G.gammaInput?r.ambient.value.copyGammaToLinear(d.ambient):
+r.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)r.mNear.value=a.near,r.mFar.value=a.far,r.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)r.opacity.value=d.opacity;if(f.receiveShadow&&!d._shadowPass&&r.shadowMatrix){for(b=0;b<Ja.length;b++)r.shadowMatrix.value[b]=Ja[b],r.shadowMap.texture[b]=G.shadowMap[b];r.shadowDarkness.value=G.shadowMapDarkness;r.shadowBias.value=G.shadowMapBias}b=d.uniformsList;r=0;for(c=b.length;r<c;r++)if(l=g.uniforms[b[r][1]])if(w=
+b[r][0],x=w.type,q=w.value,x==="i")e.uniform1i(l,q);else if(x==="f")e.uniform1f(l,q);else if(x==="v2")e.uniform2f(l,q.x,q.y);else if(x==="v3")e.uniform3f(l,q.x,q.y,q.z);else if(x==="v4")e.uniform4f(l,q.x,q.y,q.z,q.w);else if(x==="c")e.uniform3f(l,q.r,q.g,q.b);else if(x==="fv1")e.uniform1fv(l,q);else if(x==="fv")e.uniform3fv(l,q);else if(x==="v3v"){if(!w._array)w._array=new Float32Array(3*q.length);x=0;for(m=q.length;x<m;x++)j=x*3,w._array[j]=q[x].x,w._array[j+1]=q[x].y,w._array[j+2]=q[x].z;e.uniform3fv(l,
+w._array)}else if(x==="m4"){if(!w._array)w._array=new Float32Array(16);q.flattenToArray(w._array);e.uniformMatrix4fv(l,!1,w._array)}else if(x==="m4v"){if(!w._array)w._array=new Float32Array(16*q.length);x=0;for(m=q.length;x<m;x++)q[x].flattenToArrayOffset(w._array,x*16);e.uniformMatrix4fv(l,!1,w._array)}else if(x==="t"){if(e.uniform1i(l,q),l=w.texture)if(l.image instanceof Array&&l.image.length===6){if(w=l,w.image.length===6)if(w.needsUpdate){if(!w.image.__webglTextureCube)w.image.__webglTextureCube=
+e.createTexture();e.activeTexture(e.TEXTURE0+q);e.bindTexture(e.TEXTURE_CUBE_MAP,w.image.__webglTextureCube);q=X(e.TEXTURE_CUBE_MAP,w,w.image[0]);for(l=0;l<6;l++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,w.image[l]);q&&e.generateMipmap(e.TEXTURE_CUBE_MAP);w.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+q),e.bindTexture(e.TEXTURE_CUBE_MAP,w.image.__webglTextureCube)}else l instanceof THREE.WebGLRenderTargetCube?(w=l,e.activeTexture(e.TEXTURE0+q),e.bindTexture(e.TEXTURE_CUBE_MAP,
+w.__webglTexture)):la(l,q)}else if(x==="tv"){if(!w._array){w._array=[];x=0;for(m=w.texture.length;x<m;x++)w._array[x]=q+x}e.uniform1iv(l,w._array);x=0;for(m=w.texture.length;x<m;x++)(l=w.texture[x])&&la(l,w._array[x])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&h.cameraPosition!==null&&e.uniform3f(h.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||
+d.skinning)&&h.viewMatrix!==null&&e.uniformMatrix4fv(h.viewMatrix,!1,Ka);d.skinning&&(e.uniformMatrix4fv(h.cameraInverseMatrix,!1,Ka),e.uniformMatrix4fv(h.boneGlobalMatrices,!1,f.boneMatrices))}e.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray);h.normalMatrix&&e.uniformMatrix3fv(h.normalMatrix,!1,f._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||f.receiveShadow)&&h.objectMatrix!==null&&e.uniformMatrix4fv(h.objectMatrix,!1,f._objectMatrixArray);return g}
+function P(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&(b=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix))&&b.transposeIntoArray(a._normalMatrixArray)}function I(a){if(za!==a.doubleSided)a.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),za=a.doubleSided;if(Ta!==a.flipSided)a.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),Ta=a.flipSided}function S(a){Na!==a&&(a?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),Na=a)}function E(a){Oa!==
+a&&(e.depthMask(a),Oa=a)}function N(a,b,c){Ua!==a&&(a?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),Ua=a);if(a&&(Va!==b||Wa!==c))e.polygonOffset(b,c),Va=b,Wa=c}function ca(a){if(a!==Pa){switch(a){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);
+break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}Pa=a}}function M(a,b){var c;a==="fragment"?c=e.createShader(e.FRAGMENT_SHADER):a==="vertex"&&(c=e.createShader(e.VERTEX_SHADER));e.shaderSource(c,b);e.compileShader(c);if(!e.getShaderParameter(c,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(c)),console.error(b),null;return c}function X(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===
+0?(e.texParameteri(a,e.TEXTURE_WRAP_S,ia(b.wrapS)),e.texParameteri(a,e.TEXTURE_WRAP_T,ia(b.wrapT)),e.texParameteri(a,e.TEXTURE_MAG_FILTER,ia(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,ia(b.minFilter)),!0):(e.texParameteri(a,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(a,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(a,e.TEXTURE_MAG_FILTER,wa(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,wa(b.minFilter)),!1)}function la(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
+!0,a.__webglTexture=e.createTexture(),G.info.memory.textures++;e.activeTexture(e.TEXTURE0+b);e.bindTexture(e.TEXTURE_2D,a.__webglTexture);var c=X(e.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,ia(a.format),a.image.width,a.image.height,0,ia(a.format),e.UNSIGNED_BYTE,a.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,a.image);c&&e.generateMipmap(e.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else e.activeTexture(e.TEXTURE0+b),e.bindTexture(e.TEXTURE_2D,
+a.__webglTexture)}function pa(a,b){e.bindRenderbuffer(e.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,a)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height)}
+function sa(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=e.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];e.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture);X(e.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=e.createFramebuffer();a.__webglRenderbuffer[c]=e.createRenderbuffer();e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+
+c,0,ia(a.format),a.width,a.height,0,ia(a.format),ia(a.type),null);var d=a,f=e.TEXTURE_CUBE_MAP_POSITIVE_X+c;e.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer[c]);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,f,d.__webglTexture,0);pa(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=e.createFramebuffer(),a.__webglRenderbuffer=e.createRenderbuffer(),e.bindTexture(e.TEXTURE_2D,a.__webglTexture),X(e.TEXTURE_2D,a,a),e.texImage2D(e.TEXTURE_2D,0,ia(a.format),a.width,a.height,0,ia(a.format),
+ia(a.type),null),c=e.TEXTURE_2D,e.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,c,a.__webglTexture,0),pa(a.__webglRenderbuffer,a);b?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=d=0):(b=null,c=Ha,a=Ea,d=Qa,f=Ra);b!==Ca&&(e.bindFramebuffer(e.FRAMEBUFFER,
+b),e.viewport(d,f,c,a),Ca=b)}function wa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function ia(a){switch(a){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;
+case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;
+case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var a=a||{},ta=a.canvas!==void 0?a.canvas:document.createElement("canvas"),Za=a.precision!==void 0?a.precision:"highp",qa=a.antialias!==void 0?a.antialias:!1,na=a.stencil!==void 0?a.stencil:!0,oa=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,K=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),
+W=a.clearAlpha!==void 0?a.clearAlpha:0,fa=a.maxLights!==void 0?a.maxLights:4;this.domElement=ta;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 G=this,e,ua=[],xa=null,Ca=null,Aa=-1,ya=null,Fa=0,za=null,Ta=null,Pa=null,Na=null,Oa=null,Ua=null,Va=null,Wa=null,Ia=null,Qa=0,Ra=0,Ha=0,Ea=0,ra=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ba=new THREE.Matrix4,La=new Float32Array(16),Ka=new Float32Array(16),
+Da=new THREE.Vector4,Sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},va,Ja=[],Ga,Ma,D={},Xa=!1;e=function(){var a;try{if(!(a=ta.getContext("experimental-webgl",{antialias:qa,stencil:na,preserveDrawingBuffer:oa})))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}();
+e.clearColor(0,0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(K.r,K.g,K.b,W);(function(){D.vertices=new Float32Array(16);D.faces=new Uint16Array(6);var a=0;D.vertices[a++]=-1;D.vertices[a++]=-1;D.vertices[a++]=0;D.vertices[a++]=1;D.vertices[a++]=1;D.vertices[a++]=-1;D.vertices[a++]=1;D.vertices[a++]=
+1;D.vertices[a++]=1;D.vertices[a++]=1;D.vertices[a++]=1;D.vertices[a++]=0;D.vertices[a++]=-1;D.vertices[a++]=1;D.vertices[a++]=0;a=D.vertices[a++]=0;D.faces[a++]=0;D.faces[a++]=1;D.faces[a++]=2;D.faces[a++]=0;D.faces[a++]=2;D.faces[a++]=3;D.vertexBuffer=e.createBuffer();D.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,D.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,D.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,D.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,D.faces,e.STATIC_DRAW);
+D.program=e.createProgram();e.attachShader(D.program,M("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(D.program,M("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(D.program);D.attributes={};D.uniforms={};D.attributes.position=e.getAttribLocation(D.program,"position");D.attributes.uv=e.getAttribLocation(D.program,"uv");D.uniforms.uvOffset=e.getUniformLocation(D.program,"uvOffset");D.uniforms.uvScale=e.getUniformLocation(D.program,"uvScale");D.uniforms.rotation=e.getUniformLocation(D.program,
+"rotation");D.uniforms.scale=e.getUniformLocation(D.program,"scale");D.uniforms.alignment=e.getUniformLocation(D.program,"alignment");D.uniforms.color=e.getUniformLocation(D.program,"color");D.uniforms.map=e.getUniformLocation(D.program,"map");D.uniforms.opacity=e.getUniformLocation(D.program,"opacity");D.uniforms.useScreenCoordinates=e.getUniformLocation(D.program,"useScreenCoordinates");D.uniforms.affectedByDistance=e.getUniformLocation(D.program,"affectedByDistance");D.uniforms.screenPosition=
+e.getUniformLocation(D.program,"screenPosition");D.uniforms.modelViewMatrix=e.getUniformLocation(D.program,"modelViewMatrix");D.uniforms.projectionMatrix=e.getUniformLocation(D.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});Ma=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});
+Ga._shadowPass=!0;Ma._shadowPass=!0})();this.context=e;var Ya=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return e};this.supportsVertexTextures=function(){return Ya};this.setSize=function(a,b){ta.width=a;ta.height=b;this.setViewport(0,0,ta.width,ta.height)};this.setViewport=function(a,b,c,d){Qa=a;Ra=b;Ha=c;Ea=d;e.viewport(Qa,Ra,Ha,Ea)};this.setScissor=function(a,b,c,d){e.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};
+this.setClearColorHex=function(a,b){K.setHex(a);W=b;e.clearColor(K.r,K.g,K.b,W)};this.setClearColor=function(a,b){K.copy(a);W=b;e.clearColor(K.r,K.g,K.b,W)};this.getClearColor=function(){return K};this.getClearAlpha=function(){return W};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=e.COLOR_BUFFER_BIT;if(b===void 0||b)d|=e.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=e.STENCIL_BUFFER_BIT;e.clear(d)};this.clearTarget=function(a,b,c,e){sa(a);this.clear(b,c,e)};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];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);e.deleteBuffer(c.__webglSkinVertexBBuffer);
+e.deleteBuffer(c.__webglSkinIndicesBuffer);e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d<f;d++)e.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)e.deleteBuffer(c.__webglCustomAttributesList[d].buffer);G.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),
+e.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,e.deleteTexture(a.__webglTexture),G.info.memory.textures--};this.updateShadowMap=
+function(a,b){t(a,b)};this.render=function(a,b,c,d){var f,g,h,i,r=a.lights,j=a.fog;Aa=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();this.shadowMapEnabled&&this.shadowMapAutoUpdate&&t(a,b);G.info.render.calls=0;G.info.render.vertices=0;G.info.render.faces=0;b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ka);
+b.projectionMatrix.flattenToArray(La);Ba.multiply(b.projectionMatrix,b.matrixWorldInverse);m(Ba);sa(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);i=a.__webglObjects;d=0;for(f=i.length;d<f;d++)if(g=i[d],h=g.object,g.render=!1,h.visible&&(!(h instanceof THREE.Mesh)||!h.frustumCulled||n(h))){h.matrixWorld.flattenToArray(h._objectMatrixArray);P(h,b,!0);var s=g,w=s.object,l=s.buffer,x=void 0,x=x=void 0,x=w.material;if(x instanceof THREE.MeshFaceMaterial){if(x=
+l.materialIndex,x>=0)x=w.geometry.materials[x],x.transparent?(s.transparent=x,s.opaque=null):(s.opaque=x,s.transparent=null)}else if(x)x.transparent?(s.transparent=x,s.opaque=null):(s.opaque=x,s.transparent=null);g.render=!0;if(this.sortObjects)h.renderDepth?g.z=h.renderDepth:(Da.copy(h.position),Ba.multiplyVector3(Da),g.z=Da.z)}this.sortObjects&&i.sort(k);i=a.__webglObjectsImmediate;d=0;for(f=i.length;d<f;d++)if(g=i[d],h=g.object,h.visible)h.matrixAutoUpdate&&h.matrixWorld.flattenToArray(h._objectMatrixArray),
+P(h,b,!0),h=g.object.material,h.transparent?(g.transparent=h,g.opaque=null):(g.opaque=h,g.transparent=null);a.overrideMaterial?(ca(a.overrideMaterial.blending),S(a.overrideMaterial.depthTest),E(a.overrideMaterial.depthWrite),N(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),o(a.__webglObjects,!1,"",b,r,j,!0,a.overrideMaterial),z(a.__webglObjectsImmediate,"",b,r,j,!1,a.overrideMaterial)):(ca(THREE.NormalBlending),o(a.__webglObjects,!0,
+"opaque",b,r,j,!1),z(a.__webglObjectsImmediate,"opaque",b,r,j,!1),o(a.__webglObjects,!1,"transparent",b,r,j,!0),z(a.__webglObjectsImmediate,"transparent",b,r,j,!0));if(a.__webglSprites.length){h=D.attributes;r=D.uniforms;j=Ea/Ha;d=[];f=Ha*0.5;i=Ea*0.5;g=!0;e.useProgram(D.program);xa=D.program;ya=Na=Pa=-1;Xa||(e.enableVertexAttribArray(D.attributes.position),e.enableVertexAttribArray(D.attributes.uv),Xa=!0);e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,D.vertexBuffer);
+e.vertexAttribPointer(h.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(h.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,D.elementBuffer);e.uniformMatrix4fv(r.projectionMatrix,!1,La);e.activeTexture(e.TEXTURE0);e.uniform1i(r.map,0);h=0;for(s=a.__webglSprites.length;h<s;h++)if(w=a.__webglSprites[h],w.visible&&w.opacity!==0)w.useScreenCoordinates?w.z=-w.position.z:(w._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,w.matrixWorld,w._modelViewMatrixArray),w.z=-w._modelViewMatrix.n34);
+a.__webglSprites.sort(k);h=0;for(s=a.__webglSprites.length;h<s;h++)w=a.__webglSprites[h],w.visible&&w.opacity!==0&&w.map&&w.map.image&&w.map.image.width&&(w.useScreenCoordinates?(e.uniform1i(r.useScreenCoordinates,1),e.uniform3f(r.screenPosition,(w.position.x-f)/f,(i-w.position.y)/i,Math.max(0,Math.min(1,w.position.z)))):(e.uniform1i(r.useScreenCoordinates,0),e.uniform1i(r.affectedByDistance,w.affectedByDistance?1:0),e.uniformMatrix4fv(r.modelViewMatrix,!1,w._modelViewMatrixArray)),b=w.map.image.width/
+(w.scaleByViewport?Ea:1),d[0]=b*j*w.scale.x,d[1]=b*w.scale.y,e.uniform2f(r.uvScale,w.uvScale.x,w.uvScale.y),e.uniform2f(r.uvOffset,w.uvOffset.x,w.uvOffset.y),e.uniform2f(r.alignment,w.alignment.x,w.alignment.y),e.uniform1f(r.opacity,w.opacity),e.uniform3f(r.color,w.color.r,w.color.g,w.color.b),e.uniform1f(r.rotation,w.rotation),e.uniform2fv(r.scale,d),w.mergeWith3D&&!g?(e.enable(e.DEPTH_TEST),g=!0):!w.mergeWith3D&&g&&(e.disable(e.DEPTH_TEST),g=!1),ca(w.blending),la(w.map,0),e.drawElements(e.TRIANGLES,
+6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Oa)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,c.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,c.__webglTexture),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=
+[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var i=a.__objectsAdded[0],m=a,n=void 0,k=void 0,j=void 0;if(!i.__webglInit)if(i.__webglInit=!0,i._modelViewMatrix=new THREE.Matrix4,i._normalMatrixArray=new Float32Array(9),i._modelViewMatrixArray=new Float32Array(16),i._objectMatrixArray=new Float32Array(16),i.matrixWorld.flattenToArray(i._objectMatrixArray),i instanceof THREE.Mesh){k=i.geometry;if(k.geometryGroups===void 0){var j=k,o=void 0,q=void 0,r=void 0,t=void 0,
+s=void 0,w=void 0,l=void 0,x={},D=j.morphTargets.length;j.geometryGroups={};o=0;for(q=j.faces.length;o<q;o++)r=j.faces[o],t=r.materialIndex,w=t!==void 0?t:-1,x[w]===void 0&&(x[w]={hash:w,counter:0}),l=x[w].hash+"_"+x[w].counter,j.geometryGroups[l]===void 0&&(j.geometryGroups[l]={faces3:[],faces4:[],materialIndex:t,vertices:0,numMorphTargets:D}),s=r instanceof THREE.Face3?3:4,j.geometryGroups[l].vertices+s>65535&&(x[w].counter+=1,l=x[w].hash+"_"+x[w].counter,j.geometryGroups[l]===void 0&&(j.geometryGroups[l]=
+{faces3:[],faces4:[],materialIndex:t,vertices:0,numMorphTargets:D})),r instanceof THREE.Face3?j.geometryGroups[l].faces3.push(o):j.geometryGroups[l].faces4.push(o),j.geometryGroups[l].vertices+=s;j.geometryGroupsList=[];o=void 0;for(o in j.geometryGroups)j.geometryGroups[o].id=Fa++,j.geometryGroupsList.push(j.geometryGroups[o])}for(n in k.geometryGroups)if(j=k.geometryGroups[n],!j.__webglVertexBuffer){o=j;o.__webglVertexBuffer=e.createBuffer();o.__webglNormalBuffer=e.createBuffer();o.__webglTangentBuffer=
+e.createBuffer();o.__webglColorBuffer=e.createBuffer();o.__webglUVBuffer=e.createBuffer();o.__webglUV2Buffer=e.createBuffer();o.__webglSkinVertexABuffer=e.createBuffer();o.__webglSkinVertexBBuffer=e.createBuffer();o.__webglSkinIndicesBuffer=e.createBuffer();o.__webglSkinWeightsBuffer=e.createBuffer();o.__webglFaceBuffer=e.createBuffer();o.__webglLineBuffer=e.createBuffer();if(o.numMorphTargets){r=q=void 0;o.__webglMorphTargetsBuffers=[];q=0;for(r=o.numMorphTargets;q<r;q++)o.__webglMorphTargetsBuffers.push(e.createBuffer())}G.info.memory.geometries++;
+t=i;s=t.geometry;q=j.faces3;w=j.faces4;o=q.length*3+w.length*4;r=q.length*1+w.length*2;w=q.length*3+w.length*4;q=c(t,j);l=f(q);x=d(q);D=g(q);j.__vertexArray=new Float32Array(o*3);if(x)j.__normalArray=new Float32Array(o*3);if(s.hasTangents)j.__tangentArray=new Float32Array(o*4);if(D)j.__colorArray=new Float32Array(o*3);if(l){if(s.faceUvs.length>0||s.faceVertexUvs.length>0)j.__uvArray=new Float32Array(o*2);if(s.faceUvs.length>1||s.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(o*2)}if(t.geometry.skinWeights.length&&
+t.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(o*4),j.__skinVertexBArray=new Float32Array(o*4),j.__skinIndexArray=new Float32Array(o*4),j.__skinWeightArray=new Float32Array(o*4);j.__faceArray=new Uint16Array(r*3);j.__lineArray=new Uint16Array(w*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(s=j.numMorphTargets;t<s;t++)j.__morphTargetsArrays.push(new Float32Array(o*3))}j.__webglFaceCount=r*3;j.__webglLineCount=w*2;if(q.attributes){if(j.__webglCustomAttributesList===
+void 0)j.__webglCustomAttributesList=[];r=void 0;for(r in q.attributes){var t=q.attributes[r],s={},z;for(z in t)s[z]=t[z];if(!s.__webglInitialized||s.createUniqueBuffers)s.__webglInitialized=!0,w=1,s.type==="v2"?w=2:s.type==="v3"?w=3:s.type==="v4"?w=4:s.type==="c"&&(w=3),s.size=w,s.array=new Float32Array(o*w),s.buffer=e.createBuffer(),s.buffer.belongsToAttribute=r,t.needsUpdate=!0,s.__original=t;j.__webglCustomAttributesList.push(s)}}j.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=
+!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(i instanceof THREE.Ribbon){if(k=i.geometry,!k.__webglVertexBuffer)j=k,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),G.info.memory.geometries++,j=k,o=j.vertices.length,j.__vertexArray=new Float32Array(o*3),j.__colorArray=new Float32Array(o*3),j.__webglVertexCount=o,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(i instanceof THREE.Line){if(k=i.geometry,!k.__webglVertexBuffer)j=
+k,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),G.info.memory.geometries++,j=k,o=i,q=j.vertices.length,j.__vertexArray=new Float32Array(q*3),j.__colorArray=new Float32Array(q*3),j.__webglLineCount=q,b(j,o),k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(i instanceof THREE.ParticleSystem&&(k=i.geometry,!k.__webglVertexBuffer))j=k,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),G.info.geometries++,j=k,o=i,q=j.vertices.length,j.__vertexArray=
+new Float32Array(q*3),j.__colorArray=new Float32Array(q*3),j.__sortArray=[],j.__webglParticleCount=q,b(j,o),k.__dirtyVertices=!0,k.__dirtyColors=!0;if(!i.__webglActive){if(i instanceof THREE.Mesh)for(n in k=i.geometry,k.geometryGroups)j=k.geometryGroups[n],F(m.__webglObjects,j,i);else i instanceof THREE.Ribbon||i instanceof THREE.Line||i instanceof THREE.ParticleSystem?(k=i.geometry,F(m.__webglObjects,k,i)):THREE.MarchingCubes!==void 0&&i instanceof THREE.MarchingCubes||i.immediateRenderCallback?
+m.__webglObjectsImmediate.push({object:i,opaque:null,transparent:null}):i instanceof THREE.Sprite&&m.__webglSprites.push(i);i.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){i=a.__objectsRemoved[0];m=a;if(i instanceof THREE.Mesh||i instanceof THREE.ParticleSystem||i instanceof THREE.Ribbon||i instanceof THREE.Line)da(m.__webglObjects,i);else if(i instanceof THREE.Sprite){m=m.__webglSprites;n=i;for(k=m.length-1;k>=0;k--)m[k]===n&&m.splice(k,1)}else(i instanceof THREE.MarchingCubes||
+i.immediateRenderCallback)&&da(m.__webglObjectsImmediate,i);i.__webglActive=!1;a.__objectsRemoved.splice(0,1)}i=0;for(m=a.__webglObjects.length;i<m;i++)if(z=a.__webglObjects[i].object,n=z.geometry,k=r=q=void 0,z instanceof THREE.Mesh){j=0;for(o=n.geometryGroupsList.length;j<o;j++)if(q=n.geometryGroupsList[j],k=c(z,q),r=k.attributes&&R(k),n.__dirtyVertices||n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents||r){var L=z,r=e.DYNAMIC_DRAW,t=!n.dynamic,
+l=k;if(q.__inittedArrays){var s=d(l),w=g(l),I=f(l),K=s===THREE.SmoothShading,E=x=l=void 0,v=void 0,$=void 0,M=void 0,y=void 0,ba=void 0,N=void 0,S=E=void 0,A=void 0,B=void 0,C=void 0,aa=v=void 0,ea=void 0,ka=void 0,T=v=N=void 0,U=void 0,O=C=B=A=y=void 0,H=v=C=B=A=O=C=B=A=O=C=B=A=void 0,J=void 0,P=M=void 0,W=void 0,Y=void 0,ia=void 0,ga=void 0,fa=S=Y=J=0,ca=0,X=H=E=0,Q=y=aa=0,u=0,ha=void 0,Q=q.__vertexArray,W=q.__uvArray,u=q.__uv2Array,P=q.__normalArray,$=q.__tangentArray,ea=q.__colorArray,T=q.__skinVertexAArray,
+U=q.__skinVertexBArray,ba=q.__skinIndexArray,ja=q.__skinWeightArray,O=q.__morphTargetsArrays,D=q.__webglCustomAttributesList,p=void 0,p=q.__faceArray,ha=q.__lineArray,ka=L.geometry,na=ka.__dirtyElements,la=ka.__dirtyUvs,M=ka.__dirtyNormals,N=ka.__dirtyTangents,va=ka.__dirtyColors,ia=ka.__dirtyMorphTargets,ga=ka.vertices,L=q.faces3,V=q.faces4,Z=ka.faces,pa=ka.faceVertexUvs[0],ua=ka.faceVertexUvs[1],oa=ka.skinVerticesA,ra=ka.skinVerticesB,ta=ka.skinIndices,qa=ka.skinWeights,sa=ka.morphTargets;if(ka.__dirtyVertices){l=
+0;for(x=L.length;l<x;l++)v=Z[L[l]],A=ga[v.a].position,B=ga[v.b].position,C=ga[v.c].position,Q[Y]=A.x,Q[Y+1]=A.y,Q[Y+2]=A.z,Q[Y+3]=B.x,Q[Y+4]=B.y,Q[Y+5]=B.z,Q[Y+6]=C.x,Q[Y+7]=C.y,Q[Y+8]=C.z,Y+=9;l=0;for(x=V.length;l<x;l++)v=Z[V[l]],A=ga[v.a].position,B=ga[v.b].position,C=ga[v.c].position,v=ga[v.d].position,Q[Y]=A.x,Q[Y+1]=A.y,Q[Y+2]=A.z,Q[Y+3]=B.x,Q[Y+4]=B.y,Q[Y+5]=B.z,Q[Y+6]=C.x,Q[Y+7]=C.y,Q[Y+8]=C.z,Q[Y+9]=v.x,Q[Y+10]=v.y,Q[Y+11]=v.z,Y+=12;e.bindBuffer(e.ARRAY_BUFFER,q.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,
+Q,r)}if(ia){Y=0;for(ia=sa.length;Y<ia;Y++){l=Q=0;for(x=L.length;l<x;l++)v=Z[L[l]],A=sa[Y].vertices[v.a].position,B=sa[Y].vertices[v.b].position,C=sa[Y].vertices[v.c].position,ga=O[Y],ga[Q]=A.x,ga[Q+1]=A.y,ga[Q+2]=A.z,ga[Q+3]=B.x,ga[Q+4]=B.y,ga[Q+5]=B.z,ga[Q+6]=C.x,ga[Q+7]=C.y,ga[Q+8]=C.z,Q+=9;l=0;for(x=V.length;l<x;l++)v=Z[V[l]],A=sa[Y].vertices[v.a].position,B=sa[Y].vertices[v.b].position,C=sa[Y].vertices[v.c].position,v=sa[Y].vertices[v.d].position,ga=O[Y],ga[Q]=A.x,ga[Q+1]=A.y,ga[Q+2]=A.z,ga[Q+
+3]=B.x,ga[Q+4]=B.y,ga[Q+5]=B.z,ga[Q+6]=C.x,ga[Q+7]=C.y,ga[Q+8]=C.z,ga[Q+9]=v.x,ga[Q+10]=v.y,ga[Q+11]=v.z,Q+=12;e.bindBuffer(e.ARRAY_BUFFER,q.__webglMorphTargetsBuffers[Y]);e.bufferData(e.ARRAY_BUFFER,O[Y],r)}}if(qa.length){l=0;for(x=L.length;l<x;l++)v=Z[L[l]],A=qa[v.a],B=qa[v.b],C=qa[v.c],ja[y]=A.x,ja[y+1]=A.y,ja[y+2]=A.z,ja[y+3]=A.w,ja[y+4]=B.x,ja[y+5]=B.y,ja[y+6]=B.z,ja[y+7]=B.w,ja[y+8]=C.x,ja[y+9]=C.y,ja[y+10]=C.z,ja[y+11]=C.w,A=ta[v.a],B=ta[v.b],C=ta[v.c],ba[y]=A.x,ba[y+1]=A.y,ba[y+2]=A.z,ba[y+
+3]=A.w,ba[y+4]=B.x,ba[y+5]=B.y,ba[y+6]=B.z,ba[y+7]=B.w,ba[y+8]=C.x,ba[y+9]=C.y,ba[y+10]=C.z,ba[y+11]=C.w,A=oa[v.a],B=oa[v.b],C=oa[v.c],T[y]=A.x,T[y+1]=A.y,T[y+2]=A.z,T[y+3]=1,T[y+4]=B.x,T[y+5]=B.y,T[y+6]=B.z,T[y+7]=1,T[y+8]=C.x,T[y+9]=C.y,T[y+10]=C.z,T[y+11]=1,A=ra[v.a],B=ra[v.b],C=ra[v.c],U[y]=A.x,U[y+1]=A.y,U[y+2]=A.z,U[y+3]=1,U[y+4]=B.x,U[y+5]=B.y,U[y+6]=B.z,U[y+7]=1,U[y+8]=C.x,U[y+9]=C.y,U[y+10]=C.z,U[y+11]=1,y+=12;l=0;for(x=V.length;l<x;l++)v=Z[V[l]],A=qa[v.a],B=qa[v.b],C=qa[v.c],O=qa[v.d],ja[y]=
+A.x,ja[y+1]=A.y,ja[y+2]=A.z,ja[y+3]=A.w,ja[y+4]=B.x,ja[y+5]=B.y,ja[y+6]=B.z,ja[y+7]=B.w,ja[y+8]=C.x,ja[y+9]=C.y,ja[y+10]=C.z,ja[y+11]=C.w,ja[y+12]=O.x,ja[y+13]=O.y,ja[y+14]=O.z,ja[y+15]=O.w,A=ta[v.a],B=ta[v.b],C=ta[v.c],O=ta[v.d],ba[y]=A.x,ba[y+1]=A.y,ba[y+2]=A.z,ba[y+3]=A.w,ba[y+4]=B.x,ba[y+5]=B.y,ba[y+6]=B.z,ba[y+7]=B.w,ba[y+8]=C.x,ba[y+9]=C.y,ba[y+10]=C.z,ba[y+11]=C.w,ba[y+12]=O.x,ba[y+13]=O.y,ba[y+14]=O.z,ba[y+15]=O.w,A=oa[v.a],B=oa[v.b],C=oa[v.c],O=oa[v.d],T[y]=A.x,T[y+1]=A.y,T[y+2]=A.z,T[y+
+3]=1,T[y+4]=B.x,T[y+5]=B.y,T[y+6]=B.z,T[y+7]=1,T[y+8]=C.x,T[y+9]=C.y,T[y+10]=C.z,T[y+11]=1,T[y+12]=O.x,T[y+13]=O.y,T[y+14]=O.z,T[y+15]=1,A=ra[v.a],B=ra[v.b],C=ra[v.c],v=ra[v.d],U[y]=A.x,U[y+1]=A.y,U[y+2]=A.z,U[y+3]=1,U[y+4]=B.x,U[y+5]=B.y,U[y+6]=B.z,U[y+7]=1,U[y+8]=C.x,U[y+9]=C.y,U[y+10]=C.z,U[y+11]=1,U[y+12]=v.x,U[y+13]=v.y,U[y+14]=v.z,U[y+15]=1,y+=16;y>0&&(e.bindBuffer(e.ARRAY_BUFFER,q.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,T,r),e.bindBuffer(e.ARRAY_BUFFER,q.__webglSkinVertexBBuffer),
+e.bufferData(e.ARRAY_BUFFER,U,r),e.bindBuffer(e.ARRAY_BUFFER,q.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,ba,r),e.bindBuffer(e.ARRAY_BUFFER,q.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ja,r))}if(va&&w){l=0;for(x=L.length;l<x;l++)v=Z[L[l]],y=v.vertexColors,ba=v.color,y.length===3&&w===THREE.VertexColors?(v=y[0],T=y[1],U=y[2]):U=T=v=ba,ea[aa]=v.r,ea[aa+1]=v.g,ea[aa+2]=v.b,ea[aa+3]=T.r,ea[aa+4]=T.g,ea[aa+5]=T.b,ea[aa+6]=U.r,ea[aa+7]=U.g,ea[aa+8]=U.b,aa+=9;l=0;for(x=V.length;l<x;l++)v=
+Z[V[l]],y=v.vertexColors,ba=v.color,y.length===4&&w===THREE.VertexColors?(v=y[0],T=y[1],U=y[2],y=y[3]):y=U=T=v=ba,ea[aa]=v.r,ea[aa+1]=v.g,ea[aa+2]=v.b,ea[aa+3]=T.r,ea[aa+4]=T.g,ea[aa+5]=T.b,ea[aa+6]=U.r,ea[aa+7]=U.g,ea[aa+8]=U.b,ea[aa+9]=y.r,ea[aa+10]=y.g,ea[aa+11]=y.b,aa+=12;aa>0&&(e.bindBuffer(e.ARRAY_BUFFER,q.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,ea,r))}if(N&&ka.hasTangents){l=0;for(x=L.length;l<x;l++)v=Z[L[l]],N=v.vertexTangents,aa=N[0],ea=N[1],ka=N[2],$[H]=aa.x,$[H+1]=aa.y,$[H+2]=aa.z,
+$[H+3]=aa.w,$[H+4]=ea.x,$[H+5]=ea.y,$[H+6]=ea.z,$[H+7]=ea.w,$[H+8]=ka.x,$[H+9]=ka.y,$[H+10]=ka.z,$[H+11]=ka.w,H+=12;l=0;for(x=V.length;l<x;l++)v=Z[V[l]],N=v.vertexTangents,aa=N[0],ea=N[1],ka=N[2],N=N[3],$[H]=aa.x,$[H+1]=aa.y,$[H+2]=aa.z,$[H+3]=aa.w,$[H+4]=ea.x,$[H+5]=ea.y,$[H+6]=ea.z,$[H+7]=ea.w,$[H+8]=ka.x,$[H+9]=ka.y,$[H+10]=ka.z,$[H+11]=ka.w,$[H+12]=N.x,$[H+13]=N.y,$[H+14]=N.z,$[H+15]=N.w,H+=16;e.bindBuffer(e.ARRAY_BUFFER,q.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,$,r)}if(M&&s){l=0;for(x=
+L.length;l<x;l++)if(v=Z[L[l]],$=v.vertexNormals,M=v.normal,$.length===3&&K)for(H=0;H<3;H++)M=$[H],P[E]=M.x,P[E+1]=M.y,P[E+2]=M.z,E+=3;else for(H=0;H<3;H++)P[E]=M.x,P[E+1]=M.y,P[E+2]=M.z,E+=3;l=0;for(x=V.length;l<x;l++)if(v=Z[V[l]],$=v.vertexNormals,M=v.normal,$.length===4&&K)for(H=0;H<4;H++)M=$[H],P[E]=M.x,P[E+1]=M.y,P[E+2]=M.z,E+=3;else for(H=0;H<4;H++)P[E]=M.x,P[E+1]=M.y,P[E+2]=M.z,E+=3;e.bindBuffer(e.ARRAY_BUFFER,q.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,P,r)}if(la&&pa&&I){l=0;for(x=L.length;l<
+x;l++)if(E=L[l],E=pa[E],E!==void 0)for(H=0;H<3;H++)P=E[H],W[S]=P.u,W[S+1]=P.v,S+=2;l=0;for(x=V.length;l<x;l++)if(E=V[l],E=pa[E],E!==void 0)for(H=0;H<4;H++)P=E[H],W[S]=P.u,W[S+1]=P.v,S+=2;S>0&&(e.bindBuffer(e.ARRAY_BUFFER,q.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,W,r))}if(la&&ua&&I){l=0;for(x=L.length;l<x;l++)if(E=L[l],S=ua[E],S!==void 0)for(H=0;H<3;H++)W=S[H],u[fa]=W.u,u[fa+1]=W.v,fa+=2;l=0;for(x=V.length;l<x;l++)if(E=V[l],S=ua[E],S!==void 0)for(H=0;H<4;H++)W=S[H],u[fa]=W.u,u[fa+1]=W.v,fa+=2;
+fa>0&&(e.bindBuffer(e.ARRAY_BUFFER,q.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,u,r))}if(na){l=0;for(x=L.length;l<x;l++)p[ca]=J,p[ca+1]=J+1,p[ca+2]=J+2,ca+=3,ha[X]=J,ha[X+1]=J+1,ha[X+2]=J,ha[X+3]=J+2,ha[X+4]=J+1,ha[X+5]=J+2,X+=6,J+=3;l=0;for(x=V.length;l<x;l++)p[ca]=J,p[ca+1]=J+1,p[ca+2]=J+3,p[ca+3]=J+1,p[ca+4]=J+2,p[ca+5]=J+3,ca+=6,ha[X]=J,ha[X+1]=J+1,ha[X+2]=J,ha[X+3]=J+3,ha[X+4]=J+1,ha[X+5]=J+2,ha[X+6]=J+2,ha[X+7]=J+3,X+=8,J+=4;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,q.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,
+p,r);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,q.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ha,r)}if(D){H=0;for(J=D.length;H<J;H++)if(p=D[H],p.__original.needsUpdate){u=0;if(p.size===1)if(p.boundTo===void 0||p.boundTo==="vertices"){l=0;for(x=L.length;l<x;l++)v=Z[L[l]],p.array[u]=p.value[v.a],p.array[u+1]=p.value[v.b],p.array[u+2]=p.value[v.c],u+=3;l=0;for(x=V.length;l<x;l++)v=Z[V[l]],p.array[u]=p.value[v.a],p.array[u+1]=p.value[v.b],p.array[u+2]=p.value[v.c],p.array[u+3]=p.value[v.d],u+=4}else{if(p.boundTo===
+"faces"){l=0;for(x=L.length;l<x;l++)ha=p.value[L[l]],p.array[u]=ha,p.array[u+1]=ha,p.array[u+2]=ha,u+=3;l=0;for(x=V.length;l<x;l++)ha=p.value[V[l]],p.array[u]=ha,p.array[u+1]=ha,p.array[u+2]=ha,p.array[u+3]=ha,u+=4}}else if(p.size===2)if(p.boundTo===void 0||p.boundTo==="vertices"){l=0;for(x=L.length;l<x;l++)v=Z[L[l]],A=p.value[v.a],B=p.value[v.b],C=p.value[v.c],p.array[u]=A.x,p.array[u+1]=A.y,p.array[u+2]=B.x,p.array[u+3]=B.y,p.array[u+4]=C.x,p.array[u+5]=C.y,u+=6;l=0;for(x=V.length;l<x;l++)v=Z[V[l]],
+A=p.value[v.a],B=p.value[v.b],C=p.value[v.c],v=p.value[v.d],p.array[u]=A.x,p.array[u+1]=A.y,p.array[u+2]=B.x,p.array[u+3]=B.y,p.array[u+4]=C.x,p.array[u+5]=C.y,p.array[u+6]=v.x,p.array[u+7]=v.y,u+=8}else{if(p.boundTo==="faces"){l=0;for(x=L.length;l<x;l++)C=B=A=ha=p.value[L[l]],p.array[u]=A.x,p.array[u+1]=A.y,p.array[u+2]=B.x,p.array[u+3]=B.y,p.array[u+4]=C.x,p.array[u+5]=C.y,u+=6;l=0;for(x=V.length;l<x;l++)v=C=B=A=ha=p.value[V[l]],p.array[u]=A.x,p.array[u+1]=A.y,p.array[u+2]=B.x,p.array[u+3]=B.y,
+p.array[u+4]=C.x,p.array[u+5]=C.y,p.array[u+6]=v.x,p.array[u+7]=v.y,u+=8}}else if(p.size===3)if(s=p.type==="c"?["r","g","b"]:["x","y","z"],p.boundTo===void 0||p.boundTo==="vertices"){l=0;for(x=L.length;l<x;l++)v=Z[L[l]],A=p.value[v.a],B=p.value[v.b],C=p.value[v.c],p.array[u]=A[s[0]],p.array[u+1]=A[s[1]],p.array[u+2]=A[s[2]],p.array[u+3]=B[s[0]],p.array[u+4]=B[s[1]],p.array[u+5]=B[s[2]],p.array[u+6]=C[s[0]],p.array[u+7]=C[s[1]],p.array[u+8]=C[s[2]],u+=9;l=0;for(x=V.length;l<x;l++)v=Z[V[l]],A=p.value[v.a],
+B=p.value[v.b],C=p.value[v.c],v=p.value[v.d],p.array[u]=A[s[0]],p.array[u+1]=A[s[1]],p.array[u+2]=A[s[2]],p.array[u+3]=B[s[0]],p.array[u+4]=B[s[1]],p.array[u+5]=B[s[2]],p.array[u+6]=C[s[0]],p.array[u+7]=C[s[1]],p.array[u+8]=C[s[2]],p.array[u+9]=v[s[0]],p.array[u+10]=v[s[1]],p.array[u+11]=v[s[2]],u+=12}else{if(p.boundTo==="faces"){l=0;for(x=L.length;l<x;l++)C=B=A=ha=p.value[L[l]],p.array[u]=A[s[0]],p.array[u+1]=A[s[1]],p.array[u+2]=A[s[2]],p.array[u+3]=B[s[0]],p.array[u+4]=B[s[1]],p.array[u+5]=B[s[2]],
+p.array[u+6]=C[s[0]],p.array[u+7]=C[s[1]],p.array[u+8]=C[s[2]],u+=9;l=0;for(x=V.length;l<x;l++)v=C=B=A=ha=p.value[V[l]],p.array[u]=A[s[0]],p.array[u+1]=A[s[1]],p.array[u+2]=A[s[2]],p.array[u+3]=B[s[0]],p.array[u+4]=B[s[1]],p.array[u+5]=B[s[2]],p.array[u+6]=C[s[0]],p.array[u+7]=C[s[1]],p.array[u+8]=C[s[2]],p.array[u+9]=v[s[0]],p.array[u+10]=v[s[1]],p.array[u+11]=v[s[2]],u+=12}}else if(p.size===4)if(p.boundTo===void 0||p.boundTo==="vertices"){l=0;for(x=L.length;l<x;l++)v=Z[L[l]],A=p.value[v.a],B=p.value[v.b],
+C=p.value[v.c],p.array[u]=A.x,p.array[u+1]=A.y,p.array[u+2]=A.z,p.array[u+3]=A.w,p.array[u+4]=B.x,p.array[u+5]=B.y,p.array[u+6]=B.z,p.array[u+7]=B.w,p.array[u+8]=C.x,p.array[u+9]=C.y,p.array[u+10]=C.z,p.array[u+11]=C.w,u+=12;l=0;for(x=V.length;l<x;l++)v=Z[V[l]],A=p.value[v.a],B=p.value[v.b],C=p.value[v.c],v=p.value[v.d],p.array[u]=A.x,p.array[u+1]=A.y,p.array[u+2]=A.z,p.array[u+3]=A.w,p.array[u+4]=B.x,p.array[u+5]=B.y,p.array[u+6]=B.z,p.array[u+7]=B.w,p.array[u+8]=C.x,p.array[u+9]=C.y,p.array[u+10]=
+C.z,p.array[u+11]=C.w,p.array[u+12]=v.x,p.array[u+13]=v.y,p.array[u+14]=v.z,p.array[u+15]=v.w,u+=16}else if(p.boundTo==="faces"){l=0;for(x=L.length;l<x;l++)C=B=A=ha=p.value[L[l]],p.array[u]=A.x,p.array[u+1]=A.y,p.array[u+2]=A.z,p.array[u+3]=A.w,p.array[u+4]=B.x,p.array[u+5]=B.y,p.array[u+6]=B.z,p.array[u+7]=B.w,p.array[u+8]=C.x,p.array[u+9]=C.y,p.array[u+10]=C.z,p.array[u+11]=C.w,u+=12;l=0;for(x=V.length;l<x;l++)v=C=B=A=ha=p.value[V[l]],p.array[u]=A.x,p.array[u+1]=A.y,p.array[u+2]=A.z,p.array[u+3]=
+A.w,p.array[u+4]=B.x,p.array[u+5]=B.y,p.array[u+6]=B.z,p.array[u+7]=B.w,p.array[u+8]=C.x,p.array[u+9]=C.y,p.array[u+10]=C.z,p.array[u+11]=C.w,p.array[u+12]=v.x,p.array[u+13]=v.y,p.array[u+14]=v.z,p.array[u+15]=v.w,u+=16}e.bindBuffer(e.ARRAY_BUFFER,p.buffer);e.bufferData(e.ARRAY_BUFFER,p.array,r)}}t&&(delete q.__inittedArrays,delete q.__colorArray,delete q.__normalArray,delete q.__tangentArray,delete q.__uvArray,delete q.__uv2Array,delete q.__faceArray,delete q.__vertexArray,delete q.__lineArray,delete q.__skinVertexAArray,
+delete q.__skinVertexBArray,delete q.__skinIndexArray,delete q.__skinWeightArray)}}n.__dirtyVertices=!1;n.__dirtyMorphTargets=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyColors=!1;n.__dirtyTangents=!1;k.attributes&&ma(k)}else if(z instanceof THREE.Ribbon){if(n.__dirtyVertices||n.__dirtyColors){k=n;z=e.DYNAMIC_DRAW;s=j=s=t=t=void 0;w=k.vertices;o=k.colors;l=w.length;q=o.length;x=k.__vertexArray;r=k.__colorArray;D=k.__dirtyColors;if(k.__dirtyVertices){for(t=0;t<l;t++)s=w[t].position,
+j=t*3,x[j]=s.x,x[j+1]=s.y,x[j+2]=s.z;e.bindBuffer(e.ARRAY_BUFFER,k.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,x,z)}if(D){for(t=0;t<q;t++)s=o[t],j=t*3,r[j]=s.r,r[j+1]=s.g,r[j+2]=s.b;e.bindBuffer(e.ARRAY_BUFFER,k.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,r,z)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(z instanceof THREE.Line){k=c(z,q);r=k.attributes&&R(k);if(n.__dirtyVertices||n.__dirtyColors||r){z=n;j=e.DYNAMIC_DRAW;l=o=K=w=I=void 0;w=z.vertices;q=z.colors;l=w.length;r=q.length;x=
+z.__vertexArray;t=z.__colorArray;D=z.__dirtyColors;s=z.__webglCustomAttributesList;J=Z=V=L=K=I=void 0;if(z.__dirtyVertices){for(I=0;I<l;I++)K=w[I].position,o=I*3,x[o]=K.x,x[o+1]=K.y,x[o+2]=K.z;e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,x,j)}if(D){for(w=0;w<r;w++)l=q[w],o=w*3,t[o]=l.r,t[o+1]=l.g,t[o+2]=l.b;e.bindBuffer(e.ARRAY_BUFFER,z.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,t,j)}if(s){I=0;for(K=s.length;I<K;I++)if(J=s[I],J.needsUpdate&&(J.boundTo===void 0||
+J.boundTo==="vertices")){o=0;V=J.value.length;if(J.size===1)for(L=0;L<V;L++)J.array[L]=J.value[L];else if(J.size===2)for(L=0;L<V;L++)Z=J.value[L],J.array[o]=Z.x,J.array[o+1]=Z.y,o+=2;else if(J.size===3)if(J.type==="c")for(L=0;L<V;L++)Z=J.value[L],J.array[o]=Z.r,J.array[o+1]=Z.g,J.array[o+2]=Z.b,o+=3;else for(L=0;L<V;L++)Z=J.value[L],J.array[o]=Z.x,J.array[o+1]=Z.y,J.array[o+2]=Z.z,o+=3;else if(J.size===4)for(L=0;L<V;L++)Z=J.value[L],J.array[o]=Z.x,J.array[o+1]=Z.y,J.array[o+2]=Z.z,J.array[o+3]=Z.w,
+o+=4;e.bindBuffer(e.ARRAY_BUFFER,J.buffer);e.bufferData(e.ARRAY_BUFFER,J.array,j)}}}n.__dirtyVertices=!1;n.__dirtyColors=!1;k.attributes&&ma(k)}else if(z instanceof THREE.ParticleSystem)k=c(z,q),r=k.attributes&&R(k),(n.__dirtyVertices||n.__dirtyColors||z.sortParticles||r)&&h(n,e.DYNAMIC_DRAW,z),n.__dirtyVertices=!1,n.__dirtyColors=!1,k.attributes&&ma(k)};this.initMaterial=function(a,b,c,d){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 k,n,o;k=o=j=0;for(n=b.length;k<n;k++)h=b[k],h instanceof THREE.SpotLight&&o++,h instanceof THREE.DirectionalLight&&
+o++,h instanceof THREE.PointLight&&j++;j+o<=fa?k=o:(k=Math.ceil(fa*o/(j+o)),j=fa-k);h={directional:k,point:j};j=o=0;for(k=b.length;j<k;j++)n=b[j],n instanceof THREE.SpotLight&&n.castShadow&&o++;var l=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)l=d.bones.length;var m;a:{k=a.fragmentShader;n=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:l,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},t,d=[];i?d.push(i):(d.push(k),d.push(n));for(t in c)d.push(t),d.push(c[t]);i=d.join();t=0;for(d=ua.length;t<d;t++)if(ua[t].code===i){m=ua[t].program;break a}t=e.createProgram();
+d=[Ya?"#define VERTEX_TEXTURES":"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.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 "+Za+" 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:"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.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(r,M("fragment",h+l));d.attachShader(r,
-M("vertex",e+n));d.linkProgram(r);d.getProgramParameter(r,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(r,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");r.uniforms={};r.attributes={};var y,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in k)e.push(y);y=e;e=0;for(k=y.length;e<k;e++)l=y[e],r.uniforms[l]=d.getUniformLocation(r,
-l);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(y=0;y<c.maxMorphTargets;y++)e.push("morphTarget"+y);for(q in b)e.push(q);q=e;y=0;for(b=q.length;y<b;y++)c=q[y],r.attributes[c]=d.getAttribLocation(r,c);r.id=ta.length;ta.push({program:r,code:i});G.info.memory.programs=ta.length;q=r}a.program=q;q=a.program.attributes;q.position>=0&&d.enableVertexAttribArray(q.position);q.color>=0&&d.enableVertexAttribArray(q.color);q.normal>=0&&d.enableVertexAttribArray(q.normal);
-q.tangent>=0&&d.enableVertexAttribArray(q.tangent);a.skinning&&q.skinVertexA>=0&&q.skinVertexB>=0&&q.skinIndex>=0&&q.skinWeight>=0&&(d.enableVertexAttribArray(q.skinVertexA),d.enableVertexAttribArray(q.skinVertexB),d.enableVertexAttribArray(q.skinIndex),d.enableVertexAttribArray(q.skinWeight));if(a.attributes)for(g in a.attributes)q[g]!==void 0&&q[g]>=0&&d.enableVertexAttribArray(q[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)y="morphTarget"+g,q[y]>=0&&(d.enableVertexAttribArray(q[y]),
-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)}};
+"",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");e.attachShader(t,M("fragment",h+k));e.attachShader(t,
+M("vertex",d+n));e.linkProgram(t);e.getProgramParameter(t,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(t,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");t.uniforms={};t.attributes={};var z,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(z in j)d.push(z);z=d;d=0;for(j=z.length;d<j;d++)k=z[d],t.uniforms[k]=e.getUniformLocation(t,
+k);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(z=0;z<c.maxMorphTargets;z++)d.push("morphTarget"+z);for(m in b)d.push(m);m=d;z=0;for(b=m.length;z<b;z++)c=m[z],t.attributes[c]=e.getAttribLocation(t,c);t.id=ua.length;ua.push({program:t,code:i});G.info.memory.programs=ua.length;m=t}a.program=m;m=a.program.attributes;m.position>=0&&e.enableVertexAttribArray(m.position);m.color>=0&&e.enableVertexAttribArray(m.color);m.normal>=0&&e.enableVertexAttribArray(m.normal);
+m.tangent>=0&&e.enableVertexAttribArray(m.tangent);a.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0&&(e.enableVertexAttribArray(m.skinVertexA),e.enableVertexAttribArray(m.skinVertexB),e.enableVertexAttribArray(m.skinIndex),e.enableVertexAttribArray(m.skinWeight));if(a.attributes)for(g in a.attributes)m[g]!==void 0&&m[g]>=0&&e.enableVertexAttribArray(m[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)z="morphTarget"+g,m[z]>=0&&(e.enableVertexAttribArray(m[z]),
+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"?e.frontFace(e.CCW):e.frontFace(e.CW),a==="back"?e.cullFace(e.BACK):a==="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.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:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};

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