Explorar o código

Made SpritePlugin and LensFlare plugins default.

Also some refactoring in plugins.

Still not really satisfied with a solution, will need to handle somehow ordering of plugins (both among them and with respect to rest of rendering, this would be needed for example to be able to redo shadow maps as a plugin).
alteredq %!s(int64=13) %!d(string=hai) anos
pai
achega
4be5880b0f

+ 254 - 254
build/Three.js

@@ -15,11 +15,11 @@ 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);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,
+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);w=p.dot(p);z=p.dot(m);A=1/(t*w-u*u);v=(w*y-u*z)*A;G=(t*z-u*y)*A;return v>=0&&G>=0&&v+G<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};
+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,w,z,A,v,G};
 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}};
@@ -28,16 +28,16 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=
 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,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,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,
+t=a.n44,u=b.n11,y=b.n12,w=b.n13,z=b.n14,A=b.n21,v=b.n22,G=b.n23,F=b.n24,K=b.n31,s=b.n32,N=b.n33,U=b.n34,$=b.n41,R=b.n42,V=b.n43,aa=b.n44;this.n11=c*u+d*A+e*K+g*$;this.n12=c*y+d*v+e*s+g*R;this.n13=c*w+d*G+e*N+g*V;this.n14=c*z+d*F+e*U+g*aa;this.n21=f*u+h*A+i*K+j*$;this.n22=f*y+h*v+i*s+j*R;this.n23=f*w+h*G+i*N+j*V;this.n24=f*z+h*F+i*U+j*aa;this.n31=k*u+o*A+p*K+m*$;this.n32=k*y+o*v+p*s+m*R;this.n33=k*w+o*G+p*N+m*V;this.n34=k*z+o*F+p*U+m*aa;this.n41=q*u+n*A+r*K+t*$;this.n42=q*y+n*v+r*s+t*R;this.n43=q*
+w+n*G+r*N+t*V;this.n44=q*z+n*F+r*U+t*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,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,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,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=
@@ -56,18 +56,18 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 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=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)};
+k,o,p=[],m,q=[],n,r,t=[],u,y,w=[],z={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,v=new THREE.Vector4,G=new THREE.Matrix4,F=new THREE.Matrix4,K=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],s=new THREE.Vector4,N=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);G.multiply(b.projectionMatrix,b.matrixWorldInverse);G.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+G.multiply(b.matrixWorld,b.projectionMatrixInverse);G.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){g=0;z.objects.length=0;z.sprites.length=0;z.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=K[h].x*d.n14+K[h].y*d.n24+K[h].z*d.n34+K[h].w,c<=g){c=!1;break a}c=!0}c?(G.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,z.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(G.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,z.sprites.push(e)):b instanceof THREE.Light&&z.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(b);d&&
+z.objects.sort(c);return z};this.projectScene=function(a,e,g){var f=e.near,K=e.far,A,I,L,C,P,W,S,l,da,O,ga,X,ca,na,ia,qa;y=r=m=o=0;z.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);G.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(G);z=this.projectGraph(a,!1);a=0;for(A=z.objects.length;a<A;a++)if(da=z.objects[a].object,O=da.matrixWorld,
+X=da.material,i=0,da instanceof THREE.Mesh){ga=da.geometry;ca=da.geometry.materials;C=ga.vertices;na=ga.faces;ia=ga.faceVertexUvs;ga=da.matrixRotationWorld.extractRotation(O);I=0;for(L=C.length;I<L;I++)h=b(),h.positionWorld.copy(C[I].position),O.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),G.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<K;C=0;for(I=na.length;C<
+I;C++){L=na[C];if(L instanceof THREE.Face3)if(P=j[L.a],W=j[L.b],S=j[L.c],P.visible&&W.visible&&S.visible&&(da.doubleSided||da.flipSided!=(S.positionScreen.x-P.positionScreen.x)*(W.positionScreen.y-P.positionScreen.y)-(S.positionScreen.y-P.positionScreen.y)*(W.positionScreen.x-P.positionScreen.x)<0))l=p[o]=p[o]||new THREE.RenderableFace3,o++,k=l,k.v1.copy(P),k.v2.copy(W),k.v3.copy(S);else continue;else if(L instanceof THREE.Face4)if(P=j[L.a],W=j[L.b],S=j[L.c],l=j[L.d],P.visible&&W.visible&&S.visible&&
+l.visible&&(da.doubleSided||da.flipSided!=((l.positionScreen.x-P.positionScreen.x)*(W.positionScreen.y-P.positionScreen.y)-(l.positionScreen.y-P.positionScreen.y)*(W.positionScreen.x-P.positionScreen.x)<0||(W.positionScreen.x-S.positionScreen.x)*(l.positionScreen.y-S.positionScreen.y)-(W.positionScreen.y-S.positionScreen.y)*(l.positionScreen.x-S.positionScreen.x)<0)))qa=q[m]=q[m]||new THREE.RenderableFace4,m++,k=qa,k.v1.copy(P),k.v2.copy(W),k.v3.copy(S),k.v4.copy(l);else continue;k.normalWorld.copy(L.normal);
+ga.multiplyVector3(k.normalWorld);k.centroidWorld.copy(L.centroid);O.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);G.multiplyVector3(k.centroidScreen);S=L.vertexNormals;P=0;for(W=S.length;P<W;P++)l=k.vertexNormalsWorld[P],l.copy(S[P]),ga.multiplyVector3(l);P=0;for(W=ia.length;P<W;P++)if(qa=ia[P][C]){S=0;for(l=qa.length;S<l;S++)k.uvs[P][S]=qa[S]}k.material=X;k.faceMaterial=L.materialIndex!==null?ca[L.materialIndex]:null;k.z=k.centroidScreen.z;z.elements.push(k)}}else if(da instanceof
+THREE.Line){F.multiply(G,O);C=da.geometry.vertices;P=b();P.positionScreen.copy(C[0].position);F.multiplyVector4(P.positionScreen);I=1;for(L=C.length;I<L;I++)if(P=b(),P.positionScreen.copy(C[I].position),F.multiplyVector4(P.positionScreen),W=j[i-2],s.copy(P.positionScreen),N.copy(W.positionScreen),d(s,N))s.multiplyScalar(1/s.w),N.multiplyScalar(1/N.w),da=t[r]=t[r]||new THREE.RenderableLine,r++,n=da,n.v1.positionScreen.copy(s),n.v2.positionScreen.copy(N),n.z=Math.max(s.z,N.z),n.material=X,z.elements.push(n)}a=
+0;for(A=z.sprites.length;a<A;a++)if(da=z.sprites[a].object,O=da.matrixWorld,da instanceof THREE.Particle&&(v.set(O.n14,O.n24,O.n34,1),G.multiplyVector4(v),v.z/=v.w,v.z>0&&v.z<1))f=w[y]=w[y]||new THREE.RenderableParticle,y++,u=f,u.x=v.x/v.w,u.y=v.y/v.w,u.z=v.z,u.rotation=da.rotation.z,u.scale.x=da.scale.x*Math.abs(u.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),u.scale.y=da.scale.y*Math.abs(u.y-(v.y+e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),u.material=da.material,z.elements.push(u);
+g&&z.elements.sort(c);return z}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,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=
@@ -83,9 +83,9 @@ 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,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=
+b,c,d,e,g,U){h=a.vertices[b].position;i=a.vertices[c].position;j=a.vertices[d].position;k=f[e];o=f[g];p=f[U];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;w=p.u-k.u;z=o.v-k.v;A=p.v-k.v;v=1/(y*A-w*z);s.set((A*m-z*q)*v,(A*n-z*r)*v,(A*t-z*u)*v);N.set((y*q-w*m)*v,(y*r-w*n)*v,(y*u-w*t)*v);F[b].addSelf(s);F[c].addSelf(s);F[d].addSelf(s);K[b].addSelf(N);K[c].addSelf(N);K[d].addSelf(N)}var b,c,d,e,g,f,h,i,j,k,o,p,m,q,n,r,t,u,y,w,z,A,v,G,F=[],K=[],s=new THREE.Vector3,N=new THREE.Vector3,
+U=new THREE.Vector3,$=new THREE.Vector3,R=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)F[b]=new THREE.Vector3,K[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 V=["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++)R.copy(g.vertexNormals[d]),e=g[V[d]],
+G=F[e],U.copy(G),U.subSelf(R.multiplyScalar(R.dot(G))).normalize(),$.cross(g.vertexNormals[d],G),e=$.dot(K[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=
 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;
@@ -149,46 +149,46 @@ THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lig
 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,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.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(w!=a)n.strokeStyle=w=a}function e(a){if(z!=a)n.fillStyle=z=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,w=null,z=null,A=null,v=null,G=null,F,K,s,N,U=new THREE.RenderableVertex,$=new THREE.RenderableVertex,R,V,aa,ja,I,L,C,P,W,S,l,da,O=new THREE.Color,ga=new THREE.Color,X=new THREE.Color,ca=new THREE.Color,na=new THREE.Color,ia=[],qa=[],ra,oa,ta,pa,Ba,wa,va,xa,M,fa,T=new THREE.Rectangle,J=new THREE.Rectangle,H=new THREE.Rectangle,Q=!1,ba=new THREE.Color,Z=new THREE.Color,sa=new THREE.Color,Y=new THREE.Vector3,ka,ea,za,ya,ha,Ia,a=16;ka=document.createElement("canvas");
+ka.width=ka.height=2;ea=ka.getContext("2d");ea.fillStyle="rgba(0,0,0,1)";ea.fillRect(0,0,2,2);za=ea.getImageData(0,0,2,2);ya=za.data;ha=document.createElement("canvas");ha.width=ha.height=a;Ia=ha.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;T.set(-m,-q,m,q);J.set(-m,-q,m,q);u=1;y=0;G=
+v=A=z=w=null};this.setClearColor=function(a,b){r.copy(a);t=b;J.set(-m,-q,m,q)};this.setClearColorHex=function(a,b){r.setHex(a);t=b;J.set(-m,-q,m,q)};this.clear=function(){n.setTransform(1,0,0,-1,m,q);J.isEmpty()||(J.minSelf(T),J.inflate(2),t<1&&n.clearRect(Math.floor(J.getX()),Math.floor(J.getY()),Math.floor(J.getWidth()),Math.floor(J.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(J.getX()),
+Math.floor(J.getY()),Math.floor(J.getWidth()),Math.floor(J.getHeight()))),J.empty())};this.render=function(a,k){function o(a){var b,c,d,e;ba.setRGB(0,0,0);Z.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?(ba.r+=e.r,ba.g+=e.g,ba.b+=e.b):d instanceof THREE.DirectionalLight?(Z.r+=e.r,Z.g+=e.g,Z.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,l,i;e=0;for(g=a.length;e<g;e++)f=a[e],h=f.color,
+f instanceof THREE.DirectionalLight?(l=f.matrixWorld.getPosition(),i=c.dot(l),i<=0||(i*=f.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):f instanceof THREE.PointLight&&(l=f.matrixWorld.getPosition(),i=c.dot(Y.sub(l,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(l)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}function r(a,g,f){b(f.opacity);c(f.blending);var h,i,l,k,j,ha;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)k=f.map.image,j=k.width>>1,ha=k.height>>
+1,f=g.scale.x*m,l=g.scale.y*q,h=f*j,i=l*ha,H.set(a.x-h,a.y-i,a.x+h,a.y+i),T.intersects(H)&&(n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(f,-l),n.translate(-j,-ha),n.drawImage(k,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(h=g.scale.x*m,i=g.scale.y*q,H.set(a.x-h,a.y-i,a.x+h,a.y+i),T.intersects(H)&&(d(f.color.getContextStyle()),e(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(h,i),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(v!=a)n.lineCap=v=a;a=f.linejoin;if(G!=a)n.lineJoin=G=a;d(f.color.getContextStyle());n.stroke();H.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);R=a.positionScreen.x;V=a.positionScreen.y;
+aa=d.positionScreen.x;ja=d.positionScreen.y;I=e.positionScreen.x;L=e.positionScreen.y;Ha(R,V,aa,ja,I,L);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(pa=m.uvs[0],z(R,V,aa,ja,I,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,Y.copy(m.vertexNormalsWorld[f]),Ba=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,wa=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,
+Y.copy(m.vertexNormalsWorld[h]),va=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,xa=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,Y.copy(m.vertexNormalsWorld[l]),M=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,fa=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,z(R,V,aa,ja,I,L,Ba,wa,va,xa,M,fa,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],
+z(R,V,aa,ja,I,L,pa[f].u,pa[f].v,pa[h].u,pa[h].v,pa[l].u,pa[l].v,n.map)),c(THREE.SubtractiveBlending)),Q?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(ga.r=X.r=ca.r=ba.r,ga.g=X.g=ca.g=ba.g,ga.b=X.b=ca.b=ba.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],ga),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],X),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ca),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)),X.r=Math.max(0,Math.min(n.color.r*X.r,1)),X.g=Math.max(0,Math.min(n.color.g*X.g,1)),X.b=Math.max(0,Math.min(n.color.b*X.b,1)),ca.r=Math.max(0,Math.min(n.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(n.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(n.color.b*ca.b,1)),na.r=(X.r+ca.r)*0.5,na.g=(X.g+ca.g)*0.5,na.b=(X.b+ca.b)*0.5,ta=Ja(ga,X,ca,na),Fa(R,V,aa,ja,I,L,0,0,1,0,0,1,ta)):(O.r=ba.r,O.g=ba.g,O.b=ba.b,p(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):Aa(O)):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,ga.r=ga.g=ga.b=1-Ea(a.positionScreen.z,ra,oa),X.r=X.g=X.b=1-Ea(d.positionScreen.z,ra,oa),ca.r=ca.g=ca.b=1-Ea(e.positionScreen.z,ra,oa),na.r=(X.r+ca.r)*0.5,na.g=(X.g+ca.g)*0.5,na.b=(X.b+ca.b)*
+0.5,ta=Ja(ga,X,ca,na),Fa(R,V,aa,ja,I,L,0,0,1,0,0,1,ta);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):Aa(O)}function y(a,d,e,f,h,n,m,j,ha){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,m,j,ha),u(h,e,n,1,2,3,m,j,ha);else if(R=a.positionScreen.x,V=a.positionScreen.y,aa=d.positionScreen.x,ja=
+d.positionScreen.y,I=e.positionScreen.x,L=e.positionScreen.y,C=f.positionScreen.x,P=f.positionScreen.y,W=h.positionScreen.x,S=h.positionScreen.y,l=n.positionScreen.x,da=n.positionScreen.y,j instanceof THREE.MeshBasicMaterial)w(R,V,aa,ja,I,L,C,P),j.wireframe?Ca(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Aa(j.color);else if(j instanceof THREE.MeshLambertMaterial)Q?!j.wireframe&&j.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==4?(ga.r=X.r=ca.r=na.r=ba.r,ga.g=X.g=
+ca.g=na.g=ba.g,ga.b=X.b=ca.b=na.b=ba.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],ga),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],X),p(i,m.v4.positionWorld,m.vertexNormalsWorld[3],ca),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],na),ga.r=Math.max(0,Math.min(j.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(j.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(j.color.b*ga.b,1)),X.r=Math.max(0,Math.min(j.color.r*X.r,1)),X.g=Math.max(0,Math.min(j.color.g*X.g,1)),X.b=Math.max(0,Math.min(j.color.b*X.b,1)),ca.r=
+Math.max(0,Math.min(j.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(j.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(j.color.b*ca.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(ga,X,ca,na),Ha(R,V,aa,ja,C,P),Fa(R,V,aa,ja,C,P,0,0,1,0,0,1,ta),Ha(W,S,I,L,l,da),Fa(W,S,I,L,l,da,1,0,1,1,0,1,ta)):(O.r=ba.r,O.g=ba.g,O.b=ba.b,p(i,m.centroidWorld,m.normalWorld,O),O.r=Math.max(0,Math.min(j.color.r*O.r,1)),O.g=Math.max(0,Math.min(j.color.g*
+O.g,1)),O.b=Math.max(0,Math.min(j.color.b*O.b,1)),w(R,V,aa,ja,I,L,C,P),j.wireframe?Ca(O,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Aa(O)):(w(R,V,aa,ja,I,L,C,P),j.wireframe?Ca(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Aa(j.color));else if(j instanceof THREE.MeshNormalMaterial)O.r=Ga(m.normalWorld.x),O.g=Ga(m.normalWorld.y),O.b=Ga(m.normalWorld.z),w(R,V,aa,ja,I,L,C,P),j.wireframe?Ca(O,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Aa(O);else if(j instanceof
+THREE.MeshDepthMaterial)ra=k.near,oa=k.far,ga.r=ga.g=ga.b=1-Ea(a.positionScreen.z,ra,oa),X.r=X.g=X.b=1-Ea(d.positionScreen.z,ra,oa),ca.r=ca.g=ca.b=1-Ea(f.positionScreen.z,ra,oa),na.r=na.g=na.b=1-Ea(e.positionScreen.z,ra,oa),ta=Ja(ga,X,ca,na),Ha(R,V,aa,ja,C,P),Fa(R,V,aa,ja,C,P,0,0,1,0,0,1,ta),Ha(W,S,I,L,l,da),Fa(W,S,I,L,l,da,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 w(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(A!=b)n.lineWidth=A=b;if(v!=c)n.lineCap=v=c;if(G!=e)n.lineJoin=G=e;d(a.getContextStyle());n.stroke();H.inflate(b*2)}function Aa(a){e(a.getContextStyle());n.fill()}function z(a,b,c,d,g,f,h,i,l,k,m,j,ha){if(ha.image.width!=0){if(ha.needsUpdate==!0||ia[ha.id]==void 0){var o=ha.wrapS==THREE.RepeatWrapping,p=ha.wrapT==THREE.RepeatWrapping;ia[ha.id]=n.createPattern(ha.image,o&&p?"repeat":o&&!p?"repeat-x":!o&&
+p?"repeat-y":"no-repeat");ha.needsUpdate=!1}e(ia[ha.id]);var o=ha.offset.x/ha.repeat.x,p=ha.offset.y/ha.repeat.y,M=ha.image.width*ha.repeat.x,r=ha.image.height*ha.repeat.y,h=(h+o)*M,i=(i+p)*r,l=(l+o)*M,k=(k+p)*r,m=(m+o)*M,j=(j+p)*r;c-=a;d-=b;g-=a;f-=b;l-=h;k-=i;m-=h;j-=i;o=l*j-m*k;if(o==0){if(qa[ha.id]==void 0)b=document.createElement("canvas"),b.width=ha.image.width,b.height=ha.image.height,a=b.getContext("2d"),a.drawImage(ha.image,0,0),qa[ha.id]=a.getImageData(0,0,ha.image.width,ha.image.height).data,
+delete b;b=qa[ha.id];h=(Math.floor(h)+Math.floor(i)*ha.image.width)*4;O.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Aa(O)}else o=1/o,ha=(j*c-k*g)*o,k=(j*d-k*f)*o,c=(l*g-m*c)*o,d=(l*f-m*d)*o,a=a-ha*h-c*i,h=b-k*h-d*i,n.save(),n.transform(ha,k,c,d,a,h),n.fill(),n.restore()}}function Fa(a,b,c,d,e,g,f,h,i,l,k,m,j){var ha,o;ha=j.width-1;o=j.height-1;f*=ha;h*=o;i*=ha;l*=o;k*=ha;m*=o;c-=a;d-=b;e-=a;g-=b;i-=f;l-=h;k-=f;m-=h;o=1/(i*m-k*l);ha=(m*c-l*e)*o;l=(m*d-l*g)*o;c=(i*e-k*c)*o;d=(i*g-k*d)*o;a=a-ha*f-c*h;b=b-
+l*f-d*h;n.save();n.transform(ha,l,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;ea.putImageData(za,0,0);Ia.drawImage(ka,0,0);return ha}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 D,Ka,ua,E;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;(Q=i.length>0)&&o(i);D=0;for(Ka=h.length;D<Ka;D++)if(ua=h[D],E=ua.material,E=E instanceof THREE.MeshFaceMaterial?ua.faceMaterial:E,!(E==null||E.opacity==0)){H.empty();if(ua instanceof THREE.RenderableParticle)F=ua,F.x*=m,F.y*=q,r(F,ua,E,a);else if(ua instanceof THREE.RenderableLine)F=ua.v1,K=ua.v2,F.positionScreen.x*=m,F.positionScreen.y*=q,K.positionScreen.x*=m,K.positionScreen.y*=q,H.addPoint(F.positionScreen.x,F.positionScreen.y),H.addPoint(K.positionScreen.x,K.positionScreen.y),T.intersects(H)&&
+t(F,K,ua,E,a);else if(ua instanceof THREE.RenderableFace3)F=ua.v1,K=ua.v2,s=ua.v3,F.positionScreen.x*=m,F.positionScreen.y*=q,K.positionScreen.x*=m,K.positionScreen.y*=q,s.positionScreen.x*=m,s.positionScreen.y*=q,E.overdraw&&(Da(F.positionScreen,K.positionScreen),Da(K.positionScreen,s.positionScreen),Da(s.positionScreen,F.positionScreen)),H.add3Points(F.positionScreen.x,F.positionScreen.y,K.positionScreen.x,K.positionScreen.y,s.positionScreen.x,s.positionScreen.y),T.intersects(H)&&u(F,K,s,0,1,2,
+ua,E,a);else if(ua instanceof THREE.RenderableFace4)F=ua.v1,K=ua.v2,s=ua.v3,N=ua.v4,F.positionScreen.x*=m,F.positionScreen.y*=q,K.positionScreen.x*=m,K.positionScreen.y*=q,s.positionScreen.x*=m,s.positionScreen.y*=q,N.positionScreen.x*=m,N.positionScreen.y*=q,U.positionScreen.copy(K.positionScreen),$.positionScreen.copy(N.positionScreen),E.overdraw&&(Da(F.positionScreen,K.positionScreen),Da(K.positionScreen,N.positionScreen),Da(N.positionScreen,F.positionScreen),Da(s.positionScreen,U.positionScreen),
+Da(s.positionScreen,$.positionScreen)),H.addPoint(F.positionScreen.x,F.positionScreen.y),H.addPoint(K.positionScreen.x,K.positionScreen.y),H.addPoint(s.positionScreen.x,s.positionScreen.y),H.addPoint(N.positionScreen.x,N.positionScreen.y),T.intersects(H)&&y(F,K,s,N,U,$,ua,E,a);J.addRectangle(H)}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){K[a]==null&&(K[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),R==0&&K[a].setAttribute("shape-rendering","crispEdges"));return K[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,w=new THREE.Color,z=new THREE.Color,A=new THREE.Color,v=new THREE.Color,G,F=new THREE.Vector3,K=[],s=[],N,U,$,R=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":R=1;break;case "low":R=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 K,F,L,C;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;$=U=0;if(y=f.length>0){z.setRGB(0,0,0);A.setRGB(0,0,0);v.setRGB(0,0,0);K=0;for(F=f.length;K<F;K++)C=f[K],L=C.color,C instanceof THREE.AmbientLight?(z.r+=L.r,z.g+=L.g,z.b+=L.b):C instanceof THREE.DirectionalLight?(A.r+=L.r,A.g+=L.g,A.b+=L.b):C instanceof THREE.PointLight&&(v.r+=L.r,v.g+=L.g,v.b+=L.b)}K=0;for(F=g.length;K<F;K++)if(L=g[K],C=L.material,C=C instanceof THREE.MeshFaceMaterial?L.faceMaterial:C,!(C==null||C.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 P=q,W=$++;s[W]==null&&(s[W]=document.createElementNS("http://www.w3.org/2000/svg","line"),R==0&&s[W].setAttribute("shape-rendering","crispEdges"));N=s[W];N.setAttribute("x1",L.positionScreen.x);N.setAttribute("y1",L.positionScreen.y);
+N.setAttribute("x2",P.positionScreen.x);N.setAttribute("y2",P.positionScreen.y);C instanceof THREE.LineBasicMaterial&&(N.setAttribute("style","fill: none; stroke: "+C.color.getContextStyle()+"; stroke-width: "+C.linewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.linecap+"; stroke-linejoin: "+C.linejoin),i.appendChild(N))}}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 P=m,W=q,S=n;d.info.render.vertices+=3;d.info.render.faces++;N=b(U++);N.setAttribute("d","M "+P.positionScreen.x+" "+P.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+"z");C instanceof THREE.MeshBasicMaterial?w.copy(C.color):C instanceof THREE.MeshLambertMaterial?
+y?(w.r=z.r,w.g=z.g,w.b=z.b,a(f,L.centroidWorld,L.normalWorld,w),w.r=Math.max(0,Math.min(C.color.r*w.r,1)),w.g=Math.max(0,Math.min(C.color.g*w.g,1)),w.b=Math.max(0,Math.min(C.color.b*w.b,1))):w.copy(C.color):C instanceof THREE.MeshDepthMaterial?(G=1-C.__2near/(C.__farPlusNear-L.z*C.__farMinusNear),w.setRGB(G,G,G)):C instanceof THREE.MeshNormalMaterial&&w.setRGB(c(L.normalWorld.x),c(L.normalWorld.y),c(L.normalWorld.z));C.wireframe?N.setAttribute("style","fill: none; stroke: "+w.getContextStyle()+"; stroke-width: "+
+C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):N.setAttribute("style","fill: "+w.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(N)}}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 P=m,W=q,S=n,l=r;d.info.render.vertices+=4;d.info.render.faces++;N=b(U++);N.setAttribute("d","M "+P.positionScreen.x+" "+P.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+" L "+l.positionScreen.x+","+l.positionScreen.y+"z");C instanceof THREE.MeshBasicMaterial?
+w.copy(C.color):C instanceof THREE.MeshLambertMaterial?y?(w.r=z.r,w.g=z.g,w.b=z.b,a(f,L.centroidWorld,L.normalWorld,w),w.r=Math.max(0,Math.min(C.color.r*w.r,1)),w.g=Math.max(0,Math.min(C.color.g*w.g,1)),w.b=Math.max(0,Math.min(C.color.b*w.b,1))):w.copy(C.color):C instanceof THREE.MeshDepthMaterial?(G=1-C.__2near/(C.__farPlusNear-L.z*C.__farMinusNear),w.setRGB(G,G,G)):C instanceof THREE.MeshNormalMaterial&&w.setRGB(c(L.normalWorld.x),c(L.normalWorld.y),c(L.normalWorld.z));C.wireframe?N.setAttribute("style",
+"fill: none; stroke: "+w.getContextStyle()+"; stroke-width: "+C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):N.setAttribute("style","fill: "+w.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(N)}}};
 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",
@@ -223,117 +223,117 @@ THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"v
 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 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,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]=
+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){H.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,Z.copy(e),H.multiplyVector3(Z),j[d]=[Z.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(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=w(a,b,c,d,f),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==ca&&(ca=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=
+m=0;h=f.morphTargetInfluences;var j,n=h.length;g=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(j=0;j<n;j++)!i[j]&&h[j]>k&&(m=j,k=h[m]);l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[m]);l.vertexAttribPointer(c["morphTarget"+g],3,l.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=k;i[m]=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=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)),S.info.render.calls++,S.info.render.vertices+=e.__webglFaceCount,S.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),S.info.render.calls++):f instanceof THREE.ParticleSystem?(l.drawArrays(l.POINTS,0,e.__webglParticleCount),S.info.render.calls++):f instanceof THREE.Ribbon&&(l.drawArrays(l.TRIANGLE_STRIP,0,e.__webglVertexCount),S.info.render.calls++)}}function j(a){J[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);J[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);J[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);J[3].set(a.n41-
+a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);J[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);J[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=J[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=J[d].x*b.n14+J[d].y*b.n24+J[d].z*b.n34+J[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;Y||(Y=new THREE.PerspectiveCamera(S.shadowCameraFov,S.shadowMapWidth/S.shadowMapHeight,S.shadowCameraNear,S.shadowCameraFar));b=0;for(c=p.length;b<c;b++)if(n=p[b],n.castShadow&&n instanceof THREE.SpotLight){X=-1;S.shadowMap[o]||(S.shadowMap[o]=new THREE.WebGLRenderTarget(S.shadowMapWidth,S.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),ka[o]=new THREE.Matrix4);d=S.shadowMap[o];e=ka[o];Y.position.copy(n.position);Y.lookAt(n.target.position);
+Y.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(Y),this.autoUpdateScene&&a.updateMatrixWorld());Y.matrixWorldInverse.getInverse(Y.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(Y.projectionMatrix);e.multiplySelf(Y.matrixWorldInverse);Y.matrixWorldInverse.flattenToArray(ba);Y.projectionMatrix.flattenToArray(Q);H.multiply(Y.projectionMatrix,Y.matrixWorldInverse);j(H);U(d);l.clearColor(1,1,1,1);S.clear();l.clearColor(C.r,C.g,C.b,P);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),z(n,Y,!1),g.render=!0;v(!0);S.setBlending(THREE.NormalBlending);for(d=0;d<e;d++)if(g=a.__webglObjects[d],g.render)n=g.object,g=g.buffer,A(n),m=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?za:ea,i(Y,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),ca=-1,z(n,Y,!1),A(n),f=w(Y,p,null,ea,n),n.immediateRenderCallback?n.immediateRenderCallback(f,l,J):n.render(function(a){h(a,f,ea.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&&S.setBlending(l.blending);v(l.depthTest);G(l.depthWrite);F(l.polygonOffset,
+l.polygonOffsetFactor,l.polygonOffsetUnits)}A(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){ca=-1;if(g)n=g;else{n=i[b];if(!n)continue;f&&this.setBlending(n.blending);v(n.depthTest);G(n.depthWrite);F(n.polygonOffset,n.polygonOffsetFactor,n.polygonOffsetUnits)}A(k);m=w(c,d,e,n,k);k.immediateRenderCallback?k.immediateRenderCallback(m,l,J):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 w(a,b,c,d,e){d.program||S.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(S.maxMorphTargets);
+for(var f=0,g=S.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==O&&(l.useProgram(f),O=f,h=!0);if(d.id!==X)X=d.id,h=!0;if(h){l.uniformMatrix4fv(g.projectionMatrix,!1,Q);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,T=q.directional.positions,fa=q.point.colors,u=q.point.positions,y=q.point.distances,J=0,K=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)S.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=J*3,S.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),T[r]=p.x,T[r+
+1]=p.y,T[r+2]=p.z,J+=1;else if(k instanceof THREE.SpotLight)r=J*3,S.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(),T[r]=p.x*n,T[r+1]=p.y*n,T[r+2]=p.z*n,J+=1;else if(k instanceof THREE.PointLight)k=K*3,S.gammaInput?(fa[k]=n.r*n.r*M*M,fa[k+1]=n.g*n.g*M*M,fa[k+2]=n.b*n.b*M*M):(fa[k]=n.r*M,fa[k+1]=n.g*M,fa[k+2]=n.b*M),u[k]=p.x,u[k+1]=p.y,u[k+2]=p.z,y[K]=r,K+=1;c=J*3;for(h=t.length;c<h;c++)t[c]=0;c=K*3;for(h=fa.length;c<h;c++)fa[c]=
+0;q.point.length=K;q.directional.length=J;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,
+S.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=V.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,S.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)S.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]=S.shadowMap[b];i.shadowDarkness.value=S.shadowMapDarkness;i.shadowBias.value=S.shadowMapBias}b=
 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;
+(m=j,l.activeTexture(l.TEXTURE0+h),l.bindTexture(l.TEXTURE_CUBE_MAP,m.__webglTexture)):S.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])&&S.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,ba);d.skinning&&(l.uniformMatrix4fv(g.cameraInverseMatrix,!1,ba),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 z(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(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 v(a){oa!==a&&(a?l.enable(l.DEPTH_TEST):
+l.disable(l.DEPTH_TEST),oa=a)}function G(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 K(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,R(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,R(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,R(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,R(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,$(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,$(b.minFilter)),
+!1)}function N(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 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=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,R(a.format),
+a.width,a.height,0,R(a.format),R(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);N(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,R(a.format),a.width,a.height,0,R(a.format),R(a.type),null),
+c=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,c,a.__webglTexture,0),N(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=fa,a=T,d=xa,e=M);b!==ga&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,
+e,c,a),ga=b)}function $(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return l.NEAREST;default:return l.LINEAR}}function R(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,
+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||{},V=a.canvas!==void 0?a.canvas:document.createElement("canvas"),aa=a.precision!==void 0?a.precision:"highp",ja=a.antialias!==void 0?a.antialias:!1,I=a.stencil!==void 0?a.stencil:!0,L=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,C=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),
+P=a.clearAlpha!==void 0?a.clearAlpha:0,W=a.maxLights!==void 0?a.maxLights:4;this.domElement=V;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 S=this,l,da=[],O=null,ga=null,X=-1,ca=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,fa=0,T=0,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Matrix4,Q=new Float32Array(16),
+ba=new Float32Array(16),Z=new THREE.Vector4,sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Y,ka=[],ea,za;l=function(){var a;try{if(!(a=V.getContext("experimental-webgl",{antialias:ja,stencil:I,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(C.r,C.g,C.b,P);(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);ea=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});ea._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){V.width=a;V.height=b;this.setViewport(0,0,V.width,V.height)};this.setViewport=function(a,b,c,d){xa=a;M=b;fa=c;T=d;l.viewport(xa,M,fa,T)};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){C.setHex(a);P=b;l.clearColor(C.r,C.g,C.b,P)};this.setClearColor=function(a,b){C.copy(a);P=b;l.clearColor(C.r,C.g,C.b,P)};this.getClearColor=function(){return C};this.getClearAlpha=function(){return P};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){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];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!==
+S.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--};this.deallocateTexture=
+function(a){if(a.__webglInit)a.__webglInit=!1,l.deleteTexture(a.__webglTexture),S.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;X=-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);S.info.render.calls=0;S.info.render.vertices=
+0;S.info.render.faces=0;b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(ba);b.projectionMatrix.flattenToArray(Q);H.multiply(b.projectionMatrix,b.matrixWorldInverse);j(H);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(f=h[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh)||!g.frustumCulled||k(g))){g.matrixWorld.flattenToArray(g._objectMatrixArray);z(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:(Z.copy(g.position),H.multiplyVector3(Z),f.z=Z.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),z(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),v(a.overrideMaterial.depthTest),G(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,fa,T,Q),O=null,ca=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");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);
+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,T=void 0,fa=void 0,s=void 0,J={},K=j.morphTargets.length;j.geometryGroups={};o=0;for(p=j.faces.length;o<
+p;o++)M=j.faces[o],q=M.materialIndex,fa=q!==void 0?q:-1,J[fa]===void 0&&(J[fa]={hash:fa,counter:0}),s=J[fa].hash+"_"+J[fa].counter,j.geometryGroups[s]===void 0&&(j.geometryGroups[s]={faces3:[],faces4:[],materialIndex:q,vertices:0,numMorphTargets:K}),T=M instanceof THREE.Face3?3:4,j.geometryGroups[s].vertices+T>65535&&(J[fa].counter+=1,s=J[fa].hash+"_"+J[fa].counter,j.geometryGroups[s]===void 0&&(j.geometryGroups[s]={faces3:[],faces4:[],materialIndex:q,vertices:0,numMorphTargets:K})),M instanceof THREE.Face3?
+j.geometryGroups[s].faces3.push(o):j.geometryGroups[s].faces4.push(o),j.geometryGroups[s].vertices+=T;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())}S.info.memory.geometries++;q=h;T=q.geometry;p=j.faces3;fa=j.faces4;
+o=p.length*3+fa.length*4;M=p.length*1+fa.length*2;fa=p.length*3+fa.length*4;p=c(q,j);s=g(p);J=d(p);K=e(p);j.__vertexArray=new Float32Array(o*3);if(J)j.__normalArray=new Float32Array(o*3);if(T.hasTangents)j.__tangentArray=new Float32Array(o*4);if(K)j.__colorArray=new Float32Array(o*3);if(s){if(T.faceUvs.length>0||T.faceVertexUvs.length>0)j.__uvArray=new Float32Array(o*2);if(T.faceUvs.length>1||T.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(fa*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];q=0;for(T=j.numMorphTargets;q<T;q++)j.__morphTargetsArrays.push(new Float32Array(o*3))}j.__webglFaceCount=M*3;j.__webglLineCount=fa*2;if(p.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];M=void 0;
+for(M in p.attributes){var q=p.attributes[M],T={},N;for(N in q)T[N]=q[N];if(!T.__webglInitialized||T.createUniqueBuffers)T.__webglInitialized=!0,fa=1,T.type==="v2"?fa=2:T.type==="v3"?fa=3:T.type==="v4"?fa=4:T.type==="c"&&(fa=3),T.size=fa,T.array=new Float32Array(o*fa),T.buffer=l.createBuffer(),T.buffer.belongsToAttribute=M,q.needsUpdate=!0,T.__original=q;j.__webglCustomAttributesList.push(T)}}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(),S.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(),S.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(),S.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(N=a.__webglObjects[h].object,k=N.geometry,m=M=p=void 0,N instanceof THREE.Mesh){j=0;for(o=k.geometryGroupsList.length;j<o;j++)if(p=k.geometryGroupsList[j],m=c(N,p),M=m.attributes&&r(m),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||M){var w=N,M=l.DYNAMIC_DRAW,q=!k.dynamic,s=m;if(p.__inittedArrays){var T=
+d(s),fa=e(s),U=g(s),A=T===THREE.SmoothShading,C=J=s=void 0,D=void 0,z=void 0,L=void 0,E=void 0,P=void 0,F=void 0,G=C=void 0,v=void 0,H=void 0,Q=void 0,I=D=void 0,V=void 0,W=void 0,R=D=F=void 0,ba=void 0,$=Q=H=v=E=void 0,Z=D=Q=H=v=$=Q=H=v=$=Q=H=v=void 0,O=void 0,aa=L=void 0,da=void 0,Y=void 0,ga=void 0,X=void 0,ca=G=Y=O=0,ja=0,sa=Z=C=0,ea=E=I=0,B=0,ka=void 0,ea=p.__vertexArray,da=p.__uvArray,B=p.__uv2Array,aa=p.__normalArray,z=p.__tangentArray,V=p.__colorArray,R=p.__skinVertexAArray,ba=p.__skinVertexBArray,
+P=p.__skinIndexArray,ia=p.__skinWeightArray,$=p.__morphTargetsArrays,K=p.__webglCustomAttributesList,x=void 0,x=p.__faceArray,ka=p.__lineArray,W=w.geometry,ya=W.__dirtyElements,qa=W.__dirtyUvs,L=W.__dirtyNormals,F=W.__dirtyTangents,ra=W.__dirtyColors,ga=W.__dirtyMorphTargets,X=W.vertices,w=p.faces3,la=p.faces4,ma=W.faces,pa=W.faceVertexUvs[0],ta=W.faceVertexUvs[1],oa=W.skinVerticesA,za=W.skinVerticesB,va=W.skinIndices,wa=W.skinWeights,xa=W.morphTargets;if(W.__dirtyVertices){s=0;for(J=w.length;s<J;s++)D=
+ma[w[s]],v=X[D.a].position,H=X[D.b].position,Q=X[D.c].position,ea[Y]=v.x,ea[Y+1]=v.y,ea[Y+2]=v.z,ea[Y+3]=H.x,ea[Y+4]=H.y,ea[Y+5]=H.z,ea[Y+6]=Q.x,ea[Y+7]=Q.y,ea[Y+8]=Q.z,Y+=9;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],v=X[D.a].position,H=X[D.b].position,Q=X[D.c].position,D=X[D.d].position,ea[Y]=v.x,ea[Y+1]=v.y,ea[Y+2]=v.z,ea[Y+3]=H.x,ea[Y+4]=H.y,ea[Y+5]=H.z,ea[Y+6]=Q.x,ea[Y+7]=Q.y,ea[Y+8]=Q.z,ea[Y+9]=D.x,ea[Y+10]=D.y,ea[Y+11]=D.z,Y+=12;l.bindBuffer(l.ARRAY_BUFFER,p.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,
+ea,M)}if(ga){Y=0;for(ga=xa.length;Y<ga;Y++){s=ea=0;for(J=w.length;s<J;s++)D=ma[w[s]],v=xa[Y].vertices[D.a].position,H=xa[Y].vertices[D.b].position,Q=xa[Y].vertices[D.c].position,X=$[Y],X[ea]=v.x,X[ea+1]=v.y,X[ea+2]=v.z,X[ea+3]=H.x,X[ea+4]=H.y,X[ea+5]=H.z,X[ea+6]=Q.x,X[ea+7]=Q.y,X[ea+8]=Q.z,ea+=9;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],v=xa[Y].vertices[D.a].position,H=xa[Y].vertices[D.b].position,Q=xa[Y].vertices[D.c].position,D=xa[Y].vertices[D.d].position,X=$[Y],X[ea]=v.x,X[ea+1]=v.y,X[ea+2]=v.z,
+X[ea+3]=H.x,X[ea+4]=H.y,X[ea+5]=H.z,X[ea+6]=Q.x,X[ea+7]=Q.y,X[ea+8]=Q.z,X[ea+9]=D.x,X[ea+10]=D.y,X[ea+11]=D.z,ea+=12;l.bindBuffer(l.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[Y]);l.bufferData(l.ARRAY_BUFFER,$[Y],M)}}if(wa.length){s=0;for(J=w.length;s<J;s++)D=ma[w[s]],v=wa[D.a],H=wa[D.b],Q=wa[D.c],ia[E]=v.x,ia[E+1]=v.y,ia[E+2]=v.z,ia[E+3]=v.w,ia[E+4]=H.x,ia[E+5]=H.y,ia[E+6]=H.z,ia[E+7]=H.w,ia[E+8]=Q.x,ia[E+9]=Q.y,ia[E+10]=Q.z,ia[E+11]=Q.w,v=va[D.a],H=va[D.b],Q=va[D.c],P[E]=v.x,P[E+1]=v.y,P[E+2]=v.z,
+P[E+3]=v.w,P[E+4]=H.x,P[E+5]=H.y,P[E+6]=H.z,P[E+7]=H.w,P[E+8]=Q.x,P[E+9]=Q.y,P[E+10]=Q.z,P[E+11]=Q.w,v=oa[D.a],H=oa[D.b],Q=oa[D.c],R[E]=v.x,R[E+1]=v.y,R[E+2]=v.z,R[E+3]=1,R[E+4]=H.x,R[E+5]=H.y,R[E+6]=H.z,R[E+7]=1,R[E+8]=Q.x,R[E+9]=Q.y,R[E+10]=Q.z,R[E+11]=1,v=za[D.a],H=za[D.b],Q=za[D.c],ba[E]=v.x,ba[E+1]=v.y,ba[E+2]=v.z,ba[E+3]=1,ba[E+4]=H.x,ba[E+5]=H.y,ba[E+6]=H.z,ba[E+7]=1,ba[E+8]=Q.x,ba[E+9]=Q.y,ba[E+10]=Q.z,ba[E+11]=1,E+=12;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],v=wa[D.a],H=wa[D.b],Q=wa[D.c],
+$=wa[D.d],ia[E]=v.x,ia[E+1]=v.y,ia[E+2]=v.z,ia[E+3]=v.w,ia[E+4]=H.x,ia[E+5]=H.y,ia[E+6]=H.z,ia[E+7]=H.w,ia[E+8]=Q.x,ia[E+9]=Q.y,ia[E+10]=Q.z,ia[E+11]=Q.w,ia[E+12]=$.x,ia[E+13]=$.y,ia[E+14]=$.z,ia[E+15]=$.w,v=va[D.a],H=va[D.b],Q=va[D.c],$=va[D.d],P[E]=v.x,P[E+1]=v.y,P[E+2]=v.z,P[E+3]=v.w,P[E+4]=H.x,P[E+5]=H.y,P[E+6]=H.z,P[E+7]=H.w,P[E+8]=Q.x,P[E+9]=Q.y,P[E+10]=Q.z,P[E+11]=Q.w,P[E+12]=$.x,P[E+13]=$.y,P[E+14]=$.z,P[E+15]=$.w,v=oa[D.a],H=oa[D.b],Q=oa[D.c],$=oa[D.d],R[E]=v.x,R[E+1]=v.y,R[E+2]=v.z,R[E+
+3]=1,R[E+4]=H.x,R[E+5]=H.y,R[E+6]=H.z,R[E+7]=1,R[E+8]=Q.x,R[E+9]=Q.y,R[E+10]=Q.z,R[E+11]=1,R[E+12]=$.x,R[E+13]=$.y,R[E+14]=$.z,R[E+15]=1,v=za[D.a],H=za[D.b],Q=za[D.c],D=za[D.d],ba[E]=v.x,ba[E+1]=v.y,ba[E+2]=v.z,ba[E+3]=1,ba[E+4]=H.x,ba[E+5]=H.y,ba[E+6]=H.z,ba[E+7]=1,ba[E+8]=Q.x,ba[E+9]=Q.y,ba[E+10]=Q.z,ba[E+11]=1,ba[E+12]=D.x,ba[E+13]=D.y,ba[E+14]=D.z,ba[E+15]=1,E+=16;E>0&&(l.bindBuffer(l.ARRAY_BUFFER,p.__webglSkinVertexABuffer),l.bufferData(l.ARRAY_BUFFER,R,M),l.bindBuffer(l.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),
+l.bufferData(l.ARRAY_BUFFER,ba,M),l.bindBuffer(l.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,P,M),l.bindBuffer(l.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,ia,M))}if(ra&&fa){s=0;for(J=w.length;s<J;s++)D=ma[w[s]],E=D.vertexColors,P=D.color,E.length===3&&fa===THREE.VertexColors?(D=E[0],R=E[1],ba=E[2]):ba=R=D=P,V[I]=D.r,V[I+1]=D.g,V[I+2]=D.b,V[I+3]=R.r,V[I+4]=R.g,V[I+5]=R.b,V[I+6]=ba.r,V[I+7]=ba.g,V[I+8]=ba.b,I+=9;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],
+E=D.vertexColors,P=D.color,E.length===4&&fa===THREE.VertexColors?(D=E[0],R=E[1],ba=E[2],E=E[3]):E=ba=R=D=P,V[I]=D.r,V[I+1]=D.g,V[I+2]=D.b,V[I+3]=R.r,V[I+4]=R.g,V[I+5]=R.b,V[I+6]=ba.r,V[I+7]=ba.g,V[I+8]=ba.b,V[I+9]=E.r,V[I+10]=E.g,V[I+11]=E.b,I+=12;I>0&&(l.bindBuffer(l.ARRAY_BUFFER,p.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,V,M))}if(F&&W.hasTangents){s=0;for(J=w.length;s<J;s++)D=ma[w[s]],F=D.vertexTangents,I=F[0],V=F[1],W=F[2],z[Z]=I.x,z[Z+1]=I.y,z[Z+2]=I.z,z[Z+3]=I.w,z[Z+4]=V.x,z[Z+5]=V.y,
+z[Z+6]=V.z,z[Z+7]=V.w,z[Z+8]=W.x,z[Z+9]=W.y,z[Z+10]=W.z,z[Z+11]=W.w,Z+=12;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],F=D.vertexTangents,I=F[0],V=F[1],W=F[2],F=F[3],z[Z]=I.x,z[Z+1]=I.y,z[Z+2]=I.z,z[Z+3]=I.w,z[Z+4]=V.x,z[Z+5]=V.y,z[Z+6]=V.z,z[Z+7]=V.w,z[Z+8]=W.x,z[Z+9]=W.y,z[Z+10]=W.z,z[Z+11]=W.w,z[Z+12]=F.x,z[Z+13]=F.y,z[Z+14]=F.z,z[Z+15]=F.w,Z+=16;l.bindBuffer(l.ARRAY_BUFFER,p.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,z,M)}if(L&&T){s=0;for(J=w.length;s<J;s++)if(D=ma[w[s]],z=D.vertexNormals,L=
+D.normal,z.length===3&&A)for(Z=0;Z<3;Z++)L=z[Z],aa[C]=L.x,aa[C+1]=L.y,aa[C+2]=L.z,C+=3;else for(Z=0;Z<3;Z++)aa[C]=L.x,aa[C+1]=L.y,aa[C+2]=L.z,C+=3;s=0;for(J=la.length;s<J;s++)if(D=ma[la[s]],z=D.vertexNormals,L=D.normal,z.length===4&&A)for(Z=0;Z<4;Z++)L=z[Z],aa[C]=L.x,aa[C+1]=L.y,aa[C+2]=L.z,C+=3;else for(Z=0;Z<4;Z++)aa[C]=L.x,aa[C+1]=L.y,aa[C+2]=L.z,C+=3;l.bindBuffer(l.ARRAY_BUFFER,p.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,aa,M)}if(qa&&pa&&U){s=0;for(J=w.length;s<J;s++)if(C=w[s],C=pa[C],
+C!==void 0)for(Z=0;Z<3;Z++)aa=C[Z],da[G]=aa.u,da[G+1]=aa.v,G+=2;s=0;for(J=la.length;s<J;s++)if(C=la[s],C=pa[C],C!==void 0)for(Z=0;Z<4;Z++)aa=C[Z],da[G]=aa.u,da[G+1]=aa.v,G+=2;G>0&&(l.bindBuffer(l.ARRAY_BUFFER,p.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,da,M))}if(qa&&ta&&U){s=0;for(J=w.length;s<J;s++)if(C=w[s],G=ta[C],G!==void 0)for(Z=0;Z<3;Z++)da=G[Z],B[ca]=da.u,B[ca+1]=da.v,ca+=2;s=0;for(J=la.length;s<J;s++)if(C=la[s],G=ta[C],G!==void 0)for(Z=0;Z<4;Z++)da=G[Z],B[ca]=da.u,B[ca+1]=da.v,ca+=2;ca>
+0&&(l.bindBuffer(l.ARRAY_BUFFER,p.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,B,M))}if(ya){s=0;for(J=w.length;s<J;s++)x[ja]=O,x[ja+1]=O+1,x[ja+2]=O+2,ja+=3,ka[sa]=O,ka[sa+1]=O+1,ka[sa+2]=O,ka[sa+3]=O+2,ka[sa+4]=O+1,ka[sa+5]=O+2,sa+=6,O+=3;s=0;for(J=la.length;s<J;s++)x[ja]=O,x[ja+1]=O+1,x[ja+2]=O+3,x[ja+3]=O+1,x[ja+4]=O+2,x[ja+5]=O+3,ja+=6,ka[sa]=O,ka[sa+1]=O+1,ka[sa+2]=O,ka[sa+3]=O+3,ka[sa+4]=O+1,ka[sa+5]=O+2,ka[sa+6]=O+2,ka[sa+7]=O+3,sa+=8,O+=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(K){Z=0;for(O=K.length;Z<O;Z++)if(x=K[Z],x.__original.needsUpdate){B=0;if(x.size===1)if(x.boundTo===void 0||x.boundTo==="vertices"){s=0;for(J=w.length;s<J;s++)D=ma[w[s]],x.array[B]=x.value[D.a],x.array[B+1]=x.value[D.b],x.array[B+2]=x.value[D.c],B+=3;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],x.array[B]=x.value[D.a],x.array[B+1]=x.value[D.b],x.array[B+2]=x.value[D.c],
+x.array[B+3]=x.value[D.d],B+=4}else{if(x.boundTo==="faces"){s=0;for(J=w.length;s<J;s++)ka=x.value[w[s]],x.array[B]=ka,x.array[B+1]=ka,x.array[B+2]=ka,B+=3;s=0;for(J=la.length;s<J;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(J=w.length;s<J;s++)D=ma[w[s]],v=x.value[D.a],H=x.value[D.b],Q=x.value[D.c],x.array[B]=v.x,x.array[B+1]=v.y,x.array[B+2]=H.x,x.array[B+3]=H.y,x.array[B+4]=Q.x,
+x.array[B+5]=Q.y,B+=6;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],v=x.value[D.a],H=x.value[D.b],Q=x.value[D.c],D=x.value[D.d],x.array[B]=v.x,x.array[B+1]=v.y,x.array[B+2]=H.x,x.array[B+3]=H.y,x.array[B+4]=Q.x,x.array[B+5]=Q.y,x.array[B+6]=D.x,x.array[B+7]=D.y,B+=8}else{if(x.boundTo==="faces"){s=0;for(J=w.length;s<J;s++)Q=H=v=ka=x.value[w[s]],x.array[B]=v.x,x.array[B+1]=v.y,x.array[B+2]=H.x,x.array[B+3]=H.y,x.array[B+4]=Q.x,x.array[B+5]=Q.y,B+=6;s=0;for(J=la.length;s<J;s++)D=Q=H=v=ka=x.value[la[s]],x.array[B]=
+v.x,x.array[B+1]=v.y,x.array[B+2]=H.x,x.array[B+3]=H.y,x.array[B+4]=Q.x,x.array[B+5]=Q.y,x.array[B+6]=D.x,x.array[B+7]=D.y,B+=8}}else if(x.size===3)if(T=x.type==="c"?["r","g","b"]:["x","y","z"],x.boundTo===void 0||x.boundTo==="vertices"){s=0;for(J=w.length;s<J;s++)D=ma[w[s]],v=x.value[D.a],H=x.value[D.b],Q=x.value[D.c],x.array[B]=v[T[0]],x.array[B+1]=v[T[1]],x.array[B+2]=v[T[2]],x.array[B+3]=H[T[0]],x.array[B+4]=H[T[1]],x.array[B+5]=H[T[2]],x.array[B+6]=Q[T[0]],x.array[B+7]=Q[T[1]],x.array[B+8]=Q[T[2]],
+B+=9;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],v=x.value[D.a],H=x.value[D.b],Q=x.value[D.c],D=x.value[D.d],x.array[B]=v[T[0]],x.array[B+1]=v[T[1]],x.array[B+2]=v[T[2]],x.array[B+3]=H[T[0]],x.array[B+4]=H[T[1]],x.array[B+5]=H[T[2]],x.array[B+6]=Q[T[0]],x.array[B+7]=Q[T[1]],x.array[B+8]=Q[T[2]],x.array[B+9]=D[T[0]],x.array[B+10]=D[T[1]],x.array[B+11]=D[T[2]],B+=12}else{if(x.boundTo==="faces"){s=0;for(J=w.length;s<J;s++)Q=H=v=ka=x.value[w[s]],x.array[B]=v[T[0]],x.array[B+1]=v[T[1]],x.array[B+2]=v[T[2]],
+x.array[B+3]=H[T[0]],x.array[B+4]=H[T[1]],x.array[B+5]=H[T[2]],x.array[B+6]=Q[T[0]],x.array[B+7]=Q[T[1]],x.array[B+8]=Q[T[2]],B+=9;s=0;for(J=la.length;s<J;s++)D=Q=H=v=ka=x.value[la[s]],x.array[B]=v[T[0]],x.array[B+1]=v[T[1]],x.array[B+2]=v[T[2]],x.array[B+3]=H[T[0]],x.array[B+4]=H[T[1]],x.array[B+5]=H[T[2]],x.array[B+6]=Q[T[0]],x.array[B+7]=Q[T[1]],x.array[B+8]=Q[T[2]],x.array[B+9]=D[T[0]],x.array[B+10]=D[T[1]],x.array[B+11]=D[T[2]],B+=12}}else if(x.size===4)if(x.boundTo===void 0||x.boundTo==="vertices"){s=
+0;for(J=w.length;s<J;s++)D=ma[w[s]],v=x.value[D.a],H=x.value[D.b],Q=x.value[D.c],x.array[B]=v.x,x.array[B+1]=v.y,x.array[B+2]=v.z,x.array[B+3]=v.w,x.array[B+4]=H.x,x.array[B+5]=H.y,x.array[B+6]=H.z,x.array[B+7]=H.w,x.array[B+8]=Q.x,x.array[B+9]=Q.y,x.array[B+10]=Q.z,x.array[B+11]=Q.w,B+=12;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],v=x.value[D.a],H=x.value[D.b],Q=x.value[D.c],D=x.value[D.d],x.array[B]=v.x,x.array[B+1]=v.y,x.array[B+2]=v.z,x.array[B+3]=v.w,x.array[B+4]=H.x,x.array[B+5]=H.y,x.array[B+
+6]=H.z,x.array[B+7]=H.w,x.array[B+8]=Q.x,x.array[B+9]=Q.y,x.array[B+10]=Q.z,x.array[B+11]=Q.w,x.array[B+12]=D.x,x.array[B+13]=D.y,x.array[B+14]=D.z,x.array[B+15]=D.w,B+=16}else if(x.boundTo==="faces"){s=0;for(J=w.length;s<J;s++)Q=H=v=ka=x.value[w[s]],x.array[B]=v.x,x.array[B+1]=v.y,x.array[B+2]=v.z,x.array[B+3]=v.w,x.array[B+4]=H.x,x.array[B+5]=H.y,x.array[B+6]=H.z,x.array[B+7]=H.w,x.array[B+8]=Q.x,x.array[B+9]=Q.y,x.array[B+10]=Q.z,x.array[B+11]=Q.w,B+=12;s=0;for(J=la.length;s<J;s++)D=Q=H=v=ka=x.value[la[s]],
+x.array[B]=v.x,x.array[B+1]=v.y,x.array[B+2]=v.z,x.array[B+3]=v.w,x.array[B+4]=H.x,x.array[B+5]=H.y,x.array[B+6]=H.z,x.array[B+7]=H.w,x.array[B+8]=Q.x,x.array[B+9]=Q.y,x.array[B+10]=Q.z,x.array[B+11]=Q.w,x.array[B+12]=D.x,x.array[B+13]=D.y,x.array[B+14]=D.z,x.array[B+15]=D.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(N instanceof THREE.Ribbon){if(k.__dirtyVertices||k.__dirtyColors){m=k;N=l.DYNAMIC_DRAW;T=j=T=q=q=void 0;fa=m.vertices;o=m.colors;s=fa.length;p=o.length;J=m.__vertexArray;M=m.__colorArray;
+K=m.__dirtyColors;if(m.__dirtyVertices){for(q=0;q<s;q++)T=fa[q].position,j=q*3,J[j]=T.x,J[j+1]=T.y,J[j+2]=T.z;l.bindBuffer(l.ARRAY_BUFFER,m.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,J,N)}if(K){for(q=0;q<p;q++)T=o[q],j=q*3,M[j]=T.r,M[j+1]=T.g,M[j+2]=T.b;l.bindBuffer(l.ARRAY_BUFFER,m.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,M,N)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(N instanceof THREE.Line){m=c(N,p);M=m.attributes&&r(m);if(k.__dirtyVertices||k.__dirtyColors||M){N=k;j=l.DYNAMIC_DRAW;
+s=o=A=fa=U=void 0;fa=N.vertices;p=N.colors;s=fa.length;M=p.length;J=N.__vertexArray;q=N.__colorArray;K=N.__dirtyColors;T=N.__webglCustomAttributesList;O=ma=la=w=A=U=void 0;if(N.__dirtyVertices){for(U=0;U<s;U++)A=fa[U].position,o=U*3,J[o]=A.x,J[o+1]=A.y,J[o+2]=A.z;l.bindBuffer(l.ARRAY_BUFFER,N.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,J,j)}if(K){for(fa=0;fa<M;fa++)s=p[fa],o=fa*3,q[o]=s.r,q[o+1]=s.g,q[o+2]=s.b;l.bindBuffer(l.ARRAY_BUFFER,N.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,q,j)}if(T){U=
+0;for(A=T.length;U<A;U++)if(O=T[U],O.needsUpdate&&(O.boundTo===void 0||O.boundTo==="vertices")){o=0;la=O.value.length;if(O.size===1)for(w=0;w<la;w++)O.array[w]=O.value[w];else if(O.size===2)for(w=0;w<la;w++)ma=O.value[w],O.array[o]=ma.x,O.array[o+1]=ma.y,o+=2;else if(O.size===3)if(O.type==="c")for(w=0;w<la;w++)ma=O.value[w],O.array[o]=ma.r,O.array[o+1]=ma.g,O.array[o+2]=ma.b,o+=3;else for(w=0;w<la;w++)ma=O.value[w],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(w=
+0;w<la;w++)ma=O.value[w],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;l.bindBuffer(l.ARRAY_BUFFER,O.buffer);l.bufferData(l.ARRAY_BUFFER,O.array,j)}}}k.__dirtyVertices=!1;k.__dirtyColors=!1;m.attributes&&t(m)}else if(N instanceof THREE.ParticleSystem)m=c(N,p),M=m.attributes&&r(m),(k.__dirtyVertices||k.__dirtyColors||N.sortParticles||M)&&f(k,l.DYNAMIC_DRAW,N),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<=W?j=k:(j=Math.ceil(W*k/(i+k)),i=W-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=da.length;p<d;p++)if(da[p].code===h){o=da[p].program;break a}p=l.createProgram();d=[ya?"#define VERTEX_TEXTURES":"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.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 "+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:"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.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");l.attachShader(p,K("fragment",g+j));l.attachShader(p,
+K("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=da.length;da.push({program:p,code:h});S.info.memory.programs=da.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)}};
+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(),S.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,R(a.format),a.image.width,a.image.height,0,R(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)};this.addPlugin(new THREE.SpritePlugin);this.addPlugin(new THREE.LensFlarePlugin)};
 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};
@@ -485,23 +485,23 @@ c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=p:o.addSelf(a.
 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=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=
+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,C=i/p,P=new THREE.Vector3;P[n]=k>0?1:-1;for(h=0;h<y;h++)for(i=0;i<u;i++){var W=new THREE.Vector3;W[a]=(i*L-q)*c;W[b]=(h*C-r)*f;W[n]=k;j.vertices.push(new THREE.Vertex(W))}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(P),a.vertexNormals.push(P.clone(),P.clone(),P.clone(),P.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,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;
+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(),w=k[i+1][h+1].clone(),z=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,w,z])}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(),w=new THREE.UV(y.u,0),this.faces.push(new THREE.Face3(c,o,p,[q,n,r])),this.faceVertexUvs[0].push([u,y,w])}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(),
+w=new THREE.UV(y.u,1),this.faces.push(new THREE.Face3(c,o,p,[q,n,r])),this.faceVertexUvs[0].push([u,y,w])}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,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;
+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;){W=s;S=s-1;S<0&&(S=a.length-1);for(var b=
+0,c=m+k*2,b=0;b<c;b++){var d=aa*b,e=aa*(b+1),f=l+W+d,g=l+W+e,j=f,d=l+S+d,e=l+S+e,n=g;j+=K;d+=K;e+=K;n+=K;F.faces.push(new THREE.Face4(j,d,e,n,null,null,w));w&&(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+=K;b+=K;c+=K;F.faces.push(new THREE.Face3(a,b,c,null,
+null,y));if(y){var d=z.maxY,e=z.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,w=b.extrudeMaterial,z=this.shapebb;if(n)r=n.getPoints(p),m=r.length,t=!0,o=!1;o||(j=i=k=0);var A,v,G,F=this,K=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();v=0;for(G=p.length;v<G;v++)A=p[v],THREE.Shape.Utils.isClockWise(A)&&
+(p[v]=A.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(q,p);u=q;v=0;for(G=p.length;v<G;v++)A=p[v],q=q.concat(A);var s,N,U,$,R,V,aa=q.length,ja=n.length,I=[];s=0;N=u.length;W=N-1;for(S=s+1;s<N;s++,W++,S++)W===N&&(W=0),S===N&&(S=0),I[s]=d(u[s],u[W],u[S]);var L=[],C,P=I.concat();v=0;for(G=p.length;v<G;v++){A=p[v];C=[];s=0;N=A.length;W=N-1;for(S=s+1;s<N;s++,W++,S++)W===N&&(W=0),S===N&&(S=0),C[s]=d(A[s],A[W],A[S]);L.push(C);P=P.concat(C)}for(U=0;U<k;U++){$=U/k;R=i*(1-$);$=j*Math.sin($*Math.PI/2);
+s=0;for(N=u.length;s<N;s++)V=c(u[s],I[s],$),g(V.x,V.y,-R);v=0;for(G=p.length;v<G;v++){A=p[v];C=L[v];s=0;for(N=A.length;s<N;s++)V=c(A[s],C[s],$),g(V.x,V.y,-R)}}$=j;for(s=0;s<aa;s++)V=o?c(q[s],P[s],$):q[s],t?g(V.x,V.y+r[0].y,r[0].x):g(V.x,V.y,0);for(U=1;U<=m;U++)for(s=0;s<aa;s++)V=o?c(q[s],P[s],$):q[s],t?g(V.x,V.y+r[U-1].y,r[U-1].x):g(V.x,V.y,h/m*U);for(U=k-1;U>=0;U--){$=U/k;R=i*(1-$);$=j*Math.sin($*Math.PI/2);s=0;for(N=u.length;s<N;s++)V=c(u[s],I[s],$),g(V.x,V.y,h+R);v=0;for(G=p.length;v<G;v++){A=
+p[v];C=L[v];s=0;for(N=A.length;s<N;s++)V=c(A[s],C[s],$),t?g(V.x,V.y+r[m-1].y,r[m-1].x+R):g(V.x,V.y,h+R)}}if(o){o=aa*0;for(s=0;s<ja;s++)j=n[s],f(j[2]+o,j[1]+o,j[0]+o);o=aa*(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]+aa*m,j[1]+aa*m,j[2]+aa*m)}var W,S,l=0;e(u);l+=u.length;v=0;for(G=p.length;v<G;v++)A=p[v],e(A),l+=A.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,
@@ -524,8 +524,8 @@ THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:
 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=
+(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,w=void 0,
+z=void 0,A=void 0,v=void 0,G=void 0,F=void 0,K=void 0,y=p[t[m]].x,w=p[t[m]].y,z=p[t[q]].x,A=p[t[q]].y,v=p[t[n]].x,G=p[t[n]].y;if(1.0E-10>(z-y)*(G-w)-(A-w)*(v-y))p=!1;else{for(u=0;u<r;u++)if(!(u==m||u==q||u==n)){var F=p[t[u]].x,K=p[t[u]].y,s=void 0,N=void 0,U=void 0,$=void 0,R=void 0,V=void 0,aa=void 0,ja=void 0,I=void 0,L=void 0,C=void 0,P=void 0,s=U=R=void 0,s=v-z,N=G-A,U=y-v,$=w-G,R=z-y,V=A-w,aa=F-y,ja=K-w,I=F-z,L=K-A,C=F-v,P=K-G,s=s*L-N*I,R=R*ja-V*aa,U=U*P-$*C;if(s>=0&&U>=0&&R>=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);
@@ -536,11 +536,11 @@ e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var d=(a+1)
 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,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()};
+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 w=0,u=h.length,z,A,v={},G={},F=function(a,
+b){v[a]===void 0&&(v[a]=[]);v[a].push(b)},K=function(a,b){G[a]===void 0&&(G[a]={});G[a][b]=null};for(m in q){y=q[m];z=m.split("_");A=z[0];z=z[1];F(A,[A,z]);F(z,[A,z]);n=0;for(r=y.length;n<r;n++)t=y[n],K(A,t,m),K(z,t,m);y.length<2&&(o[m]=!0)}for(m in q)if(y=q[m],t=y[0],y=y[1],z=m.split("_"),A=z[0],z=z[1],r=new THREE.Vector3,o[m]?(r.addSelf(h[A].position),r.addSelf(h[z].position),r.multiplyScalar(0.5)):(r.addSelf(j[t]),r.addSelf(j[y]),r.addSelf(h[A].position),r.addSelf(h[z].position),r.multiplyScalar(0.25)),
+k[m]=u+d.length+w,i.push(new THREE.Vertex(r)),w++,f.supportUVs&&p.length!=0)y=new THREE.UV,y.u=p[A].u+p[z].u,y.v=p[A].v+p[z].v,y.u/=2,y.v/=2,p.push(y);var s,N;z=["123","12","2","23"];r=["123","23","3","31"];var F=["123","31","1","12"],K=["1234","12","2","23"],U=["1234","23","3","34"],$=["1234","34","4","41"],R=["1234","41","1","12"];m=0;for(q=j.length;m<q;m++)t=d[m],y=u+m,t instanceof THREE.Face3?(w=c(t.a,t.b),A=c(t.b,t.c),s=c(t.c,t.a),b(y,k[w],t.b,k[A],t,z),b(y,k[A],t.c,k[s],t,r),b(y,k[s],t.a,k[w],
+t,F)):t instanceof THREE.Face4?(w=c(t.a,t.b),A=c(t.b,t.c),s=c(t.c,t.d),N=c(t.d,t.a),b(y,k[w],t.b,k[A],t,K),b(y,k[A],t.c,k[s],t,U),b(y,k[s],t.d,k[N],t,$),b(y,k[N],t.a,k[w],t,R)):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(v[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 G[m])i.addSelf(j[n]),y++;w=0;u=v[m].length;for(n=0;n<u;n++)o[c(v[m][n][0],v[m][n][1])]&&w++;if(w!=2){i.divideScalar(y);for(n=0;n<
+u;n++)y=v[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)==
@@ -559,17 +559,17 @@ THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){
 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,
+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=[],w,z,A,v,G,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,
+4+t.material_index_bytes;w=t.ntri_flat*b;z=t.ntri_smooth*(b+t.normal_index_bytes*3);A=t.ntri_flat_uv*(b+t.uv_index_bytes*3);v=t.ntri_smooth_uv*(b+t.normal_index_bytes*3+t.uv_index_bytes*3);G=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);w=r+w+c(t.ntri_flat*2);z=w+z+c(t.ntri_smooth*2);A=z+A+c(t.ntri_flat_uv*2);v=A+v+c(t.ntri_smooth_uv*2);G=v+G+c(t.nquad_flat*2);
+b=G+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)}})(z);(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)}})(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;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)}})(w);(function(a){var b=t.nquad_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(v);(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)}})(G);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){da=a;d=d||X;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",G,"material");ta=b("//dae:library_effects/dae:effect",U,"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",R,"animation");pa=b(".//dae:library_visual_scenes/dae:visual_scene",
+k,"visual_scene");wa=[];va=[];(a=da.evaluate(".//dae:scene/dae:instance_visual_scene",da,I,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ga=pa[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 ia);i={scene:O,morphs:wa,skins:va,dae:{images:na,materials:oa,effects:ta,geometries:ra,controllers:qa,animations:ia,visualScenes:pa,scene:ga}};d&&d(i);return i}function b(a,b,c){for(var a=da.evaluate(a,
+da,I,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=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++)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=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,
@@ -578,89 +578,89 @@ p.material;l++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.
 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=
+0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";this.stride=this.count=0;this.params=[]}function z(){this.input={}}function A(){this.semantic="";this.offset=0;this.source="";this.set=0}function v(a){this.id=a;this.type=null}function G(){this.name=this.id="";this.instance_effect=null}function F(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function K(a,
+b){this.type=a;this.effect=b;this.material=null}function s(a){this.effect=a;this.format=this.init_from=null}function N(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 $(){this.url=""}function R(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function V(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
+this.dotSyntax=this.sid=null}function aa(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(ca[b]!=void 0)return ca[b];ca[b]=(new v(b)).parse(a);return ca[b]}function I(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function L(a){for(var a=P(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function C(a){for(var a=P(a),b=[],
+c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function P(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function W(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function S(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+=S(a.x,b)+",";c+=S(a.y,b)+",";c+=S(a.z,b);return c}var da=null,O=null,ga,X=null,
+ca={},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 v).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};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 v).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 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()}}};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 A).parse(g));break;case "v":c=C(g.textContent);break;case "vcount":d=C(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=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;
+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=da.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",da,I,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=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=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],
+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=da.evaluate(".//dae:instance_material",c,I,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=da.evaluate(".//dae:instance_material",
+c,I,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 z).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=ca[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],
+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=ca[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=
+a.input.POSITION.source};y.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=W(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=C(c.textContent);break;case "p":this.p=C(c.textContent)}}return this};w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=W(a,"count",0);this.stride=
+W(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};z.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new 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=W(a,"set",-1);this.offset=W(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};v.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=P(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=
+C(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=P(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 w).parse(c.childNodes[d]);break}}}return this};v.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=
+this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};G.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new $).parse(a.childNodes[b]);break}return this};F.prototype.isColor=
+function(){return this.texture==null};F.prototype.isTexture=function(){return this.texture!=null};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=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};K.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=da.evaluate(".//dae:float",c,I,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};K.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.nodeName)}}return this};N.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 N(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 K(c.nodeName,this)).parse(c)}}};$.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};R.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 v).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new aa(this)).parse(c));break;case "channel":this.channel.push((new V(this)).parse(c))}}return this};V.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};aa.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};aa.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))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}};
+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))X=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,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+=
+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,w=a.faces;o=a.vertices;var z=a.normals,A=a.colors,v=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&v++;for(c=0;c<v;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=w.length;j<k;){b=w[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=w[j++],r.b=w[j++],r.c=w[j++],r.d=w[j++],o=4):(r=new THREE.Face3,r.a=w[j++],r.b=w[j++],r.c=w[j++],o=3);if(i)i=w[j++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<v;c++)t=a.uvs[c],q=w[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<v;c++){t=a.uvs[c];u=[];
+for(e=0;e<o;e++)q=w[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=w[j++]*3,e=new THREE.Vector3,e.x=z[m++],e.y=z[m++],e.z=z[m],r.normal=e;if(p)for(c=0;c<o;c++)m=w[j++]*3,e=new THREE.Vector3,e.x=z[m++],e.y=z[m++],e.z=z[m],r.vertexNormals.push(e);if(n)p=w[j++],p=new THREE.Color(A[p]),r.color=p;if(b)for(c=0;c<o;c++)p=w[j++],p=new THREE.Color(A[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: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.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function e(){var a;for(p in U.objects)if(!I.objects[p])if(t=U.objects[p],t.geometry!==void 0){if(F=I.geometries[t.geometry]){a=!1;for(C=0;C<t.materials.length;C++)N=I.materials[t.materials[C]],a=N instanceof THREE.ShaderMaterial;a&&F.computeTangents();w=t.position;z=t.rotation;A=t.quaternion;v=t.scale;A=0;N.length==0&&(N=new THREE.MeshFaceMaterial);N.length>1&&(N=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(F,N);a.name=p;a.position.set(w[0],w[1],w[2]);A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]);a.scale.set(v[0],v[1],v[2]);a.visible=t.visible;I.scene.add(a);I.objects[p]=a;if(t.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);I.scene.collisions.colliders.push(b)}if(t.castsShadow)b=new THREE.ShadowVolume(F),I.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},I.triggers[a.name]=b)}}else w=t.position,z=t.rotation,A=t.quaternion,v=t.scale,A=0,a=new THREE.Object3D,a.name=p,a.position.set(w[0],w[1],w[2]),A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]),a.scale.set(v[0],v[1],v[2]),a.visible=t.visible!==void 0?t.visible:!1,I.scene.add(a),I.objects[p]=a,I.empties[p]=a,t.trigger&&t.trigger.toLowerCase()!="none"&&(b={type:t.trigger,object:t},I.triggers[a.name]=b)}function g(a){return function(b){I.geometries[a]=
+b;e();R-=1;i.onLoadComplete();h()}}function f(a){return function(b){I.geometries[a]=b}}function h(){i.callbackProgress({totalModels:aa,totalTextures:ja,loadedModels:aa-R,loadedTextures:ja-V},I);i.onLoadProgress();R==0&&V==0&&b(I)}var i=this,j=THREE.Loader.prototype.extractUrlbase(c),k,o,p,m,q,n,r,t,u,y,w,z,A,v,G,F,K,s,N,U,$,R,V,aa,ja,I;U=a;c=new THREE.BinaryLoader;$=new THREE.JSONLoader;V=R=0;I={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)I.scene.collisions=new THREE.CollisionSystem;if(U.transform){a=U.transform.position;u=U.transform.rotation;var L=U.transform.scale;a&&I.scene.position.set(a[0],a[1],a[2]);u&&I.scene.rotation.set(u[0],u[1],u[2]);L&&I.scene.scale.set(L[0],L[1],L[2]);(a||u||L)&&I.scene.updateMatrix()}a=function(){V-=1;h();i.onLoadComplete()};for(q in U.cameras)u=U.cameras[q],u.type=="perspective"?K=new THREE.PerspectiveCamera(u.fov,
+u.aspect,u.near,u.far):u.type=="ortho"&&(K=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far)),w=u.position,u=u.target,K.position.set(w[0],w[1],w[2]),K.target=new THREE.Vector3(u[0],u[1],u[2]),I.cameras[q]=K;for(m in U.lights)u=U.lights[m],q=u.color!==void 0?u.color:16777215,K=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(w=u.direction,y=new THREE.DirectionalLight(q,K),y.position.set(w[0],w[1],w[2]),y.position.normalize()):u.type=="point"?(w=u.position,y=u.distance,
+y=new THREE.PointLight(q,K,y),y.position.set(w[0],w[1],w[2])):u.type=="ambient"&&(y=new THREE.AmbientLight(q)),I.scene.add(y),I.lights[m]=y;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)),u=m.color,s.color.setRGB(u[0],u[1],u[2]),I.fogs[n]=s;if(I.cameras&&U.defaults.camera)I.currentCamera=I.cameras[U.defaults.camera];if(I.fogs&&U.defaults.fog)I.scene.fog=I.fogs[U.defaults.fog];u=U.defaults.bgcolor;I.bgColor=new THREE.Color;
+I.bgColor.setRGB(u[0],u[1],u[2]);I.bgColorAlpha=U.defaults.bgalpha;for(k in U.geometries)if(n=U.geometries[k],n.type=="bin_mesh"||n.type=="ascii_mesh")R+=1,i.onLoadStart();aa=R;for(k in U.geometries)n=U.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),I.geometries[k]=F):n.type=="plane"?(F=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),I.geometries[k]=F):n.type=="sphere"?
+(F=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),I.geometries[k]=F):n.type=="cylinder"?(F=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),I.geometries[k]=F):n.type=="torus"?(F=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),I.geometries[k]=F):n.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(n.subdivisions),I.geometries[k]=F):n.type=="bin_mesh"?c.load(d(n.url,U.urlBaseType),g(k)):n.type=="ascii_mesh"?$.load(d(n.url,U.urlBaseType),
+g(k)):n.type=="embedded_mesh"&&(n=U.embeds[n.id])&&$.createModel(n,f(k),"");for(r in U.textures)if(k=U.textures[r],k.url instanceof Array){V+=k.url.length;for(n=0;n<k.url.length;n++)i.onLoadStart()}else V+=1,i.onLoadStart();ja=V;for(r in U.textures){k=U.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 C=0;C<k.url.length;C++)n[C]=d(k.url[C],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]]}}I.textures[r]=n}for(o in U.materials){r=U.materials[o];for(G in r.parameters)if(G=="envMap"||G=="map"||G=="lightMap")r.parameters[G]=I.textures[r.parameters[G]];else if(G=="shading")r.parameters[G]=r.parameters[G]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(G=="blending")r.parameters[G]=THREE[r.parameters[G]]?THREE[r.parameters[G]]:THREE.NormalBlending;else if(G=="combine")r.parameters[G]=r.parameters[G]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(G==
+"vertexColors")if(r.parameters[G]=="face")r.parameters[G]=THREE.FaceColors;else if(r.parameters[G])r.parameters[G]=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;$=r.parameters.shininess;a.tNormal.texture=I.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=I.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=$;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);I.materials[o]=r}e();i.callbackSync(I);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),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)};
+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,w,z=a.length;for(c=0;c<z;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;y=d;w=e;i=f;u=d;var A=e,v=f,G=g.materials[0],F=j[A*3],K=j[A*3+1],A=j[A*3+2],s=j[v*3],N=j[v*3+1],v=j[v*3+2];u=new THREE.Vector3(j[u*3],j[u*3+1],j[u*3+2]);A=new THREE.Vector3(F,K,A);v=new THREE.Vector3(s,N,v);g.faces.push(new THREE.Face3(y,w,i,[u,A,v],null,G));g=k[d*2];d=k[d*2+
+1];i=k[e*2];u=k[e*2+1];y=k[f*2];w=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,w));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,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+
+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],w=this.field[k],z=this.field[p],A=this.field[m],v=this.field[q];r<f&&(n|=1);t<f&&(n|=2);u<f&&(n|=8);y<f&&(n|=4);w<f&&(n|=16);z<f&&(n|=32);A<f&&(n|=128);v<f&&(n|=64);var G=THREE.edgeTable[n];if(G===0)return 0;var F=this.delta,K=a+
+F,s=b+F,F=e+F;G&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,r,t));G&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(i*3,this.vlist,this.nlist,3,f,K,b,e,t,y));G&4&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,6,f,a,s,e,u,y));G&8&&(this.compNorm(g),this.compNorm(j),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,r,u));G&16&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,12,f,a,b,F,w,z));G&32&&(this.compNorm(p),
+this.compNorm(q),this.VIntY(p*3,this.vlist,this.nlist,15,f,K,b,F,z,v));G&64&&(this.compNorm(m),this.compNorm(q),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,s,F,A,v));G&128&&(this.compNorm(k),this.compNorm(m),this.VIntY(k*3,this.vlist,this.nlist,21,f,a,b,F,w,A));G&256&&(this.compNorm(g),this.compNorm(k),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,r,w));G&512&&(this.compNorm(i),this.compNorm(p),this.VIntZ(i*3,this.vlist,this.nlist,27,f,K,b,e,t,z));G&1024&&(this.compNorm(o),this.compNorm(q),this.VIntZ(o*
+3,this.vlist,this.nlist,30,f,K,s,e,y,v));G&2048&&(this.compNorm(j),this.compNorm(m),this.VIntZ(j*3,this.vlist,this.nlist,33,f,a,s,e,u,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+
 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,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=
@@ -698,24 +698,24 @@ 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,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)}};
+"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=a.length;if(i){var j=new THREE.Vector3,k=h/f,o=f*0.5,p=h*0.5,m=16/h,q=new THREE.Vector2(m*k,m),n=new THREE.Vector3(1,1,0),r=new THREE.Vector2(1,1),t=d.uniforms,m=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
+b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(t.occlusionMap,0);b.uniform1i(t.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(m.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(m.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var u,y,w,z,A;for(u=0;u<i;u++)if(m=16/h,q.set(m*k,m),z=a[u],j.set(z.matrixWorld.n14,z.matrixWorld.n24,z.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(j),
+g.projectionMatrix.multiplyVector3(j),n.copy(j),r.x=n.x*o+o,r.y=n.y*p+p,d.hasVertexTexture||r.x>0&&r.x<f&&r.y>0&&r.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,r.x-8,r.y-8,16,16,0);b.uniform1i(t.renderType,0);b.uniform2f(t.scale,q.x,q.y);b.uniform3f(t.screenPosition,n.x,n.y,n.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,r.x-8,r.y-8,16,16,0);b.uniform1i(t.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);z.positionScreen.copy(n);z.customUpdateCallback?z.customUpdateCallback(z):z.updateLensFlares();b.uniform1i(t.renderType,2);b.enable(b.BLEND);y=0;for(w=z.lensFlares.length;y<w;y++)if(A=z.lensFlares[y],A.opacity>0.0010&&A.scale>0.0010)n.x=A.x,n.y=A.y,n.z=A.z,m=A.size*A.scale/
+h,q.x=m*k,q.y=m,b.uniform3f(t.screenPosition,n.x,n.y,n.z),b.uniform2f(t.scale,q.x,q.y),b.uniform1f(t.rotation,A.rotation),b.uniform1f(t.opacity,A.opacity),b.uniform3f(t.color,A.color.r,A.color.g,A.color.b),c.setBlending(A.blending),c.setTexture(A.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)}};
+"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h,i){var e=e.__webglSprites,j=e.length;if(j){var k=d.attributes,o=d.uniforms,p=h/f;f*=0.5;var m=h*0.5,q=!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(o.projectionMatrix,!1,i);b.activeTexture(b.TEXTURE0);b.uniform1i(o.map,0);for(var n=[],i=0;i<j;i++)if(k=e[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.sort(a);for(i=
+0;i<j;i++)k=e[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,(m-k.position.y)/m,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),n[0]=g*p*k.scale.x,n[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,n),k.mergeWith3D&&!q?(b.enable(b.DEPTH_TEST),q=!0):!k.mergeWith3D&&q&&(b.disable(b.DEPTH_TEST),q=!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)}};
+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,w=y*j/125,z=j*Math.tan(o*Math.PI/360),A;f.n14=y;h.n14=-y;y=-z*i+w;A=z*i+w;u.n11=2*j/(A-y);u.n13=(A+y)/(A-y);e.projectionMatrix.copy(u);y=-z*i-w;A=z*i-w;u.n11=
+2*j/(A-y);u.n13=(A+y)/(A-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}"},

