Pārlūkot izejas kodu

Refactored MarchingCubes out into examples/js

This probably could be done in some nicer way, but at least there is no more direct dependency in WebGLRenderer (and lib shrunk ;).
alteredq 13 gadi atpakaļ
vecāks
revīzija
0e3b527cdc

+ 411 - 447
build/Three.js

@@ -21,42 +21,42 @@ a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){
 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},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
 THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
 THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b){function c(a,b,c){q.sub(c,a);s=q.dot(b);u=n.add(a,r.copy(b).multiplyScalar(s));return v=c.distanceTo(u)}function d(a,b,c,d){q.sub(d,b);n.sub(c,b);r.sub(a,b);t=q.dot(q);w=q.dot(n);z=q.dot(r);F=n.dot(n);C=n.dot(r);D=1/(t*F-w*w);I=(F*z-w*C)*D;K=(t*C-w*z)*D;return 0<=I&&0<=K&&1>I+K}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,
-k=new THREE.Vector3,j=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(a){var b,n=[];if(a instanceof THREE.Particle){var q=c(this.origin,this.direction,a.matrixWorld.getPosition());if(q>a.scale.x)return[];b={distance:q,point:a.position,face:null,object:a};n.push(b)}else if(a instanceof THREE.Mesh){var q=c(this.origin,this.direction,a.matrixWorld.getPosition()),r=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
-a.matrixWorld.getColumnZ().length());if(q>a.geometry.boundingSphere.radius*Math.max(r.x,Math.max(r.y,r.z)))return n;var s,l,t=a.geometry,u=t.vertices,y;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(q=0,r=t.faces.length;q<r;q++)if(b=t.faces[q],k.copy(this.origin),j.copy(this.direction),y=a.matrixWorld,p=y.multiplyVector3(p.copy(b.centroid)).subSelf(k),m=a.matrixRotationWorld.multiplyVector3(m.copy(b.normal)),s=j.dot(m),!(Math.abs(s)<e)&&(l=m.dot(p)/s,!(0>l)&&(a.doubleSided||(a.flipSided?
-0<s:0>s))))if(o.add(k,j.multiplyScalar(l)),b instanceof THREE.Face3)f=y.multiplyVector3(f.copy(u[b.a].position)),g=y.multiplyVector3(g.copy(u[b.b].position)),h=y.multiplyVector3(h.copy(u[b.c].position)),d(o,f,g,h)&&(b={distance:k.distanceTo(o),point:o.clone(),face:b,object:a},n.push(b));else if(b instanceof THREE.Face4&&(f=y.multiplyVector3(f.copy(u[b.a].position)),g=y.multiplyVector3(g.copy(u[b.b].position)),h=y.multiplyVector3(h.copy(u[b.c].position)),i=y.multiplyVector3(i.copy(u[b.d].position)),
-d(o,f,g,i)||d(o,g,h,i)))b={distance:k.distanceTo(o),point:o.clone(),face:b,object:a},n.push(b)}return n};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var q=new THREE.Vector3,n=new THREE.Vector3,r=new THREE.Vector3,s,u,v,t,w,z,F,C,D,I,K};
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,j,p){h=!1;b=f;c=g;d=j;e=p;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
-function(f,g,j,p,m,o){h?(h=!1,b=f<j?f<m?f:m:j<m?j:m,c=g<p?g<o?g:o:p<o?p:o,d=f>j?f>m?f:m:j>m?j:m,e=g>p?g>o?g:o:p>o?p:o):(b=f<j?f<m?f<b?f:b:m<b?m:b:j<m?j<b?j:b:m<b?m:b,c=g<p?g<o?g<c?g:c:o<c?o:c:p<o?p<c?p:c:o<c?o:c,d=f>j?f>m?f>d?f:d:m>d?m:d:j>m?j>d?j:d:m>d?m:d,e=g>p?g>o?g>e?g:e:o>e?o:e:p>o?p>e?p:e:o>e?o:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
+THREE.Ray=function(a,b){function c(a,b,c){q.sub(c,a);s=q.dot(b);u=m.add(a,r.copy(b).multiplyScalar(s));return v=c.distanceTo(u)}function d(a,b,c,d){q.sub(d,b);m.sub(c,b);r.sub(a,b);t=q.dot(q);w=q.dot(m);z=q.dot(r);B=m.dot(m);I=m.dot(r);C=1/(t*B-w*w);H=(B*z-w*I)*C;K=(t*I-w*z)*C;return 0<=H&&0<=K&&1>H+K}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,
+l=new THREE.Vector3,k=new THREE.Vector3,p=new THREE.Vector3,n=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(a){var b,m=[];if(a instanceof THREE.Particle){var q=c(this.origin,this.direction,a.matrixWorld.getPosition());if(q>a.scale.x)return[];b={distance:q,point:a.position,face:null,object:a};m.push(b)}else if(a instanceof THREE.Mesh){var q=c(this.origin,this.direction,a.matrixWorld.getPosition()),r=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
+a.matrixWorld.getColumnZ().length());if(q>a.geometry.boundingSphere.radius*Math.max(r.x,Math.max(r.y,r.z)))return m;var s,j,t=a.geometry,u=t.vertices,y;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(q=0,r=t.faces.length;q<r;q++)if(b=t.faces[q],l.copy(this.origin),k.copy(this.direction),y=a.matrixWorld,p=y.multiplyVector3(p.copy(b.centroid)).subSelf(l),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),s=k.dot(n),!(Math.abs(s)<e)&&(j=n.dot(p)/s,!(0>j)&&(a.doubleSided||(a.flipSided?
+0<s:0>s))))if(o.add(l,k.multiplyScalar(j)),b instanceof THREE.Face3)f=y.multiplyVector3(f.copy(u[b.a].position)),g=y.multiplyVector3(g.copy(u[b.b].position)),h=y.multiplyVector3(h.copy(u[b.c].position)),d(o,f,g,h)&&(b={distance:l.distanceTo(o),point:o.clone(),face:b,object:a},m.push(b));else if(b instanceof THREE.Face4&&(f=y.multiplyVector3(f.copy(u[b.a].position)),g=y.multiplyVector3(g.copy(u[b.b].position)),h=y.multiplyVector3(h.copy(u[b.c].position)),i=y.multiplyVector3(i.copy(u[b.d].position)),
+d(o,f,g,i)||d(o,g,h,i)))b={distance:l.distanceTo(o),point:o.clone(),face:b,object:a},m.push(b)}return m};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,this.intersectObject(a[c]));b.sort(function(a,b){return a.distance-b.distance});return b};var q=new THREE.Vector3,m=new THREE.Vector3,r=new THREE.Vector3,s,u,v,t,w,z,B,I,C,H,K};
+THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,k,p){h=!1;b=f;c=g;d=k;e=p;a()};this.addPoint=function(f,g){h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>g?e:g);a()};this.add3Points=
+function(f,g,k,p,n,o){h?(h=!1,b=f<k?f<n?f:n:k<n?k:n,c=g<p?g<o?g:o:p<o?p:o,d=f>k?f>n?f:n:k>n?k:n,e=g>p?g>o?g:o:p>o?p:o):(b=f<k?f<n?f<b?f:b:n<b?n:b:k<n?k<b?k:b:n<b?n:b,c=g<p?g<o?g<c?g:c:o<c?o:c:p<o?p<c?p:c:o<c?o:c,d=f>k?f>n?f>d?f:d:n>d?n:d:k>n?k>d?k:d:n>d?n:d,e=g>p?g>o?g>e?g:e:o>e?o:e:p>o?p>e?p:e:o>e?o:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
 f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,k,j,p,m,o,q,n){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,i||0,k||0,void 0!==j?j:1,p||0,m||0,o||0,q||0,void 0!==n?n:1);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,k,j,p,m,o,q,n){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=i;this.n32=k;this.n33=j;this.n34=p;this.n41=m;this.n42=o;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,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d);this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,i=a.n23,k=a.n24,j=a.n31,p=a.n32,m=a.n33,o=a.n34,q=a.n41,n=a.n42,r=a.n43,s=a.n44,u=b.n11,
-v=b.n12,t=b.n13,w=b.n14,z=b.n21,F=b.n22,C=b.n23,D=b.n24,I=b.n31,K=b.n32,O=b.n33,Q=b.n34,L=b.n41,B=b.n42,N=b.n43,E=b.n44;this.n11=c*u+d*z+e*I+f*L;this.n12=c*v+d*F+e*K+f*B;this.n13=c*t+d*C+e*O+f*N;this.n14=c*w+d*D+e*Q+f*E;this.n21=g*u+h*z+i*I+k*L;this.n22=g*v+h*F+i*K+k*B;this.n23=g*t+h*C+i*O+k*N;this.n24=g*w+h*D+i*Q+k*E;this.n31=j*u+p*z+m*I+o*L;this.n32=j*v+p*F+m*K+o*B;this.n33=j*t+p*C+m*O+o*N;this.n34=j*w+p*D+m*Q+o*E;this.n41=q*u+n*z+r*I+s*L;this.n42=q*v+n*F+r*K+s*B;this.n43=q*t+n*C+r*O+s*N;this.n44=
-q*w+n*D+r*Q+s*E;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;
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,l,k,p,n,o,q,m){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,i||0,l||0,void 0!==k?k:1,p||0,n||0,o||0,q||0,void 0!==m?m:1);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,l,k,p,n,o,q,m){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=i;this.n32=l;this.n33=k;this.n34=p;this.n41=n;this.n42=o;this.n43=q;this.n44=m;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d);this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,h=a.n22,i=a.n23,l=a.n24,k=a.n31,p=a.n32,n=a.n33,o=a.n34,q=a.n41,m=a.n42,r=a.n43,s=a.n44,u=b.n11,
+v=b.n12,t=b.n13,w=b.n14,z=b.n21,B=b.n22,I=b.n23,C=b.n24,H=b.n31,K=b.n32,O=b.n33,Q=b.n34,L=b.n41,D=b.n42,N=b.n43,E=b.n44;this.n11=c*u+d*z+e*H+f*L;this.n12=c*v+d*B+e*K+f*D;this.n13=c*t+d*I+e*O+f*N;this.n14=c*w+d*C+e*Q+f*E;this.n21=g*u+h*z+i*H+l*L;this.n22=g*v+h*B+i*K+l*D;this.n23=g*t+h*I+i*O+l*N;this.n24=g*w+h*C+i*Q+l*E;this.n31=k*u+p*z+n*H+o*L;this.n32=k*v+p*B+n*K+o*D;this.n33=k*t+p*I+n*O+o*N;this.n34=k*w+p*C+n*Q+o*E;this.n41=q*u+m*z+r*H+s*L;this.n42=q*v+m*B+r*K+s*D;this.n43=q*t+m*I+r*O+s*N;this.n44=
+q*w+m*C+r*Q+s*E;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;
 this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*
 d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+
-this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,i=this.n31,k=this.n32,j=this.n33,p=this.n34,m=this.n41,o=this.n42,q=this.n43,n=this.n44;return d*g*k*m-c*h*k*m-d*f*j*m+b*h*j*m+c*f*p*m-b*g*p*m-d*g*i*o+c*h*i*o+d*e*j*o-a*h*j*o-c*e*p*o+a*g*p*o+d*f*i*q-b*h*i*q-d*e*k*q+a*h*k*q+b*e*p*q-a*f*p*q-c*f*i*n+b*g*i*n+c*e*k*n-a*g*k*n-b*e*j*n+a*f*j*n},transpose:function(){var a;
+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,i=this.n31,l=this.n32,k=this.n33,p=this.n34,n=this.n41,o=this.n42,q=this.n43,m=this.n44;return d*g*l*n-c*h*l*n-d*f*k*n+b*h*k*n+c*f*p*n-b*g*p*n-d*g*i*o+c*h*i*o+d*e*k*o-a*h*k*o-c*e*p*o+a*g*p*o+d*f*i*q-b*h*i*q-d*e*l*q+a*h*l*q+b*e*p*q-a*f*p*q-c*f*i*m+b*g*i*m+c*e*l*m-a*g*l*m-b*e*k*m+a*f*k*m},transpose:function(){var a;
 a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;return this},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=
 this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=
-Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,k=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,k*g+c,k*h-d*f,0,i*h-d*g,k*h+d*f,e*h*h+c,0,0,0,0,1);return this},
-setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,i=a.n24,k=a.n31,j=
-a.n32,p=a.n33,m=a.n34,o=a.n41,q=a.n42,n=a.n43,r=a.n44;this.n11=h*m*q-i*p*q+i*j*n-g*m*n-h*j*r+g*p*r;this.n12=e*p*q-d*m*q-e*j*n+c*m*n+d*j*r-c*p*r;this.n13=d*i*q-e*h*q+e*g*n-c*i*n-d*g*r+c*h*r;this.n14=e*h*j-d*i*j-e*g*p+c*i*p+d*g*m-c*h*m;this.n21=i*p*o-h*m*o-i*k*n+f*m*n+h*k*r-f*p*r;this.n22=d*m*o-e*p*o+e*k*n-b*m*n-d*k*r+b*p*r;this.n23=e*h*o-d*i*o-e*f*n+b*i*n+d*f*r-b*h*r;this.n24=d*i*k-e*h*k+e*f*p-b*i*p-d*f*m+b*h*m;this.n31=g*m*o-i*j*o+i*k*q-f*m*q-g*k*r+f*j*r;this.n32=e*j*o-c*m*o-e*k*q+b*m*q+c*k*r-b*j*
-r;this.n33=c*i*o-e*g*o+e*f*q-b*i*q-c*f*r+b*g*r;this.n34=e*g*k-c*i*k-e*f*j+b*i*j+c*f*m-b*g*m;this.n41=h*j*o-g*p*o-h*k*q+f*p*q+g*k*n-f*j*n;this.n42=c*p*o-d*j*o+d*k*q-b*p*q-c*k*n+b*j*n;this.n43=d*g*o-c*h*o-d*f*q+b*h*q+c*f*n-b*g*n;this.n44=c*h*k-d*g*k+d*f*j-b*h*j-c*f*p+b*g*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=g*h,k=g*e,
-j=d*h,p=d*e;this.n11=i+p*c;this.n12=j*c-k;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=k*c-j;this.n32=p+i*c;this.n33=f*g;break;case "ZXY":i=g*h;k=g*e;j=d*h;p=d*e;this.n11=i-p*c;this.n12=-f*e;this.n13=j+k*c;this.n21=k+j*c;this.n22=f*h;this.n23=p-i*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":i=f*h;k=f*e;j=c*h;p=c*e;this.n11=g*h;this.n12=j*d-k;this.n13=i*d+p;this.n21=g*e;this.n22=p*d+i;this.n23=k*d-j;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":i=f*g;k=f*d;j=c*g;
-p=c*d;this.n11=g*h;this.n12=p-i*e;this.n13=j*e+k;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=k*e+j;this.n33=i-p*e;break;case "XZY":i=f*g;k=f*d;j=c*g;p=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=i*e+p;this.n22=f*h;this.n23=k*e-j;this.n31=j*e-k;this.n32=c*h;this.n33=p*e+i;break;default:i=f*h,k=f*e,j=c*h,p=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=k+j*d,this.n22=i-p*d,this.n23=-c*g,this.n31=p-i*d,this.n32=j+k*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=
-a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,i=b*g,b=b*h,k=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(k+d);this.n12=i-e;this.n13=b+g;this.n21=i+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+k);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;
+Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,l=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,l*g+c,l*h-d*f,0,i*h-d*g,l*h+d*f,e*h*h+c,0,0,0,0,1);return this},
+setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,i=a.n24,l=a.n31,k=
+a.n32,p=a.n33,n=a.n34,o=a.n41,q=a.n42,m=a.n43,r=a.n44;this.n11=h*n*q-i*p*q+i*k*m-g*n*m-h*k*r+g*p*r;this.n12=e*p*q-d*n*q-e*k*m+c*n*m+d*k*r-c*p*r;this.n13=d*i*q-e*h*q+e*g*m-c*i*m-d*g*r+c*h*r;this.n14=e*h*k-d*i*k-e*g*p+c*i*p+d*g*n-c*h*n;this.n21=i*p*o-h*n*o-i*l*m+f*n*m+h*l*r-f*p*r;this.n22=d*n*o-e*p*o+e*l*m-b*n*m-d*l*r+b*p*r;this.n23=e*h*o-d*i*o-e*f*m+b*i*m+d*f*r-b*h*r;this.n24=d*i*l-e*h*l+e*f*p-b*i*p-d*f*n+b*h*n;this.n31=g*n*o-i*k*o+i*l*q-f*n*q-g*l*r+f*k*r;this.n32=e*k*o-c*n*o-e*l*q+b*n*q+c*l*r-b*k*
+r;this.n33=c*i*o-e*g*o+e*f*q-b*i*q-c*f*r+b*g*r;this.n34=e*g*l-c*i*l-e*f*k+b*i*k+c*f*n-b*g*n;this.n41=h*k*o-g*p*o-h*l*q+f*p*q+g*l*m-f*k*m;this.n42=c*p*o-d*k*o+d*l*q-b*p*q-c*l*m+b*k*m;this.n43=d*g*o-c*h*o-d*f*q+b*h*q+c*f*m-b*g*m;this.n44=c*h*l-d*g*l+d*f*k-b*h*k-c*f*p+b*g*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=g*h,l=g*e,
+k=d*h,p=d*e;this.n11=i+p*c;this.n12=k*c-l;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=l*c-k;this.n32=p+i*c;this.n33=f*g;break;case "ZXY":i=g*h;l=g*e;k=d*h;p=d*e;this.n11=i-p*c;this.n12=-f*e;this.n13=k+l*c;this.n21=l+k*c;this.n22=f*h;this.n23=p-i*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":i=f*h;l=f*e;k=c*h;p=c*e;this.n11=g*h;this.n12=k*d-l;this.n13=i*d+p;this.n21=g*e;this.n22=p*d+i;this.n23=l*d-k;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":i=f*g;l=f*d;k=c*g;
+p=c*d;this.n11=g*h;this.n12=p-i*e;this.n13=k*e+l;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*e+k;this.n33=i-p*e;break;case "XZY":i=f*g;l=f*d;k=c*g;p=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=i*e+p;this.n22=f*h;this.n23=l*e-k;this.n31=k*e-l;this.n32=c*h;this.n33=p*e+i;break;default:i=f*h,l=f*e,k=c*h,p=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=l+k*d,this.n22=i-p*d,this.n23=-c*g,this.n31=p-i*d,this.n32=k+l*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=
+a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,i=b*g,b=b*h,l=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(l+d);this.n12=i-e;this.n13=b+g;this.n21=i+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+l);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;
 d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.set(this.n13,this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();
 c.y=e.length();c.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=
-a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,i=Math.cos(b),k=Math.sin(b),j=1-i,p=c*d*j,m=c*e*j,j=d*e*j,c=c*k,o=d*k,k=e*k,e=
-f+(1-f)*i,f=p+k,d=m-o,p=p-k,g=g+(1-g)*i,k=j+c,m=m+o,j=j-c,h=h+(1-h)*i,i=this.n11,c=this.n21,o=this.n31,q=this.n41,n=this.n12,r=this.n22,s=this.n32,u=this.n42,v=this.n13,t=this.n23,w=this.n33,z=this.n43;this.n11=e*i+f*n+d*v;this.n21=e*c+f*r+d*t;this.n31=e*o+f*s+d*w;this.n41=e*q+f*u+d*z;this.n12=p*i+g*n+k*v;this.n22=p*c+g*r+k*t;this.n32=p*o+g*s+k*w;this.n42=p*q+g*u+k*z;this.n13=m*i+j*n+h*v;this.n23=m*c+j*r+h*t;this.n33=m*o+j*s+h*w;this.n43=m*q+j*u+h*z;return this},rotateX:function(a){var b=this.n12,
-c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,i=this.n43,k=Math.cos(a),a=Math.sin(a);this.n12=k*b+a*f;this.n22=k*c+a*g;this.n32=k*d+a*h;this.n42=k*e+a*i;this.n13=k*f-a*b;this.n23=k*g-a*c;this.n33=k*h-a*d;this.n43=k*i-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n13,g=this.n23,h=this.n33,i=this.n43,k=Math.cos(a),a=Math.sin(a);this.n11=k*b-a*f;this.n21=k*c-a*g;this.n31=k*d-a*h;this.n41=k*e-a*i;this.n13=k*f+a*b;this.n23=k*g+a*c;this.n33=
-k*h+a*d;this.n43=k*i+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,i=this.n42,k=Math.cos(a),a=Math.sin(a);this.n11=k*b+a*f;this.n21=k*c+a*g;this.n31=k*d+a*h;this.n41=k*e+a*i;this.n12=k*f-a*b;this.n22=k*g-a*c;this.n32=k*h-a*d;this.n42=k*i-a*e;return this},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*
+a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,i=Math.cos(b),l=Math.sin(b),k=1-i,p=c*d*k,n=c*e*k,k=d*e*k,c=c*l,o=d*l,l=e*l,e=
+f+(1-f)*i,f=p+l,d=n-o,p=p-l,g=g+(1-g)*i,l=k+c,n=n+o,k=k-c,h=h+(1-h)*i,i=this.n11,c=this.n21,o=this.n31,q=this.n41,m=this.n12,r=this.n22,s=this.n32,u=this.n42,v=this.n13,t=this.n23,w=this.n33,z=this.n43;this.n11=e*i+f*m+d*v;this.n21=e*c+f*r+d*t;this.n31=e*o+f*s+d*w;this.n41=e*q+f*u+d*z;this.n12=p*i+g*m+l*v;this.n22=p*c+g*r+l*t;this.n32=p*o+g*s+l*w;this.n42=p*q+g*u+l*z;this.n13=n*i+k*m+h*v;this.n23=n*c+k*r+h*t;this.n33=n*o+k*s+h*w;this.n43=n*q+k*u+h*z;return this},rotateX:function(a){var b=this.n12,
+c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,i=this.n43,l=Math.cos(a),a=Math.sin(a);this.n12=l*b+a*f;this.n22=l*c+a*g;this.n32=l*d+a*h;this.n42=l*e+a*i;this.n13=l*f-a*b;this.n23=l*g-a*c;this.n33=l*h-a*d;this.n43=l*i-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n13,g=this.n23,h=this.n33,i=this.n43,l=Math.cos(a),a=Math.sin(a);this.n11=l*b-a*f;this.n21=l*c-a*g;this.n31=l*d-a*h;this.n41=l*e-a*i;this.n13=l*f+a*b;this.n23=l*g+a*c;this.n33=
+l*h+a*d;this.n43=l*i+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,i=this.n42,l=Math.cos(a),a=Math.sin(a);this.n11=l*b+a*f;this.n21=l*c+a*g;this.n31=l*d+a*h;this.n41=l*e+a*i;this.n12=l*f-a*b;this.n22=l*g-a*c;this.n32=l*h-a*d;this.n42=l*i-a*e;return this},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*
 c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this},clone:function(){return new THREE.Matrix4(this.n11,this.n12,this.n13,this.n14,this.n21,this.n22,this.n23,this.n24,this.n31,this.n32,this.n33,this.n34,this.n41,this.n42,this.n43,this.n44)}};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*k;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*i;c[6]=a*k;c[7]=a*j;c[8]=a*p;return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*l;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*i;c[6]=a*l;c[7]=a*k;c[8]=a*p;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,h,i,k;g=new THREE.Matrix4;h=b-a;i=c-d;k=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/i;g.n23=0;g.n24=-((c+d)/i);g.n31=0;g.n32=0;g.n33=-2/k;g.n34=-((f+e)/k);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,h,i,l;g=new THREE.Matrix4;h=b-a;i=c-d;l=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/i;g.n23=0;g.n24=-((c+d)/i);g.n31=0;g.n32=0;g.n33=-2/l;g.n34=-((f+e)/l);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.getRotationFromMatrix(this.matrix,this.scale);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,
@@ -64,23 +64,23 @@ this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,
 this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
 this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<
 c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=k[i]=k[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,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
-var e,f,g=[],h,i,k=[],j,p,m=[],o,q=[],n,r,s=[],u,v,t=[],w={objects:[],sprites:[],lights:[],elements:[]},z=new THREE.Vector3,F=new THREE.Vector4,C=new THREE.Matrix4,D=new THREE.Matrix4,I=new THREE.Frustum,K=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);C.multiply(b.projectionMatrix,b.matrixWorldInverse);C.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);C.multiply(b.matrixWorld,
-b.projectionMatrixInverse);C.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;w.objects.length=0;w.sprites.length=0;w.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||I.contains(b))?(z.copy(b.matrixWorld.getPosition()),C.multiplyVector3(z),
-e=a(),e.object=b,e.z=z.z,w.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(z.copy(b.matrixWorld.getPosition()),C.multiplyVector3(z),e=a(),e.object=b,e.z=z.z,w.sprites.push(e)):b instanceof THREE.Light&&w.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&w.objects.sort(c);return w};this.projectScene=function(a,e,f){var g=e.near,E=e.far,l=!1,z,G,y,T,P,da,ja,ha,R,Z,S,$,ca,Ua,Ia;v=r=o=p=0;w.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);C.multiply(e.projectionMatrix,e.matrixWorldInverse);I.setFromMatrix(C);w=this.projectGraph(a,!1);for(a=0,z=w.objects.length;a<z;a++)if(R=w.objects[a].object,Z=R.matrixWorld,i=0,R instanceof THREE.Mesh){S=R.geometry;$=R.geometry.materials;T=S.vertices;ca=S.faces;Ua=S.faceVertexUvs;S=R.matrixRotationWorld.extractRotation(Z);for(G=0,y=T.length;G<y;G++)h=b(),h.positionWorld.copy(T[G].position),Z.multiplyVector3(h.positionWorld),
-h.positionScreen.copy(h.positionWorld),C.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<E;for(T=0,G=ca.length;T<G;T++){y=ca[T];if(y instanceof THREE.Face3)if(P=k[y.a],da=k[y.b],ja=k[y.c],P.visible&&da.visible&&ja.visible)if(l=0>(ja.positionScreen.x-P.positionScreen.x)*(da.positionScreen.y-P.positionScreen.y)-(ja.positionScreen.y-P.positionScreen.y)*(da.positionScreen.x-P.positionScreen.x),
-R.doubleSided||l!=R.flipSided)ha=m[p]=m[p]||new THREE.RenderableFace3,p++,j=ha,j.v1.copy(P),j.v2.copy(da),j.v3.copy(ja);else continue;else continue;else if(y instanceof THREE.Face4)if(P=k[y.a],da=k[y.b],ja=k[y.c],ha=k[y.d],P.visible&&da.visible&&ja.visible&&ha.visible)if(l=0>(ha.positionScreen.x-P.positionScreen.x)*(da.positionScreen.y-P.positionScreen.y)-(ha.positionScreen.y-P.positionScreen.y)*(da.positionScreen.x-P.positionScreen.x)||0>(da.positionScreen.x-ja.positionScreen.x)*(ha.positionScreen.y-
-ja.positionScreen.y)-(da.positionScreen.y-ja.positionScreen.y)*(ha.positionScreen.x-ja.positionScreen.x),R.doubleSided||l!=R.flipSided)Ia=q[o]=q[o]||new THREE.RenderableFace4,o++,j=Ia,j.v1.copy(P),j.v2.copy(da),j.v3.copy(ja),j.v4.copy(ha);else continue;else continue;j.normalWorld.copy(y.normal);!l&&(R.flipSided||R.doubleSided)&&j.normalWorld.negate();S.multiplyVector3(j.normalWorld);j.centroidWorld.copy(y.centroid);Z.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);C.multiplyVector3(j.centroidScreen);
-ja=y.vertexNormals;for(P=0,da=ja.length;P<da;P++)ha=j.vertexNormalsWorld[P],ha.copy(ja[P]),!l&&(R.flipSided||R.doubleSided)&&ha.negate(),S.multiplyVector3(ha);for(P=0,da=Ua.length;P<da;P++)if(Ia=Ua[P][T])for(ja=0,ha=Ia.length;ja<ha;ja++)j.uvs[P][ja]=Ia[ja];j.material=R.material;j.faceMaterial=null!==y.materialIndex?$[y.materialIndex]:null;j.z=j.centroidScreen.z;w.elements.push(j)}}else if(R instanceof THREE.Line){D.multiply(C,Z);T=R.geometry.vertices;P=b();P.positionScreen.copy(T[0].position);D.multiplyVector4(P.positionScreen);
-for(G=1,y=T.length;G<y;G++)if(P=b(),P.positionScreen.copy(T[G].position),D.multiplyVector4(P.positionScreen),da=k[i-2],K.copy(P.positionScreen),O.copy(da.positionScreen),d(K,O))K.multiplyScalar(1/K.w),O.multiplyScalar(1/O.w),Z=s[r]=s[r]||new THREE.RenderableLine,r++,n=Z,n.v1.positionScreen.copy(K),n.v2.positionScreen.copy(O),n.z=Math.max(K.z,O.z),n.material=R.material,w.elements.push(n)}for(a=0,z=w.sprites.length;a<z;a++)if(R=w.sprites[a].object,Z=R.matrixWorld,R instanceof THREE.Particle&&(F.set(Z.n14,
-Z.n24,Z.n34,1),C.multiplyVector4(F),F.z/=F.w,0<F.z&&1>F.z))g=t[v]=t[v]||new THREE.RenderableParticle,v++,u=g,u.x=F.x/F.w,u.y=F.y/F.w,u.z=F.z,u.rotation=R.rotation.z,u.scale.x=R.scale.x*Math.abs(u.x-(F.x+e.projectionMatrix.n11)/(F.w+e.projectionMatrix.n14)),u.scale.y=R.scale.y*Math.abs(u.y-(F.y+e.projectionMatrix.n22)/(F.w+e.projectionMatrix.n24)),u.material=R.material,w.elements.push(u);f&&w.elements.sort(c);return w}};
+THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=l[i]=l[i]||new THREE.RenderableVertex;i++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
+var e,f,g=[],h,i,l=[],k,p,n=[],o,q=[],m,r,s=[],u,v,t=[],w={objects:[],sprites:[],lights:[],elements:[]},z=new THREE.Vector3,B=new THREE.Vector4,I=new THREE.Matrix4,C=new THREE.Matrix4,H=new THREE.Frustum,K=new THREE.Vector4,O=new THREE.Vector4;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){f=0;w.objects.length=0;w.sprites.length=0;w.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||H.contains(b))?(z.copy(b.matrixWorld.getPosition()),I.multiplyVector3(z),
+e=a(),e.object=b,e.z=z.z,w.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(z.copy(b.matrixWorld.getPosition()),I.multiplyVector3(z),e=a(),e.object=b,e.z=z.z,w.sprites.push(e)):b instanceof THREE.Light&&w.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&w.objects.sort(c);return w};this.projectScene=function(a,e,f){var g=e.near,E=e.far,j=!1,z,F,y,U,P,fa,ja,ha,R,aa,S,ba,da,Ua,Ia;v=r=o=p=0;w.elements.length=0;void 0===e.parent&&(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);H.setFromMatrix(I);w=this.projectGraph(a,!1);for(a=0,z=w.objects.length;a<z;a++)if(R=w.objects[a].object,aa=R.matrixWorld,i=0,R instanceof THREE.Mesh){S=R.geometry;ba=R.geometry.materials;U=S.vertices;da=S.faces;Ua=S.faceVertexUvs;S=R.matrixRotationWorld.extractRotation(aa);for(F=0,y=U.length;F<y;F++)h=b(),h.positionWorld.copy(U[F].position),aa.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>g&&h.positionScreen.z<E;for(U=0,F=da.length;U<F;U++){y=da[U];if(y instanceof THREE.Face3)if(P=l[y.a],fa=l[y.b],ja=l[y.c],P.visible&&fa.visible&&ja.visible)if(j=0>(ja.positionScreen.x-P.positionScreen.x)*(fa.positionScreen.y-P.positionScreen.y)-(ja.positionScreen.y-P.positionScreen.y)*(fa.positionScreen.x-P.positionScreen.x),
+R.doubleSided||j!=R.flipSided)ha=n[p]=n[p]||new THREE.RenderableFace3,p++,k=ha,k.v1.copy(P),k.v2.copy(fa),k.v3.copy(ja);else continue;else continue;else if(y instanceof THREE.Face4)if(P=l[y.a],fa=l[y.b],ja=l[y.c],ha=l[y.d],P.visible&&fa.visible&&ja.visible&&ha.visible)if(j=0>(ha.positionScreen.x-P.positionScreen.x)*(fa.positionScreen.y-P.positionScreen.y)-(ha.positionScreen.y-P.positionScreen.y)*(fa.positionScreen.x-P.positionScreen.x)||0>(fa.positionScreen.x-ja.positionScreen.x)*(ha.positionScreen.y-
+ja.positionScreen.y)-(fa.positionScreen.y-ja.positionScreen.y)*(ha.positionScreen.x-ja.positionScreen.x),R.doubleSided||j!=R.flipSided)Ia=q[o]=q[o]||new THREE.RenderableFace4,o++,k=Ia,k.v1.copy(P),k.v2.copy(fa),k.v3.copy(ja),k.v4.copy(ha);else continue;else continue;k.normalWorld.copy(y.normal);!j&&(R.flipSided||R.doubleSided)&&k.normalWorld.negate();S.multiplyVector3(k.normalWorld);k.centroidWorld.copy(y.centroid);aa.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);I.multiplyVector3(k.centroidScreen);
+ja=y.vertexNormals;for(P=0,fa=ja.length;P<fa;P++)ha=k.vertexNormalsWorld[P],ha.copy(ja[P]),!j&&(R.flipSided||R.doubleSided)&&ha.negate(),S.multiplyVector3(ha);for(P=0,fa=Ua.length;P<fa;P++)if(Ia=Ua[P][U])for(ja=0,ha=Ia.length;ja<ha;ja++)k.uvs[P][ja]=Ia[ja];k.material=R.material;k.faceMaterial=null!==y.materialIndex?ba[y.materialIndex]:null;k.z=k.centroidScreen.z;w.elements.push(k)}}else if(R instanceof THREE.Line){C.multiply(I,aa);U=R.geometry.vertices;P=b();P.positionScreen.copy(U[0].position);C.multiplyVector4(P.positionScreen);
+for(F=1,y=U.length;F<y;F++)if(P=b(),P.positionScreen.copy(U[F].position),C.multiplyVector4(P.positionScreen),fa=l[i-2],K.copy(P.positionScreen),O.copy(fa.positionScreen),d(K,O))K.multiplyScalar(1/K.w),O.multiplyScalar(1/O.w),aa=s[r]=s[r]||new THREE.RenderableLine,r++,m=aa,m.v1.positionScreen.copy(K),m.v2.positionScreen.copy(O),m.z=Math.max(K.z,O.z),m.material=R.material,w.elements.push(m)}for(a=0,z=w.sprites.length;a<z;a++)if(R=w.sprites[a].object,aa=R.matrixWorld,R instanceof THREE.Particle&&(B.set(aa.n14,
+aa.n24,aa.n34,1),I.multiplyVector4(B),B.z/=B.w,0<B.z&&1>B.z))g=t[v]=t[v]||new THREE.RenderableParticle,v++,u=g,u.x=B.x/B.w,u.y=B.y/B.w,u.z=B.z,u.rotation=R.rotation.z,u.scale.x=R.scale.x*Math.abs(u.x-(B.x+e.projectionMatrix.n11)/(B.w+e.projectionMatrix.n14)),u.scale.y=R.scale.y*Math.abs(u.y-(B.y+e.projectionMatrix.n22)/(B.w+e.projectionMatrix.n24)),u.material=R.material,w.elements.push(u);f&&w.elements.sort(c);return w}};
 THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-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);0===a?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},multiply:function(a,
-b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,i=this.w,k=i*c+g*e-h*d,j=i*d+h*c-f*e,p=i*e+f*
-d-g*c,c=-f*c-g*d-h*e;b.x=k*i+c*-f+j*-h-p*-g;b.y=j*i+c*-g+p*-f-k*-h;b.z=p*i+c*-h+k*-g-j*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
+b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,i=this.w,l=i*c+g*e-h*d,k=i*d+h*c-f*e,p=i*e+f*
+d-g*c,c=-f*c-g*d-h*e;b.x=l*i+c*-f+k*-h-p*-g;b.y=k*i+c*-g+p*-f-l*-h;b.z=p*i+c*-h+l*-g-k*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
 THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(0.0010>Math.abs(e))return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
@@ -94,16 +94,16 @@ h=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.v
 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;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,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));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,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]))},computeMorphNormals:function(){var a,b,c,d,e;for(c=0,d=this.faces.length;c<
 d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();if(!e.__originalVertexNormals)e.__originalVertexNormals=[];for(a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};
-this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,k;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,k=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(i),h.push(k)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();
-f.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],i=g.faceNormals[c],k=g.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2])):(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2]),k.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,
-b,c,d,e,f,P){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;j=g[e];p=g[f];m=g[P];o=i.x-h.x;q=k.x-h.x;n=i.y-h.y;r=k.y-h.y;s=i.z-h.z;u=k.z-h.z;v=p.u-j.u;t=m.u-j.u;w=p.v-j.v;z=m.v-j.v;F=1/(v*z-t*w);K.set((z*o-w*q)*F,(z*n-w*r)*F,(z*s-w*u)*F);O.set((v*q-t*o)*F,(v*r-t*n)*F,(v*u-t*s)*F);D[b].addSelf(K);D[c].addSelf(K);D[d].addSelf(K);I[b].addSelf(O);I[c].addSelf(O);I[d].addSelf(O)}var b,c,d,e,f,g,h,i,k,j,p,m,o,q,n,r,s,u,v,t,w,z,F,C,D=[],I=[],K=new THREE.Vector3,O=new THREE.Vector3,
-Q=new THREE.Vector3,L=new THREE.Vector3,B=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)D[b]=new THREE.Vector3,I[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var N=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)B.copy(f.vertexNormals[d]),e=f[N[d]],
-C=D[e],Q.copy(C),Q.subSelf(B.multiplyScalar(B.dot(C))).normalize(),L.cross(f.vertexNormals[d],C),e=L.dot(I[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(Q.x,Q.y,Q.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<
+this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,l;for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,l=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(i),h.push(l)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();
+f.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],i=g.faceNormals[c],l=g.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(l.a.copy(e.vertexNormals[0]),l.b.copy(e.vertexNormals[1]),l.c.copy(e.vertexNormals[2])):(l.a.copy(e.vertexNormals[0]),l.b.copy(e.vertexNormals[1]),l.c.copy(e.vertexNormals[2]),l.d.copy(e.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,
+b,c,d,e,f,P){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=g[e];p=g[f];n=g[P];o=i.x-h.x;q=l.x-h.x;m=i.y-h.y;r=l.y-h.y;s=i.z-h.z;u=l.z-h.z;v=p.u-k.u;t=n.u-k.u;w=p.v-k.v;z=n.v-k.v;B=1/(v*z-t*w);K.set((z*o-w*q)*B,(z*m-w*r)*B,(z*s-w*u)*B);O.set((v*q-t*o)*B,(v*r-t*m)*B,(v*u-t*s)*B);C[b].addSelf(K);C[c].addSelf(K);C[d].addSelf(K);H[b].addSelf(O);H[c].addSelf(O);H[d].addSelf(O)}var b,c,d,e,f,g,h,i,l,k,p,n,o,q,m,r,s,u,v,t,w,z,B,I,C=[],H=[],K=new THREE.Vector3,O=new THREE.Vector3,
+Q=new THREE.Vector3,L=new THREE.Vector3,D=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)C[b]=new THREE.Vector3,H[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var N=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)D.copy(f.vertexNormals[d]),e=f[N[d]],
+I=C[e],Q.copy(I),Q.subSelf(D.multiplyScalar(D.dot(I))).normalize(),L.cross(f.vertexNormals[d],I),e=L.dot(H[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(Q.x,Q.y,Q.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<
 e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,
 4),f,g;for(f=0,g=this.vertices.length;f<g;f++)d=this.vertices[f].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];for(f=0,g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,k,j,p,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
-f+2;k=this.points[c[0]];j=this.points[c[1]];p=this.points[c[2]];m=this.points[c[3]];h=g*g;i=g*h;d.x=b(k.x,j.x,p.x,m.x,g,h,i);d.y=b(k.y,j.y,p.y,m.y,g,h,i);d.z=b(k.z,j.z,p.z,m.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=
-a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];g=Math.ceil(a*c/j.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),
+THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,l,k,p,n;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
+f+2;l=this.points[c[0]];k=this.points[c[1]];p=this.points[c[2]];n=this.points[c[3]];h=g*g;i=g*h;d.x=b(l.x,k.x,p.x,n.x,g,h,i);d.y=b(l.y,k.y,p.y,n.y,g,h,i);d.z=b(l.z,k.z,p.z,n.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=
+a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,l=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=l.chunks[b]-l.chunks[b-1];g=Math.ceil(a*c/l.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),
 h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=h}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.getRotationFromMatrix(this.matrix)};
 THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
 THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((void 0!==b?b:24)/(2*a))*(180/Math.PI);this.updateProjectionMatrix()};
@@ -136,7 +136,7 @@ a.fog?a.fog:!1;this.lights=void 0!==a.lights?a.lights:!1;this.vertexColors=void
 THREE.Texture=function(a,b,c,d,e,f,g,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
 !0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};
 THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;
-THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,e,f,g,h,i,k){THREE.Texture.call(this,null,f,g,h,i,k,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,e,f,g,h,i,l){THREE.Texture.call(this,null,f,g,h,i,l,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.ParticleBasicMaterial({color:16777215*Math.random()});this.sortParticles=!1;if(this.geometry)this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius;this.frustumCulled=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
 THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=void 0!==b?b:new THREE.LineBasicMaterial({color:16777215*Math.random()});this.type=void 0!==c?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
@@ -166,47 +166,47 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
 THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&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=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};
-THREE.DOMRenderer=function(){var a,b,c,d,e,f,g,h=new THREE.Projector;g=function(a){for(var b=document.documentElement,c=0;c<a.length;c++)if("string"===typeof b.style[a[c]])return a[c];return null}(["transform","MozTransform","WebkitTransform","msTransform","OTransform"]);this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var j,p,m,o,q,n;a=h.projectScene(c,d);b=a.elements;for(j=0,p=b.length;j<p;j++)if(m=b[j],m instanceof THREE.RenderableParticle&&
-m.material instanceof THREE.ParticleDOMMaterial)o=m.material.domElement,q=m.x*e+e-(o.offsetWidth>>1),n=m.y*f+f-(o.offsetHeight>>1),o.style.left=q+"px",o.style.top=n+"px",o.style.zIndex=Math.abs(Math.floor((1-m.z)*d.far/d.near)),g&&(o.style[g]="scale("+m.scale.x*e+","+m.scale.y*f+")")}};
-THREE.CanvasRenderer=function(a){function b(a){if(u!=a)n.globalAlpha=u=a}function c(a){if(v!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}v=a}}function d(a){if(t!=a)n.strokeStyle=t=a}function e(a){if(w!=a)n.fillStyle=w=a}var a=a||{},f=this,g,h,i,k=new THREE.Projector,j=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
-p,m,o,q,n=j.getContext("2d"),r=new THREE.Color(0),s=0,u=1,v=0,t=null,w=null,z=null,F=null,C=null,D,I,K,O,Q=new THREE.RenderableVertex,L=new THREE.RenderableVertex,B,N,E,l,Y,G,y,T,P,da,ja,ha,R=new THREE.Color,Z=new THREE.Color,S=new THREE.Color,$=new THREE.Color,ca=new THREE.Color,Ua=[],Ia=[],oa,Fa,Aa,ka,bb,jb,Va,cb,eb,db,Ga=new THREE.Rectangle,ra=new THREE.Rectangle,Ba=new THREE.Rectangle,Oa=!1,sa=new THREE.Color,Wa=new THREE.Color,mb=new THREE.Color,aa=new THREE.Vector3,fa,Fb,Tc,fb,pc,Cc,a=16;fa=
-document.createElement("canvas");fa.width=fa.height=2;Fb=fa.getContext("2d");Fb.fillStyle="rgba(0,0,0,1)";Fb.fillRect(0,0,2,2);Tc=Fb.getImageData(0,0,2,2);fb=Tc.data;pc=document.createElement("canvas");pc.width=pc.height=a;Cc=pc.getContext("2d");Cc.translate(-a/2,-a/2);Cc.scale(a,a);a--;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;m=b;o=Math.floor(p/2);q=Math.floor(m/2);j.width=p;j.height=m;Ga.set(-o,
--q,o,q);ra.set(-o,-q,o,q);u=1;v=0;C=F=z=w=t=null};this.setClearColor=function(a,b){r.copy(a);s=b;ra.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;ra.set(-o,-q,o,q)};this.clear=function(){n.setTransform(1,0,0,-1,o,q);ra.isEmpty()||(ra.minSelf(Ga),ra.inflate(2),1>s&&n.clearRect(Math.floor(ra.getX()),Math.floor(ra.getY()),Math.floor(ra.getWidth()),Math.floor(ra.getHeight())),0<s&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*
-r.b)+","+s+")"),n.fillRect(Math.floor(ra.getX()),Math.floor(ra.getY()),Math.floor(ra.getWidth()),Math.floor(ra.getHeight()))),ra.empty())};this.render=function(a,j){function m(a){var b,c,d,e;sa.setRGB(0,0,0);Wa.setRGB(0,0,0);mb.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(sa.r+=e.r,sa.g+=e.g,sa.b+=e.b):d instanceof THREE.DirectionalLight?(Wa.r+=e.r,Wa.g+=e.g,Wa.b+=e.b):d instanceof THREE.PointLight&&(mb.r+=e.r,mb.g+=e.g,mb.b+=e.b)}function p(a,b,c,d){var e,
-f,g,h,l,i;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(l=g.matrixWorld.getPosition(),i=c.dot(l),0>=i||(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):g instanceof THREE.PointLight&&(l=g.matrixWorld.getPosition(),i=c.dot(aa.sub(l,b).normalize()),0>=i||(i*=0==g.distance?1:1-Math.min(b.distanceTo(l)/g.distance,1),0!=i&&(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}function r(a,f,g){b(g.opacity);c(g.blending);var h,aa,i,l,fa,j;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)l=
-g.map.image,fa=l.width>>1,j=l.height>>1,g=f.scale.x*o,i=f.scale.y*q,h=g*fa,aa=i*j,Ba.set(a.x-h,a.y-aa,a.x+h,a.y+aa),Ga.intersects(Ba)&&(n.save(),n.translate(a.x,a.y),n.rotate(-f.rotation),n.scale(g,-i),n.translate(-fa,-j),n.drawImage(l,0,0),n.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=f.scale.x*o,aa=f.scale.y*q,Ba.set(a.x-h,a.y-aa,a.x+h,a.y+aa),Ga.intersects(Ba)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-f.rotation),n.scale(h,
-aa),g.program(n),n.restore()))}function s(a,e,f,g){b(g.opacity);c(g.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(z!=a)n.lineWidth=z=a;a=g.linecap;if(F!=a)n.lineCap=F=a;a=g.linejoin;if(C!=a)n.lineJoin=C=a;d(g.color.getContextStyle());n.stroke();Ba.inflate(2*g.linewidth)}}function t(a,d,e,g,h,fa,k,n){f.info.render.vertices+=3;f.info.render.faces++;b(n.opacity);
-c(n.blending);B=a.positionScreen.x;N=a.positionScreen.y;E=d.positionScreen.x;l=d.positionScreen.y;Y=e.positionScreen.x;G=e.positionScreen.y;v(B,N,E,l,Y,G);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(ka=k.uvs[0],Uc(B,N,E,l,Y,G,ka[g].u,ka[g].v,ka[h].u,ka[h].v,ka[fa].u,ka[fa].v,n.map));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,aa.copy(k.vertexNormalsWorld[g]),bb=0.5*(aa.x*a.n11+aa.y*a.n12+aa.z*
-a.n13)+0.5,jb=0.5*-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)+0.5,aa.copy(k.vertexNormalsWorld[h]),Va=0.5*(aa.x*a.n11+aa.y*a.n12+aa.z*a.n13)+0.5,cb=0.5*-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)+0.5,aa.copy(k.vertexNormalsWorld[fa]),eb=0.5*(aa.x*a.n11+aa.y*a.n12+aa.z*a.n13)+0.5,db=0.5*-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)+0.5,Uc(B,N,E,l,Y,G,bb,jb,Va,cb,eb,db,n.envMap)}else n.wireframe?Mb(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Gb(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&
-!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&(ka=k.uvs[0],Uc(B,N,E,l,Y,G,ka[g].u,ka[g].v,ka[h].u,ka[h].v,ka[fa].u,ka[fa].v,n.map)),c(THREE.SubtractiveBlending)),Oa?!n.wireframe&&n.shading==THREE.SmoothShading&&3==k.vertexNormalsWorld.length?(Z.r=S.r=$.r=sa.r,Z.g=S.g=$.g=sa.g,Z.b=S.b=$.b=sa.b,p(i,k.v1.positionWorld,k.vertexNormalsWorld[0],Z),p(i,k.v2.positionWorld,k.vertexNormalsWorld[1],S),p(i,k.v3.positionWorld,k.vertexNormalsWorld[2],$),Z.r=Math.max(0,Math.min(n.color.r*Z.r,1)),Z.g=
-Math.max(0,Math.min(n.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(n.color.b*Z.b,1)),S.r=Math.max(0,Math.min(n.color.r*S.r,1)),S.g=Math.max(0,Math.min(n.color.g*S.g,1)),S.b=Math.max(0,Math.min(n.color.b*S.b,1)),$.r=Math.max(0,Math.min(n.color.r*$.r,1)),$.g=Math.max(0,Math.min(n.color.g*$.g,1)),$.b=Math.max(0,Math.min(n.color.b*$.b,1)),ca.r=0.5*(S.r+$.r),ca.g=0.5*(S.g+$.g),ca.b=0.5*(S.b+$.b),Aa=Dc(Z,S,$,ca),gc(B,N,E,l,Y,G,0,0,1,0,0,1,Aa)):(R.r=sa.r,R.g=sa.g,R.b=sa.b,p(i,k.centroidWorld,k.normalWorld,R),
-R.r=Math.max(0,Math.min(n.color.r*R.r,1)),R.g=Math.max(0,Math.min(n.color.g*R.g,1)),R.b=Math.max(0,Math.min(n.color.b*R.b,1)),n.wireframe?Mb(R,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Gb(R)):n.wireframe?Mb(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Gb(n.color);else if(n instanceof THREE.MeshDepthMaterial)oa=j.near,Fa=j.far,Z.r=Z.g=Z.b=1-ac(a.positionScreen.z,oa,Fa),S.r=S.g=S.b=1-ac(d.positionScreen.z,oa,Fa),$.r=$.g=$.b=1-ac(e.positionScreen.z,oa,Fa),ca.r=
-0.5*(S.r+$.r),ca.g=0.5*(S.g+$.g),ca.b=0.5*(S.b+$.b),Aa=Dc(Z,S,$,ca),gc(B,N,E,l,Y,G,0,0,1,0,0,1,Aa);else if(n instanceof THREE.MeshNormalMaterial)R.r=hc(k.normalWorld.x),R.g=hc(k.normalWorld.y),R.b=hc(k.normalWorld.z),n.wireframe?Mb(R,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Gb(R)}function u(a,d,e,g,h,aa,fa,k,n){f.info.render.vertices+=4;f.info.render.faces++;b(k.opacity);c(k.blending);if(k.map||k.envMap)t(a,d,g,0,1,3,fa,k,n),t(h,e,aa,1,2,3,fa,k,n);else if(B=a.positionScreen.x,
-N=a.positionScreen.y,E=d.positionScreen.x,l=d.positionScreen.y,Y=e.positionScreen.x,G=e.positionScreen.y,y=g.positionScreen.x,T=g.positionScreen.y,P=h.positionScreen.x,da=h.positionScreen.y,ja=aa.positionScreen.x,ha=aa.positionScreen.y,k instanceof THREE.MeshBasicMaterial)w(B,N,E,l,Y,G,y,T),k.wireframe?Mb(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(k.color);else if(k instanceof THREE.MeshLambertMaterial)Oa?!k.wireframe&&k.shading==THREE.SmoothShading&&4==fa.vertexNormalsWorld.length?
-(Z.r=S.r=$.r=ca.r=sa.r,Z.g=S.g=$.g=ca.g=sa.g,Z.b=S.b=$.b=ca.b=sa.b,p(i,fa.v1.positionWorld,fa.vertexNormalsWorld[0],Z),p(i,fa.v2.positionWorld,fa.vertexNormalsWorld[1],S),p(i,fa.v4.positionWorld,fa.vertexNormalsWorld[3],$),p(i,fa.v3.positionWorld,fa.vertexNormalsWorld[2],ca),Z.r=Math.max(0,Math.min(k.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(k.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(k.color.b*Z.b,1)),S.r=Math.max(0,Math.min(k.color.r*S.r,1)),S.g=Math.max(0,Math.min(k.color.g*S.g,1)),S.b=Math.max(0,
-Math.min(k.color.b*S.b,1)),$.r=Math.max(0,Math.min(k.color.r*$.r,1)),$.g=Math.max(0,Math.min(k.color.g*$.g,1)),$.b=Math.max(0,Math.min(k.color.b*$.b,1)),ca.r=Math.max(0,Math.min(k.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(k.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(k.color.b*ca.b,1)),Aa=Dc(Z,S,$,ca),v(B,N,E,l,y,T),gc(B,N,E,l,y,T,0,0,1,0,0,1,Aa),v(P,da,Y,G,ja,ha),gc(P,da,Y,G,ja,ha,1,0,1,1,0,1,Aa)):(R.r=sa.r,R.g=sa.g,R.b=sa.b,p(i,fa.centroidWorld,fa.normalWorld,R),R.r=Math.max(0,Math.min(k.color.r*
-R.r,1)),R.g=Math.max(0,Math.min(k.color.g*R.g,1)),R.b=Math.max(0,Math.min(k.color.b*R.b,1)),w(B,N,E,l,Y,G,y,T),k.wireframe?Mb(R,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(R)):(w(B,N,E,l,Y,G,y,T),k.wireframe?Mb(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):Gb(k.color));else if(k instanceof THREE.MeshNormalMaterial)R.r=hc(fa.normalWorld.x),R.g=hc(fa.normalWorld.y),R.b=hc(fa.normalWorld.z),w(B,N,E,l,Y,G,y,T),k.wireframe?Mb(R,k.wireframeLinewidth,k.wireframeLinecap,
-k.wireframeLinejoin):Gb(R);else if(k instanceof THREE.MeshDepthMaterial)oa=j.near,Fa=j.far,Z.r=Z.g=Z.b=1-ac(a.positionScreen.z,oa,Fa),S.r=S.g=S.b=1-ac(d.positionScreen.z,oa,Fa),$.r=$.g=$.b=1-ac(g.positionScreen.z,oa,Fa),ca.r=ca.g=ca.b=1-ac(e.positionScreen.z,oa,Fa),Aa=Dc(Z,S,$,ca),v(B,N,E,l,y,T),gc(B,N,E,l,y,T,0,0,1,0,0,1,Aa),v(P,da,Y,G,ja,ha),gc(P,da,Y,G,ja,ha,1,0,1,1,0,1,Aa)}function v(a,b,c,d,e,f){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(a,b);n.closePath()}function w(a,
-b,c,d,e,f,g,h){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(g,h);n.lineTo(a,b);n.closePath()}function Mb(a,b,c,e){if(z!=b)n.lineWidth=z=b;if(F!=c)n.lineCap=F=c;if(C!=e)n.lineJoin=C=e;d(a.getContextStyle());n.stroke();Ba.inflate(2*b)}function Gb(a){e(a.getContextStyle());n.fill()}function Uc(a,b,c,d,f,g,h,aa,i,l,fa,k,j){if(0!=j.image.width){if(!0==j.needsUpdate||void 0==Ua[j.id]){var m=j.wrapS==THREE.RepeatWrapping,o=j.wrapT==THREE.RepeatWrapping;Ua[j.id]=n.createPattern(j.image,
-m&&o?"repeat":m&&!o?"repeat-x":!m&&o?"repeat-y":"no-repeat");j.needsUpdate=!1}e(Ua[j.id]);var m=j.offset.x/j.repeat.x,o=j.offset.y/j.repeat.y,p=j.image.width*j.repeat.x,Fb=j.image.height*j.repeat.y,h=(h+m)*p,aa=(aa+o)*Fb,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+m)*p-h,l=(l+o)*Fb-aa,fa=(fa+m)*p-h,k=(k+o)*Fb-aa,m=i*k-fa*l;if(0==m){if(void 0===Ia[j.id])b=document.createElement("canvas"),b.width=j.image.width,b.height=j.image.height,b=b.getContext("2d"),b.drawImage(j.image,0,0),Ia[j.id]=b.getImageData(0,0,j.image.width,
-j.image.height).data;b=Ia[j.id];h=4*(Math.floor(h)+Math.floor(aa)*j.image.width);R.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Gb(R)}else m=1/m,j=(k*c-l*f)*m,l=(k*d-l*g)*m,c=(i*f-fa*c)*m,d=(i*g-fa*d)*m,a=a-j*h-c*aa,h=b-l*h-d*aa,n.save(),n.transform(j,l,c,d,a,h),n.fill(),n.restore()}}function gc(a,b,c,d,e,f,g,h,aa,i,l,fa,k){var j,m;j=k.width-1;m=k.height-1;g*=j;h*=m;c-=a;d-=b;e-=a;f-=b;aa=aa*j-g;i=i*m-h;l=l*j-g;fa=fa*m-h;m=1/(aa*fa-l*i);j=(fa*c-i*e)*m;i=(fa*d-i*f)*m;c=(aa*e-l*c)*m;d=(aa*f-l*d)*m;a=a-j*
-g-c*h;b=b-i*g-d*h;n.save();n.transform(j,i,c,d,a,b);n.clip();n.drawImage(k,0,0);n.restore()}function Dc(a,b,c,d){var e=~~(255*a.r),f=~~(255*a.g),a=~~(255*a.b),g=~~(255*b.r),h=~~(255*b.g),b=~~(255*b.b),aa=~~(255*c.r),i=~~(255*c.g),c=~~(255*c.b),l=~~(255*d.r),k=~~(255*d.g),d=~~(255*d.b);fb[0]=0>e?0:255<e?255:e;fb[1]=0>f?0:255<f?255:f;fb[2]=0>a?0:255<a?255:a;fb[4]=0>g?0:255<g?255:g;fb[5]=0>h?0:255<h?255:h;fb[6]=0>b?0:255<b?255:b;fb[8]=0>aa?0:255<aa?255:aa;fb[9]=0>i?0:255<i?255:i;fb[10]=0>c?0:255<c?255:
-c;fb[12]=0>l?0:255<l?255:l;fb[13]=0>k?0:255<k?255:k;fb[14]=0>d?0:255<d?255:d;Fb.putImageData(Tc,0,0);Cc.drawImage(fa,0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ec,ed,Pa,kb;this.autoClear?this.clear():n.setTransform(1,0,0,-1,o,q);f.info.render.vertices=0;f.info.render.faces=0;g=k.projectScene(a,j,this.sortElements);
-h=g.elements;i=g.lights;(Oa=0<i.length)&&m(i);for(Ec=0,ed=h.length;Ec<ed;Ec++)if(Pa=h[Ec],kb=Pa.material,kb=kb instanceof THREE.MeshFaceMaterial?Pa.faceMaterial:kb,!(null==kb||0==kb.opacity)){Ba.empty();if(Pa instanceof THREE.RenderableParticle)D=Pa,D.x*=o,D.y*=q,r(D,Pa,kb,a);else if(Pa instanceof THREE.RenderableLine)D=Pa.v1,I=Pa.v2,D.positionScreen.x*=o,D.positionScreen.y*=q,I.positionScreen.x*=o,I.positionScreen.y*=q,Ba.addPoint(D.positionScreen.x,D.positionScreen.y),Ba.addPoint(I.positionScreen.x,
-I.positionScreen.y),Ga.intersects(Ba)&&s(D,I,Pa,kb,a);else if(Pa instanceof THREE.RenderableFace3)D=Pa.v1,I=Pa.v2,K=Pa.v3,D.positionScreen.x*=o,D.positionScreen.y*=q,I.positionScreen.x*=o,I.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,kb.overdraw&&(Nb(D.positionScreen,I.positionScreen),Nb(I.positionScreen,K.positionScreen),Nb(K.positionScreen,D.positionScreen)),Ba.add3Points(D.positionScreen.x,D.positionScreen.y,I.positionScreen.x,I.positionScreen.y,K.positionScreen.x,K.positionScreen.y),
-Ga.intersects(Ba)&&t(D,I,K,0,1,2,Pa,kb,a);else if(Pa instanceof THREE.RenderableFace4)D=Pa.v1,I=Pa.v2,K=Pa.v3,O=Pa.v4,D.positionScreen.x*=o,D.positionScreen.y*=q,I.positionScreen.x*=o,I.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,O.positionScreen.x*=o,O.positionScreen.y*=q,Q.positionScreen.copy(I.positionScreen),L.positionScreen.copy(O.positionScreen),kb.overdraw&&(Nb(D.positionScreen,I.positionScreen),Nb(I.positionScreen,O.positionScreen),Nb(O.positionScreen,D.positionScreen),
-Nb(K.positionScreen,Q.positionScreen),Nb(K.positionScreen,L.positionScreen)),Ba.addPoint(D.positionScreen.x,D.positionScreen.y),Ba.addPoint(I.positionScreen.x,I.positionScreen.y),Ba.addPoint(K.positionScreen.x,K.positionScreen.y),Ba.addPoint(O.positionScreen.x,O.positionScreen.y),Ga.intersects(Ba)&&u(D,I,K,O,Q,L,Pa,kb,a);ra.addRectangle(Ba)}n.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,k;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),k=c.dot(i),0>=k||(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),k=c.dot(D.sub(i,b).normalize()),0>=k||(k*=0==g.distance?1:1-Math.min(b.distanceTo(i)/g.distance,1),0!=k&&(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)))}function b(a){null==I[a]&&(I[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),0==B&&I[a].setAttribute("shape-rendering","crispEdges"));return I[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,j,p,m,o,q,n,r,s=new THREE.Rectangle,u=new THREE.Rectangle,v=!1,t=new THREE.Color,w=new THREE.Color,z=new THREE.Color,F=new THREE.Color,C,D=new THREE.Vector3,I=[],K=[],O,Q,L,B=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":B=1;break;case "low":B=0}};this.setSize=function(a,b){k=a;j=b;p=k/2;m=j/2;i.setAttribute("viewBox",-p+" "+-m+" "+k+" "+j);i.setAttribute("width",k);i.setAttribute("height",j);s.set(-p,-m,p,m)};this.clear=function(){for(;0<i.childNodes.length;)i.removeChild(i.childNodes[0])};this.render=function(k,j){var l,D,G,y;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,j,this.sortElements);f=e.elements;
-g=e.lights;L=Q=0;if(v=0<g.length){w.setRGB(0,0,0);z.setRGB(0,0,0);F.setRGB(0,0,0);for(l=0,D=g.length;l<D;l++)y=g[l],G=y.color,y instanceof THREE.AmbientLight?(w.r+=G.r,w.g+=G.g,w.b+=G.b):y instanceof THREE.DirectionalLight?(z.r+=G.r,z.g+=G.g,z.b+=G.b):y instanceof THREE.PointLight&&(F.r+=G.r,F.g+=G.g,F.b+=G.b)}for(l=0,D=f.length;l<D;l++)if(G=f[l],y=G.material,y=y instanceof THREE.MeshFaceMaterial?G.faceMaterial:y,!(null==y||0==y.opacity))if(u.empty(),G instanceof THREE.RenderableParticle)o=G,o.x*=
-p,o.y*=-m;else if(G instanceof THREE.RenderableLine){if(o=G.v1,q=G.v2,o.positionScreen.x*=p,o.positionScreen.y*=-m,q.positionScreen.x*=p,q.positionScreen.y*=-m,u.addPoint(o.positionScreen.x,o.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(u)){G=o;var T=q,P=L++;null==K[P]&&(K[P]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==B&&K[P].setAttribute("shape-rendering","crispEdges"));O=K[P];O.setAttribute("x1",G.positionScreen.x);O.setAttribute("y1",G.positionScreen.y);
-O.setAttribute("x2",T.positionScreen.x);O.setAttribute("y2",T.positionScreen.y);y instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: "+y.color.getContextStyle()+"; stroke-width: "+y.linewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.linecap+"; stroke-linejoin: "+y.linejoin),i.appendChild(O))}}else if(G instanceof THREE.RenderableFace3){if(o=G.v1,q=G.v2,n=G.v3,o.positionScreen.x*=p,o.positionScreen.y*=-m,q.positionScreen.x*=p,q.positionScreen.y*=-m,n.positionScreen.x*=
-p,n.positionScreen.y*=-m,u.addPoint(o.positionScreen.x,o.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),s.intersects(u)){var T=o,P=q,da=n;d.info.render.vertices+=3;d.info.render.faces++;O=b(Q++);O.setAttribute("d","M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+"z");y instanceof THREE.MeshBasicMaterial?t.copy(y.color):y instanceof THREE.MeshLambertMaterial?
-v?(t.r=w.r,t.g=w.g,t.b=w.b,a(g,G.centroidWorld,G.normalWorld,t),t.r=Math.max(0,Math.min(y.color.r*t.r,1)),t.g=Math.max(0,Math.min(y.color.g*t.g,1)),t.b=Math.max(0,Math.min(y.color.b*t.b,1))):t.copy(y.color):y instanceof THREE.MeshDepthMaterial?(C=1-y.__2near/(y.__farPlusNear-G.z*y.__farMinusNear),t.setRGB(C,C,C)):y instanceof THREE.MeshNormalMaterial&&t.setRGB(c(G.normalWorld.x),c(G.normalWorld.y),c(G.normalWorld.z));y.wireframe?O.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+
-y.wireframeLinewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframeLinecap+"; stroke-linejoin: "+y.wireframeLinejoin):O.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+y.opacity);i.appendChild(O)}}else if(G instanceof THREE.RenderableFace4&&(o=G.v1,q=G.v2,n=G.v3,r=G.v4,o.positionScreen.x*=p,o.positionScreen.y*=-m,q.positionScreen.x*=p,q.positionScreen.y*=-m,n.positionScreen.x*=p,n.positionScreen.y*=-m,r.positionScreen.x*=p,r.positionScreen.y*=-m,u.addPoint(o.positionScreen.x,
-o.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),s.intersects(u))){var T=o,P=q,da=n,I=r;d.info.render.vertices+=4;d.info.render.faces++;O=b(Q++);O.setAttribute("d","M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+" L "+I.positionScreen.x+","+I.positionScreen.y+"z");y instanceof THREE.MeshBasicMaterial?
-t.copy(y.color):y instanceof THREE.MeshLambertMaterial?v?(t.r=w.r,t.g=w.g,t.b=w.b,a(g,G.centroidWorld,G.normalWorld,t),t.r=Math.max(0,Math.min(y.color.r*t.r,1)),t.g=Math.max(0,Math.min(y.color.g*t.g,1)),t.b=Math.max(0,Math.min(y.color.b*t.b,1))):t.copy(y.color):y instanceof THREE.MeshDepthMaterial?(C=1-y.__2near/(y.__farPlusNear-G.z*y.__farMinusNear),t.setRGB(C,C,C)):y instanceof THREE.MeshNormalMaterial&&t.setRGB(c(G.normalWorld.x),c(G.normalWorld.y),c(G.normalWorld.z));y.wireframe?O.setAttribute("style",
+THREE.DOMRenderer=function(){var a,b,c,d,e,f,g,h=new THREE.Projector;g=function(a){for(var b=document.documentElement,c=0;c<a.length;c++)if("string"===typeof b.style[a[c]])return a[c];return null}(["transform","MozTransform","WebkitTransform","msTransform","OTransform"]);this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var k,p,n,o,q,m;a=h.projectScene(c,d);b=a.elements;for(k=0,p=b.length;k<p;k++)if(n=b[k],n instanceof THREE.RenderableParticle&&
+n.material instanceof THREE.ParticleDOMMaterial)o=n.material.domElement,q=n.x*e+e-(o.offsetWidth>>1),m=n.y*f+f-(o.offsetHeight>>1),o.style.left=q+"px",o.style.top=m+"px",o.style.zIndex=Math.abs(Math.floor((1-n.z)*d.far/d.near)),g&&(o.style[g]="scale("+n.scale.x*e+","+n.scale.y*f+")")}};
+THREE.CanvasRenderer=function(a){function b(a){if(u!=a)m.globalAlpha=u=a}function c(a){if(v!=a){switch(a){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}v=a}}function d(a){if(t!=a)m.strokeStyle=t=a}function e(a){if(w!=a)m.fillStyle=w=a}var a=a||{},f=this,g,h,i,l=new THREE.Projector,k=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
+p,n,o,q,m=k.getContext("2d"),r=new THREE.Color(0),s=0,u=1,v=0,t=null,w=null,z=null,B=null,I=null,C,H,K,O,Q=new THREE.RenderableVertex,L=new THREE.RenderableVertex,D,N,E,j,Z,F,y,U,P,fa,ja,ha,R=new THREE.Color,aa=new THREE.Color,S=new THREE.Color,ba=new THREE.Color,da=new THREE.Color,Ua=[],Ia=[],oa,Fa,Aa,ka,bb,jb,Va,cb,eb,db,Ga=new THREE.Rectangle,ra=new THREE.Rectangle,Ba=new THREE.Rectangle,Oa=!1,sa=new THREE.Color,Wa=new THREE.Color,mb=new THREE.Color,$=new THREE.Vector3,V,Fb,Tc,fb,pc,Cc,a=16;V=
+document.createElement("canvas");V.width=V.height=2;Fb=V.getContext("2d");Fb.fillStyle="rgba(0,0,0,1)";Fb.fillRect(0,0,2,2);Tc=Fb.getImageData(0,0,2,2);fb=Tc.data;pc=document.createElement("canvas");pc.width=pc.height=a;Cc=pc.getContext("2d");Cc.translate(-a/2,-a/2);Cc.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){p=a;n=b;o=Math.floor(p/2);q=Math.floor(n/2);k.width=p;k.height=n;Ga.set(-o,-q,
+o,q);ra.set(-o,-q,o,q);u=1;v=0;I=B=z=w=t=null};this.setClearColor=function(a,b){r.copy(a);s=b;ra.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;ra.set(-o,-q,o,q)};this.clear=function(){m.setTransform(1,0,0,-1,o,q);ra.isEmpty()||(ra.minSelf(Ga),ra.inflate(2),1>s&&m.clearRect(Math.floor(ra.getX()),Math.floor(ra.getY()),Math.floor(ra.getWidth()),Math.floor(ra.getHeight())),0<s&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*
+r.b)+","+s+")"),m.fillRect(Math.floor(ra.getX()),Math.floor(ra.getY()),Math.floor(ra.getWidth()),Math.floor(ra.getHeight()))),ra.empty())};this.render=function(a,k){function n(a){var b,c,d,e;sa.setRGB(0,0,0);Wa.setRGB(0,0,0);mb.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(sa.r+=e.r,sa.g+=e.g,sa.b+=e.b):d instanceof THREE.DirectionalLight?(Wa.r+=e.r,Wa.g+=e.g,Wa.b+=e.b):d instanceof THREE.PointLight&&(mb.r+=e.r,mb.g+=e.g,mb.b+=e.b)}function p(a,b,c,d){var e,
+f,g,h,j,V;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),V=c.dot(j),0>=V||(V*=g.intensity,d.r+=h.r*V,d.g+=h.g*V,d.b+=h.b*V)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),V=c.dot($.sub(j,b).normalize()),0>=V||(V*=0==g.distance?1:1-Math.min(b.distanceTo(j)/g.distance,1),0!=V&&(V*=g.intensity,d.r+=h.r*V,d.g+=h.g*V,d.b+=h.b*V)))}function r(a,f,g){b(g.opacity);c(g.blending);var $,h,j,V,i,l;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)V=
+g.map.image,i=V.width>>1,l=V.height>>1,g=f.scale.x*o,j=f.scale.y*q,$=g*i,h=j*l,Ba.set(a.x-$,a.y-h,a.x+$,a.y+h),Ga.intersects(Ba)&&(m.save(),m.translate(a.x,a.y),m.rotate(-f.rotation),m.scale(g,-j),m.translate(-i,-l),m.drawImage(V,0,0),m.restore())}else g instanceof THREE.ParticleCanvasMaterial&&($=f.scale.x*o,h=f.scale.y*q,Ba.set(a.x-$,a.y-h,a.x+$,a.y+h),Ga.intersects(Ba)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),m.save(),m.translate(a.x,a.y),m.rotate(-f.rotation),m.scale($,h),g.program(m),
+m.restore()))}function s(a,e,f,g){b(g.opacity);c(g.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(e.positionScreen.x,e.positionScreen.y);m.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(z!=a)m.lineWidth=z=a;a=g.linecap;if(B!=a)m.lineCap=B=a;a=g.linejoin;if(I!=a)m.lineJoin=I=a;d(g.color.getContextStyle());m.stroke();Ba.inflate(2*g.linewidth)}}function t(a,d,e,g,h,V,l,m){f.info.render.vertices+=3;f.info.render.faces++;b(m.opacity);c(m.blending);
+D=a.positionScreen.x;N=a.positionScreen.y;E=d.positionScreen.x;j=d.positionScreen.y;Z=e.positionScreen.x;F=e.positionScreen.y;v(D,N,E,j,Z,F);if(m instanceof THREE.MeshBasicMaterial)if(m.map)m.map.mapping instanceof THREE.UVMapping&&(ka=l.uvs[0],Uc(D,N,E,j,Z,F,ka[g].u,ka[g].v,ka[h].u,ka[h].v,ka[V].u,ka[V].v,m.map));else if(m.envMap){if(m.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,$.copy(l.vertexNormalsWorld[g]),bb=0.5*($.x*a.n11+$.y*a.n12+$.z*a.n13)+0.5,jb=0.5*
+-($.x*a.n21+$.y*a.n22+$.z*a.n23)+0.5,$.copy(l.vertexNormalsWorld[h]),Va=0.5*($.x*a.n11+$.y*a.n12+$.z*a.n13)+0.5,cb=0.5*-($.x*a.n21+$.y*a.n22+$.z*a.n23)+0.5,$.copy(l.vertexNormalsWorld[V]),eb=0.5*($.x*a.n11+$.y*a.n12+$.z*a.n13)+0.5,db=0.5*-($.x*a.n21+$.y*a.n22+$.z*a.n23)+0.5,Uc(D,N,E,j,Z,F,bb,jb,Va,cb,eb,db,m.envMap)}else m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(m.color);else if(m instanceof THREE.MeshLambertMaterial)m.map&&!m.wireframe&&(m.map.mapping instanceof
+THREE.UVMapping&&(ka=l.uvs[0],Uc(D,N,E,j,Z,F,ka[g].u,ka[g].v,ka[h].u,ka[h].v,ka[V].u,ka[V].v,m.map)),c(THREE.SubtractiveBlending)),Oa?!m.wireframe&&m.shading==THREE.SmoothShading&&3==l.vertexNormalsWorld.length?(aa.r=S.r=ba.r=sa.r,aa.g=S.g=ba.g=sa.g,aa.b=S.b=ba.b=sa.b,p(i,l.v1.positionWorld,l.vertexNormalsWorld[0],aa),p(i,l.v2.positionWorld,l.vertexNormalsWorld[1],S),p(i,l.v3.positionWorld,l.vertexNormalsWorld[2],ba),aa.r=Math.max(0,Math.min(m.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(m.color.g*aa.g,
+1)),aa.b=Math.max(0,Math.min(m.color.b*aa.b,1)),S.r=Math.max(0,Math.min(m.color.r*S.r,1)),S.g=Math.max(0,Math.min(m.color.g*S.g,1)),S.b=Math.max(0,Math.min(m.color.b*S.b,1)),ba.r=Math.max(0,Math.min(m.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(m.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(m.color.b*ba.b,1)),da.r=0.5*(S.r+ba.r),da.g=0.5*(S.g+ba.g),da.b=0.5*(S.b+ba.b),Aa=Dc(aa,S,ba,da),gc(D,N,E,j,Z,F,0,0,1,0,0,1,Aa)):(R.r=sa.r,R.g=sa.g,R.b=sa.b,p(i,l.centroidWorld,l.normalWorld,R),R.r=Math.max(0,Math.min(m.color.r*
+R.r,1)),R.g=Math.max(0,Math.min(m.color.g*R.g,1)),R.b=Math.max(0,Math.min(m.color.b*R.b,1)),m.wireframe?Mb(R,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(R)):m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(m.color);else if(m instanceof THREE.MeshDepthMaterial)oa=k.near,Fa=k.far,aa.r=aa.g=aa.b=1-ac(a.positionScreen.z,oa,Fa),S.r=S.g=S.b=1-ac(d.positionScreen.z,oa,Fa),ba.r=ba.g=ba.b=1-ac(e.positionScreen.z,oa,Fa),da.r=0.5*(S.r+ba.r),da.g=0.5*
+(S.g+ba.g),da.b=0.5*(S.b+ba.b),Aa=Dc(aa,S,ba,da),gc(D,N,E,j,Z,F,0,0,1,0,0,1,Aa);else if(m instanceof THREE.MeshNormalMaterial)R.r=hc(l.normalWorld.x),R.g=hc(l.normalWorld.y),R.b=hc(l.normalWorld.z),m.wireframe?Mb(R,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(R)}function u(a,d,e,g,$,h,V,m,l){f.info.render.vertices+=4;f.info.render.faces++;b(m.opacity);c(m.blending);if(m.map||m.envMap)t(a,d,g,0,1,3,V,m,l),t($,e,h,1,2,3,V,m,l);else if(D=a.positionScreen.x,N=a.positionScreen.y,E=d.positionScreen.x,
+j=d.positionScreen.y,Z=e.positionScreen.x,F=e.positionScreen.y,y=g.positionScreen.x,U=g.positionScreen.y,P=$.positionScreen.x,fa=$.positionScreen.y,ja=h.positionScreen.x,ha=h.positionScreen.y,m instanceof THREE.MeshBasicMaterial)w(D,N,E,j,Z,F,y,U),m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(m.color);else if(m instanceof THREE.MeshLambertMaterial)Oa?!m.wireframe&&m.shading==THREE.SmoothShading&&4==V.vertexNormalsWorld.length?(aa.r=S.r=ba.r=da.r=sa.r,aa.g=
+S.g=ba.g=da.g=sa.g,aa.b=S.b=ba.b=da.b=sa.b,p(i,V.v1.positionWorld,V.vertexNormalsWorld[0],aa),p(i,V.v2.positionWorld,V.vertexNormalsWorld[1],S),p(i,V.v4.positionWorld,V.vertexNormalsWorld[3],ba),p(i,V.v3.positionWorld,V.vertexNormalsWorld[2],da),aa.r=Math.max(0,Math.min(m.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(m.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(m.color.b*aa.b,1)),S.r=Math.max(0,Math.min(m.color.r*S.r,1)),S.g=Math.max(0,Math.min(m.color.g*S.g,1)),S.b=Math.max(0,Math.min(m.color.b*S.b,1)),
+ba.r=Math.max(0,Math.min(m.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(m.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(m.color.b*ba.b,1)),da.r=Math.max(0,Math.min(m.color.r*da.r,1)),da.g=Math.max(0,Math.min(m.color.g*da.g,1)),da.b=Math.max(0,Math.min(m.color.b*da.b,1)),Aa=Dc(aa,S,ba,da),v(D,N,E,j,y,U),gc(D,N,E,j,y,U,0,0,1,0,0,1,Aa),v(P,fa,Z,F,ja,ha),gc(P,fa,Z,F,ja,ha,1,0,1,1,0,1,Aa)):(R.r=sa.r,R.g=sa.g,R.b=sa.b,p(i,V.centroidWorld,V.normalWorld,R),R.r=Math.max(0,Math.min(m.color.r*R.r,1)),R.g=Math.max(0,
+Math.min(m.color.g*R.g,1)),R.b=Math.max(0,Math.min(m.color.b*R.b,1)),w(D,N,E,j,Z,F,y,U),m.wireframe?Mb(R,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(R)):(w(D,N,E,j,Z,F,y,U),m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Gb(m.color));else if(m instanceof THREE.MeshNormalMaterial)R.r=hc(V.normalWorld.x),R.g=hc(V.normalWorld.y),R.b=hc(V.normalWorld.z),w(D,N,E,j,Z,F,y,U),m.wireframe?Mb(R,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):
+Gb(R);else if(m instanceof THREE.MeshDepthMaterial)oa=k.near,Fa=k.far,aa.r=aa.g=aa.b=1-ac(a.positionScreen.z,oa,Fa),S.r=S.g=S.b=1-ac(d.positionScreen.z,oa,Fa),ba.r=ba.g=ba.b=1-ac(g.positionScreen.z,oa,Fa),da.r=da.g=da.b=1-ac(e.positionScreen.z,oa,Fa),Aa=Dc(aa,S,ba,da),v(D,N,E,j,y,U),gc(D,N,E,j,y,U,0,0,1,0,0,1,Aa),v(P,fa,Z,F,ja,ha),gc(P,fa,Z,F,ja,ha,1,0,1,1,0,1,Aa)}function v(a,b,c,d,e,f){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(a,b);m.closePath()}function w(a,b,c,d,e,f,g,$){m.beginPath();
+m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(g,$);m.lineTo(a,b);m.closePath()}function Mb(a,b,c,e){if(z!=b)m.lineWidth=z=b;if(B!=c)m.lineCap=B=c;if(I!=e)m.lineJoin=I=e;d(a.getContextStyle());m.stroke();Ba.inflate(2*b)}function Gb(a){e(a.getContextStyle());m.fill()}function Uc(a,b,c,d,f,g,$,h,V,j,i,l,k){if(0!=k.image.width){if(!0==k.needsUpdate||void 0==Ua[k.id]){var n=k.wrapS==THREE.RepeatWrapping,o=k.wrapT==THREE.RepeatWrapping;Ua[k.id]=m.createPattern(k.image,n&&o?"repeat":n&&!o?"repeat-x":
+!n&&o?"repeat-y":"no-repeat");k.needsUpdate=!1}e(Ua[k.id]);var n=k.offset.x/k.repeat.x,o=k.offset.y/k.repeat.y,Fb=k.image.width*k.repeat.x,p=k.image.height*k.repeat.y,$=($+n)*Fb,h=(h+o)*p,c=c-a,d=d-b,f=f-a,g=g-b,V=(V+n)*Fb-$,j=(j+o)*p-h,i=(i+n)*Fb-$,l=(l+o)*p-h,n=V*l-i*j;if(0==n){if(void 0===Ia[k.id])b=document.createElement("canvas"),b.width=k.image.width,b.height=k.image.height,b=b.getContext("2d"),b.drawImage(k.image,0,0),Ia[k.id]=b.getImageData(0,0,k.image.width,k.image.height).data;b=Ia[k.id];
+$=4*(Math.floor($)+Math.floor(h)*k.image.width);R.setRGB(b[$]/255,b[$+1]/255,b[$+2]/255);Gb(R)}else n=1/n,k=(l*c-j*f)*n,j=(l*d-j*g)*n,c=(V*f-i*c)*n,d=(V*g-i*d)*n,a=a-k*$-c*h,$=b-j*$-d*h,m.save(),m.transform(k,j,c,d,a,$),m.fill(),m.restore()}}function gc(a,b,c,d,e,f,g,$,h,V,j,i,l){var k,n;k=l.width-1;n=l.height-1;g*=k;$*=n;c-=a;d-=b;e-=a;f-=b;h=h*k-g;V=V*n-$;j=j*k-g;i=i*n-$;n=1/(h*i-j*V);k=(i*c-V*e)*n;V=(i*d-V*f)*n;c=(h*e-j*c)*n;d=(h*f-j*d)*n;a=a-k*g-c*$;b=b-V*g-d*$;m.save();m.transform(k,V,c,d,a,
+b);m.clip();m.drawImage(l,0,0);m.restore()}function Dc(a,b,c,d){var e=~~(255*a.r),f=~~(255*a.g),a=~~(255*a.b),g=~~(255*b.r),$=~~(255*b.g),b=~~(255*b.b),h=~~(255*c.r),j=~~(255*c.g),c=~~(255*c.b),m=~~(255*d.r),i=~~(255*d.g),d=~~(255*d.b);fb[0]=0>e?0:255<e?255:e;fb[1]=0>f?0:255<f?255:f;fb[2]=0>a?0:255<a?255:a;fb[4]=0>g?0:255<g?255:g;fb[5]=0>$?0:255<$?255:$;fb[6]=0>b?0:255<b?255:b;fb[8]=0>h?0:255<h?255:h;fb[9]=0>j?0:255<j?255:j;fb[10]=0>c?0:255<c?255:c;fb[12]=0>m?0:255<m?255:m;fb[13]=0>i?0:255<i?255:
+i;fb[14]=0>d?0:255<d?255:d;Fb.putImageData(Tc,0,0);Cc.drawImage(V,0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ec,ed,Pa,kb;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,q);f.info.render.vertices=0;f.info.render.faces=0;g=l.projectScene(a,k,this.sortElements);h=g.elements;i=g.lights;(Oa=0<i.length)&&n(i);
+for(Ec=0,ed=h.length;Ec<ed;Ec++)if(Pa=h[Ec],kb=Pa.material,kb=kb instanceof THREE.MeshFaceMaterial?Pa.faceMaterial:kb,!(null==kb||0==kb.opacity)){Ba.empty();if(Pa instanceof THREE.RenderableParticle)C=Pa,C.x*=o,C.y*=q,r(C,Pa,kb,a);else if(Pa instanceof THREE.RenderableLine)C=Pa.v1,H=Pa.v2,C.positionScreen.x*=o,C.positionScreen.y*=q,H.positionScreen.x*=o,H.positionScreen.y*=q,Ba.addPoint(C.positionScreen.x,C.positionScreen.y),Ba.addPoint(H.positionScreen.x,H.positionScreen.y),Ga.intersects(Ba)&&s(C,
+H,Pa,kb,a);else if(Pa instanceof THREE.RenderableFace3)C=Pa.v1,H=Pa.v2,K=Pa.v3,C.positionScreen.x*=o,C.positionScreen.y*=q,H.positionScreen.x*=o,H.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,kb.overdraw&&(Nb(C.positionScreen,H.positionScreen),Nb(H.positionScreen,K.positionScreen),Nb(K.positionScreen,C.positionScreen)),Ba.add3Points(C.positionScreen.x,C.positionScreen.y,H.positionScreen.x,H.positionScreen.y,K.positionScreen.x,K.positionScreen.y),Ga.intersects(Ba)&&t(C,H,K,0,1,2,
+Pa,kb,a);else if(Pa instanceof THREE.RenderableFace4)C=Pa.v1,H=Pa.v2,K=Pa.v3,O=Pa.v4,C.positionScreen.x*=o,C.positionScreen.y*=q,H.positionScreen.x*=o,H.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,O.positionScreen.x*=o,O.positionScreen.y*=q,Q.positionScreen.copy(H.positionScreen),L.positionScreen.copy(O.positionScreen),kb.overdraw&&(Nb(C.positionScreen,H.positionScreen),Nb(H.positionScreen,O.positionScreen),Nb(O.positionScreen,C.positionScreen),Nb(K.positionScreen,Q.positionScreen),
+Nb(K.positionScreen,L.positionScreen)),Ba.addPoint(C.positionScreen.x,C.positionScreen.y),Ba.addPoint(H.positionScreen.x,H.positionScreen.y),Ba.addPoint(K.positionScreen.x,K.positionScreen.y),Ba.addPoint(O.positionScreen.x,O.positionScreen.y),Ga.intersects(Ba)&&u(C,H,K,O,Q,L,Pa,kb,a);ra.addRectangle(Ba)}m.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,m,i;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(m=g.matrixWorld.getPosition(),i=c.dot(m),0>=i||(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):g instanceof THREE.PointLight&&(m=g.matrixWorld.getPosition(),i=c.dot(C.sub(m,b).normalize()),0>=i||(i*=0==g.distance?1:1-Math.min(b.distanceTo(m)/g.distance,1),0!=i&&(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}function b(a){null==H[a]&&(H[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),0==D&&H[a].setAttribute("shape-rendering","crispEdges"));return H[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,p,n,o,q,m,r,s=new THREE.Rectangle,u=new THREE.Rectangle,v=!1,t=new THREE.Color,w=new THREE.Color,z=new THREE.Color,B=new THREE.Color,I,C=new THREE.Vector3,H=[],K=[],O,Q,L,D=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":D=1;break;case "low":D=0}};this.setSize=function(a,b){l=a;k=b;p=l/2;n=k/2;i.setAttribute("viewBox",-p+" "+-n+" "+l+" "+k);i.setAttribute("width",l);i.setAttribute("height",k);s.set(-p,-n,p,n)};this.clear=function(){for(;0<i.childNodes.length;)i.removeChild(i.childNodes[0])};this.render=function(l,k){var j,C,F,y;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(l,k,this.sortElements);f=e.elements;
+g=e.lights;L=Q=0;if(v=0<g.length){w.setRGB(0,0,0);z.setRGB(0,0,0);B.setRGB(0,0,0);for(j=0,C=g.length;j<C;j++)y=g[j],F=y.color,y instanceof THREE.AmbientLight?(w.r+=F.r,w.g+=F.g,w.b+=F.b):y instanceof THREE.DirectionalLight?(z.r+=F.r,z.g+=F.g,z.b+=F.b):y instanceof THREE.PointLight&&(B.r+=F.r,B.g+=F.g,B.b+=F.b)}for(j=0,C=f.length;j<C;j++)if(F=f[j],y=F.material,y=y instanceof THREE.MeshFaceMaterial?F.faceMaterial:y,!(null==y||0==y.opacity))if(u.empty(),F instanceof THREE.RenderableParticle)o=F,o.x*=
+p,o.y*=-n;else if(F instanceof THREE.RenderableLine){if(o=F.v1,q=F.v2,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,u.addPoint(o.positionScreen.x,o.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(u)){F=o;var U=q,P=L++;null==K[P]&&(K[P]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==D&&K[P].setAttribute("shape-rendering","crispEdges"));O=K[P];O.setAttribute("x1",F.positionScreen.x);O.setAttribute("y1",F.positionScreen.y);
+O.setAttribute("x2",U.positionScreen.x);O.setAttribute("y2",U.positionScreen.y);y instanceof THREE.LineBasicMaterial&&(O.setAttribute("style","fill: none; stroke: "+y.color.getContextStyle()+"; stroke-width: "+y.linewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.linecap+"; stroke-linejoin: "+y.linejoin),i.appendChild(O))}}else if(F instanceof THREE.RenderableFace3){if(o=F.v1,q=F.v2,m=F.v3,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,m.positionScreen.x*=
+p,m.positionScreen.y*=-n,u.addPoint(o.positionScreen.x,o.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),u.addPoint(m.positionScreen.x,m.positionScreen.y),s.intersects(u)){var U=o,P=q,fa=m;d.info.render.vertices+=3;d.info.render.faces++;O=b(Q++);O.setAttribute("d","M "+U.positionScreen.x+" "+U.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");y instanceof THREE.MeshBasicMaterial?t.copy(y.color):y instanceof THREE.MeshLambertMaterial?
+v?(t.r=w.r,t.g=w.g,t.b=w.b,a(g,F.centroidWorld,F.normalWorld,t),t.r=Math.max(0,Math.min(y.color.r*t.r,1)),t.g=Math.max(0,Math.min(y.color.g*t.g,1)),t.b=Math.max(0,Math.min(y.color.b*t.b,1))):t.copy(y.color):y instanceof THREE.MeshDepthMaterial?(I=1-y.__2near/(y.__farPlusNear-F.z*y.__farMinusNear),t.setRGB(I,I,I)):y instanceof THREE.MeshNormalMaterial&&t.setRGB(c(F.normalWorld.x),c(F.normalWorld.y),c(F.normalWorld.z));y.wireframe?O.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+
+y.wireframeLinewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframeLinecap+"; stroke-linejoin: "+y.wireframeLinejoin):O.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+y.opacity);i.appendChild(O)}}else if(F instanceof THREE.RenderableFace4&&(o=F.v1,q=F.v2,m=F.v3,r=F.v4,o.positionScreen.x*=p,o.positionScreen.y*=-n,q.positionScreen.x*=p,q.positionScreen.y*=-n,m.positionScreen.x*=p,m.positionScreen.y*=-n,r.positionScreen.x*=p,r.positionScreen.y*=-n,u.addPoint(o.positionScreen.x,
+o.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(r.positionScreen.x,r.positionScreen.y),s.intersects(u))){var U=o,P=q,fa=m,H=r;d.info.render.vertices+=4;d.info.render.faces++;O=b(Q++);O.setAttribute("d","M "+U.positionScreen.x+" "+U.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+" L "+H.positionScreen.x+","+H.positionScreen.y+"z");y instanceof THREE.MeshBasicMaterial?
+t.copy(y.color):y instanceof THREE.MeshLambertMaterial?v?(t.r=w.r,t.g=w.g,t.b=w.b,a(g,F.centroidWorld,F.normalWorld,t),t.r=Math.max(0,Math.min(y.color.r*t.r,1)),t.g=Math.max(0,Math.min(y.color.g*t.g,1)),t.b=Math.max(0,Math.min(y.color.b*t.b,1))):t.copy(y.color):y instanceof THREE.MeshDepthMaterial?(I=1-y.__2near/(y.__farPlusNear-F.z*y.__farMinusNear),t.setRGB(I,I,I)):y instanceof THREE.MeshNormalMaterial&&t.setRGB(c(F.normalWorld.x),c(F.normalWorld.y),c(F.normalWorld.z));y.wireframe?O.setAttribute("style",
 "fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+y.wireframeLinewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframeLinecap+"; stroke-linejoin: "+y.wireframeLinejoin):O.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+y.opacity);i.appendChild(O)}}};
 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\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#endif\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",
@@ -242,130 +242,130 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
 "}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
-THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(void 0===a.__webglCustomAttributesList)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?g=4:"c"===f.type&&(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)}}}
+THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(void 0===a.__webglCustomAttributesList)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.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;if(0<=b.materialIndex)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?!0:!1}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;
-var i=a.colors,k=i.length,j=a.__vertexArray,n=a.__colorArray,m=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,q=a.__webglCustomAttributesList;if(c.sortParticles){db.copy(eb);db.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,Ga.copy(e),db.multiplyVector3(Ga),m[d]=[Ga.z,d];m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[m[d][1]].position,f=3*d,j[f]=e.x,j[f+1]=e.y,j[f+2]=e.z;for(d=0;d<k;d++)f=3*d,e=i[m[d][1]],n[f]=e.r,n[f+1]=e.g,n[f+2]=e.b;if(q)for(i=0,k=q.length;i<k;i++)if(h=
-q[i],void 0===h.boundTo||"vertices"===h.boundTo)if(f=0,e=h.value.length,1===h.size)for(d=0;d<e;d++)g=m[d][1],h.array[d]=h.value[g];else if(2===h.size)for(d=0;d<e;d++)g=m[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<e;d++)g=m[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=m[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(4===h.size)for(d=0;d<e;d++)g=m[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=3*d,j[f]=e.x,j[f+1]=e.y,j[f+2]=e.z;if(p)for(d=0;d<k;d++)e=i[d],f=3*d,n[f]=e.r,n[f+1]=e.g,n[f+2]=e.b;if(q)for(i=0,k=q.length;i<k;i++)if(h=q[i],h.needsUpdate&&(void 0===h.boundTo||"vertices"===h.boundTo))if(e=h.value.length,f=0,1===h.size)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(2===h.size)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(3===h.size)if("c"===
-h.type)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(4===h.size)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,j,b);if(p||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,a.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,
-n,b);if(q)for(i=0,k=q.length;i<k;i++)if(h=q[i],h.needsUpdate||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,h.buffer),l.bufferData(l.ARRAY_BUFFER,h.array,b)}function g(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)da=G=null,T=P=$=S=Z=-1,a[d].render(b,c,jb,Va),da=G=null,T=P=$=S=Z=-1}function i(a,b,c,d,e,f,g,h){var i,k,l,j;b?(k=a.length-1,j=b=-1):(k=0,b=a.length,j=1);for(var n=k;n!==b;n+=j)if(i=a[n],i.render){k=i.object;l=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;
-g&&E.setBlending(i.blending);E.setDepthTest(i.depthTest);E.setDepthWrite(i.depthWrite);s(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}E.setObjectFaces(k);l instanceof THREE.BufferGeometry?E.renderBufferDirect(d,e,f,i,l,k):E.renderBuffer(d,e,f,i,l,k)}}function k(a,b,c,d,e,f,g){for(var h,i,k=0,l=a.length;k<l;k++)if(h=a[k],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&E.setBlending(h.blending);E.setDepthTest(h.depthTest);E.setDepthWrite(h.depthWrite);s(h.polygonOffset,h.polygonOffsetFactor,
-h.polygonOffsetUnits)}E.renderImmediateObject(c,d,e,h,i)}}function j(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function m(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function o(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function n(a,b,c,d,e){if(!d.program||d.needsUpdate)E.initMaterial(d,
-b,c,e),d.needsUpdate=!1;if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets);for(var f=0,g=E.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==G&&(l.useProgram(f),G=f,h=!0);if(d.id!==T)T=d.id,h=!0;if(h||a!==da)l.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray),a!==da&&(da=a);if(h){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){var k,j=0,n=0,m=0,o,p,q,r=Ba,s=r.directional.colors,y=r.directional.positions,t=r.point.colors,u=r.point.positions,w=r.point.distances,P=0,D=0,C=q=0;for(c=0,h=b.length;c<h;c++)if(k=b[c],!k.onlyShadow)if(o=k.color,p=k.intensity,q=k.distance,k instanceof THREE.AmbientLight)E.gammaInput?(j+=o.r*o.r,n+=o.g*o.g,m+=o.b*o.b):
-(j+=o.r,n+=o.g,m+=o.b);else if(k instanceof THREE.DirectionalLight)q=3*P,E.gammaInput?(s[q]=o.r*o.r*p*p,s[q+1]=o.g*o.g*p*p,s[q+2]=o.b*o.b*p*p):(s[q]=o.r*p,s[q+1]=o.g*p,s[q+2]=o.b*p),ra.copy(k.matrixWorld.getPosition()),ra.subSelf(k.target.matrixWorld.getPosition()),ra.normalize(),y[q]=ra.x,y[q+1]=ra.y,y[q+2]=ra.z,P+=1;else if(k instanceof THREE.PointLight||k instanceof THREE.SpotLight)C=3*D,E.gammaInput?(t[C]=o.r*o.r*p*p,t[C+1]=o.g*o.g*p*p,t[C+2]=o.b*o.b*p*p):(t[C]=o.r*p,t[C+1]=o.g*p,t[C+2]=o.b*p),
-k=k.matrixWorld.getPosition(),u[C]=k.x,u[C+1]=k.y,u[C+2]=k.z,w[D]=q,D+=1;for(c=3*P,h=s.length;c<h;c++)s[c]=0;for(c=3*D,h=t.length;c<h;c++)t[c]=0;r.point.length=D;r.directional.length=P;r.ambient[0]=j;r.ambient[1]=n;r.ambient[2]=m;c=Ba;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances}if(d instanceof
-THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,E.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=F.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,E.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),
-i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)E.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);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){h=c=0;for(j=b.length;h<j;h++)if(n=b[h],n.castShadow&&(n instanceof THREE.SpotLight||n instanceof THREE.DirectionalLight&&!n.shadowCascade))i.shadowMap.texture[c]=n.shadowMap,i.shadowMapSize.value[c]=n.shadowMapSize,i.shadowMatrix.value[c]=n.shadowMatrix,i.shadowDarkness.value[c]=n.shadowDarkness,
-i.shadowBias.value[c]=n.shadowBias,c++}b=d.uniformsList;for(i=0,c=b.length;i<c;i++)if(n=f.uniforms[b[i][1]])if(h=b[i][0],m=h.type,j=h.value,"i"===m)l.uniform1i(n,j);else if("f"===m)l.uniform1f(n,j);else if("v2"===m)l.uniform2f(n,j.x,j.y);else if("v3"===m)l.uniform3f(n,j.x,j.y,j.z);else if("v4"===m)l.uniform4f(n,j.x,j.y,j.z,j.w);else if("c"===m)l.uniform3f(n,j.r,j.g,j.b);else if("fv1"===m)l.uniform1fv(n,j);else if("fv"===m)l.uniform3fv(n,j);else if("v2v"===m){if(!h._array)h._array=new Float32Array(2*
-j.length);for(m=0,r=j.length;m<r;m++)s=2*m,h._array[s]=j[m].x,h._array[s+1]=j[m].y;l.uniform2fv(n,h._array)}else if("v3v"===m){if(!h._array)h._array=new Float32Array(3*j.length);for(m=0,r=j.length;m<r;m++)s=3*m,h._array[s]=j[m].x,h._array[s+1]=j[m].y,h._array[s+2]=j[m].z;l.uniform3fv(n,h._array)}else if("v4v"==m){if(!h._array)h._array=new Float32Array(4*j.length);for(m=0,r=j.length;m<r;m++)s=4*m,h._array[s]=j[m].x,h._array[s+1]=j[m].y,h._array[s+2]=j[m].z,h._array[s+3]=j[m].w;l.uniform4fv(n,h._array)}else if("m4"===
-m){if(!h._array)h._array=new Float32Array(16);j.flattenToArray(h._array);l.uniformMatrix4fv(n,!1,h._array)}else if("m4v"===m){if(!h._array)h._array=new Float32Array(16*j.length);for(m=0,r=j.length;m<r;m++)j[m].flattenToArrayOffset(h._array,16*m);l.uniformMatrix4fv(n,!1,h._array)}else if("t"===m){if(l.uniform1i(n,j),n=h.texture)if(n.image instanceof Array&&6===n.image.length){if(h=n,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=l.createTexture();l.activeTexture(l.TEXTURE0+
-j);l.bindTexture(l.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);j=[];for(n=0;6>n;n++){m=j;r=n;if(E.autoScaleCubemaps){if(s=h.image[n],t=sa,!(s.width<=t&&s.height<=t))u=Math.max(s.width,s.height),y=Math.floor(s.width*t/u),t=Math.floor(s.height*t/u),u=document.createElement("canvas"),u.width=y,u.height=t,u.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,y,t),s=u}else s=h.image[n];m[r]=s}n=j[0];m=0===(n.width&n.width-1)&&0===(n.height&n.height-1);r=z(h.format);s=z(h.type);v(l.TEXTURE_CUBE_MAP,
-h,m);for(n=0;6>n;n++)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,r,r,s,j[n]);h.generateMipmaps&&m&&l.generateMipmap(l.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdate)h.onUpdate()}else l.activeTexture(l.TEXTURE0+j),l.bindTexture(l.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(h=n,l.activeTexture(l.TEXTURE0+j),l.bindTexture(l.TEXTURE_CUBE_MAP,h.__webglTexture)):E.setTexture(n,j)}else if("tv"===m){if(!h._array){h._array=[];for(m=0,r=h.texture.length;m<
-r;m++)h._array[m]=j+m}l.uniform1iv(n,h._array);for(m=0,r=h.texture.length;m<r;m++)(n=h.texture[m])&&E.setTexture(n,h._array[m])}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==g.cameraPosition)b=a.matrixWorld.getPosition(),l.uniform3f(g.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&l.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);
-d.skinning&&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)&&null!==g.objectMatrix&&l.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function r(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);
-c&&c.transposeIntoArray(a._normalMatrixArray)}function s(a,b,c){ca!==a&&(a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),ca=a);if(a&&(Ua!==b||Ia!==c))l.polygonOffset(b,c),Ua=b,Ia=c}function u(a,b){var c;"fragment"===a?c=l.createShader(l.FRAGMENT_SHADER):"vertex"===a&&(c=l.createShader(l.VERTEX_SHADER));l.shaderSource(c,b);l.compileShader(c);return!l.getShaderParameter(c,l.COMPILE_STATUS)?(console.error(l.getShaderInfoLog(c)),console.error(b),null):c}function v(a,b,c){c?(l.texParameteri(a,
-l.TEXTURE_WRAP_S,z(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,z(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,z(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,z(b.minFilter))):(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,w(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,w(b.minFilter)))}function t(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 w(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return l.NEAREST;
-default:return l.LINEAR}}function z(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.UnsignedIntType: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||{},F=void 0!==a.canvas?a.canvas:document.createElement("canvas"),C=void 0!==a.precision?a.precision:"highp",D=void 0!==a.alpha?a.alpha:!0,I=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,K=void 0!==a.antialias?a.antialias:!1,O=void 0!==a.stencil?a.stencil:!0,Q=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,L=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),B=void 0!==a.clearAlpha?a.clearAlpha:0,N=void 0!==a.maxLights?a.maxLights:4;this.domElement=
-F;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info=
-{memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var E=this,l,Y=[],G=null,y=null,T=-1,P=null,da=null,ja=0,ha=null,R=null,Z=null,S=null,$=null,ca=null,Ua=null,Ia=null,oa=null,Fa=0,Aa=0,ka=0,bb=0,jb=0,Va=0,cb=new THREE.Frustum,eb=new THREE.Matrix4,db=new THREE.Matrix4,Ga=new THREE.Vector4,ra=new THREE.Vector3,Ba={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};l=function(){var a;try{if(!(a=
-F.getContext("experimental-webgl",{alpha:D,premultipliedAlpha:I,antialias:K,stencil:O,preserveDrawingBuffer:Q})))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(L.r,L.g,L.b,B);this.context=l;var Oa=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS);l.getParameter(l.MAX_TEXTURE_SIZE);var sa=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return l};this.supportsVertexTextures=function(){return 0<Oa};this.setSize=function(a,b){F.width=a;F.height=b;this.setViewport(0,0,F.width,F.height)};this.setViewport=function(a,
-b,c,d){Fa=a;Aa=b;ka=c;bb=d;l.viewport(Fa,Aa,ka,bb)};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){L.setHex(a);B=b;l.clearColor(L.r,L.g,L.b,B)};this.setClearColor=function(a,b){L.copy(a);B=b;l.clearColor(L.r,L.g,L.b,B)};this.getClearColor=function(){return L};this.getClearAlpha=function(){return B};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=l.COLOR_BUFFER_BIT;
-if(void 0===b||b)d|=l.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.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);var d=void 0,e=void 0;if(c.numMorphTargets)for(d=0,e=c.numMorphTargets;d<e;d++)l.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.numMorphNormals)for(d=0,e=c.numMorphNormals;d<e;d++)l.deleteBuffer(c.__webglMorphNormalsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)l.deleteBuffer(c.__webglCustomAttributesList[d].buffer);E.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),
-l.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,l.deleteTexture(a.__webglTexture),E.info.memory.textures--};this.deallocateRenderTarget=
-function(a){if(a&&a.__webglTexture)if(l.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)l.deleteFramebuffer(a.__webglFramebuffer[b]),l.deleteRenderbuffer(a.__webglRenderbuffer[b]);else l.deleteFramebuffer(a.__webglFramebuffer),l.deleteRenderbuffer(a.__webglRenderbuffer)};this.updateShadowMap=function(a,b){G=null;T=P=$=S=Z=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(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,j,k,n,m,o=3*a.count;for(m=0;m<o;m+=9)c=a.normalArray,d=c[m],e=c[m+1],f=c[m+2],g=c[m+3],i=c[m+
-4],k=c[m+5],h=c[m+6],j=c[m+7],n=c[m+8],d=(d+g+h)/3,e=(e+i+j)/3,f=(f+k+n)/3,c[m]=d,c[m+1]=e,c[m+2]=f,c[m+3]=d,c[m+4]=e,c[m+5]=f,c[m+6]=d,c[m+7]=e,c[m+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};this.renderBufferDirect=function(a,b,c,d,e,f){if(0!==d.opacity&&(c=n(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?
-1:0),d!==P&&(P=d,b=!0),f instanceof THREE.Mesh)){f=e.offsets;d=0;for(c=f.length;d<c;++d)b&&(l.bindBuffer(l.ARRAY_BUFFER,e.vertexPositionBuffer),l.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,l.FLOAT,!1,0,12*f[d].index),0<=a.normal&&e.vertexNormalBuffer&&(l.bindBuffer(l.ARRAY_BUFFER,e.vertexNormalBuffer),l.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,l.FLOAT,!1,0,12*f[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(l.bindBuffer(l.ARRAY_BUFFER,e.vertexUvBuffer),
-l.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,l.FLOAT,!1,0,8*f[d].index),l.enableVertexAttribArray(a.uv)):l.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(l.bindBuffer(l.ARRAY_BUFFER,e.vertexColorBuffer),l.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,l.FLOAT,!1,0,16*f[d].index)),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),l.drawElements(l.TRIANGLES,f[d].count,l.UNSIGNED_SHORT,2*f[d].start),E.info.render.calls++,E.info.render.vertices+=f[d].count,
-E.info.render.faces+=f[d].count/3}};this.renderBuffer=function(a,b,c,d,e,f){if(0!==d.opacity){var g,h,c=n(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==P&&(P=c,a=!0);if(!d.morphTargets&&0<=b.position)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;-1!==f.morphTargetBase?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),l.vertexAttribPointer(c.position,
-3,l.FLOAT,!1,0,0)):0<=c.position&&(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),d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[g]]),l.vertexAttribPointer(c["morphNormal"+
-g],3,l.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],j=-1,k=0;h=f.morphTargetInfluences;var m,o=h.length;g=0;for(-1!==f.morphTargetBase&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(m=0;m<o;m++)!i[m]&&h[m]>j&&(k=m,j=h[k]);l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);l.vertexAttribPointer(c["morphTarget"+g],3,l.FLOAT,!1,0,0);d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[k]),l.vertexAttribPointer(c["morphNormal"+
-g],3,l.FLOAT,!1,0,0));f.__webglMorphTargetInfluences[g]=j;i[k]=1;j=-1;g++}}null!==d.program.uniforms.morphTargetInfluences&&l.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(g=0,h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(l.bindBuffer(l.ARRAY_BUFFER,c.buffer),l.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,l.FLOAT,!1,0,0));0<=b.color&&
-(l.bindBuffer(l.ARRAY_BUFFER,e.__webglColorBuffer),l.vertexAttribPointer(b.color,3,l.FLOAT,!1,0,0));0<=b.normal&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglNormalBuffer),l.vertexAttribPointer(b.normal,3,l.FLOAT,!1,0,0));0<=b.tangent&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglTangentBuffer),l.vertexAttribPointer(b.tangent,4,l.FLOAT,!1,0,0));0<=b.uv&&(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));
-0<=b.uv2&&(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&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(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!==oa&&(l.lineWidth(d),oa=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)),E.info.render.calls++,E.info.render.vertices+=e.__webglFaceCount,E.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,d=d.linewidth,d!==oa&&(l.lineWidth(d),oa=d),l.drawArrays(f,0,e.__webglLineCount),E.info.render.calls++):f instanceof THREE.ParticleSystem?(l.drawArrays(l.POINTS,0,e.__webglParticleCount),E.info.render.calls++,E.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(l.drawArrays(l.TRIANGLE_STRIP,
-0,e.__webglVertexCount),E.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,j,m,n=a.__lights,o=a.fog;T=-1;void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);
-b.projectionMatrix.flattenToArray(b._projectionMatrixArray);eb.multiply(b.projectionMatrix,b.matrixWorldInverse);cb.setFromMatrix(eb);this.autoUpdateObjects&&this.initWebGLObjects(a);h(this.renderPluginsPre,a,b);E.info.render.calls=0;E.info.render.vertices=0;E.info.render.faces=0;E.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;for(d=0,e=m.length;d<e;d++)if(f=m[d],j=f.object,f.render=!1,
-j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||cb.contains(j))){j.matrixWorld.flattenToArray(j._objectMatrixArray);r(j,b);var p=f,q=p.object,y=p.buffer,t=void 0,t=t=void 0,t=q.material;if(t instanceof THREE.MeshFaceMaterial){if(t=y.materialIndex,0<=t)t=q.geometry.materials[t],t.transparent?(p.transparent=t,p.opaque=null):(p.opaque=t,p.transparent=null)}else if(t)t.transparent?(p.transparent=t,p.opaque=null):(p.opaque=t,p.transparent=null);f.render=!0;
-if(this.sortObjects)j.renderDepth?f.z=j.renderDepth:(Ga.copy(j.matrixWorld.getPosition()),eb.multiplyVector3(Ga),f.z=Ga.z)}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;for(d=0,e=m.length;d<e;d++)if(f=m[d],j=f.object,j.visible)j.matrixAutoUpdate&&j.matrixWorld.flattenToArray(j._objectMatrixArray),r(j,b),j=f.object.material,j.transparent?(f.transparent=j,f.opaque=null):(f.opaque=j,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),
-this.setDepthWrite(a.overrideMaterial.depthWrite),s(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,n,o,!0,a.overrideMaterial),k(a.__webglObjectsImmediate,"",b,n,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,n,o,!1),k(a.__webglObjectsImmediate,"opaque",b,n,o,!1),i(a.__webglObjects,!1,"transparent",b,n,o,!0),k(a.__webglObjectsImmediate,"transparent",b,n,o,!0));
-h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&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.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,e){var f=
-n(a,b,c,d,e);P=-1;E.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,l,cb):e.render(function(a){E.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,i=void 0,k=void 0,n=void 0;if(!g.__webglInit)if(g.__webglInit=!0,g._modelViewMatrix=new THREE.Matrix4,g._normalMatrixArray=new Float32Array(9),
-g._modelViewMatrixArray=new Float32Array(16),g._objectMatrixArray=new Float32Array(16),g.matrixWorld.flattenToArray(g._objectMatrixArray),g instanceof THREE.Mesh){if(k=g.geometry,k instanceof THREE.Geometry){if(void 0===k.geometryGroups){var r=k,s=void 0,t=void 0,y=void 0,u=void 0,v=void 0,w=void 0,z=void 0,P={},D=r.morphTargets.length,G=r.morphNormals.length;r.geometryGroups={};for(s=0,t=r.faces.length;s<t;s++)y=r.faces[s],u=y.materialIndex,w=void 0!==u?u:-1,void 0===P[w]&&(P[w]={hash:w,counter:0}),
-z=P[w].hash+"_"+P[w].counter,void 0===r.geometryGroups[z]&&(r.geometryGroups[z]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:D,numMorphNormals:G}),v=y instanceof THREE.Face3?3:4,65535<r.geometryGroups[z].vertices+v&&(P[w].counter+=1,z=P[w].hash+"_"+P[w].counter,void 0===r.geometryGroups[z]&&(r.geometryGroups[z]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:D,numMorphNormals:G})),y instanceof THREE.Face3?r.geometryGroups[z].faces3.push(s):r.geometryGroups[z].faces4.push(s),
-r.geometryGroups[z].vertices+=v;r.geometryGroupsList=[];var da=void 0;for(da in r.geometryGroups)r.geometryGroups[da].id=ja++,r.geometryGroupsList.push(r.geometryGroups[da])}for(i in k.geometryGroups)if(n=k.geometryGroups[i],!n.__webglVertexBuffer){var C=n;C.__webglVertexBuffer=l.createBuffer();C.__webglNormalBuffer=l.createBuffer();C.__webglTangentBuffer=l.createBuffer();C.__webglColorBuffer=l.createBuffer();C.__webglUVBuffer=l.createBuffer();C.__webglUV2Buffer=l.createBuffer();C.__webglSkinVertexABuffer=
-l.createBuffer();C.__webglSkinVertexBBuffer=l.createBuffer();C.__webglSkinIndicesBuffer=l.createBuffer();C.__webglSkinWeightsBuffer=l.createBuffer();C.__webglFaceBuffer=l.createBuffer();C.__webglLineBuffer=l.createBuffer();var T=void 0,F=void 0;if(C.numMorphTargets){C.__webglMorphTargetsBuffers=[];for(T=0,F=C.numMorphTargets;T<F;T++)C.__webglMorphTargetsBuffers.push(l.createBuffer())}if(C.numMorphNormals){C.__webglMorphNormalsBuffers=[];for(T=0,F=C.numMorphNormals;T<F;T++)C.__webglMorphNormalsBuffers.push(l.createBuffer())}E.info.memory.geometries++;
-var B=n,I=g,L=I.geometry,R=B.faces3,N=B.faces4,K=3*R.length+4*N.length,O=1*R.length+2*N.length,ha=3*R.length+4*N.length,S=c(I,B),$=e(S),Q=d(S),Z=S.vertexColors?S.vertexColors:!1;B.__vertexArray=new Float32Array(3*K);if(Q)B.__normalArray=new Float32Array(3*K);if(L.hasTangents)B.__tangentArray=new Float32Array(4*K);if(Z)B.__colorArray=new Float32Array(3*K);if($){if(0<L.faceUvs.length||0<L.faceVertexUvs.length)B.__uvArray=new Float32Array(2*K);if(1<L.faceUvs.length||1<L.faceVertexUvs.length)B.__uv2Array=
-new Float32Array(2*K)}if(I.geometry.skinWeights.length&&I.geometry.skinIndices.length)B.__skinVertexAArray=new Float32Array(4*K),B.__skinVertexBArray=new Float32Array(4*K),B.__skinIndexArray=new Float32Array(4*K),B.__skinWeightArray=new Float32Array(4*K);B.__faceArray=new Uint16Array(3*O);B.__lineArray=new Uint16Array(2*ha);var ca=void 0,Y=void 0;if(B.numMorphTargets){B.__morphTargetsArrays=[];for(ca=0,Y=B.numMorphTargets;ca<Y;ca++)B.__morphTargetsArrays.push(new Float32Array(3*K))}if(B.numMorphNormals){B.__morphNormalsArrays=
-[];for(ca=0,Y=B.numMorphNormals;ca<Y;ca++)B.__morphNormalsArrays.push(new Float32Array(3*K))}B.__webglFaceCount=3*O;B.__webglLineCount=2*ha;if(S.attributes){if(void 0===B.__webglCustomAttributesList)B.__webglCustomAttributesList=[];var Ua=void 0;for(Ua in S.attributes){var Ia=S.attributes[Ua],oa={},Aa;for(Aa in Ia)oa[Aa]=Ia[Aa];if(!oa.__webglInitialized||oa.createUniqueBuffers){oa.__webglInitialized=!0;var ka=1;"v2"===oa.type?ka=2:"v3"===oa.type?ka=3:"v4"===oa.type?ka=4:"c"===oa.type&&(ka=3);oa.size=
-ka;oa.array=new Float32Array(K*ka);oa.buffer=l.createBuffer();oa.buffer.belongsToAttribute=Ua;Ia.needsUpdate=!0;oa.__original=Ia}B.__webglCustomAttributesList.push(oa)}}B.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}}else if(g instanceof THREE.Ribbon){if(k=g.geometry,!k.__webglVertexBuffer){var ra=k;ra.__webglVertexBuffer=l.createBuffer();ra.__webglColorBuffer=l.createBuffer();E.info.memory.geometries++;
-var Fa=k,sa=Fa.vertices.length;Fa.__vertexArray=new Float32Array(3*sa);Fa.__colorArray=new Float32Array(3*sa);Fa.__webglVertexCount=sa;k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(g instanceof THREE.Line){if(k=g.geometry,!k.__webglVertexBuffer){var Ba=k;Ba.__webglVertexBuffer=l.createBuffer();Ba.__webglColorBuffer=l.createBuffer();E.info.memory.geometries++;var Ga=k,Oa=g,bb=Ga.vertices.length;Ga.__vertexArray=new Float32Array(3*bb);Ga.__colorArray=new Float32Array(3*bb);Ga.__webglLineCount=bb;
-b(Ga,Oa);k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(g instanceof THREE.ParticleSystem&&(k=g.geometry,!k.__webglVertexBuffer)){var jb=k;jb.__webglVertexBuffer=l.createBuffer();jb.__webglColorBuffer=l.createBuffer();E.info.geometries++;var Va=k,eb=g,cb=Va.vertices.length;Va.__vertexArray=new Float32Array(3*cb);Va.__colorArray=new Float32Array(3*cb);Va.__sortArray=[];Va.__webglParticleCount=cb;b(Va,eb);k.__dirtyVertices=!0;k.__dirtyColors=!0}if(!g.__webglActive){if(g instanceof THREE.Mesh)if(k=
-g.geometry,k instanceof THREE.BufferGeometry)j(h.__webglObjects,k,g);else for(i in k.geometryGroups)n=k.geometryGroups[i],j(h.__webglObjects,n,g);else g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem?(k=g.geometry,j(h.__webglObjects,k,g)):void 0!==THREE.MarchingCubes&&g instanceof THREE.MarchingCubes||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof
-THREE.LensFlare&&h.__webglFlares.push(g);g.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var gb=a.__objectsRemoved[0],db=a;gb instanceof THREE.Mesh||gb instanceof THREE.ParticleSystem||gb instanceof THREE.Ribbon||gb instanceof THREE.Line?o(db.__webglObjects,gb):gb instanceof THREE.Sprite?q(db.__webglSprites,gb):gb instanceof THREE.LensFlare?q(db.__webglFlares,gb):(gb instanceof THREE.MarchingCubes||gb.immediateRenderCallback)&&o(db.__webglObjectsImmediate,gb);gb.__webglActive=
-!1;a.__objectsRemoved.splice(0,1)}for(var Vc=0,qd=a.__webglObjects.length;Vc<qd;Vc++){var nb=a.__webglObjects[Vc].object,ia=nb.geometry,qc=void 0,ic=void 0,Xa=void 0;if(nb instanceof THREE.Mesh)if(ia instanceof THREE.BufferGeometry)ia.__dirtyVertices=!1,ia.__dirtyElements=!1,ia.__dirtyUvs=!1,ia.__dirtyNormals=!1,ia.__dirtyColors=!1;else{for(var Wc=0,rd=ia.geometryGroupsList.length;Wc<rd;Wc++)if(qc=ia.geometryGroupsList[Wc],Xa=c(nb,qc),ic=Xa.attributes&&p(Xa),ia.__dirtyVertices||ia.__dirtyMorphTargets||
-ia.__dirtyElements||ia.__dirtyUvs||ia.__dirtyNormals||ia.__dirtyColors||ia.__dirtyTangents||ic){var ea=qc,sd=nb,Za=l.DYNAMIC_DRAW,td=!ia.dynamic,bc=Xa;if(ea.__inittedArrays){var fd=d(bc),Xc=bc.vertexColors?bc.vertexColors:!1,gd=e(bc),Fc=fd===THREE.SmoothShading,H=void 0,U=void 0,lb=void 0,M=void 0,jc=void 0,Ob=void 0,ob=void 0,Gc=void 0,Hb=void 0,kc=void 0,lc=void 0,V=void 0,W=void 0,X=void 0,pa=void 0,pb=void 0,qb=void 0,rb=void 0,rc=void 0,sb=void 0,tb=void 0,ub=void 0,sc=void 0,vb=void 0,wb=void 0,
-xb=void 0,tc=void 0,yb=void 0,zb=void 0,Ab=void 0,uc=void 0,Bb=void 0,Cb=void 0,Db=void 0,vc=void 0,Pb=void 0,Qb=void 0,Rb=void 0,Hc=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Ic=void 0,la=void 0,hd=void 0,Vb=void 0,mc=void 0,nc=void 0,La=void 0,id=void 0,Ja=void 0,Ka=void 0,Wb=void 0,Ib=void 0,Ca=0,Ha=0,Jb=0,Kb=0,hb=0,Ra=0,qa=0,Sa=0,Da=0,J=0,ba=0,A=0,$a=void 0,Ma=ea.__vertexArray,wc=ea.__uvArray,xc=ea.__uv2Array,ib=ea.__normalArray,ua=ea.__tangentArray,Na=ea.__colorArray,va=ea.__skinVertexAArray,wa=ea.__skinVertexBArray,
-xa=ea.__skinIndexArray,ya=ea.__skinWeightArray,Yc=ea.__morphTargetsArrays,Zc=ea.__morphNormalsArrays,$c=ea.__webglCustomAttributesList,x=void 0,Eb=ea.__faceArray,ab=ea.__lineArray,Ta=sd.geometry,ud=Ta.__dirtyElements,jd=Ta.__dirtyUvs,vd=Ta.__dirtyNormals,wd=Ta.__dirtyTangents,xd=Ta.__dirtyColors,yd=Ta.__dirtyMorphTargets,cc=Ta.vertices,ma=ea.faces3,na=ea.faces4,Ea=Ta.faces,ad=Ta.faceVertexUvs[0],bd=Ta.faceVertexUvs[1],dc=Ta.skinVerticesA,ec=Ta.skinVerticesB,fc=Ta.skinIndices,Xb=Ta.skinWeights,Yb=
-Ta.morphTargets,Jc=Ta.morphNormals;if(Ta.__dirtyVertices){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],V=cc[M.a].position,W=cc[M.b].position,X=cc[M.c].position,Ma[Ha]=V.x,Ma[Ha+1]=V.y,Ma[Ha+2]=V.z,Ma[Ha+3]=W.x,Ma[Ha+4]=W.y,Ma[Ha+5]=W.z,Ma[Ha+6]=X.x,Ma[Ha+7]=X.y,Ma[Ha+8]=X.z,Ha+=9;for(H=0,U=na.length;H<U;H++)M=Ea[na[H]],V=cc[M.a].position,W=cc[M.b].position,X=cc[M.c].position,pa=cc[M.d].position,Ma[Ha]=V.x,Ma[Ha+1]=V.y,Ma[Ha+2]=V.z,Ma[Ha+3]=W.x,Ma[Ha+4]=W.y,Ma[Ha+5]=W.z,Ma[Ha+6]=X.x,Ma[Ha+7]=X.y,Ma[Ha+
-8]=X.z,Ma[Ha+9]=pa.x,Ma[Ha+10]=pa.y,Ma[Ha+11]=pa.z,Ha+=12;l.bindBuffer(l.ARRAY_BUFFER,ea.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,Ma,Za)}if(yd)for(La=0,id=Yb.length;La<id;La++){ba=0;for(H=0,U=ma.length;H<U;H++){Wb=ma[H];M=Ea[Wb];V=Yb[La].vertices[M.a].position;W=Yb[La].vertices[M.b].position;X=Yb[La].vertices[M.c].position;Ja=Yc[La];Ja[ba]=V.x;Ja[ba+1]=V.y;Ja[ba+2]=V.z;Ja[ba+3]=W.x;Ja[ba+4]=W.y;Ja[ba+5]=W.z;Ja[ba+6]=X.x;Ja[ba+7]=X.y;Ja[ba+8]=X.z;if(bc.morphNormals)Fc?(Ib=Jc[La].vertexNormals[Wb],
-sb=Ib.a,tb=Ib.b,ub=Ib.c):ub=tb=sb=Jc[La].faceNormals[Wb],Ka=Zc[La],Ka[ba]=sb.x,Ka[ba+1]=sb.y,Ka[ba+2]=sb.z,Ka[ba+3]=tb.x,Ka[ba+4]=tb.y,Ka[ba+5]=tb.z,Ka[ba+6]=ub.x,Ka[ba+7]=ub.y,Ka[ba+8]=ub.z;ba+=9}for(H=0,U=na.length;H<U;H++){Wb=na[H];M=Ea[Wb];V=Yb[La].vertices[M.a].position;W=Yb[La].vertices[M.b].position;X=Yb[La].vertices[M.c].position;pa=Yb[La].vertices[M.d].position;Ja=Yc[La];Ja[ba]=V.x;Ja[ba+1]=V.y;Ja[ba+2]=V.z;Ja[ba+3]=W.x;Ja[ba+4]=W.y;Ja[ba+5]=W.z;Ja[ba+6]=X.x;Ja[ba+7]=X.y;Ja[ba+8]=X.z;Ja[ba+
-9]=pa.x;Ja[ba+10]=pa.y;Ja[ba+11]=pa.z;if(bc.morphNormals)Fc?(Ib=Jc[La].vertexNormals[Wb],sb=Ib.a,tb=Ib.b,ub=Ib.c,sc=Ib.d):sc=ub=tb=sb=Jc[La].faceNormals[Wb],Ka=Zc[La],Ka[ba]=sb.x,Ka[ba+1]=sb.y,Ka[ba+2]=sb.z,Ka[ba+3]=tb.x,Ka[ba+4]=tb.y,Ka[ba+5]=tb.z,Ka[ba+6]=ub.x,Ka[ba+7]=ub.y,Ka[ba+8]=ub.z,Ka[ba+9]=sc.x,Ka[ba+10]=sc.y,Ka[ba+11]=sc.z;ba+=12}l.bindBuffer(l.ARRAY_BUFFER,ea.__webglMorphTargetsBuffers[La]);l.bufferData(l.ARRAY_BUFFER,Yc[La],Za);bc.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,ea.__webglMorphNormalsBuffers[La]),
-l.bufferData(l.ARRAY_BUFFER,Zc[La],Za))}if(Xb.length){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],yb=Xb[M.a],zb=Xb[M.b],Ab=Xb[M.c],ya[J]=yb.x,ya[J+1]=yb.y,ya[J+2]=yb.z,ya[J+3]=yb.w,ya[J+4]=zb.x,ya[J+5]=zb.y,ya[J+6]=zb.z,ya[J+7]=zb.w,ya[J+8]=Ab.x,ya[J+9]=Ab.y,ya[J+10]=Ab.z,ya[J+11]=Ab.w,Bb=fc[M.a],Cb=fc[M.b],Db=fc[M.c],xa[J]=Bb.x,xa[J+1]=Bb.y,xa[J+2]=Bb.z,xa[J+3]=Bb.w,xa[J+4]=Cb.x,xa[J+5]=Cb.y,xa[J+6]=Cb.z,xa[J+7]=Cb.w,xa[J+8]=Db.x,xa[J+9]=Db.y,xa[J+10]=Db.z,xa[J+11]=Db.w,Pb=dc[M.a],Qb=dc[M.b],Rb=dc[M.c],
-va[J]=Pb.x,va[J+1]=Pb.y,va[J+2]=Pb.z,va[J+3]=1,va[J+4]=Qb.x,va[J+5]=Qb.y,va[J+6]=Qb.z,va[J+7]=1,va[J+8]=Rb.x,va[J+9]=Rb.y,va[J+10]=Rb.z,va[J+11]=1,Sb=ec[M.a],Tb=ec[M.b],Ub=ec[M.c],wa[J]=Sb.x,wa[J+1]=Sb.y,wa[J+2]=Sb.z,wa[J+3]=1,wa[J+4]=Tb.x,wa[J+5]=Tb.y,wa[J+6]=Tb.z,wa[J+7]=1,wa[J+8]=Ub.x,wa[J+9]=Ub.y,wa[J+10]=Ub.z,wa[J+11]=1,J+=12;for(H=0,U=na.length;H<U;H++)M=Ea[na[H]],yb=Xb[M.a],zb=Xb[M.b],Ab=Xb[M.c],uc=Xb[M.d],ya[J]=yb.x,ya[J+1]=yb.y,ya[J+2]=yb.z,ya[J+3]=yb.w,ya[J+4]=zb.x,ya[J+5]=zb.y,ya[J+6]=
-zb.z,ya[J+7]=zb.w,ya[J+8]=Ab.x,ya[J+9]=Ab.y,ya[J+10]=Ab.z,ya[J+11]=Ab.w,ya[J+12]=uc.x,ya[J+13]=uc.y,ya[J+14]=uc.z,ya[J+15]=uc.w,Bb=fc[M.a],Cb=fc[M.b],Db=fc[M.c],vc=fc[M.d],xa[J]=Bb.x,xa[J+1]=Bb.y,xa[J+2]=Bb.z,xa[J+3]=Bb.w,xa[J+4]=Cb.x,xa[J+5]=Cb.y,xa[J+6]=Cb.z,xa[J+7]=Cb.w,xa[J+8]=Db.x,xa[J+9]=Db.y,xa[J+10]=Db.z,xa[J+11]=Db.w,xa[J+12]=vc.x,xa[J+13]=vc.y,xa[J+14]=vc.z,xa[J+15]=vc.w,Pb=dc[M.a],Qb=dc[M.b],Rb=dc[M.c],Hc=dc[M.d],va[J]=Pb.x,va[J+1]=Pb.y,va[J+2]=Pb.z,va[J+3]=1,va[J+4]=Qb.x,va[J+5]=Qb.y,
-va[J+6]=Qb.z,va[J+7]=1,va[J+8]=Rb.x,va[J+9]=Rb.y,va[J+10]=Rb.z,va[J+11]=1,va[J+12]=Hc.x,va[J+13]=Hc.y,va[J+14]=Hc.z,va[J+15]=1,Sb=ec[M.a],Tb=ec[M.b],Ub=ec[M.c],Ic=ec[M.d],wa[J]=Sb.x,wa[J+1]=Sb.y,wa[J+2]=Sb.z,wa[J+3]=1,wa[J+4]=Tb.x,wa[J+5]=Tb.y,wa[J+6]=Tb.z,wa[J+7]=1,wa[J+8]=Ub.x,wa[J+9]=Ub.y,wa[J+10]=Ub.z,wa[J+11]=1,wa[J+12]=Ic.x,wa[J+13]=Ic.y,wa[J+14]=Ic.z,wa[J+15]=1,J+=16;0<J&&(l.bindBuffer(l.ARRAY_BUFFER,ea.__webglSkinVertexABuffer),l.bufferData(l.ARRAY_BUFFER,va,Za),l.bindBuffer(l.ARRAY_BUFFER,
-ea.__webglSkinVertexBBuffer),l.bufferData(l.ARRAY_BUFFER,wa,Za),l.bindBuffer(l.ARRAY_BUFFER,ea.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,xa,Za),l.bindBuffer(l.ARRAY_BUFFER,ea.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,ya,Za))}if(xd&&Xc){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],ob=M.vertexColors,Gc=M.color,3===ob.length&&Xc===THREE.VertexColors?(vb=ob[0],wb=ob[1],xb=ob[2]):xb=wb=vb=Gc,Na[Da]=vb.r,Na[Da+1]=vb.g,Na[Da+2]=vb.b,Na[Da+3]=wb.r,Na[Da+4]=wb.g,Na[Da+5]=wb.b,Na[Da+6]=xb.r,
-Na[Da+7]=xb.g,Na[Da+8]=xb.b,Da+=9;for(H=0,U=na.length;H<U;H++)M=Ea[na[H]],ob=M.vertexColors,Gc=M.color,4===ob.length&&Xc===THREE.VertexColors?(vb=ob[0],wb=ob[1],xb=ob[2],tc=ob[3]):tc=xb=wb=vb=Gc,Na[Da]=vb.r,Na[Da+1]=vb.g,Na[Da+2]=vb.b,Na[Da+3]=wb.r,Na[Da+4]=wb.g,Na[Da+5]=wb.b,Na[Da+6]=xb.r,Na[Da+7]=xb.g,Na[Da+8]=xb.b,Na[Da+9]=tc.r,Na[Da+10]=tc.g,Na[Da+11]=tc.b,Da+=12;0<Da&&(l.bindBuffer(l.ARRAY_BUFFER,ea.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,Na,Za))}if(wd&&Ta.hasTangents){for(H=0,U=ma.length;H<
-U;H++)M=Ea[ma[H]],Hb=M.vertexTangents,pb=Hb[0],qb=Hb[1],rb=Hb[2],ua[qa]=pb.x,ua[qa+1]=pb.y,ua[qa+2]=pb.z,ua[qa+3]=pb.w,ua[qa+4]=qb.x,ua[qa+5]=qb.y,ua[qa+6]=qb.z,ua[qa+7]=qb.w,ua[qa+8]=rb.x,ua[qa+9]=rb.y,ua[qa+10]=rb.z,ua[qa+11]=rb.w,qa+=12;for(H=0,U=na.length;H<U;H++)M=Ea[na[H]],Hb=M.vertexTangents,pb=Hb[0],qb=Hb[1],rb=Hb[2],rc=Hb[3],ua[qa]=pb.x,ua[qa+1]=pb.y,ua[qa+2]=pb.z,ua[qa+3]=pb.w,ua[qa+4]=qb.x,ua[qa+5]=qb.y,ua[qa+6]=qb.z,ua[qa+7]=qb.w,ua[qa+8]=rb.x,ua[qa+9]=rb.y,ua[qa+10]=rb.z,ua[qa+11]=rb.w,
-ua[qa+12]=rc.x,ua[qa+13]=rc.y,ua[qa+14]=rc.z,ua[qa+15]=rc.w,qa+=16;l.bindBuffer(l.ARRAY_BUFFER,ea.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,ua,Za)}if(vd&&fd){for(H=0,U=ma.length;H<U;H++)if(M=Ea[ma[H]],jc=M.vertexNormals,Ob=M.normal,3===jc.length&&Fc)for(la=0;3>la;la++)Vb=jc[la],ib[Ra]=Vb.x,ib[Ra+1]=Vb.y,ib[Ra+2]=Vb.z,Ra+=3;else for(la=0;3>la;la++)ib[Ra]=Ob.x,ib[Ra+1]=Ob.y,ib[Ra+2]=Ob.z,Ra+=3;for(H=0,U=na.length;H<U;H++)if(M=Ea[na[H]],jc=M.vertexNormals,Ob=M.normal,4===jc.length&&Fc)for(la=
-0;4>la;la++)Vb=jc[la],ib[Ra]=Vb.x,ib[Ra+1]=Vb.y,ib[Ra+2]=Vb.z,Ra+=3;else for(la=0;4>la;la++)ib[Ra]=Ob.x,ib[Ra+1]=Ob.y,ib[Ra+2]=Ob.z,Ra+=3;l.bindBuffer(l.ARRAY_BUFFER,ea.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,ib,Za)}if(jd&&ad&&gd){for(H=0,U=ma.length;H<U;H++)if(lb=ma[H],M=Ea[lb],kc=ad[lb],void 0!==kc)for(la=0;3>la;la++)mc=kc[la],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=2;for(H=0,U=na.length;H<U;H++)if(lb=na[H],M=Ea[lb],kc=ad[lb],void 0!==kc)for(la=0;4>la;la++)mc=kc[la],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=
-2;0<Jb&&(l.bindBuffer(l.ARRAY_BUFFER,ea.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,wc,Za))}if(jd&&bd&&gd){for(H=0,U=ma.length;H<U;H++)if(lb=ma[H],M=Ea[lb],lc=bd[lb],void 0!==lc)for(la=0;3>la;la++)nc=lc[la],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;for(H=0,U=na.length;H<U;H++)if(lb=na[H],M=Ea[lb],lc=bd[lb],void 0!==lc)for(la=0;4>la;la++)nc=lc[la],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;0<Kb&&(l.bindBuffer(l.ARRAY_BUFFER,ea.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,xc,Za))}if(ud){for(H=0,U=ma.length;H<U;H++)M=
-Ea[ma[H]],Eb[hb]=Ca,Eb[hb+1]=Ca+1,Eb[hb+2]=Ca+2,hb+=3,ab[Sa]=Ca,ab[Sa+1]=Ca+1,ab[Sa+2]=Ca,ab[Sa+3]=Ca+2,ab[Sa+4]=Ca+1,ab[Sa+5]=Ca+2,Sa+=6,Ca+=3;for(H=0,U=na.length;H<U;H++)M=Ea[na[H]],Eb[hb]=Ca,Eb[hb+1]=Ca+1,Eb[hb+2]=Ca+3,Eb[hb+3]=Ca+1,Eb[hb+4]=Ca+2,Eb[hb+5]=Ca+3,hb+=6,ab[Sa]=Ca,ab[Sa+1]=Ca+1,ab[Sa+2]=Ca,ab[Sa+3]=Ca+3,ab[Sa+4]=Ca+1,ab[Sa+5]=Ca+2,ab[Sa+6]=Ca+2,ab[Sa+7]=Ca+3,Sa+=8,Ca+=4;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,ea.__webglFaceBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,Eb,Za);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,
-ea.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,ab,Za)}if($c)for(la=0,hd=$c.length;la<hd;la++)if(x=$c[la],x.__original.needsUpdate){A=0;if(1===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],x.array[A]=x.value[M.a],x.array[A+1]=x.value[M.b],x.array[A+2]=x.value[M.c],A+=3;for(H=0,U=na.length;H<U;H++)M=Ea[na[H]],x.array[A]=x.value[M.a],x.array[A+1]=x.value[M.b],x.array[A+2]=x.value[M.c],x.array[A+3]=x.value[M.d],A+=4}else{if("faces"===x.boundTo){for(H=
-0,U=ma.length;H<U;H++)$a=x.value[ma[H]],x.array[A]=$a,x.array[A+1]=$a,x.array[A+2]=$a,A+=3;for(H=0,U=na.length;H<U;H++)$a=x.value[na[H]],x.array[A]=$a,x.array[A+1]=$a,x.array[A+2]=$a,x.array[A+3]=$a,A+=4}}else if(2===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],V=x.value[M.a],W=x.value[M.b],X=x.value[M.c],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=W.x,x.array[A+3]=W.y,x.array[A+4]=X.x,x.array[A+5]=X.y,A+=6;for(H=0,U=na.length;H<U;H++)M=Ea[na[H]],
-V=x.value[M.a],W=x.value[M.b],X=x.value[M.c],pa=x.value[M.d],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=W.x,x.array[A+3]=W.y,x.array[A+4]=X.x,x.array[A+5]=X.y,x.array[A+6]=pa.x,x.array[A+7]=pa.y,A+=8}else{if("faces"===x.boundTo){for(H=0,U=ma.length;H<U;H++)X=W=V=$a=x.value[ma[H]],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=W.x,x.array[A+3]=W.y,x.array[A+4]=X.x,x.array[A+5]=X.y,A+=6;for(H=0,U=na.length;H<U;H++)pa=X=W=V=$a=x.value[na[H]],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=W.x,x.array[A+
-3]=W.y,x.array[A+4]=X.x,x.array[A+5]=X.y,x.array[A+6]=pa.x,x.array[A+7]=pa.y,A+=8}}else if(3===x.size){var ga;ga="c"===x.type?["r","g","b"]:["x","y","z"];if(void 0===x.boundTo||"vertices"===x.boundTo){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],V=x.value[M.a],W=x.value[M.b],X=x.value[M.c],x.array[A]=V[ga[0]],x.array[A+1]=V[ga[1]],x.array[A+2]=V[ga[2]],x.array[A+3]=W[ga[0]],x.array[A+4]=W[ga[1]],x.array[A+5]=W[ga[2]],x.array[A+6]=X[ga[0]],x.array[A+7]=X[ga[1]],x.array[A+8]=X[ga[2]],A+=9;for(H=0,U=na.length;H<
-U;H++)M=Ea[na[H]],V=x.value[M.a],W=x.value[M.b],X=x.value[M.c],pa=x.value[M.d],x.array[A]=V[ga[0]],x.array[A+1]=V[ga[1]],x.array[A+2]=V[ga[2]],x.array[A+3]=W[ga[0]],x.array[A+4]=W[ga[1]],x.array[A+5]=W[ga[2]],x.array[A+6]=X[ga[0]],x.array[A+7]=X[ga[1]],x.array[A+8]=X[ga[2]],x.array[A+9]=pa[ga[0]],x.array[A+10]=pa[ga[1]],x.array[A+11]=pa[ga[2]],A+=12}else if("faces"===x.boundTo){for(H=0,U=ma.length;H<U;H++)X=W=V=$a=x.value[ma[H]],x.array[A]=V[ga[0]],x.array[A+1]=V[ga[1]],x.array[A+2]=V[ga[2]],x.array[A+
-3]=W[ga[0]],x.array[A+4]=W[ga[1]],x.array[A+5]=W[ga[2]],x.array[A+6]=X[ga[0]],x.array[A+7]=X[ga[1]],x.array[A+8]=X[ga[2]],A+=9;for(H=0,U=na.length;H<U;H++)pa=X=W=V=$a=x.value[na[H]],x.array[A]=V[ga[0]],x.array[A+1]=V[ga[1]],x.array[A+2]=V[ga[2]],x.array[A+3]=W[ga[0]],x.array[A+4]=W[ga[1]],x.array[A+5]=W[ga[2]],x.array[A+6]=X[ga[0]],x.array[A+7]=X[ga[1]],x.array[A+8]=X[ga[2]],x.array[A+9]=pa[ga[0]],x.array[A+10]=pa[ga[1]],x.array[A+11]=pa[ga[2]],A+=12}}else if(4===x.size)if(void 0===x.boundTo||"vertices"===
-x.boundTo){for(H=0,U=ma.length;H<U;H++)M=Ea[ma[H]],V=x.value[M.a],W=x.value[M.b],X=x.value[M.c],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=V.z,x.array[A+3]=V.w,x.array[A+4]=W.x,x.array[A+5]=W.y,x.array[A+6]=W.z,x.array[A+7]=W.w,x.array[A+8]=X.x,x.array[A+9]=X.y,x.array[A+10]=X.z,x.array[A+11]=X.w,A+=12;for(H=0,U=na.length;H<U;H++)M=Ea[na[H]],V=x.value[M.a],W=x.value[M.b],X=x.value[M.c],pa=x.value[M.d],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=V.z,x.array[A+3]=V.w,x.array[A+4]=W.x,x.array[A+5]=
-W.y,x.array[A+6]=W.z,x.array[A+7]=W.w,x.array[A+8]=X.x,x.array[A+9]=X.y,x.array[A+10]=X.z,x.array[A+11]=X.w,x.array[A+12]=pa.x,x.array[A+13]=pa.y,x.array[A+14]=pa.z,x.array[A+15]=pa.w,A+=16}else if("faces"===x.boundTo){for(H=0,U=ma.length;H<U;H++)X=W=V=$a=x.value[ma[H]],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=V.z,x.array[A+3]=V.w,x.array[A+4]=W.x,x.array[A+5]=W.y,x.array[A+6]=W.z,x.array[A+7]=W.w,x.array[A+8]=X.x,x.array[A+9]=X.y,x.array[A+10]=X.z,x.array[A+11]=X.w,A+=12;for(H=0,U=na.length;H<
-U;H++)pa=X=W=V=$a=x.value[na[H]],x.array[A]=V.x,x.array[A+1]=V.y,x.array[A+2]=V.z,x.array[A+3]=V.w,x.array[A+4]=W.x,x.array[A+5]=W.y,x.array[A+6]=W.z,x.array[A+7]=W.w,x.array[A+8]=X.x,x.array[A+9]=X.y,x.array[A+10]=X.z,x.array[A+11]=X.w,x.array[A+12]=pa.x,x.array[A+13]=pa.y,x.array[A+14]=pa.z,x.array[A+15]=pa.w,A+=16}l.bindBuffer(l.ARRAY_BUFFER,x.buffer);l.bufferData(l.ARRAY_BUFFER,x.array,Za)}td&&(delete ea.__inittedArrays,delete ea.__colorArray,delete ea.__normalArray,delete ea.__tangentArray,delete ea.__uvArray,
-delete ea.__uv2Array,delete ea.__faceArray,delete ea.__vertexArray,delete ea.__lineArray,delete ea.__skinVertexAArray,delete ea.__skinVertexBArray,delete ea.__skinIndexArray,delete ea.__skinWeightArray)}}ia.__dirtyVertices=!1;ia.__dirtyMorphTargets=!1;ia.__dirtyElements=!1;ia.__dirtyUvs=!1;ia.__dirtyNormals=!1;ia.__dirtyColors=!1;ia.__dirtyTangents=!1;Xa.attributes&&m(Xa)}else if(nb instanceof THREE.Ribbon){if(ia.__dirtyVertices||ia.__dirtyColors){var Zb=ia,kd=l.DYNAMIC_DRAW,yc=void 0,zc=void 0,Kc=
-void 0,$b=void 0,Lc=void 0,ld=Zb.vertices,md=Zb.colors,zd=ld.length,Ad=md.length,Mc=Zb.__vertexArray,Nc=Zb.__colorArray,Bd=Zb.__dirtyColors;if(Zb.__dirtyVertices){for(yc=0;yc<zd;yc++)Kc=ld[yc].position,$b=3*yc,Mc[$b]=Kc.x,Mc[$b+1]=Kc.y,Mc[$b+2]=Kc.z;l.bindBuffer(l.ARRAY_BUFFER,Zb.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,Mc,kd)}if(Bd){for(zc=0;zc<Ad;zc++)Lc=md[zc],$b=3*zc,Nc[$b]=Lc.r,Nc[$b+1]=Lc.g,Nc[$b+2]=Lc.b;l.bindBuffer(l.ARRAY_BUFFER,Zb.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,
-Nc,kd)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1}else if(nb instanceof THREE.Line){Xa=c(nb,qc);ic=Xa.attributes&&p(Xa);if(ia.__dirtyVertices||ia.__dirtyColors||ic){var Lb=ia,cd=l.DYNAMIC_DRAW,Ac=void 0,Bc=void 0,Oc=void 0,za=void 0,Pc=void 0,nd=Lb.vertices,od=Lb.colors,Cd=nd.length,Dd=od.length,Qc=Lb.__vertexArray,Rc=Lb.__colorArray,Ed=Lb.__dirtyColors,dd=Lb.__webglCustomAttributesList,Sc=void 0,pd=void 0,Qa=void 0,oc=void 0,Ya=void 0,ta=void 0;if(Lb.__dirtyVertices){for(Ac=0;Ac<Cd;Ac++)Oc=nd[Ac].position,
-za=3*Ac,Qc[za]=Oc.x,Qc[za+1]=Oc.y,Qc[za+2]=Oc.z;l.bindBuffer(l.ARRAY_BUFFER,Lb.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,Qc,cd)}if(Ed){for(Bc=0;Bc<Dd;Bc++)Pc=od[Bc],za=3*Bc,Rc[za]=Pc.r,Rc[za+1]=Pc.g,Rc[za+2]=Pc.b;l.bindBuffer(l.ARRAY_BUFFER,Lb.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,Rc,cd)}if(dd)for(Sc=0,pd=dd.length;Sc<pd;Sc++)if(ta=dd[Sc],ta.needsUpdate&&(void 0===ta.boundTo||"vertices"===ta.boundTo)){za=0;oc=ta.value.length;if(1===ta.size)for(Qa=0;Qa<oc;Qa++)ta.array[Qa]=ta.value[Qa];
-else if(2===ta.size)for(Qa=0;Qa<oc;Qa++)Ya=ta.value[Qa],ta.array[za]=Ya.x,ta.array[za+1]=Ya.y,za+=2;else if(3===ta.size)if("c"===ta.type)for(Qa=0;Qa<oc;Qa++)Ya=ta.value[Qa],ta.array[za]=Ya.r,ta.array[za+1]=Ya.g,ta.array[za+2]=Ya.b,za+=3;else for(Qa=0;Qa<oc;Qa++)Ya=ta.value[Qa],ta.array[za]=Ya.x,ta.array[za+1]=Ya.y,ta.array[za+2]=Ya.z,za+=3;else if(4===ta.size)for(Qa=0;Qa<oc;Qa++)Ya=ta.value[Qa],ta.array[za]=Ya.x,ta.array[za+1]=Ya.y,ta.array[za+2]=Ya.z,ta.array[za+3]=Ya.w,za+=4;l.bindBuffer(l.ARRAY_BUFFER,
-ta.buffer);l.bufferData(l.ARRAY_BUFFER,ta.array,cd)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1;Xa.attributes&&m(Xa)}else if(nb instanceof THREE.ParticleSystem)Xa=c(nb,qc),ic=Xa.attributes&&p(Xa),(ia.__dirtyVertices||ia.__dirtyColors||nb.sortParticles||ic)&&f(ia,l.DYNAMIC_DRAW,nb),ia.__dirtyVertices=!1,ia.__dirtyColors=!1,Xa.attributes&&m(Xa)}};this.initMaterial=function(a,b,c,d){var e,f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof
-THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var k=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var j,n;f=k=0;for(j=0,n=b.length;j<n;j++)e=b[j],e.onlyShadow||(e instanceof THREE.DirectionalLight&&f++,e instanceof
-THREE.PointLight&&k++,e instanceof THREE.SpotLight&&k++);k+f<=N?j=f:(j=Math.ceil(N*f/(k+f)),k=N-j);e=j;f=k;var m=0;for(k=0,j=b.length;k<j;k++)n=b[k],n.castShadow&&(n instanceof THREE.SpotLight&&m++,n instanceof THREE.DirectionalLight&&!n.shadowCascade&&m++);var o=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)o=d.bones.length;var p;a:{j=a.fragmentShader;n=a.vertexShader;var k=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
-sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},
-q,d=[];i?d.push(i):(d.push(j),d.push(n));for(q in c)d.push(q),d.push(c[q]);i=d.join();for(q=0,d=Y.length;q<d;q++)if(Y[q].code===i){p=Y[q].program;break a}q=l.createProgram();d=["precision "+C+" float;",0<Oa?"#define VERTEX_TEXTURES":"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+
+var m=a.colors,i=m.length,l=a.__vertexArray,k=a.__colorArray,n=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,q=a.__webglCustomAttributesList;if(c.sortParticles){db.copy(eb);db.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,Ga.copy(e),db.multiplyVector3(Ga),n[d]=[Ga.z,d];n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[n[d][1]].position,f=3*d,l[f]=e.x,l[f+1]=e.y,l[f+2]=e.z;for(d=0;d<i;d++)f=3*d,e=m[n[d][1]],k[f]=e.r,k[f+1]=e.g,k[f+2]=e.b;if(q)for(m=0,i=q.length;m<i;m++)if(h=
+q[m],void 0===h.boundTo||"vertices"===h.boundTo)if(f=0,e=h.value.length,1===h.size)for(d=0;d<e;d++)g=n[d][1],h.array[d]=h.value[g];else if(2===h.size)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<e;d++)g=n[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=n[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(4===h.size)for(d=0;d<e;d++)g=n[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=3*d,l[f]=e.x,l[f+1]=e.y,l[f+2]=e.z;if(p)for(d=0;d<i;d++)e=m[d],f=3*d,k[f]=e.r,k[f+1]=e.g,k[f+2]=e.b;if(q)for(m=0,i=q.length;m<i;m++)if(h=q[m],h.needsUpdate&&(void 0===h.boundTo||"vertices"===h.boundTo))if(e=h.value.length,f=0,1===h.size)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(2===h.size)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(3===h.size)if("c"===
+h.type)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(4===h.size)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)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,
+k,b);if(q)for(m=0,i=q.length;m<i;m++)if(h=q[m],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}function g(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)fa=F=null,U=P=ba=S=aa=-1,a[d].render(b,c,jb,Va),fa=F=null,U=P=ba=S=aa=-1}function i(a,b,c,d,e,f,g,h){var j,m,i,l;b?(m=a.length-1,l=b=-1):(m=0,b=a.length,l=1);for(var k=m;k!==b;k+=l)if(j=a[k],j.render){m=j.object;i=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;
+g&&E.setBlending(j.blending);E.setDepthTest(j.depthTest);E.setDepthWrite(j.depthWrite);s(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}E.setObjectFaces(m);i instanceof THREE.BufferGeometry?E.renderBufferDirect(d,e,f,j,i,m):E.renderBuffer(d,e,f,j,i,m)}}function l(a,b,c,d,e,f,g){for(var h,j,m=0,i=a.length;m<i;m++)if(h=a[m],j=h.object,j.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&E.setBlending(h.blending);E.setDepthTest(h.depthTest);E.setDepthWrite(h.depthWrite);s(h.polygonOffset,h.polygonOffsetFactor,
+h.polygonOffsetUnits)}E.renderImmediateObject(c,d,e,h,j)}}function k(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function n(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function o(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function m(a,b,c,d,e){if(!d.program||d.needsUpdate)E.initMaterial(d,
+b,c,e),d.needsUpdate=!1;if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets);for(var f=0,g=E.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,m=d.uniforms;f!==F&&(j.useProgram(f),F=f,h=!0);if(d.id!==U)U=d.id,h=!0;if(h||a!==fa)j.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray),a!==fa&&(fa=a);if(h){if(c&&d.fog)if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=
+c.near,m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var i,k=0,l=0,n=0,o,p,q,r=Ba,s=r.directional.colors,y=r.directional.positions,t=r.point.colors,u=r.point.positions,w=r.point.distances,P=0,C=0,D=q=0;for(c=0,h=b.length;c<h;c++)if(i=b[c],!i.onlyShadow)if(o=i.color,p=i.intensity,q=i.distance,i instanceof THREE.AmbientLight)E.gammaInput?(k+=o.r*o.r,l+=o.g*o.g,n+=o.b*o.b):
+(k+=o.r,l+=o.g,n+=o.b);else if(i instanceof THREE.DirectionalLight)q=3*P,E.gammaInput?(s[q]=o.r*o.r*p*p,s[q+1]=o.g*o.g*p*p,s[q+2]=o.b*o.b*p*p):(s[q]=o.r*p,s[q+1]=o.g*p,s[q+2]=o.b*p),ra.copy(i.matrixWorld.getPosition()),ra.subSelf(i.target.matrixWorld.getPosition()),ra.normalize(),y[q]=ra.x,y[q+1]=ra.y,y[q+2]=ra.z,P+=1;else if(i instanceof THREE.PointLight||i instanceof THREE.SpotLight)D=3*C,E.gammaInput?(t[D]=o.r*o.r*p*p,t[D+1]=o.g*o.g*p*p,t[D+2]=o.b*o.b*p*p):(t[D]=o.r*p,t[D+1]=o.g*p,t[D+2]=o.b*p),
+i=i.matrixWorld.getPosition(),u[D]=i.x,u[D+1]=i.y,u[D+2]=i.z,w[C]=q,C+=1;for(c=3*P,h=s.length;c<h;c++)s[c]=0;for(c=3*C,h=t.length;c<h;c++)t[c]=0;r.point.length=C;r.directional.length=P;r.ambient[0]=k;r.ambient[1]=l;r.ambient[2]=n;c=Ba;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=c.point.distances}if(d instanceof
+THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)m.opacity.value=d.opacity,E.gammaInput?m.diffuse.value.copyGammaToLinear(d.color):m.diffuse.value=d.color,(m.map.texture=d.map)&&m.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),m.lightMap.texture=d.lightMap,m.envMap.texture=d.envMap,m.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,m.reflectivity.value=d.reflectivity,m.refractionRatio.value=
+d.refractionRatio,m.combine.value=d.combine,m.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)m.diffuse.value=d.color,m.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)m.psColor.value=d.color,m.opacity.value=d.opacity,m.size.value=d.size,m.scale.value=B.height/2,m.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)m.shininess.value=d.shininess,E.gammaInput?(m.ambient.value.copyGammaToLinear(d.ambient),
+m.emissive.value.copyGammaToLinear(d.emissive),m.specular.value.copyGammaToLinear(d.specular)):(m.ambient.value=d.ambient,m.emissive.value=d.emissive,m.specular.value=d.specular),d.wrapAround&&m.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)E.gammaInput?(m.ambient.value.copyGammaToLinear(d.ambient),m.emissive.value.copyGammaToLinear(d.emissive)):(m.ambient.value=d.ambient,m.emissive.value=d.emissive),d.wrapAround&&m.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof
+THREE.MeshDepthMaterial)m.mNear.value=a.near,m.mFar.value=a.far,m.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)m.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&m.shadowMatrix){h=c=0;for(k=b.length;h<k;h++)if(l=b[h],l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight&&!l.shadowCascade))m.shadowMap.texture[c]=l.shadowMap,m.shadowMapSize.value[c]=l.shadowMapSize,m.shadowMatrix.value[c]=l.shadowMatrix,m.shadowDarkness.value[c]=l.shadowDarkness,
+m.shadowBias.value[c]=l.shadowBias,c++}b=d.uniformsList;for(m=0,c=b.length;m<c;m++)if(l=f.uniforms[b[m][1]])if(h=b[m][0],n=h.type,k=h.value,"i"===n)j.uniform1i(l,k);else if("f"===n)j.uniform1f(l,k);else if("v2"===n)j.uniform2f(l,k.x,k.y);else if("v3"===n)j.uniform3f(l,k.x,k.y,k.z);else if("v4"===n)j.uniform4f(l,k.x,k.y,k.z,k.w);else if("c"===n)j.uniform3f(l,k.r,k.g,k.b);else if("fv1"===n)j.uniform1fv(l,k);else if("fv"===n)j.uniform3fv(l,k);else if("v2v"===n){if(!h._array)h._array=new Float32Array(2*
+k.length);for(n=0,r=k.length;n<r;n++)s=2*n,h._array[s]=k[n].x,h._array[s+1]=k[n].y;j.uniform2fv(l,h._array)}else if("v3v"===n){if(!h._array)h._array=new Float32Array(3*k.length);for(n=0,r=k.length;n<r;n++)s=3*n,h._array[s]=k[n].x,h._array[s+1]=k[n].y,h._array[s+2]=k[n].z;j.uniform3fv(l,h._array)}else if("v4v"==n){if(!h._array)h._array=new Float32Array(4*k.length);for(n=0,r=k.length;n<r;n++)s=4*n,h._array[s]=k[n].x,h._array[s+1]=k[n].y,h._array[s+2]=k[n].z,h._array[s+3]=k[n].w;j.uniform4fv(l,h._array)}else if("m4"===
+n){if(!h._array)h._array=new Float32Array(16);k.flattenToArray(h._array);j.uniformMatrix4fv(l,!1,h._array)}else if("m4v"===n){if(!h._array)h._array=new Float32Array(16*k.length);for(n=0,r=k.length;n<r;n++)k[n].flattenToArrayOffset(h._array,16*n);j.uniformMatrix4fv(l,!1,h._array)}else if("t"===n){if(j.uniform1i(l,k),l=h.texture)if(l.image instanceof Array&&6===l.image.length){if(h=l,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+
+k);j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);k=[];for(l=0;6>l;l++){n=k;r=l;if(E.autoScaleCubemaps){if(s=h.image[l],t=sa,!(s.width<=t&&s.height<=t))u=Math.max(s.width,s.height),y=Math.floor(s.width*t/u),t=Math.floor(s.height*t/u),u=document.createElement("canvas"),u.width=y,u.height=t,u.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,y,t),s=u}else s=h.image[l];n[r]=s}l=k[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);r=z(h.format);s=z(h.type);v(j.TEXTURE_CUBE_MAP,
+h,n);for(l=0;6>l;l++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,r,r,s,k[l]);h.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdate)h.onUpdate()}else j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else l instanceof THREE.WebGLRenderTargetCube?(h=l,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,h.__webglTexture)):E.setTexture(l,k)}else if("tv"===n){if(!h._array){h._array=[];for(n=0,r=h.texture.length;n<
+r;n++)h._array[n]=k+n}j.uniform1iv(l,h._array);for(n=0,r=h.texture.length;n<r;n++)(l=h.texture[n])&&E.setTexture(l,h._array[n])}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==g.cameraPosition)b=a.matrixWorld.getPosition(),j.uniform3f(g.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&j.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);
+d.skinning&&j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices)}j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&null!==g.objectMatrix&&j.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function r(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);
+c&&c.transposeIntoArray(a._normalMatrixArray)}function s(a,b,c){da!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),da=a);if(a&&(Ua!==b||Ia!==c))j.polygonOffset(b,c),Ua=b,Ia=c}function u(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(b),null):c}function v(a,b,c){c?(j.texParameteri(a,
+j.TEXTURE_WRAP_S,z(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,z(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,z(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,z(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,w(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,w(b.minFilter)))}function t(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,
+j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function w(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;
+default:return j.LINEAR}}function z(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;
+case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedIntType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}
+var a=a||{},B=void 0!==a.canvas?a.canvas:document.createElement("canvas"),I=void 0!==a.precision?a.precision:"highp",C=void 0!==a.alpha?a.alpha:!0,H=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,K=void 0!==a.antialias?a.antialias:!1,O=void 0!==a.stencil?a.stencil:!0,Q=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,L=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),D=void 0!==a.clearAlpha?a.clearAlpha:0,N=void 0!==a.maxLights?a.maxLights:4;this.domElement=
+B;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info=
+{memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var E=this,j,Z=[],F=null,y=null,U=-1,P=null,fa=null,ja=0,ha=null,R=null,aa=null,S=null,ba=null,da=null,Ua=null,Ia=null,oa=null,Fa=0,Aa=0,ka=0,bb=0,jb=0,Va=0,cb=new THREE.Frustum,eb=new THREE.Matrix4,db=new THREE.Matrix4,Ga=new THREE.Vector4,ra=new THREE.Vector3,Ba={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};j=function(){var a;try{if(!(a=
+B.getContext("experimental-webgl",{alpha:C,premultipliedAlpha:H,antialias:K,stencil:O,preserveDrawingBuffer:Q})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);
+j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(L.r,L.g,L.b,D);this.context=j;var Oa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var sa=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=function(){return 0<Oa};this.setSize=function(a,b){B.width=a;B.height=b;this.setViewport(0,0,B.width,B.height)};this.setViewport=function(a,
+b,c,d){Fa=a;Aa=b;ka=c;bb=d;j.viewport(Fa,Aa,ka,bb)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){L.setHex(a);D=b;j.clearColor(L.r,L.g,L.b,D)};this.setClearColor=function(a,b){L.copy(a);D=b;j.clearColor(L.r,L.g,L.b,D)};this.getClearColor=function(){return L};this.getClearAlpha=function(){return D};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;
+if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,
+a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);
+j.deleteBuffer(c.__webglLineBuffer);var d=void 0,e=void 0;if(c.numMorphTargets)for(d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.numMorphNormals)for(d=0,e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);E.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),
+j.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),E.info.memory.textures--};this.deallocateRenderTarget=
+function(a){if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);else j.deleteFramebuffer(a.__webglFramebuffer),j.deleteRenderbuffer(a.__webglRenderbuffer)};this.updateShadowMap=function(a,b){F=null;U=P=ba=S=aa=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();
+if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,m,i,l,k,n,o=3*a.count;for(n=0;n<o;n+=9)c=a.normalArray,d=c[n],e=c[n+1],f=c[n+2],g=c[n+3],m=c[n+
+4],l=c[n+5],h=c[n+6],i=c[n+7],k=c[n+8],d=(d+g+h)/3,e=(e+m+i)/3,f=(f+l+k)/3,c[n]=d,c[n+1]=e,c[n+2]=f,c[n+3]=d,c[n+4]=e,c[n+5]=f,c[n+6]=d,c[n+7]=e,c[n+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(0!==d.opacity&&(c=m(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?
+1:0),d!==P&&(P=d,b=!0),f instanceof THREE.Mesh)){f=e.offsets;d=0;for(c=f.length;d<c;++d)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexPositionBuffer),j.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,j.FLOAT,!1,0,12*f[d].index),0<=a.normal&&e.vertexNormalBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexNormalBuffer),j.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,j.FLOAT,!1,0,12*f[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.vertexUvBuffer),
+j.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,j.FLOAT,!1,0,8*f[d].index),j.enableVertexAttribArray(a.uv)):j.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexColorBuffer),j.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,j.FLOAT,!1,0,16*f[d].index)),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),j.drawElements(j.TRIANGLES,f[d].count,j.UNSIGNED_SHORT,2*f[d].start),E.info.render.calls++,E.info.render.vertices+=f[d].count,
+E.info.render.faces+=f[d].count/3}};this.renderBuffer=function(a,b,c,d,e,f){if(0!==d.opacity){var g,h,c=m(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==P&&(P=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),j.vertexAttribPointer(c.position,
+3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0),d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[i[g]]),j.vertexAttribPointer(c["morphNormal"+
+g],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],l=-1,k=0;h=f.morphTargetInfluences;var n,o=h.length;g=0;for(-1!==f.morphTargetBase&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(n=0;n<o;n++)!i[n]&&h[n]>l&&(k=n,l=h[k]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[k]),j.vertexAttribPointer(c["morphNormal"+
+g],3,j.FLOAT,!1,0,0));f.__webglMorphTargetInfluences[g]=l;i[k]=1;l=-1;g++}}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(g=0,h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0));0<=b.color&&
+(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));0<=b.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));0<=b.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));0<=b.uv&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));
+0<=b.uv2&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,
+e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==oa&&(j.lineWidth(d),oa=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,
+j.UNSIGNED_SHORT,0)),E.info.render.calls++,E.info.render.vertices+=e.__webglFaceCount,E.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==oa&&(j.lineWidth(d),oa=d),j.drawArrays(f,0,e.__webglLineCount),E.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),E.info.render.calls++,E.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,
+0,e.__webglVertexCount),E.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,m,k,n=a.__lights,o=a.fog;U=-1;void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);
+b.projectionMatrix.flattenToArray(b._projectionMatrixArray);eb.multiply(b.projectionMatrix,b.matrixWorldInverse);cb.setFromMatrix(eb);this.autoUpdateObjects&&this.initWebGLObjects(a);h(this.renderPluginsPre,a,b);E.info.render.calls=0;E.info.render.vertices=0;E.info.render.faces=0;E.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);k=a.__webglObjects;for(d=0,e=k.length;d<e;d++)if(f=k[d],m=f.object,f.render=!1,
+m.visible&&(!(m instanceof THREE.Mesh||m instanceof THREE.ParticleSystem)||!m.frustumCulled||cb.contains(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);r(m,b);var p=f,q=p.object,y=p.buffer,t=void 0,t=t=void 0,t=q.material;if(t instanceof THREE.MeshFaceMaterial){if(t=y.materialIndex,0<=t)t=q.geometry.materials[t],t.transparent?(p.transparent=t,p.opaque=null):(p.opaque=t,p.transparent=null)}else if(t)t.transparent?(p.transparent=t,p.opaque=null):(p.opaque=t,p.transparent=null);f.render=!0;
+if(this.sortObjects)m.renderDepth?f.z=m.renderDepth:(Ga.copy(m.matrixWorld.getPosition()),eb.multiplyVector3(Ga),f.z=Ga.z)}this.sortObjects&&k.sort(g);k=a.__webglObjectsImmediate;for(d=0,e=k.length;d<e;d++)if(f=k[d],m=f.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),r(m,b),m=f.object.material,m.transparent?(f.transparent=m,f.opaque=null):(f.opaque=m,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),
+this.setDepthWrite(a.overrideMaterial.depthWrite),s(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,n,o,!0,a.overrideMaterial),l(a.__webglObjectsImmediate,"",b,n,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,n,o,!1),l(a.__webglObjectsImmediate,"opaque",b,n,o,!1),i(a.__webglObjects,!1,"transparent",b,n,o,!0),l(a.__webglObjectsImmediate,"transparent",b,n,o,!0));
+h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,e){var f=
+m(a,b,c,d,e);P=-1;E.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,j,cb):e.render(function(a){E.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,m=void 0,i=void 0,l=void 0;if(!g.__webglInit)if(g.__webglInit=!0,g._modelViewMatrix=new THREE.Matrix4,g._normalMatrixArray=new Float32Array(9),
+g._modelViewMatrixArray=new Float32Array(16),g._objectMatrixArray=new Float32Array(16),g.matrixWorld.flattenToArray(g._objectMatrixArray),g instanceof THREE.Mesh){if(i=g.geometry,i instanceof THREE.Geometry){if(void 0===i.geometryGroups){var r=i,s=void 0,y=void 0,t=void 0,u=void 0,v=void 0,w=void 0,z=void 0,P={},F=r.morphTargets.length,fa=r.morphNormals.length;r.geometryGroups={};for(s=0,y=r.faces.length;s<y;s++)t=r.faces[s],u=t.materialIndex,w=void 0!==u?u:-1,void 0===P[w]&&(P[w]={hash:w,counter:0}),
+z=P[w].hash+"_"+P[w].counter,void 0===r.geometryGroups[z]&&(r.geometryGroups[z]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:F,numMorphNormals:fa}),v=t instanceof THREE.Face3?3:4,65535<r.geometryGroups[z].vertices+v&&(P[w].counter+=1,z=P[w].hash+"_"+P[w].counter,void 0===r.geometryGroups[z]&&(r.geometryGroups[z]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:F,numMorphNormals:fa})),t instanceof THREE.Face3?r.geometryGroups[z].faces3.push(s):r.geometryGroups[z].faces4.push(s),
+r.geometryGroups[z].vertices+=v;r.geometryGroupsList=[];var U=void 0;for(U in r.geometryGroups)r.geometryGroups[U].id=ja++,r.geometryGroupsList.push(r.geometryGroups[U])}for(m in i.geometryGroups)if(l=i.geometryGroups[m],!l.__webglVertexBuffer){var C=l;C.__webglVertexBuffer=j.createBuffer();C.__webglNormalBuffer=j.createBuffer();C.__webglTangentBuffer=j.createBuffer();C.__webglColorBuffer=j.createBuffer();C.__webglUVBuffer=j.createBuffer();C.__webglUV2Buffer=j.createBuffer();C.__webglSkinVertexABuffer=
+j.createBuffer();C.__webglSkinVertexBBuffer=j.createBuffer();C.__webglSkinIndicesBuffer=j.createBuffer();C.__webglSkinWeightsBuffer=j.createBuffer();C.__webglFaceBuffer=j.createBuffer();C.__webglLineBuffer=j.createBuffer();var D=void 0,I=void 0;if(C.numMorphTargets){C.__webglMorphTargetsBuffers=[];for(D=0,I=C.numMorphTargets;D<I;D++)C.__webglMorphTargetsBuffers.push(j.createBuffer())}if(C.numMorphNormals){C.__webglMorphNormalsBuffers=[];for(D=0,I=C.numMorphNormals;D<I;D++)C.__webglMorphNormalsBuffers.push(j.createBuffer())}E.info.memory.geometries++;
+var B=l,H=g,L=H.geometry,R=B.faces3,N=B.faces4,K=3*R.length+4*N.length,O=1*R.length+2*N.length,ha=3*R.length+4*N.length,S=c(H,B),ba=e(S),Q=d(S),aa=S.vertexColors?S.vertexColors:!1;B.__vertexArray=new Float32Array(3*K);if(Q)B.__normalArray=new Float32Array(3*K);if(L.hasTangents)B.__tangentArray=new Float32Array(4*K);if(aa)B.__colorArray=new Float32Array(3*K);if(ba){if(0<L.faceUvs.length||0<L.faceVertexUvs.length)B.__uvArray=new Float32Array(2*K);if(1<L.faceUvs.length||1<L.faceVertexUvs.length)B.__uv2Array=
+new Float32Array(2*K)}if(H.geometry.skinWeights.length&&H.geometry.skinIndices.length)B.__skinVertexAArray=new Float32Array(4*K),B.__skinVertexBArray=new Float32Array(4*K),B.__skinIndexArray=new Float32Array(4*K),B.__skinWeightArray=new Float32Array(4*K);B.__faceArray=new Uint16Array(3*O);B.__lineArray=new Uint16Array(2*ha);var da=void 0,Z=void 0;if(B.numMorphTargets){B.__morphTargetsArrays=[];for(da=0,Z=B.numMorphTargets;da<Z;da++)B.__morphTargetsArrays.push(new Float32Array(3*K))}if(B.numMorphNormals){B.__morphNormalsArrays=
+[];for(da=0,Z=B.numMorphNormals;da<Z;da++)B.__morphNormalsArrays.push(new Float32Array(3*K))}B.__webglFaceCount=3*O;B.__webglLineCount=2*ha;if(S.attributes){if(void 0===B.__webglCustomAttributesList)B.__webglCustomAttributesList=[];var Ua=void 0;for(Ua in S.attributes){var Ia=S.attributes[Ua],oa={},Aa;for(Aa in Ia)oa[Aa]=Ia[Aa];if(!oa.__webglInitialized||oa.createUniqueBuffers){oa.__webglInitialized=!0;var ka=1;"v2"===oa.type?ka=2:"v3"===oa.type?ka=3:"v4"===oa.type?ka=4:"c"===oa.type&&(ka=3);oa.size=
+ka;oa.array=new Float32Array(K*ka);oa.buffer=j.createBuffer();oa.buffer.belongsToAttribute=Ua;Ia.needsUpdate=!0;oa.__original=Ia}B.__webglCustomAttributesList.push(oa)}}B.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}}else if(g instanceof THREE.Ribbon){if(i=g.geometry,!i.__webglVertexBuffer){var ra=i;ra.__webglVertexBuffer=j.createBuffer();ra.__webglColorBuffer=j.createBuffer();E.info.memory.geometries++;
+var Fa=i,sa=Fa.vertices.length;Fa.__vertexArray=new Float32Array(3*sa);Fa.__colorArray=new Float32Array(3*sa);Fa.__webglVertexCount=sa;i.__dirtyVertices=!0;i.__dirtyColors=!0}}else if(g instanceof THREE.Line){if(i=g.geometry,!i.__webglVertexBuffer){var Ba=i;Ba.__webglVertexBuffer=j.createBuffer();Ba.__webglColorBuffer=j.createBuffer();E.info.memory.geometries++;var Ga=i,Oa=g,bb=Ga.vertices.length;Ga.__vertexArray=new Float32Array(3*bb);Ga.__colorArray=new Float32Array(3*bb);Ga.__webglLineCount=bb;
+b(Ga,Oa);i.__dirtyVertices=!0;i.__dirtyColors=!0}}else if(g instanceof THREE.ParticleSystem&&(i=g.geometry,!i.__webglVertexBuffer)){var jb=i;jb.__webglVertexBuffer=j.createBuffer();jb.__webglColorBuffer=j.createBuffer();E.info.geometries++;var Va=i,eb=g,cb=Va.vertices.length;Va.__vertexArray=new Float32Array(3*cb);Va.__colorArray=new Float32Array(3*cb);Va.__sortArray=[];Va.__webglParticleCount=cb;b(Va,eb);i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!g.__webglActive){if(g instanceof THREE.Mesh)if(i=
+g.geometry,i instanceof THREE.BufferGeometry)k(h.__webglObjects,i,g);else for(m in i.geometryGroups)l=i.geometryGroups[m],k(h.__webglObjects,l,g);else g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem?(i=g.geometry,k(h.__webglObjects,i,g)):g instanceof THREE.ImmediateRenderObject||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof THREE.LensFlare&&h.__webglFlares.push(g);
+g.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var gb=a.__objectsRemoved[0],db=a;gb instanceof THREE.Mesh||gb instanceof THREE.ParticleSystem||gb instanceof THREE.Ribbon||gb instanceof THREE.Line?o(db.__webglObjects,gb):gb instanceof THREE.Sprite?q(db.__webglSprites,gb):gb instanceof THREE.LensFlare?q(db.__webglFlares,gb):(gb instanceof THREE.ImmediateRenderObject||gb.immediateRenderCallback)&&o(db.__webglObjectsImmediate,gb);gb.__webglActive=!1;a.__objectsRemoved.splice(0,
+1)}for(var Vc=0,qd=a.__webglObjects.length;Vc<qd;Vc++){var nb=a.__webglObjects[Vc].object,ia=nb.geometry,qc=void 0,ic=void 0,Xa=void 0;if(nb instanceof THREE.Mesh)if(ia instanceof THREE.BufferGeometry)ia.__dirtyVertices=!1,ia.__dirtyElements=!1,ia.__dirtyUvs=!1,ia.__dirtyNormals=!1,ia.__dirtyColors=!1;else{for(var Wc=0,rd=ia.geometryGroupsList.length;Wc<rd;Wc++)if(qc=ia.geometryGroupsList[Wc],Xa=c(nb,qc),ic=Xa.attributes&&p(Xa),ia.__dirtyVertices||ia.__dirtyMorphTargets||ia.__dirtyElements||ia.__dirtyUvs||
+ia.__dirtyNormals||ia.__dirtyColors||ia.__dirtyTangents||ic){var ea=qc,sd=nb,Za=j.DYNAMIC_DRAW,td=!ia.dynamic,bc=Xa;if(ea.__inittedArrays){var fd=d(bc),Xc=bc.vertexColors?bc.vertexColors:!1,gd=e(bc),Fc=fd===THREE.SmoothShading,G=void 0,T=void 0,lb=void 0,M=void 0,jc=void 0,Ob=void 0,ob=void 0,Gc=void 0,Hb=void 0,kc=void 0,lc=void 0,W=void 0,X=void 0,Y=void 0,pa=void 0,pb=void 0,qb=void 0,rb=void 0,rc=void 0,sb=void 0,tb=void 0,ub=void 0,sc=void 0,vb=void 0,wb=void 0,xb=void 0,tc=void 0,yb=void 0,
+zb=void 0,Ab=void 0,uc=void 0,Bb=void 0,Cb=void 0,Db=void 0,vc=void 0,Pb=void 0,Qb=void 0,Rb=void 0,Hc=void 0,Sb=void 0,Tb=void 0,Ub=void 0,Ic=void 0,la=void 0,hd=void 0,Vb=void 0,mc=void 0,nc=void 0,La=void 0,id=void 0,Ja=void 0,Ka=void 0,Wb=void 0,Ib=void 0,Ca=0,Ha=0,Jb=0,Kb=0,hb=0,Ra=0,qa=0,Sa=0,Da=0,J=0,ca=0,A=0,$a=void 0,Ma=ea.__vertexArray,wc=ea.__uvArray,xc=ea.__uv2Array,ib=ea.__normalArray,ua=ea.__tangentArray,Na=ea.__colorArray,va=ea.__skinVertexAArray,wa=ea.__skinVertexBArray,xa=ea.__skinIndexArray,
+ya=ea.__skinWeightArray,Yc=ea.__morphTargetsArrays,Zc=ea.__morphNormalsArrays,$c=ea.__webglCustomAttributesList,x=void 0,Eb=ea.__faceArray,ab=ea.__lineArray,Ta=sd.geometry,ud=Ta.__dirtyElements,jd=Ta.__dirtyUvs,vd=Ta.__dirtyNormals,wd=Ta.__dirtyTangents,xd=Ta.__dirtyColors,yd=Ta.__dirtyMorphTargets,cc=Ta.vertices,ma=ea.faces3,na=ea.faces4,Ea=Ta.faces,ad=Ta.faceVertexUvs[0],bd=Ta.faceVertexUvs[1],dc=Ta.skinVerticesA,ec=Ta.skinVerticesB,fc=Ta.skinIndices,Xb=Ta.skinWeights,Yb=Ta.morphTargets,Jc=Ta.morphNormals;
+if(Ta.__dirtyVertices){for(G=0,T=ma.length;G<T;G++)M=Ea[ma[G]],W=cc[M.a].position,X=cc[M.b].position,Y=cc[M.c].position,Ma[Ha]=W.x,Ma[Ha+1]=W.y,Ma[Ha+2]=W.z,Ma[Ha+3]=X.x,Ma[Ha+4]=X.y,Ma[Ha+5]=X.z,Ma[Ha+6]=Y.x,Ma[Ha+7]=Y.y,Ma[Ha+8]=Y.z,Ha+=9;for(G=0,T=na.length;G<T;G++)M=Ea[na[G]],W=cc[M.a].position,X=cc[M.b].position,Y=cc[M.c].position,pa=cc[M.d].position,Ma[Ha]=W.x,Ma[Ha+1]=W.y,Ma[Ha+2]=W.z,Ma[Ha+3]=X.x,Ma[Ha+4]=X.y,Ma[Ha+5]=X.z,Ma[Ha+6]=Y.x,Ma[Ha+7]=Y.y,Ma[Ha+8]=Y.z,Ma[Ha+9]=pa.x,Ma[Ha+10]=pa.y,
+Ma[Ha+11]=pa.z,Ha+=12;j.bindBuffer(j.ARRAY_BUFFER,ea.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Ma,Za)}if(yd)for(La=0,id=Yb.length;La<id;La++){ca=0;for(G=0,T=ma.length;G<T;G++){Wb=ma[G];M=Ea[Wb];W=Yb[La].vertices[M.a].position;X=Yb[La].vertices[M.b].position;Y=Yb[La].vertices[M.c].position;Ja=Yc[La];Ja[ca]=W.x;Ja[ca+1]=W.y;Ja[ca+2]=W.z;Ja[ca+3]=X.x;Ja[ca+4]=X.y;Ja[ca+5]=X.z;Ja[ca+6]=Y.x;Ja[ca+7]=Y.y;Ja[ca+8]=Y.z;if(bc.morphNormals)Fc?(Ib=Jc[La].vertexNormals[Wb],sb=Ib.a,tb=Ib.b,ub=Ib.c):ub=
+tb=sb=Jc[La].faceNormals[Wb],Ka=Zc[La],Ka[ca]=sb.x,Ka[ca+1]=sb.y,Ka[ca+2]=sb.z,Ka[ca+3]=tb.x,Ka[ca+4]=tb.y,Ka[ca+5]=tb.z,Ka[ca+6]=ub.x,Ka[ca+7]=ub.y,Ka[ca+8]=ub.z;ca+=9}for(G=0,T=na.length;G<T;G++){Wb=na[G];M=Ea[Wb];W=Yb[La].vertices[M.a].position;X=Yb[La].vertices[M.b].position;Y=Yb[La].vertices[M.c].position;pa=Yb[La].vertices[M.d].position;Ja=Yc[La];Ja[ca]=W.x;Ja[ca+1]=W.y;Ja[ca+2]=W.z;Ja[ca+3]=X.x;Ja[ca+4]=X.y;Ja[ca+5]=X.z;Ja[ca+6]=Y.x;Ja[ca+7]=Y.y;Ja[ca+8]=Y.z;Ja[ca+9]=pa.x;Ja[ca+10]=pa.y;Ja[ca+
+11]=pa.z;if(bc.morphNormals)Fc?(Ib=Jc[La].vertexNormals[Wb],sb=Ib.a,tb=Ib.b,ub=Ib.c,sc=Ib.d):sc=ub=tb=sb=Jc[La].faceNormals[Wb],Ka=Zc[La],Ka[ca]=sb.x,Ka[ca+1]=sb.y,Ka[ca+2]=sb.z,Ka[ca+3]=tb.x,Ka[ca+4]=tb.y,Ka[ca+5]=tb.z,Ka[ca+6]=ub.x,Ka[ca+7]=ub.y,Ka[ca+8]=ub.z,Ka[ca+9]=sc.x,Ka[ca+10]=sc.y,Ka[ca+11]=sc.z;ca+=12}j.bindBuffer(j.ARRAY_BUFFER,ea.__webglMorphTargetsBuffers[La]);j.bufferData(j.ARRAY_BUFFER,Yc[La],Za);bc.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,ea.__webglMorphNormalsBuffers[La]),j.bufferData(j.ARRAY_BUFFER,
+Zc[La],Za))}if(Xb.length){for(G=0,T=ma.length;G<T;G++)M=Ea[ma[G]],yb=Xb[M.a],zb=Xb[M.b],Ab=Xb[M.c],ya[J]=yb.x,ya[J+1]=yb.y,ya[J+2]=yb.z,ya[J+3]=yb.w,ya[J+4]=zb.x,ya[J+5]=zb.y,ya[J+6]=zb.z,ya[J+7]=zb.w,ya[J+8]=Ab.x,ya[J+9]=Ab.y,ya[J+10]=Ab.z,ya[J+11]=Ab.w,Bb=fc[M.a],Cb=fc[M.b],Db=fc[M.c],xa[J]=Bb.x,xa[J+1]=Bb.y,xa[J+2]=Bb.z,xa[J+3]=Bb.w,xa[J+4]=Cb.x,xa[J+5]=Cb.y,xa[J+6]=Cb.z,xa[J+7]=Cb.w,xa[J+8]=Db.x,xa[J+9]=Db.y,xa[J+10]=Db.z,xa[J+11]=Db.w,Pb=dc[M.a],Qb=dc[M.b],Rb=dc[M.c],va[J]=Pb.x,va[J+1]=Pb.y,
+va[J+2]=Pb.z,va[J+3]=1,va[J+4]=Qb.x,va[J+5]=Qb.y,va[J+6]=Qb.z,va[J+7]=1,va[J+8]=Rb.x,va[J+9]=Rb.y,va[J+10]=Rb.z,va[J+11]=1,Sb=ec[M.a],Tb=ec[M.b],Ub=ec[M.c],wa[J]=Sb.x,wa[J+1]=Sb.y,wa[J+2]=Sb.z,wa[J+3]=1,wa[J+4]=Tb.x,wa[J+5]=Tb.y,wa[J+6]=Tb.z,wa[J+7]=1,wa[J+8]=Ub.x,wa[J+9]=Ub.y,wa[J+10]=Ub.z,wa[J+11]=1,J+=12;for(G=0,T=na.length;G<T;G++)M=Ea[na[G]],yb=Xb[M.a],zb=Xb[M.b],Ab=Xb[M.c],uc=Xb[M.d],ya[J]=yb.x,ya[J+1]=yb.y,ya[J+2]=yb.z,ya[J+3]=yb.w,ya[J+4]=zb.x,ya[J+5]=zb.y,ya[J+6]=zb.z,ya[J+7]=zb.w,ya[J+8]=
+Ab.x,ya[J+9]=Ab.y,ya[J+10]=Ab.z,ya[J+11]=Ab.w,ya[J+12]=uc.x,ya[J+13]=uc.y,ya[J+14]=uc.z,ya[J+15]=uc.w,Bb=fc[M.a],Cb=fc[M.b],Db=fc[M.c],vc=fc[M.d],xa[J]=Bb.x,xa[J+1]=Bb.y,xa[J+2]=Bb.z,xa[J+3]=Bb.w,xa[J+4]=Cb.x,xa[J+5]=Cb.y,xa[J+6]=Cb.z,xa[J+7]=Cb.w,xa[J+8]=Db.x,xa[J+9]=Db.y,xa[J+10]=Db.z,xa[J+11]=Db.w,xa[J+12]=vc.x,xa[J+13]=vc.y,xa[J+14]=vc.z,xa[J+15]=vc.w,Pb=dc[M.a],Qb=dc[M.b],Rb=dc[M.c],Hc=dc[M.d],va[J]=Pb.x,va[J+1]=Pb.y,va[J+2]=Pb.z,va[J+3]=1,va[J+4]=Qb.x,va[J+5]=Qb.y,va[J+6]=Qb.z,va[J+7]=1,va[J+
+8]=Rb.x,va[J+9]=Rb.y,va[J+10]=Rb.z,va[J+11]=1,va[J+12]=Hc.x,va[J+13]=Hc.y,va[J+14]=Hc.z,va[J+15]=1,Sb=ec[M.a],Tb=ec[M.b],Ub=ec[M.c],Ic=ec[M.d],wa[J]=Sb.x,wa[J+1]=Sb.y,wa[J+2]=Sb.z,wa[J+3]=1,wa[J+4]=Tb.x,wa[J+5]=Tb.y,wa[J+6]=Tb.z,wa[J+7]=1,wa[J+8]=Ub.x,wa[J+9]=Ub.y,wa[J+10]=Ub.z,wa[J+11]=1,wa[J+12]=Ic.x,wa[J+13]=Ic.y,wa[J+14]=Ic.z,wa[J+15]=1,J+=16;0<J&&(j.bindBuffer(j.ARRAY_BUFFER,ea.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,va,Za),j.bindBuffer(j.ARRAY_BUFFER,ea.__webglSkinVertexBBuffer),
+j.bufferData(j.ARRAY_BUFFER,wa,Za),j.bindBuffer(j.ARRAY_BUFFER,ea.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,xa,Za),j.bindBuffer(j.ARRAY_BUFFER,ea.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,ya,Za))}if(xd&&Xc){for(G=0,T=ma.length;G<T;G++)M=Ea[ma[G]],ob=M.vertexColors,Gc=M.color,3===ob.length&&Xc===THREE.VertexColors?(vb=ob[0],wb=ob[1],xb=ob[2]):xb=wb=vb=Gc,Na[Da]=vb.r,Na[Da+1]=vb.g,Na[Da+2]=vb.b,Na[Da+3]=wb.r,Na[Da+4]=wb.g,Na[Da+5]=wb.b,Na[Da+6]=xb.r,Na[Da+7]=xb.g,Na[Da+8]=xb.b,
+Da+=9;for(G=0,T=na.length;G<T;G++)M=Ea[na[G]],ob=M.vertexColors,Gc=M.color,4===ob.length&&Xc===THREE.VertexColors?(vb=ob[0],wb=ob[1],xb=ob[2],tc=ob[3]):tc=xb=wb=vb=Gc,Na[Da]=vb.r,Na[Da+1]=vb.g,Na[Da+2]=vb.b,Na[Da+3]=wb.r,Na[Da+4]=wb.g,Na[Da+5]=wb.b,Na[Da+6]=xb.r,Na[Da+7]=xb.g,Na[Da+8]=xb.b,Na[Da+9]=tc.r,Na[Da+10]=tc.g,Na[Da+11]=tc.b,Da+=12;0<Da&&(j.bindBuffer(j.ARRAY_BUFFER,ea.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Na,Za))}if(wd&&Ta.hasTangents){for(G=0,T=ma.length;G<T;G++)M=Ea[ma[G]],Hb=
+M.vertexTangents,pb=Hb[0],qb=Hb[1],rb=Hb[2],ua[qa]=pb.x,ua[qa+1]=pb.y,ua[qa+2]=pb.z,ua[qa+3]=pb.w,ua[qa+4]=qb.x,ua[qa+5]=qb.y,ua[qa+6]=qb.z,ua[qa+7]=qb.w,ua[qa+8]=rb.x,ua[qa+9]=rb.y,ua[qa+10]=rb.z,ua[qa+11]=rb.w,qa+=12;for(G=0,T=na.length;G<T;G++)M=Ea[na[G]],Hb=M.vertexTangents,pb=Hb[0],qb=Hb[1],rb=Hb[2],rc=Hb[3],ua[qa]=pb.x,ua[qa+1]=pb.y,ua[qa+2]=pb.z,ua[qa+3]=pb.w,ua[qa+4]=qb.x,ua[qa+5]=qb.y,ua[qa+6]=qb.z,ua[qa+7]=qb.w,ua[qa+8]=rb.x,ua[qa+9]=rb.y,ua[qa+10]=rb.z,ua[qa+11]=rb.w,ua[qa+12]=rc.x,ua[qa+
+13]=rc.y,ua[qa+14]=rc.z,ua[qa+15]=rc.w,qa+=16;j.bindBuffer(j.ARRAY_BUFFER,ea.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,ua,Za)}if(vd&&fd){for(G=0,T=ma.length;G<T;G++)if(M=Ea[ma[G]],jc=M.vertexNormals,Ob=M.normal,3===jc.length&&Fc)for(la=0;3>la;la++)Vb=jc[la],ib[Ra]=Vb.x,ib[Ra+1]=Vb.y,ib[Ra+2]=Vb.z,Ra+=3;else for(la=0;3>la;la++)ib[Ra]=Ob.x,ib[Ra+1]=Ob.y,ib[Ra+2]=Ob.z,Ra+=3;for(G=0,T=na.length;G<T;G++)if(M=Ea[na[G]],jc=M.vertexNormals,Ob=M.normal,4===jc.length&&Fc)for(la=0;4>la;la++)Vb=jc[la],
+ib[Ra]=Vb.x,ib[Ra+1]=Vb.y,ib[Ra+2]=Vb.z,Ra+=3;else for(la=0;4>la;la++)ib[Ra]=Ob.x,ib[Ra+1]=Ob.y,ib[Ra+2]=Ob.z,Ra+=3;j.bindBuffer(j.ARRAY_BUFFER,ea.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,ib,Za)}if(jd&&ad&&gd){for(G=0,T=ma.length;G<T;G++)if(lb=ma[G],M=Ea[lb],kc=ad[lb],void 0!==kc)for(la=0;3>la;la++)mc=kc[la],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=2;for(G=0,T=na.length;G<T;G++)if(lb=na[G],M=Ea[lb],kc=ad[lb],void 0!==kc)for(la=0;4>la;la++)mc=kc[la],wc[Jb]=mc.u,wc[Jb+1]=mc.v,Jb+=2;0<Jb&&(j.bindBuffer(j.ARRAY_BUFFER,
+ea.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,wc,Za))}if(jd&&bd&&gd){for(G=0,T=ma.length;G<T;G++)if(lb=ma[G],M=Ea[lb],lc=bd[lb],void 0!==lc)for(la=0;3>la;la++)nc=lc[la],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;for(G=0,T=na.length;G<T;G++)if(lb=na[G],M=Ea[lb],lc=bd[lb],void 0!==lc)for(la=0;4>la;la++)nc=lc[la],xc[Kb]=nc.u,xc[Kb+1]=nc.v,Kb+=2;0<Kb&&(j.bindBuffer(j.ARRAY_BUFFER,ea.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,xc,Za))}if(ud){for(G=0,T=ma.length;G<T;G++)M=Ea[ma[G]],Eb[hb]=Ca,Eb[hb+1]=Ca+1,Eb[hb+
+2]=Ca+2,hb+=3,ab[Sa]=Ca,ab[Sa+1]=Ca+1,ab[Sa+2]=Ca,ab[Sa+3]=Ca+2,ab[Sa+4]=Ca+1,ab[Sa+5]=Ca+2,Sa+=6,Ca+=3;for(G=0,T=na.length;G<T;G++)M=Ea[na[G]],Eb[hb]=Ca,Eb[hb+1]=Ca+1,Eb[hb+2]=Ca+3,Eb[hb+3]=Ca+1,Eb[hb+4]=Ca+2,Eb[hb+5]=Ca+3,hb+=6,ab[Sa]=Ca,ab[Sa+1]=Ca+1,ab[Sa+2]=Ca,ab[Sa+3]=Ca+3,ab[Sa+4]=Ca+1,ab[Sa+5]=Ca+2,ab[Sa+6]=Ca+2,ab[Sa+7]=Ca+3,Sa+=8,Ca+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ea.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Eb,Za);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ea.__webglLineBuffer);
+j.bufferData(j.ELEMENT_ARRAY_BUFFER,ab,Za)}if($c)for(la=0,hd=$c.length;la<hd;la++)if(x=$c[la],x.__original.needsUpdate){A=0;if(1===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(G=0,T=ma.length;G<T;G++)M=Ea[ma[G]],x.array[A]=x.value[M.a],x.array[A+1]=x.value[M.b],x.array[A+2]=x.value[M.c],A+=3;for(G=0,T=na.length;G<T;G++)M=Ea[na[G]],x.array[A]=x.value[M.a],x.array[A+1]=x.value[M.b],x.array[A+2]=x.value[M.c],x.array[A+3]=x.value[M.d],A+=4}else{if("faces"===x.boundTo){for(G=0,T=ma.length;G<
+T;G++)$a=x.value[ma[G]],x.array[A]=$a,x.array[A+1]=$a,x.array[A+2]=$a,A+=3;for(G=0,T=na.length;G<T;G++)$a=x.value[na[G]],x.array[A]=$a,x.array[A+1]=$a,x.array[A+2]=$a,x.array[A+3]=$a,A+=4}}else if(2===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(G=0,T=ma.length;G<T;G++)M=Ea[ma[G]],W=x.value[M.a],X=x.value[M.b],Y=x.value[M.c],x.array[A]=W.x,x.array[A+1]=W.y,x.array[A+2]=X.x,x.array[A+3]=X.y,x.array[A+4]=Y.x,x.array[A+5]=Y.y,A+=6;for(G=0,T=na.length;G<T;G++)M=Ea[na[G]],W=x.value[M.a],X=
+x.value[M.b],Y=x.value[M.c],pa=x.value[M.d],x.array[A]=W.x,x.array[A+1]=W.y,x.array[A+2]=X.x,x.array[A+3]=X.y,x.array[A+4]=Y.x,x.array[A+5]=Y.y,x.array[A+6]=pa.x,x.array[A+7]=pa.y,A+=8}else{if("faces"===x.boundTo){for(G=0,T=ma.length;G<T;G++)Y=X=W=$a=x.value[ma[G]],x.array[A]=W.x,x.array[A+1]=W.y,x.array[A+2]=X.x,x.array[A+3]=X.y,x.array[A+4]=Y.x,x.array[A+5]=Y.y,A+=6;for(G=0,T=na.length;G<T;G++)pa=Y=X=W=$a=x.value[na[G]],x.array[A]=W.x,x.array[A+1]=W.y,x.array[A+2]=X.x,x.array[A+3]=X.y,x.array[A+
+4]=Y.x,x.array[A+5]=Y.y,x.array[A+6]=pa.x,x.array[A+7]=pa.y,A+=8}}else if(3===x.size){var ga;ga="c"===x.type?["r","g","b"]:["x","y","z"];if(void 0===x.boundTo||"vertices"===x.boundTo){for(G=0,T=ma.length;G<T;G++)M=Ea[ma[G]],W=x.value[M.a],X=x.value[M.b],Y=x.value[M.c],x.array[A]=W[ga[0]],x.array[A+1]=W[ga[1]],x.array[A+2]=W[ga[2]],x.array[A+3]=X[ga[0]],x.array[A+4]=X[ga[1]],x.array[A+5]=X[ga[2]],x.array[A+6]=Y[ga[0]],x.array[A+7]=Y[ga[1]],x.array[A+8]=Y[ga[2]],A+=9;for(G=0,T=na.length;G<T;G++)M=Ea[na[G]],
+W=x.value[M.a],X=x.value[M.b],Y=x.value[M.c],pa=x.value[M.d],x.array[A]=W[ga[0]],x.array[A+1]=W[ga[1]],x.array[A+2]=W[ga[2]],x.array[A+3]=X[ga[0]],x.array[A+4]=X[ga[1]],x.array[A+5]=X[ga[2]],x.array[A+6]=Y[ga[0]],x.array[A+7]=Y[ga[1]],x.array[A+8]=Y[ga[2]],x.array[A+9]=pa[ga[0]],x.array[A+10]=pa[ga[1]],x.array[A+11]=pa[ga[2]],A+=12}else if("faces"===x.boundTo){for(G=0,T=ma.length;G<T;G++)Y=X=W=$a=x.value[ma[G]],x.array[A]=W[ga[0]],x.array[A+1]=W[ga[1]],x.array[A+2]=W[ga[2]],x.array[A+3]=X[ga[0]],
+x.array[A+4]=X[ga[1]],x.array[A+5]=X[ga[2]],x.array[A+6]=Y[ga[0]],x.array[A+7]=Y[ga[1]],x.array[A+8]=Y[ga[2]],A+=9;for(G=0,T=na.length;G<T;G++)pa=Y=X=W=$a=x.value[na[G]],x.array[A]=W[ga[0]],x.array[A+1]=W[ga[1]],x.array[A+2]=W[ga[2]],x.array[A+3]=X[ga[0]],x.array[A+4]=X[ga[1]],x.array[A+5]=X[ga[2]],x.array[A+6]=Y[ga[0]],x.array[A+7]=Y[ga[1]],x.array[A+8]=Y[ga[2]],x.array[A+9]=pa[ga[0]],x.array[A+10]=pa[ga[1]],x.array[A+11]=pa[ga[2]],A+=12}}else if(4===x.size)if(void 0===x.boundTo||"vertices"===x.boundTo){for(G=
+0,T=ma.length;G<T;G++)M=Ea[ma[G]],W=x.value[M.a],X=x.value[M.b],Y=x.value[M.c],x.array[A]=W.x,x.array[A+1]=W.y,x.array[A+2]=W.z,x.array[A+3]=W.w,x.array[A+4]=X.x,x.array[A+5]=X.y,x.array[A+6]=X.z,x.array[A+7]=X.w,x.array[A+8]=Y.x,x.array[A+9]=Y.y,x.array[A+10]=Y.z,x.array[A+11]=Y.w,A+=12;for(G=0,T=na.length;G<T;G++)M=Ea[na[G]],W=x.value[M.a],X=x.value[M.b],Y=x.value[M.c],pa=x.value[M.d],x.array[A]=W.x,x.array[A+1]=W.y,x.array[A+2]=W.z,x.array[A+3]=W.w,x.array[A+4]=X.x,x.array[A+5]=X.y,x.array[A+6]=
+X.z,x.array[A+7]=X.w,x.array[A+8]=Y.x,x.array[A+9]=Y.y,x.array[A+10]=Y.z,x.array[A+11]=Y.w,x.array[A+12]=pa.x,x.array[A+13]=pa.y,x.array[A+14]=pa.z,x.array[A+15]=pa.w,A+=16}else if("faces"===x.boundTo){for(G=0,T=ma.length;G<T;G++)Y=X=W=$a=x.value[ma[G]],x.array[A]=W.x,x.array[A+1]=W.y,x.array[A+2]=W.z,x.array[A+3]=W.w,x.array[A+4]=X.x,x.array[A+5]=X.y,x.array[A+6]=X.z,x.array[A+7]=X.w,x.array[A+8]=Y.x,x.array[A+9]=Y.y,x.array[A+10]=Y.z,x.array[A+11]=Y.w,A+=12;for(G=0,T=na.length;G<T;G++)pa=Y=X=W=
+$a=x.value[na[G]],x.array[A]=W.x,x.array[A+1]=W.y,x.array[A+2]=W.z,x.array[A+3]=W.w,x.array[A+4]=X.x,x.array[A+5]=X.y,x.array[A+6]=X.z,x.array[A+7]=X.w,x.array[A+8]=Y.x,x.array[A+9]=Y.y,x.array[A+10]=Y.z,x.array[A+11]=Y.w,x.array[A+12]=pa.x,x.array[A+13]=pa.y,x.array[A+14]=pa.z,x.array[A+15]=pa.w,A+=16}j.bindBuffer(j.ARRAY_BUFFER,x.buffer);j.bufferData(j.ARRAY_BUFFER,x.array,Za)}td&&(delete ea.__inittedArrays,delete ea.__colorArray,delete ea.__normalArray,delete ea.__tangentArray,delete ea.__uvArray,
+delete ea.__uv2Array,delete ea.__faceArray,delete ea.__vertexArray,delete ea.__lineArray,delete ea.__skinVertexAArray,delete ea.__skinVertexBArray,delete ea.__skinIndexArray,delete ea.__skinWeightArray)}}ia.__dirtyVertices=!1;ia.__dirtyMorphTargets=!1;ia.__dirtyElements=!1;ia.__dirtyUvs=!1;ia.__dirtyNormals=!1;ia.__dirtyColors=!1;ia.__dirtyTangents=!1;Xa.attributes&&n(Xa)}else if(nb instanceof THREE.Ribbon){if(ia.__dirtyVertices||ia.__dirtyColors){var Zb=ia,kd=j.DYNAMIC_DRAW,yc=void 0,zc=void 0,Kc=
+void 0,$b=void 0,Lc=void 0,ld=Zb.vertices,md=Zb.colors,zd=ld.length,Ad=md.length,Mc=Zb.__vertexArray,Nc=Zb.__colorArray,Bd=Zb.__dirtyColors;if(Zb.__dirtyVertices){for(yc=0;yc<zd;yc++)Kc=ld[yc].position,$b=3*yc,Mc[$b]=Kc.x,Mc[$b+1]=Kc.y,Mc[$b+2]=Kc.z;j.bindBuffer(j.ARRAY_BUFFER,Zb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Mc,kd)}if(Bd){for(zc=0;zc<Ad;zc++)Lc=md[zc],$b=3*zc,Nc[$b]=Lc.r,Nc[$b+1]=Lc.g,Nc[$b+2]=Lc.b;j.bindBuffer(j.ARRAY_BUFFER,Zb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,
+Nc,kd)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1}else if(nb instanceof THREE.Line){Xa=c(nb,qc);ic=Xa.attributes&&p(Xa);if(ia.__dirtyVertices||ia.__dirtyColors||ic){var Lb=ia,cd=j.DYNAMIC_DRAW,Ac=void 0,Bc=void 0,Oc=void 0,za=void 0,Pc=void 0,nd=Lb.vertices,od=Lb.colors,Cd=nd.length,Dd=od.length,Qc=Lb.__vertexArray,Rc=Lb.__colorArray,Ed=Lb.__dirtyColors,dd=Lb.__webglCustomAttributesList,Sc=void 0,pd=void 0,Qa=void 0,oc=void 0,Ya=void 0,ta=void 0;if(Lb.__dirtyVertices){for(Ac=0;Ac<Cd;Ac++)Oc=nd[Ac].position,
+za=3*Ac,Qc[za]=Oc.x,Qc[za+1]=Oc.y,Qc[za+2]=Oc.z;j.bindBuffer(j.ARRAY_BUFFER,Lb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Qc,cd)}if(Ed){for(Bc=0;Bc<Dd;Bc++)Pc=od[Bc],za=3*Bc,Rc[za]=Pc.r,Rc[za+1]=Pc.g,Rc[za+2]=Pc.b;j.bindBuffer(j.ARRAY_BUFFER,Lb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Rc,cd)}if(dd)for(Sc=0,pd=dd.length;Sc<pd;Sc++)if(ta=dd[Sc],ta.needsUpdate&&(void 0===ta.boundTo||"vertices"===ta.boundTo)){za=0;oc=ta.value.length;if(1===ta.size)for(Qa=0;Qa<oc;Qa++)ta.array[Qa]=ta.value[Qa];
+else if(2===ta.size)for(Qa=0;Qa<oc;Qa++)Ya=ta.value[Qa],ta.array[za]=Ya.x,ta.array[za+1]=Ya.y,za+=2;else if(3===ta.size)if("c"===ta.type)for(Qa=0;Qa<oc;Qa++)Ya=ta.value[Qa],ta.array[za]=Ya.r,ta.array[za+1]=Ya.g,ta.array[za+2]=Ya.b,za+=3;else for(Qa=0;Qa<oc;Qa++)Ya=ta.value[Qa],ta.array[za]=Ya.x,ta.array[za+1]=Ya.y,ta.array[za+2]=Ya.z,za+=3;else if(4===ta.size)for(Qa=0;Qa<oc;Qa++)Ya=ta.value[Qa],ta.array[za]=Ya.x,ta.array[za+1]=Ya.y,ta.array[za+2]=Ya.z,ta.array[za+3]=Ya.w,za+=4;j.bindBuffer(j.ARRAY_BUFFER,
+ta.buffer);j.bufferData(j.ARRAY_BUFFER,ta.array,cd)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1;Xa.attributes&&n(Xa)}else if(nb instanceof THREE.ParticleSystem)Xa=c(nb,qc),ic=Xa.attributes&&p(Xa),(ia.__dirtyVertices||ia.__dirtyColors||nb.sortParticles||ic)&&f(ia,j.DYNAMIC_DRAW,nb),ia.__dirtyVertices=!1,ia.__dirtyColors=!1,Xa.attributes&&n(Xa)}};this.initMaterial=function(a,b,c,d){var e,f,g,h,m;a instanceof THREE.MeshDepthMaterial?m="depth":a instanceof THREE.MeshNormalMaterial?m="normal":a instanceof
+THREE.MeshBasicMaterial?m="basic":a instanceof THREE.MeshLambertMaterial?m="lambert":a instanceof THREE.MeshPhongMaterial?m="phong":a instanceof THREE.LineBasicMaterial?m="basic":a instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var i=THREE.ShaderLib[m];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var l,k;f=i=0;for(l=0,k=b.length;l<k;l++)e=b[l],e.onlyShadow||(e instanceof THREE.DirectionalLight&&f++,e instanceof
+THREE.PointLight&&i++,e instanceof THREE.SpotLight&&i++);i+f<=N?l=f:(l=Math.ceil(N*f/(i+f)),i=N-l);e=l;f=i;var n=0;for(i=0,l=b.length;i<l;i++)k=b[i],k.castShadow&&(k instanceof THREE.SpotLight&&n++,k instanceof THREE.DirectionalLight&&!k.shadowCascade&&n++);var o=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)o=d.bones.length;var p;a:{l=a.fragmentShader;k=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
+sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},
+q,d=[];m?d.push(m):(d.push(l),d.push(k));for(q in c)d.push(q),d.push(c[q]);m=d.join();for(q=0,d=Z.length;q<d;q++)if(Z[q].code===m){p=Z[q].program;break a}q=j.createProgram();d=["precision "+I+" float;",0<Oa?"#define VERTEX_TEXTURES":"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#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.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":
 "",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\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;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-e=["precision "+C+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?
-"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");l.attachShader(q,u("fragment",e+j));
-l.attachShader(q,u("vertex",d+n));l.linkProgram(q);l.getProgramParameter(q,l.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+l.getProgramParameter(q,l.VALIDATE_STATUS)+", gl error ["+l.getError()+"]");q.uniforms={};q.attributes={};var r,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,boneGlobalMatrices,morphTargetInfluences".split(",");for(r in k)d.push(r);r=d;for(d=0,k=r.length;d<k;d++)j=r[d],q.uniforms[j]=l.getUniformLocation(q,
-j);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(r=0;r<c.maxMorphTargets;r++)d.push("morphTarget"+r);for(r=0;r<c.maxMorphNormals;r++)d.push("morphNormal"+r);for(p in b)d.push(p);p=d;for(r=0,b=p.length;r<b;r++)c=p[r],q.attributes[c]=l.getAttribLocation(q,c);q.id=Y.length;Y.push({program:q,code:i});E.info.memory.programs=Y.length;p=q}a.program=p;p=a.program.attributes;0<=p.position&&l.enableVertexAttribArray(p.position);0<=p.color&&l.enableVertexAttribArray(p.color);
-0<=p.normal&&l.enableVertexAttribArray(p.normal);0<=p.tangent&&l.enableVertexAttribArray(p.tangent);a.skinning&&0<=p.skinVertexA&&0<=p.skinVertexB&&0<=p.skinIndex&&0<=p.skinWeight&&(l.enableVertexAttribArray(p.skinVertexA),l.enableVertexAttribArray(p.skinVertexB),l.enableVertexAttribArray(p.skinIndex),l.enableVertexAttribArray(p.skinWeight));if(a.attributes)for(h in a.attributes)void 0!==p[h]&&0<=p[h]&&l.enableVertexAttribArray(p[h]);if(a.morphTargets){a.numSupportedMorphTargets=0;q="morphTarget";
-for(h=0;h<this.maxMorphTargets;h++)r=q+h,0<=p[r]&&(l.enableVertexAttribArray(p[r]),a.numSupportedMorphTargets++)}if(a.morphNormals){a.numSupportedMorphNormals=0;q="morphNormal";for(h=0;h<this.maxMorphNormals;h++)r=q+h,0<=p[r]&&(l.enableVertexAttribArray(p[r]),a.numSupportedMorphNormals++)}a.uniformsList=[];for(g in a.uniforms)a.uniformsList.push([a.uniforms[g],g])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?l.frontFace(l.CCW):l.frontFace(l.CW),"back"===a?l.cullFace(l.BACK):"front"===a?l.cullFace(l.FRONT):
-l.cullFace(l.FRONT_AND_BACK),l.enable(l.CULL_FACE)):l.disable(l.CULL_FACE)};this.setObjectFaces=function(a){if(ha!==a.doubleSided)a.doubleSided?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),ha=a.doubleSided;if(R!==a.flipSided)a.flipSided?l.frontFace(l.CW):l.frontFace(l.CCW),R=a.flipSided};this.setDepthTest=function(a){S!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),S=a)};this.setDepthWrite=function(a){$!==a&&(l.depthMask(a),$=a)};this.setBlending=function(a){if(a!==Z){switch(a){case THREE.NoBlending:l.disable(l.BLEND);
-break;case THREE.AdditiveBlending:l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE);break;case THREE.SubtractiveBlending:l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.ZERO,l.SRC_COLOR);break;default:l.enable(l.BLEND),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)}Z=
-a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=l.createTexture(),E.info.memory.textures++;l.activeTexture(l.TEXTURE0+b);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=z(a.format),f=z(a.type);v(l.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?l.texImage2D(l.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):l.texImage2D(l.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&l.generateMipmap(l.TEXTURE_2D);
-a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else l.activeTexture(l.TEXTURE0+b),l.bindTexture(l.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(void 0===a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=!0;a.__webglTexture=l.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=z(a.format),e=z(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,
-a.__webglTexture);v(l.TEXTURE_CUBE_MAP,a,c);for(c=0;6>c;c++){a.__webglFramebuffer[c]=l.createFramebuffer();a.__webglRenderbuffer[c]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,d,a.width,a.height,0,d,e,null);var f=a,g=l.TEXTURE_CUBE_MAP_POSITIVE_X+c;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[c]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,g,f.__webglTexture,0);t(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=
-l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),v(l.TEXTURE_2D,a,c),l.texImage2D(l.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,d,a.__webglTexture,0),t(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,d=a.width,a=a.height,c=e=0):(b=null,d=ka,a=bb,e=Fa,c=Aa);b!==y&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(e,c,d,a),y=b);jb=d;Va=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+e=["precision "+I+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?
+"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(q,u("fragment",e+l));
+j.attachShader(q,u("vertex",d+k));j.linkProgram(q);j.getProgramParameter(q,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(q,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");q.uniforms={};q.attributes={};var r,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,boneGlobalMatrices,morphTargetInfluences".split(",");for(r in i)d.push(r);r=d;for(d=0,i=r.length;d<i;d++)l=r[d],q.uniforms[l]=j.getUniformLocation(q,
+l);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(r=0;r<c.maxMorphTargets;r++)d.push("morphTarget"+r);for(r=0;r<c.maxMorphNormals;r++)d.push("morphNormal"+r);for(p in b)d.push(p);p=d;for(r=0,b=p.length;r<b;r++)c=p[r],q.attributes[c]=j.getAttribLocation(q,c);q.id=Z.length;Z.push({program:q,code:m});E.info.memory.programs=Z.length;p=q}a.program=p;p=a.program.attributes;0<=p.position&&j.enableVertexAttribArray(p.position);0<=p.color&&j.enableVertexAttribArray(p.color);
+0<=p.normal&&j.enableVertexAttribArray(p.normal);0<=p.tangent&&j.enableVertexAttribArray(p.tangent);a.skinning&&0<=p.skinVertexA&&0<=p.skinVertexB&&0<=p.skinIndex&&0<=p.skinWeight&&(j.enableVertexAttribArray(p.skinVertexA),j.enableVertexAttribArray(p.skinVertexB),j.enableVertexAttribArray(p.skinIndex),j.enableVertexAttribArray(p.skinWeight));if(a.attributes)for(h in a.attributes)void 0!==p[h]&&0<=p[h]&&j.enableVertexAttribArray(p[h]);if(a.morphTargets){a.numSupportedMorphTargets=0;q="morphTarget";
+for(h=0;h<this.maxMorphTargets;h++)r=q+h,0<=p[r]&&(j.enableVertexAttribArray(p[r]),a.numSupportedMorphTargets++)}if(a.morphNormals){a.numSupportedMorphNormals=0;q="morphNormal";for(h=0;h<this.maxMorphNormals;h++)r=q+h,0<=p[r]&&(j.enableVertexAttribArray(p[r]),a.numSupportedMorphNormals++)}a.uniformsList=[];for(g in a.uniforms)a.uniformsList.push([a.uniforms[g],g])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?j.frontFace(j.CCW):j.frontFace(j.CW),"back"===a?j.cullFace(j.BACK):"front"===a?j.cullFace(j.FRONT):
+j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.setObjectFaces=function(a){if(ha!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ha=a.doubleSided;if(R!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),R=a.flipSided};this.setDepthTest=function(a){S!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),S=a)};this.setDepthWrite=function(a){ba!==a&&(j.depthMask(a),ba=a)};this.setBlending=function(a){if(a!==aa){switch(a){case THREE.NoBlending:j.disable(j.BLEND);
+break;case THREE.AdditiveBlending:j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.enable(j.BLEND),j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}aa=
+a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),E.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=z(a.format),f=z(a.type);v(j.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);
+a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(void 0===a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=z(a.format),e=z(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,
+a.__webglTexture);v(j.TEXTURE_CUBE_MAP,a,c);for(c=0;6>c;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,d,a.width,a.height,0,d,e,null);var f=a,g=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,g,f.__webglTexture,0);t(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=
+j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),v(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),t(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:
+a.__webglFramebuffer,d=a.width,a=a.height,c=e=0):(b=null,d=ka,a=bb,e=Fa,c=Aa);b!==y&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(e,c,d,a),y=b);jb=d;Va=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:
 THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!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};
@@ -375,31 +375,31 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,f=Math.max(Math.max(c,d),e),g=Math.min(Math.min(c,d),e);if(g===f)g=c=0;else{var h=f-g,g=h/f,c=(c===f?(d-e)/h:d===f?2+(e-c)/h:4+(c-d)/h)/6;0>c&&(c+=1);1<c&&(c-=1)}void 0===b&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=f;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,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,k=f.faces,j=a.faceVertexUvs[0],p=f.faceVertexUvs[0],m={},o=0;o<a.materials.length;o++)m[a.materials[o].id]=o;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var o=0,q=h.length;o<q;o++){var n=h[o].clone();c&&c.multiplyVector3(n.position);g.push(n)}for(o=0,q=k.length;o<q;o++){var g=
-k[o],r,s,u=g.vertexNormals,v=g.vertexColors;g instanceof THREE.Face3?r=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(r=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));r.normal.copy(g.normal);d&&d.multiplyVector3(r.normal);h=0;for(n=u.length;h<n;h++)s=u[h].clone(),d&&d.multiplyVector3(s),r.vertexNormals.push(s);r.color.copy(g.color);h=0;for(n=v.length;h<n;h++)s=v[h],r.vertexColors.push(s.clone());if(void 0!==g.materialIndex){h=f.materials[g.materialIndex];n=h.id;v=m[n];if(void 0===v)v=a.materials.length,
-m[n]=v,a.materials.push(h);r.materialIndex=v}r.centroid.copy(g.centroid);c&&c.multiplyVector3(r.centroid);i.push(r)}for(o=0,q=p.length;o<q;o++){c=p[o];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++)b.vertices.push(d[a].clone());for(a=0,c=e.length;a<c;a++)b.faces.push(e[a].clone());for(a=0,c=f.length;a<c;a++){for(var d=
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,l=f.faces,k=a.faceVertexUvs[0],p=f.faceVertexUvs[0],n={},o=0;o<a.materials.length;o++)n[a.materials[o].id]=o;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var o=0,q=h.length;o<q;o++){var m=h[o].clone();c&&c.multiplyVector3(m.position);g.push(m)}for(o=0,q=l.length;o<q;o++){var g=
+l[o],r,s,u=g.vertexNormals,v=g.vertexColors;g instanceof THREE.Face3?r=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(r=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));r.normal.copy(g.normal);d&&d.multiplyVector3(r.normal);h=0;for(m=u.length;h<m;h++)s=u[h].clone(),d&&d.multiplyVector3(s),r.vertexNormals.push(s);r.color.copy(g.color);h=0;for(m=v.length;h<m;h++)s=v[h],r.vertexColors.push(s.clone());if(void 0!==g.materialIndex){h=f.materials[g.materialIndex];m=h.id;v=n[m];if(void 0===v)v=a.materials.length,
+n[m]=v,a.materials.push(h);r.materialIndex=v}r.centroid.copy(g.centroid);c&&c.multiplyVector3(r.centroid);i.push(r)}for(o=0,q=p.length;o<q;o++){c=p[o];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++)b.vertices.push(d[a].clone());for(a=0,c=e.length;a<c;a++)b.faces.push(e[a].clone());for(a=0,c=f.length;a<c;a++){for(var d=
 f[a],e=[],g=0,h=d.length;g<h;g++)e.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(e)}return b},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,
 e=b.vertices[a.b].position,f=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;f=b.vertices[a.c].position;var b=b.vertices[a.d].position,g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*
-(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,k=[],j,p,m,o;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3)j=g[d.a].position,p=g[d.b].position,m=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,p,m);else if(d instanceof
-THREE.Face4)j=g[d.a].position,p=g[d.b].position,m=g[d.c].position,o=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,p,o),d._area2=THREE.GeometryUtils.triangleArea(p,m,o),d._area=d._area1+d._area2;i+=d._area;k[e]=i}d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);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*
+(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return l[e]>a?b(c,e-1):l[e]<a?b(e+1,d):e}return b(0,l.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,l=[],k,p,n,o;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3)k=g[d.a].position,p=g[d.b].position,n=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,p,n);else if(d instanceof
+THREE.Face4)k=g[d.a].position,p=g[d.b].position,n=g[d.c].position,o=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,p,o),d._area2=THREE.GeometryUtils.triangleArea(p,n,o),d._area=d._area1+d._area2;i+=d._area;l[e]=i}d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);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=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).setTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++)1!==d[e].u&&(d[e].u-=Math.floor(d[e].u)),1!==d[e].v&&(d[e].v-=Math.floor(d[e].v))},triangulateQuads:function(a){var b,c,d,e,f=[],g=[],h=[];for(b=0,
-c=a.faceUvs.length;b<c;b++)g[b]=[];for(b=0,c=a.faceVertexUvs.length;b<c;b++)h[b]=[];for(b=0,c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){e=d.a;var i=d.b,k=d.c,j=d.d,p=new THREE.Face3,m=new THREE.Face3;p.color.copy(d.color);m.color.copy(d.color);p.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;p.a=e;p.b=i;p.c=j;m.a=i;m.b=k;m.c=j;4===d.vertexColors.length&&(p.vertexColors[0]=d.vertexColors[0].clone(),p.vertexColors[1]=d.vertexColors[1].clone(),p.vertexColors[2]=
-d.vertexColors[3].clone(),m.vertexColors[0]=d.vertexColors[1].clone(),m.vertexColors[1]=d.vertexColors[2].clone(),m.vertexColors[2]=d.vertexColors[3].clone());f.push(p,m);for(d=0,e=a.faceVertexUvs.length;d<e;d++)a.faceVertexUvs[d].length&&(p=a.faceVertexUvs[d][b],i=p[1],k=p[2],j=p[3],p=[p[0].clone(),i.clone(),j.clone()],i=[i.clone(),k.clone(),j.clone()],h[d].push(p,i));for(d=0,e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{f.push(d);for(d=0,e=a.faceUvs.length;d<
-e;d++)g[d].push(a.faceUvs[d]);for(d=0,e=a.faceVertexUvs.length;d<e;d++)h[d].push(a.faceVertexUvs[d])}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],k=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());
-b.push(k.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],b.push(g.clone()),b.push(h.clone()),b.push(i.clone()),f.a=e,f.b=e+1,f.c=e+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,i,k,j,p,m,o,q,n,r,s,u,v,t,w=[],z=[];for(c=0,d=a.faceVertexUvs.length;c<d;c++)z[c]=[];for(c=0,d=a.faces.length;c<d;c++)if(e=a.faces[c],e instanceof THREE.Face3)if(f=e.a,g=e.b,h=e.c,k=a.vertices[f],j=a.vertices[g],p=a.vertices[h],
-o=k.position.distanceTo(j.position),q=j.position.distanceTo(p.position),m=k.position.distanceTo(p.position),o>b||q>b||m>b){i=a.vertices.length;v=e.clone();t=e.clone();o>=q&&o>=m?(k=k.clone(),k.position.lerpSelf(j.position,0.5),v.a=f,v.b=i,v.c=h,t.a=i,t.b=g,t.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),v.vertexNormals[1].copy(f),t.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),
-v.vertexColors[1].copy(f),t.vertexColors[0].copy(f)),e=0):q>=o&&q>=m?(k=j.clone(),k.position.lerpSelf(p.position,0.5),v.a=f,v.b=g,v.c=i,t.a=i,t.b=h,t.c=f,3===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),v.vertexNormals[2].copy(f),t.vertexNormals[0].copy(f),t.vertexNormals[1].copy(e.vertexNormals[2]),t.vertexNormals[2].copy(e.vertexNormals[0])),3===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),v.vertexColors[2].copy(f),
-t.vertexColors[0].copy(f),t.vertexColors[1].copy(e.vertexColors[2]),t.vertexColors[2].copy(e.vertexColors[0])),e=1):(k=k.clone(),k.position.lerpSelf(p.position,0.5),v.a=f,v.b=g,v.c=i,t.a=i,t.b=g,t.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[2],0.5),v.vertexNormals[2].copy(f),t.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[2],0.5),v.vertexColors[2].copy(f),t.vertexColors[0].copy(f)),e=2);w.push(v,
-t);a.vertices.push(k);for(f=0,g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(k=a.faceVertexUvs[f][c],t=k[0],h=k[1],v=k[2],0===e?(j=t.clone(),j.lerpSelf(h,0.5),k=[t.clone(),j.clone(),v.clone()],h=[j.clone(),h.clone(),v.clone()]):1===e?(j=h.clone(),j.lerpSelf(v,0.5),k=[t.clone(),h.clone(),j.clone()],h=[j.clone(),v.clone(),t.clone()]):(j=t.clone(),j.lerpSelf(v,0.5),k=[t.clone(),h.clone(),j.clone()],h=[j.clone(),h.clone(),v.clone()]),z[f].push(k,h))}else{w.push(e);for(f=0,g=a.faceVertexUvs.length;f<
-g;f++)z[f].push(a.faceVertexUvs[f])}else if(f=e.a,g=e.b,h=e.c,i=e.d,k=a.vertices[f],j=a.vertices[g],p=a.vertices[h],m=a.vertices[i],o=k.position.distanceTo(j.position),q=j.position.distanceTo(p.position),n=p.position.distanceTo(m.position),r=k.position.distanceTo(m.position),o>b||q>b||n>b||r>b){s=a.vertices.length;u=a.vertices.length+1;v=e.clone();t=e.clone();o>=q&&o>=n&&o>=r||n>=q&&n>=o&&n>=r?(o=k.clone(),o.position.lerpSelf(j.position,0.5),j=p.clone(),j.position.lerpSelf(m.position,0.5),v.a=f,v.b=
+c=a.faceUvs.length;b<c;b++)g[b]=[];for(b=0,c=a.faceVertexUvs.length;b<c;b++)h[b]=[];for(b=0,c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){e=d.a;var i=d.b,l=d.c,k=d.d,p=new THREE.Face3,n=new THREE.Face3;p.color.copy(d.color);n.color.copy(d.color);p.materialIndex=d.materialIndex;n.materialIndex=d.materialIndex;p.a=e;p.b=i;p.c=k;n.a=i;n.b=l;n.c=k;4===d.vertexColors.length&&(p.vertexColors[0]=d.vertexColors[0].clone(),p.vertexColors[1]=d.vertexColors[1].clone(),p.vertexColors[2]=
+d.vertexColors[3].clone(),n.vertexColors[0]=d.vertexColors[1].clone(),n.vertexColors[1]=d.vertexColors[2].clone(),n.vertexColors[2]=d.vertexColors[3].clone());f.push(p,n);for(d=0,e=a.faceVertexUvs.length;d<e;d++)a.faceVertexUvs[d].length&&(p=a.faceVertexUvs[d][b],i=p[1],l=p[2],k=p[3],p=[p[0].clone(),i.clone(),k.clone()],i=[i.clone(),l.clone(),k.clone()],h[d].push(p,i));for(d=0,e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{f.push(d);for(d=0,e=a.faceUvs.length;d<
+e;d++)g[d].push(a.faceUvs[d]);for(d=0,e=a.faceVertexUvs.length;d<e;d++)h[d].push(a.faceVertexUvs[d])}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],l=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());
+b.push(l.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],b.push(g.clone()),b.push(h.clone()),b.push(i.clone()),f.a=e,f.b=e+1,f.c=e+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,i,l,k,p,n,o,q,m,r,s,u,v,t,w=[],z=[];for(c=0,d=a.faceVertexUvs.length;c<d;c++)z[c]=[];for(c=0,d=a.faces.length;c<d;c++)if(e=a.faces[c],e instanceof THREE.Face3)if(f=e.a,g=e.b,h=e.c,l=a.vertices[f],k=a.vertices[g],p=a.vertices[h],
+o=l.position.distanceTo(k.position),q=k.position.distanceTo(p.position),n=l.position.distanceTo(p.position),o>b||q>b||n>b){i=a.vertices.length;v=e.clone();t=e.clone();o>=q&&o>=n?(l=l.clone(),l.position.lerpSelf(k.position,0.5),v.a=f,v.b=i,v.c=h,t.a=i,t.b=g,t.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),v.vertexNormals[1].copy(f),t.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),
+v.vertexColors[1].copy(f),t.vertexColors[0].copy(f)),e=0):q>=o&&q>=n?(l=k.clone(),l.position.lerpSelf(p.position,0.5),v.a=f,v.b=g,v.c=i,t.a=i,t.b=h,t.c=f,3===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),v.vertexNormals[2].copy(f),t.vertexNormals[0].copy(f),t.vertexNormals[1].copy(e.vertexNormals[2]),t.vertexNormals[2].copy(e.vertexNormals[0])),3===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),v.vertexColors[2].copy(f),
+t.vertexColors[0].copy(f),t.vertexColors[1].copy(e.vertexColors[2]),t.vertexColors[2].copy(e.vertexColors[0])),e=1):(l=l.clone(),l.position.lerpSelf(p.position,0.5),v.a=f,v.b=g,v.c=i,t.a=i,t.b=g,t.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[2],0.5),v.vertexNormals[2].copy(f),t.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[2],0.5),v.vertexColors[2].copy(f),t.vertexColors[0].copy(f)),e=2);w.push(v,
+t);a.vertices.push(l);for(f=0,g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(l=a.faceVertexUvs[f][c],t=l[0],h=l[1],v=l[2],0===e?(k=t.clone(),k.lerpSelf(h,0.5),l=[t.clone(),k.clone(),v.clone()],h=[k.clone(),h.clone(),v.clone()]):1===e?(k=h.clone(),k.lerpSelf(v,0.5),l=[t.clone(),h.clone(),k.clone()],h=[k.clone(),v.clone(),t.clone()]):(k=t.clone(),k.lerpSelf(v,0.5),l=[t.clone(),h.clone(),k.clone()],h=[k.clone(),h.clone(),v.clone()]),z[f].push(l,h))}else{w.push(e);for(f=0,g=a.faceVertexUvs.length;f<
+g;f++)z[f].push(a.faceVertexUvs[f])}else if(f=e.a,g=e.b,h=e.c,i=e.d,l=a.vertices[f],k=a.vertices[g],p=a.vertices[h],n=a.vertices[i],o=l.position.distanceTo(k.position),q=k.position.distanceTo(p.position),m=p.position.distanceTo(n.position),r=l.position.distanceTo(n.position),o>b||q>b||m>b||r>b){s=a.vertices.length;u=a.vertices.length+1;v=e.clone();t=e.clone();o>=q&&o>=m&&o>=r||m>=q&&m>=o&&m>=r?(o=l.clone(),o.position.lerpSelf(k.position,0.5),k=p.clone(),k.position.lerpSelf(n.position,0.5),v.a=f,v.b=
 s,v.c=u,v.d=i,t.a=s,t.b=g,t.c=h,t.d=u,4===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),g=e.vertexNormals[2].clone(),g.lerpSelf(e.vertexNormals[3],0.5),v.vertexNormals[1].copy(f),v.vertexNormals[2].copy(g),t.vertexNormals[0].copy(f),t.vertexNormals[3].copy(g)),4===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),g=e.vertexColors[2].clone(),g.lerpSelf(e.vertexColors[3],0.5),v.vertexColors[1].copy(f),v.vertexColors[2].copy(g),
-t.vertexColors[0].copy(f),t.vertexColors[3].copy(g)),e=0):(o=j.clone(),o.position.lerpSelf(p.position,0.5),j=m.clone(),j.position.lerpSelf(k.position,0.5),v.a=f,v.b=g,v.c=s,v.d=u,t.a=u,t.b=s,t.c=h,t.d=i,4===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),g=e.vertexNormals[3].clone(),g.lerpSelf(e.vertexNormals[0],0.5),v.vertexNormals[2].copy(f),v.vertexNormals[3].copy(g),t.vertexNormals[0].copy(g),t.vertexNormals[1].copy(f)),4===e.vertexColors.length&&(f=e.vertexColors[1].clone(),
-f.lerpSelf(e.vertexColors[2],0.5),g=e.vertexColors[3].clone(),g.lerpSelf(e.vertexColors[0],0.5),v.vertexColors[2].copy(f),v.vertexColors[3].copy(g),t.vertexColors[0].copy(g),t.vertexColors[1].copy(f)),e=1);w.push(v,t);a.vertices.push(o,j);for(f=0,g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(k=a.faceVertexUvs[f][c],t=k[0],h=k[1],v=k[2],k=k[3],0===e?(j=t.clone(),j.lerpSelf(h,0.5),p=v.clone(),p.lerpSelf(k,0.5),t=[t.clone(),j.clone(),p.clone(),k.clone()],h=[j.clone(),h.clone(),v.clone(),
-p.clone()]):(j=h.clone(),j.lerpSelf(v,0.5),p=k.clone(),p.lerpSelf(t,0.5),t=[t.clone(),h.clone(),j.clone(),p.clone()],h=[p.clone(),j.clone(),v.clone(),k.clone()]),z[f].push(t,h))}else{w.push(e);for(f=0,g=a.faceVertexUvs.length;f<g;f++)z[f].push(a.faceVertexUvs[f])}a.faces=w;a.faceVertexUvs=z}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+t.vertexColors[0].copy(f),t.vertexColors[3].copy(g)),e=0):(o=k.clone(),o.position.lerpSelf(p.position,0.5),k=n.clone(),k.position.lerpSelf(l.position,0.5),v.a=f,v.b=g,v.c=s,v.d=u,t.a=u,t.b=s,t.c=h,t.d=i,4===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),g=e.vertexNormals[3].clone(),g.lerpSelf(e.vertexNormals[0],0.5),v.vertexNormals[2].copy(f),v.vertexNormals[3].copy(g),t.vertexNormals[0].copy(g),t.vertexNormals[1].copy(f)),4===e.vertexColors.length&&(f=e.vertexColors[1].clone(),
+f.lerpSelf(e.vertexColors[2],0.5),g=e.vertexColors[3].clone(),g.lerpSelf(e.vertexColors[0],0.5),v.vertexColors[2].copy(f),v.vertexColors[3].copy(g),t.vertexColors[0].copy(g),t.vertexColors[1].copy(f)),e=1);w.push(v,t);a.vertices.push(o,k);for(f=0,g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(l=a.faceVertexUvs[f][c],t=l[0],h=l[1],v=l[2],l=l[3],0===e?(k=t.clone(),k.lerpSelf(h,0.5),p=v.clone(),p.lerpSelf(l,0.5),t=[t.clone(),k.clone(),p.clone(),l.clone()],h=[k.clone(),h.clone(),v.clone(),
+p.clone()]):(k=h.clone(),k.lerpSelf(v,0.5),p=l.clone(),p.lerpSelf(t,0.5),t=[t.clone(),h.clone(),k.clone(),p.clone()],h=[p.clone(),k.clone(),v.clone(),l.clone()]),z[f].push(t,h))}else{w.push(e);for(f=0,g=a.faceVertexUvs.length;f<g;f++)z[f].push(a.faceVertexUvs[f])}a.faces=w;a.faceVertexUvs=z}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={crossOrigin:"anonymous",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=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)f.needsUpdate=!0;c&&c(this)},e[b].crossOrigin=this.crossOrigin,e[b].src=a[b];return f},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=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),k=i.data,j=0;j<d;j++)for(var p=1;p<e;p++){var m=0>p-1?e-1:p-1,o=(p+1)%e,q=0>j-1?d-1:j-1,n=(j+1)%d,r=[],s=[0,0,h[4*(p*d+j)]/255*b];r.push([-1,0,h[4*(p*d+q)]/255*b]);r.push([-1,-1,h[4*(m*d+q)]/255*b]);r.push([0,-1,
-h[4*(m*d+j)]/255*b]);r.push([1,-1,h[4*(m*d+n)]/255*b]);r.push([1,0,h[4*(p*d+n)]/255*b]);r.push([1,1,h[4*(o*d+n)]/255*b]);r.push([0,1,h[4*(o*d+j)]/255*b]);r.push([-1,1,h[4*(o*d+q)]/255*b]);m=[];q=r.length;for(o=0;o<q;o++){var n=r[o],u=r[(o+1)%q],n=[n[0]-s[0],n[1]-s[1],n[2]-s[2]],u=[u[0]-s[0],u[1]-s[1],u[2]-s[2]];m.push(c([n[1]*u[2]-n[2]*u[1],n[2]*u[0]-n[0]*u[2],n[0]*u[1]-n[1]*u[0]]))}r=[0,0,0];for(o=0;o<m.length;o++)r[0]+=m[o][0],r[1]+=m[o][1],r[2]+=m[o][2];r[0]/=m.length;r[1]/=m.length;r[2]/=m.length;
-s=4*(p*d+j);k[s]=255*((r[0]+1)/2)|0;k[s+1]=255*(r[1]+0.5)|0;k[s+2]=255*r[2]|0;k[s+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return 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=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),l=i.data,k=0;k<d;k++)for(var p=1;p<e;p++){var n=0>p-1?e-1:p-1,o=(p+1)%e,q=0>k-1?d-1:k-1,m=(k+1)%d,r=[],s=[0,0,h[4*(p*d+k)]/255*b];r.push([-1,0,h[4*(p*d+q)]/255*b]);r.push([-1,-1,h[4*(n*d+q)]/255*b]);r.push([0,-1,
+h[4*(n*d+k)]/255*b]);r.push([1,-1,h[4*(n*d+m)]/255*b]);r.push([1,0,h[4*(p*d+m)]/255*b]);r.push([1,1,h[4*(o*d+m)]/255*b]);r.push([0,1,h[4*(o*d+k)]/255*b]);r.push([-1,1,h[4*(o*d+q)]/255*b]);n=[];q=r.length;for(o=0;o<q;o++){var m=r[o],u=r[(o+1)%q],m=[m[0]-s[0],m[1]-s[1],m[2]-s[2]],u=[u[0]-s[0],u[1]-s[1],u[2]-s[2]];n.push(c([m[1]*u[2]-m[2]*u[1],m[2]*u[0]-m[0]*u[2],m[0]*u[1]-m[1]*u[0]]))}r=[0,0,0];for(o=0;o<n.length;o++)r[0]+=n[o][0],r[1]+=n[o][1],r[2]+=n[o][2];r[0]/=n.length;r[1]/=n.length;r[2]/=n.length;
+s=4*(p*d+k);l[s]=255*((r[0]+1)/2)|0;l[s+1]=255*(r[1]+0.5)|0;l[s+2]=255*r[2]|0;l[s+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
 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 f=new THREE.Mesh(a,b[c]);e.add(f)}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,
@@ -451,37 +451,37 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.s
 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,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1],h=new THREE.ArcCurve(h.x+a,h.y+b,c,d,e,f);this.curves.push(h);h=h.getPoint(f?1:0);g.push(h.x);g.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:g})};
 THREE.Path.prototype.absarc=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=new THREE.ArcCurve(a,b,c,d,e,f);this.curves.push(h);h=h.getPoint(f?1:0);g.push(h.x);g.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:g})};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,f,g,h,i,k,j,p,m,o,q,n;for(d=0,e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];p=f[0];m=f[1];0<c.length?(g=c[c.length-1],o=g.x,q=g.y):(g=this.actions[d-1].args,o=g[g.length-2],q=g[g.length-1]);for(f=1;f<=
-a;f++)n=f/a,g=THREE.Shape.Utils.b2(n,o,p,h),n=THREE.Shape.Utils.b2(n,q,m,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];p=f[0];m=f[1];k=f[2];j=f[3];0<c.length?(g=c[c.length-1],o=g.x,q=g.y):(g=this.actions[d-1].args,o=g[g.length-2],q=g[g.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b3(n,o,p,k,h),n=THREE.Shape.Utils.b3(n,q,m,j,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;n=[new THREE.Vector2(g[g.length-
-2],g[g.length-1])];g=a*f[0].length;n=n.concat(f[0]);n=new THREE.SplineCurve(n);for(f=1;f<=g;f++)c.push(n.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];k=f[2];p=f[3];m=!!f[5];j=f[4]-p;o=2*a;for(f=1;f<=o;f++)n=f/o,m||(n=1-n),n=p+n*j,g=h+k*Math.cos(n),n=i+k*Math.sin(n),c.push(new THREE.Vector2(g,n))}d=c[c.length-1];1.0E-10>Math.abs(d.x-c[0].x)&&1.0E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);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,f){var g=this.getPoints(),h,i,k,j,p;for(h=0,i=g.length;h<i;h++)k=g[h],j=k.x,p=k.y,k.x=a*j+b*p+c,k.y=d*p+e*j+f;return g};
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,f,g,h,i,l,k,p,n,o,q,m;for(d=0,e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];p=f[0];n=f[1];0<c.length?(g=c[c.length-1],o=g.x,q=g.y):(g=this.actions[d-1].args,o=g[g.length-2],q=g[g.length-1]);for(f=1;f<=
+a;f++)m=f/a,g=THREE.Shape.Utils.b2(m,o,p,h),m=THREE.Shape.Utils.b2(m,q,n,i),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];p=f[0];n=f[1];l=f[2];k=f[3];0<c.length?(g=c[c.length-1],o=g.x,q=g.y):(g=this.actions[d-1].args,o=g[g.length-2],q=g[g.length-1]);for(f=1;f<=a;f++)m=f/a,g=THREE.Shape.Utils.b3(m,o,p,l,h),m=THREE.Shape.Utils.b3(m,q,n,k,i),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;m=[new THREE.Vector2(g[g.length-
+2],g[g.length-1])];g=a*f[0].length;m=m.concat(f[0]);m=new THREE.SplineCurve(m);for(f=1;f<=g;f++)c.push(m.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];l=f[2];p=f[3];n=!!f[5];k=f[4]-p;o=2*a;for(f=1;f<=o;f++)m=f/o,n||(m=1-m),m=p+m*k,g=h+l*Math.cos(m),m=i+l*Math.sin(m),c.push(new THREE.Vector2(g,m))}d=c[c.length-1];1.0E-10>Math.abs(d.x-c[0].x)&&1.0E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);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,f){var g=this.getPoints(),h,i,l,k,p;for(h=0,i=g.length;h<i;h++)l=g[h],k=l.x,p=l.y,l.x=a*k+b*p+c,l.y=d*p+e*k+f;return g};
 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;for(a=0,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();for(a=0,c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,2*Math.PI,!1),b.stroke(),b.closePath()};
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;for(a=0,b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&0!=f.actions.length&&(e.push(f),f=new THREE.Path),f[c].apply(f,d);0!=f.actions.length&&e.push(f);if(0==e.length)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(1==e.length)return f=e[0],g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves,d.push(g),d;if(a){g=new THREE.Shape;for(a=0,b=e.length;a<
 b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g.actions=f.actions,g.curves=f.curves,d.push(g),g=new THREE.Shape):g.holes.push(f)}else{for(a=0,b=e.length;a<b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g&&d.push(g),g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves):g.holes.push(f);d.push(g)}return d};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,f,g,h,i,k,j,p,m,o,q=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){m=k[e];o=[];for(p=0;p<c.length;p++)j=c[p],j=m.distanceToSquared(j),o.push(j),j<f&&(f=j,g=e,h=p)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:k.length-1;var n=[k[g],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(n);var r=[k[g],k[f],c[h]];m=THREE.FontUtils.Triangulate.area(r);o=h;j=g;h+=1;g+=-1;0>
-h&&(h+=c.length);h%=c.length;0>g&&(g+=k.length);g%=k.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:k.length-1;n=[k[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);r=[k[g],k[f],c[h]];r=THREE.FontUtils.Triangulate.area(r);p+m>n+r&&(h=o,g=j,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=k.length),g%=k.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:k.length-1);p=c.slice(0,h);m=c.slice(h);o=k.slice(g);j=k.slice(0,g);f=[k[g],k[f],c[h]];q.push([k[g],c[h],c[e]]);q.push(f);c=p.concat(o).concat(j).concat(m)}return{shape:c,
-isolatedPts:q,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,i,k={};for(f=0,g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,void 0!==k[i]&&console.log("Duplicate point",i),k[i]=f;for(f=0,g=c.length;f<g;f++){h=c[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}for(f=0,g=e.length;f<g;f++){h=e[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=k[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,l,k,p,n,o,q=[];for(i=0;i<b.length;i++){l=b[i];Array.prototype.push.apply(d,l);f=Number.POSITIVE_INFINITY;for(e=0;e<l.length;e++){n=l[e];o=[];for(p=0;p<c.length;p++)k=c[p],k=n.distanceToSquared(k),o.push(k),k<f&&(f=k,g=e,h=p)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:l.length-1;var m=[l[g],c[h],c[e]];p=THREE.FontUtils.Triangulate.area(m);var r=[l[g],l[f],c[h]];n=THREE.FontUtils.Triangulate.area(r);o=h;k=g;h+=1;g+=-1;0>
+h&&(h+=c.length);h%=c.length;0>g&&(g+=l.length);g%=l.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:l.length-1;m=[l[g],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);r=[l[g],l[f],c[h]];r=THREE.FontUtils.Triangulate.area(r);p+n>m+r&&(h=o,g=k,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=l.length),g%=l.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:l.length-1);p=c.slice(0,h);n=c.slice(h);o=l.slice(g);k=l.slice(0,g);f=[l[g],l[f],c[h]];q.push([l[g],c[h],c[e]]);q.push(f);c=p.concat(o).concat(k).concat(n)}return{shape:c,
+isolatedPts:q,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,i,l={};for(f=0,g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,void 0!==l[i]&&console.log("Duplicate point",i),l[i]=f;for(f=0,g=c.length;f<g;f++){h=c[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=l[i],void 0!==i&&(h[d]=i)}for(f=0,g=e.length;f<g;f++){h=e[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=l[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
 isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},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){b=b||this.parameters;this.text=a;var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
 THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){-1===a.indexOf(b)&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);-1!==b&&a.splice(b,1)},add:function(a){void 0!==b[a.name]&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(!0!==a.initialized){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(0>a.hierarchy[c].keys[d].time)a.hierarchy[c].keys[d].time=
-0;if(void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var k=a.hierarchy[c].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var j=
-{};for(k in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===k){j[k]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(j[k]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=j}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
+0;if(void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var l=a.hierarchy[c].keys[d].morphTargets[i];h[l]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k=
+{};for(l in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===l){k[l]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(k[l]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if("string"===typeof a){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=
 1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=void 0!==c?c:THREE.AnimationHandler.LINEAR;this.JITCompile=void 0!==d?d:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(void 0===e.animationCache)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
 THREE.Bone?e.skinMatrix:e.matrix;var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.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(void 0!==this.hierarchy[a].animationCache)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,f,g,h,i,k,j=this.data.JIT.hierarchy,p,m;m=this.currentTime+=a*this.timeScale;p=this.currentTime%=this.data.length;k=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,q=this.hierarchy.length;o<q;o++)if(a=this.hierarchy[o],i=a.animationCache,this.JITCompile&&void 0!==j[o][k])a instanceof THREE.Bone?(a.skinMatrix=j[o][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
-j[o][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var n=0;3>n;n++){c=b[n];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=m){if(p<m)if(this.loop){g=this.data.hierarchy[o].keys[0];for(h=this.getNextKeyWith(c,o,1);h.time<p;)g=h,h=this.getNextKeyWith(c,o,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,o,h.index+1);while(h.time<p)}i.prevKey[c]=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,l,k=this.data.JIT.hierarchy,p,n;n=this.currentTime+=a*this.timeScale;p=this.currentTime%=this.data.length;l=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,q=this.hierarchy.length;o<q;o++)if(a=this.hierarchy[o],i=a.animationCache,this.JITCompile&&void 0!==k[o][l])a instanceof THREE.Bone?(a.skinMatrix=k[o][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
+k[o][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;3>m;m++){c=b[m];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=n){if(p<n)if(this.loop){g=this.data.hierarchy[o].keys[0];for(h=this.getNextKeyWith(c,o,1);h.time<p;)g=h,h=this.getNextKeyWith(c,o,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,o,h.index+1);while(h.time<p)}i.prevKey[c]=
 g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(p-g.time)/(h.time-g.time);e=g[c];f=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",o,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",o,h.index+1).pos,d=0.33*d+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,1.01*d),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("rot"===
-c)THREE.Quaternion.slerp(e,f,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d}}if(this.JITCompile&&void 0===j[0][k]){this.hierarchy[0].updateMatrixWorld(!0);for(o=0;o<this.hierarchy.length;o++)j[o][k]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,k;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],k[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],k[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],k[2],e,c,g);return d};
+c)THREE.Quaternion.slerp(e,f,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d}}if(this.JITCompile&&void 0===k[0][l]){this.hierarchy[0].updateMatrixWorld(!0);for(o=0;o<this.hierarchy.length;o++)k[o][l]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,l;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];l=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],l[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],l[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],l[2],e,c,g);return d};
 THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=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<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])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?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};
 THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
@@ -489,9 +489,9 @@ d.matrixWorldNeedsUpdate=!0}}};
 THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++){e=this.hierarchy[c];f=this.data.hierarchy[c];e.useQuaternion=!0;if(void 0===f.animationCache)f.animationCache={},f.animationCache.prevKey=null,f.animationCache.nextKey=null,f.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:
 e.matrix;e=this.data.hierarchy[c].keys;if(e.length)f.animationCache.prevKey=e[0],f.animationCache.nextKey=e[1],this.startTime=Math.min(e[0].time,this.startTime),this.endTime=Math.max(e[e.length-1].time,this.endTime)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(void 0!==c.animationCache){var d=c.animationCache.originalMatrix;b instanceof THREE.Bone?(d.copy(b.skinMatrix),b.skinMatrix=d):(d.copy(b.matrix),b.matrix=d);delete c.animationCache}}};
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var j=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=j.length-1;e=this.hierarchy[a];if(j.length){for(j=
-0;j<f.length;j++)g=f[j],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(k=this.hierarchy.length;a<k;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var j=b.keys,p=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(j.length){if(this.JITCompile&&p)d instanceof
-THREE.Bone?d.skinMatrix=p.originalMatrix:d.matrix=p.originalMatrix;b=p.prevKey;c=p.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=j[0];for(c=j[1];c.time<g;)b=c,c=j[b.index+1]}else if(!i)for(var m=j.length-1;c.time<g&&c.index!==m;)b=c,c=j[b.index+1];p.prevKey=b;p.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,l=this.hierarchy.length;a<l;a++){var k=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=k.length-1;e=this.hierarchy[a];if(k.length){for(k=
+0;k<f.length;k++)g=f[k],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(l=this.hierarchy.length;a<l;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,p=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(k.length){if(this.JITCompile&&p)d instanceof
+THREE.Bone?d.skinMatrix=p.originalMatrix:d.matrix=p.originalMatrix;b=p.prevKey;c=p.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=k[0];for(c=k[1];c.time<g;)b=c,c=k[b.index+1]}else if(!i)for(var n=k.length-1;c.time<g&&c.index!==n;)b=c,c=k[b.index+1];p.prevKey=b;p.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=
 this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
 THREE.CubeCamera=function(a,b,c,d){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
 this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
@@ -529,72 +529,72 @@ 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=void 0!==b?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,f=new THREE.Matrix4,g=!1,h=1,i=0,k=0,j=0,p=0,m=0,o=window.innerWidth/2,q=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
-this.rotateHorizontally(b*p);this.rotateVertically(b*m)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*k);this.object.translateY(b*j);g&&(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=void 0!==b?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,f=new THREE.Matrix4,g=!1,h=1,i=0,l=0,k=0,p=0,n=0,o=window.innerWidth/2,q=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
+this.rotateHorizontally(b*p);this.rotateVertically(b*n)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*l);this.object.translateY(b*k);g&&(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;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){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-o)/window.innerWidth;m=(a.clientY-q)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
-function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:g=!0;h=1;break;case 69:g=!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:g=!1;break;case 69:g=!1;break;case 82:j=0;break;case 70:j=0}},!1)};
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-o)/window.innerWidth;n=(a.clientY-q)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
+function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:l=-1;break;case 40:case 83:i=-1;break;case 39:case 68:l=1;break;case 81:g=!0;h=1;break;case 69:g=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:l=0;break;case 40:case 83:i=0;break;case 39:case 68:l=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
 THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=void 0!==b?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;var d=new THREE.Vector3,e=!1,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,p=new THREE.Vector2,m=new THREE.Vector2,o={type:"change"};this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
+new THREE.Vector3;var d=new THREE.Vector3,e=!1,f=-1,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector2,k=new THREE.Vector2,p=new THREE.Vector2,n=new THREE.Vector2,o={type:"change"};this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
 0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*c.screen.height+c.screen.offsetTop-b)/c.radius,0),e=d.length();1<e?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.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=a*c.rotateSpeed;
-d.setFromAxisAngle(b,-a);d.multiplyVector3(g);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;1!==a&&0<a&&(g.multiplyScalar(a),c.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=m.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.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=m:p.addSelf(a.sub(m,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),g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))};this.update=function(){g.copy(c.object.position).subSelf(c.target);
-c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);0<d.distanceTo(c.object.position)&&(c.dispatchEvent(o),d.copy(c.object.position))};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=m=c.getMouseOnScreen(a.clientX,
-a.clientY),e=!1),-1!==f&&(0===f&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):2===f&&!c.noPan&&(m=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===f))f=a.button,0===f&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?k=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=m=
+d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-l.y)*c.zoomSpeed;1!==a&&0<a&&(g.multiplyScalar(a),c.staticMoving?l=k:l.y+=(k.y-l.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=n.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.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=n:p.addSelf(a.sub(n,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),g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))};this.update=function(){g.copy(c.object.position).subSelf(c.target);
+c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);0<d.distanceTo(c.object.position)&&(c.dispatchEvent(o),d.copy(c.object.position))};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),l=k=c.getMouseOnScreen(a.clientX,a.clientY),p=n=c.getMouseOnScreen(a.clientX,
+a.clientY),e=!1),-1!==f&&(0===f&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):2===f&&!c.noPan&&(n=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===f))f=a.button,0===f&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?l=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=n=
 c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),f=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&-1===f&&(a.keyCode===c.keys[0]&&!c.noRotate?f=0:a.keyCode===c.keys[1]&&!c.noZoom?f=1:a.keyCode===c.keys[2]&&!c.noPan&&(f=2),-1!==f&&(e=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&-1!==f&&(f=-1)},!1)};
-THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,j,m){var n,o=d||1,p=e||1,q=h/2,r=i/2,s=k.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",p=f||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",o=f||1;var l=o+1,u=p+1,v=h/o,y=i/p,T=new THREE.Vector3;T[n]=0<j?1:-1;for(h=0;h<u;h++)for(i=0;i<l;i++){var P=new THREE.Vector3;P[a]=(i*v-q)*c;P[b]=(h*y-r)*g;P[n]=j;k.vertices.push(new THREE.Vertex(P))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
-new THREE.Face4(i+l*h+s,i+l*(h+1)+s,i+1+l*(h+1)+s,i+1+l*h+s),a.normal.copy(T),a.vertexNormals.push(T.clone(),T.clone(),T.clone(),T.clone()),a.materialIndex=m,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,m=c/2,o,q,n,r,s,u;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;6>o;o++)this.materials.push(g)}o=0;r=1;q=2;s=
-3;n=4;u=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var v in h)void 0!==this.sides[v]&&(this.sides[v]=h[v]);this.sides.px&&i("z","y",-1,-1,c,b,j,o);this.sides.nx&&i("z","y",1,-1,c,b,-j,r);this.sides.py&&i("x","z",1,1,a,c,p,q);this.sides.ny&&i("x","z",1,-1,a,c,-p,s);this.sides.pz&&i("x","y",1,-1,a,b,m,n);this.sides.nz&&i("x","y",-1,-1,a,b,-m,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,m,i,k){var n,o=d||1,p=e||1,q=h/2,r=m/2,s=l.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",p=f||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",o=f||1;var j=o+1,u=p+1,v=h/o,y=m/p,U=new THREE.Vector3;U[n]=0<i?1:-1;for(h=0;h<u;h++)for(m=0;m<j;m++){var P=new THREE.Vector3;P[a]=(m*v-q)*c;P[b]=(h*y-r)*g;P[n]=i;l.vertices.push(new THREE.Vertex(P))}for(h=0;h<p;h++)for(m=0;m<o;m++)a=
+new THREE.Face4(m+j*h+s,m+j*(h+1)+s,m+1+j*(h+1)+s,m+1+j*h+s),a.normal.copy(U),a.vertexNormals.push(U.clone(),U.clone(),U.clone(),U.clone()),a.materialIndex=k,l.faces.push(a),l.faceVertexUvs[0].push([new THREE.UV(m/o,h/p),new THREE.UV(m/o,(h+1)/p),new THREE.UV((m+1)/o,(h+1)/p),new THREE.UV((m+1)/o,h/p)])}THREE.Geometry.call(this);var l=this,k=a/2,p=b/2,n=c/2,o,q,m,r,s,u;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;6>o;o++)this.materials.push(g)}o=0;r=1;q=2;s=
+3;m=4;u=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var v in h)void 0!==this.sides[v]&&(this.sides[v]=h[v]);this.sides.px&&i("z","y",-1,-1,c,b,k,o);this.sides.nx&&i("z","y",1,-1,c,b,-k,r);this.sides.py&&i("x","z",1,1,a,c,p,q);this.sides.ny&&i("x","z",1,-1,a,c,-p,s);this.sides.pz&&i("x","y",1,-1,a,b,n,m);this.sides.nz&&i("x","y",-1,-1,a,b,-n,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,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,k=[],j=[];for(i=0;i<=e;i++){var p=[],m=[],o=i/e,q=o*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,r=q*Math.sin(2*n*Math.PI),s=-o*c+g,u=q*Math.cos(2*n*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(r,s,u)));p.push(this.vertices.length-1);m.push(new THREE.UV(n,o))}k.push(p);j.push(m)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=k[i][h],p=k[i+1][h],
-m=k[i+1][h+1],o=k[i][h+1],q=this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[p].position.clone().setY(0).normalize(),r=this.vertices[m].position.clone().setY(0).normalize(),s=this.vertices[o].position.clone().setY(0).normalize(),u=j[i][h].clone(),v=j[i+1][h].clone(),t=j[i+1][h+1].clone(),w=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,p,m,o,[q,n,r,s]));this.faceVertexUvs[0].push([u,v,t,w])}if(!f&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
-0;h<d;h++)c=k[0][h],p=k[0][h+1],m=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=j[0][h].clone(),v=j[0][h+1].clone(),t=new THREE.UV(v.u,0),this.faces.push(new THREE.Face3(c,p,m,[q,n,r])),this.faceVertexUvs[0].push([u,v,t])}if(!f&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=k[i][h+1],p=k[i][h],m=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=j[i][h+1].clone(),v=j[i][h].clone(),t=new THREE.UV(v.u,1),this.faces.push(new THREE.Face3(c,p,m,[q,n,r])),this.faceVertexUvs[0].push([u,v,t])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,l=[],k=[];for(i=0;i<=e;i++){var p=[],n=[],o=i/e,q=o*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,r=q*Math.sin(2*m*Math.PI),s=-o*c+g,u=q*Math.cos(2*m*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(r,s,u)));p.push(this.vertices.length-1);n.push(new THREE.UV(m,o))}l.push(p);k.push(n)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=l[i][h],p=l[i+1][h],
+n=l[i+1][h+1],o=l[i][h+1],q=this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[p].position.clone().setY(0).normalize(),r=this.vertices[n].position.clone().setY(0).normalize(),s=this.vertices[o].position.clone().setY(0).normalize(),u=k[i][h].clone(),v=k[i+1][h].clone(),t=k[i+1][h+1].clone(),w=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,p,n,o,[q,m,r,s]));this.faceVertexUvs[0].push([u,v,t,w])}if(!f&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
+0;h<d;h++)c=l[0][h],p=l[0][h+1],n=this.vertices.length-1,q=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),u=k[0][h].clone(),v=k[0][h+1].clone(),t=new THREE.UV(v.u,0),this.faces.push(new THREE.Face3(c,p,n,[q,m,r])),this.faceVertexUvs[0].push([u,v,t])}if(!f&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=l[i][h+1],p=l[i][h],n=this.vertices.length-1,q=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,
+0),u=k[i][h+1].clone(),v=k[i][h].clone(),t=new THREE.UV(v.u,1),this.faces.push(new THREE.Face3(c,p,n,[q,m,r])),this.faceVertexUvs[0].push([u,v,t])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,b){if("undefined"!==typeof a)THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
-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);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(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+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(y=c.length;0<=--y;){e=y;f=y-1;0>f&&(f=c.length-1);
-for(var g=0,h=o+2*j,g=0;g<h;g++){var i=l*g,k=l*(g+1),m=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,m=m+D,i=i+D,n=n+D,k=k+D;C.faces.push(new THREE.Face4(m,i,n,k,null,null,t));m=P.generateSideWallUV(C,a,p,b,m,i,n,k,q,r);C.faceVertexUvs[0].push(m)}}}function f(a,b,c){C.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(c,d,e,f){c+=D;d+=D;e+=D;C.faces.push(new THREE.Face3(c,d,e,null,null,v));c=f?P.generateBottomUV(C,a,b,c,d,e):P.generateTopUV(C,a,b,c,d,e);C.faceVertexUvs[0].push(c)}var h=
-void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,j=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,o=void 0!==b.steps?b.steps:1,q=b.bendPath,n=b.extrudePath,r,s=!1,u=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,v=b.material,t=b.extrudeMaterial;if(n)r=n.getPoints(m),o=r.length,s=!0,p=!1;p||(k=i=j=0);var w,z,F,C=this,D=this.vertices.length;q&&a.addWrapPath(q);
-var q=u?a.extractAllSpacedPoints(m):a.extractAllPoints(m),m=q.shape,I=q.holes;if(q=!THREE.Shape.Utils.isClockWise(m)){m=m.reverse();for(z=0,F=I.length;z<F;z++)w=I[z],THREE.Shape.Utils.isClockWise(w)&&(I[z]=w.reverse());q=!1}var K=THREE.Shape.Utils.triangulateShape(m,I),O=m;for(z=0,F=I.length;z<F;z++)w=I[z],m=m.concat(w);var Q,L,B,N,E,l=m.length,Y,G=K.length,q=[],y=0;B=O.length;Q=B-1;for(L=y+1;y<B;y++,Q++,L++)Q===B&&(Q=0),L===B&&(L=0),q[y]=d(O[y],O[Q],O[L]);var n=[],T,u=q.concat();for(z=0,F=I.length;z<
-F;z++){w=I[z];T=[];for(y=0,B=w.length,Q=B-1,L=y+1;y<B;y++,Q++,L++)Q===B&&(Q=0),L===B&&(L=0),T[y]=d(w[y],w[Q],w[L]);n.push(T);u=u.concat(T)}for(Q=0;Q<j;Q++){B=Q/j;N=i*(1-B);L=k*Math.sin(B*Math.PI/2);for(y=0,B=O.length;y<B;y++)E=c(O[y],q[y],L),f(E.x,E.y,-N);for(z=0,F=I.length;z<F;z++){w=I[z];T=n[z];for(y=0,B=w.length;y<B;y++)E=c(w[y],T[y],L),f(E.x,E.y,-N)}}L=k;for(y=0;y<l;y++)E=p?c(m[y],u[y],L):m[y],s?f(E.x,E.y+r[0].y,r[0].x):f(E.x,E.y,0);for(B=1;B<=o;B++)for(y=0;y<l;y++)E=p?c(m[y],u[y],L):m[y],s?f(E.x,
-E.y+r[B-1].y,r[B-1].x):f(E.x,E.y,h/o*B);for(Q=j-1;0<=Q;Q--){B=Q/j;N=i*(1-B);L=k*Math.sin(B*Math.PI/2);for(y=0,B=O.length;y<B;y++)E=c(O[y],q[y],L),f(E.x,E.y,h+N);for(z=0,F=I.length;z<F;z++){w=I[z];T=n[z];for(y=0,B=w.length;y<B;y++)E=c(w[y],T[y],L),s?f(E.x,E.y+r[o-1].y,r[o-1].x+N):f(E.x,E.y,h+N)}}var P=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(p){var a;a=0*l;for(y=0;y<G;y++)Y=K[y],g(Y[2]+a,Y[1]+a,Y[0]+a,!0);a=o+2*j;a*=l;for(y=0;y<G;y++)Y=K[y],g(Y[0]+a,Y[1]+a,Y[2]+a,!1)}else{for(y=0;y<G;y++)Y=
-K[y],g(Y[2],Y[1],Y[0],!0);for(y=0;y<G;y++)Y=K[y],g(Y[0]+l*o,Y[1]+l*o,Y[2]+l*o,!1)}})();(function(){var a=0;e(O,a);a+=O.length;for(z=0,F=I.length;z<F;z++)w=I[z],e(w,a),a+=w.length})()};
+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,m=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);m.copy(a).addSelf(g);if(h.equals(m))return g.clone();
+h.copy(b).addSelf(f);m.copy(c).addSelf(g);f=d.dot(g);g=m.subSelf(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(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+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(y=c.length;0<=--y;){e=y;f=y-1;0>f&&(f=c.length-1);
+for(var g=0,h=o+2*k,g=0;g<h;g++){var m=j*g,i=j*(g+1),l=d+e+m,m=d+f+m,n=d+f+i,i=d+e+i,p=c,q=g,r=h,l=l+C,m=m+C,n=n+C,i=i+C;I.faces.push(new THREE.Face4(l,m,n,i,null,null,t));l=P.generateSideWallUV(I,a,p,b,l,m,n,i,q,r);I.faceVertexUvs[0].push(l)}}}function f(a,b,c){I.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(c,d,e,f){c+=C;d+=C;e+=C;I.faces.push(new THREE.Face3(c,d,e,null,null,v));c=f?P.generateBottomUV(I,a,b,c,d,e):P.generateTopUV(I,a,b,c,d,e);I.faceVertexUvs[0].push(c)}var h=
+void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,l=void 0!==b.bevelSize?b.bevelSize:i-2,k=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments:12,o=void 0!==b.steps?b.steps:1,q=b.bendPath,m=b.extrudePath,r,s=!1,u=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,v=b.material,t=b.extrudeMaterial;if(m)r=m.getPoints(n),o=r.length,s=!0,p=!1;p||(l=i=k=0);var w,z,B,I=this,C=this.vertices.length;q&&a.addWrapPath(q);
+var q=u?a.extractAllSpacedPoints(n):a.extractAllPoints(n),n=q.shape,H=q.holes;if(q=!THREE.Shape.Utils.isClockWise(n)){n=n.reverse();for(z=0,B=H.length;z<B;z++)w=H[z],THREE.Shape.Utils.isClockWise(w)&&(H[z]=w.reverse());q=!1}var K=THREE.Shape.Utils.triangulateShape(n,H),O=n;for(z=0,B=H.length;z<B;z++)w=H[z],n=n.concat(w);var Q,L,D,N,E,j=n.length,Z,F=K.length,q=[],y=0;D=O.length;Q=D-1;for(L=y+1;y<D;y++,Q++,L++)Q===D&&(Q=0),L===D&&(L=0),q[y]=d(O[y],O[Q],O[L]);var m=[],U,u=q.concat();for(z=0,B=H.length;z<
+B;z++){w=H[z];U=[];for(y=0,D=w.length,Q=D-1,L=y+1;y<D;y++,Q++,L++)Q===D&&(Q=0),L===D&&(L=0),U[y]=d(w[y],w[Q],w[L]);m.push(U);u=u.concat(U)}for(Q=0;Q<k;Q++){D=Q/k;N=i*(1-D);L=l*Math.sin(D*Math.PI/2);for(y=0,D=O.length;y<D;y++)E=c(O[y],q[y],L),f(E.x,E.y,-N);for(z=0,B=H.length;z<B;z++){w=H[z];U=m[z];for(y=0,D=w.length;y<D;y++)E=c(w[y],U[y],L),f(E.x,E.y,-N)}}L=l;for(y=0;y<j;y++)E=p?c(n[y],u[y],L):n[y],s?f(E.x,E.y+r[0].y,r[0].x):f(E.x,E.y,0);for(D=1;D<=o;D++)for(y=0;y<j;y++)E=p?c(n[y],u[y],L):n[y],s?f(E.x,
+E.y+r[D-1].y,r[D-1].x):f(E.x,E.y,h/o*D);for(Q=k-1;0<=Q;Q--){D=Q/k;N=i*(1-D);L=l*Math.sin(D*Math.PI/2);for(y=0,D=O.length;y<D;y++)E=c(O[y],q[y],L),f(E.x,E.y,h+N);for(z=0,B=H.length;z<B;z++){w=H[z];U=m[z];for(y=0,D=w.length;y<D;y++)E=c(w[y],U[y],L),s?f(E.x,E.y+r[o-1].y,r[o-1].x+N):f(E.x,E.y,h+N)}}var P=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(p){var a;a=0*j;for(y=0;y<F;y++)Z=K[y],g(Z[2]+a,Z[1]+a,Z[0]+a,!0);a=o+2*k;a*=j;for(y=0;y<F;y++)Z=K[y],g(Z[0]+a,Z[1]+a,Z[2]+a,!1)}else{for(y=0;y<F;y++)Z=
+K[y],g(Z[2],Z[1],Z[0],!0);for(y=0;y<F;y++)Z=K[y],g(Z[0]+j*o,Z[1]+j*o,Z[2]+j*o,!1)}})();(function(){var a=0;e(O,a);a+=O.length;for(z=0,B=H.length;z<B;z++)w=H[z],e(w,a),a+=w.length})()};
 THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].position.x;e=a.vertices[e].position.y;c=a.vertices[f].position.x;f=a.vertices[f].position.y;return[new THREE.UV(a.vertices[d].position.x,1-a.vertices[d].position.y),new THREE.UV(b,1-e),new THREE.UV(c,1-f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].position.x,c=a.vertices[e].position.y,e=a.vertices[e].position.z,
-d=a.vertices[f].position.x,i=a.vertices[f].position.y,f=a.vertices[f].position.z,k=a.vertices[g].position.x,j=a.vertices[g].position.y,g=a.vertices[g].position.z,p=a.vertices[h].position.x,m=a.vertices[h].position.y,a=a.vertices[h].position.z;return 0.01>Math.abs(c-i)?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(k,g),new THREE.UV(p,a)]:[new THREE.UV(c,e),new THREE.UV(i,f),new THREE.UV(j,g),new THREE.UV(m,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+d=a.vertices[f].position.x,i=a.vertices[f].position.y,f=a.vertices[f].position.z,l=a.vertices[g].position.x,k=a.vertices[g].position.y,g=a.vertices[g].position.z,p=a.vertices[h].position.x,n=a.vertices[h].position.y,a=a.vertices[h].position.z;return 0.01>Math.abs(c-i)?[new THREE.UV(b,e),new THREE.UV(d,f),new THREE.UV(l,g),new THREE.UV(p,a)]:[new THREE.UV(c,e),new THREE.UV(i,f),new THREE.UV(k,g),new THREE.UV(n,a)]}};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.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],f=[],g=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=g.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=f;0==i&&(f=d);
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
-THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,k=b/d,j=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,0,a*k-f)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*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+
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,l=b/d,k=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,0,a*l-f)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),e.normal.copy(k),e.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/c,(a+
 1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,f=void 0!==f?f:0,g=void 0!==g?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,k=[],j=[];for(i=0;i<=c;i++){var p=[],m=[];for(h=0;h<=b;h++){var o=h/b,q=i/c,n=-a*Math.cos(d+o*e)*Math.sin(f+q*g),r=a*Math.cos(f+q*g),s=a*Math.sin(d+o*e)*Math.sin(f+q*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,r,s)));p.push(this.vertices.length-1);m.push(new THREE.UV(o,
-q))}k.push(p);j.push(m)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],e=k[i][h],f=k[i+1][h],g=k[i+1][h+1],p=this.vertices[d].position.clone().normalize(),m=this.vertices[e].position.clone().normalize(),o=this.vertices[f].position.clone().normalize(),q=this.vertices[g].position.clone().normalize(),n=j[i][h+1].clone(),r=j[i][h].clone(),s=j[i+1][h].clone(),u=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,f,g,[p,o,q])),this.faceVertexUvs[0].push([n,
-s,u])):Math.abs(this.vertices[f].position.y)==a?(this.faces.push(new THREE.Face3(d,e,f,[p,m,o])),this.faceVertexUvs[0].push([n,r,s])):(this.faces.push(new THREE.Face4(d,e,f,g,[p,m,o,q])),this.faceVertexUvs[0].push([n,r,s,u]))}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,f,g){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,f=void 0!==f?f:0,g=void 0!==g?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,l=[],k=[];for(i=0;i<=c;i++){var p=[],n=[];for(h=0;h<=b;h++){var o=h/b,q=i/c,m=-a*Math.cos(d+o*e)*Math.sin(f+q*g),r=a*Math.cos(f+q*g),s=a*Math.sin(d+o*e)*Math.sin(f+q*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,r,s)));p.push(this.vertices.length-1);n.push(new THREE.UV(o,
+q))}l.push(p);k.push(n)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=l[i][h+1],e=l[i][h],f=l[i+1][h],g=l[i+1][h+1],p=this.vertices[d].position.clone().normalize(),n=this.vertices[e].position.clone().normalize(),o=this.vertices[f].position.clone().normalize(),q=this.vertices[g].position.clone().normalize(),m=k[i][h+1].clone(),r=k[i][h].clone(),s=k[i+1][h].clone(),u=k[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,f,g,[p,o,q])),this.faceVertexUvs[0].push([m,
+s,u])):Math.abs(this.vertices[f].position.y)==a?(this.faces.push(new THREE.Face3(d,e,f,[p,n,o])),this.faceVertexUvs[0].push([m,r,s])):(this.faces.push(new THREE.Face4(d,e,f,g,[p,n,o,q])),this.faceVertexUvs[0].push([m,r,s,u]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=void 0!==b.height?b.height:50;if(void 0===b.bevelThickness)b.bevelThickness=10;if(void 0===b.bevelSize)b.bevelSize=8;if(void 0===b.bevelEnabled)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=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,k,j,p,m,o,q,n,r,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.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;f.push(new THREE.Vector2(i,j));e.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;f.push(new THREE.Vector2(i,
-j));e.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;o=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(o,q,i,j);if(g=f[f.length-1]){p=g.x;m=g.y;for(g=1,h=this.divisions;g<=h;g++){var u=g/h,v=THREE.Shape.Utils.b2(u,p,o,i),u=THREE.Shape.Utils.b2(u,m,q,j);f.push(new THREE.Vector2(v,u))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,o=b[a++]*c+d,q=b[a++]*-c,n=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,j,o,q,n,r),g=f[f.length-1]){p=g.x;m=g.y;for(g=1,h=this.divisions;g<=h;g++)u=g/h,v=THREE.Shape.Utils.b3(u,p,o,
-n,i),u=THREE.Shape.Utils.b3(u,m,q,r,j),f.push(new THREE.Vector2(v,u))}}}return{offset:s.ha*c,points:f,path:e}}}};
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,k,j;if(0<b(a))for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var p=2*e;for(k=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);j=k+1;e<=j&&(j=0);var m;a:{m=a;var o=i,q=k,n=j,r=e,s=g,u=void 0,v=void 0,t=void 0,w=void 0,z=void 0,
-F=void 0,C=void 0,D=void 0,I=void 0,v=m[s[o]].x,t=m[s[o]].y,w=m[s[q]].x,z=m[s[q]].y,F=m[s[n]].x,C=m[s[n]].y;if(1.0E-10>(w-v)*(C-t)-(z-t)*(F-v))m=!1;else{for(u=0;u<r;u++)if(!(u==o||u==q||u==n)){var D=m[s[u]].x,I=m[s[u]].y,K=void 0,O=void 0,Q=void 0,L=void 0,B=void 0,N=void 0,E=void 0,l=void 0,Y=void 0,G=void 0,y=void 0,T=void 0,K=Q=B=void 0,K=F-w,O=C-z,Q=v-F,L=t-C,B=w-v,N=z-t,E=D-v,l=I-t,Y=D-w,G=I-z,y=D-F,T=I-C,K=K*G-O*Y,B=B*l-N*E,Q=Q*T-L*y;if(0<=K&&0<=Q&&0<=B){m=!1;break a}}m=!0}}if(m){f.push([a[g[i]],
-a[g[k]],a[g[j]]]);h.push([g[i],g[k],g[j]]);for(i=k,j=k+1;j<e;i++,j++)g[i]=g[j];e--;p=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,l,k,p,n,o,q,m,r,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));l=b.length;for(a=0;a<l;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(i,k));e.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(i,
+k));e.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;o=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(o,q,i,k);if(g=f[f.length-1]){p=g.x;n=g.y;for(g=1,h=this.divisions;g<=h;g++){var u=g/h,v=THREE.Shape.Utils.b2(u,p,o,i),u=THREE.Shape.Utils.b2(u,n,q,k);f.push(new THREE.Vector2(v,u))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,o=b[a++]*c+d,q=b[a++]*-c,m=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,k,o,q,m,r),g=f[f.length-1]){p=g.x;n=g.y;for(g=1,h=this.divisions;g<=h;g++)u=g/h,v=THREE.Shape.Utils.b3(u,p,o,
+m,i),u=THREE.Shape.Utils.b3(u,n,q,r,k),f.push(new THREE.Vector2(v,u))}}}return{offset:s.ha*c,points:f,path:e}}}};
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,l,k;if(0<b(a))for(l=0;l<e;l++)g[l]=l;else for(l=0;l<e;l++)g[l]=e-1-l;var p=2*e;for(l=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}i=l;e<=i&&(i=0);l=i+1;e<=l&&(l=0);k=l+1;e<=k&&(k=0);var n;a:{n=a;var o=i,q=l,m=k,r=e,s=g,u=void 0,v=void 0,t=void 0,w=void 0,z=void 0,
+B=void 0,I=void 0,C=void 0,H=void 0,v=n[s[o]].x,t=n[s[o]].y,w=n[s[q]].x,z=n[s[q]].y,B=n[s[m]].x,I=n[s[m]].y;if(1.0E-10>(w-v)*(I-t)-(z-t)*(B-v))n=!1;else{for(u=0;u<r;u++)if(!(u==o||u==q||u==m)){var C=n[s[u]].x,H=n[s[u]].y,K=void 0,O=void 0,Q=void 0,L=void 0,D=void 0,N=void 0,E=void 0,j=void 0,Z=void 0,F=void 0,y=void 0,U=void 0,K=Q=D=void 0,K=B-w,O=I-z,Q=v-B,L=t-I,D=w-v,N=z-t,E=C-v,j=H-t,Z=C-w,F=H-z,y=C-B,U=H-I,K=K*F-O*Z,D=D*j-N*E,Q=Q*U-L*y;if(0<=K&&0<=Q&&0<=D){n=!1;break a}}n=!0}}if(n){f.push([a[g[i]],
+a[g[l]],a[g[k]]]);h.push([g[i],g[l],g[k]]);for(i=l,k=l+1;k<e;i++,k++)g[i]=g[k];e--;p=2*e}}return d?h:f};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||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=2*c/this.segmentsR*Math.PI;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
 this.tube*Math.sin(g);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,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*e*(2+c);b=0.5*e*(2+c)*b;e=0.5*f*e*Math.sin(a);return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
 Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=2*(a/this.segmentsR)*this.p*Math.PI,g=2*(b/this.segmentsT)*Math.PI,f=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(i,f);d.add(i,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=i*d.x+g*e.x;f.y+=i*d.y+g*e.y;f.z+=i*d.z+g*e.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=
-0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=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(c,d,e,f));this.faceVertexUvs[0].push([g,i,k,j])}this.computeCentroids();this.computeFaceNormals();
+0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,i,l,k])}this.computeCentroids();this.computeFaceNormals();
 this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
-THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=e||!1;if(f)this.debug=new THREE.Object3D;this.grid=[];var b=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,b=new THREE.Vector3,h=new THREE.Matrix4,d=[],f=[],i=[],k=this.segments+1,j,p,m,o;this.tangents=d;this.normals=f;this.binormals=i;for(a=0;a<k;a++)j=a/(k-1),d[a]=this.path.getTangentAt(j),d[a].normalize();f[0]=new THREE.Vector3;i[0]=
-new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(d[0].x);p=Math.abs(d[0].y);m=Math.abs(d[0].z);j<=a&&(a=j,g.set(1,0,0));p<=a&&(a=p,g.set(0,1,0));m<=a&&g.set(0,0,1);b.cross(d[0],g).normalize();f[0].cross(d[0],b);i[0].cross(d[0],f[0]);for(a=1;a<k;a++)f[a]=f[a-1].clone(),i[a]=i[a-1].clone(),b.cross(d[a-1],d[a]),1.0E-4<b.length()&&(b.normalize(),g=Math.acos(d[a-1].dot(d[a])),h.setRotationAxis(b,g).multiplyVector3(f[a])),i[a].cross(d[a],f[a]);if(this.closed){g=Math.acos(f[0].dot(f[k-1]));g/=k-1;0<d[0].dot(b.cross(f[0],
-f[k-1]))&&(g=-g);for(a=1;a<k;a++)h.setRotationAxis(d[a],g*a).multiplyVector3(f[a]),i[a].cross(d[a],f[a])}for(a=0;a<k;a++){this.grid[a]=[];j=a/(k-1);j=this.path.getPointAt(j);b=d[a];g=f[a];h=i[a];this.debug&&(this.debug.add(new THREE.ArrowHelper(b,j,c,255)),this.debug.add(new THREE.ArrowHelper(g,j,c,16711680)),this.debug.add(new THREE.ArrowHelper(h,j,c,65280)));for(b=0;b<this.segmentsRadius;b++)m=2*(b/this.segmentsRadius)*Math.PI,p=-this.radius*Math.cos(m),m=this.radius*Math.sin(m),o=(new THREE.Vector3).copy(j),
-o.x+=p*g.x+m*h.x,o.y+=p*g.y+m*h.y,o.z+=p*g.z+m*h.z,this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o.x,o.y,o.z)))-1}for(a=0;a<this.segments;a++)for(b=0;b<this.segmentsRadius;b++)f=e?(a+1)%this.segments:a+1,i=(b+1)%this.segmentsRadius,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][i],i=this.grid[a][i],k=new THREE.UV(a/this.segments,b/this.segmentsRadius),g=new THREE.UV((a+1)/this.segments,b/this.segmentsRadius),h=new THREE.UV((a+1)/this.segments,(b+1)/this.segmentsRadius),
-j=new THREE.UV(a/this.segments,(b+1)/this.segmentsRadius),this.faces.push(new THREE.Face4(c,d,f,i)),this.faceVertexUvs[0].push([k,g,h,j]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
+THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=e||!1;if(f)this.debug=new THREE.Object3D;this.grid=[];var b=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,b=new THREE.Vector3,h=new THREE.Matrix4,d=[],f=[],i=[],l=this.segments+1,k,p,n,o;this.tangents=d;this.normals=f;this.binormals=i;for(a=0;a<l;a++)k=a/(l-1),d[a]=this.path.getTangentAt(k),d[a].normalize();f[0]=new THREE.Vector3;i[0]=
+new THREE.Vector3;a=Number.MAX_VALUE;k=Math.abs(d[0].x);p=Math.abs(d[0].y);n=Math.abs(d[0].z);k<=a&&(a=k,g.set(1,0,0));p<=a&&(a=p,g.set(0,1,0));n<=a&&g.set(0,0,1);b.cross(d[0],g).normalize();f[0].cross(d[0],b);i[0].cross(d[0],f[0]);for(a=1;a<l;a++)f[a]=f[a-1].clone(),i[a]=i[a-1].clone(),b.cross(d[a-1],d[a]),1.0E-4<b.length()&&(b.normalize(),g=Math.acos(d[a-1].dot(d[a])),h.setRotationAxis(b,g).multiplyVector3(f[a])),i[a].cross(d[a],f[a]);if(this.closed){g=Math.acos(f[0].dot(f[l-1]));g/=l-1;0<d[0].dot(b.cross(f[0],
+f[l-1]))&&(g=-g);for(a=1;a<l;a++)h.setRotationAxis(d[a],g*a).multiplyVector3(f[a]),i[a].cross(d[a],f[a])}for(a=0;a<l;a++){this.grid[a]=[];k=a/(l-1);k=this.path.getPointAt(k);b=d[a];g=f[a];h=i[a];this.debug&&(this.debug.add(new THREE.ArrowHelper(b,k,c,255)),this.debug.add(new THREE.ArrowHelper(g,k,c,16711680)),this.debug.add(new THREE.ArrowHelper(h,k,c,65280)));for(b=0;b<this.segmentsRadius;b++)n=2*(b/this.segmentsRadius)*Math.PI,p=-this.radius*Math.cos(n),n=this.radius*Math.sin(n),o=(new THREE.Vector3).copy(k),
+o.x+=p*g.x+n*h.x,o.y+=p*g.y+n*h.y,o.z+=p*g.z+n*h.z,this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o.x,o.y,o.z)))-1}for(a=0;a<this.segments;a++)for(b=0;b<this.segmentsRadius;b++)f=e?(a+1)%this.segments:a+1,i=(b+1)%this.segmentsRadius,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][i],i=this.grid[a][i],l=new THREE.UV(a/this.segments,b/this.segmentsRadius),g=new THREE.UV((a+1)/this.segments,b/this.segmentsRadius),h=new THREE.UV((a+1)/this.segments,(b+1)/this.segmentsRadius),
+k=new THREE.UV(a/this.segments,(b+1)/this.segmentsRadius),this.faces.push(new THREE.Face4(c,d,f,i)),this.faceVertexUvs[0].push([l,g,h,k]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
 THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=new THREE.Vertex(a.normalize());b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function f(a,b,c,d){1>d?(d=new THREE.Face3(a.index,b.index,c.index,[a.position.clone(),b.position.clone(),c.position.clone()]),d.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),d.normal=d.centroid.clone().normalize(),
 i.faces.push(d),d=Math.atan2(d.centroid.z,-d.centroid.x),i.faceVertexUvs[0].push([h(a.uv,a.position,d),h(b.uv,b.position,d),h(c.uv,c.position,d)])):(d-=1,f(a,g(a,b),g(a,c),d),f(g(a,b),b,g(b,c),d),f(g(a,c),g(b,c),c,d),f(g(a,b),g(b,c),g(a,c),d))}function g(a,b){p[a.index]||(p[a.index]=[]);p[b.index]||(p[b.index]=[]);var c=p[a.index][b.index];void 0===c&&(p[a.index][b.index]=p[b.index][a.index]=c=e((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return c}function h(a,b,c){0>c&&1===a.u&&
-(a=new THREE.UV(a.u-1,a.v));0===b.x&&0===b.z&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,i=this,k=0,j=a.length;k<j;k++)e(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));for(var p=[],a=this.vertices,k=0,j=b.length;k<j;k++)f(a[b[k][0]],a[b[k][1]],a[b[k][2]],d);this.mergeVertices();k=0;for(j=this.vertices.length;k<j;k++)this.vertices[k].position.multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};
+(a=new THREE.UV(a.u-1,a.v));0===b.x&&0===b.z&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,i=this,l=0,k=a.length;l<k;l++)e(new THREE.Vector3(a[l][0],a[l][1],a[l][2]));for(var p=[],a=this.vertices,l=0,k=b.length;l<k;l++)f(a[b[l][0]],a[b[l][1]],a[b[l][2]],d);this.mergeVertices();l=0;for(k=this.vertices.length;l<k;l++)this.vertices[l].position.multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};
 THREE.PolyhedronGeometry.prototype=new THREE.Geometry;THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
 THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};
@@ -610,170 +610,134 @@ this.camera=a;this.update(a);this.lines=new THREE.Line(this.lineGeometry,this.li
 THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(void 0!==a){d=0;for(e=a.length;d<e;d++)b.lineGeometry.vertices[a[d]].position.copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",
 -1,-1,1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=!0};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 THREE.SubdivisionModifier=function(a){this.subdivisions=void 0===a?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;0<b--;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(g.useOldVertexColors){k.vertexColors=[];for(var j,n,p,o=0;4>o;o++){p=i[o];j=new THREE.Color;j.setRGB(0,0,0);for(var q=0;q<p.length;q++)n=h.vertexColors[p[q]-1],j.r+=n.r,j.g+=n.g,j.b+=n.b;j.r/=p.length;j.g/=p.length;j.b/=p.length;k.vertexColors[o]=j}}e.push(k);(!g.supportUVs||0!=m.length)&&f.push([m[a],m[b],m[c],m[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],e=[],f=[],g=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},p={},m=[],o,q,n,r,s,u=a.faceVertexUvs[0];for(o=0,q=u.length;o<q;o++)for(n=0,r=u[o].length;n<r;n++)s=d[o]["abcd".charAt(n)],m[s]||(m[s]=u[o][n]);var v;for(o=0,q=d.length;o<q;o++)if(s=d[o],k.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),g.supportUVs&&0!=m.length){v=new THREE.UV;if(s instanceof THREE.Face3)v.u=m[s.a].u+m[s.b].u+m[s.c].u,v.v=m[s.a].v+m[s.b].v+m[s.c].v,v.u/=3,v.v/=3;else if(s instanceof THREE.Face4)v.u=
-m[s.a].u+m[s.b].u+m[s.c].u+m[s.d].u,v.v=m[s.a].v+m[s.b].v+m[s.c].v+m[s.d].v,v.u/=4,v.v/=4;m.push(v)}q=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,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 t=0,u=h.length,w,z,F={},C={},D=function(a,
-b){void 0===F[a]&&(F[a]=[]);F[a].push(b)},I=function(a,b){void 0===C[a]&&(C[a]={});C[a][b]=null};for(o in q){v=q[o];w=o.split("_");z=w[0];w=w[1];D(z,[z,w]);D(w,[z,w]);for(n=0,r=v.length;n<r;n++)s=v[n],I(z,s,o),I(w,s,o);2>v.length&&(p[o]=!0)}for(o in q)if(v=q[o],s=v[0],v=v[1],w=o.split("_"),z=w[0],w=w[1],r=new THREE.Vector3,p[o]?(r.addSelf(h[z].position),r.addSelf(h[w].position),r.multiplyScalar(0.5)):(r.addSelf(k[s]),r.addSelf(k[v]),r.addSelf(h[z].position),r.addSelf(h[w].position),r.multiplyScalar(0.25)),
-j[o]=u+d.length+t,i.push(new THREE.Vertex(r)),t++,g.supportUVs&&0!=m.length)v=new THREE.UV,v.u=m[z].u+m[w].u,v.v=m[z].v+m[w].v,v.u/=2,v.v/=2,m.push(v);var K,O;w=["123","12","2","23"];r=["123","23","3","31"];var D=["123","31","1","12"],I=["1234","12","2","23"],Q=["1234","23","3","34"],L=["1234","34","4","41"],B=["1234","41","1","12"];for(o=0,q=k.length;o<q;o++)s=d[o],v=u+o,s instanceof THREE.Face3?(t=c(s.a,s.b),z=c(s.b,s.c),K=c(s.c,s.a),b(v,j[t],s.b,j[z],s,w),b(v,j[z],s.c,j[K],s,r),b(v,j[K],s.a,j[t],
-s,D)):s instanceof THREE.Face4?(t=c(s.a,s.b),z=c(s.b,s.c),K=c(s.c,s.d),O=c(s.d,s.a),b(v,j[t],s.b,j[z],s,I),b(v,j[z],s.c,j[K],s,Q),b(v,j[K],s.d,j[O],s,L),b(v,j[O],s.a,j[t],s,B)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;j=new THREE.Vector3;for(o=0,q=h.length;o<q;o++)if(void 0!==F[o]){i.set(0,0,0);j.set(0,0,0);s=new THREE.Vector3(0,0,0);v=0;for(n in C[o])i.addSelf(k[n]),v++;t=0;u=F[o].length;for(n=0;n<u;n++)p[c(F[o][n][0],F[o][n][1])]&&t++;if(2!=t){i.divideScalar(v);for(n=0;n<
-u;n++)v=F[o][n],v=h[v[0]].position.clone().addSelf(h[v[1]].position).divideScalar(2),j.addSelf(v);j.divideScalar(u);s.addSelf(h[o].position);s.multiplyScalar(u-3);s.addSelf(i);s.addSelf(j.multiplyScalar(2));s.divideScalar(u);d[o].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,m){var i=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(g.useOldVertexColors){i.vertexColors=[];for(var l,k,p,o=0;4>o;o++){p=m[o];l=new THREE.Color;l.setRGB(0,0,0);for(var q=0;q<p.length;q++)k=h.vertexColors[p[q]-1],l.r+=k.r,l.g+=k.g,l.b+=k.b;l.r/=p.length;l.g/=p.length;l.b/=p.length;i.vertexColors[o]=l}}e.push(i);(!g.supportUVs||0!=n.length)&&f.push([n[a],n[b],n[c],n[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],e=[],f=[],g=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],k={},p={},n=[],o,q,m,r,s,u=a.faceVertexUvs[0];for(o=0,q=u.length;o<q;o++)for(m=0,r=u[o].length;m<r;m++)s=d[o]["abcd".charAt(m)],n[s]||(n[s]=u[o][m]);var v;for(o=0,q=d.length;o<q;o++)if(s=d[o],l.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),g.supportUVs&&0!=n.length){v=new THREE.UV;if(s instanceof THREE.Face3)v.u=n[s.a].u+n[s.b].u+n[s.c].u,v.v=n[s.a].v+n[s.b].v+n[s.c].v,v.u/=3,v.v/=3;else if(s instanceof THREE.Face4)v.u=
+n[s.a].u+n[s.b].u+n[s.c].u+n[s.d].u,v.v=n[s.a].v+n[s.b].v+n[s.c].v+n[s.d].v,v.u/=4,v.v/=4;n.push(v)}q=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,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 t=0,u=h.length,w,z,B={},I={},C=function(a,
+b){void 0===B[a]&&(B[a]=[]);B[a].push(b)},H=function(a,b){void 0===I[a]&&(I[a]={});I[a][b]=null};for(o in q){v=q[o];w=o.split("_");z=w[0];w=w[1];C(z,[z,w]);C(w,[z,w]);for(m=0,r=v.length;m<r;m++)s=v[m],H(z,s,o),H(w,s,o);2>v.length&&(p[o]=!0)}for(o in q)if(v=q[o],s=v[0],v=v[1],w=o.split("_"),z=w[0],w=w[1],r=new THREE.Vector3,p[o]?(r.addSelf(h[z].position),r.addSelf(h[w].position),r.multiplyScalar(0.5)):(r.addSelf(l[s]),r.addSelf(l[v]),r.addSelf(h[z].position),r.addSelf(h[w].position),r.multiplyScalar(0.25)),
+k[o]=u+d.length+t,i.push(new THREE.Vertex(r)),t++,g.supportUVs&&0!=n.length)v=new THREE.UV,v.u=n[z].u+n[w].u,v.v=n[z].v+n[w].v,v.u/=2,v.v/=2,n.push(v);var K,O;w=["123","12","2","23"];r=["123","23","3","31"];var C=["123","31","1","12"],H=["1234","12","2","23"],Q=["1234","23","3","34"],L=["1234","34","4","41"],D=["1234","41","1","12"];for(o=0,q=l.length;o<q;o++)s=d[o],v=u+o,s instanceof THREE.Face3?(t=c(s.a,s.b),z=c(s.b,s.c),K=c(s.c,s.a),b(v,k[t],s.b,k[z],s,w),b(v,k[z],s.c,k[K],s,r),b(v,k[K],s.a,k[t],
+s,C)):s instanceof THREE.Face4?(t=c(s.a,s.b),z=c(s.b,s.c),K=c(s.c,s.d),O=c(s.d,s.a),b(v,k[t],s.b,k[z],s,H),b(v,k[z],s.c,k[K],s,Q),b(v,k[K],s.d,k[O],s,L),b(v,k[O],s.a,k[t],s,D)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;k=new THREE.Vector3;for(o=0,q=h.length;o<q;o++)if(void 0!==B[o]){i.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);v=0;for(m in I[o])i.addSelf(l[m]),v++;t=0;u=B[o].length;for(m=0;m<u;m++)p[c(B[o][m][0],B[o][m][1])]&&t++;if(2!=t){i.divideScalar(v);for(m=0;m<
+u;m++)v=B[o][m],v=h[v[0]].position.clone().addSelf(h[v[1]].position).divideScalar(2),k.addSelf(v);k.divideScalar(u);s.addSelf(h[o].position);s.multiplyScalar(u-3);s.addSelf(i);s.addSelf(k.multiplyScalar(2));s.divideScalar(u);d[o].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
 THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",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?b+((100*a.loaded/
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=
 Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=!0};e.crossOrigin=h.crossOrigin;e.src=b}function f(a,c,d,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=d;
-if(f){a[c].repeat.set(f[0],f[1]);if(1!=f[0])a[c].wrapS=THREE.RepeatWrapping;if(1!=f[1])a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==f[h[0]])a[c].wrapS=f[h[0]];if(void 0!==f[h[1]])a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,i="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};if(a.shading){var j=
-a.shading.toLowerCase();"phong"===j?i="MeshPhongMaterial":"basic"===j&&(i="MeshBasicMaterial")}if(void 0!==a.blending&&void 0!==THREE[a.blending])k.blending=THREE[a.blending];if(void 0!==a.transparent||1>a.opacity)k.transparent=a.transparent;if(void 0!==a.depthTest)k.depthTest=a.depthTest;if(void 0!==a.depthWrite)k.depthWrite=a.depthWrite;if(void 0!==a.vertexColors)if("face"==a.vertexColors)k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=THREE.VertexColors;if(a.colorDiffuse)k.color=
-g(a.colorDiffuse);else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=g(a.colorSpecular);if(a.colorAmbient)k.ambient=g(a.colorAmbient);if(a.transparency)k.opacity=a.transparency;if(a.specularCoef)k.shininess=a.specularCoef;a.mapDiffuse&&b&&f(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(k,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,
-a.mapNormalWrap);a.mapSpecular&&b&&f(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){i=THREE.ShaderUtils.lib.normal;j=THREE.UniformsUtils.clone(i.uniforms);j.tNormal.texture=k.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(k.map)j.tDiffuse.texture=k.map,j.enableDiffuse.value=!0;if(k.specularMap)j.tSpecular.texture=k.specularMap,j.enableSpecular.value=!0;if(k.lightMap)j.tAO.texture=k.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(k.color);
-j.uSpecularColor.value.setHex(k.specular);j.uAmbientColor.value.setHex(k.ambient);j.uShininess.value=k.shininess;if(void 0!==k.opacity)j.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:j,lights:!0,fog:!0})}else k=new THREE[i](k);if(void 0!==a.DbgName)k.name=a.DbgName;return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+if(f){a[c].repeat.set(f[0],f[1]);if(1!=f[0])a[c].wrapS=THREE.RepeatWrapping;if(1!=f[1])a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==f[h[0]])a[c].wrapS=f[h[0]];if(void 0!==f[h[1]])a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,i="MeshLambertMaterial",l={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};if(a.shading){var k=
+a.shading.toLowerCase();"phong"===k?i="MeshPhongMaterial":"basic"===k&&(i="MeshBasicMaterial")}if(void 0!==a.blending&&void 0!==THREE[a.blending])l.blending=THREE[a.blending];if(void 0!==a.transparent||1>a.opacity)l.transparent=a.transparent;if(void 0!==a.depthTest)l.depthTest=a.depthTest;if(void 0!==a.depthWrite)l.depthWrite=a.depthWrite;if(void 0!==a.vertexColors)if("face"==a.vertexColors)l.vertexColors=THREE.FaceColors;else if(a.vertexColors)l.vertexColors=THREE.VertexColors;if(a.colorDiffuse)l.color=
+g(a.colorDiffuse);else if(a.DbgColor)l.color=a.DbgColor;if(a.colorSpecular)l.specular=g(a.colorSpecular);if(a.colorAmbient)l.ambient=g(a.colorAmbient);if(a.transparency)l.opacity=a.transparency;if(a.specularCoef)l.shininess=a.specularCoef;a.mapDiffuse&&b&&f(l,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(l,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(l,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,
+a.mapNormalWrap);a.mapSpecular&&b&&f(l,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){i=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(i.uniforms);k.tNormal.texture=l.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(l.map)k.tDiffuse.texture=l.map,k.enableDiffuse.value=!0;if(l.specularMap)k.tSpecular.texture=l.specularMap,k.enableSpecular.value=!0;if(l.lightMap)k.tAO.texture=l.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(l.color);
+k.uSpecularColor.value.setHex(l.specular);k.uAmbientColor.value.setHex(l.ambient);k.uShininess.value=l.shininess;if(void 0!==l.opacity)k.uOpacity.value=l.opacity;l=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:k,lights:!0,fog:!0})}else l=new THREE[i](l);if(void 0!==a.DbgName)l.name=a.DbgName;return l}};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){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,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(4==g.readyState)if(200==g.status||0==g.status){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,!0);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){4==f.readyState?200==f.status||0==f.status?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]"):3==f.readyState?e&&(0==h&&(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):2==f.readyState&&(h=f.getResponseHeader("Content-Length"))};
 f.open("GET",g,!0);f.responseType="arraybuffer";f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,k,j,p,m,o,q,n,r,s,u,v,t;function w(a){return a%4?4-a%4:0}function z(a,b){return(new Uint8Array(a,b,1))[0]}function F(a,b){return(new Uint32Array(a,b,1))[0]}function C(b,c){var d,e,f,g,h,i,k,j,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[3*d];f=l[3*d+1];g=l[3*d+2];h=E[2*e];e=E[2*e+1];i=E[2*f];k=E[2*f+1];f=E[2*g];j=E[2*g+1];g=L.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,k));m.push(new THREE.UV(f,
-j));g.push(m)}}function D(b,c){var d,e,f,g,h,i,k,j,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[4*d];f=n[4*d+1];g=n[4*d+2];h=n[4*d+3];i=E[2*e];e=E[2*e+1];k=E[2*f];l=E[2*f+1];j=E[2*g];m=E[2*g+1];g=E[2*h];f=E[2*h+1];h=L.faceVertexUvs[0];var o=[];o.push(new THREE.UV(i,e));o.push(new THREE.UV(k,l));o.push(new THREE.UV(j,m));o.push(new THREE.UV(g,f));h.push(o)}}function I(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[3*d],f=c[3*d+1],g=c[3*d+2],h=i[d],
-L.faces.push(new THREE.Face3(e,f,g,null,null,h))}function K(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=k[d],L.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function O(b,c,d,e){for(var f,g,h,i,k,j,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];k=d[3*e];j=d[3*e+1];l=d[3*e+2];i=m[e];var n=N[3*j],o=N[3*j+1];j=N[3*j+2];var p=N[3*l],q=
-N[3*l+1];l=N[3*l+2];L.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(N[3*k],N[3*k+1],N[3*k+2]),new THREE.Vector3(n,o,j),new THREE.Vector3(p,q,l)],null,i))}}function Q(b,c,d,e){for(var f,g,h,i,k,j,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];j=d[4*e];l=d[4*e+1];m=d[4*e+2];n=d[4*e+3];k=o[e];var p=N[3*l],q=N[3*l+1];l=N[3*l+2];var r=N[3*m],s=N[3*m+1];m=N[3*m+2];var t=N[3*n],u=N[3*n+1];n=N[3*n+2];L.faces.push(new THREE.Face4(f,
-g,h,i,[new THREE.Vector3(N[3*j],N[3*j+1],N[3*j+2]),new THREE.Vector3(p,q,l),new THREE.Vector3(r,s,m),new THREE.Vector3(t,u,n)],null,k))}}var L=this,B=0,N=[],E=[],l,Y,G;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(L,d,b);(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,B,12);c=z(a,B+12);z(a,B+13);z(a,B+14);z(a,B+15);e=z(a,B+16);i=z(a,B+17);k=z(a,B+18);j=z(a,B+19);p=F(a,B+20);m=F(a,B+20+4);o=F(a,B+20+8);b=F(a,B+20+12);q=
-F(a,B+20+16);n=F(a,B+20+20);r=F(a,B+20+24);s=F(a,B+20+28);u=F(a,B+20+32);v=F(a,B+20+36);t=F(a,B+20+40);B+=c;c=3*e+j;G=4*e+j;l=b*c;Y=q*(c+3*i);e=n*(c+3*k);j=r*(c+3*i+3*k);c=s*G;i=u*(G+4*i);k=v*(G+4*k);B+=function(b){var b=new Float32Array(a,b,3*p),c,d,e,f;for(c=0;c<p;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],L.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*p*Float32Array.BYTES_PER_ELEMENT}(B);B+=function(b){if(m){var b=new Int8Array(a,b,3*m),c,d,e,f;for(c=0;c<m;c++)d=b[3*c],e=b[3*c+1],
-f=b[3*c+2],N.push(d/127,e/127,f/127)}return 3*m*Int8Array.BYTES_PER_ELEMENT}(B);B+=w(3*m);B+=function(b){if(o){var b=new Float32Array(a,b,2*o),c,d,e;for(c=0;c<o;c++)d=b[2*c],e=b[2*c+1],E.push(d,e)}return 2*o*Float32Array.BYTES_PER_ELEMENT}(B);l=B+l+w(2*b);Y=l+Y+w(2*q);e=Y+e+w(2*n);j=e+j+w(2*r);c=j+c+w(2*s);i=c+i+w(2*u);k=i+k+w(2*v);(function(a){if(n){var b=a+3*n*Uint32Array.BYTES_PER_ELEMENT;I(n,a,b+3*n*Uint32Array.BYTES_PER_ELEMENT);C(n,b)}})(Y);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT,
-c=b+3*r*Uint32Array.BYTES_PER_ELEMENT;O(r,a,b,c+3*r*Uint32Array.BYTES_PER_ELEMENT);C(r,c)}})(e);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT;K(v,a,b+4*v*Uint32Array.BYTES_PER_ELEMENT);D(v,b)}})(i);(function(a){if(t){var b=a+4*t*Uint32Array.BYTES_PER_ELEMENT,c=b+4*t*Uint32Array.BYTES_PER_ELEMENT;Q(t,a,b,c+4*t*Uint32Array.BYTES_PER_ELEMENT);D(t,c)}})(k);b&&I(b,B,B+3*b*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(q){var b=a+3*q*Uint32Array.BYTES_PER_ELEMENT;O(q,a,b,b+3*q*Uint32Array.BYTES_PER_ELEMENT)}})(l);
-s&&K(s,j,j+4*s*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;Q(u,a,b,b+4*u*Uint32Array.BYTES_PER_ELEMENT)}})(c);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){S=a;d=d||Ua;void 0!==e&&(a=e.split("/"),a.pop(),db=(1>a.length?".":a.join("/"))+"/");if((a=S.evaluate("//dae:asset",S,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var i=a.childNodes[e];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":sa=i.textContent.charAt(0)}}if(!Oa.convertUpAxis||sa===Oa.upAxis)Wa=null;else switch(sa){case "X":Wa="Y"===
-Oa.upAxis?"XtoY":"XtoZ";break;case "Y":Wa="X"===Oa.upAxis?"YtoX":"YtoZ";break;case "Z":Wa="X"===Oa.upAxis?"ZtoX":"ZtoY"}oa=b("//dae:library_images/dae:image",g,"image");bb=b("//dae:library_materials/dae:material",C,"material");jb=b("//dae:library_effects/dae:effect",Q,"effect");ka=b("//dae:library_geometries/dae:geometry",r,"geometry");Va=b(".//dae:library_cameras/dae:camera",Y,"camera");Aa=b("//dae:library_controllers/dae:controller",h,"controller");Fa=b("//dae:library_animations/dae:animation",
-B,"animation");eb=b(".//dae:library_visual_scenes/dae:visual_scene",j,"visual_scene");Ga=[];ra=[];(a=S.evaluate(".//dae:scene/dae:instance_visual_scene",S,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ca=eb[0<a.length?a:"visual_scene0"]):ca=null;$=new THREE.Object3D;for(a=0;a<ca.nodes.length;a++)$.add(f(ca.nodes[a]));cb=[];c($);a={scene:$,morphs:Ga,skins:ra,animations:cb,dae:{images:oa,materials:bb,cameras:Va,effects:jb,geometries:ka,controllers:Aa,
-animations:Fa,visualScenes:eb,scene:ca}};d&&d(a);return a}function b(a,b,c){for(var a=S.evaluate(a,S,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=ca.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};cb.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,l,k,p,n,o,q,m,r,s,u,v,t;function w(a){return a%4?4-a%4:0}function z(a,b){return(new Uint8Array(a,b,1))[0]}function B(a,b){return(new Uint32Array(a,b,1))[0]}function I(b,c){var d,e,f,g,h,m,i,j,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[3*d];f=l[3*d+1];g=l[3*d+2];h=E[2*e];e=E[2*e+1];m=E[2*f];i=E[2*f+1];f=E[2*g];j=E[2*g+1];g=L.faceVertexUvs[0];var k=[];k.push(new THREE.UV(h,e));k.push(new THREE.UV(m,i));k.push(new THREE.UV(f,
+j));g.push(k)}}function C(b,c){var d,e,f,g,h,m,i,j,l,k,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[4*d];f=n[4*d+1];g=n[4*d+2];h=n[4*d+3];m=E[2*e];e=E[2*e+1];i=E[2*f];l=E[2*f+1];j=E[2*g];k=E[2*g+1];g=E[2*h];f=E[2*h+1];h=L.faceVertexUvs[0];var o=[];o.push(new THREE.UV(m,e));o.push(new THREE.UV(i,l));o.push(new THREE.UV(j,k));o.push(new THREE.UV(g,f));h.push(o)}}function H(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),m=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*d+1],g=c[3*d+2],h=m[d],
+L.faces.push(new THREE.Face3(e,f,g,null,null,h))}function K(b,c,d){for(var e,f,g,h,m,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],m=i[d],L.faces.push(new THREE.Face4(e,f,g,h,null,null,m))}function O(b,c,d,e){for(var f,g,h,m,i,j,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),k=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];i=d[3*e];j=d[3*e+1];l=d[3*e+2];m=k[e];var n=N[3*j],o=N[3*j+1];j=N[3*j+2];var p=N[3*l],q=
+N[3*l+1];l=N[3*l+2];L.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(N[3*i],N[3*i+1],N[3*i+2]),new THREE.Vector3(n,o,j),new THREE.Vector3(p,q,l)],null,m))}}function Q(b,c,d,e){for(var f,g,h,m,i,j,l,k,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];m=c[4*e+3];j=d[4*e];l=d[4*e+1];k=d[4*e+2];n=d[4*e+3];i=o[e];var p=N[3*l],q=N[3*l+1];l=N[3*l+2];var r=N[3*k],s=N[3*k+1];k=N[3*k+2];var t=N[3*n],u=N[3*n+1];n=N[3*n+2];L.faces.push(new THREE.Face4(f,
+g,h,m,[new THREE.Vector3(N[3*j],N[3*j+1],N[3*j+2]),new THREE.Vector3(p,q,l),new THREE.Vector3(r,s,k),new THREE.Vector3(t,u,n)],null,i))}}var L=this,D=0,N=[],E=[],j,Z,F;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(L,d,b);(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,D,12);c=z(a,D+12);z(a,D+13);z(a,D+14);z(a,D+15);e=z(a,D+16);i=z(a,D+17);l=z(a,D+18);k=z(a,D+19);p=B(a,D+20);n=B(a,D+20+4);o=B(a,D+20+8);b=B(a,D+20+12);q=
+B(a,D+20+16);m=B(a,D+20+20);r=B(a,D+20+24);s=B(a,D+20+28);u=B(a,D+20+32);v=B(a,D+20+36);t=B(a,D+20+40);D+=c;c=3*e+k;F=4*e+k;j=b*c;Z=q*(c+3*i);e=m*(c+3*l);k=r*(c+3*i+3*l);c=s*F;i=u*(F+4*i);l=v*(F+4*l);D+=function(b){var b=new Float32Array(a,b,3*p),c,d,e,f;for(c=0;c<p;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],L.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*p*Float32Array.BYTES_PER_ELEMENT}(D);D+=function(b){if(n){var b=new Int8Array(a,b,3*n),c,d,e,f;for(c=0;c<n;c++)d=b[3*c],e=b[3*c+1],
+f=b[3*c+2],N.push(d/127,e/127,f/127)}return 3*n*Int8Array.BYTES_PER_ELEMENT}(D);D+=w(3*n);D+=function(b){if(o){var b=new Float32Array(a,b,2*o),c,d,e;for(c=0;c<o;c++)d=b[2*c],e=b[2*c+1],E.push(d,e)}return 2*o*Float32Array.BYTES_PER_ELEMENT}(D);j=D+j+w(2*b);Z=j+Z+w(2*q);e=Z+e+w(2*m);k=e+k+w(2*r);c=k+c+w(2*s);i=c+i+w(2*u);l=i+l+w(2*v);(function(a){if(m){var b=a+3*m*Uint32Array.BYTES_PER_ELEMENT;H(m,a,b+3*m*Uint32Array.BYTES_PER_ELEMENT);I(m,b)}})(Z);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT,
+c=b+3*r*Uint32Array.BYTES_PER_ELEMENT;O(r,a,b,c+3*r*Uint32Array.BYTES_PER_ELEMENT);I(r,c)}})(e);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT;K(v,a,b+4*v*Uint32Array.BYTES_PER_ELEMENT);C(v,b)}})(i);(function(a){if(t){var b=a+4*t*Uint32Array.BYTES_PER_ELEMENT,c=b+4*t*Uint32Array.BYTES_PER_ELEMENT;Q(t,a,b,c+4*t*Uint32Array.BYTES_PER_ELEMENT);C(t,c)}})(l);b&&H(b,D,D+3*b*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(q){var b=a+3*q*Uint32Array.BYTES_PER_ELEMENT;O(q,a,b,b+3*q*Uint32Array.BYTES_PER_ELEMENT)}})(j);
+s&&K(s,k,k+4*s*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;Q(u,a,b,b+4*u*Uint32Array.BYTES_PER_ELEMENT)}})(c);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){S=a;d=d||Ua;void 0!==e&&(a=e.split("/"),a.pop(),db=(1>a.length?".":a.join("/"))+"/");if((a=S.evaluate("//dae:asset",S,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var m=a.childNodes[e];switch(m.nodeName){case "unit":(m=m.getAttribute("meter"))&&parseFloat(m);break;case "up_axis":sa=m.textContent.charAt(0)}}if(!Oa.convertUpAxis||sa===Oa.upAxis)Wa=null;else switch(sa){case "X":Wa="Y"===
+Oa.upAxis?"XtoY":"XtoZ";break;case "Y":Wa="X"===Oa.upAxis?"YtoX":"YtoZ";break;case "Z":Wa="X"===Oa.upAxis?"ZtoX":"ZtoY"}oa=b("//dae:library_images/dae:image",g,"image");bb=b("//dae:library_materials/dae:material",I,"material");jb=b("//dae:library_effects/dae:effect",Q,"effect");ka=b("//dae:library_geometries/dae:geometry",r,"geometry");Va=b(".//dae:library_cameras/dae:camera",Z,"camera");Aa=b("//dae:library_controllers/dae:controller",h,"controller");Fa=b("//dae:library_animations/dae:animation",
+D,"animation");eb=b(".//dae:library_visual_scenes/dae:visual_scene",k,"visual_scene");Ga=[];ra=[];(a=S.evaluate(".//dae:scene/dae:instance_visual_scene",S,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),da=eb[0<a.length?a:"visual_scene0"]):da=null;ba=new THREE.Object3D;for(a=0;a<da.nodes.length;a++)ba.add(f(da.nodes[a]));cb=[];c(ba);a={scene:ba,morphs:Ga,skins:ra,animations:cb,dae:{images:oa,materials:bb,cameras:Va,effects:jb,geometries:ka,controllers:Aa,
+animations:Fa,visualScenes:eb,scene:da}};d&&d(a);return a}function b(a,b,c){for(var a=S.evaluate(a,S,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=da.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};cb.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,
 b.keys[e].time)}else d={hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=0,g=c(a.children[e]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function e(a,b,c){var e,
-f=Aa[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 c=1E6,g=-c,h=0;for(e in Fa)for(var i=Fa[e],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=ca.getChildById(b.skeleton[0],!0)||ca.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,n,
-j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++)if(l=j[m],n=-1,"JOINT"==l.type){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(0<=n){o=k.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<k.weights.length;o++)for(var p=
-0;p<k.weights[o].length;p++){var q=k.weights[o][p];q.joint==n&&l.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+l.sid+"'.";}for(j=0;j<h.length;j++)if("JOINT"==h[j].type)for(k=0;k<h[j].weights.length;k++)l=h[j].weights[k],m=l.index,l=l.weight,n=a.vertices[m],m=i[m],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*l,m.position.y+=g.y*l,m.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function f(a){var b=
-new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var i=Aa[a.controllers[g].url];switch(i.type){case "skin":if(ka[i.skin.source]){var j=new n;j.url=i.skin.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);c=a.controllers[g]}else if(Aa[i.skin.source]&&(d=i=Aa[i.skin.source],i.morph&&ka[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j);break;case "morph":if(ka[i.morph.source])j=new n,
-j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j),d=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=0;g<a.geometries.length;g++){var i=a.geometries[g],j=i.instance_material,i=ka[i.url],k={},l=[],m=0,p;if(i&&i.mesh&&i.mesh.primitives){if(0==b.name.length)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var q=bb[p.target],r=jb[q.instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;
-k[p.symbol]=m;l.push(r.material);p=r.material;p.name=null==q.name||""===q.name?q.id:q.name;m++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(1<m){j=new THREE.MeshFaceMaterial;i.materials=l;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materialIndex=k[l.daeMaterial]}if(void 0!==c)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=Aa[c.url],j.skinInstanceController=c,j.name="skin_"+ra.length,ra.push(j);
-else if(void 0!==d){h=i;k=d instanceof o?Aa[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(m=ka[k.targets[l]],m.mesh&&m.mesh.primitives&&m.mesh.primitives.length)m=m.mesh.primitives[0].geometry,m.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:m.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+Ga.length;Ga.push(j)}else j=
+f=Aa[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 c=1E6,g=-c,h=0;for(e in Fa)for(var m=Fa[e],i=0;i<m.sampler.length;i++){var j=m.sampler[i];j.create();c=Math.min(c,j.startTime);g=Math.max(g,j.endTime);h=Math.max(h,j.input.length)}e=h;for(var b=da.getChildById(b.skeleton[0],!0)||da.getChildBySid(b.skeleton[0],!0),l,k,g=new THREE.Vector3,n,
+i=0;i<a.vertices.length;i++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[i].position);for(c=0;c<e;c++){h=[];m=[];for(i=0;i<a.vertices.length;i++)m.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);i=h;j=f.skin;for(k=0;k<i.length;k++)if(l=i[k],n=-1,"JOINT"==l.type){for(var o=0;o<j.joints.length;o++)if(l.sid==j.joints[o]){n=o;break}if(0<=n){o=j.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<j.weights.length;o++)for(var p=
+0;p<j.weights[o].length;p++){var q=j.weights[o][p];q.joint==n&&l.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+l.sid+"'.";}for(i=0;i<h.length;i++)if("JOINT"==h[i].type)for(j=0;j<h[i].weights.length;j++)l=h[i].weights[j],k=l.index,l=l.weight,n=a.vertices[k],k=m[k],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[i].skinningMatrix.multiplyVector3(g),k.position.x+=g.x*l,k.position.y+=g.y*l,k.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:m})}}}function f(a){var b=
+new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var i=Aa[a.controllers[g].url];switch(i.type){case "skin":if(ka[i.skin.source]){var j=new m;j.url=i.skin.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);c=a.controllers[g]}else if(Aa[i.skin.source]&&(d=i=Aa[i.skin.source],i.morph&&ka[i.morph.source]))j=new m,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j);break;case "morph":if(ka[i.morph.source])j=new m,
+j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j),d=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=0;g<a.geometries.length;g++){var i=a.geometries[g],j=i.instance_material,i=ka[i.url],l={},k=[],n=0,p;if(i&&i.mesh&&i.mesh.primitives){if(0==b.name.length)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var q=bb[p.target],r=jb[q.instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;
+l[p.symbol]=n;k.push(r.material);p=r.material;p.name=null==q.name||""===q.name?q.id:q.name;n++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(1<n){j=new THREE.MeshFaceMaterial;i.materials=k;for(h=0;h<i.faces.length;h++)k=i.faces[h],k.materialIndex=l[k.daeMaterial]}if(void 0!==c)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=Aa[c.url],j.skinInstanceController=c,j.name="skin_"+ra.length,ra.push(j);
+else if(void 0!==d){h=i;l=d instanceof o?Aa[d.url]:d;if(!l||!l.morph)console.log("could not find morph controller!");else{l=l.morph;for(k=0;k<l.targets.length;k++)if(n=ka[l.targets[k]],n.mesh&&n.mesh.primitives&&n.mesh.primitives.length)n=n.mesh.primitives[0].geometry,n.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:n.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+Ga.length;Ga.push(j)}else j=
 new THREE.Mesh(i,j);1<a.geometries.length?b.add(j):b=j}}for(g=0;g<a.cameras.length;g++)b=Va[a.cameras[g].url],b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar);b.name=a.id||"";b.matrix=a.matrix;g=a.matrix.decompose();b.position=g[0];b.quaternion=g[1];b.useQuaternion=!0;b.scale=g[2];Oa.centerGeometry&&b.geometry&&(g=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(g.multiplySelf(b.scale)),b.position.subSelf(g));for(g=0;g<a.nodes.length;g++)b.add(f(a.nodes[g],a));
-return b}function g(){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 m(){this.type=this.sid="";this.data=[];this.obj=null}function o(){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 s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function u(){}function v(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}
-function t(){this.source="";this.stride=this.count=0;this.params=[]}function w(){this.input={}}function z(){this.semantic="";this.offset=0;this.source="";this.set=0}function F(a){this.id=a;this.type=null}function C(){this.name=this.id="";this.instance_effect=null}function D(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function I(a,b){this.type=a;this.effect=b;this.material=null}function K(a){this.effect=
-a;this.format=this.init_from=null}function O(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Q(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function L(){this.url=""}function B(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function N(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function E(a){this.id="";this.animation=
-a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function l(a){this.targets=[];this.time=a}function Y(){this.name=this.id=""}function G(){this.url=""}function y(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function T(a){for(var a=da(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function P(a){for(var a=da(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function da(a){return 0<
+return b}function g(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=
+[];this.matrix=new THREE.Matrix4}function n(){this.type=this.sid="";this.data=[];this.obj=null}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function q(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function u(){}function v(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}
+function t(){this.source="";this.stride=this.count=0;this.params=[]}function w(){this.input={}}function z(){this.semantic="";this.offset=0;this.source="";this.set=0}function B(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function C(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function H(a,b){this.type=a;this.effect=b;this.material=null}function K(a){this.effect=
+a;this.format=this.init_from=null}function O(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Q(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function L(){this.url=""}function D(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function N(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function E(a){this.id="";this.animation=
+a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function j(a){this.targets=[];this.time=a}function Z(){this.name=this.id=""}function F(){this.url=""}function y(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function U(a){for(var a=fa(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function P(a){for(var a=fa(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function fa(a){return 0<
 a.length?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function ja(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function ha(a,b){if(Oa.convertUpAxis&&sa!==Oa.upAxis)switch(Wa){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function R(a,b){var c=
-[a[b],a[b+1],a[b+2]];ha(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function Z(a){if(Oa.convertUpAxis){var b=[a[0],a[4],a[8]];ha(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];ha(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];ha(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];ha(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];ha(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];ha(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];ha(b,-1);a[3]=b[0];
-a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var S=null,$=null,ca,Ua=null,Ia={},oa={},Fa={},Aa={},ka={},bb={},jb={},Va={},cb,eb,db,Ga,ra,Ba=THREE.SmoothShading,Oa={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},sa="Y",Wa=null,mb=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=
-c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
-0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new F).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new z).parse(d))}}return b};
-k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=T(f.textContent);this.bindShapeMatrix=Z(f);break;case "source":f=(new F).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,
-b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new z).parse(d),e=b[d.source];if("JOINT"==d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)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(1==g.nodeType)switch(g.nodeName){case "input":e.push((new z).parse(g));break;
-case "v":c=P(g.textContent);break;case "vcount":d=P(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(1==c.nodeType)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],
+[a[b],a[b+1],a[b+2]];ha(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function aa(a){if(Oa.convertUpAxis){var b=[a[0],a[4],a[8]];ha(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];ha(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];ha(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];ha(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];ha(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];ha(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];ha(b,-1);a[3]=b[0];
+a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var S=null,ba=null,da,Ua=null,Ia={},oa={},Fa={},Aa={},ka={},bb={},jb={},Va={},cb,eb,db,Ga,ra,Ba=THREE.SmoothShading,Oa={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},sa="Y",Wa=null,mb=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=
+c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new l).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
+0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new B).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(1==d.nodeType)switch(d.nodeName){case "input":b.push((new z).parse(d))}}return b};
+l.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=U(f.textContent);this.bindShapeMatrix=aa(f);break;case "source":f=(new B).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,
+b);return this};l.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new z).parse(d),e=b[d.source];if("JOINT"==d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)this.invBindMatrices=e.read()}}};l.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new z).parse(g));break;
+case "v":c=P(g.textContent);break;case "vcount":d=P(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var m={},l=0;l<e.length;l++){var k=e[l],n=c[g+k.offset];switch(k.semantic){case "JOINT":m.joint=n;break;case "WEIGHT":m.weight=b[k.source].data[n]}}i.push(m);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(1==c.nodeType)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=0<=e.indexOf("."),g=0<=e.indexOf("("),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="JOINT"==this.type?this.type:
-"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":this.cameras.push((new G).parse(b));break;case "instance_controller":this.controllers.push((new o).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;
-case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=S.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",S,y,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 m).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in Fa)for(var e=Fa[d],f=0;f<e.channel.length;f++){var g=e.channel[f],
+"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":this.cameras.push((new F).parse(b));break;case "instance_controller":this.controllers.push((new o).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=S.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",S,y,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 n).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in Fa)for(var e=Fa[d],f=0;f<e.channel.length;f++){var g=e.channel[f],
 h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(Oa.convertUpAxis)switch(g){case "X":switch(Wa){case "XtoY":case "XtoZ":case "YtoX":g="Y";break;case "ZtoX":g="Z"}break;case "Y":switch(Wa){case "XtoY":case "YtoX":case "ZtoX":g="X";
-break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(Wa){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){-1===a.indexOf(f)&&a.push(f);b=0;for(var k=i.length;b<k;b++){var q=i[b],r=h.getData(j.type,b),s;s=null;for(var t=0,u=d.length;t<u&&null==s;t++){var v=d[t];if(v.time===q)s=v;else if(v.time>q)break}if(!s){s=new l(q);t=-1;u=0;for(v=d.length;u<v&&-1==t;u++)d[u].time>=q&&(t=u);q=t;d.splice(-1==q?d.length:
-q,0,s)}s.addTarget(f,j,g,r)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(s=d[b],!s.hasTarget(e)){h=d;f=s;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;r=void 0;if(k.length){r=[];for(q=0;q<
-k.length;++q)r[q]=k[q]+(j[q]-k[q])*h}else r=k+(j-k)*h;f.addTarget(g,i.transform,i.member,r)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};m.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=T(a.textContent);this.convert();return this};m.prototype.convert=function(){switch(this.type){case "matrix":this.obj=Z(this.data);
-break;case "rotate":this.angle=this.data[3]*mb;case "translate":ha(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":ha(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};m.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,
-this.angle);break;case "scale":a.scale(this.obj)}};m.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=
+break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(Wa){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,l=this.getTransformBySid(b.sid);if(l){-1===a.indexOf(f)&&a.push(f);b=0;for(var k=i.length;b<k;b++){var q=i[b],r=h.getData(l.type,b),s;s=null;for(var t=0,u=d.length;t<u&&null==s;t++){var v=d[t];if(v.time===q)s=v;else if(v.time>q)break}if(!s){s=new j(q);t=-1;u=0;for(v=d.length;u<v&&-1==t;u++)d[u].time>=q&&(t=u);q=t;d.splice(-1==q?d.length:
+q,0,s)}s.addTarget(f,l,g,r)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(s=d[b],!s.hasTarget(e)){h=d;f=s;l=b;g=e;i=void 0;a:{i=l?l-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(l+=1;l<h.length;l++)if(k=h[l],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-i.time);i=i.getTarget(g);l=k.getTarget(g).data;k=i.data;r=void 0;if(k.length){r=[];for(q=0;q<
+k.length;++q)r[q]=k[q]+(l[q]-k[q])*h}else r=k+(l-k)*h;f.addTarget(g,i.transform,i.member,r)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};n.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=U(a.textContent);this.convert();return this};n.prototype.convert=function(){switch(this.type){case "matrix":this.obj=aa(this.data);
+break;case "rotate":this.angle=this.data[3]*mb;case "translate":ha(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":ha(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};n.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,
+this.angle);break;case "scale":a.scale(this.obj)}};n.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=
 a*mb;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*mb}}};o.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=S.evaluate(".//dae:instance_material",c,y,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(1==c.nodeType&&"bind_material"==c.nodeName){if(a=S.evaluate(".//dae:instance_material",c,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+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};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(1==c.nodeType&&"bind_material"==c.nodeName){if(a=S.evaluate(".//dae:instance_material",c,y,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 s(this)).parse(c)}}return this};s.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==Ia[d]&&(Ia[d]=
-(new F(d)).parse(c));break;case "vertices":this.vertices=(new w).parse(c);break;case "triangles":this.primitives.push((new v).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new u).parse(c))}}this.geometry3js=new THREE.Geometry;a=Ia[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(R(a,b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),
-this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.calcNormals&&(this.geometry3js.computeVertexNormals(),delete this.geometry3js.calcNormals);this.geometry3js.computeBoundingBox();return this};s.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,l=0,m=3,n=0,o=[];for(d=0;d<g.length;d++){h=g[d];var p=h.offset+1,n=n<p?p:n;switch(h.semantic){case "TEXCOORD":o.push(h.set)}}for(;c<f.length;){var q=
-[],r=[],p={},s=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=Ia[h.source],i=f[c+d*n+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":q.push(i);break;case "NORMAL":r.push(R(k.data,j));break;case "TEXCOORD":void 0===p[h.set]&&(p[h.set]=[]);p[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(0==r.length)if(h=this.vertices.input.NORMAL){k=Ia[h.source];
-j=k.accessor.params.length;h=0;for(i=q.length;h<i;h++)r.push(R(k.data,q[h]*j))}else b.calcNormals=!0;if(3===m)d.push(new THREE.Face3(q[0],q[1],q[2],r,s.length?s:new THREE.Color));else if(4===m)d.push(new THREE.Face4(q[0],q[1],q[2],q[3],r,s.length?s:new THREE.Color));else if(4<m&&Oa.subdivideFaces){s=s.length?s:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(q[0],q[e],q[e+1],[r[0],r[e++],r[e]],s))}if(d.length){h=0;for(i=d.length;h<i;h++){e=d[h];e.daeMaterial=a.material;b.faces.push(e);for(e=
-0;e<o.length;e++)q=p[o[e]],q=4<m?[q[0],q[h+1],q[h+2]]:4===m?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(q)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=n*m}};u.prototype=new v;u.prototype.constructor=u;v.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};v.prototype.parse=function(a){this.inputs=[];this.material=
+(new B(d)).parse(c));break;case "vertices":this.vertices=(new w).parse(c);break;case "triangles":this.primitives.push((new v).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new u).parse(c))}}this.geometry3js=new THREE.Geometry;a=Ia[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(R(a,b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),
+this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.calcNormals&&(this.geometry3js.computeVertexNormals(),delete this.geometry3js.calcNormals);this.geometry3js.computeBoundingBox();return this};s.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,m,l=0,k=3,n=0,o=[];for(d=0;d<g.length;d++){h=g[d];var p=h.offset+1,n=n<p?p:n;switch(h.semantic){case "TEXCOORD":o.push(h.set)}}for(;c<f.length;){var q=
+[],r=[],p={},s=[];a.vcount&&(k=a.vcount[l++]);for(d=0;d<k;d++)for(e=0;e<g.length;e++)switch(h=g[e],m=Ia[h.source],i=f[c+d*n+h.offset],j=m.accessor.params.length,j*=i,h.semantic){case "VERTEX":q.push(i);break;case "NORMAL":r.push(R(m.data,j));break;case "TEXCOORD":void 0===p[h.set]&&(p[h.set]=[]);p[h.set].push(new THREE.UV(m.data[j],1-m.data[j+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(m.data[j],m.data[j+1],m.data[j+2]))}e=null;d=[];if(0==r.length)if(h=this.vertices.input.NORMAL){m=Ia[h.source];
+j=m.accessor.params.length;h=0;for(i=q.length;h<i;h++)r.push(R(m.data,q[h]*j))}else b.calcNormals=!0;if(3===k)d.push(new THREE.Face3(q[0],q[1],q[2],r,s.length?s:new THREE.Color));else if(4===k)d.push(new THREE.Face4(q[0],q[1],q[2],q[3],r,s.length?s:new THREE.Color));else if(4<k&&Oa.subdivideFaces){s=s.length?s:new THREE.Color;for(e=1;e<k-1;)d.push(new THREE.Face3(q[0],q[e],q[e+1],[r[0],r[e++],r[e]],s))}if(d.length){h=0;for(i=d.length;h<i;h++){e=d[h];e.daeMaterial=a.material;b.faces.push(e);for(e=
+0;e<o.length;e++)q=p[o[e]],q=4<k?[q[0],q[h+1],q[h+2]]:4===k?[q[0],q[1],q[2],q[3]]:[q[0],q[1],q[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(q)}}else console.log("dropped face with vcount "+k+" for geometry with id: "+b.id);c+=n*k}};u.prototype=new v;u.prototype.constructor=u;v.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};v.prototype.parse=function(a){this.inputs=[];this.material=
 a.getAttribute("material");this.count=ja(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=P(c.textContent);break;case "p":this.p=P(c.textContent)}}return this};t.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=ja(a,"count",0);this.stride=ja(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==
 c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){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=ja(a,"set",-1);this.offset=ja(a,"offset",0);
-if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};F.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=da(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=T(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=P(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=
-da(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new t).parse(c.childNodes[d]);break}}}return this};F.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),c=Z(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+
-b.type+".")}return a};C.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new L).parse(a.childNodes[b]);break}return this};D.prototype.isColor=function(){return null==this.texture};D.prototype.isTexture=function(){return null!=this.texture};D.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=
-T(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};D.prototype.parseTexture=function(a){if(!a.childNodes)return this;a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&
-(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};I.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=
-(new D).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=S.evaluate(".//dae:float",c,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};I.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];
-if(d instanceof D)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=oa[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(db+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else"diffuse"==
+if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};B.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=fa(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=U(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=P(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=
+fa(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new t).parse(c.childNodes[d]);break}}}return this};B.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),c=aa(c);a.push(c)}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("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new L).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return null==this.texture};C.prototype.isTexture=function(){return null!=this.texture};C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=
+U(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};C.prototype.parseTexture=function(a){if(!a.childNodes)return this;a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&
+(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};H.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=
+(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=S.evaluate(".//dae:float",c,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};H.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];
+if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=oa[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(db+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else"diffuse"==
 c?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=Ba;return this.material=new THREE.MeshLambertMaterial(a)};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+
 c.nodeName)}}return this};O.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)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};
 Q.prototype.create=function(){if(null==this.shader)return null};Q.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(1==c.nodeType)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};Q.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=
 (new K(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new O(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};Q.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)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};
-Q.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new I(c.nodeName,this)).parse(c)}}};L.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};B.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(1==c.nodeType)switch(c.nodeName){case "source":c=(new F).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new E(this)).parse(c));break;case "channel":this.channel.push((new N(this)).parse(c))}}return this};N.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=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();
+Q.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new H(c.nodeName,this)).parse(c)}}};L.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};D.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(1==c.nodeType)switch(c.nodeName){case "source":c=(new B).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new E(this)).parse(c));break;case "channel":this.channel.push((new N(this)).parse(c))}}return this};N.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=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();
 else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};E.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(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new z).parse(c))}}return this};E.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=
 this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),
-this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};E.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":ha(c,-1);break;case "scale":ha(c,1)}}else c=this.output[b];return c};l.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};l.prototype.apply=function(a){for(var b=
-0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};l.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};l.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};l.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/
-(a.time-this.time),g=e.data,h=d.data;if(0>f||1<f)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=0>f?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};Y.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};Y.prototype.parseOptics=
-function(a){for(var b=0;b<a.childNodes.length;b++)if("technique_common"==a.childNodes[b].nodeName)for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++)if("perspective"==c.childNodes[d].nodeName)for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];switch(g.nodeName){case "xfov":this.fov=g.textContent;break;case "znear":this.znear=0.4;break;case "zfar":this.zfar=1E15;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}return this};G.prototype.parse=function(a){this.url=
+this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};E.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":ha(c,-1);break;case "scale":ha(c,1)}}else c=this.output[b];return c};j.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};j.prototype.apply=function(a){for(var b=
+0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};j.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};j.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};j.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/
+(a.time-this.time),g=e.data,h=d.data;if(0>f||1<f)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=0>f?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};Z.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};Z.prototype.parseOptics=
+function(a){for(var b=0;b<a.childNodes.length;b++)if("technique_common"==a.childNodes[b].nodeName)for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++)if("perspective"==c.childNodes[d].nodeName)for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];switch(g.nodeName){case "xfov":this.fov=g.textContent;break;case "znear":this.znear=0.4;break;case "zfar":this.zfar=1E15;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}return this};F.prototype.parse=function(a){this.url=
 a.getAttribute("url").replace(/^#/,"");return this};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(Ua=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==f.readyState&&d&&(0==e&&(e=f.getResponseHeader("Content-Length")),
 d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Ba=a},applySkin:e,geometries:ka,options:Oa}};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){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 f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),
 e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,i,k,j,p,m,o,q,n,r,s,u,v,t=a.faces;p=a.vertices;var w=a.normals,z=a.colors,F=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&F++;for(c=0;c<F;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=p.length;k<j;)m=new THREE.Vertex,m.position.x=p[k++]*b,m.position.y=p[k++]*b,m.position.z=p[k++]*b,d.vertices.push(m);k=0;for(j=t.length;k<j;){b=
-t[k++];p=b&1;i=b&2;c=b&4;e=b&8;o=b&16;m=b&32;n=b&64;b&=128;p?(r=new THREE.Face4,r.a=t[k++],r.b=t[k++],r.c=t[k++],r.d=t[k++],p=4):(r=new THREE.Face3,r.a=t[k++],r.b=t[k++],r.c=t[k++],p=3);if(i)i=t[k++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<F;c++)s=a.uvs[c],q=t[k++],v=s[2*q],q=s[2*q+1],d.faceUvs[c][i]=new THREE.UV(v,q);if(e)for(c=0;c<F;c++){s=a.uvs[c];u=[];for(e=0;e<p;e++)q=t[k++],v=s[2*q],q=s[2*q+1],u[e]=new THREE.UV(v,q);d.faceVertexUvs[c][i]=u}if(o)o=3*t[k++],e=new THREE.Vector3,e.x=w[o++],
-e.y=w[o++],e.z=w[o],r.normal=e;if(m)for(c=0;c<p;c++)o=3*t[k++],e=new THREE.Vector3,e.x=w[o++],e.y=w[o++],e.z=w[o],r.vertexNormals.push(e);if(n)m=t[k++],m=new THREE.Color(z[m]),r.color=m;if(b)for(c=0;c<p;c++)m=t[k++],m=new THREE.Color(z[m]),r.vertexColors.push(m);d.faces.push(r)}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,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)for(b=0,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(void 0!==a.morphTargets){var c,e,i,k,j,p,m,o,q;for(c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;q=a.morphTargets[c].vertices;for(i=0,k=q.length;i<k;i+=3)j=q[i]*b,p=q[i+1]*b,m=q[i+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(j,p,
-m)))}}if(void 0!==a.morphColors)for(c=0,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;for(b=0,i=j.length;b<i;b+=3)p=new THREE.Color(16755200),p.setRGB(j[b],j[b+1],j[b+2]),k.push(p)}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,e,i,l,k,p,n,o,q,m,r,s,u,v,t=a.faces;p=a.vertices;var w=a.normals,z=a.colors,B=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&B++;for(c=0;c<B;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(k=p.length;l<k;)n=new THREE.Vertex,n.position.x=p[l++]*b,n.position.y=p[l++]*b,n.position.z=p[l++]*b,d.vertices.push(n);l=0;for(k=t.length;l<k;){b=
+t[l++];p=b&1;i=b&2;c=b&4;e=b&8;o=b&16;n=b&32;m=b&64;b&=128;p?(r=new THREE.Face4,r.a=t[l++],r.b=t[l++],r.c=t[l++],r.d=t[l++],p=4):(r=new THREE.Face3,r.a=t[l++],r.b=t[l++],r.c=t[l++],p=3);if(i)i=t[l++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<B;c++)s=a.uvs[c],q=t[l++],v=s[2*q],q=s[2*q+1],d.faceUvs[c][i]=new THREE.UV(v,q);if(e)for(c=0;c<B;c++){s=a.uvs[c];u=[];for(e=0;e<p;e++)q=t[l++],v=s[2*q],q=s[2*q+1],u[e]=new THREE.UV(v,q);d.faceVertexUvs[c][i]=u}if(o)o=3*t[l++],e=new THREE.Vector3,e.x=w[o++],
+e.y=w[o++],e.z=w[o],r.normal=e;if(n)for(c=0;c<p;c++)o=3*t[l++],e=new THREE.Vector3,e.x=w[o++],e.y=w[o++],e.z=w[o],r.vertexNormals.push(e);if(m)n=t[l++],n=new THREE.Color(z[n]),r.color=n;if(b)for(c=0;c<p;c++)n=t[l++],n=new THREE.Color(z[n]),r.vertexColors.push(n);d.faces.push(r)}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,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)for(b=0,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(void 0!==a.morphTargets){var c,e,i,l,k,p,n,o,q;for(c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;q=a.morphTargets[c].vertices;for(i=0,l=q.length;i<l;i+=3)k=q[i]*b,p=q[i+1]*b,n=q[i+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(k,p,
+n)))}}if(void 0!==a.morphColors)for(c=0,e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;k=a.morphColors[c].colors;for(b=0,i=k.length;b<i;b+=3)p=new THREE.Color(16755200),p.setRGB(k[b],k[b+1],k[b+2]),l.push(p)}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status||0==d.status){var e=JSON.parse(d.responseText);c.createScene(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.overrideMimeType&&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"relativeToHTML"==b?a:k+"/"+a}function e(){var a;for(m in L.objects)if(!G.objects[m])if(s=L.objects[m],void 0!==s.geometry){if(I=G.geometries[s.geometry])a=!1,K=G.materials[s.materials[0]],(a=K instanceof THREE.ShaderMaterial)&&I.computeTangents(),t=s.position,w=s.rotation,z=s.quaternion,F=s.scale,z=0,0==s.materials.length&&(K=new THREE.MeshFaceMaterial),1<s.materials.length&&(K=new THREE.MeshFaceMaterial),a=new THREE.Mesh(I,
-K),a.name=m,a.position.set(t[0],t[1],t[2]),z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]),a.scale.set(F[0],F[1],F[2]),a.visible=s.visible,a.doubleSided=s.doubleSided,a.castShadow=s.castShadow,a.receiveShadow=s.receiveShadow,G.scene.add(a),G.objects[m]=a}else t=s.position,w=s.rotation,z=s.quaternion,F=s.scale,z=0,a=new THREE.Object3D,a.name=m,a.position.set(t[0],t[1],t[2]),z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(w[0],
-w[1],w[2]),a.scale.set(F[0],F[1],F[2]),a.visible=void 0!==s.visible?s.visible:!1,G.scene.add(a),G.objects[m]=a,G.empties[m]=a}function f(a){return function(b){G.geometries[a]=b;e();N-=1;i.onLoadComplete();h()}}function g(a){return function(b){G.geometries[a]=b}}function h(){i.callbackProgress({totalModels:l,totalTextures:Y,loadedModels:l-N,loadedTextures:Y-E},G);i.onLoadProgress();0==N&&0==E&&b(G)}var i=this,k=THREE.Loader.prototype.extractUrlBase(c),j,p,m,o,q,n,r,s,u,v,t,w,z,F,C,D,I,K,O,Q,L,B,N,
-E,l,Y,G;L=a;c=new THREE.BinaryLoader;B=new THREE.JSONLoader;E=N=0;G={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(L.transform&&(a=L.transform.position,u=L.transform.rotation,C=L.transform.scale,a&&G.scene.position.set(a[0],a[1],a[2]),u&&G.scene.rotation.set(u[0],u[1],u[2]),C&&G.scene.scale.set(C[0],C[1],C[2]),a||u||C))G.scene.updateMatrix(),G.scene.updateMatrixWorld();a=function(){E-=1;h();i.onLoadComplete()};for(q in L.cameras)C=
-L.cameras[q],"perspective"==C.type?O=new THREE.PerspectiveCamera(C.fov,C.aspect,C.near,C.far):"ortho"==C.type&&(O=new THREE.OrthographicCamera(C.left,C.right,C.top,C.bottom,C.near,C.far)),t=C.position,u=C.target,C=C.up,O.position.set(t[0],t[1],t[2]),O.target=new THREE.Vector3(u[0],u[1],u[2]),C&&O.up.set(C[0],C[1],C[2]),G.cameras[q]=O;for(o in L.lights)u=L.lights[o],q=void 0!==u.color?u.color:16777215,O=void 0!==u.intensity?u.intensity:1,"directional"==u.type?(t=u.direction,v=new THREE.DirectionalLight(q,
-O),v.position.set(t[0],t[1],t[2]),v.position.normalize()):"point"==u.type?(t=u.position,v=u.distance,v=new THREE.PointLight(q,O,v),v.position.set(t[0],t[1],t[2])):"ambient"==u.type&&(v=new THREE.AmbientLight(q)),G.scene.add(v),G.lights[o]=v;for(n in L.fogs)o=L.fogs[n],"linear"==o.type?Q=new THREE.Fog(0,o.near,o.far):"exp2"==o.type&&(Q=new THREE.FogExp2(0,o.density)),C=o.color,Q.color.setRGB(C[0],C[1],C[2]),G.fogs[n]=Q;if(G.cameras&&L.defaults.camera)G.currentCamera=G.cameras[L.defaults.camera];if(G.fogs&&
-L.defaults.fog)G.scene.fog=G.fogs[L.defaults.fog];C=L.defaults.bgcolor;G.bgColor=new THREE.Color;G.bgColor.setRGB(C[0],C[1],C[2]);G.bgColorAlpha=L.defaults.bgalpha;for(j in L.geometries)if(n=L.geometries[j],"bin_mesh"==n.type||"ascii_mesh"==n.type)N+=1,i.onLoadStart();l=N;for(j in L.geometries)if(n=L.geometries[j],"cube"==n.type)I=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),G.geometries[j]=I;else if("plane"==n.type)I=new THREE.PlaneGeometry(n.width,
-n.height,n.segmentsWidth,n.segmentsHeight),G.geometries[j]=I;else if("sphere"==n.type)I=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),G.geometries[j]=I;else if("cylinder"==n.type)I=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),G.geometries[j]=I;else if("torus"==n.type)I=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),G.geometries[j]=I;else if("icosahedron"==n.type)I=new THREE.IcosahedronGeometry(n.radius,n.subdivisions),G.geometries[j]=
-I;else if("bin_mesh"==n.type)c.load(d(n.url,L.urlBaseType),f(j));else if("ascii_mesh"==n.type)B.load(d(n.url,L.urlBaseType),f(j));else if("embedded_mesh"==n.type)n=L.embeds[n.id],n.metadata=L.metadata,n&&B.createModel(n,g(j),"");for(r in L.textures)if(j=L.textures[r],j.url instanceof Array){E+=j.url.length;for(n=0;n<j.url.length;n++)i.onLoadStart()}else E+=1,i.onLoadStart();Y=E;for(r in L.textures){j=L.textures[r];if(void 0!=j.mapping&&void 0!=THREE[j.mapping])j.mapping=new THREE[j.mapping];if(j.url instanceof
-Array){n=[];for(Q=0;Q<j.url.length;Q++)n[Q]=d(j.url[Q],L.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,j.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(j.url,L.urlBaseType),j.mapping,a);if(void 0!=THREE[j.minFilter])n.minFilter=THREE[j.minFilter];if(void 0!=THREE[j.magFilter])n.magFilter=THREE[j.magFilter];if(j.repeat){n.repeat.set(j.repeat[0],j.repeat[1]);if(1!=j.repeat[0])n.wrapS=THREE.RepeatWrapping;if(1!=j.repeat[1])n.wrapT=THREE.RepeatWrapping}j.offset&&n.offset.set(j.offset[0],j.offset[1]);
-if(j.wrap){Q={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==Q[j.wrap[0]])n.wrapS=Q[j.wrap[0]];if(void 0!==Q[j.wrap[1]])n.wrapT=Q[j.wrap[1]]}}G.textures[r]=n}for(p in L.materials){r=L.materials[p];for(D in r.parameters)if("envMap"==D||"map"==D||"lightMap"==D)r.parameters[D]=G.textures[r.parameters[D]];else if("shading"==D)r.parameters[D]="flat"==r.parameters[D]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==D)r.parameters[D]=THREE[r.parameters[D]]?THREE[r.parameters[D]]:
-THREE.NormalBlending;else if("combine"==D)r.parameters[D]="MixOperation"==r.parameters[D]?THREE.MixOperation:THREE.MultiplyOperation;else if("vertexColors"==D)if("face"==r.parameters[D])r.parameters[D]=THREE.FaceColors;else if(r.parameters[D])r.parameters[D]=THREE.VertexColors;if(void 0!==r.parameters.opacity&&1>r.parameters.opacity)r.parameters.transparent=!0;if(r.parameters.normalMap){a=THREE.ShaderUtils.lib.normal;j=THREE.UniformsUtils.clone(a.uniforms);n=r.parameters.color;Q=r.parameters.specular;
-c=r.parameters.ambient;B=r.parameters.shininess;j.tNormal.texture=G.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)j.uNormalScale.value=r.parameters.normalMapFactor;if(r.parameters.map)j.tDiffuse.texture=r.parameters.map,j.enableDiffuse.value=!0;if(r.parameters.lightMap)j.tAO.texture=r.parameters.lightMap,j.enableAO.value=!0;if(r.parameters.specularMap)j.tSpecular.texture=G.textures[r.parameters.specularMap],j.enableSpecular.value=!0;j.uDiffuseColor.value.setHex(n);j.uSpecularColor.value.setHex(Q);
-j.uAmbientColor.value.setHex(c);j.uShininess.value=B;if(r.parameters.opacity)j.uOpacity.value=r.parameters.opacity;K=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:j,lights:!0,fog:!0})}else K=new THREE[r.type](r.parameters);G.materials[p]=K}e();i.callbackSync(G);h()};THREE.UTF8Loader=function(){};
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:l+"/"+a}function e(){var a;for(n in L.objects)if(!F.objects[n])if(s=L.objects[n],void 0!==s.geometry){if(H=F.geometries[s.geometry])a=!1,K=F.materials[s.materials[0]],(a=K instanceof THREE.ShaderMaterial)&&H.computeTangents(),t=s.position,w=s.rotation,z=s.quaternion,B=s.scale,z=0,0==s.materials.length&&(K=new THREE.MeshFaceMaterial),1<s.materials.length&&(K=new THREE.MeshFaceMaterial),a=new THREE.Mesh(H,
+K),a.name=n,a.position.set(t[0],t[1],t[2]),z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]),a.scale.set(B[0],B[1],B[2]),a.visible=s.visible,a.doubleSided=s.doubleSided,a.castShadow=s.castShadow,a.receiveShadow=s.receiveShadow,F.scene.add(a),F.objects[n]=a}else t=s.position,w=s.rotation,z=s.quaternion,B=s.scale,z=0,a=new THREE.Object3D,a.name=n,a.position.set(t[0],t[1],t[2]),z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(w[0],
+w[1],w[2]),a.scale.set(B[0],B[1],B[2]),a.visible=void 0!==s.visible?s.visible:!1,F.scene.add(a),F.objects[n]=a,F.empties[n]=a}function f(a){return function(b){F.geometries[a]=b;e();N-=1;i.onLoadComplete();h()}}function g(a){return function(b){F.geometries[a]=b}}function h(){i.callbackProgress({totalModels:j,totalTextures:Z,loadedModels:j-N,loadedTextures:Z-E},F);i.onLoadProgress();0==N&&0==E&&b(F)}var i=this,l=THREE.Loader.prototype.extractUrlBase(c),k,p,n,o,q,m,r,s,u,v,t,w,z,B,I,C,H,K,O,Q,L,D,N,
+E,j,Z,F;L=a;c=new THREE.BinaryLoader;D=new THREE.JSONLoader;E=N=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(L.transform&&(a=L.transform.position,u=L.transform.rotation,I=L.transform.scale,a&&F.scene.position.set(a[0],a[1],a[2]),u&&F.scene.rotation.set(u[0],u[1],u[2]),I&&F.scene.scale.set(I[0],I[1],I[2]),a||u||I))F.scene.updateMatrix(),F.scene.updateMatrixWorld();a=function(){E-=1;h();i.onLoadComplete()};for(q in L.cameras)I=
+L.cameras[q],"perspective"==I.type?O=new THREE.PerspectiveCamera(I.fov,I.aspect,I.near,I.far):"ortho"==I.type&&(O=new THREE.OrthographicCamera(I.left,I.right,I.top,I.bottom,I.near,I.far)),t=I.position,u=I.target,I=I.up,O.position.set(t[0],t[1],t[2]),O.target=new THREE.Vector3(u[0],u[1],u[2]),I&&O.up.set(I[0],I[1],I[2]),F.cameras[q]=O;for(o in L.lights)u=L.lights[o],q=void 0!==u.color?u.color:16777215,O=void 0!==u.intensity?u.intensity:1,"directional"==u.type?(t=u.direction,v=new THREE.DirectionalLight(q,
+O),v.position.set(t[0],t[1],t[2]),v.position.normalize()):"point"==u.type?(t=u.position,v=u.distance,v=new THREE.PointLight(q,O,v),v.position.set(t[0],t[1],t[2])):"ambient"==u.type&&(v=new THREE.AmbientLight(q)),F.scene.add(v),F.lights[o]=v;for(m in L.fogs)o=L.fogs[m],"linear"==o.type?Q=new THREE.Fog(0,o.near,o.far):"exp2"==o.type&&(Q=new THREE.FogExp2(0,o.density)),I=o.color,Q.color.setRGB(I[0],I[1],I[2]),F.fogs[m]=Q;if(F.cameras&&L.defaults.camera)F.currentCamera=F.cameras[L.defaults.camera];if(F.fogs&&
+L.defaults.fog)F.scene.fog=F.fogs[L.defaults.fog];I=L.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(I[0],I[1],I[2]);F.bgColorAlpha=L.defaults.bgalpha;for(k in L.geometries)if(m=L.geometries[k],"bin_mesh"==m.type||"ascii_mesh"==m.type)N+=1,i.onLoadStart();j=N;for(k in L.geometries)if(m=L.geometries[k],"cube"==m.type)H=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),F.geometries[k]=H;else if("plane"==m.type)H=new THREE.PlaneGeometry(m.width,
+m.height,m.segmentsWidth,m.segmentsHeight),F.geometries[k]=H;else if("sphere"==m.type)H=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),F.geometries[k]=H;else if("cylinder"==m.type)H=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),F.geometries[k]=H;else if("torus"==m.type)H=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),F.geometries[k]=H;else if("icosahedron"==m.type)H=new THREE.IcosahedronGeometry(m.radius,m.subdivisions),F.geometries[k]=
+H;else if("bin_mesh"==m.type)c.load(d(m.url,L.urlBaseType),f(k));else if("ascii_mesh"==m.type)D.load(d(m.url,L.urlBaseType),f(k));else if("embedded_mesh"==m.type)m=L.embeds[m.id],m.metadata=L.metadata,m&&D.createModel(m,g(k),"");for(r in L.textures)if(k=L.textures[r],k.url instanceof Array){E+=k.url.length;for(m=0;m<k.url.length;m++)i.onLoadStart()}else E+=1,i.onLoadStart();Z=E;for(r in L.textures){k=L.textures[r];if(void 0!=k.mapping&&void 0!=THREE[k.mapping])k.mapping=new THREE[k.mapping];if(k.url instanceof
+Array){m=[];for(Q=0;Q<k.url.length;Q++)m[Q]=d(k.url[Q],L.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(k.url,L.urlBaseType),k.mapping,a);if(void 0!=THREE[k.minFilter])m.minFilter=THREE[k.minFilter];if(void 0!=THREE[k.magFilter])m.magFilter=THREE[k.magFilter];if(k.repeat){m.repeat.set(k.repeat[0],k.repeat[1]);if(1!=k.repeat[0])m.wrapS=THREE.RepeatWrapping;if(1!=k.repeat[1])m.wrapT=THREE.RepeatWrapping}k.offset&&m.offset.set(k.offset[0],k.offset[1]);
+if(k.wrap){Q={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==Q[k.wrap[0]])m.wrapS=Q[k.wrap[0]];if(void 0!==Q[k.wrap[1]])m.wrapT=Q[k.wrap[1]]}}F.textures[r]=m}for(p in L.materials){r=L.materials[p];for(C in r.parameters)if("envMap"==C||"map"==C||"lightMap"==C)r.parameters[C]=F.textures[r.parameters[C]];else if("shading"==C)r.parameters[C]="flat"==r.parameters[C]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==C)r.parameters[C]=THREE[r.parameters[C]]?THREE[r.parameters[C]]:
+THREE.NormalBlending;else if("combine"==C)r.parameters[C]="MixOperation"==r.parameters[C]?THREE.MixOperation:THREE.MultiplyOperation;else if("vertexColors"==C)if("face"==r.parameters[C])r.parameters[C]=THREE.FaceColors;else if(r.parameters[C])r.parameters[C]=THREE.VertexColors;if(void 0!==r.parameters.opacity&&1>r.parameters.opacity)r.parameters.transparent=!0;if(r.parameters.normalMap){a=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(a.uniforms);m=r.parameters.color;Q=r.parameters.specular;
+c=r.parameters.ambient;D=r.parameters.shininess;k.tNormal.texture=F.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)k.uNormalScale.value=r.parameters.normalMapFactor;if(r.parameters.map)k.tDiffuse.texture=r.parameters.map,k.enableDiffuse.value=!0;if(r.parameters.lightMap)k.tAO.texture=r.parameters.lightMap,k.enableAO.value=!0;if(r.parameters.specularMap)k.tSpecular.texture=F.textures[r.parameters.specularMap],k.enableSpecular.value=!0;k.uDiffuseColor.value.setHex(m);k.uSpecularColor.value.setHex(Q);
+k.uAmbientColor.value.setHex(c);k.uShininess.value=D;if(r.parameters.opacity)k.uOpacity.value=r.parameters.opacity;K=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:k,lights:!0,fog:!0})}else K=new THREE[r.type](r.parameters);F.materials[p]=K}e();i.callbackSync(F);h()};THREE.UTF8Loader=function(){};
 THREE.UTF8Loader.prototype.load=function(a,b,c){var d=new XMLHttpRequest,e=void 0!==c.scale?c.scale:1,f=void 0!==c.offsetX?c.offsetX:0,g=void 0!==c.offsetY?c.offsetY:0,h=void 0!==c.offsetZ?c.offsetZ:0;d.onreadystatechange=function(){4==d.readyState?200==d.status||0==d.status?THREE.UTF8Loader.prototype.createModel(d.responseText,b,e,f,g,h):console.error("THREE.UTF8Loader: Couldn't load ["+a+"] ["+d.status+"]"):3!=d.readyState&&2==d.readyState&&d.getResponseHeader("Content-Length")};d.open("GET",a,
 !0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);57344<=b&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;8>e;e++){for(var f=0,g=0;g<b;++g){var h=a.charCodeAt(g+d),f=f+(h>>1^-(h&1));c[8*g+e]=f}d+=b}b=a.length-d;f=new Uint16Array(b);for(e=g=0;e<b;e++)h=a.charCodeAt(e+d),f[e]=g-h,0==h&&g++;return[c,f]};
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,f){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,g,i){for(var j,k,r,s=a.length;i<s;i+=g)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+=f,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,r)))})(g[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)})(g[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)})(g[0],8,5);(function(a){var c,d,e,f,g,i,u,v,t,w=a.length;for(c=0;c<w;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;v=d;t=e;i=f;var z=k[3*e],F=k[3*e+1],C=k[3*e+2],D=k[3*f],I=k[3*f+1],K=k[3*f+2];u=new THREE.Vector3(k[3*d],k[3*d+1],k[3*d+2]);z=new THREE.Vector3(z,F,C);D=new THREE.Vector3(D,I,K);g.faces.push(new THREE.Face3(v,t,i,[u,z,D],null,0));g=j[2*d];d=j[2*d+1];i=j[2*e];u=j[2*e+1];v=j[2*
-f];t=j[2*f+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(v,t));f.push(u)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};
-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(3*this.size3);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(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,f,g,h,i,k,j,p){g=(g-j)/(p-j);j=this.normal_cache;b[f]=h+g*this.delta;b[f+1]=i;b[f+2]=k;e[f]=this.lerp(j[a],j[a+3],g);e[f+1]=this.lerp(j[a+1],j[a+4],g);e[f+2]=this.lerp(j[a+2],j[a+5],g)};this.VIntY=function(a,b,e,f,g,h,i,k,j,p){g=(g-j)/(p-j);j=this.normal_cache;b[f]=h;b[f+1]=i+g*this.delta;b[f+2]=k;b=a+3*this.yd;
-e[f]=this.lerp(j[a],j[b],g);e[f+1]=this.lerp(j[a+1],j[b+1],g);e[f+2]=this.lerp(j[a+2],j[b+2],g)};this.VIntZ=function(a,b,e,f,g,h,i,k,j,p){g=(g-j)/(p-j);j=this.normal_cache;b[f]=h;b[f+1]=i;b[f+2]=k+g*this.delta;b=a+3*this.zd;e[f]=this.lerp(j[a],j[b],g);e[f+1]=this.lerp(j[a+1],j[b+1],g);e[f+2]=this.lerp(j[a+2],j[b+2],g)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(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,f,g,h){var i=f+1,k=f+this.yd,j=f+this.zd,p=i+this.yd,m=i+this.zd,o=f+this.yd+this.zd,q=i+this.yd+this.zd,n=0,r=this.field[f],s=this.field[i],u=this.field[k],v=this.field[p],t=this.field[j],w=this.field[m],z=this.field[o],F=this.field[q];r<g&&(n|=1);s<g&&(n|=2);u<g&&(n|=8);v<g&&(n|=4);t<g&&(n|=16);w<g&&(n|=32);z<g&&(n|=128);F<g&&(n|=64);var C=THREE.edgeTable[n];if(0===C)return 0;var D=this.delta,I=a+
-D,K=b+D,D=e+D;C&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(3*f,this.vlist,this.nlist,0,g,a,b,e,r,s));C&2&&(this.compNorm(i),this.compNorm(p),this.VIntY(3*i,this.vlist,this.nlist,3,g,I,b,e,s,v));C&4&&(this.compNorm(k),this.compNorm(p),this.VIntX(3*k,this.vlist,this.nlist,6,g,a,K,e,u,v));C&8&&(this.compNorm(f),this.compNorm(k),this.VIntY(3*f,this.vlist,this.nlist,9,g,a,b,e,r,u));C&16&&(this.compNorm(j),this.compNorm(m),this.VIntX(3*j,this.vlist,this.nlist,12,g,a,b,D,t,w));C&32&&(this.compNorm(m),
-this.compNorm(q),this.VIntY(3*m,this.vlist,this.nlist,15,g,I,b,D,w,F));C&64&&(this.compNorm(o),this.compNorm(q),this.VIntX(3*o,this.vlist,this.nlist,18,g,a,K,D,z,F));C&128&&(this.compNorm(j),this.compNorm(o),this.VIntY(3*j,this.vlist,this.nlist,21,g,a,b,D,t,z));C&256&&(this.compNorm(f),this.compNorm(j),this.VIntZ(3*f,this.vlist,this.nlist,24,g,a,b,e,r,t));C&512&&(this.compNorm(i),this.compNorm(m),this.VIntZ(3*i,this.vlist,this.nlist,27,g,I,b,e,s,w));C&1024&&(this.compNorm(p),this.compNorm(q),this.VIntZ(3*
-p,this.vlist,this.nlist,30,g,I,K,e,v,F));C&2048&&(this.compNorm(k),this.compNorm(o),this.VIntZ(3*k,this.vlist,this.nlist,33,g,a,K,e,u,z));n<<=4;for(g=f=0;-1!=THREE.triTable[n+g];)a=n+g,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),g+=3,f++;return f};this.posnormtriv=function(a,b,e,f,g,h){var i=3*this.count;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[f];this.positionArray[i+
-4]=a[f+1];this.positionArray[i+5]=a[f+2];this.positionArray[i+6]=a[g];this.positionArray[i+7]=a[g+1];this.positionArray[i+8]=a[g+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[f];this.normalArray[i+4]=b[f+1];this.normalArray[i+5]=b[f+2];this.normalArray[i+6]=b[g];this.normalArray[i+7]=b[g+1];this.normalArray[i+8]=b[g+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(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,f,g){var h=this.size*Math.sqrt(f/g),i=e*this.size,k=b*this.size,j=a*this.size,p=Math.floor(i-h);1>p&&(p=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var m=Math.floor(k-h);1>m&&(m=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var o=Math.floor(j-h);1>o&&(o=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
-1);for(var q,n,r,s,u,v,t,j=p;j<i;j++){r=this.size2*j;u=j/this.size-e;v=u*u;for(p=m;p<k;p++){n=r+this.size*p;q=p/this.size-b;t=q*q;for(q=o;q<h;q++)s=q/this.size-a,s=f/(1.0E-6+s*s+t+v)-g,0<s&&(this.field[n+q]+=s)}}};this.addPlaneX=function(a,b){var e,f,g,h,i,k=this.size,j=this.yd,p=this.zd,m=this.field,o=k*Math.sqrt(a/b);o>k&&(o=k);for(e=0;e<o;e++)if(f=e/k,f*=f,h=a/(1.0E-4+f)-b,0<h)for(f=0;f<k;f++){i=e+f*j;for(g=0;g<k;g++)m[p*g+i]+=h}};this.addPlaneY=function(a,b){var e,f,g,h,i,k,j=this.size,p=this.yd,
-m=this.zd,o=this.field,q=j*Math.sqrt(a/b);q>j&&(q=j);for(f=0;f<q;f++)if(e=f/j,e*=e,h=a/(1.0E-4+e)-b,0<h){i=f*p;for(e=0;e<j;e++){k=i+e;for(g=0;g<j;g++)o[m*g+k]+=h}}};this.addPlaneZ=function(a,b){var e,f,g,h,i,k,j=this.size,p=this.yd,m=this.zd,o=this.field,q=j*Math.sqrt(a/b);q>j&&(q=j);for(g=0;g<q;g++)if(e=g/j,e*=e,h=a/(1.0E-4+e)-b,0<h){i=m*g;for(f=0;f<j;f++){k=i+f*p;for(e=0;e<j;e++)o[k+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
-function(a){this.begin();var b,e,f,g,h,i,k,j,p,m=this.size-2;for(g=1;g<m;g++){p=this.size2*g;k=(g-this.halfsize)/this.halfsize;for(f=1;f<m;f++){j=p+this.size*f;i=(f-this.halfsize)/this.halfsize;for(e=1;e<m;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(f){var g,h,i,k,j,p,m,o;for(g=0;g<f.count;g++)m=3*g,j=m+1,o=m+2,h=f.positionArray[m],i=f.positionArray[j],k=
-f.positionArray[o],p=new THREE.Vector3(h,i,k),h=f.normalArray[m],i=f.normalArray[j],k=f.normalArray[o],m=new THREE.Vector3(h,i,k),m.normalize(),j=new THREE.Vertex(p),b.vertices.push(j),e.push(m);p=f.count/3;for(g=0;g<p;g++)m=3*(a+g),j=m+1,o=m+2,h=e[m],i=e[j],k=e[o],m=new THREE.Face3(m,j,o,[h,i,k]),b.faces.push(m);a+=p;f.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]);
-THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,
--1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,
-8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,
--1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,
-5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,
--1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,
-10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,
-6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,
-8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,
-2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,
--1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,
--1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,
--1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,
--1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,
-2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,
-4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;
-THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,f){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],k=[];(function(a,g,i){for(var l,m,k,s=a.length;i<s;i+=g)l=a[i],m=a[i+1],k=a[i+2],l=l/16383*c,m=m/16383*c,k=k/16383*c,l+=d,m+=e,k+=f,b.vertices.push(new THREE.Vertex(new THREE.Vector3(l,m,k)))})(g[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)})(g[0],8,3);(function(a,
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,l.push(d,e,f)})(g[0],8,5);(function(a){var c,d,e,f,g,i,u,v,t,w=a.length;for(c=0;c<w;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;v=d;t=e;i=f;var z=l[3*e],B=l[3*e+1],I=l[3*e+2],C=l[3*f],H=l[3*f+1],K=l[3*f+2];u=new THREE.Vector3(l[3*d],l[3*d+1],l[3*d+2]);z=new THREE.Vector3(z,B,I);C=new THREE.Vector3(C,H,K);g.faces.push(new THREE.Face3(v,t,i,[u,z,C],null,0));g=k[2*d];d=k[2*d+1];i=k[2*e];u=k[2*e+1];v=k[2*
+f];t=k[2*f+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(v,t));f.push(u)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
+THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
+THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
 THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
 THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=new THREE.Mesh;THREE.MorphBlendMesh.prototype.constructor=THREE.MorphBlendMesh;
 THREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[a]=b;this.animationsList.push(b)};
@@ -783,43 +747,43 @@ THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.ani
 THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};
 THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time){d.direction*=-1;if(d.time>d.duration)d.time=d.duration,d.directionBackwards=!0;if(0>d.time)d.time=0,d.directionBackwards=!1}}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight;
 if(f!==d.currentFrame)this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f;e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,i,k,j,p,m,o;this.init=function(q){b=q.context;c=q;d=new Float32Array(16);e=new Uint16Array(6);q=0;d[q++]=-1;d[q++]=-1;d[q++]=0;d[q++]=0;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,i,l,k,p,n,o;this.init=function(q){b=q.context;c=q;d=new Float32Array(16);e=new Uint16Array(6);q=0;d[q++]=-1;d[q++]=-1;d[q++]=0;d[q++]=0;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=
 0;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=0;d[q++]=1;q=0;e[q++]=0;e[q++]=1;e[q++]=2;e[q++]=0;e[q++]=2;e[q++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);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,i);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);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(k=!1,j=a(THREE.ShaderFlares.lensFlare)):(k=!0,j=a(THREE.ShaderFlares.lensFlareVertexTexture));p={};m={};p.vertex=b.getAttribLocation(j,"position");p.uv=b.getAttribLocation(j,"uv");m.renderType=b.getUniformLocation(j,"renderType");m.map=b.getUniformLocation(j,"map");m.occlusionMap=b.getUniformLocation(j,"occlusionMap");m.opacity=b.getUniformLocation(j,"opacity");m.color=b.getUniformLocation(j,
-"color");m.scale=b.getUniformLocation(j,"scale");m.rotation=b.getUniformLocation(j,"rotation");m.screenPosition=b.getUniformLocation(j,"screenPosition");o=!1};this.render=function(a,d,e,s){var a=a.__webglFlares,u=a.length;if(u){var v=new THREE.Vector3,t=s/e,w=0.5*e,z=0.5*s,F=16/s,C=new THREE.Vector2(F*t,F),D=new THREE.Vector3(1,1,0),I=new THREE.Vector2(1,1),K=m,F=p;b.useProgram(j);o||(b.enableVertexAttribArray(p.vertex),b.enableVertexAttribArray(p.uv),o=!0);b.uniform1i(K.occlusionMap,0);b.uniform1i(K.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(F.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(F.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var O,Q,L,B,N;for(O=0;O<u;O++)if(F=16/s,C.set(F*t,F),B=a[O],v.set(B.matrixWorld.n14,B.matrixWorld.n24,B.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(v),d.projectionMatrix.multiplyVector3(v),D.copy(v),I.x=D.x*w+w,I.y=D.y*z+z,k||0<I.x&&I.x<e&&0<I.y&&I.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
-h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,I.x-8,I.y-8,16,16,0);b.uniform1i(K.renderType,0);b.uniform2f(K.scale,C.x,C.y);b.uniform3f(K.screenPosition,D.x,D.y,D.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,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,I.x-8,I.y-8,16,16,0);b.uniform1i(K.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
-6,b.UNSIGNED_SHORT,0);B.positionScreen.copy(D);B.customUpdateCallback?B.customUpdateCallback(B):B.updateLensFlares();b.uniform1i(K.renderType,2);b.enable(b.BLEND);for(Q=0,L=B.lensFlares.length;Q<L;Q++)if(N=B.lensFlares[Q],0.0010<N.opacity&&0.0010<N.scale)D.x=N.x,D.y=N.y,D.z=N.z,F=N.size*N.scale/s,C.x=F*t,C.y=F,b.uniform3f(K.screenPosition,D.x,D.y,D.z),b.uniform2f(K.scale,C.x,C.y),b.uniform1f(K.rotation,N.rotation),b.uniform1f(K.opacity,N.opacity),b.uniform3f(K.color,N.color.r,N.color.g,N.color.b),
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(l=!1,k=a(THREE.ShaderFlares.lensFlare)):(l=!0,k=a(THREE.ShaderFlares.lensFlareVertexTexture));p={};n={};p.vertex=b.getAttribLocation(k,"position");p.uv=b.getAttribLocation(k,"uv");n.renderType=b.getUniformLocation(k,"renderType");n.map=b.getUniformLocation(k,"map");n.occlusionMap=b.getUniformLocation(k,"occlusionMap");n.opacity=b.getUniformLocation(k,"opacity");n.color=b.getUniformLocation(k,
+"color");n.scale=b.getUniformLocation(k,"scale");n.rotation=b.getUniformLocation(k,"rotation");n.screenPosition=b.getUniformLocation(k,"screenPosition");o=!1};this.render=function(a,d,e,s){var a=a.__webglFlares,u=a.length;if(u){var v=new THREE.Vector3,t=s/e,w=0.5*e,z=0.5*s,B=16/s,I=new THREE.Vector2(B*t,B),C=new THREE.Vector3(1,1,0),H=new THREE.Vector2(1,1),K=n,B=p;b.useProgram(k);o||(b.enableVertexAttribArray(p.vertex),b.enableVertexAttribArray(p.uv),o=!0);b.uniform1i(K.occlusionMap,0);b.uniform1i(K.map,
+1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(B.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(B.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var O,Q,L,D,N;for(O=0;O<u;O++)if(B=16/s,I.set(B*t,B),D=a[O],v.set(D.matrixWorld.n14,D.matrixWorld.n24,D.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(v),d.projectionMatrix.multiplyVector3(v),C.copy(v),H.x=C.x*w+w,H.y=C.y*z+z,l||0<H.x&&H.x<e&&0<H.y&&H.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
+h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,H.x-8,H.y-8,16,16,0);b.uniform1i(K.renderType,0);b.uniform2f(K.scale,I.x,I.y);b.uniform3f(K.screenPosition,C.x,C.y,C.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,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,H.x-8,H.y-8,16,16,0);b.uniform1i(K.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
+6,b.UNSIGNED_SHORT,0);D.positionScreen.copy(C);D.customUpdateCallback?D.customUpdateCallback(D):D.updateLensFlares();b.uniform1i(K.renderType,2);b.enable(b.BLEND);for(Q=0,L=D.lensFlares.length;Q<L;Q++)if(N=D.lensFlares[Q],0.0010<N.opacity&&0.0010<N.scale)C.x=N.x,C.y=N.y,C.z=N.z,B=N.size*N.scale/s,I.x=B*t,I.y=B,b.uniform3f(K.screenPosition,C.x,C.y,C.z),b.uniform2f(K.scale,I.x,I.y),b.uniform1f(K.rotation,N.rotation),b.uniform1f(K.opacity,N.opacity),b.uniform3f(K.color,N.color.r,N.color.g,N.color.b),
 c.setBlending(N.blending),c.setTexture(N.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.ShadowMapPlugin=function(){var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4,g=new THREE.Vector3,h=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
-c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,k){var j,p,m,o,q,n,r,s,u,v=[];o=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(j=0,p=i.__lights.length;j<p;j++)if(m=i.__lights[j],m.castShadow)if(m instanceof THREE.DirectionalLight&&m.shadowCascade)for(q=0;q<m.shadowCascadeCount;q++){var t;if(m.shadowCascadeArray[q])t=m.shadowCascadeArray[q];else{u=m;r=q;t=new THREE.DirectionalLight;t.isVirtual=
+c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,l){var k,p,n,o,q,m,r,s,u,v=[];o=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(k=0,p=i.__lights.length;k<p;k++)if(n=i.__lights[k],n.castShadow)if(n instanceof THREE.DirectionalLight&&n.shadowCascade)for(q=0;q<n.shadowCascadeCount;q++){var t;if(n.shadowCascadeArray[q])t=n.shadowCascadeArray[q];else{u=n;r=q;t=new THREE.DirectionalLight;t.isVirtual=
 !0;t.onlyShadow=!0;t.castShadow=!0;t.shadowCameraNear=u.shadowCameraNear;t.shadowCameraFar=u.shadowCameraFar;t.shadowCameraLeft=u.shadowCameraLeft;t.shadowCameraRight=u.shadowCameraRight;t.shadowCameraBottom=u.shadowCameraBottom;t.shadowCameraTop=u.shadowCameraTop;t.shadowCameraVisible=u.shadowCameraVisible;t.shadowDarkness=u.shadowDarkness;t.shadowBias=u.shadowCascadeBias[r];t.shadowMapWidth=u.shadowCascadeWidth[r];t.shadowMapHeight=u.shadowCascadeHeight[r];t.pointsWorld=[];t.pointsFrustum=[];s=
-t.pointsWorld;n=t.pointsFrustum;for(var w=0;8>w;w++)s[w]=new THREE.Vector3,n[w]=new THREE.Vector3;s=u.shadowCascadeNearZ[r];u=u.shadowCascadeFarZ[r];n[0].set(-1,-1,s);n[1].set(1,-1,s);n[2].set(-1,1,s);n[3].set(1,1,s);n[4].set(-1,-1,u);n[5].set(1,-1,u);n[6].set(-1,1,u);n[7].set(1,1,u);t.originalCamera=k;n=new THREE.Gyroscope;n.position=m.shadowCascadeOffset;n.add(t);n.add(t.target);k.add(n);m.shadowCascadeArray[q]=t;console.log("Created virtualLight",t)}r=m;s=q;u=r.shadowCascadeArray[s];u.position.copy(r.position);
-u.target.position.copy(r.target.position);u.lookAt(u.target);u.shadowCameraVisible=r.shadowCameraVisible;u.shadowDarkness=r.shadowDarkness;u.shadowBias=r.shadowCascadeBias[s];n=r.shadowCascadeNearZ[s];r=r.shadowCascadeFarZ[s];u=u.pointsFrustum;u[0].z=n;u[1].z=n;u[2].z=n;u[3].z=n;u[4].z=r;u[5].z=r;u[6].z=r;u[7].z=r;v[o]=t;o++}else v[o]=m,o++;for(j=0,p=v.length;j<p;j++){m=v[j];if(!m.shadowMap)m.shadowMap=new THREE.WebGLRenderTarget(m.shadowMapWidth,m.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
-format:THREE.RGBAFormat}),m.shadowMapSize=new THREE.Vector2(m.shadowMapWidth,m.shadowMapHeight),m.shadowMatrix=new THREE.Matrix4;if(!m.shadowCamera){if(m instanceof THREE.SpotLight)m.shadowCamera=new THREE.PerspectiveCamera(m.shadowCameraFov,m.shadowMapWidth/m.shadowMapHeight,m.shadowCameraNear,m.shadowCameraFar);else if(m instanceof THREE.DirectionalLight)m.shadowCamera=new THREE.OrthographicCamera(m.shadowCameraLeft,m.shadowCameraRight,m.shadowCameraTop,m.shadowCameraBottom,m.shadowCameraNear,m.shadowCameraFar);
-else{console.error("Unsupported light type for shadow");continue}i.add(m.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(m.shadowCameraVisible&&!m.cameraHelper)m.cameraHelper=new THREE.CameraHelper(m.shadowCamera),m.shadowCamera.add(m.cameraHelper);if(m.isVirtual&&t.originalCamera==k){q=k;o=m.shadowCamera;n=m.pointsFrustum;u=m.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(r=0;8>r;r++){s=u[r];s.copy(n[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(s,
-q);o.matrixWorldInverse.multiplyVector3(s);if(s.x<g.x)g.x=s.x;if(s.x>h.x)h.x=s.x;if(s.y<g.y)g.y=s.y;if(s.y>h.y)h.y=s.y;if(s.z<g.z)g.z=s.z;if(s.z>h.z)h.z=s.z}o.left=g.x;o.right=h.x;o.top=h.y;o.bottom=g.y;o.updateProjectionMatrix()}o=m.shadowMap;n=m.shadowMatrix;q=m.shadowCamera;q.position.copy(m.matrixWorld.getPosition());q.lookAt(m.target.matrixWorld.getPosition());q.updateMatrixWorld();q.matrixWorldInverse.getInverse(q.matrixWorld);if(m.cameraHelper)m.cameraHelper.lines.visible=m.shadowCameraVisible;
-m.shadowCameraVisible&&m.cameraHelper.update();n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(q.projectionMatrix);n.multiplySelf(q.matrixWorldInverse);if(!q._viewMatrixArray)q._viewMatrixArray=new Float32Array(16);if(!q._projectionMatrixArray)q._projectionMatrixArray=new Float32Array(16);q.matrixWorldInverse.flattenToArray(q._viewMatrixArray);q.projectionMatrix.flattenToArray(q._projectionMatrixArray);f.multiply(q.projectionMatrix,q.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(o);
-b.clear();u=i.__webglObjects;for(m=0,o=u.length;m<o;m++)if(r=u[m],n=r.object,r.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),r.render=!0;for(m=0,o=u.length;m<o;m++)if(r=u[m],r.render)n=r.object,r=r.buffer,b.setObjectFaces(n),s=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:
-c,r instanceof THREE.BufferGeometry?b.renderBufferDirect(q,i.__lights,null,s,r,n):b.renderBuffer(q,i.__lights,null,s,r,n);u=i.__webglObjectsImmediate;for(m=0,o=u.length;m<o;m++)r=u[m],n=r.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),b.renderImmediateObject(q,i.__lights,null,c,n))}j=b.getClearColor();p=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,p);
+t.pointsWorld;m=t.pointsFrustum;for(var w=0;8>w;w++)s[w]=new THREE.Vector3,m[w]=new THREE.Vector3;s=u.shadowCascadeNearZ[r];u=u.shadowCascadeFarZ[r];m[0].set(-1,-1,s);m[1].set(1,-1,s);m[2].set(-1,1,s);m[3].set(1,1,s);m[4].set(-1,-1,u);m[5].set(1,-1,u);m[6].set(-1,1,u);m[7].set(1,1,u);t.originalCamera=l;m=new THREE.Gyroscope;m.position=n.shadowCascadeOffset;m.add(t);m.add(t.target);l.add(m);n.shadowCascadeArray[q]=t;console.log("Created virtualLight",t)}r=n;s=q;u=r.shadowCascadeArray[s];u.position.copy(r.position);
+u.target.position.copy(r.target.position);u.lookAt(u.target);u.shadowCameraVisible=r.shadowCameraVisible;u.shadowDarkness=r.shadowDarkness;u.shadowBias=r.shadowCascadeBias[s];m=r.shadowCascadeNearZ[s];r=r.shadowCascadeFarZ[s];u=u.pointsFrustum;u[0].z=m;u[1].z=m;u[2].z=m;u[3].z=m;u[4].z=r;u[5].z=r;u[6].z=r;u[7].z=r;v[o]=t;o++}else v[o]=n,o++;for(k=0,p=v.length;k<p;k++){n=v[k];if(!n.shadowMap)n.shadowMap=new THREE.WebGLRenderTarget(n.shadowMapWidth,n.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
+format:THREE.RGBAFormat}),n.shadowMapSize=new THREE.Vector2(n.shadowMapWidth,n.shadowMapHeight),n.shadowMatrix=new THREE.Matrix4;if(!n.shadowCamera){if(n instanceof THREE.SpotLight)n.shadowCamera=new THREE.PerspectiveCamera(n.shadowCameraFov,n.shadowMapWidth/n.shadowMapHeight,n.shadowCameraNear,n.shadowCameraFar);else if(n instanceof THREE.DirectionalLight)n.shadowCamera=new THREE.OrthographicCamera(n.shadowCameraLeft,n.shadowCameraRight,n.shadowCameraTop,n.shadowCameraBottom,n.shadowCameraNear,n.shadowCameraFar);
+else{console.error("Unsupported light type for shadow");continue}i.add(n.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(n.shadowCameraVisible&&!n.cameraHelper)n.cameraHelper=new THREE.CameraHelper(n.shadowCamera),n.shadowCamera.add(n.cameraHelper);if(n.isVirtual&&t.originalCamera==l){q=l;o=n.shadowCamera;m=n.pointsFrustum;u=n.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(r=0;8>r;r++){s=u[r];s.copy(m[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(s,
+q);o.matrixWorldInverse.multiplyVector3(s);if(s.x<g.x)g.x=s.x;if(s.x>h.x)h.x=s.x;if(s.y<g.y)g.y=s.y;if(s.y>h.y)h.y=s.y;if(s.z<g.z)g.z=s.z;if(s.z>h.z)h.z=s.z}o.left=g.x;o.right=h.x;o.top=h.y;o.bottom=g.y;o.updateProjectionMatrix()}o=n.shadowMap;m=n.shadowMatrix;q=n.shadowCamera;q.position.copy(n.matrixWorld.getPosition());q.lookAt(n.target.matrixWorld.getPosition());q.updateMatrixWorld();q.matrixWorldInverse.getInverse(q.matrixWorld);if(n.cameraHelper)n.cameraHelper.lines.visible=n.shadowCameraVisible;
+n.shadowCameraVisible&&n.cameraHelper.update();m.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);m.multiplySelf(q.projectionMatrix);m.multiplySelf(q.matrixWorldInverse);if(!q._viewMatrixArray)q._viewMatrixArray=new Float32Array(16);if(!q._projectionMatrixArray)q._projectionMatrixArray=new Float32Array(16);q.matrixWorldInverse.flattenToArray(q._viewMatrixArray);q.projectionMatrix.flattenToArray(q._projectionMatrixArray);f.multiply(q.projectionMatrix,q.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(o);
+b.clear();u=i.__webglObjects;for(n=0,o=u.length;n<o;n++)if(r=u[n],m=r.object,r.render=!1,m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||e.contains(m)))m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),r.render=!0;for(n=0,o=u.length;n<o;n++)if(r=u[n],r.render)m=r.object,r=r.buffer,b.setObjectFaces(m),s=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:
+c,r instanceof THREE.BufferGeometry?b.renderBufferDirect(q,i.__lights,null,s,r,m):b.renderBuffer(q,i.__lights,null,s,r,m);u=i.__webglObjectsImmediate;for(n=0,o=u.length;n<o;n++)r=u[n],m=r.object,m.visible&&m.castShadow&&(m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(q.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),b.renderImmediateObject(q,i.__lights,null,c,m))}k=b.getClearColor();p=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,p);
 a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
-THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,i,k,j;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),o=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(o);b.compileShader(q);b.attachShader(m,o);b.attachShader(m,q);b.linkProgram(m);h=m;i={};k={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");k.uvOffset=b.getUniformLocation(h,"uvOffset");k.uvScale=b.getUniformLocation(h,
-"uvScale");k.rotation=b.getUniformLocation(h,"rotation");k.scale=b.getUniformLocation(h,"scale");k.alignment=b.getUniformLocation(h,"alignment");k.color=b.getUniformLocation(h,"color");k.map=b.getUniformLocation(h,"map");k.opacity=b.getUniformLocation(h,"opacity");k.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");k.screenPosition=b.getUniformLocation(h,"screenPosition");k.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
-k.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");j=!1};this.render=function(d,e,o,q){var d=d.__webglSprites,n=d.length;if(n){var r=i,s=k,u=q/o,o=0.5*o,v=0.5*q,t=!0;b.useProgram(h);j||(b.enableVertexAttribArray(r.position),b.enableVertexAttribArray(r.uv),j=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(s.projectionMatrix,
-!1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var w,z=[],r=0;r<n;r++)if(w=d[r],w.visible&&0!==w.opacity)w.useScreenCoordinates?w.z=-w.position.z:(w._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,w.matrixWorld,w._modelViewMatrixArray),w.z=-w._modelViewMatrix.n34);d.sort(a);for(r=0;r<n;r++)w=d[r],w.visible&&0!==w.opacity&&w.map&&w.map.image&&w.map.image.width&&(w.useScreenCoordinates?(b.uniform1i(s.useScreenCoordinates,1),b.uniform3f(s.screenPosition,(w.position.x-
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,i,l,k;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),o=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(o);b.compileShader(q);b.attachShader(n,o);b.attachShader(n,q);b.linkProgram(n);h=n;i={};l={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");l.uvOffset=b.getUniformLocation(h,"uvOffset");l.uvScale=b.getUniformLocation(h,
+"uvScale");l.rotation=b.getUniformLocation(h,"rotation");l.scale=b.getUniformLocation(h,"scale");l.alignment=b.getUniformLocation(h,"alignment");l.color=b.getUniformLocation(h,"color");l.map=b.getUniformLocation(h,"map");l.opacity=b.getUniformLocation(h,"opacity");l.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");l.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");l.screenPosition=b.getUniformLocation(h,"screenPosition");l.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
+l.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=!1};this.render=function(d,e,o,q){var d=d.__webglSprites,m=d.length;if(m){var r=i,s=l,u=q/o,o=0.5*o,v=0.5*q,t=!0;b.useProgram(h);k||(b.enableVertexAttribArray(r.position),b.enableVertexAttribArray(r.uv),k=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(s.projectionMatrix,
+!1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var w,z=[],r=0;r<m;r++)if(w=d[r],w.visible&&0!==w.opacity)w.useScreenCoordinates?w.z=-w.position.z:(w._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,w.matrixWorld,w._modelViewMatrixArray),w.z=-w._modelViewMatrix.n34);d.sort(a);for(r=0;r<m;r++)w=d[r],w.visible&&0!==w.opacity&&w.map&&w.map.image&&w.map.image.width&&(w.useScreenCoordinates?(b.uniform1i(s.useScreenCoordinates,1),b.uniform3f(s.screenPosition,(w.position.x-
 o)/o,(v-w.position.y)/v,Math.max(0,Math.min(1,w.position.z)))):(b.uniform1i(s.useScreenCoordinates,0),b.uniform1i(s.affectedByDistance,w.affectedByDistance?1:0),b.uniformMatrix4fv(s.modelViewMatrix,!1,w._modelViewMatrixArray)),e=w.map.image.width/(w.scaleByViewport?q:1),z[0]=e*u*w.scale.x,z[1]=e*w.scale.y,b.uniform2f(s.uvScale,w.uvScale.x,w.uvScale.y),b.uniform2f(s.uvOffset,w.uvOffset.x,w.uvOffset.y),b.uniform2f(s.alignment,w.alignment.x,w.alignment.y),b.uniform1f(s.opacity,w.opacity),b.uniform3f(s.color,
 w.color.r,w.color.g,w.color.b),b.uniform1f(s.rotation,w.rotation),b.uniform2fv(s.scale,z),w.mergeWith3D&&!t?(b.enable(b.DEPTH_TEST),t=!0):!w.mergeWith3D&&t&&(b.disable(b.DEPTH_TEST),t=!1),c.setBlending(w.blending),c.setTexture(w.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
-b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,k,j,p,m,o;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
-h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();o=g.__webglObjects;for(i=0,k=o.length;i<k;i++)if(j=o[i],m=j.object,j.render=!1,m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||e.contains(m)))m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),j.render=!0;for(i=0,k=o.length;i<k;i++)if(j=o[i],j.render)m=j.object,j=j.buffer,b.setObjectFaces(m),p=m.customDepthMaterial?
-m.customDepthMaterial:m.geometry.morphTargets.length?d:c,j instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,p,j,m):b.renderBuffer(h,g.__lights,null,p,j,m);o=g.__webglObjectsImmediate;for(i=0,k=o.length;i<k;i++)j=o[i],m=j.object,m.visible&&m.castShadow&&(m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),b.renderImmediateObject(h,g.__lights,null,c,m));i=b.getClearColor();
-k=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,k);a.enable(a.BLEND)}};
-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,f=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,p;e.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},m=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),q=new THREE.PerspectiveCamera(53,
-1,1,1E4);q.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:m},mapRight:{type:"t",value:1,texture:o}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
-n=new THREE.Scene,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;n.add(a);n.add(q);this.setSize=function(a,d){c.call(b,a,d);m.width=a;m.height=d;o.width=a;o.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 u=c.projectionMatrix.clone(),v=0.5*(125/30),t=v*k/125,w=k*Math.tan(p*Math.PI/360),z;g.n14=v;h.n14=-v;v=-w*i+t;z=w*i+t;u.n11=2*k/(z-v);u.n13=(z+v)/(z-v);e.projectionMatrix.copy(u);
-v=-w*i-t;z=w*i-t;u.n11=2*k/(z-v);u.n13=(z+v)/(z-v);f.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,m,!0);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,o,!0);n.updateMatrixWorld();d.call(b,n,q)}};
+b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,l,k,p,n,o;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);f.multiply(h.projectionMatrix,
+h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();o=g.__webglObjects;for(i=0,l=o.length;i<l;i++)if(k=o[i],n=k.object,k.render=!1,n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||e.contains(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),k.render=!0;for(i=0,l=o.length;i<l;i++)if(k=o[i],k.render)n=k.object,k=k.buffer,b.setObjectFaces(n),p=n.customDepthMaterial?
+n.customDepthMaterial:n.geometry.morphTargets.length?d:c,k instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,p,k,n):b.renderBuffer(h,g.__lights,null,p,k,n);o=g.__webglObjectsImmediate;for(i=0,l=o.length;i<l;i++)k=o[i],n=k.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),b.renderImmediateObject(h,g.__lights,null,c,n));i=b.getClearColor();
+l=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,l);a.enable(a.BLEND)}};
+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,f=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,l,k,p;e.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),o=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:n},mapRight:{type:"t",value:1,texture:o}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
+m=new THREE.Scene,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;m.add(a);m.add(q);this.setSize=function(a,d){c.call(b,a,d);n.width=a;n.height=d;o.width=a;o.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||l!==c.near||k!==c.far||p!==c.fov){i=c.aspect;l=c.near;k=c.far;p=c.fov;var u=c.projectionMatrix.clone(),v=0.5*(125/30),t=v*l/125,w=l*Math.tan(p*Math.PI/360),z;g.n14=v;h.n14=-v;v=-w*i+t;z=w*i+t;u.n11=2*l/(z-v);u.n13=(z+v)/(z-v);e.projectionMatrix.copy(u);
+v=-w*i-t;z=w*i-t;u.n11=2*l/(z-v);u.n13=(z+v)/(z-v);f.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,n,!0);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,o,!0);m.updateMatrixWorld();d.call(b,m,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,f,g=new THREE.PerspectiveCamera;g.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&&void 0!==a.separation)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;f=d};this.render=function(a,c){this.clear();g.fov=c.fov;g.aspect=0.5*c.aspect;g.near=c.near;g.far=
 c.far;g.updateProjectionMatrix();g.position.copy(c.position);g.target.copy(c.target);g.translateX(b.separation);g.lookAt(g.target);h.projectionMatrix=g.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,f);d.call(b,a,g);this.setViewport(e,0,e,f);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:"precision mediump float;\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}"},

+ 216 - 252
build/custom/ThreeExtras.js

@@ -1,31 +1,31 @@
 // ThreeExtras.js - http://github.com/mrdoob/three.js
 'use strict';THREE.ColorUtils={adjustHSV:function(a,b,c,d){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+b,0,1);f.s=THREE.Math.clamp(f.s+c,0,1);f.v=THREE.Math.clamp(f.v+d,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,f=a.b,e=Math.max(Math.max(c,d),f),g=Math.min(Math.min(c,d),f);if(g===e)g=c=0;else{var h=e-g,g=h/e,c=(c===e?(d-f)/h:d===e?2+(f-c)/h:4+(c-d)/h)/6;0>c&&(c+=1);1<c&&(c-=1)}void 0===b&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=e;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,f=a.vertices.length,e=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=e.vertices,j=a.faces,k=e.faces,i=a.faceVertexUvs[0],o=e.faceVertexUvs[0],l={},n=0;n<a.materials.length;n++)l[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,p=h.length;n<p;n++){var m=h[n].clone();c&&c.multiplyVector3(m.position);g.push(m)}for(n=0,p=k.length;n<p;n++){var g=
-k[n],r,q,t=g.vertexNormals,s=g.vertexColors;g instanceof THREE.Face3?r=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(r=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));r.normal.copy(g.normal);d&&d.multiplyVector3(r.normal);h=0;for(m=t.length;h<m;h++)q=t[h].clone(),d&&d.multiplyVector3(q),r.vertexNormals.push(q);r.color.copy(g.color);h=0;for(m=s.length;h<m;h++)q=s[h],r.vertexColors.push(q.clone());if(void 0!==g.materialIndex){h=e.materials[g.materialIndex];m=h.id;s=l[m];if(void 0===s)s=a.materials.length,
-l[m]=s,a.materials.push(h);r.materialIndex=s}r.centroid.copy(g.centroid);c&&c.multiplyVector3(r.centroid);j.push(r)}for(n=0,p=o.length;n<p;n++){c=o[n];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));i.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,f=a.faces,e=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++)b.vertices.push(d[a].clone());for(a=0,c=f.length;a<c;a++)b.faces.push(f[a].clone());for(a=0,c=e.length;a<c;a++){for(var d=
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,f=a.vertices.length,e=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=e.vertices,i=a.faces,j=e.faces,k=a.faceVertexUvs[0],q=e.faceVertexUvs[0],l={},n=0;n<a.materials.length;n++)l[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,r=h.length;n<r;n++){var m=h[n].clone();c&&c.multiplyVector3(m.position);g.push(m)}for(n=0,r=j.length;n<r;n++){var g=
+j[n],o,p,t=g.vertexNormals,s=g.vertexColors;g instanceof THREE.Face3?o=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(o=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));o.normal.copy(g.normal);d&&d.multiplyVector3(o.normal);h=0;for(m=t.length;h<m;h++)p=t[h].clone(),d&&d.multiplyVector3(p),o.vertexNormals.push(p);o.color.copy(g.color);h=0;for(m=s.length;h<m;h++)p=s[h],o.vertexColors.push(p.clone());if(void 0!==g.materialIndex){h=e.materials[g.materialIndex];m=h.id;s=l[m];if(void 0===s)s=a.materials.length,
+l[m]=s,a.materials.push(h);o.materialIndex=s}o.centroid.copy(g.centroid);c&&c.multiplyVector3(o.centroid);i.push(o)}for(n=0,r=q.length;n<r;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));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,f=a.faces,e=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++)b.vertices.push(d[a].clone());for(a=0,c=f.length;a<c;a++)b.faces.push(f[a].clone());for(a=0,c=e.length;a<c;a++){for(var d=
 e[a],f=[],g=0,h=d.length;g<h;g++)f.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(f)}return b},randomPointInTriangle:function(a,b,c){var d,f,e,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();1<d+f&&(d=1-d,f=1-f);e=1-d-f;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(f);g.addSelf(h);h.copy(c);h.multiplyScalar(e);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,f,e;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,
 f=b.vertices[a.b].position,e=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,f,e);if(a instanceof THREE.Face4){d=b.vertices[a.a].position;f=b.vertices[a.b].position;e=b.vertices[a.c].position;var b=b.vertices[a.d].position,g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(d,f,b),g=THREE.GeometryUtils.triangleArea(f,e,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,f,b),g=THREE.GeometryUtils.triangleArea(f,e,b));return THREE.GeometryUtils.random()*
-(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,f,b):THREE.GeometryUtils.randomPointInTriangle(f,e,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var f=c+Math.floor((d-c)/2);return k[f]>a?b(c,f-1):k[f]<a?b(f+1,d):f}return b(0,k.length-1)}var d,f,e=a.faces,g=a.vertices,h=e.length,j=0,k=[],i,o,l,n;for(f=0;f<h;f++){d=e[f];if(d instanceof THREE.Face3)i=g[d.a].position,o=g[d.b].position,l=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(i,o,l);else if(d instanceof
-THREE.Face4)i=g[d.a].position,o=g[d.b].position,l=g[d.c].position,n=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(i,o,n),d._area2=THREE.GeometryUtils.triangleArea(o,l,n),d._area=d._area1+d._area2;j+=d._area;k[f]=j}d=[];for(f=0;f<b;f++)g=THREE.GeometryUtils.random()*j,g=c(g),d[f]=THREE.GeometryUtils.randomPointInFace(e[g],a,!0);return d},triangleArea:function(a,b,c){var d,f=THREE.GeometryUtils.__v1;f.sub(a,b);d=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();b=0.5*(d+a+c);return Math.sqrt(b*
+(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,f,b):THREE.GeometryUtils.randomPointInTriangle(f,e,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var f=c+Math.floor((d-c)/2);return j[f]>a?b(c,f-1):j[f]<a?b(f+1,d):f}return b(0,j.length-1)}var d,f,e=a.faces,g=a.vertices,h=e.length,i=0,j=[],k,q,l,n;for(f=0;f<h;f++){d=e[f];if(d instanceof THREE.Face3)k=g[d.a].position,q=g[d.b].position,l=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,q,l);else if(d instanceof
+THREE.Face4)k=g[d.a].position,q=g[d.b].position,l=g[d.c].position,n=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,q,n),d._area2=THREE.GeometryUtils.triangleArea(q,l,n),d._area=d._area1+d._area2;i+=d._area;j[f]=i}d=[];for(f=0;f<b;f++)g=THREE.GeometryUtils.random()*i,g=c(g),d[f]=THREE.GeometryUtils.randomPointInFace(e[g],a,!0);return d},triangleArea:function(a,b,c){var d,f=THREE.GeometryUtils.__v1;f.sub(a,b);d=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();b=0.5*(d+a+c);return Math.sqrt(b*
 (b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).setTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],f=0,e=d.length;f<e;f++)1!==d[f].u&&(d[f].u-=Math.floor(d[f].u)),1!==d[f].v&&(d[f].v-=Math.floor(d[f].v))},triangulateQuads:function(a){var b,c,d,f,e=[],g=[],h=[];for(b=0,
-c=a.faceUvs.length;b<c;b++)g[b]=[];for(b=0,c=a.faceVertexUvs.length;b<c;b++)h[b]=[];for(b=0,c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){f=d.a;var j=d.b,k=d.c,i=d.d,o=new THREE.Face3,l=new THREE.Face3;o.color.copy(d.color);l.color.copy(d.color);o.materialIndex=d.materialIndex;l.materialIndex=d.materialIndex;o.a=f;o.b=j;o.c=i;l.a=j;l.b=k;l.c=i;4===d.vertexColors.length&&(o.vertexColors[0]=d.vertexColors[0].clone(),o.vertexColors[1]=d.vertexColors[1].clone(),o.vertexColors[2]=
-d.vertexColors[3].clone(),l.vertexColors[0]=d.vertexColors[1].clone(),l.vertexColors[1]=d.vertexColors[2].clone(),l.vertexColors[2]=d.vertexColors[3].clone());e.push(o,l);for(d=0,f=a.faceVertexUvs.length;d<f;d++)a.faceVertexUvs[d].length&&(o=a.faceVertexUvs[d][b],j=o[1],k=o[2],i=o[3],o=[o[0].clone(),j.clone(),i.clone()],j=[j.clone(),k.clone(),i.clone()],h[d].push(o,j));for(d=0,f=a.faceUvs.length;d<f;d++)a.faceUvs[d].length&&(j=a.faceUvs[d][b],g[d].push(j,j))}else{e.push(d);for(d=0,f=a.faceUvs.length;d<
-f;d++)g[d].push(a.faceUvs[d]);for(d=0,f=a.faceVertexUvs.length;d<f;d++)h[d].push(a.faceVertexUvs[d])}a.faces=e;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var f=b.length,e=a.faces[c];if(e instanceof THREE.Face4){var g=e.a,h=e.b,j=e.c,g=a.vertices[g],h=a.vertices[h],j=a.vertices[j],k=a.vertices[e.d];b.push(g.clone());b.push(h.clone());b.push(j.clone());
-b.push(k.clone());e.a=f;e.b=f+1;e.c=f+2;e.d=f+3}else g=e.a,h=e.b,j=e.c,g=a.vertices[g],h=a.vertices[h],j=a.vertices[j],b.push(g.clone()),b.push(h.clone()),b.push(j.clone()),e.a=f,e.b=f+1,e.c=f+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,f,e,g,h,j,k,i,o,l,n,p,m,r,q,t,s,u,v=[],w=[];for(c=0,d=a.faceVertexUvs.length;c<d;c++)w[c]=[];for(c=0,d=a.faces.length;c<d;c++)if(f=a.faces[c],f instanceof THREE.Face3)if(e=f.a,g=f.b,h=f.c,k=a.vertices[e],i=a.vertices[g],o=a.vertices[h],
-n=k.position.distanceTo(i.position),p=i.position.distanceTo(o.position),l=k.position.distanceTo(o.position),n>b||p>b||l>b){j=a.vertices.length;s=f.clone();u=f.clone();n>=p&&n>=l?(k=k.clone(),k.position.lerpSelf(i.position,0.5),s.a=e,s.b=j,s.c=h,u.a=j,u.b=g,u.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),s.vertexNormals[1].copy(e),u.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],0.5),
-s.vertexColors[1].copy(e),u.vertexColors[0].copy(e)),f=0):p>=n&&p>=l?(k=i.clone(),k.position.lerpSelf(o.position,0.5),s.a=e,s.b=g,s.c=j,u.a=j,u.b=h,u.c=e,3===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],0.5),s.vertexNormals[2].copy(e),u.vertexNormals[0].copy(e),u.vertexNormals[1].copy(f.vertexNormals[2]),u.vertexNormals[2].copy(f.vertexNormals[0])),3===f.vertexColors.length&&(e=f.vertexColors[1].clone(),e.lerpSelf(f.vertexColors[2],0.5),s.vertexColors[2].copy(e),
-u.vertexColors[0].copy(e),u.vertexColors[1].copy(f.vertexColors[2]),u.vertexColors[2].copy(f.vertexColors[0])),f=1):(k=k.clone(),k.position.lerpSelf(o.position,0.5),s.a=e,s.b=g,s.c=j,u.a=j,u.b=g,u.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[2],0.5),s.vertexNormals[2].copy(e),u.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[2],0.5),s.vertexColors[2].copy(e),u.vertexColors[0].copy(e)),f=2);v.push(s,
-u);a.vertices.push(k);for(e=0,g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(k=a.faceVertexUvs[e][c],u=k[0],h=k[1],s=k[2],0===f?(i=u.clone(),i.lerpSelf(h,0.5),k=[u.clone(),i.clone(),s.clone()],h=[i.clone(),h.clone(),s.clone()]):1===f?(i=h.clone(),i.lerpSelf(s,0.5),k=[u.clone(),h.clone(),i.clone()],h=[i.clone(),s.clone(),u.clone()]):(i=u.clone(),i.lerpSelf(s,0.5),k=[u.clone(),h.clone(),i.clone()],h=[i.clone(),h.clone(),s.clone()]),w[e].push(k,h))}else{v.push(f);for(e=0,g=a.faceVertexUvs.length;e<
-g;e++)w[e].push(a.faceVertexUvs[e])}else if(e=f.a,g=f.b,h=f.c,j=f.d,k=a.vertices[e],i=a.vertices[g],o=a.vertices[h],l=a.vertices[j],n=k.position.distanceTo(i.position),p=i.position.distanceTo(o.position),m=o.position.distanceTo(l.position),r=k.position.distanceTo(l.position),n>b||p>b||m>b||r>b){q=a.vertices.length;t=a.vertices.length+1;s=f.clone();u=f.clone();n>=p&&n>=m&&n>=r||m>=p&&m>=n&&m>=r?(n=k.clone(),n.position.lerpSelf(i.position,0.5),i=o.clone(),i.position.lerpSelf(l.position,0.5),s.a=e,s.b=
-q,s.c=t,s.d=j,u.a=q,u.b=g,u.c=h,u.d=t,4===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),g=f.vertexNormals[2].clone(),g.lerpSelf(f.vertexNormals[3],0.5),s.vertexNormals[1].copy(e),s.vertexNormals[2].copy(g),u.vertexNormals[0].copy(e),u.vertexNormals[3].copy(g)),4===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],0.5),g=f.vertexColors[2].clone(),g.lerpSelf(f.vertexColors[3],0.5),s.vertexColors[1].copy(e),s.vertexColors[2].copy(g),
-u.vertexColors[0].copy(e),u.vertexColors[3].copy(g)),f=0):(n=i.clone(),n.position.lerpSelf(o.position,0.5),i=l.clone(),i.position.lerpSelf(k.position,0.5),s.a=e,s.b=g,s.c=q,s.d=t,u.a=t,u.b=q,u.c=h,u.d=j,4===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],0.5),g=f.vertexNormals[3].clone(),g.lerpSelf(f.vertexNormals[0],0.5),s.vertexNormals[2].copy(e),s.vertexNormals[3].copy(g),u.vertexNormals[0].copy(g),u.vertexNormals[1].copy(e)),4===f.vertexColors.length&&(e=f.vertexColors[1].clone(),
-e.lerpSelf(f.vertexColors[2],0.5),g=f.vertexColors[3].clone(),g.lerpSelf(f.vertexColors[0],0.5),s.vertexColors[2].copy(e),s.vertexColors[3].copy(g),u.vertexColors[0].copy(g),u.vertexColors[1].copy(e)),f=1);v.push(s,u);a.vertices.push(n,i);for(e=0,g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(k=a.faceVertexUvs[e][c],u=k[0],h=k[1],s=k[2],k=k[3],0===f?(i=u.clone(),i.lerpSelf(h,0.5),o=s.clone(),o.lerpSelf(k,0.5),u=[u.clone(),i.clone(),o.clone(),k.clone()],h=[i.clone(),h.clone(),s.clone(),
-o.clone()]):(i=h.clone(),i.lerpSelf(s,0.5),o=k.clone(),o.lerpSelf(u,0.5),u=[u.clone(),h.clone(),i.clone(),o.clone()],h=[o.clone(),i.clone(),s.clone(),k.clone()]),w[e].push(u,h))}else{v.push(f);for(e=0,g=a.faceVertexUvs.length;e<g;e++)w[e].push(a.faceVertexUvs[e])}a.faces=v;a.faceVertexUvs=w}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+c=a.faceUvs.length;b<c;b++)g[b]=[];for(b=0,c=a.faceVertexUvs.length;b<c;b++)h[b]=[];for(b=0,c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){f=d.a;var i=d.b,j=d.c,k=d.d,q=new THREE.Face3,l=new THREE.Face3;q.color.copy(d.color);l.color.copy(d.color);q.materialIndex=d.materialIndex;l.materialIndex=d.materialIndex;q.a=f;q.b=i;q.c=k;l.a=i;l.b=j;l.c=k;4===d.vertexColors.length&&(q.vertexColors[0]=d.vertexColors[0].clone(),q.vertexColors[1]=d.vertexColors[1].clone(),q.vertexColors[2]=
+d.vertexColors[3].clone(),l.vertexColors[0]=d.vertexColors[1].clone(),l.vertexColors[1]=d.vertexColors[2].clone(),l.vertexColors[2]=d.vertexColors[3].clone());e.push(q,l);for(d=0,f=a.faceVertexUvs.length;d<f;d++)a.faceVertexUvs[d].length&&(q=a.faceVertexUvs[d][b],i=q[1],j=q[2],k=q[3],q=[q[0].clone(),i.clone(),k.clone()],i=[i.clone(),j.clone(),k.clone()],h[d].push(q,i));for(d=0,f=a.faceUvs.length;d<f;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{e.push(d);for(d=0,f=a.faceUvs.length;d<
+f;d++)g[d].push(a.faceUvs[d]);for(d=0,f=a.faceVertexUvs.length;d<f;d++)h[d].push(a.faceVertexUvs[d])}a.faces=e;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var f=b.length,e=a.faces[c];if(e instanceof THREE.Face4){var g=e.a,h=e.b,i=e.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],j=a.vertices[e.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());
+b.push(j.clone());e.a=f;e.b=f+1;e.c=f+2;e.d=f+3}else g=e.a,h=e.b,i=e.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],b.push(g.clone()),b.push(h.clone()),b.push(i.clone()),e.a=f,e.b=f+1,e.c=f+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,f,e,g,h,i,j,k,q,l,n,r,m,o,p,t,s,u,v=[],w=[];for(c=0,d=a.faceVertexUvs.length;c<d;c++)w[c]=[];for(c=0,d=a.faces.length;c<d;c++)if(f=a.faces[c],f instanceof THREE.Face3)if(e=f.a,g=f.b,h=f.c,j=a.vertices[e],k=a.vertices[g],q=a.vertices[h],
+n=j.position.distanceTo(k.position),r=k.position.distanceTo(q.position),l=j.position.distanceTo(q.position),n>b||r>b||l>b){i=a.vertices.length;s=f.clone();u=f.clone();n>=r&&n>=l?(j=j.clone(),j.position.lerpSelf(k.position,0.5),s.a=e,s.b=i,s.c=h,u.a=i,u.b=g,u.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),s.vertexNormals[1].copy(e),u.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],0.5),
+s.vertexColors[1].copy(e),u.vertexColors[0].copy(e)),f=0):r>=n&&r>=l?(j=k.clone(),j.position.lerpSelf(q.position,0.5),s.a=e,s.b=g,s.c=i,u.a=i,u.b=h,u.c=e,3===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],0.5),s.vertexNormals[2].copy(e),u.vertexNormals[0].copy(e),u.vertexNormals[1].copy(f.vertexNormals[2]),u.vertexNormals[2].copy(f.vertexNormals[0])),3===f.vertexColors.length&&(e=f.vertexColors[1].clone(),e.lerpSelf(f.vertexColors[2],0.5),s.vertexColors[2].copy(e),
+u.vertexColors[0].copy(e),u.vertexColors[1].copy(f.vertexColors[2]),u.vertexColors[2].copy(f.vertexColors[0])),f=1):(j=j.clone(),j.position.lerpSelf(q.position,0.5),s.a=e,s.b=g,s.c=i,u.a=i,u.b=g,u.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[2],0.5),s.vertexNormals[2].copy(e),u.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[2],0.5),s.vertexColors[2].copy(e),u.vertexColors[0].copy(e)),f=2);v.push(s,
+u);a.vertices.push(j);for(e=0,g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(j=a.faceVertexUvs[e][c],u=j[0],h=j[1],s=j[2],0===f?(k=u.clone(),k.lerpSelf(h,0.5),j=[u.clone(),k.clone(),s.clone()],h=[k.clone(),h.clone(),s.clone()]):1===f?(k=h.clone(),k.lerpSelf(s,0.5),j=[u.clone(),h.clone(),k.clone()],h=[k.clone(),s.clone(),u.clone()]):(k=u.clone(),k.lerpSelf(s,0.5),j=[u.clone(),h.clone(),k.clone()],h=[k.clone(),h.clone(),s.clone()]),w[e].push(j,h))}else{v.push(f);for(e=0,g=a.faceVertexUvs.length;e<
+g;e++)w[e].push(a.faceVertexUvs[e])}else if(e=f.a,g=f.b,h=f.c,i=f.d,j=a.vertices[e],k=a.vertices[g],q=a.vertices[h],l=a.vertices[i],n=j.position.distanceTo(k.position),r=k.position.distanceTo(q.position),m=q.position.distanceTo(l.position),o=j.position.distanceTo(l.position),n>b||r>b||m>b||o>b){p=a.vertices.length;t=a.vertices.length+1;s=f.clone();u=f.clone();n>=r&&n>=m&&n>=o||m>=r&&m>=n&&m>=o?(n=j.clone(),n.position.lerpSelf(k.position,0.5),k=q.clone(),k.position.lerpSelf(l.position,0.5),s.a=e,s.b=
+p,s.c=t,s.d=i,u.a=p,u.b=g,u.c=h,u.d=t,4===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),g=f.vertexNormals[2].clone(),g.lerpSelf(f.vertexNormals[3],0.5),s.vertexNormals[1].copy(e),s.vertexNormals[2].copy(g),u.vertexNormals[0].copy(e),u.vertexNormals[3].copy(g)),4===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],0.5),g=f.vertexColors[2].clone(),g.lerpSelf(f.vertexColors[3],0.5),s.vertexColors[1].copy(e),s.vertexColors[2].copy(g),
+u.vertexColors[0].copy(e),u.vertexColors[3].copy(g)),f=0):(n=k.clone(),n.position.lerpSelf(q.position,0.5),k=l.clone(),k.position.lerpSelf(j.position,0.5),s.a=e,s.b=g,s.c=p,s.d=t,u.a=t,u.b=p,u.c=h,u.d=i,4===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],0.5),g=f.vertexNormals[3].clone(),g.lerpSelf(f.vertexNormals[0],0.5),s.vertexNormals[2].copy(e),s.vertexNormals[3].copy(g),u.vertexNormals[0].copy(g),u.vertexNormals[1].copy(e)),4===f.vertexColors.length&&(e=f.vertexColors[1].clone(),
+e.lerpSelf(f.vertexColors[2],0.5),g=f.vertexColors[3].clone(),g.lerpSelf(f.vertexColors[0],0.5),s.vertexColors[2].copy(e),s.vertexColors[3].copy(g),u.vertexColors[0].copy(g),u.vertexColors[1].copy(e)),f=1);v.push(s,u);a.vertices.push(n,k);for(e=0,g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(j=a.faceVertexUvs[e][c],u=j[0],h=j[1],s=j[2],j=j[3],0===f?(k=u.clone(),k.lerpSelf(h,0.5),q=s.clone(),q.lerpSelf(j,0.5),u=[u.clone(),k.clone(),q.clone(),j.clone()],h=[k.clone(),h.clone(),s.clone(),
+q.clone()]):(k=h.clone(),k.lerpSelf(s,0.5),q=j.clone(),q.lerpSelf(u,0.5),u=[u.clone(),h.clone(),k.clone(),q.clone()],h=[q.clone(),k.clone(),s.clone(),j.clone()]),w[e].push(u,h))}else{v.push(f);for(e=0,g=a.faceVertexUvs.length;e<g;e++)w[e].push(a.faceVertexUvs[e])}a.faces=v;a.faceVertexUvs=w}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,f=new THREE.Texture(d,b);d.onload=function(){f.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return f},loadTextureCube:function(a,b,c){var d,f=[],e=new THREE.Texture(f,b);f.loadCount=0;for(b=0,d=a.length;b<d;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;if(6===f.loadCount)e.needsUpdate=!0;c&&c(this)},f[b].crossOrigin=this.crossOrigin,f[b].src=a[b];return e},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=b|1,d=a.width,f=a.height,e=document.createElement("canvas");e.width=d;e.height=f;var g=e.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,f).data,j=g.createImageData(d,f),k=j.data,i=0;i<d;i++)for(var o=1;o<f;o++){var l=0>o-1?f-1:o-1,n=(o+1)%f,p=0>i-1?d-1:i-1,m=(i+1)%d,r=[],q=[0,0,h[4*(o*d+i)]/255*b];r.push([-1,0,h[4*(o*d+p)]/255*b]);r.push([-1,-1,h[4*(l*d+p)]/255*b]);r.push([0,-1,
-h[4*(l*d+i)]/255*b]);r.push([1,-1,h[4*(l*d+m)]/255*b]);r.push([1,0,h[4*(o*d+m)]/255*b]);r.push([1,1,h[4*(n*d+m)]/255*b]);r.push([0,1,h[4*(n*d+i)]/255*b]);r.push([-1,1,h[4*(n*d+p)]/255*b]);l=[];p=r.length;for(n=0;n<p;n++){var m=r[n],t=r[(n+1)%p],m=[m[0]-q[0],m[1]-q[1],m[2]-q[2]],t=[t[0]-q[0],t[1]-q[1],t[2]-q[2]];l.push(c([m[1]*t[2]-m[2]*t[1],m[2]*t[0]-m[0]*t[2],m[0]*t[1]-m[1]*t[0]]))}r=[0,0,0];for(n=0;n<l.length;n++)r[0]+=l[n][0],r[1]+=l[n][1],r[2]+=l[n][2];r[0]/=l.length;r[1]/=l.length;r[2]/=l.length;
-q=4*(o*d+i);k[q]=255*((r[0]+1)/2)|0;k[q+1]=255*(r[1]+0.5)|0;k[q+2]=255*r[2]|0;k[q+3]=255}g.putImageData(j,0,0);return e},generateDataTexture:function(a,b,c){for(var d=a*b,f=new Uint8Array(3*d),e=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)f[3*h]=e,f[3*h+1]=g,f[3*h+2]=c;a=new THREE.DataTexture(f,a,b,THREE.RGBFormat);a.needsUpdate=!0;return 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=b|1,d=a.width,f=a.height,e=document.createElement("canvas");e.width=d;e.height=f;var g=e.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,f).data,i=g.createImageData(d,f),j=i.data,k=0;k<d;k++)for(var q=1;q<f;q++){var l=0>q-1?f-1:q-1,n=(q+1)%f,r=0>k-1?d-1:k-1,m=(k+1)%d,o=[],p=[0,0,h[4*(q*d+k)]/255*b];o.push([-1,0,h[4*(q*d+r)]/255*b]);o.push([-1,-1,h[4*(l*d+r)]/255*b]);o.push([0,-1,
+h[4*(l*d+k)]/255*b]);o.push([1,-1,h[4*(l*d+m)]/255*b]);o.push([1,0,h[4*(q*d+m)]/255*b]);o.push([1,1,h[4*(n*d+m)]/255*b]);o.push([0,1,h[4*(n*d+k)]/255*b]);o.push([-1,1,h[4*(n*d+r)]/255*b]);l=[];r=o.length;for(n=0;n<r;n++){var m=o[n],t=o[(n+1)%r],m=[m[0]-p[0],m[1]-p[1],m[2]-p[2]],t=[t[0]-p[0],t[1]-p[1],t[2]-p[2]];l.push(c([m[1]*t[2]-m[2]*t[1],m[2]*t[0]-m[0]*t[2],m[0]*t[1]-m[1]*t[0]]))}o=[0,0,0];for(n=0;n<l.length;n++)o[0]+=l[n][0],o[1]+=l[n][1],o[2]+=l[n][2];o[0]/=l.length;o[1]/=l.length;o[2]/=l.length;
+p=4*(q*d+k);j[p]=255*((o[0]+1)/2)|0;j[p+1]=255*(o[1]+0.5)|0;j[p+2]=255*o[2]|0;j[p+3]=255}g.putImageData(i,0,0);return e},generateDataTexture:function(a,b,c){for(var d=a*b,f=new Uint8Array(3*d),e=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)f[3*h]=e,f[3*h+1]=g,f[3*h+2]=c;a=new THREE.DataTexture(f,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,f=a.children.length;for(d=0;d<f;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,f=new THREE.Object3D;for(c=0;c<d;c++){var e=new THREE.Mesh(a,b[c]);f.add(e)}return f},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,
@@ -44,7 +44,7 @@ THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:
 THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.vertexColorArray=this.vertexUvArray=this.vertexNormalArray=this.vertexPositionArray=this.vertexIndexArray=this.vertexColorBuffer=this.vertexUvBuffer=this.vertexNormalBuffer=this.vertexPositionBuffer=this.vertexIndexBuffer=null;this.dynamic=!1;this.boundingSphere=this.boundingBox=null;this.morphTargets=[]};THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,computeBoundingBox:function(){},computeBoundingSphere:function(){}};
 THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
 THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),f,e=0;b.push(0);for(f=1;f<=a;f++)c=this.getPoint(f/a),e+=c.distanceTo(d),b.push(e),d=c;return this.cacheArcLengths=b};
-THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,f=c.length,e;e=b?b:a*c[f-1];for(var g=0,h=f-1,j;g<=h;)if(d=Math.floor(g+(h-g)/2),j=c[d]-e,0>j)g=d+1;else if(0<j)h=d-1;else{h=d;break}d=h;if(c[d]==e)return d/(f-1);g=c[d];return c=(d+(e-g)/(c[d+1]-g))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
+THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,f=c.length,e;e=b?b:a*c[f-1];for(var g=0,h=f-1,i;g<=h;)if(d=Math.floor(g+(h-g)/2),i=c[d]-e,0>i)g=d+1;else if(0<i)h=d-1;else{h=d;break}d=h;if(c[d]==e)return d/(f-1);g=c[d];return c=(d+(e-g)/(c[d+1]-g))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
 THREE.Curve.prototype.getTangent=function(a){var b=a-1.0E-4,a=a+1.0E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().subSelf(b).normalize()};THREE.Curve.prototype.getTangentAt=function(a){return this.getTangent(this.getUtoTmapping(a))};THREE.LineCurve=function(a,b){a instanceof THREE.Vector2?(this.v1=a,this.v2=b):THREE.LineCurve.oldConstructor.apply(this,arguments)};
 THREE.LineCurve.oldConstructor=function(a,b,c,d){this.constructor(new THREE.Vector2(a,b),new THREE.Vector2(c,d))};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.multiplyScalar(a).addSelf(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};
 THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};THREE.QuadraticBezierCurve=function(a,b,c){if(!(b instanceof THREE.Vector2))var d=Array.prototype.slice.call(arguments),a=new THREE.Vector2(d[0],d[1]),b=new THREE.Vector2(d[2],d[3]),c=new THREE.Vector2(d[4],d[5]);this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
@@ -63,10 +63,10 @@ THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]
 d[c[1]].z,d[c[2]].z,d[c[3]].z,f);return b});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=!1};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};
 THREE.CurvePath.prototype.closePath=function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
 THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,f;b=c=Number.NEGATIVE_INFINITY;d=f=Number.POSITIVE_INFINITY;var e,g,h,j;j=new THREE.Vector2;for(g=0,h=a.length;g<h;g++){e=a[g];if(e.x>b)b=e.x;else if(e.x<d)d=e.x;if(e.y>c)c=e.y;else if(e.y<c)f=e.y;j.addSelf(e.x,e.y)}return{minX:d,minY:f,maxX:b,maxY:c,centroid:j.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,f;b=c=Number.NEGATIVE_INFINITY;d=f=Number.POSITIVE_INFINITY;var e,g,h,i;i=new THREE.Vector2;for(g=0,h=a.length;g<h;g++){e=a[g];if(e.x>b)b=e.x;else if(e.x<d)d=e.x;if(e.y>c)c=e.y;else if(e.y<c)f=e.y;i.addSelf(e.x,e.y)}return{minX:d,minY:f,maxX:b,maxY:c,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
 THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vertex(new THREE.Vector3(a[c].x,a[c].y,0)));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
 THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,f;if(!b)b=this.bends;for(d=0,f=b.length;d<f;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,f;if(!b)b=this.bends;for(d=0,f=b.length;d<f;d++)c=this.getWrapPoints(c,b[d]);return c};
-THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,f,e,g,h,j;for(d=0,f=a.length;d<f;d++)e=a[d],g=e.x,h=e.y,j=g/c.maxX,j=b.getUtoTmapping(j,g),g=b.getPoint(j),h=b.getNormalVector(j).multiplyScalar(h),e.x=g.x+h.x,e.y=g.y+h.y;return a};
+THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,f,e,g,h,i;for(d=0,f=a.length;d<f;d++)e=a[d],g=e.x,h=e.y,i=g/c.maxX,i=b.getUtoTmapping(i,g),g=b.getPoint(i),h=b.getNormalVector(i).multiplyScalar(h),e.x=g.x+h.x,e.y=g.y+h.y;return a};
 THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){void 0==a[b]&&(a[b]=[]);-1===a[b].indexOf(c)&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)}};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=new THREE.Object3D;THREE.Gyroscope.prototype.constructor=THREE.Gyroscope;
 THREE.Gyroscope.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?(this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(this.translationWorld,this.rotationWorld,this.scaleWorld),this.matrix.decompose(this.translationObject,this.rotationObject,this.scaleObject),this.matrixWorld.compose(this.translationWorld,this.rotationObject,this.scaleWorld)):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.Gyroscope.prototype.translationWorld=new THREE.Vector3;THREE.Gyroscope.prototype.translationObject=new THREE.Vector3;THREE.Gyroscope.prototype.rotationWorld=new THREE.Quaternion;THREE.Gyroscope.prototype.rotationObject=new THREE.Quaternion;THREE.Gyroscope.prototype.scaleWorld=new THREE.Vector3;THREE.Gyroscope.prototype.scaleObject=new THREE.Vector3;
@@ -77,37 +77,37 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,f,e){var g=Array.prototype.s
 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,f,e){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1],h=new THREE.ArcCurve(h.x+a,h.y+b,c,d,f,e);this.curves.push(h);h=h.getPoint(e?1:0);g.push(h.x);g.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:g})};
 THREE.Path.prototype.absarc=function(a,b,c,d,f,e){var g=Array.prototype.slice.call(arguments),h=new THREE.ArcCurve(a,b,c,d,f,e);this.curves.push(h);h=h.getPoint(e?1:0);g.push(h.x);g.push(h.y);this.actions.push({action:THREE.PathActions.ARC,args:g})};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,f,e,g,h,j,k,i,o,l,n,p,m;for(d=0,f=this.actions.length;d<f;d++)switch(e=this.actions[d],g=e.action,e=e.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];j=e[3];o=e[0];l=e[1];0<c.length?(g=c[c.length-1],n=g.x,p=g.y):(g=this.actions[d-1].args,n=g[g.length-2],p=g[g.length-1]);for(e=1;e<=
-a;e++)m=e/a,g=THREE.Shape.Utils.b2(m,n,o,h),m=THREE.Shape.Utils.b2(m,p,l,j),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];j=e[5];o=e[0];l=e[1];k=e[2];i=e[3];0<c.length?(g=c[c.length-1],n=g.x,p=g.y):(g=this.actions[d-1].args,n=g[g.length-2],p=g[g.length-1]);for(e=1;e<=a;e++)m=e/a,g=THREE.Shape.Utils.b3(m,n,o,k,h),m=THREE.Shape.Utils.b3(m,p,l,i,j),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;m=[new THREE.Vector2(g[g.length-
-2],g[g.length-1])];g=a*e[0].length;m=m.concat(e[0]);m=new THREE.SplineCurve(m);for(e=1;e<=g;e++)c.push(m.getPointAt(e/g));break;case THREE.PathActions.ARC:h=e[0];j=e[1];k=e[2];o=e[3];l=!!e[5];i=e[4]-o;n=2*a;for(e=1;e<=n;e++)m=e/n,l||(m=1-m),m=o+m*i,g=h+k*Math.cos(m),m=j+k*Math.sin(m),c.push(new THREE.Vector2(g,m))}d=c[c.length-1];1.0E-10>Math.abs(d.x-c[0].x)&&1.0E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);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,f,e){var g=this.getPoints(),h,j,k,i,o;for(h=0,j=g.length;h<j;h++)k=g[h],i=k.x,o=k.y,k.x=a*i+b*o+c,k.y=d*o+f*i+e;return g};
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,f,e,g,h,i,j,k,q,l,n,r,m;for(d=0,f=this.actions.length;d<f;d++)switch(e=this.actions[d],g=e.action,e=e.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];i=e[3];q=e[0];l=e[1];0<c.length?(g=c[c.length-1],n=g.x,r=g.y):(g=this.actions[d-1].args,n=g[g.length-2],r=g[g.length-1]);for(e=1;e<=
+a;e++)m=e/a,g=THREE.Shape.Utils.b2(m,n,q,h),m=THREE.Shape.Utils.b2(m,r,l,i),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];q=e[0];l=e[1];j=e[2];k=e[3];0<c.length?(g=c[c.length-1],n=g.x,r=g.y):(g=this.actions[d-1].args,n=g[g.length-2],r=g[g.length-1]);for(e=1;e<=a;e++)m=e/a,g=THREE.Shape.Utils.b3(m,n,q,j,h),m=THREE.Shape.Utils.b3(m,r,l,k,i),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;m=[new THREE.Vector2(g[g.length-
+2],g[g.length-1])];g=a*e[0].length;m=m.concat(e[0]);m=new THREE.SplineCurve(m);for(e=1;e<=g;e++)c.push(m.getPointAt(e/g));break;case THREE.PathActions.ARC:h=e[0];i=e[1];j=e[2];q=e[3];l=!!e[5];k=e[4]-q;n=2*a;for(e=1;e<=n;e++)m=e/n,l||(m=1-m),m=q+m*k,g=h+j*Math.cos(m),m=i+j*Math.sin(m),c.push(new THREE.Vector2(g,m))}d=c[c.length-1];1.0E-10>Math.abs(d.x-c[0].x)&&1.0E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);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,f,e){var g=this.getPoints(),h,i,j,k,q;for(h=0,i=g.length;h<i;h++)j=g[h],k=j.x,q=j.y,j.x=a*k+b*q+c,j.y=d*q+f*k+e;return g};
 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,f;for(a=0,c=this.actions.length;a<c;a++)d=this.actions[a],f=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,f);b.stroke();b.closePath();b.strokeStyle="red";d=
 this.getPoints();for(a=0,c=d.length;a<c;a++)f=d[a],b.beginPath(),b.arc(f.x,f.y,1.5,0,2*Math.PI,!1),b.stroke(),b.closePath()};
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,f=[],e=new THREE.Path;for(a=0,b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&0!=e.actions.length&&(f.push(e),e=new THREE.Path),e[c].apply(e,d);0!=e.actions.length&&f.push(e);if(0==f.length)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(f[0].getPoints());if(1==f.length)return e=f[0],g=new THREE.Shape,g.actions=e.actions,g.curves=e.curves,d.push(g),d;if(a){g=new THREE.Shape;for(a=0,b=f.length;a<
 b;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(g.actions=e.actions,g.curves=e.curves,d.push(g),g=new THREE.Shape):g.holes.push(e)}else{for(a=0,b=f.length;a<b;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(g&&d.push(g),g=new THREE.Shape,g.actions=e.actions,g.curves=e.curves):g.holes.push(e);d.push(g)}return d};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(),f,e,g,h,j,k,i,o,l,n,p=[];for(j=0;j<b.length;j++){k=b[j];Array.prototype.push.apply(d,k);e=Number.POSITIVE_INFINITY;for(f=0;f<k.length;f++){l=k[f];n=[];for(o=0;o<c.length;o++)i=c[o],i=l.distanceToSquared(i),n.push(i),i<e&&(e=i,g=f,h=o)}f=0<=h-1?h-1:c.length-1;e=0<=g-1?g-1:k.length-1;var m=[k[g],c[h],c[f]];o=THREE.FontUtils.Triangulate.area(m);var r=[k[g],k[e],c[h]];l=THREE.FontUtils.Triangulate.area(r);n=h;i=g;h+=1;g+=-1;0>
-h&&(h+=c.length);h%=c.length;0>g&&(g+=k.length);g%=k.length;f=0<=h-1?h-1:c.length-1;e=0<=g-1?g-1:k.length-1;m=[k[g],c[h],c[f]];m=THREE.FontUtils.Triangulate.area(m);r=[k[g],k[e],c[h]];r=THREE.FontUtils.Triangulate.area(r);o+l>m+r&&(h=n,g=i,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=k.length),g%=k.length,f=0<=h-1?h-1:c.length-1,e=0<=g-1?g-1:k.length-1);o=c.slice(0,h);l=c.slice(h);n=k.slice(g);i=k.slice(0,g);e=[k[g],k[e],c[h]];p.push([k[g],c[h],c[f]]);p.push(e);c=o.concat(n).concat(i).concat(l)}return{shape:c,
-isolatedPts:p,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),e,g,h,j,k={};for(e=0,g=d.length;e<g;e++)j=d[e].x+":"+d[e].y,void 0!==k[j]&&console.log("Duplicate point",j),k[j]=e;for(e=0,g=c.length;e<g;e++){h=c[e];for(d=0;3>d;d++)j=h[d].x+":"+h[d].y,j=k[j],void 0!==j&&(h[d]=j)}for(e=0,g=f.length;e<g;e++){h=f[e];for(d=0;3>d;d++)j=h[d].x+":"+h[d].y,j=k[j],void 0!==j&&(h[d]=j)}return c.concat(f)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),f,e,g,h,i,j,k,q,l,n,r=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);e=Number.POSITIVE_INFINITY;for(f=0;f<j.length;f++){l=j[f];n=[];for(q=0;q<c.length;q++)k=c[q],k=l.distanceToSquared(k),n.push(k),k<e&&(e=k,g=f,h=q)}f=0<=h-1?h-1:c.length-1;e=0<=g-1?g-1:j.length-1;var m=[j[g],c[h],c[f]];q=THREE.FontUtils.Triangulate.area(m);var o=[j[g],j[e],c[h]];l=THREE.FontUtils.Triangulate.area(o);n=h;k=g;h+=1;g+=-1;0>
+h&&(h+=c.length);h%=c.length;0>g&&(g+=j.length);g%=j.length;f=0<=h-1?h-1:c.length-1;e=0<=g-1?g-1:j.length-1;m=[j[g],c[h],c[f]];m=THREE.FontUtils.Triangulate.area(m);o=[j[g],j[e],c[h]];o=THREE.FontUtils.Triangulate.area(o);q+l>m+o&&(h=n,g=k,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=j.length),g%=j.length,f=0<=h-1?h-1:c.length-1,e=0<=g-1?g-1:j.length-1);q=c.slice(0,h);l=c.slice(h);n=j.slice(g);k=j.slice(0,g);e=[j[g],j[e],c[h]];r.push([j[g],c[h],c[f]]);r.push(e);c=q.concat(n).concat(k).concat(l)}return{shape:c,
+isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),e,g,h,i,j={};for(e=0,g=d.length;e<g;e++)i=d[e].x+":"+d[e].y,void 0!==j[i]&&console.log("Duplicate point",i),j[i]=e;for(e=0,g=c.length;e<g;e++){h=c[e];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}for(e=0,g=f.length;e<g;e++){h=f[e];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=j[i],void 0!==i&&(h[d]=i)}return c.concat(f)},
 isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},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,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 this.b3p3(a,f)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){b=b||this.parameters;this.text=a;var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",f=void 0!==b.weight?b.weight:"normal",e=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=f;THREE.FontUtils.style=e};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
 THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){-1===a.indexOf(b)&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);-1!==b&&a.splice(b,1)},add:function(a){void 0!==b[a.name]&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(!0!==a.initialized){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(0>a.hierarchy[c].keys[d].time)a.hierarchy[c].keys[d].time=
-0;if(void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var j=0;j<a.hierarchy[c].keys[d].morphTargets.length;j++){var k=a.hierarchy[c].keys[d].morphTargets[j];h[k]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var i=
-{};for(k in h){for(j=0;j<a.hierarchy[c].keys[d].morphTargets.length;j++)if(a.hierarchy[c].keys[d].morphTargets[j]===k){i[k]=a.hierarchy[c].keys[d].morphTargetsInfluences[j];break}j===a.hierarchy[c].keys[d].morphTargets.length&&(i[k]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=i}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
+0;if(void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k=
+{};for(j in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){k[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if("string"===typeof a){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=
 1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=void 0!==c?c:THREE.AnimationHandler.LINEAR;this.JITCompile=void 0!==d?d:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;var c,d=this.hierarchy.length,f;for(c=0;c<d;c++){f=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(void 0===f.animationCache)f.animationCache={},f.animationCache.prevKey={pos:0,rot:0,scl:0},f.animationCache.nextKey={pos:0,rot:0,scl:0},f.animationCache.originalMatrix=f instanceof
 THREE.Bone?f.skinMatrix:f.matrix;var e=f.animationCache.prevKey;f=f.animationCache.nextKey;e.pos=this.data.hierarchy[c].keys[0];e.rot=this.data.hierarchy[c].keys[0];e.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.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(void 0!==this.hierarchy[a].animationCache)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,f,e,g,h,j,k,i=this.data.JIT.hierarchy,o,l;l=this.currentTime+=a*this.timeScale;o=this.currentTime%=this.data.length;k=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,p=this.hierarchy.length;n<p;n++)if(a=this.hierarchy[n],j=a.animationCache,this.JITCompile&&void 0!==i[n][k])a instanceof THREE.Bone?(a.skinMatrix=i[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
-i[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;3>m;m++){c=b[m];g=j.prevKey[c];h=j.nextKey[c];if(h.time<=l){if(o<l)if(this.loop){g=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<o;)g=h,h=this.getNextKeyWith(c,n,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,n,h.index+1);while(h.time<o)}j.prevKey[c]=
-g;j.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(o-g.time)/(h.time-g.time);f=g[c];e=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(e[0]-f[0])*d,c.y=f[1]+(e[1]-f[1])*d,c.z=f[2]+(e[2]-f[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,f,e,g,h,i,j,k=this.data.JIT.hierarchy,q,l;l=this.currentTime+=a*this.timeScale;q=this.currentTime%=this.data.length;j=parseInt(Math.min(q*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,r=this.hierarchy.length;n<r;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&void 0!==k[n][j])a instanceof THREE.Bone?(a.skinMatrix=k[n][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
+k[n][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;3>m;m++){c=b[m];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=l){if(q<l)if(this.loop){g=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(c,n,1);h.time<q;)g=h,h=this.getNextKeyWith(c,n,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,n,h.index+1);while(h.time<q)}i.prevKey[c]=
+g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(q-g.time)/(h.time-g.time);f=g[c];e=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(e[0]-f[0])*d,c.y=f[1]+(e[1]-f[1])*d,c.z=f[2]+(e[2]-f[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",n,g.index-1).pos,this.points[1]=f,this.points[2]=e,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=0.33*d+0.33,f=this.interpolateCatmullRom(this.points,d),c.x=f[0],c.y=f[1],c.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,1.01*d),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("rot"===
-c)THREE.Quaternion.slerp(f,e,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=f[0]+(e[0]-f[0])*d,c.y=f[1]+(e[1]-f[1])*d,c.z=f[2]+(e[2]-f[2])*d}}if(this.JITCompile&&void 0===i[0][k]){this.hierarchy[0].updateMatrixWorld(!0);for(n=0;n<this.hierarchy.length;n++)i[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=[],f,e,g,h,j,k;f=(a.length-1)*b;e=Math.floor(f);f-=e;c[0]=0===e?e:e-1;c[1]=e;c[2]=e>a.length-2?e:e+1;c[3]=e>a.length-3?e:e+2;e=a[c[0]];h=a[c[1]];j=a[c[2]];k=a[c[3]];c=f*f;g=f*c;d[0]=this.interpolate(e[0],h[0],j[0],k[0],f,c,g);d[1]=this.interpolate(e[1],h[1],j[1],k[1],f,c,g);d[2]=this.interpolate(e[2],h[2],j[2],k[2],f,c,g);return d};
+c)THREE.Quaternion.slerp(f,e,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=f[0]+(e[0]-f[0])*d,c.y=f[1]+(e[1]-f[1])*d,c.z=f[2]+(e[2]-f[2])*d}}if(this.JITCompile&&void 0===k[0][j]){this.hierarchy[0].updateMatrixWorld(!0);for(n=0;n<this.hierarchy.length;n++)k[n][j]=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=[],f,e,g,h,i,j;f=(a.length-1)*b;e=Math.floor(f);f-=e;c[0]=0===e?e:e-1;c[1]=e;c[2]=e>a.length-2?e:e+1;c[3]=e>a.length-3?e:e+2;e=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=f*f;g=f*c;d[0]=this.interpolate(e[0],h[0],i[0],j[0],f,c,g);d[1]=this.interpolate(e[1],h[1],i[1],j[1],f,c,g);d[2]=this.interpolate(e[2],h[2],i[2],j[2],f,c,g);return d};
 THREE.Animation.prototype.interpolate=function(a,b,c,d,f,e,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*e+a*f+b};THREE.Animation.prototype.getNextKeyWith=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<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])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?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};
 THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var f=0;f<c.length;f++){var e=c[f],g=this.getNextKeyWith(e,a,0);g&&g.apply(e)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
@@ -115,9 +115,9 @@ d.matrixWorldNeedsUpdate=!0}}};
 THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,f,e;for(c=0;c<d;c++){f=this.hierarchy[c];e=this.data.hierarchy[c];f.useQuaternion=!0;if(void 0===e.animationCache)e.animationCache={},e.animationCache.prevKey=null,e.animationCache.nextKey=null,e.animationCache.originalMatrix=f instanceof THREE.Bone?f.skinMatrix:
 f.matrix;f=this.data.hierarchy[c].keys;if(f.length)e.animationCache.prevKey=f[0],e.animationCache.nextKey=f[1],this.startTime=Math.min(f[0].time,this.startTime),this.endTime=Math.max(f[f.length-1].time,this.endTime)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(void 0!==c.animationCache){var d=c.animationCache.originalMatrix;b instanceof THREE.Bone?(d.copy(b.skinMatrix),b.skinMatrix=d):(d.copy(b.matrix),b.matrix=d);delete c.animationCache}}};
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,f,e=this.data.JIT.hierarchy,g,h,j;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;f=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((j=g<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var i=this.data.hierarchy[a].keys,e=this.data.hierarchy[a].sids;d=i.length-1;f=this.hierarchy[a];if(i.length){for(i=
-0;i<e.length;i++)g=e[i],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();f.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(k=this.hierarchy.length;a<k;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var i=b.keys,o=b.animationCache;if(this.JITCompile&&void 0!==e[a][f])d instanceof THREE.Bone?(d.skinMatrix=e[a][f],d.matrixWorldNeedsUpdate=!1):(d.matrix=e[a][f],d.matrixWorldNeedsUpdate=!0);else if(i.length){if(this.JITCompile&&o)d instanceof
-THREE.Bone?d.skinMatrix=o.originalMatrix:d.matrix=o.originalMatrix;b=o.prevKey;c=o.nextKey;if(b&&c){if(c.time<=h){if(j&&this.loop){b=i[0];for(c=i[1];c.time<g;)b=c,c=i[b.index+1]}else if(!j)for(var l=i.length-1;c.time<g&&c.index!==l;)b=c,c=i[b.index+1];o.prevKey=b;o.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===e[0][f]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)e[a][f]=
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,f,e=this.data.JIT.hierarchy,g,h,i;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;f=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var k=this.data.hierarchy[a].keys,e=this.data.hierarchy[a].sids;d=k.length-1;f=this.hierarchy[a];if(k.length){for(k=
+0;k<e.length;k++)g=e[k],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();f.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,q=b.animationCache;if(this.JITCompile&&void 0!==e[a][f])d instanceof THREE.Bone?(d.skinMatrix=e[a][f],d.matrixWorldNeedsUpdate=!1):(d.matrix=e[a][f],d.matrixWorldNeedsUpdate=!0);else if(k.length){if(this.JITCompile&&q)d instanceof
+THREE.Bone?d.skinMatrix=q.originalMatrix:d.matrix=q.originalMatrix;b=q.prevKey;c=q.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=k[0];for(c=k[1];c.time<g;)b=c,c=k[b.index+1]}else if(!i)for(var l=k.length-1;c.time<g&&c.index!==l;)b=c,c=k[b.index+1];q.prevKey=b;q.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===e[0][f]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)e[a][f]=
 this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
 THREE.CubeCamera=function(a,b,c,d){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
 this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
@@ -137,8 +137,8 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);a*=this.lookSpeed;this.activeLook||(a=0);this.lon+=this.mouseX*a;this.lookVertical&&(this.lat-=this.mouseY*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;var b=this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);b=1;this.constrainVertical&&
 (b=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*a;this.lookVertical&&(this.lat-=this.mouseY*a*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
 this.object.lookAt(b)}};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){return 1>(a*=2)?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),r=g.length,q=0;f=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<r-1;f++)q=d*h.chunks[f]/h.total,b.keys[f]={time:q,pos:g[f]};e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
-return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=void 0!==b?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=
+THREE.PathControls=function(a,b){function c(a){return 1>(a*=2)?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),o=g.length,p=0;f=o-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<o-1;f++)p=d*h.chunks[f]/h.total,b.keys[f]={time:p,pos:g[f]};e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
+return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(a,b){var c,d,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return f}this.object=a;this.domElement=void 0!==b?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 g=2*Math.PI,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%g;this.phi=0<=a?a:a+g;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===
@@ -155,72 +155,72 @@ 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=void 0!==b?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,f=new THREE.Vector3,e=new THREE.Matrix4,g=!1,h=1,j=0,k=0,i=0,o=0,l=0,n=window.innerWidth/2,p=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
-this.rotateHorizontally(b*o);this.rotateVertically(b*l)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<j||this.autoForward&&!(0>j)?1:j));this.object.translateX(b*k);this.object.translateY(b*i);g&&(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();f.copy(this.forward);d.set(0,1,0);c.cross(d,
+THREE.RollControls=function(a,b){this.object=a;this.domElement=void 0!==b?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,f=new THREE.Vector3,e=new THREE.Matrix4,g=!1,h=1,i=0,j=0,k=0,q=0,l=0,n=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
+this.rotateHorizontally(b*q);this.rotateVertically(b*l)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*j);this.object.translateY(b*k);g&&(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();f.copy(this.forward);d.set(0,1,0);c.cross(d,
 f).normalize();d.cross(f,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=f.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=f.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=f.z;e.identity();e.n11=Math.cos(this.roll);e.n12=-Math.sin(this.roll);e.n21=Math.sin(this.roll);e.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(e);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-n)/window.innerWidth;l=(a.clientY-p)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:j=1;break;case 2:j=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:j=0;break;case 2:j=0}},!1);this.domElement.addEventListener("keydown",
-function(a){switch(a.keyCode){case 38:case 87:j=1;break;case 37:case 65:k=-1;break;case 40:case 83:j=-1;break;case 39:case 68:k=1;break;case 81:g=!0;h=1;break;case 69:g=!0;h=-1;break;case 82:i=1;break;case 70:i=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:j=0;break;case 37:case 65:k=0;break;case 40:case 83:j=0;break;case 39:case 68:k=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:i=0;break;case 70:i=0}},!1)};
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){q=(a.clientX-n)/window.innerWidth;l=(a.clientY-r)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
+function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:g=!0;h=1;break;case 69:g=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
 THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=void 0!==b?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;var d=new THREE.Vector3,f=!1,e=-1,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector2,i=new THREE.Vector2,o=new THREE.Vector2,l=new THREE.Vector2,n={type:"change"};this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
-0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*c.screen.height+c.screen.offsetTop-b)/c.radius,0),e=d.length();1<e?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(j)/h.length()/j.length());if(a){var b=(new THREE.Vector3).cross(h,j).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;
-d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(j);c.staticMoving?h=j:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(i.y-k.y)*c.zoomSpeed;1!==a&&0<a&&(g.multiplyScalar(a),c.staticMoving?k=i:k.y+=(i.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=l.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);
-b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=l:o.addSelf(a.sub(l,o).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))};this.update=function(){g.copy(c.object.position).subSelf(c.target);
-c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);0<d.distanceTo(c.object.position)&&(c.dispatchEvent(n),d.copy(c.object.position))};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(f&&(h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY),k=i=c.getMouseOnScreen(a.clientX,a.clientY),o=l=c.getMouseOnScreen(a.clientX,
-a.clientY),f=!1),-1!==e&&(0===e&&!c.noRotate?j=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?i=c.getMouseOnScreen(a.clientX,a.clientY):2===e&&!c.noPan&&(l=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===e))e=a.button,0===e&&!c.noRotate?h=j=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?k=i=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=l=
+new THREE.Vector3;var d=new THREE.Vector3,f=!1,e=-1,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,q=new THREE.Vector2,l=new THREE.Vector2,n={type:"change"};this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-
+0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*c.screen.height+c.screen.offsetTop-b)/c.radius,0),e=d.length();1<e?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.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=a*c.rotateSpeed;
+d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*c.zoomSpeed;1!==a&&0<a&&(g.multiplyScalar(a),c.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=l.clone().subSelf(q);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.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=l:q.addSelf(a.sub(l,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),g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))};this.update=function(){g.copy(c.object.position).subSelf(c.target);
+c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);0<d.distanceTo(c.object.position)&&(c.dispatchEvent(n),d.copy(c.object.position))};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(f&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=c.getMouseOnScreen(a.clientX,a.clientY),q=l=c.getMouseOnScreen(a.clientX,
+a.clientY),f=!1),-1!==e&&(0===e&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):2===e&&!c.noPan&&(l=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===e))e=a.button,0===e&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?j=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(q=l=
 c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),e=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&-1===e&&(a.keyCode===c.keys[0]&&!c.noRotate?e=0:a.keyCode===c.keys[1]&&!c.noZoom?e=1:a.keyCode===c.keys[2]&&!c.noPan&&(e=2),-1!==e&&(f=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&-1!==e&&(e=-1)},!1)};
-THREE.CubeGeometry=function(a,b,c,d,f,e,g,h){function j(a,b,c,g,h,i,j,l){var n,m=d||1,o=f||1,p=h/2,r=i/2,q=k.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",o=e||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",m=e||1;var s=m+1,t=o+1,F=h/m,B=i/o,M=new THREE.Vector3;M[n]=0<j?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var N=new THREE.Vector3;N[a]=(i*F-p)*c;N[b]=(h*B-r)*g;N[n]=j;k.vertices.push(new THREE.Vertex(N))}for(h=0;h<o;h++)for(i=0;i<m;i++)a=
-new THREE.Face4(i+s*h+q,i+s*(h+1)+q,i+1+s*(h+1)+q,i+1+s*h+q),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/m,h/o),new THREE.UV(i/m,(h+1)/o),new THREE.UV((i+1)/m,(h+1)/o),new THREE.UV((i+1)/m,h/o)])}THREE.Geometry.call(this);var k=this,i=a/2,o=b/2,l=c/2,n,p,m,r,q,t;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(n=0;6>n;n++)this.materials.push(g)}n=0;r=1;p=2;q=
-3;m=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var s in h)void 0!==this.sides[s]&&(this.sides[s]=h[s]);this.sides.px&&j("z","y",-1,-1,c,b,i,n);this.sides.nx&&j("z","y",1,-1,c,b,-i,r);this.sides.py&&j("x","z",1,1,a,c,o,p);this.sides.ny&&j("x","z",1,-1,a,c,-o,q);this.sides.pz&&j("x","y",1,-1,a,b,l,m);this.sides.nz&&j("x","y",-1,-1,a,b,-l,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,b,c,d,f,e,g,h){function i(a,b,c,g,h,l,i,k){var n,m=d||1,q=f||1,r=h/2,o=l/2,p=j.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",q=e||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",m=e||1;var s=m+1,t=q+1,E=h/m,y=l/q,M=new THREE.Vector3;M[n]=0<i?1:-1;for(h=0;h<t;h++)for(l=0;l<s;l++){var N=new THREE.Vector3;N[a]=(l*E-r)*c;N[b]=(h*y-o)*g;N[n]=i;j.vertices.push(new THREE.Vertex(N))}for(h=0;h<q;h++)for(l=0;l<m;l++)a=
+new THREE.Face4(l+s*h+p,l+s*(h+1)+p,l+1+s*(h+1)+p,l+1+s*h+p),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=k,j.faces.push(a),j.faceVertexUvs[0].push([new THREE.UV(l/m,h/q),new THREE.UV(l/m,(h+1)/q),new THREE.UV((l+1)/m,(h+1)/q),new THREE.UV((l+1)/m,h/q)])}THREE.Geometry.call(this);var j=this,k=a/2,q=b/2,l=c/2,n,r,m,o,p,t;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(n=0;6>n;n++)this.materials.push(g)}n=0;o=1;r=2;p=
+3;m=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var s in h)void 0!==this.sides[s]&&(this.sides[s]=h[s]);this.sides.px&&i("z","y",-1,-1,c,b,k,n);this.sides.nx&&i("z","y",1,-1,c,b,-k,o);this.sides.py&&i("x","z",1,1,a,c,q,r);this.sides.ny&&i("x","z",1,-1,a,c,-q,p);this.sides.pz&&i("x","y",1,-1,a,b,l,m);this.sides.nz&&i("x","y",-1,-1,a,b,-l,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,f=f||1,h,j,k=[],i=[];for(j=0;j<=f;j++){var o=[],l=[],n=j/f,p=n*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,r=p*Math.sin(2*m*Math.PI),q=-n*c+g,t=p*Math.cos(2*m*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(r,q,t)));o.push(this.vertices.length-1);l.push(new THREE.UV(m,n))}k.push(o);i.push(l)}for(j=0;j<f;j++)for(h=0;h<d;h++){var c=k[j][h],o=k[j+1][h],
-l=k[j+1][h+1],n=k[j][h+1],p=this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[o].position.clone().setY(0).normalize(),r=this.vertices[l].position.clone().setY(0).normalize(),q=this.vertices[n].position.clone().setY(0).normalize(),t=i[j][h].clone(),s=i[j+1][h].clone(),u=i[j+1][h+1].clone(),v=i[j][h+1].clone();this.faces.push(new THREE.Face4(c,o,l,n,[p,m,r,q]));this.faceVertexUvs[0].push([t,s,u,v])}if(!e&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
-0;h<d;h++)c=k[0][h],o=k[0][h+1],l=this.vertices.length-1,p=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),t=i[0][h].clone(),s=i[0][h+1].clone(),u=new THREE.UV(s.u,0),this.faces.push(new THREE.Face3(c,o,l,[p,m,r])),this.faceVertexUvs[0].push([t,s,u])}if(!e&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=k[j][h+1],o=k[j][h],l=this.vertices.length-1,p=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,
-0),t=i[j][h+1].clone(),s=i[j][h].clone(),u=new THREE.UV(s.u,1),this.faces.push(new THREE.Face3(c,o,l,[p,m,r])),this.faceVertexUvs[0].push([t,s,u])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,f=f||1,h,i,j=[],k=[];for(i=0;i<=f;i++){var q=[],l=[],n=i/f,r=n*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,o=r*Math.sin(2*m*Math.PI),p=-n*c+g,t=r*Math.cos(2*m*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,p,t)));q.push(this.vertices.length-1);l.push(new THREE.UV(m,n))}j.push(q);k.push(l)}for(i=0;i<f;i++)for(h=0;h<d;h++){var c=j[i][h],q=j[i+1][h],
+l=j[i+1][h+1],n=j[i][h+1],r=this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[q].position.clone().setY(0).normalize(),o=this.vertices[l].position.clone().setY(0).normalize(),p=this.vertices[n].position.clone().setY(0).normalize(),t=k[i][h].clone(),s=k[i+1][h].clone(),u=k[i+1][h+1].clone(),v=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,q,l,n,[r,m,o,p]));this.faceVertexUvs[0].push([t,s,u,v])}if(!e&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
+0;h<d;h++)c=j[0][h],q=j[0][h+1],l=this.vertices.length-1,r=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),o=new THREE.Vector3(0,1,0),t=k[0][h].clone(),s=k[0][h+1].clone(),u=new THREE.UV(s.u,0),this.faces.push(new THREE.Face3(c,q,l,[r,m,o])),this.faceVertexUvs[0].push([t,s,u])}if(!e&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=j[i][h+1],q=j[i][h],l=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),o=new THREE.Vector3(0,-1,
+0),t=k[i][h+1].clone(),s=k[i][h].clone(),u=new THREE.UV(s.u,1),this.faces.push(new THREE.Face3(c,q,l,[r,m,o])),this.faceVertexUvs[0].push([t,s,u])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,b){if("undefined"!==typeof a)THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
-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);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(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+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function f(c,d){var e,f;for(B=c.length;0<=--B;){e=B;f=B-1;0>f&&(f=c.length-1);
-for(var g=0,h=n+2*i,g=0;g<h;g++){var j=L*g,l=L*(g+1),k=d+e+j,j=d+f+j,m=d+f+l,l=d+e+l,o=c,p=g,q=h,k=k+A,j=j+A,m=m+A,l=l+A;y.faces.push(new THREE.Face4(k,j,m,l,null,null,u));k=N.generateSideWallUV(y,a,o,b,k,j,m,l,p,q);y.faceVertexUvs[0].push(k)}}}function e(a,b,c){y.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(c,d,e,f){c+=A;d+=A;e+=A;y.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?N.generateBottomUV(y,a,b,c,d,e):N.generateTopUV(y,a,b,c,d,e);y.faceVertexUvs[0].push(c)}var h=
-void 0!==b.amount?b.amount:100,j=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:j-2,i=void 0!==b.bevelSegments?b.bevelSegments:3,o=void 0!==b.bevelEnabled?b.bevelEnabled:!0,l=void 0!==b.curveSegments?b.curveSegments:12,n=void 0!==b.steps?b.steps:1,p=b.bendPath,m=b.extrudePath,r,q=!1,t=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,s=b.material,u=b.extrudeMaterial;if(m)r=m.getPoints(l),n=r.length,q=!0,o=!1;o||(k=j=i=0);var v,w,z,y=this,A=this.vertices.length;p&&a.addWrapPath(p);
-var p=t?a.extractAllSpacedPoints(l):a.extractAllPoints(l),l=p.shape,D=p.holes;if(p=!THREE.Shape.Utils.isClockWise(l)){l=l.reverse();for(w=0,z=D.length;w<z;w++)v=D[w],THREE.Shape.Utils.isClockWise(v)&&(D[w]=v.reverse());p=!1}var I=THREE.Shape.Utils.triangulateShape(l,D),J=l;for(w=0,z=D.length;w<z;w++)v=D[w],l=l.concat(v);var H,C,x,E,G,L=l.length,K,F=I.length,p=[],B=0;x=J.length;H=x-1;for(C=B+1;B<x;B++,H++,C++)H===x&&(H=0),C===x&&(C=0),p[B]=d(J[B],J[H],J[C]);var m=[],M,t=p.concat();for(w=0,z=D.length;w<
-z;w++){v=D[w];M=[];for(B=0,x=v.length,H=x-1,C=B+1;B<x;B++,H++,C++)H===x&&(H=0),C===x&&(C=0),M[B]=d(v[B],v[H],v[C]);m.push(M);t=t.concat(M)}for(H=0;H<i;H++){x=H/i;E=j*(1-x);C=k*Math.sin(x*Math.PI/2);for(B=0,x=J.length;B<x;B++)G=c(J[B],p[B],C),e(G.x,G.y,-E);for(w=0,z=D.length;w<z;w++){v=D[w];M=m[w];for(B=0,x=v.length;B<x;B++)G=c(v[B],M[B],C),e(G.x,G.y,-E)}}C=k;for(B=0;B<L;B++)G=o?c(l[B],t[B],C):l[B],q?e(G.x,G.y+r[0].y,r[0].x):e(G.x,G.y,0);for(x=1;x<=n;x++)for(B=0;B<L;B++)G=o?c(l[B],t[B],C):l[B],q?e(G.x,
-G.y+r[x-1].y,r[x-1].x):e(G.x,G.y,h/n*x);for(H=i-1;0<=H;H--){x=H/i;E=j*(1-x);C=k*Math.sin(x*Math.PI/2);for(B=0,x=J.length;B<x;B++)G=c(J[B],p[B],C),e(G.x,G.y,h+E);for(w=0,z=D.length;w<z;w++){v=D[w];M=m[w];for(B=0,x=v.length;B<x;B++)G=c(v[B],M[B],C),q?e(G.x,G.y+r[n-1].y,r[n-1].x+E):e(G.x,G.y,h+E)}}var N=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(o){var a;a=0*L;for(B=0;B<F;B++)K=I[B],g(K[2]+a,K[1]+a,K[0]+a,!0);a=n+2*i;a*=L;for(B=0;B<F;B++)K=I[B],g(K[0]+a,K[1]+a,K[2]+a,!1)}else{for(B=0;B<F;B++)K=
-I[B],g(K[2],K[1],K[0],!0);for(B=0;B<F;B++)K=I[B],g(K[0]+L*n,K[1]+L*n,K[2]+L*n,!1)}})();(function(){var a=0;f(J,a);a+=J.length;for(w=0,z=D.length;w<z;w++)v=D[w],f(v,a),a+=v.length})()};
+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,l=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);l.copy(a).addSelf(g);if(h.equals(l))return g.clone();
+h.copy(b).addSelf(f);l.copy(c).addSelf(g);f=d.dot(g);g=l.subSelf(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(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+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function f(c,d){var e,f;for(y=c.length;0<=--y;){e=y;f=y-1;0>f&&(f=c.length-1);
+for(var g=0,h=n+2*k,g=0;g<h;g++){var l=L*g,i=L*(g+1),j=d+e+l,l=d+f+l,m=d+f+i,i=d+e+i,q=c,r=g,o=h,j=j+C,l=l+C,m=m+C,i=i+C;B.faces.push(new THREE.Face4(j,l,m,i,null,null,u));j=N.generateSideWallUV(B,a,q,b,j,l,m,i,r,o);B.faceVertexUvs[0].push(j)}}}function e(a,b,c){B.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(c,d,e,f){c+=C;d+=C;e+=C;B.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?N.generateBottomUV(B,a,b,c,d,e):N.generateTopUV(B,a,b,c,d,e);B.faceVertexUvs[0].push(c)}var h=
+void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,k=void 0!==b.bevelSegments?b.bevelSegments:3,q=void 0!==b.bevelEnabled?b.bevelEnabled:!0,l=void 0!==b.curveSegments?b.curveSegments:12,n=void 0!==b.steps?b.steps:1,r=b.bendPath,m=b.extrudePath,o,p=!1,t=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,s=b.material,u=b.extrudeMaterial;if(m)o=m.getPoints(l),n=o.length,p=!0,q=!1;q||(j=i=k=0);var v,w,A,B=this,C=this.vertices.length;r&&a.addWrapPath(r);
+var r=t?a.extractAllSpacedPoints(l):a.extractAllPoints(l),l=r.shape,F=r.holes;if(r=!THREE.Shape.Utils.isClockWise(l)){l=l.reverse();for(w=0,A=F.length;w<A;w++)v=F[w],THREE.Shape.Utils.isClockWise(v)&&(F[w]=v.reverse());r=!1}var I=THREE.Shape.Utils.triangulateShape(l,F),J=l;for(w=0,A=F.length;w<A;w++)v=F[w],l=l.concat(v);var H,z,x,D,G,L=l.length,K,E=I.length,r=[],y=0;x=J.length;H=x-1;for(z=y+1;y<x;y++,H++,z++)H===x&&(H=0),z===x&&(z=0),r[y]=d(J[y],J[H],J[z]);var m=[],M,t=r.concat();for(w=0,A=F.length;w<
+A;w++){v=F[w];M=[];for(y=0,x=v.length,H=x-1,z=y+1;y<x;y++,H++,z++)H===x&&(H=0),z===x&&(z=0),M[y]=d(v[y],v[H],v[z]);m.push(M);t=t.concat(M)}for(H=0;H<k;H++){x=H/k;D=i*(1-x);z=j*Math.sin(x*Math.PI/2);for(y=0,x=J.length;y<x;y++)G=c(J[y],r[y],z),e(G.x,G.y,-D);for(w=0,A=F.length;w<A;w++){v=F[w];M=m[w];for(y=0,x=v.length;y<x;y++)G=c(v[y],M[y],z),e(G.x,G.y,-D)}}z=j;for(y=0;y<L;y++)G=q?c(l[y],t[y],z):l[y],p?e(G.x,G.y+o[0].y,o[0].x):e(G.x,G.y,0);for(x=1;x<=n;x++)for(y=0;y<L;y++)G=q?c(l[y],t[y],z):l[y],p?e(G.x,
+G.y+o[x-1].y,o[x-1].x):e(G.x,G.y,h/n*x);for(H=k-1;0<=H;H--){x=H/k;D=i*(1-x);z=j*Math.sin(x*Math.PI/2);for(y=0,x=J.length;y<x;y++)G=c(J[y],r[y],z),e(G.x,G.y,h+D);for(w=0,A=F.length;w<A;w++){v=F[w];M=m[w];for(y=0,x=v.length;y<x;y++)G=c(v[y],M[y],z),p?e(G.x,G.y+o[n-1].y,o[n-1].x+D):e(G.x,G.y,h+D)}}var N=THREE.ExtrudeGeometry.WorldUVGenerator;(function(){if(q){var a;a=0*L;for(y=0;y<E;y++)K=I[y],g(K[2]+a,K[1]+a,K[0]+a,!0);a=n+2*k;a*=L;for(y=0;y<E;y++)K=I[y],g(K[0]+a,K[1]+a,K[2]+a,!1)}else{for(y=0;y<E;y++)K=
+I[y],g(K[2],K[1],K[0],!0);for(y=0;y<E;y++)K=I[y],g(K[0]+L*n,K[1]+L*n,K[2]+L*n,!1)}})();(function(){var a=0;f(J,a);a+=J.length;for(w=0,A=F.length;w<A;w++)v=F[w],f(v,a),a+=v.length})()};
 THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,f,e){b=a.vertices[f].position.x;f=a.vertices[f].position.y;c=a.vertices[e].position.x;e=a.vertices[e].position.y;return[new THREE.UV(a.vertices[d].position.x,1-a.vertices[d].position.y),new THREE.UV(b,1-f),new THREE.UV(c,1-e)]},generateBottomUV:function(a,b,c,d,f,e){return this.generateTopUV(a,b,c,d,f,e)},generateSideWallUV:function(a,b,c,d,f,e,g,h){var b=a.vertices[f].position.x,c=a.vertices[f].position.y,f=a.vertices[f].position.z,
-d=a.vertices[e].position.x,j=a.vertices[e].position.y,e=a.vertices[e].position.z,k=a.vertices[g].position.x,i=a.vertices[g].position.y,g=a.vertices[g].position.z,o=a.vertices[h].position.x,l=a.vertices[h].position.y,a=a.vertices[h].position.z;return 0.01>Math.abs(c-j)?[new THREE.UV(b,f),new THREE.UV(d,e),new THREE.UV(k,g),new THREE.UV(o,a)]:[new THREE.UV(c,f),new THREE.UV(j,e),new THREE.UV(i,g),new THREE.UV(l,a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+d=a.vertices[e].position.x,i=a.vertices[e].position.y,e=a.vertices[e].position.z,j=a.vertices[g].position.x,k=a.vertices[g].position.y,g=a.vertices[g].position.z,q=a.vertices[h].position.x,l=a.vertices[h].position.y,a=a.vertices[h].position.z;return 0.01>Math.abs(c-i)?[new THREE.UV(b,f),new THREE.UV(d,e),new THREE.UV(j,g),new THREE.UV(q,a)]:[new THREE.UV(c,f),new THREE.UV(i,e),new THREE.UV(k,g),new THREE.UV(l,a)]}};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.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],f=[],e=[],g=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var j=0;j<=this.angle+0.0010;j+=b){for(h=0;h<c.length;h++)j<this.angle?(c[h]=g.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),f[h]=this.vertices.length-1):f=e;0==j&&(e=d);
-for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(f[h],f[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-j/this.angle,h/a.length),new THREE.UV(1-j/this.angle,(h+1)/a.length),new THREE.UV(1-(j-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(j-b)/this.angle,h/a.length)]);d=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
-THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var f=a/2,e=b/2,c=c||1,d=d||1,g=c+1,h=d+1,j=a/c,k=b/d,i=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*j-f,0,a*k-e)));for(a=0;a<d;a++)for(b=0;b<c;b++)f=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),f.normal.copy(i),f.vertexNormals.push(i.clone(),i.clone(),i.clone(),i.clone()),this.faces.push(f),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/c,(a+
+THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],f=[],e=[],g=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=g.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),f[h]=this.vertices.length-1):f=e;0==i&&(e=d);
+for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(f[h],f[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var f=a/2,e=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,j=b/d,k=new THREE.Vector3(0,1,0),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-f,0,a*j-e)));for(a=0;a<d;a++)for(b=0;b<c;b++)f=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),f.normal.copy(k),f.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(f),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,f,e,g){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,f=void 0!==f?f:2*Math.PI,e=void 0!==e?e:0,g=void 0!==g?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,j,k=[],i=[];for(j=0;j<=c;j++){var o=[],l=[];for(h=0;h<=b;h++){var n=h/b,p=j/c,m=-a*Math.cos(d+n*f)*Math.sin(e+p*g),r=a*Math.cos(e+p*g),q=a*Math.sin(d+n*f)*Math.sin(e+p*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,r,q)));o.push(this.vertices.length-1);l.push(new THREE.UV(n,
-p))}k.push(o);i.push(l)}for(j=0;j<c;j++)for(h=0;h<b;h++){var d=k[j][h+1],f=k[j][h],e=k[j+1][h],g=k[j+1][h+1],o=this.vertices[d].position.clone().normalize(),l=this.vertices[f].position.clone().normalize(),n=this.vertices[e].position.clone().normalize(),p=this.vertices[g].position.clone().normalize(),m=i[j][h+1].clone(),r=i[j][h].clone(),q=i[j+1][h].clone(),t=i[j+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,e,g,[o,n,p])),this.faceVertexUvs[0].push([m,
-q,t])):Math.abs(this.vertices[e].position.y)==a?(this.faces.push(new THREE.Face3(d,f,e,[o,l,n])),this.faceVertexUvs[0].push([m,r,q])):(this.faces.push(new THREE.Face4(d,f,e,g,[o,l,n,p])),this.faceVertexUvs[0].push([m,r,q,t]))}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,f,e,g){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,f=void 0!==f?f:2*Math.PI,e=void 0!==e?e:0,g=void 0!==g?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,j=[],k=[];for(i=0;i<=c;i++){var q=[],l=[];for(h=0;h<=b;h++){var n=h/b,r=i/c,m=-a*Math.cos(d+n*f)*Math.sin(e+r*g),o=a*Math.cos(e+r*g),p=a*Math.sin(d+n*f)*Math.sin(e+r*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,o,p)));q.push(this.vertices.length-1);l.push(new THREE.UV(n,
+r))}j.push(q);k.push(l)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],f=j[i][h],e=j[i+1][h],g=j[i+1][h+1],q=this.vertices[d].position.clone().normalize(),l=this.vertices[f].position.clone().normalize(),n=this.vertices[e].position.clone().normalize(),r=this.vertices[g].position.clone().normalize(),m=k[i][h+1].clone(),o=k[i][h].clone(),p=k[i+1][h].clone(),t=k[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,e,g,[q,n,r])),this.faceVertexUvs[0].push([m,
+p,t])):Math.abs(this.vertices[e].position.y)==a?(this.faces.push(new THREE.Face3(d,f,e,[q,l,n])),this.faceVertexUvs[0].push([m,o,p])):(this.faces.push(new THREE.Face4(d,f,e,g,[q,l,n,r])),this.faceVertexUvs[0].push([m,o,p,t]))}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=void 0!==b.height?b.height:50;if(void 0===b.bevelThickness)b.bevelThickness=10;if(void 0===b.bevelSize)b.bevelSize=8;if(void 0===b.bevelEnabled)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,f=(""+a).split(""),e=f.length,g=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(f[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,f){var e=[],g,h,j,k,i,o,l,n,p,m,r,q=b.glyphs[a]||b.glyphs["?"];if(q){if(q.o){b=q._cachedOutline||(q._cachedOutline=q.o.split(" "));k=b.length;for(a=0;a<k;)switch(j=b[a++],j){case "m":j=b[a++]*c+d;i=b[a++]*c;e.push(new THREE.Vector2(j,i));f.moveTo(j,i);break;case "l":j=b[a++]*c+d;i=b[a++]*c;e.push(new THREE.Vector2(j,
-i));f.lineTo(j,i);break;case "q":j=b[a++]*c+d;i=b[a++]*c;n=b[a++]*c+d;p=b[a++]*c;f.quadraticCurveTo(n,p,j,i);if(g=e[e.length-1]){o=g.x;l=g.y;for(g=1,h=this.divisions;g<=h;g++){var t=g/h,s=THREE.Shape.Utils.b2(t,o,n,j),t=THREE.Shape.Utils.b2(t,l,p,i);e.push(new THREE.Vector2(s,t))}}break;case "b":if(j=b[a++]*c+d,i=b[a++]*c,n=b[a++]*c+d,p=b[a++]*-c,m=b[a++]*c+d,r=b[a++]*-c,f.bezierCurveTo(j,i,n,p,m,r),g=e[e.length-1]){o=g.x;l=g.y;for(g=1,h=this.divisions;g<=h;g++)t=g/h,s=THREE.Shape.Utils.b3(t,o,n,
-m,j),t=THREE.Shape.Utils.b3(t,l,p,r,i),e.push(new THREE.Vector2(s,t))}}}return{offset:q.ha*c,points:e,path:f}}}};
-(function(a){var b=function(a){for(var b=a.length,f=0,e=b-1,g=0;g<b;e=g++)f+=a[e].x*a[g].y-a[g].x*a[e].y;return 0.5*f};a.Triangulate=function(a,d){var f=a.length;if(3>f)return null;var e=[],g=[],h=[],j,k,i;if(0<b(a))for(k=0;k<f;k++)g[k]=k;else for(k=0;k<f;k++)g[k]=f-1-k;var o=2*f;for(k=f-1;2<f;){if(0>=o--){console.log("Warning, unable to triangulate polygon!");break}j=k;f<=j&&(j=0);k=j+1;f<=k&&(k=0);i=k+1;f<=i&&(i=0);var l;a:{l=a;var n=j,p=k,m=i,r=f,q=g,t=void 0,s=void 0,u=void 0,v=void 0,w=void 0,
-z=void 0,y=void 0,A=void 0,D=void 0,s=l[q[n]].x,u=l[q[n]].y,v=l[q[p]].x,w=l[q[p]].y,z=l[q[m]].x,y=l[q[m]].y;if(1.0E-10>(v-s)*(y-u)-(w-u)*(z-s))l=!1;else{for(t=0;t<r;t++)if(!(t==n||t==p||t==m)){var A=l[q[t]].x,D=l[q[t]].y,I=void 0,J=void 0,H=void 0,C=void 0,x=void 0,E=void 0,G=void 0,L=void 0,K=void 0,F=void 0,B=void 0,M=void 0,I=H=x=void 0,I=z-v,J=y-w,H=s-z,C=u-y,x=v-s,E=w-u,G=A-s,L=D-u,K=A-v,F=D-w,B=A-z,M=D-y,I=I*F-J*K,x=x*L-E*G,H=H*M-C*B;if(0<=I&&0<=H&&0<=x){l=!1;break a}}l=!0}}if(l){e.push([a[g[j]],
-a[g[k]],a[g[i]]]);h.push([g[j],g[k],g[i]]);for(j=k,i=k+1;i<f;j++,i++)g[j]=g[i];f--;o=2*f}}return d?h:e};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+0,f=(""+a).split(""),e=f.length,g=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(f[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,f){var e=[],g,h,i,j,k,q,l,n,r,m,o,p=b.glyphs[a]||b.glyphs["?"];if(p){if(p.o){b=p._cachedOutline||(p._cachedOutline=p.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;e.push(new THREE.Vector2(i,k));f.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;e.push(new THREE.Vector2(i,
+k));f.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;n=b[a++]*c+d;r=b[a++]*c;f.quadraticCurveTo(n,r,i,k);if(g=e[e.length-1]){q=g.x;l=g.y;for(g=1,h=this.divisions;g<=h;g++){var t=g/h,s=THREE.Shape.Utils.b2(t,q,n,i),t=THREE.Shape.Utils.b2(t,l,r,k);e.push(new THREE.Vector2(s,t))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,n=b[a++]*c+d,r=b[a++]*-c,m=b[a++]*c+d,o=b[a++]*-c,f.bezierCurveTo(i,k,n,r,m,o),g=e[e.length-1]){q=g.x;l=g.y;for(g=1,h=this.divisions;g<=h;g++)t=g/h,s=THREE.Shape.Utils.b3(t,q,n,
+m,i),t=THREE.Shape.Utils.b3(t,l,r,o,k),e.push(new THREE.Vector2(s,t))}}}return{offset:p.ha*c,points:e,path:f}}}};
+(function(a){var b=function(a){for(var b=a.length,f=0,e=b-1,g=0;g<b;e=g++)f+=a[e].x*a[g].y-a[g].x*a[e].y;return 0.5*f};a.Triangulate=function(a,d){var f=a.length;if(3>f)return null;var e=[],g=[],h=[],i,j,k;if(0<b(a))for(j=0;j<f;j++)g[j]=j;else for(j=0;j<f;j++)g[j]=f-1-j;var q=2*f;for(j=f-1;2<f;){if(0>=q--){console.log("Warning, unable to triangulate polygon!");break}i=j;f<=i&&(i=0);j=i+1;f<=j&&(j=0);k=j+1;f<=k&&(k=0);var l;a:{l=a;var n=i,r=j,m=k,o=f,p=g,t=void 0,s=void 0,u=void 0,v=void 0,w=void 0,
+A=void 0,B=void 0,C=void 0,F=void 0,s=l[p[n]].x,u=l[p[n]].y,v=l[p[r]].x,w=l[p[r]].y,A=l[p[m]].x,B=l[p[m]].y;if(1.0E-10>(v-s)*(B-u)-(w-u)*(A-s))l=!1;else{for(t=0;t<o;t++)if(!(t==n||t==r||t==m)){var C=l[p[t]].x,F=l[p[t]].y,I=void 0,J=void 0,H=void 0,z=void 0,x=void 0,D=void 0,G=void 0,L=void 0,K=void 0,E=void 0,y=void 0,M=void 0,I=H=x=void 0,I=A-v,J=B-w,H=s-A,z=u-B,x=v-s,D=w-u,G=C-s,L=F-u,K=C-v,E=F-w,y=C-A,M=F-B,I=I*E-J*K,x=x*L-D*G,H=H*M-z*y;if(0<=I&&0<=H&&0<=x){l=!1;break a}}l=!0}}if(l){e.push([a[g[i]],
+a[g[j]],a[g[k]]]);h.push([g[i],g[j],g[k]]);for(i=j,k=j+1;k<f;i++,k++)g[i]=g[k];f--;q=2*f}}return d?h:e};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,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=f||2*Math.PI;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var e=d/this.segmentsT*this.arc,g=2*c/this.segmentsR*Math.PI;f.x=this.radius*Math.cos(e);f.y=this.radius*Math.sin(e);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(e);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(e);h.z=
-this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var f=(this.segmentsT+1)*c+d-1,e=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,j=new THREE.Face4(f,e,g,h,[b[f],b[e],b[g],b[h]]);j.normal.addSelf(b[f]);j.normal.addSelf(b[e]);j.normal.addSelf(b[g]);j.normal.addSelf(b[h]);j.normal.normalize();this.faces.push(j);
+this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var f=(this.segmentsT+1)*c+d-1,e=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(f,e,g,h,[b[f],b[e],b[g],b[h]]);i.normal.addSelf(b[f]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[f].clone(),a[e].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(a,b,c,d,f,e,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*e*(2+c);b=0.5*e*(2+c)*b;e=0.5*f*e*Math.sin(a);return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=f||2;this.q=e||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
-Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var j=2*(a/this.segmentsR)*this.p*Math.PI,g=2*(b/this.segmentsT)*Math.PI,e=h(j,g,this.q,this.p,this.radius,this.heightScale),j=h(j+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(j,e);d.add(j,e);f.cross(c,d);d.cross(f,c);f.normalize();d.normalize();j=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);e.x+=j*d.x+g*f.x;e.y+=j*d.y+g*f.y;e.z+=j*d.z+g*f.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 f=(a+1)%this.segmentsR,e=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][e],e=this.grid[a][e],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),i=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,f,e));this.faceVertexUvs[0].push([g,j,k,i])}this.computeCentroids();this.computeFaceNormals();
+Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=2*(a/this.segmentsR)*this.p*Math.PI,g=2*(b/this.segmentsT)*Math.PI,e=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(i,e);d.add(i,e);f.cross(c,d);d.cross(f,c);f.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);e.x+=i*d.x+g*f.x;e.y+=i*d.y+g*f.y;e.z+=i*d.z+g*f.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 f=(a+1)%this.segmentsR,e=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][e],e=this.grid[a][e],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,f,e));this.faceVertexUvs[0].push([g,i,j,k])}this.computeCentroids();this.computeFaceNormals();
 this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
-THREE.TubeGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=f||!1;if(e)this.debug=new THREE.Object3D;this.grid=[];var b=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,b=new THREE.Vector3,h=new THREE.Matrix4,d=[],e=[],j=[],k=this.segments+1,i,o,l,n;this.tangents=d;this.normals=e;this.binormals=j;for(a=0;a<k;a++)i=a/(k-1),d[a]=this.path.getTangentAt(i),d[a].normalize();e[0]=new THREE.Vector3;j[0]=
-new THREE.Vector3;a=Number.MAX_VALUE;i=Math.abs(d[0].x);o=Math.abs(d[0].y);l=Math.abs(d[0].z);i<=a&&(a=i,g.set(1,0,0));o<=a&&(a=o,g.set(0,1,0));l<=a&&g.set(0,0,1);b.cross(d[0],g).normalize();e[0].cross(d[0],b);j[0].cross(d[0],e[0]);for(a=1;a<k;a++)e[a]=e[a-1].clone(),j[a]=j[a-1].clone(),b.cross(d[a-1],d[a]),1.0E-4<b.length()&&(b.normalize(),g=Math.acos(d[a-1].dot(d[a])),h.setRotationAxis(b,g).multiplyVector3(e[a])),j[a].cross(d[a],e[a]);if(this.closed){g=Math.acos(e[0].dot(e[k-1]));g/=k-1;0<d[0].dot(b.cross(e[0],
-e[k-1]))&&(g=-g);for(a=1;a<k;a++)h.setRotationAxis(d[a],g*a).multiplyVector3(e[a]),j[a].cross(d[a],e[a])}for(a=0;a<k;a++){this.grid[a]=[];i=a/(k-1);i=this.path.getPointAt(i);b=d[a];g=e[a];h=j[a];this.debug&&(this.debug.add(new THREE.ArrowHelper(b,i,c,255)),this.debug.add(new THREE.ArrowHelper(g,i,c,16711680)),this.debug.add(new THREE.ArrowHelper(h,i,c,65280)));for(b=0;b<this.segmentsRadius;b++)l=2*(b/this.segmentsRadius)*Math.PI,o=-this.radius*Math.cos(l),l=this.radius*Math.sin(l),n=(new THREE.Vector3).copy(i),
-n.x+=o*g.x+l*h.x,n.y+=o*g.y+l*h.y,n.z+=o*g.z+l*h.z,this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n.x,n.y,n.z)))-1}for(a=0;a<this.segments;a++)for(b=0;b<this.segmentsRadius;b++)e=f?(a+1)%this.segments:a+1,j=(b+1)%this.segmentsRadius,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][j],j=this.grid[a][j],k=new THREE.UV(a/this.segments,b/this.segmentsRadius),g=new THREE.UV((a+1)/this.segments,b/this.segmentsRadius),h=new THREE.UV((a+1)/this.segments,(b+1)/this.segmentsRadius),
-i=new THREE.UV(a/this.segments,(b+1)/this.segmentsRadius),this.faces.push(new THREE.Face4(c,d,e,j)),this.faceVertexUvs[0].push([k,g,h,i]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
-THREE.PolyhedronGeometry=function(a,b,c,d){function f(a){var b=new THREE.Vertex(a.normalize());b.index=j.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function e(a,b,c,d){1>d?(d=new THREE.Face3(a.index,b.index,c.index,[a.position.clone(),b.position.clone(),c.position.clone()]),d.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),d.normal=d.centroid.clone().normalize(),
-j.faces.push(d),d=Math.atan2(d.centroid.z,-d.centroid.x),j.faceVertexUvs[0].push([h(a.uv,a.position,d),h(b.uv,b.position,d),h(c.uv,c.position,d)])):(d-=1,e(a,g(a,b),g(a,c),d),e(g(a,b),b,g(b,c),d),e(g(a,c),g(b,c),c,d),e(g(a,b),g(b,c),g(a,c),d))}function g(a,b){o[a.index]||(o[a.index]=[]);o[b.index]||(o[b.index]=[]);var c=o[a.index][b.index];void 0===c&&(o[a.index][b.index]=o[b.index][a.index]=c=f((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return c}function h(a,b,c){0>c&&1===a.u&&
-(a=new THREE.UV(a.u-1,a.v));0===b.x&&0===b.z&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,j=this,k=0,i=a.length;k<i;k++)f(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));for(var o=[],a=this.vertices,k=0,i=b.length;k<i;k++)e(a[b[k][0]],a[b[k][1]],a[b[k][2]],d);this.mergeVertices();k=0;for(i=this.vertices.length;k<i;k++)this.vertices[k].position.multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};
+THREE.TubeGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=f||!1;if(e)this.debug=new THREE.Object3D;this.grid=[];var b=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,b=new THREE.Vector3,h=new THREE.Matrix4,d=[],e=[],i=[],j=this.segments+1,k,q,l,n;this.tangents=d;this.normals=e;this.binormals=i;for(a=0;a<j;a++)k=a/(j-1),d[a]=this.path.getTangentAt(k),d[a].normalize();e[0]=new THREE.Vector3;i[0]=
+new THREE.Vector3;a=Number.MAX_VALUE;k=Math.abs(d[0].x);q=Math.abs(d[0].y);l=Math.abs(d[0].z);k<=a&&(a=k,g.set(1,0,0));q<=a&&(a=q,g.set(0,1,0));l<=a&&g.set(0,0,1);b.cross(d[0],g).normalize();e[0].cross(d[0],b);i[0].cross(d[0],e[0]);for(a=1;a<j;a++)e[a]=e[a-1].clone(),i[a]=i[a-1].clone(),b.cross(d[a-1],d[a]),1.0E-4<b.length()&&(b.normalize(),g=Math.acos(d[a-1].dot(d[a])),h.setRotationAxis(b,g).multiplyVector3(e[a])),i[a].cross(d[a],e[a]);if(this.closed){g=Math.acos(e[0].dot(e[j-1]));g/=j-1;0<d[0].dot(b.cross(e[0],
+e[j-1]))&&(g=-g);for(a=1;a<j;a++)h.setRotationAxis(d[a],g*a).multiplyVector3(e[a]),i[a].cross(d[a],e[a])}for(a=0;a<j;a++){this.grid[a]=[];k=a/(j-1);k=this.path.getPointAt(k);b=d[a];g=e[a];h=i[a];this.debug&&(this.debug.add(new THREE.ArrowHelper(b,k,c,255)),this.debug.add(new THREE.ArrowHelper(g,k,c,16711680)),this.debug.add(new THREE.ArrowHelper(h,k,c,65280)));for(b=0;b<this.segmentsRadius;b++)l=2*(b/this.segmentsRadius)*Math.PI,q=-this.radius*Math.cos(l),l=this.radius*Math.sin(l),n=(new THREE.Vector3).copy(k),
+n.x+=q*g.x+l*h.x,n.y+=q*g.y+l*h.y,n.z+=q*g.z+l*h.z,this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n.x,n.y,n.z)))-1}for(a=0;a<this.segments;a++)for(b=0;b<this.segmentsRadius;b++)e=f?(a+1)%this.segments:a+1,i=(b+1)%this.segmentsRadius,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][i],i=this.grid[a][i],j=new THREE.UV(a/this.segments,b/this.segmentsRadius),g=new THREE.UV((a+1)/this.segments,b/this.segmentsRadius),h=new THREE.UV((a+1)/this.segments,(b+1)/this.segmentsRadius),
+k=new THREE.UV(a/this.segments,(b+1)/this.segmentsRadius),this.faces.push(new THREE.Face4(c,d,e,i)),this.faceVertexUvs[0].push([j,g,h,k]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=new THREE.Geometry;THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;
+THREE.PolyhedronGeometry=function(a,b,c,d){function f(a){var b=new THREE.Vertex(a.normalize());b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function e(a,b,c,d){1>d?(d=new THREE.Face3(a.index,b.index,c.index,[a.position.clone(),b.position.clone(),c.position.clone()]),d.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),d.normal=d.centroid.clone().normalize(),
+i.faces.push(d),d=Math.atan2(d.centroid.z,-d.centroid.x),i.faceVertexUvs[0].push([h(a.uv,a.position,d),h(b.uv,b.position,d),h(c.uv,c.position,d)])):(d-=1,e(a,g(a,b),g(a,c),d),e(g(a,b),b,g(b,c),d),e(g(a,c),g(b,c),c,d),e(g(a,b),g(b,c),g(a,c),d))}function g(a,b){q[a.index]||(q[a.index]=[]);q[b.index]||(q[b.index]=[]);var c=q[a.index][b.index];void 0===c&&(q[a.index][b.index]=q[b.index][a.index]=c=f((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return c}function h(a,b,c){0>c&&1===a.u&&
+(a=new THREE.UV(a.u-1,a.v));0===b.x&&0===b.z&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,i=this,j=0,k=a.length;j<k;j++)f(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var q=[],a=this.vertices,j=0,k=b.length;j<k;j++)e(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(k=this.vertices.length;j<k;j++)this.vertices[j].position.multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};
 THREE.PolyhedronGeometry.prototype=new THREE.Geometry;THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
 THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};
@@ -236,215 +236,179 @@ this.camera=a;this.update(a);this.lines=new THREE.Line(this.lineGeometry,this.li
 THREE.CameraHelper.prototype.update=function(){function a(a,d,f,e){THREE.CameraHelper.__v.set(d,f,e);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(void 0!==a){d=0;for(f=a.length;d<f;d++)b.lineGeometry.vertices[a[d]].position.copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",
 -1,-1,1);a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=!0};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 THREE.SubdivisionModifier=function(a){this.subdivisions=void 0===a?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;0<b--;)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(g.useOldVertexColors){j.vertexColors=[];for(var k,m,o,n=0;4>n;n++){o=i[n];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<o.length;p++)m=h.vertexColors[o[p]-1],k.r+=m.r,k.g+=m.g,k.b+=m.b;k.r/=o.length;k.g/=o.length;k.b/=o.length;j.vertexColors[n]=k}}f.push(j);(!g.supportUVs||0!=l.length)&&e.push([l[a],l[b],l[c],l[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],f=[],e=[],g=this,h=a.vertices,d=a.faces,j=h.concat(),k=[],i={},o={},l=[],n,p,m,r,q,t=a.faceVertexUvs[0];for(n=0,p=t.length;n<p;n++)for(m=0,r=t[n].length;m<r;m++)q=d[n]["abcd".charAt(m)],l[q]||(l[q]=t[n][m]);var s;for(n=0,p=d.length;n<p;n++)if(q=d[n],k.push(q.centroid),j.push(new THREE.Vertex(q.centroid)),g.supportUVs&&0!=l.length){s=new THREE.UV;if(q instanceof THREE.Face3)s.u=l[q.a].u+l[q.b].u+l[q.c].u,s.v=l[q.a].v+l[q.b].v+l[q.c].v,s.u/=3,s.v/=3;else if(q instanceof THREE.Face4)s.u=
-l[q.a].u+l[q.b].u+l[q.c].u+l[q.d].u,s.v=l[q.a].v+l[q.b].v+l[q.c].v+l[q.d].v,s.u/=4,s.v/=4;l.push(s)}p=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,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 u=0,t=h.length,v,w,z={},y={},A=function(a,
-b){void 0===z[a]&&(z[a]=[]);z[a].push(b)},D=function(a,b){void 0===y[a]&&(y[a]={});y[a][b]=null};for(n in p){s=p[n];v=n.split("_");w=v[0];v=v[1];A(w,[w,v]);A(v,[w,v]);for(m=0,r=s.length;m<r;m++)q=s[m],D(w,q,n),D(v,q,n);2>s.length&&(o[n]=!0)}for(n in p)if(s=p[n],q=s[0],s=s[1],v=n.split("_"),w=v[0],v=v[1],r=new THREE.Vector3,o[n]?(r.addSelf(h[w].position),r.addSelf(h[v].position),r.multiplyScalar(0.5)):(r.addSelf(k[q]),r.addSelf(k[s]),r.addSelf(h[w].position),r.addSelf(h[v].position),r.multiplyScalar(0.25)),
-i[n]=t+d.length+u,j.push(new THREE.Vertex(r)),u++,g.supportUVs&&0!=l.length)s=new THREE.UV,s.u=l[w].u+l[v].u,s.v=l[w].v+l[v].v,s.u/=2,s.v/=2,l.push(s);var I,J;v=["123","12","2","23"];r=["123","23","3","31"];var A=["123","31","1","12"],D=["1234","12","2","23"],H=["1234","23","3","34"],C=["1234","34","4","41"],x=["1234","41","1","12"];for(n=0,p=k.length;n<p;n++)q=d[n],s=t+n,q instanceof THREE.Face3?(u=c(q.a,q.b),w=c(q.b,q.c),I=c(q.c,q.a),b(s,i[u],q.b,i[w],q,v),b(s,i[w],q.c,i[I],q,r),b(s,i[I],q.a,i[u],
-q,A)):q instanceof THREE.Face4?(u=c(q.a,q.b),w=c(q.b,q.c),I=c(q.c,q.d),J=c(q.d,q.a),b(s,i[u],q.b,i[w],q,D),b(s,i[w],q.c,i[I],q,H),b(s,i[I],q.d,i[J],q,C),b(s,i[J],q.a,i[u],q,x)):console.log("face should be a face!",q);d=j;j=new THREE.Vector3;i=new THREE.Vector3;for(n=0,p=h.length;n<p;n++)if(void 0!==z[n]){j.set(0,0,0);i.set(0,0,0);q=new THREE.Vector3(0,0,0);s=0;for(m in y[n])j.addSelf(k[m]),s++;u=0;t=z[n].length;for(m=0;m<t;m++)o[c(z[n][m][0],z[n][m][1])]&&u++;if(2!=u){j.divideScalar(s);for(m=0;m<
-t;m++)s=z[n][m],s=h[s[0]].position.clone().addSelf(h[s[1]].position).divideScalar(2),i.addSelf(s);i.divideScalar(t);q.addSelf(h[n].position);q.multiplyScalar(t-3);q.addSelf(j);q.addSelf(i.multiplyScalar(2));q.divideScalar(t);d[n].position=q}}a.vertices=d;a.faces=f;a.faceVertexUvs[0]=e;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(g.useOldVertexColors){k.vertexColors=[];for(var j,m,n,q=0;4>q;q++){n=i[q];j=new THREE.Color;j.setRGB(0,0,0);for(var o=0;o<n.length;o++)m=h.vertexColors[n[o]-1],j.r+=m.r,j.g+=m.g,j.b+=m.b;j.r/=n.length;j.g/=n.length;j.b/=n.length;k.vertexColors[q]=j}}f.push(k);(!g.supportUVs||0!=l.length)&&e.push([l[a],l[b],l[c],l[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],f=[],e=[],g=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},q={},l=[],n,r,m,o,p,t=a.faceVertexUvs[0];for(n=0,r=t.length;n<r;n++)for(m=0,o=t[n].length;m<o;m++)p=d[n]["abcd".charAt(m)],l[p]||(l[p]=t[n][m]);var s;for(n=0,r=d.length;n<r;n++)if(p=d[n],j.push(p.centroid),i.push(new THREE.Vertex(p.centroid)),g.supportUVs&&0!=l.length){s=new THREE.UV;if(p instanceof THREE.Face3)s.u=l[p.a].u+l[p.b].u+l[p.c].u,s.v=l[p.a].v+l[p.b].v+l[p.c].v,s.u/=3,s.v/=3;else if(p instanceof THREE.Face4)s.u=
+l[p.a].u+l[p.b].u+l[p.c].u+l[p.d].u,s.v=l[p.a].v+l[p.b].v+l[p.c].v+l[p.d].v,s.u/=4,s.v/=4;l.push(s)}r=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,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 u=0,t=h.length,v,w,A={},B={},C=function(a,
+b){void 0===A[a]&&(A[a]=[]);A[a].push(b)},F=function(a,b){void 0===B[a]&&(B[a]={});B[a][b]=null};for(n in r){s=r[n];v=n.split("_");w=v[0];v=v[1];C(w,[w,v]);C(v,[w,v]);for(m=0,o=s.length;m<o;m++)p=s[m],F(w,p,n),F(v,p,n);2>s.length&&(q[n]=!0)}for(n in r)if(s=r[n],p=s[0],s=s[1],v=n.split("_"),w=v[0],v=v[1],o=new THREE.Vector3,q[n]?(o.addSelf(h[w].position),o.addSelf(h[v].position),o.multiplyScalar(0.5)):(o.addSelf(j[p]),o.addSelf(j[s]),o.addSelf(h[w].position),o.addSelf(h[v].position),o.multiplyScalar(0.25)),
+k[n]=t+d.length+u,i.push(new THREE.Vertex(o)),u++,g.supportUVs&&0!=l.length)s=new THREE.UV,s.u=l[w].u+l[v].u,s.v=l[w].v+l[v].v,s.u/=2,s.v/=2,l.push(s);var I,J;v=["123","12","2","23"];o=["123","23","3","31"];var C=["123","31","1","12"],F=["1234","12","2","23"],H=["1234","23","3","34"],z=["1234","34","4","41"],x=["1234","41","1","12"];for(n=0,r=j.length;n<r;n++)p=d[n],s=t+n,p instanceof THREE.Face3?(u=c(p.a,p.b),w=c(p.b,p.c),I=c(p.c,p.a),b(s,k[u],p.b,k[w],p,v),b(s,k[w],p.c,k[I],p,o),b(s,k[I],p.a,k[u],
+p,C)):p instanceof THREE.Face4?(u=c(p.a,p.b),w=c(p.b,p.c),I=c(p.c,p.d),J=c(p.d,p.a),b(s,k[u],p.b,k[w],p,F),b(s,k[w],p.c,k[I],p,H),b(s,k[I],p.d,k[J],p,z),b(s,k[J],p.a,k[u],p,x)):console.log("face should be a face!",p);d=i;i=new THREE.Vector3;k=new THREE.Vector3;for(n=0,r=h.length;n<r;n++)if(void 0!==A[n]){i.set(0,0,0);k.set(0,0,0);p=new THREE.Vector3(0,0,0);s=0;for(m in B[n])i.addSelf(j[m]),s++;u=0;t=A[n].length;for(m=0;m<t;m++)q[c(A[n][m][0],A[n][m][1])]&&u++;if(2!=u){i.divideScalar(s);for(m=0;m<
+t;m++)s=A[n][m],s=h[s[0]].position.clone().addSelf(h[s[1]].position).divideScalar(2),k.addSelf(s);k.divideScalar(t);p.addSelf(h[n].position);p.multiplyScalar(t-3);p.addSelf(i);p.addSelf(k.multiplyScalar(2));p.divideScalar(t);d[n].position=p}}a.vertices=d;a.faces=f;a.faceVertexUvs[0]=e;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
 THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",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?b+((100*a.loaded/
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=
 Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function f(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=!0};e.crossOrigin=h.crossOrigin;e.src=b}function e(a,c,d,e,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=d;
-if(e){a[c].repeat.set(e[0],e[1]);if(1!=e[0])a[c].wrapS=THREE.RepeatWrapping;if(1!=e[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(void 0!==e[h[0]])a[c].wrapS=e[h[0]];if(void 0!==e[h[1]])a[c].wrapT=e[h[1]]}f(a[c],b+"/"+d)}function g(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,j="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};if(a.shading){var i=
-a.shading.toLowerCase();"phong"===i?j="MeshPhongMaterial":"basic"===i&&(j="MeshBasicMaterial")}if(void 0!==a.blending&&void 0!==THREE[a.blending])k.blending=THREE[a.blending];if(void 0!==a.transparent||1>a.opacity)k.transparent=a.transparent;if(void 0!==a.depthTest)k.depthTest=a.depthTest;if(void 0!==a.depthWrite)k.depthWrite=a.depthWrite;if(void 0!==a.vertexColors)if("face"==a.vertexColors)k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=THREE.VertexColors;if(a.colorDiffuse)k.color=
-g(a.colorDiffuse);else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=g(a.colorSpecular);if(a.colorAmbient)k.ambient=g(a.colorAmbient);if(a.transparency)k.opacity=a.transparency;if(a.specularCoef)k.shininess=a.specularCoef;a.mapDiffuse&&b&&e(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(k,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,
-a.mapNormalWrap);a.mapSpecular&&b&&e(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){j=THREE.ShaderUtils.lib.normal;i=THREE.UniformsUtils.clone(j.uniforms);i.tNormal.texture=k.normalMap;if(a.mapNormalFactor)i.uNormalScale.value=a.mapNormalFactor;if(k.map)i.tDiffuse.texture=k.map,i.enableDiffuse.value=!0;if(k.specularMap)i.tSpecular.texture=k.specularMap,i.enableSpecular.value=!0;if(k.lightMap)i.tAO.texture=k.lightMap,i.enableAO.value=!0;i.uDiffuseColor.value.setHex(k.color);
-i.uSpecularColor.value.setHex(k.specular);i.uAmbientColor.value.setHex(k.ambient);i.uShininess.value=k.shininess;if(void 0!==k.opacity)i.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:i,lights:!0,fog:!0})}else k=new THREE[j](k);if(void 0!==a.DbgName)k.name=a.DbgName;return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+if(e){a[c].repeat.set(e[0],e[1]);if(1!=e[0])a[c].wrapS=THREE.RepeatWrapping;if(1!=e[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(void 0!==e[h[0]])a[c].wrapS=e[h[0]];if(void 0!==e[h[1]])a[c].wrapT=e[h[1]]}f(a[c],b+"/"+d)}function g(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,i="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};if(a.shading){var k=
+a.shading.toLowerCase();"phong"===k?i="MeshPhongMaterial":"basic"===k&&(i="MeshBasicMaterial")}if(void 0!==a.blending&&void 0!==THREE[a.blending])j.blending=THREE[a.blending];if(void 0!==a.transparent||1>a.opacity)j.transparent=a.transparent;if(void 0!==a.depthTest)j.depthTest=a.depthTest;if(void 0!==a.depthWrite)j.depthWrite=a.depthWrite;if(void 0!==a.vertexColors)if("face"==a.vertexColors)j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=THREE.VertexColors;if(a.colorDiffuse)j.color=
+g(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=g(a.colorSpecular);if(a.colorAmbient)j.ambient=g(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&e(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(j,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,
+a.mapNormalWrap);a.mapSpecular&&b&&e(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){i=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(i.uniforms);k.tNormal.texture=j.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(j.map)k.tDiffuse.texture=j.map,k.enableDiffuse.value=!0;if(j.specularMap)k.tSpecular.texture=j.specularMap,k.enableSpecular.value=!0;if(j.lightMap)k.tAO.texture=j.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(j.color);
+k.uSpecularColor.value.setHex(j.specular);k.uAmbientColor.value.setHex(j.ambient);k.uShininess.value=j.shininess;if(void 0!==j.opacity)k.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:k,lights:!0,fog:!0})}else j=new THREE[i](j);if(void 0!==a.DbgName)j.name=a.DbgName;return j}};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){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),f=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,f)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,f,e){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(4==g.readyState)if(200==g.status||0==g.status){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,f,d,e)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,!0);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,f){var e=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;e.onreadystatechange=function(){4==e.readyState?200==e.status||0==e.status?THREE.BinaryLoader.prototype.createBinModel(e.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+e.status+"]"):3==e.readyState?f&&(0==h&&(h=e.getResponseHeader("Content-Length")),f({total:h,loaded:e.responseText.length})):2==e.readyState&&(h=e.getResponseHeader("Content-Length"))};
 e.open("GET",g,!0);e.responseType="arraybuffer";e.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,j,k,i,o,l,n,p,m,r,q,t,s,u;function v(a){return a%4?4-a%4:0}function w(a,b){return(new Uint8Array(a,b,1))[0]}function z(a,b){return(new Uint32Array(a,b,1))[0]}function y(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[3*d];f=l[3*d+1];g=l[3*d+2];h=G[2*e];e=G[2*e+1];i=G[2*f];j=G[2*f+1];f=G[2*g];k=G[2*g+1];g=C.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,j));m.push(new THREE.UV(f,
-k));g.push(m)}}function A(b,c){var d,e,f,g,h,i,j,k,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[4*d];f=n[4*d+1];g=n[4*d+2];h=n[4*d+3];i=G[2*e];e=G[2*e+1];j=G[2*f];l=G[2*f+1];k=G[2*g];m=G[2*g+1];g=G[2*h];f=G[2*h+1];h=C.faceVertexUvs[0];var o=[];o.push(new THREE.UV(i,e));o.push(new THREE.UV(j,l));o.push(new THREE.UV(k,m));o.push(new THREE.UV(g,f));h.push(o)}}function D(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[3*d],f=c[3*d+1],g=c[3*d+2],h=i[d],
-C.faces.push(new THREE.Face3(e,f,g,null,null,h))}function I(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[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],C.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function J(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];k=d[3*e+1];l=d[3*e+2];i=m[e];var n=E[3*k],o=E[3*k+1];k=E[3*k+2];var q=E[3*l],p=
-E[3*l+1];l=E[3*l+2];C.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(E[3*j],E[3*j+1],E[3*j+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(q,p,l)],null,i))}}function H(b,c,d,e){for(var f,g,h,i,j,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];k=d[4*e];l=d[4*e+1];m=d[4*e+2];n=d[4*e+3];j=o[e];var q=E[3*l],p=E[3*l+1];l=E[3*l+2];var r=E[3*m],s=E[3*m+1];m=E[3*m+2];var t=E[3*n],u=E[3*n+1];n=E[3*n+2];C.faces.push(new THREE.Face4(f,
-g,h,i,[new THREE.Vector3(E[3*k],E[3*k+1],E[3*k+2]),new THREE.Vector3(q,p,l),new THREE.Vector3(r,s,m),new THREE.Vector3(t,u,n)],null,j))}}var C=this,x=0,E=[],G=[],L,K,F;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(C,d,b);(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,x,12);c=w(a,x+12);w(a,x+13);w(a,x+14);w(a,x+15);f=w(a,x+16);j=w(a,x+17);k=w(a,x+18);i=w(a,x+19);o=z(a,x+20);l=z(a,x+20+4);n=z(a,x+20+8);b=z(a,x+20+12);p=
-z(a,x+20+16);m=z(a,x+20+20);r=z(a,x+20+24);q=z(a,x+20+28);t=z(a,x+20+32);s=z(a,x+20+36);u=z(a,x+20+40);x+=c;c=3*f+i;F=4*f+i;L=b*c;K=p*(c+3*j);f=m*(c+3*k);i=r*(c+3*j+3*k);c=q*F;j=t*(F+4*j);k=s*(F+4*k);x+=function(b){var b=new Float32Array(a,b,3*o),c,d,e,f;for(c=0;c<o;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],C.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*o*Float32Array.BYTES_PER_ELEMENT}(x);x+=function(b){if(l){var b=new Int8Array(a,b,3*l),c,d,e,f;for(c=0;c<l;c++)d=b[3*c],e=b[3*c+1],
-f=b[3*c+2],E.push(d/127,e/127,f/127)}return 3*l*Int8Array.BYTES_PER_ELEMENT}(x);x+=v(3*l);x+=function(b){if(n){var b=new Float32Array(a,b,2*n),c,d,e;for(c=0;c<n;c++)d=b[2*c],e=b[2*c+1],G.push(d,e)}return 2*n*Float32Array.BYTES_PER_ELEMENT}(x);L=x+L+v(2*b);K=L+K+v(2*p);f=K+f+v(2*m);i=f+i+v(2*r);c=i+c+v(2*q);j=c+j+v(2*t);k=j+k+v(2*s);(function(a){if(m){var b=a+3*m*Uint32Array.BYTES_PER_ELEMENT;D(m,a,b+3*m*Uint32Array.BYTES_PER_ELEMENT);y(m,b)}})(K);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT,
-c=b+3*r*Uint32Array.BYTES_PER_ELEMENT;J(r,a,b,c+3*r*Uint32Array.BYTES_PER_ELEMENT);y(r,c)}})(f);(function(a){if(s){var b=a+4*s*Uint32Array.BYTES_PER_ELEMENT;I(s,a,b+4*s*Uint32Array.BYTES_PER_ELEMENT);A(s,b)}})(j);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT,c=b+4*u*Uint32Array.BYTES_PER_ELEMENT;H(u,a,b,c+4*u*Uint32Array.BYTES_PER_ELEMENT);A(u,c)}})(k);b&&D(b,x,x+3*b*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(p){var b=a+3*p*Uint32Array.BYTES_PER_ELEMENT;J(p,a,b,b+3*p*Uint32Array.BYTES_PER_ELEMENT)}})(L);
-q&&I(q,i,i+4*q*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(t){var b=a+4*t*Uint32Array.BYTES_PER_ELEMENT;H(t,a,b,b+4*t*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))};
-THREE.ColladaLoader=function(){function a(a,d,f){P=a;d=d||la;void 0!==f&&(a=f.split("/"),a.pop(),ma=(1>a.length?".":a.join("/"))+"/");if((a=P.evaluate("//dae:asset",P,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(f=0;f<a.childNodes.length;f++){var j=a.childNodes[f];switch(j.nodeName){case "unit":(j=j.getAttribute("meter"))&&parseFloat(j);break;case "up_axis":$=j.textContent.charAt(0)}}if(!Q.convertUpAxis||$===Q.upAxis)U=null;else switch($){case "X":U="Y"===Q.upAxis?
-"XtoY":"XtoZ";break;case "Y":U="X"===Q.upAxis?"YtoX":"YtoZ";break;case "Z":U="X"===Q.upAxis?"ZtoX":"ZtoY"}ea=b("//dae:library_images/dae:image",g,"image");fa=b("//dae:library_materials/dae:material",y,"material");ga=b("//dae:library_effects/dae:effect",H,"effect");T=b("//dae:library_geometries/dae:geometry",r,"geometry");ha=b(".//dae:library_cameras/dae:camera",K,"camera");S=b("//dae:library_controllers/dae:controller",h,"controller");V=b("//dae:library_animations/dae:animation",x,"animation");ia=
-b(".//dae:library_visual_scenes/dae:visual_scene",i,"visual_scene");aa=[];ba=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),R=ia[0<a.length?a:"visual_scene0"]):R=null;Z=new THREE.Object3D;for(a=0;a<R.nodes.length;a++)Z.add(e(R.nodes[a]));ja=[];c(Z);a={scene:Z,morphs:aa,skins:ba,animations:ja,dae:{images:ea,materials:fa,cameras:ha,effects:ga,geometries:T,controllers:S,animations:V,visualScenes:ia,
-scene:R}};d&&d(a);return a}function b(a,b,c){for(var a=P.evaluate(a,P,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=R.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};ja.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d=
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,i,j,k,q,l,n,r,m,o,p,t,s,u;function v(a){return a%4?4-a%4:0}function w(a,b){return(new Uint8Array(a,b,1))[0]}function A(a,b){return(new Uint32Array(a,b,1))[0]}function B(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[3*d];f=l[3*d+1];g=l[3*d+2];h=G[2*e];e=G[2*e+1];i=G[2*f];j=G[2*f+1];f=G[2*g];k=G[2*g+1];g=z.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,j));m.push(new THREE.UV(f,
+k));g.push(m)}}function C(b,c){var d,e,f,g,h,i,j,k,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[4*d];f=n[4*d+1];g=n[4*d+2];h=n[4*d+3];i=G[2*e];e=G[2*e+1];j=G[2*f];l=G[2*f+1];k=G[2*g];m=G[2*g+1];g=G[2*h];f=G[2*h+1];h=z.faceVertexUvs[0];var q=[];q.push(new THREE.UV(i,e));q.push(new THREE.UV(j,l));q.push(new THREE.UV(k,m));q.push(new THREE.UV(g,f));h.push(q)}}function F(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[3*d],f=c[3*d+1],g=c[3*d+2],h=i[d],
+z.faces.push(new THREE.Face3(e,f,g,null,null,h))}function I(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[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],z.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function J(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];k=d[3*e+1];l=d[3*e+2];i=m[e];var n=D[3*k],q=D[3*k+1];k=D[3*k+2];var o=D[3*l],p=
+D[3*l+1];l=D[3*l+2];z.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(D[3*j],D[3*j+1],D[3*j+2]),new THREE.Vector3(n,q,k),new THREE.Vector3(o,p,l)],null,i))}}function H(b,c,d,e){for(var f,g,h,i,j,k,l,m,n,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[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];k=d[4*e];l=d[4*e+1];m=d[4*e+2];n=d[4*e+3];j=q[e];var o=D[3*l],p=D[3*l+1];l=D[3*l+2];var r=D[3*m],s=D[3*m+1];m=D[3*m+2];var t=D[3*n],u=D[3*n+1];n=D[3*n+2];z.faces.push(new THREE.Face4(f,
+g,h,i,[new THREE.Vector3(D[3*k],D[3*k+1],D[3*k+2]),new THREE.Vector3(o,p,l),new THREE.Vector3(r,s,m),new THREE.Vector3(t,u,n)],null,j))}}var z=this,x=0,D=[],G=[],L,K,E;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(z,d,b);(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,x,12);c=w(a,x+12);w(a,x+13);w(a,x+14);w(a,x+15);f=w(a,x+16);i=w(a,x+17);j=w(a,x+18);k=w(a,x+19);q=A(a,x+20);l=A(a,x+20+4);n=A(a,x+20+8);b=A(a,x+20+12);r=
+A(a,x+20+16);m=A(a,x+20+20);o=A(a,x+20+24);p=A(a,x+20+28);t=A(a,x+20+32);s=A(a,x+20+36);u=A(a,x+20+40);x+=c;c=3*f+k;E=4*f+k;L=b*c;K=r*(c+3*i);f=m*(c+3*j);k=o*(c+3*i+3*j);c=p*E;i=t*(E+4*i);j=s*(E+4*j);x+=function(b){var b=new Float32Array(a,b,3*q),c,d,e,f;for(c=0;c<q;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],z.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*q*Float32Array.BYTES_PER_ELEMENT}(x);x+=function(b){if(l){var b=new Int8Array(a,b,3*l),c,d,e,f;for(c=0;c<l;c++)d=b[3*c],e=b[3*c+1],
+f=b[3*c+2],D.push(d/127,e/127,f/127)}return 3*l*Int8Array.BYTES_PER_ELEMENT}(x);x+=v(3*l);x+=function(b){if(n){var b=new Float32Array(a,b,2*n),c,d,e;for(c=0;c<n;c++)d=b[2*c],e=b[2*c+1],G.push(d,e)}return 2*n*Float32Array.BYTES_PER_ELEMENT}(x);L=x+L+v(2*b);K=L+K+v(2*r);f=K+f+v(2*m);k=f+k+v(2*o);c=k+c+v(2*p);i=c+i+v(2*t);j=i+j+v(2*s);(function(a){if(m){var b=a+3*m*Uint32Array.BYTES_PER_ELEMENT;F(m,a,b+3*m*Uint32Array.BYTES_PER_ELEMENT);B(m,b)}})(K);(function(a){if(o){var b=a+3*o*Uint32Array.BYTES_PER_ELEMENT,
+c=b+3*o*Uint32Array.BYTES_PER_ELEMENT;J(o,a,b,c+3*o*Uint32Array.BYTES_PER_ELEMENT);B(o,c)}})(f);(function(a){if(s){var b=a+4*s*Uint32Array.BYTES_PER_ELEMENT;I(s,a,b+4*s*Uint32Array.BYTES_PER_ELEMENT);C(s,b)}})(i);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT,c=b+4*u*Uint32Array.BYTES_PER_ELEMENT;H(u,a,b,c+4*u*Uint32Array.BYTES_PER_ELEMENT);C(u,c)}})(j);b&&F(b,x,x+3*b*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT;J(r,a,b,b+3*r*Uint32Array.BYTES_PER_ELEMENT)}})(L);
+p&&I(p,k,k+4*p*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(t){var b=a+4*t*Uint32Array.BYTES_PER_ELEMENT;H(t,a,b,b+4*t*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))};
+THREE.ColladaLoader=function(){function a(a,d,f){P=a;d=d||la;void 0!==f&&(a=f.split("/"),a.pop(),ma=(1>a.length?".":a.join("/"))+"/");if((a=P.evaluate("//dae:asset",P,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(f=0;f<a.childNodes.length;f++){var i=a.childNodes[f];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":$=i.textContent.charAt(0)}}if(!Q.convertUpAxis||$===Q.upAxis)U=null;else switch($){case "X":U="Y"===Q.upAxis?
+"XtoY":"XtoZ";break;case "Y":U="X"===Q.upAxis?"YtoX":"YtoZ";break;case "Z":U="X"===Q.upAxis?"ZtoX":"ZtoY"}ea=b("//dae:library_images/dae:image",g,"image");fa=b("//dae:library_materials/dae:material",B,"material");ga=b("//dae:library_effects/dae:effect",H,"effect");T=b("//dae:library_geometries/dae:geometry",o,"geometry");ha=b(".//dae:library_cameras/dae:camera",K,"camera");S=b("//dae:library_controllers/dae:controller",h,"controller");V=b("//dae:library_animations/dae:animation",x,"animation");ia=
+b(".//dae:library_visual_scenes/dae:visual_scene",k,"visual_scene");aa=[];ba=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),R=ia[0<a.length?a:"visual_scene0"]):R=null;Z=new THREE.Object3D;for(a=0;a<R.nodes.length;a++)Z.add(e(R.nodes[a]));ja=[];c(Z);a={scene:Z,morphs:aa,skins:ba,animations:ja,dae:{images:ea,materials:fa,cameras:ha,effects:ga,geometries:T,controllers:S,animations:V,visualScenes:ia,
+scene:R}};d&&d(a);return a}function b(a,b,c){for(var a=P.evaluate(a,P,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=R.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};ja.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d=
 {hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=0,g=c(a.children[e]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function f(a,b,c){var e,f=S[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 c=1E6,g=-c,h=0;for(e in V)for(var i=V[e],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=R.getChildById(b.skeleton[0],!0)||R.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,n,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);
-for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++)if(l=j[m],n=-1,"JOINT"==l.type){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(0<=n){o=k.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<k.weights.length;o++)for(var q=0;q<k.weights[o].length;q++){var p=k.weights[o][q];p.joint==n&&l.weights.push(p)}}else throw"ColladaLoader: Could not find joint '"+
-l.sid+"'.";}for(j=0;j<h.length;j++)if("JOINT"==h[j].type)for(k=0;k<h[j].weights.length;k++)l=h[j].weights[k],m=l.index,l=l.weight,n=a.vertices[m],m=i[m],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*l,m.position.y+=g.y*l,m.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function e(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var j=S[a.controllers[g].url];switch(j.type){case "skin":if(T[j.skin.source]){var i=
-new m;i.url=j.skin.source;i.instance_material=a.controllers[g].instance_material;a.geometries.push(i);c=a.controllers[g]}else if(S[j.skin.source]&&(d=j=S[j.skin.source],j.morph&&T[j.morph.source]))i=new m,i.url=j.morph.source,i.instance_material=a.controllers[g].instance_material,a.geometries.push(i);break;case "morph":if(T[j.morph.source])i=new m,i.url=j.morph.source,i.instance_material=a.controllers[g].instance_material,a.geometries.push(i),d=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=
-0;g<a.geometries.length;g++){var j=a.geometries[g],i=j.instance_material,j=T[j.url],k={},l=[],o=0,q;if(j&&j.mesh&&j.mesh.primitives){if(0==b.name.length)b.name=j.id;if(i)for(h=0;h<i.length;h++){q=i[h];var p=fa[q.target],r=ga[p.instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;k[q.symbol]=o;l.push(r.material);q=r.material;q.name=null==p.name||""===p.name?p.id:p.name;o++}i=q||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});j=j.mesh.geometry3js;
-if(1<o){i=new THREE.MeshFaceMaterial;j.materials=l;for(h=0;h<j.faces.length;h++)l=j.faces[h],l.materialIndex=k[l.daeMaterial]}if(void 0!==c)f(j,c),i.morphTargets=!0,i=new THREE.SkinnedMesh(j,i),i.skeleton=c.skeleton,i.skinController=S[c.url],i.skinInstanceController=c,i.name="skin_"+ba.length,ba.push(i);else if(void 0!==d){h=j;k=d instanceof n?S[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(o=T[k.targets[l]],o.mesh&&o.mesh.primitives&&
-o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}i.morphTargets=!0;i=new THREE.Mesh(j,i);i.name="morph_"+aa.length;aa.push(i)}else i=new THREE.Mesh(j,i);1<a.geometries.length?b.add(i):b=i}}for(g=0;g<a.cameras.length;g++)b=ha[a.cameras[g].url],b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar);b.name=a.id||"";b.matrix=a.matrix;
-g=a.matrix.decompose();b.position=g[0];b.quaternion=g[1];b.useQuaternion=!0;b.scale=g[2];Q.centerGeometry&&b.geometry&&(g=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(g.multiplySelf(b.scale)),b.position.subSelf(g));for(g=0;g<a.nodes.length;g++)b.add(e(a.nodes[g],a));return b}function g(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function j(){this.weights=this.targets=this.source=this.method=null}function k(){this.source=
-"";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function i(){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 l(){this.type=this.sid="";this.data=[];this.obj=null}function n(){this.url="";this.skeleton=[];this.instance_material=[]}function p(){this.target=this.symbol=""}function m(){this.url=
-"";this.instance_material=[]}function r(){this.id="";this.mesh=null}function q(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function s(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function u(){this.source="";this.stride=this.count=0;this.params=[]}function v(){this.input={}}function w(){this.semantic="";this.offset=0;this.source="";this.set=0}function z(a){this.id=a;this.type=null}function y(){this.name=
-this.id="";this.instance_effect=null}function A(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function D(a,b){this.type=a;this.effect=b;this.material=null}function I(a){this.effect=a;this.format=this.init_from=null}function J(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function H(){this.name=this.id="";this.sampler=this.surface=this.shader=
-null}function C(){this.url=""}function x(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function E(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function G(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function L(a){this.targets=[];this.time=a}function K(){this.name=this.id=""}function F(){this.url=
-""}function B(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function M(a){for(var a=Y(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function N(a){for(var a=Y(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function Y(a){return 0<a.length?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function W(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function O(a,b){if(Q.convertUpAxis&&$!==Q.upAxis)switch(U){case "XtoY":var c=
+for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++)if(l=j[m],n=-1,"JOINT"==l.type){for(var q=0;q<k.joints.length;q++)if(l.sid==k.joints[q]){n=q;break}if(0<=n){q=k.invBindMatrices[n];l.invBindMatrix=q;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,q);l.weights=[];for(q=0;q<k.weights.length;q++)for(var o=0;o<k.weights[q].length;o++){var p=k.weights[q][o];p.joint==n&&l.weights.push(p)}}else throw"ColladaLoader: Could not find joint '"+
+l.sid+"'.";}for(j=0;j<h.length;j++)if("JOINT"==h[j].type)for(k=0;k<h[j].weights.length;k++)l=h[j].weights[k],m=l.index,l=l.weight,n=a.vertices[m],m=i[m],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*l,m.position.y+=g.y*l,m.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function e(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var i=S[a.controllers[g].url];switch(i.type){case "skin":if(T[i.skin.source]){var j=
+new m;j.url=i.skin.source;j.instance_material=a.controllers[g].instance_material;a.geometries.push(j);c=a.controllers[g]}else if(S[i.skin.source]&&(d=i=S[i.skin.source],i.morph&&T[i.morph.source]))j=new m,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j);break;case "morph":if(T[i.morph.source])j=new m,j.url=i.morph.source,j.instance_material=a.controllers[g].instance_material,a.geometries.push(j),d=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=
+0;g<a.geometries.length;g++){var i=a.geometries[g],j=i.instance_material,i=T[i.url],k={},l=[],q=0,o;if(i&&i.mesh&&i.mesh.primitives){if(0==b.name.length)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var p=fa[o.target],r=ga[p.instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;k[o.symbol]=q;l.push(r.material);o=r.material;o.name=null==p.name||""===p.name?p.id:p.name;q++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;
+if(1<q){j=new THREE.MeshFaceMaterial;i.materials=l;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materialIndex=k[l.daeMaterial]}if(void 0!==c)f(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=S[c.url],j.skinInstanceController=c,j.name="skin_"+ba.length,ba.push(j);else if(void 0!==d){h=i;k=d instanceof n?S[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(q=T[k.targets[l]],q.mesh&&q.mesh.primitives&&
+q.mesh.primitives.length)q=q.mesh.primitives[0].geometry,q.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:q.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+aa.length;aa.push(j)}else j=new THREE.Mesh(i,j);1<a.geometries.length?b.add(j):b=j}}for(g=0;g<a.cameras.length;g++)b=ha[a.cameras[g].url],b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar);b.name=a.id||"";b.matrix=a.matrix;
+g=a.matrix.decompose();b.position=g[0];b.quaternion=g[1];b.useQuaternion=!0;b.scale=g[2];Q.centerGeometry&&b.geometry&&(g=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(g.multiplySelf(b.scale)),b.position.subSelf(g));for(g=0;g<a.nodes.length;g++)b.add(e(a.nodes[g],a));return b}function g(){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 q(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function l(){this.type=this.sid="";this.data=[];this.obj=null}function n(){this.url="";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function m(){this.url=
+"";this.instance_material=[]}function o(){this.id="";this.mesh=null}function p(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function s(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function u(){this.source="";this.stride=this.count=0;this.params=[]}function v(){this.input={}}function w(){this.semantic="";this.offset=0;this.source="";this.set=0}function A(a){this.id=a;this.type=null}function B(){this.name=
+this.id="";this.instance_effect=null}function C(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function F(a,b){this.type=a;this.effect=b;this.material=null}function I(a){this.effect=a;this.format=this.init_from=null}function J(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function H(){this.name=this.id="";this.sampler=this.surface=this.shader=
+null}function z(){this.url=""}function x(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function D(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function G(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function L(a){this.targets=[];this.time=a}function K(){this.name=this.id=""}function E(){this.url=
+""}function y(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function M(a){for(var a=Y(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function N(a){for(var a=Y(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function Y(a){return 0<a.length?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function W(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function O(a,b){if(Q.convertUpAxis&&$!==Q.upAxis)switch(U){case "XtoY":var c=
 a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function ca(a,b){var c=[a[b],a[b+1],a[b+2]];O(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function da(a){if(Q.convertUpAxis){var b=[a[0],a[4],a[8]];O(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];O(b,-1);a[1]=b[0];a[5]=b[1];a[9]=
 b[2];b=[a[2],a[6],a[10]];O(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];O(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];O(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];O(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];O(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var P=null,Z=null,R,la=null,X={},ea={},V={},S={},T={},fa={},ga={},ha={},ja,ia,ma,aa,ba,na=THREE.SmoothShading,
-Q={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},$="Y",U=null,ka=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);
-this.type=c.nodeName;break;case "morph":this.morph=(new j).parse(c),this.type=c.nodeName}}return this};j.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(1==e.nodeType)switch(e.nodeName){case "source":e=(new z).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};j.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new w).parse(d))}}return b};k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];
-if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=M(f.textContent);this.bindShapeMatrix=da(f);break;case "source":f=(new z).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(1==d.nodeType)switch(d.nodeName){case "input":var d=(new w).parse(d),e=b[d.source];if("JOINT"==
-d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)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(1==g.nodeType)switch(g.nodeName){case "input":e.push((new w).parse(g));break;case "v":c=N(g.textContent);break;case "vcount":d=N(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],j=[],i=0;i<h;i++){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]}}j.push(k);g+=e.length}for(i=0;i<j.length;i++)j[i].index=f;this.weights.push(j)}};i.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};i.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};i.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(1==c.nodeType)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=0<=e.indexOf("."),g=0<=e.indexOf("("),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="JOINT"==this.type?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));
-break;case "instance_camera":this.cameras.push((new F).parse(b));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,B,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 l).parse(b));
+Q={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},$="Y",U=null,ka=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)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(1==e.nodeType)switch(e.nodeName){case "source":e=(new A).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(1==d.nodeType)switch(d.nodeName){case "input":b.push((new w).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(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=M(f.textContent);this.bindShapeMatrix=da(f);break;case "source":f=(new A).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(1==d.nodeType)switch(d.nodeName){case "input":var d=(new w).parse(d),e=b[d.source];if("JOINT"==
+d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)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(1==g.nodeType)switch(g.nodeName){case "input":e.push((new w).parse(g));break;case "v":c=N(g.textContent);break;case "vcount":d=N(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(1==c.nodeType)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=0<=e.indexOf("."),g=0<=e.indexOf("("),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="JOINT"==this.type?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new q).parse(b));
+break;case "instance_camera":this.cameras.push((new E).parse(b));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,y,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 l).parse(b));
 break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in V)for(var e=V[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(Q.convertUpAxis)switch(g){case "X":switch(U){case "XtoY":case "XtoZ":case "YtoX":g=
-"Y";break;case "ZtoX":g="Z"}break;case "Y":switch(U){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(U){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){-1===a.indexOf(f)&&a.push(f);b=0;for(var k=i.length;b<k;b++){var q=i[b],p=h.getData(j.type,b),r;r=null;for(var s=0,t=d.length;s<t&&null==r;s++){var u=d[s];if(u.time===q)r=u;else if(u.time>q)break}if(!r){r=
-new L(q);s=-1;t=0;for(u=d.length;t<u&&-1==s;t++)d[t].time>=q&&(s=t);q=s;d.splice(-1==q?d.length:q,0,r)}r.addTarget(f,j,g,p)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(r=d[b],!r.hasTarget(e)){h=d;f=r;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-
-i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;p=void 0;if(k.length){p=[];for(q=0;q<k.length;++q)p[q]=k[q]+(j[q]-k[q])*h}else p=k+(j-k)*h;f.addTarget(g,i.transform,i.member,p)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};l.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=M(a.textContent);this.convert();
+"Y";break;case "ZtoX":g="Z"}break;case "Y":switch(U){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(U){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){-1===a.indexOf(f)&&a.push(f);b=0;for(var k=i.length;b<k;b++){var o=i[b],p=h.getData(j.type,b),r;r=null;for(var s=0,t=d.length;s<t&&null==r;s++){var u=d[s];if(u.time===o)r=u;else if(u.time>o)break}if(!r){r=
+new L(o);s=-1;t=0;for(u=d.length;t<u&&-1==s;t++)d[t].time>=o&&(s=t);o=s;d.splice(-1==o?d.length:o,0,r)}r.addTarget(f,j,g,p)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(r=d[b],!r.hasTarget(e)){h=d;f=r;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-
+i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;p=void 0;if(k.length){p=[];for(o=0;o<k.length;++o)p[o]=k[o]+(j[o]-k[o])*h}else p=k+(j-k)*h;f.addTarget(g,i.transform,i.member,p)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};q.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};l.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=M(a.textContent);this.convert();
 return this};l.prototype.convert=function(){switch(this.type){case "matrix":this.obj=da(this.data);break;case "rotate":this.angle=this.data[3]*ka;case "translate":O(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":O(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};l.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);
 break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};l.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=
 a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*ka;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*ka}}};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(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=P.evaluate(".//dae:instance_material",
-c,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new p).parse(d)),d=c.iterateNext()}}return this};p.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(1==c.nodeType&&"bind_material"==c.nodeName){if(a=
-P.evaluate(".//dae:instance_material",c,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new p).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 q(this)).parse(c)}}return this};q.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==X[d]&&(X[d]=(new z(d)).parse(c));break;case "vertices":this.vertices=(new v).parse(c);break;case "triangles":this.primitives.push((new s).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new t).parse(c))}}this.geometry3js=new THREE.Geometry;a=X[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(ca(a,
-b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.calcNormals&&(this.geometry3js.computeVertexNormals(),delete this.geometry3js.calcNormals);this.geometry3js.computeBoundingBox();return this};q.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,l=0,m=3,n=0,o=[];for(d=0;d<g.length;d++){h=g[d];var q=h.offset+
-1,n=n<q?q:n;switch(h.semantic){case "TEXCOORD":o.push(h.set)}}for(;c<f.length;){var p=[],r=[],q={},s=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=X[h.source],i=f[c+d*n+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":p.push(i);break;case "NORMAL":r.push(ca(k.data,j));break;case "TEXCOORD":void 0===q[h.set]&&(q[h.set]=[]);q[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(k.data[j],k.data[j+
+c,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new r).parse(d)),d=c.iterateNext()}}return this};r.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};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(1==c.nodeType&&"bind_material"==c.nodeName){if(a=
+P.evaluate(".//dae:instance_material",c,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new r).parse(b)),b=a.iterateNext();break}}return this};o.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new p(this)).parse(c)}}return this};p.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==X[d]&&(X[d]=(new A(d)).parse(c));break;case "vertices":this.vertices=(new v).parse(c);break;case "triangles":this.primitives.push((new s).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new t).parse(c))}}this.geometry3js=new THREE.Geometry;a=X[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(ca(a,
+b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.calcNormals&&(this.geometry3js.computeVertexNormals(),delete this.geometry3js.calcNormals);this.geometry3js.computeBoundingBox();return this};p.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,l=0,m=3,n=0,q=[];for(d=0;d<g.length;d++){h=g[d];var o=h.offset+
+1,n=n<o?o:n;switch(h.semantic){case "TEXCOORD":q.push(h.set)}}for(;c<f.length;){var p=[],r=[],o={},s=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=X[h.source],i=f[c+d*n+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":p.push(i);break;case "NORMAL":r.push(ca(k.data,j));break;case "TEXCOORD":void 0===o[h.set]&&(o[h.set]=[]);o[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(k.data[j],k.data[j+
 1],k.data[j+2]))}e=null;d=[];if(0==r.length)if(h=this.vertices.input.NORMAL){k=X[h.source];j=k.accessor.params.length;h=0;for(i=p.length;h<i;h++)r.push(ca(k.data,p[h]*j))}else b.calcNormals=!0;if(3===m)d.push(new THREE.Face3(p[0],p[1],p[2],r,s.length?s:new THREE.Color));else if(4===m)d.push(new THREE.Face4(p[0],p[1],p[2],p[3],r,s.length?s:new THREE.Color));else if(4<m&&Q.subdivideFaces){s=s.length?s:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(p[0],p[e],p[e+1],[r[0],r[e++],r[e]],s))}if(d.length){h=
-0;for(i=d.length;h<i;h++){e=d[h];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<o.length;e++)p=q[o[e]],p=4<m?[p[0],p[h+1],p[h+2]]:4===m?[p[0],p[1],p[2],p[3]]:[p[0],p[1],p[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(p)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=n*m}};t.prototype=new s;t.prototype.constructor=t;s.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=
+0;for(i=d.length;h<i;h++){e=d[h];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<q.length;e++)p=o[q[e]],p=4<m?[p[0],p[h+1],p[h+2]]:4===m?[p[0],p[1],p[2],p[3]]:[p[0],p[1],p[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(p)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=n*m}};t.prototype=new s;t.prototype.constructor=t;s.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};s.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 w).parse(a.childNodes[b]));break;case "vcount":this.vcount=N(c.textContent);break;case "p":this.p=N(c.textContent)}}return this};u.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("param"==c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){var c=(new w).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};w.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("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};z.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=Y(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=M(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
-N(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=Y(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new u).parse(c.childNodes[d]);break}}}return this};z.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=
-this.data.slice(b,b+16),c=da(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};y.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new C).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return null==this.texture};A.prototype.isTexture=function(){return null!=this.texture};
-A.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=M(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};A.prototype.parseTexture=function(a){if(!a.childNodes)return this;
-a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};D.prototype.parse=
-function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)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,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();
-return this};D.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,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){var e=ea[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(ma+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,
+"");this.set=W(a,"set",-1);this.offset=W(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};A.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=Y(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=M(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
+N(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=Y(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new u).parse(c.childNodes[d]);break}}}return this};A.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=
+this.data.slice(b,b+16),c=da(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};B.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new z).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return null==this.texture};C.prototype.isTexture=function(){return null!=this.texture};
+C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=M(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};C.prototype.parseTexture=function(a){if(!a.childNodes)return this;
+a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};F.prototype.parse=
+function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",c,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();
+return this};F.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=ea[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(ma+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,
 e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else"diffuse"==c?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=na;return this.material=new THREE.MeshLambertMaterial(a)};I.prototype.parse=function(a){for(var b=0;b<
 a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)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};J.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=
 c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};H.prototype.create=function(){if(null==this.shader)return null};H.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
 H.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=(new I(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new J(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};H.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
-break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};H.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new D(c.nodeName,this)).parse(c)}}};C.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};x.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(1==c.nodeType)switch(c.nodeName){case "source":c=(new z).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new G(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("/");
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};H.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new F(c.nodeName,this)).parse(c)}}};z.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};x.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(1==c.nodeType)switch(c.nodeName){case "source":c=(new A).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new G(this)).parse(c));break;case "channel":this.channel.push((new D(this)).parse(c))}}return this};D.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=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};G.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(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new w).parse(c))}}return this};
 G.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=
 0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};G.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":O(c,-1);break;case "scale":O(c,1)}}else c=this.output[b];return c};L.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,
 member:c,transform:b,data:d})};L.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};L.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};L.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};L.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=
 this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(a.time-this.time),g=e.data,h=d.data;if(0>f||1<f)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=0>f?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};K.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};
-K.prototype.parseOptics=function(a){for(var b=0;b<a.childNodes.length;b++)if("technique_common"==a.childNodes[b].nodeName)for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++)if("perspective"==c.childNodes[d].nodeName)for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];switch(g.nodeName){case "xfov":this.fov=g.textContent;break;case "znear":this.znear=0.4;break;case "zfar":this.zfar=1E15;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}return this};F.prototype.parse=
+K.prototype.parseOptics=function(a){for(var b=0;b<a.childNodes.length;b++)if("technique_common"==a.childNodes[b].nodeName)for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++)if("perspective"==c.childNodes[d].nodeName)for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];switch(g.nodeName){case "xfov":this.fov=g.textContent;break;case "znear":this.znear=0.4;break;case "zfar":this.zfar=1E15;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}return this};E.prototype.parse=
 function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(la=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==f.readyState&&d&&(0==e&&(e=f.getResponseHeader("Content-Length")),
 d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){na=a},applySkin:f,geometries:T,options:Q}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,f){var e=new XMLHttpRequest,g=0;e.onreadystatechange=function(){if(e.readyState===e.DONE)if(200===e.status||0===e.status){if(e.responseText){var h=JSON.parse(e.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+e.status+"]");else e.readyState===e.LOADING?f&&(0===g&&(g=e.getResponseHeader("Content-Length")),
 f({total:g,loaded:e.responseText.length})):e.readyState===e.HEADERS_RECEIVED&&(g=e.getResponseHeader("Content-Length"))};e.open("GET",b,!0);e.overrideMimeType&&e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,f,j,k,i,o,l,n,p,m,r,q,t,s,u=a.faces;o=a.vertices;var v=a.normals,w=a.colors,z=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&z++;for(c=0;c<z;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(i=o.length;k<i;)l=new THREE.Vertex,l.position.x=o[k++]*b,l.position.y=o[k++]*b,l.position.z=o[k++]*b,d.vertices.push(l);k=0;for(i=u.length;k<i;){b=
-u[k++];o=b&1;j=b&2;c=b&4;f=b&8;n=b&16;l=b&32;m=b&64;b&=128;o?(r=new THREE.Face4,r.a=u[k++],r.b=u[k++],r.c=u[k++],r.d=u[k++],o=4):(r=new THREE.Face3,r.a=u[k++],r.b=u[k++],r.c=u[k++],o=3);if(j)j=u[k++],r.materialIndex=j;j=d.faces.length;if(c)for(c=0;c<z;c++)q=a.uvs[c],p=u[k++],s=q[2*p],p=q[2*p+1],d.faceUvs[c][j]=new THREE.UV(s,p);if(f)for(c=0;c<z;c++){q=a.uvs[c];t=[];for(f=0;f<o;f++)p=u[k++],s=q[2*p],p=q[2*p+1],t[f]=new THREE.UV(s,p);d.faceVertexUvs[c][j]=t}if(n)n=3*u[k++],f=new THREE.Vector3,f.x=v[n++],
-f.y=v[n++],f.z=v[n],r.normal=f;if(l)for(c=0;c<o;c++)n=3*u[k++],f=new THREE.Vector3,f.x=v[n++],f.y=v[n++],f.z=v[n],r.vertexNormals.push(f);if(m)l=u[k++],l=new THREE.Color(w[l]),r.color=l;if(b)for(c=0;c<o;c++)l=u[k++],l=new THREE.Color(w[l]),r.vertexColors.push(l);d.faces.push(r)}})(f);(function(){var b,c,f,j;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=2)f=a.skinWeights[b],j=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(f,j,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<
-c;b+=2)f=a.skinIndices[b],j=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(f,j,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,f,j,k,i,o,l,n,p;for(c=0,f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;p=a.morphTargets[c].vertices;for(j=0,k=p.length;j<k;j+=3)i=p[j]*b,o=p[j+1]*b,l=p[j+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(i,o,
-l)))}}if(void 0!==a.morphColors)for(c=0,f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;i=a.morphColors[c].colors;for(b=0,j=i.length;b<j;b+=3)o=new THREE.Color(16755200),o.setRGB(i[b],i[b+1],i[b+2]),k.push(o)}})(f);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,f,i,j,k,q,l,n,r,m,o,p,t,s,u=a.faces;q=a.vertices;var v=a.normals,w=a.colors,A=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&A++;for(c=0;c<A;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(k=q.length;j<k;)l=new THREE.Vertex,l.position.x=q[j++]*b,l.position.y=q[j++]*b,l.position.z=q[j++]*b,d.vertices.push(l);j=0;for(k=u.length;j<k;){b=
+u[j++];q=b&1;i=b&2;c=b&4;f=b&8;n=b&16;l=b&32;m=b&64;b&=128;q?(o=new THREE.Face4,o.a=u[j++],o.b=u[j++],o.c=u[j++],o.d=u[j++],q=4):(o=new THREE.Face3,o.a=u[j++],o.b=u[j++],o.c=u[j++],q=3);if(i)i=u[j++],o.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<A;c++)p=a.uvs[c],r=u[j++],s=p[2*r],r=p[2*r+1],d.faceUvs[c][i]=new THREE.UV(s,r);if(f)for(c=0;c<A;c++){p=a.uvs[c];t=[];for(f=0;f<q;f++)r=u[j++],s=p[2*r],r=p[2*r+1],t[f]=new THREE.UV(s,r);d.faceVertexUvs[c][i]=t}if(n)n=3*u[j++],f=new THREE.Vector3,f.x=v[n++],
+f.y=v[n++],f.z=v[n],o.normal=f;if(l)for(c=0;c<q;c++)n=3*u[j++],f=new THREE.Vector3,f.x=v[n++],f.y=v[n++],f.z=v[n],o.vertexNormals.push(f);if(m)l=u[j++],l=new THREE.Color(w[l]),o.color=l;if(b)for(c=0;c<q;c++)l=u[j++],l=new THREE.Color(w[l]),o.vertexColors.push(l);d.faces.push(o)}})(f);(function(){var b,c,f,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=2)f=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(f,i,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<
+c;b+=2)f=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(f,i,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,f,i,j,k,q,l,n,r;for(c=0,f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;r=a.morphTargets[c].vertices;for(i=0,j=r.length;i<j;i+=3)k=r[i]*b,q=r[i+1]*b,l=r[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(k,q,
+l)))}}if(void 0!==a.morphColors)for(c=0,f=a.morphColors.length;c<f;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;for(b=0,i=k.length;b<i;b+=3)q=new THREE.Color(16755200),q.setRGB(k[b],k[b+1],k[b+2]),j.push(q)}})(f);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(4==d.readyState)if(200==d.status||0==d.status){var f=JSON.parse(d.responseText);c.createScene(f,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.overrideMimeType&&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"relativeToHTML"==b?a:k+"/"+a}function f(){var a;for(l in C.objects)if(!F.objects[l])if(q=C.objects[l],void 0!==q.geometry){if(D=F.geometries[q.geometry])a=!1,I=F.materials[q.materials[0]],(a=I instanceof THREE.ShaderMaterial)&&D.computeTangents(),u=q.position,v=q.rotation,w=q.quaternion,z=q.scale,w=0,0==q.materials.length&&(I=new THREE.MeshFaceMaterial),1<q.materials.length&&(I=new THREE.MeshFaceMaterial),a=new THREE.Mesh(D,
-I),a.name=l,a.position.set(u[0],u[1],u[2]),w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]),a.scale.set(z[0],z[1],z[2]),a.visible=q.visible,a.doubleSided=q.doubleSided,a.castShadow=q.castShadow,a.receiveShadow=q.receiveShadow,F.scene.add(a),F.objects[l]=a}else u=q.position,v=q.rotation,w=q.quaternion,z=q.scale,w=0,a=new THREE.Object3D,a.name=l,a.position.set(u[0],u[1],u[2]),w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(v[0],
-v[1],v[2]),a.scale.set(z[0],z[1],z[2]),a.visible=void 0!==q.visible?q.visible:!1,F.scene.add(a),F.objects[l]=a,F.empties[l]=a}function e(a){return function(b){F.geometries[a]=b;f();E-=1;j.onLoadComplete();h()}}function g(a){return function(b){F.geometries[a]=b}}function h(){j.callbackProgress({totalModels:L,totalTextures:K,loadedModels:L-E,loadedTextures:K-G},F);j.onLoadProgress();0==E&&0==G&&b(F)}var j=this,k=THREE.Loader.prototype.extractUrlBase(c),i,o,l,n,p,m,r,q,t,s,u,v,w,z,y,A,D,I,J,H,C,x,E,
-G,L,K,F;C=a;c=new THREE.BinaryLoader;x=new THREE.JSONLoader;G=E=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(C.transform&&(a=C.transform.position,t=C.transform.rotation,y=C.transform.scale,a&&F.scene.position.set(a[0],a[1],a[2]),t&&F.scene.rotation.set(t[0],t[1],t[2]),y&&F.scene.scale.set(y[0],y[1],y[2]),a||t||y))F.scene.updateMatrix(),F.scene.updateMatrixWorld();a=function(){G-=1;h();j.onLoadComplete()};for(p in C.cameras)y=
-C.cameras[p],"perspective"==y.type?J=new THREE.PerspectiveCamera(y.fov,y.aspect,y.near,y.far):"ortho"==y.type&&(J=new THREE.OrthographicCamera(y.left,y.right,y.top,y.bottom,y.near,y.far)),u=y.position,t=y.target,y=y.up,J.position.set(u[0],u[1],u[2]),J.target=new THREE.Vector3(t[0],t[1],t[2]),y&&J.up.set(y[0],y[1],y[2]),F.cameras[p]=J;for(n in C.lights)t=C.lights[n],p=void 0!==t.color?t.color:16777215,J=void 0!==t.intensity?t.intensity:1,"directional"==t.type?(u=t.direction,s=new THREE.DirectionalLight(p,
-J),s.position.set(u[0],u[1],u[2]),s.position.normalize()):"point"==t.type?(u=t.position,s=t.distance,s=new THREE.PointLight(p,J,s),s.position.set(u[0],u[1],u[2])):"ambient"==t.type&&(s=new THREE.AmbientLight(p)),F.scene.add(s),F.lights[n]=s;for(m in C.fogs)n=C.fogs[m],"linear"==n.type?H=new THREE.Fog(0,n.near,n.far):"exp2"==n.type&&(H=new THREE.FogExp2(0,n.density)),y=n.color,H.color.setRGB(y[0],y[1],y[2]),F.fogs[m]=H;if(F.cameras&&C.defaults.camera)F.currentCamera=F.cameras[C.defaults.camera];if(F.fogs&&
-C.defaults.fog)F.scene.fog=F.fogs[C.defaults.fog];y=C.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(y[0],y[1],y[2]);F.bgColorAlpha=C.defaults.bgalpha;for(i in C.geometries)if(m=C.geometries[i],"bin_mesh"==m.type||"ascii_mesh"==m.type)E+=1,j.onLoadStart();L=E;for(i in C.geometries)if(m=C.geometries[i],"cube"==m.type)D=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),F.geometries[i]=D;else if("plane"==m.type)D=new THREE.PlaneGeometry(m.width,
-m.height,m.segmentsWidth,m.segmentsHeight),F.geometries[i]=D;else if("sphere"==m.type)D=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),F.geometries[i]=D;else if("cylinder"==m.type)D=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),F.geometries[i]=D;else if("torus"==m.type)D=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),F.geometries[i]=D;else if("icosahedron"==m.type)D=new THREE.IcosahedronGeometry(m.radius,m.subdivisions),F.geometries[i]=
-D;else if("bin_mesh"==m.type)c.load(d(m.url,C.urlBaseType),e(i));else if("ascii_mesh"==m.type)x.load(d(m.url,C.urlBaseType),e(i));else if("embedded_mesh"==m.type)m=C.embeds[m.id],m.metadata=C.metadata,m&&x.createModel(m,g(i),"");for(r in C.textures)if(i=C.textures[r],i.url instanceof Array){G+=i.url.length;for(m=0;m<i.url.length;m++)j.onLoadStart()}else G+=1,j.onLoadStart();K=G;for(r in C.textures){i=C.textures[r];if(void 0!=i.mapping&&void 0!=THREE[i.mapping])i.mapping=new THREE[i.mapping];if(i.url instanceof
-Array){m=[];for(H=0;H<i.url.length;H++)m[H]=d(i.url[H],C.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,i.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(i.url,C.urlBaseType),i.mapping,a);if(void 0!=THREE[i.minFilter])m.minFilter=THREE[i.minFilter];if(void 0!=THREE[i.magFilter])m.magFilter=THREE[i.magFilter];if(i.repeat){m.repeat.set(i.repeat[0],i.repeat[1]);if(1!=i.repeat[0])m.wrapS=THREE.RepeatWrapping;if(1!=i.repeat[1])m.wrapT=THREE.RepeatWrapping}i.offset&&m.offset.set(i.offset[0],i.offset[1]);
-if(i.wrap){H={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==H[i.wrap[0]])m.wrapS=H[i.wrap[0]];if(void 0!==H[i.wrap[1]])m.wrapT=H[i.wrap[1]]}}F.textures[r]=m}for(o in C.materials){r=C.materials[o];for(A in r.parameters)if("envMap"==A||"map"==A||"lightMap"==A)r.parameters[A]=F.textures[r.parameters[A]];else if("shading"==A)r.parameters[A]="flat"==r.parameters[A]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==A)r.parameters[A]=THREE[r.parameters[A]]?THREE[r.parameters[A]]:
-THREE.NormalBlending;else if("combine"==A)r.parameters[A]="MixOperation"==r.parameters[A]?THREE.MixOperation:THREE.MultiplyOperation;else if("vertexColors"==A)if("face"==r.parameters[A])r.parameters[A]=THREE.FaceColors;else if(r.parameters[A])r.parameters[A]=THREE.VertexColors;if(void 0!==r.parameters.opacity&&1>r.parameters.opacity)r.parameters.transparent=!0;if(r.parameters.normalMap){a=THREE.ShaderUtils.lib.normal;i=THREE.UniformsUtils.clone(a.uniforms);m=r.parameters.color;H=r.parameters.specular;
-c=r.parameters.ambient;x=r.parameters.shininess;i.tNormal.texture=F.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)i.uNormalScale.value=r.parameters.normalMapFactor;if(r.parameters.map)i.tDiffuse.texture=r.parameters.map,i.enableDiffuse.value=!0;if(r.parameters.lightMap)i.tAO.texture=r.parameters.lightMap,i.enableAO.value=!0;if(r.parameters.specularMap)i.tSpecular.texture=F.textures[r.parameters.specularMap],i.enableSpecular.value=!0;i.uDiffuseColor.value.setHex(m);i.uSpecularColor.value.setHex(H);
-i.uAmbientColor.value.setHex(c);i.uShininess.value=x;if(r.parameters.opacity)i.uOpacity.value=r.parameters.opacity;I=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:i,lights:!0,fog:!0})}else I=new THREE[r.type](r.parameters);F.materials[o]=I}f();j.callbackSync(F);h()};THREE.UTF8Loader=function(){};
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:j+"/"+a}function f(){var a;for(l in z.objects)if(!E.objects[l])if(p=z.objects[l],void 0!==p.geometry){if(F=E.geometries[p.geometry])a=!1,I=E.materials[p.materials[0]],(a=I instanceof THREE.ShaderMaterial)&&F.computeTangents(),u=p.position,v=p.rotation,w=p.quaternion,A=p.scale,w=0,0==p.materials.length&&(I=new THREE.MeshFaceMaterial),1<p.materials.length&&(I=new THREE.MeshFaceMaterial),a=new THREE.Mesh(F,
+I),a.name=l,a.position.set(u[0],u[1],u[2]),w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]),a.scale.set(A[0],A[1],A[2]),a.visible=p.visible,a.doubleSided=p.doubleSided,a.castShadow=p.castShadow,a.receiveShadow=p.receiveShadow,E.scene.add(a),E.objects[l]=a}else u=p.position,v=p.rotation,w=p.quaternion,A=p.scale,w=0,a=new THREE.Object3D,a.name=l,a.position.set(u[0],u[1],u[2]),w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(v[0],
+v[1],v[2]),a.scale.set(A[0],A[1],A[2]),a.visible=void 0!==p.visible?p.visible:!1,E.scene.add(a),E.objects[l]=a,E.empties[l]=a}function e(a){return function(b){E.geometries[a]=b;f();D-=1;i.onLoadComplete();h()}}function g(a){return function(b){E.geometries[a]=b}}function h(){i.callbackProgress({totalModels:L,totalTextures:K,loadedModels:L-D,loadedTextures:K-G},E);i.onLoadProgress();0==D&&0==G&&b(E)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),k,q,l,n,r,m,o,p,t,s,u,v,w,A,B,C,F,I,J,H,z,x,D,
+G,L,K,E;z=a;c=new THREE.BinaryLoader;x=new THREE.JSONLoader;G=D=0;E={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(z.transform&&(a=z.transform.position,t=z.transform.rotation,B=z.transform.scale,a&&E.scene.position.set(a[0],a[1],a[2]),t&&E.scene.rotation.set(t[0],t[1],t[2]),B&&E.scene.scale.set(B[0],B[1],B[2]),a||t||B))E.scene.updateMatrix(),E.scene.updateMatrixWorld();a=function(){G-=1;h();i.onLoadComplete()};for(r in z.cameras)B=
+z.cameras[r],"perspective"==B.type?J=new THREE.PerspectiveCamera(B.fov,B.aspect,B.near,B.far):"ortho"==B.type&&(J=new THREE.OrthographicCamera(B.left,B.right,B.top,B.bottom,B.near,B.far)),u=B.position,t=B.target,B=B.up,J.position.set(u[0],u[1],u[2]),J.target=new THREE.Vector3(t[0],t[1],t[2]),B&&J.up.set(B[0],B[1],B[2]),E.cameras[r]=J;for(n in z.lights)t=z.lights[n],r=void 0!==t.color?t.color:16777215,J=void 0!==t.intensity?t.intensity:1,"directional"==t.type?(u=t.direction,s=new THREE.DirectionalLight(r,
+J),s.position.set(u[0],u[1],u[2]),s.position.normalize()):"point"==t.type?(u=t.position,s=t.distance,s=new THREE.PointLight(r,J,s),s.position.set(u[0],u[1],u[2])):"ambient"==t.type&&(s=new THREE.AmbientLight(r)),E.scene.add(s),E.lights[n]=s;for(m in z.fogs)n=z.fogs[m],"linear"==n.type?H=new THREE.Fog(0,n.near,n.far):"exp2"==n.type&&(H=new THREE.FogExp2(0,n.density)),B=n.color,H.color.setRGB(B[0],B[1],B[2]),E.fogs[m]=H;if(E.cameras&&z.defaults.camera)E.currentCamera=E.cameras[z.defaults.camera];if(E.fogs&&
+z.defaults.fog)E.scene.fog=E.fogs[z.defaults.fog];B=z.defaults.bgcolor;E.bgColor=new THREE.Color;E.bgColor.setRGB(B[0],B[1],B[2]);E.bgColorAlpha=z.defaults.bgalpha;for(k in z.geometries)if(m=z.geometries[k],"bin_mesh"==m.type||"ascii_mesh"==m.type)D+=1,i.onLoadStart();L=D;for(k in z.geometries)if(m=z.geometries[k],"cube"==m.type)F=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),E.geometries[k]=F;else if("plane"==m.type)F=new THREE.PlaneGeometry(m.width,
+m.height,m.segmentsWidth,m.segmentsHeight),E.geometries[k]=F;else if("sphere"==m.type)F=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),E.geometries[k]=F;else if("cylinder"==m.type)F=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),E.geometries[k]=F;else if("torus"==m.type)F=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),E.geometries[k]=F;else if("icosahedron"==m.type)F=new THREE.IcosahedronGeometry(m.radius,m.subdivisions),E.geometries[k]=
+F;else if("bin_mesh"==m.type)c.load(d(m.url,z.urlBaseType),e(k));else if("ascii_mesh"==m.type)x.load(d(m.url,z.urlBaseType),e(k));else if("embedded_mesh"==m.type)m=z.embeds[m.id],m.metadata=z.metadata,m&&x.createModel(m,g(k),"");for(o in z.textures)if(k=z.textures[o],k.url instanceof Array){G+=k.url.length;for(m=0;m<k.url.length;m++)i.onLoadStart()}else G+=1,i.onLoadStart();K=G;for(o in z.textures){k=z.textures[o];if(void 0!=k.mapping&&void 0!=THREE[k.mapping])k.mapping=new THREE[k.mapping];if(k.url instanceof
+Array){m=[];for(H=0;H<k.url.length;H++)m[H]=d(k.url[H],z.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(k.url,z.urlBaseType),k.mapping,a);if(void 0!=THREE[k.minFilter])m.minFilter=THREE[k.minFilter];if(void 0!=THREE[k.magFilter])m.magFilter=THREE[k.magFilter];if(k.repeat){m.repeat.set(k.repeat[0],k.repeat[1]);if(1!=k.repeat[0])m.wrapS=THREE.RepeatWrapping;if(1!=k.repeat[1])m.wrapT=THREE.RepeatWrapping}k.offset&&m.offset.set(k.offset[0],k.offset[1]);
+if(k.wrap){H={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==H[k.wrap[0]])m.wrapS=H[k.wrap[0]];if(void 0!==H[k.wrap[1]])m.wrapT=H[k.wrap[1]]}}E.textures[o]=m}for(q in z.materials){o=z.materials[q];for(C in o.parameters)if("envMap"==C||"map"==C||"lightMap"==C)o.parameters[C]=E.textures[o.parameters[C]];else if("shading"==C)o.parameters[C]="flat"==o.parameters[C]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==C)o.parameters[C]=THREE[o.parameters[C]]?THREE[o.parameters[C]]:
+THREE.NormalBlending;else if("combine"==C)o.parameters[C]="MixOperation"==o.parameters[C]?THREE.MixOperation:THREE.MultiplyOperation;else if("vertexColors"==C)if("face"==o.parameters[C])o.parameters[C]=THREE.FaceColors;else if(o.parameters[C])o.parameters[C]=THREE.VertexColors;if(void 0!==o.parameters.opacity&&1>o.parameters.opacity)o.parameters.transparent=!0;if(o.parameters.normalMap){a=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(a.uniforms);m=o.parameters.color;H=o.parameters.specular;
+c=o.parameters.ambient;x=o.parameters.shininess;k.tNormal.texture=E.textures[o.parameters.normalMap];if(o.parameters.normalMapFactor)k.uNormalScale.value=o.parameters.normalMapFactor;if(o.parameters.map)k.tDiffuse.texture=o.parameters.map,k.enableDiffuse.value=!0;if(o.parameters.lightMap)k.tAO.texture=o.parameters.lightMap,k.enableAO.value=!0;if(o.parameters.specularMap)k.tSpecular.texture=E.textures[o.parameters.specularMap],k.enableSpecular.value=!0;k.uDiffuseColor.value.setHex(m);k.uSpecularColor.value.setHex(H);
+k.uAmbientColor.value.setHex(c);k.uShininess.value=x;if(o.parameters.opacity)k.uOpacity.value=o.parameters.opacity;I=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:k,lights:!0,fog:!0})}else I=new THREE[o.type](o.parameters);E.materials[q]=I}f();i.callbackSync(E);h()};THREE.UTF8Loader=function(){};
 THREE.UTF8Loader.prototype.load=function(a,b,c){var d=new XMLHttpRequest,f=void 0!==c.scale?c.scale:1,e=void 0!==c.offsetX?c.offsetX:0,g=void 0!==c.offsetY?c.offsetY:0,h=void 0!==c.offsetZ?c.offsetZ:0;d.onreadystatechange=function(){4==d.readyState?200==d.status||0==d.status?THREE.UTF8Loader.prototype.createModel(d.responseText,b,f,e,g,h):console.error("THREE.UTF8Loader: Couldn't load ["+a+"] ["+d.status+"]"):3!=d.readyState&&2==d.readyState&&d.getResponseHeader("Content-Length")};d.open("GET",a,
 !0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);57344<=b&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,f=0;8>f;f++){for(var e=0,g=0;g<b;++g){var h=a.charCodeAt(g+d),e=e+(h>>1^-(h&1));c[8*g+f]=e}d+=b}b=a.length-d;e=new Uint16Array(b);for(f=g=0;f<b;f++)h=a.charCodeAt(f+d),e[f]=g-h,0==h&&g++;return[c,e]};
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,f,e){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],i=[];(function(a,g,i){for(var j,k,r,q=a.length;i<q;i+=g)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+=f,r+=e,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,r)))})(g[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,i.push(d,1-e)})(g[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)})(g[0],8,5);(function(a){var c,d,e,f,g,j,t,s,u,v=a.length;for(c=0;c<v;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;s=d;u=e;j=f;var w=k[3*e],z=k[3*e+1],y=k[3*e+2],A=k[3*f],D=k[3*f+1],I=k[3*f+2];t=new THREE.Vector3(k[3*d],k[3*d+1],k[3*d+2]);w=new THREE.Vector3(w,z,y);A=new THREE.Vector3(A,D,I);g.faces.push(new THREE.Face3(s,u,j,[t,w,A],null,0));g=i[2*d];d=i[2*d+1];j=i[2*e];t=i[2*e+1];s=i[2*
-f];u=i[2*f+1];f=b.faceVertexUvs[0];e=j;j=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,j));t.push(new THREE.UV(s,u));f.push(t)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};
-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(3*this.size3);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(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,f){return a+(b-a)*f};this.VIntX=function(a,b,f,e,g,h,j,k,i,o){g=(g-i)/(o-i);i=this.normal_cache;b[e]=h+g*this.delta;b[e+1]=j;b[e+2]=k;f[e]=this.lerp(i[a],i[a+3],g);f[e+1]=this.lerp(i[a+1],i[a+4],g);f[e+2]=this.lerp(i[a+2],i[a+5],g)};this.VIntY=function(a,b,f,e,g,h,j,k,i,o){g=(g-i)/(o-i);i=this.normal_cache;b[e]=h;b[e+1]=j+g*this.delta;b[e+2]=k;b=a+3*this.yd;
-f[e]=this.lerp(i[a],i[b],g);f[e+1]=this.lerp(i[a+1],i[b+1],g);f[e+2]=this.lerp(i[a+2],i[b+2],g)};this.VIntZ=function(a,b,f,e,g,h,j,k,i,o){g=(g-i)/(o-i);i=this.normal_cache;b[e]=h;b[e+1]=j;b[e+2]=k+g*this.delta;b=a+3*this.zd;f[e]=this.lerp(i[a],i[b],g);f[e+1]=this.lerp(i[a+1],i[b+1],g);f[e+2]=this.lerp(i[a+2],i[b+2],g)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(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,f,e,g,h){var j=e+1,k=e+this.yd,i=e+this.zd,o=j+this.yd,l=j+this.zd,n=e+this.yd+this.zd,p=j+this.yd+this.zd,m=0,r=this.field[e],q=this.field[j],t=this.field[k],s=this.field[o],u=this.field[i],v=this.field[l],w=this.field[n],z=this.field[p];r<g&&(m|=1);q<g&&(m|=2);t<g&&(m|=8);s<g&&(m|=4);u<g&&(m|=16);v<g&&(m|=32);w<g&&(m|=128);z<g&&(m|=64);var y=THREE.edgeTable[m];if(0===y)return 0;var A=this.delta,D=a+
-A,I=b+A,A=f+A;y&1&&(this.compNorm(e),this.compNorm(j),this.VIntX(3*e,this.vlist,this.nlist,0,g,a,b,f,r,q));y&2&&(this.compNorm(j),this.compNorm(o),this.VIntY(3*j,this.vlist,this.nlist,3,g,D,b,f,q,s));y&4&&(this.compNorm(k),this.compNorm(o),this.VIntX(3*k,this.vlist,this.nlist,6,g,a,I,f,t,s));y&8&&(this.compNorm(e),this.compNorm(k),this.VIntY(3*e,this.vlist,this.nlist,9,g,a,b,f,r,t));y&16&&(this.compNorm(i),this.compNorm(l),this.VIntX(3*i,this.vlist,this.nlist,12,g,a,b,A,u,v));y&32&&(this.compNorm(l),
-this.compNorm(p),this.VIntY(3*l,this.vlist,this.nlist,15,g,D,b,A,v,z));y&64&&(this.compNorm(n),this.compNorm(p),this.VIntX(3*n,this.vlist,this.nlist,18,g,a,I,A,w,z));y&128&&(this.compNorm(i),this.compNorm(n),this.VIntY(3*i,this.vlist,this.nlist,21,g,a,b,A,u,w));y&256&&(this.compNorm(e),this.compNorm(i),this.VIntZ(3*e,this.vlist,this.nlist,24,g,a,b,f,r,u));y&512&&(this.compNorm(j),this.compNorm(l),this.VIntZ(3*j,this.vlist,this.nlist,27,g,D,b,f,q,v));y&1024&&(this.compNorm(o),this.compNorm(p),this.VIntZ(3*
-o,this.vlist,this.nlist,30,g,D,I,f,s,z));y&2048&&(this.compNorm(k),this.compNorm(n),this.VIntZ(3*k,this.vlist,this.nlist,33,g,a,I,f,t,w));m<<=4;for(g=e=0;-1!=THREE.triTable[m+g];)a=m+g,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],h),g+=3,e++;return e};this.posnormtriv=function(a,b,f,e,g,h){var j=3*this.count;this.positionArray[j]=a[f];this.positionArray[j+1]=a[f+1];this.positionArray[j+2]=a[f+2];this.positionArray[j+3]=a[e];this.positionArray[j+
-4]=a[e+1];this.positionArray[j+5]=a[e+2];this.positionArray[j+6]=a[g];this.positionArray[j+7]=a[g+1];this.positionArray[j+8]=a[g+2];this.normalArray[j]=b[f];this.normalArray[j+1]=b[f+1];this.normalArray[j+2]=b[f+2];this.normalArray[j+3]=b[e];this.normalArray[j+4]=b[e+1];this.normalArray[j+5]=b[e+2];this.normalArray[j+6]=b[g];this.normalArray[j+7]=b[g+1];this.normalArray[j+8]=b[g+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(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,f,e,g){var h=this.size*Math.sqrt(e/g),j=f*this.size,k=b*this.size,i=a*this.size,o=Math.floor(j-h);1>o&&(o=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var l=Math.floor(k-h);1>l&&(l=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var n=Math.floor(i-h);1>n&&(n=1);h=Math.floor(i+h);h>this.size-1&&(h=this.size-
-1);for(var p,m,r,q,t,s,u,i=o;i<j;i++){r=this.size2*i;t=i/this.size-f;s=t*t;for(o=l;o<k;o++){m=r+this.size*o;p=o/this.size-b;u=p*p;for(p=n;p<h;p++)q=p/this.size-a,q=e/(1.0E-6+q*q+u+s)-g,0<q&&(this.field[m+p]+=q)}}};this.addPlaneX=function(a,b){var f,e,g,h,j,k=this.size,i=this.yd,o=this.zd,l=this.field,n=k*Math.sqrt(a/b);n>k&&(n=k);for(f=0;f<n;f++)if(e=f/k,e*=e,h=a/(1.0E-4+e)-b,0<h)for(e=0;e<k;e++){j=f+e*i;for(g=0;g<k;g++)l[o*g+j]+=h}};this.addPlaneY=function(a,b){var f,e,g,h,j,k,i=this.size,o=this.yd,
-l=this.zd,n=this.field,p=i*Math.sqrt(a/b);p>i&&(p=i);for(e=0;e<p;e++)if(f=e/i,f*=f,h=a/(1.0E-4+f)-b,0<h){j=e*o;for(f=0;f<i;f++){k=j+f;for(g=0;g<i;g++)n[l*g+k]+=h}}};this.addPlaneZ=function(a,b){var f,e,g,h,j,k,i=this.size,o=this.yd,l=this.zd,n=this.field,p=i*Math.sqrt(a/b);p>i&&(p=i);for(g=0;g<p;g++)if(f=g/i,f*=f,h=a/(1.0E-4+f)-b,0<h){j=l*g;for(e=0;e<i;e++){k=j+e*o;for(f=0;f<i;f++)n[k+f]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
-function(a){this.begin();var b,f,e,g,h,j,k,i,o,l=this.size-2;for(g=1;g<l;g++){o=this.size2*g;k=(g-this.halfsize)/this.halfsize;for(e=1;e<l;e++){i=o+this.size*e;j=(e-this.halfsize)/this.halfsize;for(f=1;f<l;f++)h=(f-this.halfsize)/this.halfsize,b=i+f,this.polygonize(h,j,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,f=[];this.render(function(e){var g,h,j,k,i,o,l,n;for(g=0;g<e.count;g++)l=3*g,i=l+1,n=l+2,h=e.positionArray[l],j=e.positionArray[i],k=
-e.positionArray[n],o=new THREE.Vector3(h,j,k),h=e.normalArray[l],j=e.normalArray[i],k=e.normalArray[n],l=new THREE.Vector3(h,j,k),l.normalize(),i=new THREE.Vertex(o),b.vertices.push(i),f.push(l);o=e.count/3;for(g=0;g<o;g++)l=3*(a+g),i=l+1,n=l+2,h=f[l],j=f[i],k=f[n],l=new THREE.Face3(l,i,n,[h,j,k]),b.faces.push(l);a+=o;e.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]);
-THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,
--1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,
-8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,
--1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,
-5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,
--1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,
-10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,
-6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,
-8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,
-2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,
--1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,
--1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,
--1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,
--1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,
-2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,
-4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.LensFlare=function(a,b,c,d,f){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,f)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;
-THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;THREE.LensFlare.prototype.add=function(a,b,c,d,f,e){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===e&&(e=1);void 0===f&&(f=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:e,color:f,blending:d})};
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,f,e){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,g,i){for(var j,k,o,p=a.length;i<p;i+=g)j=a[i],k=a[i+1],o=a[i+2],j=j/16383*c,k=k/16383*c,o=o/16383*c,j+=d,k+=f,o+=e,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,o)))})(g[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)})(g[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)})(g[0],8,5);(function(a){var c,d,e,f,g,i,t,s,u,v=a.length;for(c=0;c<v;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;s=d;u=e;i=f;var w=j[3*e],A=j[3*e+1],B=j[3*e+2],C=j[3*f],F=j[3*f+1],I=j[3*f+2];t=new THREE.Vector3(j[3*d],j[3*d+1],j[3*d+2]);w=new THREE.Vector3(w,A,B);C=new THREE.Vector3(C,F,I);g.faces.push(new THREE.Face3(s,u,i,[t,w,C],null,0));g=k[2*d];d=k[2*d+1];i=k[2*e];t=k[2*e+1];s=k[2*
+f];u=k[2*f+1];f=b.faceVertexUvs[0];e=i;i=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,i));t.push(new THREE.UV(s,u));f.push(t)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=new THREE.Object3D;THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject;
+THREE.LensFlare=function(a,b,c,d,f){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,f)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
+THREE.LensFlare.prototype.add=function(a,b,c,d,f,e){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===e&&(e=1);void 0===f&&(f=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:e,color:f,blending:d})};
 THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,f=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+f*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
 THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=new THREE.Mesh;THREE.MorphBlendMesh.prototype.constructor=THREE.MorphBlendMesh;
 THREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[a]=b;this.animationsList.push(b)};
-THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},f=this.geometry,e=0,g=f.morphTargets.length;e<g;e++){var h=f.morphTargets[e].name.match(b);if(h&&1<h.length){var j=h[1];d[j]||(d[j]={start:Infinity,end:-Infinity});h=d[j];if(e<h.start)h.start=e;if(e>h.end)h.end=e;c||(c=j)}}for(j in d)h=d[j],this.createAnimation(j,h.start,h.end,a);this.firstAnimation=c};
+THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)(\d+)/,c,d={},f=this.geometry,e=0,g=f.morphTargets.length;e<g;e++){var h=f.morphTargets[e].name.match(b);if(h&&1<h.length){var i=h[1];d[i]||(d[i]={start:Infinity,end:-Infinity});h=d[i];if(e<h.start)h.start=e;if(e>h.end)h.end=e;c||(c=i)}}for(i in d)h=d[i],this.createAnimation(i,h.start,h.end,a);this.firstAnimation=c};
 THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a])a.direction=1,a.directionBackwards=!1};THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a])a.direction=-1,a.directionBackwards=!0};THREE.MorphBlendMesh.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];if(c)c.fps=b,c.duration=(c.end-c.start)/c.fps};
 THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];if(c)c.duration=b,c.fps=(c.end-c.start)/c.duration};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];if(c)c.weight=b};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];if(c)c.time=b};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};
 THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};
 THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var f=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time){d.direction*=-1;if(d.time>d.duration)d.time=d.duration,d.directionBackwards=!0;if(0>d.time)d.time=0,d.directionBackwards=!1}}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var e=d.startFrame+THREE.Math.clamp(Math.floor(d.time/f),0,d.length-1),g=d.weight;
 if(e!==d.currentFrame)this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[e]=0,d.lastFrame=d.currentFrame,d.currentFrame=e;f=d.time%f/f;d.directionBackwards&&(f=1-f);this.morphTargetInfluences[d.currentFrame]=f*g;this.morphTargetInfluences[d.lastFrame]=(1-f)*g}}};
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,f,e,g,h,j,k,i,o,l,n;this.init=function(p){b=p.context;c=p;d=new Float32Array(16);f=new Uint16Array(6);p=0;d[p++]=-1;d[p++]=-1;d[p++]=0;d[p++]=0;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]=
-0;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]=0;d[p++]=1;p=0;f[p++]=0;f[p++]=1;f[p++]=2;f[p++]=0;f[p++]=2;f[p++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);h=b.createTexture();j=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);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,j);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);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(k=!1,i=a(THREE.ShaderFlares.lensFlare)):(k=!0,i=a(THREE.ShaderFlares.lensFlareVertexTexture));o={};l={};o.vertex=b.getAttribLocation(i,"position");o.uv=b.getAttribLocation(i,"uv");l.renderType=b.getUniformLocation(i,"renderType");l.map=b.getUniformLocation(i,"map");l.occlusionMap=b.getUniformLocation(i,"occlusionMap");l.opacity=b.getUniformLocation(i,"opacity");l.color=b.getUniformLocation(i,
-"color");l.scale=b.getUniformLocation(i,"scale");l.rotation=b.getUniformLocation(i,"rotation");l.screenPosition=b.getUniformLocation(i,"screenPosition");n=!1};this.render=function(a,d,f,q){var a=a.__webglFlares,t=a.length;if(t){var s=new THREE.Vector3,u=q/f,v=0.5*f,w=0.5*q,z=16/q,y=new THREE.Vector2(z*u,z),A=new THREE.Vector3(1,1,0),D=new THREE.Vector2(1,1),I=l,z=o;b.useProgram(i);n||(b.enableVertexAttribArray(o.vertex),b.enableVertexAttribArray(o.uv),n=!0);b.uniform1i(I.occlusionMap,0);b.uniform1i(I.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(z.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var J,H,C,x,E;for(J=0;J<t;J++)if(z=16/q,y.set(z*u,z),x=a[J],s.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(s),d.projectionMatrix.multiplyVector3(s),A.copy(s),D.x=A.x*v+v,D.y=A.y*w+w,k||0<D.x&&D.x<f&&0<D.y&&D.y<q){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
-h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,D.x-8,D.y-8,16,16,0);b.uniform1i(I.renderType,0);b.uniform2f(I.scale,y.x,y.y);b.uniform3f(I.screenPosition,A.x,A.y,A.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,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,D.x-8,D.y-8,16,16,0);b.uniform1i(I.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
-6,b.UNSIGNED_SHORT,0);x.positionScreen.copy(A);x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);for(H=0,C=x.lensFlares.length;H<C;H++)if(E=x.lensFlares[H],0.0010<E.opacity&&0.0010<E.scale)A.x=E.x,A.y=E.y,A.z=E.z,z=E.size*E.scale/q,y.x=z*u,y.y=z,b.uniform3f(I.screenPosition,A.x,A.y,A.z),b.uniform2f(I.scale,y.x,y.y),b.uniform1f(I.rotation,E.rotation),b.uniform1f(I.opacity,E.opacity),b.uniform3f(I.color,E.color.r,E.color.g,E.color.b),
-c.setBlending(E.blending),c.setTexture(E.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.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,f,e,g,h,i,j,k,q,l,n;this.init=function(r){b=r.context;c=r;d=new Float32Array(16);f=new Uint16Array(6);r=0;d[r++]=-1;d[r++]=-1;d[r++]=0;d[r++]=0;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=
+0;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=1;d[r++]=-1;d[r++]=1;d[r++]=0;d[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);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,i);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);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(j=!1,k=a(THREE.ShaderFlares.lensFlare)):(j=!0,k=a(THREE.ShaderFlares.lensFlareVertexTexture));q={};l={};q.vertex=b.getAttribLocation(k,"position");q.uv=b.getAttribLocation(k,"uv");l.renderType=b.getUniformLocation(k,"renderType");l.map=b.getUniformLocation(k,"map");l.occlusionMap=b.getUniformLocation(k,"occlusionMap");l.opacity=b.getUniformLocation(k,"opacity");l.color=b.getUniformLocation(k,
+"color");l.scale=b.getUniformLocation(k,"scale");l.rotation=b.getUniformLocation(k,"rotation");l.screenPosition=b.getUniformLocation(k,"screenPosition");n=!1};this.render=function(a,d,f,p){var a=a.__webglFlares,t=a.length;if(t){var s=new THREE.Vector3,u=p/f,v=0.5*f,w=0.5*p,A=16/p,B=new THREE.Vector2(A*u,A),C=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),I=l,A=q;b.useProgram(k);n||(b.enableVertexAttribArray(q.vertex),b.enableVertexAttribArray(q.uv),n=!0);b.uniform1i(I.occlusionMap,0);b.uniform1i(I.map,
+1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(A.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(A.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var J,H,z,x,D;for(J=0;J<t;J++)if(A=16/p,B.set(A*u,A),x=a[J],s.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(s),d.projectionMatrix.multiplyVector3(s),C.copy(s),F.x=C.x*v+v,F.y=C.y*w+w,j||0<F.x&&F.x<f&&0<F.y&&F.y<p){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
+h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,F.x-8,F.y-8,16,16,0);b.uniform1i(I.renderType,0);b.uniform2f(I.scale,B.x,B.y);b.uniform3f(I.screenPosition,C.x,C.y,C.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,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,F.x-8,F.y-8,16,16,0);b.uniform1i(I.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
+6,b.UNSIGNED_SHORT,0);x.positionScreen.copy(C);x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);for(H=0,z=x.lensFlares.length;H<z;H++)if(D=x.lensFlares[H],0.0010<D.opacity&&0.0010<D.scale)C.x=D.x,C.y=D.y,C.z=D.z,A=D.size*D.scale/p,B.x=A*u,B.y=A,b.uniform3f(I.screenPosition,C.x,C.y,C.z),b.uniform2f(I.scale,B.x,B.y),b.uniform1f(I.rotation,D.rotation),b.uniform1f(I.opacity,D.opacity),b.uniform3f(I.color,D.color.r,D.color.g,D.color.b),
+c.setBlending(D.blending),c.setTexture(D.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.ShadowMapPlugin=function(){var a,b,c,d,f=new THREE.Frustum,e=new THREE.Matrix4,g=new THREE.Vector3,h=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
-c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(j,k){var i,o,l,n,p,m,r,q,t,s=[];n=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(i=0,o=j.__lights.length;i<o;i++)if(l=j.__lights[i],l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(p=0;p<l.shadowCascadeCount;p++){var u;if(l.shadowCascadeArray[p])u=l.shadowCascadeArray[p];else{t=l;r=p;u=new THREE.DirectionalLight;u.isVirtual=
-!0;u.onlyShadow=!0;u.castShadow=!0;u.shadowCameraNear=t.shadowCameraNear;u.shadowCameraFar=t.shadowCameraFar;u.shadowCameraLeft=t.shadowCameraLeft;u.shadowCameraRight=t.shadowCameraRight;u.shadowCameraBottom=t.shadowCameraBottom;u.shadowCameraTop=t.shadowCameraTop;u.shadowCameraVisible=t.shadowCameraVisible;u.shadowDarkness=t.shadowDarkness;u.shadowBias=t.shadowCascadeBias[r];u.shadowMapWidth=t.shadowCascadeWidth[r];u.shadowMapHeight=t.shadowCascadeHeight[r];u.pointsWorld=[];u.pointsFrustum=[];q=
-u.pointsWorld;m=u.pointsFrustum;for(var v=0;8>v;v++)q[v]=new THREE.Vector3,m[v]=new THREE.Vector3;q=t.shadowCascadeNearZ[r];t=t.shadowCascadeFarZ[r];m[0].set(-1,-1,q);m[1].set(1,-1,q);m[2].set(-1,1,q);m[3].set(1,1,q);m[4].set(-1,-1,t);m[5].set(1,-1,t);m[6].set(-1,1,t);m[7].set(1,1,t);u.originalCamera=k;m=new THREE.Gyroscope;m.position=l.shadowCascadeOffset;m.add(u);m.add(u.target);k.add(m);l.shadowCascadeArray[p]=u;console.log("Created virtualLight",u)}r=l;q=p;t=r.shadowCascadeArray[q];t.position.copy(r.position);
-t.target.position.copy(r.target.position);t.lookAt(t.target);t.shadowCameraVisible=r.shadowCameraVisible;t.shadowDarkness=r.shadowDarkness;t.shadowBias=r.shadowCascadeBias[q];m=r.shadowCascadeNearZ[q];r=r.shadowCascadeFarZ[q];t=t.pointsFrustum;t[0].z=m;t[1].z=m;t[2].z=m;t[3].z=m;t[4].z=r;t[5].z=r;t[6].z=r;t[7].z=r;s[n]=u;n++}else s[n]=l,n++;for(i=0,o=s.length;i<o;i++){l=s[i];if(!l.shadowMap)l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,l.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
+c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,j){var k,q,l,n,r,m,o,p,t,s=[];n=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(k=0,q=i.__lights.length;k<q;k++)if(l=i.__lights[k],l.castShadow)if(l instanceof THREE.DirectionalLight&&l.shadowCascade)for(r=0;r<l.shadowCascadeCount;r++){var u;if(l.shadowCascadeArray[r])u=l.shadowCascadeArray[r];else{t=l;o=r;u=new THREE.DirectionalLight;u.isVirtual=
+!0;u.onlyShadow=!0;u.castShadow=!0;u.shadowCameraNear=t.shadowCameraNear;u.shadowCameraFar=t.shadowCameraFar;u.shadowCameraLeft=t.shadowCameraLeft;u.shadowCameraRight=t.shadowCameraRight;u.shadowCameraBottom=t.shadowCameraBottom;u.shadowCameraTop=t.shadowCameraTop;u.shadowCameraVisible=t.shadowCameraVisible;u.shadowDarkness=t.shadowDarkness;u.shadowBias=t.shadowCascadeBias[o];u.shadowMapWidth=t.shadowCascadeWidth[o];u.shadowMapHeight=t.shadowCascadeHeight[o];u.pointsWorld=[];u.pointsFrustum=[];p=
+u.pointsWorld;m=u.pointsFrustum;for(var v=0;8>v;v++)p[v]=new THREE.Vector3,m[v]=new THREE.Vector3;p=t.shadowCascadeNearZ[o];t=t.shadowCascadeFarZ[o];m[0].set(-1,-1,p);m[1].set(1,-1,p);m[2].set(-1,1,p);m[3].set(1,1,p);m[4].set(-1,-1,t);m[5].set(1,-1,t);m[6].set(-1,1,t);m[7].set(1,1,t);u.originalCamera=j;m=new THREE.Gyroscope;m.position=l.shadowCascadeOffset;m.add(u);m.add(u.target);j.add(m);l.shadowCascadeArray[r]=u;console.log("Created virtualLight",u)}o=l;p=r;t=o.shadowCascadeArray[p];t.position.copy(o.position);
+t.target.position.copy(o.target.position);t.lookAt(t.target);t.shadowCameraVisible=o.shadowCameraVisible;t.shadowDarkness=o.shadowDarkness;t.shadowBias=o.shadowCascadeBias[p];m=o.shadowCascadeNearZ[p];o=o.shadowCascadeFarZ[p];t=t.pointsFrustum;t[0].z=m;t[1].z=m;t[2].z=m;t[3].z=m;t[4].z=o;t[5].z=o;t[6].z=o;t[7].z=o;s[n]=u;n++}else s[n]=l,n++;for(k=0,q=s.length;k<q;k++){l=s[k];if(!l.shadowMap)l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,l.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
 format:THREE.RGBAFormat}),l.shadowMapSize=new THREE.Vector2(l.shadowMapWidth,l.shadowMapHeight),l.shadowMatrix=new THREE.Matrix4;if(!l.shadowCamera){if(l instanceof THREE.SpotLight)l.shadowCamera=new THREE.PerspectiveCamera(l.shadowCameraFov,l.shadowMapWidth/l.shadowMapHeight,l.shadowCameraNear,l.shadowCameraFar);else if(l instanceof THREE.DirectionalLight)l.shadowCamera=new THREE.OrthographicCamera(l.shadowCameraLeft,l.shadowCameraRight,l.shadowCameraTop,l.shadowCameraBottom,l.shadowCameraNear,l.shadowCameraFar);
-else{console.error("Unsupported light type for shadow");continue}j.add(l.shadowCamera);b.autoUpdateScene&&j.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper)l.cameraHelper=new THREE.CameraHelper(l.shadowCamera),l.shadowCamera.add(l.cameraHelper);if(l.isVirtual&&u.originalCamera==k){p=k;n=l.shadowCamera;m=l.pointsFrustum;t=l.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(r=0;8>r;r++){q=t[r];q.copy(m[r]);THREE.ShadowMapPlugin.__projector.unprojectVector(q,
-p);n.matrixWorldInverse.multiplyVector3(q);if(q.x<g.x)g.x=q.x;if(q.x>h.x)h.x=q.x;if(q.y<g.y)g.y=q.y;if(q.y>h.y)h.y=q.y;if(q.z<g.z)g.z=q.z;if(q.z>h.z)h.z=q.z}n.left=g.x;n.right=h.x;n.top=h.y;n.bottom=g.y;n.updateProjectionMatrix()}n=l.shadowMap;m=l.shadowMatrix;p=l.shadowCamera;p.position.copy(l.matrixWorld.getPosition());p.lookAt(l.target.matrixWorld.getPosition());p.updateMatrixWorld();p.matrixWorldInverse.getInverse(p.matrixWorld);if(l.cameraHelper)l.cameraHelper.lines.visible=l.shadowCameraVisible;
-l.shadowCameraVisible&&l.cameraHelper.update();m.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);m.multiplySelf(p.projectionMatrix);m.multiplySelf(p.matrixWorldInverse);if(!p._viewMatrixArray)p._viewMatrixArray=new Float32Array(16);if(!p._projectionMatrixArray)p._projectionMatrixArray=new Float32Array(16);p.matrixWorldInverse.flattenToArray(p._viewMatrixArray);p.projectionMatrix.flattenToArray(p._projectionMatrixArray);e.multiply(p.projectionMatrix,p.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(n);
-b.clear();t=j.__webglObjects;for(l=0,n=t.length;l<n;l++)if(r=t[l],m=r.object,r.render=!1,m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||f.contains(m)))m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(p.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),r.render=!0;for(l=0,n=t.length;l<n;l++)if(r=t[l],r.render)m=r.object,r=r.buffer,b.setObjectFaces(m),q=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:
-c,r instanceof THREE.BufferGeometry?b.renderBufferDirect(p,j.__lights,null,q,r,m):b.renderBuffer(p,j.__lights,null,q,r,m);t=j.__webglObjectsImmediate;for(l=0,n=t.length;l<n;l++)r=t[l],m=r.object,m.visible&&m.castShadow&&(m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(p.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),b.renderImmediateObject(p,j.__lights,null,c,m))}i=b.getClearColor();o=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,o);
+else{console.error("Unsupported light type for shadow");continue}i.add(l.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(l.shadowCameraVisible&&!l.cameraHelper)l.cameraHelper=new THREE.CameraHelper(l.shadowCamera),l.shadowCamera.add(l.cameraHelper);if(l.isVirtual&&u.originalCamera==j){r=j;n=l.shadowCamera;m=l.pointsFrustum;t=l.pointsWorld;g.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(o=0;8>o;o++){p=t[o];p.copy(m[o]);THREE.ShadowMapPlugin.__projector.unprojectVector(p,
+r);n.matrixWorldInverse.multiplyVector3(p);if(p.x<g.x)g.x=p.x;if(p.x>h.x)h.x=p.x;if(p.y<g.y)g.y=p.y;if(p.y>h.y)h.y=p.y;if(p.z<g.z)g.z=p.z;if(p.z>h.z)h.z=p.z}n.left=g.x;n.right=h.x;n.top=h.y;n.bottom=g.y;n.updateProjectionMatrix()}n=l.shadowMap;m=l.shadowMatrix;r=l.shadowCamera;r.position.copy(l.matrixWorld.getPosition());r.lookAt(l.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);if(l.cameraHelper)l.cameraHelper.lines.visible=l.shadowCameraVisible;
+l.shadowCameraVisible&&l.cameraHelper.update();m.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);m.multiplySelf(r.projectionMatrix);m.multiplySelf(r.matrixWorldInverse);if(!r._viewMatrixArray)r._viewMatrixArray=new Float32Array(16);if(!r._projectionMatrixArray)r._projectionMatrixArray=new Float32Array(16);r.matrixWorldInverse.flattenToArray(r._viewMatrixArray);r.projectionMatrix.flattenToArray(r._projectionMatrixArray);e.multiply(r.projectionMatrix,r.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(n);
+b.clear();t=i.__webglObjects;for(l=0,n=t.length;l<n;l++)if(o=t[l],m=o.object,o.render=!1,m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||f.contains(m)))m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),o.render=!0;for(l=0,n=t.length;l<n;l++)if(o=t[l],o.render)m=o.object,o=o.buffer,b.setObjectFaces(m),p=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:
+c,o instanceof THREE.BufferGeometry?b.renderBufferDirect(r,i.__lights,null,p,o,m):b.renderBuffer(r,i.__lights,null,p,o,m);t=i.__webglObjectsImmediate;for(l=0,n=t.length;l<n;l++)o=t[l],m=o.object,m.visible&&m.castShadow&&(m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(r.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),b.renderImmediateObject(r,i.__lights,null,c,m))}k=b.getClearColor();q=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,q);
 a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
-THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,f,e,g,h,j,k,i;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);f=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),n=b.createShader(b.FRAGMENT_SHADER),p=b.createShader(b.VERTEX_SHADER);b.shaderSource(n,a.fragmentShader);b.shaderSource(p,a.vertexShader);b.compileShader(n);b.compileShader(p);b.attachShader(l,n);b.attachShader(l,p);b.linkProgram(l);h=l;j={};k={};j.position=b.getAttribLocation(h,"position");j.uv=b.getAttribLocation(h,"uv");k.uvOffset=b.getUniformLocation(h,"uvOffset");k.uvScale=b.getUniformLocation(h,
-"uvScale");k.rotation=b.getUniformLocation(h,"rotation");k.scale=b.getUniformLocation(h,"scale");k.alignment=b.getUniformLocation(h,"alignment");k.color=b.getUniformLocation(h,"color");k.map=b.getUniformLocation(h,"map");k.opacity=b.getUniformLocation(h,"opacity");k.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");k.screenPosition=b.getUniformLocation(h,"screenPosition");k.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
-k.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");i=!1};this.render=function(d,f,n,p){var d=d.__webglSprites,m=d.length;if(m){var r=j,q=k,t=p/n,n=0.5*n,s=0.5*p,u=!0;b.useProgram(h);i||(b.enableVertexAttribArray(r.position),b.enableVertexAttribArray(r.uv),i=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(q.projectionMatrix,
-!1,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(q.map,0);for(var v,w=[],r=0;r<m;r++)if(v=d[r],v.visible&&0!==v.opacity)v.useScreenCoordinates?v.z=-v.position.z:(v._modelViewMatrix.multiplyToArray(f.matrixWorldInverse,v.matrixWorld,v._modelViewMatrixArray),v.z=-v._modelViewMatrix.n34);d.sort(a);for(r=0;r<m;r++)v=d[r],v.visible&&0!==v.opacity&&v.map&&v.map.image&&v.map.image.width&&(v.useScreenCoordinates?(b.uniform1i(q.useScreenCoordinates,1),b.uniform3f(q.screenPosition,(v.position.x-
-n)/n,(s-v.position.y)/s,Math.max(0,Math.min(1,v.position.z)))):(b.uniform1i(q.useScreenCoordinates,0),b.uniform1i(q.affectedByDistance,v.affectedByDistance?1:0),b.uniformMatrix4fv(q.modelViewMatrix,!1,v._modelViewMatrixArray)),f=v.map.image.width/(v.scaleByViewport?p:1),w[0]=f*t*v.scale.x,w[1]=f*v.scale.y,b.uniform2f(q.uvScale,v.uvScale.x,v.uvScale.y),b.uniform2f(q.uvOffset,v.uvOffset.x,v.uvOffset.y),b.uniform2f(q.alignment,v.alignment.x,v.alignment.y),b.uniform1f(q.opacity,v.opacity),b.uniform3f(q.color,
-v.color.r,v.color.g,v.color.b),b.uniform1f(q.rotation,v.rotation),b.uniform2fv(q.scale,w),v.mergeWith3D&&!u?(b.enable(b.DEPTH_TEST),u=!0):!v.mergeWith3D&&u&&(b.disable(b.DEPTH_TEST),u=!1),c.setBlending(v.blending),c.setTexture(v.map,0),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,f,e,g,h,i,j,k;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);f=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),n=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER);b.shaderSource(n,a.fragmentShader);b.shaderSource(r,a.vertexShader);b.compileShader(n);b.compileShader(r);b.attachShader(l,n);b.attachShader(l,r);b.linkProgram(l);h=l;i={};j={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,"uvOffset");j.uvScale=b.getUniformLocation(h,
+"uvScale");j.rotation=b.getUniformLocation(h,"rotation");j.scale=b.getUniformLocation(h,"scale");j.alignment=b.getUniformLocation(h,"alignment");j.color=b.getUniformLocation(h,"color");j.map=b.getUniformLocation(h,"map");j.opacity=b.getUniformLocation(h,"opacity");j.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");j.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");j.screenPosition=b.getUniformLocation(h,"screenPosition");j.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
+j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=!1};this.render=function(d,f,n,r){var d=d.__webglSprites,m=d.length;if(m){var o=i,p=j,t=r/n,n=0.5*n,s=0.5*r,u=!0;b.useProgram(h);k||(b.enableVertexAttribArray(o.position),b.enableVertexAttribArray(o.uv),k=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(o.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(o.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(p.projectionMatrix,
+!1,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(p.map,0);for(var v,w=[],o=0;o<m;o++)if(v=d[o],v.visible&&0!==v.opacity)v.useScreenCoordinates?v.z=-v.position.z:(v._modelViewMatrix.multiplyToArray(f.matrixWorldInverse,v.matrixWorld,v._modelViewMatrixArray),v.z=-v._modelViewMatrix.n34);d.sort(a);for(o=0;o<m;o++)v=d[o],v.visible&&0!==v.opacity&&v.map&&v.map.image&&v.map.image.width&&(v.useScreenCoordinates?(b.uniform1i(p.useScreenCoordinates,1),b.uniform3f(p.screenPosition,(v.position.x-
+n)/n,(s-v.position.y)/s,Math.max(0,Math.min(1,v.position.z)))):(b.uniform1i(p.useScreenCoordinates,0),b.uniform1i(p.affectedByDistance,v.affectedByDistance?1:0),b.uniformMatrix4fv(p.modelViewMatrix,!1,v._modelViewMatrixArray)),f=v.map.image.width/(v.scaleByViewport?r:1),w[0]=f*t*v.scale.x,w[1]=f*v.scale.y,b.uniform2f(p.uvScale,v.uvScale.x,v.uvScale.y),b.uniform2f(p.uvOffset,v.uvOffset.x,v.uvOffset.y),b.uniform2f(p.alignment,v.alignment.x,v.alignment.y),b.uniform1f(p.opacity,v.opacity),b.uniform3f(p.color,
+v.color.r,v.color.g,v.color.b),b.uniform1f(p.rotation,v.rotation),b.uniform2fv(p.scale,w),v.mergeWith3D&&!u?(b.enable(b.DEPTH_TEST),u=!0):!v.mergeWith3D&&u&&(b.disable(b.DEPTH_TEST),u=!1),c.setBlending(v.blending),c.setTexture(v.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,f=new THREE.Frustum,e=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
-b){this.enabled&&this.update(a,b)};this.update=function(g,h){var j,k,i,o,l,n;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);e.multiply(h.projectionMatrix,
-h.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(this.renderTarget);b.clear();n=g.__webglObjects;for(j=0,k=n.length;j<k;j++)if(i=n[j],l=i.object,i.render=!1,l.visible&&(!(l instanceof THREE.Mesh)||!l.frustumCulled||f.contains(l)))l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),i.render=!0;for(j=0,k=n.length;j<k;j++)if(i=n[j],i.render)l=i.object,i=i.buffer,b.setObjectFaces(l),o=l.customDepthMaterial?
-l.customDepthMaterial:l.geometry.morphTargets.length?d:c,i instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,o,i,l):b.renderBuffer(h,g.__lights,null,o,i,l);n=g.__webglObjectsImmediate;for(j=0,k=n.length;j<k;j++)i=n[j],l=i.object,l.visible&&l.castShadow&&(l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),b.renderImmediateObject(h,g.__lights,null,c,l));j=b.getClearColor();
-k=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,k);a.enable(a.BLEND)}};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,f=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,j,k,i,o;f.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},l=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.PerspectiveCamera(53,
-1,1,1E4);p.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:l},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,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;m.add(a);m.add(p);this.setSize=function(a,d){c.call(b,a,d);l.width=a;l.height=d;n.width=a;n.height=d};this.render=function(a,c){a.updateMatrixWorld();if(j!==c.aspect||k!==c.near||i!==c.far||o!==c.fov){j=c.aspect;k=c.near;i=c.far;o=c.fov;var t=c.projectionMatrix.clone(),s=0.5*(125/30),u=s*k/125,v=k*Math.tan(o*Math.PI/360),w;g.n14=s;h.n14=-s;s=-v*j+u;w=v*j+u;t.n11=2*k/(w-s);t.n13=(w+s)/(w-s);f.projectionMatrix.copy(t);
-s=-v*j-u;w=v*j-u;t.n11=2*k/(w-s);t.n13=(w+s)/(w-s);e.projectionMatrix.copy(t)}f.matrixWorld.copy(c.matrixWorld).multiplySelf(h);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,l,!0);e.matrixWorld.copy(c.matrixWorld).multiplySelf(g);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,n,!0);m.updateMatrixWorld();d.call(b,m,p)}};
+b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,j,k,q,l,n;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);e.multiply(h.projectionMatrix,
+h.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(this.renderTarget);b.clear();n=g.__webglObjects;for(i=0,j=n.length;i<j;i++)if(k=n[i],l=k.object,k.render=!1,l.visible&&(!(l instanceof THREE.Mesh)||!l.frustumCulled||f.contains(l)))l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),k.render=!0;for(i=0,j=n.length;i<j;i++)if(k=n[i],k.render)l=k.object,k=k.buffer,b.setObjectFaces(l),q=l.customDepthMaterial?
+l.customDepthMaterial:l.geometry.morphTargets.length?d:c,k instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,q,k,l):b.renderBuffer(h,g.__lights,null,q,k,l);n=g.__webglObjectsImmediate;for(i=0,j=n.length;i<j;i++)k=n[i],l=k.object,l.visible&&l.castShadow&&(l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(h.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),b.renderImmediateObject(h,g.__lights,null,c,l));i=b.getClearColor();
+j=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,j);a.enable(a.BLEND)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,f=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,q;f.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},l=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),r=new THREE.PerspectiveCamera(53,
+1,1,1E4);r.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:l},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,a=new THREE.Mesh(new THREE.PlaneGeometry(2,2),a);a.rotation.x=Math.PI/2;m.add(a);m.add(r);this.setSize=function(a,d){c.call(b,a,d);l.width=a;l.height=d;n.width=a;n.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||j!==c.near||k!==c.far||q!==c.fov){i=c.aspect;j=c.near;k=c.far;q=c.fov;var t=c.projectionMatrix.clone(),s=0.5*(125/30),u=s*j/125,v=j*Math.tan(q*Math.PI/360),w;g.n14=s;h.n14=-s;s=-v*i+u;w=v*i+u;t.n11=2*j/(w-s);t.n13=(w+s)/(w-s);f.projectionMatrix.copy(t);
+s=-v*i-u;w=v*i-u;t.n11=2*j/(w-s);t.n13=(w+s)/(w-s);e.projectionMatrix.copy(t)}f.matrixWorld.copy(c.matrixWorld).multiplySelf(h);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,l,!0);e.matrixWorld.copy(c.matrixWorld).multiplySelf(g);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,n,!0);m.updateMatrixWorld();d.call(b,m,r)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,f,e,g=new THREE.PerspectiveCamera;g.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&&void 0!==a.separation)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);f=a/2;e=d};this.render=function(a,c){this.clear();g.fov=c.fov;g.aspect=0.5*c.aspect;g.near=c.near;g.far=
 c.far;g.updateProjectionMatrix();g.position.copy(c.position);g.target.copy(c.target);g.translateX(b.separation);g.lookAt(g.target);h.projectionMatrix=g.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,f,e);d.call(b,a,g);this.setViewport(f,0,f,e);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:"precision mediump float;\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}"},

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 79 - 79
build/custom/ThreeWebGL.js


+ 16 - 16
src/extras/objects/MarchingCubes.js → examples/js/MarchingCubes.js

@@ -7,7 +7,7 @@
 
 THREE.MarchingCubes = function ( resolution, material ) {
 
-	THREE.Object3D.call( this );
+	THREE.ImmediateRenderObject.call( this );
 
 	this.material = material;
 
@@ -130,7 +130,7 @@ THREE.MarchingCubes = function ( resolution, material ) {
 	// Returns total number of triangles. Fills triangles.
 	// (this is where most of time is spent - it's inner work of O(n3) loop )
 
-	this.polygonize = function( fx, fy, fz, q, isol, render_callback ) {
+	this.polygonize = function( fx, fy, fz, q, isol, renderCallback ) {
 
 		// cache indices
 		var q1 = q + 1,
@@ -288,7 +288,7 @@ THREE.MarchingCubes = function ( resolution, material ) {
 							  3 * THREE.triTable[ o1 ],
 							  3 * THREE.triTable[ o2 ],
 							  3 * THREE.triTable[ o3 ],
-							  render_callback );
+							  renderCallback );
 
 			i += 3;
 			numtris ++;
@@ -303,7 +303,7 @@ THREE.MarchingCubes = function ( resolution, material ) {
 	// Immediate render mode simulator
 	/////////////////////////////////////
 
-	this.posnormtriv = function( pos, norm, o1, o2, o3, render_callback ) {
+	this.posnormtriv = function( pos, norm, o1, o2, o3, renderCallback ) {
 
 		var c = this.count * 3;
 
@@ -338,7 +338,7 @@ THREE.MarchingCubes = function ( resolution, material ) {
 
 		if ( this.count >= this.maxCount - 3 ) {
 
-			render_callback( this );
+			renderCallback( this );
 
 		}
 
@@ -352,15 +352,15 @@ THREE.MarchingCubes = function ( resolution, material ) {
 
 	};
 
-	this.end = function( render_callback ) {
+	this.end = function( renderCallback ) {
 
 		if ( this.count === 0 )
 			return;
 
-		for ( var i = this.count * 3; i < this.positionArray.length; i++ )
+		for ( var i = this.count * 3; i < this.positionArray.length; i ++ )
 			this.positionArray[ i ] = 0.0;
 
-		render_callback( this );
+		renderCallback( this );
 
 	};
 
@@ -551,7 +551,7 @@ THREE.MarchingCubes = function ( resolution, material ) {
 
 		// wipe the normal cache
 
-		for ( i = 0; i < this.size3; i++ ) {
+		for ( i = 0; i < this.size3; i ++ ) {
 
 			this.normal_cache[ i * 3 ] = 0.0;
 			this.field[ i ] = 0.0;
@@ -560,7 +560,7 @@ THREE.MarchingCubes = function ( resolution, material ) {
 
 	};
 
-	this.render = function( render_callback ) {
+	this.render = function( renderCallback ) {
 
 		this.begin();
 
@@ -568,22 +568,22 @@ THREE.MarchingCubes = function ( resolution, material ) {
 
 		var q, x, y, z, fx, fy, fz, y_offset, z_offset, smin2 = this.size - 2;
 
-		for ( z = 1; z < smin2; z++ ) {
+		for ( z = 1; z < smin2; z ++ ) {
 
 			z_offset = this.size2 * z;
 			fz = ( z - this.halfsize ) / this.halfsize; //+ 1
 
-			for ( y = 1; y < smin2; y++ ) {
+			for ( y = 1; y < smin2; y ++ ) {
 
 				y_offset = z_offset + this.size * y;
 				fy = ( y - this.halfsize ) / this.halfsize; //+ 1
 
-				for ( x = 1; x < smin2; x++ ) {
+				for ( x = 1; x < smin2; x ++ ) {
 
 					fx = ( x - this.halfsize ) / this.halfsize; //+ 1
 					q = y_offset + x;
 
-					this.polygonize( fx, fy, fz, q, this.isolation, render_callback );
+					this.polygonize( fx, fy, fz, q, this.isolation, renderCallback );
 
 				}
 
@@ -591,7 +591,7 @@ THREE.MarchingCubes = function ( resolution, material ) {
 
 		}
 
-		this.end( render_callback );
+		this.end( renderCallback );
 
 	};
 
@@ -665,7 +665,7 @@ THREE.MarchingCubes = function ( resolution, material ) {
 
 };
 
-THREE.MarchingCubes.prototype = new THREE.Object3D();
+THREE.MarchingCubes.prototype = new THREE.ImmediateRenderObject();
 THREE.MarchingCubes.prototype.constructor = THREE.MarchingCubes;
 
 

+ 2 - 0
examples/webgl_marching_cubes.html

@@ -56,6 +56,8 @@
 
 	<script src="../build/Three.js"></script>
 
+	<script src="js/MarchingCubes.js"></script>
+
 	<script src="js/ShaderExtras.js"></script>
 	<script src="js/ShaderToon.js"></script>
 

+ 2 - 2
src/renderers/WebGLRenderer.js

@@ -3936,7 +3936,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 				geometry = object.geometry;
 				addBuffer( scene.__webglObjects, geometry, object );
 
-			} else if ( THREE.MarchingCubes !== undefined && object instanceof THREE.MarchingCubes || object.immediateRenderCallback ) {
+			} else if ( object instanceof THREE.ImmediateRenderObject || object.immediateRenderCallback ) {
 
 				addBufferImmediate( scene.__webglObjectsImmediate, object );
 
@@ -4135,7 +4135,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			removeInstancesDirect( scene.__webglFlares, object );
 
-		} else if ( object instanceof THREE.MarchingCubes || object.immediateRenderCallback ) {
+		} else if ( object instanceof THREE.ImmediateRenderObject || object.immediateRenderCallback ) {
 
 			removeInstances( scene.__webglObjectsImmediate, object );
 

+ 2 - 2
utils/build.py

@@ -131,7 +131,7 @@ EXTRAS_FILES = [
 'extras/loaders/JSONLoader.js',
 'extras/loaders/SceneLoader.js',
 'extras/loaders/UTF8Loader.js',
-'extras/objects/MarchingCubes.js',
+'extras/objects/ImmediateRenderObject.js',
 'extras/objects/LensFlare.js',
 'extras/objects/MorphBlendMesh.js',
 'extras/renderers/plugins/LensFlarePlugin.js',
@@ -364,7 +364,7 @@ WEBGL_FILES = [
 'extras/core/Gyroscope.js',
 'extras/helpers/CameraHelper.js',
 'extras/objects/LensFlare.js',
-'extras/objects/MarchingCubes.js',
+'extras/objects/ImmediateRenderObject.js',
 'extras/renderers/plugins/LensFlarePlugin.js',
 'extras/renderers/plugins/ShadowMapPlugin.js',
 'extras/renderers/plugins/SpritePlugin.js',

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels