Browse Source

Moved sprite handling into plugin.

Work in progress. Still just experimenting. Probably will make some auto-adding of plugins.
alteredq 13 years ago
parent
commit
1dcf5fc79b
7 changed files with 749 additions and 1028 deletions
  1. 376 374
      build/Three.js
  2. 166 155
      build/custom/ThreeExtras.js
  3. 199 208
      build/custom/ThreeWebGL.js
  4. 4 0
      examples/webgl_sprites.html
  5. 1 218
      src/renderers/WebGLRenderer.js
  6. 0 72
      src/renderers/WebGLShaders.js
  7. 3 1
      utils/build.py

+ 376 - 374
build/Three.js

@@ -15,64 +15,64 @@ 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){o.sub(c,a);r=o.dot(b);if(r<=0)return null;n=p.add(a,m.copy(b).multiplyScalar(r));return q=c.distanceTo(n)}function d(a,b,c,d){o.sub(d,b);p.sub(c,b);m.sub(a,b);t=o.dot(o);v=o.dot(p);z=o.dot(m);u=p.dot(p);B=p.dot(m);A=1/(t*u-v*v);F=(u*z-v*B)*A;H=(t*B-v*z)*A;return F>=0&&H>=0&&F+H<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,g=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3;this.intersectObject=function(m){for(var n,o=[],p=0,r=m.children.length;p<r;p++)Array.prototype.push.apply(o,this.intersectObject(m.children[p]));if(m instanceof THREE.Particle){p=
-c(this.origin,this.direction,m.matrixWorld.getPosition());if(p===null||p>m.scale.x)return[];n={distance:p,point:m.position,face:null,object:m};o.push(n)}else if(m instanceof THREE.Mesh){p=c(this.origin,this.direction,m.matrixWorld.getPosition());if(p===null||p>m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)))return o;var q,t=m.geometry,v=t.vertices,z;m.matrixRotationWorld.extractRotation(m.matrixWorld);p=0;for(r=t.faces.length;p<r;p++)if(n=t.faces[p],a.copy(this.origin),
-b.copy(this.direction),z=m.matrixWorld,i=z.multiplyVector3(i.copy(n.centroid)).subSelf(a),q=i.dot(b),!(q<=0)&&(e=z.multiplyVector3(e.copy(v[n.a].position)),g=z.multiplyVector3(g.copy(v[n.b].position)),f=z.multiplyVector3(f.copy(v[n.c].position)),n instanceof THREE.Face4&&(h=z.multiplyVector3(h.copy(v[n.d].position))),l=m.matrixRotationWorld.multiplyVector3(l.copy(n.normal)),q=b.dot(l),m.doubleSided||(m.flipSided?q>0:q<0)))if(q=l.dot(i.sub(e,a))/q,k.add(a,b.multiplyScalar(q)),n instanceof THREE.Face3)d(k,
-e,g,f)&&(n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},o.push(n));else if(n instanceof THREE.Face4&&(d(k,e,g,h)||d(k,g,f,h)))n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},o.push(n)}return o};var o=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,r,n,q,t,v,z,u,B,A,F,H};
+THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);q=o.dot(b);if(q<=0)return null;n=p.add(a,m.copy(b).multiplyScalar(q));return r=c.distanceTo(n)}function d(a,b,c,d){o.sub(d,b);p.sub(c,b);m.sub(a,b);t=o.dot(o);u=o.dot(p);y=o.dot(m);v=p.dot(p);A=p.dot(m);z=1/(t*v-u*u);w=(v*y-u*A)*z;I=(t*A-u*y)*z;return w>=0&&I>=0&&w+I<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,g=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector3;this.intersectObject=function(m){for(var n,o=[],p=0,q=m.children.length;p<q;p++)Array.prototype.push.apply(o,this.intersectObject(m.children[p]));if(m instanceof THREE.Particle){p=
+c(this.origin,this.direction,m.matrixWorld.getPosition());if(p===null||p>m.scale.x)return[];n={distance:p,point:m.position,face:null,object:m};o.push(n)}else if(m instanceof THREE.Mesh){p=c(this.origin,this.direction,m.matrixWorld.getPosition());if(p===null||p>m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)))return o;var r,t=m.geometry,u=t.vertices,y;m.matrixRotationWorld.extractRotation(m.matrixWorld);p=0;for(q=t.faces.length;p<q;p++)if(n=t.faces[p],a.copy(this.origin),
+b.copy(this.direction),y=m.matrixWorld,i=y.multiplyVector3(i.copy(n.centroid)).subSelf(a),r=i.dot(b),!(r<=0)&&(e=y.multiplyVector3(e.copy(u[n.a].position)),g=y.multiplyVector3(g.copy(u[n.b].position)),f=y.multiplyVector3(f.copy(u[n.c].position)),n instanceof THREE.Face4&&(h=y.multiplyVector3(h.copy(u[n.d].position))),j=m.matrixRotationWorld.multiplyVector3(j.copy(n.normal)),r=b.dot(j),m.doubleSided||(m.flipSided?r>0:r<0)))if(r=j.dot(i.sub(e,a))/r,k.add(a,b.multiplyScalar(r)),n instanceof THREE.Face3)d(k,
+e,g,f)&&(n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},o.push(n));else if(n instanceof THREE.Face4&&(d(k,e,g,h)||d(k,g,f,h)))n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},o.push(n)}return o};var o=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,q,n,r,t,u,y,v,A,z,w,I};
 THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(g,f,k,o){h=!1;b=g;c=f;d=k;e=o;a()};this.addPoint=function(g,f){h?(h=!1,b=g,c=f,d=g,e=f):(b=b<g?b:g,c=c<f?c:f,d=d>g?d:g,e=e>f?e:f);a()};this.add3Points=
 function(g,f,k,o,p,m){h?(h=!1,b=g<k?g<p?g:p:k<p?k:p,c=f<o?f<m?f:m:o<m?o:m,d=g>k?g>p?g:p:k>p?k:p,e=f>o?f>m?f:m:o>m?o:m):(b=g<k?g<p?g<b?g:b:p<b?p:b:k<p?k<b?k:b:p<b?p:b,c=f<o?f<m?f<c?f:c:m<c?m:c:o<m?o<c?o:c:m<c?m:c,d=g>k?g>p?g>d?g:d:p>d?p:d:k>p?k>d?k:d:p>d?p:d,e=f>o?f>m?f>e?f:e:m>e?m:e:o>m?o>e?o:e:m>e?m:e);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),d=g.getRight(),e=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),d=d>g.getRight()?d:g.getRight(),e=e>
 g.getBottom()?e:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;d+=g;e+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();e=e<g.getBottom()?e:g.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,g,f,h,i,l,k,o,p,m,r,n){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,g!==void 0?g:1,f||0,h||0,i||0,l||0,k!==void 0?k:1,o||0,p||0,m||0,r||0,n!==void 0?n:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,i,l,k,o,p,m,r,n){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=i;this.n32=l;this.n33=k;this.n34=o;this.n41=p;this.n42=m;this.n43=r;this.n44=n;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,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,i=a.n23,l=a.n24,k=a.n31,o=a.n32,p=a.n33,m=a.n34,r=a.n41,n=a.n42,q=a.n43,
-t=a.n44,v=b.n11,z=b.n12,u=b.n13,B=b.n14,A=b.n21,F=b.n22,H=b.n23,E=b.n24,L=b.n31,s=b.n32,G=b.n33,U=b.n34,Z=b.n41,Q=b.n42,T=b.n43,$=b.n44;this.n11=c*v+d*A+e*L+g*Z;this.n12=c*z+d*F+e*s+g*Q;this.n13=c*u+d*H+e*G+g*T;this.n14=c*B+d*E+e*U+g*$;this.n21=f*v+h*A+i*L+l*Z;this.n22=f*z+h*F+i*s+l*Q;this.n23=f*u+h*H+i*G+l*T;this.n24=f*B+h*E+i*U+l*$;this.n31=k*v+o*A+p*L+m*Z;this.n32=k*z+o*F+p*s+m*Q;this.n33=k*u+o*H+p*G+m*T;this.n34=k*B+o*E+p*U+m*$;this.n41=r*v+n*A+q*L+t*Z;this.n42=r*z+n*F+q*s+t*Q;this.n43=r*u+n*
-H+q*G+t*T;this.n44=r*B+n*E+q*U+t*$;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
+THREE.Matrix4=function(a,b,c,d,e,g,f,h,i,j,k,o,p,m,q,n){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,g!==void 0?g:1,f||0,h||0,i||0,j||0,k!==void 0?k:1,o||0,p||0,m||0,q||0,n!==void 0?n:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,i,j,k,o,p,m,q,n){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=i;this.n32=j;this.n33=k;this.n34=o;this.n41=p;this.n42=m;this.n43=q;this.n44=n;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,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,i=a.n23,j=a.n24,k=a.n31,o=a.n32,p=a.n33,m=a.n34,q=a.n41,n=a.n42,r=a.n43,
+t=a.n44,u=b.n11,y=b.n12,v=b.n13,A=b.n14,z=b.n21,w=b.n22,I=b.n23,F=b.n24,G=b.n31,s=b.n32,E=b.n33,T=b.n34,Z=b.n41,Q=b.n42,U=b.n43,$=b.n44;this.n11=c*u+d*z+e*G+g*Z;this.n12=c*y+d*w+e*s+g*Q;this.n13=c*v+d*I+e*E+g*U;this.n14=c*A+d*F+e*T+g*$;this.n21=f*u+h*z+i*G+j*Z;this.n22=f*y+h*w+i*s+j*Q;this.n23=f*v+h*I+i*E+j*U;this.n24=f*A+h*F+i*T+j*$;this.n31=k*u+o*z+p*G+m*Z;this.n32=k*y+o*w+p*s+m*Q;this.n33=k*v+o*I+p*E+m*U;this.n34=k*A+o*F+p*T+m*$;this.n41=q*u+n*z+r*G+t*Z;this.n42=q*y+n*w+r*s+t*Q;this.n43=q*v+n*
+I+r*E+t*U;this.n44=q*A+n*F+r*T+t*$;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,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,g=this.n22,f=this.n23,h=this.n24,i=this.n31,l=this.n32,k=this.n33,o=this.n34,p=this.n41,m=this.n42,r=this.n43,n=this.n44;return d*f*l*p-c*h*l*p-d*g*k*p+b*h*k*p+c*g*o*p-b*f*o*p-d*f*i*m+c*h*i*m+d*e*k*m-a*h*k*m-c*e*o*m+a*f*o*m+d*g*i*r-b*h*i*r-d*e*l*r+a*h*l*r+b*e*o*r-a*g*o*r-c*g*i*n+b*f*i*n+c*e*l*n-a*f*l*n-b*e*k*n+a*g*k*n},transpose:function(){var a;
+a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,i=this.n31,j=this.n32,k=this.n33,o=this.n34,p=this.n41,m=this.n42,q=this.n43,n=this.n44;return d*f*j*p-c*h*j*p-d*g*k*p+b*h*k*p+c*g*o*p-b*f*o*p-d*f*i*m+c*h*i*m+d*e*k*m-a*h*k*m-c*e*o*m+a*f*o*m+d*g*i*q-b*h*i*q-d*e*j*q+a*h*j*q+b*e*o*q-a*g*o*q-c*g*i*n+b*f*i*n+c*e*j*n-a*f*j*n-b*e*k*n+a*g*k*n},transpose:function(){var a;
 a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;
 a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;
 a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},
 setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},
-setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,h=a.z,i=e*g,l=e*f;this.set(i*g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,l*f+c,l*h-d*g,0,i*h-d*f,l*h+d*g,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,g=a.n21,f=a.n22,h=a.n23,i=a.n24,l=a.n31,k=a.n32,o=a.n33,p=a.n34,m=a.n41,r=a.n42,n=a.n43,q=a.n44;this.n11=h*p*r-i*o*r+i*k*n-f*p*n-h*k*q+f*o*q;this.n12=e*o*r-d*p*r-e*k*n+c*p*n+d*k*q-c*o*q;this.n13=d*i*r-e*h*r+e*f*n-c*i*n-d*f*q+c*h*q;this.n14=e*h*k-d*i*k-e*f*o+c*i*o+d*f*p-c*h*p;this.n21=i*o*m-h*p*m-i*l*n+g*p*n+h*l*q-g*o*q;this.n22=d*p*m-e*o*m+
-e*l*n-b*p*n-d*l*q+b*o*q;this.n23=e*h*m-d*i*m-e*g*n+b*i*n+d*g*q-b*h*q;this.n24=d*i*l-e*h*l+e*g*o-b*i*o-d*g*p+b*h*p;this.n31=f*p*m-i*k*m+i*l*r-g*p*r-f*l*q+g*k*q;this.n32=e*k*m-c*p*m-e*l*r+b*p*r+c*l*q-b*k*q;this.n33=d*i*m-e*f*m+e*g*r-b*i*r-c*g*q+b*f*q;this.n34=e*f*l-c*i*l-e*g*k+b*i*k+c*g*p-b*f*p;this.n41=h*k*m-f*o*m-h*l*r+g*o*r+f*l*n-g*k*n;this.n42=c*o*m-d*k*m+d*l*r-b*o*r-c*l*n+b*k*n;this.n43=d*f*m-c*h*m-d*g*r+b*h*r+c*g*n-b*f*n;this.n44=c*h*l-d*f*l+d*g*k-b*h*k-c*g*o+b*f*o;this.multiplyScalar(1/a.determinant());
-return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=f*h,l=f*e,k=d*h,o=d*e;this.n11=i+o*c;this.n12=k*c-l;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=l*c-k;this.n32=o+i*c;this.n33=g*f;break;case "ZXY":i=f*h;l=f*e;k=d*h;o=d*e;this.n11=i-o*c;this.n12=-g*e;this.n13=k+l*c;this.n21=l+k*c;this.n22=g*h;this.n23=o-i*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":i=
-g*h;l=g*e;k=c*h;o=c*e;this.n11=f*h;this.n12=k*d-l;this.n13=i*d+o;this.n21=f*e;this.n22=o*d+i;this.n23=l*d-k;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":i=g*f;l=g*d;k=c*f;o=c*d;this.n11=f*h;this.n12=o-i*e;this.n13=k*e+l;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*e+k;this.n33=i-o*e;break;case "XZY":i=g*f;l=g*d;k=c*f;o=c*d;this.n11=f*h;this.n12=-e;this.n13=d*h;this.n21=i*e+o;this.n22=g*h;this.n23=l*e-k;this.n31=k*e-l;this.n32=c*h;this.n33=o*e+i;break;default:i=g*h,l=g*
-e,k=c*h,o=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=l+k*d,this.n22=i-o*d,this.n23=-c*f,this.n31=o-i*d,this.n32=k+l*d,this.n33=g*f}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,i=b*f;b*=h;var l=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(l+d);this.n12=i-e;this.n13=b+f;this.n21=i+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;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),e=1-c,g=a.x,f=a.y,h=a.z,i=e*g,j=e*f;this.set(i*g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,j*f+c,j*h-d*g,0,i*h-d*f,j*h+d*g,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,g=a.n21,f=a.n22,h=a.n23,i=a.n24,j=a.n31,k=a.n32,o=a.n33,p=a.n34,m=a.n41,q=a.n42,n=a.n43,r=a.n44;this.n11=h*p*q-i*o*q+i*k*n-f*p*n-h*k*r+f*o*r;this.n12=e*o*q-d*p*q-e*k*n+c*p*n+d*k*r-c*o*r;this.n13=d*i*q-e*h*q+e*f*n-c*i*n-d*f*r+c*h*r;this.n14=e*h*k-d*i*k-e*f*o+c*i*o+d*f*p-c*h*p;this.n21=i*o*m-h*p*m-i*j*n+g*p*n+h*j*r-g*o*r;this.n22=d*p*m-e*o*m+
+e*j*n-b*p*n-d*j*r+b*o*r;this.n23=e*h*m-d*i*m-e*g*n+b*i*n+d*g*r-b*h*r;this.n24=d*i*j-e*h*j+e*g*o-b*i*o-d*g*p+b*h*p;this.n31=f*p*m-i*k*m+i*j*q-g*p*q-f*j*r+g*k*r;this.n32=e*k*m-c*p*m-e*j*q+b*p*q+c*j*r-b*k*r;this.n33=d*i*m-e*f*m+e*g*q-b*i*q-c*g*r+b*f*r;this.n34=e*f*j-c*i*j-e*g*k+b*i*k+c*g*p-b*f*p;this.n41=h*k*m-f*o*m-h*j*q+g*o*q+f*j*n-g*k*n;this.n42=c*o*m-d*k*m+d*j*q-b*o*q-c*j*n+b*k*n;this.n43=d*f*m-c*h*m-d*g*q+b*h*q+c*g*n-b*f*n;this.n44=c*h*j-d*f*j+d*g*k-b*h*k-c*g*o+b*f*o;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=f*h,j=f*e,k=d*h,o=d*e;this.n11=i+o*c;this.n12=k*c-j;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=j*c-k;this.n32=o+i*c;this.n33=g*f;break;case "ZXY":i=f*h;j=f*e;k=d*h;o=d*e;this.n11=i-o*c;this.n12=-g*e;this.n13=k+j*c;this.n21=j+k*c;this.n22=g*h;this.n23=o-i*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":i=
+g*h;j=g*e;k=c*h;o=c*e;this.n11=f*h;this.n12=k*d-j;this.n13=i*d+o;this.n21=f*e;this.n22=o*d+i;this.n23=j*d-k;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":i=g*f;j=g*d;k=c*f;o=c*d;this.n11=f*h;this.n12=o-i*e;this.n13=k*e+j;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=j*e+k;this.n33=i-o*e;break;case "XZY":i=g*f;j=g*d;k=c*f;o=c*d;this.n11=f*h;this.n12=-e;this.n13=d*h;this.n21=i*e+o;this.n22=g*h;this.n23=j*e-k;this.n31=k*e-j;this.n32=c*h;this.n33=o*e+i;break;default:i=g*h,j=g*
+e,k=c*h,o=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=j+k*d,this.n22=i-o*d,this.n23=-c*f,this.n31=o-i*d,this.n32=k+j*d,this.n33=g*f}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,i=b*f;b*=h;var j=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(j+d);this.n12=i-e;this.n13=b+f;this.n21=i+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
 a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.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=d.length();c.y=e.length();c.z=g.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,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,o=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*l;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*i;c[6]=a*l;c[7]=a*k;c[8]=a*o;return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,o=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*j;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*i;c[6]=a*j;c[7]=a*k;c[8]=a*o;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};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,g){var f,h,i,l;f=new THREE.Matrix4;h=b-a;i=c-d;l=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((c+d)/i);f.n31=0;f.n32=0;f.n33=-2/l;f.n34=-((g+e)/l);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,i,j;f=new THREE.Matrix4;h=b-a;i=c-d;j=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((c+d)/i);f.n31=0;f.n32=0;f.n33=-2/j;f.n34=-((g+e)/j);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !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=f[g]=f[g]||new THREE.RenderableObject;g++;return a}function b(){var a=l[i]=l[i]||new THREE.RenderableVertex;i++;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,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;return e>=0&&g>=0&&f>=0&&h>=0?!0:e<0&&g<0||f<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g))),f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var e,g,f=[],h,i,l=[],
-k,o,p=[],m,r=[],n,q,t=[],v,z,u=[],B={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,F=new THREE.Vector4,H=new THREE.Matrix4,E=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],s=new THREE.Vector4,G=new THREE.Vector4;this.computeFrustum=function(a){L[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);L[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);L[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);L[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);L[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);L[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=L[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);H.multiply(b.projectionMatrix,b.matrixWorldInverse);H.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-H.multiply(b.matrixWorld,b.projectionMatrixInverse);H.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){g=0;B.objects.length=0;B.sprites.length=0;B.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
-g=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=L[h].x*d.n14+L[h].y*d.n24+L[h].z*d.n34+L[h].w,c<=g){c=!1;break a}c=!0}c?(H.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,B.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(H.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,B.sprites.push(e)):b instanceof THREE.Light&&B.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(b);d&&
-B.objects.sort(c);return B};this.projectScene=function(a,e,g){var f=e.near,L=e.far,A,y,N,I,w,V,R,j,ba,O,ga,fa,W,na,ha,ra;z=q=m=o=0;B.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);H.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(H);B=this.projectGraph(a,!1);a=0;for(A=B.objects.length;a<A;a++)if(ba=B.objects[a].object,O=ba.matrixWorld,
-fa=ba.material,i=0,ba instanceof THREE.Mesh){ga=ba.geometry;W=ba.geometry.materials;I=ga.vertices;na=ga.faces;ha=ga.faceVertexUvs;ga=ba.matrixRotationWorld.extractRotation(O);y=0;for(N=I.length;y<N;y++)h=b(),h.positionWorld.copy(I[y].position),O.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),H.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<L;I=0;for(y=na.length;I<
-y;I++){N=na[I];if(N instanceof THREE.Face3)if(w=l[N.a],V=l[N.b],R=l[N.c],w.visible&&V.visible&&R.visible&&(ba.doubleSided||ba.flipSided!=(R.positionScreen.x-w.positionScreen.x)*(V.positionScreen.y-w.positionScreen.y)-(R.positionScreen.y-w.positionScreen.y)*(V.positionScreen.x-w.positionScreen.x)<0))j=p[o]=p[o]||new THREE.RenderableFace3,o++,k=j,k.v1.copy(w),k.v2.copy(V),k.v3.copy(R);else continue;else if(N instanceof THREE.Face4)if(w=l[N.a],V=l[N.b],R=l[N.c],j=l[N.d],w.visible&&V.visible&&R.visible&&
-j.visible&&(ba.doubleSided||ba.flipSided!=((j.positionScreen.x-w.positionScreen.x)*(V.positionScreen.y-w.positionScreen.y)-(j.positionScreen.y-w.positionScreen.y)*(V.positionScreen.x-w.positionScreen.x)<0||(V.positionScreen.x-R.positionScreen.x)*(j.positionScreen.y-R.positionScreen.y)-(V.positionScreen.y-R.positionScreen.y)*(j.positionScreen.x-R.positionScreen.x)<0)))ra=r[m]=r[m]||new THREE.RenderableFace4,m++,k=ra,k.v1.copy(w),k.v2.copy(V),k.v3.copy(R),k.v4.copy(j);else continue;k.normalWorld.copy(N.normal);
-ga.multiplyVector3(k.normalWorld);k.centroidWorld.copy(N.centroid);O.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);H.multiplyVector3(k.centroidScreen);R=N.vertexNormals;w=0;for(V=R.length;w<V;w++)j=k.vertexNormalsWorld[w],j.copy(R[w]),ga.multiplyVector3(j);w=0;for(V=ha.length;w<V;w++)if(ra=ha[w][I]){R=0;for(j=ra.length;R<j;R++)k.uvs[w][R]=ra[R]}k.material=fa;k.faceMaterial=N.materialIndex!==null?W[N.materialIndex]:null;k.z=k.centroidScreen.z;B.elements.push(k)}}else if(ba instanceof
-THREE.Line){E.multiply(H,O);I=ba.geometry.vertices;w=b();w.positionScreen.copy(I[0].position);E.multiplyVector4(w.positionScreen);y=1;for(N=I.length;y<N;y++)if(w=b(),w.positionScreen.copy(I[y].position),E.multiplyVector4(w.positionScreen),V=l[i-2],s.copy(w.positionScreen),G.copy(V.positionScreen),d(s,G))s.multiplyScalar(1/s.w),G.multiplyScalar(1/G.w),ba=t[q]=t[q]||new THREE.RenderableLine,q++,n=ba,n.v1.positionScreen.copy(s),n.v2.positionScreen.copy(G),n.z=Math.max(s.z,G.z),n.material=fa,B.elements.push(n)}a=
-0;for(A=B.sprites.length;a<A;a++)if(ba=B.sprites[a].object,O=ba.matrixWorld,ba instanceof THREE.Particle&&(F.set(O.n14,O.n24,O.n34,1),H.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))f=u[z]=u[z]||new THREE.RenderableParticle,z++,v=f,v.x=F.x/F.w,v.y=F.y/F.w,v.z=F.z,v.rotation=ba.rotation.z,v.scale.x=ba.scale.x*Math.abs(v.x-(F.x+e.projectionMatrix.n11)/(F.w+e.projectionMatrix.n14)),v.scale.y=ba.scale.y*Math.abs(v.y-(F.y+e.projectionMatrix.n22)/(F.w+e.projectionMatrix.n24)),v.material=ba.material,B.elements.push(v);
-g&&B.elements.sort(c);return B}};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=f[g]=f[g]||new THREE.RenderableObject;g++;return a}function b(){var a=j[i]=j[i]||new THREE.RenderableVertex;i++;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,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;return e>=0&&g>=0&&f>=0&&h>=0?!0:e<0&&g<0||f<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g))),f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var e,g,f=[],h,i,j=[],
+k,o,p=[],m,q=[],n,r,t=[],u,y,v=[],A={objects:[],sprites:[],lights:[],elements:[]},z=new THREE.Vector3,w=new THREE.Vector4,I=new THREE.Matrix4,F=new THREE.Matrix4,G=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],s=new THREE.Vector4,E=new THREE.Vector4;this.computeFrustum=function(a){G[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);G[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);G[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+a.n23,a.n44+a.n24);G[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);G[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);G[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=G[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);I.multiply(b.projectionMatrix,b.matrixWorldInverse);I.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+I.multiply(b.matrixWorld,b.projectionMatrixInverse);I.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){g=0;A.objects.length=0;A.sprites.length=0;A.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
+g=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=G[h].x*d.n14+G[h].y*d.n24+G[h].z*d.n34+G[h].w,c<=g){c=!1;break a}c=!0}c?(I.multiplyVector3(z.copy(b.position)),e=a(),e.object=b,e.z=z.z,A.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(I.multiplyVector3(z.copy(b.position)),e=a(),e.object=b,e.z=z.z,A.sprites.push(e)):b instanceof THREE.Light&&A.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(b);d&&
+A.objects.sort(c);return A};this.projectScene=function(a,e,g){var f=e.near,G=e.far,z,K,L,H,O,V,R,l,ca,N,fa,W,ba,na,ia,qa;y=r=m=o=0;A.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);I.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(I);A=this.projectGraph(a,!1);a=0;for(z=A.objects.length;a<z;a++)if(ca=A.objects[a].object,N=ca.matrixWorld,
+W=ca.material,i=0,ca instanceof THREE.Mesh){fa=ca.geometry;ba=ca.geometry.materials;H=fa.vertices;na=fa.faces;ia=fa.faceVertexUvs;fa=ca.matrixRotationWorld.extractRotation(N);K=0;for(L=H.length;K<L;K++)h=b(),h.positionWorld.copy(H[K].position),N.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),I.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<G;H=0;for(K=na.length;H<
+K;H++){L=na[H];if(L instanceof THREE.Face3)if(O=j[L.a],V=j[L.b],R=j[L.c],O.visible&&V.visible&&R.visible&&(ca.doubleSided||ca.flipSided!=(R.positionScreen.x-O.positionScreen.x)*(V.positionScreen.y-O.positionScreen.y)-(R.positionScreen.y-O.positionScreen.y)*(V.positionScreen.x-O.positionScreen.x)<0))l=p[o]=p[o]||new THREE.RenderableFace3,o++,k=l,k.v1.copy(O),k.v2.copy(V),k.v3.copy(R);else continue;else if(L instanceof THREE.Face4)if(O=j[L.a],V=j[L.b],R=j[L.c],l=j[L.d],O.visible&&V.visible&&R.visible&&
+l.visible&&(ca.doubleSided||ca.flipSided!=((l.positionScreen.x-O.positionScreen.x)*(V.positionScreen.y-O.positionScreen.y)-(l.positionScreen.y-O.positionScreen.y)*(V.positionScreen.x-O.positionScreen.x)<0||(V.positionScreen.x-R.positionScreen.x)*(l.positionScreen.y-R.positionScreen.y)-(V.positionScreen.y-R.positionScreen.y)*(l.positionScreen.x-R.positionScreen.x)<0)))qa=q[m]=q[m]||new THREE.RenderableFace4,m++,k=qa,k.v1.copy(O),k.v2.copy(V),k.v3.copy(R),k.v4.copy(l);else continue;k.normalWorld.copy(L.normal);
+fa.multiplyVector3(k.normalWorld);k.centroidWorld.copy(L.centroid);N.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);I.multiplyVector3(k.centroidScreen);R=L.vertexNormals;O=0;for(V=R.length;O<V;O++)l=k.vertexNormalsWorld[O],l.copy(R[O]),fa.multiplyVector3(l);O=0;for(V=ia.length;O<V;O++)if(qa=ia[O][H]){R=0;for(l=qa.length;R<l;R++)k.uvs[O][R]=qa[R]}k.material=W;k.faceMaterial=L.materialIndex!==null?ba[L.materialIndex]:null;k.z=k.centroidScreen.z;A.elements.push(k)}}else if(ca instanceof
+THREE.Line){F.multiply(I,N);H=ca.geometry.vertices;O=b();O.positionScreen.copy(H[0].position);F.multiplyVector4(O.positionScreen);K=1;for(L=H.length;K<L;K++)if(O=b(),O.positionScreen.copy(H[K].position),F.multiplyVector4(O.positionScreen),V=j[i-2],s.copy(O.positionScreen),E.copy(V.positionScreen),d(s,E))s.multiplyScalar(1/s.w),E.multiplyScalar(1/E.w),ca=t[r]=t[r]||new THREE.RenderableLine,r++,n=ca,n.v1.positionScreen.copy(s),n.v2.positionScreen.copy(E),n.z=Math.max(s.z,E.z),n.material=W,A.elements.push(n)}a=
+0;for(z=A.sprites.length;a<z;a++)if(ca=A.sprites[a].object,N=ca.matrixWorld,ca instanceof THREE.Particle&&(w.set(N.n14,N.n24,N.n34,1),I.multiplyVector4(w),w.z/=w.w,w.z>0&&w.z<1))f=v[y]=v[y]||new THREE.RenderableParticle,y++,u=f,u.x=w.x/w.w,u.y=w.y/w.w,u.z=w.z,u.rotation=ca.rotation.z,u.scale.x=ca.scale.x*Math.abs(u.x-(w.x+e.projectionMatrix.n11)/(w.w+e.projectionMatrix.n14)),u.scale.y=ca.scale.y*Math.abs(u.y-(w.y+e.projectionMatrix.n22)/(w.w+e.projectionMatrix.n24)),u.material=ca.material,A.elements.push(u);
+g&&A.elements.sort(c);return A}};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),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-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,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-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,g=this.x,f=this.y,h=this.z,i=this.w,l=i*c+f*e-h*d,k=i*d+h*c-g*e,o=i*e+g*d-f*c,c=-g*
-c-f*d-h*e;b.x=l*i+c*-g+k*-h-o*-f;b.y=k*i+c*-f+o*-g-l*-h;b.z=o*i+c*-h+l*-f-k*-g;return b}};
+this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-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,g=this.x,f=this.y,h=this.z,i=this.w,j=i*c+f*e-h*d,k=i*d+h*c-g*e,o=i*e+g*d-f*c,c=-g*
+c-f*d-h*e;b.x=j*i+c*-g+k*-h-o*-f;b.y=k*i+c*-f+o*-g-j*-h;b.z=o*i+c*-h+j*-f-k*-g;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 g=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010)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)*g)/e;d=Math.sin(d*g)/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,g){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=g;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,g,f){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=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.UV=function(a,b){this.u=a||0;this.v=b||0};
@@ -83,14 +83,14 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 b,c,d,e,g,f=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],e=this.vertices[c.b],g=this.vertices[c.c],f.sub(g.position,e.position),h.sub(d.position,e.position),f.crossSelf(h),f.isZero()||f.normalize(),c.normal.copy(f)},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,g,U){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=f[e];o=f[g];p=f[U];m=i.x-h.x;r=l.x-h.x;n=i.y-h.y;q=l.y-h.y;t=i.z-h.z;v=l.z-h.z;z=o.u-k.u;u=p.u-k.u;B=o.v-k.v;A=p.v-k.v;F=1/(z*A-u*B);s.set((A*m-B*r)*F,(A*n-B*q)*F,(A*t-B*v)*F);G.set((z*r-u*m)*F,(z*q-u*n)*F,(z*v-u*t)*F);E[b].addSelf(s);E[c].addSelf(s);E[d].addSelf(s);L[b].addSelf(G);L[c].addSelf(G);L[d].addSelf(G)}var b,c,d,e,g,f,h,i,l,k,o,p,m,r,n,q,t,v,z,u,B,A,F,H,E=[],L=[],s=new THREE.Vector3,G=new THREE.Vector3,
-U=new THREE.Vector3,Z=new THREE.Vector3,Q=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)E[b]=new THREE.Vector3,L[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],f=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 T=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)Q.copy(g.vertexNormals[d]),e=g[T[d]],
-H=E[e],U.copy(H),U.subSelf(Q.multiplyScalar(Q.dot(H))).normalize(),Z.cross(g.vertexNormals[d],H),e=Z.dot(L[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(U.x,U.y,U.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=
+b,c,d,e,g,T){h=a.vertices[b].position;i=a.vertices[c].position;j=a.vertices[d].position;k=f[e];o=f[g];p=f[T];m=i.x-h.x;q=j.x-h.x;n=i.y-h.y;r=j.y-h.y;t=i.z-h.z;u=j.z-h.z;y=o.u-k.u;v=p.u-k.u;A=o.v-k.v;z=p.v-k.v;w=1/(y*z-v*A);s.set((z*m-A*q)*w,(z*n-A*r)*w,(z*t-A*u)*w);E.set((y*q-v*m)*w,(y*r-v*n)*w,(y*u-v*t)*w);F[b].addSelf(s);F[c].addSelf(s);F[d].addSelf(s);G[b].addSelf(E);G[c].addSelf(E);G[d].addSelf(E)}var b,c,d,e,g,f,h,i,j,k,o,p,m,q,n,r,t,u,y,v,A,z,w,I,F=[],G=[],s=new THREE.Vector3,E=new THREE.Vector3,
+T=new THREE.Vector3,Z=new THREE.Vector3,Q=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)F[b]=new THREE.Vector3,G[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],f=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 U=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)Q.copy(g.vertexNormals[d]),e=g[U[d]],
+I=F[e],T.copy(I),T.subSelf(Q.multiplyScalar(Q.dot(I))).normalize(),Z.cross(g.vertexNormals[d],I),e=Z.dot(G[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(T.x,T.y,T.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,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,e=Math.pow(10,4),g,f;g=0;for(f=this.vertices.length;g<f;g++)d=this.vertices[g].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),a[d]===void 0?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];g=0;for(f=this.faces.length;g<f;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=
 c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,g,f,h,i,l,k,o,p;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){e=(this.points.length-1)*a;g=Math.floor(e);f=e-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;l=this.points[c[0]];k=this.points[c[1]];
-o=this.points[c[2]];p=this.points[c[3]];h=f*f;i=f*h;d.x=b(l.x,k.x,o.x,p.x,f,h,i);d.y=b(l.y,k.y,o.y,p.y,f,h,i);d.z=b(l.z,k.z,o.z,p.z,f,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,g=new THREE.Vector3,f=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),f.copy(d),i+=f.distanceTo(g),
+THREE.Spline=function(a){function b(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,g,f,h,i,j,k,o,p;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){e=(this.points.length-1)*a;g=Math.floor(e);f=e-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;j=this.points[c[0]];k=this.points[c[1]];
+o=this.points[c[2]];p=this.points[c[3]];h=f*f;i=f*h;d.x=b(j.x,k.x,o.x,p.x,f,h,i);d.y=b(j.y,k.y,o.y,p.y,f,h,i);d.z=b(j.z,k.z,o.z,p.z,f,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,g=new THREE.Vector3,f=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),f.copy(d),i+=f.distanceTo(g),
 g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,g,f,h=[],i=new THREE.Vector3,k=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];f=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<f-1;c++)d=e+c*(1/f)*(g-e),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
 h}};THREE.Edge=function(a,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,e,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=g!==void 0?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
@@ -148,47 +148,47 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var 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.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,g;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;g=d/2};this.render=function(c,d){var i,l,k,o,p,m,r,n;a=b.projectScene(c,d);i=0;for(l=a.length;i<l;i++)if(p=a[i],p instanceof THREE.RenderableParticle){r=p.x*e+e;n=p.y*g+g;k=0;for(o=p.material.length;k<o;k++)if(m=p.material[k],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=r+"px",m.style.top=n+"px"}}};
-THREE.CanvasRenderer=function(a){function b(a){if(v!=a)n.globalAlpha=v=a}function c(a){if(z!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}z=a}}function d(a){if(u!=a)n.strokeStyle=u=a}function e(a){if(B!=a)n.fillStyle=B=a}var g=this,f,h,i,l=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-o,p,m,r,n=k.getContext("2d"),q=new THREE.Color(0),t=0,v=1,z=0,u=null,B=null,A=null,F=null,H=null,E,L,s,G,U=new THREE.RenderableVertex,Z=new THREE.RenderableVertex,Q,T,$,ia,y,N,I,w,V,R,j,ba,O=new THREE.Color,ga=new THREE.Color,fa=new THREE.Color,W=new THREE.Color,na=new THREE.Color,ha=[],ra=[],oa,pa,sa,ta,Ba,va,ua,Aa,K,ea,S=new THREE.Rectangle,ca=new THREE.Rectangle,J=new THREE.Rectangle,P=!1,aa=new THREE.Color,Y=new THREE.Color,qa=new THREE.Color,X=new THREE.Vector3,ka,da,xa,M,wa,za,a=16;ka=document.createElement("canvas");
-ka.width=ka.height=2;da=ka.getContext("2d");da.fillStyle="rgba(0,0,0,1)";da.fillRect(0,0,2,2);xa=da.getImageData(0,0,2,2);M=xa.data;wa=document.createElement("canvas");wa.width=wa.height=a;za=wa.getContext("2d");za.translate(-a/2,-a/2);za.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;p=b;m=Math.floor(o/2);r=Math.floor(p/2);k.width=o;k.height=p;S.set(-m,-r,m,r);ca.set(-m,-r,m,r);v=1;z=0;H=
-F=A=B=u=null};this.setClearColor=function(a,b){q.copy(a);t=b;ca.set(-m,-r,m,r)};this.setClearColorHex=function(a,b){q.setHex(a);t=b;ca.set(-m,-r,m,r)};this.clear=function(){n.setTransform(1,0,0,-1,m,r);ca.isEmpty()||(ca.minSelf(S),ca.inflate(2),t<1&&n.clearRect(Math.floor(ca.getX()),Math.floor(ca.getY()),Math.floor(ca.getWidth()),Math.floor(ca.getHeight())),t>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+t+")"),n.fillRect(Math.floor(ca.getX()),
-Math.floor(ca.getY()),Math.floor(ca.getWidth()),Math.floor(ca.getHeight()))),ca.empty())};this.render=function(a,k){function p(a){var b,c,d,e;aa.setRGB(0,0,0);Y.setRGB(0,0,0);qa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(aa.r+=e.r,aa.g+=e.g,aa.b+=e.b):d instanceof THREE.DirectionalLight?(Y.r+=e.r,Y.g+=e.g,Y.b+=e.b):d instanceof THREE.PointLight&&(qa.r+=e.r,qa.g+=e.g,qa.b+=e.b)}function o(a,b,c,d){var e,g,f,j,h,i;e=0;for(g=a.length;e<g;e++)f=a[e],j=f.color,
-f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(X.sub(h,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function q(a,g,f){b(f.opacity);c(f.blending);var j,h,i,k,l,ja;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)k=f.map.image,l=k.width>>1,ja=k.height>>
-1,f=g.scale.x*m,i=g.scale.y*r,j=f*l,h=i*ja,J.set(a.x-j,a.y-h,a.x+j,a.y+h),S.intersects(J)&&(n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(f,-i),n.translate(-l,-ja),n.drawImage(k,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=g.scale.x*m,h=g.scale.y*r,J.set(a.x-j,a.y-h,a.x+j,a.y+h),S.intersects(J)&&(d(f.color.getContextStyle()),e(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(j,h),f.program(n),n.restore()))}function t(a,e,
-g,f){b(f.opacity);c(f.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(A!=a)n.lineWidth=A=a;a=f.linecap;if(F!=a)n.lineCap=F=a;a=f.linejoin;if(H!=a)n.lineJoin=H=a;d(f.color.getContextStyle());n.stroke();J.inflate(f.linewidth*2)}}function v(a,d,e,f,j,h,m,n){g.info.render.vertices+=3;g.info.render.faces++;b(n.opacity);c(n.blending);Q=a.positionScreen.x;T=a.positionScreen.y;
-$=d.positionScreen.x;ia=d.positionScreen.y;y=e.positionScreen.x;N=e.positionScreen.y;Ha(Q,T,$,ia,y,N);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(ta=m.uvs[0],Ja(Q,T,$,ia,y,N,ta[f].u,ta[f].v,ta[j].u,ta[j].v,ta[h].u,ta[h].v,n.map));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,X.copy(m.vertexNormalsWorld[f]),Ba=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,va=-(X.x*a.n21+X.y*a.n22+X.z*a.n23)*0.5+0.5,
-X.copy(m.vertexNormalsWorld[j]),ua=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,Aa=-(X.x*a.n21+X.y*a.n22+X.z*a.n23)*0.5+0.5,X.copy(m.vertexNormalsWorld[h]),K=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,ea=-(X.x*a.n21+X.y*a.n22+X.z*a.n23)*0.5+0.5,Ja(Q,T,$,ia,y,N,Ba,va,ua,Aa,K,ea,n.envMap)}else n.wireframe?Ca(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):u(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&(ta=m.uvs[0],
-Ja(Q,T,$,ia,y,N,ta[f].u,ta[f].v,ta[j].u,ta[j].v,ta[h].u,ta[h].v,n.map)),c(THREE.SubtractiveBlending)),P?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(ga.r=fa.r=W.r=aa.r,ga.g=fa.g=W.g=aa.g,ga.b=fa.b=W.b=aa.b,o(i,m.v1.positionWorld,m.vertexNormalsWorld[0],ga),o(i,m.v2.positionWorld,m.vertexNormalsWorld[1],fa),o(i,m.v3.positionWorld,m.vertexNormalsWorld[2],W),ga.r=Math.max(0,Math.min(n.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(n.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(n.color.b*
-ga.b,1)),fa.r=Math.max(0,Math.min(n.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(n.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(n.color.b*fa.b,1)),W.r=Math.max(0,Math.min(n.color.r*W.r,1)),W.g=Math.max(0,Math.min(n.color.g*W.g,1)),W.b=Math.max(0,Math.min(n.color.b*W.b,1)),na.r=(fa.r+W.r)*0.5,na.g=(fa.g+W.g)*0.5,na.b=(fa.b+W.b)*0.5,sa=B(ga,fa,W,na),Fa(Q,T,$,ia,y,N,0,0,1,0,0,1,sa)):(O.r=aa.r,O.g=aa.g,O.b=aa.b,o(i,m.centroidWorld,m.normalWorld,O),O.r=Math.max(0,Math.min(n.color.r*O.r,1)),O.g=Math.max(0,Math.min(n.color.g*
-O.g,1)),O.b=Math.max(0,Math.min(n.color.b*O.b,1)),n.wireframe?Ca(O,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):u(O)):n.wireframe?Ca(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):u(n.color);else if(n instanceof THREE.MeshDepthMaterial)oa=k.near,pa=k.far,ga.r=ga.g=ga.b=1-Ea(a.positionScreen.z,oa,pa),fa.r=fa.g=fa.b=1-Ea(d.positionScreen.z,oa,pa),W.r=W.g=W.b=1-Ea(e.positionScreen.z,oa,pa),na.r=(fa.r+W.r)*0.5,na.g=(fa.g+W.g)*0.5,na.b=(fa.b+W.b)*0.5,sa=B(ga,fa,W,
-na),Fa(Q,T,$,ia,y,N,0,0,1,0,0,1,sa);else if(n instanceof THREE.MeshNormalMaterial)O.r=Ga(m.normalWorld.x),O.g=Ga(m.normalWorld.y),O.b=Ga(m.normalWorld.z),n.wireframe?Ca(O,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):u(O)}function La(a,d,e,f,h,m,n,l,ja){g.info.render.vertices+=4;g.info.render.faces++;b(l.opacity);c(l.blending);if(l.map||l.envMap)v(a,d,f,0,1,3,n,l,ja),v(h,e,m,1,2,3,n,l,ja);else if(Q=a.positionScreen.x,T=a.positionScreen.y,$=d.positionScreen.x,ia=d.positionScreen.y,y=
-e.positionScreen.x,N=e.positionScreen.y,I=f.positionScreen.x,w=f.positionScreen.y,V=h.positionScreen.x,R=h.positionScreen.y,j=m.positionScreen.x,ba=m.positionScreen.y,l instanceof THREE.MeshBasicMaterial)z(Q,T,$,ia,y,N,I,w),l.wireframe?Ca(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):u(l.color);else if(l instanceof THREE.MeshLambertMaterial)P?!l.wireframe&&l.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==4?(ga.r=fa.r=W.r=na.r=aa.r,ga.g=fa.g=W.g=na.g=aa.g,ga.b=fa.b=
-W.b=na.b=aa.b,o(i,n.v1.positionWorld,n.vertexNormalsWorld[0],ga),o(i,n.v2.positionWorld,n.vertexNormalsWorld[1],fa),o(i,n.v4.positionWorld,n.vertexNormalsWorld[3],W),o(i,n.v3.positionWorld,n.vertexNormalsWorld[2],na),ga.r=Math.max(0,Math.min(l.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(l.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(l.color.b*ga.b,1)),fa.r=Math.max(0,Math.min(l.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(l.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(l.color.b*fa.b,1)),W.r=Math.max(0,Math.min(l.color.r*
-W.r,1)),W.g=Math.max(0,Math.min(l.color.g*W.g,1)),W.b=Math.max(0,Math.min(l.color.b*W.b,1)),na.r=Math.max(0,Math.min(l.color.r*na.r,1)),na.g=Math.max(0,Math.min(l.color.g*na.g,1)),na.b=Math.max(0,Math.min(l.color.b*na.b,1)),sa=B(ga,fa,W,na),Ha(Q,T,$,ia,I,w),Fa(Q,T,$,ia,I,w,0,0,1,0,0,1,sa),Ha(V,R,y,N,j,ba),Fa(V,R,y,N,j,ba,1,0,1,1,0,1,sa)):(O.r=aa.r,O.g=aa.g,O.b=aa.b,o(i,n.centroidWorld,n.normalWorld,O),O.r=Math.max(0,Math.min(l.color.r*O.r,1)),O.g=Math.max(0,Math.min(l.color.g*O.g,1)),O.b=Math.max(0,
-Math.min(l.color.b*O.b,1)),z(Q,T,$,ia,y,N,I,w),l.wireframe?Ca(O,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):u(O)):(z(Q,T,$,ia,y,N,I,w),l.wireframe?Ca(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):u(l.color));else if(l instanceof THREE.MeshNormalMaterial)O.r=Ga(n.normalWorld.x),O.g=Ga(n.normalWorld.y),O.b=Ga(n.normalWorld.z),z(Q,T,$,ia,y,N,I,w),l.wireframe?Ca(O,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):u(O);else if(l instanceof THREE.MeshDepthMaterial)oa=
-k.near,pa=k.far,ga.r=ga.g=ga.b=1-Ea(a.positionScreen.z,oa,pa),fa.r=fa.g=fa.b=1-Ea(d.positionScreen.z,oa,pa),W.r=W.g=W.b=1-Ea(f.positionScreen.z,oa,pa),na.r=na.g=na.b=1-Ea(e.positionScreen.z,oa,pa),sa=B(ga,fa,W,na),Ha(Q,T,$,ia,I,w),Fa(Q,T,$,ia,I,w,0,0,1,0,0,1,sa),Ha(V,R,y,N,j,ba),Fa(V,R,y,N,j,ba,1,0,1,1,0,1,sa)}function Ha(a,b,c,d,e,f){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(a,b);n.closePath()}function z(a,b,c,d,e,f,g,j){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,
-f);n.lineTo(g,j);n.lineTo(a,b);n.closePath()}function Ca(a,b,c,e){if(A!=b)n.lineWidth=A=b;if(F!=c)n.lineCap=F=c;if(H!=e)n.lineJoin=H=e;d(a.getContextStyle());n.stroke();J.inflate(b*2)}function u(a){e(a.getContextStyle());n.fill()}function Ja(a,b,c,d,f,g,j,h,i,m,k,l,ja){if(ja.image.width!=0){if(ja.needsUpdate==!0||ha[ja.id]==void 0){var o=ja.wrapS==THREE.RepeatWrapping,p=ja.wrapT==THREE.RepeatWrapping;ha[ja.id]=n.createPattern(ja.image,o&&p?"repeat":o&&!p?"repeat-x":!o&&p?"repeat-y":"no-repeat");ja.needsUpdate=
-!1}e(ha[ja.id]);var o=ja.offset.x/ja.repeat.x,p=ja.offset.y/ja.repeat.y,K=ja.image.width*ja.repeat.x,q=ja.image.height*ja.repeat.y,j=(j+o)*K,h=(h+p)*q,i=(i+o)*K,m=(m+p)*q,k=(k+o)*K,l=(l+p)*q;c-=a;d-=b;f-=a;g-=b;i-=j;m-=h;k-=j;l-=h;o=i*l-k*m;if(o==0){if(ra[ja.id]==void 0)b=document.createElement("canvas"),b.width=ja.image.width,b.height=ja.image.height,a=b.getContext("2d"),a.drawImage(ja.image,0,0),ra[ja.id]=a.getImageData(0,0,ja.image.width,ja.image.height).data,delete b;b=ra[ja.id];j=(Math.floor(j)+
-Math.floor(h)*ja.image.width)*4;O.setRGB(b[j]/255,b[j+1]/255,b[j+2]/255);u(O)}else o=1/o,ja=(l*c-m*f)*o,m=(l*d-m*g)*o,c=(i*f-k*c)*o,d=(i*g-k*d)*o,a=a-ja*j-c*h,j=b-m*j-d*h,n.save(),n.transform(ja,m,c,d,a,j),n.fill(),n.restore()}}function Fa(a,b,c,d,e,f,g,j,h,i,m,k,l){var ja,o;ja=l.width-1;o=l.height-1;g*=ja;j*=o;h*=ja;i*=o;m*=ja;k*=o;c-=a;d-=b;e-=a;f-=b;h-=g;i-=j;m-=g;k-=j;o=1/(h*k-m*i);ja=(k*c-i*e)*o;i=(k*d-i*f)*o;c=(h*e-m*c)*o;d=(h*f-m*d)*o;a=a-ja*g-c*j;b=b-i*g-d*j;n.save();n.transform(ja,i,c,d,
-a,b);n.clip();n.drawImage(l,0,0);n.restore()}function B(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),m=~~(d.r*255),n=~~(d.g*255),d=~~(d.b*255);M[0]=e<0?0:e>255?255:e;M[1]=f<0?0:f>255?255:f;M[2]=a<0?0:a>255?255:a;M[4]=g<0?0:g>255?255:g;M[5]=j<0?0:j>255?255:j;M[6]=b<0?0:b>255?255:b;M[8]=h<0?0:h>255?255:h;M[9]=i<0?0:i>255?255:i;M[10]=c<0?0:c>255?255:c;M[12]=m<0?0:m>255?255:m;M[13]=n<0?0:n>255?255:n;M[14]=d<
-0?0:d>255?255:d;da.putImageData(xa,0,0);za.drawImage(ka,0,0);return wa}function Ea(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ga(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Da(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 Ia,Ka,C,ya;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,r);g.info.render.vertices=0;g.info.render.faces=0;f=l.projectScene(a,k,this.sortElements);h=f.elements;i=f.lights;(P=i.length>0)&&p(i);Ia=0;for(Ka=
-h.length;Ia<Ka;Ia++)if(C=h[Ia],ya=C.material,ya=ya instanceof THREE.MeshFaceMaterial?C.faceMaterial:ya,!(ya==null||ya.opacity==0)){J.empty();if(C instanceof THREE.RenderableParticle)E=C,E.x*=m,E.y*=r,q(E,C,ya,a);else if(C instanceof THREE.RenderableLine)E=C.v1,L=C.v2,E.positionScreen.x*=m,E.positionScreen.y*=r,L.positionScreen.x*=m,L.positionScreen.y*=r,J.addPoint(E.positionScreen.x,E.positionScreen.y),J.addPoint(L.positionScreen.x,L.positionScreen.y),S.intersects(J)&&t(E,L,C,ya,a);else if(C instanceof
-THREE.RenderableFace3)E=C.v1,L=C.v2,s=C.v3,E.positionScreen.x*=m,E.positionScreen.y*=r,L.positionScreen.x*=m,L.positionScreen.y*=r,s.positionScreen.x*=m,s.positionScreen.y*=r,ya.overdraw&&(Da(E.positionScreen,L.positionScreen),Da(L.positionScreen,s.positionScreen),Da(s.positionScreen,E.positionScreen)),J.add3Points(E.positionScreen.x,E.positionScreen.y,L.positionScreen.x,L.positionScreen.y,s.positionScreen.x,s.positionScreen.y),S.intersects(J)&&v(E,L,s,0,1,2,C,ya,a);else if(C instanceof THREE.RenderableFace4)E=
-C.v1,L=C.v2,s=C.v3,G=C.v4,E.positionScreen.x*=m,E.positionScreen.y*=r,L.positionScreen.x*=m,L.positionScreen.y*=r,s.positionScreen.x*=m,s.positionScreen.y*=r,G.positionScreen.x*=m,G.positionScreen.y*=r,U.positionScreen.copy(L.positionScreen),Z.positionScreen.copy(G.positionScreen),ya.overdraw&&(Da(E.positionScreen,L.positionScreen),Da(L.positionScreen,G.positionScreen),Da(G.positionScreen,E.positionScreen),Da(s.positionScreen,U.positionScreen),Da(s.positionScreen,Z.positionScreen)),J.addPoint(E.positionScreen.x,
-E.positionScreen.y),J.addPoint(L.positionScreen.x,L.positionScreen.y),J.addPoint(s.positionScreen.x,s.positionScreen.y),J.addPoint(G.positionScreen.x,G.positionScreen.y),S.intersects(J)&&La(E,L,s,G,U,Z,C,ya,a);ca.addRectangle(J)}n.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,j;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),j=c.dot(i),j<=0||(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),j=c.dot(E.sub(i,b).normalize()),j<=0||(j*=g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,1),j!=0&&(j*=g.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function b(a){L[a]==null&&(L[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),Q==0&&L[a].setAttribute("shape-rendering","crispEdges"));return L[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,e,g,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,o,p,m,r,n,q,t=new THREE.Rectangle,v=new THREE.Rectangle,z=!1,u=new THREE.Color,B=new THREE.Color,A=new THREE.Color,F=new THREE.Color,H,E=new THREE.Vector3,L=[],s=[],G,U,Z,Q=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
-faces:0}};this.setQuality=function(a){switch(a){case "high":Q=1;break;case "low":Q=0}};this.setSize=function(a,b){l=a;k=b;o=l/2;p=k/2;i.setAttribute("viewBox",-o+" "+-p+" "+l+" "+k);i.setAttribute("width",l);i.setAttribute("height",k);t.set(-o,-p,o,p)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var L,E,N,I;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,l,this.sortElements);g=e.elements;
-f=e.lights;Z=U=0;if(z=f.length>0){B.setRGB(0,0,0);A.setRGB(0,0,0);F.setRGB(0,0,0);L=0;for(E=f.length;L<E;L++)I=f[L],N=I.color,I instanceof THREE.AmbientLight?(B.r+=N.r,B.g+=N.g,B.b+=N.b):I instanceof THREE.DirectionalLight?(A.r+=N.r,A.g+=N.g,A.b+=N.b):I instanceof THREE.PointLight&&(F.r+=N.r,F.g+=N.g,F.b+=N.b)}L=0;for(E=g.length;L<E;L++)if(N=g[L],I=N.material,I=I instanceof THREE.MeshFaceMaterial?N.faceMaterial:I,!(I==null||I.opacity==0))if(v.empty(),N instanceof THREE.RenderableParticle)m=N,m.x*=
-o,m.y*=-p;else if(N instanceof THREE.RenderableLine){if(m=N.v1,r=N.v2,m.positionScreen.x*=o,m.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,v.addPoint(m.positionScreen.x,m.positionScreen.y),v.addPoint(r.positionScreen.x,r.positionScreen.y),t.intersects(v)){N=m;var w=r,V=Z++;s[V]==null&&(s[V]=document.createElementNS("http://www.w3.org/2000/svg","line"),Q==0&&s[V].setAttribute("shape-rendering","crispEdges"));G=s[V];G.setAttribute("x1",N.positionScreen.x);G.setAttribute("y1",N.positionScreen.y);
-G.setAttribute("x2",w.positionScreen.x);G.setAttribute("y2",w.positionScreen.y);I instanceof THREE.LineBasicMaterial&&(G.setAttribute("style","fill: none; stroke: "+I.color.getContextStyle()+"; stroke-width: "+I.linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.linecap+"; stroke-linejoin: "+I.linejoin),i.appendChild(G))}}else if(N instanceof THREE.RenderableFace3){if(m=N.v1,r=N.v2,n=N.v3,m.positionScreen.x*=o,m.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,n.positionScreen.x*=
-o,n.positionScreen.y*=-p,v.addPoint(m.positionScreen.x,m.positionScreen.y),v.addPoint(r.positionScreen.x,r.positionScreen.y),v.addPoint(n.positionScreen.x,n.positionScreen.y),t.intersects(v)){var w=m,V=r,R=n;d.info.render.vertices+=3;d.info.render.faces++;G=b(U++);G.setAttribute("d","M "+w.positionScreen.x+" "+w.positionScreen.y+" L "+V.positionScreen.x+" "+V.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+"z");I instanceof THREE.MeshBasicMaterial?u.copy(I.color):I instanceof THREE.MeshLambertMaterial?
-z?(u.r=B.r,u.g=B.g,u.b=B.b,a(f,N.centroidWorld,N.normalWorld,u),u.r=Math.max(0,Math.min(I.color.r*u.r,1)),u.g=Math.max(0,Math.min(I.color.g*u.g,1)),u.b=Math.max(0,Math.min(I.color.b*u.b,1))):u.copy(I.color):I instanceof THREE.MeshDepthMaterial?(H=1-I.__2near/(I.__farPlusNear-N.z*I.__farMinusNear),u.setRGB(H,H,H)):I instanceof THREE.MeshNormalMaterial&&u.setRGB(c(N.normalWorld.x),c(N.normalWorld.y),c(N.normalWorld.z));I.wireframe?G.setAttribute("style","fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+
-I.wireframeLinewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframeLinecap+"; stroke-linejoin: "+I.wireframeLinejoin):G.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+I.opacity);i.appendChild(G)}}else if(N instanceof THREE.RenderableFace4&&(m=N.v1,r=N.v2,n=N.v3,q=N.v4,m.positionScreen.x*=o,m.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,n.positionScreen.x*=o,n.positionScreen.y*=-p,q.positionScreen.x*=o,q.positionScreen.y*=-p,v.addPoint(m.positionScreen.x,
-m.positionScreen.y),v.addPoint(r.positionScreen.x,r.positionScreen.y),v.addPoint(n.positionScreen.x,n.positionScreen.y),v.addPoint(q.positionScreen.x,q.positionScreen.y),t.intersects(v))){var w=m,V=r,R=n,j=q;d.info.render.vertices+=4;d.info.render.faces++;G=b(U++);G.setAttribute("d","M "+w.positionScreen.x+" "+w.positionScreen.y+" L "+V.positionScreen.x+" "+V.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");I instanceof THREE.MeshBasicMaterial?
-u.copy(I.color):I instanceof THREE.MeshLambertMaterial?z?(u.r=B.r,u.g=B.g,u.b=B.b,a(f,N.centroidWorld,N.normalWorld,u),u.r=Math.max(0,Math.min(I.color.r*u.r,1)),u.g=Math.max(0,Math.min(I.color.g*u.g,1)),u.b=Math.max(0,Math.min(I.color.b*u.b,1))):u.copy(I.color):I instanceof THREE.MeshDepthMaterial?(H=1-I.__2near/(I.__farPlusNear-N.z*I.__farMinusNear),u.setRGB(H,H,H)):I instanceof THREE.MeshNormalMaterial&&u.setRGB(c(N.normalWorld.x),c(N.normalWorld.y),c(N.normalWorld.z));I.wireframe?G.setAttribute("style",
-"fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+I.wireframeLinewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframeLinecap+"; stroke-linejoin: "+I.wireframeLinejoin):G.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+I.opacity);i.appendChild(G)}}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,g;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;g=d/2};this.render=function(c,d){var i,j,k,o,p,m,q,n;a=b.projectScene(c,d);i=0;for(j=a.length;i<j;i++)if(p=a[i],p instanceof THREE.RenderableParticle){q=p.x*e+e;n=p.y*g+g;k=0;for(o=p.material.length;k<o;k++)if(m=p.material[k],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=q+"px",m.style.top=n+"px"}}};
+THREE.CanvasRenderer=function(a){function b(a){if(u!=a)n.globalAlpha=u=a}function c(a){if(y!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}y=a}}function d(a){if(v!=a)n.strokeStyle=v=a}function e(a){if(A!=a)n.fillStyle=A=a}var g=this,f,h,i,j=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+o,p,m,q,n=k.getContext("2d"),r=new THREE.Color(0),t=0,u=1,y=0,v=null,A=null,z=null,w=null,I=null,F,G,s,E,T=new THREE.RenderableVertex,Z=new THREE.RenderableVertex,Q,U,$,ja,K,L,H,O,V,R,l,ca,N=new THREE.Color,fa=new THREE.Color,W=new THREE.Color,ba=new THREE.Color,na=new THREE.Color,ia=[],qa=[],ra,oa,ta,pa,Ba,wa,va,xa,M,ea,S=new THREE.Rectangle,ha=new THREE.Rectangle,J=new THREE.Rectangle,P=!1,aa=new THREE.Color,Y=new THREE.Color,sa=new THREE.Color,X=new THREE.Vector3,ka,da,za,ya,ga,Ia,a=16;ka=document.createElement("canvas");
+ka.width=ka.height=2;da=ka.getContext("2d");da.fillStyle="rgba(0,0,0,1)";da.fillRect(0,0,2,2);za=da.getImageData(0,0,2,2);ya=za.data;ga=document.createElement("canvas");ga.width=ga.height=a;Ia=ga.getContext("2d");Ia.translate(-a/2,-a/2);Ia.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;p=b;m=Math.floor(o/2);q=Math.floor(p/2);k.width=o;k.height=p;S.set(-m,-q,m,q);ha.set(-m,-q,m,q);u=1;y=0;
+I=w=z=A=v=null};this.setClearColor=function(a,b){r.copy(a);t=b;ha.set(-m,-q,m,q)};this.setClearColorHex=function(a,b){r.setHex(a);t=b;ha.set(-m,-q,m,q)};this.clear=function(){n.setTransform(1,0,0,-1,m,q);ha.isEmpty()||(ha.minSelf(S),ha.inflate(2),t<1&&n.clearRect(Math.floor(ha.getX()),Math.floor(ha.getY()),Math.floor(ha.getWidth()),Math.floor(ha.getHeight())),t>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*255)+","+t+")"),n.fillRect(Math.floor(ha.getX()),
+Math.floor(ha.getY()),Math.floor(ha.getWidth()),Math.floor(ha.getHeight()))),ha.empty())};this.render=function(a,k){function o(a){var b,c,d,e;aa.setRGB(0,0,0);Y.setRGB(0,0,0);sa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(aa.r+=e.r,aa.g+=e.g,aa.b+=e.b):d instanceof THREE.DirectionalLight?(Y.r+=e.r,Y.g+=e.g,Y.b+=e.b):d instanceof THREE.PointLight&&(sa.r+=e.r,sa.g+=e.g,sa.b+=e.b)}function p(a,b,c,d){var e,g,f,h,i,l;e=0;for(g=a.length;e<g;e++)f=a[e],h=f.color,
+f instanceof THREE.DirectionalLight?(i=f.matrixWorld.getPosition(),l=c.dot(i),l<=0||(l*=f.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)):f instanceof THREE.PointLight&&(i=f.matrixWorld.getPosition(),l=c.dot(X.sub(i,b).normalize()),l<=0||(l*=f.distance==0?1:1-Math.min(b.distanceTo(i)/f.distance,1),l!=0&&(l*=f.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)))}function r(a,g,f){b(f.opacity);c(f.blending);var h,l,i,k,j,ga;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)k=f.map.image,j=k.width>>1,ga=k.height>>
+1,f=g.scale.x*m,i=g.scale.y*q,h=f*j,l=i*ga,J.set(a.x-h,a.y-l,a.x+h,a.y+l),S.intersects(J)&&(n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(f,-i),n.translate(-j,-ga),n.drawImage(k,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(h=g.scale.x*m,l=g.scale.y*q,J.set(a.x-h,a.y-l,a.x+h,a.y+l),S.intersects(J)&&(d(f.color.getContextStyle()),e(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(h,l),f.program(n),n.restore()))}function t(a,e,
+g,f){b(f.opacity);c(f.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(z!=a)n.lineWidth=z=a;a=f.linecap;if(w!=a)n.lineCap=w=a;a=f.linejoin;if(I!=a)n.lineJoin=I=a;d(f.color.getContextStyle());n.stroke();J.inflate(f.linewidth*2)}}function u(a,d,e,f,h,l,m,n){g.info.render.vertices+=3;g.info.render.faces++;b(n.opacity);c(n.blending);Q=a.positionScreen.x;U=a.positionScreen.y;
+$=d.positionScreen.x;ja=d.positionScreen.y;K=e.positionScreen.x;L=e.positionScreen.y;Ha(Q,U,$,ja,K,L);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(pa=m.uvs[0],A(Q,U,$,ja,K,L,pa[f].u,pa[f].v,pa[h].u,pa[h].v,pa[l].u,pa[l].v,n.map));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,X.copy(m.vertexNormalsWorld[f]),Ba=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,wa=-(X.x*a.n21+X.y*a.n22+X.z*a.n23)*0.5+0.5,
+X.copy(m.vertexNormalsWorld[h]),va=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,xa=-(X.x*a.n21+X.y*a.n22+X.z*a.n23)*0.5+0.5,X.copy(m.vertexNormalsWorld[l]),M=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,ea=-(X.x*a.n21+X.y*a.n22+X.z*a.n23)*0.5+0.5,A(Q,U,$,ja,K,L,Ba,wa,va,xa,M,ea,n.envMap)}else n.wireframe?Ca(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&(pa=m.uvs[0],
+A(Q,U,$,ja,K,L,pa[f].u,pa[f].v,pa[h].u,pa[h].v,pa[l].u,pa[l].v,n.map)),c(THREE.SubtractiveBlending)),P?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(fa.r=W.r=ba.r=aa.r,fa.g=W.g=ba.g=aa.g,fa.b=W.b=ba.b=aa.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],fa),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],W),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ba),fa.r=Math.max(0,Math.min(n.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(n.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(n.color.b*
+fa.b,1)),W.r=Math.max(0,Math.min(n.color.r*W.r,1)),W.g=Math.max(0,Math.min(n.color.g*W.g,1)),W.b=Math.max(0,Math.min(n.color.b*W.b,1)),ba.r=Math.max(0,Math.min(n.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(n.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(n.color.b*ba.b,1)),na.r=(W.r+ba.r)*0.5,na.g=(W.g+ba.g)*0.5,na.b=(W.b+ba.b)*0.5,ta=Ja(fa,W,ba,na),Fa(Q,U,$,ja,K,L,0,0,1,0,0,1,ta)):(N.r=aa.r,N.g=aa.g,N.b=aa.b,p(i,m.centroidWorld,m.normalWorld,N),N.r=Math.max(0,Math.min(n.color.r*N.r,1)),N.g=Math.max(0,Math.min(n.color.g*
+N.g,1)),N.b=Math.max(0,Math.min(n.color.b*N.b,1)),n.wireframe?Ca(N,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(N)):n.wireframe?Ca(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color);else if(n instanceof THREE.MeshDepthMaterial)ra=k.near,oa=k.far,fa.r=fa.g=fa.b=1-Ea(a.positionScreen.z,ra,oa),W.r=W.g=W.b=1-Ea(d.positionScreen.z,ra,oa),ba.r=ba.g=ba.b=1-Ea(e.positionScreen.z,ra,oa),na.r=(W.r+ba.r)*0.5,na.g=(W.g+ba.g)*0.5,na.b=(W.b+ba.b)*0.5,ta=Ja(fa,W,
+ba,na),Fa(Q,U,$,ja,K,L,0,0,1,0,0,1,ta);else if(n instanceof THREE.MeshNormalMaterial)N.r=Ga(m.normalWorld.x),N.g=Ga(m.normalWorld.y),N.b=Ga(m.normalWorld.z),n.wireframe?Ca(N,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(N)}function y(a,d,e,f,h,m,n,j,ga){g.info.render.vertices+=4;g.info.render.faces++;b(j.opacity);c(j.blending);if(j.map||j.envMap)u(a,d,f,0,1,3,n,j,ga),u(h,e,m,1,2,3,n,j,ga);else if(Q=a.positionScreen.x,U=a.positionScreen.y,$=d.positionScreen.x,ja=d.positionScreen.y,
+K=e.positionScreen.x,L=e.positionScreen.y,H=f.positionScreen.x,O=f.positionScreen.y,V=h.positionScreen.x,R=h.positionScreen.y,l=m.positionScreen.x,ca=m.positionScreen.y,j instanceof THREE.MeshBasicMaterial)v(Q,U,$,ja,K,L,H,O),j.wireframe?Ca(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Aa(j.color);else if(j instanceof THREE.MeshLambertMaterial)P?!j.wireframe&&j.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==4?(fa.r=W.r=ba.r=na.r=aa.r,fa.g=W.g=ba.g=na.g=aa.g,fa.b=
+W.b=ba.b=na.b=aa.b,p(i,n.v1.positionWorld,n.vertexNormalsWorld[0],fa),p(i,n.v2.positionWorld,n.vertexNormalsWorld[1],W),p(i,n.v4.positionWorld,n.vertexNormalsWorld[3],ba),p(i,n.v3.positionWorld,n.vertexNormalsWorld[2],na),fa.r=Math.max(0,Math.min(j.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(j.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(j.color.b*fa.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)),ba.r=Math.max(0,Math.min(j.color.r*
+ba.r,1)),ba.g=Math.max(0,Math.min(j.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(j.color.b*ba.b,1)),na.r=Math.max(0,Math.min(j.color.r*na.r,1)),na.g=Math.max(0,Math.min(j.color.g*na.g,1)),na.b=Math.max(0,Math.min(j.color.b*na.b,1)),ta=Ja(fa,W,ba,na),Ha(Q,U,$,ja,H,O),Fa(Q,U,$,ja,H,O,0,0,1,0,0,1,ta),Ha(V,R,K,L,l,ca),Fa(V,R,K,L,l,ca,1,0,1,1,0,1,ta)):(N.r=aa.r,N.g=aa.g,N.b=aa.b,p(i,n.centroidWorld,n.normalWorld,N),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)),v(Q,U,$,ja,K,L,H,O),j.wireframe?Ca(N,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Aa(N)):(v(Q,U,$,ja,K,L,H,O),j.wireframe?Ca(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Aa(j.color));else if(j instanceof THREE.MeshNormalMaterial)N.r=Ga(n.normalWorld.x),N.g=Ga(n.normalWorld.y),N.b=Ga(n.normalWorld.z),v(Q,U,$,ja,K,L,H,O),j.wireframe?Ca(N,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Aa(N);else if(j instanceof THREE.MeshDepthMaterial)ra=
+k.near,oa=k.far,fa.r=fa.g=fa.b=1-Ea(a.positionScreen.z,ra,oa),W.r=W.g=W.b=1-Ea(d.positionScreen.z,ra,oa),ba.r=ba.g=ba.b=1-Ea(f.positionScreen.z,ra,oa),na.r=na.g=na.b=1-Ea(e.positionScreen.z,ra,oa),ta=Ja(fa,W,ba,na),Ha(Q,U,$,ja,H,O),Fa(Q,U,$,ja,H,O,0,0,1,0,0,1,ta),Ha(V,R,K,L,l,ca),Fa(V,R,K,L,l,ca,1,0,1,1,0,1,ta)}function Ha(a,b,c,d,e,g){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(a,b);n.closePath()}function v(a,b,c,d,e,g,f,h){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,
+g);n.lineTo(f,h);n.lineTo(a,b);n.closePath()}function Ca(a,b,c,e){if(z!=b)n.lineWidth=z=b;if(w!=c)n.lineCap=w=c;if(I!=e)n.lineJoin=I=e;d(a.getContextStyle());n.stroke();J.inflate(b*2)}function Aa(a){e(a.getContextStyle());n.fill()}function A(a,b,c,d,g,f,h,l,i,k,m,j,ga){if(ga.image.width!=0){if(ga.needsUpdate==!0||ia[ga.id]==void 0){var o=ga.wrapS==THREE.RepeatWrapping,p=ga.wrapT==THREE.RepeatWrapping;ia[ga.id]=n.createPattern(ga.image,o&&p?"repeat":o&&!p?"repeat-x":!o&&p?"repeat-y":"no-repeat");ga.needsUpdate=
+!1}e(ia[ga.id]);var o=ga.offset.x/ga.repeat.x,p=ga.offset.y/ga.repeat.y,M=ga.image.width*ga.repeat.x,r=ga.image.height*ga.repeat.y,h=(h+o)*M,l=(l+p)*r,i=(i+o)*M,k=(k+p)*r,m=(m+o)*M,j=(j+p)*r;c-=a;d-=b;g-=a;f-=b;i-=h;k-=l;m-=h;j-=l;o=i*j-m*k;if(o==0){if(qa[ga.id]==void 0)b=document.createElement("canvas"),b.width=ga.image.width,b.height=ga.image.height,a=b.getContext("2d"),a.drawImage(ga.image,0,0),qa[ga.id]=a.getImageData(0,0,ga.image.width,ga.image.height).data,delete b;b=qa[ga.id];h=(Math.floor(h)+
+Math.floor(l)*ga.image.width)*4;N.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Aa(N)}else o=1/o,ga=(j*c-k*g)*o,k=(j*d-k*f)*o,c=(i*g-m*c)*o,d=(i*f-m*d)*o,a=a-ga*h-c*l,h=b-k*h-d*l,n.save(),n.transform(ga,k,c,d,a,h),n.fill(),n.restore()}}function Fa(a,b,c,d,e,g,f,h,l,i,k,m,j){var ga,o;ga=j.width-1;o=j.height-1;f*=ga;h*=o;l*=ga;i*=o;k*=ga;m*=o;c-=a;d-=b;e-=a;g-=b;l-=f;i-=h;k-=f;m-=h;o=1/(l*m-k*i);ga=(m*c-i*e)*o;i=(m*d-i*g)*o;c=(l*e-k*c)*o;d=(l*g-k*d)*o;a=a-ga*f-c*h;b=b-i*f-d*h;n.save();n.transform(ga,i,c,d,
+a,b);n.clip();n.drawImage(j,0,0);n.restore()}function Ja(a,b,c,d){var e=~~(a.r*255),g=~~(a.g*255),a=~~(a.b*255),f=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),l=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),m=~~(d.g*255),d=~~(d.b*255);ya[0]=e<0?0:e>255?255:e;ya[1]=g<0?0:g>255?255:g;ya[2]=a<0?0:a>255?255:a;ya[4]=f<0?0:f>255?255:f;ya[5]=h<0?0:h>255?255:h;ya[6]=b<0?0:b>255?255:b;ya[8]=l<0?0:l>255?255:l;ya[9]=i<0?0:i>255?255:i;ya[10]=c<0?0:c>255?255:c;ya[12]=k<0?0:k>255?255:k;ya[13]=m<0?0:m>255?255:
+m;ya[14]=d<0?0:d>255?255:d;da.putImageData(za,0,0);Ia.drawImage(ka,0,0);return ga}function Ea(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ga(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Da(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 C,Ka,ua,D;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,q);g.info.render.vertices=0;g.info.render.faces=0;f=j.projectScene(a,k,this.sortElements);h=f.elements;i=f.lights;(P=i.length>0)&&o(i);C=
+0;for(Ka=h.length;C<Ka;C++)if(ua=h[C],D=ua.material,D=D instanceof THREE.MeshFaceMaterial?ua.faceMaterial:D,!(D==null||D.opacity==0)){J.empty();if(ua instanceof THREE.RenderableParticle)F=ua,F.x*=m,F.y*=q,r(F,ua,D,a);else if(ua instanceof THREE.RenderableLine)F=ua.v1,G=ua.v2,F.positionScreen.x*=m,F.positionScreen.y*=q,G.positionScreen.x*=m,G.positionScreen.y*=q,J.addPoint(F.positionScreen.x,F.positionScreen.y),J.addPoint(G.positionScreen.x,G.positionScreen.y),S.intersects(J)&&t(F,G,ua,D,a);else if(ua instanceof
+THREE.RenderableFace3)F=ua.v1,G=ua.v2,s=ua.v3,F.positionScreen.x*=m,F.positionScreen.y*=q,G.positionScreen.x*=m,G.positionScreen.y*=q,s.positionScreen.x*=m,s.positionScreen.y*=q,D.overdraw&&(Da(F.positionScreen,G.positionScreen),Da(G.positionScreen,s.positionScreen),Da(s.positionScreen,F.positionScreen)),J.add3Points(F.positionScreen.x,F.positionScreen.y,G.positionScreen.x,G.positionScreen.y,s.positionScreen.x,s.positionScreen.y),S.intersects(J)&&u(F,G,s,0,1,2,ua,D,a);else if(ua instanceof THREE.RenderableFace4)F=
+ua.v1,G=ua.v2,s=ua.v3,E=ua.v4,F.positionScreen.x*=m,F.positionScreen.y*=q,G.positionScreen.x*=m,G.positionScreen.y*=q,s.positionScreen.x*=m,s.positionScreen.y*=q,E.positionScreen.x*=m,E.positionScreen.y*=q,T.positionScreen.copy(G.positionScreen),Z.positionScreen.copy(E.positionScreen),D.overdraw&&(Da(F.positionScreen,G.positionScreen),Da(G.positionScreen,E.positionScreen),Da(E.positionScreen,F.positionScreen),Da(s.positionScreen,T.positionScreen),Da(s.positionScreen,Z.positionScreen)),J.addPoint(F.positionScreen.x,
+F.positionScreen.y),J.addPoint(G.positionScreen.x,G.positionScreen.y),J.addPoint(s.positionScreen.x,s.positionScreen.y),J.addPoint(E.positionScreen.x,E.positionScreen.y),S.intersects(J)&&y(F,G,s,E,T,Z,ua,D,a);ha.addRectangle(J)}n.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,g,f,h,i,l;e=0;for(g=a.length;e<g;e++)f=a[e],h=f.color,f instanceof THREE.DirectionalLight?(i=f.matrixWorld.getPosition(),l=c.dot(i),l<=0||(l*=f.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)):f instanceof THREE.PointLight&&(i=f.matrixWorld.getPosition(),l=c.dot(F.sub(i,b).normalize()),l<=0||(l*=f.distance==0?1:1-Math.min(b.distanceTo(i)/f.distance,1),l!=0&&(l*=f.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)))}function b(a){G[a]==null&&(G[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),Q==0&&G[a].setAttribute("shape-rendering","crispEdges"));return G[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,e,g,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,k,o,p,m,q,n,r,t=new THREE.Rectangle,u=new THREE.Rectangle,y=!1,v=new THREE.Color,A=new THREE.Color,z=new THREE.Color,w=new THREE.Color,I,F=new THREE.Vector3,G=[],s=[],E,T,Z,Q=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
+faces:0}};this.setQuality=function(a){switch(a){case "high":Q=1;break;case "low":Q=0}};this.setSize=function(a,b){j=a;k=b;o=j/2;p=k/2;i.setAttribute("viewBox",-o+" "+-p+" "+j+" "+k);i.setAttribute("width",j);i.setAttribute("height",k);t.set(-o,-p,o,p)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,j){var G,F,L,H;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,j,this.sortElements);g=e.elements;
+f=e.lights;Z=T=0;if(y=f.length>0){A.setRGB(0,0,0);z.setRGB(0,0,0);w.setRGB(0,0,0);G=0;for(F=f.length;G<F;G++)H=f[G],L=H.color,H instanceof THREE.AmbientLight?(A.r+=L.r,A.g+=L.g,A.b+=L.b):H instanceof THREE.DirectionalLight?(z.r+=L.r,z.g+=L.g,z.b+=L.b):H instanceof THREE.PointLight&&(w.r+=L.r,w.g+=L.g,w.b+=L.b)}G=0;for(F=g.length;G<F;G++)if(L=g[G],H=L.material,H=H instanceof THREE.MeshFaceMaterial?L.faceMaterial:H,!(H==null||H.opacity==0))if(u.empty(),L instanceof THREE.RenderableParticle)m=L,m.x*=
+o,m.y*=-p;else if(L instanceof THREE.RenderableLine){if(m=L.v1,q=L.v2,m.positionScreen.x*=o,m.positionScreen.y*=-p,q.positionScreen.x*=o,q.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),t.intersects(u)){L=m;var O=q,V=Z++;s[V]==null&&(s[V]=document.createElementNS("http://www.w3.org/2000/svg","line"),Q==0&&s[V].setAttribute("shape-rendering","crispEdges"));E=s[V];E.setAttribute("x1",L.positionScreen.x);E.setAttribute("y1",L.positionScreen.y);
+E.setAttribute("x2",O.positionScreen.x);E.setAttribute("y2",O.positionScreen.y);H instanceof THREE.LineBasicMaterial&&(E.setAttribute("style","fill: none; stroke: "+H.color.getContextStyle()+"; stroke-width: "+H.linewidth+"; stroke-opacity: "+H.opacity+"; stroke-linecap: "+H.linecap+"; stroke-linejoin: "+H.linejoin),i.appendChild(E))}}else if(L instanceof THREE.RenderableFace3){if(m=L.v1,q=L.v2,n=L.v3,m.positionScreen.x*=o,m.positionScreen.y*=-p,q.positionScreen.x*=o,q.positionScreen.y*=-p,n.positionScreen.x*=
+o,n.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),t.intersects(u)){var O=m,V=q,R=n;d.info.render.vertices+=3;d.info.render.faces++;E=b(T++);E.setAttribute("d","M "+O.positionScreen.x+" "+O.positionScreen.y+" L "+V.positionScreen.x+" "+V.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+"z");H instanceof THREE.MeshBasicMaterial?v.copy(H.color):H instanceof THREE.MeshLambertMaterial?
+y?(v.r=A.r,v.g=A.g,v.b=A.b,a(f,L.centroidWorld,L.normalWorld,v),v.r=Math.max(0,Math.min(H.color.r*v.r,1)),v.g=Math.max(0,Math.min(H.color.g*v.g,1)),v.b=Math.max(0,Math.min(H.color.b*v.b,1))):v.copy(H.color):H instanceof THREE.MeshDepthMaterial?(I=1-H.__2near/(H.__farPlusNear-L.z*H.__farMinusNear),v.setRGB(I,I,I)):H instanceof THREE.MeshNormalMaterial&&v.setRGB(c(L.normalWorld.x),c(L.normalWorld.y),c(L.normalWorld.z));H.wireframe?E.setAttribute("style","fill: none; stroke: "+v.getContextStyle()+"; stroke-width: "+
+H.wireframeLinewidth+"; stroke-opacity: "+H.opacity+"; stroke-linecap: "+H.wireframeLinecap+"; stroke-linejoin: "+H.wireframeLinejoin):E.setAttribute("style","fill: "+v.getContextStyle()+"; fill-opacity: "+H.opacity);i.appendChild(E)}}else if(L instanceof THREE.RenderableFace4&&(m=L.v1,q=L.v2,n=L.v3,r=L.v4,m.positionScreen.x*=o,m.positionScreen.y*=-p,q.positionScreen.x*=o,q.positionScreen.y*=-p,n.positionScreen.x*=o,n.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,
+m.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),u.addPoint(r.positionScreen.x,r.positionScreen.y),t.intersects(u))){var O=m,V=q,R=n,l=r;d.info.render.vertices+=4;d.info.render.faces++;E=b(T++);E.setAttribute("d","M "+O.positionScreen.x+" "+O.positionScreen.y+" L "+V.positionScreen.x+" "+V.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+" L "+l.positionScreen.x+","+l.positionScreen.y+"z");H instanceof THREE.MeshBasicMaterial?
+v.copy(H.color):H instanceof THREE.MeshLambertMaterial?y?(v.r=A.r,v.g=A.g,v.b=A.b,a(f,L.centroidWorld,L.normalWorld,v),v.r=Math.max(0,Math.min(H.color.r*v.r,1)),v.g=Math.max(0,Math.min(H.color.g*v.g,1)),v.b=Math.max(0,Math.min(H.color.b*v.b,1))):v.copy(H.color):H instanceof THREE.MeshDepthMaterial?(I=1-H.__2near/(H.__farPlusNear-L.z*H.__farMinusNear),v.setRGB(I,I,I)):H instanceof THREE.MeshNormalMaterial&&v.setRGB(c(L.normalWorld.x),c(L.normalWorld.y),c(L.normalWorld.z));H.wireframe?E.setAttribute("style",
+"fill: none; stroke: "+v.getContextStyle()+"; stroke-width: "+H.wireframeLinewidth+"; stroke-opacity: "+H.opacity+"; stroke-linecap: "+H.wireframeLinecap+"; stroke-linejoin: "+H.wireframeLinejoin):E.setAttribute("style","fill: "+v.getContextStyle()+"; fill-opacity: "+H.opacity);i.appendChild(E)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
@@ -206,9 +206,8 @@ THREE.UniformsUtils={merge:function(a){var b,c,d,e={};for(b=0;b<a.length;b++)for
 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}}};
-THREE.ShaderLib={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\n}"},
-depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}"},normal:{uniforms:{opacity:{type:"f",value:1}},
-vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}",fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}"},basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.map_pars_vertex,
+THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}"},normal:{uniforms:{opacity:{type:"f",
+value:1}},vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}",fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}"},basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.map_pars_vertex,
 THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,
 THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(328965)}}]),vertexShader:["varying vec3 vLightWeighting;",THREE.ShaderChunk.map_pars_vertex,
@@ -222,127 +221,119 @@ 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,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var g=d.attributes[e];if(!g.__webglInitialized||g.createUniqueBuffers){g.__webglInitialized=!0;var f=1;g.type==="v2"?f=2:g.type==="v3"?f=3:g.type==="v4"?f=4:g.type==="c"&&(f=3);g.size=f;g.array=new Float32Array(c*f);g.buffer=j.createBuffer();g.buffer.belongsToAttribute=e;g.needsUpdate=!0}a.__webglCustomAttributesList.push(g)}}}
+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 e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=l.createBuffer();f.buffer.belongsToAttribute=e;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 e(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 f(a,b,c){var d,e,g,f,h=a.vertices;f=h.length;var i=a.colors,m=i.length,n=a.__vertexArray,k=a.__colorArray,l=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,K=a.__webglCustomAttributesList;if(c.sortParticles){J.multiplySelf(c.matrixWorld);for(d=0;d<f;d++)e=h[d].position,Y.copy(e),J.multiplyVector3(Y),l[d]=[Y.z,d];l.sort(function(a,b){return b[0]-a[0]});for(d=0;d<f;d++)e=h[l[d][1]].position,g=d*3,n[g]=e.x,n[g+1]=e.y,n[g+2]=e.z;for(d=0;d<m;d++)g=d*3,e=i[l[d][1]],k[g]=e.r,k[g+1]=
-e.g,k[g+2]=e.b;if(K){i=0;for(m=K.length;i<m;i++)if(h=K[i],h.boundTo===void 0||h.boundTo==="vertices")if(g=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)f=l[d][1],h.array[d]=h.value[f];else if(h.size===2)for(d=0;d<e;d++)f=l[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=l[d][1],f=h.value[f],h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=l[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=
-3;else if(h.size===4)for(d=0;d<e;d++)f=l[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,g+=4}}else{if(o)for(d=0;d<f;d++)e=h[d].position,g=d*3,n[g]=e.x,n[g+1]=e.y,n[g+2]=e.z;if(p)for(d=0;d<m;d++)e=i[d],g=d*3,k[g]=e.r,k[g+1]=e.g,k[g+2]=e.b;if(K){i=0;for(m=K.length;i<m;i++)if(h=K[i],h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices"))if(e=h.value.length,g=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)f=h.value[d],h.array[g]=
-f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,g+=4}}if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,n,b);if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,
-a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(K){i=0;for(m=K.length;i<m;i++)if(h=K[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),
-j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,g,f,h,i,m,n,k,l,o=a.count*3;for(l=0;l<o;l+=9)c=a.normalArray,d=c[l],e=c[l+1],g=c[l+2],f=c[l+3],i=c[l+4],n=c[l+5],h=c[l+6],m=c[l+7],k=c[l+8],d=(d+f+h)/3,e=(e+i+m)/3,g=(g+n+k)/3,c[l]=d,c[l+1]=e,c[l+2]=g,c[l+3]=d,c[l+4]=e,c[l+5]=g,c[l+6]=d,c[l+7]=e,c[l+8]=g}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);
-j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function i(a,b,c,d,e,g){if(d.opacity!==0){var f,h,c=u(a,b,c,d,g),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==W&&(W=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;g.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[g.morphTargetBase]),
-j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){f=0;var i=g.morphTargetForcedOrder;for(h=g.morphTargetInfluences;f<d.numSupportedMorphTargets&&f<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[f]=h[i[f]],f++}else{var i=[],m=-1,
-l=0;h=g.morphTargetInfluences;var n,k=h.length;f=0;for(g.morphTargetBase!==-1&&(i[g.morphTargetBase]=!0);f<d.numSupportedMorphTargets;){for(n=0;n<k;n++)!i[n]&&h[n]>m&&(l=n,m=h[l]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[f]=m;i[l]=1;m=-1;f++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){f=
-0;for(h=e.__webglCustomAttributesList.length;f<h;f++)c=e.__webglCustomAttributesList[f],b[c.buffer.belongsToAttribute]>=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,
-e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
-0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?
-(d=d.wireframeLinewidth,d!==ua&&(j.lineWidth(d),ua=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),R.info.render.calls++,R.info.render.vertices+=e.__webglFaceCount,R.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==
-ua&&(j.lineWidth(d),ua=d),j.drawArrays(g,0,e.__webglLineCount),R.info.render.calls++):g instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),R.info.render.calls++):g instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),R.info.render.calls++)}}function l(a){ca[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ca[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ca[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ca[3].set(a.n41-
-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ca[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ca[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=ca[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function k(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),d=0;d<6;d++)if(a=ca[d].x*b.n14+ca[d].y*b.n24+ca[d].z*b.n34+ca[d].w,a<=c)return!1;return!0}function o(a,b){return b.z-a.z}function p(a){var b,
-c,d,e,g,f,m,n,o=0,p=a.lights;X||(X=new THREE.PerspectiveCamera(R.shadowCameraFov,R.shadowMapWidth/R.shadowMapHeight,R.shadowCameraNear,R.shadowCameraFar));b=0;for(c=p.length;b<c;b++)if(n=p[b],n.castShadow&&n instanceof THREE.SpotLight){fa=-1;R.shadowMap[o]||(R.shadowMap[o]=new THREE.WebGLRenderTarget(R.shadowMapWidth,R.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),ka[o]=new THREE.Matrix4);d=R.shadowMap[o];e=ka[o];X.position.copy(n.position);X.lookAt(n.target.position);
-X.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(X),this.autoUpdateScene&&a.updateMatrixWorld());X.matrixWorldInverse.getInverse(X.matrixWorld);e.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);e.multiplySelf(X.projectionMatrix);e.multiplySelf(X.matrixWorldInverse);X.matrixWorldInverse.flattenToArray(aa);X.projectionMatrix.flattenToArray(P);J.multiply(X.projectionMatrix,X.matrixWorldInverse);l(J);U(d);j.clearColor(1,1,1,1);R.clear();j.clearColor(I.r,I.g,I.b,w);e=a.__webglObjects.length;
-for(d=0;d<e;d++)if(f=a.__webglObjects[d],n=f.object,f.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||k(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),B(n,X,!1),f.render=!0;F(!0);R.setBlending(THREE.NormalBlending);for(d=0;d<e;d++)if(f=a.__webglObjects[d],f.render)n=f.object,f=f.buffer,A(n),m=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?xa:da,i(X,p,null,m,f,n);e=a.__webglObjectsImmediate.length;for(d=0;d<e;d++)f=a.__webglObjectsImmediate[d],
-n=f.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),W=-1,B(n,X,!1),A(n),g=u(X,p,null,da,n),n.immediateRenderCallback?n.immediateRenderCallback(g,j,ca):n.render(function(a){h(a,g,da.shading)}));o++}}function m(a,b,c,d,e,g,f,h){var j,n,m,l;b?(n=a.length-1,l=b=-1):(n=0,b=a.length,l=1);for(var k=n;k!==b;k+=l)if(j=a[k],j.render){n=j.object;m=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;f&&R.setBlending(j.blending);F(j.depthTest);H(j.depthWrite);E(j.polygonOffset,
-j.polygonOffsetFactor,j.polygonOffsetUnits)}A(n);i(d,e,g,j,m,n)}}function r(a,b,c,d,e,g,f){for(var i,n,m,l,k=0,o=a.length;k<o;k++)if(i=a[k],n=i.object,n.visible){W=-1;if(f)m=f;else{m=i[b];if(!m)continue;g&&this.setBlending(m.blending);F(m.depthTest);H(m.depthWrite);E(m.polygonOffset,m.polygonOffsetFactor,m.polygonOffsetUnits)}A(n);l=u(c,d,e,m,n);n.immediateRenderCallback?n.immediateRenderCallback(l,j,ca):n.render(function(a){h(a,l,m.shading)})}}function n(a,b,c){a.push({buffer:b,object:c,opaque:null,
-transparent:null})}function q(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function v(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function z(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function u(a,b,c,d,e){d.program||R.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(R.maxMorphTargets);
-for(var g=0,f=R.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==O&&(j.useProgram(g),O=g,h=!0);if(d.id!==fa)fa=d.id,h=!0;if(h){j.uniformMatrix4fv(f.projectionMatrix,!1,P);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var n,
-m,l=0,k=0,o=0,p,K,q,r=qa,t=r.directional.colors,S=r.directional.positions,ea=r.point.colors,v=r.point.positions,z=r.point.distances,u=0,L=0,c=n=q=0,h=b.length;c<h;c++)if(n=b[c],m=n.color,p=n.position,K=n.intensity,q=n.distance,n instanceof THREE.AmbientLight)R.gammaInput?(l+=m.r*m.r,k+=m.g*m.g,o+=m.b*m.b):(l+=m.r,k+=m.g,o+=m.b);else if(n instanceof THREE.DirectionalLight)q=u*3,R.gammaInput?(t[q]=m.r*m.r*K*K,t[q+1]=m.g*m.g*K*K,t[q+2]=m.b*m.b*K*K):(t[q]=m.r*K,t[q+1]=m.g*K,t[q+2]=m.b*K),S[q]=p.x,S[q+
-1]=p.y,S[q+2]=p.z,u+=1;else if(n instanceof THREE.SpotLight)q=u*3,R.gammaInput?(t[q]=m.r*m.r*K*K,t[q+1]=m.g*m.g*K*K,t[q+2]=m.b*m.b*K*K):(t[q]=m.r*K,t[q+1]=m.g*K,t[q+2]=m.b*K),m=1/p.length(),S[q]=p.x*m,S[q+1]=p.y*m,S[q+2]=p.z*m,u+=1;else if(n instanceof THREE.PointLight)n=L*3,R.gammaInput?(ea[n]=m.r*m.r*K*K,ea[n+1]=m.g*m.g*K*K,ea[n+2]=m.b*m.b*K*K):(ea[n]=m.r*K,ea[n+1]=m.g*K,ea[n+2]=m.b*K),v[n]=p.x,v[n+1]=p.y,v[n+2]=p.z,z[L]=q,L+=1;c=u*3;for(h=t.length;c<h;c++)t[c]=0;c=L*3;for(h=ea.length;c<h;c++)ea[c]=
-0;r.point.length=L;r.directional.length=u;r.ambient[0]=l;r.ambient[1]=k;r.ambient[2]=o;b=qa;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,
-R.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;
-if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=T.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,R.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof
+return!1}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;var i=a.colors,k=i.length,m=a.__vertexArray,n=a.__colorArray,j=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,M=a.__webglCustomAttributesList;if(c.sortParticles){J.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,Y.copy(e),J.multiplyVector3(Y),j[d]=[Y.z,d];j.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[j[d][1]].position,f=d*3,m[f]=e.x,m[f+1]=e.y,m[f+2]=e.z;for(d=0;d<k;d++)f=d*3,e=i[j[d][1]],n[f]=e.r,n[f+1]=
+e.g,n[f+2]=e.b;if(M){i=0;for(k=M.length;i<k;i++)if(h=M[i],h.boundTo===void 0||h.boundTo==="vertices")if(f=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)g=j[d][1],h.array[d]=h.value[g];else if(h.size===2)for(d=0;d<e;d++)g=j[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=j[d][1],g=h.value[g],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=j[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=
+3;else if(h.size===4)for(d=0;d<e;d++)g=j[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}else{if(o)for(d=0;d<g;d++)e=h[d].position,f=d*3,m[f]=e.x,m[f+1]=e.y,m[f+2]=e.z;if(p)for(d=0;d<k;d++)e=i[d],f=d*3,n[f]=e.r,n[f+1]=e.g,n[f+2]=e.b;if(M){i=0;for(k=M.length;i<k;i++)if(h=M[i],h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices"))if(e=h.value.length,f=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)g=h.value[d],h.array[f]=
+g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(h.size===4)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}if(o||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,m,b);if(p||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,
+a.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,n,b);if(M){i=0;for(k=M.length;i<k;i++)if(h=M[i],h.needsUpdate||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,h.buffer),l.bufferData(l.ARRAY_BUFFER,h.array,b)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=l.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=l.createBuffer();a.hasPos&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,a.positionArray,l.DYNAMIC_DRAW),l.enableVertexAttribArray(b.attributes.position),
+l.vertexAttribPointer(b.attributes.position,3,l.FLOAT,!1,0,0));if(a.hasNormal){l.bindBuffer(l.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,k,m,n,j,o=a.count*3;for(j=0;j<o;j+=9)c=a.normalArray,d=c[j],e=c[j+1],f=c[j+2],g=c[j+3],i=c[j+4],m=c[j+5],h=c[j+6],k=c[j+7],n=c[j+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+m+n)/3,c[j]=d,c[j+1]=e,c[j+2]=f,c[j+3]=d,c[j+4]=e,c[j+5]=f,c[j+6]=d,c[j+7]=e,c[j+8]=f}l.bufferData(l.ARRAY_BUFFER,a.normalArray,l.DYNAMIC_DRAW);l.enableVertexAttribArray(b.attributes.normal);
+l.vertexAttribPointer(b.attributes.normal,3,l.FLOAT,!1,0,0)}l.drawArrays(l.TRIANGLES,0,a.count);a.count=0}function i(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=v(a,b,c,d,f),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==ba&&(ba=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),l.vertexAttribPointer(b.position,3,l.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;f.morphTargetBase!==-1?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),
+l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0)):c.position>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),l.vertexAttribPointer(c["morphTarget"+g],3,l.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],k=-1,
+j=0;h=f.morphTargetInfluences;var m,n=h.length;g=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(m=0;m<n;m++)!i[m]&&h[m]>k&&(j=m,k=h[j]);l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j]);l.vertexAttribPointer(c["morphTarget"+g],3,l.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=k;i[j]=1;k=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&l.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=
+0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],b[c.buffer.belongsToAttribute]>=0&&(l.bindBuffer(l.ARRAY_BUFFER,c.buffer),l.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,l.FLOAT,!1,0,0))}b.color>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglColorBuffer),l.vertexAttribPointer(b.color,3,l.FLOAT,!1,0,0));b.normal>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglNormalBuffer),l.vertexAttribPointer(b.normal,3,l.FLOAT,!1,0,0));b.tangent>=0&&(l.bindBuffer(l.ARRAY_BUFFER,
+e.__webglTangentBuffer),l.vertexAttribPointer(b.tangent,4,l.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUVBuffer),l.vertexAttribPointer(b.uv,2,l.FLOAT,!1,0,0),l.enableVertexAttribArray(b.uv)):l.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUV2Buffer),l.vertexAttribPointer(b.uv2,2,l.FLOAT,!1,0,0),l.enableVertexAttribArray(b.uv2)):l.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
+0&&b.skinIndex>=0&&b.skinWeight>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinVertexABuffer),l.vertexAttribPointer(b.skinVertexA,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),l.vertexAttribPointer(b.skinVertexB,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),l.vertexAttribPointer(b.skinIndex,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),l.vertexAttribPointer(b.skinWeight,4,l.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?
+(d=d.wireframeLinewidth,d!==va&&(l.lineWidth(d),va=d),a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),l.drawElements(l.LINES,e.__webglLineCount,l.UNSIGNED_SHORT,0)):(a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),l.drawElements(l.TRIANGLES,e.__webglFaceCount,l.UNSIGNED_SHORT,0)),R.info.render.calls++,R.info.render.vertices+=e.__webglFaceCount,R.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,d=d.linewidth,d!==
+va&&(l.lineWidth(d),va=d),l.drawArrays(f,0,e.__webglLineCount),R.info.render.calls++):f instanceof THREE.ParticleSystem?(l.drawArrays(l.POINTS,0,e.__webglParticleCount),R.info.render.calls++):f instanceof THREE.Ribbon&&(l.drawArrays(l.TRIANGLE_STRIP,0,e.__webglVertexCount),R.info.render.calls++)}}function j(a){ha[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ha[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ha[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ha[3].set(a.n41-
+a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ha[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ha[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=ha[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function k(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),d=0;d<6;d++)if(a=ha[d].x*b.n14+ha[d].y*b.n24+ha[d].z*b.n34+ha[d].w,a<=c)return!1;return!0}function o(a,b){return b.z-a.z}function p(a){var b,
+c,d,e,f,g,m,n,o=0,p=a.lights;X||(X=new THREE.PerspectiveCamera(R.shadowCameraFov,R.shadowMapWidth/R.shadowMapHeight,R.shadowCameraNear,R.shadowCameraFar));b=0;for(c=p.length;b<c;b++)if(n=p[b],n.castShadow&&n instanceof THREE.SpotLight){W=-1;R.shadowMap[o]||(R.shadowMap[o]=new THREE.WebGLRenderTarget(R.shadowMapWidth,R.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),ka[o]=new THREE.Matrix4);d=R.shadowMap[o];e=ka[o];X.position.copy(n.position);X.lookAt(n.target.position);
+X.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(X),this.autoUpdateScene&&a.updateMatrixWorld());X.matrixWorldInverse.getInverse(X.matrixWorld);e.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);e.multiplySelf(X.projectionMatrix);e.multiplySelf(X.matrixWorldInverse);X.matrixWorldInverse.flattenToArray(aa);X.projectionMatrix.flattenToArray(P);J.multiply(X.projectionMatrix,X.matrixWorldInverse);j(J);T(d);l.clearColor(1,1,1,1);R.clear();l.clearColor(H.r,H.g,H.b,O);e=a.__webglObjects.length;
+for(d=0;d<e;d++)if(g=a.__webglObjects[d],n=g.object,g.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||k(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),A(n,X,!1),g.render=!0;w(!0);R.setBlending(THREE.NormalBlending);for(d=0;d<e;d++)if(g=a.__webglObjects[d],g.render)n=g.object,g=g.buffer,z(n),m=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?za:da,i(X,p,null,m,g,n);e=a.__webglObjectsImmediate.length;for(d=0;d<e;d++)g=a.__webglObjectsImmediate[d],
+n=g.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),ba=-1,A(n,X,!1),z(n),f=v(X,p,null,da,n),n.immediateRenderCallback?n.immediateRenderCallback(f,l,ha):n.render(function(a){h(a,f,da.shading)}));o++}}function m(a,b,c,d,e,f,g,h){var l,k,n,m;b?(k=a.length-1,m=b=-1):(k=0,b=a.length,m=1);for(var j=k;j!==b;j+=m)if(l=a[j],l.render){k=l.object;n=l.buffer;if(h)l=h;else{l=l[c];if(!l)continue;g&&R.setBlending(l.blending);w(l.depthTest);I(l.depthWrite);
+F(l.polygonOffset,l.polygonOffsetFactor,l.polygonOffsetUnits)}z(k);i(d,e,f,l,n,k)}}function q(a,b,c,d,e,f,g){for(var i,k,n,m,j=0,o=a.length;j<o;j++)if(i=a[j],k=i.object,k.visible){ba=-1;if(g)n=g;else{n=i[b];if(!n)continue;f&&this.setBlending(n.blending);w(n.depthTest);I(n.depthWrite);F(n.polygonOffset,n.polygonOffsetFactor,n.polygonOffsetUnits)}z(k);m=v(c,d,e,n,k);k.immediateRenderCallback?k.immediateRenderCallback(m,l,ha):k.render(function(a){h(a,m,n.shading)})}}function n(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 t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function u(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function y(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function v(a,b,c,d,e){d.program||R.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(R.maxMorphTargets);
+for(var f=0,g=R.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==N&&(l.useProgram(f),N=f,h=!0);if(d.id!==W)W=d.id,h=!0;if(h){l.uniformMatrix4fv(g.projectionMatrix,!1,P);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var k,
+n,m=0,j=0,o=0,p,M,r,q=sa,t=q.directional.colors,S=q.directional.positions,ea=q.point.colors,u=q.point.positions,y=q.point.distances,v=0,ha=0,c=k=r=0,h=b.length;c<h;c++)if(k=b[c],n=k.color,p=k.position,M=k.intensity,r=k.distance,k instanceof THREE.AmbientLight)R.gammaInput?(m+=n.r*n.r,j+=n.g*n.g,o+=n.b*n.b):(m+=n.r,j+=n.g,o+=n.b);else if(k instanceof THREE.DirectionalLight)r=v*3,R.gammaInput?(t[r]=n.r*n.r*M*M,t[r+1]=n.g*n.g*M*M,t[r+2]=n.b*n.b*M*M):(t[r]=n.r*M,t[r+1]=n.g*M,t[r+2]=n.b*M),S[r]=p.x,S[r+
+1]=p.y,S[r+2]=p.z,v+=1;else if(k instanceof THREE.SpotLight)r=v*3,R.gammaInput?(t[r]=n.r*n.r*M*M,t[r+1]=n.g*n.g*M*M,t[r+2]=n.b*n.b*M*M):(t[r]=n.r*M,t[r+1]=n.g*M,t[r+2]=n.b*M),n=1/p.length(),S[r]=p.x*n,S[r+1]=p.y*n,S[r+2]=p.z*n,v+=1;else if(k instanceof THREE.PointLight)k=ha*3,R.gammaInput?(ea[k]=n.r*n.r*M*M,ea[k+1]=n.g*n.g*M*M,ea[k+2]=n.b*n.b*M*M):(ea[k]=n.r*M,ea[k+1]=n.g*M,ea[k+2]=n.b*M),u[k]=p.x,u[k+1]=p.y,u[k+2]=p.z,y[ha]=r,ha+=1;c=v*3;for(h=t.length;c<h;c++)t[c]=0;c=ha*3;for(h=ea.length;c<h;c++)ea[c]=
+0;q.point.length=ha;q.directional.length=v;q.ambient[0]=m;q.ambient[1]=j;q.ambient[2]=o;b=sa;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=
+d.opacity,R.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;
+if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=U.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,R.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof
 THREE.MeshLambertMaterial)R.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<ka.length;b++)i.shadowMatrix.value[b]=ka[b],i.shadowMap.texture[b]=R.shadowMap[b];i.shadowDarkness.value=R.shadowMapDarkness;i.shadowBias.value=R.shadowMapBias}b=
-d.uniformsList;i=0;for(c=b.length;i<c;i++)if(k=g.uniforms[b[i][1]])if(l=b[i][0],o=l.type,h=l.value,o==="i")j.uniform1i(k,h);else if(o==="f")j.uniform1f(k,h);else if(o==="v2")j.uniform2f(k,h.x,h.y);else if(o==="v3")j.uniform3f(k,h.x,h.y,h.z);else if(o==="v4")j.uniform4f(k,h.x,h.y,h.z,h.w);else if(o==="c")j.uniform3f(k,h.r,h.g,h.b);else if(o==="fv1")j.uniform1fv(k,h);else if(o==="fv")j.uniform3fv(k,h);else if(o==="v3v"){if(!l._array)l._array=new Float32Array(3*h.length);o=0;for(p=h.length;o<p;o++)r=
-o*3,l._array[r]=h[o].x,l._array[r+1]=h[o].y,l._array[r+2]=h[o].z;j.uniform3fv(k,l._array)}else if(o==="m4"){if(!l._array)l._array=new Float32Array(16);h.flattenToArray(l._array);j.uniformMatrix4fv(k,!1,l._array)}else if(o==="m4v"){if(!l._array)l._array=new Float32Array(16*h.length);o=0;for(p=h.length;o<p;o++)h[o].flattenToArrayOffset(l._array,o*16);j.uniformMatrix4fv(k,!1,l._array)}else if(o==="t"){if(j.uniform1i(k,h),k=l.texture)if(k.image instanceof Array&&k.image.length===6){if(l=k,l.image.length===
-6)if(l.needsUpdate){if(!l.image.__webglTextureCube)l.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+h);j.bindTexture(j.TEXTURE_CUBE_MAP,l.image.__webglTextureCube);h=s(j.TEXTURE_CUBE_MAP,l,l.image[0]);for(k=0;k<6;k++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,l.image[k]);h&&j.generateMipmap(j.TEXTURE_CUBE_MAP);l.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,l.image.__webglTextureCube)}else k instanceof THREE.WebGLRenderTargetCube?
-(l=k,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,l.__webglTexture)):R.setTexture(k,h)}else if(o==="tv"){if(!l._array){l._array=[];o=0;for(p=l.texture.length;o<p;o++)l._array[o]=h+o}j.uniform1iv(k,l._array);o=0;for(p=l.texture.length;o<p;o++)(k=l.texture[o])&&R.setTexture(k,l._array[o])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&f.cameraPosition!==null&&j.uniform3f(f.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||
-d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&f.viewMatrix!==null&&j.uniformMatrix4fv(f.viewMatrix,!1,aa);d.skinning&&(j.uniformMatrix4fv(f.cameraInverseMatrix,!1,aa),j.uniformMatrix4fv(f.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(f.modelViewMatrix,!1,e._modelViewMatrixArray);f.normalMatrix&&j.uniformMatrix3fv(f.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&f.objectMatrix!==
-null&&j.uniformMatrix4fv(f.objectMatrix,!1,e._objectMatrixArray);return g}function B(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function A(a){if(ha!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ha=a.doubleSided;if(ra!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ra=a.flipSided}function F(a){pa!==a&&(a?j.enable(j.DEPTH_TEST):
-j.disable(j.DEPTH_TEST),pa=a)}function H(a){sa!==a&&(j.depthMask(a),sa=a)}function E(a,b,c){ta!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),ta=a);if(a&&(Ba!==b||va!==c))j.polygonOffset(b,c),Ba=b,va=c}function L(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(b),null;
-return c}function s(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,Q(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,Q(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,Q(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,Q(b.minFilter)),!0):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,Z(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,Z(b.minFilter)),
-!1)}function G(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function U(a){var b=
-a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);s(j.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Q(a.format),
-a.width,a.height,0,Q(a.format),Q(a.type),null);var d=a,e=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,e,d.__webglTexture,0);G(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),s(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,Q(a.format),a.width,a.height,0,Q(a.format),Q(a.type),null),
-c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,c,a.__webglTexture,0),G(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=ea,a=S,d=Aa,e=K);b!==ga&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,
-e,c,a),ga=b)}function Z(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function Q(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;
-case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;
-case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var a=a||{},T=a.canvas!==void 0?a.canvas:document.createElement("canvas"),$=a.precision!==void 0?a.precision:"highp",ia=a.antialias!==void 0?a.antialias:!1,y=a.stencil!==void 0?a.stencil:!0,N=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,I=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),
-w=a.clearAlpha!==void 0?a.clearAlpha:0,V=a.maxLights!==void 0?a.maxLights:4;this.domElement=T;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.renderPlugins=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var R=this,j,ba=[],O=null,ga=null,fa=-1,W=null,na=0,ha=null,ra=null,oa=null,pa=null,sa=null,ta=null,Ba=null,va=null,ua=null,Aa=0,K=0,ea=0,S=0,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Matrix4,P=new Float32Array(16),
-aa=new Float32Array(16),Y=new THREE.Vector4,qa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},X,ka=[],da,xa,M={},wa=!1;j=function(){var a;try{if(!(a=T.getContext("experimental-webgl",{antialias:ia,stencil:y,preserveDrawingBuffer:N})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();
-j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(I.r,I.g,I.b,w);(function(){M.vertices=new Float32Array(16);M.faces=new Uint16Array(6);var a=0;M.vertices[a++]=-1;M.vertices[a++]=-1;M.vertices[a++]=0;M.vertices[a++]=1;M.vertices[a++]=1;M.vertices[a++]=-1;M.vertices[a++]=1;M.vertices[a++]=
-1;M.vertices[a++]=1;M.vertices[a++]=1;M.vertices[a++]=1;M.vertices[a++]=0;M.vertices[a++]=-1;M.vertices[a++]=1;M.vertices[a++]=0;a=M.vertices[a++]=0;M.faces[a++]=0;M.faces[a++]=1;M.faces[a++]=2;M.faces[a++]=0;M.faces[a++]=2;M.faces[a++]=3;M.vertexBuffer=j.createBuffer();M.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,M.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,M.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,M.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,M.faces,j.STATIC_DRAW);
-M.program=j.createProgram();j.attachShader(M.program,L("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(M.program,L("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(M.program);M.attributes={};M.uniforms={};M.attributes.position=j.getAttribLocation(M.program,"position");M.attributes.uv=j.getAttribLocation(M.program,"uv");M.uniforms.uvOffset=j.getUniformLocation(M.program,"uvOffset");M.uniforms.uvScale=j.getUniformLocation(M.program,"uvScale");M.uniforms.rotation=j.getUniformLocation(M.program,
-"rotation");M.uniforms.scale=j.getUniformLocation(M.program,"scale");M.uniforms.alignment=j.getUniformLocation(M.program,"alignment");M.uniforms.color=j.getUniformLocation(M.program,"color");M.uniforms.map=j.getUniformLocation(M.program,"map");M.uniforms.opacity=j.getUniformLocation(M.program,"opacity");M.uniforms.useScreenCoordinates=j.getUniformLocation(M.program,"useScreenCoordinates");M.uniforms.affectedByDistance=j.getUniformLocation(M.program,"affectedByDistance");M.uniforms.screenPosition=
-j.getUniformLocation(M.program,"screenPosition");M.uniforms.modelViewMatrix=j.getUniformLocation(M.program,"modelViewMatrix");M.uniforms.projectionMatrix=j.getUniformLocation(M.program,"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);da=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});xa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});
-da._shadowPass=!0;xa._shadowPass=!0})();this.context=j;var za=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=function(){return za};this.setSize=function(a,b){T.width=a;T.height=b;this.setViewport(0,0,T.width,T.height)};this.setViewport=function(a,b,c,d){Aa=a;K=b;ea=c;S=d;j.viewport(Aa,K,ea,S)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};
-this.setClearColorHex=function(a,b){I.setHex(a);w=b;j.clearColor(I.r,I.g,I.b,w)};this.setClearColor=function(a,b){I.copy(a);w=b;j.clearColor(I.r,I.g,I.b,w)};this.getClearColor=function(){return I};this.getClearAlpha=function(){return w};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){U(a);this.clear(b,c,d)};this.addPlugin=function(a){a.init(this);
-this.renderPlugins.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);
-j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);R.info.memory.geometries--}else if(a instanceof
-THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),R.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),R.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),R.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,
-j.deleteTexture(a.__webglTexture),R.info.memory.textures--};this.updateShadowMap=function(a,b){p(a,b)};this.render=function(a,b,c,d){var e,g,f,h,i=a.lights,n=a.fog;fa=-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&&p(a,b);R.info.render.calls=0;R.info.render.vertices=0;R.info.render.faces=0;b.matrixWorldInverse.getInverse(b.matrixWorld);
-b.matrixWorldInverse.flattenToArray(aa);b.projectionMatrix.flattenToArray(P);J.multiply(b.projectionMatrix,b.matrixWorldInverse);l(J);U(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(g=h[d],f=g.object,g.render=!1,f.visible&&(!(f instanceof THREE.Mesh)||!f.frustumCulled||k(f))){f.matrixWorld.flattenToArray(f._objectMatrixArray);B(f,b,!0);var K=g,q=K.object,t=K.buffer,v=void 0,v=v=void 0,v=q.material;
-if(v instanceof THREE.MeshFaceMaterial){if(v=t.materialIndex,v>=0)v=q.geometry.materials[v],v.transparent?(K.transparent=v,K.opaque=null):(K.opaque=v,K.transparent=null)}else if(v)v.transparent?(K.transparent=v,K.opaque=null):(K.opaque=v,K.transparent=null);g.render=!0;if(this.sortObjects)f.renderDepth?g.z=f.renderDepth:(Y.copy(f.position),J.multiplyVector3(Y),g.z=Y.z)}this.sortObjects&&h.sort(o);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)if(g=h[d],f=g.object,f.visible)f.matrixAutoUpdate&&
-f.matrixWorld.flattenToArray(f._objectMatrixArray),B(f,b,!0),f=g.object.material,f.transparent?(g.transparent=f,g.opaque=null):(g.opaque=f,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),F(a.overrideMaterial.depthTest),H(a.overrideMaterial.depthWrite),E(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),m(a.__webglObjects,!1,"",b,i,n,!0,a.overrideMaterial),r(a.__webglObjectsImmediate,"",b,i,n,!1,a.overrideMaterial)):
-(this.setBlending(THREE.NormalBlending),m(a.__webglObjects,!0,"opaque",b,i,n,!1),r(a.__webglObjectsImmediate,"opaque",b,i,n,!1),m(a.__webglObjects,!1,"transparent",b,i,n,!0),r(a.__webglObjectsImmediate,"transparent",b,i,n,!0));if(a.__webglSprites.length){f=M.attributes;i=M.uniforms;n=S/ea;d=[];e=ea*0.5;h=S*0.5;g=!0;j.useProgram(M.program);O=M.program;W=pa=oa=-1;wa||(j.enableVertexAttribArray(M.attributes.position),j.enableVertexAttribArray(M.attributes.uv),wa=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);
-j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,M.vertexBuffer);j.vertexAttribPointer(f.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(f.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,M.elementBuffer);j.uniformMatrix4fv(i.projectionMatrix,!1,P);j.activeTexture(j.TEXTURE0);j.uniform1i(i.map,0);f=0;for(K=a.__webglSprites.length;f<K;f++)if(q=a.__webglSprites[f],q.visible&&q.opacity!==0)q.useScreenCoordinates?q.z=-q.position.z:(q._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,q.matrixWorld,
-q._modelViewMatrixArray),q.z=-q._modelViewMatrix.n34);a.__webglSprites.sort(o);f=0;for(K=a.__webglSprites.length;f<K;f++)q=a.__webglSprites[f],q.visible&&q.opacity!==0&&q.map&&q.map.image&&q.map.image.width&&(q.useScreenCoordinates?(j.uniform1i(i.useScreenCoordinates,1),j.uniform3f(i.screenPosition,(q.position.x-e)/e,(h-q.position.y)/h,Math.max(0,Math.min(1,q.position.z)))):(j.uniform1i(i.useScreenCoordinates,0),j.uniform1i(i.affectedByDistance,q.affectedByDistance?1:0),j.uniformMatrix4fv(i.modelViewMatrix,
-!1,q._modelViewMatrixArray)),t=q.map.image.width/(q.scaleByViewport?S:1),d[0]=t*n*q.scale.x,d[1]=t*q.scale.y,j.uniform2f(i.uvScale,q.uvScale.x,q.uvScale.y),j.uniform2f(i.uvOffset,q.uvOffset.x,q.uvOffset.y),j.uniform2f(i.alignment,q.alignment.x,q.alignment.y),j.uniform1f(i.opacity,q.opacity),j.uniform3f(i.color,q.color.r,q.color.g,q.color.b),j.uniform1f(i.rotation,q.rotation),j.uniform2fv(i.scale,d),q.mergeWith3D&&!g?(j.enable(j.DEPTH_TEST),g=!0):!q.mergeWith3D&&g&&(j.disable(j.DEPTH_TEST),g=!1),R.setBlending(q.blending),
-R.setTexture(q.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(sa)}if(this.renderPlugins.length){d=0;for(e=this.renderPlugins.length;d<e;d++)this.renderPlugins[d].render(a,b,ea,S),O=null,W=sa=pa=oa=-1}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,
-null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,m=void 0,l=void 0,k=void 0;if(!h.__webglInit)if(h.__webglInit=!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),
-h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){l=h.geometry;if(l.geometryGroups===void 0){var k=l,o=void 0,p=void 0,K=void 0,r=void 0,S=void 0,ea=void 0,s=void 0,u={},L=k.morphTargets.length;k.geometryGroups={};o=0;for(p=k.faces.length;o<p;o++)K=k.faces[o],r=K.materialIndex,ea=r!==void 0?r:-1,u[ea]===void 0&&(u[ea]={hash:ea,counter:0}),s=u[ea].hash+"_"+u[ea].counter,k.geometryGroups[s]===void 0&&(k.geometryGroups[s]={faces3:[],
-faces4:[],materialIndex:r,vertices:0,numMorphTargets:L}),S=K instanceof THREE.Face3?3:4,k.geometryGroups[s].vertices+S>65535&&(u[ea].counter+=1,s=u[ea].hash+"_"+u[ea].counter,k.geometryGroups[s]===void 0&&(k.geometryGroups[s]={faces3:[],faces4:[],materialIndex:r,vertices:0,numMorphTargets:L})),K instanceof THREE.Face3?k.geometryGroups[s].faces3.push(o):k.geometryGroups[s].faces4.push(o),k.geometryGroups[s].vertices+=S;k.geometryGroupsList=[];o=void 0;for(o in k.geometryGroups)k.geometryGroups[o].id=
-na++,k.geometryGroupsList.push(k.geometryGroups[o])}for(m in l.geometryGroups)if(k=l.geometryGroups[m],!k.__webglVertexBuffer){o=k;o.__webglVertexBuffer=j.createBuffer();o.__webglNormalBuffer=j.createBuffer();o.__webglTangentBuffer=j.createBuffer();o.__webglColorBuffer=j.createBuffer();o.__webglUVBuffer=j.createBuffer();o.__webglUV2Buffer=j.createBuffer();o.__webglSkinVertexABuffer=j.createBuffer();o.__webglSkinVertexBBuffer=j.createBuffer();o.__webglSkinIndicesBuffer=j.createBuffer();o.__webglSkinWeightsBuffer=
-j.createBuffer();o.__webglFaceBuffer=j.createBuffer();o.__webglLineBuffer=j.createBuffer();if(o.numMorphTargets){K=p=void 0;o.__webglMorphTargetsBuffers=[];p=0;for(K=o.numMorphTargets;p<K;p++)o.__webglMorphTargetsBuffers.push(j.createBuffer())}R.info.memory.geometries++;r=h;S=r.geometry;p=k.faces3;ea=k.faces4;o=p.length*3+ea.length*4;K=p.length*1+ea.length*2;ea=p.length*3+ea.length*4;p=c(r,k);s=g(p);u=d(p);L=e(p);k.__vertexArray=new Float32Array(o*3);if(u)k.__normalArray=new Float32Array(o*3);if(S.hasTangents)k.__tangentArray=
-new Float32Array(o*4);if(L)k.__colorArray=new Float32Array(o*3);if(s){if(S.faceUvs.length>0||S.faceVertexUvs.length>0)k.__uvArray=new Float32Array(o*2);if(S.faceUvs.length>1||S.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(o*2)}if(r.geometry.skinWeights.length&&r.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(o*4),k.__skinVertexBArray=new Float32Array(o*4),k.__skinIndexArray=new Float32Array(o*4),k.__skinWeightArray=new Float32Array(o*4);k.__faceArray=new Uint16Array(K*3);
-k.__lineArray=new Uint16Array(ea*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];r=0;for(S=k.numMorphTargets;r<S;r++)k.__morphTargetsArrays.push(new Float32Array(o*3))}k.__webglFaceCount=K*3;k.__webglLineCount=ea*2;if(p.attributes){if(k.__webglCustomAttributesList===void 0)k.__webglCustomAttributesList=[];K=void 0;for(K in p.attributes){var r=p.attributes[K],S={},ca;for(ca in r)S[ca]=r[ca];if(!S.__webglInitialized||S.createUniqueBuffers)S.__webglInitialized=!0,ea=1,S.type==="v2"?ea=2:S.type===
-"v3"?ea=3:S.type==="v4"?ea=4:S.type==="c"&&(ea=3),S.size=ea,S.array=new Float32Array(o*ea),S.buffer=j.createBuffer(),S.buffer.belongsToAttribute=K,r.needsUpdate=!0,S.__original=r;k.__webglCustomAttributesList.push(S)}}k.__inittedArrays=!0;l.__dirtyVertices=!0;l.__dirtyMorphTargets=!0;l.__dirtyElements=!0;l.__dirtyUvs=!0;l.__dirtyNormals=!0;l.__dirtyTangents=!0;l.__dirtyColors=!0}}else if(h instanceof THREE.Ribbon){if(l=h.geometry,!l.__webglVertexBuffer)k=l,k.__webglVertexBuffer=j.createBuffer(),k.__webglColorBuffer=
-j.createBuffer(),R.info.memory.geometries++,k=l,o=k.vertices.length,k.__vertexArray=new Float32Array(o*3),k.__colorArray=new Float32Array(o*3),k.__webglVertexCount=o,l.__dirtyVertices=!0,l.__dirtyColors=!0}else if(h instanceof THREE.Line){if(l=h.geometry,!l.__webglVertexBuffer)k=l,k.__webglVertexBuffer=j.createBuffer(),k.__webglColorBuffer=j.createBuffer(),R.info.memory.geometries++,k=l,o=h,p=k.vertices.length,k.__vertexArray=new Float32Array(p*3),k.__colorArray=new Float32Array(p*3),k.__webglLineCount=
-p,b(k,o),l.__dirtyVertices=!0,l.__dirtyColors=!0}else if(h instanceof THREE.ParticleSystem&&(l=h.geometry,!l.__webglVertexBuffer))k=l,k.__webglVertexBuffer=j.createBuffer(),k.__webglColorBuffer=j.createBuffer(),R.info.geometries++,k=l,o=h,p=k.vertices.length,k.__vertexArray=new Float32Array(p*3),k.__colorArray=new Float32Array(p*3),k.__sortArray=[],k.__webglParticleCount=p,b(k,o),l.__dirtyVertices=!0,l.__dirtyColors=!0;if(!h.__webglActive){if(h instanceof THREE.Mesh)for(m in l=h.geometry,l.geometryGroups)k=
-l.geometryGroups[m],n(i.__webglObjects,k,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(l=h.geometry,n(i.__webglObjects,l,h)):THREE.MarchingCubes!==void 0&&h instanceof THREE.MarchingCubes||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)h=
-a.__objectsRemoved[0],i=a,h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem||h instanceof THREE.Ribbon||h instanceof THREE.Line?v(i.__webglObjects,h):h instanceof THREE.Sprite?z(i.__webglSprites,h):h instanceof THREE.LensFlare?z(i.__webglFlares,h):(h instanceof THREE.MarchingCubes||h.immediateRenderCallback)&&v(i.__webglObjectsImmediate,h),h.__webglActive=!1,a.__objectsRemoved.splice(0,1);h=0;for(i=a.__webglObjects.length;h<i;h++)if(ca=a.__webglObjects[h].object,m=ca.geometry,l=K=p=void 0,
-ca instanceof THREE.Mesh){k=0;for(o=m.geometryGroupsList.length;k<o;k++)if(p=m.geometryGroupsList[k],l=c(ca,p),K=l.attributes&&q(l),m.__dirtyVertices||m.__dirtyMorphTargets||m.__dirtyElements||m.__dirtyUvs||m.__dirtyNormals||m.__dirtyColors||m.__dirtyTangents||K){var G=ca,K=j.DYNAMIC_DRAW,r=!m.dynamic,s=l;if(p.__inittedArrays){var S=d(s),ea=e(s),U=g(s),I=S===THREE.SmoothShading,A=u=s=void 0,C=void 0,B=void 0,N=void 0,w=void 0,E=void 0,H=void 0,F=A=void 0,J=void 0,P=void 0,y=void 0,T=C=void 0,M=void 0,
-V=void 0,Q=C=H=void 0,aa=void 0,Z=y=P=J=w=void 0,Y=C=y=P=J=Z=y=P=J=Z=y=P=J=void 0,O=void 0,$=N=void 0,ba=void 0,X=void 0,ga=void 0,W=void 0,fa=F=X=O=0,ia=0,qa=Y=A=0,da=w=T=0,D=0,ka=void 0,da=p.__vertexArray,ba=p.__uvArray,D=p.__uv2Array,$=p.__normalArray,B=p.__tangentArray,M=p.__colorArray,Q=p.__skinVertexAArray,aa=p.__skinVertexBArray,E=p.__skinIndexArray,ha=p.__skinWeightArray,Z=p.__morphTargetsArrays,L=p.__webglCustomAttributesList,x=void 0,x=p.__faceArray,ka=p.__lineArray,V=G.geometry,ra=V.__dirtyElements,
-oa=V.__dirtyUvs,N=V.__dirtyNormals,H=V.__dirtyTangents,ta=V.__dirtyColors,ga=V.__dirtyMorphTargets,W=V.vertices,G=p.faces3,la=p.faces4,ma=V.faces,sa=V.faceVertexUvs[0],za=V.faceVertexUvs[1],pa=V.skinVerticesA,xa=V.skinVerticesB,wa=V.skinIndices,ua=V.skinWeights,va=V.morphTargets;if(V.__dirtyVertices){s=0;for(u=G.length;s<u;s++)C=ma[G[s]],J=W[C.a].position,P=W[C.b].position,y=W[C.c].position,da[X]=J.x,da[X+1]=J.y,da[X+2]=J.z,da[X+3]=P.x,da[X+4]=P.y,da[X+5]=P.z,da[X+6]=y.x,da[X+7]=y.y,da[X+8]=y.z,X+=
-9;s=0;for(u=la.length;s<u;s++)C=ma[la[s]],J=W[C.a].position,P=W[C.b].position,y=W[C.c].position,C=W[C.d].position,da[X]=J.x,da[X+1]=J.y,da[X+2]=J.z,da[X+3]=P.x,da[X+4]=P.y,da[X+5]=P.z,da[X+6]=y.x,da[X+7]=y.y,da[X+8]=y.z,da[X+9]=C.x,da[X+10]=C.y,da[X+11]=C.z,X+=12;j.bindBuffer(j.ARRAY_BUFFER,p.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,da,K)}if(ga){X=0;for(ga=va.length;X<ga;X++){s=da=0;for(u=G.length;s<u;s++)C=ma[G[s]],J=va[X].vertices[C.a].position,P=va[X].vertices[C.b].position,y=va[X].vertices[C.c].position,
-W=Z[X],W[da]=J.x,W[da+1]=J.y,W[da+2]=J.z,W[da+3]=P.x,W[da+4]=P.y,W[da+5]=P.z,W[da+6]=y.x,W[da+7]=y.y,W[da+8]=y.z,da+=9;s=0;for(u=la.length;s<u;s++)C=ma[la[s]],J=va[X].vertices[C.a].position,P=va[X].vertices[C.b].position,y=va[X].vertices[C.c].position,C=va[X].vertices[C.d].position,W=Z[X],W[da]=J.x,W[da+1]=J.y,W[da+2]=J.z,W[da+3]=P.x,W[da+4]=P.y,W[da+5]=P.z,W[da+6]=y.x,W[da+7]=y.y,W[da+8]=y.z,W[da+9]=C.x,W[da+10]=C.y,W[da+11]=C.z,da+=12;j.bindBuffer(j.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[X]);
-j.bufferData(j.ARRAY_BUFFER,Z[X],K)}}if(ua.length){s=0;for(u=G.length;s<u;s++)C=ma[G[s]],J=ua[C.a],P=ua[C.b],y=ua[C.c],ha[w]=J.x,ha[w+1]=J.y,ha[w+2]=J.z,ha[w+3]=J.w,ha[w+4]=P.x,ha[w+5]=P.y,ha[w+6]=P.z,ha[w+7]=P.w,ha[w+8]=y.x,ha[w+9]=y.y,ha[w+10]=y.z,ha[w+11]=y.w,J=wa[C.a],P=wa[C.b],y=wa[C.c],E[w]=J.x,E[w+1]=J.y,E[w+2]=J.z,E[w+3]=J.w,E[w+4]=P.x,E[w+5]=P.y,E[w+6]=P.z,E[w+7]=P.w,E[w+8]=y.x,E[w+9]=y.y,E[w+10]=y.z,E[w+11]=y.w,J=pa[C.a],P=pa[C.b],y=pa[C.c],Q[w]=J.x,Q[w+1]=J.y,Q[w+2]=J.z,Q[w+3]=1,Q[w+4]=
-P.x,Q[w+5]=P.y,Q[w+6]=P.z,Q[w+7]=1,Q[w+8]=y.x,Q[w+9]=y.y,Q[w+10]=y.z,Q[w+11]=1,J=xa[C.a],P=xa[C.b],y=xa[C.c],aa[w]=J.x,aa[w+1]=J.y,aa[w+2]=J.z,aa[w+3]=1,aa[w+4]=P.x,aa[w+5]=P.y,aa[w+6]=P.z,aa[w+7]=1,aa[w+8]=y.x,aa[w+9]=y.y,aa[w+10]=y.z,aa[w+11]=1,w+=12;s=0;for(u=la.length;s<u;s++)C=ma[la[s]],J=ua[C.a],P=ua[C.b],y=ua[C.c],Z=ua[C.d],ha[w]=J.x,ha[w+1]=J.y,ha[w+2]=J.z,ha[w+3]=J.w,ha[w+4]=P.x,ha[w+5]=P.y,ha[w+6]=P.z,ha[w+7]=P.w,ha[w+8]=y.x,ha[w+9]=y.y,ha[w+10]=y.z,ha[w+11]=y.w,ha[w+12]=Z.x,ha[w+13]=Z.y,
-ha[w+14]=Z.z,ha[w+15]=Z.w,J=wa[C.a],P=wa[C.b],y=wa[C.c],Z=wa[C.d],E[w]=J.x,E[w+1]=J.y,E[w+2]=J.z,E[w+3]=J.w,E[w+4]=P.x,E[w+5]=P.y,E[w+6]=P.z,E[w+7]=P.w,E[w+8]=y.x,E[w+9]=y.y,E[w+10]=y.z,E[w+11]=y.w,E[w+12]=Z.x,E[w+13]=Z.y,E[w+14]=Z.z,E[w+15]=Z.w,J=pa[C.a],P=pa[C.b],y=pa[C.c],Z=pa[C.d],Q[w]=J.x,Q[w+1]=J.y,Q[w+2]=J.z,Q[w+3]=1,Q[w+4]=P.x,Q[w+5]=P.y,Q[w+6]=P.z,Q[w+7]=1,Q[w+8]=y.x,Q[w+9]=y.y,Q[w+10]=y.z,Q[w+11]=1,Q[w+12]=Z.x,Q[w+13]=Z.y,Q[w+14]=Z.z,Q[w+15]=1,J=xa[C.a],P=xa[C.b],y=xa[C.c],C=xa[C.d],aa[w]=
-J.x,aa[w+1]=J.y,aa[w+2]=J.z,aa[w+3]=1,aa[w+4]=P.x,aa[w+5]=P.y,aa[w+6]=P.z,aa[w+7]=1,aa[w+8]=y.x,aa[w+9]=y.y,aa[w+10]=y.z,aa[w+11]=1,aa[w+12]=C.x,aa[w+13]=C.y,aa[w+14]=C.z,aa[w+15]=1,w+=16;w>0&&(j.bindBuffer(j.ARRAY_BUFFER,p.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,Q,K),j.bindBuffer(j.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,aa,K),j.bindBuffer(j.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,E,K),j.bindBuffer(j.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),
-j.bufferData(j.ARRAY_BUFFER,ha,K))}if(ta&&ea){s=0;for(u=G.length;s<u;s++)C=ma[G[s]],w=C.vertexColors,E=C.color,w.length===3&&ea===THREE.VertexColors?(C=w[0],Q=w[1],aa=w[2]):aa=Q=C=E,M[T]=C.r,M[T+1]=C.g,M[T+2]=C.b,M[T+3]=Q.r,M[T+4]=Q.g,M[T+5]=Q.b,M[T+6]=aa.r,M[T+7]=aa.g,M[T+8]=aa.b,T+=9;s=0;for(u=la.length;s<u;s++)C=ma[la[s]],w=C.vertexColors,E=C.color,w.length===4&&ea===THREE.VertexColors?(C=w[0],Q=w[1],aa=w[2],w=w[3]):w=aa=Q=C=E,M[T]=C.r,M[T+1]=C.g,M[T+2]=C.b,M[T+3]=Q.r,M[T+4]=Q.g,M[T+5]=Q.b,M[T+
-6]=aa.r,M[T+7]=aa.g,M[T+8]=aa.b,M[T+9]=w.r,M[T+10]=w.g,M[T+11]=w.b,T+=12;T>0&&(j.bindBuffer(j.ARRAY_BUFFER,p.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,M,K))}if(H&&V.hasTangents){s=0;for(u=G.length;s<u;s++)C=ma[G[s]],H=C.vertexTangents,T=H[0],M=H[1],V=H[2],B[Y]=T.x,B[Y+1]=T.y,B[Y+2]=T.z,B[Y+3]=T.w,B[Y+4]=M.x,B[Y+5]=M.y,B[Y+6]=M.z,B[Y+7]=M.w,B[Y+8]=V.x,B[Y+9]=V.y,B[Y+10]=V.z,B[Y+11]=V.w,Y+=12;s=0;for(u=la.length;s<u;s++)C=ma[la[s]],H=C.vertexTangents,T=H[0],M=H[1],V=H[2],H=H[3],B[Y]=T.x,B[Y+1]=
-T.y,B[Y+2]=T.z,B[Y+3]=T.w,B[Y+4]=M.x,B[Y+5]=M.y,B[Y+6]=M.z,B[Y+7]=M.w,B[Y+8]=V.x,B[Y+9]=V.y,B[Y+10]=V.z,B[Y+11]=V.w,B[Y+12]=H.x,B[Y+13]=H.y,B[Y+14]=H.z,B[Y+15]=H.w,Y+=16;j.bindBuffer(j.ARRAY_BUFFER,p.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,B,K)}if(N&&S){s=0;for(u=G.length;s<u;s++)if(C=ma[G[s]],B=C.vertexNormals,N=C.normal,B.length===3&&I)for(Y=0;Y<3;Y++)N=B[Y],$[A]=N.x,$[A+1]=N.y,$[A+2]=N.z,A+=3;else for(Y=0;Y<3;Y++)$[A]=N.x,$[A+1]=N.y,$[A+2]=N.z,A+=3;s=0;for(u=la.length;s<u;s++)if(C=ma[la[s]],
-B=C.vertexNormals,N=C.normal,B.length===4&&I)for(Y=0;Y<4;Y++)N=B[Y],$[A]=N.x,$[A+1]=N.y,$[A+2]=N.z,A+=3;else for(Y=0;Y<4;Y++)$[A]=N.x,$[A+1]=N.y,$[A+2]=N.z,A+=3;j.bindBuffer(j.ARRAY_BUFFER,p.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,$,K)}if(oa&&sa&&U){s=0;for(u=G.length;s<u;s++)if(A=G[s],A=sa[A],A!==void 0)for(Y=0;Y<3;Y++)$=A[Y],ba[F]=$.u,ba[F+1]=$.v,F+=2;s=0;for(u=la.length;s<u;s++)if(A=la[s],A=sa[A],A!==void 0)for(Y=0;Y<4;Y++)$=A[Y],ba[F]=$.u,ba[F+1]=$.v,F+=2;F>0&&(j.bindBuffer(j.ARRAY_BUFFER,
-p.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,ba,K))}if(oa&&za&&U){s=0;for(u=G.length;s<u;s++)if(A=G[s],F=za[A],F!==void 0)for(Y=0;Y<3;Y++)ba=F[Y],D[fa]=ba.u,D[fa+1]=ba.v,fa+=2;s=0;for(u=la.length;s<u;s++)if(A=la[s],F=za[A],F!==void 0)for(Y=0;Y<4;Y++)ba=F[Y],D[fa]=ba.u,D[fa+1]=ba.v,fa+=2;fa>0&&(j.bindBuffer(j.ARRAY_BUFFER,p.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,D,K))}if(ra){s=0;for(u=G.length;s<u;s++)x[ia]=O,x[ia+1]=O+1,x[ia+2]=O+2,ia+=3,ka[qa]=O,ka[qa+1]=O+1,ka[qa+2]=O,ka[qa+3]=O+2,ka[qa+
-4]=O+1,ka[qa+5]=O+2,qa+=6,O+=3;s=0;for(u=la.length;s<u;s++)x[ia]=O,x[ia+1]=O+1,x[ia+2]=O+3,x[ia+3]=O+1,x[ia+4]=O+2,x[ia+5]=O+3,ia+=6,ka[qa]=O,ka[qa+1]=O+1,ka[qa+2]=O,ka[qa+3]=O+3,ka[qa+4]=O+1,ka[qa+5]=O+2,ka[qa+6]=O+2,ka[qa+7]=O+3,qa+=8,O+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,x,K);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,ka,K)}if(L){Y=0;for(O=L.length;Y<O;Y++)if(x=L[Y],x.__original.needsUpdate){D=
-0;if(x.size===1)if(x.boundTo===void 0||x.boundTo==="vertices"){s=0;for(u=G.length;s<u;s++)C=ma[G[s]],x.array[D]=x.value[C.a],x.array[D+1]=x.value[C.b],x.array[D+2]=x.value[C.c],D+=3;s=0;for(u=la.length;s<u;s++)C=ma[la[s]],x.array[D]=x.value[C.a],x.array[D+1]=x.value[C.b],x.array[D+2]=x.value[C.c],x.array[D+3]=x.value[C.d],D+=4}else{if(x.boundTo==="faces"){s=0;for(u=G.length;s<u;s++)ka=x.value[G[s]],x.array[D]=ka,x.array[D+1]=ka,x.array[D+2]=ka,D+=3;s=0;for(u=la.length;s<u;s++)ka=x.value[la[s]],x.array[D]=
-ka,x.array[D+1]=ka,x.array[D+2]=ka,x.array[D+3]=ka,D+=4}}else if(x.size===2)if(x.boundTo===void 0||x.boundTo==="vertices"){s=0;for(u=G.length;s<u;s++)C=ma[G[s]],J=x.value[C.a],P=x.value[C.b],y=x.value[C.c],x.array[D]=J.x,x.array[D+1]=J.y,x.array[D+2]=P.x,x.array[D+3]=P.y,x.array[D+4]=y.x,x.array[D+5]=y.y,D+=6;s=0;for(u=la.length;s<u;s++)C=ma[la[s]],J=x.value[C.a],P=x.value[C.b],y=x.value[C.c],C=x.value[C.d],x.array[D]=J.x,x.array[D+1]=J.y,x.array[D+2]=P.x,x.array[D+3]=P.y,x.array[D+4]=y.x,x.array[D+
-5]=y.y,x.array[D+6]=C.x,x.array[D+7]=C.y,D+=8}else{if(x.boundTo==="faces"){s=0;for(u=G.length;s<u;s++)y=P=J=ka=x.value[G[s]],x.array[D]=J.x,x.array[D+1]=J.y,x.array[D+2]=P.x,x.array[D+3]=P.y,x.array[D+4]=y.x,x.array[D+5]=y.y,D+=6;s=0;for(u=la.length;s<u;s++)C=y=P=J=ka=x.value[la[s]],x.array[D]=J.x,x.array[D+1]=J.y,x.array[D+2]=P.x,x.array[D+3]=P.y,x.array[D+4]=y.x,x.array[D+5]=y.y,x.array[D+6]=C.x,x.array[D+7]=C.y,D+=8}}else if(x.size===3)if(S=x.type==="c"?["r","g","b"]:["x","y","z"],x.boundTo===
-void 0||x.boundTo==="vertices"){s=0;for(u=G.length;s<u;s++)C=ma[G[s]],J=x.value[C.a],P=x.value[C.b],y=x.value[C.c],x.array[D]=J[S[0]],x.array[D+1]=J[S[1]],x.array[D+2]=J[S[2]],x.array[D+3]=P[S[0]],x.array[D+4]=P[S[1]],x.array[D+5]=P[S[2]],x.array[D+6]=y[S[0]],x.array[D+7]=y[S[1]],x.array[D+8]=y[S[2]],D+=9;s=0;for(u=la.length;s<u;s++)C=ma[la[s]],J=x.value[C.a],P=x.value[C.b],y=x.value[C.c],C=x.value[C.d],x.array[D]=J[S[0]],x.array[D+1]=J[S[1]],x.array[D+2]=J[S[2]],x.array[D+3]=P[S[0]],x.array[D+4]=
-P[S[1]],x.array[D+5]=P[S[2]],x.array[D+6]=y[S[0]],x.array[D+7]=y[S[1]],x.array[D+8]=y[S[2]],x.array[D+9]=C[S[0]],x.array[D+10]=C[S[1]],x.array[D+11]=C[S[2]],D+=12}else{if(x.boundTo==="faces"){s=0;for(u=G.length;s<u;s++)y=P=J=ka=x.value[G[s]],x.array[D]=J[S[0]],x.array[D+1]=J[S[1]],x.array[D+2]=J[S[2]],x.array[D+3]=P[S[0]],x.array[D+4]=P[S[1]],x.array[D+5]=P[S[2]],x.array[D+6]=y[S[0]],x.array[D+7]=y[S[1]],x.array[D+8]=y[S[2]],D+=9;s=0;for(u=la.length;s<u;s++)C=y=P=J=ka=x.value[la[s]],x.array[D]=J[S[0]],
-x.array[D+1]=J[S[1]],x.array[D+2]=J[S[2]],x.array[D+3]=P[S[0]],x.array[D+4]=P[S[1]],x.array[D+5]=P[S[2]],x.array[D+6]=y[S[0]],x.array[D+7]=y[S[1]],x.array[D+8]=y[S[2]],x.array[D+9]=C[S[0]],x.array[D+10]=C[S[1]],x.array[D+11]=C[S[2]],D+=12}}else if(x.size===4)if(x.boundTo===void 0||x.boundTo==="vertices"){s=0;for(u=G.length;s<u;s++)C=ma[G[s]],J=x.value[C.a],P=x.value[C.b],y=x.value[C.c],x.array[D]=J.x,x.array[D+1]=J.y,x.array[D+2]=J.z,x.array[D+3]=J.w,x.array[D+4]=P.x,x.array[D+5]=P.y,x.array[D+6]=
-P.z,x.array[D+7]=P.w,x.array[D+8]=y.x,x.array[D+9]=y.y,x.array[D+10]=y.z,x.array[D+11]=y.w,D+=12;s=0;for(u=la.length;s<u;s++)C=ma[la[s]],J=x.value[C.a],P=x.value[C.b],y=x.value[C.c],C=x.value[C.d],x.array[D]=J.x,x.array[D+1]=J.y,x.array[D+2]=J.z,x.array[D+3]=J.w,x.array[D+4]=P.x,x.array[D+5]=P.y,x.array[D+6]=P.z,x.array[D+7]=P.w,x.array[D+8]=y.x,x.array[D+9]=y.y,x.array[D+10]=y.z,x.array[D+11]=y.w,x.array[D+12]=C.x,x.array[D+13]=C.y,x.array[D+14]=C.z,x.array[D+15]=C.w,D+=16}else if(x.boundTo==="faces"){s=
-0;for(u=G.length;s<u;s++)y=P=J=ka=x.value[G[s]],x.array[D]=J.x,x.array[D+1]=J.y,x.array[D+2]=J.z,x.array[D+3]=J.w,x.array[D+4]=P.x,x.array[D+5]=P.y,x.array[D+6]=P.z,x.array[D+7]=P.w,x.array[D+8]=y.x,x.array[D+9]=y.y,x.array[D+10]=y.z,x.array[D+11]=y.w,D+=12;s=0;for(u=la.length;s<u;s++)C=y=P=J=ka=x.value[la[s]],x.array[D]=J.x,x.array[D+1]=J.y,x.array[D+2]=J.z,x.array[D+3]=J.w,x.array[D+4]=P.x,x.array[D+5]=P.y,x.array[D+6]=P.z,x.array[D+7]=P.w,x.array[D+8]=y.x,x.array[D+9]=y.y,x.array[D+10]=y.z,x.array[D+
-11]=y.w,x.array[D+12]=C.x,x.array[D+13]=C.y,x.array[D+14]=C.z,x.array[D+15]=C.w,D+=16}j.bindBuffer(j.ARRAY_BUFFER,x.buffer);j.bufferData(j.ARRAY_BUFFER,x.array,K)}}r&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}}m.__dirtyVertices=!1;m.__dirtyMorphTargets=
-!1;m.__dirtyElements=!1;m.__dirtyUvs=!1;m.__dirtyNormals=!1;m.__dirtyColors=!1;m.__dirtyTangents=!1;l.attributes&&t(l)}else if(ca instanceof THREE.Ribbon){if(m.__dirtyVertices||m.__dirtyColors){l=m;ca=j.DYNAMIC_DRAW;S=k=S=r=r=void 0;ea=l.vertices;o=l.colors;s=ea.length;p=o.length;u=l.__vertexArray;K=l.__colorArray;L=l.__dirtyColors;if(l.__dirtyVertices){for(r=0;r<s;r++)S=ea[r].position,k=r*3,u[k]=S.x,u[k+1]=S.y,u[k+2]=S.z;j.bindBuffer(j.ARRAY_BUFFER,l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,
-u,ca)}if(L){for(r=0;r<p;r++)S=o[r],k=r*3,K[k]=S.r,K[k+1]=S.g,K[k+2]=S.b;j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,K,ca)}}m.__dirtyVertices=!1;m.__dirtyColors=!1}else if(ca instanceof THREE.Line){l=c(ca,p);K=l.attributes&&q(l);if(m.__dirtyVertices||m.__dirtyColors||K){ca=m;k=j.DYNAMIC_DRAW;s=o=I=ea=U=void 0;ea=ca.vertices;p=ca.colors;s=ea.length;K=p.length;u=ca.__vertexArray;r=ca.__colorArray;L=ca.__dirtyColors;S=ca.__webglCustomAttributesList;O=ma=la=G=I=U=void 0;
-if(ca.__dirtyVertices){for(U=0;U<s;U++)I=ea[U].position,o=U*3,u[o]=I.x,u[o+1]=I.y,u[o+2]=I.z;j.bindBuffer(j.ARRAY_BUFFER,ca.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,u,k)}if(L){for(ea=0;ea<K;ea++)s=p[ea],o=ea*3,r[o]=s.r,r[o+1]=s.g,r[o+2]=s.b;j.bindBuffer(j.ARRAY_BUFFER,ca.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,r,k)}if(S){U=0;for(I=S.length;U<I;U++)if(O=S[U],O.needsUpdate&&(O.boundTo===void 0||O.boundTo==="vertices")){o=0;la=O.value.length;if(O.size===1)for(G=0;G<la;G++)O.array[G]=
-O.value[G];else if(O.size===2)for(G=0;G<la;G++)ma=O.value[G],O.array[o]=ma.x,O.array[o+1]=ma.y,o+=2;else if(O.size===3)if(O.type==="c")for(G=0;G<la;G++)ma=O.value[G],O.array[o]=ma.r,O.array[o+1]=ma.g,O.array[o+2]=ma.b,o+=3;else for(G=0;G<la;G++)ma=O.value[G],O.array[o]=ma.x,O.array[o+1]=ma.y,O.array[o+2]=ma.z,o+=3;else if(O.size===4)for(G=0;G<la;G++)ma=O.value[G],O.array[o]=ma.x,O.array[o+1]=ma.y,O.array[o+2]=ma.z,O.array[o+3]=ma.w,o+=4;j.bindBuffer(j.ARRAY_BUFFER,O.buffer);j.bufferData(j.ARRAY_BUFFER,
-O.array,k)}}}m.__dirtyVertices=!1;m.__dirtyColors=!1;l.attributes&&t(l)}else if(ca instanceof THREE.ParticleSystem)l=c(ca,p),K=l.attributes&&q(l),(m.__dirtyVertices||m.__dirtyColors||ca.sortParticles||K)&&f(m,j.DYNAMIC_DRAW,ca),m.__dirtyVertices=!1,m.__dirtyColors=!1,l.attributes&&t(l)};this.initMaterial=function(a,b,c,d){var e,f,g,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?
-h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var k,l,m;k=m=i=0;for(l=b.length;k<l;k++)g=b[k],g instanceof THREE.SpotLight&&m++,g instanceof THREE.DirectionalLight&&m++,g instanceof THREE.PointLight&&i++;i+m<=V?k=m:(k=Math.ceil(V*m/(i+
-m)),i=V-k);g={directional:k,point:i};i=m=0;for(k=b.length;i<k;i++)l=b[i],l instanceof THREE.SpotLight&&l.castShadow&&m++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{k=a.fragmentShader;l=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,
-maxPointLights:g.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(k),d.push(l));for(p in c)d.push(p),d.push(c[p]);h=d.join();p=0;for(d=ba.length;p<d;p++)if(ba[p].code===h){o=ba[p].program;break a}p=j.createProgram();d=[za?"#define VERTEX_TEXTURES":"",R.gammaInput?"#define GAMMA_INPUT":
-"",R.gammaOutput?"#define GAMMA_OUTPUT":"",R.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");
+d.uniformsList;i=0;for(c=b.length;i<c;i++)if(j=f.uniforms[b[i][1]])if(m=b[i][0],o=m.type,h=m.value,o==="i")l.uniform1i(j,h);else if(o==="f")l.uniform1f(j,h);else if(o==="v2")l.uniform2f(j,h.x,h.y);else if(o==="v3")l.uniform3f(j,h.x,h.y,h.z);else if(o==="v4")l.uniform4f(j,h.x,h.y,h.z,h.w);else if(o==="c")l.uniform3f(j,h.r,h.g,h.b);else if(o==="fv1")l.uniform1fv(j,h);else if(o==="fv")l.uniform3fv(j,h);else if(o==="v3v"){if(!m._array)m._array=new Float32Array(3*h.length);o=0;for(p=h.length;o<p;o++)q=
+o*3,m._array[q]=h[o].x,m._array[q+1]=h[o].y,m._array[q+2]=h[o].z;l.uniform3fv(j,m._array)}else if(o==="m4"){if(!m._array)m._array=new Float32Array(16);h.flattenToArray(m._array);l.uniformMatrix4fv(j,!1,m._array)}else if(o==="m4v"){if(!m._array)m._array=new Float32Array(16*h.length);o=0;for(p=h.length;o<p;o++)h[o].flattenToArrayOffset(m._array,o*16);l.uniformMatrix4fv(j,!1,m._array)}else if(o==="t"){if(l.uniform1i(j,h),j=m.texture)if(j.image instanceof Array&&j.image.length===6){if(m=j,m.image.length===
+6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=l.createTexture();l.activeTexture(l.TEXTURE0+h);l.bindTexture(l.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);h=s(l.TEXTURE_CUBE_MAP,m,m.image[0]);for(j=0;j<6;j++)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,l.RGBA,l.RGBA,l.UNSIGNED_BYTE,m.image[j]);h&&l.generateMipmap(l.TEXTURE_CUBE_MAP);m.needsUpdate=!1}else l.activeTexture(l.TEXTURE0+h),l.bindTexture(l.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else j instanceof THREE.WebGLRenderTargetCube?
+(m=j,l.activeTexture(l.TEXTURE0+h),l.bindTexture(l.TEXTURE_CUBE_MAP,m.__webglTexture)):R.setTexture(j,h)}else if(o==="tv"){if(!m._array){m._array=[];o=0;for(p=m.texture.length;o<p;o++)m._array[o]=h+o}l.uniform1iv(j,m._array);o=0;for(p=m.texture.length;o<p;o++)(j=m.texture[o])&&R.setTexture(j,m._array[o])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null&&l.uniform3f(g.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||
+d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&g.viewMatrix!==null&&l.uniformMatrix4fv(g.viewMatrix,!1,aa);d.skinning&&(l.uniformMatrix4fv(g.cameraInverseMatrix,!1,aa),l.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}l.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&l.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&g.objectMatrix!==
+null&&l.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function A(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function z(a){if(ia!==a.doubleSided)a.doubleSided?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),ia=a.doubleSided;if(qa!==a.flipSided)a.flipSided?l.frontFace(l.CW):l.frontFace(l.CCW),qa=a.flipSided}function w(a){oa!==a&&(a?l.enable(l.DEPTH_TEST):
+l.disable(l.DEPTH_TEST),oa=a)}function I(a){ta!==a&&(l.depthMask(a),ta=a)}function F(a,b,c){pa!==a&&(a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),pa=a);if(a&&(Ba!==b||wa!==c))l.polygonOffset(b,c),Ba=b,wa=c}function G(a,b){var c;a==="fragment"?c=l.createShader(l.FRAGMENT_SHADER):a==="vertex"&&(c=l.createShader(l.VERTEX_SHADER));l.shaderSource(c,b);l.compileShader(c);if(!l.getShaderParameter(c,l.COMPILE_STATUS))return console.error(l.getShaderInfoLog(c)),console.error(b),null;
+return c}function s(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(l.texParameteri(a,l.TEXTURE_WRAP_S,Q(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,Q(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,Q(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,Q(b.minFilter)),!0):(l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_MAG_FILTER,Z(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,Z(b.minFilter)),
+!1)}function E(a,b){l.bindRenderbuffer(l.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)):l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function T(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=l.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);s(l.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=l.createFramebuffer();a.__webglRenderbuffer[c]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Q(a.format),
+a.width,a.height,0,Q(a.format),Q(a.type),null);var d=a,e=l.TEXTURE_CUBE_MAP_POSITIVE_X+c;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[c]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,e,d.__webglTexture,0);E(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),s(l.TEXTURE_2D,a,a),l.texImage2D(l.TEXTURE_2D,0,Q(a.format),a.width,a.height,0,Q(a.format),Q(a.type),null),
+c=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,c,a.__webglTexture,0),E(a.__webglRenderbuffer,a);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=ea,a=S,d=xa,e=M);b!==fa&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,
+e,c,a),fa=b)}function Z(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return l.NEAREST;default:return l.LINEAR}}function Q(a){switch(a){case THREE.RepeatWrapping:return l.REPEAT;case THREE.ClampToEdgeWrapping:return l.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return l.MIRRORED_REPEAT;case THREE.NearestFilter:return l.NEAREST;case THREE.NearestMipMapNearestFilter:return l.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return l.NEAREST_MIPMAP_LINEAR;
+case THREE.LinearFilter:return l.LINEAR;case THREE.LinearMipMapNearestFilter:return l.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return l.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return l.BYTE;case THREE.UnsignedByteType:return l.UNSIGNED_BYTE;case THREE.ShortType:return l.SHORT;case THREE.UnsignedShortType:return l.UNSIGNED_SHORT;case THREE.IntType:return l.INT;case THREE.UnsignedShortType:return l.UNSIGNED_INT;case THREE.FloatType:return l.FLOAT;case THREE.AlphaFormat:return l.ALPHA;
+case THREE.RGBFormat:return l.RGB;case THREE.RGBAFormat:return l.RGBA;case THREE.LuminanceFormat:return l.LUMINANCE;case THREE.LuminanceAlphaFormat:return l.LUMINANCE_ALPHA}return 0}var a=a||{},U=a.canvas!==void 0?a.canvas:document.createElement("canvas"),$=a.precision!==void 0?a.precision:"highp",ja=a.antialias!==void 0?a.antialias:!1,K=a.stencil!==void 0?a.stencil:!0,L=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,H=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),
+O=a.clearAlpha!==void 0?a.clearAlpha:0,V=a.maxLights!==void 0?a.maxLights:4;this.domElement=U;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.renderPlugins=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var R=this,l,ca=[],N=null,fa=null,W=-1,ba=null,na=0,ia=null,qa=null,ra=null,oa=null,ta=null,pa=null,Ba=null,wa=null,va=null,xa=0,M=0,ea=0,S=0,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Matrix4,P=new Float32Array(16),
+aa=new Float32Array(16),Y=new THREE.Vector4,sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},X,ka=[],da,za;l=function(){var a;try{if(!(a=U.getContext("experimental-webgl",{antialias:ja,stencil:K,preserveDrawingBuffer:L})))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}();
+l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);l.clearColor(H.r,H.g,H.b,O);(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);da=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});za=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
+vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});da._shadowPass=!0;za._shadowPass=!0})();this.context=l;var ya=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return l};this.supportsVertexTextures=function(){return ya};this.setSize=function(a,b){U.width=a;U.height=b;this.setViewport(0,0,U.width,U.height)};this.setViewport=function(a,b,c,d){xa=a;M=b;ea=c;S=d;l.viewport(xa,M,ea,S)};this.setScissor=function(a,b,c,d){l.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?
+l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.setClearColorHex=function(a,b){H.setHex(a);O=b;l.clearColor(H.r,H.g,H.b,O)};this.setClearColor=function(a,b){H.copy(a);O=b;l.clearColor(H.r,H.g,H.b,O)};this.getClearColor=function(){return H};this.getClearAlpha=function(){return O};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=l.COLOR_BUFFER_BIT;if(b===void 0||b)d|=l.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearTarget=function(a,b,c,d){T(a);this.clear(b,
+c,d)};this.addPlugin=function(a){a.init(this);this.renderPlugins.push(a)};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];l.deleteBuffer(c.__webglVertexBuffer);l.deleteBuffer(c.__webglNormalBuffer);l.deleteBuffer(c.__webglTangentBuffer);l.deleteBuffer(c.__webglColorBuffer);
+l.deleteBuffer(c.__webglUVBuffer);l.deleteBuffer(c.__webglUV2Buffer);l.deleteBuffer(c.__webglSkinVertexABuffer);l.deleteBuffer(c.__webglSkinVertexBBuffer);l.deleteBuffer(c.__webglSkinIndicesBuffer);l.deleteBuffer(c.__webglSkinWeightsBuffer);l.deleteBuffer(c.__webglFaceBuffer);l.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)l.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)l.deleteBuffer(c.__webglCustomAttributesList[d].buffer);
+R.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),R.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),R.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),R.info.memory.geometries--};this.deallocateTexture=
+function(a){if(a.__webglInit)a.__webglInit=!1,l.deleteTexture(a.__webglTexture),R.info.memory.textures--};this.updateShadowMap=function(a,b){p(a,b)};this.render=function(a,b,c,d){var e,f,g,h,i=a.lights,n=a.fog;W=-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&&p(a,b);R.info.render.calls=0;R.info.render.vertices=
+0;R.info.render.faces=0;b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(aa);b.projectionMatrix.flattenToArray(P);J.multiply(b.projectionMatrix,b.matrixWorldInverse);j(J);T(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh)||!g.frustumCulled||k(g))){g.matrixWorld.flattenToArray(g._objectMatrixArray);A(g,
+b,!0);var M=f,r=M.object,t=M.buffer,u=void 0,u=u=void 0,u=r.material;if(u instanceof THREE.MeshFaceMaterial){if(u=t.materialIndex,u>=0)u=r.geometry.materials[u],u.transparent?(M.transparent=u,M.opaque=null):(M.opaque=u,M.transparent=null)}else if(u)u.transparent?(M.transparent=u,M.opaque=null):(M.opaque=u,M.transparent=null);f.render=!0;if(this.sortObjects)g.renderDepth?f.z=g.renderDepth:(Y.copy(g.position),J.multiplyVector3(Y),f.z=Y.z)}this.sortObjects&&h.sort(o);h=a.__webglObjectsImmediate;d=0;
+for(e=h.length;d<e;d++)if(f=h[d],g=f.object,g.visible)g.matrixAutoUpdate&&g.matrixWorld.flattenToArray(g._objectMatrixArray),A(g,b,!0),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),w(a.overrideMaterial.depthTest),I(a.overrideMaterial.depthWrite),F(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),m(a.__webglObjects,!1,"",
+b,i,n,!0,a.overrideMaterial),q(a.__webglObjectsImmediate,"",b,i,n,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),m(a.__webglObjects,!0,"opaque",b,i,n,!1),q(a.__webglObjectsImmediate,"opaque",b,i,n,!1),m(a.__webglObjects,!1,"transparent",b,i,n,!0),q(a.__webglObjectsImmediate,"transparent",b,i,n,!0));if(this.renderPlugins.length){d=0;for(e=this.renderPlugins.length;d<e;d++)this.renderPlugins[d].render(a,b,ea,S,P),N=null,ba=ta=oa=ra=-1}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==
+THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,c.__webglTexture),l.generateMipmap(l.TEXTURE_CUBE_MAP),l.bindTexture(l.TEXTURE_CUBE_MAP,null)):(l.bindTexture(l.TEXTURE_2D,c.__webglTexture),l.generateMipmap(l.TEXTURE_2D),l.bindTexture(l.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],
+i=a,k=void 0,m=void 0,j=void 0;if(!h.__webglInit)if(h.__webglInit=!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){m=h.geometry;if(m.geometryGroups===void 0){var j=m,o=void 0,p=void 0,M=void 0,q=void 0,S=void 0,ea=void 0,s=void 0,v={},ha=j.morphTargets.length;j.geometryGroups={};o=0;for(p=j.faces.length;o<
+p;o++)M=j.faces[o],q=M.materialIndex,ea=q!==void 0?q:-1,v[ea]===void 0&&(v[ea]={hash:ea,counter:0}),s=v[ea].hash+"_"+v[ea].counter,j.geometryGroups[s]===void 0&&(j.geometryGroups[s]={faces3:[],faces4:[],materialIndex:q,vertices:0,numMorphTargets:ha}),S=M instanceof THREE.Face3?3:4,j.geometryGroups[s].vertices+S>65535&&(v[ea].counter+=1,s=v[ea].hash+"_"+v[ea].counter,j.geometryGroups[s]===void 0&&(j.geometryGroups[s]={faces3:[],faces4:[],materialIndex:q,vertices:0,numMorphTargets:ha})),M instanceof
+THREE.Face3?j.geometryGroups[s].faces3.push(o):j.geometryGroups[s].faces4.push(o),j.geometryGroups[s].vertices+=S;j.geometryGroupsList=[];o=void 0;for(o in j.geometryGroups)j.geometryGroups[o].id=na++,j.geometryGroupsList.push(j.geometryGroups[o])}for(k in m.geometryGroups)if(j=m.geometryGroups[k],!j.__webglVertexBuffer){o=j;o.__webglVertexBuffer=l.createBuffer();o.__webglNormalBuffer=l.createBuffer();o.__webglTangentBuffer=l.createBuffer();o.__webglColorBuffer=l.createBuffer();o.__webglUVBuffer=
+l.createBuffer();o.__webglUV2Buffer=l.createBuffer();o.__webglSkinVertexABuffer=l.createBuffer();o.__webglSkinVertexBBuffer=l.createBuffer();o.__webglSkinIndicesBuffer=l.createBuffer();o.__webglSkinWeightsBuffer=l.createBuffer();o.__webglFaceBuffer=l.createBuffer();o.__webglLineBuffer=l.createBuffer();if(o.numMorphTargets){M=p=void 0;o.__webglMorphTargetsBuffers=[];p=0;for(M=o.numMorphTargets;p<M;p++)o.__webglMorphTargetsBuffers.push(l.createBuffer())}R.info.memory.geometries++;q=h;S=q.geometry;p=
+j.faces3;ea=j.faces4;o=p.length*3+ea.length*4;M=p.length*1+ea.length*2;ea=p.length*3+ea.length*4;p=c(q,j);s=g(p);v=d(p);ha=e(p);j.__vertexArray=new Float32Array(o*3);if(v)j.__normalArray=new Float32Array(o*3);if(S.hasTangents)j.__tangentArray=new Float32Array(o*4);if(ha)j.__colorArray=new Float32Array(o*3);if(s){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(q.geometry.skinWeights.length&&
+q.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(M*3);j.__lineArray=new Uint16Array(ea*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];q=0;for(S=j.numMorphTargets;q<S;q++)j.__morphTargetsArrays.push(new Float32Array(o*3))}j.__webglFaceCount=M*3;j.__webglLineCount=ea*2;if(p.attributes){if(j.__webglCustomAttributesList===
+void 0)j.__webglCustomAttributesList=[];M=void 0;for(M in p.attributes){var q=p.attributes[M],S={},G;for(G in q)S[G]=q[G];if(!S.__webglInitialized||S.createUniqueBuffers)S.__webglInitialized=!0,ea=1,S.type==="v2"?ea=2:S.type==="v3"?ea=3:S.type==="v4"?ea=4:S.type==="c"&&(ea=3),S.size=ea,S.array=new Float32Array(o*ea),S.buffer=l.createBuffer(),S.buffer.belongsToAttribute=M,q.needsUpdate=!0,S.__original=q;j.__webglCustomAttributesList.push(S)}}j.__inittedArrays=!0;m.__dirtyVertices=!0;m.__dirtyMorphTargets=
+!0;m.__dirtyElements=!0;m.__dirtyUvs=!0;m.__dirtyNormals=!0;m.__dirtyTangents=!0;m.__dirtyColors=!0}}else if(h instanceof THREE.Ribbon){if(m=h.geometry,!m.__webglVertexBuffer)j=m,j.__webglVertexBuffer=l.createBuffer(),j.__webglColorBuffer=l.createBuffer(),R.info.memory.geometries++,j=m,o=j.vertices.length,j.__vertexArray=new Float32Array(o*3),j.__colorArray=new Float32Array(o*3),j.__webglVertexCount=o,m.__dirtyVertices=!0,m.__dirtyColors=!0}else if(h instanceof THREE.Line){if(m=h.geometry,!m.__webglVertexBuffer)j=
+m,j.__webglVertexBuffer=l.createBuffer(),j.__webglColorBuffer=l.createBuffer(),R.info.memory.geometries++,j=m,o=h,p=j.vertices.length,j.__vertexArray=new Float32Array(p*3),j.__colorArray=new Float32Array(p*3),j.__webglLineCount=p,b(j,o),m.__dirtyVertices=!0,m.__dirtyColors=!0}else if(h instanceof THREE.ParticleSystem&&(m=h.geometry,!m.__webglVertexBuffer))j=m,j.__webglVertexBuffer=l.createBuffer(),j.__webglColorBuffer=l.createBuffer(),R.info.geometries++,j=m,o=h,p=j.vertices.length,j.__vertexArray=
+new Float32Array(p*3),j.__colorArray=new Float32Array(p*3),j.__sortArray=[],j.__webglParticleCount=p,b(j,o),m.__dirtyVertices=!0,m.__dirtyColors=!0;if(!h.__webglActive){if(h instanceof THREE.Mesh)for(k in m=h.geometry,m.geometryGroups)j=m.geometryGroups[k],n(i.__webglObjects,j,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(m=h.geometry,n(i.__webglObjects,m,h)):THREE.MarchingCubes!==void 0&&h instanceof THREE.MarchingCubes||h.immediateRenderCallback?
+i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)h=a.__objectsRemoved[0],i=a,h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem||h instanceof THREE.Ribbon||h instanceof THREE.Line?u(i.__webglObjects,h):h instanceof THREE.Sprite?y(i.__webglSprites,h):h instanceof THREE.LensFlare?y(i.__webglFlares,
+h):(h instanceof THREE.MarchingCubes||h.immediateRenderCallback)&&u(i.__webglObjectsImmediate,h),h.__webglActive=!1,a.__objectsRemoved.splice(0,1);h=0;for(i=a.__webglObjects.length;h<i;h++)if(G=a.__webglObjects[h].object,k=G.geometry,m=M=p=void 0,G instanceof THREE.Mesh){j=0;for(o=k.geometryGroupsList.length;j<o;j++)if(p=k.geometryGroupsList[j],m=c(G,p),M=m.attributes&&r(m),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||
+M){var E=G,M=l.DYNAMIC_DRAW,q=!k.dynamic,s=m;if(p.__inittedArrays){var S=d(s),ea=e(s),T=g(s),H=S===THREE.SmoothShading,z=v=s=void 0,C=void 0,A=void 0,L=void 0,D=void 0,O=void 0,F=void 0,I=z=void 0,w=void 0,J=void 0,P=void 0,K=C=void 0,U=void 0,V=void 0,Q=C=F=void 0,aa=void 0,Z=P=J=w=D=void 0,Y=C=P=J=w=Z=P=J=w=Z=P=J=w=void 0,N=void 0,$=L=void 0,ca=void 0,X=void 0,fa=void 0,W=void 0,ba=I=X=N=0,ja=0,sa=Y=z=0,da=D=K=0,B=0,ka=void 0,da=p.__vertexArray,ca=p.__uvArray,B=p.__uv2Array,$=p.__normalArray,A=
+p.__tangentArray,U=p.__colorArray,Q=p.__skinVertexAArray,aa=p.__skinVertexBArray,O=p.__skinIndexArray,ia=p.__skinWeightArray,Z=p.__morphTargetsArrays,ha=p.__webglCustomAttributesList,x=void 0,x=p.__faceArray,ka=p.__lineArray,V=E.geometry,ya=V.__dirtyElements,qa=V.__dirtyUvs,L=V.__dirtyNormals,F=V.__dirtyTangents,ra=V.__dirtyColors,fa=V.__dirtyMorphTargets,W=V.vertices,E=p.faces3,la=p.faces4,ma=V.faces,pa=V.faceVertexUvs[0],ta=V.faceVertexUvs[1],oa=V.skinVerticesA,za=V.skinVerticesB,va=V.skinIndices,
+wa=V.skinWeights,xa=V.morphTargets;if(V.__dirtyVertices){s=0;for(v=E.length;s<v;s++)C=ma[E[s]],w=W[C.a].position,J=W[C.b].position,P=W[C.c].position,da[X]=w.x,da[X+1]=w.y,da[X+2]=w.z,da[X+3]=J.x,da[X+4]=J.y,da[X+5]=J.z,da[X+6]=P.x,da[X+7]=P.y,da[X+8]=P.z,X+=9;s=0;for(v=la.length;s<v;s++)C=ma[la[s]],w=W[C.a].position,J=W[C.b].position,P=W[C.c].position,C=W[C.d].position,da[X]=w.x,da[X+1]=w.y,da[X+2]=w.z,da[X+3]=J.x,da[X+4]=J.y,da[X+5]=J.z,da[X+6]=P.x,da[X+7]=P.y,da[X+8]=P.z,da[X+9]=C.x,da[X+10]=C.y,
+da[X+11]=C.z,X+=12;l.bindBuffer(l.ARRAY_BUFFER,p.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,da,M)}if(fa){X=0;for(fa=xa.length;X<fa;X++){s=da=0;for(v=E.length;s<v;s++)C=ma[E[s]],w=xa[X].vertices[C.a].position,J=xa[X].vertices[C.b].position,P=xa[X].vertices[C.c].position,W=Z[X],W[da]=w.x,W[da+1]=w.y,W[da+2]=w.z,W[da+3]=J.x,W[da+4]=J.y,W[da+5]=J.z,W[da+6]=P.x,W[da+7]=P.y,W[da+8]=P.z,da+=9;s=0;for(v=la.length;s<v;s++)C=ma[la[s]],w=xa[X].vertices[C.a].position,J=xa[X].vertices[C.b].position,P=xa[X].vertices[C.c].position,
+C=xa[X].vertices[C.d].position,W=Z[X],W[da]=w.x,W[da+1]=w.y,W[da+2]=w.z,W[da+3]=J.x,W[da+4]=J.y,W[da+5]=J.z,W[da+6]=P.x,W[da+7]=P.y,W[da+8]=P.z,W[da+9]=C.x,W[da+10]=C.y,W[da+11]=C.z,da+=12;l.bindBuffer(l.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[X]);l.bufferData(l.ARRAY_BUFFER,Z[X],M)}}if(wa.length){s=0;for(v=E.length;s<v;s++)C=ma[E[s]],w=wa[C.a],J=wa[C.b],P=wa[C.c],ia[D]=w.x,ia[D+1]=w.y,ia[D+2]=w.z,ia[D+3]=w.w,ia[D+4]=J.x,ia[D+5]=J.y,ia[D+6]=J.z,ia[D+7]=J.w,ia[D+8]=P.x,ia[D+9]=P.y,ia[D+10]=P.z,ia[D+
+11]=P.w,w=va[C.a],J=va[C.b],P=va[C.c],O[D]=w.x,O[D+1]=w.y,O[D+2]=w.z,O[D+3]=w.w,O[D+4]=J.x,O[D+5]=J.y,O[D+6]=J.z,O[D+7]=J.w,O[D+8]=P.x,O[D+9]=P.y,O[D+10]=P.z,O[D+11]=P.w,w=oa[C.a],J=oa[C.b],P=oa[C.c],Q[D]=w.x,Q[D+1]=w.y,Q[D+2]=w.z,Q[D+3]=1,Q[D+4]=J.x,Q[D+5]=J.y,Q[D+6]=J.z,Q[D+7]=1,Q[D+8]=P.x,Q[D+9]=P.y,Q[D+10]=P.z,Q[D+11]=1,w=za[C.a],J=za[C.b],P=za[C.c],aa[D]=w.x,aa[D+1]=w.y,aa[D+2]=w.z,aa[D+3]=1,aa[D+4]=J.x,aa[D+5]=J.y,aa[D+6]=J.z,aa[D+7]=1,aa[D+8]=P.x,aa[D+9]=P.y,aa[D+10]=P.z,aa[D+11]=1,D+=12;s=
+0;for(v=la.length;s<v;s++)C=ma[la[s]],w=wa[C.a],J=wa[C.b],P=wa[C.c],Z=wa[C.d],ia[D]=w.x,ia[D+1]=w.y,ia[D+2]=w.z,ia[D+3]=w.w,ia[D+4]=J.x,ia[D+5]=J.y,ia[D+6]=J.z,ia[D+7]=J.w,ia[D+8]=P.x,ia[D+9]=P.y,ia[D+10]=P.z,ia[D+11]=P.w,ia[D+12]=Z.x,ia[D+13]=Z.y,ia[D+14]=Z.z,ia[D+15]=Z.w,w=va[C.a],J=va[C.b],P=va[C.c],Z=va[C.d],O[D]=w.x,O[D+1]=w.y,O[D+2]=w.z,O[D+3]=w.w,O[D+4]=J.x,O[D+5]=J.y,O[D+6]=J.z,O[D+7]=J.w,O[D+8]=P.x,O[D+9]=P.y,O[D+10]=P.z,O[D+11]=P.w,O[D+12]=Z.x,O[D+13]=Z.y,O[D+14]=Z.z,O[D+15]=Z.w,w=oa[C.a],
+J=oa[C.b],P=oa[C.c],Z=oa[C.d],Q[D]=w.x,Q[D+1]=w.y,Q[D+2]=w.z,Q[D+3]=1,Q[D+4]=J.x,Q[D+5]=J.y,Q[D+6]=J.z,Q[D+7]=1,Q[D+8]=P.x,Q[D+9]=P.y,Q[D+10]=P.z,Q[D+11]=1,Q[D+12]=Z.x,Q[D+13]=Z.y,Q[D+14]=Z.z,Q[D+15]=1,w=za[C.a],J=za[C.b],P=za[C.c],C=za[C.d],aa[D]=w.x,aa[D+1]=w.y,aa[D+2]=w.z,aa[D+3]=1,aa[D+4]=J.x,aa[D+5]=J.y,aa[D+6]=J.z,aa[D+7]=1,aa[D+8]=P.x,aa[D+9]=P.y,aa[D+10]=P.z,aa[D+11]=1,aa[D+12]=C.x,aa[D+13]=C.y,aa[D+14]=C.z,aa[D+15]=1,D+=16;D>0&&(l.bindBuffer(l.ARRAY_BUFFER,p.__webglSkinVertexABuffer),l.bufferData(l.ARRAY_BUFFER,
+Q,M),l.bindBuffer(l.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),l.bufferData(l.ARRAY_BUFFER,aa,M),l.bindBuffer(l.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,O,M),l.bindBuffer(l.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,ia,M))}if(ra&&ea){s=0;for(v=E.length;s<v;s++)C=ma[E[s]],D=C.vertexColors,O=C.color,D.length===3&&ea===THREE.VertexColors?(C=D[0],Q=D[1],aa=D[2]):aa=Q=C=O,U[K]=C.r,U[K+1]=C.g,U[K+2]=C.b,U[K+3]=Q.r,U[K+4]=Q.g,U[K+5]=Q.b,U[K+6]=aa.r,U[K+
+7]=aa.g,U[K+8]=aa.b,K+=9;s=0;for(v=la.length;s<v;s++)C=ma[la[s]],D=C.vertexColors,O=C.color,D.length===4&&ea===THREE.VertexColors?(C=D[0],Q=D[1],aa=D[2],D=D[3]):D=aa=Q=C=O,U[K]=C.r,U[K+1]=C.g,U[K+2]=C.b,U[K+3]=Q.r,U[K+4]=Q.g,U[K+5]=Q.b,U[K+6]=aa.r,U[K+7]=aa.g,U[K+8]=aa.b,U[K+9]=D.r,U[K+10]=D.g,U[K+11]=D.b,K+=12;K>0&&(l.bindBuffer(l.ARRAY_BUFFER,p.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,U,M))}if(F&&V.hasTangents){s=0;for(v=E.length;s<v;s++)C=ma[E[s]],F=C.vertexTangents,K=F[0],U=F[1],V=F[2],
+A[Y]=K.x,A[Y+1]=K.y,A[Y+2]=K.z,A[Y+3]=K.w,A[Y+4]=U.x,A[Y+5]=U.y,A[Y+6]=U.z,A[Y+7]=U.w,A[Y+8]=V.x,A[Y+9]=V.y,A[Y+10]=V.z,A[Y+11]=V.w,Y+=12;s=0;for(v=la.length;s<v;s++)C=ma[la[s]],F=C.vertexTangents,K=F[0],U=F[1],V=F[2],F=F[3],A[Y]=K.x,A[Y+1]=K.y,A[Y+2]=K.z,A[Y+3]=K.w,A[Y+4]=U.x,A[Y+5]=U.y,A[Y+6]=U.z,A[Y+7]=U.w,A[Y+8]=V.x,A[Y+9]=V.y,A[Y+10]=V.z,A[Y+11]=V.w,A[Y+12]=F.x,A[Y+13]=F.y,A[Y+14]=F.z,A[Y+15]=F.w,Y+=16;l.bindBuffer(l.ARRAY_BUFFER,p.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,A,M)}if(L&&
+S){s=0;for(v=E.length;s<v;s++)if(C=ma[E[s]],A=C.vertexNormals,L=C.normal,A.length===3&&H)for(Y=0;Y<3;Y++)L=A[Y],$[z]=L.x,$[z+1]=L.y,$[z+2]=L.z,z+=3;else for(Y=0;Y<3;Y++)$[z]=L.x,$[z+1]=L.y,$[z+2]=L.z,z+=3;s=0;for(v=la.length;s<v;s++)if(C=ma[la[s]],A=C.vertexNormals,L=C.normal,A.length===4&&H)for(Y=0;Y<4;Y++)L=A[Y],$[z]=L.x,$[z+1]=L.y,$[z+2]=L.z,z+=3;else for(Y=0;Y<4;Y++)$[z]=L.x,$[z+1]=L.y,$[z+2]=L.z,z+=3;l.bindBuffer(l.ARRAY_BUFFER,p.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,$,M)}if(qa&&pa&&
+T){s=0;for(v=E.length;s<v;s++)if(z=E[s],z=pa[z],z!==void 0)for(Y=0;Y<3;Y++)$=z[Y],ca[I]=$.u,ca[I+1]=$.v,I+=2;s=0;for(v=la.length;s<v;s++)if(z=la[s],z=pa[z],z!==void 0)for(Y=0;Y<4;Y++)$=z[Y],ca[I]=$.u,ca[I+1]=$.v,I+=2;I>0&&(l.bindBuffer(l.ARRAY_BUFFER,p.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,ca,M))}if(qa&&ta&&T){s=0;for(v=E.length;s<v;s++)if(z=E[s],I=ta[z],I!==void 0)for(Y=0;Y<3;Y++)ca=I[Y],B[ba]=ca.u,B[ba+1]=ca.v,ba+=2;s=0;for(v=la.length;s<v;s++)if(z=la[s],I=ta[z],I!==void 0)for(Y=0;Y<4;Y++)ca=
+I[Y],B[ba]=ca.u,B[ba+1]=ca.v,ba+=2;ba>0&&(l.bindBuffer(l.ARRAY_BUFFER,p.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,B,M))}if(ya){s=0;for(v=E.length;s<v;s++)x[ja]=N,x[ja+1]=N+1,x[ja+2]=N+2,ja+=3,ka[sa]=N,ka[sa+1]=N+1,ka[sa+2]=N,ka[sa+3]=N+2,ka[sa+4]=N+1,ka[sa+5]=N+2,sa+=6,N+=3;s=0;for(v=la.length;s<v;s++)x[ja]=N,x[ja+1]=N+1,x[ja+2]=N+3,x[ja+3]=N+1,x[ja+4]=N+2,x[ja+5]=N+3,ja+=6,ka[sa]=N,ka[sa+1]=N+1,ka[sa+2]=N,ka[sa+3]=N+3,ka[sa+4]=N+1,ka[sa+5]=N+2,ka[sa+6]=N+2,ka[sa+7]=N+3,sa+=8,N+=4;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,
+p.__webglFaceBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,x,M);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,ka,M)}if(ha){Y=0;for(N=ha.length;Y<N;Y++)if(x=ha[Y],x.__original.needsUpdate){B=0;if(x.size===1)if(x.boundTo===void 0||x.boundTo==="vertices"){s=0;for(v=E.length;s<v;s++)C=ma[E[s]],x.array[B]=x.value[C.a],x.array[B+1]=x.value[C.b],x.array[B+2]=x.value[C.c],B+=3;s=0;for(v=la.length;s<v;s++)C=ma[la[s]],x.array[B]=x.value[C.a],x.array[B+1]=x.value[C.b],
+x.array[B+2]=x.value[C.c],x.array[B+3]=x.value[C.d],B+=4}else{if(x.boundTo==="faces"){s=0;for(v=E.length;s<v;s++)ka=x.value[E[s]],x.array[B]=ka,x.array[B+1]=ka,x.array[B+2]=ka,B+=3;s=0;for(v=la.length;s<v;s++)ka=x.value[la[s]],x.array[B]=ka,x.array[B+1]=ka,x.array[B+2]=ka,x.array[B+3]=ka,B+=4}}else if(x.size===2)if(x.boundTo===void 0||x.boundTo==="vertices"){s=0;for(v=E.length;s<v;s++)C=ma[E[s]],w=x.value[C.a],J=x.value[C.b],P=x.value[C.c],x.array[B]=w.x,x.array[B+1]=w.y,x.array[B+2]=J.x,x.array[B+
+3]=J.y,x.array[B+4]=P.x,x.array[B+5]=P.y,B+=6;s=0;for(v=la.length;s<v;s++)C=ma[la[s]],w=x.value[C.a],J=x.value[C.b],P=x.value[C.c],C=x.value[C.d],x.array[B]=w.x,x.array[B+1]=w.y,x.array[B+2]=J.x,x.array[B+3]=J.y,x.array[B+4]=P.x,x.array[B+5]=P.y,x.array[B+6]=C.x,x.array[B+7]=C.y,B+=8}else{if(x.boundTo==="faces"){s=0;for(v=E.length;s<v;s++)P=J=w=ka=x.value[E[s]],x.array[B]=w.x,x.array[B+1]=w.y,x.array[B+2]=J.x,x.array[B+3]=J.y,x.array[B+4]=P.x,x.array[B+5]=P.y,B+=6;s=0;for(v=la.length;s<v;s++)C=P=
+J=w=ka=x.value[la[s]],x.array[B]=w.x,x.array[B+1]=w.y,x.array[B+2]=J.x,x.array[B+3]=J.y,x.array[B+4]=P.x,x.array[B+5]=P.y,x.array[B+6]=C.x,x.array[B+7]=C.y,B+=8}}else if(x.size===3)if(S=x.type==="c"?["r","g","b"]:["x","y","z"],x.boundTo===void 0||x.boundTo==="vertices"){s=0;for(v=E.length;s<v;s++)C=ma[E[s]],w=x.value[C.a],J=x.value[C.b],P=x.value[C.c],x.array[B]=w[S[0]],x.array[B+1]=w[S[1]],x.array[B+2]=w[S[2]],x.array[B+3]=J[S[0]],x.array[B+4]=J[S[1]],x.array[B+5]=J[S[2]],x.array[B+6]=P[S[0]],x.array[B+
+7]=P[S[1]],x.array[B+8]=P[S[2]],B+=9;s=0;for(v=la.length;s<v;s++)C=ma[la[s]],w=x.value[C.a],J=x.value[C.b],P=x.value[C.c],C=x.value[C.d],x.array[B]=w[S[0]],x.array[B+1]=w[S[1]],x.array[B+2]=w[S[2]],x.array[B+3]=J[S[0]],x.array[B+4]=J[S[1]],x.array[B+5]=J[S[2]],x.array[B+6]=P[S[0]],x.array[B+7]=P[S[1]],x.array[B+8]=P[S[2]],x.array[B+9]=C[S[0]],x.array[B+10]=C[S[1]],x.array[B+11]=C[S[2]],B+=12}else{if(x.boundTo==="faces"){s=0;for(v=E.length;s<v;s++)P=J=w=ka=x.value[E[s]],x.array[B]=w[S[0]],x.array[B+
+1]=w[S[1]],x.array[B+2]=w[S[2]],x.array[B+3]=J[S[0]],x.array[B+4]=J[S[1]],x.array[B+5]=J[S[2]],x.array[B+6]=P[S[0]],x.array[B+7]=P[S[1]],x.array[B+8]=P[S[2]],B+=9;s=0;for(v=la.length;s<v;s++)C=P=J=w=ka=x.value[la[s]],x.array[B]=w[S[0]],x.array[B+1]=w[S[1]],x.array[B+2]=w[S[2]],x.array[B+3]=J[S[0]],x.array[B+4]=J[S[1]],x.array[B+5]=J[S[2]],x.array[B+6]=P[S[0]],x.array[B+7]=P[S[1]],x.array[B+8]=P[S[2]],x.array[B+9]=C[S[0]],x.array[B+10]=C[S[1]],x.array[B+11]=C[S[2]],B+=12}}else if(x.size===4)if(x.boundTo===
+void 0||x.boundTo==="vertices"){s=0;for(v=E.length;s<v;s++)C=ma[E[s]],w=x.value[C.a],J=x.value[C.b],P=x.value[C.c],x.array[B]=w.x,x.array[B+1]=w.y,x.array[B+2]=w.z,x.array[B+3]=w.w,x.array[B+4]=J.x,x.array[B+5]=J.y,x.array[B+6]=J.z,x.array[B+7]=J.w,x.array[B+8]=P.x,x.array[B+9]=P.y,x.array[B+10]=P.z,x.array[B+11]=P.w,B+=12;s=0;for(v=la.length;s<v;s++)C=ma[la[s]],w=x.value[C.a],J=x.value[C.b],P=x.value[C.c],C=x.value[C.d],x.array[B]=w.x,x.array[B+1]=w.y,x.array[B+2]=w.z,x.array[B+3]=w.w,x.array[B+
+4]=J.x,x.array[B+5]=J.y,x.array[B+6]=J.z,x.array[B+7]=J.w,x.array[B+8]=P.x,x.array[B+9]=P.y,x.array[B+10]=P.z,x.array[B+11]=P.w,x.array[B+12]=C.x,x.array[B+13]=C.y,x.array[B+14]=C.z,x.array[B+15]=C.w,B+=16}else if(x.boundTo==="faces"){s=0;for(v=E.length;s<v;s++)P=J=w=ka=x.value[E[s]],x.array[B]=w.x,x.array[B+1]=w.y,x.array[B+2]=w.z,x.array[B+3]=w.w,x.array[B+4]=J.x,x.array[B+5]=J.y,x.array[B+6]=J.z,x.array[B+7]=J.w,x.array[B+8]=P.x,x.array[B+9]=P.y,x.array[B+10]=P.z,x.array[B+11]=P.w,B+=12;s=0;for(v=
+la.length;s<v;s++)C=P=J=w=ka=x.value[la[s]],x.array[B]=w.x,x.array[B+1]=w.y,x.array[B+2]=w.z,x.array[B+3]=w.w,x.array[B+4]=J.x,x.array[B+5]=J.y,x.array[B+6]=J.z,x.array[B+7]=J.w,x.array[B+8]=P.x,x.array[B+9]=P.y,x.array[B+10]=P.z,x.array[B+11]=P.w,x.array[B+12]=C.x,x.array[B+13]=C.y,x.array[B+14]=C.z,x.array[B+15]=C.w,B+=16}l.bindBuffer(l.ARRAY_BUFFER,x.buffer);l.bufferData(l.ARRAY_BUFFER,x.array,M)}}q&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,
+delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyColors=!1;k.__dirtyTangents=!1;m.attributes&&t(m)}else if(G instanceof THREE.Ribbon){if(k.__dirtyVertices||k.__dirtyColors){m=k;G=l.DYNAMIC_DRAW;S=j=S=q=q=void 0;ea=m.vertices;
+o=m.colors;s=ea.length;p=o.length;v=m.__vertexArray;M=m.__colorArray;ha=m.__dirtyColors;if(m.__dirtyVertices){for(q=0;q<s;q++)S=ea[q].position,j=q*3,v[j]=S.x,v[j+1]=S.y,v[j+2]=S.z;l.bindBuffer(l.ARRAY_BUFFER,m.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,v,G)}if(ha){for(q=0;q<p;q++)S=o[q],j=q*3,M[j]=S.r,M[j+1]=S.g,M[j+2]=S.b;l.bindBuffer(l.ARRAY_BUFFER,m.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,M,G)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(G instanceof THREE.Line){m=c(G,p);M=m.attributes&&
+r(m);if(k.__dirtyVertices||k.__dirtyColors||M){G=k;j=l.DYNAMIC_DRAW;s=o=H=ea=T=void 0;ea=G.vertices;p=G.colors;s=ea.length;M=p.length;v=G.__vertexArray;q=G.__colorArray;ha=G.__dirtyColors;S=G.__webglCustomAttributesList;N=ma=la=E=H=T=void 0;if(G.__dirtyVertices){for(T=0;T<s;T++)H=ea[T].position,o=T*3,v[o]=H.x,v[o+1]=H.y,v[o+2]=H.z;l.bindBuffer(l.ARRAY_BUFFER,G.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,v,j)}if(ha){for(ea=0;ea<M;ea++)s=p[ea],o=ea*3,q[o]=s.r,q[o+1]=s.g,q[o+2]=s.b;l.bindBuffer(l.ARRAY_BUFFER,
+G.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,q,j)}if(S){T=0;for(H=S.length;T<H;T++)if(N=S[T],N.needsUpdate&&(N.boundTo===void 0||N.boundTo==="vertices")){o=0;la=N.value.length;if(N.size===1)for(E=0;E<la;E++)N.array[E]=N.value[E];else if(N.size===2)for(E=0;E<la;E++)ma=N.value[E],N.array[o]=ma.x,N.array[o+1]=ma.y,o+=2;else if(N.size===3)if(N.type==="c")for(E=0;E<la;E++)ma=N.value[E],N.array[o]=ma.r,N.array[o+1]=ma.g,N.array[o+2]=ma.b,o+=3;else for(E=0;E<la;E++)ma=N.value[E],N.array[o]=ma.x,N.array[o+
+1]=ma.y,N.array[o+2]=ma.z,o+=3;else if(N.size===4)for(E=0;E<la;E++)ma=N.value[E],N.array[o]=ma.x,N.array[o+1]=ma.y,N.array[o+2]=ma.z,N.array[o+3]=ma.w,o+=4;l.bindBuffer(l.ARRAY_BUFFER,N.buffer);l.bufferData(l.ARRAY_BUFFER,N.array,j)}}}k.__dirtyVertices=!1;k.__dirtyColors=!1;m.attributes&&t(m)}else if(G instanceof THREE.ParticleSystem)m=c(G,p),M=m.attributes&&r(m),(k.__dirtyVertices||k.__dirtyColors||G.sortParticles||M)&&f(k,l.DYNAMIC_DRAW,G),k.__dirtyVertices=!1,k.__dirtyColors=!1,m.attributes&&t(m)};
+this.initMaterial=function(a,b,c,d){var e,f,g,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;
+a.fragmentShader=i.fragmentShader}var j,m,k;j=k=i=0;for(m=b.length;j<m;j++)g=b[j],g instanceof THREE.SpotLight&&k++,g instanceof THREE.DirectionalLight&&k++,g instanceof THREE.PointLight&&i++;i+k<=V?j=k:(j=Math.ceil(V*k/(i+k)),i=V-j);g={directional:j,point:i};i=k=0;for(j=b.length;i<j;i++)m=b[i],m instanceof THREE.SpotLight&&m.castShadow&&k++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{j=a.fragmentShader;m=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,
+envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:k,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=
+[];h?d.push(h):(d.push(j),d.push(m));for(p in c)d.push(p),d.push(c[p]);h=d.join();p=0;for(d=ca.length;p<d;p++)if(ca[p].code===h){o=ca[p].program;break a}p=l.createProgram();d=[ya?"#define VERTEX_TEXTURES":"",R.gammaInput?"#define GAMMA_INPUT":"",R.gammaOutput?"#define GAMMA_OUTPUT":"",R.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");
 g=["#ifdef GL_ES","precision "+$+" 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:"",R.gammaInput?"#define GAMMA_INPUT":"",R.gammaOutput?"#define GAMMA_OUTPUT":"",R.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
-"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(p,L("fragment",g+k));j.attachShader(p,
-L("vertex",d+l));j.linkProgram(p);j.getProgramParameter(p,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(p,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");p.uniforms={};p.attributes={};var K,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(K in i)d.push(K);K=d;d=0;for(i=K.length;d<i;d++)k=K[d],p.uniforms[k]=j.getUniformLocation(p,
-k);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(K=0;K<c.maxMorphTargets;K++)d.push("morphTarget"+K);for(o in b)d.push(o);o=d;K=0;for(b=o.length;K<b;K++)c=o[K],p.attributes[c]=j.getAttribLocation(p,c);p.id=ba.length;ba.push({program:p,code:h});R.info.memory.programs=ba.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=0&&j.enableVertexAttribArray(o.normal);
-o.tangent>=0&&j.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(j.enableVertexAttribArray(o.skinVertexA),j.enableVertexAttribArray(o.skinVertexB),j.enableVertexAttribArray(o.skinIndex),j.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(f in a.attributes)o[f]!==void 0&&o[f]>=0&&j.enableVertexAttribArray(o[f]);if(a.morphTargets)for(f=a.numSupportedMorphTargets=0;f<this.maxMorphTargets;f++)K="morphTarget"+f,o[K]>=0&&(j.enableVertexAttribArray(o[K]),
-a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),a==="back"?j.cullFace(j.BACK):a==="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.setBlending=function(a){if(a!==oa){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);
-j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}oa=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),R.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);
-var c=s(j.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,Q(a.format),a.image.width,a.image.height,0,Q(a.format),j.UNSIGNED_BYTE,a.image.data):j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,a.image);c&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)}};
+"",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");l.attachShader(p,G("fragment",g+j));l.attachShader(p,
+G("vertex",d+m));l.linkProgram(p);l.getProgramParameter(p,l.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+l.getProgramParameter(p,l.VALIDATE_STATUS)+", gl error ["+l.getError()+"]");p.uniforms={};p.attributes={};var M,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(M in i)d.push(M);M=d;d=0;for(i=M.length;d<i;d++)j=M[d],p.uniforms[j]=l.getUniformLocation(p,
+j);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(M=0;M<c.maxMorphTargets;M++)d.push("morphTarget"+M);for(o in b)d.push(o);o=d;M=0;for(b=o.length;M<b;M++)c=o[M],p.attributes[c]=l.getAttribLocation(p,c);p.id=ca.length;ca.push({program:p,code:h});R.info.memory.programs=ca.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&l.enableVertexAttribArray(o.position);o.color>=0&&l.enableVertexAttribArray(o.color);o.normal>=0&&l.enableVertexAttribArray(o.normal);
+o.tangent>=0&&l.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(l.enableVertexAttribArray(o.skinVertexA),l.enableVertexAttribArray(o.skinVertexB),l.enableVertexAttribArray(o.skinIndex),l.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(f in a.attributes)o[f]!==void 0&&o[f]>=0&&l.enableVertexAttribArray(o[f]);if(a.morphTargets)for(f=a.numSupportedMorphTargets=0;f<this.maxMorphTargets;f++)M="morphTarget"+f,o[M]>=0&&(l.enableVertexAttribArray(o[M]),
+a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?l.frontFace(l.CCW):l.frontFace(l.CW),a==="back"?l.cullFace(l.BACK):a==="front"?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK),l.enable(l.CULL_FACE)):l.disable(l.CULL_FACE)};this.setBlending=function(a){if(a!==ra){switch(a){case THREE.AdditiveBlending:l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE);break;case THREE.SubtractiveBlending:l.blendEquation(l.FUNC_ADD);
+l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:l.blendEquation(l.FUNC_ADD);l.blendFunc(l.ZERO,l.SRC_COLOR);break;default:l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)}ra=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=l.createTexture(),R.info.memory.textures++;l.activeTexture(l.TEXTURE0+b);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);
+var c=s(l.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?l.texImage2D(l.TEXTURE_2D,0,Q(a.format),a.image.width,a.image.height,0,Q(a.format),l.UNSIGNED_BYTE,a.image.data):l.texImage2D(l.TEXTURE_2D,0,l.RGBA,l.RGBA,l.UNSIGNED_BYTE,a.image);c&&l.generateMipmap(l.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else l.activeTexture(l.TEXTURE0+b),l.bindTexture(l.TEXTURE_2D,a.__webglTexture)}};
 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};
@@ -352,19 +343,19 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,g=Math.max(Math.max(c,d),e),f=Math.min(Math.min(c,d),e);if(f===g)f=c=0;else{var h=g-f,f=h/g,c=c===g?(d-e)/h:d===g?2+(e-c)/h:4+(c-d)/h;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=g;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,l=g.faces,k=a.faceVertexUvs[0],o=g.faceVertexUvs[0],p={},m=0;m<a.materials.length;m++)p[a.materials[m].id]=m;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var m=0,r=h.length;m<r;m++){var n=new THREE.Vertex(h[m].position.clone());c&&c.multiplyVector3(n.position);f.push(n)}m=
-0;for(r=l.length;m<r;m++){var f=l[m],q,t,v=f.vertexNormals,z=f.vertexColors;f instanceof THREE.Face3?q=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(q=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));q.normal.copy(f.normal);d&&d.multiplyVector3(q.normal);h=0;for(n=v.length;h<n;h++)t=v[h].clone(),d&&d.multiplyVector3(t),q.vertexNormals.push(t);q.color.copy(f.color);h=0;for(n=z.length;h<n;h++)t=z[h],q.vertexColors.push(t.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
-n=p[h.id];if(n===void 0)n=a.materials.length,a.materials.push(h);q.materialIndex=n}q.centroid.copy(f.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}m=0;for(r=o.length;m<r;m++){c=o[m];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var f=new THREE.Vertex(d[a].position.clone());b.vertices.push(f)}a=0;
-for(c=e.length;a<c;a++){var h=e[a],i,l,k=h.vertexNormals,o=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(f=k.length;d<f;d++)l=k[d],i.vertexNormals.push(l.clone());i.color.copy(h.color);d=0;for(f=o.length;d<f;d++)l=o[d],i.vertexColors.push(l.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}a=0;for(c=g.length;a<c;a++){e=g[a];i=[];d=0;for(f=e.length;d<
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,j=g.faces,k=a.faceVertexUvs[0],o=g.faceVertexUvs[0],p={},m=0;m<a.materials.length;m++)p[a.materials[m].id]=m;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var m=0,q=h.length;m<q;m++){var n=new THREE.Vertex(h[m].position.clone());c&&c.multiplyVector3(n.position);f.push(n)}m=
+0;for(q=j.length;m<q;m++){var f=j[m],r,t,u=f.vertexNormals,y=f.vertexColors;f instanceof THREE.Face3?r=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(r=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));r.normal.copy(f.normal);d&&d.multiplyVector3(r.normal);h=0;for(n=u.length;h<n;h++)t=u[h].clone(),d&&d.multiplyVector3(t),r.vertexNormals.push(t);r.color.copy(f.color);h=0;for(n=y.length;h<n;h++)t=y[h],r.vertexColors.push(t.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
+n=p[h.id];if(n===void 0)n=a.materials.length,a.materials.push(h);r.materialIndex=n}r.centroid.copy(f.centroid);c&&c.multiplyVector3(r.centroid);i.push(r)}m=0;for(q=o.length;m<q;m++){c=o[m];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var f=new THREE.Vertex(d[a].position.clone());b.vertices.push(f)}a=0;
+for(c=e.length;a<c;a++){var h=e[a],i,j,k=h.vertexNormals,o=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(f=k.length;d<f;d++)j=k[d],i.vertexNormals.push(j.clone());i.color.copy(h.color);d=0;for(f=o.length;d<f;d++)j=o[d],i.vertexColors.push(j.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}a=0;for(c=g.length;a<c;a++){e=g[a];i=[];d=0;for(f=e.length;d<
 f;d++)i.push(new THREE.UV(e[d].u,e[d].v));b.faceVertexUvs[0].push(i)}return b},randomPointInTriangle:function(a,b,c){var d,e,g,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();d+e>1&&(d=1-d,e=1-e);g=1-d-e;f.copy(a);f.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);f.addSelf(h);h.copy(c);h.multiplyScalar(g);f.addSelf(h);return f},randomPointInFace:function(a,b,c){var d,e,g;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,e=b.vertices[a.b].position,
 g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,g);else if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,f;c?a._area1&&a._area2?(c=a._area1,f=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b),a._area1=c,a._area2=f):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b));return THREE.GeometryUtils.random()*(c+
-f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return l[e]>a?b(c,e-1):l[e]<a?b(e+1,d):e}return b(0,l.length-1)}var d,e,g=a.faces,f=a.vertices,h=g.length,i=0,l=[],k,o,p,m;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)k=f[d.a].position,o=f[d.b].position,p=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,o,p);else if(d instanceof
-THREE.Face4)k=f[d.a].position,o=f[d.b].position,p=f[d.c].position,m=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,o,m),d._area2=THREE.GeometryUtils.triangleArea(o,p,m),d._area=d._area1+d._area2;i+=d._area;l[e]=i}d=[];f={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();
+f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,g=a.faces,f=a.vertices,h=g.length,i=0,j=[],k,o,p,m;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)k=f[d.a].position,o=f[d.b].position,p=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,o,p);else if(d instanceof
+THREE.Face4)k=f[d.a].position,o=f[d.b].position,p=f[d.c].position,m=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,o,m),d._area2=THREE.GeometryUtils.triangleArea(o,p,m),d._area=d._area1+d._area2;i+=d._area;j[e]=i}d=[];f={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();
 b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Matrix4;b.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(b);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin="";d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],g=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(e.loadCount===6)g.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return g},getNormalMap:function(a,b){var c=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]};b|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),l=i.data,k=0;k<d;k++)for(var o=1;o<e;o++){var p=o-1<0?e-1:o-1,m=(o+1)%e,r=k-1<0?d-1:k-1,n=(k+1)%d,q=[],t=[0,0,h[(o*d+k)*4]/255*b];q.push([-1,0,h[(o*d+r)*4]/255*b]);q.push([-1,-1,h[(p*d+r)*4]/255*b]);q.push([0,-1,h[(p*d+k)*4]/255*b]);q.push([1,-1,h[(p*d+n)*4]/255*b]);
-q.push([1,0,h[(o*d+n)*4]/255*b]);q.push([1,1,h[(m*d+n)*4]/255*b]);q.push([0,1,h[(m*d+k)*4]/255*b]);q.push([-1,1,h[(m*d+r)*4]/255*b]);p=[];r=q.length;for(m=0;m<r;m++){var n=q[m],v=q[(m+1)%r],n=[n[0]-t[0],n[1]-t[1],n[2]-t[2]],v=[v[0]-t[0],v[1]-t[1],v[2]-t[2]];p.push(c([n[1]*v[2]-n[2]*v[1],n[2]*v[0]-n[0]*v[2],n[0]*v[1]-n[1]*v[0]]))}q=[0,0,0];for(m=0;m<p.length;m++)q[0]+=p[m][0],q[1]+=p[m][1],q[2]+=p[m][2];q[0]/=p.length;q[1]/=p.length;q[2]/=p.length;t=(o*d+k)*4;l[t]=(q[0]+1)/2*255|0;l[t+1]=(q[1]+0.5)*
-255|0;l[t+2]=q[2]*255|0;l[t+3]=255}f.putImageData(i,0,0);return g}};
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),j=i.data,k=0;k<d;k++)for(var o=1;o<e;o++){var p=o-1<0?e-1:o-1,m=(o+1)%e,q=k-1<0?d-1:k-1,n=(k+1)%d,r=[],t=[0,0,h[(o*d+k)*4]/255*b];r.push([-1,0,h[(o*d+q)*4]/255*b]);r.push([-1,-1,h[(p*d+q)*4]/255*b]);r.push([0,-1,h[(p*d+k)*4]/255*b]);r.push([1,-1,h[(p*d+n)*4]/255*b]);
+r.push([1,0,h[(o*d+n)*4]/255*b]);r.push([1,1,h[(m*d+n)*4]/255*b]);r.push([0,1,h[(m*d+k)*4]/255*b]);r.push([-1,1,h[(m*d+q)*4]/255*b]);p=[];q=r.length;for(m=0;m<q;m++){var n=r[m],u=r[(m+1)%q],n=[n[0]-t[0],n[1]-t[1],n[2]-t[2]],u=[u[0]-t[0],u[1]-t[1],u[2]-t[2]];p.push(c([n[1]*u[2]-n[2]*u[1],n[2]*u[0]-n[0]*u[2],n[0]*u[1]-n[1]*u[0]]))}r=[0,0,0];for(m=0;m<p.length;m++)r[0]+=p[m][0],r[1]+=p[m][1],r[2]+=p[m][2];r[0]/=p.length;r[1]/=p.length;r[2]/=p.length;t=(o*d+k)*4;j[t]=(r[0]+1)/2*255|0;j[t+1]=(r[1]+0.5)*
+255|0;j[t+2]=r[2]*255|0;j[t+3]=255}f.putImageData(i,0,0);return g}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var g=new THREE.Mesh(a,b[c]);e.add(g)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
 b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
 (b=new THREE.ParticleSystem(a.geometry,a.material),b.sortParticles=a.sortParticles):a instanceof THREE.Particle?b=new THREE.Particle(a.material):a instanceof THREE.Sprite?(b=new THREE.Sprite({}),b.color.copy(a.color),b.map=a.map,b.blending=a.blending,b.useScreenCoordinates=a.useScreenCoordinates,b.mergeWith3D=a.mergeWith3D,b.affectedByDistance=a.affectedByDistance,b.scaleByViewport=a.scaleByViewport,b.alignment=a.alignment,b.rotation3d.copy(a.rotation3d),b.rotation=a.rotation,b.opacity=a.opacity,
@@ -409,37 +400,37 @@ THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,g){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,g)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
 THREE.Path.prototype.arc=function(a,b,c,d,e,g){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,e,g));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,l,k,o,p,m,r,n;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];o=g[0];p=g[1];c.length>0?(f=c[c.length-1],m=f.x,r=f.y):(f=this.actions[d-1].args,m=f[f.length-2],r=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b2(n,m,o,h),n=THREE.Shape.Utils.b2(n,r,p,
-i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];o=g[0];p=g[1];l=g[2];k=g[3];c.length>0?(f=c[c.length-1],m=f.x,r=f.y):(f=this.actions[d-1].args,m=f[f.length-2],r=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b3(n,m,o,l,h),n=THREE.Shape.Utils.b3(n,r,p,k,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];n=a*g[0].length;f=f.concat(g[0]);g=new THREE.SplineCurve(f);
-for(f=1;f<=n;f++)c.push(g.getPointAt(f/n));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=g[0];i=g[1];l=g[2];o=g[3];n=g[4];p=!!g[5];k=f[f.length-2];m=f[f.length-1];f.length==0&&(k=m=0);r=n-o;var q=a*2;for(f=1;f<=q;f++)n=f/q,p||(n=1-n),n=o+n*r,g=k+h+l*Math.cos(n),n=m+i+l*Math.sin(n),c.push(new THREE.Vector2(g,n))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
-THREE.Path.prototype.nltransform=function(a,b,c,d,e,g){var f=this.getPoints(),h,i,l,k,o;h=0;for(i=f.length;h<i;h++)l=f[h],k=l.x,o=l.y,l.x=a*k+b*o+c,l.y=d*o+e*k+g;return f};
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,j,k,o,p,m,q,n;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];o=g[0];p=g[1];c.length>0?(f=c[c.length-1],m=f.x,q=f.y):(f=this.actions[d-1].args,m=f[f.length-2],q=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b2(n,m,o,h),n=THREE.Shape.Utils.b2(n,q,p,
+i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];o=g[0];p=g[1];j=g[2];k=g[3];c.length>0?(f=c[c.length-1],m=f.x,q=f.y):(f=this.actions[d-1].args,m=f[f.length-2],q=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b3(n,m,o,j,h),n=THREE.Shape.Utils.b3(n,q,p,k,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];n=a*g[0].length;f=f.concat(g[0]);g=new THREE.SplineCurve(f);
+for(f=1;f<=n;f++)c.push(g.getPointAt(f/n));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=g[0];i=g[1];j=g[2];o=g[3];n=g[4];p=!!g[5];k=f[f.length-2];m=f[f.length-1];f.length==0&&(k=m=0);q=n-o;var r=a*2;for(f=1;f<=r;f++)n=f/r,p||(n=1-n),n=o+n*q,g=k+h+j*Math.cos(n),n=m+i+j*Math.sin(n),c.push(new THREE.Vector2(g,n))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
+THREE.Path.prototype.nltransform=function(a,b,c,d,e,g){var f=this.getPoints(),h,i,j,k,o;h=0;for(i=f.length;h<i;h++)j=f[h],k=j.x,o=j.y,j.x=a*k+b*o+c,j.y=d*o+e*k+g;return f};
 THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,e,a=0;for(c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
 this.getPoints();a=0;for(c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],g=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&g.actions.length!=0&&(e.push(g),g=new THREE.Path),g[c].apply(g,d);g.actions.length!=0&&e.push(g);if(e.length==0)return[];var f,g=[];if(THREE.Shape.Utils.isClockWise(e[0].getPoints())){a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f&&g.push(f),f=new THREE.Shape,f.actions=d.actions,f.curves=
 d.curves):f.holes.push(d);g.push(f)}else{f=new THREE.Shape;a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f.actions=d.actions,f.curves=d.curves,g.push(f),f=new THREE.Shape):f.holes.push(d)}return g};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 b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].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,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,l,k,o,p,m,r=[];for(i=0;i<b.length;i++){l=b[i];Array.prototype.push.apply(d,l);g=Number.POSITIVE_INFINITY;for(e=0;e<l.length;e++){p=l[e];m=[];for(o=0;o<c.length;o++)k=c[o],k=p.distanceToSquared(k),m.push(k),k<g&&(g=k,f=e,h=o)}e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:l.length-1;var n=[l[f],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(n);var q=[l[f],l[g],c[h]];p=THREE.FontUtils.Triangulate.area(q);m=h;k=f;h+=1;f+=-1;h<
-0&&(h+=c.length);h%=c.length;f<0&&(f+=l.length);f%=l.length;e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:l.length-1;n=[l[f],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[l[f],l[g],c[h]];q=THREE.FontUtils.Triangulate.area(q);o+p>n+q&&(h=m,f=k,h<0&&(h+=c.length),h%=c.length,f<0&&(f+=l.length),f%=l.length,e=h-1>=0?h-1:c.length-1,g=f-1>=0?f-1:l.length-1);o=c.slice(0,h);p=c.slice(h);m=l.slice(f);k=l.slice(0,f);g=[l[f],l[g],c[h]];r.push([l[f],c[h],c[e]]);r.push(g);c=o.concat(m).concat(k).concat(p)}return{shape:c,
-isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,f,h,i,l={};g=0;for(f=d.length;g<f;g++)i=d[g].x+":"+d[g].y,l[i]!==void 0&&console.log("Duplicate point",i),l[i]=g;g=0;for(f=c.length;g<f;g++){h=c[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=l[i],i!==void 0&&(h[d]=i)}g=0;for(f=e.length;g<f;g++){h=e[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=l[i],i!==void 0&&(h[d]=i)}return c.concat(e)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,j,k,o,p,m,q=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);g=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){p=j[e];m=[];for(o=0;o<c.length;o++)k=c[o],k=p.distanceToSquared(k),m.push(k),k<g&&(g=k,f=e,h=o)}e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:j.length-1;var n=[j[f],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(n);var r=[j[f],j[g],c[h]];p=THREE.FontUtils.Triangulate.area(r);m=h;k=f;h+=1;f+=-1;h<
+0&&(h+=c.length);h%=c.length;f<0&&(f+=j.length);f%=j.length;e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:j.length-1;n=[j[f],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);r=[j[f],j[g],c[h]];r=THREE.FontUtils.Triangulate.area(r);o+p>n+r&&(h=m,f=k,h<0&&(h+=c.length),h%=c.length,f<0&&(f+=j.length),f%=j.length,e=h-1>=0?h-1:c.length-1,g=f-1>=0?f-1:j.length-1);o=c.slice(0,h);p=c.slice(h);m=j.slice(f);k=j.slice(0,f);g=[j[f],j[g],c[h]];q.push([j[f],c[h],c[e]]);q.push(g);c=o.concat(m).concat(k).concat(p)}return{shape:c,
+isolatedPts:q,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,f,h,i,j={};g=0;for(f=d.length;g<f;g++)i=d[g].x+":"+d[g].y,j[i]!==void 0&&console.log("Duplicate point",i),j[i]=g;g=0;for(f=c.length;g<f;g++){h=c[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}g=0;for(f=e.length;g<f;g++){h=e[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}return c.concat(e)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",g=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=g};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
 THREE.AnimationHandler=function(){var a=[],b={},c={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){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(a.hierarchy[c].keys[d].time<
-0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var l=a.hierarchy[c].keys[d].morphTargets[i];h[l]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k=
-{};for(l in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===l){k[l]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(k[l]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
+0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k=
+{};for(j in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){k[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[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)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
 2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===void 0)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
 THREE.Bone?e.skinMatrix:e.matrix;var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.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 b=["pos","rot","scl"],c,d,e,g,f,h,i,l,k=this.data.JIT.hierarchy,o,p;this.currentTime+=a*this.timeScale;p=this.currentTime;o=this.currentTime%=this.data.length;l=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,r=this.hierarchy.length;m<r;m++)if(a=this.hierarchy[m],i=a.animationCache,this.JITCompile&&k[m][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=k[m][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=k[m][l],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 n=0;n<3;n++){c=b[n];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=p){if(o<p)if(this.loop){f=this.data.hierarchy[m].keys[0];for(h=this.getNextKeyWith(c,m,1);h.time<o;)f=h,h=this.getNextKeyWith(c,m,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,m,h.index+1);while(h.time<
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,g,f,h,i,j,k=this.data.JIT.hierarchy,o,p;this.currentTime+=a*this.timeScale;p=this.currentTime;o=this.currentTime%=this.data.length;j=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,q=this.hierarchy.length;m<q;m++)if(a=this.hierarchy[m],i=a.animationCache,this.JITCompile&&k[m][j]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=k[m][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=k[m][j],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 n=0;n<3;n++){c=b[n];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=p){if(o<p)if(this.loop){f=this.data.hierarchy[m].keys[0];for(h=this.getNextKeyWith(c,m,1);h.time<o;)f=h,h=this.getNextKeyWith(c,m,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,m,h.index+1);while(h.time<
 o)}i.prevKey[c]=f;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(o-f.time)/(h.time-f.time);e=f[c];g=h[c];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m),d=d<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",m,f.index-1).pos,this.points[1]=e,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",m,h.index+1).pos,d=d*0.33+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[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(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(c===
-"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d}}if(this.JITCompile&&k[0][l]===void 0){this.hierarchy[0].update(null,!0);for(m=0;m<this.hierarchy.length;m++)k[m][l]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,g,f,h,i,l;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];l=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],i[0],l[0],e,c,f);d[1]=this.interpolate(g[1],h[1],i[1],l[1],e,c,f);d[2]=this.interpolate(g[2],h[2],i[2],l[2],e,c,f);return d};
+"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d}}if(this.JITCompile&&k[0][j]===void 0){this.hierarchy[0].update(null,!0);for(m=0;m<this.hierarchy.length;m++)k[m][j]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,g,f,h,i,j;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],i[0],j[0],e,c,f);d[1]=this.interpolate(g[1],h[1],i[1],j[1],e,c,f);d[2]=this.interpolate(g[2],h[2],i[2],j[2],e,c,f);return d};
 THREE.Animation.prototype.interpolate=function(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<d.length-1?c:d.length-1:c%=d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
 THREE.CubeCamera=function(a,b,c,d){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
@@ -461,7 +452,7 @@ 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",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
-THREE.PathControls=function(a,b){function c(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 e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},g,f=b.getControlPointsArray(),h=b.getLength(),q=f.length,t=0;g=q-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[g]={time:d,pos:f[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<q-1;g++)t=d*h.chunks[g]/h.total,b.keys[g]={time:t,pos:f[g]};e.hierarchy[0]=
+THREE.PathControls=function(a,b){function c(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 e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),r=g.length,t=0;f=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<r-1;f++)t=d*h.chunks[f]/h.total,b.keys[f]={time:t,pos:g[f]};e.hierarchy[0]=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(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=b!==void 0?b: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.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,h=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%f;this.phi=a>=0?a:a+f;b=this.verticalAngleMap.srcRange;
@@ -479,42 +470,42 @@ THREE.FlyControls=function(a,b){function c(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",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b: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 c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,i=0,l=0,k=0,o=0,p=0,m=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
-this.rotateHorizontally(b*o);this.rotateVertically(b*p)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*l);this.object.translateY(b*k);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b: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 c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,i=0,j=0,k=0,o=0,p=0,m=window.innerWidth/2,q=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
+this.rotateHorizontally(b*o);this.rotateVertically(b*p)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*j);this.object.translateY(b*k);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
 e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;g.identity();g.n11=Math.cos(this.roll);g.n12=-Math.sin(this.roll);g.n21=Math.sin(this.roll);g.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(g);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){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);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){o=(a.clientX-m)/window.innerWidth;p=(a.clientY-r)/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:l=-1;break;case 40:case 83:i=-1;break;case 39:case 68:l=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:l=0;break;case 40:case 83:i=0;break;case 39:case 68:l=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-m)/window.innerWidth;p=(a.clientY-q)/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:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
 THREE.TrackballControls=function(a,b){var c=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=b!==void 0?b: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 e=!1,g=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector2,k=new THREE.Vector2,o=new THREE.Vector2,p=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
-c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),g=d.length();g>1?d.normalize():d.z=Math.sqrt(1-g*g);f.copy(c.object.position).subSelf(c.target);g=c.object.up.clone().setLength(d.y);g.addSelf(c.object.up.clone().crossSelf(f).setLength(d.x));g.addSelf(f.setLength(d.z));return g};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=c.rotateSpeed;d.setFromAxisAngle(b,
--a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-l.y)*c.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),c.staticMoving?l=k:l.y+=(k.y-l.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=p.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));
+this.target=new THREE.Vector3(0,0,0);var e=!1,g=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,o=new THREE.Vector2,p=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
+c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=c.rotateSpeed;d.setFromAxisAngle(b,
+-a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*c.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),c.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=p.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));
 c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=p:o.addSelf(a.sub(p,o).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),f.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,f.setLength(c.minDistance))};this.update=function(){f.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();
-c.noPan||c.panCamera();c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),l=k=c.getMouseOnScreen(a.clientX,a.clientY),o=p=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),g!==d.NONE&&(g===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&
-!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):g===d.PAN&&!c.noPan&&(p=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!c.noZoom?l=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=p=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
+c.noPan||c.panCamera();c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=c.getMouseOnScreen(a.clientX,a.clientY),o=p=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),g!==d.NONE&&(g===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&
+!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):g===d.PAN&&!c.noPan&&(p=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!c.noZoom?j=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=p=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
 function(a){if(c.enabled)a.preventDefault(),a.stopPropagation(),g=d.NONE},!1);window.addEventListener("keydown",function(a){if(c.enabled&&g===d.NONE){if(a.keyCode===c.keys[d.ROTATE]&&!c.noRotate)g=d.ROTATE;else if(a.keyCode===c.keys[d.ZOOM]&&!c.noZoom)g=d.ZOOM;else if(a.keyCode===c.keys[d.PAN]&&!c.noPan)g=d.PAN;g!==d.NONE&&(e=!0)}},!1);window.addEventListener("keyup",function(){if(c.enabled&&g!==d.NONE)g=d.NONE},!1)};
-THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,k,m){var n,o=d||1,p=e||1,q=h/2,r=i/2,t=l.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",p=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=g||1;var v=o+1,y=p+1,z=h/o,I=i/p,w=new THREE.Vector3;w[n]=k>0?1:-1;for(h=0;h<y;h++)for(i=0;i<v;i++){var V=new THREE.Vector3;V[a]=(i*z-q)*c;V[b]=(h*I-r)*f;V[n]=k;l.vertices.push(new THREE.Vertex(V))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
-new THREE.Face4(i+v*h+t,i+v*(h+1)+t,i+1+v*(h+1)+t,i+1+v*h+t),a.normal.copy(w),a.vertexNormals.push(w.clone(),w.clone(),w.clone(),w.clone()),a.materialIndex=m,l.faces.push(a),l.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var l=this,k=a/2,o=b/2,p=c/2,m,r,n,q,t,v;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;q=1;r=2;t=
-3;n=4;v=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var z in h)this.sides[z]!=void 0&&(this.sides[z]=h[z]);this.sides.px&&i("z","y",-1,-1,c,b,k,m);this.sides.nx&&i("z","y",1,-1,c,b,-k,q);this.sides.py&&i("x","z",1,1,a,c,o,r);this.sides.ny&&i("x","z",1,-1,a,c,-o,t);this.sides.pz&&i("x","y",1,-1,a,b,p,n);this.sides.nz&&i("x","y",-1,-1,a,b,-p,v);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,k,m){var n,o=d||1,p=e||1,q=h/2,r=i/2,t=j.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",p=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=g||1;var u=o+1,y=p+1,L=h/o,H=i/p,O=new THREE.Vector3;O[n]=k>0?1:-1;for(h=0;h<y;h++)for(i=0;i<u;i++){var V=new THREE.Vector3;V[a]=(i*L-q)*c;V[b]=(h*H-r)*f;V[n]=k;j.vertices.push(new THREE.Vertex(V))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
+new THREE.Face4(i+u*h+t,i+u*(h+1)+t,i+1+u*(h+1)+t,i+1+u*h+t),a.normal.copy(O),a.vertexNormals.push(O.clone(),O.clone(),O.clone(),O.clone()),a.materialIndex=m,j.faces.push(a),j.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var j=this,k=a/2,o=b/2,p=c/2,m,q,n,r,t,u;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;r=1;q=2;t=
+3;n=4;u=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var y in h)this.sides[y]!=void 0&&(this.sides[y]=h[y]);this.sides.px&&i("z","y",-1,-1,c,b,k,m);this.sides.nx&&i("z","y",1,-1,c,b,-k,r);this.sides.py&&i("x","z",1,1,a,c,o,q);this.sides.ny&&i("x","z",1,-1,a,c,-o,t);this.sides.pz&&i("x","y",1,-1,a,b,p,n);this.sides.nz&&i("x","y",-1,-1,a,b,-p,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,d=d||8,e=e||1,h,i,l=[],k=[];for(i=0;i<=e;i++){var o=[],p=[],m=i/e,r=m*(b-a)+a;for(h=0;h<=d;h++){var n=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(r*Math.sin(n*Math.PI*2),-m*c+f,r*Math.cos(n*Math.PI*2))));o.push(this.vertices.length-1);p.push(new THREE.UV(n,m))}l.push(o);k.push(p)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=l[i][h],o=l[i+1][h],p=l[i+1][h+1],m=l[i][h+1],r=
-this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[o].position.clone().setY(0).normalize(),q=this.vertices[p].position.clone().setY(0).normalize(),t=this.vertices[m].position.clone().setY(0).normalize(),v=k[i][h].clone(),z=k[i+1][h].clone(),u=k[i+1][h+1].clone(),B=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,o,p,m,[r,n,q,t]));this.faceVertexUvs[0].push([v,z,u,B])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=l[0][h],o=l[0][h+
-1],p=this.vertices.length-1,r=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),v=k[0][h].clone(),z=k[0][h+1].clone(),u=new THREE.UV(z.u,0),this.faces.push(new THREE.Face3(c,o,p,[r,n,q])),this.faceVertexUvs[0].push([v,z,u])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=l[i][h+1],o=l[i][h],p=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),v=k[i][h+1].clone(),z=k[i][h].clone(),
-u=new THREE.UV(z.u,1),this.faces.push(new THREE.Face3(c,o,p,[r,n,q])),this.faceVertexUvs[0].push([v,z,u])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,d=d||8,e=e||1,h,i,j=[],k=[];for(i=0;i<=e;i++){var o=[],p=[],m=i/e,q=m*(b-a)+a;for(h=0;h<=d;h++){var n=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(q*Math.sin(n*Math.PI*2),-m*c+f,q*Math.cos(n*Math.PI*2))));o.push(this.vertices.length-1);p.push(new THREE.UV(n,m))}j.push(o);k.push(p)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=j[i][h],o=j[i+1][h],p=j[i+1][h+1],m=j[i][h+1],q=
+this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[o].position.clone().setY(0).normalize(),r=this.vertices[p].position.clone().setY(0).normalize(),t=this.vertices[m].position.clone().setY(0).normalize(),u=k[i][h].clone(),y=k[i+1][h].clone(),v=k[i+1][h+1].clone(),A=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,o,p,m,[q,n,r,t]));this.faceVertexUvs[0].push([u,y,v,A])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=j[0][h],o=j[0][h+
+1],p=this.vertices.length-1,q=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),u=k[0][h].clone(),y=k[0][h+1].clone(),v=new THREE.UV(y.u,0),this.faces.push(new THREE.Face3(c,o,p,[q,n,r])),this.faceVertexUvs[0].push([u,y,v])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=j[i][h+1],o=j[i][h],p=this.vertices.length-1,q=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),u=k[i][h+1].clone(),y=k[i][h].clone(),
+v=new THREE.UV(y.u,1),this.faces.push(new THREE.Face3(c,o,p,[q,n,r])),this.faceVertexUvs[0].push([u,y,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d=a.length,e;this.shapebb=a[d-1].getBoundingBox();for(c=0;c<d;c++)e=a[c],this.addShape(e,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
-THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,g=THREE.ExtrudeGeometry.__v3,e=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);d=d.normalize();f=f.normalize();g.set(-d.y,d.x);e.set(f.y,-f.x);h.copy(a).addSelf(g);i.copy(a).addSelf(e);if(h.equals(i))return e.clone();
-h.copy(b).addSelf(g);i.copy(c).addSelf(e);g=d.dot(e);e=i.subSelf(h).dot(e);g===0&&(console.log("Either infinite or no solutions!"),e===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));e/=g;if(e<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(e).addSelf(h).subSelf(a).clone()}function e(a){for(s=a.length;--s>=0;){V=s;R=s-1;R<0&&(R=a.length-1);for(var b=
-0,c=m+k*2,b=0;b<c;b++){var d=$*b,g=$*(b+1),f=j+V+d,e=j+V+g,l=f,d=j+R+d,g=j+R+g,n=e;l+=L;d+=L;g+=L;n+=L;E.faces.push(new THREE.Face4(l,d,g,n,null,null,u));u&&(l=b/c,d=(b+1)/c,g=h+i*2,f=(E.vertices[f].position.z+i)/g,e=(E.vertices[e].position.z+i)/g,E.faceVertexUvs[0].push([new THREE.UV(f,l),new THREE.UV(e,l),new THREE.UV(e,d),new THREE.UV(f,d)]))}}}function g(a,b,c){E.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=L;b+=L;c+=L;E.faces.push(new THREE.Face3(a,b,c,null,
-null,z));if(z){var d=B.maxY,g=B.maxX,f=E.vertices[b].position.x,b=E.vertices[b].position.y,e=E.vertices[c].position.x,c=E.vertices[c].position.y;E.faceVertexUvs[0].push([new THREE.UV(E.vertices[a].position.x/g,E.vertices[a].position.y/d),new THREE.UV(f/g,b/d),new THREE.UV(e/g,c/d)])}}var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,l=b.bevelSize!==void 0?b.bevelSize:i-2,k=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:!0,p=b.curveSegments!==
-void 0?b.curveSegments:12,m=b.steps!==void 0?b.steps:1,r=b.bendPath,n=b.extrudePath,q,t=!1,v=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,z=b.material,u=b.extrudeMaterial,B=this.shapebb;if(n)q=n.getPoints(p),m=q.length,t=!0,o=!1;o||(l=i=k=0);var A,F,H,E=this,L=this.vertices.length;r&&a.addWrapPath(r);p=v?a.extractAllSpacedPoints(p):a.extractAllPoints(p);r=p.shape;p=p.holes;if(n=!THREE.Shape.Utils.isClockWise(r)){r=r.reverse();F=0;for(H=p.length;F<H;F++)A=p[F],THREE.Shape.Utils.isClockWise(A)&&
-(p[F]=A.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(r,p);v=r;F=0;for(H=p.length;F<H;F++)A=p[F],r=r.concat(A);var s,G,U,Z,Q,T,$=r.length,ia=n.length,y=[];s=0;G=v.length;V=G-1;for(R=s+1;s<G;s++,V++,R++)V===G&&(V=0),R===G&&(R=0),y[s]=d(v[s],v[V],v[R]);var N=[],I,w=y.concat();F=0;for(H=p.length;F<H;F++){A=p[F];I=[];s=0;G=A.length;V=G-1;for(R=s+1;s<G;s++,V++,R++)V===G&&(V=0),R===G&&(R=0),I[s]=d(A[s],A[V],A[R]);N.push(I);w=w.concat(I)}for(U=0;U<k;U++){Z=U/k;Q=i*(1-Z);Z=l*Math.sin(Z*Math.PI/2);
-s=0;for(G=v.length;s<G;s++)T=c(v[s],y[s],Z),g(T.x,T.y,-Q);F=0;for(H=p.length;F<H;F++){A=p[F];I=N[F];s=0;for(G=A.length;s<G;s++)T=c(A[s],I[s],Z),g(T.x,T.y,-Q)}}Z=l;for(s=0;s<$;s++)T=o?c(r[s],w[s],Z):r[s],t?g(T.x,T.y+q[0].y,q[0].x):g(T.x,T.y,0);for(U=1;U<=m;U++)for(s=0;s<$;s++)T=o?c(r[s],w[s],Z):r[s],t?g(T.x,T.y+q[U-1].y,q[U-1].x):g(T.x,T.y,h/m*U);for(U=k-1;U>=0;U--){Z=U/k;Q=i*(1-Z);Z=l*Math.sin(Z*Math.PI/2);s=0;for(G=v.length;s<G;s++)T=c(v[s],y[s],Z),g(T.x,T.y,h+Q);F=0;for(H=p.length;F<H;F++){A=p[F];
-I=N[F];s=0;for(G=A.length;s<G;s++)T=c(A[s],I[s],Z),t?g(T.x,T.y+q[m-1].y,q[m-1].x+Q):g(T.x,T.y,h+Q)}}if(o){o=$*0;for(s=0;s<ia;s++)l=n[s],f(l[2]+o,l[1]+o,l[0]+o);o=$*(m+k*2);for(s=0;s<ia;s++)l=n[s],f(l[0]+o,l[1]+o,l[2]+o)}else{for(s=0;s<ia;s++)l=n[s],f(l[2],l[1],l[0]);for(s=0;s<ia;s++)l=n[s],f(l[0]+$*m,l[1]+$*m,l[2]+$*m)}var V,R,j=0;e(v);j+=v.length;F=0;for(H=p.length;F<H;F++)A=p[F],e(A),j+=A.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(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 e(a){for(s=a.length;--s>=0;){V=s;R=s-1;R<0&&(R=a.length-1);for(var b=
+0,c=m+k*2,b=0;b<c;b++){var d=$*b,e=$*(b+1),f=l+V+d,g=l+V+e,j=f,d=l+R+d,e=l+R+e,n=g;j+=G;d+=G;e+=G;n+=G;F.faces.push(new THREE.Face4(j,d,e,n,null,null,v));v&&(j=b/c,d=(b+1)/c,e=h+i*2,f=(F.vertices[f].position.z+i)/e,g=(F.vertices[g].position.z+i)/e,F.faceVertexUvs[0].push([new THREE.UV(f,j),new THREE.UV(g,j),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function g(a,b,c){F.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=G;b+=G;c+=G;F.faces.push(new THREE.Face3(a,b,c,null,
+null,y));if(y){var d=A.maxY,e=A.maxX,f=F.vertices[b].position.x,b=F.vertices[b].position.y,g=F.vertices[c].position.x,c=F.vertices[c].position.y;F.faceVertexUvs[0].push([new THREE.UV(F.vertices[a].position.x/e,F.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,j=b.bevelSize!==void 0?b.bevelSize:i-2,k=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:!0,p=b.curveSegments!==
+void 0?b.curveSegments:12,m=b.steps!==void 0?b.steps:1,q=b.bendPath,n=b.extrudePath,r,t=!1,u=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,y=b.material,v=b.extrudeMaterial,A=this.shapebb;if(n)r=n.getPoints(p),m=r.length,t=!0,o=!1;o||(j=i=k=0);var z,w,I,F=this,G=this.vertices.length;q&&a.addWrapPath(q);p=u?a.extractAllSpacedPoints(p):a.extractAllPoints(p);q=p.shape;p=p.holes;if(n=!THREE.Shape.Utils.isClockWise(q)){q=q.reverse();w=0;for(I=p.length;w<I;w++)z=p[w],THREE.Shape.Utils.isClockWise(z)&&
+(p[w]=z.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(q,p);u=q;w=0;for(I=p.length;w<I;w++)z=p[w],q=q.concat(z);var s,E,T,Z,Q,U,$=q.length,ja=n.length,K=[];s=0;E=u.length;V=E-1;for(R=s+1;s<E;s++,V++,R++)V===E&&(V=0),R===E&&(R=0),K[s]=d(u[s],u[V],u[R]);var L=[],H,O=K.concat();w=0;for(I=p.length;w<I;w++){z=p[w];H=[];s=0;E=z.length;V=E-1;for(R=s+1;s<E;s++,V++,R++)V===E&&(V=0),R===E&&(R=0),H[s]=d(z[s],z[V],z[R]);L.push(H);O=O.concat(H)}for(T=0;T<k;T++){Z=T/k;Q=i*(1-Z);Z=j*Math.sin(Z*Math.PI/2);
+s=0;for(E=u.length;s<E;s++)U=c(u[s],K[s],Z),g(U.x,U.y,-Q);w=0;for(I=p.length;w<I;w++){z=p[w];H=L[w];s=0;for(E=z.length;s<E;s++)U=c(z[s],H[s],Z),g(U.x,U.y,-Q)}}Z=j;for(s=0;s<$;s++)U=o?c(q[s],O[s],Z):q[s],t?g(U.x,U.y+r[0].y,r[0].x):g(U.x,U.y,0);for(T=1;T<=m;T++)for(s=0;s<$;s++)U=o?c(q[s],O[s],Z):q[s],t?g(U.x,U.y+r[T-1].y,r[T-1].x):g(U.x,U.y,h/m*T);for(T=k-1;T>=0;T--){Z=T/k;Q=i*(1-Z);Z=j*Math.sin(Z*Math.PI/2);s=0;for(E=u.length;s<E;s++)U=c(u[s],K[s],Z),g(U.x,U.y,h+Q);w=0;for(I=p.length;w<I;w++){z=p[w];
+H=L[w];s=0;for(E=z.length;s<E;s++)U=c(z[s],H[s],Z),t?g(U.x,U.y+r[m-1].y,r[m-1].x+Q):g(U.x,U.y,h+Q)}}if(o){o=$*0;for(s=0;s<ja;s++)j=n[s],f(j[2]+o,j[1]+o,j[0]+o);o=$*(m+k*2);for(s=0;s<ja;s++)j=n[s],f(j[0]+o,j[1]+o,j[2]+o)}else{for(s=0;s<ja;s++)j=n[s],f(j[2],j[1],j[0]);for(s=0;s<ja;s++)j=n[s],f(j[0]+$*m,j[1]+$*m,j[2]+$*m)}var V,R,l=0;e(u);l+=u.length;w=0;for(I=p.length;w<I;w++)z=p[w],e(z),l+=z.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 b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var g=e.vertices[a].position,f=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(g.clone().normalize(),f.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-g.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,c){var d=e.vertices[a].position,g=e.vertices[c].position;return b((d.x+g.x)/2,(d.y+g.y)/2,(d.z+g.z)/2)}var e=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,
-1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in g.faces){var i=d(g.faces[h].a,g.faces[h].b),l=d(g.faces[h].b,g.faces[h].c),k=d(g.faces[h].c,g.faces[h].a);c(g.faces[h].a,i,k,a);c(g.faces[h].b,l,i,a);c(g.faces[h].c,k,l,a);c(i,l,k,a)}g.faces=a.faces;g.faceVertexUvs[0]=a.faceVertexUvs[0]}e.faces=
+THREE.IcosahedronGeometry=function(a){function b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var f=e.vertices[a].position,g=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([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(g.z,g.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-g.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,c){var d=e.vertices[a].position,f=e.vertices[c].position;return b((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,
+1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in g.faces){var i=d(g.faces[h].a,g.faces[h].b),j=d(g.faces[h].b,g.faces[h].c),k=d(g.faces[h].c,g.faces[h].a);c(g.faces[h].a,i,k,a);c(g.faces[h].b,j,i,a);c(g.faces[h].c,k,j,a);c(i,j,k,a)}g.faces=a.faces;g.faceVertexUvs[0]=a.faceVertexUvs[0]}e.faces=
 g.faces;e.faceVertexUvs[0]=g.faceVertexUvs[0];this.computeCentroids();this.computeFaceNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],g=[],f=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=f.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=g;i==0&&(g=d);
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
@@ -522,160 +513,160 @@ THREE.OctahedronGeometry=function(a,b){function c(b){var c=b.clone().normalize()
 f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push([g(a.uv,a.position,h),g(b.uv,b.position,h),g(c.uv,c.position,h)])):(h-=1,d(a,e(a,b),e(a,c),h),d(e(a,b),b,e(b,c),h),d(e(a,c),e(b,c),c,h),d(e(a,b),e(b,c),e(a,c),h))}function e(a,b){h[a.index]||(h[a.index]=[]);h[b.index]||(h[b.index]=[]);var d=h[a.index][b.index];d===void 0&&(h[a.index][b.index]=h[b.index][a.index]=d=c((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return d}function g(a,b,c){c<0&&a.u===
 1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var b=b||0,f=this;c(new THREE.Vector3(1,0,0));c(new THREE.Vector3(-1,0,0));c(new THREE.Vector3(0,1,0));c(new THREE.Vector3(0,-1,0));c(new THREE.Vector3(0,0,1));c(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],b);d(i[0],i[4],i[3],b);d(i[0],i[3],i[5],b);d(i[0],i[5],i[2],b);d(i[1],i[2],i[5],b);d(i[1],i[5],i[3],b);d(i[1],i[3],i[4],b);d(i[1],i[4],i[2],b);this.boundingSphere=
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
-THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,g=b/2,c=c||1,d=d||1,f=c+1,h=d+1,i=a/c,l=b/d,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<f;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*l-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+f*a,b+f*(a+1),b+1+f*(a+1),b+1+f*a),e.normal.copy(k),e.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,g=b/2,c=c||1,d=d||1,f=c+1,h=d+1,i=a/c,j=b/d,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<f;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*j-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+f*a,b+f*(a+1),b+1+f*(a+1),b+1+f*a),e.normal.copy(k),e.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
 c,(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c,d,e,g,f){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,g=g!=void 0?g:0,f=f!=void 0?f:Math.PI,h,i,l=[],k=[];for(i=0;i<=c;i++){var o=[],p=[];for(h=0;h<=b;h++){var m=h/b,r=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+m*e)*Math.sin(g+r*f),a*Math.cos(g+r*f),a*Math.sin(d+m*e)*Math.sin(g+r*f))));o.push(this.vertices.length-1);p.push(new THREE.UV(m,r))}l.push(o);
-k.push(p)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=l[i][h+1],e=l[i][h],g=l[i+1][h],f=l[i+1][h+1],o=this.vertices[d].position.clone().normalize(),p=this.vertices[e].position.clone().normalize(),m=this.vertices[g].position.clone().normalize(),r=this.vertices[f].position.clone().normalize(),n=k[i][h+1].clone(),q=k[i][h].clone(),t=k[i+1][h].clone(),v=k[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,f,[o,m,r])),this.faceVertexUvs[0].push([n,t,v])):Math.abs(this.vertices[g].position.y)==
-a?(this.faces.push(new THREE.Face3(d,e,g,[o,p,m])),this.faceVertexUvs[0].push([n,q,t])):(this.faces.push(new THREE.Face4(d,e,g,f,[o,p,m,r])),this.faceVertexUvs[0].push([n,q,t,v]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
+THREE.SphereGeometry=function(a,b,c,d,e,g,f){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,g=g!=void 0?g:0,f=f!=void 0?f:Math.PI,h,i,j=[],k=[];for(i=0;i<=c;i++){var o=[],p=[];for(h=0;h<=b;h++){var m=h/b,q=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+m*e)*Math.sin(g+q*f),a*Math.cos(g+q*f),a*Math.sin(d+m*e)*Math.sin(g+q*f))));o.push(this.vertices.length-1);p.push(new THREE.UV(m,q))}j.push(o);
+k.push(p)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],e=j[i][h],g=j[i+1][h],f=j[i+1][h+1],o=this.vertices[d].position.clone().normalize(),p=this.vertices[e].position.clone().normalize(),m=this.vertices[g].position.clone().normalize(),q=this.vertices[f].position.clone().normalize(),n=k[i][h+1].clone(),r=k[i][h].clone(),t=k[i+1][h].clone(),u=k[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,f,[o,m,q])),this.faceVertexUvs[0].push([n,t,u])):Math.abs(this.vertices[g].position.y)==
+a?(this.faces.push(new THREE.Face3(d,e,g,[o,p,m])),this.faceVertexUvs[0].push([n,r,t])):(this.faces.push(new THREE.Face4(d,e,g,f,[o,p,m,q])),this.faceVertexUvs[0].push([n,r,t,u]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};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 b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
-0,e=String(a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,l,k,o,p,m,r,n,q,t=b.glyphs[a]||b.glyphs["?"];if(t){if(t.o){b=t._cachedOutline||(t._cachedOutline=t.o.split(" "));l=b.length;for(a=0;a<l;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,k));e.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,
-k));e.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;m=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(m,r,i,k);if(f=g[g.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++){var v=f/h,z=THREE.Shape.Utils.b2(v,o,m,i),v=THREE.Shape.Utils.b2(v,p,r,k);g.push(new THREE.Vector2(z,v))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,m=b[a++]*c+d,r=b[a++]*-c,n=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,k,m,r,n,q),f=g[g.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++)v=f/h,z=THREE.Shape.Utils.b3(v,o,m,
-n,i),v=THREE.Shape.Utils.b3(v,p,r,q,k),g.push(new THREE.Vector2(z,v))}}}return{offset:t.ha*c,points:g,path:e}}}};
-(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,l,k;if(b(a)>0)for(l=0;l<e;l++)f[l]=l;else for(l=0;l<e;l++)f[l]=e-1-l;var o=2*e;for(l=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=l;e<=i&&(i=0);l=i+1;e<=l&&(l=0);k=l+1;e<=k&&(k=0);var p;a:{p=a;var m=i,r=l,n=k,q=e,t=f,v=void 0,z=void 0,u=void 0,
-B=void 0,A=void 0,F=void 0,H=void 0,E=void 0,L=void 0,z=p[t[m]].x,u=p[t[m]].y,B=p[t[r]].x,A=p[t[r]].y,F=p[t[n]].x,H=p[t[n]].y;if(1.0E-10>(B-z)*(H-u)-(A-u)*(F-z))p=!1;else{for(v=0;v<q;v++)if(!(v==m||v==r||v==n)){var E=p[t[v]].x,L=p[t[v]].y,s=void 0,G=void 0,U=void 0,Z=void 0,Q=void 0,T=void 0,$=void 0,ia=void 0,y=void 0,N=void 0,I=void 0,w=void 0,s=U=Q=void 0,s=F-B,G=H-A,U=z-F,Z=u-H,Q=B-z,T=A-u,$=E-z,ia=L-u,y=E-B,N=L-A,I=E-F,w=L-H,s=s*N-G*y,Q=Q*ia-T*$,U=U*w-Z*I;if(s>=0&&U>=0&&Q>=0){p=!1;break a}}p=
-!0}}if(p){g.push([a[f[i]],a[f[l]],a[f[k]]]);h.push([f[i],f[l],f[k]]);i=l;for(k=l+1;k<e;i++,k++)f[i]=f[k];e--;o=2*e}}if(d)return h;return g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+0,e=String(a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,j,k,o,p,m,q,n,r,t=b.glyphs[a]||b.glyphs["?"];if(t){if(t.o){b=t._cachedOutline||(t._cachedOutline=t.o.split(" "));j=b.length;for(a=0;a<j;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,k));e.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,
+k));e.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;m=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(m,q,i,k);if(f=g[g.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++){var u=f/h,y=THREE.Shape.Utils.b2(u,o,m,i),u=THREE.Shape.Utils.b2(u,p,q,k);g.push(new THREE.Vector2(y,u))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,m=b[a++]*c+d,q=b[a++]*-c,n=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,k,m,q,n,r),f=g[g.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++)u=f/h,y=THREE.Shape.Utils.b3(u,o,m,
+n,i),u=THREE.Shape.Utils.b3(u,p,q,r,k),g.push(new THREE.Vector2(y,u))}}}return{offset:t.ha*c,points:g,path:e}}}};
+(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,j,k;if(b(a)>0)for(j=0;j<e;j++)f[j]=j;else for(j=0;j<e;j++)f[j]=e-1-j;var o=2*e;for(j=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);k=j+1;e<=k&&(k=0);var p;a:{p=a;var m=i,q=j,n=k,r=e,t=f,u=void 0,y=void 0,v=void 0,
+A=void 0,z=void 0,w=void 0,I=void 0,F=void 0,G=void 0,y=p[t[m]].x,v=p[t[m]].y,A=p[t[q]].x,z=p[t[q]].y,w=p[t[n]].x,I=p[t[n]].y;if(1.0E-10>(A-y)*(I-v)-(z-v)*(w-y))p=!1;else{for(u=0;u<r;u++)if(!(u==m||u==q||u==n)){var F=p[t[u]].x,G=p[t[u]].y,s=void 0,E=void 0,T=void 0,Z=void 0,Q=void 0,U=void 0,$=void 0,ja=void 0,K=void 0,L=void 0,H=void 0,O=void 0,s=T=Q=void 0,s=w-A,E=I-z,T=y-w,Z=v-I,Q=A-y,U=z-v,$=F-y,ja=G-v,K=F-A,L=G-z,H=F-w,O=G-I,s=s*L-E*K,Q=Q*ja-U*$,T=T*O-Z*H;if(s>=0&&T>=0&&Q>=0){p=!1;break a}}p=
+!0}}if(p){g.push([a[f[i]],a[f[j]],a[f[k]]]);h.push([f[i],f[j],f[k]]);i=j;for(k=j+1;k<e;i++,k++)f[i]=f[k];e--;o=2*e}}if(d)return h;return g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,f=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(g);e.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(g);h.z=
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,f=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,g,f,h,[b[e],b[g],b[f],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[f]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[e].clone(),a[g].clone(),a[f].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
-THREE.TorusKnotGeometry=function(a,b,c,d,e,g,f){function h(a,b,c,d,g,f){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(g*(2+c)*0.5*Math.cos(a),g*(2+c)*Math.sin(a)*0.5,f*g*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<
+THREE.TorusKnotGeometry=function(a,b,c,d,e,g,f){function h(a,b,c,d,e,f){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,f*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<
 this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,f=b/this.segmentsT*2*Math.PI,e=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);c.x=i.x-e.x;c.y=i.y-e.y;c.z=i.z-e.z;d.x=i.x+e.x;d.y=i.y+e.y;d.z=i.z+e.z;g.cross(c,d);d.cross(g,c);g.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);e.x+=i*d.x+f*g.x;e.y+=i*d.y+f*g.y;e.z+=i*d.z+f*g.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,
-e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var d=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,e=this.grid[a][b],c=this.grid[d][b],d=this.grid[d][g],g=this.grid[a][g],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,c,d,g));this.faceVertexUvs[0].push([f,i,l,k])}this.computeCentroids();
+e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var d=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,e=this.grid[a][b],c=this.grid[d][b],d=this.grid[d][g],g=this.grid[a][g],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,c,d,g));this.faceVertexUvs[0].push([f,i,j,k])}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 b=this.subdivisions;b-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){k.vertexColors=[];for(var l,m,j,n=0;n<4;n++){j=i[n];l=new THREE.Color;l.setRGB(0,0,0);for(var o=0;o<j.length;o++)m=h.vertexColors[j[o]-1],l.r+=m.r,l.g+=m.g,l.b+=m.b;l.r/=j.length;l.g/=j.length;l.b/=j.length;k.vertexColors[n]=l}}e.push(k);(!f.supportUVs||p.length!=0)&&g.push([p[a],p[b],p[c],p[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],k={},o={},p=[],m,r,n,q,t,v=a.faceVertexUvs[0];m=0;for(r=v.length;m<r;m++){n=0;for(q=v[m].length;n<q;n++)t=d[m]["abcd".charAt(n)],p[t]||(p[t]=v[m][n])}var z;m=0;for(r=d.length;m<r;m++)if(t=d[m],l.push(t.centroid),i.push(new THREE.Vertex(t.centroid)),f.supportUVs&&p.length!=0){z=new THREE.UV;if(t instanceof THREE.Face3)z.u=p[t.a].u+p[t.b].u+p[t.c].u,z.v=p[t.a].v+p[t.b].v+p[t.c].v,z.u/=3,z.v/=3;else if(t instanceof THREE.Face4)z.u=
-p[t.a].u+p[t.b].u+p[t.c].u+p[t.d].u,z.v=p[t.a].v+p[t.b].v+p[t.c].v+p[t.d].v,z.u/=4,z.v/=4;p.push(z)}r=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].push(d)}var d,g,f,e,h={};d=0;for(g=a.faces.length;d<g;d++)f=a.faces[d],f instanceof THREE.Face3?(e=c(f.a,f.b),b(h,e,d),e=c(f.b,f.c),b(h,e,d),e=c(f.c,f.a),b(h,e,d)):f instanceof THREE.Face4&&(e=c(f.a,f.b),b(h,e,d),e=c(f.b,f.c),b(h,e,d),e=c(f.c,f.d),b(h,e,d),e=c(f.d,f.a),b(h,e,d));return h}(a);var u=0,v=h.length,B,A,F={},H={},E=function(a,
-b){F[a]===void 0&&(F[a]=[]);F[a].push(b)},L=function(a,b){H[a]===void 0&&(H[a]={});H[a][b]=null};for(m in r){z=r[m];B=m.split("_");A=B[0];B=B[1];E(A,[A,B]);E(B,[A,B]);n=0;for(q=z.length;n<q;n++)t=z[n],L(A,t,m),L(B,t,m);z.length<2&&(o[m]=!0)}for(m in r)if(z=r[m],t=z[0],z=z[1],B=m.split("_"),A=B[0],B=B[1],q=new THREE.Vector3,o[m]?(q.addSelf(h[A].position),q.addSelf(h[B].position),q.multiplyScalar(0.5)):(q.addSelf(l[t]),q.addSelf(l[z]),q.addSelf(h[A].position),q.addSelf(h[B].position),q.multiplyScalar(0.25)),
-k[m]=v+d.length+u,i.push(new THREE.Vertex(q)),u++,f.supportUVs&&p.length!=0)z=new THREE.UV,z.u=p[A].u+p[B].u,z.v=p[A].v+p[B].v,z.u/=2,z.v/=2,p.push(z);var s,G;B=["123","12","2","23"];q=["123","23","3","31"];var E=["123","31","1","12"],L=["1234","12","2","23"],U=["1234","23","3","34"],Z=["1234","34","4","41"],Q=["1234","41","1","12"];m=0;for(r=l.length;m<r;m++)t=d[m],z=v+m,t instanceof THREE.Face3?(u=c(t.a,t.b),A=c(t.b,t.c),s=c(t.c,t.a),b(z,k[u],t.b,k[A],t,B),b(z,k[A],t.c,k[s],t,q),b(z,k[s],t.a,k[u],
-t,E)):t instanceof THREE.Face4?(u=c(t.a,t.b),A=c(t.b,t.c),s=c(t.c,t.d),G=c(t.d,t.a),b(z,k[u],t.b,k[A],t,L),b(z,k[A],t.c,k[s],t,U),b(z,k[s],t.d,k[G],t,Z),b(z,k[G],t.a,k[u],t,Q)):console.log("face should be a face!",t);d=i;i=new THREE.Vector3;k=new THREE.Vector3;m=0;for(r=h.length;m<r;m++)if(F[m]!==void 0){i.set(0,0,0);k.set(0,0,0);t=new THREE.Vector3(0,0,0);z=0;for(n in H[m])i.addSelf(l[n]),z++;u=0;v=F[m].length;for(n=0;n<v;n++)o[c(F[m][n][0],F[m][n][1])]&&u++;if(u!=2){i.divideScalar(z);for(n=0;n<
-v;n++)z=F[m][n],z=h[z[0]].position.clone().addSelf(h[z[1]].position).divideScalar(2),k.addSelf(z);k.divideScalar(v);t.addSelf(h[m].position);t.multiplyScalar(v-3);t.addSelf(i);t.addSelf(k.multiplyScalar(2));t.divideScalar(v);d[m].position=t}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var k,m,l,n=0;n<4;n++){l=i[n];k=new THREE.Color;k.setRGB(0,0,0);for(var o=0;o<l.length;o++)m=h.vertexColors[l[o]-1],k.r+=m.r,k.g+=m.g,k.b+=m.b;k.r/=l.length;k.g/=l.length;k.b/=l.length;j.vertexColors[n]=k}}e.push(j);(!f.supportUVs||p.length!=0)&&g.push([p[a],p[b],p[c],p[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},o={},p=[],m,q,n,r,t,u=a.faceVertexUvs[0];m=0;for(q=u.length;m<q;m++){n=0;for(r=u[m].length;n<r;n++)t=d[m]["abcd".charAt(n)],p[t]||(p[t]=u[m][n])}var y;m=0;for(q=d.length;m<q;m++)if(t=d[m],j.push(t.centroid),i.push(new THREE.Vertex(t.centroid)),f.supportUVs&&p.length!=0){y=new THREE.UV;if(t instanceof THREE.Face3)y.u=p[t.a].u+p[t.b].u+p[t.c].u,y.v=p[t.a].v+p[t.b].v+p[t.c].v,y.u/=3,y.v/=3;else if(t instanceof THREE.Face4)y.u=
+p[t.a].u+p[t.b].u+p[t.c].u+p[t.d].u,y.v=p[t.a].v+p[t.b].v+p[t.c].v+p[t.d].v,y.u/=4,y.v/=4;p.push(y)}q=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].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=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var v=0,u=h.length,A,z,w={},I={},F=function(a,
+b){w[a]===void 0&&(w[a]=[]);w[a].push(b)},G=function(a,b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(m in q){y=q[m];A=m.split("_");z=A[0];A=A[1];F(z,[z,A]);F(A,[z,A]);n=0;for(r=y.length;n<r;n++)t=y[n],G(z,t,m),G(A,t,m);y.length<2&&(o[m]=!0)}for(m in q)if(y=q[m],t=y[0],y=y[1],A=m.split("_"),z=A[0],A=A[1],r=new THREE.Vector3,o[m]?(r.addSelf(h[z].position),r.addSelf(h[A].position),r.multiplyScalar(0.5)):(r.addSelf(j[t]),r.addSelf(j[y]),r.addSelf(h[z].position),r.addSelf(h[A].position),r.multiplyScalar(0.25)),
+k[m]=u+d.length+v,i.push(new THREE.Vertex(r)),v++,f.supportUVs&&p.length!=0)y=new THREE.UV,y.u=p[z].u+p[A].u,y.v=p[z].v+p[A].v,y.u/=2,y.v/=2,p.push(y);var s,E;A=["123","12","2","23"];r=["123","23","3","31"];var F=["123","31","1","12"],G=["1234","12","2","23"],T=["1234","23","3","34"],Z=["1234","34","4","41"],Q=["1234","41","1","12"];m=0;for(q=j.length;m<q;m++)t=d[m],y=u+m,t instanceof THREE.Face3?(v=c(t.a,t.b),z=c(t.b,t.c),s=c(t.c,t.a),b(y,k[v],t.b,k[z],t,A),b(y,k[z],t.c,k[s],t,r),b(y,k[s],t.a,k[v],
+t,F)):t instanceof THREE.Face4?(v=c(t.a,t.b),z=c(t.b,t.c),s=c(t.c,t.d),E=c(t.d,t.a),b(y,k[v],t.b,k[z],t,G),b(y,k[z],t.c,k[s],t,T),b(y,k[s],t.d,k[E],t,Z),b(y,k[E],t.a,k[v],t,Q)):console.log("face should be a face!",t);d=i;i=new THREE.Vector3;k=new THREE.Vector3;m=0;for(q=h.length;m<q;m++)if(w[m]!==void 0){i.set(0,0,0);k.set(0,0,0);t=new THREE.Vector3(0,0,0);y=0;for(n in I[m])i.addSelf(j[n]),y++;v=0;u=w[m].length;for(n=0;n<u;n++)o[c(w[m][n][0],w[m][n][1])]&&v++;if(v!=2){i.divideScalar(y);for(n=0;n<
+u;n++)y=w[m][n],y=h[y[0]].position.clone().addSelf(h[y[1]].position).divideScalar(2),k.addSelf(y);k.divideScalar(u);t.addSelf(h[m].position);t.multiplyScalar(u-3);t.addSelf(i);t.addSelf(k.multiplyScalar(2));t.divideScalar(u);d[m].position=t}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;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 b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
-a}function d(a,b){var d=new Image;d.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=b;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,b,d)}else a.image=this;a.needsUpdate=!0};d.src=b}function e(a,c,f,g,e,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=f;if(g){a[c].repeat.set(g[0],g[1]);if(g[0]!=1)a[c].wrapS=THREE.RepeatWrapping;
-if(g[1]!=1)a[c].wrapT=THREE.RepeatWrapping}e&&a[c].offset.set(e[0],e[1]);if(h){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[h[0]]!==void 0)a[c].wrapS=g[h[0]];if(g[h[1]]!==void 0)a[c].wrapT=g[h[1]]}d(a[c],b+"/"+f)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,h,i;h="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
+a}function d(a,b){var d=new Image;d.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=b;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,b,d)}else a.image=this;a.needsUpdate=!0};d.src=b}function e(a,c,e,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=e;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;
+if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}d(a[c],b+"/"+e)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,h,i;h="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
 if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=g(a.colorDiffuse);
 else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=g(a.colorSpecular);if(a.colorAmbient)f.ambient=g(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&b&&e(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&b&&e(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(l.uniforms),o=f.color;h=f.specular;i=f.ambient;var p=f.shininess;k.tNormal.texture=f.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(f.map)k.tDiffuse.texture=f.map,k.enableDiffuse.value=!0;if(f.specularMap)k.tSpecular.texture=f.specularMap,k.enableSpecular.value=!0;if(f.lightMap)k.tAO.texture=
-f.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(o);k.uSpecularColor.value.setHex(h);k.uAmbientColor.value.setHex(i);k.uShininess.value=p;if(f.opacity)k.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:k,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+a.mapSpecular&&b&&e(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var j=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(j.uniforms),o=f.color;h=f.specular;i=f.ambient;var p=f.shininess;k.tNormal.texture=f.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(f.map)k.tDiffuse.texture=f.map,k.enableDiffuse.value=!0;if(f.specularMap)k.tSpecular.texture=f.specularMap,k.enableSpecular.value=!0;if(f.lightMap)k.tAO.texture=
+f.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(o);k.uSpecularColor.value.setHex(h);k.uAmbientColor.value.setHex(i);k.uShininess.value=p;if(f.opacity)k.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:k,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
 THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,b,c,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,b=d.callback,c=d.texture_path,d=d.bin_path;var c=c?c:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,g){var f=new XMLHttpRequest;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(h,c,e,d,g)}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+
 f.status+"]")};f.open("GET",b,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var g=new XMLHttpRequest,f=c+"/"+a.buffers,h=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("Couldn't load ["+f+"] ["+g.status+"]"):g.readyState==3?e&&(h==0&&(h=g.getResponseHeader("Content-Length")),e({total:h,loaded:g.responseText.length})):g.readyState==2&&(h=g.getResponseHeader("Content-Length"))};g.open("GET",f,!0);
 g.responseType="arraybuffer";g.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function l(b,c){var d,e,g,f,h,i,k,l,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];g=m[d*3+1];f=m[d*3+2];h=z[e*2];e=z[e*2+1];i=z[g*2];k=z[g*2+1];g=z[f*2];l=z[f*2+1];f=n.faceVertexUvs[0];var o=[];o.push(new THREE.UV(h,e));o.push(new THREE.UV(i,k));o.push(new THREE.UV(g,l));f.push(o)}}
-function k(b,c){var d,e,g,f,h,i,k,l,m,o,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];g=p[d*4+1];f=p[d*4+2];h=p[d*4+3];i=z[e*2];e=z[e*2+1];k=z[g*2];m=z[g*2+1];l=z[f*2];o=z[f*2+1];f=z[h*2];g=z[h*2+1];h=n.faceVertexUvs[0];var q=[];q.push(new THREE.UV(i,e));q.push(new THREE.UV(k,m));q.push(new THREE.UV(l,o));q.push(new THREE.UV(f,g));h.push(q)}}function o(b,c,d){for(var e,g,f,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],g=c[d*3+1],f=c[d*3+2],h=i[d],n.faces.push(new THREE.Face3(e,
-g,f,null,null,h))}function p(b,c,d){for(var e,g,f,h,i,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],g=c[d*4+1],f=c[d*4+2],h=c[d*4+3],i=k[d],n.faces.push(new THREE.Face4(e,g,f,h,null,null,i))}function m(b,c,d,e){for(var g,f,h,i,k,l,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[e*3];f=c[e*3+1];h=c[e*3+2];k=d[e*3];l=d[e*3+1];m=d[e*3+2];i=o[e];var p=v[l*3],q=v[l*3+1];l=v[l*3+2];var r=v[m*3],j=v[m*3+1];m=v[m*3+2];n.faces.push(new THREE.Face3(g,
-f,h,[new THREE.Vector3(v[k*3],v[k*3+1],v[k*3+2]),new THREE.Vector3(p,q,l),new THREE.Vector3(r,j,m)],null,i))}}function r(b,c,d,e){for(var g,f,h,i,k,l,m,o,p,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=new Uint16Array(a,e,b),e=0;e<b;e++){g=c[e*4];f=c[e*4+1];h=c[e*4+2];i=c[e*4+3];l=d[e*4];m=d[e*4+1];o=d[e*4+2];p=d[e*4+3];k=q[e];var r=v[m*3],j=v[m*3+1];m=v[m*3+2];var t=v[o*3],u=v[o*3+1];o=v[o*3+2];var z=v[p*3],A=v[p*3+1];p=v[p*3+2];n.faces.push(new THREE.Face4(g,f,h,i,[new THREE.Vector3(v[l*
-3],v[l*3+1],v[l*3+2]),new THREE.Vector3(r,j,m),new THREE.Vector3(t,u,o),new THREE.Vector3(z,A,p)],null,k))}}var n=this,q=0,t,v=[],z=[],u,B,A,F,H,E;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);t={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,q,12),header_bytes:e(a,q+12),vertex_coordinate_bytes:e(a,q+13),normal_coordinate_bytes:e(a,q+14),uv_coordinate_bytes:e(a,q+15),vertex_index_bytes:e(a,q+16),normal_index_bytes:e(a,
-q+17),uv_index_bytes:e(a,q+18),material_index_bytes:e(a,q+19),nvertices:i(a,q+20),nnormals:i(a,q+20+4),nuvs:i(a,q+20+8),ntri_flat:i(a,q+20+12),ntri_smooth:i(a,q+20+16),ntri_flat_uv:i(a,q+20+20),ntri_smooth_uv:i(a,q+20+24),nquad_flat:i(a,q+20+28),nquad_smooth:i(a,q+20+32),nquad_flat_uv:i(a,q+20+36),nquad_smooth_uv:i(a,q+20+40)};t.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");q+=t.header_bytes;b=t.vertex_index_bytes*3+t.material_index_bytes;E=t.vertex_index_bytes*
-4+t.material_index_bytes;u=t.ntri_flat*b;B=t.ntri_smooth*(b+t.normal_index_bytes*3);A=t.ntri_flat_uv*(b+t.uv_index_bytes*3);F=t.ntri_smooth_uv*(b+t.normal_index_bytes*3+t.uv_index_bytes*3);H=t.nquad_flat*E;b=t.nquad_smooth*(E+t.normal_index_bytes*4);E=t.nquad_flat_uv*(E+t.uv_index_bytes*4);q+=function(b){var c=t.nvertices,b=new Float32Array(a,b,c*3),d,e,g,f;for(d=0;d<c;d++)e=b[d*3],g=b[d*3+1],f=b[d*3+2],n.vertices.push(new THREE.Vertex(new THREE.Vector3(e,g,f)));return c*3*Float32Array.BYTES_PER_ELEMENT}(q);
-q+=function(b){var c=t.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,g,f;for(d=0;d<c;d++)e=b[d*3],g=b[d*3+1],f=b[d*3+2],v.push(e/127,g/127,f/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(q);q+=c(t.nnormals*3);q+=function(b){var c=t.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,g;for(d=0;d<c;d++)e=b[d*2],g=b[d*2+1],z.push(e,g)}return c*2*Float32Array.BYTES_PER_ELEMENT}(q);u=q+u+c(t.ntri_flat*2);B=u+B+c(t.ntri_smooth*2);A=B+A+c(t.ntri_flat_uv*2);F=A+F+c(t.ntri_smooth_uv*2);H=F+H+c(t.nquad_flat*2);
-b=H+b+c(t.nquad_smooth*2);E=b+E+c(t.nquad_flat_uv*2);(function(a){var b=t.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,c)}})(B);(function(a){var b=t.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,d)}})(A);(function(a){var b=t.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;p(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,
-c)}})(b);(function(a){var b=t.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;r(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,d)}})(E);(function(a){var b=t.ntri_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(q);(function(a){var b=t.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(u);(function(a){var b=t.nquad_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(F);(function(a){var b=
-t.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;r(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(H);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
-THREE.ColladaLoader=function(){function a(a,d,e){ba=a;d=d||fa;e!==void 0&&(a=e.split("/"),a.pop(),Ba=a.length<1?"":a.join("/")+"/");na=b("//dae:library_images/dae:image",f,"image");pa=b("//dae:library_materials/dae:material",H,"material");sa=b("//dae:library_effects/dae:effect",U,"effect");oa=b("//dae:library_geometries/dae:geometry",q,"geometry");ra=b("//dae:library_controllers/dae:controller",h,"controller");ha=b("//dae:library_animations/dae:animation",Q,"animation");ta=b(".//dae:library_visual_scenes/dae:visual_scene",
-k,"visual_scene");va=[];ua=[];(a=ba.evaluate(".//dae:scene/dae:instance_visual_scene",ba,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ga=ta[a]):ga=null;O=new THREE.Object3D;for(a=0;a<ga.nodes.length;a++)O.add(g(ga.nodes[a]));c();for(var i in ha);i={scene:O,morphs:va,skins:ua,dae:{images:na,materials:pa,effects:sa,geometries:oa,controllers:ra,animations:ha,visualScenes:ta,scene:ga}};d&&d(i);return i}function b(a,b,c){for(var a=ba.evaluate(a,
-ba,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),g=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+g++;d[e.id]=e;e=a.iterateNext()}return d}function c(){var a=1E6,b=-a,c=0,d;for(d in ha)for(var e=ha[d],g=0;g<e.sampler.length;g++){var f=e.sampler[g];f.create();a=Math.min(a,f.startTime);b=Math.max(b,f.endTime);c=Math.max(c,f.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 g=
-a.channels[0].sampler.output[c];g instanceof THREE.Matrix4&&a.world.copy(g)}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 e(a,b,e){var g=ra[b.url];if(!g||!g.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(),b=ga.getChildById(b.skeleton[0],!0)||ga.getChildBySid(b.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,
-m;for(h=0;h<a.vertices.length;h++)g.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);for(e=0;e<f.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(b,n,e);h=n;i=g.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function j(b,c){var d,e,f,g,h,i,j,k,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];f=m[d*3+1];g=m[d*3+2];h=y[e*2];e=y[e*2+1];i=y[f*2];j=y[f*2+1];f=y[g*2];k=y[g*2+1];g=n.faceVertexUvs[0];var o=[];o.push(new THREE.UV(h,e));o.push(new THREE.UV(i,j));o.push(new THREE.UV(f,k));g.push(o)}}
+function k(b,c){var d,e,f,g,h,i,j,k,m,o,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];f=p[d*4+1];g=p[d*4+2];h=p[d*4+3];i=y[e*2];e=y[e*2+1];j=y[f*2];m=y[f*2+1];k=y[g*2];o=y[g*2+1];g=y[h*2];f=y[h*2+1];h=n.faceVertexUvs[0];var q=[];q.push(new THREE.UV(i,e));q.push(new THREE.UV(j,m));q.push(new THREE.UV(k,o));q.push(new THREE.UV(g,f));h.push(q)}}function o(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 p(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 m(b,c,d,e){for(var f,g,h,i,j,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=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];m=d[e*3+2];i=o[e];var p=u[k*3],q=u[k*3+1];k=u[k*3+2];var r=u[m*3],l=u[m*3+1];m=u[m*3+2];n.faces.push(new THREE.Face3(f,
+g,h,[new THREE.Vector3(u[j*3],u[j*3+1],u[j*3+2]),new THREE.Vector3(p,q,k),new THREE.Vector3(r,l,m)],null,i))}}function q(b,c,d,e){for(var f,g,h,i,j,k,m,o,p,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=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];m=d[e*4+1];o=d[e*4+2];p=d[e*4+3];j=q[e];var r=u[m*3],l=u[m*3+1];m=u[m*3+2];var t=u[o*3],v=u[o*3+1];o=u[o*3+2];var w=u[p*3],y=u[p*3+1];p=u[p*3+2];n.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(u[k*
+3],u[k*3+1],u[k*3+2]),new THREE.Vector3(r,l,m),new THREE.Vector3(t,v,o),new THREE.Vector3(w,y,p)],null,j))}}var n=this,r=0,t,u=[],y=[],v,A,z,w,I,F;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);t={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,r,12),header_bytes:e(a,r+12),vertex_coordinate_bytes:e(a,r+13),normal_coordinate_bytes:e(a,r+14),uv_coordinate_bytes:e(a,r+15),vertex_index_bytes:e(a,r+16),normal_index_bytes:e(a,
+r+17),uv_index_bytes:e(a,r+18),material_index_bytes:e(a,r+19),nvertices:i(a,r+20),nnormals:i(a,r+20+4),nuvs:i(a,r+20+8),ntri_flat:i(a,r+20+12),ntri_smooth:i(a,r+20+16),ntri_flat_uv:i(a,r+20+20),ntri_smooth_uv:i(a,r+20+24),nquad_flat:i(a,r+20+28),nquad_smooth:i(a,r+20+32),nquad_flat_uv:i(a,r+20+36),nquad_smooth_uv:i(a,r+20+40)};t.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");r+=t.header_bytes;b=t.vertex_index_bytes*3+t.material_index_bytes;F=t.vertex_index_bytes*
+4+t.material_index_bytes;v=t.ntri_flat*b;A=t.ntri_smooth*(b+t.normal_index_bytes*3);z=t.ntri_flat_uv*(b+t.uv_index_bytes*3);w=t.ntri_smooth_uv*(b+t.normal_index_bytes*3+t.uv_index_bytes*3);I=t.nquad_flat*F;b=t.nquad_smooth*(F+t.normal_index_bytes*4);F=t.nquad_flat_uv*(F+t.uv_index_bytes*4);r+=function(b){var c=t.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}(r);
+r+=function(b){var c=t.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],u.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(r);r+=c(t.nnormals*3);r+=function(b){var c=t.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],y.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(r);v=r+v+c(t.ntri_flat*2);A=v+A+c(t.ntri_smooth*2);z=A+z+c(t.ntri_flat_uv*2);w=z+w+c(t.ntri_smooth_uv*2);I=w+I+c(t.nquad_flat*2);
+b=I+b+c(t.nquad_smooth*2);F=b+F+c(t.nquad_flat_uv*2);(function(a){var b=t.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);j(b,c)}})(A);(function(a){var b=t.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);j(b,d)}})(z);(function(a){var b=t.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;p(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,
+c)}})(b);(function(a){var b=t.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,d)}})(F);(function(a){var b=t.ntri_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(r);(function(a){var b=t.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(v);(function(a){var b=t.nquad_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(w);(function(a){var b=
+t.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(I);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
+THREE.ColladaLoader=function(){function a(a,d,e){ca=a;d=d||W;e!==void 0&&(a=e.split("/"),a.pop(),Ba=a.length<1?"":a.join("/")+"/");na=b("//dae:library_images/dae:image",f,"image");oa=b("//dae:library_materials/dae:material",I,"material");ta=b("//dae:library_effects/dae:effect",T,"effect");ra=b("//dae:library_geometries/dae:geometry",r,"geometry");qa=b("//dae:library_controllers/dae:controller",h,"controller");ia=b("//dae:library_animations/dae:animation",Q,"animation");pa=b(".//dae:library_visual_scenes/dae:visual_scene",
+k,"visual_scene");wa=[];va=[];(a=ca.evaluate(".//dae:scene/dae:instance_visual_scene",ca,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),fa=pa[a]):fa=null;N=new THREE.Object3D;for(a=0;a<fa.nodes.length;a++)N.add(g(fa.nodes[a]));c();for(var i in ia);i={scene:N,morphs:wa,skins:va,dae:{images:na,materials:oa,effects:ta,geometries:ra,controllers:qa,animations:ia,visualScenes:pa,scene:fa}};d&&d(i);return i}function b(a,b,c){for(var a=ca.evaluate(a,
+ca,K,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 c(){var a=1E6,b=-a,c=0,d;for(d in ia)for(var e=ia[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 e(a,b,e){var f=qa[b.url];if(!f||!f.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 g=c(),b=fa.getChildById(b.skeleton[0],!0)||fa.getChildBySid(b.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,
+m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(b,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=
 0;q<i.weights[p].length;q++){var r=i.weights[p][q];r.joint==m&&j.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function g(a){var b=
-new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=ra[a.controllers[f].url];switch(i.type){case "skin":if(oa[i.skin.source]){var j=new n;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(ra[i.skin.source]&&(d=i=ra[i.skin.source],i.morph&&oa[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(oa[i.morph.source])j=new n,
-j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=oa[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=sa[pa[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)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=ra[c.url],j.skinInstanceController=c,j.name="skin_"+ua.length,ua.push(j);else if(d!==void 0){h=i;k=d instanceof m?ra[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=oa[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_"+va.length;va.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
-b.scale);for(f=0;f<a.nodes.length;f++)b.add(g(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
-[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function m(){this.url="";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function t(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function v(){}function z(){this.material="";this.count=
-0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function u(){this.source="";this.stride=this.count=0;this.params=[]}function B(){this.input={}}function A(){this.semantic="";this.offset=0;this.source="";this.set=0}function F(a){this.id=a;this.type=null}function H(){this.name=this.id="";this.instance_effect=null}function E(){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 L(a,
-b){this.type=a;this.effect=b;this.material=null}function s(a){this.effect=a;this.format=this.init_from=null}function G(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function U(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Z(){this.url=""}function Q(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function T(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
-this.dotSyntax=this.sid=null}function $(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ia(a){var b=a.getAttribute("id");if(W[b]!=void 0)return W[b];W[b]=(new F(b)).parse(a);return W[b]}function y(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function N(a){for(var a=w(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function I(a){for(var a=w(a),b=[],c=0;c<
-a.length;c++)b.push(parseInt(a[c],10));return b}function w(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function V(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function R(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 j(a,b){var c="";c+=R(a.x,b)+",";c+=R(a.y,b)+",";c+=R(a.z,b);return c}var ba=null,O=null,ga,fa=null,W=
-{},na={},ha={},ra={},oa={},pa={},sa={},ta,Ba,va,ua,Aa=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new l).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 F).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 A).parse(d))}}return b};l.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=
-N(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 F).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};l.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 A).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()}}};l.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 A).parse(g));break;case "v":c=I(g.textContent);break;case "vcount":d=I(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=
+new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=qa[a.controllers[f].url];switch(i.type){case "skin":if(ra[i.skin.source]){var j=new n;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(qa[i.skin.source]&&(d=i=qa[i.skin.source],i.morph&&ra[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(ra[i.morph.source])j=new n,
+j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=ra[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=ta[oa[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)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=qa[c.url],j.skinInstanceController=c,j.name="skin_"+va.length,va.push(j);else if(d!==void 0){h=i;k=d instanceof m?qa[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=ra[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_"+wa.length;wa.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
+b.scale);for(f=0;f<a.nodes.length;f++)b.add(g(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function j(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
+[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function m(){this.url="";this.skeleton=[];this.instance_material=[]}function q(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function t(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function u(){}function y(){this.material="";this.count=
+0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){this.source="";this.stride=this.count=0;this.params=[]}function A(){this.input={}}function z(){this.semantic="";this.offset=0;this.source="";this.set=0}function w(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function F(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function G(a,
+b){this.type=a;this.effect=b;this.material=null}function s(a){this.effect=a;this.format=this.init_from=null}function E(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function T(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Z(){this.url=""}function Q(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function U(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
+this.dotSyntax=this.sid=null}function $(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ja(a){var b=a.getAttribute("id");if(ba[b]!=void 0)return ba[b];ba[b]=(new w(b)).parse(a);return ba[b]}function K(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function L(a){for(var a=O(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=O(a),b=[],c=
+0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function O(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function V(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function R(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 l(a,b){var c="";c+=R(a.x,b)+",";c+=R(a.y,b)+",";c+=R(a.z,b);return c}var ca=null,N=null,fa,W=null,
+ba={},na={},ia={},qa={},ra={},oa={},ta={},pa,Ba,wa,va,xa=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new j).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 w).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 z).parse(d))}}return b};j.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 w).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};j.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 z).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()}}};j.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 z).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)}};k.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};k.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};k.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 o).parse(c))}}return this};o.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};o.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};o.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};o.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};o.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 o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=ba.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",ba,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;
-case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in ha)for(var e=ha[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=
+1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=ca.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",ca,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;
+case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in ia)for(var e=ia[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};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=N(a.textContent);this.updateMatrix();return this};
+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};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=L(a.textContent);this.updateMatrix();return this};
 p.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],
-this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=ba.evaluate(".//dae:instance_material",c,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null))for(var d=c.iterateNext();d;)this.instance_material.push((new r).parse(d)),d=c.iterateNext()}}return this};r.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=ba.evaluate(".//dae:instance_material",
-c,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new r).parse(b)),b=a.iterateNext();break}}return this};q.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new t(this)).parse(c)}}return this};t.prototype.parse=function(a){function b(a,c){var d=j(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":ia(d);break;case "vertices":this.vertices=(new B).parse(d);break;case "triangles":this.primitives.push((new z).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new v).parse(d))}}var e={};this.geometry3js=new THREE.Geometry;d=W[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+
-1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};t.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,k,l,m,n=0,o=3,p=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":p.push(i.set)}for(;d<
-g.length;){var q=[],r=[],t={},s=[];a.vcount&&(o=a.vcount[n++]);for(e=0;e<o;e++)for(f=0;f<h.length;f++)switch(i=h[f],m=W[i.source],k=g[d+e*h.length+i.offset],l=m.accessor.params.length,l*=k,i.semantic){case "VERTEX":i=j(b.vertices[k].position);q.push(c[i].index);break;case "NORMAL":r.push(new THREE.Vector3(m.data[l],m.data[l+1],m.data[l+2]));break;case "TEXCOORD":t[i.set]===void 0&&(t[i.set]=[]);t[i.set].push(new THREE.UV(m.data[l],m.data[l+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(m.data[l],
-m.data[l+1],m.data[l+2]))}var u;o==3?u=new THREE.Face3(q[0],q[1],q[2],[r[0],r[1],r[2]],s.length?s:new THREE.Color):o==4&&(u=new THREE.Face4(q[0],q[1],q[2],q[3],[r[0],r[1],r[2],r[3]],s.length?s:new THREE.Color));u.daeMaterial=a.material;b.faces.push(u);for(f=0;f<p.length;f++)e=t[p[f]],b.faceVertexUvs[f].push([e[0],e[1],e[2]]);d+=h.length*o}};v.prototype=new z;v.prototype.constructor=v;z.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};z.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=V(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 A).parse(a.childNodes[b]));break;case "vcount":this.vcount=I(c.textContent);break;case "p":this.p=I(c.textContent)}}return this};u.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=V(a,"count",0);this.stride=
-V(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};B.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 A).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};A.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
-"");this.set=V(a,"set",-1);this.offset=V(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};F.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=w(c.textContent),e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=N(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
-I(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=w(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new u).parse(c.childNodes[d]);break}}}return this};F.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};H.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 Z).parse(a.childNodes[b]);break}return this};E.prototype.isColor=
-function(){return this.texture==null};E.prototype.isTexture=function(){return this.texture!=null};E.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=N(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};L.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 E).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=ba.evaluate(".//dae:float",c,y,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};L.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 E)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=na[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(Ba+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=Aa;return this.material=new THREE.MeshLambertMaterial(a)};s.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};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "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};
-U.prototype.create=function(){if(this.shader==null)return null};U.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};U.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 s(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new G(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};U.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};
-U.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 L(c.nodeName,this)).parse(c)}}};Z.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};Q.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 F).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new $(this)).parse(c));break;case "channel":this.channel.push((new T(this)).parse(c))}}return this};T.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};$.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 A).parse(c))}}return this};$.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=
+this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=ca.evaluate(".//dae:instance_material",c,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null))for(var d=c.iterateNext();d;)this.instance_material.push((new q).parse(d)),d=c.iterateNext()}}return this};q.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=ca.evaluate(".//dae:instance_material",
+c,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new q).parse(b)),b=a.iterateNext();break}}return this};r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new t(this)).parse(c)}}return this};t.prototype.parse=function(a){function b(a,c){var d=l(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=
+0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":ja(d);break;case "vertices":this.vertices=(new A).parse(d);break;case "triangles":this.primitives.push((new y).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new u).parse(d))}}var e={};this.geometry3js=new THREE.Geometry;d=ba[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],
+d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};t.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,m,n=0,o=3,p=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":p.push(i.set)}for(;d<
+g.length;){var q=[],r=[],t={},s=[];a.vcount&&(o=a.vcount[n++]);for(e=0;e<o;e++)for(f=0;f<h.length;f++)switch(i=h[f],m=ba[i.source],j=g[d+e*h.length+i.offset],k=m.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=l(b.vertices[j].position);q.push(c[i].index);break;case "NORMAL":r.push(new THREE.Vector3(m.data[k],m.data[k+1],m.data[k+2]));break;case "TEXCOORD":t[i.set]===void 0&&(t[i.set]=[]);t[i.set].push(new THREE.UV(m.data[k],m.data[k+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(m.data[k],
+m.data[k+1],m.data[k+2]))}var u;o==3?u=new THREE.Face3(q[0],q[1],q[2],[r[0],r[1],r[2]],s.length?s:new THREE.Color):o==4&&(u=new THREE.Face4(q[0],q[1],q[2],q[3],[r[0],r[1],r[2],r[3]],s.length?s:new THREE.Color));u.daeMaterial=a.material;b.faces.push(u);for(f=0;f<p.length;f++)e=t[p[f]],b.faceVertexUvs[f].push([e[0],e[1],e[2]]);d+=h.length*o}};u.prototype=new y;u.prototype.constructor=u;y.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};y.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=V(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 z).parse(a.childNodes[b]));break;case "vcount":this.vcount=H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};v.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=V(a,"count",0);this.stride=
+V(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 z).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};z.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
+"");this.set=V(a,"set",-1);this.offset=V(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};w.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=O(c.textContent),e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=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=O(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new v).parse(c.childNodes[d]);break}}}return this};w.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};I.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 Z).parse(a.childNodes[b]);break}return this};F.prototype.isColor=
+function(){return this.texture==null};F.prototype.isTexture=function(){return this.texture!=null};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=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};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=
+a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new F).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=ca.evaluate(".//dae:float",c,K,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};G.prototype.create=function(){var a=
+{},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof F)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=na[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(Ba+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=xa;return this.material=new THREE.MeshLambertMaterial(a)};s.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};E.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};
+T.prototype.create=function(){if(this.shader==null)return null};T.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};T.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 s(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new E(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};T.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};
+T.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 G(c.nodeName,this)).parse(c)}}};Z.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};Q.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 w).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new $(this)).parse(c));break;case "channel":this.channel.push((new U(this)).parse(c))}}return this};U.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};$.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 z).parse(c))}}return this};$.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))fa=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){Aa=a},applySkin:e,geometries:oa}};
+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))W=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){xa=a},applySkin:e,geometries:ra}};
 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,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0)try{var h=JSON.parse(g.responseText);a.createModel(h,c,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+g.status+"]");else g.readyState==3?e&&(f==0&&(f=g.getResponseHeader("Content-Length")),e({total:f,loaded:g.responseText.length})):
 g.readyState==2&&(f=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,l,k,o,p,m,r,n,q,t,v,z,u=a.faces;o=a.vertices;var B=a.normals,A=a.colors,F=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&F++;for(c=0;c<F;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(k=o.length;l<
-k;)p=new THREE.Vertex,p.position.x=o[l++]*b,p.position.y=o[l++]*b,p.position.z=o[l++]*b,d.vertices.push(p);l=0;for(k=u.length;l<k;){b=u[l++];o=b&1;i=b&2;c=b&4;e=b&8;m=b&16;p=b&32;n=b&64;b&=128;o?(q=new THREE.Face4,q.a=u[l++],q.b=u[l++],q.c=u[l++],q.d=u[l++],o=4):(q=new THREE.Face3,q.a=u[l++],q.b=u[l++],q.c=u[l++],o=3);if(i)i=u[l++],q.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<F;c++)t=a.uvs[c],r=u[l++],z=t[r*2],r=t[r*2+1],d.faceUvs[c][i]=new THREE.UV(z,r);if(e)for(c=0;c<F;c++){t=a.uvs[c];v=[];
-for(e=0;e<o;e++)r=u[l++],z=t[r*2],r=t[r*2+1],v[e]=new THREE.UV(z,r);d.faceVertexUvs[c][i]=v}if(m)m=u[l++]*3,e=new THREE.Vector3,e.x=B[m++],e.y=B[m++],e.z=B[m],q.normal=e;if(p)for(c=0;c<o;c++)m=u[l++]*3,e=new THREE.Vector3,e.x=B[m++],e.y=B[m++],e.z=B[m],q.vertexNormals.push(e);if(n)p=u[l++],p=new THREE.Color(A[p]),q.color=p;if(b)for(c=0;c<o;c++)p=u[l++],p=new THREE.Color(A[p]),q.vertexColors.push(p);d.faces.push(q)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
-2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,l,k,o,p,m,r;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];m=d.morphTargets[c].vertices;
-r=a.morphTargets[c].vertices;i=0;for(l=r.length;i<l;i+=3)k=r[i]*b,o=r[i+1]*b,p=r[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(k,o,p)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b+=3)o=new THREE.Color(16755200),o.setRGB(k[b],k[b+1],k[b+2]),l.push(o)}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,j,k,o,p,m,q,n,r,t,u,y,v=a.faces;o=a.vertices;var A=a.normals,z=a.colors,w=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&w++;for(c=0;c<w;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(k=o.length;j<
+k;)p=new THREE.Vertex,p.position.x=o[j++]*b,p.position.y=o[j++]*b,p.position.z=o[j++]*b,d.vertices.push(p);j=0;for(k=v.length;j<k;){b=v[j++];o=b&1;i=b&2;c=b&4;e=b&8;m=b&16;p=b&32;n=b&64;b&=128;o?(r=new THREE.Face4,r.a=v[j++],r.b=v[j++],r.c=v[j++],r.d=v[j++],o=4):(r=new THREE.Face3,r.a=v[j++],r.b=v[j++],r.c=v[j++],o=3);if(i)i=v[j++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<w;c++)t=a.uvs[c],q=v[j++],y=t[q*2],q=t[q*2+1],d.faceUvs[c][i]=new THREE.UV(y,q);if(e)for(c=0;c<w;c++){t=a.uvs[c];u=[];
+for(e=0;e<o;e++)q=v[j++],y=t[q*2],q=t[q*2+1],u[e]=new THREE.UV(y,q);d.faceVertexUvs[c][i]=u}if(m)m=v[j++]*3,e=new THREE.Vector3,e.x=A[m++],e.y=A[m++],e.z=A[m],r.normal=e;if(p)for(c=0;c<o;c++)m=v[j++]*3,e=new THREE.Vector3,e.x=A[m++],e.y=A[m++],e.z=A[m],r.vertexNormals.push(e);if(n)p=v[j++],p=new THREE.Color(z[p]),r.color=p;if(b)for(c=0;c<o;c++)p=v[j++],p=new THREE.Color(z[p]),r.vertexColors.push(p);d.faces.push(r)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
+2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,j,k,o,p,m,q;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];m=d.morphTargets[c].vertices;
+q=a.morphTargets[c].vertices;i=0;for(j=q.length;i<j;i+=3)k=q[i]*b,o=q[i+1]*b,p=q[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(k,o,p)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b+=3)o=new THREE.Color(16755200),o.setRGB(k[b],k[b+1],k[b+2]),j.push(o)}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
 d.computeTangents();b(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,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var e=JSON.parse(d.responseText);e.metadata===void 0||e.metadata.formatVersion===void 0||e.metadata.formatVersion!==3?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(g){console.error(g),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,b,c){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function e(){var a;for(p in U.objects)if(!y.objects[p])if(t=U.objects[p],t.geometry!==void 0){if(E=y.geometries[t.geometry]){a=!1;for(I=0;I<t.materials.length;I++)G=y.materials[t.materials[I]],a=G instanceof THREE.ShaderMaterial;a&&E.computeTangents();u=t.position;B=t.rotation;A=t.quaternion;F=t.scale;A=0;G.length==0&&(G=new THREE.MeshFaceMaterial);G.length>1&&(G=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(E,G);a.name=p;a.position.set(u[0],u[1],u[2]);A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(B[0],B[1],B[2]);a.scale.set(F[0],F[1],F[2]);a.visible=t.visible;y.scene.add(a);y.objects[p]=a;if(t.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);y.scene.collisions.colliders.push(b)}if(t.castsShadow)b=new THREE.ShadowVolume(E),y.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;t.trigger&&t.trigger.toLowerCase()!="none"&&(b=
-{type:t.trigger,object:t},y.triggers[a.name]=b)}}else u=t.position,B=t.rotation,A=t.quaternion,F=t.scale,A=0,a=new THREE.Object3D,a.name=p,a.position.set(u[0],u[1],u[2]),A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(B[0],B[1],B[2]),a.scale.set(F[0],F[1],F[2]),a.visible=t.visible!==void 0?t.visible:!1,y.scene.add(a),y.objects[p]=a,y.empties[p]=a,t.trigger&&t.trigger.toLowerCase()!="none"&&(b={type:t.trigger,object:t},y.triggers[a.name]=b)}function g(a){return function(b){y.geometries[a]=
-b;e();Q-=1;i.onLoadComplete();h()}}function f(a){return function(b){y.geometries[a]=b}}function h(){i.callbackProgress({totalModels:$,totalTextures:ia,loadedModels:$-Q,loadedTextures:ia-T},y);i.onLoadProgress();Q==0&&T==0&&b(y)}var i=this,l=THREE.Loader.prototype.extractUrlbase(c),k,o,p,m,r,n,q,t,v,z,u,B,A,F,H,E,L,s,G,U,Z,Q,T,$,ia,y;U=a;c=new THREE.BinaryLoader;Z=new THREE.JSONLoader;T=Q=0;y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
-empties:{}};a=!1;for(p in U.objects)if(t=U.objects[p],t.meshCollider){a=!0;break}if(a)y.scene.collisions=new THREE.CollisionSystem;if(U.transform){a=U.transform.position;v=U.transform.rotation;var N=U.transform.scale;a&&y.scene.position.set(a[0],a[1],a[2]);v&&y.scene.rotation.set(v[0],v[1],v[2]);N&&y.scene.scale.set(N[0],N[1],N[2]);(a||v||N)&&y.scene.updateMatrix()}a=function(){T-=1;h();i.onLoadComplete()};for(r in U.cameras)v=U.cameras[r],v.type=="perspective"?L=new THREE.PerspectiveCamera(v.fov,
-v.aspect,v.near,v.far):v.type=="ortho"&&(L=new THREE.OrthographicCamera(v.left,v.right,v.top,v.bottom,v.near,v.far)),u=v.position,v=v.target,L.position.set(u[0],u[1],u[2]),L.target=new THREE.Vector3(v[0],v[1],v[2]),y.cameras[r]=L;for(m in U.lights)v=U.lights[m],r=v.color!==void 0?v.color:16777215,L=v.intensity!==void 0?v.intensity:1,v.type=="directional"?(u=v.direction,z=new THREE.DirectionalLight(r,L),z.position.set(u[0],u[1],u[2]),z.position.normalize()):v.type=="point"?(u=v.position,z=v.distance,
-z=new THREE.PointLight(r,L,z),z.position.set(u[0],u[1],u[2])):v.type=="ambient"&&(z=new THREE.AmbientLight(r)),y.scene.add(z),y.lights[m]=z;for(n in U.fogs)m=U.fogs[n],m.type=="linear"?s=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(s=new THREE.FogExp2(0,m.density)),v=m.color,s.color.setRGB(v[0],v[1],v[2]),y.fogs[n]=s;if(y.cameras&&U.defaults.camera)y.currentCamera=y.cameras[U.defaults.camera];if(y.fogs&&U.defaults.fog)y.scene.fog=y.fogs[U.defaults.fog];v=U.defaults.bgcolor;y.bgColor=new THREE.Color;
-y.bgColor.setRGB(v[0],v[1],v[2]);y.bgColorAlpha=U.defaults.bgalpha;for(k in U.geometries)if(n=U.geometries[k],n.type=="bin_mesh"||n.type=="ascii_mesh")Q+=1,i.onLoadStart();$=Q;for(k in U.geometries)n=U.geometries[k],n.type=="cube"?(E=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),y.geometries[k]=E):n.type=="plane"?(E=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),y.geometries[k]=E):n.type=="sphere"?
-(E=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),y.geometries[k]=E):n.type=="cylinder"?(E=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),y.geometries[k]=E):n.type=="torus"?(E=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),y.geometries[k]=E):n.type=="icosahedron"?(E=new THREE.IcosahedronGeometry(n.subdivisions),y.geometries[k]=E):n.type=="bin_mesh"?c.load(d(n.url,U.urlBaseType),g(k)):n.type=="ascii_mesh"?Z.load(d(n.url,U.urlBaseType),
-g(k)):n.type=="embedded_mesh"&&(n=U.embeds[n.id])&&Z.createModel(n,f(k),"");for(q in U.textures)if(k=U.textures[q],k.url instanceof Array){T+=k.url.length;for(n=0;n<k.url.length;n++)i.onLoadStart()}else T+=1,i.onLoadStart();ia=T;for(q in U.textures){k=U.textures[q];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){n=[];for(var I=0;I<k.url.length;I++)n[I]=d(k.url[I],U.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,k.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(k.url,
-U.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)n.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=void 0)n.magFilter=THREE[k.magFilter];if(k.repeat){n.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}k.offset&&n.offset.set(k.offset[0],k.offset[1]);if(k.wrap){s={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(s[k.wrap[0]]!==void 0)n.wrapS=s[k.wrap[0]];if(s[k.wrap[1]]!==void 0)n.wrapT=
-s[k.wrap[1]]}}y.textures[q]=n}for(o in U.materials){q=U.materials[o];for(H in q.parameters)if(H=="envMap"||H=="map"||H=="lightMap")q.parameters[H]=y.textures[q.parameters[H]];else if(H=="shading")q.parameters[H]=q.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H=="blending")q.parameters[H]=THREE[q.parameters[H]]?THREE[q.parameters[H]]:THREE.NormalBlending;else if(H=="combine")q.parameters[H]=q.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(H==
-"vertexColors")if(q.parameters[H]=="face")q.parameters[H]=THREE.FaceColors;else if(q.parameters[H])q.parameters[H]=THREE.VertexColors;if(q.parameters.opacity!==void 0&&q.parameters.opacity<1)q.parameters.transparent=!0;if(q.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);n=q.parameters.color;s=q.parameters.specular;c=q.parameters.ambient;Z=q.parameters.shininess;a.tNormal.texture=y.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)a.uNormalScale.value=
-q.parameters.normalMapFactor;if(q.parameters.map)a.tDiffuse.texture=q.parameters.map,a.enableDiffuse.value=!0;if(q.parameters.lightMap)a.tAO.texture=q.parameters.lightMap,a.enableAO.value=!0;if(q.parameters.specularMap)a.tSpecular.texture=y.textures[q.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(s);a.uAmbientColor.value.setHex(c);a.uShininess.value=Z;if(q.parameters.opacity)a.uOpacity.value=q.parameters.opacity;q=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
-vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else q=new THREE[q.type](q.parameters);y.materials[o]=q}e();i.callbackSync(y);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function e(){var a;for(p in T.objects)if(!K.objects[p])if(t=T.objects[p],t.geometry!==void 0){if(F=K.geometries[t.geometry]){a=!1;for(H=0;H<t.materials.length;H++)E=K.materials[t.materials[H]],a=E instanceof THREE.ShaderMaterial;a&&F.computeTangents();v=t.position;A=t.rotation;z=t.quaternion;w=t.scale;z=0;E.length==0&&(E=new THREE.MeshFaceMaterial);E.length>1&&(E=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(F,E);a.name=p;a.position.set(v[0],v[1],v[2]);z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(A[0],A[1],A[2]);a.scale.set(w[0],w[1],w[2]);a.visible=t.visible;K.scene.add(a);K.objects[p]=a;if(t.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);K.scene.collisions.colliders.push(b)}if(t.castsShadow)b=new THREE.ShadowVolume(F),K.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;t.trigger&&t.trigger.toLowerCase()!="none"&&(b=
+{type:t.trigger,object:t},K.triggers[a.name]=b)}}else v=t.position,A=t.rotation,z=t.quaternion,w=t.scale,z=0,a=new THREE.Object3D,a.name=p,a.position.set(v[0],v[1],v[2]),z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(A[0],A[1],A[2]),a.scale.set(w[0],w[1],w[2]),a.visible=t.visible!==void 0?t.visible:!1,K.scene.add(a),K.objects[p]=a,K.empties[p]=a,t.trigger&&t.trigger.toLowerCase()!="none"&&(b={type:t.trigger,object:t},K.triggers[a.name]=b)}function g(a){return function(b){K.geometries[a]=
+b;e();Q-=1;i.onLoadComplete();h()}}function f(a){return function(b){K.geometries[a]=b}}function h(){i.callbackProgress({totalModels:$,totalTextures:ja,loadedModels:$-Q,loadedTextures:ja-U},K);i.onLoadProgress();Q==0&&U==0&&b(K)}var i=this,j=THREE.Loader.prototype.extractUrlbase(c),k,o,p,m,q,n,r,t,u,y,v,A,z,w,I,F,G,s,E,T,Z,Q,U,$,ja,K;T=a;c=new THREE.BinaryLoader;Z=new THREE.JSONLoader;U=Q=0;K={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+empties:{}};a=!1;for(p in T.objects)if(t=T.objects[p],t.meshCollider){a=!0;break}if(a)K.scene.collisions=new THREE.CollisionSystem;if(T.transform){a=T.transform.position;u=T.transform.rotation;var L=T.transform.scale;a&&K.scene.position.set(a[0],a[1],a[2]);u&&K.scene.rotation.set(u[0],u[1],u[2]);L&&K.scene.scale.set(L[0],L[1],L[2]);(a||u||L)&&K.scene.updateMatrix()}a=function(){U-=1;h();i.onLoadComplete()};for(q in T.cameras)u=T.cameras[q],u.type=="perspective"?G=new THREE.PerspectiveCamera(u.fov,
+u.aspect,u.near,u.far):u.type=="ortho"&&(G=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far)),v=u.position,u=u.target,G.position.set(v[0],v[1],v[2]),G.target=new THREE.Vector3(u[0],u[1],u[2]),K.cameras[q]=G;for(m in T.lights)u=T.lights[m],q=u.color!==void 0?u.color:16777215,G=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(v=u.direction,y=new THREE.DirectionalLight(q,G),y.position.set(v[0],v[1],v[2]),y.position.normalize()):u.type=="point"?(v=u.position,y=u.distance,
+y=new THREE.PointLight(q,G,y),y.position.set(v[0],v[1],v[2])):u.type=="ambient"&&(y=new THREE.AmbientLight(q)),K.scene.add(y),K.lights[m]=y;for(n in T.fogs)m=T.fogs[n],m.type=="linear"?s=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(s=new THREE.FogExp2(0,m.density)),u=m.color,s.color.setRGB(u[0],u[1],u[2]),K.fogs[n]=s;if(K.cameras&&T.defaults.camera)K.currentCamera=K.cameras[T.defaults.camera];if(K.fogs&&T.defaults.fog)K.scene.fog=K.fogs[T.defaults.fog];u=T.defaults.bgcolor;K.bgColor=new THREE.Color;
+K.bgColor.setRGB(u[0],u[1],u[2]);K.bgColorAlpha=T.defaults.bgalpha;for(k in T.geometries)if(n=T.geometries[k],n.type=="bin_mesh"||n.type=="ascii_mesh")Q+=1,i.onLoadStart();$=Q;for(k in T.geometries)n=T.geometries[k],n.type=="cube"?(F=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),K.geometries[k]=F):n.type=="plane"?(F=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),K.geometries[k]=F):n.type=="sphere"?
+(F=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),K.geometries[k]=F):n.type=="cylinder"?(F=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),K.geometries[k]=F):n.type=="torus"?(F=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),K.geometries[k]=F):n.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(n.subdivisions),K.geometries[k]=F):n.type=="bin_mesh"?c.load(d(n.url,T.urlBaseType),g(k)):n.type=="ascii_mesh"?Z.load(d(n.url,T.urlBaseType),
+g(k)):n.type=="embedded_mesh"&&(n=T.embeds[n.id])&&Z.createModel(n,f(k),"");for(r in T.textures)if(k=T.textures[r],k.url instanceof Array){U+=k.url.length;for(n=0;n<k.url.length;n++)i.onLoadStart()}else U+=1,i.onLoadStart();ja=U;for(r in T.textures){k=T.textures[r];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){n=[];for(var H=0;H<k.url.length;H++)n[H]=d(k.url[H],T.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,k.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(k.url,
+T.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)n.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=void 0)n.magFilter=THREE[k.magFilter];if(k.repeat){n.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}k.offset&&n.offset.set(k.offset[0],k.offset[1]);if(k.wrap){s={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(s[k.wrap[0]]!==void 0)n.wrapS=s[k.wrap[0]];if(s[k.wrap[1]]!==void 0)n.wrapT=
+s[k.wrap[1]]}}K.textures[r]=n}for(o in T.materials){r=T.materials[o];for(I in r.parameters)if(I=="envMap"||I=="map"||I=="lightMap")r.parameters[I]=K.textures[r.parameters[I]];else if(I=="shading")r.parameters[I]=r.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")r.parameters[I]=THREE[r.parameters[I]]?THREE[r.parameters[I]]:THREE.NormalBlending;else if(I=="combine")r.parameters[I]=r.parameters[I]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(I==
+"vertexColors")if(r.parameters[I]=="face")r.parameters[I]=THREE.FaceColors;else if(r.parameters[I])r.parameters[I]=THREE.VertexColors;if(r.parameters.opacity!==void 0&&r.parameters.opacity<1)r.parameters.transparent=!0;if(r.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);n=r.parameters.color;s=r.parameters.specular;c=r.parameters.ambient;Z=r.parameters.shininess;a.tNormal.texture=K.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)a.uNormalScale.value=
+r.parameters.normalMapFactor;if(r.parameters.map)a.tDiffuse.texture=r.parameters.map,a.enableDiffuse.value=!0;if(r.parameters.lightMap)a.tAO.texture=r.parameters.lightMap,a.enableAO.value=!0;if(r.parameters.specularMap)a.tSpecular.texture=K.textures[r.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(s);a.uAmbientColor.value.setHex(c);a.uShininess.value=Z;if(r.parameters.opacity)a.uOpacity.value=r.parameters.opacity;r=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
+vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else r=new THREE[r.type](r.parameters);K.materials[o]=r}e();i.callbackSync(K);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var d=new XMLHttpRequest,e=c.scale!==void 0?c.scale:1,g=c.offsetX!==void 0?c.offsetX:0,f=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 b,e,g,f,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;e<8;e++){for(var g=0,f=0;f<b;++f){var h=a.charCodeAt(f+d);g+=h>>1^-(h&1);c[8*f+e]=g}d+=b}b=a.length-d;g=new Uint16Array(b);for(e=f=0;e<b;e++)h=a.charCodeAt(e+d),g[e]=f-h,h==0&&f++;return[c,g]};
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],k=[];(function(a,f,i){for(var k,l,q,t=a.length;i<t;i+=f)k=a[i],l=a[i+1],q=a[i+2],k=k/16383*c,l=l/16383*c,q=q/16383*c,k+=d,l+=e,q+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,q)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(f[0],8,3);(function(a,
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,l.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,v,z,u,B=a.length;for(c=0;c<B;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;z=d;u=e;i=f;v=d;var A=e,F=f,H=g.materials[0],E=l[A*3],L=l[A*3+1],A=l[A*3+2],s=l[F*3],G=l[F*3+1],F=l[F*3+2];v=new THREE.Vector3(l[v*3],l[v*3+1],l[v*3+2]);A=new THREE.Vector3(E,L,A);F=new THREE.Vector3(s,G,F);g.faces.push(new THREE.Face3(z,u,i,[v,A,F],null,H));g=k[d*2];d=k[d*2+
-1];i=k[e*2];v=k[e*2+1];z=k[f*2];u=k[f*2+1];f=b.faceVertexUvs[0];e=i;i=v;v=[];v.push(new THREE.UV(g,d));v.push(new THREE.UV(e,i));v.push(new THREE.UV(z,u));f.push(v)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,f,i){for(var j,k,r,t=a.length;i<t;i+=f)j=a[i],k=a[i+1],r=a[i+2],j=j/16383*c,k=k/16383*c,r=r/16383*c,j+=d,k+=e,r+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,r)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(f[0],8,3);(function(a,
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,j.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,u,y,v,A=a.length;for(c=0;c<A;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;y=d;v=e;i=f;u=d;var z=e,w=f,I=g.materials[0],F=j[z*3],G=j[z*3+1],z=j[z*3+2],s=j[w*3],E=j[w*3+1],w=j[w*3+2];u=new THREE.Vector3(j[u*3],j[u*3+1],j[u*3+2]);z=new THREE.Vector3(F,G,z);w=new THREE.Vector3(s,E,w);g.faces.push(new THREE.Face3(y,v,i,[u,z,w],null,I));g=k[d*2];d=k[d*2+
+1];i=k[e*2];u=k[e*2+1];y=k[f*2];v=k[f*2+1];f=b.faceVertexUvs[0];e=i;i=u;u=[];u.push(new THREE.UV(g,d));u.push(new THREE.UV(e,i));u.push(new THREE.UV(y,v));f.push(u)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;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,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,l,k,o){f=(f-k)/(o-k);k=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=l;e[g]=this.lerp(k[a],k[a+3],f);e[g+1]=this.lerp(k[a+1],k[a+4],f);e[g+2]=this.lerp(k[a+2],k[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,l,k,o){f=(f-k)/(o-k);k=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=l;b=a+this.yd*
-3;e[g]=this.lerp(k[a],k[b],f);e[g+1]=this.lerp(k[a+1],k[b+1],f);e[g+2]=this.lerp(k[a+2],k[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,l,k,o){f=(f-k)/(o-k);k=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=l+f*this.delta;b=a+this.zd*3;e[g]=this.lerp(k[a],k[b],f);e[g+1]=this.lerp(k[a+1],k[b+1],f);e[g+2]=this.lerp(k[a+2],k[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
-this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,l=g+this.yd,k=g+this.zd,o=i+this.yd,p=i+this.zd,m=g+this.yd+this.zd,r=i+this.yd+this.zd,n=0,q=this.field[g],t=this.field[i],v=this.field[l],z=this.field[o],u=this.field[k],B=this.field[p],A=this.field[m],F=this.field[r];q<f&&(n|=1);t<f&&(n|=2);v<f&&(n|=8);z<f&&(n|=4);u<f&&(n|=16);B<f&&(n|=32);A<f&&(n|=128);F<f&&(n|=64);var H=THREE.edgeTable[n];if(H===0)return 0;var E=this.delta,L=a+
-E,s=b+E,E=e+E;H&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,q,t));H&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(i*3,this.vlist,this.nlist,3,f,L,b,e,t,z));H&4&&(this.compNorm(l),this.compNorm(o),this.VIntX(l*3,this.vlist,this.nlist,6,f,a,s,e,v,z));H&8&&(this.compNorm(g),this.compNorm(l),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,q,v));H&16&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,12,f,a,b,E,u,B));H&32&&(this.compNorm(p),
-this.compNorm(r),this.VIntY(p*3,this.vlist,this.nlist,15,f,L,b,E,B,F));H&64&&(this.compNorm(m),this.compNorm(r),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,s,E,A,F));H&128&&(this.compNorm(k),this.compNorm(m),this.VIntY(k*3,this.vlist,this.nlist,21,f,a,b,E,u,A));H&256&&(this.compNorm(g),this.compNorm(k),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,q,u));H&512&&(this.compNorm(i),this.compNorm(p),this.VIntZ(i*3,this.vlist,this.nlist,27,f,L,b,e,t,B));H&1024&&(this.compNorm(o),this.compNorm(r),this.VIntZ(o*
-3,this.vlist,this.nlist,30,f,L,s,e,z,F));H&2048&&(this.compNorm(l),this.compNorm(m),this.VIntZ(l*3,this.vlist,this.nlist,33,f,a,s,e,v,A));n<<=4;for(f=g=0;THREE.triTable[n+f]!=-1;)a=n+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
+this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,j,k,o){f=(f-k)/(o-k);k=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=j;e[g]=this.lerp(k[a],k[a+3],f);e[g+1]=this.lerp(k[a+1],k[a+4],f);e[g+2]=this.lerp(k[a+2],k[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,j,k,o){f=(f-k)/(o-k);k=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=j;b=a+this.yd*
+3;e[g]=this.lerp(k[a],k[b],f);e[g+1]=this.lerp(k[a+1],k[b+1],f);e[g+2]=this.lerp(k[a+2],k[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,j,k,o){f=(f-k)/(o-k);k=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=j+f*this.delta;b=a+this.zd*3;e[g]=this.lerp(k[a],k[b],f);e[g+1]=this.lerp(k[a+1],k[b+1],f);e[g+2]=this.lerp(k[a+2],k[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,j=g+this.yd,k=g+this.zd,o=i+this.yd,p=i+this.zd,m=g+this.yd+this.zd,q=i+this.yd+this.zd,n=0,r=this.field[g],t=this.field[i],u=this.field[j],y=this.field[o],v=this.field[k],A=this.field[p],z=this.field[m],w=this.field[q];r<f&&(n|=1);t<f&&(n|=2);u<f&&(n|=8);y<f&&(n|=4);v<f&&(n|=16);A<f&&(n|=32);z<f&&(n|=128);w<f&&(n|=64);var I=THREE.edgeTable[n];if(I===0)return 0;var F=this.delta,G=a+
+F,s=b+F,F=e+F;I&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,r,t));I&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(i*3,this.vlist,this.nlist,3,f,G,b,e,t,y));I&4&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,6,f,a,s,e,u,y));I&8&&(this.compNorm(g),this.compNorm(j),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,r,u));I&16&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,12,f,a,b,F,v,A));I&32&&(this.compNorm(p),
+this.compNorm(q),this.VIntY(p*3,this.vlist,this.nlist,15,f,G,b,F,A,w));I&64&&(this.compNorm(m),this.compNorm(q),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,s,F,z,w));I&128&&(this.compNorm(k),this.compNorm(m),this.VIntY(k*3,this.vlist,this.nlist,21,f,a,b,F,v,z));I&256&&(this.compNorm(g),this.compNorm(k),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,r,v));I&512&&(this.compNorm(i),this.compNorm(p),this.VIntZ(i*3,this.vlist,this.nlist,27,f,G,b,e,t,A));I&1024&&(this.compNorm(o),this.compNorm(q),this.VIntZ(o*
+3,this.vlist,this.nlist,30,f,G,s,e,y,w));I&2048&&(this.compNorm(j),this.compNorm(m),this.VIntZ(j*3,this.vlist,this.nlist,33,f,a,s,e,u,z));n<<=4;for(f=g=0;THREE.triTable[n+f]!=-1;)a=n+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
 4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=b[e];this.normalArray[i+1]=b[e+1];this.normalArray[i+2]=b[e+2];this.normalArray[i+3]=b[g];this.normalArray[i+4]=b[g+1];this.normalArray[i+5]=b[g+2];this.normalArray[i+6]=b[f];this.normalArray[i+7]=b[f+1];this.normalArray[i+8]=b[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,l=b*this.size,k=a*this.size,o=Math.floor(i-h);o<1&&(o=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var p=Math.floor(l-h);p<1&&(p=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var m=Math.floor(k-h);m<1&&(m=1);h=Math.floor(k+h);h>this.size-1&&(h=this.size-
-1);for(var r,n,q,t,v,z;o<i;o++){k=this.size2*o;n=o/this.size-e;v=n*n;for(n=p;n<l;n++){q=k+this.size*n;r=n/this.size-b;z=r*r;for(r=m;r<h;r++)t=r/this.size-a,t=g/(1.0E-6+t*t+z+v)-f,t>0&&(this.field[q+r]+=t)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,l=this.size,k=this.yd,o=this.zd,p=this.field,m=l*Math.sqrt(a/b);m>l&&(m=l);for(e=0;e<m;e++)if(g=e/l,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<l;g++){i=e+g*k;for(f=0;f<l;f++)p[o*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,l,k=this.size,o=this.yd,p=
-this.zd,m=this.field,r=k*Math.sqrt(a/b);r>k&&(r=k);for(g=0;g<r;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-b,h>0){i=g*o;for(e=0;e<k;e++){l=i+e;for(f=0;f<k;f++)m[p*f+l]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,l,k=this.size,o=this.yd,p=this.zd,m=this.field,r=k*Math.sqrt(a/b);r>k&&(r=k);for(f=0;f<r;f++)if(e=f/k,e*=e,h=a/(1.0E-4+e)-b,h>0){i=p*f;for(g=0;g<k;g++){l=i+g*o;for(e=0;e<k;e++)m[l+e]+=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 b,e,g,f,h,i,l,k,o,p=this.size-2;for(f=1;f<p;f++){o=this.size2*f;l=(f-this.halfsize)/this.halfsize;for(g=1;g<p;g++){k=o+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<p;e++)h=(e-this.halfsize)/this.halfsize,b=k+e,this.polygonize(h,i,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,l,k,o,p,m;for(f=0;f<g.count;f++)p=f*3,k=p+1,m=p+2,h=g.positionArray[p],i=g.positionArray[k],l=
-g.positionArray[m],o=new THREE.Vector3(h,i,l),h=g.normalArray[p],i=g.normalArray[k],l=g.normalArray[m],p=new THREE.Vector3(h,i,l),p.normalize(),k=new THREE.Vertex(o),b.vertices.push(k),e.push(p);o=g.count/3;for(f=0;f<o;f++)p=(a+f)*3,k=p+1,m=p+2,h=e[p],i=e[k],l=e[m],p=new THREE.Face3(p,k,m,[h,i,l]),b.faces.push(p);a+=o;g.count=0});return b};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 b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,j=b*this.size,k=a*this.size,o=Math.floor(i-h);o<1&&(o=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var p=Math.floor(j-h);p<1&&(p=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var m=Math.floor(k-h);m<1&&(m=1);h=Math.floor(k+h);h>this.size-1&&(h=this.size-
+1);for(var q,n,r,t,u,y;o<i;o++){k=this.size2*o;n=o/this.size-e;u=n*n;for(n=p;n<j;n++){r=k+this.size*n;q=n/this.size-b;y=q*q;for(q=m;q<h;q++)t=q/this.size-a,t=g/(1.0E-6+t*t+y+u)-f,t>0&&(this.field[r+q]+=t)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,j=this.size,k=this.yd,o=this.zd,p=this.field,m=j*Math.sqrt(a/b);m>j&&(m=j);for(e=0;e<m;e++)if(g=e/j,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<j;g++){i=e+g*k;for(f=0;f<j;f++)p[o*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,j,k=this.size,o=this.yd,p=
+this.zd,m=this.field,q=k*Math.sqrt(a/b);q>k&&(q=k);for(g=0;g<q;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-b,h>0){i=g*o;for(e=0;e<k;e++){j=i+e;for(f=0;f<k;f++)m[p*f+j]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,j,k=this.size,o=this.yd,p=this.zd,m=this.field,q=k*Math.sqrt(a/b);q>k&&(q=k);for(f=0;f<q;f++)if(e=f/k,e*=e,h=a/(1.0E-4+e)-b,h>0){i=p*f;for(g=0;g<k;g++){j=i+g*o;for(e=0;e<k;e++)m[j+e]+=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 b,e,g,f,h,i,j,k,o,p=this.size-2;for(f=1;f<p;f++){o=this.size2*f;j=(f-this.halfsize)/this.halfsize;for(g=1;g<p;g++){k=o+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<p;e++)h=(e-this.halfsize)/this.halfsize,b=k+e,this.polygonize(h,i,j,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,j,k,o,p,m;for(f=0;f<g.count;f++)p=f*3,k=p+1,m=p+2,h=g.positionArray[p],i=g.positionArray[k],j=
+g.positionArray[m],o=new THREE.Vector3(h,i,j),h=g.normalArray[p],i=g.normalArray[k],j=g.normalArray[m],p=new THREE.Vector3(h,i,j),p.normalize(),k=new THREE.Vertex(o),b.vertices.push(k),e.push(p);o=g.count/3;for(f=0;f<o;f++)p=(a+f)*3,k=p+1,m=p+2,h=e[p],i=e[k],j=e[m],p=new THREE.Face3(p,k,m,[h,i,j]),b.faces.push(p);a+=o;g.count=0});return b};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]);
@@ -707,16 +698,27 @@ d.vertices[e++]=1;d.vertices[e++]=-1;d.vertices[e++]=1;d.vertices[e++]=0;d.verti
 d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);d.tempTexture=b.createTexture();d.occlusionTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);
 b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(d.hasVertexTexture=!1,d.program=a(THREE.ShaderFlares.lensFlare)):(d.hasVertexTexture=
 !0,d.program=a(THREE.ShaderFlares.lensFlareVertexTexture));d.attributes={};d.uniforms={};d.attributes.vertex=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.renderType=b.getUniformLocation(d.program,"renderType");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.occlusionMap=b.getUniformLocation(d.program,"occlusionMap");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.color=b.getUniformLocation(d.program,
-"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i,l,k=a.length,o,p,m,r=new THREE.Vector3,n=h/f,q=f*0.5,t=h*0.5,v=16/h,z=new THREE.Vector2(v*n,v),u=new THREE.Vector3(1,1,0),B=new THREE.Vector2(1,1),A=d.uniforms;i=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
-b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(A.occlusionMap,0);b.uniform1i(A.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(i.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(i.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);for(l=0;l<k;l++)if(v=16/h,z.set(v*n,v),i=a[l],r.set(i.matrixWorld.n14,i.matrixWorld.n24,i.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(r),g.projectionMatrix.multiplyVector3(r),
-u.copy(r),B.x=u.x*q+q,B.y=u.y*t+t,d.hasVertexTexture||B.x>0&&B.x<f&&B.y>0&&B.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,B.x-8,B.y-8,16,16,0);b.uniform1i(A.renderType,0);b.uniform2f(A.scale,z.x,z.y);b.uniform3f(A.screenPosition,u.x,u.y,u.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.copyTexImage2D(b.TEXTURE_2D,
-0,b.RGBA,B.x-8,B.y-8,16,16,0);b.uniform1i(A.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);i.positionScreen.copy(u);i.customUpdateCallback?i.customUpdateCallback(i):i.updateLensFlares();b.uniform1i(A.renderType,2);b.enable(b.BLEND);o=0;for(p=i.lensFlares.length;o<p;o++)if(m=i.lensFlares[o],m.opacity>0.0010&&m.scale>0.0010)u.x=m.x,u.y=m.y,u.z=m.z,v=m.size*m.scale/h,z.x=v*n,z.y=v,b.uniform3f(A.screenPosition,
-u.x,u.y,u.z),b.uniform2f(A.scale,z.x,z.y),b.uniform1f(A.rotation,m.rotation),b.uniform1f(A.opacity,m.opacity),b.uniform3f(A.color,m.color.r,m.color.g,m.color.b),c.setBlending(m.blending),c.setTexture(m.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,l,k,o;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),r=new THREE.PerspectiveCamera(53,
-1,1,1E4);r.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:m}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
-n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(r);this.setSize=function(a,d){c.call(b,a,d);p.width=a;p.height=d;m.width=a;m.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||l!==c.near||k!==c.far||o!==c.fov){i=c.aspect;l=c.near;k=c.far;o=c.fov;var v=c.projectionMatrix.clone(),z=125/30*0.5,u=z*l/125,B=l*Math.tan(o*Math.PI/360),A;f.n14=z;h.n14=-z;z=-B*i+u;A=B*i+u;v.n11=2*l/(A-z);v.n13=(A+z)/(A-z);e.projectionMatrix.copy(v);z=-B*i-u;A=B*i-u;v.n11=
-2*l/(A-z);v.n13=(A+z)/(A-z);g.projectionMatrix.copy(v)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,p,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,m,!0);n.updateMatrixWorld();d.call(b,n,r)}};
+"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i,j,k=a.length,o,p,m,q=new THREE.Vector3,n=h/f,r=f*0.5,t=h*0.5,u=16/h,y=new THREE.Vector2(u*n,u),v=new THREE.Vector3(1,1,0),A=new THREE.Vector2(1,1),z=d.uniforms;i=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
+b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(z.occlusionMap,0);b.uniform1i(z.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(i.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(i.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);for(j=0;j<k;j++)if(u=16/h,y.set(u*n,u),i=a[j],q.set(i.matrixWorld.n14,i.matrixWorld.n24,i.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(q),g.projectionMatrix.multiplyVector3(q),
+v.copy(q),A.x=v.x*r+r,A.y=v.y*t+t,d.hasVertexTexture||A.x>0&&A.x<f&&A.y>0&&A.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,A.x-8,A.y-8,16,16,0);b.uniform1i(z.renderType,0);b.uniform2f(z.scale,y.x,y.y);b.uniform3f(z.screenPosition,v.x,v.y,v.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.copyTexImage2D(b.TEXTURE_2D,
+0,b.RGBA,A.x-8,A.y-8,16,16,0);b.uniform1i(z.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);i.positionScreen.copy(v);i.customUpdateCallback?i.customUpdateCallback(i):i.updateLensFlares();b.uniform1i(z.renderType,2);b.enable(b.BLEND);o=0;for(p=i.lensFlares.length;o<p;o++)if(m=i.lensFlares[o],m.opacity>0.0010&&m.scale>0.0010)v.x=m.x,v.y=m.y,v.z=m.z,u=m.size*m.scale/h,y.x=u*n,y.y=u,b.uniform3f(z.screenPosition,
+v.x,v.y,v.z),b.uniform2f(z.scale,y.x,y.y),b.uniform1f(z.rotation,m.rotation),b.uniform1f(z.opacity,m.opacity),b.uniform3f(z.color,m.color.r,m.color.g,m.color.b),c.setBlending(m.blending),c.setTexture(m.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}};
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d={};this.init=function(a){b=a.context;c=a;d.vertices=new Float32Array(16);d.faces=new Uint16Array(6);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=b.createBuffer();d.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,d.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,g=b.createProgram(),f=b.createShader(b.FRAGMENT_SHADER),h=b.createShader(b.VERTEX_SHADER);b.shaderSource(f,a.fragmentShader);b.shaderSource(h,a.vertexShader);
+b.compileShader(f);b.compileShader(h);b.attachShader(g,f);b.attachShader(g,h);b.linkProgram(g);d.program=g;d.attributes={};d.uniforms={};d.attributes.position=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.uvOffset=b.getUniformLocation(d.program,"uvOffset");d.uniforms.uvScale=b.getUniformLocation(d.program,"uvScale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.alignment=
+b.getUniformLocation(d.program,"alignment");d.uniforms.color=b.getUniformLocation(d.program,"color");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.useScreenCoordinates=b.getUniformLocation(d.program,"useScreenCoordinates");d.uniforms.affectedByDistance=b.getUniformLocation(d.program,"affectedByDistance");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.uniforms.modelViewMatrix=b.getUniformLocation(d.program,
+"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h,i){var j,k;j=d.attributes;var o=d.uniforms,p=h/f,m=[];f*=0.5;var q=h*0.5,n=!0;b.useProgram(d.program);_currentProgram=d.program;if(!d.attributesEnabled)b.enableVertexAttribArray(j.position),b.enableVertexAttribArray(j.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(j.position,
+2,b.FLOAT,!1,16,0);b.vertexAttribPointer(j.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(o.projectionMatrix,!1,i);b.activeTexture(b.TEXTURE0);b.uniform1i(o.map,0);i=0;for(j=e.__webglSprites.length;i<j;i++)if(k=e.__webglSprites[i],k.visible&&k.opacity!==0)k.useScreenCoordinates?k.z=-k.position.z:(k._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,k.matrixWorld,k._modelViewMatrixArray),k.z=-k._modelViewMatrix.n34);e.__webglSprites.sort(a);i=0;for(j=
+e.__webglSprites.length;i<j;i++)k=e.__webglSprites[i],k.visible&&k.opacity!==0&&k.map&&k.map.image&&k.map.image.width&&(k.useScreenCoordinates?(b.uniform1i(o.useScreenCoordinates,1),b.uniform3f(o.screenPosition,(k.position.x-f)/f,(q-k.position.y)/q,Math.max(0,Math.min(1,k.position.z)))):(b.uniform1i(o.useScreenCoordinates,0),b.uniform1i(o.affectedByDistance,k.affectedByDistance?1:0),b.uniformMatrix4fv(o.modelViewMatrix,!1,k._modelViewMatrixArray)),g=k.map.image.width/(k.scaleByViewport?h:1),m[0]=
+g*p*k.scale.x,m[1]=g*k.scale.y,b.uniform2f(o.uvScale,k.uvScale.x,k.uvScale.y),b.uniform2f(o.uvOffset,k.uvOffset.x,k.uvOffset.y),b.uniform2f(o.alignment,k.alignment.x,k.alignment.y),b.uniform1f(o.opacity,k.opacity),b.uniform3f(o.color,k.color.r,k.color.g,k.color.b),b.uniform1f(o.rotation,k.rotation),b.uniform2fv(o.scale,m),k.mergeWith3D&&!n?(b.enable(b.DEPTH_TEST),n=!0):!k.mergeWith3D&&n&&(b.disable(b.DEPTH_TEST),n=!1),c.setBlending(k.blending),c.setTexture(k.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,
+0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,o;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),q=new THREE.PerspectiveCamera(53,
+1,1,1E4);q.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:m}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
+n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(q);this.setSize=function(a,d){c.call(b,a,d);p.width=a;p.height=d;m.width=a;m.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||j!==c.near||k!==c.far||o!==c.fov){i=c.aspect;j=c.near;k=c.far;o=c.fov;var u=c.projectionMatrix.clone(),y=125/30*0.5,v=y*j/125,A=j*Math.tan(o*Math.PI/360),z;f.n14=y;h.n14=-y;y=-A*i+v;z=A*i+v;u.n11=2*j/(z-y);u.n13=(z+y)/(z-y);e.projectionMatrix.copy(u);y=-A*i-v;z=A*i-v;u.n11=
+2*j/(z-y);u.n13=(z+y)/(z-y);g.projectionMatrix.copy(u)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,p,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,m,!0);n.updateMatrixWorld();d.call(b,n,q)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,g,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;g=d};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=
 c.far;f.updateProjectionMatrix();f.position.copy(c.position);f.target.copy(c.target);f.translateX(b.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,g);d.call(b,a,f);this.setViewport(e,0,e,g);d.call(b,a,h,!1)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
 lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
+THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
+fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\n}"}};

+ 166 - 155
build/custom/ThreeExtras.js

@@ -1,19 +1,19 @@
 // ThreeExtras.js r47dev - http://github.com/mrdoob/three.js
 THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,g=Math.max(Math.max(c,d),e),f=Math.min(Math.min(c,d),e);if(f===g)f=c=0;else{var h=g-f,f=h/g,c=c===g?(d-e)/h:d===g?2+(e-c)/h:4+(c-d)/h;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=g;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,k=g.faces,j=a.faceVertexUvs[0],q=g.faceVertexUvs[0],o={},l=0;l<a.materials.length;l++)o[a.materials[l].id]=l;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var l=0,s=h.length;l<s;l++){var n=new THREE.Vertex(h[l].position.clone());c&&c.multiplyVector3(n.position);f.push(n)}l=
-0;for(s=k.length;l<s;l++){var f=k[l],p,m,r=f.vertexNormals,t=f.vertexColors;f instanceof THREE.Face3?p=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(p=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));p.normal.copy(f.normal);d&&d.multiplyVector3(p.normal);h=0;for(n=r.length;h<n;h++)m=r[h].clone(),d&&d.multiplyVector3(m),p.vertexNormals.push(m);p.color.copy(f.color);h=0;for(n=t.length;h<n;h++)m=t[h],p.vertexColors.push(m.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
-n=o[h.id];if(n===void 0)n=a.materials.length,a.materials.push(h);p.materialIndex=n}p.centroid.copy(f.centroid);c&&c.multiplyVector3(p.centroid);i.push(p)}l=0;for(s=q.length;l<s;l++){c=q[l];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var f=new THREE.Vertex(d[a].position.clone());b.vertices.push(f)}a=0;
-for(c=e.length;a<c;a++){var h=e[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(f=j.length;d<f;d++)k=j[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(f=q.length;d<f;d++)k=q[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}a=0;for(c=g.length;a<c;a++){e=g[a];i=[];d=0;for(f=e.length;d<
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,k=g.faces,j=a.faceVertexUvs[0],p=g.faceVertexUvs[0],o={},l=0;l<a.materials.length;l++)o[a.materials[l].id]=l;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var l=0,s=h.length;l<s;l++){var m=new THREE.Vertex(h[l].position.clone());c&&c.multiplyVector3(m.position);f.push(m)}l=
+0;for(s=k.length;l<s;l++){var f=k[l],q,n,r=f.vertexNormals,t=f.vertexColors;f instanceof THREE.Face3?q=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(q=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));q.normal.copy(f.normal);d&&d.multiplyVector3(q.normal);h=0;for(m=r.length;h<m;h++)n=r[h].clone(),d&&d.multiplyVector3(n),q.vertexNormals.push(n);q.color.copy(f.color);h=0;for(m=t.length;h<m;h++)n=t[h],q.vertexColors.push(n.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
+m=o[h.id];if(m===void 0)m=a.materials.length,a.materials.push(h);q.materialIndex=m}q.centroid.copy(f.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}l=0;for(s=p.length;l<s;l++){c=p[l];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var f=new THREE.Vertex(d[a].position.clone());b.vertices.push(f)}a=0;
+for(c=e.length;a<c;a++){var h=e[a],i,k,j=h.vertexNormals,p=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(f=j.length;d<f;d++)k=j[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(f=p.length;d<f;d++)k=p[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}a=0;for(c=g.length;a<c;a++){e=g[a];i=[];d=0;for(f=e.length;d<
 f;d++)i.push(new THREE.UV(e[d].u,e[d].v));b.faceVertexUvs[0].push(i)}return b},randomPointInTriangle:function(a,b,c){var d,e,g,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();d+e>1&&(d=1-d,e=1-e);g=1-d-e;f.copy(a);f.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);f.addSelf(h);h.copy(c);h.multiplyScalar(g);f.addSelf(h);return f},randomPointInFace:function(a,b,c){var d,e,g;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,e=b.vertices[a.b].position,
 g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,g);else if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,f;c?a._area1&&a._area2?(c=a._area1,f=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b),a._area1=c,a._area2=f):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b));return THREE.GeometryUtils.random()*(c+
-f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,b)}},randomPointsInGeometry:function(a,b){function c(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,e,g=a.faces,f=a.vertices,h=g.length,i=0,k=[],j,q,o,l;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)j=f[d.a].position,q=f[d.b].position,o=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,q,o);else if(d instanceof
-THREE.Face4)j=f[d.a].position,q=f[d.b].position,o=f[d.c].position,l=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,q,l),d._area2=THREE.GeometryUtils.triangleArea(q,o,l),d._area=d._area1+d._area2;i+=d._area;k[e]=i}d=[];f={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();
+f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,b)}},randomPointsInGeometry:function(a,b){function c(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,e,g=a.faces,f=a.vertices,h=g.length,i=0,k=[],j,p,o,l;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)j=f[d.a].position,p=f[d.b].position,o=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,p,o);else if(d instanceof
+THREE.Face4)j=f[d.a].position,p=f[d.b].position,o=f[d.c].position,l=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,p,l),d._area2=THREE.GeometryUtils.triangleArea(p,o,l),d._area=d._area1+d._area2;i+=d._area;k[e]=i}d=[];f={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();
 b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Matrix4;b.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(b);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin="";d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],g=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(e.loadCount===6)g.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return g},getNormalMap:function(a,b){var c=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]};b|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),k=i.data,j=0;j<d;j++)for(var q=1;q<e;q++){var o=q-1<0?e-1:q-1,l=(q+1)%e,s=j-1<0?d-1:j-1,n=(j+1)%d,p=[],m=[0,0,h[(q*d+j)*4]/255*b];p.push([-1,0,h[(q*d+s)*4]/255*b]);p.push([-1,-1,h[(o*d+s)*4]/255*b]);p.push([0,-1,h[(o*d+j)*4]/255*b]);p.push([1,-1,h[(o*d+n)*4]/255*b]);
-p.push([1,0,h[(q*d+n)*4]/255*b]);p.push([1,1,h[(l*d+n)*4]/255*b]);p.push([0,1,h[(l*d+j)*4]/255*b]);p.push([-1,1,h[(l*d+s)*4]/255*b]);o=[];s=p.length;for(l=0;l<s;l++){var n=p[l],r=p[(l+1)%s],n=[n[0]-m[0],n[1]-m[1],n[2]-m[2]],r=[r[0]-m[0],r[1]-m[1],r[2]-m[2]];o.push(c([n[1]*r[2]-n[2]*r[1],n[2]*r[0]-n[0]*r[2],n[0]*r[1]-n[1]*r[0]]))}p=[0,0,0];for(l=0;l<o.length;l++)p[0]+=o[l][0],p[1]+=o[l][1],p[2]+=o[l][2];p[0]/=o.length;p[1]/=o.length;p[2]/=o.length;m=(q*d+j)*4;k[m]=(p[0]+1)/2*255|0;k[m+1]=(p[1]+0.5)*
-255|0;k[m+2]=p[2]*255|0;k[m+3]=255}f.putImageData(i,0,0);return g}};
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),k=i.data,j=0;j<d;j++)for(var p=1;p<e;p++){var o=p-1<0?e-1:p-1,l=(p+1)%e,s=j-1<0?d-1:j-1,m=(j+1)%d,q=[],n=[0,0,h[(p*d+j)*4]/255*b];q.push([-1,0,h[(p*d+s)*4]/255*b]);q.push([-1,-1,h[(o*d+s)*4]/255*b]);q.push([0,-1,h[(o*d+j)*4]/255*b]);q.push([1,-1,h[(o*d+m)*4]/255*b]);
+q.push([1,0,h[(p*d+m)*4]/255*b]);q.push([1,1,h[(l*d+m)*4]/255*b]);q.push([0,1,h[(l*d+j)*4]/255*b]);q.push([-1,1,h[(l*d+s)*4]/255*b]);o=[];s=q.length;for(l=0;l<s;l++){var m=q[l],r=q[(l+1)%s],m=[m[0]-n[0],m[1]-n[1],m[2]-n[2]],r=[r[0]-n[0],r[1]-n[1],r[2]-n[2]];o.push(c([m[1]*r[2]-m[2]*r[1],m[2]*r[0]-m[0]*r[2],m[0]*r[1]-m[1]*r[0]]))}q=[0,0,0];for(l=0;l<o.length;l++)q[0]+=o[l][0],q[1]+=o[l][1],q[2]+=o[l][2];q[0]/=o.length;q[1]/=o.length;q[2]/=o.length;n=(p*d+j)*4;k[n]=(q[0]+1)/2*255|0;k[n+1]=(q[1]+0.5)*
+255|0;k[n+2]=q[2]*255|0;k[n+3]=255}f.putImageData(i,0,0);return g}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var g=new THREE.Mesh(a,b[c]);e.add(g)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
 b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
 (b=new THREE.ParticleSystem(a.geometry,a.material),b.sortParticles=a.sortParticles):a instanceof THREE.Particle?b=new THREE.Particle(a.material):a instanceof THREE.Sprite?(b=new THREE.Sprite({}),b.color.copy(a.color),b.map=a.map,b.blending=a.blending,b.useScreenCoordinates=a.useScreenCoordinates,b.mergeWith3D=a.mergeWith3D,b.affectedByDistance=a.affectedByDistance,b.scaleByViewport=a.scaleByViewport,b.alignment=a.alignment,b.rotation3d.copy(a.rotation3d),b.rotation=a.rotation,b.opacity=a.opacity,
@@ -58,34 +58,34 @@ THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,g){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,g)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
 THREE.Path.prototype.arc=function(a,b,c,d,e,g){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,e,g));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,k,j,q,o,l,s,n;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];q=g[0];o=g[1];c.length>0?(f=c[c.length-1],l=f.x,s=f.y):(f=this.actions[d-1].args,l=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b2(n,l,q,h),n=THREE.Shape.Utils.b2(n,s,o,
-i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];q=g[0];o=g[1];k=g[2];j=g[3];c.length>0?(f=c[c.length-1],l=f.x,s=f.y):(f=this.actions[d-1].args,l=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b3(n,l,q,k,h),n=THREE.Shape.Utils.b3(n,s,o,j,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];n=a*g[0].length;f=f.concat(g[0]);g=new THREE.SplineCurve(f);
-for(f=1;f<=n;f++)c.push(g.getPointAt(f/n));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=g[0];i=g[1];k=g[2];q=g[3];n=g[4];o=!!g[5];j=f[f.length-2];l=f[f.length-1];f.length==0&&(j=l=0);s=n-q;var p=a*2;for(f=1;f<=p;f++)n=f/p,o||(n=1-n),n=q+n*s,g=j+h+k*Math.cos(n),n=l+i+k*Math.sin(n),c.push(new THREE.Vector2(g,n))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
-THREE.Path.prototype.nltransform=function(a,b,c,d,e,g){var f=this.getPoints(),h,i,k,j,q;h=0;for(i=f.length;h<i;h++)k=f[h],j=k.x,q=k.y,k.x=a*j+b*q+c,k.y=d*q+e*j+g;return f};
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,k,j,p,o,l,s,m;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];p=g[0];o=g[1];c.length>0?(f=c[c.length-1],l=f.x,s=f.y):(f=this.actions[d-1].args,l=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)m=f/a,g=THREE.Shape.Utils.b2(m,l,p,h),m=THREE.Shape.Utils.b2(m,s,o,
+i),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];p=g[0];o=g[1];k=g[2];j=g[3];c.length>0?(f=c[c.length-1],l=f.x,s=f.y):(f=this.actions[d-1].args,l=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)m=f/a,g=THREE.Shape.Utils.b3(m,l,p,k,h),m=THREE.Shape.Utils.b3(m,s,o,j,i),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];m=a*g[0].length;f=f.concat(g[0]);g=new THREE.SplineCurve(f);
+for(f=1;f<=m;f++)c.push(g.getPointAt(f/m));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=g[0];i=g[1];k=g[2];p=g[3];m=g[4];o=!!g[5];j=f[f.length-2];l=f[f.length-1];f.length==0&&(j=l=0);s=m-p;var q=a*2;for(f=1;f<=q;f++)m=f/q,o||(m=1-m),m=p+m*s,g=j+h+k*Math.cos(m),m=l+i+k*Math.sin(m),c.push(new THREE.Vector2(g,m))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
+THREE.Path.prototype.nltransform=function(a,b,c,d,e,g){var f=this.getPoints(),h,i,k,j,p;h=0;for(i=f.length;h<i;h++)k=f[h],j=k.x,p=k.y,k.x=a*j+b*p+c,k.y=d*p+e*j+g;return f};
 THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,e,a=0;for(c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
 this.getPoints();a=0;for(c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],g=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&g.actions.length!=0&&(e.push(g),g=new THREE.Path),g[c].apply(g,d);g.actions.length!=0&&e.push(g);if(e.length==0)return[];var f,g=[];if(THREE.Shape.Utils.isClockWise(e[0].getPoints())){a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f&&g.push(f),f=new THREE.Shape,f.actions=d.actions,f.curves=
 d.curves):f.holes.push(d);g.push(f)}else{f=new THREE.Shape;a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f.actions=d.actions,f.curves=d.curves,g.push(f),f=new THREE.Shape):f.holes.push(d)}return g};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 b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].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,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,k,j,q,o,l,s=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);g=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){o=k[e];l=[];for(q=0;q<c.length;q++)j=c[q],j=o.distanceToSquared(j),l.push(j),j<g&&(g=j,f=e,h=q)}e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:k.length-1;var n=[k[f],c[h],c[e]];q=THREE.FontUtils.Triangulate.area(n);var p=[k[f],k[g],c[h]];o=THREE.FontUtils.Triangulate.area(p);l=h;j=f;h+=1;f+=-1;h<
-0&&(h+=c.length);h%=c.length;f<0&&(f+=k.length);f%=k.length;e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:k.length-1;n=[k[f],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);p=[k[f],k[g],c[h]];p=THREE.FontUtils.Triangulate.area(p);q+o>n+p&&(h=l,f=j,h<0&&(h+=c.length),h%=c.length,f<0&&(f+=k.length),f%=k.length,e=h-1>=0?h-1:c.length-1,g=f-1>=0?f-1:k.length-1);q=c.slice(0,h);o=c.slice(h);l=k.slice(f);j=k.slice(0,f);g=[k[f],k[g],c[h]];s.push([k[f],c[h],c[e]]);s.push(g);c=q.concat(l).concat(j).concat(o)}return{shape:c,
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,k,j,p,o,l,s=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);g=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){o=k[e];l=[];for(p=0;p<c.length;p++)j=c[p],j=o.distanceToSquared(j),l.push(j),j<g&&(g=j,f=e,h=p)}e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:k.length-1;var m=[k[f],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(m);var q=[k[f],k[g],c[h]];o=THREE.FontUtils.Triangulate.area(q);l=h;j=f;h+=1;f+=-1;h<
+0&&(h+=c.length);h%=c.length;f<0&&(f+=k.length);f%=k.length;e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:k.length-1;m=[k[f],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);q=[k[f],k[g],c[h]];q=THREE.FontUtils.Triangulate.area(q);p+o>m+q&&(h=l,f=j,h<0&&(h+=c.length),h%=c.length,f<0&&(f+=k.length),f%=k.length,e=h-1>=0?h-1:c.length-1,g=f-1>=0?f-1:k.length-1);p=c.slice(0,h);o=c.slice(h);l=k.slice(f);j=k.slice(0,f);g=[k[f],k[g],c[h]];s.push([k[f],c[h],c[e]]);s.push(g);c=p.concat(l).concat(j).concat(o)}return{shape:c,
 isolatedPts:s,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,f,h,i,k={};g=0;for(f=d.length;g<f;g++)i=d[g].x+":"+d[g].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=g;g=0;for(f=c.length;g<f;g++){h=c[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}g=0;for(f=e.length;g<f;g++){h=e[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}return c.concat(e)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",g=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=g};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
-THREE.AnimationHandler=function(){var a=[],b={},c={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){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(a.hierarchy[c].keys[d].time<
-0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var k=a.hierarchy[c].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var j=
-{};for(k in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===k){j[k]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(j[k]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=j}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
-a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var c=[];if(a instanceof THREE.SkinnedMesh)for(var b=0;b<a.bones.length;b++)c.push(a.bones[b]);else d(a,c);return c}},d=function(a,c){c.push(a);for(var b=0;b<a.children.length;b++)d(a.children[b],c)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
+THREE.AnimationHandler=function(){var a=[],b={},c={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){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var d=0;d<a.hierarchy.length;d++){for(var c=0;c<a.hierarchy[d].keys.length;c++){if(a.hierarchy[d].keys[c].time<
+0)a.hierarchy[d].keys[c].time=0;if(a.hierarchy[d].keys[c].rot!==void 0&&!(a.hierarchy[d].keys[c].rot instanceof THREE.Quaternion)){var h=a.hierarchy[d].keys[c].rot;a.hierarchy[d].keys[c].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[d].keys[0].morphTargets!==void 0){h={};for(c=0;c<a.hierarchy[d].keys.length;c++)for(var i=0;i<a.hierarchy[d].keys[c].morphTargets.length;i++){var k=a.hierarchy[d].keys[c].morphTargets[i];h[k]=-1}a.hierarchy[d].usedMorphTargets=h;for(c=0;c<a.hierarchy[d].keys.length;c++){var j=
+{};for(k in h){for(i=0;i<a.hierarchy[d].keys[c].morphTargets.length;i++)if(a.hierarchy[d].keys[c].morphTargets[i]===k){j[k]=a.hierarchy[d].keys[c].morphTargetsInfluences[i];break}i===a.hierarchy[d].keys[c].morphTargets.length&&(j[k]=0)}a.hierarchy[d].keys[c].morphTargetsInfluences=j}}for(c=1;c<a.hierarchy[d].keys.length;c++)a.hierarchy[d].keys[c].time===a.hierarchy[d].keys[c-1].time&&(a.hierarchy[d].keys.splice(c,1),c--);for(c=1;c<a.hierarchy[d].keys.length;c++)a.hierarchy[d].keys[c].index=c}c=parseInt(a.length*
+a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(d=0;d<a.hierarchy.length;d++)a.JIT.hierarchy.push(Array(c));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[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)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
 2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===void 0)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
 THREE.Bone?e.skinMatrix:e.matrix;var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.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 b=["pos","rot","scl"],c,d,e,g,f,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 l=0,s=this.hierarchy.length;l<s;l++)if(a=this.hierarchy[l],i=a.animationCache,this.JITCompile&&j[l][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[l][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=j[l][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 n=0;n<3;n++){c=b[n];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=o){if(q<o)if(this.loop){f=this.data.hierarchy[l].keys[0];for(h=this.getNextKeyWith(c,l,1);h.time<q;)f=h,h=this.getNextKeyWith(c,l,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,l,h.index+1);while(h.time<
-q)}i.prevKey[c]=f;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(q-f.time)/(h.time-f.time);e=f[c];g=h[c];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+l),d=d<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,g,f,h,i,k,j=this.data.JIT.hierarchy,p,o;this.currentTime+=a*this.timeScale;o=this.currentTime;p=this.currentTime%=this.data.length;k=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var l=0,s=this.hierarchy.length;l<s;l++)if(a=this.hierarchy[l],i=a.animationCache,this.JITCompile&&j[l][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[l][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=j[l][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++){c=b[m];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=o){if(p<o)if(this.loop){f=this.data.hierarchy[l].keys[0];for(h=this.getNextKeyWith(c,l,1);h.time<p;)f=h,h=this.getNextKeyWith(c,l,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,l,h.index+1);while(h.time<
+p)}i.prevKey[c]=f;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(p-f.time)/(h.time-f.time);e=f[c];g=h[c];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+l),d=d<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",l,f.index-1).pos,this.points[1]=e,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",l,h.index+1).pos,d=d*0.33+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[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(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(c===
 "rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d}}if(this.JITCompile&&j[0][k]===void 0){this.hierarchy[0].update(null,!0);for(l=0;l<this.hierarchy.length;l++)j[l][k]=this.hierarchy[l]instanceof THREE.Bone?this.hierarchy[l].skinMatrix.clone():this.hierarchy[l].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,g,f,h,i,k;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],i[0],k[0],e,c,f);d[1]=this.interpolate(g[1],h[1],i[1],k[1],e,c,f);d[2]=this.interpolate(g[2],h[2],i[2],k[2],e,c,f);return d};
@@ -94,72 +94,72 @@ THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hie
 THREE.CubeCamera=function(a,b,c,d){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);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,c){var b=this.renderTarget;b.activeCubeFace=0;a.render(c,this.cameraPX,b);b.activeCubeFace=1;a.render(c,this.cameraNX,b);b.activeCubeFace=2;a.render(c,this.cameraPY,b);b.activeCubeFace=3;a.render(c,
-this.cameraNY,b);b.activeCubeFace=4;a.render(c,this.cameraPZ,b);b.activeCubeFace=5;a.render(c,this.cameraNZ,b)}};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 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().")};
 THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,b,c,d,e,g,f){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,g,f);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);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),b=2*a*this.cameraP.aspect/2;a/=this.zoom;b/=this.zoom;this.cameraO.left=-b;this.cameraO.right=b;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};
 THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,b){b||(b=43.25);var c=2*Math.atan(b/(a*2));c*=180/Math.PI;this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
 THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
-THREE.FirstPersonControls=function(a,b){function c(a,c){return function(){c.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=b!==void 0?b:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
+THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=b!==void 0?b:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;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));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};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.onKeyDown=
 function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
-!1;break;case 70:this.moveDown=!1}};this.update=function(a){var c=0;if(!this.freeze){if(this.heightSpeed){var b=THREE.Math.clamp(this.object.position.y,this.heightMin,this.heightMax)-this.heightMin;this.autoSpeedFactor=a*b*this.heightCoef}else this.autoSpeedFactor=0;c=a*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(c+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(c);this.moveLeft&&this.object.translateX(-c);this.moveRight&&
-this.object.translateX(c);this.moveUp&&this.object.translateY(c);this.moveDown&&this.object.translateY(-c);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=
-1;this.constrainVertical&&(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*
+!1;break;case 70:this.moveDown=!1}};this.update=function(a){var b=0;if(!this.freeze){if(this.heightSpeed){var c=THREE.Math.clamp(this.object.position.y,this.heightMin,this.heightMax)-this.heightMin;this.autoSpeedFactor=a*c*this.heightCoef}else this.autoSpeedFactor=0;b=a*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(b);this.moveLeft&&this.object.translateX(-b);this.moveRight&&
+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",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
-THREE.PathControls=function(a,b){function c(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,c){return function(){c.apply(a,arguments)}}function e(a,c,b,d){var f={name:b,fps:0.6,length:d,hierarchy:[]},e,g=c.getControlPointsArray(),h=c.getLength(),p=g.length,m=0;e=p-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[e]={time:d,pos:g[e],rot:[0,0,0,1],scl:[1,1,1]};for(e=1;e<p-1;e++)m=d*h.chunks[e]/h.total,c.keys[e]={time:m,pos:g[e]};f.hierarchy[0]=
-c;THREE.AnimationHandler.add(f);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(a,c){var b,d,f=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)d=b/(a.points.length*c),d=a.getPoint(d),f.vertices[b]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return f}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
+THREE.PathControls=function(a,b){function c(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 e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,n=0;f=q-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<q-1;f++)n=d*h.chunks[f]/h.total,b.keys[f]={time:n,pos:g[f]};e.hierarchy[0]=
+b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(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=b!==void 0?b: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.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,h=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%f;this.phi=a>=0?a:a+f;b=this.verticalAngleMap.srcRange;
 a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-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}),c=new THREE.MeshLambertMaterial({color:65280}),
-b=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(b,a);a=new THREE.Mesh(f,c);a.position.set(0,10,0);this.animation=e(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=e(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,c=this.spline,f=g(c,10),b=g(c,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),b=new THREE.ParticleSystem(b,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);b.scale.set(1,1,1);a.add(b);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),l=0;l<c.points.length;l++)b=new THREE.Mesh(f,h),b.position.copy(c.points[l]),a.add(b)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
+function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
+c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=e(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=e(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
+this.debugPath,b=this.spline,f=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),l=0;l<b.points.length;l++)c=new THREE.Mesh(f,h),c.position.copy(b.points[l]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
 !1)}};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(a,b){function c(a,c){return function(){c.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;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,
+THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;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=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
-!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),b=c.size[0]/2,f=c.size[1]/2;this.moveState.yawLeft=-(a.pageX-c.offset[0]-b)/b;this.moveState.pitchDown=(a.pageY-c.offset[1]-f)/f;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=
-!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(a){var c=a*this.movementSpeed;a*=this.rollSpeed;this.object.translateX(this.moveVector.x*c);this.object.translateY(this.moveVector.y*c);this.object.translateZ(this.moveVector.z*c);this.tmpQuaternion.set(this.rotationVector.x*a,this.rotationVector.y*a,this.rotationVector.z*a,1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);
+!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),c=b.size[0]/2,f=b.size[1]/2;this.moveState.yawLeft=-(a.pageX-b.offset[0]-c)/c;this.moveState.pitchDown=(a.pageY-b.offset[1]-f)/f;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=
+!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(a){var b=a*this.movementSpeed;a*=this.rollSpeed;this.object.translateX(this.moveVector.x*b);this.object.translateY(this.moveVector.y*b);this.object.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*a,this.rotationVector.y*a,this.rotationVector.z*a,1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);
 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",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b: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 c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,i=0,k=0,j=0,q=0,o=0,l=window.innerWidth/2,s=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
-this.rotateHorizontally(b*q);this.rotateVertically(b*o)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*k);this.object.translateY(b*j);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b: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 c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,i=0,k=0,j=0,p=0,o=0,l=window.innerWidth/2,s=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
+this.rotateHorizontally(b*p);this.rotateVertically(b*o)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*k);this.object.translateY(b*j);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
 e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;g.identity();g.n11=Math.cos(this.roll);g.n12=-Math.sin(this.roll);g.n21=Math.sin(this.roll);g.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(g);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){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);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-l)/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){p=(a.clientX-l)/window.innerWidth;o=(a.clientY-s)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
 function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82: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:f=!1;break;case 69:f=!1;break;case 82:j=0;break;case 70:j=0}},!1)};
 THREE.TrackballControls=function(a,b){var c=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=b!==void 0?b: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 e=!1,g=d.NONE,f=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,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
+this.target=new THREE.Vector3(0,0,0);var e=!1,g=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,p=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,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
 c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=c.rotateSpeed;d.setFromAxisAngle(b,
--a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-k.y)*c.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),c.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(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));
-c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?q=o:q.addSelf(a.sub(o,q).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),f.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,f.setLength(c.minDistance))};this.update=function(){f.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();
-c.noPan||c.panCamera();c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=c.getMouseOnScreen(a.clientX,a.clientY),q=o=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),g!==d.NONE&&(g===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&
-!c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):g===d.PAN&&!c.noPan&&(o=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!c.noZoom?k=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(q=o=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
+-a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-k.y)*c.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),c.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));
+c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?p=o:p.addSelf(a.sub(o,p).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),f.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,f.setLength(c.minDistance))};this.update=function(){f.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();
+c.noPan||c.panCamera();c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=c.getMouseOnScreen(a.clientX,a.clientY),p=o=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),g!==d.NONE&&(g===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&
+!c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):g===d.PAN&&!c.noPan&&(o=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!c.noZoom?k=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=o=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
 function(a){if(c.enabled)a.preventDefault(),a.stopPropagation(),g=d.NONE},!1);window.addEventListener("keydown",function(a){if(c.enabled&&g===d.NONE){if(a.keyCode===c.keys[d.ROTATE]&&!c.noRotate)g=d.ROTATE;else if(a.keyCode===c.keys[d.ZOOM]&&!c.noZoom)g=d.ZOOM;else if(a.keyCode===c.keys[d.PAN]&&!c.noPan)g=d.PAN;g!==d.NONE&&(e=!0)}},!1);window.addEventListener("keyup",function(){if(c.enabled&&g!==d.NONE)g=d.NONE},!1)};
-THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,j,l){var n,o=d||1,m=e||1,p=h/2,q=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",m=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=g||1;var r=o+1,t=m+1,L=h/o,H=i/m,M=new THREE.Vector3;M[n]=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)*f;J[n]=j;k.vertices.push(new THREE.Vertex(J))}for(h=0;h<m;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=l,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/o,h/m),new THREE.UV(i/o,(h+1)/m),new THREE.UV((i+1)/o,(h+1)/m),new THREE.UV((i+1)/o,h/m)])}THREE.Geometry.call(this);var k=this,j=a/2,q=b/2,o=c/2,l,s,n,p,m,r;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(l=0;l<6;l++)this.materials.push(f)}l=0;p=1;s=2;m=
-3;n=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,c,b,j,l);this.sides.nx&&i("z","y",1,-1,c,b,-j,p);this.sides.py&&i("x","z",1,1,a,c,q,s);this.sides.ny&&i("x","z",1,-1,a,c,-q,m);this.sides.pz&&i("x","y",1,-1,a,b,o,n);this.sides.nz&&i("x","y",-1,-1,a,b,-o,r);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,j,l){var m,o=d||1,p=e||1,n=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",p=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")m="x",o=g||1;var r=o+1,t=p+1,L=h/o,H=i/p,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-n)*c;J[b]=(h*H-q)*f;J[m]=j;k.vertices.push(new THREE.Vertex(J))}for(h=0;h<p;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=l,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var k=this,j=a/2,p=b/2,o=c/2,l,s,m,q,n,r;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(l=0;l<6;l++)this.materials.push(f)}l=0;q=1;s=2;n=
+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,c,b,j,l);this.sides.nx&&i("z","y",1,-1,c,b,-j,q);this.sides.py&&i("x","z",1,1,a,c,p,s);this.sides.ny&&i("x","z",1,-1,a,c,-p,n);this.sides.pz&&i("x","y",1,-1,a,b,o,m);this.sides.nz&&i("x","y",-1,-1,a,b,-o,r);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,d=d||8,e=e||1,h,i,k=[],j=[];for(i=0;i<=e;i++){var q=[],o=[],l=i/e,s=l*(b-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),-l*c+f,s*Math.cos(n*Math.PI*2))));q.push(this.vertices.length-1);o.push(new THREE.UV(n,l))}k.push(q);j.push(o)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=k[i][h],q=k[i+1][h],o=k[i+1][h+1],l=k[i][h+1],s=
-this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[q].position.clone().setY(0).normalize(),p=this.vertices[o].position.clone().setY(0).normalize(),m=this.vertices[l].position.clone().setY(0).normalize(),r=j[i][h].clone(),t=j[i+1][h].clone(),v=j[i+1][h+1].clone(),y=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,q,o,l,[s,n,p,m]));this.faceVertexUvs[0].push([r,t,v,y])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=k[0][h],q=k[0][h+
-1],o=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),r=j[0][h].clone(),t=j[0][h+1].clone(),v=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,q,o,[s,n,p])),this.faceVertexUvs[0].push([r,t,v])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=k[i][h+1],q=k[i][h],o=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),r=j[i][h+1].clone(),t=j[i][h].clone(),
-v=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,q,o,[s,n,p])),this.faceVertexUvs[0].push([r,t,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,d=d||8,e=e||1,h,i,k=[],j=[];for(i=0;i<=e;i++){var p=[],o=[],l=i/e,s=l*(b-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),-l*c+f,s*Math.cos(m*Math.PI*2))));p.push(this.vertices.length-1);o.push(new THREE.UV(m,l))}k.push(p);j.push(o)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=k[i][h],p=k[i+1][h],o=k[i+1][h+1],l=k[i][h+1],s=
+this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[p].position.clone().setY(0).normalize(),q=this.vertices[o].position.clone().setY(0).normalize(),n=this.vertices[l].position.clone().setY(0).normalize(),r=j[i][h].clone(),t=j[i+1][h].clone(),v=j[i+1][h+1].clone(),y=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,p,o,l,[s,m,q,n]));this.faceVertexUvs[0].push([r,t,v,y])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=k[0][h],p=k[0][h+
+1],o=this.vertices.length-1,s=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),r=j[0][h].clone(),t=j[0][h+1].clone(),v=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,p,o,[s,m,q])),this.faceVertexUvs[0].push([r,t,v])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=k[i][h+1],p=k[i][h],o=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),r=j[i][h+1].clone(),t=j[i][h].clone(),
+v=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,p,o,[s,m,q])),this.faceVertexUvs[0].push([r,t,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d=a.length,e;this.shapebb=a[d-1].getBoundingBox();for(c=0;c<d;c++)e=a[c],this.addShape(e,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,e=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);f.set(a.x-c.x,a.y-c.y);d=d.normalize();f=f.normalize();e.set(-d.y,d.x);g.set(f.y,-f.x);h.copy(a).addSelf(e);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
 h.copy(b).addSelf(e);i.copy(c).addSelf(g);e=d.dot(g);g=i.subSelf(h).dot(g);e===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=e;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 e(a){for(w=a.length;--w>=0;){J=w;N=w-1;N<0&&(N=a.length-1);for(var b=
-0,c=l+j*2,b=0;b<c;b++){var d=K*b,f=K*(b+1),e=Q+J+d,g=Q+J+f,k=e,d=Q+N+d,f=Q+N+f,n=g;k+=F;d+=F;f+=F;n+=F;A.faces.push(new THREE.Face4(k,d,f,n,null,null,v));v&&(k=b/c,d=(b+1)/c,f=h+i*2,e=(A.vertices[e].position.z+i)/f,g=(A.vertices[g].position.z+i)/f,A.faceVertexUvs[0].push([new THREE.UV(e,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(e,d)]))}}}function g(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(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=y.maxY,f=y.maxX,e=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/f,A.vertices[a].position.y/d),new THREE.UV(e/f,b/d),new THREE.UV(g/f,c/d)])}}var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:i-2,j=b.bevelSegments!==void 0?b.bevelSegments:3,q=b.bevelEnabled!==void 0?b.bevelEnabled:!0,o=b.curveSegments!==
-void 0?b.curveSegments:12,l=b.steps!==void 0?b.steps:1,s=b.bendPath,n=b.extrudePath,p,m=!1,r=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,t=b.material,v=b.extrudeMaterial,y=this.shapebb;if(n)p=n.getPoints(o),l=p.length,m=!0,q=!1;q||(k=i=j=0);var u,x,z,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(n=!THREE.Shape.Utils.isClockWise(s)){s=s.reverse();x=0;for(z=o.length;x<z;x++)u=o[x],THREE.Shape.Utils.isClockWise(u)&&
-(o[x]=u.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(s,o);r=s;x=0;for(z=o.length;x<z;x++)u=o[x],s=s.concat(u);var w,D,B,G,I,E,K=s.length,O=n.length,C=[];w=0;D=r.length;J=D-1;for(N=w+1;w<D;w++,J++,N++)J===D&&(J=0),N===D&&(N=0),C[w]=d(r[w],r[J],r[N]);var L=[],H,M=C.concat();x=0;for(z=o.length;x<z;x++){u=o[x];H=[];w=0;D=u.length;J=D-1;for(N=w+1;w<D;w++,J++,N++)J===D&&(J=0),N===D&&(N=0),H[w]=d(u[w],u[J],u[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);w=
-0;for(D=r.length;w<D;w++)E=c(r[w],C[w],G),g(E.x,E.y,-I);x=0;for(z=o.length;x<z;x++){u=o[x];H=L[x];w=0;for(D=u.length;w<D;w++)E=c(u[w],H[w],G),g(E.x,E.y,-I)}}G=k;for(w=0;w<K;w++)E=q?c(s[w],M[w],G):s[w],m?g(E.x,E.y+p[0].y,p[0].x):g(E.x,E.y,0);for(B=1;B<=l;B++)for(w=0;w<K;w++)E=q?c(s[w],M[w],G):s[w],m?g(E.x,E.y+p[B-1].y,p[B-1].x):g(E.x,E.y,h/l*B);for(B=j-1;B>=0;B--){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);w=0;for(D=r.length;w<D;w++)E=c(r[w],C[w],G),g(E.x,E.y,h+I);x=0;for(z=o.length;x<z;x++){u=o[x];
-H=L[x];w=0;for(D=u.length;w<D;w++)E=c(u[w],H[w],G),m?g(E.x,E.y+p[l-1].y,p[l-1].x+I):g(E.x,E.y,h+I)}}if(q){q=K*0;for(w=0;w<O;w++)k=n[w],f(k[2]+q,k[1]+q,k[0]+q);q=K*(l+j*2);for(w=0;w<O;w++)k=n[w],f(k[0]+q,k[1]+q,k[2]+q)}else{for(w=0;w<O;w++)k=n[w],f(k[2],k[1],k[0]);for(w=0;w<O;w++)k=n[w],f(k[0]+K*l,k[1]+K*l,k[2]+K*l)}var J,N,Q=0;e(r);Q+=r.length;x=0;for(z=o.length;x<z;x++)u=o[x],e(u),Q+=u.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+0,c=l+j*2,b=0;b<c;b++){var d=K*b,f=K*(b+1),e=Q+J+d,g=Q+J+f,k=e,d=Q+N+d,f=Q+N+f,m=g;k+=F;d+=F;f+=F;m+=F;A.faces.push(new THREE.Face4(k,d,f,m,null,null,v));v&&(k=b/c,d=(b+1)/c,f=h+i*2,e=(A.vertices[e].position.z+i)/f,g=(A.vertices[g].position.z+i)/f,A.faceVertexUvs[0].push([new THREE.UV(e,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(e,d)]))}}}function g(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(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=y.maxY,f=y.maxX,e=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/f,A.vertices[a].position.y/d),new THREE.UV(e/f,b/d),new THREE.UV(g/f,c/d)])}}var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:i-2,j=b.bevelSegments!==void 0?b.bevelSegments:3,p=b.bevelEnabled!==void 0?b.bevelEnabled:!0,o=b.curveSegments!==
+void 0?b.curveSegments:12,l=b.steps!==void 0?b.steps:1,s=b.bendPath,m=b.extrudePath,q,n=!1,r=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,t=b.material,v=b.extrudeMaterial,y=this.shapebb;if(m)q=m.getPoints(o),l=q.length,n=!0,p=!1;p||(k=i=j=0);var u,x,z,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(z=o.length;x<z;x++)u=o[x],THREE.Shape.Utils.isClockWise(u)&&
+(o[x]=u.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(s,o);r=s;x=0;for(z=o.length;x<z;x++)u=o[x],s=s.concat(u);var w,D,B,G,I,E,K=s.length,O=m.length,C=[];w=0;D=r.length;J=D-1;for(N=w+1;w<D;w++,J++,N++)J===D&&(J=0),N===D&&(N=0),C[w]=d(r[w],r[J],r[N]);var L=[],H,M=C.concat();x=0;for(z=o.length;x<z;x++){u=o[x];H=[];w=0;D=u.length;J=D-1;for(N=w+1;w<D;w++,J++,N++)J===D&&(J=0),N===D&&(N=0),H[w]=d(u[w],u[J],u[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);w=
+0;for(D=r.length;w<D;w++)E=c(r[w],C[w],G),g(E.x,E.y,-I);x=0;for(z=o.length;x<z;x++){u=o[x];H=L[x];w=0;for(D=u.length;w<D;w++)E=c(u[w],H[w],G),g(E.x,E.y,-I)}}G=k;for(w=0;w<K;w++)E=p?c(s[w],M[w],G):s[w],n?g(E.x,E.y+q[0].y,q[0].x):g(E.x,E.y,0);for(B=1;B<=l;B++)for(w=0;w<K;w++)E=p?c(s[w],M[w],G):s[w],n?g(E.x,E.y+q[B-1].y,q[B-1].x):g(E.x,E.y,h/l*B);for(B=j-1;B>=0;B--){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);w=0;for(D=r.length;w<D;w++)E=c(r[w],C[w],G),g(E.x,E.y,h+I);x=0;for(z=o.length;x<z;x++){u=o[x];
+H=L[x];w=0;for(D=u.length;w<D;w++)E=c(u[w],H[w],G),n?g(E.x,E.y+q[l-1].y,q[l-1].x+I):g(E.x,E.y,h+I)}}if(p){p=K*0;for(w=0;w<O;w++)k=m[w],f(k[2]+p,k[1]+p,k[0]+p);p=K*(l+j*2);for(w=0;w<O;w++)k=m[w],f(k[0]+p,k[1]+p,k[2]+p)}else{for(w=0;w<O;w++)k=m[w],f(k[2],k[1],k[0]);for(w=0;w<O;w++)k=m[w],f(k[0]+K*l,k[1]+K*l,k[2]+K*l)}var J,N,Q=0;e(r);Q+=r.length;x=0;for(z=o.length;x<z;x++)u=o[x],e(u),Q+=u.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 b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var f=e.vertices[a].position,g=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([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(g.z,g.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-g.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,c){var d=e.vertices[a].position,f=e.vertices[c].position;return b((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,
@@ -173,18 +173,18 @@ f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,g=b/2,c=c||1,d=d||1,f=c+1,h=d+1,i=a/c,k=b/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<f;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*k-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+f*a,b+f*(a+1),b+1+f*(a+1),b+1+f*a),e.normal.copy(j),e.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
 c,(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c,d,e,g,f){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,g=g!=void 0?g:0,f=f!=void 0?f:Math.PI,h,i,k=[],j=[];for(i=0;i<=c;i++){var q=[],o=[];for(h=0;h<=b;h++){var l=h/b,s=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+l*e)*Math.sin(g+s*f),a*Math.cos(g+s*f),a*Math.sin(d+l*e)*Math.sin(g+s*f))));q.push(this.vertices.length-1);o.push(new THREE.UV(l,s))}k.push(q);
-j.push(o)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],e=k[i][h],g=k[i+1][h],f=k[i+1][h+1],q=this.vertices[d].position.clone().normalize(),o=this.vertices[e].position.clone().normalize(),l=this.vertices[g].position.clone().normalize(),s=this.vertices[f].position.clone().normalize(),n=j[i][h+1].clone(),p=j[i][h].clone(),m=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,g,f,[q,l,s])),this.faceVertexUvs[0].push([n,m,r])):Math.abs(this.vertices[g].position.y)==
-a?(this.faces.push(new THREE.Face3(d,e,g,[q,o,l])),this.faceVertexUvs[0].push([n,p,m])):(this.faces.push(new THREE.Face4(d,e,g,f,[q,o,l,s])),this.faceVertexUvs[0].push([n,p,m,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,b,c,d,e,g,f){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,g=g!=void 0?g:0,f=f!=void 0?f:Math.PI,h,i,k=[],j=[];for(i=0;i<=c;i++){var p=[],o=[];for(h=0;h<=b;h++){var l=h/b,s=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+l*e)*Math.sin(g+s*f),a*Math.cos(g+s*f),a*Math.sin(d+l*e)*Math.sin(g+s*f))));p.push(this.vertices.length-1);o.push(new THREE.UV(l,s))}k.push(p);
+j.push(o)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],e=k[i][h],g=k[i+1][h],f=k[i+1][h+1],p=this.vertices[d].position.clone().normalize(),o=this.vertices[e].position.clone().normalize(),l=this.vertices[g].position.clone().normalize(),s=this.vertices[f].position.clone().normalize(),m=j[i][h+1].clone(),q=j[i][h].clone(),n=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,g,f,[p,l,s])),this.faceVertexUvs[0].push([m,n,r])):Math.abs(this.vertices[g].position.y)==
+a?(this.faces.push(new THREE.Face3(d,e,g,[p,o,l])),this.faceVertexUvs[0].push([m,q,n])):(this.faces.push(new THREE.Face4(d,e,g,f,[p,o,l,s])),this.faceVertexUvs[0].push([m,q,n,r]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};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 b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
-0,e=String(a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,k,j,q,o,l,s,n,p,m=b.glyphs[a]||b.glyphs["?"];if(m){if(m.o){b=m._cachedOutline||(m._cachedOutline=m.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,j));e.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,
-j));e.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;l=b[a++]*c+d;s=b[a++]*c;e.quadraticCurveTo(l,s,i,j);if(f=g[g.length-1]){q=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++){var r=f/h,t=THREE.Shape.Utils.b2(r,q,l,i),r=THREE.Shape.Utils.b2(r,o,s,j);g.push(new THREE.Vector2(t,r))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,l=b[a++]*c+d,s=b[a++]*-c,n=b[a++]*c+d,p=b[a++]*-c,e.bezierCurveTo(i,j,l,s,n,p),f=g[g.length-1]){q=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++)r=f/h,t=THREE.Shape.Utils.b3(r,q,l,
-n,i),r=THREE.Shape.Utils.b3(r,o,s,p,j),g.push(new THREE.Vector2(t,r))}}}return{offset:m.ha*c,points:g,path:e}}}};
-(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,k,j;if(b(a)>0)for(k=0;k<e;k++)f[k]=k;else for(k=0;k<e;k++)f[k]=e-1-k;var q=2*e;for(k=e-1;e>2;){if(q--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);j=k+1;e<=j&&(j=0);var o;a:{o=a;var l=i,s=k,n=j,p=e,m=f,r=void 0,t=void 0,v=void 0,
-y=void 0,u=void 0,x=void 0,z=void 0,A=void 0,F=void 0,t=o[m[l]].x,v=o[m[l]].y,y=o[m[s]].x,u=o[m[s]].y,x=o[m[n]].x,z=o[m[n]].y;if(1.0E-10>(y-t)*(z-v)-(u-v)*(x-t))o=!1;else{for(r=0;r<p;r++)if(!(r==l||r==s||r==n)){var A=o[m[r]].x,F=o[m[r]].y,w=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,w=B=I=void 0,w=x-y,D=z-u,B=t-x,G=v-z,I=y-t,E=u-v,K=A-t,O=F-v,C=A-y,L=F-u,H=A-x,M=F-z,w=w*L-D*C,I=I*O-E*K,B=B*M-G*H;if(w>=0&&B>=0&&I>=0){o=!1;break a}}o=!0}}if(o){g.push([a[f[i]],
-a[f[k]],a[f[j]]]);h.push([f[i],f[k],f[j]]);i=k;for(j=k+1;j<e;i++,j++)f[i]=f[j];e--;q=2*e}}if(d)return h;return g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+0,e=String(a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,k,j,p,o,l,s,m,q,n=b.glyphs[a]||b.glyphs["?"];if(n){if(n.o){b=n._cachedOutline||(n._cachedOutline=n.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,j));e.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,
+j));e.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;l=b[a++]*c+d;s=b[a++]*c;e.quadraticCurveTo(l,s,i,j);if(f=g[g.length-1]){p=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++){var r=f/h,t=THREE.Shape.Utils.b2(r,p,l,i),r=THREE.Shape.Utils.b2(r,o,s,j);g.push(new THREE.Vector2(t,r))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,l=b[a++]*c+d,s=b[a++]*-c,m=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,j,l,s,m,q),f=g[g.length-1]){p=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++)r=f/h,t=THREE.Shape.Utils.b3(r,p,l,
+m,i),r=THREE.Shape.Utils.b3(r,o,s,q,j),g.push(new THREE.Vector2(t,r))}}}return{offset:n.ha*c,points:g,path:e}}}};
+(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,k,j;if(b(a)>0)for(k=0;k<e;k++)f[k]=k;else for(k=0;k<e;k++)f[k]=e-1-k;var p=2*e;for(k=e-1;e>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);j=k+1;e<=j&&(j=0);var o;a:{o=a;var l=i,s=k,m=j,q=e,n=f,r=void 0,t=void 0,v=void 0,
+y=void 0,u=void 0,x=void 0,z=void 0,A=void 0,F=void 0,t=o[n[l]].x,v=o[n[l]].y,y=o[n[s]].x,u=o[n[s]].y,x=o[n[m]].x,z=o[n[m]].y;if(1.0E-10>(y-t)*(z-v)-(u-v)*(x-t))o=!1;else{for(r=0;r<q;r++)if(!(r==l||r==s||r==m)){var A=o[n[r]].x,F=o[n[r]].y,w=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,w=B=I=void 0,w=x-y,D=z-u,B=t-x,G=v-z,I=y-t,E=u-v,K=A-t,O=F-v,C=A-y,L=F-u,H=A-x,M=F-z,w=w*L-D*C,I=I*O-E*K,B=B*M-G*H;if(w>=0&&B>=0&&I>=0){o=!1;break a}}o=!0}}if(o){g.push([a[f[i]],
+a[f[k]],a[f[j]]]);h.push([f[i],f[k],f[j]]);i=k;for(j=k+1;j<e;i++,j++)f[i]=f[j];e--;p=2*e}}if(d)return h;return g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,f=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(g);e.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(g);h.z=
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,f=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,g,f,h,[b[e],b[g],b[f],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[f]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[e].clone(),a[g].clone(),a[f].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,b,c,d,e,g,f){function h(a,b,c,d,f,e){b=c/d*a;
 this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,f=b/this.segmentsT*2*Math.PI,e=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);c.x=i.x-e.x;c.y=i.y-e.y;c.z=i.z-e.z;d.x=i.x+e.x;d.y=i.y+e.y;d.z=i.z+e.z;g.cross(c,d);d.cross(g,c);g.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);e.x+=i*d.x+f*g.x;e.y+=i*d.y+f*g.y;e.z+=i*d.z+f*g.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,
 e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var d=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,e=this.grid[a][b],c=this.grid[d][b],d=this.grid[d][g],g=this.grid[a][g],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,c,d,g));this.faceVertexUvs[0].push([f,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 b=this.subdivisions;b-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var k,l,n,m=0;m<4;m++){n=i[m];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<n.length;p++)l=h.vertexColors[n[p]-1],k.r+=l.r,k.g+=l.g,k.b+=l.b;k.r/=n.length;k.g/=n.length;k.b/=n.length;j.vertexColors[m]=k}}e.push(j);(!f.supportUVs||o.length!=0)&&g.push([o[a],o[b],o[c],o[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},q={},o=[],l,s,n,p,m,r=a.faceVertexUvs[0];l=0;for(s=r.length;l<s;l++){n=0;for(p=r[l].length;n<p;n++)m=d[l]["abcd".charAt(n)],o[m]||(o[m]=r[l][n])}var t;l=0;for(s=d.length;l<s;l++)if(m=d[l],k.push(m.centroid),i.push(new THREE.Vertex(m.centroid)),f.supportUVs&&o.length!=0){t=new THREE.UV;if(m instanceof THREE.Face3)t.u=o[m.a].u+o[m.b].u+o[m.c].u,t.v=o[m.a].v+o[m.b].v+o[m.c].v,t.u/=3,t.v/=3;else if(m instanceof THREE.Face4)t.u=
-o[m.a].u+o[m.b].u+o[m.c].u+o[m.d].u,t.v=o[m.a].v+o[m.b].v+o[m.c].v+o[m.d].v,t.u/=4,t.v/=4;o.push(t)}s=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].push(d)}var d,f,e,g,h={};d=0;for(f=a.faces.length;d<f;d++)e=a.faces[d],e instanceof THREE.Face3?(g=c(e.a,e.b),b(h,g,d),g=c(e.b,e.c),b(h,g,d),g=c(e.c,e.a),b(h,g,d)):e instanceof THREE.Face4&&(g=c(e.a,e.b),b(h,g,d),g=c(e.b,e.c),b(h,g,d),g=c(e.c,e.d),b(h,g,d),g=c(e.d,e.a),b(h,g,d));return h}(a);var v=0,r=h.length,y,u,x={},z={},A=function(a,
-b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},F=function(a,b){z[a]===void 0&&(z[a]={});z[a][b]=null};for(l in s){t=s[l];y=l.split("_");u=y[0];y=y[1];A(u,[u,y]);A(y,[u,y]);n=0;for(p=t.length;n<p;n++)m=t[n],F(u,m,l),F(y,m,l);t.length<2&&(q[l]=!0)}for(l in s)if(t=s[l],m=t[0],t=t[1],y=l.split("_"),u=y[0],y=y[1],p=new THREE.Vector3,q[l]?(p.addSelf(h[u].position),p.addSelf(h[y].position),p.multiplyScalar(0.5)):(p.addSelf(k[m]),p.addSelf(k[t]),p.addSelf(h[u].position),p.addSelf(h[y].position),p.multiplyScalar(0.25)),
-j[l]=r+d.length+v,i.push(new THREE.Vertex(p)),v++,f.supportUVs&&o.length!=0)t=new THREE.UV,t.u=o[u].u+o[y].u,t.v=o[u].v+o[y].v,t.u/=2,t.v/=2,o.push(t);var w,D;y=["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"];l=0;for(s=k.length;l<s;l++)m=d[l],t=r+l,m instanceof THREE.Face3?(v=c(m.a,m.b),u=c(m.b,m.c),w=c(m.c,m.a),b(t,j[v],m.b,j[u],m,y),b(t,j[u],m.c,j[w],m,p),b(t,j[w],m.a,j[v],
-m,A)):m instanceof THREE.Face4?(v=c(m.a,m.b),u=c(m.b,m.c),w=c(m.c,m.d),D=c(m.d,m.a),b(t,j[v],m.b,j[u],m,F),b(t,j[u],m.c,j[w],m,B),b(t,j[w],m.d,j[D],m,G),b(t,j[D],m.a,j[v],m,I)):console.log("face should be a face!",m);d=i;i=new THREE.Vector3;j=new THREE.Vector3;l=0;for(s=h.length;l<s;l++)if(x[l]!==void 0){i.set(0,0,0);j.set(0,0,0);m=new THREE.Vector3(0,0,0);t=0;for(n in z[l])i.addSelf(k[n]),t++;v=0;r=x[l].length;for(n=0;n<r;n++)q[c(x[l][n][0],x[l][n][1])]&&v++;if(v!=2){i.divideScalar(t);for(n=0;n<
-r;n++)t=x[l][n],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(r);m.addSelf(h[l].position);m.multiplyScalar(r-3);m.addSelf(i);m.addSelf(j.multiplyScalar(2));m.divideScalar(r);d[l].position=m}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var k,l,m,n=0;n<4;n++){m=i[n];k=new THREE.Color;k.setRGB(0,0,0);for(var q=0;q<m.length;q++)l=h.vertexColors[m[q]-1],k.r+=l.r,k.g+=l.g,k.b+=l.b;k.r/=m.length;k.g/=m.length;k.b/=m.length;j.vertexColors[n]=k}}e.push(j);(!f.supportUVs||o.length!=0)&&g.push([o[a],o[b],o[c],o[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},p={},o=[],l,s,m,q,n,r=a.faceVertexUvs[0];l=0;for(s=r.length;l<s;l++){m=0;for(q=r[l].length;m<q;m++)n=d[l]["abcd".charAt(m)],o[n]||(o[n]=r[l][m])}var t;l=0;for(s=d.length;l<s;l++)if(n=d[l],k.push(n.centroid),i.push(new THREE.Vertex(n.centroid)),f.supportUVs&&o.length!=0){t=new THREE.UV;if(n instanceof THREE.Face3)t.u=o[n.a].u+o[n.b].u+o[n.c].u,t.v=o[n.a].v+o[n.b].v+o[n.c].v,t.u/=3,t.v/=3;else if(n instanceof THREE.Face4)t.u=
+o[n.a].u+o[n.b].u+o[n.c].u+o[n.d].u,t.v=o[n.a].v+o[n.b].v+o[n.c].v+o[n.d].v,t.u/=4,t.v/=4;o.push(t)}s=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].push(d)}var d,f,e,g,h={};d=0;for(f=a.faces.length;d<f;d++)e=a.faces[d],e instanceof THREE.Face3?(g=c(e.a,e.b),b(h,g,d),g=c(e.b,e.c),b(h,g,d),g=c(e.c,e.a),b(h,g,d)):e instanceof THREE.Face4&&(g=c(e.a,e.b),b(h,g,d),g=c(e.b,e.c),b(h,g,d),g=c(e.c,e.d),b(h,g,d),g=c(e.d,e.a),b(h,g,d));return h}(a);var v=0,r=h.length,y,u,x={},z={},A=function(a,
+b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},F=function(a,b){z[a]===void 0&&(z[a]={});z[a][b]=null};for(l in s){t=s[l];y=l.split("_");u=y[0];y=y[1];A(u,[u,y]);A(y,[u,y]);m=0;for(q=t.length;m<q;m++)n=t[m],F(u,n,l),F(y,n,l);t.length<2&&(p[l]=!0)}for(l in s)if(t=s[l],n=t[0],t=t[1],y=l.split("_"),u=y[0],y=y[1],q=new THREE.Vector3,p[l]?(q.addSelf(h[u].position),q.addSelf(h[y].position),q.multiplyScalar(0.5)):(q.addSelf(k[n]),q.addSelf(k[t]),q.addSelf(h[u].position),q.addSelf(h[y].position),q.multiplyScalar(0.25)),
+j[l]=r+d.length+v,i.push(new THREE.Vertex(q)),v++,f.supportUVs&&o.length!=0)t=new THREE.UV,t.u=o[u].u+o[y].u,t.v=o[u].v+o[y].v,t.u/=2,t.v/=2,o.push(t);var w,D;y=["123","12","2","23"];q=["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"];l=0;for(s=k.length;l<s;l++)n=d[l],t=r+l,n instanceof THREE.Face3?(v=c(n.a,n.b),u=c(n.b,n.c),w=c(n.c,n.a),b(t,j[v],n.b,j[u],n,y),b(t,j[u],n.c,j[w],n,q),b(t,j[w],n.a,j[v],
+n,A)):n instanceof THREE.Face4?(v=c(n.a,n.b),u=c(n.b,n.c),w=c(n.c,n.d),D=c(n.d,n.a),b(t,j[v],n.b,j[u],n,F),b(t,j[u],n.c,j[w],n,B),b(t,j[w],n.d,j[D],n,G),b(t,j[D],n.a,j[v],n,I)):console.log("face should be a face!",n);d=i;i=new THREE.Vector3;j=new THREE.Vector3;l=0;for(s=h.length;l<s;l++)if(x[l]!==void 0){i.set(0,0,0);j.set(0,0,0);n=new THREE.Vector3(0,0,0);t=0;for(m in z[l])i.addSelf(k[m]),t++;v=0;r=x[l].length;for(m=0;m<r;m++)p[c(x[l][m][0],x[l][m][1])]&&v++;if(v!=2){i.divideScalar(t);for(m=0;m<
+r;m++)t=x[l][m],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(r);n.addSelf(h[l].position);n.multiplyScalar(r-3);n.addSelf(i);n.addSelf(j.multiplyScalar(2));n.divideScalar(r);d[l].position=n}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;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 b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
@@ -206,124 +206,124 @@ a}function d(a,b){var d=new Image;d.onload=function(){if(!c(this.width)||!c(this
 if(e[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[h[0]]!==void 0)a[c].wrapS=e[h[0]];if(e[h[1]]!==void 0)a[c].wrapT=e[h[1]]}d(a[c],b+"/"+f)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,h,i;h="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
 if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=g(a.colorDiffuse);
 else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=g(a.colorSpecular);if(a.colorAmbient)f.ambient=g(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&b&&e(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&b&&e(f,"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=f.color;h=f.specular;i=f.ambient;var o=f.shininess;j.tNormal.texture=f.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(f.map)j.tDiffuse.texture=f.map,j.enableDiffuse.value=!0;if(f.specularMap)j.tSpecular.texture=f.specularMap,j.enableSpecular.value=!0;if(f.lightMap)j.tAO.texture=
-f.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(f.opacity)j.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:j,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+a.mapSpecular&&b&&e(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var k=THREE.ShaderUtils.lib.normal,j=THREE.UniformsUtils.clone(k.uniforms),p=f.color;h=f.specular;i=f.ambient;var o=f.shininess;j.tNormal.texture=f.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(f.map)j.tDiffuse.texture=f.map,j.enableDiffuse.value=!0;if(f.specularMap)j.tSpecular.texture=f.specularMap,j.enableSpecular.value=!0;if(f.lightMap)j.tAO.texture=
+f.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(p);j.uSpecularColor.value.setHex(h);j.uAmbientColor.value.setHex(i);j.uShininess.value=o;if(f.opacity)j.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:j,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
 THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,b,c,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,b=d.callback,c=d.texture_path,d=d.bin_path;var c=c?c:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,g){var f=new XMLHttpRequest;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(h,c,e,d,g)}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+
 f.status+"]")};f.open("GET",b,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var g=new XMLHttpRequest,f=c+"/"+a.buffers,h=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("Couldn't load ["+f+"] ["+g.status+"]"):g.readyState==3?e&&(h==0&&(h=g.getResponseHeader("Content-Length")),e({total:h,loaded:g.responseText.length})):g.readyState==2&&(h=g.getResponseHeader("Content-Length"))};g.open("GET",f,!0);
 g.responseType="arraybuffer";g.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(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,f,e,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=l[d*3];e=l[d*3+1];g=l[d*3+2];h=t[f*2];f=t[f*2+1];i=t[e*2];j=t[e*2+1];e=t[g*2];k=t[g*2+1];g=n.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,f));m.push(new THREE.UV(i,j));m.push(new THREE.UV(e,k));g.push(m)}}
-function j(b,c){var d,f,e,g,h,i,j,k,l,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=o[d*4];e=o[d*4+1];g=o[d*4+2];h=o[d*4+3];i=t[f*2];f=t[f*2+1];j=t[e*2];l=t[e*2+1];k=t[g*2];m=t[g*2+1];g=t[h*2];e=t[h*2+1];h=n.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,f));p.push(new THREE.UV(j,l));p.push(new THREE.UV(k,m));p.push(new THREE.UV(g,e));h.push(p)}}function q(b,c,d){for(var f,e,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)f=c[d*3],e=c[d*3+1],g=c[d*3+2],h=i[d],n.faces.push(new THREE.Face3(f,
-e,g,null,null,h))}function o(b,c,d){for(var f,e,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)f=c[d*4],e=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],n.faces.push(new THREE.Face4(f,e,g,h,null,null,i))}function l(b,c,d,f){for(var e,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*3];g=c[f*3+1];h=c[f*3+2];j=d[f*3];k=d[f*3+1];l=d[f*3+2];i=m[f];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];n.faces.push(new THREE.Face3(e,
-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,f){for(var e,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,f,b),f=0;f<b;f++){e=c[f*4];g=c[f*4+1];h=c[f*4+2];i=c[f*4+3];k=d[f*4];l=d[f*4+1];m=d[f*4+2];o=d[f*4+3];j=p[f];var q=r[l*3],s=r[l*3+1];l=r[l*3+2];var t=r[m*3],u=r[m*3+1];m=r[m*3+2];var v=r[o*3],x=r[o*3+1];o=r[o*3+2];n.faces.push(new THREE.Face4(e,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,u,m),new THREE.Vector3(v,x,o)],null,j))}}var n=this,p=0,m,r=[],t=[],v,y,u,x,z,A;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);m={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",f=0;f<c;f++)d+=String.fromCharCode(a[b+f]);return d}(a,p,12),header_bytes:e(a,p+12),vertex_coordinate_bytes:e(a,p+13),normal_coordinate_bytes:e(a,p+14),uv_coordinate_bytes:e(a,p+15),vertex_index_bytes:e(a,p+16),normal_index_bytes:e(a,
-p+17),uv_index_bytes:e(a,p+18),material_index_bytes:e(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)};m.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");p+=m.header_bytes;b=m.vertex_index_bytes*3+m.material_index_bytes;A=m.vertex_index_bytes*
-4+m.material_index_bytes;v=m.ntri_flat*b;y=m.ntri_smooth*(b+m.normal_index_bytes*3);u=m.ntri_flat_uv*(b+m.uv_index_bytes*3);x=m.ntri_smooth_uv*(b+m.normal_index_bytes*3+m.uv_index_bytes*3);z=m.nquad_flat*A;b=m.nquad_smooth*(A+m.normal_index_bytes*4);A=m.nquad_flat_uv*(A+m.uv_index_bytes*4);p+=function(b){var c=m.nvertices,b=new Float32Array(a,b,c*3),d,f,e,g;for(d=0;d<c;d++)f=b[d*3],e=b[d*3+1],g=b[d*3+2],n.vertices.push(new THREE.Vertex(new THREE.Vector3(f,e,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(p);
-p+=function(b){var c=m.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,f,e,g;for(d=0;d<c;d++)f=b[d*3],e=b[d*3+1],g=b[d*3+2],r.push(f/127,e/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(p);p+=c(m.nnormals*3);p+=function(b){var c=m.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,f,e;for(d=0;d<c;d++)f=b[d*2],e=b[d*2+1],t.push(f,e)}return c*2*Float32Array.BYTES_PER_ELEMENT}(p);v=p+v+c(m.ntri_flat*2);y=v+y+c(m.ntri_smooth*2);u=y+u+c(m.ntri_flat_uv*2);x=u+x+c(m.ntri_smooth_uv*2);z=x+z+c(m.nquad_flat*2);
-b=z+b+c(m.nquad_smooth*2);A=b+A+c(m.nquad_flat_uv*2);(function(a){var b=m.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)}})(y);(function(a){var b=m.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;l(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,d)}})(u);(function(a){var b=m.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=m.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=m.ntri_flat;b&&q(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(p);(function(a){var b=m.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;l(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(v);(function(a){var b=m.nquad_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(x);(function(a){var b=
-m.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(z);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
-THREE.ColladaLoader=function(){function a(a,d,e){P=a;d=d||ca;e!==void 0&&(a=e.split("/"),a.pop(),da=a.length<1?"":a.join("/")+"/");Z=b("//dae:library_images/dae:image",f,"image");$=b("//dae:library_materials/dae:material",z,"material");aa=b("//dae:library_effects/dae:effect",B,"effect");S=b("//dae:library_geometries/dae:geometry",p,"geometry");R=b("//dae:library_controllers/dae:controller",h,"controller");U=b("//dae:library_animations/dae:animation",I,"animation");ba=b(".//dae:library_visual_scenes/dae:visual_scene",
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(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 p(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 l(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],u=r[n*3+1];n=r[n*3+2];var v=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,u,n),new THREE.Vector3(v,x,o)],null,j))}}var m=this,q=0,n,r=[],t=[],v,y,u,x,z,A;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(m,d,b);n={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,q,12),header_bytes:e(a,q+12),vertex_coordinate_bytes:e(a,q+13),normal_coordinate_bytes:e(a,q+14),uv_coordinate_bytes:e(a,q+15),vertex_index_bytes:e(a,q+16),normal_index_bytes:e(a,
+q+17),uv_index_bytes:e(a,q+18),material_index_bytes:e(a,q+19),nvertices:i(a,q+20),nnormals:i(a,q+20+4),nuvs:i(a,q+20+8),ntri_flat:i(a,q+20+12),ntri_smooth:i(a,q+20+16),ntri_flat_uv:i(a,q+20+20),ntri_smooth_uv:i(a,q+20+24),nquad_flat:i(a,q+20+28),nquad_smooth:i(a,q+20+32),nquad_flat_uv:i(a,q+20+36),nquad_smooth_uv:i(a,q+20+40)};n.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");q+=n.header_bytes;b=n.vertex_index_bytes*3+n.material_index_bytes;A=n.vertex_index_bytes*
+4+n.material_index_bytes;v=n.ntri_flat*b;y=n.ntri_smooth*(b+n.normal_index_bytes*3);u=n.ntri_flat_uv*(b+n.uv_index_bytes*3);x=n.ntri_smooth_uv*(b+n.normal_index_bytes*3+n.uv_index_bytes*3);z=n.nquad_flat*A;b=n.nquad_smooth*(A+n.normal_index_bytes*4);A=n.nquad_flat_uv*(A+n.uv_index_bytes*4);q+=function(b){var c=n.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}(q);
+q+=function(b){var c=n.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}(q);q+=c(n.nnormals*3);q+=function(b){var c=n.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}(q);v=q+v+c(n.ntri_flat*2);y=v+y+c(n.ntri_smooth*2);u=y+u+c(n.ntri_flat_uv*2);x=u+x+c(n.ntri_smooth_uv*2);z=x+z+c(n.nquad_flat*2);
+b=z+b+c(n.nquad_smooth*2);A=b+A+c(n.nquad_flat_uv*2);(function(a){var b=n.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;p(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,c)}})(y);(function(a){var b=n.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;l(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,d)}})(u);(function(a){var b=n.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=n.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=n.ntri_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(q);(function(a){var b=n.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;l(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(v);(function(a){var b=n.nquad_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(x);(function(a){var b=
+n.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(z);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
+THREE.ColladaLoader=function(){function a(a,d,e){P=a;d=d||ca;e!==void 0&&(a=e.split("/"),a.pop(),da=a.length<1?"":a.join("/")+"/");Z=b("//dae:library_images/dae:image",f,"image");$=b("//dae:library_materials/dae:material",z,"material");aa=b("//dae:library_effects/dae:effect",B,"effect");S=b("//dae:library_geometries/dae:geometry",q,"geometry");R=b("//dae:library_controllers/dae:controller",h,"controller");U=b("//dae:library_animations/dae:animation",I,"animation");ba=b(".//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(g(T.nodes[a]));c();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 b(a,b,c){for(var a=P.evaluate(a,P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null),d={},f=a.iterateNext(),e=0;f;){f=(new b).parse(f);if(f.id.length==0)f.id=c+e++;d[f.id]=f;f=a.iterateNext()}return d}function c(){var a=1E6,b=-a,c=0,d;for(d in U)for(var f=U[d],e=0;e<f.sampler.length;e++){var g=f.sampler[e];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,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var e=a.channels[0].sampler.output[c];e instanceof
-THREE.Matrix4&&a.world.copy(e)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)d(a.nodes[f],b,c,a.world)}function e(a,b,f){var e=R[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 g=c(),b=T.getChildById(b.skeleton[0],!0)||T.getChildBySid(b.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)e.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
-for(f=0;f<g.frames;f++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(b,n,f);h=n;i=e.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var r=i.weights[p][q];r.joint==m&&j.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
-j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+f,vertices:o})}}}function g(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=R[a.controllers[f].url];switch(i.type){case "skin":if(S[i.skin.source]){var j=
-new n;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(R[i.skin.source]&&(d=i=R[i.skin.source],i.morph&&S[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(S[i.morph.source])j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
-0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=S[i.url],k={},m=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;m++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(m>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)m=
-i.faces[h],m.materials=[k[m.daeMaterial]]}if(c!==void 0)e(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 l?R[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(m=0;m<k.targets.length;m++)if(p=S[k.targets[m]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
+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 c(){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 e(a,b,e){var f=R[b.url];if(!f||!f.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 g=c(),b=T.getChildById(b.skeleton[0],!0)||T.getChildBySid(b.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
+for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(b,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var r=i.weights[p][q];r.joint==m&&j.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
+j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function g(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=R[a.controllers[f].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[f].instance_material;a.geometries.push(j);c=a.controllers[f]}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[f].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[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
+0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=S[i.url],k={},n=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;n++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(n>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)n=
+i.faces[h],n.materials=[k[n.daeMaterial]]}if(c!==void 0)e(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 l?R[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(n=0;n<k.targets.length;n++)if(p=S[k.targets[n]],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(f=0;f<a.nodes.length;f++)b.add(g(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
-null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function 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 l(){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 m(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 v(){this.source="";this.stride=this.count=0;this.params=[]}function y(){this.input={}}function u(){this.semantic=
+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 p(){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 l(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function s(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function n(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 v(){this.source="";this.stride=this.count=0;this.params=[]}function y(){this.input={}}function u(){this.semantic=
 "";this.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function z(){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 w(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;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
 c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
-0;d<a.childNodes.length;d++){var f=a.childNodes[d];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new x).parse(f);b[f.id]=f;break;case "targets":c=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],f=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.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 u).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 f=0;f<a.childNodes.length;f++){var e=a.childNodes[f];if(e.nodeType==1)switch(e.nodeName){case "bind_shape_matrix":e=L(e.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]);break;case "source":e=(new x).parse(e);b[e.id]=e;break;case "joints":c=
-e;break;case "vertex_weights":d=e;break;default:console.log(e.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 u).parse(d),f=b[d.source];if(d.semantic=="JOINT")this.joints=f.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,f=[],e=0;e<a.childNodes.length;e++){var g=
-a.childNodes[e];if(g.nodeType==1)switch(g.nodeName){case "input":f.push((new u).parse(g));break;case "v":c=H(g.textContent);break;case "vcount":d=H(g.textContent)}}for(e=g=0;e<d.length;e++){for(var h=d[e],i=[],j=0;j<h;j++){for(var k={},l=0;l<f.length;l++){var m=f[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+=f.length}for(j=0;j<i.length;j++)i[j].index=e;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 f=d.shift(),e=f.indexOf(".")>=0,g=f.indexOf("(")>=0,h;if(e)d=f.split("."),f=d.shift(),d.shift();else if(g){h=f.split("(");f=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(f==a)return c.info={sid:f,dotSyntax:e,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 l).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 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 f=U[d],e=0;e<f.channel.length;e++){var g=f.channel[e],h=f.sampler[e];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 f={},i=e=void 0,e=0;e<this.channels.length;e++)i=this.channels[e],f[i.sid]=i;g=new THREE.Matrix4;for(e=0;e<this.transforms.length;e++)if(h=
-this.transforms[e],i=f[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,
+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 u).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 u).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 u).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 p).parse(c))}}return this};p.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};p.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};p.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};p.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};p.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 p).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new l).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 p).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};p.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};l.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 m(this)).parse(c)}}return this};m.prototype.parse=function(a){function b(a,c){var d=Q(a.position);f[d]===void 0&&(f[d]={v:a,index:c});return f[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 y).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 f=
-{};this.geometry3js=new THREE.Geometry;d=V[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var e=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(e,a);this.geometry3js.vertices.push(e)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
-return this};m.prototype.handlePrimitive=function(a,b,c){var d=0,f,e,g=a.p,h=a.inputs,i,j,k,l,m=0,n=3,o=[];for(f=0;f<h.length;f++)switch(i=h[f],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],q=[],r={},s=[];a.vcount&&(n=a.vcount[m++]);for(f=0;f<n;f++)for(e=0;e<h.length;e++)switch(i=h[e],l=V[i.source],j=g[d+f*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;n==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],s.length?s:new THREE.Color):n==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(e=0;e<o.length;e++)f=r[o[e]],b.faceVertexUvs[e].push([f[0],
-f[1],f[2]]);d+=h.length*n}};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 u).parse(a.childNodes[b]));break;case "vcount":this.vcount=
+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};q.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 n(this)).parse(c)}}return this};n.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 y).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};n.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,m=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],q=[],r={},s=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=V[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=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;n==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],s.length?s:new THREE.Color):n==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*n}};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 u).parse(a.childNodes[b]));break;case "vcount":this.vcount=
 H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};v.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};y.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 u).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};u.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+/),
-f=[],e=0;e<d.length;e++)f.push(d[e]=="true"||d[e]=="1"?!0:!1);this.data=f;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 v).parse(c.childNodes[d]);break}}}return this};
+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 v).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};z.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 f=d.iterateNext(),e=[];f;)e.push(f),f=d.iterateNext();d=e;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=
+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)};w.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 w(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,f,e;if(c)b=a.split("."),a=b.shift(),e=b.shift();else if(d){f=a.split("(");a=f.shift();for(b=0;b<f.length;b++)f[b]=parseInt(f[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=f;this.member=e;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 u).parse(c))}}return this};
+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 u).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:e,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.JSONLoader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0)try{var h=JSON.parse(g.responseText);a.createModel(h,c,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+g.status+"]");else g.readyState==3?e&&(f==0&&(f=g.getResponseHeader("Content-Length")),e({total:f,loaded:g.responseText.length})):
 g.readyState==2&&(f=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,k,j,q,o,l,s,n,p,m,r,t,v=a.faces;q=a.vertices;var y=a.normals,u=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=v.length;k<j;){b=v[k++];q=b&1;i=b&2;c=b&4;e=b&8;l=b&16;o=b&32;n=b&64;b&=128;q?(p=new THREE.Face4,p.a=v[k++],p.b=v[k++],p.c=v[k++],p.d=v[k++],q=4):(p=new THREE.Face3,p.a=v[k++],p.b=v[k++],p.c=v[k++],q=3);if(i)i=v[k++],p.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)m=a.uvs[c],s=v[k++],t=m[s*2],s=m[s*2+1],d.faceUvs[c][i]=new THREE.UV(t,s);if(e)for(c=0;c<x;c++){m=a.uvs[c];r=[];
-for(e=0;e<q;e++)s=v[k++],t=m[s*2],s=m[s*2+1],r[e]=new THREE.UV(t,s);d.faceVertexUvs[c][i]=r}if(l)l=v[k++]*3,e=new THREE.Vector3,e.x=y[l++],e.y=y[l++],e.z=y[l],p.normal=e;if(o)for(c=0;c<q;c++)l=v[k++]*3,e=new THREE.Vector3,e.x=y[l++],e.y=y[l++],e.z=y[l],p.vertexNormals.push(e);if(n)o=v[k++],o=new THREE.Color(u[o]),p.color=o;if(b)for(c=0;c<q;c++)o=v[k++],o=new THREE.Color(u[o]),p.vertexColors.push(o);d.faces.push(p)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
-2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,k,j,q,o,l,s;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];l=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,l.push(new THREE.Vertex(new THREE.Vector3(j,q,o)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;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)}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,k,j,p,o,l,s,m,q,n,r,t,v=a.faces;p=a.vertices;var y=a.normals,u=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=p.length;k<
+j;)o=new THREE.Vertex,o.position.x=p[k++]*b,o.position.y=p[k++]*b,o.position.z=p[k++]*b,d.vertices.push(o);k=0;for(j=v.length;k<j;){b=v[k++];p=b&1;i=b&2;c=b&4;e=b&8;l=b&16;o=b&32;m=b&64;b&=128;p?(q=new THREE.Face4,q.a=v[k++],q.b=v[k++],q.c=v[k++],q.d=v[k++],p=4):(q=new THREE.Face3,q.a=v[k++],q.b=v[k++],q.c=v[k++],p=3);if(i)i=v[k++],q.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)n=a.uvs[c],s=v[k++],t=n[s*2],s=n[s*2+1],d.faceUvs[c][i]=new THREE.UV(t,s);if(e)for(c=0;c<x;c++){n=a.uvs[c];r=[];
+for(e=0;e<p;e++)s=v[k++],t=n[s*2],s=n[s*2+1],r[e]=new THREE.UV(t,s);d.faceVertexUvs[c][i]=r}if(l)l=v[k++]*3,e=new THREE.Vector3,e.x=y[l++],e.y=y[l++],e.z=y[l],q.normal=e;if(o)for(c=0;c<p;c++)l=v[k++]*3,e=new THREE.Vector3,e.x=y[l++],e.y=y[l++],e.z=y[l],q.vertexNormals.push(e);if(m)o=v[k++],o=new THREE.Color(u[o]),q.color=o;if(b)for(c=0;c<p;c++)o=v[k++],o=new THREE.Color(u[o]),q.vertexColors.push(o);d.faces.push(q)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
+2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,k,j,p,o,l,s;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];l=d.morphTargets[c].vertices;
+s=a.morphTargets[c].vertices;i=0;for(k=s.length;i<k;i+=3)j=s[i]*b,p=s[i+1]*b,o=s[i+2]*b,l.push(new THREE.Vertex(new THREE.Vector3(j,p,o)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;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)p=new THREE.Color(16755200),p.setRGB(j[b],j[b+1],j[b+2]),k.push(p)}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
 d.computeTangents();b(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,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var e=JSON.parse(d.responseText);e.metadata===void 0||e.metadata.formatVersion===void 0||e.metadata.formatVersion!==3?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(g){console.error(g),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,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(o in B.objects)if(!C.objects[o])if(m=B.objects[o],m.geometry!==void 0){if(A=C.geometries[m.geometry]){a=!1;for(H=0;H<m.materials.length;H++)D=C.materials[m.materials[H]],a=D instanceof THREE.ShaderMaterial;a&&A.computeTangents();v=m.position;y=m.rotation;u=m.quaternion;x=m.scale;u=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(v[0],v[1],v[2]);u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]);a.scale.set(x[0],x[1],x[2]);a.visible=m.visible;C.scene.add(a);C.objects[o]=a;if(m.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(m.castsShadow)b=new THREE.ShadowVolume(A),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;m.trigger&&m.trigger.toLowerCase()!="none"&&(b=
-{type:m.trigger,object:m},C.triggers[a.name]=b)}}else v=m.position,y=m.rotation,u=m.quaternion,x=m.scale,u=0,a=new THREE.Object3D,a.name=o,a.position.set(v[0],v[1],v[2]),u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]),a.scale.set(x[0],x[1],x[2]),a.visible=m.visible!==void 0?m.visible:!1,C.scene.add(a),C.objects[o]=a,C.empties[o]=a,m.trigger&&m.trigger.toLowerCase()!="none"&&(b={type:m.trigger,object:m},C.triggers[a.name]=b)}function g(a){return function(b){C.geometries[a]=
-b;e();I-=1;i.onLoadComplete();h()}}function f(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&&b(C)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),j,q,o,l,s,n,p,m,r,t,v,y,u,x,z,A,F,w,D,B,G,I,E,K,O,C;B=a;c=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(m=B.objects[o],m.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,
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(o in B.objects)if(!C.objects[o])if(n=B.objects[o],n.geometry!==void 0){if(A=C.geometries[n.geometry]){a=!1;for(H=0;H<n.materials.length;H++)D=C.materials[n.materials[H]],a=D instanceof THREE.ShaderMaterial;a&&A.computeTangents();v=n.position;y=n.rotation;u=n.quaternion;x=n.scale;u=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(v[0],v[1],v[2]);u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]);a.scale.set(x[0],x[1],x[2]);a.visible=n.visible;C.scene.add(a);C.objects[o]=a;if(n.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(n.castsShadow)b=new THREE.ShadowVolume(A),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;n.trigger&&n.trigger.toLowerCase()!="none"&&(b=
+{type:n.trigger,object:n},C.triggers[a.name]=b)}}else v=n.position,y=n.rotation,u=n.quaternion,x=n.scale,u=0,a=new THREE.Object3D,a.name=o,a.position.set(v[0],v[1],v[2]),u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]),a.scale.set(x[0],x[1],x[2]),a.visible=n.visible!==void 0?n.visible:!1,C.scene.add(a),C.objects[o]=a,C.empties[o]=a,n.trigger&&n.trigger.toLowerCase()!="none"&&(b={type:n.trigger,object:n},C.triggers[a.name]=b)}function g(a){return function(b){C.geometries[a]=
+b;e();I-=1;i.onLoadComplete();h()}}function f(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&&b(C)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),j,p,o,l,s,m,q,n,r,t,v,y,u,x,z,A,F,w,D,B,G,I,E,K,O,C;B=a;c=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(n=B.objects[o],n.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)),v=r.position,r=r.target,F.position.set(v[0],v[1],v[2]),F.target=new THREE.Vector3(r[0],r[1],r[2]),C.cameras[s]=F;for(l in B.lights)r=B.lights[l],s=r.color!==void 0?r.color:16777215,F=r.intensity!==void 0?r.intensity:1,r.type=="directional"?(v=r.direction,t=new THREE.DirectionalLight(s,F),t.position.set(v[0],v[1],v[2]),t.position.normalize()):r.type=="point"?(v=r.position,t=r.distance,
-t=new THREE.PointLight(s,F,t),t.position.set(v[0],v[1],v[2])):r.type=="ambient"&&(t=new THREE.AmbientLight(s)),C.scene.add(t),C.lights[l]=t;for(n in B.fogs)l=B.fogs[n],l.type=="linear"?w=new THREE.Fog(0,l.near,l.far):l.type=="exp2"&&(w=new THREE.FogExp2(0,l.density)),r=l.color,w.color.setRGB(r[0],r[1],r[2]),C.fogs[n]=w;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(n=B.geometries[j],n.type=="bin_mesh"||n.type=="ascii_mesh")I+=1,i.onLoadStart();K=I;for(j in B.geometries)n=B.geometries[j],n.type=="cube"?(A=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),C.geometries[j]=A):n.type=="plane"?(A=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),C.geometries[j]=A):n.type=="sphere"?
-(A=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),C.geometries[j]=A):n.type=="cylinder"?(A=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),C.geometries[j]=A):n.type=="torus"?(A=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),C.geometries[j]=A):n.type=="icosahedron"?(A=new THREE.IcosahedronGeometry(n.subdivisions),C.geometries[j]=A):n.type=="bin_mesh"?c.load(d(n.url,B.urlBaseType),g(j)):n.type=="ascii_mesh"?G.load(d(n.url,B.urlBaseType),
-g(j)):n.type=="embedded_mesh"&&(n=B.embeds[n.id])&&G.createModel(n,f(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){w={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(w[j.wrap[0]]!==void 0)n.wrapS=w[j.wrap[0]];if(w[j.wrap[1]]!==void 0)n.wrapT=
-w[j.wrap[1]]}}C.textures[p]=n}for(q in B.materials){p=B.materials[q];for(z in p.parameters)if(z=="envMap"||z=="map"||z=="lightMap")p.parameters[z]=C.textures[p.parameters[z]];else if(z=="shading")p.parameters[z]=p.parameters[z]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(z=="blending")p.parameters[z]=THREE[p.parameters[z]]?THREE[p.parameters[z]]:THREE.NormalBlending;else if(z=="combine")p.parameters[z]=p.parameters[z]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(z==
-"vertexColors")if(p.parameters[z]=="face")p.parameters[z]=THREE.FaceColors;else if(p.parameters[z])p.parameters[z]=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;w=p.parameters.specular;c=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(w);a.uAmbientColor.value.setHex(c);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}e();i.callbackSync(C);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+t=new THREE.PointLight(s,F,t),t.position.set(v[0],v[1],v[2])):r.type=="ambient"&&(t=new THREE.AmbientLight(s)),C.scene.add(t),C.lights[l]=t;for(m in B.fogs)l=B.fogs[m],l.type=="linear"?w=new THREE.Fog(0,l.near,l.far):l.type=="exp2"&&(w=new THREE.FogExp2(0,l.density)),r=l.color,w.color.setRGB(r[0],r[1],r[2]),C.fogs[m]=w;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"?c.load(d(m.url,B.urlBaseType),g(j)):m.type=="ascii_mesh"?G.load(d(m.url,B.urlBaseType),
+g(j)):m.type=="embedded_mesh"&&(m=B.embeds[m.id])&&G.createModel(m,f(j),"");for(q in B.textures)if(j=B.textures[q],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(q in B.textures){j=B.textures[q];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){w={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(w[j.wrap[0]]!==void 0)m.wrapS=w[j.wrap[0]];if(w[j.wrap[1]]!==void 0)m.wrapT=
+w[j.wrap[1]]}}C.textures[q]=m}for(p in B.materials){q=B.materials[p];for(z in q.parameters)if(z=="envMap"||z=="map"||z=="lightMap")q.parameters[z]=C.textures[q.parameters[z]];else if(z=="shading")q.parameters[z]=q.parameters[z]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(z=="blending")q.parameters[z]=THREE[q.parameters[z]]?THREE[q.parameters[z]]:THREE.NormalBlending;else if(z=="combine")q.parameters[z]=q.parameters[z]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(z==
+"vertexColors")if(q.parameters[z]=="face")q.parameters[z]=THREE.FaceColors;else if(q.parameters[z])q.parameters[z]=THREE.VertexColors;if(q.parameters.opacity!==void 0&&q.parameters.opacity<1)q.parameters.transparent=!0;if(q.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);m=q.parameters.color;w=q.parameters.specular;c=q.parameters.ambient;G=q.parameters.shininess;a.tNormal.texture=C.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)a.uNormalScale.value=
+q.parameters.normalMapFactor;if(q.parameters.map)a.tDiffuse.texture=q.parameters.map,a.enableDiffuse.value=!0;if(q.parameters.lightMap)a.tAO.texture=q.parameters.lightMap,a.enableAO.value=!0;if(q.parameters.specularMap)a.tSpecular.texture=C.textures[q.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(w);a.uAmbientColor.value.setHex(c);a.uShininess.value=G;if(q.parameters.opacity)a.uOpacity.value=q.parameters.opacity;q=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
+vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else q=new THREE[q.type](q.parameters);C.materials[p]=q}e();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,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var d=new XMLHttpRequest,e=c.scale!==void 0?c.scale:1,g=c.offsetX!==void 0?c.offsetX:0,f=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 b,e,g,f,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;e<8;e++){for(var g=0,f=0;f<b;++f){var h=a.charCodeAt(f+d);g+=h>>1^-(h&1);c[8*f+e]=g}d+=b}b=a.length-d;g=new Uint16Array(b);for(e=f=0;e<b;e++)h=a.charCodeAt(e+d),g[e]=f-h,h==0&&f++;return[c,g]};
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,f,i){for(var j,k,p,m=a.length;i<m;i+=f)j=a[i],k=a[i+1],p=a[i+2],j=j/16383*c,k=k/16383*c,p=p/16383*c,j+=d,k+=e,p+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,p)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,j.push(d,1-e)})(f[0],8,3);(function(a,
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,f,i){for(var j,k,q,n=a.length;i<n;i+=f)j=a[i],k=a[i+1],q=a[i+2],j=j/16383*c,k=k/16383*c,q=q/16383*c,j+=d,k+=e,q+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,q)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,j.push(d,1-e)})(f[0],8,3);(function(a,
 b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,k.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,r,t,v,y=a.length;for(c=0;c<y;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;t=d;v=e;i=f;r=d;var u=e,x=f,z=g.materials[0],A=k[u*3],F=k[u*3+1],u=k[u*3+2],w=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]);u=new THREE.Vector3(A,F,u);x=new THREE.Vector3(w,D,x);g.faces.push(new THREE.Face3(t,v,i,[r,u,x],null,z));g=j[d*2];d=j[d*2+
 1];i=j[e*2];r=j[e*2+1];t=j[f*2];v=j[f*2+1];f=b.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,v));f.push(r)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;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,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,k,j,q){f=(f-j)/(q-j);j=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=k;e[g]=this.lerp(j[a],j[a+3],f);e[g+1]=this.lerp(j[a+1],j[a+4],f);e[g+2]=this.lerp(j[a+2],j[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,k,j,q){f=(f-j)/(q-j);j=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=k;b=a+this.yd*
-3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,k,j,q){f=(f-j)/(q-j);j=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=k+f*this.delta;b=a+this.zd*3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
-this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,k=g+this.yd,j=g+this.zd,q=i+this.yd,o=i+this.zd,l=g+this.yd+this.zd,s=i+this.yd+this.zd,n=0,p=this.field[g],m=this.field[i],r=this.field[k],t=this.field[q],v=this.field[j],y=this.field[o],u=this.field[l],x=this.field[s];p<f&&(n|=1);m<f&&(n|=2);r<f&&(n|=8);t<f&&(n|=4);v<f&&(n|=16);y<f&&(n|=32);u<f&&(n|=128);x<f&&(n|=64);var z=THREE.edgeTable[n];if(z===0)return 0;var A=this.delta,F=a+
-A,w=b+A,A=e+A;z&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,p,m));z&2&&(this.compNorm(i),this.compNorm(q),this.VIntY(i*3,this.vlist,this.nlist,3,f,F,b,e,m,t));z&4&&(this.compNorm(k),this.compNorm(q),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,w,e,r,t));z&8&&(this.compNorm(g),this.compNorm(k),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,p,r));z&16&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,12,f,a,b,A,v,y));z&32&&(this.compNorm(o),
-this.compNorm(s),this.VIntY(o*3,this.vlist,this.nlist,15,f,F,b,A,y,x));z&64&&(this.compNorm(l),this.compNorm(s),this.VIntX(l*3,this.vlist,this.nlist,18,f,a,w,A,u,x));z&128&&(this.compNorm(j),this.compNorm(l),this.VIntY(j*3,this.vlist,this.nlist,21,f,a,b,A,v,u));z&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,p,v));z&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,f,F,b,e,m,y));z&1024&&(this.compNorm(q),this.compNorm(s),this.VIntZ(q*
-3,this.vlist,this.nlist,30,f,F,w,e,t,x));z&2048&&(this.compNorm(k),this.compNorm(l),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,w,e,r,u));n<<=4;for(f=g=0;THREE.triTable[n+f]!=-1;)a=n+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
+this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,k,j,p){f=(f-j)/(p-j);j=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=k;e[g]=this.lerp(j[a],j[a+3],f);e[g+1]=this.lerp(j[a+1],j[a+4],f);e[g+2]=this.lerp(j[a+2],j[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,k,j,p){f=(f-j)/(p-j);j=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=k;b=a+this.yd*
+3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,k,j,p){f=(f-j)/(p-j);j=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=k+f*this.delta;b=a+this.zd*3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,k=g+this.yd,j=g+this.zd,p=i+this.yd,o=i+this.zd,l=g+this.yd+this.zd,s=i+this.yd+this.zd,m=0,q=this.field[g],n=this.field[i],r=this.field[k],t=this.field[p],v=this.field[j],y=this.field[o],u=this.field[l],x=this.field[s];q<f&&(m|=1);n<f&&(m|=2);r<f&&(m|=8);t<f&&(m|=4);v<f&&(m|=16);y<f&&(m|=32);u<f&&(m|=128);x<f&&(m|=64);var z=THREE.edgeTable[m];if(z===0)return 0;var A=this.delta,F=a+
+A,w=b+A,A=e+A;z&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,q,n));z&2&&(this.compNorm(i),this.compNorm(p),this.VIntY(i*3,this.vlist,this.nlist,3,f,F,b,e,n,t));z&4&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,w,e,r,t));z&8&&(this.compNorm(g),this.compNorm(k),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,q,r));z&16&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,12,f,a,b,A,v,y));z&32&&(this.compNorm(o),
+this.compNorm(s),this.VIntY(o*3,this.vlist,this.nlist,15,f,F,b,A,y,x));z&64&&(this.compNorm(l),this.compNorm(s),this.VIntX(l*3,this.vlist,this.nlist,18,f,a,w,A,u,x));z&128&&(this.compNorm(j),this.compNorm(l),this.VIntY(j*3,this.vlist,this.nlist,21,f,a,b,A,v,u));z&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,q,v));z&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,f,F,b,e,n,y));z&1024&&(this.compNorm(p),this.compNorm(s),this.VIntZ(p*
+3,this.vlist,this.nlist,30,f,F,w,e,t,x));z&2048&&(this.compNorm(k),this.compNorm(l),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,w,e,r,u));m<<=4;for(f=g=0;THREE.triTable[m+f]!=-1;)a=m+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
 4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=b[e];this.normalArray[i+1]=b[e+1];this.normalArray[i+2]=b[e+2];this.normalArray[i+3]=b[g];this.normalArray[i+4]=b[g+1];this.normalArray[i+5]=b[g+2];this.normalArray[i+6]=b[f];this.normalArray[i+7]=b[f+1];this.normalArray[i+8]=b[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,k=b*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 l=Math.floor(j-h);l<1&&(l=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
-1);for(var s,n,p,m,r,t;q<i;q++){j=this.size2*q;n=q/this.size-e;r=n*n;for(n=o;n<k;n++){p=j+this.size*n;s=n/this.size-b;t=s*s;for(s=l;s<h;s++)m=s/this.size-a,m=g/(1.0E-6+m*m+t+r)-f,m>0&&(this.field[p+s]+=m)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,k=this.size,j=this.yd,q=this.zd,o=this.field,l=k*Math.sqrt(a/b);l>k&&(l=k);for(e=0;e<l;e++)if(g=e/k,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<k;g++){i=e+g*j;for(f=0;f<k;f++)o[q*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,k,j=this.size,q=this.yd,o=
-this.zd,l=this.field,s=j*Math.sqrt(a/b);s>j&&(s=j);for(g=0;g<s;g++)if(e=g/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=g*q;for(e=0;e<j;e++){k=i+e;for(f=0;f<j;f++)l[o*f+k]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,k,j=this.size,q=this.yd,o=this.zd,l=this.field,s=j*Math.sqrt(a/b);s>j&&(s=j);for(f=0;f<s;f++)if(e=f/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=o*f;for(g=0;g<j;g++){k=i+g*q;for(e=0;e<j;e++)l[k+e]+=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 b,e,g,f,h,i,k,j,q,o=this.size-2;for(f=1;f<o;f++){q=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(g=1;g<o;g++){j=q+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<o;e++)h=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(h,i,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,k,j,q,o,l;for(f=0;f<g.count;f++)o=f*3,j=o+1,l=o+2,h=g.positionArray[o],i=g.positionArray[j],k=
-g.positionArray[l],q=new THREE.Vector3(h,i,k),h=g.normalArray[o],i=g.normalArray[j],k=g.normalArray[l],o=new THREE.Vector3(h,i,k),o.normalize(),j=new THREE.Vertex(q),b.vertices.push(j),e.push(o);q=g.count/3;for(f=0;f<q;f++)o=(a+f)*3,j=o+1,l=o+2,h=e[o],i=e[j],k=e[l],o=new THREE.Face3(o,j,l,[h,i,k]),b.faces.push(o);a+=q;g.count=0});return b};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 b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,k=b*this.size,j=a*this.size,p=Math.floor(i-h);p<1&&(p=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 l=Math.floor(j-h);l<1&&(l=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
+1);for(var s,m,q,n,r,t;p<i;p++){j=this.size2*p;m=p/this.size-e;r=m*m;for(m=o;m<k;m++){q=j+this.size*m;s=m/this.size-b;t=s*s;for(s=l;s<h;s++)n=s/this.size-a,n=g/(1.0E-6+n*n+t+r)-f,n>0&&(this.field[q+s]+=n)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,k=this.size,j=this.yd,p=this.zd,o=this.field,l=k*Math.sqrt(a/b);l>k&&(l=k);for(e=0;e<l;e++)if(g=e/k,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<k;g++){i=e+g*j;for(f=0;f<k;f++)o[p*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,k,j=this.size,p=this.yd,o=
+this.zd,l=this.field,s=j*Math.sqrt(a/b);s>j&&(s=j);for(g=0;g<s;g++)if(e=g/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=g*p;for(e=0;e<j;e++){k=i+e;for(f=0;f<j;f++)l[o*f+k]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,k,j=this.size,p=this.yd,o=this.zd,l=this.field,s=j*Math.sqrt(a/b);s>j&&(s=j);for(f=0;f<s;f++)if(e=f/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=o*f;for(g=0;g<j;g++){k=i+g*p;for(e=0;e<j;e++)l[k+e]+=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 b,e,g,f,h,i,k,j,p,o=this.size-2;for(f=1;f<o;f++){p=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(g=1;g<o;g++){j=p+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<o;e++)h=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(h,i,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,k,j,p,o,l;for(f=0;f<g.count;f++)o=f*3,j=o+1,l=o+2,h=g.positionArray[o],i=g.positionArray[j],k=
+g.positionArray[l],p=new THREE.Vector3(h,i,k),h=g.normalArray[o],i=g.normalArray[j],k=g.normalArray[l],o=new THREE.Vector3(h,i,k),o.normalize(),j=new THREE.Vertex(p),b.vertices.push(j),e.push(o);p=g.count/3;for(f=0;f<p;f++)o=(a+f)*3,j=o+1,l=o+2,h=e[o],i=e[j],k=e[l],o=new THREE.Face3(o,j,l,[h,i,k]),b.faces.push(o);a+=p;g.count=0});return b};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]);
@@ -355,16 +355,27 @@ d.vertices[e++]=1;d.vertices[e++]=-1;d.vertices[e++]=1;d.vertices[e++]=0;d.verti
 d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);d.tempTexture=b.createTexture();d.occlusionTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);
 b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(d.hasVertexTexture=!1,d.program=a(THREE.ShaderFlares.lensFlare)):(d.hasVertexTexture=
 !0,d.program=a(THREE.ShaderFlares.lensFlareVertexTexture));d.attributes={};d.uniforms={};d.attributes.vertex=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.renderType=b.getUniformLocation(d.program,"renderType");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.occlusionMap=b.getUniformLocation(d.program,"occlusionMap");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.color=b.getUniformLocation(d.program,
-"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i,k,j=a.length,q,o,l,s=new THREE.Vector3,n=h/f,p=f*0.5,m=h*0.5,r=16/h,t=new THREE.Vector2(r*n,r),v=new THREE.Vector3(1,1,0),y=new THREE.Vector2(1,1),u=d.uniforms;i=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
-b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(u.occlusionMap,0);b.uniform1i(u.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(i.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(i.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);for(k=0;k<j;k++)if(r=16/h,t.set(r*n,r),i=a[k],s.set(i.matrixWorld.n14,i.matrixWorld.n24,i.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(s),g.projectionMatrix.multiplyVector3(s),
-v.copy(s),y.x=v.x*p+p,y.y=v.y*m+m,d.hasVertexTexture||y.x>0&&y.x<f&&y.y>0&&y.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,y.x-8,y.y-8,16,16,0);b.uniform1i(u.renderType,0);b.uniform2f(u.scale,t.x,t.y);b.uniform3f(u.screenPosition,v.x,v.y,v.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.copyTexImage2D(b.TEXTURE_2D,
-0,b.RGBA,y.x-8,y.y-8,16,16,0);b.uniform1i(u.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);i.positionScreen.copy(v);i.customUpdateCallback?i.customUpdateCallback(i):i.updateLensFlares();b.uniform1i(u.renderType,2);b.enable(b.BLEND);q=0;for(o=i.lensFlares.length;q<o;q++)if(l=i.lensFlares[q],l.opacity>0.0010&&l.scale>0.0010)v.x=l.x,v.y=l.y,v.z=l.z,r=l.size*l.scale/h,t.x=r*n,t.y=r,b.uniform3f(u.screenPosition,
+"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i,k,j=a.length,p,o,l,s=new THREE.Vector3,m=h/f,q=f*0.5,n=h*0.5,r=16/h,t=new THREE.Vector2(r*m,r),v=new THREE.Vector3(1,1,0),y=new THREE.Vector2(1,1),u=d.uniforms;i=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
+b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(u.occlusionMap,0);b.uniform1i(u.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(i.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(i.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);for(k=0;k<j;k++)if(r=16/h,t.set(r*m,r),i=a[k],s.set(i.matrixWorld.n14,i.matrixWorld.n24,i.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(s),g.projectionMatrix.multiplyVector3(s),
+v.copy(s),y.x=v.x*q+q,y.y=v.y*n+n,d.hasVertexTexture||y.x>0&&y.x<f&&y.y>0&&y.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,y.x-8,y.y-8,16,16,0);b.uniform1i(u.renderType,0);b.uniform2f(u.scale,t.x,t.y);b.uniform3f(u.screenPosition,v.x,v.y,v.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.copyTexImage2D(b.TEXTURE_2D,
+0,b.RGBA,y.x-8,y.y-8,16,16,0);b.uniform1i(u.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);i.positionScreen.copy(v);i.customUpdateCallback?i.customUpdateCallback(i):i.updateLensFlares();b.uniform1i(u.renderType,2);b.enable(b.BLEND);p=0;for(o=i.lensFlares.length;p<o;p++)if(l=i.lensFlares[p],l.opacity>0.0010&&l.scale>0.0010)v.x=l.x,v.y=l.y,v.z=l.z,r=l.size*l.scale/h,t.x=r*m,t.y=r,b.uniform3f(u.screenPosition,
 v.x,v.y,v.z),b.uniform2f(u.scale,t.x,t.y),b.uniform1f(u.rotation,l.rotation),b.uniform1f(u.opacity,l.opacity),b.uniform3f(u.color,l.color.r,l.color.g,l.color.b),c.setBlending(l.blending),c.setTexture(l.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,q;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),l=new THREE.WebGLRenderTarget(512,512,a),s=new THREE.PerspectiveCamera(53,
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d={};this.init=function(a){b=a.context;c=a;d.vertices=new Float32Array(16);d.faces=new Uint16Array(6);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=b.createBuffer();d.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,d.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,g=b.createProgram(),f=b.createShader(b.FRAGMENT_SHADER),h=b.createShader(b.VERTEX_SHADER);b.shaderSource(f,a.fragmentShader);b.shaderSource(h,a.vertexShader);
+b.compileShader(f);b.compileShader(h);b.attachShader(g,f);b.attachShader(g,h);b.linkProgram(g);d.program=g;d.attributes={};d.uniforms={};d.attributes.position=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.uvOffset=b.getUniformLocation(d.program,"uvOffset");d.uniforms.uvScale=b.getUniformLocation(d.program,"uvScale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.alignment=
+b.getUniformLocation(d.program,"alignment");d.uniforms.color=b.getUniformLocation(d.program,"color");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.useScreenCoordinates=b.getUniformLocation(d.program,"useScreenCoordinates");d.uniforms.affectedByDistance=b.getUniformLocation(d.program,"affectedByDistance");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.uniforms.modelViewMatrix=b.getUniformLocation(d.program,
+"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h,i){var k,j;k=d.attributes;var p=d.uniforms,o=h/f,l=[];f*=0.5;var s=h*0.5,m=!0;b.useProgram(d.program);_currentProgram=d.program;if(!d.attributesEnabled)b.enableVertexAttribArray(k.position),b.enableVertexAttribArray(k.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(k.position,
+2,b.FLOAT,!1,16,0);b.vertexAttribPointer(k.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(p.projectionMatrix,!1,i);b.activeTexture(b.TEXTURE0);b.uniform1i(p.map,0);i=0;for(k=e.__webglSprites.length;i<k;i++)if(j=e.__webglSprites[i],j.visible&&j.opacity!==0)j.useScreenCoordinates?j.z=-j.position.z:(j._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,j.matrixWorld,j._modelViewMatrixArray),j.z=-j._modelViewMatrix.n34);e.__webglSprites.sort(a);i=0;for(k=
+e.__webglSprites.length;i<k;i++)j=e.__webglSprites[i],j.visible&&j.opacity!==0&&j.map&&j.map.image&&j.map.image.width&&(j.useScreenCoordinates?(b.uniform1i(p.useScreenCoordinates,1),b.uniform3f(p.screenPosition,(j.position.x-f)/f,(s-j.position.y)/s,Math.max(0,Math.min(1,j.position.z)))):(b.uniform1i(p.useScreenCoordinates,0),b.uniform1i(p.affectedByDistance,j.affectedByDistance?1:0),b.uniformMatrix4fv(p.modelViewMatrix,!1,j._modelViewMatrixArray)),g=j.map.image.width/(j.scaleByViewport?h:1),l[0]=
+g*o*j.scale.x,l[1]=g*j.scale.y,b.uniform2f(p.uvScale,j.uvScale.x,j.uvScale.y),b.uniform2f(p.uvOffset,j.uvOffset.x,j.uvOffset.y),b.uniform2f(p.alignment,j.alignment.x,j.alignment.y),b.uniform1f(p.opacity,j.opacity),b.uniform3f(p.color,j.color.r,j.color.g,j.color.b),b.uniform1f(p.rotation,j.rotation),b.uniform2fv(p.scale,l),j.mergeWith3D&&!m?(b.enable(b.DEPTH_TEST),m=!0):!j.mergeWith3D&&m&&(b.disable(b.DEPTH_TEST),m=!1),c.setBlending(j.blending),c.setTexture(j.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,
+0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,p;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),l=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:l}},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){c.call(b,a,d);o.width=a;o.height=d;l.width=a;l.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||k!==c.near||j!==c.far||q!==c.fov){i=c.aspect;k=c.near;j=c.far;q=c.fov;var r=c.projectionMatrix.clone(),t=125/30*0.5,v=t*k/125,y=k*Math.tan(q*Math.PI/360),u;f.n14=t;h.n14=-t;t=-y*i+v;u=y*i+v;r.n11=2*k/(u-t);r.n13=(u+t)/(u-t);e.projectionMatrix.copy(r);t=-y*i-v;u=y*i-v;r.n11=
-2*k/(u-t);r.n13=(u+t)/(u-t);g.projectionMatrix.copy(r)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,o,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,l,!0);n.updateMatrixWorld();d.call(b,n,s)}};
+m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(s);this.setSize=function(a,d){c.call(b,a,d);o.width=a;o.height=d;l.width=a;l.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||k!==c.near||j!==c.far||p!==c.fov){i=c.aspect;k=c.near;j=c.far;p=c.fov;var r=c.projectionMatrix.clone(),t=125/30*0.5,v=t*k/125,y=k*Math.tan(p*Math.PI/360),u;f.n14=t;h.n14=-t;t=-y*i+v;u=y*i+v;r.n11=2*k/(u-t);r.n13=(u+t)/(u-t);e.projectionMatrix.copy(r);t=-y*i-v;u=y*i-v;r.n11=
+2*k/(u-t);r.n13=(u+t)/(u-t);g.projectionMatrix.copy(r)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,o,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,l,!0);m.updateMatrixWorld();d.call(b,m,s)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,g,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;g=d};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=
 c.far;f.updateProjectionMatrix();f.position.copy(c.position);f.target.copy(c.target);f.translateX(b.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,g);d.call(b,a,f);this.setViewport(e,0,e,g);d.call(b,a,h,!1)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
 lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
+THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
+fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\n}"}};

+ 199 - 208
build/custom/ThreeWebGL.js

@@ -1,7 +1,7 @@
 // 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,f,g;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),g=c*(1-
+b*f),b=c*(1-b*(1-f)),d){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("+
 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,96 @@ 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 T=c.distanceTo(I)}function e(a,b,c,e){p.sub(e,b);A.sub(c,b);r.sub(a,b);sa=p.dot(p);ha=p.dot(A);la=p.dot(r);ka=A.dot(A);J=A.dot(r);P=1/(sa*ka-ha*ha);G=(ka*la-ha*J)*P;N=(sa*J-ha*la)*P;return G>=0&&N>=0&&G+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,o=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.intersectObject=function(r){for(var p,y=[],A=0,qa=r.children.length;A<qa;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,T=r.geometry,oa=T.vertices,J;r.matrixRotationWorld.extractRotation(r.matrixWorld);A=0;for(qa=T.faces.length;A<
-qa;A++)if(p=T.faces[A],a.copy(this.origin),b.copy(this.direction),J=r.matrixWorld,o=J.multiplyVector3(o.copy(p.centroid)).subSelf(a),I=o.dot(b),!(I<=0)&&(f=J.multiplyVector3(f.copy(oa[p.a].position)),g=J.multiplyVector3(g.copy(oa[p.b].position)),h=J.multiplyVector3(h.copy(oa[p.c].position)),p instanceof THREE.Face4&&(i=J.multiplyVector3(i.copy(oa[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(o.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,T,sa,ha,la,ka,J,P,G,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){q.sub(c,a);y=q.dot(b);if(y<=0)return null;D=s.add(a,m.copy(b).multiplyScalar(y));return L=c.distanceTo(D)}function d(a,b,c,d){q.sub(d,b);s.sub(c,b);m.sub(a,b);sa=q.dot(q);fa=q.dot(s);la=q.dot(m);ka=s.dot(s);G=s.dot(m);N=1/(sa*ka-fa*fa);M=(ka*la-fa*G)*N;E=(sa*G-fa*la)*N;return M>=0&&E>=0&&M+E<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=
+function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,n=new THREE.Vector3,l=new THREE.Vector3,j=new THREE.Vector3;this.intersectObject=function(m){for(var q,y=[],s=0,qa=m.children.length;s<qa;s++)Array.prototype.push.apply(y,this.intersectObject(m.children[s]));
+if(m instanceof THREE.Particle){s=c(this.origin,this.direction,m.matrixWorld.getPosition());if(s===null||s>m.scale.x)return[];q={distance:s,point:m.position,face:null,object:m};y.push(q)}else if(m instanceof THREE.Mesh){s=c(this.origin,this.direction,m.matrixWorld.getPosition());if(s===null||s>m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)))return y;var D,L=m.geometry,oa=L.vertices,G;m.matrixRotationWorld.extractRotation(m.matrixWorld);s=0;for(qa=L.faces.length;s<
+qa;s++)if(q=L.faces[s],a.copy(this.origin),b.copy(this.direction),G=m.matrixWorld,n=G.multiplyVector3(n.copy(q.centroid)).subSelf(a),D=n.dot(b),!(D<=0)&&(f=G.multiplyVector3(f.copy(oa[q.a].position)),g=G.multiplyVector3(g.copy(oa[q.b].position)),h=G.multiplyVector3(h.copy(oa[q.c].position)),q instanceof THREE.Face4&&(i=G.multiplyVector3(i.copy(oa[q.d].position))),l=m.matrixRotationWorld.multiplyVector3(l.copy(q.normal)),D=b.dot(l),m.doubleSided||(m.flipSided?D>0:D<0)))if(D=l.dot(n.sub(f,a))/D,j.add(a,
+b.multiplyScalar(D)),q instanceof THREE.Face3)d(j,f,g,h)&&(q={distance:a.distanceTo(j),point:j.clone(),face:q,object:m},y.push(q));else if(q instanceof THREE.Face4&&(d(j,f,g,i)||d(j,g,h,i)))q={distance:a.distanceTo(j),point:j.clone(),face:q,object:m},y.push(q)}return y};var q=new THREE.Vector3,s=new THREE.Vector3,m=new THREE.Vector3,y,D,L,sa,fa,la,ka,G,N,M,E};
+THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,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 d};this.getBottom=function(){return f};this.set=function(g,h,j,q){i=!1;b=g;c=h;d=j;f=q;a()};this.addPoint=function(g,h){i?(i=!1,b=g,c=h,d=g,f=h):(b=b<g?b:g,c=c<h?c:h,d=d>g?d:g,f=f>h?f:h);a()};this.add3Points=
+function(g,h,j,q,s,m){i?(i=!1,b=g<j?g<s?g:s:j<s?j:s,c=h<q?h<m?h:m:q<m?q:m,d=g>j?g>s?g:s:j>s?j:s,f=h>q?h>m?h:m:q>m?q:m):(b=g<j?g<s?g<b?g:b:s<b?s:b:j<s?j<b?j:b:s<b?s:b,c=h<q?h<m?h<c?h:c:m<c?m:c:q<m?q<c?q:c:m<c?m:c,d=g>j?g>s?g>d?g:d:s>d?s:d:j>s?j>d?j:d:s>d?s:d,f=h>q?h>m?h>f?h:f:m>f?m:f:q>m?q>f?q:f:m>f?m:f);a()};this.addRectangle=function(g){i?(i=!1,b=g.getLeft(),c=g.getTop(),d=g.getRight(),f=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),d=d>g.getRight()?d:g.getRight(),f=f>
+g.getBottom()?f:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;d+=g;f+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();f=f<g.getBottom()?f:g.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(){i=!0;f=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,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,e,f,g,h,i,o,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,o||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,o,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=o;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,o=a.n23,k=a.n24,l=a.n31,p=a.n32,A=a.n33,r=a.n34,y=a.n41,I=a.n42,T=a.n43,
-sa=a.n44,ha=b.n11,la=b.n12,ka=b.n13,J=b.n14,P=b.n21,G=b.n22,N=b.n23,na=b.n24,M=b.n31,ba=b.n32,Z=b.n33,qa=b.n34,ua=b.n41,ia=b.n42,oa=b.n43,Ba=b.n44;this.n11=c*ha+e*P+f*M+g*ua;this.n12=c*la+e*G+f*ba+g*ia;this.n13=c*ka+e*N+f*Z+g*oa;this.n14=c*J+e*na+f*qa+g*Ba;this.n21=h*ha+i*P+o*M+k*ua;this.n22=h*la+i*G+o*ba+k*ia;this.n23=h*ka+i*N+o*Z+k*oa;this.n24=h*J+i*na+o*qa+k*Ba;this.n31=l*ha+p*P+A*M+r*ua;this.n32=l*la+p*G+A*ba+r*ia;this.n33=l*ka+p*N+A*Z+r*oa;this.n34=l*J+p*na+A*qa+r*Ba;this.n41=y*ha+I*P+T*M+sa*
-ua;this.n42=y*la+I*G+T*ba+sa*ia;this.n43=y*ka+I*N+T*Z+sa*oa;this.n44=y*J+I*na+T*qa+sa*Ba;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,o=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*o*r+c*i*o*r+e*f*l*r-a*i*l*r-c*f*p*r+a*h*p*r+e*g*o*y-b*i*o*y-e*f*k*y+a*i*k*y+b*f*p*y-a*
-g*p*y-c*g*o*I+b*h*o*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,o=f*g,k=f*h;this.set(o*g+c,o*h-e*i,o*i+e*h,0,o*h+e*i,k*h+c,k*i-e*g,0,o*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,o=a.n24,k=a.n31,l=a.n32,p=a.n33,A=a.n34,r=a.n41,y=a.n42,I=a.n43,T=a.n44;this.n11=i*A*y-o*p*y+o*l*I-h*A*I-i*l*T+h*p*T;this.n12=f*p*y-e*A*y-f*l*I+c*A*I+e*l*T-c*p*T;this.n13=e*o*y-f*i*y+f*h*I-c*o*I-e*h*T+c*i*T;this.n14=f*i*l-e*o*l-f*h*p+c*
-o*p+e*h*A-c*i*A;this.n21=o*p*r-i*A*r-o*k*I+g*A*I+i*k*T-g*p*T;this.n22=e*A*r-f*p*r+f*k*I-b*A*I-e*k*T+b*p*T;this.n23=f*i*r-e*o*r-f*g*I+b*o*I+e*g*T-b*i*T;this.n24=e*o*k-f*i*k+f*g*p-b*o*p-e*g*A+b*i*A;this.n31=h*A*r-o*l*r+o*k*y-g*A*y-h*k*T+g*l*T;this.n32=f*l*r-c*A*r-f*k*y+b*A*y+c*k*T-b*l*T;this.n33=e*o*r-f*h*r+f*g*y-b*o*y-c*g*T+b*h*T;this.n34=f*h*k-c*o*k-f*g*l+b*o*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 o=h*i,k=h*f,l=e*i,p=e*f;this.n11=o+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+o*c;this.n33=g*h;break;case "ZXY":o=h*i;k=h*f;l=e*i;p=e*f;this.n11=o-p*c;this.n12=-g*f;this.n13=l+
-k*c;this.n21=k+l*c;this.n22=g*i;this.n23=p-o*c;this.n31=-g*e;this.n32=c;this.n33=g*h;break;case "ZYX":o=g*i;k=g*f;l=c*i;p=c*f;this.n11=h*i;this.n12=l*e-k;this.n13=o*e+p;this.n21=h*f;this.n22=p*e+o;this.n23=k*e-l;this.n31=-e;this.n32=c*h;this.n33=g*h;break;case "YZX":o=g*h;k=g*e;l=c*h;p=c*e;this.n11=h*i;this.n12=p-o*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=o-p*f;break;case "XZY":o=g*h;k=g*e;l=c*h;p=c*e;this.n11=h*i;this.n12=-f;this.n13=e*i;this.n21=
-o*f+p;this.n22=g*i;this.n23=k*f-l;this.n31=l*f-k;this.n32=c*i;this.n33=p*f+o;break;default:o=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=o-p*e,this.n23=-c*h,this.n31=p-o*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,o=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=o-f;this.n13=b+h;this.n21=o+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,o=-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*o;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,o,k;h=new THREE.Matrix4;i=b-a;o=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/o;h.n23=0;h.n24=-((c+e)/o);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,f,g,h,i,n,l,j,q,s,m,y,D){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,g!==void 0?g:1,h||0,i||0,n||0,l||0,j!==void 0?j:1,q||0,s||0,m||0,y||0,D!==void 0?D:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,g,h,i,n,l,j,q,s,m,y,D){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=i;this.n31=n;this.n32=l;this.n33=j;this.n34=q;this.n41=s;this.n42=m;this.n43=y;this.n44=D;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,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());f.cross(g,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,i=a.n22,n=a.n23,l=a.n24,j=a.n31,q=a.n32,s=a.n33,m=a.n34,y=a.n41,D=a.n42,L=a.n43,
+sa=a.n44,fa=b.n11,la=b.n12,ka=b.n13,G=b.n14,N=b.n21,M=b.n22,E=b.n23,na=b.n24,K=b.n31,$=b.n32,X=b.n33,qa=b.n34,ua=b.n41,ga=b.n42,oa=b.n43,Aa=b.n44;this.n11=c*fa+d*N+f*K+g*ua;this.n12=c*la+d*M+f*$+g*ga;this.n13=c*ka+d*E+f*X+g*oa;this.n14=c*G+d*na+f*qa+g*Aa;this.n21=h*fa+i*N+n*K+l*ua;this.n22=h*la+i*M+n*$+l*ga;this.n23=h*ka+i*E+n*X+l*oa;this.n24=h*G+i*na+n*qa+l*Aa;this.n31=j*fa+q*N+s*K+m*ua;this.n32=j*la+q*M+s*$+m*ga;this.n33=j*ka+q*E+s*X+m*oa;this.n34=j*G+q*na+s*qa+m*Aa;this.n41=y*fa+D*N+L*K+sa*ua;
+this.n42=y*la+D*M+L*$+sa*ga;this.n43=y*ka+D*E+L*X+sa*oa;this.n44=y*G+D*na+L*qa+sa*Aa;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=
+a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,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,g=this.n22,h=this.n23,i=this.n24,n=this.n31,l=this.n32,j=this.n33,q=this.n34,s=this.n41,m=this.n42,y=this.n43,D=this.n44;return d*h*l*s-c*i*l*s-d*g*j*s+b*i*j*s+c*g*q*s-b*h*q*s-d*h*n*m+c*i*n*m+d*f*j*m-a*i*j*m-c*f*q*m+a*h*q*m+d*g*n*y-b*i*n*y-d*f*l*y+a*i*l*y+b*f*q*y-a*g*q*y-c*
+g*n*D+b*h*n*D+c*f*l*D-a*h*l*D-b*f*j*D+a*g*j*D},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;
+a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},
+flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=
+this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),
+a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,h=a.y,i=a.z,n=f*g,l=f*h;this.set(n*g+c,n*h-d*i,n*i+d*h,0,n*h+d*i,l*h+c,l*i-d*g,0,n*i-d*h,l*i+d*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,d=a.n13,f=a.n14,g=a.n21,h=a.n22,i=a.n23,n=a.n24,l=a.n31,j=a.n32,q=a.n33,s=a.n34,m=a.n41,y=a.n42,D=a.n43,L=a.n44;this.n11=i*s*y-n*q*y+n*j*D-h*s*D-i*j*L+h*q*L;this.n12=f*q*y-d*s*y-f*j*D+c*s*D+d*j*L-c*q*L;this.n13=d*n*y-f*i*y+f*h*D-c*n*D-d*h*L+c*i*L;this.n14=f*i*j-d*n*j-f*h*q+c*n*q+d*h*s-
+c*i*s;this.n21=n*q*m-i*s*m-n*l*D+g*s*D+i*l*L-g*q*L;this.n22=d*s*m-f*q*m+f*l*D-b*s*D-d*l*L+b*q*L;this.n23=f*i*m-d*n*m-f*g*D+b*n*D+d*g*L-b*i*L;this.n24=d*n*l-f*i*l+f*g*q-b*n*q-d*g*s+b*i*s;this.n31=h*s*m-n*j*m+n*l*y-g*s*y-h*l*L+g*j*L;this.n32=f*j*m-c*s*m-f*l*y+b*s*y+c*l*L-b*j*L;this.n33=d*n*m-f*h*m+f*g*y-b*n*y-c*g*L+b*h*L;this.n34=f*h*l-c*n*l-f*g*j+b*n*j+c*g*s-b*h*s;this.n41=i*j*m-h*q*m-i*l*y+g*q*y+h*l*D-g*j*D;this.n42=c*q*m-d*j*m+d*l*y-b*q*y-c*l*D+b*j*D;this.n43=d*h*m-c*i*m-d*g*y+b*i*y+c*g*D-b*h*D;
+this.n44=c*i*l-d*h*l+d*g*j-b*i*j-c*g*q+b*h*q;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,g=Math.cos(c),c=Math.sin(c),h=Math.cos(d),d=Math.sin(d),i=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var n=h*i,l=h*f,j=d*i,q=d*f;this.n11=n+q*c;this.n12=j*c-l;this.n13=g*d;this.n21=g*f;this.n22=g*i;this.n23=-c;this.n31=l*c-j;this.n32=q+n*c;this.n33=g*h;break;case "ZXY":n=h*i;l=h*f;j=d*i;q=d*f;this.n11=n-q*c;this.n12=-g*f;this.n13=j+l*c;this.n21=
+l+j*c;this.n22=g*i;this.n23=q-n*c;this.n31=-g*d;this.n32=c;this.n33=g*h;break;case "ZYX":n=g*i;l=g*f;j=c*i;q=c*f;this.n11=h*i;this.n12=j*d-l;this.n13=n*d+q;this.n21=h*f;this.n22=q*d+n;this.n23=l*d-j;this.n31=-d;this.n32=c*h;this.n33=g*h;break;case "YZX":n=g*h;l=g*d;j=c*h;q=c*d;this.n11=h*i;this.n12=q-n*f;this.n13=j*f+l;this.n21=f;this.n22=g*i;this.n23=-c*i;this.n31=-d*i;this.n32=l*f+j;this.n33=n-q*f;break;case "XZY":n=g*h;l=g*d;j=c*h;q=c*d;this.n11=h*i;this.n12=-f;this.n13=d*i;this.n21=n*f+q;this.n22=
+g*i;this.n23=l*f-j;this.n31=j*f-l;this.n32=c*i;this.n33=q*f+n;break;default:n=g*i,l=g*f,j=c*i,q=c*f,this.n11=h*i,this.n12=-h*f,this.n13=d,this.n21=l+j*d,this.n22=n-q*d,this.n23=-c*h,this.n31=q-n*d,this.n32=j+l*d,this.n33=g*h}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,i=d+d,a=b*g,n=b*h;b*=i;var l=c*h;c*=i;d*=i;g*=f;h*=f;f*=i;this.n11=1-(l+d);this.n12=n-f;this.n13=b+h;this.n21=n+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;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*=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,g=THREE.Matrix4.__v3;
+d.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=d.length();c.y=f.length();c.z=g.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,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,l=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,q=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*h+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*g;c[3]=a*h;c[4]=a*i;c[5]=a*n;c[6]=a*l;c[7]=a*j;c[8]=a*q;return b};
+THREE.Matrix4.makeFrustum=function(a,b,c,d,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/(d-c);h.n23=(d+c)/(d-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,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,g){var h,i,n,l;h=new THREE.Matrix4;i=b-a;n=c-d;l=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+d)/n);h.n31=0;h.n32=0;h.n33=-2/l;h.n34=-((g+f)/l);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__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;
+-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=h[g]=h[g]||new THREE.RenderableObject;g++;return a}function b(){var a=k[o]=k[o]||new THREE.RenderableVertex;o++;return a}function c(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,g=a.z+a.w,f=b.z+b.w,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,o,k=[],
-l,p,A=[],r,y=[],I,T,sa=[],ha,la,ka=[],J={objects:[],sprites:[],lights:[],elements:[]},P=new THREE.Vector3,G=new THREE.Vector4,N=new THREE.Matrix4,na=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ba=new THREE.Vector4,Z=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;J.objects.length=0;J.sprites.length=0;J.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(P.copy(b.position)),f=a(),f.object=b,f.z=P.z,J.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(N.multiplyVector3(P.copy(b.position)),f=a(),f.object=b,f.z=P.z,J.sprites.push(f)):b instanceof THREE.Light&&J.lights.push(b);c=0;for(e=b.children.length;c<e;c++)h(b.children[c])}};h(b);e&&
-J.objects.sort(c);return J};this.projectScene=function(a,g,f){var h=g.near,P=g.far,M,ra,da,L,O,S,F,d,R,va,ta,xa,wa,Fa,Ca,ya;la=T=r=p=0;J.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);J=this.projectGraph(a,!1);a=0;for(M=J.objects.length;a<M;a++)if(R=J.objects[a].object,va=R.matrixWorld,
-xa=R.material,o=0,R instanceof THREE.Mesh){ta=R.geometry;wa=R.geometry.materials;L=ta.vertices;Fa=ta.faces;Ca=ta.faceVertexUvs;ta=R.matrixRotationWorld.extractRotation(va);ra=0;for(da=L.length;ra<da;ra++)i=b(),i.positionWorld.copy(L[ra].position),va.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<P;L=0;for(ra=Fa.length;L<
-ra;L++){da=Fa[L];if(da instanceof THREE.Face3)if(O=k[da.a],S=k[da.b],F=k[da.c],O.visible&&S.visible&&F.visible&&(R.doubleSided||R.flipSided!=(F.positionScreen.x-O.positionScreen.x)*(S.positionScreen.y-O.positionScreen.y)-(F.positionScreen.y-O.positionScreen.y)*(S.positionScreen.x-O.positionScreen.x)<0))d=A[p]=A[p]||new THREE.RenderableFace3,p++,l=d,l.v1.copy(O),l.v2.copy(S),l.v3.copy(F);else continue;else if(da instanceof THREE.Face4)if(O=k[da.a],S=k[da.b],F=k[da.c],d=k[da.d],O.visible&&S.visible&&
-F.visible&&d.visible&&(R.doubleSided||R.flipSided!=((d.positionScreen.x-O.positionScreen.x)*(S.positionScreen.y-O.positionScreen.y)-(d.positionScreen.y-O.positionScreen.y)*(S.positionScreen.x-O.positionScreen.x)<0||(S.positionScreen.x-F.positionScreen.x)*(d.positionScreen.y-F.positionScreen.y)-(S.positionScreen.y-F.positionScreen.y)*(d.positionScreen.x-F.positionScreen.x)<0)))ya=y[r]=y[r]||new THREE.RenderableFace4,r++,l=ya,l.v1.copy(O),l.v2.copy(S),l.v3.copy(F),l.v4.copy(d);else continue;l.normalWorld.copy(da.normal);
-ta.multiplyVector3(l.normalWorld);l.centroidWorld.copy(da.centroid);va.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);N.multiplyVector3(l.centroidScreen);F=da.vertexNormals;O=0;for(S=F.length;O<S;O++)d=l.vertexNormalsWorld[O],d.copy(F[O]),ta.multiplyVector3(d);O=0;for(S=Ca.length;O<S;O++)if(ya=Ca[O][L]){F=0;for(d=ya.length;F<d;F++)l.uvs[O][F]=ya[F]}l.material=xa;l.faceMaterial=da.materialIndex!==null?wa[da.materialIndex]:null;l.z=l.centroidScreen.z;J.elements.push(l)}}else if(R instanceof
-THREE.Line){na.multiply(N,va);L=R.geometry.vertices;O=b();O.positionScreen.copy(L[0].position);na.multiplyVector4(O.positionScreen);ra=1;for(da=L.length;ra<da;ra++)if(O=b(),O.positionScreen.copy(L[ra].position),na.multiplyVector4(O.positionScreen),S=k[o-2],ba.copy(O.positionScreen),Z.copy(S.positionScreen),e(ba,Z))ba.multiplyScalar(1/ba.w),Z.multiplyScalar(1/Z.w),R=sa[T]=sa[T]||new THREE.RenderableLine,T++,I=R,I.v1.positionScreen.copy(ba),I.v2.positionScreen.copy(Z),I.z=Math.max(ba.z,Z.z),I.material=
-xa,J.elements.push(I)}a=0;for(M=J.sprites.length;a<M;a++)if(R=J.sprites[a].object,va=R.matrixWorld,R instanceof THREE.Particle&&(G.set(va.n14,va.n24,va.n34,1),N.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))h=ka[la]=ka[la]||new THREE.RenderableParticle,la++,ha=h,ha.x=G.x/G.w,ha.y=G.y/G.w,ha.z=G.z,ha.rotation=R.rotation.z,ha.scale.x=R.scale.x*Math.abs(ha.x-(G.x+g.projectionMatrix.n11)/(G.w+g.projectionMatrix.n14)),ha.scale.y=R.scale.y*Math.abs(ha.y-(G.y+g.projectionMatrix.n22)/(G.w+g.projectionMatrix.n24)),
-ha.material=R.material,J.elements.push(ha);f&&J.elements.sort(c);return J}};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[g]=h[g]||new THREE.RenderableObject;g++;return a}function b(){var a=l[n]=l[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,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 f,g,h=[],i,n,l=[],
+j,q,s=[],m,y=[],D,L,sa=[],fa,la,ka=[],G={objects:[],sprites:[],lights:[],elements:[]},N=new THREE.Vector3,M=new THREE.Vector4,E=new THREE.Matrix4,na=new THREE.Matrix4,K=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],$=new THREE.Vector4,X=new THREE.Vector4;this.computeFrustum=function(a){K[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);K[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);K[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+a.n23,a.n44+a.n24);K[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);K[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);K[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=K[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);E.multiply(b.projectionMatrix,b.matrixWorldInverse);E.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+E.multiply(b.matrixWorld,b.projectionMatrixInverse);E.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){g=0;G.objects.length=0;G.sprites.length=0;G.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,
+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=K[i].x*d.n14+K[i].y*d.n24+K[i].z*d.n34+K[i].w,c<=g){c=!1;break a}c=!0}c?(E.multiplyVector3(N.copy(b.position)),f=a(),f.object=b,f.z=N.z,G.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(E.multiplyVector3(N.copy(b.position)),f=a(),f.object=b,f.z=N.z,G.sprites.push(f)):b instanceof THREE.Light&&G.lights.push(b);c=0;for(d=b.children.length;c<d;c++)h(b.children[c])}};h(b);d&&
+G.objects.sort(c);return G};this.projectScene=function(a,g,f){var h=g.near,N=g.far,K,ra,ba,Q,J,R,C,e,O,va,ta,wa,xa,Da,Ba,ya;la=L=m=q=0;G.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);E.multiply(g.projectionMatrix,g.matrixWorldInverse);this.computeFrustum(E);G=this.projectGraph(a,!1);a=0;for(K=G.objects.length;a<K;a++)if(O=G.objects[a].object,va=O.matrixWorld,
+wa=O.material,n=0,O instanceof THREE.Mesh){ta=O.geometry;xa=O.geometry.materials;Q=ta.vertices;Da=ta.faces;Ba=ta.faceVertexUvs;ta=O.matrixRotationWorld.extractRotation(va);ra=0;for(ba=Q.length;ra<ba;ra++)i=b(),i.positionWorld.copy(Q[ra].position),va.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),E.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>h&&i.positionScreen.z<N;Q=0;for(ra=Da.length;Q<
+ra;Q++){ba=Da[Q];if(ba instanceof THREE.Face3)if(J=l[ba.a],R=l[ba.b],C=l[ba.c],J.visible&&R.visible&&C.visible&&(O.doubleSided||O.flipSided!=(C.positionScreen.x-J.positionScreen.x)*(R.positionScreen.y-J.positionScreen.y)-(C.positionScreen.y-J.positionScreen.y)*(R.positionScreen.x-J.positionScreen.x)<0))e=s[q]=s[q]||new THREE.RenderableFace3,q++,j=e,j.v1.copy(J),j.v2.copy(R),j.v3.copy(C);else continue;else if(ba instanceof THREE.Face4)if(J=l[ba.a],R=l[ba.b],C=l[ba.c],e=l[ba.d],J.visible&&R.visible&&
+C.visible&&e.visible&&(O.doubleSided||O.flipSided!=((e.positionScreen.x-J.positionScreen.x)*(R.positionScreen.y-J.positionScreen.y)-(e.positionScreen.y-J.positionScreen.y)*(R.positionScreen.x-J.positionScreen.x)<0||(R.positionScreen.x-C.positionScreen.x)*(e.positionScreen.y-C.positionScreen.y)-(R.positionScreen.y-C.positionScreen.y)*(e.positionScreen.x-C.positionScreen.x)<0)))ya=y[m]=y[m]||new THREE.RenderableFace4,m++,j=ya,j.v1.copy(J),j.v2.copy(R),j.v3.copy(C),j.v4.copy(e);else continue;j.normalWorld.copy(ba.normal);
+ta.multiplyVector3(j.normalWorld);j.centroidWorld.copy(ba.centroid);va.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);E.multiplyVector3(j.centroidScreen);C=ba.vertexNormals;J=0;for(R=C.length;J<R;J++)e=j.vertexNormalsWorld[J],e.copy(C[J]),ta.multiplyVector3(e);J=0;for(R=Ba.length;J<R;J++)if(ya=Ba[J][Q]){C=0;for(e=ya.length;C<e;C++)j.uvs[J][C]=ya[C]}j.material=wa;j.faceMaterial=ba.materialIndex!==null?xa[ba.materialIndex]:null;j.z=j.centroidScreen.z;G.elements.push(j)}}else if(O instanceof
+THREE.Line){na.multiply(E,va);Q=O.geometry.vertices;J=b();J.positionScreen.copy(Q[0].position);na.multiplyVector4(J.positionScreen);ra=1;for(ba=Q.length;ra<ba;ra++)if(J=b(),J.positionScreen.copy(Q[ra].position),na.multiplyVector4(J.positionScreen),R=l[n-2],$.copy(J.positionScreen),X.copy(R.positionScreen),d($,X))$.multiplyScalar(1/$.w),X.multiplyScalar(1/X.w),O=sa[L]=sa[L]||new THREE.RenderableLine,L++,D=O,D.v1.positionScreen.copy($),D.v2.positionScreen.copy(X),D.z=Math.max($.z,X.z),D.material=wa,
+G.elements.push(D)}a=0;for(K=G.sprites.length;a<K;a++)if(O=G.sprites[a].object,va=O.matrixWorld,O instanceof THREE.Particle&&(M.set(va.n14,va.n24,va.n34,1),E.multiplyVector4(M),M.z/=M.w,M.z>0&&M.z<1))h=ka[la]=ka[la]||new THREE.RenderableParticle,la++,fa=h,fa.x=M.x/M.w,fa.y=M.y/M.w,fa.z=M.z,fa.rotation=O.rotation.z,fa.scale.x=O.scale.x*Math.abs(fa.x-(M.x+g.projectionMatrix.n11)/(M.w+g.projectionMatrix.n14)),fa.scale.y=O.scale.y*Math.abs(fa.y-(M.y+g.projectionMatrix.n22)/(M.w+g.projectionMatrix.n24)),
+fa.material=O.material,G.elements.push(fa);f&&G.elements.sort(c);return G}};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),g=Math.cos(c),c=Math.sin(c),h=a*b,i=d*f;this.w=h*g-i*c;this.x=h*c+i*g;this.y=d*b*g+a*f*c;this.z=a*f*g-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,o=this.w,k=o*c+h*f-i*e,l=o*e+i*c-g*f,p=o*f+g*e-h*c,c=-g*
-c-h*e-i*f;b.x=k*o+c*-g+l*-i-p*-h;b.y=l*o+c*-h+p*-g-k*-i;b.z=p*o+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.0010)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,f=this.w,g=a.x,h=a.y,i=a.z,a=a.w;this.x=b*a+f*g+c*i-d*h;this.y=c*a+f*h+d*g-b*i;this.z=d*a+f*i+b*h-c*g;this.w=f*a-b*g-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,f=a.z,g=this.x,h=this.y,i=this.z,n=this.w,l=n*c+h*f-i*d,j=n*d+i*c-g*f,q=n*f+g*d-h*c,c=-g*
+c-h*d-i*f;b.x=l*n+c*-g+j*-i-q*-h;b.y=j*n+c*-h+q*-g-l*-i;b.z=q*n+c*-i+l*-h-j*-g;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 g=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)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)*g)/f;d=Math.sin(d*g)/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,g){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=g;this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,d,f,g,h){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=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};
 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 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<
 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;o=a.vertices[c].position;k=a.vertices[e].position;l=h[g];p=h[f];A=h[N];r=o.x-i.x;y=k.x-i.x;I=o.y-i.y;T=k.y-i.y;sa=o.z-i.z;ha=k.z-i.z;la=p.u-l.u;ka=A.u-l.u;J=p.v-l.v;P=A.v-l.v;G=1/(la*P-ka*J);ba.set((P*r-J*y)*G,(P*I-J*T)*G,(P*sa-J*ha)*G);Z.set((la*y-ka*r)*G,(la*T-ka*I)*G,(la*ha-ka*sa)*G);na[b].addSelf(ba);na[c].addSelf(ba);na[e].addSelf(ba);M[b].addSelf(Z);M[c].addSelf(Z);M[e].addSelf(Z)}var b,c,e,f,g,h,i,o,k,l,p,A,r,y,I,T,sa,ha,la,ka,J,P,G,N,na=[],M=[],ba=new THREE.Vector3,
-Z=new THREE.Vector3,qa=new THREE.Vector3,ua=new THREE.Vector3,ia=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)na[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 oa=["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++)ia.copy(g.vertexNormals[e]),
-f=g[oa[e]],N=na[f],qa.copy(N),qa.subSelf(ia.multiplyScalar(ia.dot(N))).normalize(),ua.cross(g.vertexNormals[e],N),f=ua.dot(M[f]),f=f<0?-1:1,g.vertexTangents[e]=new THREE.Vector4(qa.x,qa.y,qa.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,f,g,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],f=this.vertices[c.b],g=this.vertices[c.c],h.sub(g.position,f.position),i.sub(d.position,f.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,E){i=a.vertices[b].position;n=a.vertices[c].position;l=a.vertices[d].position;j=h[g];q=h[f];s=h[E];m=n.x-i.x;y=l.x-i.x;D=n.y-i.y;L=l.y-i.y;sa=n.z-i.z;fa=l.z-i.z;la=q.u-j.u;ka=s.u-j.u;G=q.v-j.v;N=s.v-j.v;M=1/(la*N-ka*G);$.set((N*m-G*y)*M,(N*D-G*L)*M,(N*sa-G*fa)*M);X.set((la*y-ka*m)*M,(la*L-ka*D)*M,(la*fa-ka*sa)*M);na[b].addSelf($);na[c].addSelf($);na[d].addSelf($);K[b].addSelf(X);K[c].addSelf(X);K[d].addSelf(X)}var b,c,d,f,g,h,i,n,l,j,q,s,m,y,D,L,sa,fa,la,ka,G,N,M,E,na=[],K=[],$=new THREE.Vector3,
+X=new THREE.Vector3,qa=new THREE.Vector3,ua=new THREE.Vector3,ga=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)na[b]=new THREE.Vector3,K[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 oa=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)ga.copy(g.vertexNormals[d]),
+f=g[oa[d]],E=na[f],qa.copy(E),qa.subSelf(ga.multiplyScalar(ga.dot(E))).normalize(),ua.cross(g.vertexNormals[d],E),f=ua.dot(K[f]),f=f<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(qa.x,qa.y,qa.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<
 c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=
-0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),g,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,f=Math.pow(10,4),g,h;g=0;for(h=this.vertices.length;g<h;g++)d=this.vertices[g].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];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=
 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,o,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;o=h*i;e.x=b(k.x,l.x,p.x,A.x,h,i,o);e.y=b(k.y,l.y,p.y,A.y,h,i,o);e.z=b(k.z,l.z,p.z,A.z,h,i,o);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e,g=b=b=0,f=new THREE.Vector3,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},f,g,h,i,n,l,j,q,s;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;l=this.points[c[0]];j=this.points[c[1]];
+q=this.points[c[2]];s=this.points[c[3]];i=h*h;n=h*i;d.x=b(l.x,j.x,q.x,s.x,h,i,n);d.y=b(l.y,j.y,q.y,s.y,h,i,n);d.z=b(l.z,j.z,q.z,s.z,h,i,n);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=[],j=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),j+=h.distanceTo(f),
+f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=g&&(i[b]=j,g=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,d,g,f,h,i=[],j=new THREE.Vector3,q=this.getLength();i.push(j.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=q.chunks[b]-q.chunks[b-1];h=Math.ceil(a*c/q.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(j.copy(d).clone());i.push(j.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,f,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;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,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,f,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;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,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 +117,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,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=d!==void 0?d: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.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,o){THREE.Texture.call(this,null,f,g,h,i,o);this.image={data:a,width:b,height:c};this.format=e!==void 0?e:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,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=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,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,d=this.addBone(),d.name=f.name,d.position.set(g[0],g[1],g[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++)f=this.geometry.bones[c],
+d=this.bones[c],f.parent===-1?this.add(d):this.bones[f.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,f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y,d=
+new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[g].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,13 +156,12 @@ 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,f={};for(b=0;b<a.length;b++)for(c in d=this.clone(a[b]),d)f[c]=d[c];return f},clone:function(a){var b,c,d,f={};for(b in a)for(c in f[b]={},a[b])d=a[b][c],f[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 f}};
 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}}};
-THREE.ShaderLib={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\n}"},
-depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}"},normal:{uniforms:{opacity:{type:"f",value:1}},
-vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}",fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}"},basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.map_pars_vertex,
+THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}"},normal:{uniforms:{opacity:{type:"f",
+value:1}},vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}",fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}"},basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.map_pars_vertex,
 THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,
 THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(328965)}}]),vertexShader:["varying vec3 vLightWeighting;",THREE.ShaderChunk.map_pars_vertex,
@@ -176,127 +175,119 @@ 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){za.multiplySelf(c.matrixWorld);for(e=0;e<z;e++)g=m[e].position,Da.copy(g),za.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 o(a,b,c,e,f,g){if(e.opacity!==0){var h,m,c=ka(a,b,c,e,g),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==wa&&(wa=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!==Ha&&(d.lineWidth(e),Ha=e),a&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),d.drawElements(d.LINES,f.__webglLineCount,d.UNSIGNED_SHORT,0)):(a&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),F.info.render.calls++,F.info.render.vertices+=f.__webglFaceCount,F.info.render.faces+=f.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?d.LINE_STRIP:d.LINES,e=e.linewidth,e!==
-Ha&&(d.lineWidth(e),Ha=e),d.drawArrays(g,0,f.__webglLineCount),F.info.render.calls++):g instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),F.info.render.calls++):g instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),F.info.render.calls++)}}function k(a){pa[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);pa[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);pa[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);pa[3].set(a.n41-
-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);pa[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);pa[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=pa[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=pa[c].x*b.n14+pa[c].y*b.n24+pa[c].z*b.n34+pa[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;ma||(ma=new THREE.PerspectiveCamera(F.shadowCameraFov,F.shadowMapWidth/F.shadowMapHeight,F.shadowCameraNear,F.shadowCameraFar));b=0;for(c=s.length;b<c;b++)if(u=s[b],u.castShadow&&u instanceof THREE.SpotLight){xa=-1;F.shadowMap[p]||(F.shadowMap[p]=new THREE.WebGLRenderTarget(F.shadowMapWidth,F.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),Ia[p]=new THREE.Matrix4);e=F.shadowMap[p];f=Ia[p];ma.position.copy(u.position);
-ma.lookAt(u.target.position);ma.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ma),this.autoUpdateScene&&a.updateMatrixWorld());ma.matrixWorldInverse.getInverse(ma.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(ma.projectionMatrix);f.multiplySelf(ma.matrixWorldInverse);ma.matrixWorldInverse.flattenToArray(Ja);ma.projectionMatrix.flattenToArray(Ka);za.multiply(ma.projectionMatrix,ma.matrixWorldInverse);k(za);qa(e);d.clearColor(1,1,1,1);
-F.clear();d.clearColor(L.r,L.g,L.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),J(u,ma,!1),h.render=!0;G(!0);F.setBlending(THREE.NormalBlending);for(e=0;e<f;e++)if(h=a.__webglObjects[e],h.render)u=h.object,h=h.buffer,P(u),m=u.customDepthMaterial?u.customDepthMaterial:u.geometry.morphTargets.length?Oa:Ga,o(ma,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),wa=-1,J(u,ma,!1),P(u),g=ka(ma,s,null,Ga,u),u.immediateRenderCallback?u.immediateRenderCallback(g,d,pa):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&&F.setBlending(u.blending);G(u.depthTest);N(u.depthWrite);na(u.polygonOffset,u.polygonOffsetFactor,u.polygonOffsetUnits)}P(i);o(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){wa=-1;if(h)p=h;else{p=m[b];if(!p)continue;g&&this.setBlending(p.blending);G(p.depthTest);N(p.depthWrite);na(p.polygonOffset,p.polygonOffsetFactor,p.polygonOffsetUnits)}P(u);s=ka(c,e,f,p,u);u.immediateRenderCallback?u.immediateRenderCallback(s,
-d,pa):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 T(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function sa(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 la(a,b){for(var d=a.length-1;d>=0;d--)a[d]===b&&a.splice(d,1)}function ka(a,b,c,e,f){e.program||F.initMaterial(e,b,c,f);if(e.morphTargets&&
-!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(F.maxMorphTargets);for(var g=0,h=F.maxMorphTargets;g<h;g++)f.__webglMorphTargetInfluences[g]=0}var m=!1,g=e.program,h=g.uniforms,u=e.uniforms;g!==va&&(d.useProgram(g),va=g,m=!0);if(e.id!==xa)xa=e.id,m=!0;if(m){d.uniformMatrix4fv(h.projectionMatrix,!1,Ka);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,o,k=Ra,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=o=0,m=b.length;c<m;c++)if(i=b[c],s=i.color,p=i.position,l=i.intensity,o=i.distance,i instanceof THREE.AmbientLight)F.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)o=x*3,F.gammaInput?(r[o]=s.r*
-s.r*l*l,r[o+1]=s.g*s.g*l*l,r[o+2]=s.b*s.b*l*l):(r[o]=s.r*l,r[o+1]=s.g*l,r[o+2]=s.b*l),A[o]=p.x,A[o+1]=p.y,A[o+2]=p.z,x+=1;else if(i instanceof THREE.SpotLight)o=x*3,F.gammaInput?(r[o]=s.r*s.r*l*l,r[o+1]=s.g*s.g*l*l,r[o+2]=s.b*s.b*l*l):(r[o]=s.r*l,r[o+1]=s.g*l,r[o+2]=s.b*l),s=1/p.length(),A[o]=p.x*s,A[o+1]=p.y*s,A[o+2]=p.z*s,x+=1;else if(i instanceof THREE.PointLight)i=y*3,F.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]=o,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=Ra;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,F.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=oa.height/2,u.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)u.shininess.value=e.shininess,F.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)F.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<Ia.length;b++)u.shadowMatrix.value[b]=Ia[b],u.shadowMap.texture[b]=F.shadowMap[b];
-u.shadowDarkness.value=F.shadowMapDarkness;u.shadowBias.value=F.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=ba(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)):F.setTexture(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])&&F.setTexture(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,Ja);e.skinning&&(d.uniformMatrix4fv(h.cameraInverseMatrix,!1,Ja),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 J(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function P(a){if(Ca!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),Ca=a.doubleSided;if(ya!==a.flipSided)a.flipSided?
-d.frontFace(d.CW):d.frontFace(d.CCW),ya=a.flipSided}function G(a){La!==a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),La=a)}function N(a){Ma!==a&&(d.depthMask(a),Ma=a)}function na(a,b,c){Sa!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),Sa=a);if(a&&(Ta!==b||Ua!==c))d.polygonOffset(b,c),Ta=b,Ua=c}function 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 ba(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,ia(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,ia(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,ia(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,ia(b.minFilter)),!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,ua(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,ua(b.minFilter)),!1)}function Z(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 qa(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);ba(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=d.createFramebuffer();a.__webglRenderbuffer[c]=
-d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,ia(a.format),a.width,a.height,0,ia(a.format),ia(a.type),null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,f,e.__webglTexture,0);Z(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),ba(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,
-0,ia(a.format),a.width,a.height,0,ia(a.format),ia(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),Z(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=Ea,a=
-Aa,e=Pa,f=Qa);b!==ta&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),ta=b)}function ua(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function ia(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;
-case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;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||{},oa=a.canvas!==void 0?a.canvas:document.createElement("canvas"),Ba=a.precision!==void 0?a.precision:"highp",Xa=a.antialias!==void 0?a.antialias:!1,ra=a.stencil!==void 0?a.stencil:!0,da=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,L=a.clearColor!==void 0?new THREE.Color(a.clearColor):
-new THREE.Color(0),O=a.clearAlpha!==void 0?a.clearAlpha:0,S=a.maxLights!==void 0?a.maxLights:4;this.domElement=oa;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.renderPlugins=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var F=this,d,R=[],va=null,ta=null,xa=-1,wa=null,Fa=0,Ca=null,ya=null,Na=null,La=null,Ma=null,Sa=null,Ta=null,Ua=null,Ha=null,Pa=0,Qa=0,Ea=0,Aa=0,pa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],za=new THREE.Matrix4,
-Ka=new Float32Array(16),Ja=new Float32Array(16),Da=new THREE.Vector4,Ra={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},ma,Ia=[],Ga,Oa,B={},Va=!1;d=function(){var a;try{if(!(a=oa.getContext("experimental-webgl",{antialias:Xa,stencil:ra,preserveDrawingBuffer:da})))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(L.r,L.g,L.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});Oa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
-vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});Ga._shadowPass=!0;Oa._shadowPass=!0})();this.context=d;var Wa=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return d};this.supportsVertexTextures=function(){return Wa};this.setSize=function(a,b){oa.width=a;oa.height=b;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(a,b,c,e){Pa=a;Qa=b;Ea=c;Aa=e;d.viewport(Pa,Qa,Ea,Aa)};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){L.setHex(a);O=b;d.clearColor(L.r,L.g,L.b,O)};this.setClearColor=function(a,b){L.copy(a);O=b;d.clearColor(L.r,L.g,L.b,O)};this.getClearColor=function(){return L};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){qa(a);this.clear(b,c,d)};this.addPlugin=function(a){a.init(this);this.renderPlugins.push(a)};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);
-F.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),F.info.memory.geometries--};this.deallocateTexture=
-function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),F.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,o=a.fog;xa=-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);F.info.render.calls=0;F.info.render.vertices=
-0;F.info.render.faces=0;b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ja);b.projectionMatrix.flattenToArray(Ka);za.multiply(b.projectionMatrix,b.matrixWorldInverse);k(za);qa(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);
-J(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),za.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),J(h,b,!0),h=g.object.material,h.transparent?(g.transparent=h,g.opaque=null):(g.opaque=h,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),G(a.overrideMaterial.depthTest),N(a.overrideMaterial.depthWrite),na(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),r(a.__webglObjects,
-!1,"",b,i,o,!0,a.overrideMaterial),y(a.__webglObjectsImmediate,"",b,i,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),r(a.__webglObjects,!0,"opaque",b,i,o,!1),y(a.__webglObjectsImmediate,"opaque",b,i,o,!1),r(a.__webglObjects,!1,"transparent",b,i,o,!0),y(a.__webglObjectsImmediate,"transparent",b,i,o,!0));if(a.__webglSprites.length){h=B.attributes;i=B.uniforms;o=Aa/Ea;e=[];f=Ea*0.5;m=Aa*0.5;g=!0;d.useProgram(B.program);va=B.program;wa=La=Na=-1;Va||(d.enableVertexAttribArray(B.attributes.position),
-d.enableVertexAttribArray(B.attributes.uv),Va=!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,Ka);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)),j=w.map.image.width/(w.scaleByViewport?Aa:1),e[0]=j*o*w.scale.x,e[1]=j*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),F.setBlending(w.blending),F.setTexture(w.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(Ma)}if(this.renderPlugins.length){e=0;for(f=this.renderPlugins.length;e<f;e++)this.renderPlugins[e].render(a,b,Ea,Aa),va=null,wa=Ma=La=Na=-1}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=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var i=a.__objectsAdded[0],p=a,l=void 0,o=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){o=i.geometry;if(o.geometryGroups===void 0){var k=o,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 o.geometryGroups)if(k=o.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())}F.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;o.__dirtyVertices=!0;o.__dirtyMorphTargets=!0;o.__dirtyElements=!0;o.__dirtyUvs=!0;o.__dirtyNormals=!0;o.__dirtyTangents=!0;o.__dirtyColors=
-!0}}else if(i instanceof THREE.Ribbon){if(o=i.geometry,!o.__webglVertexBuffer)k=o,k.__webglVertexBuffer=d.createBuffer(),k.__webglColorBuffer=d.createBuffer(),F.info.memory.geometries++,k=o,z=k.vertices.length,k.__vertexArray=new Float32Array(z*3),k.__colorArray=new Float32Array(z*3),k.__webglVertexCount=z,o.__dirtyVertices=!0,o.__dirtyColors=!0}else if(i instanceof THREE.Line){if(o=i.geometry,!o.__webglVertexBuffer)k=o,k.__webglVertexBuffer=d.createBuffer(),k.__webglColorBuffer=d.createBuffer(),
-F.info.memory.geometries++,k=o,z=i,m=k.vertices.length,k.__vertexArray=new Float32Array(m*3),k.__colorArray=new Float32Array(m*3),k.__webglLineCount=m,b(k,z),o.__dirtyVertices=!0,o.__dirtyColors=!0}else if(i instanceof THREE.ParticleSystem&&(o=i.geometry,!o.__webglVertexBuffer))k=o,k.__webglVertexBuffer=d.createBuffer(),k.__webglColorBuffer=d.createBuffer(),F.info.geometries++,k=o,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),o.__dirtyVertices=!0,o.__dirtyColors=!0;if(!i.__webglActive){if(i instanceof THREE.Mesh)for(l in o=i.geometry,o.geometryGroups)k=o.geometryGroups[l],I(p.__webglObjects,k,i);else i instanceof THREE.Ribbon||i instanceof THREE.Line||i instanceof THREE.ParticleSystem?(o=i.geometry,I(p.__webglObjects,o,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 instanceof THREE.LensFlare&&p.__webglFlares.push(i);i.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)i=a.__objectsRemoved[0],p=a,i instanceof THREE.Mesh||i instanceof THREE.ParticleSystem||i instanceof THREE.Ribbon||i instanceof THREE.Line?ha(p.__webglObjects,i):i instanceof THREE.Sprite?la(p.__webglSprites,i):i instanceof THREE.LensFlare?la(p.__webglFlares,i):(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,o=u=m=void 0,B instanceof THREE.Mesh){k=0;for(z=l.geometryGroupsList.length;k<z;k++)if(m=l.geometryGroupsList[k],o=c(B,m),u=o.attributes&&T(o),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=o;if(m.__inittedArrays){var s=e(j),w=f(j),J=g(j),O=s===THREE.SmoothShading,
-G=q=j=void 0,v=void 0,$=void 0,M=void 0,x=void 0,ca=void 0,N=void 0,R=G=void 0,C=void 0,D=void 0,E=void 0,aa=v=void 0,ea=void 0,L=void 0,U=v=N=void 0,V=void 0,P=E=D=C=x=void 0,H=v=E=D=C=P=E=D=C=P=E=D=C=void 0,K=void 0,S=M=void 0,ba=void 0,X=void 0,ka=void 0,fa=void 0,ia=R=X=K=0,da=0,Z=H=G=0,Q=x=aa=0,t=0,ga=void 0,Q=m.__vertexArray,ba=m.__uvArray,t=m.__uv2Array,S=m.__normalArray,$=m.__tangentArray,ea=m.__colorArray,U=m.__skinVertexAArray,V=m.__skinVertexBArray,ca=m.__skinIndexArray,ja=m.__skinWeightArray,
-P=m.__morphTargetsArrays,A=m.__webglCustomAttributesList,n=void 0,n=m.__faceArray,ga=m.__lineArray,L=y.geometry,oa=L.__dirtyElements,na=L.__dirtyUvs,M=L.__dirtyNormals,N=L.__dirtyTangents,qa=L.__dirtyColors,ka=L.__dirtyMorphTargets,fa=L.vertices,y=m.faces3,W=m.faces4,Y=L.faces,ma=L.faceVertexUvs[0],va=L.faceVertexUvs[1],pa=L.skinVerticesA,ra=L.skinVerticesB,ua=L.skinIndices,ta=L.skinWeights,wa=L.morphTargets;if(L.__dirtyVertices){j=0;for(q=y.length;j<q;j++)v=Y[y[j]],C=fa[v.a].position,D=fa[v.b].position,
-E=fa[v.c].position,Q[X]=C.x,Q[X+1]=C.y,Q[X+2]=C.z,Q[X+3]=D.x,Q[X+4]=D.y,Q[X+5]=D.z,Q[X+6]=E.x,Q[X+7]=E.y,Q[X+8]=E.z,X+=9;j=0;for(q=W.length;j<q;j++)v=Y[W[j]],C=fa[v.a].position,D=fa[v.b].position,E=fa[v.c].position,v=fa[v.d].position,Q[X]=C.x,Q[X+1]=C.y,Q[X+2]=C.z,Q[X+3]=D.x,Q[X+4]=D.y,Q[X+5]=D.z,Q[X+6]=E.x,Q[X+7]=E.y,Q[X+8]=E.z,Q[X+9]=v.x,Q[X+10]=v.y,Q[X+11]=v.z,X+=12;d.bindBuffer(d.ARRAY_BUFFER,m.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Q,u)}if(ka){X=0;for(ka=wa.length;X<ka;X++){j=Q=0;for(q=
-y.length;j<q;j++)v=Y[y[j]],C=wa[X].vertices[v.a].position,D=wa[X].vertices[v.b].position,E=wa[X].vertices[v.c].position,fa=P[X],fa[Q]=C.x,fa[Q+1]=C.y,fa[Q+2]=C.z,fa[Q+3]=D.x,fa[Q+4]=D.y,fa[Q+5]=D.z,fa[Q+6]=E.x,fa[Q+7]=E.y,fa[Q+8]=E.z,Q+=9;j=0;for(q=W.length;j<q;j++)v=Y[W[j]],C=wa[X].vertices[v.a].position,D=wa[X].vertices[v.b].position,E=wa[X].vertices[v.c].position,v=wa[X].vertices[v.d].position,fa=P[X],fa[Q]=C.x,fa[Q+1]=C.y,fa[Q+2]=C.z,fa[Q+3]=D.x,fa[Q+4]=D.y,fa[Q+5]=D.z,fa[Q+6]=E.x,fa[Q+7]=E.y,
-fa[Q+8]=E.z,fa[Q+9]=v.x,fa[Q+10]=v.y,fa[Q+11]=v.z,Q+=12;d.bindBuffer(d.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[X]);d.bufferData(d.ARRAY_BUFFER,P[X],u)}}if(ta.length){j=0;for(q=y.length;j<q;j++)v=Y[y[j]],C=ta[v.a],D=ta[v.b],E=ta[v.c],ja[x]=C.x,ja[x+1]=C.y,ja[x+2]=C.z,ja[x+3]=C.w,ja[x+4]=D.x,ja[x+5]=D.y,ja[x+6]=D.z,ja[x+7]=D.w,ja[x+8]=E.x,ja[x+9]=E.y,ja[x+10]=E.z,ja[x+11]=E.w,C=ua[v.a],D=ua[v.b],E=ua[v.c],ca[x]=C.x,ca[x+1]=C.y,ca[x+2]=C.z,ca[x+3]=C.w,ca[x+4]=D.x,ca[x+5]=D.y,ca[x+6]=D.z,ca[x+7]=D.w,
-ca[x+8]=E.x,ca[x+9]=E.y,ca[x+10]=E.z,ca[x+11]=E.w,C=pa[v.a],D=pa[v.b],E=pa[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,C=ra[v.a],D=ra[v.b],E=ra[v.c],V[x]=C.x,V[x+1]=C.y,V[x+2]=C.z,V[x+3]=1,V[x+4]=D.x,V[x+5]=D.y,V[x+6]=D.z,V[x+7]=1,V[x+8]=E.x,V[x+9]=E.y,V[x+10]=E.z,V[x+11]=1,x+=12;j=0;for(q=W.length;j<q;j++)v=Y[W[j]],C=ta[v.a],D=ta[v.b],E=ta[v.c],P=ta[v.d],ja[x]=C.x,ja[x+1]=C.y,ja[x+2]=C.z,ja[x+3]=C.w,ja[x+4]=D.x,
-ja[x+5]=D.y,ja[x+6]=D.z,ja[x+7]=D.w,ja[x+8]=E.x,ja[x+9]=E.y,ja[x+10]=E.z,ja[x+11]=E.w,ja[x+12]=P.x,ja[x+13]=P.y,ja[x+14]=P.z,ja[x+15]=P.w,C=ua[v.a],D=ua[v.b],E=ua[v.c],P=ua[v.d],ca[x]=C.x,ca[x+1]=C.y,ca[x+2]=C.z,ca[x+3]=C.w,ca[x+4]=D.x,ca[x+5]=D.y,ca[x+6]=D.z,ca[x+7]=D.w,ca[x+8]=E.x,ca[x+9]=E.y,ca[x+10]=E.z,ca[x+11]=E.w,ca[x+12]=P.x,ca[x+13]=P.y,ca[x+14]=P.z,ca[x+15]=P.w,C=pa[v.a],D=pa[v.b],E=pa[v.c],P=pa[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]=P.x,U[x+13]=P.y,U[x+14]=P.z,U[x+15]=1,C=ra[v.a],D=ra[v.b],E=ra[v.c],v=ra[v.d],V[x]=C.x,V[x+1]=C.y,V[x+2]=C.z,V[x+3]=1,V[x+4]=D.x,V[x+5]=D.y,V[x+6]=D.z,V[x+7]=1,V[x+8]=E.x,V[x+9]=E.y,V[x+10]=E.z,V[x+11]=1,V[x+12]=v.x,V[x+13]=v.y,V[x+14]=v.z,V[x+15]=1,x+=16;x>0&&(d.bindBuffer(d.ARRAY_BUFFER,m.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,U,u),d.bindBuffer(d.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,V,u),d.bindBuffer(d.ARRAY_BUFFER,
-m.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,ca,u),d.bindBuffer(d.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ja,u))}if(qa&&w){j=0;for(q=y.length;j<q;j++)v=Y[y[j]],x=v.vertexColors,ca=v.color,x.length===3&&w===THREE.VertexColors?(v=x[0],U=x[1],V=x[2]):V=U=v=ca,ea[aa]=v.r,ea[aa+1]=v.g,ea[aa+2]=v.b,ea[aa+3]=U.r,ea[aa+4]=U.g,ea[aa+5]=U.b,ea[aa+6]=V.r,ea[aa+7]=V.g,ea[aa+8]=V.b,aa+=9;j=0;for(q=W.length;j<q;j++)v=Y[W[j]],x=v.vertexColors,ca=v.color,x.length===4&&w===
-THREE.VertexColors?(v=x[0],U=x[1],V=x[2],x=x[3]):x=V=U=v=ca,ea[aa]=v.r,ea[aa+1]=v.g,ea[aa+2]=v.b,ea[aa+3]=U.r,ea[aa+4]=U.g,ea[aa+5]=U.b,ea[aa+6]=V.r,ea[aa+7]=V.g,ea[aa+8]=V.b,ea[aa+9]=x.r,ea[aa+10]=x.g,ea[aa+11]=x.b,aa+=12;aa>0&&(d.bindBuffer(d.ARRAY_BUFFER,m.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,ea,u))}if(N&&L.hasTangents){j=0;for(q=y.length;j<q;j++)v=Y[y[j]],N=v.vertexTangents,aa=N[0],ea=N[1],L=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]=L.x,$[H+9]=L.y,$[H+10]=L.z,$[H+11]=L.w,H+=12;j=0;for(q=W.length;j<q;j++)v=Y[W[j]],N=v.vertexTangents,aa=N[0],ea=N[1],L=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]=L.x,$[H+9]=L.y,$[H+10]=L.z,$[H+11]=L.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=Y[y[j]],$=v.vertexNormals,M=v.normal,
-$.length===3&&O)for(H=0;H<3;H++)M=$[H],S[G]=M.x,S[G+1]=M.y,S[G+2]=M.z,G+=3;else for(H=0;H<3;H++)S[G]=M.x,S[G+1]=M.y,S[G+2]=M.z,G+=3;j=0;for(q=W.length;j<q;j++)if(v=Y[W[j]],$=v.vertexNormals,M=v.normal,$.length===4&&O)for(H=0;H<4;H++)M=$[H],S[G]=M.x,S[G+1]=M.y,S[G+2]=M.z,G+=3;else for(H=0;H<4;H++)S[G]=M.x,S[G+1]=M.y,S[G+2]=M.z,G+=3;d.bindBuffer(d.ARRAY_BUFFER,m.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,S,u)}if(na&&ma&&J){j=0;for(q=y.length;j<q;j++)if(G=y[j],G=ma[G],G!==void 0)for(H=0;H<3;H++)S=
-G[H],ba[R]=S.u,ba[R+1]=S.v,R+=2;j=0;for(q=W.length;j<q;j++)if(G=W[j],G=ma[G],G!==void 0)for(H=0;H<4;H++)S=G[H],ba[R]=S.u,ba[R+1]=S.v,R+=2;R>0&&(d.bindBuffer(d.ARRAY_BUFFER,m.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,ba,u))}if(na&&va&&J){j=0;for(q=y.length;j<q;j++)if(G=y[j],R=va[G],R!==void 0)for(H=0;H<3;H++)ba=R[H],t[ia]=ba.u,t[ia+1]=ba.v,ia+=2;j=0;for(q=W.length;j<q;j++)if(G=W[j],R=va[G],R!==void 0)for(H=0;H<4;H++)ba=R[H],t[ia]=ba.u,t[ia+1]=ba.v,ia+=2;ia>0&&(d.bindBuffer(d.ARRAY_BUFFER,m.__webglUV2Buffer),
-d.bufferData(d.ARRAY_BUFFER,t,u))}if(oa){j=0;for(q=y.length;j<q;j++)n[da]=K,n[da+1]=K+1,n[da+2]=K+2,da+=3,ga[Z]=K,ga[Z+1]=K+1,ga[Z+2]=K,ga[Z+3]=K+2,ga[Z+4]=K+1,ga[Z+5]=K+2,Z+=6,K+=3;j=0;for(q=W.length;j<q;j++)n[da]=K,n[da+1]=K+1,n[da+2]=K+3,n[da+3]=K+1,n[da+4]=K+2,n[da+5]=K+3,da+=6,ga[Z]=K,ga[Z+1]=K+1,ga[Z+2]=K,ga[Z+3]=K+3,ga[Z+4]=K+1,ga[Z+5]=K+2,ga[Z+6]=K+2,ga[Z+7]=K+3,Z+=8,K+=4;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,n,u);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,
-m.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ga,u)}if(A){H=0;for(K=A.length;H<K;H++)if(n=A[H],n.__original.needsUpdate){t=0;if(n.size===1)if(n.boundTo===void 0||n.boundTo==="vertices"){j=0;for(q=y.length;j<q;j++)v=Y[y[j]],n.array[t]=n.value[v.a],n.array[t+1]=n.value[v.b],n.array[t+2]=n.value[v.c],t+=3;j=0;for(q=W.length;j<q;j++)v=Y[W[j]],n.array[t]=n.value[v.a],n.array[t+1]=n.value[v.b],n.array[t+2]=n.value[v.c],n.array[t+3]=n.value[v.d],t+=4}else{if(n.boundTo==="faces"){j=0;for(q=y.length;j<
-q;j++)ga=n.value[y[j]],n.array[t]=ga,n.array[t+1]=ga,n.array[t+2]=ga,t+=3;j=0;for(q=W.length;j<q;j++)ga=n.value[W[j]],n.array[t]=ga,n.array[t+1]=ga,n.array[t+2]=ga,n.array[t+3]=ga,t+=4}}else if(n.size===2)if(n.boundTo===void 0||n.boundTo==="vertices"){j=0;for(q=y.length;j<q;j++)v=Y[y[j]],C=n.value[v.a],D=n.value[v.b],E=n.value[v.c],n.array[t]=C.x,n.array[t+1]=C.y,n.array[t+2]=D.x,n.array[t+3]=D.y,n.array[t+4]=E.x,n.array[t+5]=E.y,t+=6;j=0;for(q=W.length;j<q;j++)v=Y[W[j]],C=n.value[v.a],D=n.value[v.b],
-E=n.value[v.c],v=n.value[v.d],n.array[t]=C.x,n.array[t+1]=C.y,n.array[t+2]=D.x,n.array[t+3]=D.y,n.array[t+4]=E.x,n.array[t+5]=E.y,n.array[t+6]=v.x,n.array[t+7]=v.y,t+=8}else{if(n.boundTo==="faces"){j=0;for(q=y.length;j<q;j++)E=D=C=ga=n.value[y[j]],n.array[t]=C.x,n.array[t+1]=C.y,n.array[t+2]=D.x,n.array[t+3]=D.y,n.array[t+4]=E.x,n.array[t+5]=E.y,t+=6;j=0;for(q=W.length;j<q;j++)v=E=D=C=ga=n.value[W[j]],n.array[t]=C.x,n.array[t+1]=C.y,n.array[t+2]=D.x,n.array[t+3]=D.y,n.array[t+4]=E.x,n.array[t+5]=
-E.y,n.array[t+6]=v.x,n.array[t+7]=v.y,t+=8}}else if(n.size===3)if(s=n.type==="c"?["r","g","b"]:["x","y","z"],n.boundTo===void 0||n.boundTo==="vertices"){j=0;for(q=y.length;j<q;j++)v=Y[y[j]],C=n.value[v.a],D=n.value[v.b],E=n.value[v.c],n.array[t]=C[s[0]],n.array[t+1]=C[s[1]],n.array[t+2]=C[s[2]],n.array[t+3]=D[s[0]],n.array[t+4]=D[s[1]],n.array[t+5]=D[s[2]],n.array[t+6]=E[s[0]],n.array[t+7]=E[s[1]],n.array[t+8]=E[s[2]],t+=9;j=0;for(q=W.length;j<q;j++)v=Y[W[j]],C=n.value[v.a],D=n.value[v.b],E=n.value[v.c],
-v=n.value[v.d],n.array[t]=C[s[0]],n.array[t+1]=C[s[1]],n.array[t+2]=C[s[2]],n.array[t+3]=D[s[0]],n.array[t+4]=D[s[1]],n.array[t+5]=D[s[2]],n.array[t+6]=E[s[0]],n.array[t+7]=E[s[1]],n.array[t+8]=E[s[2]],n.array[t+9]=v[s[0]],n.array[t+10]=v[s[1]],n.array[t+11]=v[s[2]],t+=12}else{if(n.boundTo==="faces"){j=0;for(q=y.length;j<q;j++)E=D=C=ga=n.value[y[j]],n.array[t]=C[s[0]],n.array[t+1]=C[s[1]],n.array[t+2]=C[s[2]],n.array[t+3]=D[s[0]],n.array[t+4]=D[s[1]],n.array[t+5]=D[s[2]],n.array[t+6]=E[s[0]],n.array[t+
-7]=E[s[1]],n.array[t+8]=E[s[2]],t+=9;j=0;for(q=W.length;j<q;j++)v=E=D=C=ga=n.value[W[j]],n.array[t]=C[s[0]],n.array[t+1]=C[s[1]],n.array[t+2]=C[s[2]],n.array[t+3]=D[s[0]],n.array[t+4]=D[s[1]],n.array[t+5]=D[s[2]],n.array[t+6]=E[s[0]],n.array[t+7]=E[s[1]],n.array[t+8]=E[s[2]],n.array[t+9]=v[s[0]],n.array[t+10]=v[s[1]],n.array[t+11]=v[s[2]],t+=12}}else if(n.size===4)if(n.boundTo===void 0||n.boundTo==="vertices"){j=0;for(q=y.length;j<q;j++)v=Y[y[j]],C=n.value[v.a],D=n.value[v.b],E=n.value[v.c],n.array[t]=
-C.x,n.array[t+1]=C.y,n.array[t+2]=C.z,n.array[t+3]=C.w,n.array[t+4]=D.x,n.array[t+5]=D.y,n.array[t+6]=D.z,n.array[t+7]=D.w,n.array[t+8]=E.x,n.array[t+9]=E.y,n.array[t+10]=E.z,n.array[t+11]=E.w,t+=12;j=0;for(q=W.length;j<q;j++)v=Y[W[j]],C=n.value[v.a],D=n.value[v.b],E=n.value[v.c],v=n.value[v.d],n.array[t]=C.x,n.array[t+1]=C.y,n.array[t+2]=C.z,n.array[t+3]=C.w,n.array[t+4]=D.x,n.array[t+5]=D.y,n.array[t+6]=D.z,n.array[t+7]=D.w,n.array[t+8]=E.x,n.array[t+9]=E.y,n.array[t+10]=E.z,n.array[t+11]=E.w,n.array[t+
-12]=v.x,n.array[t+13]=v.y,n.array[t+14]=v.z,n.array[t+15]=v.w,t+=16}else if(n.boundTo==="faces"){j=0;for(q=y.length;j<q;j++)E=D=C=ga=n.value[y[j]],n.array[t]=C.x,n.array[t+1]=C.y,n.array[t+2]=C.z,n.array[t+3]=C.w,n.array[t+4]=D.x,n.array[t+5]=D.y,n.array[t+6]=D.z,n.array[t+7]=D.w,n.array[t+8]=E.x,n.array[t+9]=E.y,n.array[t+10]=E.z,n.array[t+11]=E.w,t+=12;j=0;for(q=W.length;j<q;j++)v=E=D=C=ga=n.value[W[j]],n.array[t]=C.x,n.array[t+1]=C.y,n.array[t+2]=C.z,n.array[t+3]=C.w,n.array[t+4]=D.x,n.array[t+
-5]=D.y,n.array[t+6]=D.z,n.array[t+7]=D.w,n.array[t+8]=E.x,n.array[t+9]=E.y,n.array[t+10]=E.z,n.array[t+11]=E.w,n.array[t+12]=v.x,n.array[t+13]=v.y,n.array[t+14]=v.z,n.array[t+15]=v.w,t+=16}d.bindBuffer(d.ARRAY_BUFFER,n.buffer);d.bufferData(d.ARRAY_BUFFER,n.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;o.attributes&&sa(o)}else if(B instanceof THREE.Ribbon){if(l.__dirtyVertices||l.__dirtyColors){o=l;B=d.DYNAMIC_DRAW;s=k=s=r=r=void 0;w=o.vertices;z=o.colors;j=w.length;m=z.length;q=o.__vertexArray;u=o.__colorArray;A=o.__dirtyColors;if(o.__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,o.__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,o.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,u,B)}}l.__dirtyVertices=!1;l.__dirtyColors=!1}else if(B instanceof THREE.Line){o=c(B,m);u=o.attributes&&T(o);if(l.__dirtyVertices||l.__dirtyColors||u){B=l;k=d.DYNAMIC_DRAW;j=z=O=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=Y=W=y=O=J=void 0;if(B.__dirtyVertices){for(J=0;J<j;J++)O=w[J].position,z=J*3,q[z]=O.x,q[z+1]=O.y,q[z+2]=O.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(O=s.length;J<O;J++)if(K=s[J],K.needsUpdate&&(K.boundTo===void 0||K.boundTo==="vertices")){z=
-0;W=K.value.length;if(K.size===1)for(y=0;y<W;y++)K.array[y]=K.value[y];else if(K.size===2)for(y=0;y<W;y++)Y=K.value[y],K.array[z]=Y.x,K.array[z+1]=Y.y,z+=2;else if(K.size===3)if(K.type==="c")for(y=0;y<W;y++)Y=K.value[y],K.array[z]=Y.r,K.array[z+1]=Y.g,K.array[z+2]=Y.b,z+=3;else for(y=0;y<W;y++)Y=K.value[y],K.array[z]=Y.x,K.array[z+1]=Y.y,K.array[z+2]=Y.z,z+=3;else if(K.size===4)for(y=0;y<W;y++)Y=K.value[y],K.array[z]=Y.x,K.array[z+1]=Y.y,K.array[z+2]=Y.z,K.array[z+3]=Y.w,z+=4;d.bindBuffer(d.ARRAY_BUFFER,
-K.buffer);d.bufferData(d.ARRAY_BUFFER,K.array,k)}}}l.__dirtyVertices=!1;l.__dirtyColors=!1;o.attributes&&sa(o)}else if(B instanceof THREE.ParticleSystem)o=c(B,m),u=o.attributes&&T(o),(l.__dirtyVertices||l.__dirtyColors||B.sortParticles||u)&&h(l,d.DYNAMIC_DRAW,B),l.__dirtyVertices=!1,l.__dirtyColors=!1,o.attributes&&sa(o)};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,o,p;l=p=k=0;for(o=b.length;l<o;l++)h=b[l],h instanceof THREE.SpotLight&&p++,h instanceof THREE.DirectionalLight&&p++,h instanceof THREE.PointLight&&
-k++;k+p<=S?l=p:(l=Math.ceil(S*p/(k+p)),k=S-l);h={directional:l,point:k};k=p=0;for(l=b.length;k<l;k++)o=b[k],o instanceof THREE.SpotLight&&o.castShadow&&p++;var j=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)j=e.bones.length;var q;a:{l=a.fragmentShader;o=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(o));for(r in c)e.push(r),e.push(c[r]);i=e.join();r=0;for(e=R.length;r<e;r++)if(R[r].code===i){q=R[r].program;break a}r=d.createProgram();e=[Wa?"#define VERTEX_TEXTURES":"",
-F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.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":
+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 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 d,g,f,h,o=a.vertices;h=o.length;var r=a.colors,i=r.length,t=a.__vertexArray,j=a.__colorArray,k=a.__sortArray,w=a.__dirtyVertices,q=a.__dirtyColors,n=a.__webglCustomAttributesList;if(c.sortParticles){za.multiplySelf(c.matrixWorld);for(d=0;d<h;d++)g=o[d].position,Ca.copy(g),za.multiplyVector3(Ca),k[d]=[Ca.z,d];k.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++)g=o[k[d][1]].position,f=d*3,t[f]=g.x,t[f+1]=g.y,t[f+2]=g.z;for(d=0;d<i;d++)f=d*3,g=r[k[d][1]],j[f]=g.r,j[f+
+1]=g.g,j[f+2]=g.b;if(n){r=0;for(i=n.length;r<i;r++)if(o=n[r],o.boundTo===void 0||o.boundTo==="vertices")if(f=0,g=o.value.length,o.size===1)for(d=0;d<g;d++)h=k[d][1],o.array[d]=o.value[h];else if(o.size===2)for(d=0;d<g;d++)h=k[d][1],h=o.value[h],o.array[f]=h.x,o.array[f+1]=h.y,f+=2;else if(o.size===3)if(o.type==="c")for(d=0;d<g;d++)h=k[d][1],h=o.value[h],o.array[f]=h.r,o.array[f+1]=h.g,o.array[f+2]=h.b,f+=3;else for(d=0;d<g;d++)h=k[d][1],h=o.value[h],o.array[f]=h.x,o.array[f+1]=h.y,o.array[f+2]=h.z,
+f+=3;else if(o.size===4)for(d=0;d<g;d++)h=k[d][1],h=o.value[h],o.array[f]=h.x,o.array[f+1]=h.y,o.array[f+2]=h.z,o.array[f+3]=h.w,f+=4}}else{if(w)for(d=0;d<h;d++)g=o[d].position,f=d*3,t[f]=g.x,t[f+1]=g.y,t[f+2]=g.z;if(q)for(d=0;d<i;d++)g=r[d],f=d*3,j[f]=g.r,j[f+1]=g.g,j[f+2]=g.b;if(n){r=0;for(i=n.length;r<i;r++)if(o=n[r],o.needsUpdate&&(o.boundTo===void 0||o.boundTo==="vertices"))if(g=o.value.length,f=0,o.size===1)for(d=0;d<g;d++)o.array[d]=o.value[d];else if(o.size===2)for(d=0;d<g;d++)h=o.value[d],
+o.array[f]=h.x,o.array[f+1]=h.y,f+=2;else if(o.size===3)if(o.type==="c")for(d=0;d<g;d++)h=o.value[d],o.array[f]=h.r,o.array[f+1]=h.g,o.array[f+2]=h.b,f+=3;else for(d=0;d<g;d++)h=o.value[d],o.array[f]=h.x,o.array[f+1]=h.y,o.array[f+2]=h.z,f+=3;else if(o.size===4)for(d=0;d<g;d++)h=o.value[d],o.array[f]=h.x,o.array[f+1]=h.y,o.array[f+2]=h.z,o.array[f+3]=h.w,f+=4}}if(w||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,t,b);if(q||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
+a.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,j,b);if(n){r=0;for(i=n.length;r<i;r++)if(o=n[r],o.needsUpdate||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,o.buffer),e.bufferData(e.ARRAY_BUFFER,o.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,o,r,i,t,j,k,w=a.count*3;for(k=0;k<w;k+=9)c=a.normalArray,d=c[k],f=c[k+1],g=c[k+2],h=c[k+3],r=c[k+4],t=c[k+5],o=c[k+6],i=c[k+7],j=c[k+8],d=(d+h+o)/3,f=(f+r+i)/3,g=(g+t+j)/3,c[k]=d,c[k+1]=f,c[k+2]=g,c[k+3]=d,c[k+4]=f,c[k+5]=g,c[k+6]=d,c[k+7]=f,c[k+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 n(a,b,c,d,f,g){if(d.opacity!==0){var h,o,c=ka(a,b,c,d,g),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(d.wireframe?1:0);c!==xa&&(xa=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(o=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]=o[r[h]],h++}else{var r=[],i=-1,
+t=0;o=g.morphTargetInfluences;var j,k=o.length;h=0;for(g.morphTargetBase!==-1&&(r[g.morphTargetBase]=!0);h<d.numSupportedMorphTargets;){for(j=0;j<k;j++)!r[j]&&o[j]>i&&(t=j,i=o[t]);e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[t]);e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[h]=i;r[t]=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(o=f.__webglCustomAttributesList.length;h<o;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!==Fa&&(e.lineWidth(d),Fa=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)),C.info.render.calls++,C.info.render.vertices+=f.__webglFaceCount,C.info.render.faces+=f.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?e.LINE_STRIP:e.LINES,d=d.linewidth,d!==
+Fa&&(e.lineWidth(d),Fa=d),e.drawArrays(g,0,f.__webglLineCount),C.info.render.calls++):g instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,f.__webglParticleCount),C.info.render.calls++):g instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,f.__webglVertexCount),C.info.render.calls++)}}function l(a){pa[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);pa[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);pa[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);pa[3].set(a.n41-
+a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);pa[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);pa[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=pa[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function j(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=pa[e].x*b.n14+pa[e].y*b.n24+pa[e].z*b.n34+pa[e].w,a<=c)return!1;return!0}function q(a,b){return b.z-a.z}function s(a){var b,
+c,d,f,g,h,o,r,q=0,t=a.lights;ma||(ma=new THREE.PerspectiveCamera(C.shadowCameraFov,C.shadowMapWidth/C.shadowMapHeight,C.shadowCameraNear,C.shadowCameraFar));b=0;for(c=t.length;b<c;b++)if(r=t[b],r.castShadow&&r instanceof THREE.SpotLight){wa=-1;C.shadowMap[q]||(C.shadowMap[q]=new THREE.WebGLRenderTarget(C.shadowMapWidth,C.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),Ga[q]=new THREE.Matrix4);d=C.shadowMap[q];f=Ga[q];ma.position.copy(r.position);
+ma.lookAt(r.target.position);ma.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ma),this.autoUpdateScene&&a.updateMatrixWorld());ma.matrixWorldInverse.getInverse(ma.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(ma.projectionMatrix);f.multiplySelf(ma.matrixWorldInverse);ma.matrixWorldInverse.flattenToArray(Ha);ma.projectionMatrix.flattenToArray(Ia);za.multiply(ma.projectionMatrix,ma.matrixWorldInverse);l(za);qa(d);e.clearColor(1,1,1,1);
+C.clear();e.clearColor(Q.r,Q.g,Q.b,J);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||j(r)))r.matrixWorld.flattenToArray(r._objectMatrixArray),G(r,ma,!1),h.render=!0;M(!0);C.setBlending(THREE.NormalBlending);for(d=0;d<f;d++)if(h=a.__webglObjects[d],h.render)r=h.object,h=h.buffer,N(r),o=r.customDepthMaterial?r.customDepthMaterial:r.geometry.morphTargets.length?La:Ea,n(ma,t,null,o,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),xa=-1,G(r,ma,!1),N(r),g=ka(ma,t,null,Ea,r),r.immediateRenderCallback?r.immediateRenderCallback(g,e,pa):r.render(function(a){i(a,g,Ea.shading)}));q++}}function m(a,b,c,e,d,f,g,h){var r,i,t,j;b?(i=a.length-1,j=b=-1):(i=0,b=a.length,j=1);for(var k=i;k!==b;k+=j)if(r=a[k],r.render){i=r.object;t=r.buffer;if(h)r=h;else{r=
+r[c];if(!r)continue;g&&C.setBlending(r.blending);M(r.depthTest);E(r.depthWrite);na(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits)}N(i);n(e,d,f,r,t,i)}}function y(a,b,c,d,f,g,h){for(var o,r,j,t,q=0,k=a.length;q<k;q++)if(o=a[q],r=o.object,r.visible){xa=-1;if(h)j=h;else{j=o[b];if(!j)continue;g&&this.setBlending(j.blending);M(j.depthTest);E(j.depthWrite);na(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}N(r);t=ka(c,d,f,j,r);r.immediateRenderCallback?r.immediateRenderCallback(t,
+e,pa):r.render(function(a){i(a,t,j.shading)})}}function D(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function L(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function sa(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function fa(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function la(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function ka(a,b,c,d,f){d.program||C.initMaterial(d,b,c,f);if(d.morphTargets&&
+!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(C.maxMorphTargets);for(var g=0,h=C.maxMorphTargets;g<h;g++)f.__webglMorphTargetInfluences[g]=0}var o=!1,g=d.program,h=g.uniforms,r=d.uniforms;g!==va&&(e.useProgram(g),va=g,o=!0);if(d.id!==wa)wa=d.id,o=!0;if(o){e.uniformMatrix4fv(h.projectionMatrix,!1,Ia);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,t,j=0,k=0,w=0,q,n,l,m=Ra,s=m.directional.colors,D=m.directional.positions,v=m.point.colors,y=m.point.positions,G=m.point.distances,x=0,L=0,c=i=l=0,o=b.length;c<o;c++)if(i=b[c],t=i.color,q=i.position,n=i.intensity,l=i.distance,i instanceof THREE.AmbientLight)C.gammaInput?(j+=t.r*t.r,k+=t.g*t.g,w+=t.b*t.b):(j+=t.r,k+=t.g,w+=t.b);else if(i instanceof THREE.DirectionalLight)l=x*3,C.gammaInput?(s[l]=t.r*
+t.r*n*n,s[l+1]=t.g*t.g*n*n,s[l+2]=t.b*t.b*n*n):(s[l]=t.r*n,s[l+1]=t.g*n,s[l+2]=t.b*n),D[l]=q.x,D[l+1]=q.y,D[l+2]=q.z,x+=1;else if(i instanceof THREE.SpotLight)l=x*3,C.gammaInput?(s[l]=t.r*t.r*n*n,s[l+1]=t.g*t.g*n*n,s[l+2]=t.b*t.b*n*n):(s[l]=t.r*n,s[l+1]=t.g*n,s[l+2]=t.b*n),t=1/q.length(),D[l]=q.x*t,D[l+1]=q.y*t,D[l+2]=q.z*t,x+=1;else if(i instanceof THREE.PointLight)i=L*3,C.gammaInput?(v[i]=t.r*t.r*n*n,v[i+1]=t.g*t.g*n*n,v[i+2]=t.b*t.b*n*n):(v[i]=t.r*n,v[i+1]=t.g*n,v[i+2]=t.b*n),y[i]=q.x,y[i+1]=q.y,
+y[i+2]=q.z,G[L]=l,L+=1;c=x*3;for(o=s.length;c<o;c++)s[c]=0;c=L*3;for(o=v.length;c<o;c++)v[c]=0;m.point.length=L;m.directional.length=x;m.ambient[0]=j;m.ambient[1]=k;m.ambient[2]=w;b=Ra;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,C.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=oa.height/2,r.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)r.shininess.value=d.shininess,C.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)C.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<Ga.length;b++)r.shadowMatrix.value[b]=Ga[b],r.shadowMap.texture[b]=C.shadowMap[b];
+r.shadowDarkness.value=C.shadowMapDarkness;r.shadowBias.value=C.shadowMapBias}b=d.uniformsList;r=0;for(c=b.length;r<c;r++)if(k=g.uniforms[b[r][1]])if(j=b[r][0],w=j.type,o=j.value,w==="i")e.uniform1i(k,o);else if(w==="f")e.uniform1f(k,o);else if(w==="v2")e.uniform2f(k,o.x,o.y);else if(w==="v3")e.uniform3f(k,o.x,o.y,o.z);else if(w==="v4")e.uniform4f(k,o.x,o.y,o.z,o.w);else if(w==="c")e.uniform3f(k,o.r,o.g,o.b);else if(w==="fv1")e.uniform1fv(k,o);else if(w==="fv")e.uniform3fv(k,o);else if(w==="v3v"){if(!j._array)j._array=
+new Float32Array(3*o.length);w=0;for(q=o.length;w<q;w++)m=w*3,j._array[m]=o[w].x,j._array[m+1]=o[w].y,j._array[m+2]=o[w].z;e.uniform3fv(k,j._array)}else if(w==="m4"){if(!j._array)j._array=new Float32Array(16);o.flattenToArray(j._array);e.uniformMatrix4fv(k,!1,j._array)}else if(w==="m4v"){if(!j._array)j._array=new Float32Array(16*o.length);w=0;for(q=o.length;w<q;w++)o[w].flattenToArrayOffset(j._array,w*16);e.uniformMatrix4fv(k,!1,j._array)}else if(w==="t"){if(e.uniform1i(k,o),k=j.texture)if(k.image instanceof
+Array&&k.image.length===6){if(j=k,j.image.length===6)if(j.needsUpdate){if(!j.image.__webglTextureCube)j.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+o);e.bindTexture(e.TEXTURE_CUBE_MAP,j.image.__webglTextureCube);o=$(e.TEXTURE_CUBE_MAP,j,j.image[0]);for(k=0;k<6;k++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,j.image[k]);o&&e.generateMipmap(e.TEXTURE_CUBE_MAP);j.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+o),e.bindTexture(e.TEXTURE_CUBE_MAP,
+j.image.__webglTextureCube)}else k instanceof THREE.WebGLRenderTargetCube?(j=k,e.activeTexture(e.TEXTURE0+o),e.bindTexture(e.TEXTURE_CUBE_MAP,j.__webglTexture)):C.setTexture(k,o)}else if(w==="tv"){if(!j._array){j._array=[];w=0;for(q=j.texture.length;w<q;w++)j._array[w]=o+w}e.uniform1iv(k,j._array);w=0;for(q=j.texture.length;w<q;w++)(k=j.texture[w])&&C.setTexture(k,j._array[w])}(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,Ha);d.skinning&&(e.uniformMatrix4fv(h.cameraInverseMatrix,!1,Ha),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 G(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function N(a){if(Ba!==a.doubleSided)a.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),Ba=a.doubleSided;if(ya!==a.flipSided)a.flipSided?
+e.frontFace(e.CW):e.frontFace(e.CCW),ya=a.flipSided}function M(a){Ma!==a&&(a?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),Ma=a)}function E(a){Na!==a&&(e.depthMask(a),Na=a)}function na(a,b,c){Sa!==a&&(a?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),Sa=a);if(a&&(Ta!==b||Ua!==c))e.polygonOffset(b,c),Ta=b,Ua=c}function K(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 $(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(e.texParameteri(a,e.TEXTURE_WRAP_S,ga(b.wrapS)),e.texParameteri(a,e.TEXTURE_WRAP_T,ga(b.wrapT)),e.texParameteri(a,e.TEXTURE_MAG_FILTER,ga(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,ga(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,ua(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,ua(b.minFilter)),!1)}function X(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 qa(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);$(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,ga(a.format),a.width,a.height,0,ga(a.format),ga(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);X(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=e.createFramebuffer(),a.__webglRenderbuffer=e.createRenderbuffer(),e.bindTexture(e.TEXTURE_2D,a.__webglTexture),$(e.TEXTURE_2D,a,a),e.texImage2D(e.TEXTURE_2D,
+0,ga(a.format),a.width,a.height,0,ga(a.format),ga(a.type),null),c=e.TEXTURE_2D,e.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,c,a.__webglTexture,0),X(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=Ja,a=
+Ka,d=Oa,f=Pa);b!==ta&&(e.bindFramebuffer(e.FRAMEBUFFER,b),e.viewport(d,f,c,a),ta=b)}function ua(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function ga(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||{},oa=a.canvas!==void 0?a.canvas:document.createElement("canvas"),Aa=a.precision!==void 0?a.precision:"highp",Wa=a.antialias!==void 0?a.antialias:!1,ra=a.stencil!==void 0?a.stencil:!0,ba=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,Q=a.clearColor!==void 0?new THREE.Color(a.clearColor):
+new THREE.Color(0),J=a.clearAlpha!==void 0?a.clearAlpha:0,R=a.maxLights!==void 0?a.maxLights:4;this.domElement=oa;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.renderPlugins=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var C=this,e,O=[],va=null,ta=null,wa=-1,xa=null,Da=0,Ba=null,ya=null,Qa=null,Ma=null,Na=null,Sa=null,Ta=null,Ua=null,Fa=null,Oa=0,Pa=0,Ja=0,Ka=0,pa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],za=new THREE.Matrix4,
+Ia=new Float32Array(16),Ha=new Float32Array(16),Ca=new THREE.Vector4,Ra={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},ma,Ga=[],Ea,La;e=function(){var a;try{if(!(a=oa.getContext("experimental-webgl",{antialias:Wa,stencil:ra,preserveDrawingBuffer:ba})))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(Q.r,Q.g,Q.b,J);(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);Ea=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});La=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
+vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});Ea._shadowPass=!0;La._shadowPass=!0})();this.context=e;var Va=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return e};this.supportsVertexTextures=function(){return Va};this.setSize=function(a,b){oa.width=a;oa.height=b;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(a,b,c,d){Oa=a;Pa=b;Ja=c;Ka=d;e.viewport(Oa,Pa,Ja,Ka)};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){Q.setHex(a);J=b;e.clearColor(Q.r,Q.g,Q.b,J)};this.setClearColor=function(a,b){Q.copy(a);J=b;e.clearColor(Q.r,Q.g,Q.b,J)};this.getClearColor=function(){return Q};this.getClearAlpha=function(){return J};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,
+d){qa(a);this.clear(b,c,d)};this.addPlugin=function(a){a.init(this);this.renderPlugins.push(a)};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);
+C.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),C.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),C.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),C.info.memory.geometries--};this.deallocateTexture=
+function(a){if(a.__webglInit)a.__webglInit=!1,e.deleteTexture(a.__webglTexture),C.info.memory.textures--};this.updateShadowMap=function(a,b){s(a,b)};this.render=function(a,b,c,d){var f,g,h,o,i=a.lights,n=a.fog;wa=-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&&s(a,b);C.info.render.calls=0;C.info.render.vertices=
+0;C.info.render.faces=0;b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ha);b.projectionMatrix.flattenToArray(Ia);za.multiply(b.projectionMatrix,b.matrixWorldInverse);l(za);qa(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);o=a.__webglObjects;d=0;for(f=o.length;d<f;d++)if(g=o[d],h=g.object,g.render=!1,h.visible&&(!(h instanceof THREE.Mesh)||!h.frustumCulled||j(h))){h.matrixWorld.flattenToArray(h._objectMatrixArray);
+G(h,b,!0);var t=g,D=t.object,k=t.buffer,w=void 0,w=w=void 0,w=D.material;if(w instanceof THREE.MeshFaceMaterial){if(w=k.materialIndex,w>=0)w=D.geometry.materials[w],w.transparent?(t.transparent=w,t.opaque=null):(t.opaque=w,t.transparent=null)}else if(w)w.transparent?(t.transparent=w,t.opaque=null):(t.opaque=w,t.transparent=null);g.render=!0;if(this.sortObjects)h.renderDepth?g.z=h.renderDepth:(Ca.copy(h.position),za.multiplyVector3(Ca),g.z=Ca.z)}this.sortObjects&&o.sort(q);o=a.__webglObjectsImmediate;
+d=0;for(f=o.length;d<f;d++)if(g=o[d],h=g.object,h.visible)h.matrixAutoUpdate&&h.matrixWorld.flattenToArray(h._objectMatrixArray),G(h,b,!0),h=g.object.material,h.transparent?(g.transparent=h,g.opaque=null):(g.opaque=h,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),M(a.overrideMaterial.depthTest),E(a.overrideMaterial.depthWrite),na(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),m(a.__webglObjects,
+!1,"",b,i,n,!0,a.overrideMaterial),y(a.__webglObjectsImmediate,"",b,i,n,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),m(a.__webglObjects,!0,"opaque",b,i,n,!1),y(a.__webglObjectsImmediate,"opaque",b,i,n,!1),m(a.__webglObjects,!1,"transparent",b,i,n,!0),y(a.__webglObjectsImmediate,"transparent",b,i,n,!0));if(this.renderPlugins.length){d=0;for(f=this.renderPlugins.length;d<f;d++)this.renderPlugins[d].render(a,b,Ja,Ka,Ia),va=null,xa=Na=Ma=Qa=-1}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=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var i=a.__objectsAdded[0],
+j=a,q=void 0,n=void 0,l=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 l=n,m=void 0,o=void 0,r=void 0,s=void 0,t=void 0,y=void 0,k=void 0,w={},G=l.morphTargets.length;l.geometryGroups={};m=0;for(o=l.faces.length;m<o;m++)r=
+l.faces[m],s=r.materialIndex,y=s!==void 0?s:-1,w[y]===void 0&&(w[y]={hash:y,counter:0}),k=w[y].hash+"_"+w[y].counter,l.geometryGroups[k]===void 0&&(l.geometryGroups[k]={faces3:[],faces4:[],materialIndex:s,vertices:0,numMorphTargets:G}),t=r instanceof THREE.Face3?3:4,l.geometryGroups[k].vertices+t>65535&&(w[y].counter+=1,k=w[y].hash+"_"+w[y].counter,l.geometryGroups[k]===void 0&&(l.geometryGroups[k]={faces3:[],faces4:[],materialIndex:s,vertices:0,numMorphTargets:G})),r instanceof THREE.Face3?l.geometryGroups[k].faces3.push(m):
+l.geometryGroups[k].faces4.push(m),l.geometryGroups[k].vertices+=t;l.geometryGroupsList=[];m=void 0;for(m in l.geometryGroups)l.geometryGroups[m].id=Da++,l.geometryGroupsList.push(l.geometryGroups[m])}for(q in n.geometryGroups)if(l=n.geometryGroups[q],!l.__webglVertexBuffer){m=l;m.__webglVertexBuffer=e.createBuffer();m.__webglNormalBuffer=e.createBuffer();m.__webglTangentBuffer=e.createBuffer();m.__webglColorBuffer=e.createBuffer();m.__webglUVBuffer=e.createBuffer();m.__webglUV2Buffer=e.createBuffer();
+m.__webglSkinVertexABuffer=e.createBuffer();m.__webglSkinVertexBBuffer=e.createBuffer();m.__webglSkinIndicesBuffer=e.createBuffer();m.__webglSkinWeightsBuffer=e.createBuffer();m.__webglFaceBuffer=e.createBuffer();m.__webglLineBuffer=e.createBuffer();if(m.numMorphTargets){r=o=void 0;m.__webglMorphTargetsBuffers=[];o=0;for(r=m.numMorphTargets;o<r;o++)m.__webglMorphTargetsBuffers.push(e.createBuffer())}C.info.memory.geometries++;s=i;t=s.geometry;o=l.faces3;y=l.faces4;m=o.length*3+y.length*4;r=o.length*
+1+y.length*2;y=o.length*3+y.length*4;o=c(s,l);k=g(o);w=d(o);G=f(o);l.__vertexArray=new Float32Array(m*3);if(w)l.__normalArray=new Float32Array(m*3);if(t.hasTangents)l.__tangentArray=new Float32Array(m*4);if(G)l.__colorArray=new Float32Array(m*3);if(k){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)l.__uvArray=new Float32Array(m*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)l.__uv2Array=new Float32Array(m*2)}if(s.geometry.skinWeights.length&&s.geometry.skinIndices.length)l.__skinVertexAArray=
+new Float32Array(m*4),l.__skinVertexBArray=new Float32Array(m*4),l.__skinIndexArray=new Float32Array(m*4),l.__skinWeightArray=new Float32Array(m*4);l.__faceArray=new Uint16Array(r*3);l.__lineArray=new Uint16Array(y*2);if(l.numMorphTargets){l.__morphTargetsArrays=[];s=0;for(t=l.numMorphTargets;s<t;s++)l.__morphTargetsArrays.push(new Float32Array(m*3))}l.__webglFaceCount=r*3;l.__webglLineCount=y*2;if(o.attributes){if(l.__webglCustomAttributesList===void 0)l.__webglCustomAttributesList=[];r=void 0;for(r in o.attributes){var s=
+o.attributes[r],t={},ia;for(ia in s)t[ia]=s[ia];if(!t.__webglInitialized||t.createUniqueBuffers)t.__webglInitialized=!0,y=1,t.type==="v2"?y=2:t.type==="v3"?y=3:t.type==="v4"?y=4:t.type==="c"&&(y=3),t.size=y,t.array=new Float32Array(m*y),t.buffer=e.createBuffer(),t.buffer.belongsToAttribute=r,s.needsUpdate=!0,t.__original=s;l.__webglCustomAttributesList.push(t)}}l.__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)l=n,l.__webglVertexBuffer=e.createBuffer(),l.__webglColorBuffer=e.createBuffer(),C.info.memory.geometries++,l=n,m=l.vertices.length,l.__vertexArray=new Float32Array(m*3),l.__colorArray=new Float32Array(m*3),l.__webglVertexCount=m,n.__dirtyVertices=!0,n.__dirtyColors=!0}else if(i instanceof THREE.Line){if(n=i.geometry,!n.__webglVertexBuffer)l=n,l.__webglVertexBuffer=e.createBuffer(),l.__webglColorBuffer=
+e.createBuffer(),C.info.memory.geometries++,l=n,m=i,o=l.vertices.length,l.__vertexArray=new Float32Array(o*3),l.__colorArray=new Float32Array(o*3),l.__webglLineCount=o,b(l,m),n.__dirtyVertices=!0,n.__dirtyColors=!0}else if(i instanceof THREE.ParticleSystem&&(n=i.geometry,!n.__webglVertexBuffer))l=n,l.__webglVertexBuffer=e.createBuffer(),l.__webglColorBuffer=e.createBuffer(),C.info.geometries++,l=n,m=i,o=l.vertices.length,l.__vertexArray=new Float32Array(o*3),l.__colorArray=new Float32Array(o*3),l.__sortArray=
+[],l.__webglParticleCount=o,b(l,m),n.__dirtyVertices=!0,n.__dirtyColors=!0;if(!i.__webglActive){if(i instanceof THREE.Mesh)for(q in n=i.geometry,n.geometryGroups)l=n.geometryGroups[q],D(j.__webglObjects,l,i);else i instanceof THREE.Ribbon||i instanceof THREE.Line||i instanceof THREE.ParticleSystem?(n=i.geometry,D(j.__webglObjects,n,i)):THREE.MarchingCubes!==void 0&&i instanceof THREE.MarchingCubes||i.immediateRenderCallback?j.__webglObjectsImmediate.push({object:i,opaque:null,transparent:null}):i instanceof
+THREE.Sprite?j.__webglSprites.push(i):i instanceof THREE.LensFlare&&j.__webglFlares.push(i);i.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)i=a.__objectsRemoved[0],j=a,i instanceof THREE.Mesh||i instanceof THREE.ParticleSystem||i instanceof THREE.Ribbon||i instanceof THREE.Line?fa(j.__webglObjects,i):i instanceof THREE.Sprite?la(j.__webglSprites,i):i instanceof THREE.LensFlare?la(j.__webglFlares,i):(i instanceof THREE.MarchingCubes||i.immediateRenderCallback)&&fa(j.__webglObjectsImmediate,
+i),i.__webglActive=!1,a.__objectsRemoved.splice(0,1);i=0;for(j=a.__webglObjects.length;i<j;i++)if(ia=a.__webglObjects[i].object,q=ia.geometry,n=r=o=void 0,ia instanceof THREE.Mesh){l=0;for(m=q.geometryGroupsList.length;l<m;l++)if(o=q.geometryGroupsList[l],n=c(ia,o),r=n.attributes&&L(n),q.__dirtyVertices||q.__dirtyMorphTargets||q.__dirtyElements||q.__dirtyUvs||q.__dirtyNormals||q.__dirtyColors||q.__dirtyTangents||r){var I=ia,r=e.DYNAMIC_DRAW,s=!q.dynamic,k=n;if(o.__inittedArrays){var t=d(k),y=f(k),
+J=g(k),M=t===THREE.SmoothShading,E=w=k=void 0,v=void 0,Y=void 0,K=void 0,x=void 0,aa=void 0,O=void 0,Q=E=void 0,z=void 0,A=void 0,B=void 0,Z=v=void 0,ca=void 0,ja=void 0,S=v=O=void 0,T=void 0,N=B=A=z=x=void 0,F=v=B=A=z=N=B=A=z=N=B=A=z=void 0,H=void 0,R=K=void 0,$=void 0,V=void 0,ka=void 0,da=void 0,ga=Q=V=H=0,ba=0,X=F=E=0,P=x=Z=0,u=0,ea=void 0,P=o.__vertexArray,$=o.__uvArray,u=o.__uv2Array,R=o.__normalArray,Y=o.__tangentArray,ca=o.__colorArray,S=o.__skinVertexAArray,T=o.__skinVertexBArray,aa=o.__skinIndexArray,
+ha=o.__skinWeightArray,N=o.__morphTargetsArrays,G=o.__webglCustomAttributesList,p=void 0,p=o.__faceArray,ea=o.__lineArray,ja=I.geometry,oa=ja.__dirtyElements,na=ja.__dirtyUvs,K=ja.__dirtyNormals,O=ja.__dirtyTangents,qa=ja.__dirtyColors,ka=ja.__dirtyMorphTargets,da=ja.vertices,I=o.faces3,U=o.faces4,W=ja.faces,ma=ja.faceVertexUvs[0],va=ja.faceVertexUvs[1],pa=ja.skinVerticesA,ra=ja.skinVerticesB,ua=ja.skinIndices,ta=ja.skinWeights,wa=ja.morphTargets;if(ja.__dirtyVertices){k=0;for(w=I.length;k<w;k++)v=
+W[I[k]],z=da[v.a].position,A=da[v.b].position,B=da[v.c].position,P[V]=z.x,P[V+1]=z.y,P[V+2]=z.z,P[V+3]=A.x,P[V+4]=A.y,P[V+5]=A.z,P[V+6]=B.x,P[V+7]=B.y,P[V+8]=B.z,V+=9;k=0;for(w=U.length;k<w;k++)v=W[U[k]],z=da[v.a].position,A=da[v.b].position,B=da[v.c].position,v=da[v.d].position,P[V]=z.x,P[V+1]=z.y,P[V+2]=z.z,P[V+3]=A.x,P[V+4]=A.y,P[V+5]=A.z,P[V+6]=B.x,P[V+7]=B.y,P[V+8]=B.z,P[V+9]=v.x,P[V+10]=v.y,P[V+11]=v.z,V+=12;e.bindBuffer(e.ARRAY_BUFFER,o.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,P,r)}if(ka){V=
+0;for(ka=wa.length;V<ka;V++){k=P=0;for(w=I.length;k<w;k++)v=W[I[k]],z=wa[V].vertices[v.a].position,A=wa[V].vertices[v.b].position,B=wa[V].vertices[v.c].position,da=N[V],da[P]=z.x,da[P+1]=z.y,da[P+2]=z.z,da[P+3]=A.x,da[P+4]=A.y,da[P+5]=A.z,da[P+6]=B.x,da[P+7]=B.y,da[P+8]=B.z,P+=9;k=0;for(w=U.length;k<w;k++)v=W[U[k]],z=wa[V].vertices[v.a].position,A=wa[V].vertices[v.b].position,B=wa[V].vertices[v.c].position,v=wa[V].vertices[v.d].position,da=N[V],da[P]=z.x,da[P+1]=z.y,da[P+2]=z.z,da[P+3]=A.x,da[P+4]=
+A.y,da[P+5]=A.z,da[P+6]=B.x,da[P+7]=B.y,da[P+8]=B.z,da[P+9]=v.x,da[P+10]=v.y,da[P+11]=v.z,P+=12;e.bindBuffer(e.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[V]);e.bufferData(e.ARRAY_BUFFER,N[V],r)}}if(ta.length){k=0;for(w=I.length;k<w;k++)v=W[I[k]],z=ta[v.a],A=ta[v.b],B=ta[v.c],ha[x]=z.x,ha[x+1]=z.y,ha[x+2]=z.z,ha[x+3]=z.w,ha[x+4]=A.x,ha[x+5]=A.y,ha[x+6]=A.z,ha[x+7]=A.w,ha[x+8]=B.x,ha[x+9]=B.y,ha[x+10]=B.z,ha[x+11]=B.w,z=ua[v.a],A=ua[v.b],B=ua[v.c],aa[x]=z.x,aa[x+1]=z.y,aa[x+2]=z.z,aa[x+3]=z.w,aa[x+4]=
+A.x,aa[x+5]=A.y,aa[x+6]=A.z,aa[x+7]=A.w,aa[x+8]=B.x,aa[x+9]=B.y,aa[x+10]=B.z,aa[x+11]=B.w,z=pa[v.a],A=pa[v.b],B=pa[v.c],S[x]=z.x,S[x+1]=z.y,S[x+2]=z.z,S[x+3]=1,S[x+4]=A.x,S[x+5]=A.y,S[x+6]=A.z,S[x+7]=1,S[x+8]=B.x,S[x+9]=B.y,S[x+10]=B.z,S[x+11]=1,z=ra[v.a],A=ra[v.b],B=ra[v.c],T[x]=z.x,T[x+1]=z.y,T[x+2]=z.z,T[x+3]=1,T[x+4]=A.x,T[x+5]=A.y,T[x+6]=A.z,T[x+7]=1,T[x+8]=B.x,T[x+9]=B.y,T[x+10]=B.z,T[x+11]=1,x+=12;k=0;for(w=U.length;k<w;k++)v=W[U[k]],z=ta[v.a],A=ta[v.b],B=ta[v.c],N=ta[v.d],ha[x]=z.x,ha[x+1]=
+z.y,ha[x+2]=z.z,ha[x+3]=z.w,ha[x+4]=A.x,ha[x+5]=A.y,ha[x+6]=A.z,ha[x+7]=A.w,ha[x+8]=B.x,ha[x+9]=B.y,ha[x+10]=B.z,ha[x+11]=B.w,ha[x+12]=N.x,ha[x+13]=N.y,ha[x+14]=N.z,ha[x+15]=N.w,z=ua[v.a],A=ua[v.b],B=ua[v.c],N=ua[v.d],aa[x]=z.x,aa[x+1]=z.y,aa[x+2]=z.z,aa[x+3]=z.w,aa[x+4]=A.x,aa[x+5]=A.y,aa[x+6]=A.z,aa[x+7]=A.w,aa[x+8]=B.x,aa[x+9]=B.y,aa[x+10]=B.z,aa[x+11]=B.w,aa[x+12]=N.x,aa[x+13]=N.y,aa[x+14]=N.z,aa[x+15]=N.w,z=pa[v.a],A=pa[v.b],B=pa[v.c],N=pa[v.d],S[x]=z.x,S[x+1]=z.y,S[x+2]=z.z,S[x+3]=1,S[x+4]=
+A.x,S[x+5]=A.y,S[x+6]=A.z,S[x+7]=1,S[x+8]=B.x,S[x+9]=B.y,S[x+10]=B.z,S[x+11]=1,S[x+12]=N.x,S[x+13]=N.y,S[x+14]=N.z,S[x+15]=1,z=ra[v.a],A=ra[v.b],B=ra[v.c],v=ra[v.d],T[x]=z.x,T[x+1]=z.y,T[x+2]=z.z,T[x+3]=1,T[x+4]=A.x,T[x+5]=A.y,T[x+6]=A.z,T[x+7]=1,T[x+8]=B.x,T[x+9]=B.y,T[x+10]=B.z,T[x+11]=1,T[x+12]=v.x,T[x+13]=v.y,T[x+14]=v.z,T[x+15]=1,x+=16;x>0&&(e.bindBuffer(e.ARRAY_BUFFER,o.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,S,r),e.bindBuffer(e.ARRAY_BUFFER,o.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,
+T,r),e.bindBuffer(e.ARRAY_BUFFER,o.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,aa,r),e.bindBuffer(e.ARRAY_BUFFER,o.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ha,r))}if(qa&&y){k=0;for(w=I.length;k<w;k++)v=W[I[k]],x=v.vertexColors,aa=v.color,x.length===3&&y===THREE.VertexColors?(v=x[0],S=x[1],T=x[2]):T=S=v=aa,ca[Z]=v.r,ca[Z+1]=v.g,ca[Z+2]=v.b,ca[Z+3]=S.r,ca[Z+4]=S.g,ca[Z+5]=S.b,ca[Z+6]=T.r,ca[Z+7]=T.g,ca[Z+8]=T.b,Z+=9;k=0;for(w=U.length;k<w;k++)v=W[U[k]],x=v.vertexColors,aa=v.color,
+x.length===4&&y===THREE.VertexColors?(v=x[0],S=x[1],T=x[2],x=x[3]):x=T=S=v=aa,ca[Z]=v.r,ca[Z+1]=v.g,ca[Z+2]=v.b,ca[Z+3]=S.r,ca[Z+4]=S.g,ca[Z+5]=S.b,ca[Z+6]=T.r,ca[Z+7]=T.g,ca[Z+8]=T.b,ca[Z+9]=x.r,ca[Z+10]=x.g,ca[Z+11]=x.b,Z+=12;Z>0&&(e.bindBuffer(e.ARRAY_BUFFER,o.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,ca,r))}if(O&&ja.hasTangents){k=0;for(w=I.length;k<w;k++)v=W[I[k]],O=v.vertexTangents,Z=O[0],ca=O[1],ja=O[2],Y[F]=Z.x,Y[F+1]=Z.y,Y[F+2]=Z.z,Y[F+3]=Z.w,Y[F+4]=ca.x,Y[F+5]=ca.y,Y[F+6]=ca.z,Y[F+
+7]=ca.w,Y[F+8]=ja.x,Y[F+9]=ja.y,Y[F+10]=ja.z,Y[F+11]=ja.w,F+=12;k=0;for(w=U.length;k<w;k++)v=W[U[k]],O=v.vertexTangents,Z=O[0],ca=O[1],ja=O[2],O=O[3],Y[F]=Z.x,Y[F+1]=Z.y,Y[F+2]=Z.z,Y[F+3]=Z.w,Y[F+4]=ca.x,Y[F+5]=ca.y,Y[F+6]=ca.z,Y[F+7]=ca.w,Y[F+8]=ja.x,Y[F+9]=ja.y,Y[F+10]=ja.z,Y[F+11]=ja.w,Y[F+12]=O.x,Y[F+13]=O.y,Y[F+14]=O.z,Y[F+15]=O.w,F+=16;e.bindBuffer(e.ARRAY_BUFFER,o.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,Y,r)}if(K&&t){k=0;for(w=I.length;k<w;k++)if(v=W[I[k]],Y=v.vertexNormals,K=v.normal,
+Y.length===3&&M)for(F=0;F<3;F++)K=Y[F],R[E]=K.x,R[E+1]=K.y,R[E+2]=K.z,E+=3;else for(F=0;F<3;F++)R[E]=K.x,R[E+1]=K.y,R[E+2]=K.z,E+=3;k=0;for(w=U.length;k<w;k++)if(v=W[U[k]],Y=v.vertexNormals,K=v.normal,Y.length===4&&M)for(F=0;F<4;F++)K=Y[F],R[E]=K.x,R[E+1]=K.y,R[E+2]=K.z,E+=3;else for(F=0;F<4;F++)R[E]=K.x,R[E+1]=K.y,R[E+2]=K.z,E+=3;e.bindBuffer(e.ARRAY_BUFFER,o.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,R,r)}if(na&&ma&&J){k=0;for(w=I.length;k<w;k++)if(E=I[k],E=ma[E],E!==void 0)for(F=0;F<3;F++)R=
+E[F],$[Q]=R.u,$[Q+1]=R.v,Q+=2;k=0;for(w=U.length;k<w;k++)if(E=U[k],E=ma[E],E!==void 0)for(F=0;F<4;F++)R=E[F],$[Q]=R.u,$[Q+1]=R.v,Q+=2;Q>0&&(e.bindBuffer(e.ARRAY_BUFFER,o.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,$,r))}if(na&&va&&J){k=0;for(w=I.length;k<w;k++)if(E=I[k],Q=va[E],Q!==void 0)for(F=0;F<3;F++)$=Q[F],u[ga]=$.u,u[ga+1]=$.v,ga+=2;k=0;for(w=U.length;k<w;k++)if(E=U[k],Q=va[E],Q!==void 0)for(F=0;F<4;F++)$=Q[F],u[ga]=$.u,u[ga+1]=$.v,ga+=2;ga>0&&(e.bindBuffer(e.ARRAY_BUFFER,o.__webglUV2Buffer),
+e.bufferData(e.ARRAY_BUFFER,u,r))}if(oa){k=0;for(w=I.length;k<w;k++)p[ba]=H,p[ba+1]=H+1,p[ba+2]=H+2,ba+=3,ea[X]=H,ea[X+1]=H+1,ea[X+2]=H,ea[X+3]=H+2,ea[X+4]=H+1,ea[X+5]=H+2,X+=6,H+=3;k=0;for(w=U.length;k<w;k++)p[ba]=H,p[ba+1]=H+1,p[ba+2]=H+3,p[ba+3]=H+1,p[ba+4]=H+2,p[ba+5]=H+3,ba+=6,ea[X]=H,ea[X+1]=H+1,ea[X+2]=H,ea[X+3]=H+3,ea[X+4]=H+1,ea[X+5]=H+2,ea[X+6]=H+2,ea[X+7]=H+3,X+=8,H+=4;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,p,r);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
+o.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ea,r)}if(G){F=0;for(H=G.length;F<H;F++)if(p=G[F],p.__original.needsUpdate){u=0;if(p.size===1)if(p.boundTo===void 0||p.boundTo==="vertices"){k=0;for(w=I.length;k<w;k++)v=W[I[k]],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;k=0;for(w=U.length;k<w;k++)v=W[U[k]],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"){k=0;for(w=I.length;k<
+w;k++)ea=p.value[I[k]],p.array[u]=ea,p.array[u+1]=ea,p.array[u+2]=ea,u+=3;k=0;for(w=U.length;k<w;k++)ea=p.value[U[k]],p.array[u]=ea,p.array[u+1]=ea,p.array[u+2]=ea,p.array[u+3]=ea,u+=4}}else if(p.size===2)if(p.boundTo===void 0||p.boundTo==="vertices"){k=0;for(w=I.length;k<w;k++)v=W[I[k]],z=p.value[v.a],A=p.value[v.b],B=p.value[v.c],p.array[u]=z.x,p.array[u+1]=z.y,p.array[u+2]=A.x,p.array[u+3]=A.y,p.array[u+4]=B.x,p.array[u+5]=B.y,u+=6;k=0;for(w=U.length;k<w;k++)v=W[U[k]],z=p.value[v.a],A=p.value[v.b],
+B=p.value[v.c],v=p.value[v.d],p.array[u]=z.x,p.array[u+1]=z.y,p.array[u+2]=A.x,p.array[u+3]=A.y,p.array[u+4]=B.x,p.array[u+5]=B.y,p.array[u+6]=v.x,p.array[u+7]=v.y,u+=8}else{if(p.boundTo==="faces"){k=0;for(w=I.length;k<w;k++)B=A=z=ea=p.value[I[k]],p.array[u]=z.x,p.array[u+1]=z.y,p.array[u+2]=A.x,p.array[u+3]=A.y,p.array[u+4]=B.x,p.array[u+5]=B.y,u+=6;k=0;for(w=U.length;k<w;k++)v=B=A=z=ea=p.value[U[k]],p.array[u]=z.x,p.array[u+1]=z.y,p.array[u+2]=A.x,p.array[u+3]=A.y,p.array[u+4]=B.x,p.array[u+5]=
+B.y,p.array[u+6]=v.x,p.array[u+7]=v.y,u+=8}}else if(p.size===3)if(t=p.type==="c"?["r","g","b"]:["x","y","z"],p.boundTo===void 0||p.boundTo==="vertices"){k=0;for(w=I.length;k<w;k++)v=W[I[k]],z=p.value[v.a],A=p.value[v.b],B=p.value[v.c],p.array[u]=z[t[0]],p.array[u+1]=z[t[1]],p.array[u+2]=z[t[2]],p.array[u+3]=A[t[0]],p.array[u+4]=A[t[1]],p.array[u+5]=A[t[2]],p.array[u+6]=B[t[0]],p.array[u+7]=B[t[1]],p.array[u+8]=B[t[2]],u+=9;k=0;for(w=U.length;k<w;k++)v=W[U[k]],z=p.value[v.a],A=p.value[v.b],B=p.value[v.c],
+v=p.value[v.d],p.array[u]=z[t[0]],p.array[u+1]=z[t[1]],p.array[u+2]=z[t[2]],p.array[u+3]=A[t[0]],p.array[u+4]=A[t[1]],p.array[u+5]=A[t[2]],p.array[u+6]=B[t[0]],p.array[u+7]=B[t[1]],p.array[u+8]=B[t[2]],p.array[u+9]=v[t[0]],p.array[u+10]=v[t[1]],p.array[u+11]=v[t[2]],u+=12}else{if(p.boundTo==="faces"){k=0;for(w=I.length;k<w;k++)B=A=z=ea=p.value[I[k]],p.array[u]=z[t[0]],p.array[u+1]=z[t[1]],p.array[u+2]=z[t[2]],p.array[u+3]=A[t[0]],p.array[u+4]=A[t[1]],p.array[u+5]=A[t[2]],p.array[u+6]=B[t[0]],p.array[u+
+7]=B[t[1]],p.array[u+8]=B[t[2]],u+=9;k=0;for(w=U.length;k<w;k++)v=B=A=z=ea=p.value[U[k]],p.array[u]=z[t[0]],p.array[u+1]=z[t[1]],p.array[u+2]=z[t[2]],p.array[u+3]=A[t[0]],p.array[u+4]=A[t[1]],p.array[u+5]=A[t[2]],p.array[u+6]=B[t[0]],p.array[u+7]=B[t[1]],p.array[u+8]=B[t[2]],p.array[u+9]=v[t[0]],p.array[u+10]=v[t[1]],p.array[u+11]=v[t[2]],u+=12}}else if(p.size===4)if(p.boundTo===void 0||p.boundTo==="vertices"){k=0;for(w=I.length;k<w;k++)v=W[I[k]],z=p.value[v.a],A=p.value[v.b],B=p.value[v.c],p.array[u]=
+z.x,p.array[u+1]=z.y,p.array[u+2]=z.z,p.array[u+3]=z.w,p.array[u+4]=A.x,p.array[u+5]=A.y,p.array[u+6]=A.z,p.array[u+7]=A.w,p.array[u+8]=B.x,p.array[u+9]=B.y,p.array[u+10]=B.z,p.array[u+11]=B.w,u+=12;k=0;for(w=U.length;k<w;k++)v=W[U[k]],z=p.value[v.a],A=p.value[v.b],B=p.value[v.c],v=p.value[v.d],p.array[u]=z.x,p.array[u+1]=z.y,p.array[u+2]=z.z,p.array[u+3]=z.w,p.array[u+4]=A.x,p.array[u+5]=A.y,p.array[u+6]=A.z,p.array[u+7]=A.w,p.array[u+8]=B.x,p.array[u+9]=B.y,p.array[u+10]=B.z,p.array[u+11]=B.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"){k=0;for(w=I.length;k<w;k++)B=A=z=ea=p.value[I[k]],p.array[u]=z.x,p.array[u+1]=z.y,p.array[u+2]=z.z,p.array[u+3]=z.w,p.array[u+4]=A.x,p.array[u+5]=A.y,p.array[u+6]=A.z,p.array[u+7]=A.w,p.array[u+8]=B.x,p.array[u+9]=B.y,p.array[u+10]=B.z,p.array[u+11]=B.w,u+=12;k=0;for(w=U.length;k<w;k++)v=B=A=z=ea=p.value[U[k]],p.array[u]=z.x,p.array[u+1]=z.y,p.array[u+2]=z.z,p.array[u+3]=z.w,p.array[u+4]=A.x,p.array[u+
+5]=A.y,p.array[u+6]=A.z,p.array[u+7]=A.w,p.array[u+8]=B.x,p.array[u+9]=B.y,p.array[u+10]=B.z,p.array[u+11]=B.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)}}s&&(delete o.__inittedArrays,delete o.__colorArray,delete o.__normalArray,delete o.__tangentArray,delete o.__uvArray,delete o.__uv2Array,delete o.__faceArray,delete o.__vertexArray,delete o.__lineArray,delete o.__skinVertexAArray,delete o.__skinVertexBArray,
+delete o.__skinIndexArray,delete o.__skinWeightArray)}}q.__dirtyVertices=!1;q.__dirtyMorphTargets=!1;q.__dirtyElements=!1;q.__dirtyUvs=!1;q.__dirtyNormals=!1;q.__dirtyColors=!1;q.__dirtyTangents=!1;n.attributes&&sa(n)}else if(ia instanceof THREE.Ribbon){if(q.__dirtyVertices||q.__dirtyColors){n=q;ia=e.DYNAMIC_DRAW;t=l=t=s=s=void 0;y=n.vertices;m=n.colors;k=y.length;o=m.length;w=n.__vertexArray;r=n.__colorArray;G=n.__dirtyColors;if(n.__dirtyVertices){for(s=0;s<k;s++)t=y[s].position,l=s*3,w[l]=t.x,w[l+
+1]=t.y,w[l+2]=t.z;e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,w,ia)}if(G){for(s=0;s<o;s++)t=m[s],l=s*3,r[l]=t.r,r[l+1]=t.g,r[l+2]=t.b;e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,r,ia)}}q.__dirtyVertices=!1;q.__dirtyColors=!1}else if(ia instanceof THREE.Line){n=c(ia,o);r=n.attributes&&L(n);if(q.__dirtyVertices||q.__dirtyColors||r){ia=q;l=e.DYNAMIC_DRAW;k=m=M=y=J=void 0;y=ia.vertices;o=ia.colors;k=y.length;r=o.length;w=ia.__vertexArray;
+s=ia.__colorArray;G=ia.__dirtyColors;t=ia.__webglCustomAttributesList;H=W=U=I=M=J=void 0;if(ia.__dirtyVertices){for(J=0;J<k;J++)M=y[J].position,m=J*3,w[m]=M.x,w[m+1]=M.y,w[m+2]=M.z;e.bindBuffer(e.ARRAY_BUFFER,ia.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,w,l)}if(G){for(y=0;y<r;y++)k=o[y],m=y*3,s[m]=k.r,s[m+1]=k.g,s[m+2]=k.b;e.bindBuffer(e.ARRAY_BUFFER,ia.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,s,l)}if(t){J=0;for(M=t.length;J<M;J++)if(H=t[J],H.needsUpdate&&(H.boundTo===void 0||H.boundTo===
+"vertices")){m=0;U=H.value.length;if(H.size===1)for(I=0;I<U;I++)H.array[I]=H.value[I];else if(H.size===2)for(I=0;I<U;I++)W=H.value[I],H.array[m]=W.x,H.array[m+1]=W.y,m+=2;else if(H.size===3)if(H.type==="c")for(I=0;I<U;I++)W=H.value[I],H.array[m]=W.r,H.array[m+1]=W.g,H.array[m+2]=W.b,m+=3;else for(I=0;I<U;I++)W=H.value[I],H.array[m]=W.x,H.array[m+1]=W.y,H.array[m+2]=W.z,m+=3;else if(H.size===4)for(I=0;I<U;I++)W=H.value[I],H.array[m]=W.x,H.array[m+1]=W.y,H.array[m+2]=W.z,H.array[m+3]=W.w,m+=4;e.bindBuffer(e.ARRAY_BUFFER,
+H.buffer);e.bufferData(e.ARRAY_BUFFER,H.array,l)}}}q.__dirtyVertices=!1;q.__dirtyColors=!1;n.attributes&&sa(n)}else if(ia instanceof THREE.ParticleSystem)n=c(ia,o),r=n.attributes&&L(n),(q.__dirtyVertices||q.__dirtyColors||ia.sortParticles||r)&&h(q,e.DYNAMIC_DRAW,ia),q.__dirtyVertices=!1,q.__dirtyColors=!1,n.attributes&&sa(n)};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 l,n,q;l=q=j=0;for(n=b.length;l<n;l++)h=b[l],h instanceof THREE.SpotLight&&q++,h instanceof THREE.DirectionalLight&&q++,h instanceof THREE.PointLight&&
+j++;j+q<=R?l=q:(l=Math.ceil(R*q/(j+q)),j=R-l);h={directional:l,point:j};j=q=0;for(l=b.length;j<l;j++)n=b[j],n instanceof THREE.SpotLight&&n.castShadow&&q++;var k=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)k=d.bones.length;var m;a:{l=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:k,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},s,d=[];i?d.push(i):(d.push(l),d.push(n));for(s in c)d.push(s),d.push(c[s]);i=d.join();s=0;for(d=O.length;s<d;s++)if(O[s].code===i){m=O[s].program;break a}s=e.createProgram();d=[Va?"#define VERTEX_TEXTURES":"",
+C.gammaInput?"#define GAMMA_INPUT":"",C.gammaOutput?"#define GAMMA_OUTPUT":"",C.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 "+Ba+" 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:"",F.gammaInput?"#define GAMMA_INPUT":"",F.gammaOutput?"#define GAMMA_OUTPUT":"",F.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+o));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=R.length;R.push({program:r,code:i});F.info.memory.programs=R.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)};this.setBlending=function(a){if(a!==Na){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)}Na=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=d.createTexture(),F.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);
-var c=ba(d.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0,ia(a.format),a.image.width,a.image.height,0,ia(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);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)}};
+h=["#ifdef GL_ES","precision "+Aa+" 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:"",C.gammaInput?"#define GAMMA_INPUT":"",C.gammaOutput?"#define GAMMA_OUTPUT":"",C.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");e.attachShader(s,K("fragment",h+l));e.attachShader(s,
+K("vertex",d+n));e.linkProgram(s);e.getProgramParameter(s,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(s,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");s.uniforms={};s.attributes={};var y,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in j)d.push(y);y=d;d=0;for(j=y.length;d<j;d++)l=y[d],s.uniforms[l]=e.getUniformLocation(s,
+l);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(y=0;y<c.maxMorphTargets;y++)d.push("morphTarget"+y);for(m in b)d.push(m);m=d;y=0;for(b=m.length;y<b;y++)c=m[y],s.attributes[c]=e.getAttribLocation(s,c);s.id=O.length;O.push({program:s,code:i});C.info.memory.programs=O.length;m=s}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++)y="morphTarget"+g,m[y]>=0&&(e.enableVertexAttribArray(m[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"?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)};this.setBlending=function(a){if(a!==Qa){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)}Qa=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=e.createTexture(),C.info.memory.textures++;e.activeTexture(e.TEXTURE0+b);e.bindTexture(e.TEXTURE_2D,a.__webglTexture);
+var c=$(e.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,ga(a.format),a.image.width,a.image.height,0,ga(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)}};
 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};

+ 4 - 0
examples/webgl_sprites.html

@@ -113,6 +113,10 @@
 
 				container.appendChild( renderer.domElement );
 
+				renderer.addPlugin( new THREE.SpritePlugin() );
+
+				// stats
+
 				stats = new Stats();
 				stats.domElement.style.position = 'absolute';
 				stats.domElement.style.top = '0px';

+ 1 - 218
src/renderers/WebGLRenderer.js

@@ -162,18 +162,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 	var _cameraLight, _shadowMatrix = [];
 	var _depthMaterial, _depthMaterialMorph;
 
-	// sprites
-
-	var _sprite = {};
-	var _spriteAttributesEnabled = false;
-
 	// initialize
 
 	_gl = initGL();
 
 	setDefaultGLState();
 
-	initSprites();
 	initShadowmaps();
 
 	this.context = _gl;
@@ -3202,21 +3196,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		// render 2d
-
-		if ( scene.__webglSprites.length ) {
-
-			renderSprites( scene, camera );
-
-		}
-
 		// custom render plugins
 
 		if ( this.renderPlugins.length ) {
 
 			for ( i = 0, il = this.renderPlugins.length; i < il; i ++ ) {
 
-				this.renderPlugins[ i ].render( scene, camera, _viewportWidth, _viewportHeight );
+				this.renderPlugins[ i ].render( scene, camera, _viewportWidth, _viewportHeight, _projectionMatrixArray );
 
 				_currentProgram = null;
 				_oldBlending = -1;
@@ -3615,143 +3601,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
-	function renderSprites ( scene, camera ) {
-
-		var o, ol, object;
-		var attributes = _sprite.attributes;
-		var uniforms = _sprite.uniforms;
-		var invAspect = _viewportHeight / _viewportWidth;
-		var size, scale = [];
-		var screenPosition;
-		var halfViewportWidth = _viewportWidth * 0.5;
-		var halfViewportHeight = _viewportHeight * 0.5;
-		var mergeWith3D = true;
-
-		// setup gl
-
-		_gl.useProgram( _sprite.program );
-		_currentProgram = _sprite.program;
-		_oldBlending = -1;
-		_oldDepthTest = -1;
-		_currentGeometryGroupHash = -1;
-
-		if ( !_spriteAttributesEnabled ) {
-
-			_gl.enableVertexAttribArray( _sprite.attributes.position );
-			_gl.enableVertexAttribArray( _sprite.attributes.uv );
-
-			_spriteAttributesEnabled = true;
-
-		}
-
-		_gl.disable( _gl.CULL_FACE );
-		_gl.enable( _gl.BLEND );
-		_gl.depthMask( true );
-
-		_gl.bindBuffer( _gl.ARRAY_BUFFER, _sprite.vertexBuffer );
-		_gl.vertexAttribPointer( attributes.position, 2, _gl.FLOAT, false, 2 * 8, 0 );
-		_gl.vertexAttribPointer( attributes.uv, 2, _gl.FLOAT, false, 2 * 8, 8 );
-
-		_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, _sprite.elementBuffer );
-
-		_gl.uniformMatrix4fv( uniforms.projectionMatrix, false, _projectionMatrixArray );
-
-		_gl.activeTexture( _gl.TEXTURE0 );
-		_gl.uniform1i( uniforms.map, 0 );
-
-		// update positions and sort
-
-		for( o = 0, ol = scene.__webglSprites.length; o < ol; o ++ ) {
-
-			object = scene.__webglSprites[ o ];
-
-			if ( !object.visible || object.opacity === 0 ) continue;
-
-			if( !object.useScreenCoordinates ) {
-
-				object._modelViewMatrix.multiplyToArray( camera.matrixWorldInverse, object.matrixWorld, object._modelViewMatrixArray );
-				object.z = -object._modelViewMatrix.n34;
-
-			} else {
-
-				object.z = -object.position.z;
-
-			}
-
-		}
-
-		scene.__webglSprites.sort( painterSort );
-
-		// render all sprites
-
-		for ( o = 0, ol = scene.__webglSprites.length; o < ol; o ++ ) {
-
-			object = scene.__webglSprites[ o ];
-
-			if ( !object.visible || object.opacity === 0 ) continue;
-
-			if ( object.map && object.map.image && object.map.image.width ) {
-
-				if ( object.useScreenCoordinates ) {
-
-					_gl.uniform1i( uniforms.useScreenCoordinates, 1 );
-					_gl.uniform3f( uniforms.screenPosition, ( object.position.x - halfViewportWidth  ) / halfViewportWidth,
-															( halfViewportHeight - object.position.y ) / halfViewportHeight,
-															  Math.max( 0, Math.min( 1, object.position.z )));
-
-				} else {
-
-					_gl.uniform1i( uniforms.useScreenCoordinates, 0 );
-					_gl.uniform1i( uniforms.affectedByDistance, object.affectedByDistance ? 1 : 0 );
-					_gl.uniformMatrix4fv( uniforms.modelViewMatrix, false, object._modelViewMatrixArray );
-
-				}
-
-				size = object.map.image.width / ( object.scaleByViewport ? _viewportHeight : 1 );
-
-				scale[ 0 ] = size * invAspect * object.scale.x;
-				scale[ 1 ] = size * object.scale.y;
-
-				_gl.uniform2f( uniforms.uvScale, object.uvScale.x, object.uvScale.y );
-				_gl.uniform2f( uniforms.uvOffset, object.uvOffset.x, object.uvOffset.y );
-				_gl.uniform2f( uniforms.alignment, object.alignment.x, object.alignment.y );
-
-				_gl.uniform1f( uniforms.opacity, object.opacity );
-				_gl.uniform3f( uniforms.color, object.color.r, object.color.g, object.color.b );
-
-				_gl.uniform1f( uniforms.rotation, object.rotation );
-				_gl.uniform2fv( uniforms.scale, scale );
-
-				if ( object.mergeWith3D && !mergeWith3D ) {
-
-					_gl.enable( _gl.DEPTH_TEST );
-					mergeWith3D = true;
-
-				} else if ( !object.mergeWith3D && mergeWith3D ) {
-
-					_gl.disable( _gl.DEPTH_TEST );
-					mergeWith3D = false;
-
-				}
-
-				_this.setBlending( object.blending );
-				_this.setTexture( object.map, 0 );
-
-				_gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 );
-
-			}
-
-		}
-
-
-		// restore gl
-
-		_gl.enable( _gl.CULL_FACE );
-		_gl.enable( _gl.DEPTH_TEST );
-		_gl.depthMask( _oldDepthWrite );
-
-	}
-
 	// Geometry splitting
 
 	function sortFacesByMaterial ( geometry ) {
@@ -5917,72 +5766,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	// Initialization
 
-	function initSprites () {
-
-		_sprite.vertices = new Float32Array( 8 + 8 );
-		_sprite.faces    = new Uint16Array( 6 );
-
-		var i = 0;
-
-		_sprite.vertices[ i++ ] = -1; _sprite.vertices[ i++ ] = -1;	// vertex 0
-		_sprite.vertices[ i++ ] = 0;  _sprite.vertices[ i++ ] = 1;	// uv 0
-
-		_sprite.vertices[ i++ ] = 1;  _sprite.vertices[ i++ ] = -1;	// vertex 1
-		_sprite.vertices[ i++ ] = 1;  _sprite.vertices[ i++ ] = 1;	// uv 1
-
-		_sprite.vertices[ i++ ] = 1;  _sprite.vertices[ i++ ] = 1;	// vertex 2
-		_sprite.vertices[ i++ ] = 1;  _sprite.vertices[ i++ ] = 0;	// uv 2
-
-		_sprite.vertices[ i++ ] = -1; _sprite.vertices[ i++ ] = 1;	// vertex 3
-		_sprite.vertices[ i++ ] = 0;  _sprite.vertices[ i++ ] = 0;	// uv 3
-
-		i = 0;
-
-		_sprite.faces[ i++ ] = 0; _sprite.faces[ i++ ] = 1; _sprite.faces[ i++ ] = 2;
-		_sprite.faces[ i++ ] = 0; _sprite.faces[ i++ ] = 2; _sprite.faces[ i++ ] = 3;
-
-		_sprite.vertexBuffer  = _gl.createBuffer();
-		_sprite.elementBuffer = _gl.createBuffer();
-
-		_gl.bindBuffer( _gl.ARRAY_BUFFER, _sprite.vertexBuffer );
-		_gl.bufferData( _gl.ARRAY_BUFFER, _sprite.vertices, _gl.STATIC_DRAW );
-
-		_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, _sprite.elementBuffer );
-		_gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, _sprite.faces, _gl.STATIC_DRAW );
-
-		_sprite.program = _gl.createProgram();
-		_gl.attachShader( _sprite.program, getShader( "fragment", THREE.ShaderLib.sprite.fragmentShader ) );
-		_gl.attachShader( _sprite.program, getShader( "vertex",   THREE.ShaderLib.sprite.vertexShader   ) );
-		_gl.linkProgram( _sprite.program );
-
-		_sprite.attributes = {};
-		_sprite.uniforms = {};
-
-		_sprite.attributes.position           = _gl.getAttribLocation ( _sprite.program, "position" );
-		_sprite.attributes.uv                 = _gl.getAttribLocation ( _sprite.program, "uv" );
-
-		_sprite.uniforms.uvOffset             = _gl.getUniformLocation( _sprite.program, "uvOffset" );
-		_sprite.uniforms.uvScale              = _gl.getUniformLocation( _sprite.program, "uvScale" );
-
-		_sprite.uniforms.rotation             = _gl.getUniformLocation( _sprite.program, "rotation" );
-		_sprite.uniforms.scale                = _gl.getUniformLocation( _sprite.program, "scale" );
-		_sprite.uniforms.alignment            = _gl.getUniformLocation( _sprite.program, "alignment" );
-
-		_sprite.uniforms.color                = _gl.getUniformLocation( _sprite.program, "color" );
-		_sprite.uniforms.map                  = _gl.getUniformLocation( _sprite.program, "map" );
-		_sprite.uniforms.opacity              = _gl.getUniformLocation( _sprite.program, "opacity" );
-
-		_sprite.uniforms.useScreenCoordinates = _gl.getUniformLocation( _sprite.program, "useScreenCoordinates" );
-		_sprite.uniforms.affectedByDistance   = _gl.getUniformLocation( _sprite.program, "affectedByDistance" );
-		_sprite.uniforms.screenPosition    	  = _gl.getUniformLocation( _sprite.program, "screenPosition" );
-		_sprite.uniforms.modelViewMatrix      = _gl.getUniformLocation( _sprite.program, "modelViewMatrix" );
-		_sprite.uniforms.projectionMatrix     = _gl.getUniformLocation( _sprite.program, "projectionMatrix" );
-
-		//_gl.enableVertexAttribArray( _sprite.attributes.position );
-		//_gl.enableVertexAttribArray( _sprite.attributes.uv );
-
-	};
-
 	function initShadowmaps () {
 
 		var depthShader = THREE.ShaderLib[ "depthRGBA" ];

+ 0 - 72
src/renderers/WebGLShaders.js

@@ -966,78 +966,6 @@ THREE.UniformsLib = {
 
 THREE.ShaderLib = {
 
-	'sprite': {
-
-		vertexShader: [
-
-			"uniform int useScreenCoordinates;",
-			"uniform int affectedByDistance;",
-			"uniform vec3 screenPosition;",
-			"uniform mat4 modelViewMatrix;",
-			"uniform mat4 projectionMatrix;",
-			"uniform float rotation;",
-			"uniform vec2 scale;",
-			"uniform vec2 alignment;",
-			"uniform vec2 uvOffset;",
-			"uniform vec2 uvScale;",
-
-			"attribute vec2 position;",
-			"attribute vec2 uv;",
-
-			"varying vec2 vUV;",
-
-			"void main() {",
-
-				"vUV = uvOffset + uv * uvScale;",
-
-				"vec2 alignedPosition = position + alignment;",
-
-				"vec2 rotatedPosition;",
-				"rotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;",
-				"rotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;",
-
-				"vec4 finalPosition;",
-
-				"if( useScreenCoordinates != 0 ) {",
-
-					"finalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );",
-
-				"} else {",
-
-					"finalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );",
-					"finalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );",
-
-				"}",
-
-				"gl_Position = finalPosition;",
-
-			"}"
-
-		].join( "\n" ),
-
-		fragmentShader: [
-
-			"#ifdef GL_ES",
-				"precision highp float;",
-			"#endif",
-
-			"uniform vec3 color;",
-			"uniform sampler2D map;",
-			"uniform float opacity;",
-
-			"varying vec2 vUV;",
-
-			"void main() {",
-
-				"vec4 texture = texture2D( map, vUV );",
-				"gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );",
-
-			"}"
-
-		].join( "\n" )
-
-	},
-
 	'depth': {
 
 		uniforms: {

+ 3 - 1
utils/build.py

@@ -131,9 +131,11 @@ EXTRAS_FILES = [
 'extras/objects/MarchingCubes.js',
 'extras/objects/LensFlare.js',
 'extras/plugins/LensFlarePlugin.js',
+'extras/plugins/SpritePlugin.js',
 'extras/renderers/AnaglyphWebGLRenderer.js',
 'extras/renderers/CrosseyedWebGLRenderer.js',
-'extras/shaders/ShaderFlares.js'
+'extras/shaders/ShaderFlares.js',
+'extras/shaders/ShaderSprite.js'
 ]
 
 CANVAS_FILES = [