+ 141 - 141
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],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<
+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={},n=0;n<a.materials.length;n++)o[a.materials[n].id]=n;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var n=0,s=h.length;n<s;n++){var m=new THREE.Vertex(h[n].position.clone());c&&c.multiplyVector3(m.position);f.push(m)}n=
+0;for(s=k.length;n<s;n++){var f=k[n],p,l,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(m=r.length;h<m;h++)l=r[h].clone(),d&&d.multiplyVector3(l),p.vertexNormals.push(l);p.color.copy(f.color);h=0;for(m=t.length;h<m;h++)l=t[h],p.vertexColors.push(l.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);p.materialIndex=m}p.centroid.copy(f.centroid);c&&c.multiplyVector3(p.centroid);i.push(p)}n=0;for(s=q.length;n<s;n++){c=q[n];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,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<
 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(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();
+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,q,o,n;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,n=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,q,n),d._area2=THREE.GeometryUtils.triangleArea(q,o,n),d._area=d._area1+d._area2;i+=d._area;k[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 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}};
+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,n=(q+1)%e,s=j-1<0?d-1:j-1,m=(j+1)%d,p=[],l=[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+m)*4]/255*b]);
+p.push([1,0,h[(q*d+m)*4]/255*b]);p.push([1,1,h[(n*d+m)*4]/255*b]);p.push([0,1,h[(n*d+j)*4]/255*b]);p.push([-1,1,h[(n*d+s)*4]/255*b]);o=[];s=p.length;for(n=0;n<s;n++){var m=p[n],r=p[(n+1)%s],m=[m[0]-l[0],m[1]-l[1],m[2]-l[2]],r=[r[0]-l[0],r[1]-l[1],r[2]-l[2]];o.push(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]]))}p=[0,0,0];for(n=0;n<o.length;n++)p[0]+=o[n][0],p[1]+=o[n][1],p[2]+=o[n][2];p[0]/=o.length;p[1]/=o.length;p[2]/=o.length;l=(q*d+j)*4;k[l]=(p[0]+1)/2*255|0;k[l+1]=(p[1]+0.5)*
+255|0;k[l+2]=p[2]*255|0;k[l+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,18 +58,18 @@ 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,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.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,k,j,q,o,n,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];q=g[0];o=g[1];c.length>0?(f=c[c.length-1],n=f.x,s=f.y):(f=this.actions[d-1].args,n=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)m=f/a,g=THREE.Shape.Utils.b2(m,n,q,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];q=g[0];o=g[1];k=g[2];j=g[3];c.length>0?(f=c[c.length-1],n=f.x,s=f.y):(f=this.actions[d-1].args,n=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)m=f/a,g=THREE.Shape.Utils.b3(m,n,q,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];q=g[3];m=g[4];o=!!g[5];j=f[f.length-2];n=f[f.length-1];f.length==0&&(j=n=0);s=m-q;var p=a*2;for(f=1;f<=p;f++)m=f/p,o||(m=1-m),m=q+m*s,g=j+h+k*Math.cos(m),m=n+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,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.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,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,
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,k,j,q,o,n,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];n=[];for(q=0;q<c.length;q++)j=c[q],j=o.distanceToSquared(j),n.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 m=[k[f],c[h],c[e]];q=THREE.FontUtils.Triangulate.area(m);var p=[k[f],k[g],c[h]];o=THREE.FontUtils.Triangulate.area(p);n=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);p=[k[f],k[g],c[h]];p=THREE.FontUtils.Triangulate.area(p);q+o>m+p&&(h=n,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);n=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(n).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};
@@ -83,11 +83,11 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
 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,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.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 n=0,s=this.hierarchy.length;n<s;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&j[n][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=j[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;m<3;m++){c=b[m];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=o){if(q<o)if(this.loop){f=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<q;)f=h,h=this.getNextKeyWith(c,n,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,n,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 "+n),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",n,f.index-1).pos,this.points[1]=e,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",n,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(n=0;n<this.hierarchy.length;n++)j[n][k]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,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};
 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]};
@@ -110,14 +110,14 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=
 1;this.constrainVertical&&(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*
 Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",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:[]},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]=
+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(),p=g.length,l=0;f=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<p-1;f++)l=d*h.chunks[f]/h.total,b.keys[f]={time:l,pos:g[f]};e.hierarchy[0]=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function 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}),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),
+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}),n=0;n<b.points.length;n++)c=new THREE.Mesh(f,h),c.position.copy(b.points[n]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
 !1)}};THREE.PathControlsIdCounter=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=
@@ -128,38 +128,38 @@ 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,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,
+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,n=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,
 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){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){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){q=(a.clientX-n)/window.innerWidth;o=(a.clientY-s)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
 function(a){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,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-
+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-
 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(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",
+-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",
 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 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=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,j,n){var m,o=d||1,l=e||1,q=h/2,p=i/2,s=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")m="y",l=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")m="x",o=g||1;var r=o+1,t=l+1,L=h/o,H=i/l,M=new THREE.Vector3;M[m]=j>0?1:-1;for(h=0;h<t;h++)for(i=0;i<r;i++){var J=new THREE.Vector3;J[a]=(i*L-q)*c;J[b]=(h*H-p)*f;J[m]=j;k.vertices.push(new THREE.Vertex(J))}for(h=0;h<l;h++)for(i=0;i<o;i++)a=
+new THREE.Face4(i+r*h+s,i+r*(h+1)+s,i+1+r*(h+1)+s,i+1+r*h+s),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=n,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/o,h/l),new THREE.UV(i/o,(h+1)/l),new THREE.UV((i+1)/o,(h+1)/l),new THREE.UV((i+1)/o,h/l)])}THREE.Geometry.call(this);var k=this,j=a/2,q=b/2,o=c/2,n,s,m,p,l,r;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(f)}n=0;p=1;s=2;l=
+3;m=4;r=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var t in h)this.sides[t]!=void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,j,n);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,l);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 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.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=[],n=i/e,s=n*(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),-n*c+f,s*Math.cos(m*Math.PI*2))));q.push(this.vertices.length-1);o.push(new THREE.UV(m,n))}k.push(q);j.push(o)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=k[i][h],q=k[i+1][h],o=k[i+1][h+1],n=k[i][h+1],s=
+this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[q].position.clone().setY(0).normalize(),p=this.vertices[o].position.clone().setY(0).normalize(),l=this.vertices[n].position.clone().setY(0).normalize(),r=j[i][h].clone(),t=j[i+1][h].clone(),w=j[i+1][h+1].clone(),y=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,q,o,n,[s,m,p,l]));this.faceVertexUvs[0].push([r,t,w,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),m=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),r=j[0][h].clone(),t=j[0][h+1].clone(),w=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,q,o,[s,m,p])),this.faceVertexUvs[0].push([r,t,w])}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),m=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),r=j[i][h+1].clone(),t=j[i][h].clone(),
+w=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,q,o,[s,m,p])),this.faceVertexUvs[0].push([r,t,w])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.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,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;
+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(v=a.length;--v>=0;){J=v;N=v-1;N<0&&(N=a.length-1);for(var b=
+0,c=n+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,w));w&&(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,n=b.steps!==void 0?b.steps:1,s=b.bendPath,m=b.extrudePath,p,l=!1,r=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,t=b.material,w=b.extrudeMaterial,y=this.shapebb;if(m)p=m.getPoints(o),n=p.length,l=!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(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 v,D,B,G,I,E,K=s.length,O=m.length,C=[];v=0;D=r.length;J=D-1;for(N=v+1;v<D;v++,J++,N++)J===D&&(J=0),N===D&&(N=0),C[v]=d(r[v],r[J],r[N]);var L=[],H,M=C.concat();x=0;for(z=o.length;x<z;x++){u=o[x];H=[];v=0;D=u.length;J=D-1;for(N=v+1;v<D;v++,J++,N++)J===D&&(J=0),N===D&&(N=0),H[v]=d(u[v],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);v=
+0;for(D=r.length;v<D;v++)E=c(r[v],C[v],G),g(E.x,E.y,-I);x=0;for(z=o.length;x<z;x++){u=o[x];H=L[x];v=0;for(D=u.length;v<D;v++)E=c(u[v],H[v],G),g(E.x,E.y,-I)}}G=k;for(v=0;v<K;v++)E=q?c(s[v],M[v],G):s[v],l?g(E.x,E.y+p[0].y,p[0].x):g(E.x,E.y,0);for(B=1;B<=n;B++)for(v=0;v<K;v++)E=q?c(s[v],M[v],G):s[v],l?g(E.x,E.y+p[B-1].y,p[B-1].x):g(E.x,E.y,h/n*B);for(B=j-1;B>=0;B--){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);v=0;for(D=r.length;v<D;v++)E=c(r[v],C[v],G),g(E.x,E.y,h+I);x=0;for(z=o.length;x<z;x++){u=o[x];
+H=L[x];v=0;for(D=u.length;v<D;v++)E=c(u[v],H[v],G),l?g(E.x,E.y+p[n-1].y,p[n-1].x+I):g(E.x,E.y,h+I)}}if(q){q=K*0;for(v=0;v<O;v++)k=m[v],f(k[2]+q,k[1]+q,k[0]+q);q=K*(n+j*2);for(v=0;v<O;v++)k=m[v],f(k[0]+q,k[1]+q,k[2]+q)}else{for(v=0;v<O;v++)k=m[v],f(k[2],k[1],k[0]);for(v=0;v<O;v++)k=m[v],f(k[0]+K*n,k[1]+K*n,k[2]+K*n)}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 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.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 n=h/b,s=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+n*e)*Math.sin(g+s*f),a*Math.cos(g+s*f),a*Math.sin(d+n*e)*Math.sin(g+s*f))));q.push(this.vertices.length-1);o.push(new THREE.UV(n,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(),n=this.vertices[g].position.clone().normalize(),s=this.vertices[f].position.clone().normalize(),m=j[i][h+1].clone(),p=j[i][h].clone(),l=j[i+1][h].clone(),r=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,f,[q,n,s])),this.faceVertexUvs[0].push([m,l,r])):Math.abs(this.vertices[g].position.y)==
+a?(this.faces.push(new THREE.Face3(d,e,g,[q,o,n])),this.faceVertexUvs[0].push([m,p,l])):(this.faces.push(new THREE.Face4(d,e,g,f,[q,o,n,s])),this.faceVertexUvs[0].push([m,p,l,r]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.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,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};
+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,n,s,m,p,l=b.glyphs[a]||b.glyphs["?"];if(l){if(l.o){b=l._cachedOutline||(l._cachedOutline=l.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;n=b[a++]*c+d;s=b[a++]*c;e.quadraticCurveTo(n,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,n,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,n=b[a++]*c+d,s=b[a++]*-c,m=b[a++]*c+d,p=b[a++]*-c,e.bezierCurveTo(i,j,n,s,m,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,n,
+m,i),r=THREE.Shape.Utils.b3(r,o,s,p,j),g.push(new THREE.Vector2(t,r))}}}return{offset:l.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 n=i,s=k,m=j,p=e,l=f,r=void 0,t=void 0,w=void 0,
+y=void 0,u=void 0,x=void 0,z=void 0,A=void 0,F=void 0,t=o[l[n]].x,w=o[l[n]].y,y=o[l[s]].x,u=o[l[s]].y,x=o[l[m]].x,z=o[l[m]].y;if(1.0E-10>(y-t)*(z-w)-(u-w)*(x-t))o=!1;else{for(r=0;r<p;r++)if(!(r==n||r==s||r==m)){var A=o[l[r]].x,F=o[l[r]].y,v=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,v=B=I=void 0,v=x-y,D=z-u,B=t-x,G=w-z,I=y-t,E=u-w,K=A-t,O=F-w,C=A-y,L=F-u,H=A-x,M=F-z,v=v*L-D*C,I=I*O-E*K,B=B*M-G*H;if(v>=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};
 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,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.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,n,m,l=0;l<4;l++){m=i[l];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<m.length;p++)n=h.vertexColors[m[p]-1],k.r+=n.r,k.g+=n.g,k.b+=n.b;k.r/=m.length;k.g/=m.length;k.b/=m.length;j.vertexColors[l]=k}}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=[],n,s,m,p,l,r=a.faceVertexUvs[0];n=0;for(s=r.length;n<s;n++){m=0;for(p=r[n].length;m<p;m++)l=d[n]["abcd".charAt(m)],o[l]||(o[l]=r[n][m])}var t;n=0;for(s=d.length;n<s;n++)if(l=d[n],k.push(l.centroid),i.push(new THREE.Vertex(l.centroid)),f.supportUVs&&o.length!=0){t=new THREE.UV;if(l instanceof THREE.Face3)t.u=o[l.a].u+o[l.b].u+o[l.c].u,t.v=o[l.a].v+o[l.b].v+o[l.c].v,t.u/=3,t.v/=3;else if(l instanceof THREE.Face4)t.u=
+o[l.a].u+o[l.b].u+o[l.c].u+o[l.d].u,t.v=o[l.a].v+o[l.b].v+o[l.c].v+o[l.d].v,t.u/=4,t.v/=4;o.push(t)}s=function(a){function 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 w=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(n in s){t=s[n];y=n.split("_");u=y[0];y=y[1];A(u,[u,y]);A(y,[u,y]);m=0;for(p=t.length;m<p;m++)l=t[m],F(u,l,n),F(y,l,n);t.length<2&&(q[n]=!0)}for(n in s)if(t=s[n],l=t[0],t=t[1],y=n.split("_"),u=y[0],y=y[1],p=new THREE.Vector3,q[n]?(p.addSelf(h[u].position),p.addSelf(h[y].position),p.multiplyScalar(0.5)):(p.addSelf(k[l]),p.addSelf(k[t]),p.addSelf(h[u].position),p.addSelf(h[y].position),p.multiplyScalar(0.25)),
+j[n]=r+d.length+w,i.push(new THREE.Vertex(p)),w++,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 v,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"];n=0;for(s=k.length;n<s;n++)l=d[n],t=r+n,l instanceof THREE.Face3?(w=c(l.a,l.b),u=c(l.b,l.c),v=c(l.c,l.a),b(t,j[w],l.b,j[u],l,y),b(t,j[u],l.c,j[v],l,p),b(t,j[v],l.a,j[w],
+l,A)):l instanceof THREE.Face4?(w=c(l.a,l.b),u=c(l.b,l.c),v=c(l.c,l.d),D=c(l.d,l.a),b(t,j[w],l.b,j[u],l,F),b(t,j[u],l.c,j[v],l,B),b(t,j[v],l.d,j[D],l,G),b(t,j[D],l.a,j[w],l,I)):console.log("face should be a face!",l);d=i;i=new THREE.Vector3;j=new THREE.Vector3;n=0;for(s=h.length;n<s;n++)if(x[n]!==void 0){i.set(0,0,0);j.set(0,0,0);l=new THREE.Vector3(0,0,0);t=0;for(m in z[n])i.addSelf(k[m]),t++;w=0;r=x[n].length;for(m=0;m<r;m++)q[c(x[n][m][0],x[n][m][1])]&&w++;if(w!=2){i.divideScalar(t);for(m=0;m<
+r;m++)t=x[n][m],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(r);l.addSelf(h[n].position);l.multiplyScalar(r-3);l.addSelf(i);l.addSelf(j.multiplyScalar(2));l.divideScalar(r);d[n].position=l}}a.vertices=d;a.faces=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,37 +206,37 @@ 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),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;
+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;
 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,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",
+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,n=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=n[d*3];f=n[d*3+1];g=n[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 l=[];l.push(new THREE.UV(h,e));l.push(new THREE.UV(i,j));l.push(new THREE.UV(f,k));g.push(l)}}
+function j(b,c){var d,e,f,g,h,i,j,k,l,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[d*4];f=o[d*4+1];g=o[d*4+2];h=o[d*4+3];i=t[e*2];e=t[e*2+1];j=t[f*2];l=t[f*2+1];k=t[g*2];n=t[g*2+1];g=t[h*2];f=t[h*2+1];h=m.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(j,l));p.push(new THREE.UV(k,n));p.push(new THREE.UV(g,f));h.push(p)}}function q(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],m.faces.push(new THREE.Face3(e,
+f,g,null,null,h))}function o(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],m.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function n(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=n[e];var o=r[k*3],p=r[k*3+1];k=r[k*3+2];var q=r[l*3],s=r[l*3+1];l=r[l*3+2];m.faces.push(new THREE.Face3(f,
+g,h,[new THREE.Vector3(r[j*3],r[j*3+1],r[j*3+2]),new THREE.Vector3(o,p,k),new THREE.Vector3(q,s,l)],null,i))}}function s(b,c,d,e){for(var f,g,h,i,j,k,l,n,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];n=d[e*4+2];o=d[e*4+3];j=p[e];var q=r[l*3],s=r[l*3+1];l=r[l*3+2];var t=r[n*3],u=r[n*3+1];n=r[n*3+2];var w=r[o*3],x=r[o*3+1];o=r[o*3+2];m.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(r[k*
+3],r[k*3+1],r[k*3+2]),new THREE.Vector3(q,s,l),new THREE.Vector3(t,u,n),new THREE.Vector3(w,x,o)],null,j))}}var m=this,p=0,l,r=[],t=[],w,y,u,x,z,A;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(m,d,b);l={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,p,12),header_bytes: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)};l.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");p+=l.header_bytes;b=l.vertex_index_bytes*3+l.material_index_bytes;A=l.vertex_index_bytes*
+4+l.material_index_bytes;w=l.ntri_flat*b;y=l.ntri_smooth*(b+l.normal_index_bytes*3);u=l.ntri_flat_uv*(b+l.uv_index_bytes*3);x=l.ntri_smooth_uv*(b+l.normal_index_bytes*3+l.uv_index_bytes*3);z=l.nquad_flat*A;b=l.nquad_smooth*(A+l.normal_index_bytes*4);A=l.nquad_flat_uv*(A+l.uv_index_bytes*4);p+=function(b){var c=l.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],m.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(p);
+p+=function(b){var c=l.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],r.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(p);p+=c(l.nnormals*3);p+=function(b){var c=l.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],t.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(p);w=p+w+c(l.ntri_flat*2);y=w+y+c(l.ntri_smooth*2);u=y+u+c(l.ntri_flat_uv*2);x=u+x+c(l.ntri_smooth_uv*2);z=x+z+c(l.nquad_flat*2);
+b=z+b+c(l.nquad_smooth*2);A=b+A+c(l.nquad_flat_uv*2);(function(a){var b=l.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;q(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,c)}})(y);(function(a){var b=l.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;n(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,d)}})(u);(function(a){var b=l.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
+c)}})(b);(function(a){var b=l.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(A);(function(a){var b=l.ntri_flat;b&&q(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(p);(function(a){var b=l.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;n(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(w);(function(a){var b=l.nquad_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(x);(function(a){var b=
+l.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(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",
 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={},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 '"+
+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 s=i.weights[p][q];s.joint==m&&j.weights.push(s)}}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===
+0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=S[i.url],k={},l=0,o;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var p=aa[$[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=k[o.symbol]=p.material;l++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=
+i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)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 n?R[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(p=S[k.targets[l]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
 h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+W.length;W.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(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 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=
+null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function q(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function s(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function p(){this.id="";this.mesh=null}function l(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function r(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";this.stride=this.count=0;this.params=[]}function 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 v(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=
@@ -245,33 +245,33 @@ c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute(
 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];
+0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new q).parse(c))}}return this};q.prototype.getChannelForTransform=
+function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};q.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
+b);if(d)return d}return null};q.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};q.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};q.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
+this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new q).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new m).parse(b));break;case "instance_light":break;case "instance_node":b=
+b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new q).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in U)for(var e=U[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
 if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=
-this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
+this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};q.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
 this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=L(a.textContent);this.updateMatrix();return this};o.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
-case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};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];
+case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
 if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=P.evaluate(".//dae:instance_material",c,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new s).parse(d)),d=c.iterateNext()}}return this};s.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};m.prototype.parse=function(a){this.url=
-a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=P.evaluate(".//dae:instance_material",c,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new s).parse(b)),b=a.iterateNext();break}}return this};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=
+a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=P.evaluate(".//dae:instance_material",c,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new s).parse(b)),b=a.iterateNext();break}}return this};p.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
+(new l(this)).parse(c)}}return this};l.prototype.parse=function(a){function b(a,c){var d=Q(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":O(d);break;case "vertices":this.vertices=(new 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],
+return this};l.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,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 o=[],q=[],s={},r=[];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);o.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":s[i.set]===void 0&&(s[i.set]=[]);s[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;n==3?t=new THREE.Face3(o[0],o[1],o[2],[q[0],q[1],q[2]],r.length?r:new THREE.Color):n==4&&(t=new THREE.Face4(o[0],o[1],o[2],o[3],[q[0],q[1],q[2],q[3]],r.length?r:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<p.length;f++)e=s[p[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==
+H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=J(a,"count",0);this.stride=J(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};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+/),
-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};
+e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=L(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=H(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=M(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new w).parse(c.childNodes[d]);break}}}return this};
 x.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};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 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];
+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)};v.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);
+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 v(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new D(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};B.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
 break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};B.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new F(c.nodeName,this)).parse(c)}}};G.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};I.prototype.parse=function(a){this.id=a.getAttribute("id");
 this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new x).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new K(this)).parse(c));break;case "channel":this.channel.push((new E(this)).parse(c))}}return this};E.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
 b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};K.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new u).parse(c))}}return this};
@@ -281,49 +281,49 @@ Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.i
 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,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)&&
+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,n,s,m,p,l,r,t,w=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=w.length;k<j;){b=w[k++];q=b&1;i=b&2;c=b&4;e=b&8;n=b&16;o=b&32;m=b&64;b&=128;q?(p=new THREE.Face4,p.a=w[k++],p.b=w[k++],p.c=w[k++],p.d=w[k++],q=4):(p=new THREE.Face3,p.a=w[k++],p.b=w[k++],p.c=w[k++],q=3);if(i)i=w[k++],p.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)l=a.uvs[c],s=w[k++],t=l[s*2],s=l[s*2+1],d.faceUvs[c][i]=new THREE.UV(t,s);if(e)for(c=0;c<x;c++){l=a.uvs[c];r=[];
+for(e=0;e<q;e++)s=w[k++],t=l[s*2],s=l[s*2+1],r[e]=new THREE.UV(t,s);d.faceVertexUvs[c][i]=r}if(n)n=w[k++]*3,e=new THREE.Vector3,e.x=y[n++],e.y=y[n++],e.z=y[n],p.normal=e;if(o)for(c=0;c<q;c++)n=w[k++]*3,e=new THREE.Vector3,e.x=y[n++],e.y=y[n++],e.z=y[n],p.vertexNormals.push(e);if(m)o=w[k++],o=new THREE.Color(u[o]),p.color=o;if(b)for(c=0;c<q;c++)o=w[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,n,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=[];n=d.morphTargets[c].vertices;
+s=a.morphTargets[c].vertices;i=0;for(k=s.length;i<k;i+=3)j=s[i]*b,q=s[i+1]*b,o=s[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(j,q,o)))}}if(a.morphColors!==void 0){c=0;for(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)&&
 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(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(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;
+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(l=B.objects[o],l.geometry!==void 0){if(A=C.geometries[l.geometry]){a=!1;for(H=0;H<l.materials.length;H++)D=C.materials[l.materials[H]],a=D instanceof THREE.ShaderMaterial;a&&A.computeTangents();w=l.position;y=l.rotation;u=l.quaternion;x=l.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(w[0],w[1],w[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=l.visible;C.scene.add(a);C.objects[o]=a;if(l.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(l.castsShadow)b=new THREE.ShadowVolume(A),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;l.trigger&&l.trigger.toLowerCase()!="none"&&(b=
+{type:l.trigger,object:l},C.triggers[a.name]=b)}}else w=l.position,y=l.rotation,u=l.quaternion,x=l.scale,u=0,a=new THREE.Object3D,a.name=o,a.position.set(w[0],w[1],w[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=l.visible!==void 0?l.visible:!1,C.scene.add(a),C.objects[o]=a,C.empties[o]=a,l.trigger&&l.trigger.toLowerCase()!="none"&&(b={type:l.trigger,object:l},C.triggers[a.name]=b)}function 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,n,s,m,p,l,r,t,w,y,u,x,z,A,F,v,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(l=B.objects[o],l.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(B.transform){a=B.transform.position;r=B.transform.rotation;var L=B.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);r&&C.scene.rotation.set(r[0],r[1],r[2]);L&&C.scene.scale.set(L[0],L[1],L[2]);(a||r||L)&&C.scene.updateMatrix()}a=function(){E-=1;h();i.onLoadComplete()};for(s in B.cameras)r=B.cameras[s],r.type=="perspective"?F=new THREE.PerspectiveCamera(r.fov,
+r.aspect,r.near,r.far):r.type=="ortho"&&(F=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),w=r.position,r=r.target,F.position.set(w[0],w[1],w[2]),F.target=new THREE.Vector3(r[0],r[1],r[2]),C.cameras[s]=F;for(n in B.lights)r=B.lights[n],s=r.color!==void 0?r.color:16777215,F=r.intensity!==void 0?r.intensity:1,r.type=="directional"?(w=r.direction,t=new THREE.DirectionalLight(s,F),t.position.set(w[0],w[1],w[2]),t.position.normalize()):r.type=="point"?(w=r.position,t=r.distance,
+t=new THREE.PointLight(s,F,t),t.position.set(w[0],w[1],w[2])):r.type=="ambient"&&(t=new THREE.AmbientLight(s)),C.scene.add(t),C.lights[n]=t;for(m in B.fogs)n=B.fogs[m],n.type=="linear"?v=new THREE.Fog(0,n.near,n.far):n.type=="exp2"&&(v=new THREE.FogExp2(0,n.density)),r=n.color,v.color.setRGB(r[0],r[1],r[2]),C.fogs[m]=v;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;
+g(j)):m.type=="embedded_mesh"&&(m=B.embeds[m.id])&&G.createModel(m,f(j),"");for(p in B.textures)if(j=B.textures[p],j.url instanceof Array){E+=j.url.length;for(m=0;m<j.url.length;m++)i.onLoadStart()}else E+=1,i.onLoadStart();O=E;for(p in B.textures){j=B.textures[p];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){m=[];for(var H=0;H<j.url.length;H++)m[H]=d(j.url[H],B.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,j.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(j.url,
+B.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)m.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)m.magFilter=THREE[j.magFilter];if(j.repeat){m.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)m.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)m.wrapT=THREE.RepeatWrapping}j.offset&&m.offset.set(j.offset[0],j.offset[1]);if(j.wrap){v={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(v[j.wrap[0]]!==void 0)m.wrapS=v[j.wrap[0]];if(v[j.wrap[1]]!==void 0)m.wrapT=
+v[j.wrap[1]]}}C.textures[p]=m}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);m=p.parameters.color;v=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(m);a.uSpecularColor.value.setHex(v);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;
 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,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.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,l=a.length;i<l;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,
+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,w,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;w=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],v=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(v,D,x);g.faces.push(new THREE.Face3(t,w,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];w=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,w));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,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+
+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,n=g+this.yd+this.zd,s=i+this.yd+this.zd,m=0,p=this.field[g],l=this.field[i],r=this.field[k],t=this.field[q],w=this.field[j],y=this.field[o],u=this.field[n],x=this.field[s];p<f&&(m|=1);l<f&&(m|=2);r<f&&(m|=8);t<f&&(m|=4);w<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,v=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,l));z&2&&(this.compNorm(i),this.compNorm(q),this.VIntY(i*3,this.vlist,this.nlist,3,f,F,b,e,l,t));z&4&&(this.compNorm(k),this.compNorm(q),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,v,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,w,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(n),this.compNorm(s),this.VIntX(n*3,this.vlist,this.nlist,18,f,a,v,A,u,x));z&128&&(this.compNorm(j),this.compNorm(n),this.VIntY(j*3,this.vlist,this.nlist,21,f,a,b,A,w,u));z&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,p,w));z&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,f,F,b,e,l,y));z&1024&&(this.compNorm(q),this.compNorm(s),this.VIntZ(q*
+3,this.vlist,this.nlist,30,f,F,v,e,t,x));z&2048&&(this.compNorm(k),this.compNorm(n),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,v,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,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;
+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 n=Math.floor(j-h);n<1&&(n=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
+1);for(var s,m,p,l,r,t;q<i;q++){j=this.size2*q;m=q/this.size-e;r=m*m;for(m=o;m<k;m++){p=j+this.size*m;s=m/this.size-b;t=s*s;for(s=n;s<h;s++)l=s/this.size-a,l=g/(1.0E-6+l*l+t+r)-f,l>0&&(this.field[p+s]+=l)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,k=this.size,j=this.yd,q=this.zd,o=this.field,n=k*Math.sqrt(a/b);n>k&&(n=k);for(e=0;e<n;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,n=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++)n[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,n=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++)n[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,n;for(f=0;f<g.count;f++)o=f*3,j=o+1,n=o+2,h=g.positionArray[o],i=g.positionArray[j],k=
+g.positionArray[n],q=new THREE.Vector3(h,i,k),h=g.normalArray[o],i=g.normalArray[j],k=g.normalArray[n],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,n=o+2,h=e[o],i=e[j],k=e[n],o=new THREE.Face3(o,j,n,[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;
 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,24 +355,24 @@ 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,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)}};
+"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=a.length;if(i){var k=new THREE.Vector3,j=h/f,q=f*0.5,o=h*0.5,n=16/h,s=new THREE.Vector2(n*j,n),m=new THREE.Vector3(1,1,0),p=new THREE.Vector2(1,1),l=d.uniforms,n=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
+b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(l.occlusionMap,0);b.uniform1i(l.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(n.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(n.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var r,t,w,y,u;for(r=0;r<i;r++)if(n=16/h,s.set(n*j,n),y=a[r],k.set(y.matrixWorld.n14,y.matrixWorld.n24,y.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(k),
+g.projectionMatrix.multiplyVector3(k),m.copy(k),p.x=m.x*q+q,p.y=m.y*o+o,d.hasVertexTexture||p.x>0&&p.x<f&&p.y>0&&p.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,p.x-8,p.y-8,16,16,0);b.uniform1i(l.renderType,0);b.uniform2f(l.scale,s.x,s.y);b.uniform3f(l.screenPosition,m.x,m.y,m.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,p.x-8,p.y-8,16,16,0);b.uniform1i(l.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);y.positionScreen.copy(m);y.customUpdateCallback?y.customUpdateCallback(y):y.updateLensFlares();b.uniform1i(l.renderType,2);b.enable(b.BLEND);t=0;for(w=y.lensFlares.length;t<w;t++)if(u=y.lensFlares[t],u.opacity>0.0010&&u.scale>0.0010)m.x=u.x,m.y=u.y,m.z=u.z,n=u.size*u.scale/
+h,s.x=n*j,s.y=n,b.uniform3f(l.screenPosition,m.x,m.y,m.z),b.uniform2f(l.scale,s.x,s.y),b.uniform1f(l.rotation,u.rotation),b.uniform1f(l.opacity,u.opacity),b.uniform3f(l.color,u.color.r,u.color.g,u.color.b),c.setBlending(u.blending),c.setTexture(u.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 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}"}),
-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)}};
+"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h,i){var e=e.__webglSprites,k=e.length;if(k){var j=d.attributes,q=d.uniforms,o=h/f;f*=0.5;var n=h*0.5,s=!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(q.projectionMatrix,!1,i);b.activeTexture(b.TEXTURE0);b.uniform1i(q.map,0);for(var m=[],i=0;i<k;i++)if(j=e[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.sort(a);for(i=
+0;i<k;i++)j=e[i],j.visible&&j.opacity!==0&&j.map&&j.map.image&&j.map.image.width&&(j.useScreenCoordinates?(b.uniform1i(q.useScreenCoordinates,1),b.uniform3f(q.screenPosition,(j.position.x-f)/f,(n-j.position.y)/n,Math.max(0,Math.min(1,j.position.z)))):(b.uniform1i(q.useScreenCoordinates,0),b.uniform1i(q.affectedByDistance,j.affectedByDistance?1:0),b.uniformMatrix4fv(q.modelViewMatrix,!1,j._modelViewMatrixArray)),g=j.map.image.width/(j.scaleByViewport?h:1),m[0]=g*o*j.scale.x,m[1]=g*j.scale.y,b.uniform2f(q.uvScale,
+j.uvScale.x,j.uvScale.y),b.uniform2f(q.uvOffset,j.uvOffset.x,j.uvOffset.y),b.uniform2f(q.alignment,j.alignment.x,j.alignment.y),b.uniform1f(q.opacity,j.opacity),b.uniform3f(q.color,j.color.r,j.color.g,j.color.b),b.uniform1f(q.rotation,j.rotation),b.uniform2fv(q.scale,m),j.mergeWith3D&&!s?(b.enable(b.DEPTH_TEST),s=!0):!j.mergeWith3D&&s&&(b.disable(b.DEPTH_TEST),s=!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,q;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),s=new THREE.PerspectiveCamera(53,
+1,1,1E4);s.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
+m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(s);this.setSize=function(a,d){c.call(b,a,d);o.width=a;o.height=d;n.width=a;n.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,w=t*k/125,y=k*Math.tan(q*Math.PI/360),u;f.n14=t;h.n14=-t;t=-y*i+w;u=y*i+w;r.n11=2*k/(u-t);r.n13=(u+t)/(u-t);e.projectionMatrix.copy(r);t=-y*i-w;u=y*i-w;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,n,!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}"},

+ 1 - 1
build/custom/ThreeWebGL.js

@@ -287,7 +287,7 @@ l);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertex
 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)}};
+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)};this.addPlugin(new THREE.SpritePlugin);this.addPlugin(new THREE.LensFlarePlugin)};
 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};

+ 0 - 4
examples/webgl_lensflares.html

@@ -180,10 +180,6 @@
 				renderer.gammaOutput = true;
 				renderer.physicallyBasedShading = true;
 
-				// lens flares plugin
-
-				renderer.addPlugin( new THREE.LensFlarePlugin() );
-
 				// stats
 
 				stats = new Stats();

+ 0 - 2
examples/webgl_sprites.html

@@ -113,8 +113,6 @@
 
 				container.appendChild( renderer.domElement );
 
-				renderer.addPlugin( new THREE.SpritePlugin() );
-
 				// stats
 
 				stats = new Stats();

+ 33 - 36
src/extras/plugins/LensFlarePlugin.js

@@ -105,28 +105,25 @@ THREE.LensFlarePlugin = function ( ) {
 
 	this.render = function ( scene, camera, viewportWidth, viewportHeight ) {
 
-		var _flaresList = scene.__webglFlares;
+		var flares = scene.__webglFlares,
+			nFlares = flares.length;
 
-		var object;
-
-		var o, ol = _flaresList.length;
-		var f, fl, flare;
+		if ( ! nFlares ) return;
 
 		var tempPosition = new THREE.Vector3();
 
-		var invAspect = viewportHeight / viewportWidth;
-		var halfViewportWidth = viewportWidth * 0.5;
-		var halfViewportHeight = viewportHeight * 0.5;
-
-		var size = 16 / viewportHeight;
+		var invAspect = viewportHeight / viewportWidth,
+			halfViewportWidth = viewportWidth * 0.5,
+			halfViewportHeight = viewportHeight * 0.5;
 
-		var scale = new THREE.Vector2( size * invAspect, size );
+		var size = 16 / viewportHeight,
+			scale = new THREE.Vector2( size * invAspect, size );
 
-		var screenPosition = new THREE.Vector3( 1, 1, 0 );
-		var screenPositionPixels = new THREE.Vector2( 1, 1 );
+		var screenPosition = new THREE.Vector3( 1, 1, 0 ),
+			screenPositionPixels = new THREE.Vector2( 1, 1 );
 
-		var uniforms = _lensFlare.uniforms;
-		var attributes = _lensFlare.attributes;
+		var uniforms = _lensFlare.uniforms,
+			attributes = _lensFlare.attributes;
 
 		// set _lensFlare program and reset blending
 
@@ -156,21 +153,22 @@ THREE.LensFlarePlugin = function ( ) {
 		_gl.disable( _gl.CULL_FACE );
 		_gl.depthMask( false );
 
-		for ( o = 0; o < ol; o ++ ) {
+		var i, j, jl, flare, sprite;
+
+		for ( i = 0; i < nFlares; i ++ ) {
 
 			size = 16 / viewportHeight;
 			scale.set( size * invAspect, size );
 
 			// calc object screen position
 
-			object = _flaresList[ o ];
+			flare = flares[ i ];
 
-			tempPosition.set( object.matrixWorld.n14, object.matrixWorld.n24, object.matrixWorld.n34 );
+			tempPosition.set( flare.matrixWorld.n14, flare.matrixWorld.n24, flare.matrixWorld.n34 );
 
 			camera.matrixWorldInverse.multiplyVector3( tempPosition );
 			camera.projectionMatrix.multiplyVector3( tempPosition );
 
-
 			// setup arrays for gl programs
 
 			screenPosition.copy( tempPosition )
@@ -178,7 +176,6 @@ THREE.LensFlarePlugin = function ( ) {
 			screenPositionPixels.x = screenPosition.x * halfViewportWidth + halfViewportWidth;
 			screenPositionPixels.y = screenPosition.y * halfViewportHeight + halfViewportHeight;
 
-
 			// screen cull
 
 			if ( _lensFlare.hasVertexTexture || (
@@ -225,15 +222,15 @@ THREE.LensFlarePlugin = function ( ) {
 
 				// update object positions
 
-				object.positionScreen.copy( screenPosition )
+				flare.positionScreen.copy( screenPosition )
 
-				if ( object.customUpdateCallback ) {
+				if ( flare.customUpdateCallback ) {
 
-					object.customUpdateCallback( object );
+					flare.customUpdateCallback( flare );
 
 				} else {
 
-					object.updateLensFlares();
+					flare.updateLensFlares();
 
 				}
 
@@ -242,30 +239,30 @@ THREE.LensFlarePlugin = function ( ) {
 				_gl.uniform1i( uniforms.renderType, 2 );
 				_gl.enable( _gl.BLEND );
 
-				for ( f = 0, fl = object.lensFlares.length; f < fl; f ++ ) {
+				for ( j = 0, jl = flare.lensFlares.length; j < jl; j ++ ) {
 
-					flare = object.lensFlares[ f ];
+					sprite = flare.lensFlares[ j ];
 
-					if ( flare.opacity > 0.001 && flare.scale > 0.001 ) {
+					if ( sprite.opacity > 0.001 && sprite.scale > 0.001 ) {
 
-						screenPosition.x = flare.x;
-						screenPosition.y = flare.y;
-						screenPosition.z = flare.z;
+						screenPosition.x = sprite.x;
+						screenPosition.y = sprite.y;
+						screenPosition.z = sprite.z;
 
-						size = flare.size * flare.scale / viewportHeight;
+						size = sprite.size * sprite.scale / viewportHeight;
 
 						scale.x = size * invAspect;
 						scale.y = size;
 
 						_gl.uniform3f( uniforms.screenPosition, screenPosition.x, screenPosition.y, screenPosition.z );
 						_gl.uniform2f( uniforms.scale, scale.x, scale.y );
-						_gl.uniform1f( uniforms.rotation, flare.rotation );
+						_gl.uniform1f( uniforms.rotation, sprite.rotation );
 
-						_gl.uniform1f( uniforms.opacity, flare.opacity );
-						_gl.uniform3f( uniforms.color, flare.color.r, flare.color.g, flare.color.b );
+						_gl.uniform1f( uniforms.opacity, sprite.opacity );
+						_gl.uniform3f( uniforms.color, sprite.color.r, sprite.color.g, sprite.color.b );
 
-						_renderer.setBlending( flare.blending );
-						_renderer.setTexture( flare.texture, 1 );
+						_renderer.setBlending( sprite.blending );
+						_renderer.setTexture( sprite.texture, 1 );
 
 						_gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 );
 

+ 41 - 38
src/extras/plugins/SpritePlugin.js

@@ -74,17 +74,18 @@ THREE.SpritePlugin = function ( ) {
 
 	this.render = function ( scene, camera, viewportWidth, viewportHeight, projectionMatrixArray ) {
 
-		var o, ol, object;
+		var sprites = scene.__webglSprites,
+			nSprites = sprites.length;
 
-		var attributes = _sprite.attributes;
-		var uniforms = _sprite.uniforms;
+		if ( ! nSprites ) return;
+
+		var attributes = _sprite.attributes,
+			uniforms = _sprite.uniforms;
 
 		var invAspect = viewportHeight / viewportWidth;
 
-		var size, scale = [];
-		var screenPosition;
-		var halfViewportWidth = viewportWidth * 0.5;
-		var halfViewportHeight = viewportHeight * 0.5;
+		var halfViewportWidth = viewportWidth * 0.5,
+			halfViewportHeight = viewportHeight * 0.5;
 
 		var mergeWith3D = true;
 
@@ -119,81 +120,83 @@ THREE.SpritePlugin = function ( ) {
 
 		// update positions and sort
 
-		for( o = 0, ol = scene.__webglSprites.length; o < ol; o ++ ) {
+		var i, sprite, screenPosition, size, scale = [];
+
+		for( i = 0; i < nSprites; i ++ ) {
 
-			object = scene.__webglSprites[ o ];
+			sprite = sprites[ i ];
 
-			if ( !object.visible || object.opacity === 0 ) continue;
+			if ( ! sprite.visible || sprite.opacity === 0 ) continue;
 
-			if( !object.useScreenCoordinates ) {
+			if( ! sprite.useScreenCoordinates ) {
 
-				object._modelViewMatrix.multiplyToArray( camera.matrixWorldInverse, object.matrixWorld, object._modelViewMatrixArray );
-				object.z = -object._modelViewMatrix.n34;
+				sprite._modelViewMatrix.multiplyToArray( camera.matrixWorldInverse, sprite.matrixWorld, sprite._modelViewMatrixArray );
+				sprite.z = - sprite._modelViewMatrix.n34;
 
 			} else {
 
-				object.z = -object.position.z;
+				sprite.z = - sprite.position.z;
 
 			}
 
 		}
 
-		scene.__webglSprites.sort( painterSort );
+		sprites.sort( painterSort );
 
 		// render all sprites
 
-		for ( o = 0, ol = scene.__webglSprites.length; o < ol; o ++ ) {
+		for( i = 0; i < nSprites; i ++ ) {
 
-			object = scene.__webglSprites[ o ];
+			sprite = sprites[ i ];
 
-			if ( !object.visible || object.opacity === 0 ) continue;
+			if ( ! sprite.visible || sprite.opacity === 0 ) continue;
 
-			if ( object.map && object.map.image && object.map.image.width ) {
+			if ( sprite.map && sprite.map.image && sprite.map.image.width ) {
 
-				if ( object.useScreenCoordinates ) {
+				if ( sprite.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 )));
+					_gl.uniform3f( uniforms.screenPosition, ( sprite.position.x - halfViewportWidth  ) / halfViewportWidth,
+															( halfViewportHeight - sprite.position.y ) / halfViewportHeight,
+															  Math.max( 0, Math.min( 1, sprite.position.z ) ) );
 
 				} else {
 
 					_gl.uniform1i( uniforms.useScreenCoordinates, 0 );
-					_gl.uniform1i( uniforms.affectedByDistance, object.affectedByDistance ? 1 : 0 );
-					_gl.uniformMatrix4fv( uniforms.modelViewMatrix, false, object._modelViewMatrixArray );
+					_gl.uniform1i( uniforms.affectedByDistance, sprite.affectedByDistance ? 1 : 0 );
+					_gl.uniformMatrix4fv( uniforms.modelViewMatrix, false, sprite._modelViewMatrixArray );
 
 				}
 
-				size = object.map.image.width / ( object.scaleByViewport ? viewportHeight : 1 );
+				size = sprite.map.image.width / ( sprite.scaleByViewport ? viewportHeight : 1 );
 
-				scale[ 0 ] = size * invAspect * object.scale.x;
-				scale[ 1 ] = size * object.scale.y;
+				scale[ 0 ] = size * invAspect * sprite.scale.x;
+				scale[ 1 ] = size * sprite.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.uniform2f( uniforms.uvScale, sprite.uvScale.x, sprite.uvScale.y );
+				_gl.uniform2f( uniforms.uvOffset, sprite.uvOffset.x, sprite.uvOffset.y );
+				_gl.uniform2f( uniforms.alignment, sprite.alignment.x, sprite.alignment.y );
 
-				_gl.uniform1f( uniforms.opacity, object.opacity );
-				_gl.uniform3f( uniforms.color, object.color.r, object.color.g, object.color.b );
+				_gl.uniform1f( uniforms.opacity, sprite.opacity );
+				_gl.uniform3f( uniforms.color, sprite.color.r, sprite.color.g, sprite.color.b );
 
-				_gl.uniform1f( uniforms.rotation, object.rotation );
+				_gl.uniform1f( uniforms.rotation, sprite.rotation );
 				_gl.uniform2fv( uniforms.scale, scale );
 
-				if ( object.mergeWith3D && !mergeWith3D ) {
+				if ( sprite.mergeWith3D && !mergeWith3D ) {
 
 					_gl.enable( _gl.DEPTH_TEST );
 					mergeWith3D = true;
 
-				} else if ( !object.mergeWith3D && mergeWith3D ) {
+				} else if ( ! sprite.mergeWith3D && mergeWith3D ) {
 
 					_gl.disable( _gl.DEPTH_TEST );
 					mergeWith3D = false;
 
 				}
 
-				_renderer.setBlending( object.blending );
-				_renderer.setTexture( object.map, 0 );
+				_renderer.setBlending( sprite.blending );
+				_renderer.setTexture( sprite.map, 0 );
 
 				_gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 );
 

+ 5 - 0
src/renderers/WebGLRenderer.js

@@ -5830,4 +5830,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
+	// default plugins (order is important)
+
+	this.addPlugin( new THREE.SpritePlugin() );
+	this.addPlugin( new THREE.LensFlarePlugin() );
+
 };