Răsfoiți Sursa

Merge remote-tracking branch 'remotes/mrdoob/dev' into dev

Animation / skinning / path controller are now broken :/
alteredq 13 ani în urmă
părinte
comite
655b1efbde

+ 396 - 382
build/Three.js

@@ -17,62 +17,66 @@ this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};
-THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);r=o.dot(b);if(r<=0)return null;n=p.add(a,m.copy(b).multiplyScalar(r));return q=c.distanceTo(n)}function d(a,b,c,d){o.sub(d,b);p.sub(c,b);m.sub(a,b);s=o.dot(o);u=o.dot(p);t=o.dot(m);y=p.dot(p);A=p.dot(m);D=1/(s*y-u*u);F=(y*t-u*A)*D;H=(s*A-u*t)*D;return F>=0&&H>=0&&F+H<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,
-c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var e=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector3,j=new THREE.Vector3;this.intersectObject=function(m){for(var n,r=[],o=0,p=m.children.length;o<p;o++)Array.prototype.push.apply(r,this.intersectObject(m.children[o]));if(m instanceof THREE.Particle){o=
-c(this.origin,this.direction,m.matrixWorld.getPosition());if(o===null||o>m.scale.x)return[];n={distance:o,point:m.position,face:null,object:m};r.push(n)}else if(m instanceof THREE.Mesh){o=c(this.origin,this.direction,m.matrixWorld.getPosition());if(o===null||o>m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)))return r;var q,s=m.geometry,u=s.vertices,t;m.matrixRotationWorld.extractRotation(m.matrixWorld);o=0;for(p=s.faces.length;o<p;o++)if(n=s.faces[o],a.copy(this.origin),
-b.copy(this.direction),t=m.matrixWorld,i=t.multiplyVector3(i.copy(n.centroid)).subSelf(a),q=i.dot(b),!(q<=0)&&(e=t.multiplyVector3(e.copy(u[n.a].position)),g=t.multiplyVector3(g.copy(u[n.b].position)),f=t.multiplyVector3(f.copy(u[n.c].position)),n instanceof THREE.Face4&&(h=t.multiplyVector3(h.copy(u[n.d].position))),l=m.matrixRotationWorld.multiplyVector3(l.copy(n.normal)),q=b.dot(l),m.doubleSided||(m.flipSided?q>0:q<0)))if(q=l.dot(i.sub(e,a))/q,j.add(a,b.multiplyScalar(q)),n instanceof THREE.Face3)d(j,
-e,g,f)&&(n={distance:a.distanceTo(j),point:j.clone(),face:n,object:m},r.push(n));else if(n instanceof THREE.Face4&&(d(j,e,g,h)||d(j,g,f,h)))n={distance:a.distanceTo(j),point:j.clone(),face:n,object:m},r.push(n)}return r};var o=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,r,n,q,s,u,t,y,A,D,F,H};
-THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(g,f,j,o){h=!1;b=g;c=f;d=j;e=o;a()};this.addPoint=function(g,f){h?(h=!1,b=g,c=f,d=g,e=f):(b=b<g?b:g,c=c<f?c:f,d=d>g?d:g,e=e>f?e:f);a()};this.add3Points=
-function(g,f,j,o,p,m){h?(h=!1,b=g<j?g<p?g:p:j<p?j:p,c=f<o?f<m?f:m:o<m?o:m,d=g>j?g>p?g:p:j>p?j:p,e=f>o?f>m?f:m:o>m?o:m):(b=g<j?g<p?g<b?g:b:p<b?p:b:j<p?j<b?j:b:p<b?p:b,c=f<o?f<m?f<c?f:c:m<c?m:c:o<m?o<c?o:c:m<c?m:c,d=g>j?g>p?g>d?g:d:p>d?p:d:j>p?j>d?j:d:p>d?p:d,e=f>o?f>m?f>e?f:e:m>e?m:e:o>m?o>e?o:e:m>e?m:e);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),d=g.getRight(),e=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),d=d>g.getRight()?d:g.getRight(),e=e>
+THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);s=o.dot(b);if(s<=0)return null;n=p.add(a,m.copy(b).multiplyScalar(s));return q=c.distanceTo(n)}function d(a,b,c,d){o.sub(d,b);p.sub(c,b);m.sub(a,b);r=o.dot(o);t=o.dot(p);u=o.dot(m);y=p.dot(p);G=p.dot(m);w=1/(r*y-t*t);B=(y*u-t*G)*w;F=(r*G-t*u)*w;return B>=0&&F>=0&&B+F<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,
+c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var e=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector3;this.intersectObject=function(m){for(var n,s=[],o=0,p=m.children.length;o<p;o++)Array.prototype.push.apply(s,this.intersectObject(m.children[o]));if(m instanceof THREE.Particle){o=
+c(this.origin,this.direction,m.matrixWorld.getPosition());if(o===null||o>m.scale.x)return[];n={distance:o,point:m.position,face:null,object:m};s.push(n)}else if(m instanceof THREE.Mesh){o=c(this.origin,this.direction,m.matrixWorld.getPosition());if(o===null||o>m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)))return s;var q,r=m.geometry,t=r.vertices,u;m.matrixRotationWorld.extractRotation(m.matrixWorld);o=0;for(p=r.faces.length;o<p;o++)if(n=r.faces[o],a.copy(this.origin),
+b.copy(this.direction),u=m.matrixWorld,i=u.multiplyVector3(i.copy(n.centroid)).subSelf(a),q=i.dot(b),!(q<=0)&&(e=u.multiplyVector3(e.copy(t[n.a].position)),g=u.multiplyVector3(g.copy(t[n.b].position)),f=u.multiplyVector3(f.copy(t[n.c].position)),n instanceof THREE.Face4&&(h=u.multiplyVector3(h.copy(t[n.d].position))),j=m.matrixRotationWorld.multiplyVector3(j.copy(n.normal)),q=b.dot(j),m.doubleSided||(m.flipSided?q>0:q<0)))if(q=j.dot(i.sub(e,a))/q,k.add(a,b.multiplyScalar(q)),n instanceof THREE.Face3)d(k,
+e,g,f)&&(n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},s.push(n));else if(n instanceof THREE.Face4&&(d(k,e,g,h)||d(k,g,f,h)))n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},s.push(n)}return s};var o=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,s,n,q,r,t,u,y,G,w,B,F};
+THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(g,f,k,o){h=!1;b=g;c=f;d=k;e=o;a()};this.addPoint=function(g,f){h?(h=!1,b=g,c=f,d=g,e=f):(b=b<g?b:g,c=c<f?c:f,d=d>g?d:g,e=e>f?e:f);a()};this.add3Points=
+function(g,f,k,o,p,m){h?(h=!1,b=g<k?g<p?g:p:k<p?k:p,c=f<o?f<m?f:m:o<m?o:m,d=g>k?g>p?g:p:k>p?k:p,e=f>o?f>m?f:m:o>m?o:m):(b=g<k?g<p?g<b?g:b:p<b?p:b:k<p?k<b?k:b:p<b?p:b,c=f<o?f<m?f<c?f:c:m<c?m:c:o<m?o<c?o:c:m<c?m:c,d=g>k?g>p?g>d?g:d:p>d?p:d:k>p?k>d?k:d:p>d?p:d,e=f>o?f>m?f>e?f:e:m>e?m:e:o>m?o>e?o:e:m>e?m:e);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),d=g.getRight(),e=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),d=d>g.getRight()?d:g.getRight(),e=e>
 g.getBottom()?e:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;d+=g;e+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();e=e<g.getBottom()?e:g.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,e,g,f,h,i,l,j,o,p,m,r,n){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,g!==void 0?g:1,f||0,h||0,i||0,l||0,j!==void 0?j:1,o||0,p||0,m||0,r||0,n!==void 0?n:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,i,l,j,o,p,m,r,n){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=i;this.n32=l;this.n33=j;this.n34=o;this.n41=p;this.n42=m;this.n43=r;this.n44=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,i=a.n23,l=a.n24,j=a.n31,o=a.n32,p=a.n33,m=a.n34,r=a.n41,n=a.n42,q=a.n43,
-s=a.n44,u=b.n11,t=b.n12,y=b.n13,A=b.n14,D=b.n21,F=b.n22,H=b.n23,B=b.n24,J=b.n31,x=b.n32,z=b.n33,G=b.n34,W=b.n41,S=b.n42,T=b.n43,V=b.n44;this.n11=c*u+d*D+e*J+g*W;this.n12=c*t+d*F+e*x+g*S;this.n13=c*y+d*H+e*z+g*T;this.n14=c*A+d*B+e*G+g*V;this.n21=f*u+h*D+i*J+l*W;this.n22=f*t+h*F+i*x+l*S;this.n23=f*y+h*H+i*z+l*T;this.n24=f*A+h*B+i*G+l*V;this.n31=j*u+o*D+p*J+m*W;this.n32=j*t+o*F+p*x+m*S;this.n33=j*y+o*H+p*z+m*T;this.n34=j*A+o*B+p*G+m*V;this.n41=r*u+n*D+q*J+s*W;this.n42=r*t+n*F+q*x+s*S;this.n43=r*y+n*
-H+q*z+s*T;this.n44=r*A+n*B+q*G+s*V;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
+THREE.Matrix4=function(a,b,c,d,e,g,f,h,i,j,k,o,p,m,s,n){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,g!==void 0?g:1,f||0,h||0,i||0,j||0,k!==void 0?k:1,o||0,p||0,m||0,s||0,n!==void 0?n:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,i,j,k,o,p,m,s,n){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=i;this.n32=j;this.n33=k;this.n34=o;this.n41=p;this.n42=m;this.n43=s;this.n44=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,i=a.n23,j=a.n24,k=a.n31,o=a.n32,p=a.n33,m=a.n34,s=a.n41,n=a.n42,q=a.n43,
+r=a.n44,t=b.n11,u=b.n12,y=b.n13,G=b.n14,w=b.n21,B=b.n22,F=b.n23,I=b.n24,R=b.n31,x=b.n32,A=b.n33,K=b.n34,X=b.n41,T=b.n42,$=b.n43,V=b.n44;this.n11=c*t+d*w+e*R+g*X;this.n12=c*u+d*B+e*x+g*T;this.n13=c*y+d*F+e*A+g*$;this.n14=c*G+d*I+e*K+g*V;this.n21=f*t+h*w+i*R+j*X;this.n22=f*u+h*B+i*x+j*T;this.n23=f*y+h*F+i*A+j*$;this.n24=f*G+h*I+i*K+j*V;this.n31=k*t+o*w+p*R+m*X;this.n32=k*u+o*B+p*x+m*T;this.n33=k*y+o*F+p*A+m*$;this.n34=k*G+o*I+p*K+m*V;this.n41=s*t+n*w+q*R+r*X;this.n42=s*u+n*B+q*x+r*T;this.n43=s*y+n*
+F+q*A+r*$;this.n44=s*G+n*I+q*K+r*V;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*
 c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
-a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,i=this.n31,l=this.n32,j=this.n33,o=this.n34,p=this.n41,m=this.n42,r=this.n43,n=this.n44;return d*f*l*p-c*h*l*p-d*g*j*p+b*h*j*p+c*g*o*p-b*f*o*p-d*f*i*m+c*h*i*m+d*e*j*m-a*h*j*m-c*e*o*m+a*f*o*m+d*g*i*r-b*h*i*r-d*e*l*r+a*h*l*r+b*e*o*r-a*g*o*r-c*g*i*n+b*f*i*n+c*e*l*n-a*f*l*n-b*e*j*n+a*g*j*n},transpose:function(){var a;
+a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,i=this.n31,j=this.n32,k=this.n33,o=this.n34,p=this.n41,m=this.n42,s=this.n43,n=this.n44;return d*f*j*p-c*h*j*p-d*g*k*p+b*h*k*p+c*g*o*p-b*f*o*p-d*f*i*m+c*h*i*m+d*e*k*m-a*h*k*m-c*e*o*m+a*f*o*m+d*g*i*s-b*h*i*s-d*e*j*s+a*h*j*s+b*e*o*s-a*g*o*s-c*g*i*n+b*f*i*n+c*e*j*n-a*f*j*n-b*e*k*n+a*g*k*n},transpose:function(){var a;
 a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;
 a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;
 a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},
 setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},
-setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,h=a.z,i=e*g,l=e*f;this.set(i*g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,l*f+c,l*h-d*g,0,i*h-d*f,l*h+d*g,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,g=a.n21,f=a.n22,h=a.n23,i=a.n24,l=a.n31,j=a.n32,o=a.n33,p=a.n34,m=a.n41,r=a.n42,n=a.n43,q=a.n44;this.n11=h*p*r-i*o*r+i*j*n-f*p*n-h*j*q+f*o*q;this.n12=e*o*r-d*p*r-e*j*n+c*p*n+d*j*q-c*o*q;this.n13=d*i*r-e*h*r+e*f*n-c*i*n-d*f*q+c*h*q;this.n14=e*h*j-d*i*j-e*f*o+c*i*o+d*f*p-c*h*p;this.n21=i*o*m-h*p*m-i*l*n+g*p*n+h*l*q-g*o*q;this.n22=d*p*m-e*o*m+
-e*l*n-b*p*n-d*l*q+b*o*q;this.n23=e*h*m-d*i*m-e*g*n+b*i*n+d*g*q-b*h*q;this.n24=d*i*l-e*h*l+e*g*o-b*i*o-d*g*p+b*h*p;this.n31=f*p*m-i*j*m+i*l*r-g*p*r-f*l*q+g*j*q;this.n32=e*j*m-c*p*m-e*l*r+b*p*r+c*l*q-b*j*q;this.n33=c*i*m-e*f*m+e*g*r-b*i*r-c*g*q+b*f*q;this.n34=e*f*l-c*i*l-e*g*j+b*i*j+c*g*p-b*f*p;this.n41=h*j*m-f*o*m-h*l*r+g*o*r+f*l*n-g*j*n;this.n42=c*o*m-d*j*m+d*l*r-b*o*r-c*l*n+b*j*n;this.n43=d*f*m-c*h*m-d*g*r+b*h*r+c*g*n-b*f*n;this.n44=c*h*l-d*f*l+d*g*j-b*h*j-c*g*o+b*f*o;this.multiplyScalar(1/a.determinant());
-return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=f*h,l=f*e,j=d*h,o=d*e;this.n11=i+o*c;this.n12=j*c-l;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=l*c-j;this.n32=o+i*c;this.n33=g*f;break;case "ZXY":i=f*h;l=f*e;j=d*h;o=d*e;this.n11=i-o*c;this.n12=-g*e;this.n13=j+l*c;this.n21=l+j*c;this.n22=g*h;this.n23=o-i*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":i=
-g*h;l=g*e;j=c*h;o=c*e;this.n11=f*h;this.n12=j*d-l;this.n13=i*d+o;this.n21=f*e;this.n22=o*d+i;this.n23=l*d-j;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":i=g*f;l=g*d;j=c*f;o=c*d;this.n11=f*h;this.n12=o-i*e;this.n13=j*e+l;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*e+j;this.n33=i-o*e;break;case "XZY":i=g*f;l=g*d;j=c*f;o=c*d;this.n11=f*h;this.n12=-e;this.n13=d*h;this.n21=i*e+o;this.n22=g*h;this.n23=l*e-j;this.n31=j*e-l;this.n32=c*h;this.n33=o*e+i;break;default:i=g*h,l=g*
-e,j=c*h,o=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=l+j*d,this.n22=i-o*d,this.n23=-c*f,this.n31=o-i*d,this.n32=j+l*d,this.n33=g*f}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,i=b*f;b*=h;var l=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(l+d);this.n12=i-e;this.n13=b+f;this.n21=i+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+l);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
+setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,h=a.z,i=e*g,j=e*f;this.set(i*g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,j*f+c,j*h-d*g,0,i*h-d*f,j*h+d*g,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,g=a.n21,f=a.n22,h=a.n23,i=a.n24,j=a.n31,k=a.n32,o=a.n33,p=a.n34,m=a.n41,s=a.n42,n=a.n43,q=a.n44;this.n11=h*p*s-i*o*s+i*k*n-f*p*n-h*k*q+f*o*q;this.n12=e*o*s-d*p*s-e*k*n+c*p*n+d*k*q-c*o*q;this.n13=d*i*s-e*h*s+e*f*n-c*i*n-d*f*q+c*h*q;this.n14=e*h*k-d*i*k-e*f*o+c*i*o+d*f*p-c*h*p;this.n21=i*o*m-h*p*m-i*j*n+g*p*n+h*j*q-g*o*q;this.n22=d*p*m-e*o*m+
+e*j*n-b*p*n-d*j*q+b*o*q;this.n23=e*h*m-d*i*m-e*g*n+b*i*n+d*g*q-b*h*q;this.n24=d*i*j-e*h*j+e*g*o-b*i*o-d*g*p+b*h*p;this.n31=f*p*m-i*k*m+i*j*s-g*p*s-f*j*q+g*k*q;this.n32=e*k*m-c*p*m-e*j*s+b*p*s+c*j*q-b*k*q;this.n33=c*i*m-e*f*m+e*g*s-b*i*s-c*g*q+b*f*q;this.n34=e*f*j-c*i*j-e*g*k+b*i*k+c*g*p-b*f*p;this.n41=h*k*m-f*o*m-h*j*s+g*o*s+f*j*n-g*k*n;this.n42=c*o*m-d*k*m+d*j*s-b*o*s-c*j*n+b*k*n;this.n43=d*f*m-c*h*m-d*g*s+b*h*s+c*g*n-b*f*n;this.n44=c*h*j-d*f*j+d*g*k-b*h*k-c*g*o+b*f*o;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=f*h,j=f*e,k=d*h,o=d*e;this.n11=i+o*c;this.n12=k*c-j;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=j*c-k;this.n32=o+i*c;this.n33=g*f;break;case "ZXY":i=f*h;j=f*e;k=d*h;o=d*e;this.n11=i-o*c;this.n12=-g*e;this.n13=k+j*c;this.n21=j+k*c;this.n22=g*h;this.n23=o-i*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":i=
+g*h;j=g*e;k=c*h;o=c*e;this.n11=f*h;this.n12=k*d-j;this.n13=i*d+o;this.n21=f*e;this.n22=o*d+i;this.n23=j*d-k;this.n31=-d;this.n32=c*f;this.n33=g*f;break;case "YZX":i=g*f;j=g*d;k=c*f;o=c*d;this.n11=f*h;this.n12=o-i*e;this.n13=k*e+j;this.n21=e;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=j*e+k;this.n33=i-o*e;break;case "XZY":i=g*f;j=g*d;k=c*f;o=c*d;this.n11=f*h;this.n12=-e;this.n13=d*h;this.n21=i*e+o;this.n22=g*h;this.n23=j*e-k;this.n31=k*e-j;this.n32=c*h;this.n33=o*e+i;break;default:i=g*h,j=g*
+e,k=c*h,o=c*e,this.n11=f*h,this.n12=-f*e,this.n13=d,this.n21=j+k*d,this.n22=i-o*d,this.n23=-c*f,this.n31=o-i*d,this.n32=k+j*d,this.n33=g*f}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,f=c+c,h=d+d,a=b*g,i=b*f;b*=h;var j=c*f;c*=h;d*=h;g*=e;f*=e;e*=h;this.n11=1-(j+d);this.n12=i-e;this.n13=b+f;this.n21=i+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-f;this.n32=c+g;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
 a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);g.set(this.n13,
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
-return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this}};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,o=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*l;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*i;c[6]=a*l;c[7]=a*j;c[8]=a*o;return b};
+return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);else if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);else if(a.x===0&&a.y===
+0&&a.z===1)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,g=Math.sqrt(c*c+d*d+e*e);c/=g;d/=g;e/=g;var g=c*c,f=d*d,h=e*e,i=Math.cos(b),j=Math.sin(b),k=1-i,o=c*d*k,p=c*e*k;k*=d*e;c*=j;var m=d*j;j*=e;e=g+(1-g)*i;g=o+j;d=p-m;o-=j;f+=(1-f)*i;j=k+c;p+=m;k-=c;h+=(1-h)*i;var i=this.n11,c=this.n21,m=this.n31,s=this.n41,n=this.n12,q=this.n22,r=this.n32,t=this.n42,u=this.n13,y=this.n23,G=this.n33,w=this.n43;this.n11=e*i+g*n+d*u;this.n21=e*c+g*q+d*y;this.n31=e*m+g*r+d*G;this.n41=e*s+g*t+d*w;this.n12=o*i+f*n+j*
+u;this.n22=o*c+f*q+j*y;this.n32=o*m+f*r+j*G;this.n42=o*s+f*t+j*w;this.n13=p*i+k*n+h*u;this.n23=p*c+k*q+h*y;this.n33=p*m+k*r+h*G;this.n43=p*s+k*t+h*w;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,g=this.n13,f=this.n23,h=this.n33,i=this.n43,j=Math.cos(a),a=Math.sin(a);this.n12=j*b+a*g;this.n22=j*c+a*f;this.n32=j*d+a*h;this.n42=j*e+a*i;this.n13=j*g-a*b;this.n23=j*f-a*c;this.n33=j*h-a*d;this.n43=j*i-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,
+e=this.n41,g=this.n13,f=this.n23,h=this.n33,i=this.n43,j=Math.cos(a),a=Math.sin(a);this.n11=j*b-a*g;this.n21=j*c-a*f;this.n31=j*d-a*h;this.n41=j*e-a*i;this.n13=j*g+a*b;this.n23=j*f+a*c;this.n33=j*h+a*d;this.n43=j*i+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,g=this.n12,f=this.n22,h=this.n32,i=this.n42,j=Math.cos(a),a=Math.sin(a);this.n11=j*b+a*g;this.n21=j*c+a*f;this.n31=j*d+a*h;this.n41=j*e+a*i;this.n12=j*g-a*b;this.n22=j*f-a*c;this.n32=j*h-a*d;this.n42=j*
+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}};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,o=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*j;if(a===0)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*f;c[4]=a*h;c[5]=a*i;c[6]=a*j;c[7]=a*k;c[8]=a*o;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var f;f=new THREE.Matrix4;f.n11=2*e/(b-a);f.n12=0;f.n13=(b+a)/(b-a);f.n14=0;f.n21=0;f.n22=2*e/(d-c);f.n23=(d+c)/(d-c);f.n24=0;f.n31=0;f.n32=0;f.n33=-(g+e)/(g-e);f.n34=-2*g*e/(g-e);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,i,l;f=new THREE.Matrix4;h=b-a;i=c-d;l=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((c+d)/i);f.n31=0;f.n32=0;f.n33=-2/l;f.n34=-((g+e)/l);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var f,h,i,j;f=new THREE.Matrix4;h=b-a;i=c-d;j=g-e;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((b+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((c+d)/i);f.n31=0;f.n32=0;f.n33=-2/j;f.n34=-((g+e)/j);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
 -1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c<d;c++){e=this.children[c];if(e.name===a)return e;
 if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=f[g]=f[g]||new THREE.RenderableObject;g++;return a}function b(){var a=l[i]=l[i]||new THREE.RenderableVertex;i++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;return e>=0&&g>=0&&f>=0&&h>=0?!0:e<0&&g<0||f<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g))),f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var e,g,f=[],h,i,l=[],
-j,o,p=[],m,r=[],n,q,s=[],u,t,y=[],A={objects:[],sprites:[],lights:[],elements:[]},D=new THREE.Vector3,F=new THREE.Vector4,H=new THREE.Matrix4,B=new THREE.Matrix4,J=new THREE.Frustum,x=new THREE.Vector4,z=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);H.multiply(b.projectionMatrix,b.matrixWorldInverse);H.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);H.multiply(b.matrixWorld,
-b.projectionMatrixInverse);H.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){g=0;A.objects.length=0;A.sprites.length=0;A.lights.length=0;var f=function(b){if(b.visible!==!1){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===!1||J.contains(b))?(H.multiplyVector3(D.copy(b.position)),e=a(),e.object=
-b,e.z=D.z,A.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(H.multiplyVector3(D.copy(b.position)),e=a(),e.object=b,e.z=D.z,A.sprites.push(e)):b instanceof THREE.Light&&A.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)f(b.children[c])}};f(b);d&&A.objects.sort(c);return A};this.projectScene=function(a,e,g){var f=e.near,D=e.far,k,L,K,v,M,X,ca,ea,aa,U,I,P,$,Z,oa,ba;t=q=m=o=0;A.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);H.multiply(e.projectionMatrix,e.matrixWorldInverse);J.setFromMatrix(H);A=this.projectGraph(a,!1);a=0;for(k=A.objects.length;a<k;a++)if(aa=A.objects[a].object,U=aa.matrixWorld,P=aa.material,i=0,aa instanceof THREE.Mesh){I=aa.geometry;$=aa.geometry.materials;v=I.vertices;Z=I.faces;oa=I.faceVertexUvs;I=aa.matrixRotationWorld.extractRotation(U);L=0;for(K=v.length;L<K;L++)h=b(),h.positionWorld.copy(v[L].position),U.multiplyVector3(h.positionWorld),
-h.positionScreen.copy(h.positionWorld),H.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<D;v=0;for(L=Z.length;v<L;v++){K=Z[v];if(K instanceof THREE.Face3)if(M=l[K.a],X=l[K.b],ca=l[K.c],M.visible&&X.visible&&ca.visible&&(aa.doubleSided||aa.flipSided!=(ca.positionScreen.x-M.positionScreen.x)*(X.positionScreen.y-M.positionScreen.y)-(ca.positionScreen.y-M.positionScreen.y)*(X.positionScreen.x-
-M.positionScreen.x)<0))ea=p[o]=p[o]||new THREE.RenderableFace3,o++,j=ea,j.v1.copy(M),j.v2.copy(X),j.v3.copy(ca);else continue;else if(K instanceof THREE.Face4)if(M=l[K.a],X=l[K.b],ca=l[K.c],ea=l[K.d],M.visible&&X.visible&&ca.visible&&ea.visible&&(aa.doubleSided||aa.flipSided!=((ea.positionScreen.x-M.positionScreen.x)*(X.positionScreen.y-M.positionScreen.y)-(ea.positionScreen.y-M.positionScreen.y)*(X.positionScreen.x-M.positionScreen.x)<0||(X.positionScreen.x-ca.positionScreen.x)*(ea.positionScreen.y-
-ca.positionScreen.y)-(X.positionScreen.y-ca.positionScreen.y)*(ea.positionScreen.x-ca.positionScreen.x)<0)))ba=r[m]=r[m]||new THREE.RenderableFace4,m++,j=ba,j.v1.copy(M),j.v2.copy(X),j.v3.copy(ca),j.v4.copy(ea);else continue;j.normalWorld.copy(K.normal);I.multiplyVector3(j.normalWorld);j.centroidWorld.copy(K.centroid);U.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);H.multiplyVector3(j.centroidScreen);ca=K.vertexNormals;M=0;for(X=ca.length;M<X;M++)ea=j.vertexNormalsWorld[M],
-ea.copy(ca[M]),I.multiplyVector3(ea);M=0;for(X=oa.length;M<X;M++)if(ba=oa[M][v]){ca=0;for(ea=ba.length;ca<ea;ca++)j.uvs[M][ca]=ba[ca]}j.material=P;j.faceMaterial=K.materialIndex!==null?$[K.materialIndex]:null;j.z=j.centroidScreen.z;A.elements.push(j)}}else if(aa instanceof THREE.Line){B.multiply(H,U);v=aa.geometry.vertices;M=b();M.positionScreen.copy(v[0].position);B.multiplyVector4(M.positionScreen);L=1;for(K=v.length;L<K;L++)if(M=b(),M.positionScreen.copy(v[L].position),B.multiplyVector4(M.positionScreen),
-X=l[i-2],x.copy(M.positionScreen),z.copy(X.positionScreen),d(x,z))x.multiplyScalar(1/x.w),z.multiplyScalar(1/z.w),aa=s[q]=s[q]||new THREE.RenderableLine,q++,n=aa,n.v1.positionScreen.copy(x),n.v2.positionScreen.copy(z),n.z=Math.max(x.z,z.z),n.material=P,A.elements.push(n)}a=0;for(k=A.sprites.length;a<k;a++)if(aa=A.sprites[a].object,U=aa.matrixWorld,aa instanceof THREE.Particle&&(F.set(U.n14,U.n24,U.n34,1),H.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))f=y[t]=y[t]||new THREE.RenderableParticle,t++,u=f,
-u.x=F.x/F.w,u.y=F.y/F.w,u.z=F.z,u.rotation=aa.rotation.z,u.scale.x=aa.scale.x*Math.abs(u.x-(F.x+e.projectionMatrix.n11)/(F.w+e.projectionMatrix.n14)),u.scale.y=aa.scale.y*Math.abs(u.y-(F.y+e.projectionMatrix.n22)/(F.w+e.projectionMatrix.n24)),u.material=aa.material,A.elements.push(u);g&&A.elements.sort(c);return A}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
+THREE.Projector=function(){function a(){var a=f[g]=f[g]||new THREE.RenderableObject;g++;return a}function b(){var a=j[i]=j[i]||new THREE.RenderableVertex;i++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;return e>=0&&g>=0&&f>=0&&h>=0?!0:e<0&&g<0||f<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g))),f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var e,g,f=[],h,i,j=[],
+k,o,p=[],m,s=[],n,q,r=[],t,u,y=[],G={objects:[],sprites:[],lights:[],elements:[]},w=new THREE.Vector3,B=new THREE.Vector4,F=new THREE.Matrix4,I=new THREE.Matrix4,R=new THREE.Frustum,x=new THREE.Vector4,A=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);F.multiply(b.projectionMatrix,b.matrixWorldInverse);F.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);F.multiply(b.matrixWorld,
+b.projectionMatrixInverse);F.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){g=0;G.objects.length=0;G.sprites.length=0;G.lights.length=0;var f=function(b){if(b.visible!==!1){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===!1||R.contains(b))?(F.multiplyVector3(w.copy(b.position)),e=a(),e.object=
+b,e.z=w.z,G.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(F.multiplyVector3(w.copy(b.position)),e=a(),e.object=b,e.z=w.z,G.sprites.push(e)):b instanceof THREE.Light&&G.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)f(b.children[c])}};f(b);d&&G.objects.sort(c);return G};this.projectScene=function(a,e,g){var f=e.near,w=e.far,l,M,J,L,v,Y,aa,fa,ca,U,N,W,S,da,va,ea;u=q=m=o=0;G.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);F.multiply(e.projectionMatrix,e.matrixWorldInverse);R.setFromMatrix(F);G=this.projectGraph(a,!1);a=0;for(l=G.objects.length;a<l;a++)if(ca=G.objects[a].object,U=ca.matrixWorld,W=ca.material,i=0,ca instanceof THREE.Mesh){N=ca.geometry;S=ca.geometry.materials;L=N.vertices;da=N.faces;va=N.faceVertexUvs;N=ca.matrixRotationWorld.extractRotation(U);M=0;for(J=L.length;M<J;M++)h=b(),h.positionWorld.copy(L[M].position),U.multiplyVector3(h.positionWorld),
+h.positionScreen.copy(h.positionWorld),F.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<w;L=0;for(M=da.length;L<M;L++){J=da[L];if(J instanceof THREE.Face3)if(v=j[J.a],Y=j[J.b],aa=j[J.c],v.visible&&Y.visible&&aa.visible&&(ca.doubleSided||ca.flipSided!=(aa.positionScreen.x-v.positionScreen.x)*(Y.positionScreen.y-v.positionScreen.y)-(aa.positionScreen.y-v.positionScreen.y)*(Y.positionScreen.x-
+v.positionScreen.x)<0))fa=p[o]=p[o]||new THREE.RenderableFace3,o++,k=fa,k.v1.copy(v),k.v2.copy(Y),k.v3.copy(aa);else continue;else if(J instanceof THREE.Face4)if(v=j[J.a],Y=j[J.b],aa=j[J.c],fa=j[J.d],v.visible&&Y.visible&&aa.visible&&fa.visible&&(ca.doubleSided||ca.flipSided!=((fa.positionScreen.x-v.positionScreen.x)*(Y.positionScreen.y-v.positionScreen.y)-(fa.positionScreen.y-v.positionScreen.y)*(Y.positionScreen.x-v.positionScreen.x)<0||(Y.positionScreen.x-aa.positionScreen.x)*(fa.positionScreen.y-
+aa.positionScreen.y)-(Y.positionScreen.y-aa.positionScreen.y)*(fa.positionScreen.x-aa.positionScreen.x)<0)))ea=s[m]=s[m]||new THREE.RenderableFace4,m++,k=ea,k.v1.copy(v),k.v2.copy(Y),k.v3.copy(aa),k.v4.copy(fa);else continue;k.normalWorld.copy(J.normal);N.multiplyVector3(k.normalWorld);k.centroidWorld.copy(J.centroid);U.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);F.multiplyVector3(k.centroidScreen);aa=J.vertexNormals;v=0;for(Y=aa.length;v<Y;v++)fa=k.vertexNormalsWorld[v],
+fa.copy(aa[v]),N.multiplyVector3(fa);v=0;for(Y=va.length;v<Y;v++)if(ea=va[v][L]){aa=0;for(fa=ea.length;aa<fa;aa++)k.uvs[v][aa]=ea[aa]}k.material=W;k.faceMaterial=J.materialIndex!==null?S[J.materialIndex]:null;k.z=k.centroidScreen.z;G.elements.push(k)}}else if(ca instanceof THREE.Line){I.multiply(F,U);L=ca.geometry.vertices;v=b();v.positionScreen.copy(L[0].position);I.multiplyVector4(v.positionScreen);M=1;for(J=L.length;M<J;M++)if(v=b(),v.positionScreen.copy(L[M].position),I.multiplyVector4(v.positionScreen),
+Y=j[i-2],x.copy(v.positionScreen),A.copy(Y.positionScreen),d(x,A))x.multiplyScalar(1/x.w),A.multiplyScalar(1/A.w),ca=r[q]=r[q]||new THREE.RenderableLine,q++,n=ca,n.v1.positionScreen.copy(x),n.v2.positionScreen.copy(A),n.z=Math.max(x.z,A.z),n.material=W,G.elements.push(n)}a=0;for(l=G.sprites.length;a<l;a++)if(ca=G.sprites[a].object,U=ca.matrixWorld,ca instanceof THREE.Particle&&(B.set(U.n14,U.n24,U.n34,1),F.multiplyVector4(B),B.z/=B.w,B.z>0&&B.z<1))f=y[u]=y[u]||new THREE.RenderableParticle,u++,t=f,
+t.x=B.x/B.w,t.y=B.y/B.w,t.z=B.z,t.rotation=ca.rotation.z,t.scale.x=ca.scale.x*Math.abs(t.x-(B.x+e.projectionMatrix.n11)/(B.w+e.projectionMatrix.n14)),t.scale.y=ca.scale.y*Math.abs(t.y-(B.y+e.projectionMatrix.n22)/(B.w+e.projectionMatrix.n24)),t.material=ca.material,G.elements.push(t);g&&G.elements.sort(c);return G}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
-this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,i=this.w,l=i*c+f*e-h*d,j=i*d+h*c-g*e,o=i*e+g*d-f*c,c=-g*
-c-f*d-h*e;b.x=l*i+c*-g+j*-h-o*-f;b.y=j*i+c*-f+o*-g-l*-h;b.z=o*i+c*-h+l*-f-j*-g;return b}};
+this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,i=this.w,j=i*c+f*e-h*d,k=i*d+h*c-g*e,o=i*e+g*d-f*c,c=-g*
+c-f*d-h*e;b.x=j*i+c*-g+k*-h-o*-f;b.y=k*i+c*-f+o*-g-j*-h;b.z=o*i+c*-h+j*-f-k*-g;return b}};
 THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*g)/e;d=Math.sin(d*g)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
@@ -83,15 +87,15 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 b,c,d,e,g,f=new THREE.Vector3,h=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],g=this.vertices[c.c],f.sub(g.position,e.position),h.sub(d.position,e.position),f.crossSelf(h),f.isZero()||f.normalize(),c.normal.copy(f)},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=
 this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),
 d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,
-b,c,d,e,g,G){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;j=f[e];o=f[g];p=f[G];m=i.x-h.x;r=l.x-h.x;n=i.y-h.y;q=l.y-h.y;s=i.z-h.z;u=l.z-h.z;t=o.u-j.u;y=p.u-j.u;A=o.v-j.v;D=p.v-j.v;F=1/(t*D-y*A);x.set((D*m-A*r)*F,(D*n-A*q)*F,(D*s-A*u)*F);z.set((t*r-y*m)*F,(t*q-y*n)*F,(t*u-y*s)*F);B[b].addSelf(x);B[c].addSelf(x);B[d].addSelf(x);J[b].addSelf(z);J[c].addSelf(z);J[d].addSelf(z)}var b,c,d,e,g,f,h,i,l,j,o,p,m,r,n,q,s,u,t,y,A,D,F,H,B=[],J=[],x=new THREE.Vector3,z=new THREE.Vector3,
-G=new THREE.Vector3,W=new THREE.Vector3,S=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)B[b]=new THREE.Vector3,J[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],f=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var T=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)S.copy(g.vertexNormals[d]),e=g[T[d]],
-H=B[e],G.copy(H),G.subSelf(S.multiplyScalar(S.dot(H))).normalize(),W.cross(g.vertexNormals[d],H),e=W.dot(J[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(G.x,G.y,G.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=
+b,c,d,e,g,K){h=a.vertices[b].position;i=a.vertices[c].position;j=a.vertices[d].position;k=f[e];o=f[g];p=f[K];m=i.x-h.x;s=j.x-h.x;n=i.y-h.y;q=j.y-h.y;r=i.z-h.z;t=j.z-h.z;u=o.u-k.u;y=p.u-k.u;G=o.v-k.v;w=p.v-k.v;B=1/(u*w-y*G);x.set((w*m-G*s)*B,(w*n-G*q)*B,(w*r-G*t)*B);A.set((u*s-y*m)*B,(u*q-y*n)*B,(u*t-y*r)*B);I[b].addSelf(x);I[c].addSelf(x);I[d].addSelf(x);R[b].addSelf(A);R[c].addSelf(A);R[d].addSelf(A)}var b,c,d,e,g,f,h,i,j,k,o,p,m,s,n,q,r,t,u,y,G,w,B,F,I=[],R=[],x=new THREE.Vector3,A=new THREE.Vector3,
+K=new THREE.Vector3,X=new THREE.Vector3,T=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)I[b]=new THREE.Vector3,R[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],f=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var $=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)T.copy(g.vertexNormals[d]),e=g[$[d]],
+F=I[e],K.copy(F),K.subSelf(T.multiplyScalar(T.dot(F))).normalize(),X.cross(g.vertexNormals[d],F),e=X.dot(R[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(K.x,K.y,K.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=
 this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=
 0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),g,f;g=0;for(f=this.vertices.length;g<f;g++)d=this.vertices[g].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),a[d]===void 0?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];g=0;for(f=this.faces.length;g<f;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=
 c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,g,f,h,i,l,j,o,p;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;g=Math.floor(e);f=e-g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>this.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;l=this.points[c[0]];j=this.points[c[1]];
-o=this.points[c[2]];p=this.points[c[3]];h=f*f;i=f*h;d.x=b(l.x,j.x,o.x,p.x,f,h,i);d.y=b(l.y,j.y,o.y,p.y,f,h,i);d.z=b(l.z,j.z,o.z,p.z,f,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,g=new THREE.Vector3,f=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),f.copy(d),i+=f.distanceTo(g),
-g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,g,f,h=[],i=new THREE.Vector3,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];f=Math.ceil(a*c/j.total);e=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<f-1;c++)d=e+c*(1/f)*(g-e),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
+THREE.Spline=function(a){function b(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,g,f,h,i,j,k,o,p;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;g=Math.floor(e);f=e-g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>this.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;j=this.points[c[0]];k=this.points[c[1]];
+o=this.points[c[2]];p=this.points[c[3]];h=f*f;i=f*h;d.x=b(j.x,k.x,o.x,p.x,f,h,i);d.y=b(j.y,k.y,o.y,p.y,f,h,i);d.z=b(j.z,k.z,o.z,p.z,f,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,g=new THREE.Vector3,f=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),f.copy(d),i+=f.distanceTo(g),
+g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,g,f,h=[],i=new THREE.Vector3,k=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];f=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<f-1;c++)d=e+c*(1/f)*(g-e),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
 h}};THREE.Edge=function(a,b,c,d){this.vertices=[a,b];this.vertexIndices=[c,d];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};
 THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,e,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=e!==void 0?e:0.1;this.far=g!==void 0?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
 THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
@@ -148,47 +152,47 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
 THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,g;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;g=d/2};this.render=function(c,d){var i,l,j,o,p,m,r,n;a=b.projectScene(c,d);i=0;for(l=a.length;i<l;i++)if(p=a[i],p instanceof THREE.RenderableParticle){r=p.x*e+e;n=p.y*g+g;j=0;for(o=p.material.length;j<o;j++)if(m=p.material[j],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=r+"px",m.style.top=n+"px"}}};
-THREE.CanvasRenderer=function(a){function b(a){if(u!=a)n.globalAlpha=u=a}function c(a){if(t!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}t=a}}function d(a){if(y!=a)n.strokeStyle=y=a}function e(a){if(A!=a)n.fillStyle=A=a}var g=this,f,h,i,l=new THREE.Projector,a=a||{},j=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-o,p,m,r,n=j.getContext("2d"),q=new THREE.Color(0),s=0,u=1,t=0,y=null,A=null,D=null,F=null,H=null,B,J,x,z,G=new THREE.RenderableVertex,W=new THREE.RenderableVertex,S,T,V,k,L,K,v,M,X,ca,ea,aa,U=new THREE.Color,I=new THREE.Color,P=new THREE.Color,$=new THREE.Color,Z=new THREE.Color,oa=[],ba=[],ma,sa,ja,ka,ya,ua,va,wa,R,ga,Y=new THREE.Rectangle,da=new THREE.Rectangle,ta=new THREE.Rectangle,Qa=!1,ra=new THREE.Color,Ma=new THREE.Color,Na=new THREE.Color,pa=new THREE.Vector3,Ja,Ka,Ra,xa,La,Oa,a=16;Ja=document.createElement("canvas");
-Ja.width=Ja.height=2;Ka=Ja.getContext("2d");Ka.fillStyle="rgba(0,0,0,1)";Ka.fillRect(0,0,2,2);Ra=Ka.getImageData(0,0,2,2);xa=Ra.data;La=document.createElement("canvas");La.width=La.height=a;Oa=La.getContext("2d");Oa.translate(-a/2,-a/2);Oa.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){o=a;p=b;m=Math.floor(o/2);r=Math.floor(p/2);j.width=o;j.height=p;Y.set(-m,-r,m,r);da.set(-m,-r,m,r);u=1;t=0;
-H=F=D=A=y=null};this.setClearColor=function(a,b){q.copy(a);s=b;da.set(-m,-r,m,r)};this.setClearColorHex=function(a,b){q.setHex(a);s=b;da.set(-m,-r,m,r)};this.clear=function(){n.setTransform(1,0,0,-1,m,r);da.isEmpty()||(da.minSelf(Y),da.inflate(2),s<1&&n.clearRect(Math.floor(da.getX()),Math.floor(da.getY()),Math.floor(da.getWidth()),Math.floor(da.getHeight())),s>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+s+")"),n.fillRect(Math.floor(da.getX()),
-Math.floor(da.getY()),Math.floor(da.getWidth()),Math.floor(da.getHeight()))),da.empty())};this.render=function(a,j){function o(a){var b,c,d,e;ra.setRGB(0,0,0);Ma.setRGB(0,0,0);Na.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(ra.r+=e.r,ra.g+=e.g,ra.b+=e.b):d instanceof THREE.DirectionalLight?(Ma.r+=e.r,Ma.g+=e.g,Ma.b+=e.b):d instanceof THREE.PointLight&&(Na.r+=e.r,Na.g+=e.g,Na.b+=e.b)}function p(a,b,c,d){var e,g,f,h,k,i;e=0;for(g=a.length;e<g;e++)f=a[e],
-h=f.color,f instanceof THREE.DirectionalLight?(k=f.matrixWorld.getPosition(),i=c.dot(k),i<=0||(i*=f.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):f instanceof THREE.PointLight&&(k=f.matrixWorld.getPosition(),i=c.dot(pa.sub(k,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(k)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}function q(a,g,f){b(f.opacity);c(f.blending);var h,k,i,j,da,l;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)j=f.map.image,da=j.width>>
-1,l=j.height>>1,f=g.scale.x*m,i=g.scale.y*r,h=f*da,k=i*l,ta.set(a.x-h,a.y-k,a.x+h,a.y+k),Y.intersects(ta)&&(n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(f,-i),n.translate(-da,-l),n.drawImage(j,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(h=g.scale.x*m,k=g.scale.y*r,ta.set(a.x-h,a.y-k,a.x+h,a.y+k),Y.intersects(ta)&&(d(f.color.getContextStyle()),e(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(h,k),f.program(n),n.restore()))}
-function s(a,e,g,f){b(f.opacity);c(f.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(D!=a)n.lineWidth=D=a;a=f.linecap;if(F!=a)n.lineCap=F=a;a=f.linejoin;if(H!=a)n.lineJoin=H=a;d(f.color.getContextStyle());n.stroke();ta.inflate(f.linewidth*2)}}function u(a,d,e,f,h,da,m,n){g.info.render.vertices+=3;g.info.render.faces++;b(n.opacity);c(n.blending);S=a.positionScreen.x;
-T=a.positionScreen.y;V=d.positionScreen.x;k=d.positionScreen.y;L=e.positionScreen.x;K=e.positionScreen.y;y(S,T,V,k,L,K);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(ka=m.uvs[0],Sa(S,T,V,k,L,K,ka[f].u,ka[f].v,ka[h].u,ka[h].v,ka[da].u,ka[da].v,n.map));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=j.matrixWorldInverse,pa.copy(m.vertexNormalsWorld[f]),ya=(pa.x*a.n11+pa.y*a.n12+pa.z*a.n13)*0.5+0.5,ua=-(pa.x*a.n21+pa.y*
-a.n22+pa.z*a.n23)*0.5+0.5,pa.copy(m.vertexNormalsWorld[h]),va=(pa.x*a.n11+pa.y*a.n12+pa.z*a.n13)*0.5+0.5,wa=-(pa.x*a.n21+pa.y*a.n22+pa.z*a.n23)*0.5+0.5,pa.copy(m.vertexNormalsWorld[da]),R=(pa.x*a.n11+pa.y*a.n12+pa.z*a.n13)*0.5+0.5,ga=-(pa.x*a.n21+pa.y*a.n22+pa.z*a.n23)*0.5+0.5,Sa(S,T,V,k,L,K,ya,ua,va,wa,R,ga,n.envMap)}else n.wireframe?Ba(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof
-THREE.UVMapping&&(ka=m.uvs[0],Sa(S,T,V,k,L,K,ka[f].u,ka[f].v,ka[h].u,ka[h].v,ka[da].u,ka[da].v,n.map)),c(THREE.SubtractiveBlending)),Qa?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(I.r=P.r=$.r=ra.r,I.g=P.g=$.g=ra.g,I.b=P.b=$.b=ra.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],I),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],P),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],$),I.r=Math.max(0,Math.min(n.color.r*I.r,1)),I.g=Math.max(0,Math.min(n.color.g*I.g,1)),I.b=
-Math.max(0,Math.min(n.color.b*I.b,1)),P.r=Math.max(0,Math.min(n.color.r*P.r,1)),P.g=Math.max(0,Math.min(n.color.g*P.g,1)),P.b=Math.max(0,Math.min(n.color.b*P.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)),Z.r=(P.r+$.r)*0.5,Z.g=(P.g+$.g)*0.5,Z.b=(P.b+$.b)*0.5,ja=Q(I,P,$,Z),Ia(S,T,V,k,L,K,0,0,1,0,0,1,ja)):(U.r=ra.r,U.g=ra.g,U.b=ra.b,p(i,m.centroidWorld,m.normalWorld,U),U.r=Math.max(0,Math.min(n.color.r*U.r,1)),U.g=
-Math.max(0,Math.min(n.color.g*U.g,1)),U.b=Math.max(0,Math.min(n.color.b*U.b,1)),n.wireframe?Ba(U,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(U)):n.wireframe?Ba(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color);else if(n instanceof THREE.MeshDepthMaterial)ma=j.near,sa=j.far,I.r=I.g=I.b=1-N(a.positionScreen.z,ma,sa),P.r=P.g=P.b=1-N(d.positionScreen.z,ma,sa),$.r=$.g=$.b=1-N(e.positionScreen.z,ma,sa),Z.r=(P.r+$.r)*0.5,Z.g=(P.g+$.g)*0.5,Z.b=(P.b+$.b)*
-0.5,ja=Q(I,P,$,Z),Ia(S,T,V,k,L,K,0,0,1,0,0,1,ja);else if(n instanceof THREE.MeshNormalMaterial)U.r=O(m.normalWorld.x),U.g=O(m.normalWorld.y),U.b=O(m.normalWorld.z),n.wireframe?Ba(U,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(U)}function t(a,d,e,f,h,n,da,m,l){g.info.render.vertices+=4;g.info.render.faces++;b(m.opacity);c(m.blending);if(m.map||m.envMap)u(a,d,f,0,1,3,da,m,l),u(h,e,n,1,2,3,da,m,l);else if(S=a.positionScreen.x,T=a.positionScreen.y,V=d.positionScreen.x,k=d.positionScreen.y,
-L=e.positionScreen.x,K=e.positionScreen.y,v=f.positionScreen.x,M=f.positionScreen.y,X=h.positionScreen.x,ca=h.positionScreen.y,ea=n.positionScreen.x,aa=n.positionScreen.y,m instanceof THREE.MeshBasicMaterial)A(S,T,V,k,L,K,v,M),m.wireframe?Ba(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Aa(m.color);else if(m instanceof THREE.MeshLambertMaterial)Qa?!m.wireframe&&m.shading==THREE.SmoothShading&&da.vertexNormalsWorld.length==4?(I.r=P.r=$.r=Z.r=ra.r,I.g=P.g=$.g=Z.g=ra.g,I.b=P.b=
-$.b=Z.b=ra.b,p(i,da.v1.positionWorld,da.vertexNormalsWorld[0],I),p(i,da.v2.positionWorld,da.vertexNormalsWorld[1],P),p(i,da.v4.positionWorld,da.vertexNormalsWorld[3],$),p(i,da.v3.positionWorld,da.vertexNormalsWorld[2],Z),I.r=Math.max(0,Math.min(m.color.r*I.r,1)),I.g=Math.max(0,Math.min(m.color.g*I.g,1)),I.b=Math.max(0,Math.min(m.color.b*I.b,1)),P.r=Math.max(0,Math.min(m.color.r*P.r,1)),P.g=Math.max(0,Math.min(m.color.g*P.g,1)),P.b=Math.max(0,Math.min(m.color.b*P.b,1)),$.r=Math.max(0,Math.min(m.color.r*
-$.r,1)),$.g=Math.max(0,Math.min(m.color.g*$.g,1)),$.b=Math.max(0,Math.min(m.color.b*$.b,1)),Z.r=Math.max(0,Math.min(m.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(m.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(m.color.b*Z.b,1)),ja=Q(I,P,$,Z),y(S,T,V,k,v,M),Ia(S,T,V,k,v,M,0,0,1,0,0,1,ja),y(X,ca,L,K,ea,aa),Ia(X,ca,L,K,ea,aa,1,0,1,1,0,1,ja)):(U.r=ra.r,U.g=ra.g,U.b=ra.b,p(i,da.centroidWorld,da.normalWorld,U),U.r=Math.max(0,Math.min(m.color.r*U.r,1)),U.g=Math.max(0,Math.min(m.color.g*U.g,1)),U.b=Math.max(0,Math.min(m.color.b*
-U.b,1)),A(S,T,V,k,L,K,v,M),m.wireframe?Ba(U,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Aa(U)):(A(S,T,V,k,L,K,v,M),m.wireframe?Ba(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Aa(m.color));else if(m instanceof THREE.MeshNormalMaterial)U.r=O(da.normalWorld.x),U.g=O(da.normalWorld.y),U.b=O(da.normalWorld.z),A(S,T,V,k,L,K,v,M),m.wireframe?Ba(U,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Aa(U);else if(m instanceof THREE.MeshDepthMaterial)ma=j.near,
-sa=j.far,I.r=I.g=I.b=1-N(a.positionScreen.z,ma,sa),P.r=P.g=P.b=1-N(d.positionScreen.z,ma,sa),$.r=$.g=$.b=1-N(f.positionScreen.z,ma,sa),Z.r=Z.g=Z.b=1-N(e.positionScreen.z,ma,sa),ja=Q(I,P,$,Z),y(S,T,V,k,v,M),Ia(S,T,V,k,v,M,0,0,1,0,0,1,ja),y(X,ca,L,K,ea,aa),Ia(X,ca,L,K,ea,aa,1,0,1,1,0,1,ja)}function y(a,b,c,d,e,g){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(a,b);n.closePath()}function A(a,b,c,d,e,g,f,h){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(f,h);n.lineTo(a,
-b);n.closePath()}function Ba(a,b,c,e){if(D!=b)n.lineWidth=D=b;if(F!=c)n.lineCap=F=c;if(H!=e)n.lineJoin=H=e;d(a.getContextStyle());n.stroke();ta.inflate(b*2)}function Aa(a){e(a.getContextStyle());n.fill()}function Sa(a,b,c,d,g,f,h,k,i,m,j,da,l){if(l.image.width!=0){if(l.needsUpdate==!0||oa[l.id]==void 0){var o=l.wrapS==THREE.RepeatWrapping,p=l.wrapT==THREE.RepeatWrapping;oa[l.id]=n.createPattern(l.image,o&&p?"repeat":o&&!p?"repeat-x":!o&&p?"repeat-y":"no-repeat");l.needsUpdate=!1}e(oa[l.id]);var o=
-l.offset.x/l.repeat.x,p=l.offset.y/l.repeat.y,r=l.image.width*l.repeat.x,ra=l.image.height*l.repeat.y,h=(h+o)*r,k=(k+p)*ra,i=(i+o)*r,m=(m+p)*ra,j=(j+o)*r,da=(da+p)*ra;c-=a;d-=b;g-=a;f-=b;i-=h;m-=k;j-=h;da-=k;o=i*da-j*m;if(o==0){if(ba[l.id]==void 0)b=document.createElement("canvas"),b.width=l.image.width,b.height=l.image.height,a=b.getContext("2d"),a.drawImage(l.image,0,0),ba[l.id]=a.getImageData(0,0,l.image.width,l.image.height).data,delete b;b=ba[l.id];h=(Math.floor(h)+Math.floor(k)*l.image.width)*
-4;U.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Aa(U)}else o=1/o,l=(da*c-m*g)*o,m=(da*d-m*f)*o,c=(i*g-j*c)*o,d=(i*f-j*d)*o,a=a-l*h-c*k,h=b-m*h-d*k,n.save(),n.transform(l,m,c,d,a,h),n.fill(),n.restore()}}function Ia(a,b,c,d,e,g,f,h,k,i,m,j,da){var l,o;l=da.width-1;o=da.height-1;f*=l;h*=o;k*=l;i*=o;m*=l;j*=o;c-=a;d-=b;e-=a;g-=b;k-=f;i-=h;m-=f;j-=h;o=1/(k*j-m*i);l=(j*c-i*e)*o;i=(j*d-i*g)*o;c=(k*e-m*c)*o;d=(k*g-m*d)*o;a=a-l*f-c*h;b=b-i*f-d*h;n.save();n.transform(l,i,c,d,a,b);n.clip();n.drawImage(da,0,0);n.restore()}
-function Q(a,b,c,d){var e=~~(a.r*255),g=~~(a.g*255),a=~~(a.b*255),f=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),k=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),m=~~(d.r*255),j=~~(d.g*255),d=~~(d.b*255);xa[0]=e<0?0:e>255?255:e;xa[1]=g<0?0:g>255?255:g;xa[2]=a<0?0:a>255?255:a;xa[4]=f<0?0:f>255?255:f;xa[5]=h<0?0:h>255?255:h;xa[6]=b<0?0:b>255?255:b;xa[8]=k<0?0:k>255?255:k;xa[9]=i<0?0:i>255?255:i;xa[10]=c<0?0:c>255?255:c;xa[12]=m<0?0:m>255?255:m;xa[13]=j<0?0:j>255?255:j;xa[14]=d<0?0:d>255?255:d;Ka.putImageData(Ra,
-0,0);Oa.drawImage(Ja,0,0);return La}function N(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function O(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ca(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Pa,Ta,qa,za;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,r);g.info.render.vertices=0;g.info.render.faces=0;f=l.projectScene(a,j,this.sortElements);h=f.elements;i=f.lights;(Qa=i.length>0)&&o(i);Pa=0;for(Ta=h.length;Pa<Ta;Pa++)if(qa=h[Pa],za=
-qa.material,za=za instanceof THREE.MeshFaceMaterial?qa.faceMaterial:za,!(za==null||za.opacity==0)){ta.empty();if(qa instanceof THREE.RenderableParticle)B=qa,B.x*=m,B.y*=r,q(B,qa,za,a);else if(qa instanceof THREE.RenderableLine)B=qa.v1,J=qa.v2,B.positionScreen.x*=m,B.positionScreen.y*=r,J.positionScreen.x*=m,J.positionScreen.y*=r,ta.addPoint(B.positionScreen.x,B.positionScreen.y),ta.addPoint(J.positionScreen.x,J.positionScreen.y),Y.intersects(ta)&&s(B,J,qa,za,a);else if(qa instanceof THREE.RenderableFace3)B=
-qa.v1,J=qa.v2,x=qa.v3,B.positionScreen.x*=m,B.positionScreen.y*=r,J.positionScreen.x*=m,J.positionScreen.y*=r,x.positionScreen.x*=m,x.positionScreen.y*=r,za.overdraw&&(Ca(B.positionScreen,J.positionScreen),Ca(J.positionScreen,x.positionScreen),Ca(x.positionScreen,B.positionScreen)),ta.add3Points(B.positionScreen.x,B.positionScreen.y,J.positionScreen.x,J.positionScreen.y,x.positionScreen.x,x.positionScreen.y),Y.intersects(ta)&&u(B,J,x,0,1,2,qa,za,a);else if(qa instanceof THREE.RenderableFace4)B=qa.v1,
-J=qa.v2,x=qa.v3,z=qa.v4,B.positionScreen.x*=m,B.positionScreen.y*=r,J.positionScreen.x*=m,J.positionScreen.y*=r,x.positionScreen.x*=m,x.positionScreen.y*=r,z.positionScreen.x*=m,z.positionScreen.y*=r,G.positionScreen.copy(J.positionScreen),W.positionScreen.copy(z.positionScreen),za.overdraw&&(Ca(B.positionScreen,J.positionScreen),Ca(J.positionScreen,z.positionScreen),Ca(z.positionScreen,B.positionScreen),Ca(x.positionScreen,G.positionScreen),Ca(x.positionScreen,W.positionScreen)),ta.addPoint(B.positionScreen.x,
-B.positionScreen.y),ta.addPoint(J.positionScreen.x,J.positionScreen.y),ta.addPoint(x.positionScreen.x,x.positionScreen.y),ta.addPoint(z.positionScreen.x,z.positionScreen.y),Y.intersects(ta)&&t(B,J,x,z,G,W,qa,za,a);da.addRectangle(ta)}n.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,g,f,h,i,m;e=0;for(g=a.length;e<g;e++)f=a[e],h=f.color,f instanceof THREE.DirectionalLight?(i=f.matrixWorld.getPosition(),m=c.dot(i),m<=0||(m*=f.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)):f instanceof THREE.PointLight&&(i=f.matrixWorld.getPosition(),m=c.dot(B.sub(i,b).normalize()),m<=0||(m*=f.distance==0?1:1-Math.min(b.distanceTo(i)/f.distance,1),m!=0&&(m*=f.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)))}function b(a){J[a]==null&&(J[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),S==0&&J[a].setAttribute("shape-rendering","crispEdges"));return J[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,e,g,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,j,o,p,m,r,n,q,s=new THREE.Rectangle,u=new THREE.Rectangle,t=!1,y=new THREE.Color,A=new THREE.Color,D=new THREE.Color,F=new THREE.Color,H,B=new THREE.Vector3,J=[],x=[],z,G,W,S=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":S=1;break;case "low":S=0}};this.setSize=function(a,b){l=a;j=b;o=l/2;p=j/2;i.setAttribute("viewBox",-o+" "+-p+" "+l+" "+j);i.setAttribute("width",l);i.setAttribute("height",j);s.set(-o,-p,o,p)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(j,l){var k,J,K,v;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(j,l,this.sortElements);g=e.elements;
-f=e.lights;W=G=0;if(t=f.length>0){A.setRGB(0,0,0);D.setRGB(0,0,0);F.setRGB(0,0,0);k=0;for(J=f.length;k<J;k++)v=f[k],K=v.color,v instanceof THREE.AmbientLight?(A.r+=K.r,A.g+=K.g,A.b+=K.b):v instanceof THREE.DirectionalLight?(D.r+=K.r,D.g+=K.g,D.b+=K.b):v instanceof THREE.PointLight&&(F.r+=K.r,F.g+=K.g,F.b+=K.b)}k=0;for(J=g.length;k<J;k++)if(K=g[k],v=K.material,v=v instanceof THREE.MeshFaceMaterial?K.faceMaterial:v,!(v==null||v.opacity==0))if(u.empty(),K instanceof THREE.RenderableParticle)m=K,m.x*=
-o,m.y*=-p;else if(K instanceof THREE.RenderableLine){if(m=K.v1,r=K.v2,m.positionScreen.x*=o,m.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(r.positionScreen.x,r.positionScreen.y),s.intersects(u)){K=m;var M=r,B=W++;x[B]==null&&(x[B]=document.createElementNS("http://www.w3.org/2000/svg","line"),S==0&&x[B].setAttribute("shape-rendering","crispEdges"));z=x[B];z.setAttribute("x1",K.positionScreen.x);z.setAttribute("y1",K.positionScreen.y);
-z.setAttribute("x2",M.positionScreen.x);z.setAttribute("y2",M.positionScreen.y);v instanceof THREE.LineBasicMaterial&&(z.setAttribute("style","fill: none; stroke: "+v.color.getContextStyle()+"; stroke-width: "+v.linewidth+"; stroke-opacity: "+v.opacity+"; stroke-linecap: "+v.linecap+"; stroke-linejoin: "+v.linejoin),i.appendChild(z))}}else if(K instanceof THREE.RenderableFace3){if(m=K.v1,r=K.v2,n=K.v3,m.positionScreen.x*=o,m.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,n.positionScreen.x*=
-o,n.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(r.positionScreen.x,r.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),s.intersects(u)){var M=m,B=r,ca=n;d.info.render.vertices+=3;d.info.render.faces++;z=b(G++);z.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+"z");v instanceof THREE.MeshBasicMaterial?y.copy(v.color):v instanceof THREE.MeshLambertMaterial?
-t?(y.r=A.r,y.g=A.g,y.b=A.b,a(f,K.centroidWorld,K.normalWorld,y),y.r=Math.max(0,Math.min(v.color.r*y.r,1)),y.g=Math.max(0,Math.min(v.color.g*y.g,1)),y.b=Math.max(0,Math.min(v.color.b*y.b,1))):y.copy(v.color):v instanceof THREE.MeshDepthMaterial?(H=1-v.__2near/(v.__farPlusNear-K.z*v.__farMinusNear),y.setRGB(H,H,H)):v instanceof THREE.MeshNormalMaterial&&y.setRGB(c(K.normalWorld.x),c(K.normalWorld.y),c(K.normalWorld.z));v.wireframe?z.setAttribute("style","fill: none; stroke: "+y.getContextStyle()+"; stroke-width: "+
-v.wireframeLinewidth+"; stroke-opacity: "+v.opacity+"; stroke-linecap: "+v.wireframeLinecap+"; stroke-linejoin: "+v.wireframeLinejoin):z.setAttribute("style","fill: "+y.getContextStyle()+"; fill-opacity: "+v.opacity);i.appendChild(z)}}else if(K instanceof THREE.RenderableFace4&&(m=K.v1,r=K.v2,n=K.v3,q=K.v4,m.positionScreen.x*=o,m.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,n.positionScreen.x*=o,n.positionScreen.y*=-p,q.positionScreen.x*=o,q.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,
-m.positionScreen.y),u.addPoint(r.positionScreen.x,r.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(u))){var M=m,B=r,ca=n,ea=q;d.info.render.vertices+=4;d.info.render.faces++;z=b(G++);z.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+" L "+ea.positionScreen.x+","+ea.positionScreen.y+"z");v instanceof THREE.MeshBasicMaterial?
-y.copy(v.color):v instanceof THREE.MeshLambertMaterial?t?(y.r=A.r,y.g=A.g,y.b=A.b,a(f,K.centroidWorld,K.normalWorld,y),y.r=Math.max(0,Math.min(v.color.r*y.r,1)),y.g=Math.max(0,Math.min(v.color.g*y.g,1)),y.b=Math.max(0,Math.min(v.color.b*y.b,1))):y.copy(v.color):v instanceof THREE.MeshDepthMaterial?(H=1-v.__2near/(v.__farPlusNear-K.z*v.__farMinusNear),y.setRGB(H,H,H)):v instanceof THREE.MeshNormalMaterial&&y.setRGB(c(K.normalWorld.x),c(K.normalWorld.y),c(K.normalWorld.z));v.wireframe?z.setAttribute("style",
-"fill: none; stroke: "+y.getContextStyle()+"; stroke-width: "+v.wireframeLinewidth+"; stroke-opacity: "+v.opacity+"; stroke-linecap: "+v.wireframeLinecap+"; stroke-linejoin: "+v.wireframeLinejoin):z.setAttribute("style","fill: "+y.getContextStyle()+"; fill-opacity: "+v.opacity);i.appendChild(z)}}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,g;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;g=d/2};this.render=function(c,d){var i,j,k,o,p,m,s,n;a=b.projectScene(c,d);i=0;for(j=a.length;i<j;i++)if(p=a[i],p instanceof THREE.RenderableParticle){s=p.x*e+e;n=p.y*g+g;k=0;for(o=p.material.length;k<o;k++)if(m=p.material[k],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=s+"px",m.style.top=n+"px"}}};
+THREE.CanvasRenderer=function(a){function b(a){if(t!=a)n.globalAlpha=t=a}function c(a){if(u!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}u=a}}function d(a){if(y!=a)n.strokeStyle=y=a}function e(a){if(G!=a)n.fillStyle=G=a}var g=this,f,h,i,j=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+o,p,m,s,n=k.getContext("2d"),q=new THREE.Color(0),r=0,t=1,u=0,y=null,G=null,w=null,B=null,F=null,I,R,x,A,K=new THREE.RenderableVertex,X=new THREE.RenderableVertex,T,$,V,l,M,J,L,v,Y,aa,fa,ca,U=new THREE.Color,N=new THREE.Color,W=new THREE.Color,S=new THREE.Color,da=new THREE.Color,va=[],ea=[],na,la,sa,ia,Ba,wa,xa,ya,za,Aa,qa=new THREE.Rectangle,ta=new THREE.Rectangle,pa=new THREE.Rectangle,Ja=!1,ba=new THREE.Color,Z=new THREE.Color,D=new THREE.Color,ra=new THREE.Vector3,La,Ma,Pa,Ca,Na,C,a=16;La=document.createElement("canvas");
+La.width=La.height=2;Ma=La.getContext("2d");Ma.fillStyle="rgba(0,0,0,1)";Ma.fillRect(0,0,2,2);Pa=Ma.getImageData(0,0,2,2);Ca=Pa.data;Na=document.createElement("canvas");Na.width=Na.height=a;C=Na.getContext("2d");C.translate(-a/2,-a/2);C.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;p=b;m=Math.floor(o/2);s=Math.floor(p/2);k.width=o;k.height=p;qa.set(-m,-s,m,s);ta.set(-m,-s,m,s);t=1;u=0;F=
+B=w=G=y=null};this.setClearColor=function(a,b){q.copy(a);r=b;ta.set(-m,-s,m,s)};this.setClearColorHex=function(a,b){q.setHex(a);r=b;ta.set(-m,-s,m,s)};this.clear=function(){n.setTransform(1,0,0,-1,m,s);ta.isEmpty()||(ta.minSelf(qa),ta.inflate(2),r<1&&n.clearRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight())),r>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+r+")"),n.fillRect(Math.floor(ta.getX()),
+Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight()))),ta.empty())};this.render=function(a,k){function o(a){var b,c,d,e;ba.setRGB(0,0,0);Z.setRGB(0,0,0);D.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(ba.r+=e.r,ba.g+=e.g,ba.b+=e.b):d instanceof THREE.DirectionalLight?(Z.r+=e.r,Z.g+=e.g,Z.b+=e.b):d instanceof THREE.PointLight&&(D.r+=e.r,D.g+=e.g,D.b+=e.b)}function p(a,b,c,d){var e,g,f,ba,h,l;e=0;for(g=a.length;e<g;e++)f=a[e],ba=f.color,
+f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),l=c.dot(h),l<=0||(l*=f.intensity,d.r+=ba.r*l,d.g+=ba.g*l,d.b+=ba.b*l)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),l=c.dot(ra.sub(h,b).normalize()),l<=0||(l*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),l!=0&&(l*=f.intensity,d.r+=ba.r*l,d.g+=ba.g*l,d.b+=ba.b*l)))}function q(a,g,f){b(f.opacity);c(f.blending);var ba,h,l,i,k,D;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)i=f.map.image,k=i.width>>
+1,D=i.height>>1,f=g.scale.x*m,l=g.scale.y*s,ba=f*k,h=l*D,pa.set(a.x-ba,a.y-h,a.x+ba,a.y+h),qa.intersects(pa)&&(n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(f,-l),n.translate(-k,-D),n.drawImage(i,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(ba=g.scale.x*m,h=g.scale.y*s,pa.set(a.x-ba,a.y-h,a.x+ba,a.y+h),qa.intersects(pa)&&(d(f.color.getContextStyle()),e(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(ba,h),f.program(n),n.restore()))}
+function r(a,e,g,f){b(f.opacity);c(f.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(w!=a)n.lineWidth=w=a;a=f.linecap;if(B!=a)n.lineCap=B=a;a=f.linejoin;if(F!=a)n.lineJoin=F=a;d(f.color.getContextStyle());n.stroke();pa.inflate(f.linewidth*2)}}function t(a,d,e,f,h,D,j,Z){g.info.render.vertices+=3;g.info.render.faces++;b(Z.opacity);c(Z.blending);T=a.positionScreen.x;
+$=a.positionScreen.y;V=d.positionScreen.x;l=d.positionScreen.y;M=e.positionScreen.x;J=e.positionScreen.y;y(T,$,V,l,M,J);if(Z instanceof THREE.MeshBasicMaterial)if(Z.map)Z.map.mapping instanceof THREE.UVMapping&&(ia=j.uvs[0],Qa(T,$,V,l,M,J,ia[f].u,ia[f].v,ia[h].u,ia[h].v,ia[D].u,ia[D].v,Z.map));else if(Z.envMap){if(Z.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,ra.copy(j.vertexNormalsWorld[f]),Ba=(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)*0.5+0.5,wa=-(ra.x*a.n21+ra.y*a.n22+
+ra.z*a.n23)*0.5+0.5,ra.copy(j.vertexNormalsWorld[h]),xa=(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)*0.5+0.5,ya=-(ra.x*a.n21+ra.y*a.n22+ra.z*a.n23)*0.5+0.5,ra.copy(j.vertexNormalsWorld[D]),za=(ra.x*a.n11+ra.y*a.n12+ra.z*a.n13)*0.5+0.5,Aa=-(ra.x*a.n21+ra.y*a.n22+ra.z*a.n23)*0.5+0.5,Qa(T,$,V,l,M,J,Ba,wa,xa,ya,za,Aa,Z.envMap)}else Z.wireframe?Fa(Z.color,Z.wireframeLinewidth,Z.wireframeLinecap,Z.wireframeLinejoin):Ea(Z.color);else if(Z instanceof THREE.MeshLambertMaterial)Z.map&&!Z.wireframe&&(Z.map.mapping instanceof
+THREE.UVMapping&&(ia=j.uvs[0],Qa(T,$,V,l,M,J,ia[f].u,ia[f].v,ia[h].u,ia[h].v,ia[D].u,ia[D].v,Z.map)),c(THREE.SubtractiveBlending)),Ja?!Z.wireframe&&Z.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==3?(N.r=W.r=S.r=ba.r,N.g=W.g=S.g=ba.g,N.b=W.b=S.b=ba.b,p(i,j.v1.positionWorld,j.vertexNormalsWorld[0],N),p(i,j.v2.positionWorld,j.vertexNormalsWorld[1],W),p(i,j.v3.positionWorld,j.vertexNormalsWorld[2],S),N.r=Math.max(0,Math.min(Z.color.r*N.r,1)),N.g=Math.max(0,Math.min(Z.color.g*N.g,1)),N.b=
+Math.max(0,Math.min(Z.color.b*N.b,1)),W.r=Math.max(0,Math.min(Z.color.r*W.r,1)),W.g=Math.max(0,Math.min(Z.color.g*W.g,1)),W.b=Math.max(0,Math.min(Z.color.b*W.b,1)),S.r=Math.max(0,Math.min(Z.color.r*S.r,1)),S.g=Math.max(0,Math.min(Z.color.g*S.g,1)),S.b=Math.max(0,Math.min(Z.color.b*S.b,1)),da.r=(W.r+S.r)*0.5,da.g=(W.g+S.g)*0.5,da.b=(W.b+S.b)*0.5,sa=Q(N,W,S,da),Ka(T,$,V,l,M,J,0,0,1,0,0,1,sa)):(U.r=ba.r,U.g=ba.g,U.b=ba.b,p(i,j.centroidWorld,j.normalWorld,U),U.r=Math.max(0,Math.min(Z.color.r*U.r,1)),
+U.g=Math.max(0,Math.min(Z.color.g*U.g,1)),U.b=Math.max(0,Math.min(Z.color.b*U.b,1)),Z.wireframe?Fa(U,Z.wireframeLinewidth,Z.wireframeLinecap,Z.wireframeLinejoin):Ea(U)):Z.wireframe?Fa(Z.color,Z.wireframeLinewidth,Z.wireframeLinecap,Z.wireframeLinejoin):Ea(Z.color);else if(Z instanceof THREE.MeshDepthMaterial)na=k.near,la=k.far,N.r=N.g=N.b=1-O(a.positionScreen.z,na,la),W.r=W.g=W.b=1-O(d.positionScreen.z,na,la),S.r=S.g=S.b=1-O(e.positionScreen.z,na,la),da.r=(W.r+S.r)*0.5,da.g=(W.g+S.g)*0.5,da.b=(W.b+
+S.b)*0.5,sa=Q(N,W,S,da),Ka(T,$,V,l,M,J,0,0,1,0,0,1,sa);else if(Z instanceof THREE.MeshNormalMaterial)U.r=P(j.normalWorld.x),U.g=P(j.normalWorld.y),U.b=P(j.normalWorld.z),Z.wireframe?Fa(U,Z.wireframeLinewidth,Z.wireframeLinecap,Z.wireframeLinejoin):Ea(U)}function u(a,d,e,f,h,Z,D,j,m){g.info.render.vertices+=4;g.info.render.faces++;b(j.opacity);c(j.blending);if(j.map||j.envMap)t(a,d,f,0,1,3,D,j,m),t(h,e,Z,1,2,3,D,j,m);else if(T=a.positionScreen.x,$=a.positionScreen.y,V=d.positionScreen.x,l=d.positionScreen.y,
+M=e.positionScreen.x,J=e.positionScreen.y,L=f.positionScreen.x,v=f.positionScreen.y,Y=h.positionScreen.x,aa=h.positionScreen.y,fa=Z.positionScreen.x,ca=Z.positionScreen.y,j instanceof THREE.MeshBasicMaterial)G(T,$,V,l,M,J,L,v),j.wireframe?Fa(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Ea(j.color);else if(j instanceof THREE.MeshLambertMaterial)Ja?!j.wireframe&&j.shading==THREE.SmoothShading&&D.vertexNormalsWorld.length==4?(N.r=W.r=S.r=da.r=ba.r,N.g=W.g=S.g=da.g=ba.g,N.b=W.b=
+S.b=da.b=ba.b,p(i,D.v1.positionWorld,D.vertexNormalsWorld[0],N),p(i,D.v2.positionWorld,D.vertexNormalsWorld[1],W),p(i,D.v4.positionWorld,D.vertexNormalsWorld[3],S),p(i,D.v3.positionWorld,D.vertexNormalsWorld[2],da),N.r=Math.max(0,Math.min(j.color.r*N.r,1)),N.g=Math.max(0,Math.min(j.color.g*N.g,1)),N.b=Math.max(0,Math.min(j.color.b*N.b,1)),W.r=Math.max(0,Math.min(j.color.r*W.r,1)),W.g=Math.max(0,Math.min(j.color.g*W.g,1)),W.b=Math.max(0,Math.min(j.color.b*W.b,1)),S.r=Math.max(0,Math.min(j.color.r*
+S.r,1)),S.g=Math.max(0,Math.min(j.color.g*S.g,1)),S.b=Math.max(0,Math.min(j.color.b*S.b,1)),da.r=Math.max(0,Math.min(j.color.r*da.r,1)),da.g=Math.max(0,Math.min(j.color.g*da.g,1)),da.b=Math.max(0,Math.min(j.color.b*da.b,1)),sa=Q(N,W,S,da),y(T,$,V,l,L,v),Ka(T,$,V,l,L,v,0,0,1,0,0,1,sa),y(Y,aa,M,J,fa,ca),Ka(Y,aa,M,J,fa,ca,1,0,1,1,0,1,sa)):(U.r=ba.r,U.g=ba.g,U.b=ba.b,p(i,D.centroidWorld,D.normalWorld,U),U.r=Math.max(0,Math.min(j.color.r*U.r,1)),U.g=Math.max(0,Math.min(j.color.g*U.g,1)),U.b=Math.max(0,
+Math.min(j.color.b*U.b,1)),G(T,$,V,l,M,J,L,v),j.wireframe?Fa(U,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Ea(U)):(G(T,$,V,l,M,J,L,v),j.wireframe?Fa(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Ea(j.color));else if(j instanceof THREE.MeshNormalMaterial)U.r=P(D.normalWorld.x),U.g=P(D.normalWorld.y),U.b=P(D.normalWorld.z),G(T,$,V,l,M,J,L,v),j.wireframe?Fa(U,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Ea(U);else if(j instanceof THREE.MeshDepthMaterial)na=
+k.near,la=k.far,N.r=N.g=N.b=1-O(a.positionScreen.z,na,la),W.r=W.g=W.b=1-O(d.positionScreen.z,na,la),S.r=S.g=S.b=1-O(f.positionScreen.z,na,la),da.r=da.g=da.b=1-O(e.positionScreen.z,na,la),sa=Q(N,W,S,da),y(T,$,V,l,L,v),Ka(T,$,V,l,L,v,0,0,1,0,0,1,sa),y(Y,aa,M,J,fa,ca),Ka(Y,aa,M,J,fa,ca,1,0,1,1,0,1,sa)}function y(a,b,c,d,e,g){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(a,b);n.closePath()}function G(a,b,c,d,e,g,f,ba){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(f,
+ba);n.lineTo(a,b);n.closePath()}function Fa(a,b,c,e){if(w!=b)n.lineWidth=w=b;if(B!=c)n.lineCap=B=c;if(F!=e)n.lineJoin=F=e;d(a.getContextStyle());n.stroke();pa.inflate(b*2)}function Ea(a){e(a.getContextStyle());n.fill()}function Qa(a,b,c,d,g,f,ba,h,l,i,j,k,D){if(D.image.width!=0){if(D.needsUpdate==!0||va[D.id]==void 0){var Z=D.wrapS==THREE.RepeatWrapping,m=D.wrapT==THREE.RepeatWrapping;va[D.id]=n.createPattern(D.image,Z&&m?"repeat":Z&&!m?"repeat-x":!Z&&m?"repeat-y":"no-repeat");D.needsUpdate=!1}e(va[D.id]);
+var Z=D.offset.x/D.repeat.x,m=D.offset.y/D.repeat.y,o=D.image.width*D.repeat.x,p=D.image.height*D.repeat.y,ba=(ba+Z)*o,h=(h+m)*p,l=(l+Z)*o,i=(i+m)*p,j=(j+Z)*o,k=(k+m)*p;c-=a;d-=b;g-=a;f-=b;l-=ba;i-=h;j-=ba;k-=h;Z=l*k-j*i;if(Z==0){if(ea[D.id]==void 0)b=document.createElement("canvas"),b.width=D.image.width,b.height=D.image.height,a=b.getContext("2d"),a.drawImage(D.image,0,0),ea[D.id]=a.getImageData(0,0,D.image.width,D.image.height).data,delete b;b=ea[D.id];ba=(Math.floor(ba)+Math.floor(h)*D.image.width)*
+4;U.setRGB(b[ba]/255,b[ba+1]/255,b[ba+2]/255);Ea(U)}else Z=1/Z,D=(k*c-i*g)*Z,i=(k*d-i*f)*Z,c=(l*g-j*c)*Z,d=(l*f-j*d)*Z,a=a-D*ba-c*h,ba=b-i*ba-d*h,n.save(),n.transform(D,i,c,d,a,ba),n.fill(),n.restore()}}function Ka(a,b,c,d,e,g,f,ba,h,l,i,D,j){var k,Z;k=j.width-1;Z=j.height-1;f*=k;ba*=Z;h*=k;l*=Z;i*=k;D*=Z;c-=a;d-=b;e-=a;g-=b;h-=f;l-=ba;i-=f;D-=ba;Z=1/(h*D-i*l);k=(D*c-l*e)*Z;l=(D*d-l*g)*Z;c=(h*e-i*c)*Z;d=(h*g-i*d)*Z;a=a-k*f-c*ba;b=b-l*f-d*ba;n.save();n.transform(k,l,c,d,a,b);n.clip();n.drawImage(j,
+0,0);n.restore()}function Q(a,b,c,d){var e=~~(a.r*255),g=~~(a.g*255),a=~~(a.b*255),f=~~(b.r*255),ba=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),l=~~(c.g*255),c=~~(c.b*255),i=~~(d.r*255),D=~~(d.g*255),d=~~(d.b*255);Ca[0]=e<0?0:e>255?255:e;Ca[1]=g<0?0:g>255?255:g;Ca[2]=a<0?0:a>255?255:a;Ca[4]=f<0?0:f>255?255:f;Ca[5]=ba<0?0:ba>255?255:ba;Ca[6]=b<0?0:b>255?255:b;Ca[8]=h<0?0:h>255?255:h;Ca[9]=l<0?0:l>255?255:l;Ca[10]=c<0?0:c>255?255:c;Ca[12]=i<0?0:i>255?255:i;Ca[13]=D<0?0:D>255?255:D;Ca[14]=d<0?0:d>255?255:
+d;Ma.putImageData(Pa,0,0);C.drawImage(La,0,0);return Na}function O(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function P(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ga(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Oa,Ra,ua,Da;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,s);g.info.render.vertices=0;g.info.render.faces=0;f=j.projectScene(a,k,this.sortElements);h=f.elements;i=f.lights;(Ja=i.length>0)&&o(i);Oa=0;for(Ra=h.length;Oa<Ra;Oa++)if(ua=
+h[Oa],Da=ua.material,Da=Da instanceof THREE.MeshFaceMaterial?ua.faceMaterial:Da,!(Da==null||Da.opacity==0)){pa.empty();if(ua instanceof THREE.RenderableParticle)I=ua,I.x*=m,I.y*=s,q(I,ua,Da,a);else if(ua instanceof THREE.RenderableLine)I=ua.v1,R=ua.v2,I.positionScreen.x*=m,I.positionScreen.y*=s,R.positionScreen.x*=m,R.positionScreen.y*=s,pa.addPoint(I.positionScreen.x,I.positionScreen.y),pa.addPoint(R.positionScreen.x,R.positionScreen.y),qa.intersects(pa)&&r(I,R,ua,Da,a);else if(ua instanceof THREE.RenderableFace3)I=
+ua.v1,R=ua.v2,x=ua.v3,I.positionScreen.x*=m,I.positionScreen.y*=s,R.positionScreen.x*=m,R.positionScreen.y*=s,x.positionScreen.x*=m,x.positionScreen.y*=s,Da.overdraw&&(Ga(I.positionScreen,R.positionScreen),Ga(R.positionScreen,x.positionScreen),Ga(x.positionScreen,I.positionScreen)),pa.add3Points(I.positionScreen.x,I.positionScreen.y,R.positionScreen.x,R.positionScreen.y,x.positionScreen.x,x.positionScreen.y),qa.intersects(pa)&&t(I,R,x,0,1,2,ua,Da,a);else if(ua instanceof THREE.RenderableFace4)I=ua.v1,
+R=ua.v2,x=ua.v3,A=ua.v4,I.positionScreen.x*=m,I.positionScreen.y*=s,R.positionScreen.x*=m,R.positionScreen.y*=s,x.positionScreen.x*=m,x.positionScreen.y*=s,A.positionScreen.x*=m,A.positionScreen.y*=s,K.positionScreen.copy(R.positionScreen),X.positionScreen.copy(A.positionScreen),Da.overdraw&&(Ga(I.positionScreen,R.positionScreen),Ga(R.positionScreen,A.positionScreen),Ga(A.positionScreen,I.positionScreen),Ga(x.positionScreen,K.positionScreen),Ga(x.positionScreen,X.positionScreen)),pa.addPoint(I.positionScreen.x,
+I.positionScreen.y),pa.addPoint(R.positionScreen.x,R.positionScreen.y),pa.addPoint(x.positionScreen.x,x.positionScreen.y),pa.addPoint(A.positionScreen.x,A.positionScreen.y),qa.intersects(pa)&&u(I,R,x,A,K,X,ua,Da,a);ta.addRectangle(pa)}n.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,g,f,h,i,j;e=0;for(g=a.length;e<g;e++)f=a[e],h=f.color,f instanceof THREE.DirectionalLight?(i=f.matrixWorld.getPosition(),j=c.dot(i),j<=0||(j*=f.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):f instanceof THREE.PointLight&&(i=f.matrixWorld.getPosition(),j=c.dot(I.sub(i,b).normalize()),j<=0||(j*=f.distance==0?1:1-Math.min(b.distanceTo(i)/f.distance,1),j!=0&&(j*=f.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function b(a){R[a]==null&&(R[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),T==0&&R[a].setAttribute("shape-rendering","crispEdges"));return R[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,e,g,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,k,o,p,m,s,n,q,r=new THREE.Rectangle,t=new THREE.Rectangle,u=!1,y=new THREE.Color,G=new THREE.Color,w=new THREE.Color,B=new THREE.Color,F,I=new THREE.Vector3,R=[],x=[],A,K,X,T=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":T=1;break;case "low":T=0}};this.setSize=function(a,b){j=a;k=b;o=j/2;p=k/2;i.setAttribute("viewBox",-o+" "+-p+" "+j+" "+k);i.setAttribute("width",j);i.setAttribute("height",k);r.set(-o,-p,o,p)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(j,k){var l,R,J,L;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(j,k,this.sortElements);g=e.elements;
+f=e.lights;X=K=0;if(u=f.length>0){G.setRGB(0,0,0);w.setRGB(0,0,0);B.setRGB(0,0,0);l=0;for(R=f.length;l<R;l++)L=f[l],J=L.color,L instanceof THREE.AmbientLight?(G.r+=J.r,G.g+=J.g,G.b+=J.b):L instanceof THREE.DirectionalLight?(w.r+=J.r,w.g+=J.g,w.b+=J.b):L instanceof THREE.PointLight&&(B.r+=J.r,B.g+=J.g,B.b+=J.b)}l=0;for(R=g.length;l<R;l++)if(J=g[l],L=J.material,L=L instanceof THREE.MeshFaceMaterial?J.faceMaterial:L,!(L==null||L.opacity==0))if(t.empty(),J instanceof THREE.RenderableParticle)m=J,m.x*=
+o,m.y*=-p;else if(J instanceof THREE.RenderableLine){if(m=J.v1,s=J.v2,m.positionScreen.x*=o,m.positionScreen.y*=-p,s.positionScreen.x*=o,s.positionScreen.y*=-p,t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(s.positionScreen.x,s.positionScreen.y),r.intersects(t)){J=m;var v=s,I=X++;x[I]==null&&(x[I]=document.createElementNS("http://www.w3.org/2000/svg","line"),T==0&&x[I].setAttribute("shape-rendering","crispEdges"));A=x[I];A.setAttribute("x1",J.positionScreen.x);A.setAttribute("y1",J.positionScreen.y);
+A.setAttribute("x2",v.positionScreen.x);A.setAttribute("y2",v.positionScreen.y);L instanceof THREE.LineBasicMaterial&&(A.setAttribute("style","fill: none; stroke: "+L.color.getContextStyle()+"; stroke-width: "+L.linewidth+"; stroke-opacity: "+L.opacity+"; stroke-linecap: "+L.linecap+"; stroke-linejoin: "+L.linejoin),i.appendChild(A))}}else if(J instanceof THREE.RenderableFace3){if(m=J.v1,s=J.v2,n=J.v3,m.positionScreen.x*=o,m.positionScreen.y*=-p,s.positionScreen.x*=o,s.positionScreen.y*=-p,n.positionScreen.x*=
+o,n.positionScreen.y*=-p,t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(s.positionScreen.x,s.positionScreen.y),t.addPoint(n.positionScreen.x,n.positionScreen.y),r.intersects(t)){var v=m,I=s,aa=n;d.info.render.vertices+=3;d.info.render.faces++;A=b(K++);A.setAttribute("d","M "+v.positionScreen.x+" "+v.positionScreen.y+" L "+I.positionScreen.x+" "+I.positionScreen.y+" L "+aa.positionScreen.x+","+aa.positionScreen.y+"z");L instanceof THREE.MeshBasicMaterial?y.copy(L.color):L instanceof THREE.MeshLambertMaterial?
+u?(y.r=G.r,y.g=G.g,y.b=G.b,a(f,J.centroidWorld,J.normalWorld,y),y.r=Math.max(0,Math.min(L.color.r*y.r,1)),y.g=Math.max(0,Math.min(L.color.g*y.g,1)),y.b=Math.max(0,Math.min(L.color.b*y.b,1))):y.copy(L.color):L instanceof THREE.MeshDepthMaterial?(F=1-L.__2near/(L.__farPlusNear-J.z*L.__farMinusNear),y.setRGB(F,F,F)):L instanceof THREE.MeshNormalMaterial&&y.setRGB(c(J.normalWorld.x),c(J.normalWorld.y),c(J.normalWorld.z));L.wireframe?A.setAttribute("style","fill: none; stroke: "+y.getContextStyle()+"; stroke-width: "+
+L.wireframeLinewidth+"; stroke-opacity: "+L.opacity+"; stroke-linecap: "+L.wireframeLinecap+"; stroke-linejoin: "+L.wireframeLinejoin):A.setAttribute("style","fill: "+y.getContextStyle()+"; fill-opacity: "+L.opacity);i.appendChild(A)}}else if(J instanceof THREE.RenderableFace4&&(m=J.v1,s=J.v2,n=J.v3,q=J.v4,m.positionScreen.x*=o,m.positionScreen.y*=-p,s.positionScreen.x*=o,s.positionScreen.y*=-p,n.positionScreen.x*=o,n.positionScreen.y*=-p,q.positionScreen.x*=o,q.positionScreen.y*=-p,t.addPoint(m.positionScreen.x,
+m.positionScreen.y),t.addPoint(s.positionScreen.x,s.positionScreen.y),t.addPoint(n.positionScreen.x,n.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),r.intersects(t))){var v=m,I=s,aa=n,fa=q;d.info.render.vertices+=4;d.info.render.faces++;A=b(K++);A.setAttribute("d","M "+v.positionScreen.x+" "+v.positionScreen.y+" L "+I.positionScreen.x+" "+I.positionScreen.y+" L "+aa.positionScreen.x+","+aa.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");L instanceof THREE.MeshBasicMaterial?
+y.copy(L.color):L instanceof THREE.MeshLambertMaterial?u?(y.r=G.r,y.g=G.g,y.b=G.b,a(f,J.centroidWorld,J.normalWorld,y),y.r=Math.max(0,Math.min(L.color.r*y.r,1)),y.g=Math.max(0,Math.min(L.color.g*y.g,1)),y.b=Math.max(0,Math.min(L.color.b*y.b,1))):y.copy(L.color):L instanceof THREE.MeshDepthMaterial?(F=1-L.__2near/(L.__farPlusNear-J.z*L.__farMinusNear),y.setRGB(F,F,F)):L instanceof THREE.MeshNormalMaterial&&y.setRGB(c(J.normalWorld.x),c(J.normalWorld.y),c(J.normalWorld.z));L.wireframe?A.setAttribute("style",
+"fill: none; stroke: "+y.getContextStyle()+"; stroke-width: "+L.wireframeLinewidth+"; stroke-opacity: "+L.opacity+"; stroke-linecap: "+L.wireframeLinecap+"; stroke-linejoin: "+L.wireframeLinejoin):A.setAttribute("style","fill: "+y.getContextStyle()+"; fill-opacity: "+L.opacity);i.appendChild(A)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
@@ -221,115 +225,115 @@ THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THR
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
 THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
-THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=k.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(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=l.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
 function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){if(a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial)return!1;return a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){if(a.vertexColors)return a.vertexColors;return!1}function g(a){if(a.map||a.lightMap||a instanceof THREE.ShaderMaterial)return!0;
-return!1}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;var i=a.colors,m=i.length,j=a.__vertexArray,n=a.__colorArray,l=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,r=a.__webglCustomAttributesList;if(c.sortParticles){wa.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,R.copy(e),wa.multiplyVector3(R),l[d]=[R.z,d];l.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[l[d][1]].position,f=d*3,j[f]=e.x,j[f+1]=e.y,j[f+2]=e.z;for(d=0;d<m;d++)f=d*3,e=i[l[d][1]],n[f]=e.r,n[f+
-1]=e.g,n[f+2]=e.b;if(r){i=0;for(m=r.length;i<m;i++)if(h=r[i],h.boundTo===void 0||h.boundTo==="vertices")if(f=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)g=l[d][1],h.array[d]=h.value[g];else if(h.size===2)for(d=0;d<e;d++)g=l[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=l[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=l[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,
-f+=3;else if(h.size===4)for(d=0;d<e;d++)g=l[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}else{if(o)for(d=0;d<g;d++)e=h[d].position,f=d*3,j[f]=e.x,j[f+1]=e.y,j[f+2]=e.z;if(p)for(d=0;d<m;d++)e=i[d],f=d*3,n[f]=e.r,n[f+1]=e.g,n[f+2]=e.b;if(r){i=0;for(m=r.length;i<m;i++)if(h=r[i],h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices"))if(e=h.value.length,f=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)g=h.value[d],
-h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(h.size===4)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}if(o||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,j,b);if(p||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,
-a.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,n,b);if(r){i=0;for(m=r.length;i<m;i++)if(h=r[i],h.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,h.buffer),k.bufferData(k.ARRAY_BUFFER,h.array,b)}}function h(a,b){return b.z-a.z}function i(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)K=null,M=X=P=I=U=-1,a[d].render(b,c,ya,ua),K=null,M=X=P=I=U=-1}function l(a,b,c,d,e,f,g,h){var i,k,m,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;
-m=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&V.setBlending(i.blending);V.setDepthTest(i.depthTest);u(i.depthWrite);t(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}V.setObjectFaces(k);V.renderBuffer(d,e,f,i,m,k)}}function j(a,b,c,d,e,f,g){for(var h,i,k=0,m=a.length;k<m;k++)if(h=a[k],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&V.setBlending(h.blending);V.setDepthTest(h.depthTest);u(h.depthWrite);t(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}V.renderImmediateObject(c,
-d,e,h,i)}}function o(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 r(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,e){d.program||V.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=
-new Float32Array(V.maxMorphTargets);for(var f=0,g=V.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==K&&(k.useProgram(f),K=f,h=!0);if(d.id!==M)M=d.id,h=!0;if(h){k.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||
-d instanceof THREE.MeshLambertMaterial||d.lights){for(var m,j,n=0,l=0,o=0,p,r,R=ga,q=R.directional.colors,s=R.directional.positions,Y=R.point.colors,u=R.point.positions,x=R.point.distances,t=0,z=0,y=r=0,c=0,h=b.length;c<h;c++)if(m=b[c],j=m.color,p=m.intensity,r=m.distance,m instanceof THREE.AmbientLight)V.gammaInput?(n+=j.r*j.r,l+=j.g*j.g,o+=j.b*j.b):(n+=j.r,l+=j.g,o+=j.b);else if(m instanceof THREE.DirectionalLight)r=t*3,V.gammaInput?(q[r]=j.r*j.r*p*p,q[r+1]=j.g*j.g*p*p,q[r+2]=j.b*j.b*p*p):(q[r]=
-j.r*p,q[r+1]=j.g*p,q[r+2]=j.b*p),m=m.matrixWorld.getPosition(),j=1/m.length(),s[r]=m.x*j,s[r+1]=m.y*j,s[r+2]=m.z*j,t+=1;else if(m instanceof THREE.SpotLight)r=t*3,V.gammaInput?(q[r]=j.r*j.r*p*p,q[r+1]=j.g*j.g*p*p,q[r+2]=j.b*j.b*p*p):(q[r]=j.r*p,q[r+1]=j.g*p,q[r+2]=j.b*p),m=m.matrixWorld.getPosition(),j=1/m.length(),s[r]=m.x*j,s[r+1]=m.y*j,s[r+2]=m.z*j,t+=1;else if(m instanceof THREE.PointLight)y=z*3,V.gammaInput?(Y[y]=j.r*j.r*p*p,Y[y+1]=j.g*j.g*p*p,Y[y+2]=j.b*j.b*p*p):(Y[y]=j.r*p,Y[y+1]=j.g*p,Y[y+
-2]=j.b*p),m=m.matrixWorld.getPosition(),u[y]=m.x,u[y+1]=m.y,u[y+2]=m.z,x[z]=r,z+=1;c=t*3;for(h=q.length;c<h;c++)q[c]=0;c=z*3;for(h=Y.length;c<h;c++)Y[c]=0;R.point.length=z;R.directional.length=t;R.ambient[0]=n;R.ambient[1]=l;R.ambient[2]=o;b=ga;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=
+return!1}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;var i=a.colors,j=i.length,k=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,s=a.__webglCustomAttributesList;if(c.sortParticles){ya.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,za.copy(e),ya.multiplyVector3(za),n[d]=[za.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=d*3,k[f]=e.x,k[f+1]=e.y,k[f+2]=e.z;for(d=0;d<j;d++)f=d*3,e=i[n[d][1]],m[f]=e.r,m[f+
+1]=e.g,m[f+2]=e.b;if(s){i=0;for(j=s.length;i<j;i++)if(h=s[i],h.boundTo===void 0||h.boundTo==="vertices")if(f=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)g=n[d][1],h.array[d]=h.value[g];else if(h.size===2)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(h.size===3)if(h.type==="c")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(h.size===4)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=d*3,k[f]=e.x,k[f+1]=e.y,k[f+2]=e.z;if(p)for(d=0;d<j;d++)e=i[d],f=d*3,m[f]=e.r,m[f+1]=e.g,m[f+2]=e.b;if(s){i=0;for(j=s.length;i<j;i++)if(h=s[i],h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices"))if(e=h.value.length,f=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)g=h.value[d],
+h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(h.size===4)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}if(o||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,k,b);if(p||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,
+a.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,m,b);if(s){i=0;for(j=s.length;i<j;i++)if(h=s[i],h.needsUpdate||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,h.buffer),l.bufferData(l.ARRAY_BUFFER,h.array,b)}}function h(a,b){return b.z-a.z}function i(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)J=null,v=Y=W=N=U=-1,a[d].render(b,c,Ba,wa),J=null,v=Y=W=N=U=-1}function j(a,b,c,d,e,f,g,h){var l,i,j,k;b?(i=a.length-1,k=b=-1):(i=0,b=a.length,k=1);for(var m=i;m!==b;m+=k)if(l=a[m],l.render){i=l.object;
+j=l.buffer;if(h)l=h;else{l=l[c];if(!l)continue;g&&V.setBlending(l.blending);V.setDepthTest(l.depthTest);t(l.depthWrite);u(l.polygonOffset,l.polygonOffsetFactor,l.polygonOffsetUnits)}V.setObjectFaces(i);V.renderBuffer(d,e,f,l,j,i)}}function k(a,b,c,d,e,f,g){for(var h,l,i=0,j=a.length;i<j;i++)if(h=a[i],l=h.object,l.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&V.setBlending(h.blending);V.setDepthTest(h.depthTest);t(h.depthWrite);u(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}V.renderImmediateObject(c,
+d,e,h,l)}}function o(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 s(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function q(a,b,c,d,e){d.program||V.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=
+new Float32Array(V.maxMorphTargets);for(var f=0,g=V.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==J&&(l.useProgram(f),J=f,h=!0);if(d.id!==v)v=d.id,h=!0;if(h){l.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||
+d instanceof THREE.MeshLambertMaterial||d.lights){for(var j,k,m=0,n=0,o=0,p,s,q=Aa,r=q.directional.colors,t=q.directional.positions,x=q.point.colors,u=q.point.positions,A=q.point.distances,y=0,R=0,K=s=0,c=0,h=b.length;c<h;c++)if(j=b[c],k=j.color,p=j.intensity,s=j.distance,j instanceof THREE.AmbientLight)V.gammaInput?(m+=k.r*k.r,n+=k.g*k.g,o+=k.b*k.b):(m+=k.r,n+=k.g,o+=k.b);else if(j instanceof THREE.DirectionalLight)s=y*3,V.gammaInput?(r[s]=k.r*k.r*p*p,r[s+1]=k.g*k.g*p*p,r[s+2]=k.b*k.b*p*p):(r[s]=
+k.r*p,r[s+1]=k.g*p,r[s+2]=k.b*p),j=j.matrixWorld.getPosition(),k=1/j.length(),t[s]=j.x*k,t[s+1]=j.y*k,t[s+2]=j.z*k,y+=1;else if(j instanceof THREE.SpotLight)s=y*3,V.gammaInput?(r[s]=k.r*k.r*p*p,r[s+1]=k.g*k.g*p*p,r[s+2]=k.b*k.b*p*p):(r[s]=k.r*p,r[s+1]=k.g*p,r[s+2]=k.b*p),j=j.matrixWorld.getPosition(),k=1/j.length(),t[s]=j.x*k,t[s+1]=j.y*k,t[s+2]=j.z*k,y+=1;else if(j instanceof THREE.PointLight)K=R*3,V.gammaInput?(x[K]=k.r*k.r*p*p,x[K+1]=k.g*k.g*p*p,x[K+2]=k.b*k.b*p*p):(x[K]=k.r*p,x[K+1]=k.g*p,x[K+
+2]=k.b*p),j=j.matrixWorld.getPosition(),u[K]=j.x,u[K+1]=j.y,u[K+2]=j.z,A[R]=s,R+=1;c=y*3;for(h=r.length;c<h;c++)r[c]=0;c=R*3;for(h=x.length;c<h;c++)x[c]=0;q.point.length=R;q.directional.length=y;q.ambient[0]=m;q.ambient[1]=n;q.ambient[2]=o;b=Aa;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=
 b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,V.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=B.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,V.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),
+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=I.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,V.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),
 i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof THREE.MeshLambertMaterial)V.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<V.shadowMapPlugin.shadowMatrix.length;b++)i.shadowMatrix.value[b]=
-V.shadowMapPlugin.shadowMatrix[b],i.shadowMap.texture[b]=V.shadowMapPlugin.shadowMap[b];i.shadowDarkness.value=V.shadowMapDarkness;i.shadowBias.value=V.shadowMapBias}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(l=f.uniforms[b[i][1]])if(n=b[i][0],o=n.type,h=n.value,o==="i")k.uniform1i(l,h);else if(o==="f")k.uniform1f(l,h);else if(o==="v2")k.uniform2f(l,h.x,h.y);else if(o==="v3")k.uniform3f(l,h.x,h.y,h.z);else if(o==="v4")k.uniform4f(l,h.x,h.y,h.z,h.w);else if(o==="c")k.uniform3f(l,h.r,h.g,h.b);else if(o===
-"fv1")k.uniform1fv(l,h);else if(o==="fv")k.uniform3fv(l,h);else if(o==="v3v"){if(!n._array)n._array=new Float32Array(3*h.length);o=0;for(R=h.length;o<R;o++)q=o*3,n._array[q]=h[o].x,n._array[q+1]=h[o].y,n._array[q+2]=h[o].z;k.uniform3fv(l,n._array)}else if(o==="m4"){if(!n._array)n._array=new Float32Array(16);h.flattenToArray(n._array);k.uniformMatrix4fv(l,!1,n._array)}else if(o==="m4v"){if(!n._array)n._array=new Float32Array(16*h.length);o=0;for(R=h.length;o<R;o++)h[o].flattenToArrayOffset(n._array,
-o*16);k.uniformMatrix4fv(l,!1,n._array)}else if(o==="t"){if(k.uniform1i(l,h),l=n.texture)if(l.image instanceof Array&&l.image.length===6){if(n=l,n.image.length===6)if(n.needsUpdate){if(!n.image.__webglTextureCube)n.image.__webglTextureCube=k.createTexture();k.activeTexture(k.TEXTURE0+h);k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);h=A(k.TEXTURE_CUBE_MAP,n,n.image[0]);for(l=0;l<6;l++)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,n.image[l]);h&&k.generateMipmap(k.TEXTURE_CUBE_MAP);
-n.needsUpdate=!1}else k.activeTexture(k.TEXTURE0+h),k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}else l instanceof THREE.WebGLRenderTargetCube?(n=l,k.activeTexture(k.TEXTURE0+h),k.bindTexture(k.TEXTURE_CUBE_MAP,n.__webglTexture)):V.setTexture(l,h)}else if(o==="tv"){if(!n._array){n._array=[];o=0;for(R=n.texture.length;o<R;o++)n._array[o]=h+o}k.uniform1iv(l,n._array);o=0;for(R=n.texture.length;o<R;o++)(l=n.texture[o])&&V.setTexture(l,n._array[o])}(d instanceof THREE.ShaderMaterial||
-d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null&&k.uniform3f(g.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&g.viewMatrix!==null&&k.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(k.uniformMatrix4fv(g.cameraInverseMatrix,!1,a._viewMatrixArray),k.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}k.uniformMatrix4fv(g.modelViewMatrix,
-!1,e._modelViewMatrixArray);g.normalMatrix&&k.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&g.objectMatrix!==null&&k.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function s(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function u(a){P!==a&&(k.depthMask(a),
-P=a)}function t(a,b,c){$!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),$=a);if(a&&(Z!==b||oa!==c))k.polygonOffset(b,c),Z=b,oa=c}function y(a,b){var c;a==="fragment"?c=k.createShader(k.FRAGMENT_SHADER):a==="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(c)),console.error(b),null;return c}function A(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-
-1)===0?(k.texParameteri(a,k.TEXTURE_WRAP_S,H(b.wrapS)),k.texParameteri(a,k.TEXTURE_WRAP_T,H(b.wrapT)),k.texParameteri(a,k.TEXTURE_MAG_FILTER,H(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,H(b.minFilter)),!0):(k.texParameteri(a,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_MAG_FILTER,F(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,F(b.minFilter)),!1)}function D(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);b.depthBuffer&&
-!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}function F(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;
-default:return k.LINEAR}}function H(a){switch(a){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR;
-case THREE.ByteType:return k.BYTE;case THREE.UnsignedByteType:return k.UNSIGNED_BYTE;case THREE.ShortType:return k.SHORT;case THREE.UnsignedShortType:return k.UNSIGNED_SHORT;case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0}
-var a=a||{},B=a.canvas!==void 0?a.canvas:document.createElement("canvas"),J=a.precision!==void 0?a.precision:"highp",x=a.antialias!==void 0?a.antialias:!1,z=a.stencil!==void 0?a.stencil:!0,G=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,W=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),S=a.clearAlpha!==void 0?a.clearAlpha:0,T=a.maxLights!==void 0?a.maxLights:4;this.domElement=B;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
+V.shadowMapPlugin.shadowMatrix[b],i.shadowMap.texture[b]=V.shadowMapPlugin.shadowMap[b];i.shadowDarkness.value=V.shadowMapDarkness;i.shadowBias.value=V.shadowMapBias}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(n=f.uniforms[b[i][1]])if(m=b[i][0],o=m.type,h=m.value,o==="i")l.uniform1i(n,h);else if(o==="f")l.uniform1f(n,h);else if(o==="v2")l.uniform2f(n,h.x,h.y);else if(o==="v3")l.uniform3f(n,h.x,h.y,h.z);else if(o==="v4")l.uniform4f(n,h.x,h.y,h.z,h.w);else if(o==="c")l.uniform3f(n,h.r,h.g,h.b);else if(o===
+"fv1")l.uniform1fv(n,h);else if(o==="fv")l.uniform3fv(n,h);else if(o==="v3v"){if(!m._array)m._array=new Float32Array(3*h.length);o=0;for(q=h.length;o<q;o++)r=o*3,m._array[r]=h[o].x,m._array[r+1]=h[o].y,m._array[r+2]=h[o].z;l.uniform3fv(n,m._array)}else if(o==="m4"){if(!m._array)m._array=new Float32Array(16);h.flattenToArray(m._array);l.uniformMatrix4fv(n,!1,m._array)}else if(o==="m4v"){if(!m._array)m._array=new Float32Array(16*h.length);o=0;for(q=h.length;o<q;o++)h[o].flattenToArrayOffset(m._array,
+o*16);l.uniformMatrix4fv(n,!1,m._array)}else if(o==="t"){if(l.uniform1i(n,h),n=m.texture)if(n.image instanceof Array&&n.image.length===6){if(m=n,m.image.length===6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=l.createTexture();l.activeTexture(l.TEXTURE0+h);l.bindTexture(l.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);h=G(l.TEXTURE_CUBE_MAP,m,m.image[0]);for(n=0;n<6;n++)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,l.RGBA,l.RGBA,l.UNSIGNED_BYTE,m.image[n]);h&&l.generateMipmap(l.TEXTURE_CUBE_MAP);
+m.needsUpdate=!1}else l.activeTexture(l.TEXTURE0+h),l.bindTexture(l.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(m=n,l.activeTexture(l.TEXTURE0+h),l.bindTexture(l.TEXTURE_CUBE_MAP,m.__webglTexture)):V.setTexture(n,h)}else if(o==="tv"){if(!m._array){m._array=[];o=0;for(q=m.texture.length;o<q;o++)m._array[o]=h+o}l.uniform1iv(n,m._array);o=0;for(q=m.texture.length;o<q;o++)(n=m.texture[o])&&V.setTexture(n,m._array[o])}(d instanceof THREE.ShaderMaterial||
+d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null&&l.uniform3f(g.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&g.viewMatrix!==null&&l.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(l.uniformMatrix4fv(g.cameraInverseMatrix,!1,a._viewMatrixArray),l.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}l.uniformMatrix4fv(g.modelViewMatrix,
+!1,e._modelViewMatrixArray);g.normalMatrix&&l.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&g.objectMatrix!==null&&l.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function 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 t(a){W!==a&&
+(l.depthMask(a),W=a)}function u(a,b,c){S!==a&&(a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),S=a);if(a&&(da!==b||va!==c))l.polygonOffset(b,c),da=b,va=c}function y(a,b){var c;a==="fragment"?c=l.createShader(l.FRAGMENT_SHADER):a==="vertex"&&(c=l.createShader(l.VERTEX_SHADER));l.shaderSource(c,b);l.compileShader(c);if(!l.getShaderParameter(c,l.COMPILE_STATUS))return console.error(l.getShaderInfoLog(c)),console.error(b),null;return c}function G(a,b,c){return(c.width&c.width-1)===
+0&&(c.height&c.height-1)===0?(l.texParameteri(a,l.TEXTURE_WRAP_S,F(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,F(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,F(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,F(b.minFilter)),!0):(l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_MAG_FILTER,B(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,B(b.minFilter)),!1)}function w(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 B(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return l.NEAREST;
+default:return l.LINEAR}}function F(a){switch(a){case THREE.RepeatWrapping:return l.REPEAT;case THREE.ClampToEdgeWrapping:return l.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return l.MIRRORED_REPEAT;case THREE.NearestFilter:return l.NEAREST;case THREE.NearestMipMapNearestFilter:return l.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return l.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return l.LINEAR;case THREE.LinearMipMapNearestFilter:return l.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return l.LINEAR_MIPMAP_LINEAR;
+case THREE.ByteType:return l.BYTE;case THREE.UnsignedByteType:return l.UNSIGNED_BYTE;case THREE.ShortType:return l.SHORT;case THREE.UnsignedShortType:return l.UNSIGNED_SHORT;case THREE.IntType:return l.INT;case THREE.UnsignedShortType:return l.UNSIGNED_INT;case THREE.FloatType:return l.FLOAT;case THREE.AlphaFormat:return l.ALPHA;case THREE.RGBFormat:return l.RGB;case THREE.RGBAFormat:return l.RGBA;case THREE.LuminanceFormat:return l.LUMINANCE;case THREE.LuminanceAlphaFormat:return l.LUMINANCE_ALPHA}return 0}
+var a=a||{},I=a.canvas!==void 0?a.canvas:document.createElement("canvas"),R=a.precision!==void 0?a.precision:"highp",x=a.antialias!==void 0?a.antialias:!1,A=a.stencil!==void 0?a.stencil:!0,K=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,X=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),T=a.clearAlpha!==void 0?a.clearAlpha:0,$=a.maxLights!==void 0?a.maxLights:4;this.domElement=I;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
 this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,
-vertices:0,faces:0}};var V=this,k,L=[],K=null,v=null,M=-1,X=null,ca=0,ea=null,aa=null,U=null,I=null,P=null,$=null,Z=null,oa=null,ba=null,ma=0,sa=0,ja=0,ka=0,ya=0,ua=0,va=new THREE.Frustum,wa=new THREE.Matrix4,R=new THREE.Vector4,ga={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};k=function(){var a;try{if(!(a=B.getContext("experimental-webgl",{antialias:x,stencil:z,preserveDrawingBuffer:G})))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}();k.clearColor(0,0,0,1);k.clearDepth(1);k.clearStencil(0);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(W.r,W.g,W.b,S);this.context=k;var Y=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
-0;this.getContext=function(){return k};this.supportsVertexTextures=function(){return Y};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){ma=a;sa=b;ja=c;ka=d;k.viewport(ma,sa,ja,ka)};this.setScissor=function(a,b,c,d){k.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.setClearColorHex=function(a,b){W.setHex(a);S=b;k.clearColor(W.r,W.g,W.b,S)};this.setClearColor=function(a,
-b){W.copy(a);S=b;k.clearColor(W.r,W.g,W.b,S)};this.getClearColor=function(){return W};this.getClearAlpha=function(){return S};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=k.COLOR_BUFFER_BIT;if(b===void 0||b)d|=k.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=k.STENCIL_BUFFER_BIT;k.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];k.deleteBuffer(c.__webglVertexBuffer);k.deleteBuffer(c.__webglNormalBuffer);k.deleteBuffer(c.__webglTangentBuffer);k.deleteBuffer(c.__webglColorBuffer);k.deleteBuffer(c.__webglUVBuffer);k.deleteBuffer(c.__webglUV2Buffer);
-k.deleteBuffer(c.__webglSkinVertexABuffer);k.deleteBuffer(c.__webglSkinVertexBBuffer);k.deleteBuffer(c.__webglSkinIndicesBuffer);k.deleteBuffer(c.__webglSkinWeightsBuffer);k.deleteBuffer(c.__webglFaceBuffer);k.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)k.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)k.deleteBuffer(c.__webglCustomAttributesList[d].buffer);V.info.memory.geometries--}else if(a instanceof
-THREE.Ribbon)a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),V.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),V.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),V.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,
-k.deleteTexture(a.__webglTexture),V.info.memory.textures--};this.updateShadowMap=function(a,b){K=null;M=X=P=I=U=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=k.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=k.createBuffer();a.hasPos&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,a.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.position),k.vertexAttribPointer(b.attributes.position,
-3,k.FLOAT,!1,0,0));if(a.hasNormal){k.bindBuffer(k.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,m,j,n,l,o=a.count*3;for(l=0;l<o;l+=9)c=a.normalArray,d=c[l],e=c[l+1],f=c[l+2],g=c[l+3],i=c[l+4],j=c[l+5],h=c[l+6],m=c[l+7],n=c[l+8],d=(d+g+h)/3,e=(e+i+m)/3,f=(f+j+n)/3,c[l]=d,c[l+1]=e,c[l+2]=f,c[l+3]=d,c[l+4]=e,c[l+5]=f,c[l+6]=d,c[l+7]=e,c[l+8]=f}k.bufferData(k.ARRAY_BUFFER,a.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.normal);k.vertexAttribPointer(b.attributes.normal,
-3,k.FLOAT,!1,0,0)}k.drawArrays(k.TRIANGLES,0,a.count);a.count=0};this.renderBuffer=function(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=q(a,b,c,d,f),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==X&&(X=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;f.morphTargetBase!==-1?(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),
-k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):c.position>=0&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),k.vertexAttribPointer(c["morphTarget"+g],3,k.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],m=-1,
-j=0;h=f.morphTargetInfluences;var n,l=h.length;g=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(n=0;n<l;n++)!i[n]&&h[n]>m&&(j=n,m=h[j]);k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j]);k.vertexAttribPointer(c["morphTarget"+g],3,k.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=m;i[j]=1;m=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=
-0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],b[c.buffer.belongsToAttribute]>=0&&(k.bindBuffer(k.ARRAY_BUFFER,c.buffer),k.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,k.FLOAT,!1,0,0))}b.color>=0&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglColorBuffer),k.vertexAttribPointer(b.color,3,k.FLOAT,!1,0,0));b.normal>=0&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglNormalBuffer),k.vertexAttribPointer(b.normal,3,k.FLOAT,!1,0,0));b.tangent>=0&&(k.bindBuffer(k.ARRAY_BUFFER,
-e.__webglTangentBuffer),k.vertexAttribPointer(b.tangent,4,k.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(k.bindBuffer(k.ARRAY_BUFFER,e.__webglUVBuffer),k.vertexAttribPointer(b.uv,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv)):k.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(k.bindBuffer(k.ARRAY_BUFFER,e.__webglUV2Buffer),k.vertexAttribPointer(b.uv2,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv2)):k.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
-0&&b.skinIndex>=0&&b.skinWeight>=0&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexABuffer),k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),k.vertexAttribPointer(b.skinVertexB,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?
-(d=d.wireframeLinewidth,d!==ba&&(k.lineWidth(d),ba=d),a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),k.drawElements(k.LINES,e.__webglLineCount,k.UNSIGNED_SHORT,0)):(a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),k.drawElements(k.TRIANGLES,e.__webglFaceCount,k.UNSIGNED_SHORT,0)),V.info.render.calls++,V.info.render.vertices+=e.__webglFaceCount,V.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES,d=d.linewidth,d!==
-ba&&(k.lineWidth(d),ba=d),k.drawArrays(f,0,e.__webglLineCount),V.info.render.calls++):f instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,e.__webglParticleCount),V.info.render.calls++):f instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount),V.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,g,m,n=a.lights,o=a.fog;M=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();i(this.renderPluginsPre,a,b);V.info.render.calls=0;V.info.render.vertices=0;V.info.render.faces=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);wa.multiply(b.projectionMatrix,b.matrixWorldInverse);
-va.setFromMatrix(wa);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++)if(f=m[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh)||!g.frustumCulled||va.contains(g))){g.matrixWorld.flattenToArray(g._objectMatrixArray);s(g,b);var p=f,r=p.object,q=p.buffer,Y=void 0,Y=Y=void 0,Y=r.material;if(Y instanceof THREE.MeshFaceMaterial){if(Y=q.materialIndex,Y>=0)Y=r.geometry.materials[Y],
-Y.transparent?(p.transparent=Y,p.opaque=null):(p.opaque=Y,p.transparent=null)}else if(Y)Y.transparent?(p.transparent=Y,p.opaque=null):(p.opaque=Y,p.transparent=null);f.render=!0;if(this.sortObjects)g.renderDepth?f.z=g.renderDepth:(R.copy(g.position),wa.multiplyVector3(R),f.z=R.z)}this.sortObjects&&m.sort(h);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++)if(f=m[d],g=f.object,g.visible)g.matrixAutoUpdate&&g.matrixWorld.flattenToArray(g._objectMatrixArray),s(g,b),g=f.object.material,g.transparent?
-(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),u(a.overrideMaterial.depthWrite),t(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,n,o,!0,a.overrideMaterial),j(a.__webglObjectsImmediate,"",b,n,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),l(a.__webglObjects,!0,
-"opaque",b,n,o,!1),j(a.__webglObjectsImmediate,"opaque",b,n,o,!1),l(a.__webglObjects,!1,"transparent",b,n,o,!0),j(a.__webglObjectsImmediate,"transparent",b,n,o,!0));i(this.renderPluginsPost,a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture),k.generateMipmap(k.TEXTURE_CUBE_MAP),k.bindTexture(k.TEXTURE_CUBE_MAP,null)):(k.bindTexture(k.TEXTURE_2D,c.__webglTexture),k.generateMipmap(k.TEXTURE_2D),
-k.bindTexture(k.TEXTURE_2D,null)))};this.renderImmediateObject=function(a,b,c,d,e){var f=q(a,b,c,d,e);X=-1;V.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,k,va):e.render(function(a){V.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 h=a.__objectsAdded[0],i=a,j=void 0,l=void 0,q=void 0;if(!h.__webglInit)if(h.__webglInit=
-!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){l=h.geometry;if(l.geometryGroups===void 0){var q=l,R=void 0,s=void 0,Y=void 0,ga=void 0,u=void 0,x=void 0,t=void 0,z={},y=q.morphTargets.length;q.geometryGroups={};R=0;for(s=q.faces.length;R<s;R++)Y=q.faces[R],ga=Y.materialIndex,x=ga!==void 0?ga:-1,z[x]===void 0&&
-(z[x]={hash:x,counter:0}),t=z[x].hash+"_"+z[x].counter,q.geometryGroups[t]===void 0&&(q.geometryGroups[t]={faces3:[],faces4:[],materialIndex:ga,vertices:0,numMorphTargets:y}),u=Y instanceof THREE.Face3?3:4,q.geometryGroups[t].vertices+u>65535&&(z[x].counter+=1,t=z[x].hash+"_"+z[x].counter,q.geometryGroups[t]===void 0&&(q.geometryGroups[t]={faces3:[],faces4:[],materialIndex:ga,vertices:0,numMorphTargets:y})),Y instanceof THREE.Face3?q.geometryGroups[t].faces3.push(R):q.geometryGroups[t].faces4.push(R),
-q.geometryGroups[t].vertices+=u;q.geometryGroupsList=[];R=void 0;for(R in q.geometryGroups)q.geometryGroups[R].id=ca++,q.geometryGroupsList.push(q.geometryGroups[R])}for(j in l.geometryGroups)if(q=l.geometryGroups[j],!q.__webglVertexBuffer){R=q;R.__webglVertexBuffer=k.createBuffer();R.__webglNormalBuffer=k.createBuffer();R.__webglTangentBuffer=k.createBuffer();R.__webglColorBuffer=k.createBuffer();R.__webglUVBuffer=k.createBuffer();R.__webglUV2Buffer=k.createBuffer();R.__webglSkinVertexABuffer=k.createBuffer();
-R.__webglSkinVertexBBuffer=k.createBuffer();R.__webglSkinIndicesBuffer=k.createBuffer();R.__webglSkinWeightsBuffer=k.createBuffer();R.__webglFaceBuffer=k.createBuffer();R.__webglLineBuffer=k.createBuffer();if(R.numMorphTargets){Y=s=void 0;R.__webglMorphTargetsBuffers=[];s=0;for(Y=R.numMorphTargets;s<Y;s++)R.__webglMorphTargetsBuffers.push(k.createBuffer())}V.info.memory.geometries++;ga=h;u=ga.geometry;s=q.faces3;x=q.faces4;R=s.length*3+x.length*4;Y=s.length*1+x.length*2;x=s.length*3+x.length*4;s=
-c(ga,q);t=g(s);z=d(s);y=e(s);q.__vertexArray=new Float32Array(R*3);if(z)q.__normalArray=new Float32Array(R*3);if(u.hasTangents)q.__tangentArray=new Float32Array(R*4);if(y)q.__colorArray=new Float32Array(R*3);if(t){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)q.__uvArray=new Float32Array(R*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)q.__uv2Array=new Float32Array(R*2)}if(ga.geometry.skinWeights.length&&ga.geometry.skinIndices.length)q.__skinVertexAArray=new Float32Array(R*4),q.__skinVertexBArray=
-new Float32Array(R*4),q.__skinIndexArray=new Float32Array(R*4),q.__skinWeightArray=new Float32Array(R*4);q.__faceArray=new Uint16Array(Y*3);q.__lineArray=new Uint16Array(x*2);if(q.numMorphTargets){q.__morphTargetsArrays=[];ga=0;for(u=q.numMorphTargets;ga<u;ga++)q.__morphTargetsArrays.push(new Float32Array(R*3))}q.__webglFaceCount=Y*3;q.__webglLineCount=x*2;if(s.attributes){if(q.__webglCustomAttributesList===void 0)q.__webglCustomAttributesList=[];Y=void 0;for(Y in s.attributes){var ga=s.attributes[Y],
-u={},J;for(J in ga)u[J]=ga[J];if(!u.__webglInitialized||u.createUniqueBuffers)u.__webglInitialized=!0,x=1,u.type==="v2"?x=2:u.type==="v3"?x=3:u.type==="v4"?x=4:u.type==="c"&&(x=3),u.size=x,u.array=new Float32Array(R*x),u.buffer=k.createBuffer(),u.buffer.belongsToAttribute=Y,ga.needsUpdate=!0,u.__original=ga;q.__webglCustomAttributesList.push(u)}}q.__inittedArrays=!0;l.__dirtyVertices=!0;l.__dirtyMorphTargets=!0;l.__dirtyElements=!0;l.__dirtyUvs=!0;l.__dirtyNormals=!0;l.__dirtyTangents=!0;l.__dirtyColors=
-!0}}else if(h instanceof THREE.Ribbon){if(l=h.geometry,!l.__webglVertexBuffer)q=l,q.__webglVertexBuffer=k.createBuffer(),q.__webglColorBuffer=k.createBuffer(),V.info.memory.geometries++,q=l,R=q.vertices.length,q.__vertexArray=new Float32Array(R*3),q.__colorArray=new Float32Array(R*3),q.__webglVertexCount=R,l.__dirtyVertices=!0,l.__dirtyColors=!0}else if(h instanceof THREE.Line){if(l=h.geometry,!l.__webglVertexBuffer)q=l,q.__webglVertexBuffer=k.createBuffer(),q.__webglColorBuffer=k.createBuffer(),
-V.info.memory.geometries++,q=l,R=h,s=q.vertices.length,q.__vertexArray=new Float32Array(s*3),q.__colorArray=new Float32Array(s*3),q.__webglLineCount=s,b(q,R),l.__dirtyVertices=!0,l.__dirtyColors=!0}else if(h instanceof THREE.ParticleSystem&&(l=h.geometry,!l.__webglVertexBuffer))q=l,q.__webglVertexBuffer=k.createBuffer(),q.__webglColorBuffer=k.createBuffer(),V.info.geometries++,q=l,R=h,s=q.vertices.length,q.__vertexArray=new Float32Array(s*3),q.__colorArray=new Float32Array(s*3),q.__sortArray=[],q.__webglParticleCount=
-s,b(q,R),l.__dirtyVertices=!0,l.__dirtyColors=!0;if(!h.__webglActive){if(h instanceof THREE.Mesh)for(j in l=h.geometry,l.geometryGroups)q=l.geometryGroups[j],o(i.__webglObjects,q,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(l=h.geometry,o(i.__webglObjects,l,h)):THREE.MarchingCubes!==void 0&&h instanceof THREE.MarchingCubes||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):
-h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)h=a.__objectsRemoved[0],i=a,h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem||h instanceof THREE.Ribbon||h instanceof THREE.Line?r(i.__webglObjects,h):h instanceof THREE.Sprite?n(i.__webglSprites,h):h instanceof THREE.LensFlare?n(i.__webglFlares,h):(h instanceof THREE.MarchingCubes||h.immediateRenderCallback)&&r(i.__webglObjectsImmediate,h),h.__webglActive=
-!1,a.__objectsRemoved.splice(0,1);h=0;for(i=a.__webglObjects.length;h<i;h++)if(J=a.__webglObjects[h].object,j=J.geometry,l=Y=s=void 0,J instanceof THREE.Mesh){q=0;for(R=j.geometryGroupsList.length;q<R;q++)if(s=j.geometryGroupsList[q],l=c(J,s),Y=l.attributes&&p(l),j.__dirtyVertices||j.__dirtyMorphTargets||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents||Y){var G=J,Y=k.DYNAMIC_DRAW,ga=!j.dynamic,t=l;if(s.__inittedArrays){var u=d(t),x=e(t),D=g(t),K=u===THREE.SmoothShading,
-B=z=t=void 0,E=void 0,A=void 0,H=void 0,v=void 0,M=void 0,F=void 0,L=B=void 0,Q=void 0,N=void 0,O=void 0,T=E=void 0,W=void 0,X=void 0,S=E=F=void 0,U=void 0,aa=O=N=Q=v=void 0,I=E=O=N=Q=aa=O=N=Q=aa=O=N=Q=void 0,P=void 0,$=H=void 0,ea=void 0,Z=void 0,oa=void 0,ba=void 0,ma=L=Z=P=0,ka=0,ja=I=B=0,fa=v=T=0,C=0,la=void 0,fa=s.__vertexArray,ea=s.__uvArray,C=s.__uv2Array,$=s.__normalArray,A=s.__tangentArray,W=s.__colorArray,S=s.__skinVertexAArray,U=s.__skinVertexBArray,M=s.__skinIndexArray,na=s.__skinWeightArray,
-aa=s.__morphTargetsArrays,y=s.__webglCustomAttributesList,w=void 0,w=s.__faceArray,la=s.__lineArray,X=G.geometry,sa=X.__dirtyElements,va=X.__dirtyUvs,H=X.__dirtyNormals,F=X.__dirtyTangents,wa=X.__dirtyColors,oa=X.__dirtyMorphTargets,ba=X.vertices,G=s.faces3,ha=s.faces4,ia=X.faces,ua=X.faceVertexUvs[0],ya=X.faceVertexUvs[1],Fa=X.skinVerticesA,Ga=X.skinVerticesB,Ha=X.skinIndices,Da=X.skinWeights,Ea=X.morphTargets;if(X.__dirtyVertices){t=0;for(z=G.length;t<z;t++)E=ia[G[t]],Q=ba[E.a].position,N=ba[E.b].position,
-O=ba[E.c].position,fa[Z]=Q.x,fa[Z+1]=Q.y,fa[Z+2]=Q.z,fa[Z+3]=N.x,fa[Z+4]=N.y,fa[Z+5]=N.z,fa[Z+6]=O.x,fa[Z+7]=O.y,fa[Z+8]=O.z,Z+=9;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],Q=ba[E.a].position,N=ba[E.b].position,O=ba[E.c].position,E=ba[E.d].position,fa[Z]=Q.x,fa[Z+1]=Q.y,fa[Z+2]=Q.z,fa[Z+3]=N.x,fa[Z+4]=N.y,fa[Z+5]=N.z,fa[Z+6]=O.x,fa[Z+7]=O.y,fa[Z+8]=O.z,fa[Z+9]=E.x,fa[Z+10]=E.y,fa[Z+11]=E.z,Z+=12;k.bindBuffer(k.ARRAY_BUFFER,s.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,fa,Y)}if(oa){Z=0;for(oa=Ea.length;Z<
-oa;Z++){t=fa=0;for(z=G.length;t<z;t++)E=ia[G[t]],Q=Ea[Z].vertices[E.a].position,N=Ea[Z].vertices[E.b].position,O=Ea[Z].vertices[E.c].position,ba=aa[Z],ba[fa]=Q.x,ba[fa+1]=Q.y,ba[fa+2]=Q.z,ba[fa+3]=N.x,ba[fa+4]=N.y,ba[fa+5]=N.z,ba[fa+6]=O.x,ba[fa+7]=O.y,ba[fa+8]=O.z,fa+=9;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],Q=Ea[Z].vertices[E.a].position,N=Ea[Z].vertices[E.b].position,O=Ea[Z].vertices[E.c].position,E=Ea[Z].vertices[E.d].position,ba=aa[Z],ba[fa]=Q.x,ba[fa+1]=Q.y,ba[fa+2]=Q.z,ba[fa+3]=N.x,ba[fa+
-4]=N.y,ba[fa+5]=N.z,ba[fa+6]=O.x,ba[fa+7]=O.y,ba[fa+8]=O.z,ba[fa+9]=E.x,ba[fa+10]=E.y,ba[fa+11]=E.z,fa+=12;k.bindBuffer(k.ARRAY_BUFFER,s.__webglMorphTargetsBuffers[Z]);k.bufferData(k.ARRAY_BUFFER,aa[Z],Y)}}if(Da.length){t=0;for(z=G.length;t<z;t++)E=ia[G[t]],Q=Da[E.a],N=Da[E.b],O=Da[E.c],na[v]=Q.x,na[v+1]=Q.y,na[v+2]=Q.z,na[v+3]=Q.w,na[v+4]=N.x,na[v+5]=N.y,na[v+6]=N.z,na[v+7]=N.w,na[v+8]=O.x,na[v+9]=O.y,na[v+10]=O.z,na[v+11]=O.w,Q=Ha[E.a],N=Ha[E.b],O=Ha[E.c],M[v]=Q.x,M[v+1]=Q.y,M[v+2]=Q.z,M[v+3]=Q.w,
-M[v+4]=N.x,M[v+5]=N.y,M[v+6]=N.z,M[v+7]=N.w,M[v+8]=O.x,M[v+9]=O.y,M[v+10]=O.z,M[v+11]=O.w,Q=Fa[E.a],N=Fa[E.b],O=Fa[E.c],S[v]=Q.x,S[v+1]=Q.y,S[v+2]=Q.z,S[v+3]=1,S[v+4]=N.x,S[v+5]=N.y,S[v+6]=N.z,S[v+7]=1,S[v+8]=O.x,S[v+9]=O.y,S[v+10]=O.z,S[v+11]=1,Q=Ga[E.a],N=Ga[E.b],O=Ga[E.c],U[v]=Q.x,U[v+1]=Q.y,U[v+2]=Q.z,U[v+3]=1,U[v+4]=N.x,U[v+5]=N.y,U[v+6]=N.z,U[v+7]=1,U[v+8]=O.x,U[v+9]=O.y,U[v+10]=O.z,U[v+11]=1,v+=12;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],Q=Da[E.a],N=Da[E.b],O=Da[E.c],aa=Da[E.d],na[v]=Q.x,na[v+
-1]=Q.y,na[v+2]=Q.z,na[v+3]=Q.w,na[v+4]=N.x,na[v+5]=N.y,na[v+6]=N.z,na[v+7]=N.w,na[v+8]=O.x,na[v+9]=O.y,na[v+10]=O.z,na[v+11]=O.w,na[v+12]=aa.x,na[v+13]=aa.y,na[v+14]=aa.z,na[v+15]=aa.w,Q=Ha[E.a],N=Ha[E.b],O=Ha[E.c],aa=Ha[E.d],M[v]=Q.x,M[v+1]=Q.y,M[v+2]=Q.z,M[v+3]=Q.w,M[v+4]=N.x,M[v+5]=N.y,M[v+6]=N.z,M[v+7]=N.w,M[v+8]=O.x,M[v+9]=O.y,M[v+10]=O.z,M[v+11]=O.w,M[v+12]=aa.x,M[v+13]=aa.y,M[v+14]=aa.z,M[v+15]=aa.w,Q=Fa[E.a],N=Fa[E.b],O=Fa[E.c],aa=Fa[E.d],S[v]=Q.x,S[v+1]=Q.y,S[v+2]=Q.z,S[v+3]=1,S[v+4]=N.x,
-S[v+5]=N.y,S[v+6]=N.z,S[v+7]=1,S[v+8]=O.x,S[v+9]=O.y,S[v+10]=O.z,S[v+11]=1,S[v+12]=aa.x,S[v+13]=aa.y,S[v+14]=aa.z,S[v+15]=1,Q=Ga[E.a],N=Ga[E.b],O=Ga[E.c],E=Ga[E.d],U[v]=Q.x,U[v+1]=Q.y,U[v+2]=Q.z,U[v+3]=1,U[v+4]=N.x,U[v+5]=N.y,U[v+6]=N.z,U[v+7]=1,U[v+8]=O.x,U[v+9]=O.y,U[v+10]=O.z,U[v+11]=1,U[v+12]=E.x,U[v+13]=E.y,U[v+14]=E.z,U[v+15]=1,v+=16;v>0&&(k.bindBuffer(k.ARRAY_BUFFER,s.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,S,Y),k.bindBuffer(k.ARRAY_BUFFER,s.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,
-U,Y),k.bindBuffer(k.ARRAY_BUFFER,s.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,M,Y),k.bindBuffer(k.ARRAY_BUFFER,s.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,na,Y))}if(wa&&x){t=0;for(z=G.length;t<z;t++)E=ia[G[t]],v=E.vertexColors,M=E.color,v.length===3&&x===THREE.VertexColors?(E=v[0],S=v[1],U=v[2]):U=S=E=M,W[T]=E.r,W[T+1]=E.g,W[T+2]=E.b,W[T+3]=S.r,W[T+4]=S.g,W[T+5]=S.b,W[T+6]=U.r,W[T+7]=U.g,W[T+8]=U.b,T+=9;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],v=E.vertexColors,M=E.color,v.length===
-4&&x===THREE.VertexColors?(E=v[0],S=v[1],U=v[2],v=v[3]):v=U=S=E=M,W[T]=E.r,W[T+1]=E.g,W[T+2]=E.b,W[T+3]=S.r,W[T+4]=S.g,W[T+5]=S.b,W[T+6]=U.r,W[T+7]=U.g,W[T+8]=U.b,W[T+9]=v.r,W[T+10]=v.g,W[T+11]=v.b,T+=12;T>0&&(k.bindBuffer(k.ARRAY_BUFFER,s.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,W,Y))}if(F&&X.hasTangents){t=0;for(z=G.length;t<z;t++)E=ia[G[t]],F=E.vertexTangents,T=F[0],W=F[1],X=F[2],A[I]=T.x,A[I+1]=T.y,A[I+2]=T.z,A[I+3]=T.w,A[I+4]=W.x,A[I+5]=W.y,A[I+6]=W.z,A[I+7]=W.w,A[I+8]=X.x,A[I+9]=X.y,
-A[I+10]=X.z,A[I+11]=X.w,I+=12;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],F=E.vertexTangents,T=F[0],W=F[1],X=F[2],F=F[3],A[I]=T.x,A[I+1]=T.y,A[I+2]=T.z,A[I+3]=T.w,A[I+4]=W.x,A[I+5]=W.y,A[I+6]=W.z,A[I+7]=W.w,A[I+8]=X.x,A[I+9]=X.y,A[I+10]=X.z,A[I+11]=X.w,A[I+12]=F.x,A[I+13]=F.y,A[I+14]=F.z,A[I+15]=F.w,I+=16;k.bindBuffer(k.ARRAY_BUFFER,s.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,A,Y)}if(H&&u){t=0;for(z=G.length;t<z;t++)if(E=ia[G[t]],A=E.vertexNormals,H=E.normal,A.length===3&&K)for(I=0;I<3;I++)H=
-A[I],$[B]=H.x,$[B+1]=H.y,$[B+2]=H.z,B+=3;else for(I=0;I<3;I++)$[B]=H.x,$[B+1]=H.y,$[B+2]=H.z,B+=3;t=0;for(z=ha.length;t<z;t++)if(E=ia[ha[t]],A=E.vertexNormals,H=E.normal,A.length===4&&K)for(I=0;I<4;I++)H=A[I],$[B]=H.x,$[B+1]=H.y,$[B+2]=H.z,B+=3;else for(I=0;I<4;I++)$[B]=H.x,$[B+1]=H.y,$[B+2]=H.z,B+=3;k.bindBuffer(k.ARRAY_BUFFER,s.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,$,Y)}if(va&&ua&&D){t=0;for(z=G.length;t<z;t++)if(B=G[t],B=ua[B],B!==void 0)for(I=0;I<3;I++)$=B[I],ea[L]=$.u,ea[L+1]=$.v,
-L+=2;t=0;for(z=ha.length;t<z;t++)if(B=ha[t],B=ua[B],B!==void 0)for(I=0;I<4;I++)$=B[I],ea[L]=$.u,ea[L+1]=$.v,L+=2;L>0&&(k.bindBuffer(k.ARRAY_BUFFER,s.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,ea,Y))}if(va&&ya&&D){t=0;for(z=G.length;t<z;t++)if(B=G[t],L=ya[B],L!==void 0)for(I=0;I<3;I++)ea=L[I],C[ma]=ea.u,C[ma+1]=ea.v,ma+=2;t=0;for(z=ha.length;t<z;t++)if(B=ha[t],L=ya[B],L!==void 0)for(I=0;I<4;I++)ea=L[I],C[ma]=ea.u,C[ma+1]=ea.v,ma+=2;ma>0&&(k.bindBuffer(k.ARRAY_BUFFER,s.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,
-C,Y))}if(sa){t=0;for(z=G.length;t<z;t++)w[ka]=P,w[ka+1]=P+1,w[ka+2]=P+2,ka+=3,la[ja]=P,la[ja+1]=P+1,la[ja+2]=P,la[ja+3]=P+2,la[ja+4]=P+1,la[ja+5]=P+2,ja+=6,P+=3;t=0;for(z=ha.length;t<z;t++)w[ka]=P,w[ka+1]=P+1,w[ka+2]=P+3,w[ka+3]=P+1,w[ka+4]=P+2,w[ka+5]=P+3,ka+=6,la[ja]=P,la[ja+1]=P+1,la[ja+2]=P,la[ja+3]=P+3,la[ja+4]=P+1,la[ja+5]=P+2,la[ja+6]=P+2,la[ja+7]=P+3,ja+=8,P+=4;k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,s.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,w,Y);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,
-s.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,la,Y)}if(y){I=0;for(P=y.length;I<P;I++)if(w=y[I],w.__original.needsUpdate){C=0;if(w.size===1)if(w.boundTo===void 0||w.boundTo==="vertices"){t=0;for(z=G.length;t<z;t++)E=ia[G[t]],w.array[C]=w.value[E.a],w.array[C+1]=w.value[E.b],w.array[C+2]=w.value[E.c],C+=3;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],w.array[C]=w.value[E.a],w.array[C+1]=w.value[E.b],w.array[C+2]=w.value[E.c],w.array[C+3]=w.value[E.d],C+=4}else{if(w.boundTo==="faces"){t=0;for(z=
-G.length;t<z;t++)la=w.value[G[t]],w.array[C]=la,w.array[C+1]=la,w.array[C+2]=la,C+=3;t=0;for(z=ha.length;t<z;t++)la=w.value[ha[t]],w.array[C]=la,w.array[C+1]=la,w.array[C+2]=la,w.array[C+3]=la,C+=4}}else if(w.size===2)if(w.boundTo===void 0||w.boundTo==="vertices"){t=0;for(z=G.length;t<z;t++)E=ia[G[t]],Q=w.value[E.a],N=w.value[E.b],O=w.value[E.c],w.array[C]=Q.x,w.array[C+1]=Q.y,w.array[C+2]=N.x,w.array[C+3]=N.y,w.array[C+4]=O.x,w.array[C+5]=O.y,C+=6;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],Q=w.value[E.a],
-N=w.value[E.b],O=w.value[E.c],E=w.value[E.d],w.array[C]=Q.x,w.array[C+1]=Q.y,w.array[C+2]=N.x,w.array[C+3]=N.y,w.array[C+4]=O.x,w.array[C+5]=O.y,w.array[C+6]=E.x,w.array[C+7]=E.y,C+=8}else{if(w.boundTo==="faces"){t=0;for(z=G.length;t<z;t++)O=N=Q=la=w.value[G[t]],w.array[C]=Q.x,w.array[C+1]=Q.y,w.array[C+2]=N.x,w.array[C+3]=N.y,w.array[C+4]=O.x,w.array[C+5]=O.y,C+=6;t=0;for(z=ha.length;t<z;t++)E=O=N=Q=la=w.value[ha[t]],w.array[C]=Q.x,w.array[C+1]=Q.y,w.array[C+2]=N.x,w.array[C+3]=N.y,w.array[C+4]=
-O.x,w.array[C+5]=O.y,w.array[C+6]=E.x,w.array[C+7]=E.y,C+=8}}else if(w.size===3)if(u=w.type==="c"?["r","g","b"]:["x","y","z"],w.boundTo===void 0||w.boundTo==="vertices"){t=0;for(z=G.length;t<z;t++)E=ia[G[t]],Q=w.value[E.a],N=w.value[E.b],O=w.value[E.c],w.array[C]=Q[u[0]],w.array[C+1]=Q[u[1]],w.array[C+2]=Q[u[2]],w.array[C+3]=N[u[0]],w.array[C+4]=N[u[1]],w.array[C+5]=N[u[2]],w.array[C+6]=O[u[0]],w.array[C+7]=O[u[1]],w.array[C+8]=O[u[2]],C+=9;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],Q=w.value[E.a],N=
-w.value[E.b],O=w.value[E.c],E=w.value[E.d],w.array[C]=Q[u[0]],w.array[C+1]=Q[u[1]],w.array[C+2]=Q[u[2]],w.array[C+3]=N[u[0]],w.array[C+4]=N[u[1]],w.array[C+5]=N[u[2]],w.array[C+6]=O[u[0]],w.array[C+7]=O[u[1]],w.array[C+8]=O[u[2]],w.array[C+9]=E[u[0]],w.array[C+10]=E[u[1]],w.array[C+11]=E[u[2]],C+=12}else{if(w.boundTo==="faces"){t=0;for(z=G.length;t<z;t++)O=N=Q=la=w.value[G[t]],w.array[C]=Q[u[0]],w.array[C+1]=Q[u[1]],w.array[C+2]=Q[u[2]],w.array[C+3]=N[u[0]],w.array[C+4]=N[u[1]],w.array[C+5]=N[u[2]],
-w.array[C+6]=O[u[0]],w.array[C+7]=O[u[1]],w.array[C+8]=O[u[2]],C+=9;t=0;for(z=ha.length;t<z;t++)E=O=N=Q=la=w.value[ha[t]],w.array[C]=Q[u[0]],w.array[C+1]=Q[u[1]],w.array[C+2]=Q[u[2]],w.array[C+3]=N[u[0]],w.array[C+4]=N[u[1]],w.array[C+5]=N[u[2]],w.array[C+6]=O[u[0]],w.array[C+7]=O[u[1]],w.array[C+8]=O[u[2]],w.array[C+9]=E[u[0]],w.array[C+10]=E[u[1]],w.array[C+11]=E[u[2]],C+=12}}else if(w.size===4)if(w.boundTo===void 0||w.boundTo==="vertices"){t=0;for(z=G.length;t<z;t++)E=ia[G[t]],Q=w.value[E.a],N=
-w.value[E.b],O=w.value[E.c],w.array[C]=Q.x,w.array[C+1]=Q.y,w.array[C+2]=Q.z,w.array[C+3]=Q.w,w.array[C+4]=N.x,w.array[C+5]=N.y,w.array[C+6]=N.z,w.array[C+7]=N.w,w.array[C+8]=O.x,w.array[C+9]=O.y,w.array[C+10]=O.z,w.array[C+11]=O.w,C+=12;t=0;for(z=ha.length;t<z;t++)E=ia[ha[t]],Q=w.value[E.a],N=w.value[E.b],O=w.value[E.c],E=w.value[E.d],w.array[C]=Q.x,w.array[C+1]=Q.y,w.array[C+2]=Q.z,w.array[C+3]=Q.w,w.array[C+4]=N.x,w.array[C+5]=N.y,w.array[C+6]=N.z,w.array[C+7]=N.w,w.array[C+8]=O.x,w.array[C+9]=
-O.y,w.array[C+10]=O.z,w.array[C+11]=O.w,w.array[C+12]=E.x,w.array[C+13]=E.y,w.array[C+14]=E.z,w.array[C+15]=E.w,C+=16}else if(w.boundTo==="faces"){t=0;for(z=G.length;t<z;t++)O=N=Q=la=w.value[G[t]],w.array[C]=Q.x,w.array[C+1]=Q.y,w.array[C+2]=Q.z,w.array[C+3]=Q.w,w.array[C+4]=N.x,w.array[C+5]=N.y,w.array[C+6]=N.z,w.array[C+7]=N.w,w.array[C+8]=O.x,w.array[C+9]=O.y,w.array[C+10]=O.z,w.array[C+11]=O.w,C+=12;t=0;for(z=ha.length;t<z;t++)E=O=N=Q=la=w.value[ha[t]],w.array[C]=Q.x,w.array[C+1]=Q.y,w.array[C+
-2]=Q.z,w.array[C+3]=Q.w,w.array[C+4]=N.x,w.array[C+5]=N.y,w.array[C+6]=N.z,w.array[C+7]=N.w,w.array[C+8]=O.x,w.array[C+9]=O.y,w.array[C+10]=O.z,w.array[C+11]=O.w,w.array[C+12]=E.x,w.array[C+13]=E.y,w.array[C+14]=E.z,w.array[C+15]=E.w,C+=16}k.bindBuffer(k.ARRAY_BUFFER,w.buffer);k.bufferData(k.ARRAY_BUFFER,w.array,Y)}}ga&&(delete s.__inittedArrays,delete s.__colorArray,delete s.__normalArray,delete s.__tangentArray,delete s.__uvArray,delete s.__uv2Array,delete s.__faceArray,delete s.__vertexArray,delete s.__lineArray,
-delete s.__skinVertexAArray,delete s.__skinVertexBArray,delete s.__skinIndexArray,delete s.__skinWeightArray)}}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyColors=!1;j.__dirtyTangents=!1;l.attributes&&m(l)}else if(J instanceof THREE.Ribbon){if(j.__dirtyVertices||j.__dirtyColors){l=j;J=k.DYNAMIC_DRAW;u=q=u=ga=ga=void 0;x=l.vertices;R=l.colors;t=x.length;s=R.length;z=l.__vertexArray;Y=l.__colorArray;y=l.__dirtyColors;if(l.__dirtyVertices){for(ga=
-0;ga<t;ga++)u=x[ga].position,q=ga*3,z[q]=u.x,z[q+1]=u.y,z[q+2]=u.z;k.bindBuffer(k.ARRAY_BUFFER,l.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,z,J)}if(y){for(ga=0;ga<s;ga++)u=R[ga],q=ga*3,Y[q]=u.r,Y[q+1]=u.g,Y[q+2]=u.b;k.bindBuffer(k.ARRAY_BUFFER,l.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Y,J)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(J instanceof THREE.Line){l=c(J,s);Y=l.attributes&&p(l);if(j.__dirtyVertices||j.__dirtyColors||Y){J=j;q=k.DYNAMIC_DRAW;t=R=K=x=D=void 0;x=J.vertices;
-s=J.colors;t=x.length;Y=s.length;z=J.__vertexArray;ga=J.__colorArray;y=J.__dirtyColors;u=J.__webglCustomAttributesList;P=ia=ha=G=K=D=void 0;if(J.__dirtyVertices){for(D=0;D<t;D++)K=x[D].position,R=D*3,z[R]=K.x,z[R+1]=K.y,z[R+2]=K.z;k.bindBuffer(k.ARRAY_BUFFER,J.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,z,q)}if(y){for(x=0;x<Y;x++)t=s[x],R=x*3,ga[R]=t.r,ga[R+1]=t.g,ga[R+2]=t.b;k.bindBuffer(k.ARRAY_BUFFER,J.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,ga,q)}if(u){D=0;for(K=u.length;D<K;D++)if(P=
-u[D],P.needsUpdate&&(P.boundTo===void 0||P.boundTo==="vertices")){R=0;ha=P.value.length;if(P.size===1)for(G=0;G<ha;G++)P.array[G]=P.value[G];else if(P.size===2)for(G=0;G<ha;G++)ia=P.value[G],P.array[R]=ia.x,P.array[R+1]=ia.y,R+=2;else if(P.size===3)if(P.type==="c")for(G=0;G<ha;G++)ia=P.value[G],P.array[R]=ia.r,P.array[R+1]=ia.g,P.array[R+2]=ia.b,R+=3;else for(G=0;G<ha;G++)ia=P.value[G],P.array[R]=ia.x,P.array[R+1]=ia.y,P.array[R+2]=ia.z,R+=3;else if(P.size===4)for(G=0;G<ha;G++)ia=P.value[G],P.array[R]=
-ia.x,P.array[R+1]=ia.y,P.array[R+2]=ia.z,P.array[R+3]=ia.w,R+=4;k.bindBuffer(k.ARRAY_BUFFER,P.buffer);k.bufferData(k.ARRAY_BUFFER,P.array,q)}}}j.__dirtyVertices=!1;j.__dirtyColors=!1;l.attributes&&m(l)}else if(J instanceof THREE.ParticleSystem)l=c(J,s),Y=l.attributes&&p(l),(j.__dirtyVertices||j.__dirtyColors||J.sortParticles||Y)&&f(j,k.DYNAMIC_DRAW,J),j.__dirtyVertices=!1,j.__dirtyColors=!1,l.attributes&&m(l)};this.initMaterial=function(a,b,c,d){var e,f,g,h;a instanceof THREE.MeshDepthMaterial?h=
-"depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var j,m,l;j=l=i=0;for(m=b.length;j<m;j++)g=b[j],
-g instanceof THREE.SpotLight&&l++,g instanceof THREE.DirectionalLight&&l++,g instanceof THREE.PointLight&&i++;i+l<=T?j=l:(j=Math.ceil(T*l/(i+l)),i=T-j);g={directional:j,point:i};i=l=0;for(j=b.length;i<j;i++)m=b[i],m instanceof THREE.SpotLight&&m.castShadow&&l++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{j=a.fragmentShader;m=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
-sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:l,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(j),d.push(m));for(p in c)d.push(p),d.push(c[p]);h=d.join();p=0;
-for(d=L.length;p<d;p++)if(L[p].code===h){o=L[p].program;break a}p=k.createProgram();d=[Y?"#define VERTEX_TEXTURES":"",V.gammaInput?"#define GAMMA_INPUT":"",V.gammaOutput?"#define GAMMA_OUTPUT":"",V.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":
+vertices:0,faces:0}};var V=this,l,M=[],J=null,L=null,v=-1,Y=null,aa=0,fa=null,ca=null,U=null,N=null,W=null,S=null,da=null,va=null,ea=null,na=0,la=0,sa=0,ia=0,Ba=0,wa=0,xa=new THREE.Frustum,ya=new THREE.Matrix4,za=new THREE.Vector4,Aa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};l=function(){var a;try{if(!(a=I.getContext("experimental-webgl",{antialias:x,stencil:A,preserveDrawingBuffer:K})))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(X.r,X.g,X.b,T);this.context=
+l;var qa=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return l};this.supportsVertexTextures=function(){return qa};this.setSize=function(a,b){I.width=a;I.height=b;this.setViewport(0,0,I.width,I.height)};this.setViewport=function(a,b,c,d){na=a;la=b;sa=c;ia=d;l.viewport(na,la,sa,ia)};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){X.setHex(a);
+T=b;l.clearColor(X.r,X.g,X.b,T)};this.setClearColor=function(a,b){X.copy(a);T=b;l.clearColor(X.r,X.g,X.b,T)};this.getClearColor=function(){return X};this.getClearAlpha=function(){return T};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=l.COLOR_BUFFER_BIT;if(b===void 0||b)d|=l.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearTarget=function(a,b,c,d){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);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)l.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)l.deleteBuffer(c.__webglCustomAttributesList[d].buffer);
+V.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),V.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),V.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),V.info.memory.geometries--};this.deallocateTexture=
+function(a){if(a.__webglInit)a.__webglInit=!1,l.deleteTexture(a.__webglTexture),V.info.memory.textures--};this.updateShadowMap=function(a,b){J=null;v=Y=W=N=U=-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,k,j,m,n,o=a.count*3;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],i=c[n+4],j=c[n+5],h=c[n+6],k=c[n+7],m=c[n+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+j+m)/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}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.renderBuffer=function(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=q(a,b,c,d,f),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==Y&&(Y=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),l.vertexAttribPointer(b.position,3,l.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;f.morphTargetBase!==-1?(l.bindBuffer(l.ARRAY_BUFFER,
+e.__webglMorphTargetsBuffers[f.morphTargetBase]),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0)):c.position>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),l.vertexAttribPointer(c["morphTarget"+g],3,l.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=
+h[i[g]],g++}else{var i=[],k=-1,j=0;h=f.morphTargetInfluences;var m,n=h.length;g=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(m=0;m<n;m++)!i[m]&&h[m]>k&&(j=m,k=h[j]);l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j]);l.vertexAttribPointer(c["morphTarget"+g],3,l.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=k;i[j]=1;k=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&l.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=
+0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],b[c.buffer.belongsToAttribute]>=0&&(l.bindBuffer(l.ARRAY_BUFFER,c.buffer),l.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,l.FLOAT,!1,0,0))}b.color>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglColorBuffer),l.vertexAttribPointer(b.color,3,l.FLOAT,!1,0,0));b.normal>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglNormalBuffer),l.vertexAttribPointer(b.normal,3,l.FLOAT,!1,0,0));b.tangent>=0&&(l.bindBuffer(l.ARRAY_BUFFER,
+e.__webglTangentBuffer),l.vertexAttribPointer(b.tangent,4,l.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUVBuffer),l.vertexAttribPointer(b.uv,2,l.FLOAT,!1,0,0),l.enableVertexAttribArray(b.uv)):l.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUV2Buffer),l.vertexAttribPointer(b.uv2,2,l.FLOAT,!1,0,0),l.enableVertexAttribArray(b.uv2)):l.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
+0&&b.skinIndex>=0&&b.skinWeight>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinVertexABuffer),l.vertexAttribPointer(b.skinVertexA,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),l.vertexAttribPointer(b.skinVertexB,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),l.vertexAttribPointer(b.skinIndex,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),l.vertexAttribPointer(b.skinWeight,4,l.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?
+(d=d.wireframeLinewidth,d!==ea&&(l.lineWidth(d),ea=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)),V.info.render.calls++,V.info.render.vertices+=e.__webglFaceCount,V.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,d=d.linewidth,d!==
+ea&&(l.lineWidth(d),ea=d),l.drawArrays(f,0,e.__webglLineCount),V.info.render.calls++):f instanceof THREE.ParticleSystem?(l.drawArrays(l.POINTS,0,e.__webglParticleCount),V.info.render.calls++):f instanceof THREE.Ribbon&&(l.drawArrays(l.TRIANGLE_STRIP,0,e.__webglVertexCount),V.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,g,m,n=a.lights,o=a.fog;v=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();i(this.renderPluginsPre,a,b);V.info.render.calls=0;V.info.render.vertices=0;V.info.render.faces=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);ya.multiply(b.projectionMatrix,b.matrixWorldInverse);
+xa.setFromMatrix(ya);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;d=0;for(e=m.length;d<e;d++)if(f=m[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh)||!g.frustumCulled||xa.contains(g))){g.matrixWorld.flattenToArray(g._objectMatrixArray);r(g,b);var p=f,s=p.object,q=p.buffer,x=void 0,x=x=void 0,x=s.material;if(x instanceof THREE.MeshFaceMaterial){if(x=q.materialIndex,x>=0)x=s.geometry.materials[x],
+x.transparent?(p.transparent=x,p.opaque=null):(p.opaque=x,p.transparent=null)}else if(x)x.transparent?(p.transparent=x,p.opaque=null):(p.opaque=x,p.transparent=null);f.render=!0;if(this.sortObjects)g.renderDepth?f.z=g.renderDepth:(za.copy(g.position),ya.multiplyVector3(za),f.z=za.z)}this.sortObjects&&m.sort(h);m=a.__webglObjectsImmediate;d=0;for(e=m.length;d<e;d++)if(f=m[d],g=f.object,g.visible)g.matrixAutoUpdate&&g.matrixWorld.flattenToArray(g._objectMatrixArray),r(g,b),g=f.object.material,g.transparent?
+(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),t(a.overrideMaterial.depthWrite),u(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),j(a.__webglObjects,!1,"",b,n,o,!0,a.overrideMaterial),k(a.__webglObjectsImmediate,"",b,n,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),j(a.__webglObjects,!0,
+"opaque",b,n,o,!1),k(a.__webglObjectsImmediate,"opaque",b,n,o,!1),j(a.__webglObjects,!1,"transparent",b,n,o,!0),k(a.__webglObjectsImmediate,"transparent",b,n,o,!0));i(this.renderPluginsPost,a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,c.__webglTexture),l.generateMipmap(l.TEXTURE_CUBE_MAP),l.bindTexture(l.TEXTURE_CUBE_MAP,null)):(l.bindTexture(l.TEXTURE_2D,c.__webglTexture),l.generateMipmap(l.TEXTURE_2D),
+l.bindTexture(l.TEXTURE_2D,null)))};this.renderImmediateObject=function(a,b,c,d,e){var f=q(a,b,c,d,e);Y=-1;V.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,l,xa):e.render(function(a){V.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 h=a.__objectsAdded[0],i=a,k=void 0,j=void 0,D=void 0;if(!h.__webglInit)if(h.__webglInit=
+!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){j=h.geometry;if(j.geometryGroups===void 0){var D=j,q=void 0,r=void 0,x=void 0,t=void 0,u=void 0,y=void 0,C=void 0,A={},R=D.morphTargets.length;D.geometryGroups={};q=0;for(r=D.faces.length;q<r;q++)x=D.faces[q],t=x.materialIndex,y=t!==void 0?t:-1,A[y]===void 0&&
+(A[y]={hash:y,counter:0}),C=A[y].hash+"_"+A[y].counter,D.geometryGroups[C]===void 0&&(D.geometryGroups[C]={faces3:[],faces4:[],materialIndex:t,vertices:0,numMorphTargets:R}),u=x instanceof THREE.Face3?3:4,D.geometryGroups[C].vertices+u>65535&&(A[y].counter+=1,C=A[y].hash+"_"+A[y].counter,D.geometryGroups[C]===void 0&&(D.geometryGroups[C]={faces3:[],faces4:[],materialIndex:t,vertices:0,numMorphTargets:R})),x instanceof THREE.Face3?D.geometryGroups[C].faces3.push(q):D.geometryGroups[C].faces4.push(q),
+D.geometryGroups[C].vertices+=u;D.geometryGroupsList=[];q=void 0;for(q in D.geometryGroups)D.geometryGroups[q].id=aa++,D.geometryGroupsList.push(D.geometryGroups[q])}for(k in j.geometryGroups)if(D=j.geometryGroups[k],!D.__webglVertexBuffer){q=D;q.__webglVertexBuffer=l.createBuffer();q.__webglNormalBuffer=l.createBuffer();q.__webglTangentBuffer=l.createBuffer();q.__webglColorBuffer=l.createBuffer();q.__webglUVBuffer=l.createBuffer();q.__webglUV2Buffer=l.createBuffer();q.__webglSkinVertexABuffer=l.createBuffer();
+q.__webglSkinVertexBBuffer=l.createBuffer();q.__webglSkinIndicesBuffer=l.createBuffer();q.__webglSkinWeightsBuffer=l.createBuffer();q.__webglFaceBuffer=l.createBuffer();q.__webglLineBuffer=l.createBuffer();if(q.numMorphTargets){x=r=void 0;q.__webglMorphTargetsBuffers=[];r=0;for(x=q.numMorphTargets;r<x;r++)q.__webglMorphTargetsBuffers.push(l.createBuffer())}V.info.memory.geometries++;t=h;u=t.geometry;r=D.faces3;y=D.faces4;q=r.length*3+y.length*4;x=r.length*1+y.length*2;y=r.length*3+y.length*4;r=c(t,
+D);C=g(r);A=d(r);R=e(r);D.__vertexArray=new Float32Array(q*3);if(A)D.__normalArray=new Float32Array(q*3);if(u.hasTangents)D.__tangentArray=new Float32Array(q*4);if(R)D.__colorArray=new Float32Array(q*3);if(C){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)D.__uvArray=new Float32Array(q*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)D.__uv2Array=new Float32Array(q*2)}if(t.geometry.skinWeights.length&&t.geometry.skinIndices.length)D.__skinVertexAArray=new Float32Array(q*4),D.__skinVertexBArray=
+new Float32Array(q*4),D.__skinIndexArray=new Float32Array(q*4),D.__skinWeightArray=new Float32Array(q*4);D.__faceArray=new Uint16Array(x*3);D.__lineArray=new Uint16Array(y*2);if(D.numMorphTargets){D.__morphTargetsArrays=[];t=0;for(u=D.numMorphTargets;t<u;t++)D.__morphTargetsArrays.push(new Float32Array(q*3))}D.__webglFaceCount=x*3;D.__webglLineCount=y*2;if(r.attributes){if(D.__webglCustomAttributesList===void 0)D.__webglCustomAttributesList=[];x=void 0;for(x in r.attributes){var t=r.attributes[x],
+u={},K;for(K in t)u[K]=t[K];if(!u.__webglInitialized||u.createUniqueBuffers)u.__webglInitialized=!0,y=1,u.type==="v2"?y=2:u.type==="v3"?y=3:u.type==="v4"?y=4:u.type==="c"&&(y=3),u.size=y,u.array=new Float32Array(q*y),u.buffer=l.createBuffer(),u.buffer.belongsToAttribute=x,t.needsUpdate=!0,u.__original=t;D.__webglCustomAttributesList.push(u)}}D.__inittedArrays=!0;j.__dirtyVertices=!0;j.__dirtyMorphTargets=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=!0;j.__dirtyColors=
+!0}}else if(h instanceof THREE.Ribbon){if(j=h.geometry,!j.__webglVertexBuffer)D=j,D.__webglVertexBuffer=l.createBuffer(),D.__webglColorBuffer=l.createBuffer(),V.info.memory.geometries++,D=j,q=D.vertices.length,D.__vertexArray=new Float32Array(q*3),D.__colorArray=new Float32Array(q*3),D.__webglVertexCount=q,j.__dirtyVertices=!0,j.__dirtyColors=!0}else if(h instanceof THREE.Line){if(j=h.geometry,!j.__webglVertexBuffer)D=j,D.__webglVertexBuffer=l.createBuffer(),D.__webglColorBuffer=l.createBuffer(),
+V.info.memory.geometries++,D=j,q=h,r=D.vertices.length,D.__vertexArray=new Float32Array(r*3),D.__colorArray=new Float32Array(r*3),D.__webglLineCount=r,b(D,q),j.__dirtyVertices=!0,j.__dirtyColors=!0}else if(h instanceof THREE.ParticleSystem&&(j=h.geometry,!j.__webglVertexBuffer))D=j,D.__webglVertexBuffer=l.createBuffer(),D.__webglColorBuffer=l.createBuffer(),V.info.geometries++,D=j,q=h,r=D.vertices.length,D.__vertexArray=new Float32Array(r*3),D.__colorArray=new Float32Array(r*3),D.__sortArray=[],D.__webglParticleCount=
+r,b(D,q),j.__dirtyVertices=!0,j.__dirtyColors=!0;if(!h.__webglActive){if(h instanceof THREE.Mesh)for(k in j=h.geometry,j.geometryGroups)D=j.geometryGroups[k],o(i.__webglObjects,D,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(j=h.geometry,o(i.__webglObjects,j,h)):THREE.MarchingCubes!==void 0&&h instanceof THREE.MarchingCubes||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):
+h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)h=a.__objectsRemoved[0],i=a,h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem||h instanceof THREE.Ribbon||h instanceof THREE.Line?s(i.__webglObjects,h):h instanceof THREE.Sprite?n(i.__webglSprites,h):h instanceof THREE.LensFlare?n(i.__webglFlares,h):(h instanceof THREE.MarchingCubes||h.immediateRenderCallback)&&s(i.__webglObjectsImmediate,h),h.__webglActive=
+!1,a.__objectsRemoved.splice(0,1);h=0;for(i=a.__webglObjects.length;h<i;h++)if(K=a.__webglObjects[h].object,k=K.geometry,j=x=r=void 0,K instanceof THREE.Mesh){D=0;for(q=k.geometryGroupsList.length;D<q;D++)if(r=k.geometryGroupsList[D],j=c(K,r),x=j.attributes&&p(j),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||x){var w=K,x=l.DYNAMIC_DRAW,t=!k.dynamic,C=j;if(r.__inittedArrays){var u=d(C),y=e(C),G=g(C),I=u===THREE.SmoothShading,
+J=A=C=void 0,H=void 0,F=void 0,L=void 0,v=void 0,B=void 0,M=void 0,$=J=void 0,Q=void 0,O=void 0,P=void 0,X=H=void 0,U=void 0,Y=void 0,T=H=M=void 0,W=void 0,ca=P=O=Q=v=void 0,N=H=P=O=Q=ca=P=O=Q=ca=P=O=Q=void 0,S=void 0,da=L=void 0,fa=void 0,ja=void 0,va=void 0,ea=void 0,na=$=ja=S=0,la=0,ia=N=J=0,ga=v=X=0,E=0,ma=void 0,ga=r.__vertexArray,fa=r.__uvArray,E=r.__uv2Array,da=r.__normalArray,F=r.__tangentArray,U=r.__colorArray,T=r.__skinVertexAArray,W=r.__skinVertexBArray,B=r.__skinIndexArray,oa=r.__skinWeightArray,
+ca=r.__morphTargetsArrays,R=r.__webglCustomAttributesList,z=void 0,z=r.__faceArray,ma=r.__lineArray,Y=w.geometry,qa=Y.__dirtyElements,sa=Y.__dirtyUvs,L=Y.__dirtyNormals,M=Y.__dirtyTangents,za=Y.__dirtyColors,va=Y.__dirtyMorphTargets,ea=Y.vertices,w=r.faces3,ha=r.faces4,ka=Y.faces,ya=Y.faceVertexUvs[0],Ba=Y.faceVertexUvs[1],wa=Y.skinVerticesA,xa=Y.skinVerticesB,Aa=Y.skinIndices,Ha=Y.skinWeights,Ia=Y.morphTargets;if(Y.__dirtyVertices){C=0;for(A=w.length;C<A;C++)H=ka[w[C]],Q=ea[H.a].position,O=ea[H.b].position,
+P=ea[H.c].position,ga[ja]=Q.x,ga[ja+1]=Q.y,ga[ja+2]=Q.z,ga[ja+3]=O.x,ga[ja+4]=O.y,ga[ja+5]=O.z,ga[ja+6]=P.x,ga[ja+7]=P.y,ga[ja+8]=P.z,ja+=9;C=0;for(A=ha.length;C<A;C++)H=ka[ha[C]],Q=ea[H.a].position,O=ea[H.b].position,P=ea[H.c].position,H=ea[H.d].position,ga[ja]=Q.x,ga[ja+1]=Q.y,ga[ja+2]=Q.z,ga[ja+3]=O.x,ga[ja+4]=O.y,ga[ja+5]=O.z,ga[ja+6]=P.x,ga[ja+7]=P.y,ga[ja+8]=P.z,ga[ja+9]=H.x,ga[ja+10]=H.y,ga[ja+11]=H.z,ja+=12;l.bindBuffer(l.ARRAY_BUFFER,r.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,ga,
+x)}if(va){ja=0;for(va=Ia.length;ja<va;ja++){C=ga=0;for(A=w.length;C<A;C++)H=ka[w[C]],Q=Ia[ja].vertices[H.a].position,O=Ia[ja].vertices[H.b].position,P=Ia[ja].vertices[H.c].position,ea=ca[ja],ea[ga]=Q.x,ea[ga+1]=Q.y,ea[ga+2]=Q.z,ea[ga+3]=O.x,ea[ga+4]=O.y,ea[ga+5]=O.z,ea[ga+6]=P.x,ea[ga+7]=P.y,ea[ga+8]=P.z,ga+=9;C=0;for(A=ha.length;C<A;C++)H=ka[ha[C]],Q=Ia[ja].vertices[H.a].position,O=Ia[ja].vertices[H.b].position,P=Ia[ja].vertices[H.c].position,H=Ia[ja].vertices[H.d].position,ea=ca[ja],ea[ga]=Q.x,
+ea[ga+1]=Q.y,ea[ga+2]=Q.z,ea[ga+3]=O.x,ea[ga+4]=O.y,ea[ga+5]=O.z,ea[ga+6]=P.x,ea[ga+7]=P.y,ea[ga+8]=P.z,ea[ga+9]=H.x,ea[ga+10]=H.y,ea[ga+11]=H.z,ga+=12;l.bindBuffer(l.ARRAY_BUFFER,r.__webglMorphTargetsBuffers[ja]);l.bufferData(l.ARRAY_BUFFER,ca[ja],x)}}if(Ha.length){C=0;for(A=w.length;C<A;C++)H=ka[w[C]],Q=Ha[H.a],O=Ha[H.b],P=Ha[H.c],oa[v]=Q.x,oa[v+1]=Q.y,oa[v+2]=Q.z,oa[v+3]=Q.w,oa[v+4]=O.x,oa[v+5]=O.y,oa[v+6]=O.z,oa[v+7]=O.w,oa[v+8]=P.x,oa[v+9]=P.y,oa[v+10]=P.z,oa[v+11]=P.w,Q=Aa[H.a],O=Aa[H.b],P=
+Aa[H.c],B[v]=Q.x,B[v+1]=Q.y,B[v+2]=Q.z,B[v+3]=Q.w,B[v+4]=O.x,B[v+5]=O.y,B[v+6]=O.z,B[v+7]=O.w,B[v+8]=P.x,B[v+9]=P.y,B[v+10]=P.z,B[v+11]=P.w,Q=wa[H.a],O=wa[H.b],P=wa[H.c],T[v]=Q.x,T[v+1]=Q.y,T[v+2]=Q.z,T[v+3]=1,T[v+4]=O.x,T[v+5]=O.y,T[v+6]=O.z,T[v+7]=1,T[v+8]=P.x,T[v+9]=P.y,T[v+10]=P.z,T[v+11]=1,Q=xa[H.a],O=xa[H.b],P=xa[H.c],W[v]=Q.x,W[v+1]=Q.y,W[v+2]=Q.z,W[v+3]=1,W[v+4]=O.x,W[v+5]=O.y,W[v+6]=O.z,W[v+7]=1,W[v+8]=P.x,W[v+9]=P.y,W[v+10]=P.z,W[v+11]=1,v+=12;C=0;for(A=ha.length;C<A;C++)H=ka[ha[C]],Q=Ha[H.a],
+O=Ha[H.b],P=Ha[H.c],ca=Ha[H.d],oa[v]=Q.x,oa[v+1]=Q.y,oa[v+2]=Q.z,oa[v+3]=Q.w,oa[v+4]=O.x,oa[v+5]=O.y,oa[v+6]=O.z,oa[v+7]=O.w,oa[v+8]=P.x,oa[v+9]=P.y,oa[v+10]=P.z,oa[v+11]=P.w,oa[v+12]=ca.x,oa[v+13]=ca.y,oa[v+14]=ca.z,oa[v+15]=ca.w,Q=Aa[H.a],O=Aa[H.b],P=Aa[H.c],ca=Aa[H.d],B[v]=Q.x,B[v+1]=Q.y,B[v+2]=Q.z,B[v+3]=Q.w,B[v+4]=O.x,B[v+5]=O.y,B[v+6]=O.z,B[v+7]=O.w,B[v+8]=P.x,B[v+9]=P.y,B[v+10]=P.z,B[v+11]=P.w,B[v+12]=ca.x,B[v+13]=ca.y,B[v+14]=ca.z,B[v+15]=ca.w,Q=wa[H.a],O=wa[H.b],P=wa[H.c],ca=wa[H.d],T[v]=
+Q.x,T[v+1]=Q.y,T[v+2]=Q.z,T[v+3]=1,T[v+4]=O.x,T[v+5]=O.y,T[v+6]=O.z,T[v+7]=1,T[v+8]=P.x,T[v+9]=P.y,T[v+10]=P.z,T[v+11]=1,T[v+12]=ca.x,T[v+13]=ca.y,T[v+14]=ca.z,T[v+15]=1,Q=xa[H.a],O=xa[H.b],P=xa[H.c],H=xa[H.d],W[v]=Q.x,W[v+1]=Q.y,W[v+2]=Q.z,W[v+3]=1,W[v+4]=O.x,W[v+5]=O.y,W[v+6]=O.z,W[v+7]=1,W[v+8]=P.x,W[v+9]=P.y,W[v+10]=P.z,W[v+11]=1,W[v+12]=H.x,W[v+13]=H.y,W[v+14]=H.z,W[v+15]=1,v+=16;v>0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglSkinVertexABuffer),l.bufferData(l.ARRAY_BUFFER,T,x),l.bindBuffer(l.ARRAY_BUFFER,
+r.__webglSkinVertexBBuffer),l.bufferData(l.ARRAY_BUFFER,W,x),l.bindBuffer(l.ARRAY_BUFFER,r.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,B,x),l.bindBuffer(l.ARRAY_BUFFER,r.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,oa,x))}if(za&&y){C=0;for(A=w.length;C<A;C++)H=ka[w[C]],v=H.vertexColors,B=H.color,v.length===3&&y===THREE.VertexColors?(H=v[0],T=v[1],W=v[2]):W=T=H=B,U[X]=H.r,U[X+1]=H.g,U[X+2]=H.b,U[X+3]=T.r,U[X+4]=T.g,U[X+5]=T.b,U[X+6]=W.r,U[X+7]=W.g,U[X+8]=W.b,X+=9;C=0;for(A=ha.length;C<
+A;C++)H=ka[ha[C]],v=H.vertexColors,B=H.color,v.length===4&&y===THREE.VertexColors?(H=v[0],T=v[1],W=v[2],v=v[3]):v=W=T=H=B,U[X]=H.r,U[X+1]=H.g,U[X+2]=H.b,U[X+3]=T.r,U[X+4]=T.g,U[X+5]=T.b,U[X+6]=W.r,U[X+7]=W.g,U[X+8]=W.b,U[X+9]=v.r,U[X+10]=v.g,U[X+11]=v.b,X+=12;X>0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,U,x))}if(M&&Y.hasTangents){C=0;for(A=w.length;C<A;C++)H=ka[w[C]],M=H.vertexTangents,X=M[0],U=M[1],Y=M[2],F[N]=X.x,F[N+1]=X.y,F[N+2]=X.z,F[N+3]=X.w,F[N+4]=U.x,
+F[N+5]=U.y,F[N+6]=U.z,F[N+7]=U.w,F[N+8]=Y.x,F[N+9]=Y.y,F[N+10]=Y.z,F[N+11]=Y.w,N+=12;C=0;for(A=ha.length;C<A;C++)H=ka[ha[C]],M=H.vertexTangents,X=M[0],U=M[1],Y=M[2],M=M[3],F[N]=X.x,F[N+1]=X.y,F[N+2]=X.z,F[N+3]=X.w,F[N+4]=U.x,F[N+5]=U.y,F[N+6]=U.z,F[N+7]=U.w,F[N+8]=Y.x,F[N+9]=Y.y,F[N+10]=Y.z,F[N+11]=Y.w,F[N+12]=M.x,F[N+13]=M.y,F[N+14]=M.z,F[N+15]=M.w,N+=16;l.bindBuffer(l.ARRAY_BUFFER,r.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,F,x)}if(L&&u){C=0;for(A=w.length;C<A;C++)if(H=ka[w[C]],F=H.vertexNormals,
+L=H.normal,F.length===3&&I)for(N=0;N<3;N++)L=F[N],da[J]=L.x,da[J+1]=L.y,da[J+2]=L.z,J+=3;else for(N=0;N<3;N++)da[J]=L.x,da[J+1]=L.y,da[J+2]=L.z,J+=3;C=0;for(A=ha.length;C<A;C++)if(H=ka[ha[C]],F=H.vertexNormals,L=H.normal,F.length===4&&I)for(N=0;N<4;N++)L=F[N],da[J]=L.x,da[J+1]=L.y,da[J+2]=L.z,J+=3;else for(N=0;N<4;N++)da[J]=L.x,da[J+1]=L.y,da[J+2]=L.z,J+=3;l.bindBuffer(l.ARRAY_BUFFER,r.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,da,x)}if(sa&&ya&&G){C=0;for(A=w.length;C<A;C++)if(J=w[C],J=ya[J],
+J!==void 0)for(N=0;N<3;N++)da=J[N],fa[$]=da.u,fa[$+1]=da.v,$+=2;C=0;for(A=ha.length;C<A;C++)if(J=ha[C],J=ya[J],J!==void 0)for(N=0;N<4;N++)da=J[N],fa[$]=da.u,fa[$+1]=da.v,$+=2;$>0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,fa,x))}if(sa&&Ba&&G){C=0;for(A=w.length;C<A;C++)if(J=w[C],$=Ba[J],$!==void 0)for(N=0;N<3;N++)fa=$[N],E[na]=fa.u,E[na+1]=fa.v,na+=2;C=0;for(A=ha.length;C<A;C++)if(J=ha[C],$=Ba[J],$!==void 0)for(N=0;N<4;N++)fa=$[N],E[na]=fa.u,E[na+1]=fa.v,na+=2;na>
+0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,E,x))}if(qa){C=0;for(A=w.length;C<A;C++)z[la]=S,z[la+1]=S+1,z[la+2]=S+2,la+=3,ma[ia]=S,ma[ia+1]=S+1,ma[ia+2]=S,ma[ia+3]=S+2,ma[ia+4]=S+1,ma[ia+5]=S+2,ia+=6,S+=3;C=0;for(A=ha.length;C<A;C++)z[la]=S,z[la+1]=S+1,z[la+2]=S+3,z[la+3]=S+1,z[la+4]=S+2,z[la+5]=S+3,la+=6,ma[ia]=S,ma[ia+1]=S+1,ma[ia+2]=S,ma[ia+3]=S+3,ma[ia+4]=S+1,ma[ia+5]=S+2,ma[ia+6]=S+2,ma[ia+7]=S+3,ia+=8,S+=4;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,r.__webglFaceBuffer);
+l.bufferData(l.ELEMENT_ARRAY_BUFFER,z,x);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,r.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,ma,x)}if(R){N=0;for(S=R.length;N<S;N++)if(z=R[N],z.__original.needsUpdate){E=0;if(z.size===1)if(z.boundTo===void 0||z.boundTo==="vertices"){C=0;for(A=w.length;C<A;C++)H=ka[w[C]],z.array[E]=z.value[H.a],z.array[E+1]=z.value[H.b],z.array[E+2]=z.value[H.c],E+=3;C=0;for(A=ha.length;C<A;C++)H=ka[ha[C]],z.array[E]=z.value[H.a],z.array[E+1]=z.value[H.b],z.array[E+2]=z.value[H.c],
+z.array[E+3]=z.value[H.d],E+=4}else{if(z.boundTo==="faces"){C=0;for(A=w.length;C<A;C++)ma=z.value[w[C]],z.array[E]=ma,z.array[E+1]=ma,z.array[E+2]=ma,E+=3;C=0;for(A=ha.length;C<A;C++)ma=z.value[ha[C]],z.array[E]=ma,z.array[E+1]=ma,z.array[E+2]=ma,z.array[E+3]=ma,E+=4}}else if(z.size===2)if(z.boundTo===void 0||z.boundTo==="vertices"){C=0;for(A=w.length;C<A;C++)H=ka[w[C]],Q=z.value[H.a],O=z.value[H.b],P=z.value[H.c],z.array[E]=Q.x,z.array[E+1]=Q.y,z.array[E+2]=O.x,z.array[E+3]=O.y,z.array[E+4]=P.x,
+z.array[E+5]=P.y,E+=6;C=0;for(A=ha.length;C<A;C++)H=ka[ha[C]],Q=z.value[H.a],O=z.value[H.b],P=z.value[H.c],H=z.value[H.d],z.array[E]=Q.x,z.array[E+1]=Q.y,z.array[E+2]=O.x,z.array[E+3]=O.y,z.array[E+4]=P.x,z.array[E+5]=P.y,z.array[E+6]=H.x,z.array[E+7]=H.y,E+=8}else{if(z.boundTo==="faces"){C=0;for(A=w.length;C<A;C++)P=O=Q=ma=z.value[w[C]],z.array[E]=Q.x,z.array[E+1]=Q.y,z.array[E+2]=O.x,z.array[E+3]=O.y,z.array[E+4]=P.x,z.array[E+5]=P.y,E+=6;C=0;for(A=ha.length;C<A;C++)H=P=O=Q=ma=z.value[ha[C]],z.array[E]=
+Q.x,z.array[E+1]=Q.y,z.array[E+2]=O.x,z.array[E+3]=O.y,z.array[E+4]=P.x,z.array[E+5]=P.y,z.array[E+6]=H.x,z.array[E+7]=H.y,E+=8}}else if(z.size===3)if(u=z.type==="c"?["r","g","b"]:["x","y","z"],z.boundTo===void 0||z.boundTo==="vertices"){C=0;for(A=w.length;C<A;C++)H=ka[w[C]],Q=z.value[H.a],O=z.value[H.b],P=z.value[H.c],z.array[E]=Q[u[0]],z.array[E+1]=Q[u[1]],z.array[E+2]=Q[u[2]],z.array[E+3]=O[u[0]],z.array[E+4]=O[u[1]],z.array[E+5]=O[u[2]],z.array[E+6]=P[u[0]],z.array[E+7]=P[u[1]],z.array[E+8]=P[u[2]],
+E+=9;C=0;for(A=ha.length;C<A;C++)H=ka[ha[C]],Q=z.value[H.a],O=z.value[H.b],P=z.value[H.c],H=z.value[H.d],z.array[E]=Q[u[0]],z.array[E+1]=Q[u[1]],z.array[E+2]=Q[u[2]],z.array[E+3]=O[u[0]],z.array[E+4]=O[u[1]],z.array[E+5]=O[u[2]],z.array[E+6]=P[u[0]],z.array[E+7]=P[u[1]],z.array[E+8]=P[u[2]],z.array[E+9]=H[u[0]],z.array[E+10]=H[u[1]],z.array[E+11]=H[u[2]],E+=12}else{if(z.boundTo==="faces"){C=0;for(A=w.length;C<A;C++)P=O=Q=ma=z.value[w[C]],z.array[E]=Q[u[0]],z.array[E+1]=Q[u[1]],z.array[E+2]=Q[u[2]],
+z.array[E+3]=O[u[0]],z.array[E+4]=O[u[1]],z.array[E+5]=O[u[2]],z.array[E+6]=P[u[0]],z.array[E+7]=P[u[1]],z.array[E+8]=P[u[2]],E+=9;C=0;for(A=ha.length;C<A;C++)H=P=O=Q=ma=z.value[ha[C]],z.array[E]=Q[u[0]],z.array[E+1]=Q[u[1]],z.array[E+2]=Q[u[2]],z.array[E+3]=O[u[0]],z.array[E+4]=O[u[1]],z.array[E+5]=O[u[2]],z.array[E+6]=P[u[0]],z.array[E+7]=P[u[1]],z.array[E+8]=P[u[2]],z.array[E+9]=H[u[0]],z.array[E+10]=H[u[1]],z.array[E+11]=H[u[2]],E+=12}}else if(z.size===4)if(z.boundTo===void 0||z.boundTo==="vertices"){C=
+0;for(A=w.length;C<A;C++)H=ka[w[C]],Q=z.value[H.a],O=z.value[H.b],P=z.value[H.c],z.array[E]=Q.x,z.array[E+1]=Q.y,z.array[E+2]=Q.z,z.array[E+3]=Q.w,z.array[E+4]=O.x,z.array[E+5]=O.y,z.array[E+6]=O.z,z.array[E+7]=O.w,z.array[E+8]=P.x,z.array[E+9]=P.y,z.array[E+10]=P.z,z.array[E+11]=P.w,E+=12;C=0;for(A=ha.length;C<A;C++)H=ka[ha[C]],Q=z.value[H.a],O=z.value[H.b],P=z.value[H.c],H=z.value[H.d],z.array[E]=Q.x,z.array[E+1]=Q.y,z.array[E+2]=Q.z,z.array[E+3]=Q.w,z.array[E+4]=O.x,z.array[E+5]=O.y,z.array[E+
+6]=O.z,z.array[E+7]=O.w,z.array[E+8]=P.x,z.array[E+9]=P.y,z.array[E+10]=P.z,z.array[E+11]=P.w,z.array[E+12]=H.x,z.array[E+13]=H.y,z.array[E+14]=H.z,z.array[E+15]=H.w,E+=16}else if(z.boundTo==="faces"){C=0;for(A=w.length;C<A;C++)P=O=Q=ma=z.value[w[C]],z.array[E]=Q.x,z.array[E+1]=Q.y,z.array[E+2]=Q.z,z.array[E+3]=Q.w,z.array[E+4]=O.x,z.array[E+5]=O.y,z.array[E+6]=O.z,z.array[E+7]=O.w,z.array[E+8]=P.x,z.array[E+9]=P.y,z.array[E+10]=P.z,z.array[E+11]=P.w,E+=12;C=0;for(A=ha.length;C<A;C++)H=P=O=Q=ma=z.value[ha[C]],
+z.array[E]=Q.x,z.array[E+1]=Q.y,z.array[E+2]=Q.z,z.array[E+3]=Q.w,z.array[E+4]=O.x,z.array[E+5]=O.y,z.array[E+6]=O.z,z.array[E+7]=O.w,z.array[E+8]=P.x,z.array[E+9]=P.y,z.array[E+10]=P.z,z.array[E+11]=P.w,z.array[E+12]=H.x,z.array[E+13]=H.y,z.array[E+14]=H.z,z.array[E+15]=H.w,E+=16}l.bindBuffer(l.ARRAY_BUFFER,z.buffer);l.bufferData(l.ARRAY_BUFFER,z.array,x)}}t&&(delete r.__inittedArrays,delete r.__colorArray,delete r.__normalArray,delete r.__tangentArray,delete r.__uvArray,delete r.__uv2Array,delete r.__faceArray,
+delete r.__vertexArray,delete r.__lineArray,delete r.__skinVertexAArray,delete r.__skinVertexBArray,delete r.__skinIndexArray,delete r.__skinWeightArray)}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyColors=!1;k.__dirtyTangents=!1;j.attributes&&m(j)}else if(K instanceof THREE.Ribbon){if(k.__dirtyVertices||k.__dirtyColors){j=k;K=l.DYNAMIC_DRAW;u=D=u=t=t=void 0;y=j.vertices;q=j.colors;C=y.length;r=q.length;A=j.__vertexArray;x=j.__colorArray;
+R=j.__dirtyColors;if(j.__dirtyVertices){for(t=0;t<C;t++)u=y[t].position,D=t*3,A[D]=u.x,A[D+1]=u.y,A[D+2]=u.z;l.bindBuffer(l.ARRAY_BUFFER,j.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,A,K)}if(R){for(t=0;t<r;t++)u=q[t],D=t*3,x[D]=u.r,x[D+1]=u.g,x[D+2]=u.b;l.bindBuffer(l.ARRAY_BUFFER,j.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,x,K)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(K instanceof THREE.Line){j=c(K,r);x=j.attributes&&p(j);if(k.__dirtyVertices||k.__dirtyColors||x){K=k;D=l.DYNAMIC_DRAW;
+C=q=I=y=G=void 0;y=K.vertices;r=K.colors;C=y.length;x=r.length;A=K.__vertexArray;t=K.__colorArray;R=K.__dirtyColors;u=K.__webglCustomAttributesList;S=ka=ha=w=I=G=void 0;if(K.__dirtyVertices){for(G=0;G<C;G++)I=y[G].position,q=G*3,A[q]=I.x,A[q+1]=I.y,A[q+2]=I.z;l.bindBuffer(l.ARRAY_BUFFER,K.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,A,D)}if(R){for(y=0;y<x;y++)C=r[y],q=y*3,t[q]=C.r,t[q+1]=C.g,t[q+2]=C.b;l.bindBuffer(l.ARRAY_BUFFER,K.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,t,D)}if(u){G=
+0;for(I=u.length;G<I;G++)if(S=u[G],S.needsUpdate&&(S.boundTo===void 0||S.boundTo==="vertices")){q=0;ha=S.value.length;if(S.size===1)for(w=0;w<ha;w++)S.array[w]=S.value[w];else if(S.size===2)for(w=0;w<ha;w++)ka=S.value[w],S.array[q]=ka.x,S.array[q+1]=ka.y,q+=2;else if(S.size===3)if(S.type==="c")for(w=0;w<ha;w++)ka=S.value[w],S.array[q]=ka.r,S.array[q+1]=ka.g,S.array[q+2]=ka.b,q+=3;else for(w=0;w<ha;w++)ka=S.value[w],S.array[q]=ka.x,S.array[q+1]=ka.y,S.array[q+2]=ka.z,q+=3;else if(S.size===4)for(w=
+0;w<ha;w++)ka=S.value[w],S.array[q]=ka.x,S.array[q+1]=ka.y,S.array[q+2]=ka.z,S.array[q+3]=ka.w,q+=4;l.bindBuffer(l.ARRAY_BUFFER,S.buffer);l.bufferData(l.ARRAY_BUFFER,S.array,D)}}}k.__dirtyVertices=!1;k.__dirtyColors=!1;j.attributes&&m(j)}else if(K instanceof THREE.ParticleSystem)j=c(K,r),x=j.attributes&&p(j),(k.__dirtyVertices||k.__dirtyColors||K.sortParticles||x)&&f(k,l.DYNAMIC_DRAW,K),k.__dirtyVertices=!1,k.__dirtyColors=!1,j.attributes&&m(j)};this.initMaterial=function(a,b,c,d){var e,f,g,h;a instanceof
+THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var j,k,m;j=m=i=0;for(k=
+b.length;j<k;j++)g=b[j],g instanceof THREE.SpotLight&&m++,g instanceof THREE.DirectionalLight&&m++,g instanceof THREE.PointLight&&i++;i+m<=$?j=m:(j=Math.ceil($*m/(i+m)),i=$-j);g={directional:j,point:i};i=m=0;for(j=b.length;i<j;i++)k=b[i],k instanceof THREE.SpotLight&&k.castShadow&&m++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{j=a.fragmentShader;k=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,
+fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(j),d.push(k));for(p in c)d.push(p),d.push(c[p]);
+h=d.join();p=0;for(d=M.length;p<d;p++)if(M[p].code===h){o=M[p].program;break a}p=l.createProgram();d=[qa?"#define VERTEX_TEXTURES":"",V.gammaInput?"#define GAMMA_INPUT":"",V.gammaOutput?"#define GAMMA_OUTPUT":"",V.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":
 "",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-g=["#ifdef GL_ES","precision "+J+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",V.gammaInput?"#define GAMMA_INPUT":"",V.gammaOutput?"#define GAMMA_OUTPUT":"",V.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
-"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");k.attachShader(p,y("fragment",g+j));k.attachShader(p,
-y("vertex",d+m));k.linkProgram(p);k.getProgramParameter(p,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(p,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");p.uniforms={};p.attributes={};var q,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in i)d.push(q);q=d;d=0;for(i=q.length;d<i;d++)j=q[d],p.uniforms[j]=k.getUniformLocation(p,
-j);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<c.maxMorphTargets;q++)d.push("morphTarget"+q);for(o in b)d.push(o);o=d;q=0;for(b=o.length;q<b;q++)c=o[q],p.attributes[c]=k.getAttribLocation(p,c);p.id=L.length;L.push({program:p,code:h});V.info.memory.programs=L.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&k.enableVertexAttribArray(o.position);o.color>=0&&k.enableVertexAttribArray(o.color);o.normal>=0&&k.enableVertexAttribArray(o.normal);
-o.tangent>=0&&k.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(k.enableVertexAttribArray(o.skinVertexA),k.enableVertexAttribArray(o.skinVertexB),k.enableVertexAttribArray(o.skinIndex),k.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(f in a.attributes)o[f]!==void 0&&o[f]>=0&&k.enableVertexAttribArray(o[f]);if(a.morphTargets)for(f=a.numSupportedMorphTargets=0;f<this.maxMorphTargets;f++)q="morphTarget"+f,o[q]>=0&&(k.enableVertexAttribArray(o[q]),
-a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW),a==="back"?k.cullFace(k.BACK):a==="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.setObjectFaces=function(a){if(ea!==a.doubleSided)a.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),ea=a.doubleSided;if(aa!==a.flipSided)a.flipSided?k.frontFace(k.CW):
-k.frontFace(k.CCW),aa=a.flipSided};this.setDepthTest=function(a){I!==a&&(a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),I=a)};this.setBlending=function(a){if(a!==U){switch(a){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,
-k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}U=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=k.createTexture(),V.info.memory.textures++;k.activeTexture(k.TEXTURE0+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);var c=A(k.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?k.texImage2D(k.TEXTURE_2D,0,H(a.format),a.image.width,a.image.height,0,H(a.format),k.UNSIGNED_BYTE,a.image.data):k.texImage2D(k.TEXTURE_2D,
-0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,a.image);c&&k.generateMipmap(k.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else k.activeTexture(k.TEXTURE0+b),k.bindTexture(k.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=k.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];k.bindTexture(k.TEXTURE_CUBE_MAP,
-a.__webglTexture);A(k.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=k.createFramebuffer();a.__webglRenderbuffer[c]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,H(a.format),a.width,a.height,0,H(a.format),H(a.type),null);var d=a,e=k.TEXTURE_CUBE_MAP_POSITIVE_X+c;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer[c]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,e,d.__webglTexture,0);D(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=k.createFramebuffer(),
-a.__webglRenderbuffer=k.createRenderbuffer(),k.bindTexture(k.TEXTURE_2D,a.__webglTexture),A(k.TEXTURE_2D,a,a),k.texImage2D(k.TEXTURE_2D,0,H(a.format),a.width,a.height,0,H(a.format),H(a.type),null),c=k.TEXTURE_2D,k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer),k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,c,a.__webglTexture,0),D(a.__webglRenderbuffer,a);b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,
-null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=ja,a=ka,d=ma,e=sa);b!==v&&(k.bindFramebuffer(k.FRAMEBUFFER,b),k.viewport(d,e,c,a),v=b);ya=c;ua=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+g=["#ifdef GL_ES","precision "+R+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",V.gammaInput?"#define GAMMA_INPUT":"",V.gammaOutput?"#define GAMMA_OUTPUT":"",V.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
+"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");l.attachShader(p,y("fragment",g+j));l.attachShader(p,
+y("vertex",d+k));l.linkProgram(p);l.getProgramParameter(p,l.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+l.getProgramParameter(p,l.VALIDATE_STATUS)+", gl error ["+l.getError()+"]");p.uniforms={};p.attributes={};var q,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in i)d.push(q);q=d;d=0;for(i=q.length;d<i;d++)j=q[d],p.uniforms[j]=l.getUniformLocation(p,
+j);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<c.maxMorphTargets;q++)d.push("morphTarget"+q);for(o in b)d.push(o);o=d;q=0;for(b=o.length;q<b;q++)c=o[q],p.attributes[c]=l.getAttribLocation(p,c);p.id=M.length;M.push({program:p,code:h});V.info.memory.programs=M.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&l.enableVertexAttribArray(o.position);o.color>=0&&l.enableVertexAttribArray(o.color);o.normal>=0&&l.enableVertexAttribArray(o.normal);
+o.tangent>=0&&l.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(l.enableVertexAttribArray(o.skinVertexA),l.enableVertexAttribArray(o.skinVertexB),l.enableVertexAttribArray(o.skinIndex),l.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(f in a.attributes)o[f]!==void 0&&o[f]>=0&&l.enableVertexAttribArray(o[f]);if(a.morphTargets)for(f=a.numSupportedMorphTargets=0;f<this.maxMorphTargets;f++)q="morphTarget"+f,o[q]>=0&&(l.enableVertexAttribArray(o[q]),
+a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?l.frontFace(l.CCW):l.frontFace(l.CW),a==="back"?l.cullFace(l.BACK):a==="front"?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK),l.enable(l.CULL_FACE)):l.disable(l.CULL_FACE)};this.setObjectFaces=function(a){if(fa!==a.doubleSided)a.doubleSided?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),fa=a.doubleSided;if(ca!==a.flipSided)a.flipSided?l.frontFace(l.CW):
+l.frontFace(l.CCW),ca=a.flipSided};this.setDepthTest=function(a){N!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),N=a)};this.setBlending=function(a){if(a!==U){switch(a){case THREE.AdditiveBlending:l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE);break;case THREE.SubtractiveBlending:l.blendEquation(l.FUNC_ADD);l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:l.blendEquation(l.FUNC_ADD);l.blendFunc(l.ZERO,l.SRC_COLOR);break;default:l.blendEquationSeparate(l.FUNC_ADD,
+l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)}U=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=l.createTexture(),V.info.memory.textures++;l.activeTexture(l.TEXTURE0+b);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);var c=G(l.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?l.texImage2D(l.TEXTURE_2D,0,F(a.format),a.image.width,a.image.height,0,F(a.format),l.UNSIGNED_BYTE,a.image.data):l.texImage2D(l.TEXTURE_2D,
+0,l.RGBA,l.RGBA,l.UNSIGNED_BYTE,a.image);c&&l.generateMipmap(l.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else l.activeTexture(l.TEXTURE0+b),l.bindTexture(l.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=l.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,
+a.__webglTexture);G(l.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=l.createFramebuffer();a.__webglRenderbuffer[c]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,F(a.format),a.width,a.height,0,F(a.format),F(a.type),null);var d=a,e=l.TEXTURE_CUBE_MAP_POSITIVE_X+c;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[c]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,e,d.__webglTexture,0);w(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=l.createFramebuffer(),
+a.__webglRenderbuffer=l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),G(l.TEXTURE_2D,a,a),l.texImage2D(l.TEXTURE_2D,0,F(a.format),a.width,a.height,0,F(a.format),F(a.type),null),c=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,c,a.__webglTexture,0),w(a.__webglRenderbuffer,a);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,
+null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=sa,a=ia,d=na,e=la);b!==L&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,e,c,a),L=b);Ba=c;wa=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=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
@@ -339,19 +343,19 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,g=Math.max(Math.max(c,d),e),f=Math.min(Math.min(c,d),e);if(f===g)f=c=0;else{var h=g-f,f=h/g,c=c===g?(d-e)/h:d===g?2+(e-c)/h:4+(c-d)/h;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=g;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,l=g.faces,j=a.faceVertexUvs[0],o=g.faceVertexUvs[0],p={},m=0;m<a.materials.length;m++)p[a.materials[m].id]=m;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var m=0,r=h.length;m<r;m++){var n=new THREE.Vertex(h[m].position.clone());c&&c.multiplyVector3(n.position);f.push(n)}m=
-0;for(r=l.length;m<r;m++){var f=l[m],q,s,u=f.vertexNormals,t=f.vertexColors;f instanceof THREE.Face3?q=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(q=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));q.normal.copy(f.normal);d&&d.multiplyVector3(q.normal);h=0;for(n=u.length;h<n;h++)s=u[h].clone(),d&&d.multiplyVector3(s),q.vertexNormals.push(s);q.color.copy(f.color);h=0;for(n=t.length;h<n;h++)s=t[h],q.vertexColors.push(s.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
-n=p[h.id];if(n===void 0)n=a.materials.length,a.materials.push(h);q.materialIndex=n}q.centroid.copy(f.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}m=0;for(r=o.length;m<r;m++){c=o[m];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var f=new THREE.Vertex(d[a].position.clone());b.vertices.push(f)}a=0;
-for(c=e.length;a<c;a++){var h=e[a],i,l,j=h.vertexNormals,o=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(f=j.length;d<f;d++)l=j[d],i.vertexNormals.push(l.clone());i.color.copy(h.color);d=0;for(f=o.length;d<f;d++)l=o[d],i.vertexColors.push(l.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}a=0;for(c=g.length;a<c;a++){e=g[a];i=[];d=0;for(f=e.length;d<
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,j=g.faces,k=a.faceVertexUvs[0],o=g.faceVertexUvs[0],p={},m=0;m<a.materials.length;m++)p[a.materials[m].id]=m;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var m=0,s=h.length;m<s;m++){var n=new THREE.Vertex(h[m].position.clone());c&&c.multiplyVector3(n.position);f.push(n)}m=
+0;for(s=j.length;m<s;m++){var f=j[m],q,r,t=f.vertexNormals,u=f.vertexColors;f instanceof THREE.Face3?q=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(q=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));q.normal.copy(f.normal);d&&d.multiplyVector3(q.normal);h=0;for(n=t.length;h<n;h++)r=t[h].clone(),d&&d.multiplyVector3(r),q.vertexNormals.push(r);q.color.copy(f.color);h=0;for(n=u.length;h<n;h++)r=u[h],q.vertexColors.push(r.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
+n=p[h.id];if(n===void 0)n=a.materials.length,a.materials.push(h);q.materialIndex=n}q.centroid.copy(f.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}m=0;for(s=o.length;m<s;m++){c=o[m];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var f=new THREE.Vertex(d[a].position.clone());b.vertices.push(f)}a=0;
+for(c=e.length;a<c;a++){var h=e[a],i,j,k=h.vertexNormals,o=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(f=k.length;d<f;d++)j=k[d],i.vertexNormals.push(j.clone());i.color.copy(h.color);d=0;for(f=o.length;d<f;d++)j=o[d],i.vertexColors.push(j.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}a=0;for(c=g.length;a<c;a++){e=g[a];i=[];d=0;for(f=e.length;d<
 f;d++)i.push(new THREE.UV(e[d].u,e[d].v));b.faceVertexUvs[0].push(i)}return b},randomPointInTriangle:function(a,b,c){var d,e,g,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();d+e>1&&(d=1-d,e=1-e);g=1-d-e;f.copy(a);f.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);f.addSelf(h);h.copy(c);h.multiplyScalar(g);f.addSelf(h);return f},randomPointInFace:function(a,b,c){var d,e,g;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,e=b.vertices[a.b].position,
 g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,g);else if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,f;c?a._area1&&a._area2?(c=a._area1,f=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b),a._area1=c,a._area2=f):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b));return THREE.GeometryUtils.random()*(c+
-f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return l[e]>a?b(c,e-1):l[e]<a?b(e+1,d):e}return b(0,l.length-1)}var d,e,g=a.faces,f=a.vertices,h=g.length,i=0,l=[],j,o,p,m;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)j=f[d.a].position,o=f[d.b].position,p=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,o,p);else if(d instanceof
-THREE.Face4)j=f[d.a].position,o=f[d.b].position,p=f[d.c].position,m=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,o,m),d._area2=THREE.GeometryUtils.triangleArea(o,p,m),d._area=d._area1+d._area2;i+=d._area;l[e]=i}d=[];f={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();
+f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,g=a.faces,f=a.vertices,h=g.length,i=0,j=[],k,o,p,m;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)k=f[d.a].position,o=f[d.b].position,p=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,o,p);else if(d instanceof
+THREE.Face4)k=f[d.a].position,o=f[d.b].position,p=f[d.c].position,m=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,o,m),d._area2=THREE.GeometryUtils.triangleArea(o,p,m),d._area=d._area1+d._area2;i+=d._area;j[e]=i}d=[];f={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();
 b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Matrix4;b.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(b);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin="";d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],g=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(e.loadCount===6)g.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return g},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),l=i.data,j=0;j<d;j++)for(var o=1;o<e;o++){var p=o-1<0?e-1:o-1,m=(o+1)%e,r=j-1<0?d-1:j-1,n=(j+1)%d,q=[],s=[0,0,h[(o*d+j)*4]/255*b];q.push([-1,0,h[(o*d+r)*4]/255*b]);q.push([-1,-1,h[(p*d+r)*4]/255*b]);q.push([0,-1,h[(p*d+j)*4]/255*b]);q.push([1,-1,h[(p*d+n)*4]/255*b]);
-q.push([1,0,h[(o*d+n)*4]/255*b]);q.push([1,1,h[(m*d+n)*4]/255*b]);q.push([0,1,h[(m*d+j)*4]/255*b]);q.push([-1,1,h[(m*d+r)*4]/255*b]);p=[];r=q.length;for(m=0;m<r;m++){var n=q[m],u=q[(m+1)%r],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]];p.push(c([n[1]*u[2]-n[2]*u[1],n[2]*u[0]-n[0]*u[2],n[0]*u[1]-n[1]*u[0]]))}q=[0,0,0];for(m=0;m<p.length;m++)q[0]+=p[m][0],q[1]+=p[m][1],q[2]+=p[m][2];q[0]/=p.length;q[1]/=p.length;q[2]/=p.length;s=(o*d+j)*4;l[s]=(q[0]+1)/2*255|0;l[s+1]=(q[1]+0.5)*
-255|0;l[s+2]=q[2]*255|0;l[s+3]=255}f.putImageData(i,0,0);return g}};
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),j=i.data,k=0;k<d;k++)for(var o=1;o<e;o++){var p=o-1<0?e-1:o-1,m=(o+1)%e,s=k-1<0?d-1:k-1,n=(k+1)%d,q=[],r=[0,0,h[(o*d+k)*4]/255*b];q.push([-1,0,h[(o*d+s)*4]/255*b]);q.push([-1,-1,h[(p*d+s)*4]/255*b]);q.push([0,-1,h[(p*d+k)*4]/255*b]);q.push([1,-1,h[(p*d+n)*4]/255*b]);
+q.push([1,0,h[(o*d+n)*4]/255*b]);q.push([1,1,h[(m*d+n)*4]/255*b]);q.push([0,1,h[(m*d+k)*4]/255*b]);q.push([-1,1,h[(m*d+s)*4]/255*b]);p=[];s=q.length;for(m=0;m<s;m++){var n=q[m],t=q[(m+1)%s],n=[n[0]-r[0],n[1]-r[1],n[2]-r[2]],t=[t[0]-r[0],t[1]-r[1],t[2]-r[2]];p.push(c([n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]))}q=[0,0,0];for(m=0;m<p.length;m++)q[0]+=p[m][0],q[1]+=p[m][1],q[2]+=p[m][2];q[0]/=p.length;q[1]/=p.length;q[2]/=p.length;r=(o*d+k)*4;j[r]=(q[0]+1)/2*255|0;j[r+1]=(q[1]+0.5)*
+255|0;j[r+2]=q[2]*255|0;j[r+3]=255}f.putImageData(i,0,0);return g}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var g=new THREE.Mesh(a,b[c]);e.add(g)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
 b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
 (b=new THREE.ParticleSystem(a.geometry,a.material),b.sortParticles=a.sortParticles):a instanceof THREE.Particle?b=new THREE.Particle(a.material):a instanceof THREE.Sprite?(b=new THREE.Sprite({}),b.color.copy(a.color),b.map=a.map,b.blending=a.blending,b.useScreenCoordinates=a.useScreenCoordinates,b.mergeWith3D=a.mergeWith3D,b.affectedByDistance=a.affectedByDistance,b.scaleByViewport=a.scaleByViewport,b.alignment=a.alignment,b.rotation3d.copy(a.rotation3d),b.rotation=a.rotation,b.opacity=a.opacity,
@@ -396,39 +400,39 @@ THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,g){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,g)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
 THREE.Path.prototype.arc=function(a,b,c,d,e,g){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,e,g));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,l,j,o,p,m,r,n;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];o=g[0];p=g[1];c.length>0?(f=c[c.length-1],m=f.x,r=f.y):(f=this.actions[d-1].args,m=f[f.length-2],r=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b2(n,m,o,h),n=THREE.Shape.Utils.b2(n,r,p,
-i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];o=g[0];p=g[1];l=g[2];j=g[3];c.length>0?(f=c[c.length-1],m=f.x,r=f.y):(f=this.actions[d-1].args,m=f[f.length-2],r=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b3(n,m,o,l,h),n=THREE.Shape.Utils.b3(n,r,p,j,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];n=a*g[0].length;f=f.concat(g[0]);g=new THREE.SplineCurve(f);
-for(f=1;f<=n;f++)c.push(g.getPointAt(f/n));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=g[0];i=g[1];l=g[2];o=g[3];n=g[4];p=!!g[5];j=f[f.length-2];m=f[f.length-1];f.length==0&&(j=m=0);r=n-o;var q=a*2;for(f=1;f<=q;f++)n=f/q,p||(n=1-n),n=o+n*r,g=j+h+l*Math.cos(n),n=m+i+l*Math.sin(n),c.push(new THREE.Vector2(g,n))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
-THREE.Path.prototype.nltransform=function(a,b,c,d,e,g){var f=this.getPoints(),h,i,l,j,o;h=0;for(i=f.length;h<i;h++)l=f[h],j=l.x,o=l.y,l.x=a*j+b*o+c,l.y=d*o+e*j+g;return f};
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,j,k,o,p,m,s,n;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];o=g[0];p=g[1];c.length>0?(f=c[c.length-1],m=f.x,s=f.y):(f=this.actions[d-1].args,m=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b2(n,m,o,h),n=THREE.Shape.Utils.b2(n,s,p,
+i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];o=g[0];p=g[1];j=g[2];k=g[3];c.length>0?(f=c[c.length-1],m=f.x,s=f.y):(f=this.actions[d-1].args,m=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b3(n,m,o,j,h),n=THREE.Shape.Utils.b3(n,s,p,k,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];n=a*g[0].length;f=f.concat(g[0]);g=new THREE.SplineCurve(f);
+for(f=1;f<=n;f++)c.push(g.getPointAt(f/n));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=g[0];i=g[1];j=g[2];o=g[3];n=g[4];p=!!g[5];k=f[f.length-2];m=f[f.length-1];f.length==0&&(k=m=0);s=n-o;var q=a*2;for(f=1;f<=q;f++)n=f/q,p||(n=1-n),n=o+n*s,g=k+h+j*Math.cos(n),n=m+i+j*Math.sin(n),c.push(new THREE.Vector2(g,n))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
+THREE.Path.prototype.nltransform=function(a,b,c,d,e,g){var f=this.getPoints(),h,i,j,k,o;h=0;for(i=f.length;h<i;h++)j=f[h],k=j.x,o=j.y,j.x=a*k+b*o+c,j.y=d*o+e*k+g;return f};
 THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,e,a=0;for(c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
 this.getPoints();a=0;for(c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],g=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&g.actions.length!=0&&(e.push(g),g=new THREE.Path),g[c].apply(g,d);g.actions.length!=0&&e.push(g);if(e.length==0)return[];var f,g=[];if(THREE.Shape.Utils.isClockWise(e[0].getPoints())){a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f&&g.push(f),f=new THREE.Shape,f.actions=d.actions,f.curves=
 d.curves):f.holes.push(d);g.push(f)}else{f=new THREE.Shape;a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f.actions=d.actions,f.curves=d.curves,g.push(f),f=new THREE.Shape):f.holes.push(d)}return g};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,l,j,o,p,m,r=[];for(i=0;i<b.length;i++){l=b[i];Array.prototype.push.apply(d,l);g=Number.POSITIVE_INFINITY;for(e=0;e<l.length;e++){p=l[e];m=[];for(o=0;o<c.length;o++)j=c[o],j=p.distanceToSquared(j),m.push(j),j<g&&(g=j,f=e,h=o)}e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:l.length-1;var n=[l[f],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(n);var q=[l[f],l[g],c[h]];p=THREE.FontUtils.Triangulate.area(q);m=h;j=f;h+=1;f+=-1;h<
-0&&(h+=c.length);h%=c.length;f<0&&(f+=l.length);f%=l.length;e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:l.length-1;n=[l[f],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[l[f],l[g],c[h]];q=THREE.FontUtils.Triangulate.area(q);o+p>n+q&&(h=m,f=j,h<0&&(h+=c.length),h%=c.length,f<0&&(f+=l.length),f%=l.length,e=h-1>=0?h-1:c.length-1,g=f-1>=0?f-1:l.length-1);o=c.slice(0,h);p=c.slice(h);m=l.slice(f);j=l.slice(0,f);g=[l[f],l[g],c[h]];r.push([l[f],c[h],c[e]]);r.push(g);c=o.concat(m).concat(j).concat(p)}return{shape:c,
-isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,f,h,i,l={};g=0;for(f=d.length;g<f;g++)i=d[g].x+":"+d[g].y,l[i]!==void 0&&console.log("Duplicate point",i),l[i]=g;g=0;for(f=c.length;g<f;g++){h=c[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=l[i],i!==void 0&&(h[d]=i)}g=0;for(f=e.length;g<f;g++){h=e[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=l[i],i!==void 0&&(h[d]=i)}return c.concat(e)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,j,k,o,p,m,s=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);g=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){p=j[e];m=[];for(o=0;o<c.length;o++)k=c[o],k=p.distanceToSquared(k),m.push(k),k<g&&(g=k,f=e,h=o)}e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:j.length-1;var n=[j[f],c[h],c[e]];o=THREE.FontUtils.Triangulate.area(n);var q=[j[f],j[g],c[h]];p=THREE.FontUtils.Triangulate.area(q);m=h;k=f;h+=1;f+=-1;h<
+0&&(h+=c.length);h%=c.length;f<0&&(f+=j.length);f%=j.length;e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:j.length-1;n=[j[f],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[j[f],j[g],c[h]];q=THREE.FontUtils.Triangulate.area(q);o+p>n+q&&(h=m,f=k,h<0&&(h+=c.length),h%=c.length,f<0&&(f+=j.length),f%=j.length,e=h-1>=0?h-1:c.length-1,g=f-1>=0?f-1:j.length-1);o=c.slice(0,h);p=c.slice(h);m=j.slice(f);k=j.slice(0,f);g=[j[f],j[g],c[h]];s.push([j[f],c[h],c[e]]);s.push(g);c=o.concat(m).concat(k).concat(p)}return{shape:c,
+isolatedPts:s,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,f,h,i,j={};g=0;for(f=d.length;g<f;g++)i=d[g].x+":"+d[g].y,j[i]!==void 0&&console.log("Duplicate point",i),j[i]=g;g=0;for(f=c.length;g<f;g++){h=c[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}g=0;for(f=e.length;g<f;g++){h=e[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}return c.concat(e)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",g=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=g};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
 THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(a.hierarchy[c].keys[d].time<
-0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var l=a.hierarchy[c].keys[d].morphTargets[i];h[l]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var j=
-{};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){j[l]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(j[l]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=j}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
-a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
-2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===void 0)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
-THREE.Bone?e.skinMatrix:e.matrix;var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=
+h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k={};for(j in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){k[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=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(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=
+0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();
+THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3;a=0;for(b=this.hierarchy.length;a<b;a++)if(c=this.data.hierarchy[a].sids,d=this.hierarchy[a],this.data.hierarchy[a].keys.length){for(var e=
+0;e<c.length;e++){var g=c[e],f=this.getNextKeyWith(g,a,0);f&&f.apply(g)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}};
+THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,g;for(c=0;c<d;c++){e=this.hierarchy[c];g=this.data.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey=null,g.animationCache.nextKey=null,
+g.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:e.matrix;e=this.data.hierarchy[c].keys;if(e.length)g.animationCache.prevKey=e[0],g.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.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
-THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,g,f,h,i,l,j=this.data.JIT.hierarchy,o,p;this.currentTime+=a*this.timeScale;p=this.currentTime;o=this.currentTime%=this.data.length;l=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,r=this.hierarchy.length;m<r;m++)if(a=this.hierarchy[m],i=a.animationCache,this.JITCompile&&j[m][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[m][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=j[m][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var n=0;n<3;n++){c=b[n];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=p){if(o<p)if(this.loop){f=this.data.hierarchy[m].keys[0];for(h=this.getNextKeyWith(c,m,1);h.time<o;)f=h,h=this.getNextKeyWith(c,m,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,m,h.index+1);while(h.time<
-o)}i.prevKey[c]=f;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(o-f.time)/(h.time-f.time);e=f[c];g=h[c];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m),d=d<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",m,f.index-1).pos,this.points[1]=e,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",m,h.index+1).pos,d=d*0.33+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(c===
-"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d}}if(this.JITCompile&&j[0][l]===void 0){this.hierarchy[0].update(null,!0);for(m=0;m<this.hierarchy.length;m++)j[m][l]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,g,f,h,i,l;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];l=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],i[0],l[0],e,c,f);d[1]=this.interpolate(g[1],h[1],i[1],l[1],e,c,f);d[2]=this.interpolate(g[2],h[2],i[2],l[2],e,c,f);return d};
-THREE.Animation.prototype.interpolate=function(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<d.length-1?c:d.length-1:c%=d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
-THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
+THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++){var b=this.hierarchy[a];if(b.animationCache!==void 0){var c=b.animationCache.originalMatrix;b instanceof THREE.Bone?(c.copy(b.skinMatrix),b.skinMatrix=c):(c.copy(b.matrix),b.matrix=c);delete b.animationCache}}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,g=this.data.JIT.hierarchy,f,h,i;this.currentTime+=a*this.timeScale;h=this.currentTime;f=this.currentTime%=this.data.length;if(f<this.startTimeMs)f=this.currentTime=this.startTimeMs+f;e=parseInt(Math.min(f*this.data.fps,this.data.length*this.data.fps),10);if((i=f<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var k=this.data.hierarchy[a].keys,g=this.data.hierarchy[a].sids;d=k.length-1;e=this.hierarchy[a];if(k.length){for(k=
+0;k<g.length;k++)f=g[k],(h=this.getPrevKeyWith(f,a,d))&&h.apply(f);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(f<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,o=b.animationCache;if(this.JITCompile&&g[a][e]!==void 0)d instanceof THREE.Bone?(d.skinMatrix=g[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=g[a][e],d.matrixWorldNeedsUpdate=!0);else if(k.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(i&&this.loop){b=k[0];for(c=k[1];c.time<f;)b=c,c=k[b.index+1]}else if(!i)for(var p=k.length-1;c.time<f&&c.index!==p;)b=c,c=k[b.index+1];o.prevKey=b;o.nextKey=c}b.interpolate(c,f)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&g[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)g[a][e]=this.hierarchy[a]instanceof
+THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,g,f,h,i,j;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],i[0],j[0],e,c,f);d[1]=this.interpolate(g[1],h[1],i[1],j[1],e,c,f);d[2]=this.interpolate(g[2],h[2],i[2],j[2],e,c,f);return d};
+THREE.Animation.prototype.interpolate=function(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<b.length-1?c:b.length-1:c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+b.length;c>=0;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=
 new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(d,d,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
@@ -448,7 +452,7 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=
 1;this.constrainVertical&&(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*
 Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
-THREE.PathControls=function(a,b){function c(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,s=0;f=q-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<q-1;f++)s=d*h.chunks[f]/h.total,b.keys[f]={time:s,pos:g[f]};e.hierarchy[0]=
+THREE.PathControls=function(a,b){function c(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,r=0;f=q-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<q-1;f++)r=d*h.chunks[f]/h.total,b.keys[f]={time:r,pos:g[f]};e.hierarchy[0]=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,h=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%f;this.phi=a>=0?a:a+f;b=this.verticalAngleMap.srcRange;
@@ -466,42 +470,42 @@ THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,argu
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,i=0,l=0,j=0,o=0,p=0,m=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
-this.rotateHorizontally(b*o);this.rotateVertically(b*p)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*l);this.object.translateY(b*j);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,i=0,j=0,k=0,o=0,p=0,m=window.innerWidth/2,s=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
+this.rotateHorizontally(b*o);this.rotateVertically(b*p)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*j);this.object.translateY(b*k);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
 e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;g.identity();g.n11=Math.cos(this.roll);g.n12=-Math.sin(this.roll);g.n21=Math.sin(this.roll);g.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(g);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-m)/window.innerWidth;p=(a.clientY-r)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
-function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:l=-1;break;case 40:case 83:i=-1;break;case 39:case 68:l=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82: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:l=0;break;case 40:case 83:i=0;break;case 39:case 68:l=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:j=0;break;case 70:j=0}},!1)};
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-m)/window.innerWidth;p=(a.clientY-s)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
+function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
 THREE.TrackballControls=function(a,b){var c=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=b!==void 0?b:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];
-this.target=new THREE.Vector3(0,0,0);var e=!1,g=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector2,j=new THREE.Vector2,o=new THREE.Vector2,p=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
+this.target=new THREE.Vector3(0,0,0);var e=!1,g=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,o=new THREE.Vector2,p=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
 c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=c.rotateSpeed;d.setFromAxisAngle(b,
--a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-l.y)*c.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),c.staticMoving?l=j:l.y+=(j.y-l.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=p.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));
+-a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*c.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),c.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=p.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));
 c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=p:o.addSelf(a.sub(p,o).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),f.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,f.setLength(c.minDistance))};this.update=function(){f.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();
-c.noPan||c.panCamera();c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),l=j=c.getMouseOnScreen(a.clientX,a.clientY),o=p=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),g!==d.NONE&&(g===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&
-!c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):g===d.PAN&&!c.noPan&&(p=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!c.noZoom?l=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=p=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
+c.noPan||c.panCamera();c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=c.getMouseOnScreen(a.clientX,a.clientY),o=p=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),g!==d.NONE&&(g===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&
+!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):g===d.PAN&&!c.noPan&&(p=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!c.noZoom?j=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=p=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
 function(a){if(c.enabled)a.preventDefault(),a.stopPropagation(),g=d.NONE},!1);window.addEventListener("keydown",function(a){if(c.enabled&&g===d.NONE){if(a.keyCode===c.keys[d.ROTATE]&&!c.noRotate)g=d.ROTATE;else if(a.keyCode===c.keys[d.ZOOM]&&!c.noZoom)g=d.ZOOM;else if(a.keyCode===c.keys[d.PAN]&&!c.noPan)g=d.PAN;g!==d.NONE&&(e=!0)}},!1);window.addEventListener("keyup",function(){if(c.enabled&&g!==d.NONE)g=d.NONE},!1)};
-THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,j,m){var n,o=d||1,p=e||1,q=h/2,r=i/2,s=l.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",p=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=g||1;var k=o+1,t=p+1,u=h/o,v=i/p,M=new THREE.Vector3;M[n]=j>0?1:-1;for(h=0;h<t;h++)for(i=0;i<k;i++){var X=new THREE.Vector3;X[a]=(i*u-q)*c;X[b]=(h*v-r)*f;X[n]=j;l.vertices.push(new THREE.Vertex(X))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
-new THREE.Face4(i+k*h+s,i+k*(h+1)+s,i+1+k*(h+1)+s,i+1+k*h+s),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=m,l.faces.push(a),l.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var l=this,j=a/2,o=b/2,p=c/2,m,r,n,q,s,u;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;q=1;r=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(h!=void 0)for(var t in h)this.sides[t]!==void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,j,m);this.sides.nx&&i("z","y",1,-1,c,b,-j,q);this.sides.py&&i("x","z",1,1,a,c,o,r);this.sides.ny&&i("x","z",1,-1,a,c,-o,s);this.sides.pz&&i("x","y",1,-1,a,b,p,n);this.sides.nz&&i("x","y",-1,-1,a,b,-p,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,k,m){var n,o=d||1,p=e||1,q=h/2,s=i/2,r=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",p=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=g||1;var l=o+1,t=p+1,u=h/o,L=i/p,v=new THREE.Vector3;v[n]=k>0?1:-1;for(h=0;h<t;h++)for(i=0;i<l;i++){var Y=new THREE.Vector3;Y[a]=(i*u-q)*c;Y[b]=(h*L-s)*f;Y[n]=k;j.vertices.push(new THREE.Vertex(Y))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
+new THREE.Face4(i+l*h+r,i+l*(h+1)+r,i+1+l*(h+1)+r,i+1+l*h+r),a.normal.copy(v),a.vertexNormals.push(v.clone(),v.clone(),v.clone(),v.clone()),a.materialIndex=m,j.faces.push(a),j.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var j=this,k=a/2,o=b/2,p=c/2,m,s,n,q,r,t;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;q=1;s=2;r=
+3;n=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var u in h)this.sides[u]!==void 0&&(this.sides[u]=h[u]);this.sides.px&&i("z","y",-1,-1,c,b,k,m);this.sides.nx&&i("z","y",1,-1,c,b,-k,q);this.sides.py&&i("x","z",1,1,a,c,o,s);this.sides.ny&&i("x","z",1,-1,a,c,-o,r);this.sides.pz&&i("x","y",1,-1,a,b,p,n);this.sides.nz&&i("x","y",-1,-1,a,b,-p,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,d=d||8,e=e||1,h,i,l=[],j=[];for(i=0;i<=e;i++){var o=[],p=[],m=i/e,r=m*(b-a)+a;for(h=0;h<=d;h++){var n=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(r*Math.sin(n*Math.PI*2),-m*c+f,r*Math.cos(n*Math.PI*2))));o.push(this.vertices.length-1);p.push(new THREE.UV(n,m))}l.push(o);j.push(p)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=l[i][h],o=l[i+1][h],p=l[i+1][h+1],m=l[i][h+1],r=
-this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[o].position.clone().setY(0).normalize(),q=this.vertices[p].position.clone().setY(0).normalize(),s=this.vertices[m].position.clone().setY(0).normalize(),u=j[i][h].clone(),t=j[i+1][h].clone(),y=j[i+1][h+1].clone(),A=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,o,p,m,[r,n,q,s]));this.faceVertexUvs[0].push([u,t,y,A])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=l[0][h],o=l[0][h+
-1],p=this.vertices.length-1,r=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),u=j[0][h].clone(),t=j[0][h+1].clone(),y=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,o,p,[r,n,q])),this.faceVertexUvs[0].push([u,t,y])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=l[i][h+1],o=l[i][h],p=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),u=j[i][h+1].clone(),t=j[i][h].clone(),
-y=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,o,p,[r,n,q])),this.faceVertexUvs[0].push([u,t,y])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,d=d||8,e=e||1,h,i,j=[],k=[];for(i=0;i<=e;i++){var o=[],p=[],m=i/e,s=m*(b-a)+a;for(h=0;h<=d;h++){var n=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(s*Math.sin(n*Math.PI*2),-m*c+f,s*Math.cos(n*Math.PI*2))));o.push(this.vertices.length-1);p.push(new THREE.UV(n,m))}j.push(o);k.push(p)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=j[i][h],o=j[i+1][h],p=j[i+1][h+1],m=j[i][h+1],s=
+this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[o].position.clone().setY(0).normalize(),q=this.vertices[p].position.clone().setY(0).normalize(),r=this.vertices[m].position.clone().setY(0).normalize(),t=k[i][h].clone(),u=k[i+1][h].clone(),y=k[i+1][h+1].clone(),G=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,o,p,m,[s,n,q,r]));this.faceVertexUvs[0].push([t,u,y,G])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=j[0][h],o=j[0][h+
+1],p=this.vertices.length-1,s=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),t=k[0][h].clone(),u=k[0][h+1].clone(),y=new THREE.UV(u.u,0),this.faces.push(new THREE.Face3(c,o,p,[s,n,q])),this.faceVertexUvs[0].push([t,u,y])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=j[i][h+1],o=j[i][h],p=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),t=k[i][h+1].clone(),u=k[i][h].clone(),
+y=new THREE.UV(u.u,1),this.faces.push(new THREE.Face3(c,o,p,[s,n,q])),this.faceVertexUvs[0].push([t,u,y])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d=a.length,e;this.shapebb=a[d-1].getBoundingBox();for(c=0;c<d;c++)e=a[c],this.addShape(e,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
-h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(a){for(x=a.length;--x>=0;){X=x;ca=x-1;ca<0&&(ca=a.length-1);for(var b=
-0,c=m+j*2,b=0;b<c;b++){var d=V*b,e=V*(b+1),f=ea+X+d,g=ea+X+e,k=f,d=ea+ca+d,e=ea+ca+e,l=g;k+=J;d+=J;e+=J;l+=J;B.faces.push(new THREE.Face4(k,d,e,l,null,null,y));y&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(B.vertices[f].position.z+i)/e,g=(B.vertices[g].position.z+i)/e,B.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function g(a,b,c){B.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=J;b+=J;c+=J;B.faces.push(new THREE.Face3(a,b,c,
-null,null,t));if(t){var d=A.maxY,e=A.maxX,f=B.vertices[b].position.x,b=B.vertices[b].position.y,g=B.vertices[c].position.x,c=B.vertices[c].position.y;B.faceVertexUvs[0].push([new THREE.UV(B.vertices[a].position.x/e,B.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,l=b.bevelSize!==void 0?b.bevelSize:i-2,j=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:!0,
-p=b.curveSegments!==void 0?b.curveSegments:12,m=b.steps!==void 0?b.steps:1,r=b.bendPath,n=b.extrudePath,q,s=!1,u=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,t=b.material,y=b.extrudeMaterial,A=this.shapebb;if(n)q=n.getPoints(p),m=q.length,s=!0,o=!1;o||(l=i=j=0);var D,F,H,B=this,J=this.vertices.length;r&&a.addWrapPath(r);p=u?a.extractAllSpacedPoints(p):a.extractAllPoints(p);r=p.shape;p=p.holes;if(n=!THREE.Shape.Utils.isClockWise(r)){r=r.reverse();F=0;for(H=p.length;F<H;F++)D=p[F],THREE.Shape.Utils.isClockWise(D)&&
-(p[F]=D.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(r,p);u=r;F=0;for(H=p.length;F<H;F++)D=p[F],r=r.concat(D);var x,z,G,W,S,T,V=r.length,k=n.length,L=[];x=0;z=u.length;X=z-1;for(ca=x+1;x<z;x++,X++,ca++)X===z&&(X=0),ca===z&&(ca=0),L[x]=d(u[x],u[X],u[ca]);var K=[],v,M=L.concat();F=0;for(H=p.length;F<H;F++){D=p[F];v=[];x=0;z=D.length;X=z-1;for(ca=x+1;x<z;x++,X++,ca++)X===z&&(X=0),ca===z&&(ca=0),v[x]=d(D[x],D[X],D[ca]);K.push(v);M=M.concat(v)}for(G=0;G<j;G++){W=G/j;S=i*(1-W);W=l*Math.sin(W*Math.PI/
-2);x=0;for(z=u.length;x<z;x++)T=c(u[x],L[x],W),g(T.x,T.y,-S);F=0;for(H=p.length;F<H;F++){D=p[F];v=K[F];x=0;for(z=D.length;x<z;x++)T=c(D[x],v[x],W),g(T.x,T.y,-S)}}W=l;for(x=0;x<V;x++)T=o?c(r[x],M[x],W):r[x],s?g(T.x,T.y+q[0].y,q[0].x):g(T.x,T.y,0);for(G=1;G<=m;G++)for(x=0;x<V;x++)T=o?c(r[x],M[x],W):r[x],s?g(T.x,T.y+q[G-1].y,q[G-1].x):g(T.x,T.y,h/m*G);for(G=j-1;G>=0;G--){W=G/j;S=i*(1-W);W=l*Math.sin(W*Math.PI/2);x=0;for(z=u.length;x<z;x++)T=c(u[x],L[x],W),g(T.x,T.y,h+S);F=0;for(H=p.length;F<H;F++){D=
-p[F];v=K[F];x=0;for(z=D.length;x<z;x++)T=c(D[x],v[x],W),s?g(T.x,T.y+q[m-1].y,q[m-1].x+S):g(T.x,T.y,h+S)}}if(o){o=V*0;for(x=0;x<k;x++)l=n[x],f(l[2]+o,l[1]+o,l[0]+o);o=V*(m+j*2);for(x=0;x<k;x++)l=n[x],f(l[0]+o,l[1]+o,l[2]+o)}else{for(x=0;x<k;x++)l=n[x],f(l[2],l[1],l[0]);for(x=0;x<k;x++)l=n[x],f(l[0]+V*m,l[1]+V*m,l[2]+V*m)}var X,ca,ea=0;e(u);ea+=u.length;F=0;for(H=p.length;F<H;F++)D=p[F],e(D),ea+=D.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(a){for(x=a.length;--x>=0;){Y=x;aa=x-1;aa<0&&(aa=a.length-1);for(var b=
+0,c=m+k*2,b=0;b<c;b++){var d=V*b,e=V*(b+1),f=fa+Y+d,g=fa+Y+e,j=f,d=fa+aa+d,e=fa+aa+e,l=g;j+=R;d+=R;e+=R;l+=R;I.faces.push(new THREE.Face4(j,d,e,l,null,null,y));y&&(j=b/c,d=(b+1)/c,e=h+i*2,f=(I.vertices[f].position.z+i)/e,g=(I.vertices[g].position.z+i)/e,I.faceVertexUvs[0].push([new THREE.UV(f,j),new THREE.UV(g,j),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function g(a,b,c){I.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=R;b+=R;c+=R;I.faces.push(new THREE.Face3(a,b,c,
+null,null,u));if(u){var d=G.maxY,e=G.maxX,f=I.vertices[b].position.x,b=I.vertices[b].position.y,g=I.vertices[c].position.x,c=I.vertices[c].position.y;I.faceVertexUvs[0].push([new THREE.UV(I.vertices[a].position.x/e,I.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,j=b.bevelSize!==void 0?b.bevelSize:i-2,k=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:!0,
+p=b.curveSegments!==void 0?b.curveSegments:12,m=b.steps!==void 0?b.steps:1,s=b.bendPath,n=b.extrudePath,q,r=!1,t=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,u=b.material,y=b.extrudeMaterial,G=this.shapebb;if(n)q=n.getPoints(p),m=q.length,r=!0,o=!1;o||(j=i=k=0);var w,B,F,I=this,R=this.vertices.length;s&&a.addWrapPath(s);p=t?a.extractAllSpacedPoints(p):a.extractAllPoints(p);s=p.shape;p=p.holes;if(n=!THREE.Shape.Utils.isClockWise(s)){s=s.reverse();B=0;for(F=p.length;B<F;B++)w=p[B],THREE.Shape.Utils.isClockWise(w)&&
+(p[B]=w.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(s,p);t=s;B=0;for(F=p.length;B<F;B++)w=p[B],s=s.concat(w);var x,A,K,X,T,$,V=s.length,l=n.length,M=[];x=0;A=t.length;Y=A-1;for(aa=x+1;x<A;x++,Y++,aa++)Y===A&&(Y=0),aa===A&&(aa=0),M[x]=d(t[x],t[Y],t[aa]);var J=[],L,v=M.concat();B=0;for(F=p.length;B<F;B++){w=p[B];L=[];x=0;A=w.length;Y=A-1;for(aa=x+1;x<A;x++,Y++,aa++)Y===A&&(Y=0),aa===A&&(aa=0),L[x]=d(w[x],w[Y],w[aa]);J.push(L);v=v.concat(L)}for(K=0;K<k;K++){X=K/k;T=i*(1-X);X=j*Math.sin(X*Math.PI/
+2);x=0;for(A=t.length;x<A;x++)$=c(t[x],M[x],X),g($.x,$.y,-T);B=0;for(F=p.length;B<F;B++){w=p[B];L=J[B];x=0;for(A=w.length;x<A;x++)$=c(w[x],L[x],X),g($.x,$.y,-T)}}X=j;for(x=0;x<V;x++)$=o?c(s[x],v[x],X):s[x],r?g($.x,$.y+q[0].y,q[0].x):g($.x,$.y,0);for(K=1;K<=m;K++)for(x=0;x<V;x++)$=o?c(s[x],v[x],X):s[x],r?g($.x,$.y+q[K-1].y,q[K-1].x):g($.x,$.y,h/m*K);for(K=k-1;K>=0;K--){X=K/k;T=i*(1-X);X=j*Math.sin(X*Math.PI/2);x=0;for(A=t.length;x<A;x++)$=c(t[x],M[x],X),g($.x,$.y,h+T);B=0;for(F=p.length;B<F;B++){w=
+p[B];L=J[B];x=0;for(A=w.length;x<A;x++)$=c(w[x],L[x],X),r?g($.x,$.y+q[m-1].y,q[m-1].x+T):g($.x,$.y,h+T)}}if(o){o=V*0;for(x=0;x<l;x++)j=n[x],f(j[2]+o,j[1]+o,j[0]+o);o=V*(m+k*2);for(x=0;x<l;x++)j=n[x],f(j[0]+o,j[1]+o,j[2]+o)}else{for(x=0;x<l;x++)j=n[x],f(j[2],j[1],j[0]);for(x=0;x<l;x++)j=n[x],f(j[0]+V*m,j[1]+V*m,j[2]+V*m)}var Y,aa,fa=0;e(t);fa+=t.length;B=0;for(F=p.length;B<F;B++)w=p[B],e(w),fa+=w.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var f=e.vertices[a].position,g=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1-
 (Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-g.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}function d(a,c){var d=e.vertices[a].position,f=e.vertices[c].position;return b((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,
-1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in g.faces){var i=d(g.faces[h].a,g.faces[h].b),l=d(g.faces[h].b,g.faces[h].c),j=d(g.faces[h].c,g.faces[h].a);c(g.faces[h].a,i,j,a);c(g.faces[h].b,l,i,a);c(g.faces[h].c,j,l,a);c(i,l,j,a)}g.faces=a.faces;g.faceVertexUvs[0]=a.faceVertexUvs[0]}e.faces=
+1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in g.faces){var i=d(g.faces[h].a,g.faces[h].b),j=d(g.faces[h].b,g.faces[h].c),k=d(g.faces[h].c,g.faces[h].a);c(g.faces[h].a,i,k,a);c(g.faces[h].b,j,i,a);c(g.faces[h].c,k,j,a);c(i,j,k,a)}g.faces=a.faces;g.faceVertexUvs[0]=a.faceVertexUvs[0]}e.faces=
 g.faces;e.faceVertexUvs[0]=g.faceVertexUvs[0];this.computeCentroids();this.computeFaceNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],g=[],f=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=f.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=g;i==0&&(g=d);
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
@@ -509,160 +513,170 @@ THREE.OctahedronGeometry=function(a,b){function c(b){var c=b.clone().normalize()
 f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push([g(a.uv,a.position,h),g(b.uv,b.position,h),g(c.uv,c.position,h)])):(h-=1,d(a,e(a,b),e(a,c),h),d(e(a,b),b,e(b,c),h),d(e(a,c),e(b,c),c,h),d(e(a,b),e(b,c),e(a,c),h))}function e(a,b){h[a.index]||(h[a.index]=[]);h[b.index]||(h[b.index]=[]);var d=h[a.index][b.index];d===void 0&&(h[a.index][b.index]=h[b.index][a.index]=d=c((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return d}function g(a,b,c){c<0&&a.u===
 1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var b=b||0,f=this;c(new THREE.Vector3(1,0,0));c(new THREE.Vector3(-1,0,0));c(new THREE.Vector3(0,1,0));c(new THREE.Vector3(0,-1,0));c(new THREE.Vector3(0,0,1));c(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],b);d(i[0],i[4],i[3],b);d(i[0],i[3],i[5],b);d(i[0],i[5],i[2],b);d(i[1],i[2],i[5],b);d(i[1],i[5],i[3],b);d(i[1],i[3],i[4],b);d(i[1],i[4],i[2],b);this.boundingSphere=
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
-THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,g=b/2,c=c||1,d=d||1,f=c+1,h=d+1,i=a/c,l=b/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<f;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*l-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+f*a,b+f*(a+1),b+1+f*(a+1),b+1+f*a),e.normal.copy(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/
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,g=b/2,c=c||1,d=d||1,f=c+1,h=d+1,i=a/c,j=b/d,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<f;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*j-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+f*a,b+f*(a+1),b+1+f*(a+1),b+1+f*a),e.normal.copy(k),e.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
 c,(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c,d,e,g,f){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,g=g!=void 0?g:0,f=f!=void 0?f:Math.PI,h,i,l=[],j=[];for(i=0;i<=c;i++){var o=[],p=[];for(h=0;h<=b;h++){var m=h/b,r=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+m*e)*Math.sin(g+r*f),a*Math.cos(g+r*f),a*Math.sin(d+m*e)*Math.sin(g+r*f))));o.push(this.vertices.length-1);p.push(new THREE.UV(m,r))}l.push(o);
-j.push(p)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=l[i][h+1],e=l[i][h],g=l[i+1][h],f=l[i+1][h+1],o=this.vertices[d].position.clone().normalize(),p=this.vertices[e].position.clone().normalize(),m=this.vertices[g].position.clone().normalize(),r=this.vertices[f].position.clone().normalize(),n=j[i][h+1].clone(),q=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,g,f,[o,m,r])),this.faceVertexUvs[0].push([n,s,u])):Math.abs(this.vertices[g].position.y)==
-a?(this.faces.push(new THREE.Face3(d,e,g,[o,p,m])),this.faceVertexUvs[0].push([n,q,s])):(this.faces.push(new THREE.Face4(d,e,g,f,[o,p,m,r])),this.faceVertexUvs[0].push([n,q,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,g,f){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,g=g!=void 0?g:0,f=f!=void 0?f:Math.PI,h,i,j=[],k=[];for(i=0;i<=c;i++){var o=[],p=[];for(h=0;h<=b;h++){var m=h/b,s=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+m*e)*Math.sin(g+s*f),a*Math.cos(g+s*f),a*Math.sin(d+m*e)*Math.sin(g+s*f))));o.push(this.vertices.length-1);p.push(new THREE.UV(m,s))}j.push(o);
+k.push(p)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],e=j[i][h],g=j[i+1][h],f=j[i+1][h+1],o=this.vertices[d].position.clone().normalize(),p=this.vertices[e].position.clone().normalize(),m=this.vertices[g].position.clone().normalize(),s=this.vertices[f].position.clone().normalize(),n=k[i][h+1].clone(),q=k[i][h].clone(),r=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,g,f,[o,m,s])),this.faceVertexUvs[0].push([n,r,t])):Math.abs(this.vertices[g].position.y)==
+a?(this.faces.push(new THREE.Face3(d,e,g,[o,p,m])),this.faceVertexUvs[0].push([n,q,r])):(this.faces.push(new THREE.Face4(d,e,g,f,[o,p,m,s])),this.faceVertexUvs[0].push([n,q,r,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=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
-0,e=String(a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,l,j,o,p,m,r,n,q,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;j=b[a++]*c;g.push(new THREE.Vector2(i,j));e.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,
-j));e.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;m=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(m,r,i,j);if(f=g[g.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++){var u=f/h,t=THREE.Shape.Utils.b2(u,o,m,i),u=THREE.Shape.Utils.b2(u,p,r,j);g.push(new THREE.Vector2(t,u))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,m=b[a++]*c+d,r=b[a++]*-c,n=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,j,m,r,n,q),f=g[g.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++)u=f/h,t=THREE.Shape.Utils.b3(u,o,m,
-n,i),u=THREE.Shape.Utils.b3(u,p,r,q,j),g.push(new THREE.Vector2(t,u))}}}return{offset:s.ha*c,points:g,path:e}}}};
-(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,l,j;if(b(a)>0)for(l=0;l<e;l++)f[l]=l;else for(l=0;l<e;l++)f[l]=e-1-l;var o=2*e;for(l=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=l;e<=i&&(i=0);l=i+1;e<=l&&(l=0);j=l+1;e<=j&&(j=0);var p;a:{p=a;var m=i,r=l,n=j,q=e,s=f,u=void 0,t=void 0,y=void 0,
-A=void 0,D=void 0,F=void 0,H=void 0,B=void 0,J=void 0,t=p[s[m]].x,y=p[s[m]].y,A=p[s[r]].x,D=p[s[r]].y,F=p[s[n]].x,H=p[s[n]].y;if(1.0E-10>(A-t)*(H-y)-(D-y)*(F-t))p=!1;else{for(u=0;u<q;u++)if(!(u==m||u==r||u==n)){var B=p[s[u]].x,J=p[s[u]].y,x=void 0,z=void 0,G=void 0,W=void 0,S=void 0,T=void 0,V=void 0,k=void 0,L=void 0,K=void 0,v=void 0,M=void 0,x=G=S=void 0,x=F-A,z=H-D,G=t-F,W=y-H,S=A-t,T=D-y,V=B-t,k=J-y,L=B-A,K=J-D,v=B-F,M=J-H,x=x*K-z*L,S=S*k-T*V,G=G*M-W*v;if(x>=0&&G>=0&&S>=0){p=!1;break a}}p=!0}}if(p){g.push([a[f[i]],
-a[f[l]],a[f[j]]]);h.push([f[i],f[l],f[j]]);i=l;for(j=l+1;j<e;i++,j++)f[i]=f[j];e--;o=2*e}}if(d)return h;return g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+0,e=String(a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,j,k,o,p,m,s,n,q,r=b.glyphs[a]||b.glyphs["?"];if(r){if(r.o){b=r._cachedOutline||(r._cachedOutline=r.o.split(" "));j=b.length;for(a=0;a<j;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,k));e.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,
+k));e.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;m=b[a++]*c+d;s=b[a++]*c;e.quadraticCurveTo(m,s,i,k);if(f=g[g.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++){var t=f/h,u=THREE.Shape.Utils.b2(t,o,m,i),t=THREE.Shape.Utils.b2(t,p,s,k);g.push(new THREE.Vector2(u,t))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,m=b[a++]*c+d,s=b[a++]*-c,n=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,k,m,s,n,q),f=g[g.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++)t=f/h,u=THREE.Shape.Utils.b3(t,o,m,
+n,i),t=THREE.Shape.Utils.b3(t,p,s,q,k),g.push(new THREE.Vector2(u,t))}}}return{offset:r.ha*c,points:g,path:e}}}};
+(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,j,k;if(b(a)>0)for(j=0;j<e;j++)f[j]=j;else for(j=0;j<e;j++)f[j]=e-1-j;var o=2*e;for(j=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);k=j+1;e<=k&&(k=0);var p;a:{p=a;var m=i,s=j,n=k,q=e,r=f,t=void 0,u=void 0,y=void 0,
+G=void 0,w=void 0,B=void 0,F=void 0,I=void 0,R=void 0,u=p[r[m]].x,y=p[r[m]].y,G=p[r[s]].x,w=p[r[s]].y,B=p[r[n]].x,F=p[r[n]].y;if(1.0E-10>(G-u)*(F-y)-(w-y)*(B-u))p=!1;else{for(t=0;t<q;t++)if(!(t==m||t==s||t==n)){var I=p[r[t]].x,R=p[r[t]].y,x=void 0,A=void 0,K=void 0,X=void 0,T=void 0,$=void 0,V=void 0,l=void 0,M=void 0,J=void 0,L=void 0,v=void 0,x=K=T=void 0,x=B-G,A=F-w,K=u-B,X=y-F,T=G-u,$=w-y,V=I-u,l=R-y,M=I-G,J=R-w,L=I-B,v=R-F,x=x*J-A*M,T=T*l-$*V,K=K*v-X*L;if(x>=0&&K>=0&&T>=0){p=!1;break a}}p=!0}}if(p){g.push([a[f[i]],
+a[f[j]],a[f[k]]]);h.push([f[i],f[j],f[k]]);i=j;for(k=j+1;k<e;i++,k++)f[i]=f[k];e--;o=2*e}}if(d)return h;return g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,f=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(g);e.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(g);h.z=
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,f=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,g,f,h,[b[e],b[g],b[f],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[f]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[e].clone(),a[g].clone(),a[f].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(a,b,c,d,e,g,f){function h(a,b,c,d,e,f){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,f*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<
 this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,f=b/this.segmentsT*2*Math.PI,e=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);c.x=i.x-e.x;c.y=i.y-e.y;c.z=i.z-e.z;d.x=i.x+e.x;d.y=i.y+e.y;d.z=i.z+e.z;g.cross(c,d);d.cross(g,c);g.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);e.x+=i*d.x+f*g.x;e.y+=i*d.y+f*g.y;e.z+=i*d.z+f*g.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,
-e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var d=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,e=this.grid[a][b],c=this.grid[d][b],d=this.grid[d][g],g=this.grid[a][g],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,c,d,g));this.faceVertexUvs[0].push([f,i,l,j])}this.computeCentroids();
+e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var d=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,e=this.grid[a][b],c=this.grid[d][b],d=this.grid[d][g],g=this.grid[a][g],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,c,d,g));this.faceVertexUvs[0].push([f,i,j,k])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var m,l,n,o=0;o<4;o++){n=i[o];m=new THREE.Color;m.setRGB(0,0,0);for(var q=0;q<n.length;q++)l=h.vertexColors[n[q]-1],m.r+=l.r,m.g+=l.g,m.b+=l.b;m.r/=n.length;m.g/=n.length;m.b/=n.length;j.vertexColors[o]=m}}e.push(j);(!f.supportUVs||p.length!=0)&&g.push([p[a],p[b],p[c],p[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],j={},o={},p=[],m,r,n,q,s,u=a.faceVertexUvs[0];m=0;for(r=u.length;m<r;m++){n=0;for(q=u[m].length;n<q;n++)s=d[m]["abcd".charAt(n)],p[s]||(p[s]=u[m][n])}var t;m=0;for(r=d.length;m<r;m++)if(s=d[m],l.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),f.supportUVs&&p.length!=0){t=new THREE.UV;if(s instanceof THREE.Face3)t.u=p[s.a].u+p[s.b].u+p[s.c].u,t.v=p[s.a].v+p[s.b].v+p[s.c].v,t.u/=3,t.v/=3;else if(s instanceof THREE.Face4)t.u=
-p[s.a].u+p[s.b].u+p[s.c].u+p[s.d].u,t.v=p[s.a].v+p[s.b].v+p[s.c].v+p[s.d].v,t.u/=4,t.v/=4;p.push(t)}r=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var y=0,u=h.length,A,D,F={},H={},B=function(a,
-b){F[a]===void 0&&(F[a]=[]);F[a].push(b)},J=function(a,b){H[a]===void 0&&(H[a]={});H[a][b]=null};for(m in r){t=r[m];A=m.split("_");D=A[0];A=A[1];B(D,[D,A]);B(A,[D,A]);n=0;for(q=t.length;n<q;n++)s=t[n],J(D,s,m),J(A,s,m);t.length<2&&(o[m]=!0)}for(m in r)if(t=r[m],s=t[0],t=t[1],A=m.split("_"),D=A[0],A=A[1],q=new THREE.Vector3,o[m]?(q.addSelf(h[D].position),q.addSelf(h[A].position),q.multiplyScalar(0.5)):(q.addSelf(l[s]),q.addSelf(l[t]),q.addSelf(h[D].position),q.addSelf(h[A].position),q.multiplyScalar(0.25)),
-j[m]=u+d.length+y,i.push(new THREE.Vertex(q)),y++,f.supportUVs&&p.length!=0)t=new THREE.UV,t.u=p[D].u+p[A].u,t.v=p[D].v+p[A].v,t.u/=2,t.v/=2,p.push(t);var x,z;A=["123","12","2","23"];q=["123","23","3","31"];var B=["123","31","1","12"],J=["1234","12","2","23"],G=["1234","23","3","34"],W=["1234","34","4","41"],S=["1234","41","1","12"];m=0;for(r=l.length;m<r;m++)s=d[m],t=u+m,s instanceof THREE.Face3?(y=c(s.a,s.b),D=c(s.b,s.c),x=c(s.c,s.a),b(t,j[y],s.b,j[D],s,A),b(t,j[D],s.c,j[x],s,q),b(t,j[x],s.a,j[y],
-s,B)):s instanceof THREE.Face4?(y=c(s.a,s.b),D=c(s.b,s.c),x=c(s.c,s.d),z=c(s.d,s.a),b(t,j[y],s.b,j[D],s,J),b(t,j[D],s.c,j[x],s,G),b(t,j[x],s.d,j[z],s,W),b(t,j[z],s.a,j[y],s,S)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;j=new THREE.Vector3;m=0;for(r=h.length;m<r;m++)if(F[m]!==void 0){i.set(0,0,0);j.set(0,0,0);s=new THREE.Vector3(0,0,0);t=0;for(n in H[m])i.addSelf(l[n]),t++;y=0;u=F[m].length;for(n=0;n<u;n++)o[c(F[m][n][0],F[m][n][1])]&&y++;if(y!=2){i.divideScalar(t);for(n=0;n<
-u;n++)t=F[m][n],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(u);s.addSelf(h[m].position);s.multiplyScalar(u-3);s.addSelf(i);s.addSelf(j.multiplyScalar(2));s.divideScalar(u);d[m].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var k,m,n,o=0;o<4;o++){n=i[o];k=new THREE.Color;k.setRGB(0,0,0);for(var q=0;q<n.length;q++)m=h.vertexColors[n[q]-1],k.r+=m.r,k.g+=m.g,k.b+=m.b;k.r/=n.length;k.g/=n.length;k.b/=n.length;j.vertexColors[o]=k}}e.push(j);(!f.supportUVs||p.length!=0)&&g.push([p[a],p[b],p[c],p[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},o={},p=[],m,s,n,q,r,t=a.faceVertexUvs[0];m=0;for(s=t.length;m<s;m++){n=0;for(q=t[m].length;n<q;n++)r=d[m]["abcd".charAt(n)],p[r]||(p[r]=t[m][n])}var u;m=0;for(s=d.length;m<s;m++)if(r=d[m],j.push(r.centroid),i.push(new THREE.Vertex(r.centroid)),f.supportUVs&&p.length!=0){u=new THREE.UV;if(r instanceof THREE.Face3)u.u=p[r.a].u+p[r.b].u+p[r.c].u,u.v=p[r.a].v+p[r.b].v+p[r.c].v,u.u/=3,u.v/=3;else if(r instanceof THREE.Face4)u.u=
+p[r.a].u+p[r.b].u+p[r.c].u+p[r.d].u,u.v=p[r.a].v+p[r.b].v+p[r.c].v+p[r.d].v,u.u/=4,u.v/=4;p.push(u)}s=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var y=0,t=h.length,G,w,B={},F={},I=function(a,
+b){B[a]===void 0&&(B[a]=[]);B[a].push(b)},R=function(a,b){F[a]===void 0&&(F[a]={});F[a][b]=null};for(m in s){u=s[m];G=m.split("_");w=G[0];G=G[1];I(w,[w,G]);I(G,[w,G]);n=0;for(q=u.length;n<q;n++)r=u[n],R(w,r,m),R(G,r,m);u.length<2&&(o[m]=!0)}for(m in s)if(u=s[m],r=u[0],u=u[1],G=m.split("_"),w=G[0],G=G[1],q=new THREE.Vector3,o[m]?(q.addSelf(h[w].position),q.addSelf(h[G].position),q.multiplyScalar(0.5)):(q.addSelf(j[r]),q.addSelf(j[u]),q.addSelf(h[w].position),q.addSelf(h[G].position),q.multiplyScalar(0.25)),
+k[m]=t+d.length+y,i.push(new THREE.Vertex(q)),y++,f.supportUVs&&p.length!=0)u=new THREE.UV,u.u=p[w].u+p[G].u,u.v=p[w].v+p[G].v,u.u/=2,u.v/=2,p.push(u);var x,A;G=["123","12","2","23"];q=["123","23","3","31"];var I=["123","31","1","12"],R=["1234","12","2","23"],K=["1234","23","3","34"],X=["1234","34","4","41"],T=["1234","41","1","12"];m=0;for(s=j.length;m<s;m++)r=d[m],u=t+m,r instanceof THREE.Face3?(y=c(r.a,r.b),w=c(r.b,r.c),x=c(r.c,r.a),b(u,k[y],r.b,k[w],r,G),b(u,k[w],r.c,k[x],r,q),b(u,k[x],r.a,k[y],
+r,I)):r instanceof THREE.Face4?(y=c(r.a,r.b),w=c(r.b,r.c),x=c(r.c,r.d),A=c(r.d,r.a),b(u,k[y],r.b,k[w],r,R),b(u,k[w],r.c,k[x],r,K),b(u,k[x],r.d,k[A],r,X),b(u,k[A],r.a,k[y],r,T)):console.log("face should be a face!",r);d=i;i=new THREE.Vector3;k=new THREE.Vector3;m=0;for(s=h.length;m<s;m++)if(B[m]!==void 0){i.set(0,0,0);k.set(0,0,0);r=new THREE.Vector3(0,0,0);u=0;for(n in F[m])i.addSelf(j[n]),u++;y=0;t=B[m].length;for(n=0;n<t;n++)o[c(B[m][n][0],B[m][n][1])]&&y++;if(y!=2){i.divideScalar(u);for(n=0;n<
+t;n++)u=B[m][n],u=h[u[0]].position.clone().addSelf(h[u[1]].position).divideScalar(2),k.addSelf(u);k.divideScalar(t);r.addSelf(h[m].position);r.multiplyScalar(t-3);r.addSelf(i);r.addSelf(k.multiplyScalar(2));r.divideScalar(t);d[m].position=r}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
 THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
-a}function d(a,b){var d=new Image;d.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=b;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,b,d)}else a.image=this;a.needsUpdate=!0};d.src=b}function e(a,c,e,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=e;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=THREE.RepeatWrapping;
-if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}d(a[c],b+"/"+e)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,h,i;h="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
-if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=g(a.colorDiffuse);
-else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=g(a.colorSpecular);if(a.colorAmbient)f.ambient=g(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&b&&e(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&b&&e(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,j=THREE.UniformsUtils.clone(l.uniforms),o=f.color;h=f.specular;i=f.ambient;var p=f.shininess;j.tNormal.texture=f.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(f.map)j.tDiffuse.texture=f.map,j.enableDiffuse.value=!0;if(f.specularMap)j.tSpecular.texture=f.specularMap,j.enableSpecular.value=!0;if(f.lightMap)j.tAO.texture=
-f.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(o);j.uSpecularColor.value.setHex(h);j.uAmbientColor.value.setHex(i);j.uShininess.value=p;if(f.opacity)j.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:j,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
-THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,b,c,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,b=d.callback,c=d.texture_path,d=d.bin_path;var c=c?c:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
+a}function d(a,b){var d=new Image;d.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=b;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,b,d)}else a.image=this;a.needsUpdate=!0};d.crossOrigin="";d.src=b}function e(a,c,e,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=e;if(f){a[c].repeat.set(f[0],f[1]);if(f[0]!=1)a[c].wrapS=
+THREE.RepeatWrapping;if(f[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[c].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[c].wrapT=f[h[1]]}d(a[c],b+"/"+e)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,h,i;h="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading==
+"Basic"&&(h="MeshBasicMaterial"));if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;
+if(a.colorDiffuse)f.color=g(a.colorDiffuse);else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=g(a.colorSpecular);if(a.colorAmbient)f.ambient=g(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&b&&e(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(f,"normalMap",a.mapNormal,a.mapNormalRepeat,
+a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&e(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var j=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(j.uniforms),o=f.color;h=f.specular;i=f.ambient;var p=f.shininess;k.tNormal.texture=f.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(f.map)k.tDiffuse.texture=f.map,k.enableDiffuse.value=!0;if(f.specularMap)k.tSpecular.texture=f.specularMap,k.enableSpecular.value=
+!0;if(f.lightMap)k.tAO.texture=f.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(o);k.uSpecularColor.value.setHex(h);k.uAmbientColor.value.setHex(i);k.uShininess.value=p;if(f.opacity)k.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:k,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;
+THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
+THREE.BinaryLoader.prototype.load=function(a,b,c,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,b=d.callback,c=d.texture_path,d=d.bin_path;var c=c?c:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,g){var f=new XMLHttpRequest;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(h,c,e,d,g)}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+
 f.status+"]")};f.open("GET",b,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var g=new XMLHttpRequest,f=c+"/"+a.buffers,h=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("Couldn't load ["+f+"] ["+g.status+"]"):g.readyState==3?e&&(h==0&&(h=g.getResponseHeader("Content-Length")),e({total:h,loaded:g.responseText.length})):g.readyState==2&&(h=g.getResponseHeader("Content-Length"))};g.open("GET",f,!0);
 g.responseType="arraybuffer";g.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function l(b,c){var d,e,f,g,h,i,j,l,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];f=m[d*3+1];g=m[d*3+2];h=t[e*2];e=t[e*2+1];i=t[f*2];j=t[f*2+1];f=t[g*2];l=t[g*2+1];g=n.faceVertexUvs[0];var o=[];o.push(new THREE.UV(h,e));o.push(new THREE.UV(i,j));o.push(new THREE.UV(f,l));g.push(o)}}
-function j(b,c){var d,e,f,g,h,i,j,l,m,o,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];f=p[d*4+1];g=p[d*4+2];h=p[d*4+3];i=t[e*2];e=t[e*2+1];j=t[f*2];m=t[f*2+1];l=t[g*2];o=t[g*2+1];g=t[h*2];f=t[h*2+1];h=n.faceVertexUvs[0];var q=[];q.push(new THREE.UV(i,e));q.push(new THREE.UV(j,m));q.push(new THREE.UV(l,o));q.push(new THREE.UV(g,f));h.push(q)}}function o(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],n.faces.push(new THREE.Face3(e,
-f,g,null,null,h))}function p(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],n.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function m(b,c,d,e){for(var f,g,h,i,j,l,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];l=d[e*3+1];m=d[e*3+2];i=o[e];var p=u[l*3],q=u[l*3+1];l=u[l*3+2];var r=u[m*3],s=u[m*3+1];m=u[m*3+2];n.faces.push(new THREE.Face3(f,
-g,h,[new THREE.Vector3(u[j*3],u[j*3+1],u[j*3+2]),new THREE.Vector3(p,q,l),new THREE.Vector3(r,s,m)],null,i))}}function r(b,c,d,e){for(var f,g,h,i,j,l,m,o,p,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];l=d[e*4];m=d[e*4+1];o=d[e*4+2];p=d[e*4+3];j=q[e];var r=u[m*3],s=u[m*3+1];m=u[m*3+2];var t=u[o*3],y=u[o*3+1];o=u[o*3+2];var A=u[p*3],B=u[p*3+1];p=u[p*3+2];n.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(u[l*
-3],u[l*3+1],u[l*3+2]),new THREE.Vector3(r,s,m),new THREE.Vector3(t,y,o),new THREE.Vector3(A,B,p)],null,j))}}var n=this,q=0,s,u=[],t=[],y,A,D,F,H,B;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);s={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,q,12),header_bytes:e(a,q+12),vertex_coordinate_bytes:e(a,q+13),normal_coordinate_bytes:e(a,q+14),uv_coordinate_bytes:e(a,q+15),vertex_index_bytes:e(a,q+16),normal_index_bytes:e(a,
-q+17),uv_index_bytes:e(a,q+18),material_index_bytes:e(a,q+19),nvertices:i(a,q+20),nnormals:i(a,q+20+4),nuvs:i(a,q+20+8),ntri_flat:i(a,q+20+12),ntri_smooth:i(a,q+20+16),ntri_flat_uv:i(a,q+20+20),ntri_smooth_uv:i(a,q+20+24),nquad_flat:i(a,q+20+28),nquad_smooth:i(a,q+20+32),nquad_flat_uv:i(a,q+20+36),nquad_smooth_uv:i(a,q+20+40)};s.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");q+=s.header_bytes;b=s.vertex_index_bytes*3+s.material_index_bytes;B=s.vertex_index_bytes*
-4+s.material_index_bytes;y=s.ntri_flat*b;A=s.ntri_smooth*(b+s.normal_index_bytes*3);D=s.ntri_flat_uv*(b+s.uv_index_bytes*3);F=s.ntri_smooth_uv*(b+s.normal_index_bytes*3+s.uv_index_bytes*3);H=s.nquad_flat*B;b=s.nquad_smooth*(B+s.normal_index_bytes*4);B=s.nquad_flat_uv*(B+s.uv_index_bytes*4);q+=function(b){var c=s.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],n.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(q);
-q+=function(b){var c=s.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],u.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(q);q+=c(s.nnormals*3);q+=function(b){var c=s.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],t.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(q);y=q+y+c(s.ntri_flat*2);A=y+A+c(s.ntri_smooth*2);D=A+D+c(s.ntri_flat_uv*2);F=D+F+c(s.ntri_smooth_uv*2);H=F+H+c(s.nquad_flat*2);
-b=H+b+c(s.nquad_smooth*2);B=b+B+c(s.nquad_flat_uv*2);(function(a){var b=s.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,c)}})(A);(function(a){var b=s.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,d)}})(D);(function(a){var b=s.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;p(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
-c)}})(b);(function(a){var b=s.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;r(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(B);(function(a){var b=s.ntri_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(q);(function(a){var b=s.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(y);(function(a){var b=s.nquad_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(F);(function(a){var b=
-s.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;r(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(H);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
-THREE.ColladaLoader=function(){function a(a,d,e){aa=a;d=d||P;e!==void 0&&(a=e.split("/"),a.pop(),ya=a.length<1?"":a.join("/")+"/");Z=b("//dae:library_images/dae:image",f,"image");sa=b("//dae:library_materials/dae:material",H,"material");ja=b("//dae:library_effects/dae:effect",G,"effect");ma=b("//dae:library_geometries/dae:geometry",q,"geometry");ba=b("//dae:library_controllers/dae:controller",h,"controller");oa=b("//dae:library_animations/dae:animation",S,"animation");ka=b(".//dae:library_visual_scenes/dae:visual_scene",
-j,"visual_scene");ua=[];va=[];(a=aa.evaluate(".//dae:scene/dae:instance_visual_scene",aa,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),I=ka[a]):I=null;U=new THREE.Object3D;for(a=0;a<I.nodes.length;a++)U.add(g(I.nodes[a]));c();for(var i in oa);i={scene:U,morphs:ua,skins:va,dae:{images:Z,materials:sa,effects:ja,geometries:ma,controllers:ba,animations:oa,visualScenes:ka,scene:I}};d&&d(i);return i}function b(a,b,c){for(var a=aa.evaluate(a,aa,L,
-XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(){var a=1E6,b=-a,c=0,d;for(d in oa)for(var e=oa[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=
-a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function e(a,b,e){var f=ba[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=c(),b=I.getChildById(b.skeleton[0],!0)||I.getChildBySid(b.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,
-m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(b,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=
-0;q<i.weights[p].length;q++){var r=i.weights[p][q];r.joint==m&&j.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function g(a){var b=
-new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=ba[a.controllers[f].url];switch(i.type){case "skin":if(ma[i.skin.source]){var j=new n;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(ba[i.skin.source]&&(d=i=ba[i.skin.source],i.morph&&ma[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(ma[i.morph.source])j=new n,
-j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=ma[i.url],k={},l=0,o;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var p=ja[sa[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=k[o.symbol]=
-p.material;l++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=ba[c.url],j.skinInstanceController=c,j.name="skin_"+va.length,va.push(j);else if(d!==void 0){h=i;k=d instanceof m?ba[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");
-else{k=k.morph;for(l=0;l<k.targets.length;l++)if(p=ma[k.targets[l]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+ua.length;ua.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
-b.scale);for(f=0;f<a.nodes.length;f++)b.add(g(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
-[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function m(){this.url="";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function u(){}function t(){this.material="";this.count=
-0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function y(){this.source="";this.stride=this.count=0;this.params=[]}function A(){this.input={}}function D(){this.semantic="";this.offset=0;this.source="";this.set=0}function F(a){this.id=a;this.type=null}function H(){this.name=this.id="";this.instance_effect=null}function B(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function J(a,
-b){this.type=a;this.effect=b;this.material=null}function x(a){this.effect=a;this.format=this.init_from=null}function z(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function G(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function W(){this.url=""}function S(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function T(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
-this.dotSyntax=this.sid=null}function V(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function k(a){var b=a.getAttribute("id");if($[b]!=void 0)return $[b];$[b]=(new F(b)).parse(a);return $[b]}function L(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function K(a){for(var a=M(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function v(a){for(var a=M(a),b=[],c=0;c<
-a.length;c++)b.push(parseInt(a[c],10));return b}function M(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function X(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function ca(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function ea(a,b){var c="";c+=ca(a.x,b)+",";c+=ca(a.y,b)+",";c+=ca(a.z,b);return c}var aa=null,U=null,I,P=null,
-$={},Z={},oa={},ba={},ma={},sa={},ja={},ka,ya,ua,va,wa=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new l).parse(c);this.type=
-c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new F).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=
-e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new D).parse(d))}}return b};l.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=
-K(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new F).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};l.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=
-(new D).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};l.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new D).parse(g));break;case "v":c=v(g.textContent);break;case "vcount":d=v(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=
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function j(b,c){var d,e,f,g,h,i,j,k,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];f=m[d*3+1];g=m[d*3+2];h=u[e*2];e=u[e*2+1];i=u[f*2];j=u[f*2+1];f=u[g*2];k=u[g*2+1];g=n.faceVertexUvs[0];var o=[];o.push(new THREE.UV(h,e));o.push(new THREE.UV(i,j));o.push(new THREE.UV(f,k));g.push(o)}}
+function k(b,c){var d,e,f,g,h,i,j,k,m,o,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];f=p[d*4+1];g=p[d*4+2];h=p[d*4+3];i=u[e*2];e=u[e*2+1];j=u[f*2];m=u[f*2+1];k=u[g*2];o=u[g*2+1];g=u[h*2];f=u[h*2+1];h=n.faceVertexUvs[0];var q=[];q.push(new THREE.UV(i,e));q.push(new THREE.UV(j,m));q.push(new THREE.UV(k,o));q.push(new THREE.UV(g,f));h.push(q)}}function o(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],n.faces.push(new THREE.Face3(e,
+f,g,null,null,h))}function p(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],n.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function m(b,c,d,e){for(var f,g,h,i,j,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];m=d[e*3+2];i=o[e];var p=t[k*3],q=t[k*3+1];k=t[k*3+2];var r=t[m*3],s=t[m*3+1];m=t[m*3+2];n.faces.push(new THREE.Face3(f,
+g,h,[new THREE.Vector3(t[j*3],t[j*3+1],t[j*3+2]),new THREE.Vector3(p,q,k),new THREE.Vector3(r,s,m)],null,i))}}function s(b,c,d,e){for(var f,g,h,i,j,k,m,o,p,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];m=d[e*4+1];o=d[e*4+2];p=d[e*4+3];j=q[e];var r=t[m*3],s=t[m*3+1];m=t[m*3+2];var u=t[o*3],w=t[o*3+1];o=t[o*3+2];var y=t[p*3],B=t[p*3+1];p=t[p*3+2];n.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(t[k*
+3],t[k*3+1],t[k*3+2]),new THREE.Vector3(r,s,m),new THREE.Vector3(u,w,o),new THREE.Vector3(y,B,p)],null,j))}}var n=this,q=0,r,t=[],u=[],y,G,w,B,F,I;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);r={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,q,12),header_bytes:e(a,q+12),vertex_coordinate_bytes:e(a,q+13),normal_coordinate_bytes:e(a,q+14),uv_coordinate_bytes:e(a,q+15),vertex_index_bytes:e(a,q+16),normal_index_bytes:e(a,
+q+17),uv_index_bytes:e(a,q+18),material_index_bytes:e(a,q+19),nvertices:i(a,q+20),nnormals:i(a,q+20+4),nuvs:i(a,q+20+8),ntri_flat:i(a,q+20+12),ntri_smooth:i(a,q+20+16),ntri_flat_uv:i(a,q+20+20),ntri_smooth_uv:i(a,q+20+24),nquad_flat:i(a,q+20+28),nquad_smooth:i(a,q+20+32),nquad_flat_uv:i(a,q+20+36),nquad_smooth_uv:i(a,q+20+40)};r.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");q+=r.header_bytes;b=r.vertex_index_bytes*3+r.material_index_bytes;I=r.vertex_index_bytes*
+4+r.material_index_bytes;y=r.ntri_flat*b;G=r.ntri_smooth*(b+r.normal_index_bytes*3);w=r.ntri_flat_uv*(b+r.uv_index_bytes*3);B=r.ntri_smooth_uv*(b+r.normal_index_bytes*3+r.uv_index_bytes*3);F=r.nquad_flat*I;b=r.nquad_smooth*(I+r.normal_index_bytes*4);I=r.nquad_flat_uv*(I+r.uv_index_bytes*4);q+=function(b){var c=r.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],n.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(q);
+q+=function(b){var c=r.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],t.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(q);q+=c(r.nnormals*3);q+=function(b){var c=r.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],u.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(q);y=q+y+c(r.ntri_flat*2);G=y+G+c(r.ntri_smooth*2);w=G+w+c(r.ntri_flat_uv*2);B=w+B+c(r.ntri_smooth_uv*2);F=B+F+c(r.nquad_flat*2);
+b=F+b+c(r.nquad_smooth*2);I=b+I+c(r.nquad_flat_uv*2);(function(a){var b=r.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);j(b,c)}})(G);(function(a){var b=r.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);j(b,d)}})(w);(function(a){var b=r.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;p(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,
+c)}})(b);(function(a){var b=r.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,d)}})(I);(function(a){var b=r.ntri_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(q);(function(a){var b=r.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(y);(function(a){var b=r.nquad_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(B);(function(a){var b=
+r.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;s(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(F);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){U=a;d=d||S;e!==void 0&&(a=e.split("/"),a.pop(),xa=a.length<1?"":a.join("/")+"/");if((a=U.evaluate("//dae:asset",U,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.children)for(e=0;e<a.children.length;e++){var i=a.children[e];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":ta=i.textContent.charAt(0)}}if(!qa.convertUpAxis||ta===qa.upAxis)pa=null;else switch(ta){case "X":pa=qa.upAxis==="Y"?
+"XtoY":"XtoZ";break;case "Y":pa=qa.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":pa=qa.upAxis==="X"?"ZtoX":"ZtoY"}va=b("//dae:library_images/dae:image",f,"image");sa=b("//dae:library_materials/dae:material",F,"material");ia=b("//dae:library_effects/dae:effect",K,"effect");la=b("//dae:library_geometries/dae:geometry",q,"geometry");na=b("//dae:library_controllers/dae:controller",h,"controller");ea=b("//dae:library_animations/dae:animation",T,"animation");wa=b(".//dae:library_visual_scenes/dae:visual_scene",
+k,"visual_scene");ya=[];za=[];(a=U.evaluate(".//dae:scene/dae:instance_visual_scene",U,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),W=wa[a]):W=null;N=new THREE.Object3D;for(a=0;a<W.nodes.length;a++)N.add(g(W.nodes[a]));Ba=[];c(N);a={scene:N,morphs:ya,skins:za,animations:Ba,dae:{images:va,materials:sa,effects:ia,geometries:la,controllers:na,animations:ea,visualScenes:wa,scene:W}};d&&d(a);return a}function b(a,b,c){for(var a=U.evaluate(a,U,
+M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=W.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};Ba.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=na[b.url];if(!e||!e.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||
+!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var f,c=1E6,g=-c,h=0;for(f in ea)for(var i=ea[f],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}f={start:c,end:g,frames:h};for(var b=W.getChildById(b.skeleton[0],!0)||W.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,n,j=0;j<a.vertices.length;j++)e.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);
+for(c=0;c<f.frames;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;k=e.skin;for(m=0;m<j.length;m++)if(l=j[m],n=-1,l.type=="JOINT"){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(n>=0){o=k.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<k.weights.length;o++)for(var p=0;p<k.weights[o].length;p++){var 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(h[j].type=="JOINT")for(k=0;k<h[j].weights.length;k++)l=h[j].weights[k],m=l.index,l=l.weight,n=a.vertices[m],m=i[m],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*l,m.position.y+=g.y*l,m.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function g(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=na[a.controllers[f].url];switch(i.type){case "skin":if(la[i.skin.source]){var j=
+new n;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(na[i.skin.source]&&(d=i=na[i.skin.source],i.morph&&la[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(la[i.morph.source])j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
+0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=la[i.url],k={},l=[],o=0,p;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var q=ia[sa[p.target].instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=o;l.push(q.material);p=q.material;o++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(o>1){j=new THREE.MeshFaceMaterial;i.materials=
+l;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materialIndex=k[l.daeMaterial]}if(c!==void 0)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=na[c.url],j.skinInstanceController=c,j.name="skin_"+za.length,za.push(j);else if(d!==void 0){h=i;k=d instanceof m?na[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(o=la[k.targets[l]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,
+o.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+ya.length;ya.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";b.matrix=a.matrix;c=a.matrix.decompose();b.position=c[0];b.quaternion=c[1];b.useQuaternion=!0;b.scale=c[2];for(f=0;f<a.nodes.length;f++)b.add(g(a.nodes[f],a));return b}function f(){this.init_from=
+this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function j(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=
+this.sid="";this.data=[];this.obj=null}function m(){this.url="";this.skeleton=[];this.instance_material=[]}function s(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function r(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function u(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function y(){this.source="";this.stride=this.count=
+0;this.params=[]}function G(){this.input={}}function w(){this.semantic="";this.offset=0;this.source="";this.set=0}function B(a){this.id=a;this.type=null}function F(){this.name=this.id="";this.instance_effect=null}function I(){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 R(a,b){this.type=a;this.effect=b;this.material=null}function x(a){this.effect=a;this.format=this.init_from=null}function A(a){this.effect=
+a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function K(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function X(){this.url=""}function T(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function $(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function V(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 M(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function J(a){for(var a=v(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function L(a){for(var a=v(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function v(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function Y(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),
+10):c}function aa(a,b){if(qa.convertUpAxis&&ta!==qa.upAxis)switch(pa){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 fa(a,b){var c=[a[b],a[b+1],a[b+2]];aa(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ca(a){if(qa.convertUpAxis){var b=[a[0],a[4],a[8]];
+aa(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];aa(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];aa(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];aa(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];aa(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];aa(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];aa(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 U=null,N=null,W,S=null,da={},va={},ea={},na={},la={},sa={},ia={},Ba,wa,xa,ya,za,Aa=THREE.SmoothShading,qa={convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},ta="Y",pa=null,Ja=Math.PI/180;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=
+a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new j).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new 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(d.nodeType==1)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(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=J(f.textContent);this.bindShapeMatrix=ca(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};j.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=
+(new w).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};j.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new w).parse(g));break;case "v":c=L(g.textContent);break;case "vcount":d=L(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=
+e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=
 a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();
 for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};o.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};o.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};o.prototype.getTransformBySid=
 function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};o.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==
-1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=aa.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",aa,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;
-case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in oa)for(var e=oa[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=
-1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?
-g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=K(a.textContent);this.updateMatrix();return this};
-p.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],
-this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=aa.evaluate(".//dae:instance_material",c,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null))for(var d=c.iterateNext();d;)this.instance_material.push((new r).parse(d)),d=c.iterateNext()}}return this};r.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=aa.evaluate(".//dae:instance_material",
-c,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new r).parse(b)),b=a.iterateNext();break}}return this};q.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new s(this)).parse(c)}}return this};s.prototype.parse=function(a){function b(a,c){var d=ea(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=
-0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":k(d);break;case "vertices":this.vertices=(new A).parse(d);break;case "triangles":this.primitives.push((new t).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new u).parse(d))}}var e={};this.geometry3js=new THREE.Geometry;d=$[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+
-1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};s.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,m=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<
-g.length;){var p=[],q=[],r={},s=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=$[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=ea(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],l.data[k+1],l.data[k+2]));break;case "TEXCOORD":r[i.set]===void 0&&(r[i.set]=[]);r[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(l.data[k],
-l.data[k+1],l.data[k+2]))}var t;n==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],s.length?s:new THREE.Color):n==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],s.length?s:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=r[o[f]],b.faceVertexUvs[f].push([e[0],e[1],e[2]]);d+=h.length*n}};u.prototype=new t;u.prototype.constructor=u;t.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=
-a.input.POSITION.source};t.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=X(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 D).parse(a.childNodes[b]));break;case "vcount":this.vcount=v(c.textContent);break;case "p":this.p=v(c.textContent)}}return this};y.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=X(a,"count",0);this.stride=
-X(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};A.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new D).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};D.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
-"");this.set=X(a,"set",-1);this.offset=X(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};F.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=M(c.textContent),e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=K(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
-v(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=M(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new y).parse(c.childNodes[d]);break}}}return this};F.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=
-this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};H.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new W).parse(a.childNodes[b]);break}return this};B.prototype.isColor=
-function(){return this.texture==null};B.prototype.isTexture=function(){return this.texture!=null};B.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=K(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};J.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=
-a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new B).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=aa.evaluate(".//dae:float",c,L,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};J.prototype.create=function(){var a=
-{},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof B)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=Z[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ya+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=
-d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=wa;return this.material=new THREE.MeshLambertMaterial(a)};x.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+
-c.nodeName)}}return this};z.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "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};
-G.prototype.create=function(){if(this.shader==null)return null};G.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};G.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=
-(new x(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new z(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};G.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};
-G.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new J(c.nodeName,this)).parse(c)}}};W.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};S.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=
-(new F).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new V(this)).parse(c));break;case "channel":this.channel.push((new T(this)).parse(c))}}return this};T.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=
-parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};V.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new D).parse(c))}}return this};V.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=
-c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&
-document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==200))P=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){wa=a},applySkin:e,geometries:ma}};
-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;
+1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=U.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",U,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));
+break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in ea)for(var e=ea[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(qa.convertUpAxis)switch(g){case "X":switch(pa){case "XtoY":case "XtoZ":case "YtoX":g=
+"Y";break;case "ZtoX":g="Z"}break;case "Y":switch(pa){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(pa){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(var k=i.length;b<k;b++){var q=i[b],r=h.getData(j.type,b),s;s=null;for(var t=0,u=d.length;t<u&&s==null;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&&t==-1;u++)d[u].time>=q&&(t=u);q=t;d.splice(q==-1?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=i>=0?i:i+h.length;i>=0;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-
+i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;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};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=J(a.textContent);this.convert();
+return this};p.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ca(this.data);break;case "rotate":this.angle=this.data[3]*Ja;case "translate":aa(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":aa(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)}};p.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)}};p.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*Ja;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*Ja}}};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=U.evaluate(".//dae:instance_material",
+c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new s).parse(d)),d=c.iterateNext()}}return this};s.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=
+U.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new s).parse(b)),b=a.iterateNext();break}}return this};q.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new r(this)).parse(c)}}return this};r.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");da[d]==void 0&&(da[d]=(new B(d)).parse(c));break;case "vertices":this.vertices=(new G).parse(c);break;case "triangles":this.primitives.push((new u).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=da[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(fa(a,
+b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};r.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,l=0,m=3,n=[];for(d=0;d<g.length;d++)switch(h=g[d],h.semantic){case "TEXCOORD":n.push(h.set)}for(;c<f.length;){var o=[],p=[],
+q={},r=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=da[h.source],i=f[c+d*g.length+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":o.push(i);break;case "NORMAL":p.push(fa(k.data,j));break;case "TEXCOORD":q[h.set]===void 0&&(q[h.set]=[]);q[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(m===3)d.push(new THREE.Face3(o[0],o[1],o[2],[p[0],
+p[1],p[2]],r.length?r:new THREE.Color));else if(m===4)d.push(new THREE.Face4(o[0],o[1],o[2],o[3],[p[0],p[1],p[2],p[3]],r.length?r:new THREE.Color));else if(m>4&&qa.subdivideFaces){r=r.length?r:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(o[0],o[e],o[e+1],[p[0],p[e++],p[e]],r))}if(d.length){o=0;for(p=d.length;o<p;o++){e=d[o];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<n.length;e++)r=q[n[e]],r=m>4?[r[0],r[o+1],r[o+2]]:m===4?[r[0],r[1],r[2],r[3]]:[r[0],r[1],r[2]],b.faceVertexUvs[e]||
+(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(r)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=g.length*m}};t.prototype=new u;t.prototype.constructor=t;u.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};u.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=Y(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=L(c.textContent);break;case "p":this.p=L(c.textContent)}}return this};y.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=Y(a,"count",0);this.stride=Y(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};
+G.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new 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=Y(a,"set",-1);this.offset=Y(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)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=v(c.textContent),e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=J(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=L(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=v(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName==
+"accessor"){this.accessor=(new y).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=ca(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};F.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");
+for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new X).parse(a.childNodes[b]);break}return this};I.prototype.isColor=function(){return this.texture==null};I.prototype.isTexture=function(){return this.texture!=null};I.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=J(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};I.prototype.parseTexture=function(a){if(!a.children)return this;a.children[0]&&a.children[0].nodeName==="extra"&&(a=a.children[0],a.children[0]&&a.children[0].nodeName==="technique"&&(a=a.children[0]));for(var b=0;b<a.children.length;b++){var c=a.children[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=
+parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};R.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new I).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=U.evaluate(".//dae:float",
+c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};R.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof I)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
+this.effect.surface.sid){var e=va[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(xa+e.init_from),e.wrapS=d.texOpts.wrapU,e.wrapT=d.texOpts.wrapV,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=Aa;return this.material=
+new THREE.MeshLambertMaterial(a)};x.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};A.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "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};K.prototype.create=function(){if(this.shader==null)return null};K.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=
+0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};K.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new x(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new A(this)).parse(d);this.sampler.sid=b;break;case "extra":break;
+default:console.log(d.nodeName)}}};K.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};K.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=
+(new R(c.nodeName,this)).parse(c)}}};X.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};T.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new B).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new V(this)).parse(c));break;case "channel":this.channel.push((new $(this)).parse(c))}}return this};
+$.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0;if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};V.prototype.parse=function(a){this.id=
+a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new w).parse(c))}}return this};V.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}};V.prototype.getData=function(a,b){var c;if(this.strideOut>1){c=[];b*=this.strideOut;for(var d=0;d<this.strideOut;++d)c[d]=this.output[b+
+d];if(this.strideOut===3)switch(a){case "rotate":case "translate":aa(c,-1);break;case "scale":aa(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(f<0||f>1)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=f<0?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,
+d.member)}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==200))d.responseXML?(S=c,a(d.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Aa=a},applySkin:e,
+geometries:la,options:qa}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
-THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0)try{var h=JSON.parse(g.responseText);a.createModel(h,c,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+g.status+"]");else g.readyState==3?e&&(f==0&&(f=g.getResponseHeader("Content-Length")),e({total:f,loaded:g.responseText.length})):
+THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){try{var h=JSON.parse(g.responseText)}catch(i){console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}a.createModel(h,c,d);a.onLoadComplete()}else console.error("Couldn't load ["+b+"] ["+g.status+"]");else g.readyState==3?e&&(f==0&&(f=g.getResponseHeader("Content-Length")),e({total:f,loaded:g.responseText.length})):
 g.readyState==2&&(f=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,l,j,o,p,m,r,n,q,s,u,t,y=a.faces;o=a.vertices;var A=a.normals,D=a.colors,F=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&F++;for(c=0;c<F;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(j=o.length;l<
-j;)p=new THREE.Vertex,p.position.x=o[l++]*b,p.position.y=o[l++]*b,p.position.z=o[l++]*b,d.vertices.push(p);l=0;for(j=y.length;l<j;){b=y[l++];o=b&1;i=b&2;c=b&4;e=b&8;m=b&16;p=b&32;n=b&64;b&=128;o?(q=new THREE.Face4,q.a=y[l++],q.b=y[l++],q.c=y[l++],q.d=y[l++],o=4):(q=new THREE.Face3,q.a=y[l++],q.b=y[l++],q.c=y[l++],o=3);if(i)i=y[l++],q.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<F;c++)s=a.uvs[c],r=y[l++],t=s[r*2],r=s[r*2+1],d.faceUvs[c][i]=new THREE.UV(t,r);if(e)for(c=0;c<F;c++){s=a.uvs[c];u=[];
-for(e=0;e<o;e++)r=y[l++],t=s[r*2],r=s[r*2+1],u[e]=new THREE.UV(t,r);d.faceVertexUvs[c][i]=u}if(m)m=y[l++]*3,e=new THREE.Vector3,e.x=A[m++],e.y=A[m++],e.z=A[m],q.normal=e;if(p)for(c=0;c<o;c++)m=y[l++]*3,e=new THREE.Vector3,e.x=A[m++],e.y=A[m++],e.z=A[m],q.vertexNormals.push(e);if(n)p=y[l++],p=new THREE.Color(D[p]),q.color=p;if(b)for(c=0;c<o;c++)p=y[l++],p=new THREE.Color(D[p]),q.vertexColors.push(p);d.faces.push(q)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
-2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,l,j,o,p,m,r;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];m=d.morphTargets[c].vertices;
-r=a.morphTargets[c].vertices;i=0;for(l=r.length;i<l;i+=3)j=r[i]*b,o=r[i+1]*b,p=r[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(j,o,p)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;j=a.morphColors[c].colors;b=0;for(i=j.length;b<i;b+=3)o=new THREE.Color(16755200),o.setRGB(j[b],j[b+1],j[b+2]),l.push(o)}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,j,k,o,p,m,s,n,q,r,t,u,y=a.faces;o=a.vertices;var G=a.normals,w=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]=[];j=0;for(k=o.length;j<
+k;)p=new THREE.Vertex,p.position.x=o[j++]*b,p.position.y=o[j++]*b,p.position.z=o[j++]*b,d.vertices.push(p);j=0;for(k=y.length;j<k;){b=y[j++];o=b&1;i=b&2;c=b&4;e=b&8;m=b&16;p=b&32;n=b&64;b&=128;o?(q=new THREE.Face4,q.a=y[j++],q.b=y[j++],q.c=y[j++],q.d=y[j++],o=4):(q=new THREE.Face3,q.a=y[j++],q.b=y[j++],q.c=y[j++],o=3);if(i)i=y[j++],q.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<B;c++)r=a.uvs[c],s=y[j++],u=r[s*2],s=r[s*2+1],d.faceUvs[c][i]=new THREE.UV(u,s);if(e)for(c=0;c<B;c++){r=a.uvs[c];t=[];
+for(e=0;e<o;e++)s=y[j++],u=r[s*2],s=r[s*2+1],t[e]=new THREE.UV(u,s);d.faceVertexUvs[c][i]=t}if(m)m=y[j++]*3,e=new THREE.Vector3,e.x=G[m++],e.y=G[m++],e.z=G[m],q.normal=e;if(p)for(c=0;c<o;c++)m=y[j++]*3,e=new THREE.Vector3,e.x=G[m++],e.y=G[m++],e.z=G[m],q.vertexNormals.push(e);if(n)p=y[j++],p=new THREE.Color(w[p]),q.color=p;if(b)for(c=0;c<o;c++)p=y[j++],p=new THREE.Color(w[p]),q.vertexColors.push(p);d.faces.push(q)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
+2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,j,k,o,p,m,s;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];m=d.morphTargets[c].vertices;
+s=a.morphTargets[c].vertices;i=0;for(j=s.length;i<j;i+=3)k=s[i]*b,o=s[i+1]*b,p=s[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(k,o,p)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b+=3)o=new THREE.Color(16755200),o.setRGB(k[b],k[b+1],k[b+2]),j.push(o)}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
 d.computeTangents();b(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var e=JSON.parse(d.responseText);e.metadata===void 0||e.metadata.formatVersion===void 0||e.metadata.formatVersion!==3?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(g){console.error(g),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
 d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function e(){var a;for(p in G.objects)if(!L.objects[p])if(s=G.objects[p],s.geometry!==void 0){if(B=L.geometries[s.geometry]){a=!1;for(v=0;v<s.materials.length;v++)z=L.materials[s.materials[v]],a=z instanceof THREE.ShaderMaterial;a&&B.computeTangents();y=s.position;A=s.rotation;D=s.quaternion;F=s.scale;D=0;z.length==0&&(z=new THREE.MeshFaceMaterial);z.length>1&&(z=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(B,z);a.name=p;a.position.set(y[0],y[1],y[2]);D?(a.quaternion.set(D[0],D[1],D[2],D[3]),a.useQuaternion=!0):a.rotation.set(A[0],A[1],A[2]);a.scale.set(F[0],F[1],F[2]);a.visible=s.visible;L.scene.add(a);L.objects[p]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);L.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(B),L.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&s.trigger.toLowerCase()!="none"&&(b=
-{type:s.trigger,object:s},L.triggers[a.name]=b)}}else y=s.position,A=s.rotation,D=s.quaternion,F=s.scale,D=0,a=new THREE.Object3D,a.name=p,a.position.set(y[0],y[1],y[2]),D?(a.quaternion.set(D[0],D[1],D[2],D[3]),a.useQuaternion=!0):a.rotation.set(A[0],A[1],A[2]),a.scale.set(F[0],F[1],F[2]),a.visible=s.visible!==void 0?s.visible:!1,L.scene.add(a),L.objects[p]=a,L.empties[p]=a,s.trigger&&s.trigger.toLowerCase()!="none"&&(b={type:s.trigger,object:s},L.triggers[a.name]=b)}function g(a){return function(b){L.geometries[a]=
-b;e();S-=1;i.onLoadComplete();h()}}function f(a){return function(b){L.geometries[a]=b}}function h(){i.callbackProgress({totalModels:V,totalTextures:k,loadedModels:V-S,loadedTextures:k-T},L);i.onLoadProgress();S==0&&T==0&&b(L)}var i=this,l=THREE.Loader.prototype.extractUrlbase(c),j,o,p,m,r,n,q,s,u,t,y,A,D,F,H,B,J,x,z,G,W,S,T,V,k,L;G=a;c=new THREE.BinaryLoader;W=new THREE.JSONLoader;T=S=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
-empties:{}};a=!1;for(p in G.objects)if(s=G.objects[p],s.meshCollider){a=!0;break}if(a)L.scene.collisions=new THREE.CollisionSystem;if(G.transform){a=G.transform.position;u=G.transform.rotation;var K=G.transform.scale;a&&L.scene.position.set(a[0],a[1],a[2]);u&&L.scene.rotation.set(u[0],u[1],u[2]);K&&L.scene.scale.set(K[0],K[1],K[2]);(a||u||K)&&L.scene.updateMatrix()}a=function(){T-=1;h();i.onLoadComplete()};for(r in G.cameras)u=G.cameras[r],u.type=="perspective"?J=new THREE.PerspectiveCamera(u.fov,
-u.aspect,u.near,u.far):u.type=="ortho"&&(J=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far)),y=u.position,u=u.target,J.position.set(y[0],y[1],y[2]),J.target=new THREE.Vector3(u[0],u[1],u[2]),L.cameras[r]=J;for(m in G.lights)u=G.lights[m],r=u.color!==void 0?u.color:16777215,J=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(y=u.direction,t=new THREE.DirectionalLight(r,J),t.position.set(y[0],y[1],y[2]),t.position.normalize()):u.type=="point"?(y=u.position,t=u.distance,
-t=new THREE.PointLight(r,J,t),t.position.set(y[0],y[1],y[2])):u.type=="ambient"&&(t=new THREE.AmbientLight(r)),L.scene.add(t),L.lights[m]=t;for(n in G.fogs)m=G.fogs[n],m.type=="linear"?x=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(x=new THREE.FogExp2(0,m.density)),u=m.color,x.color.setRGB(u[0],u[1],u[2]),L.fogs[n]=x;if(L.cameras&&G.defaults.camera)L.currentCamera=L.cameras[G.defaults.camera];if(L.fogs&&G.defaults.fog)L.scene.fog=L.fogs[G.defaults.fog];u=G.defaults.bgcolor;L.bgColor=new THREE.Color;
-L.bgColor.setRGB(u[0],u[1],u[2]);L.bgColorAlpha=G.defaults.bgalpha;for(j in G.geometries)if(n=G.geometries[j],n.type=="bin_mesh"||n.type=="ascii_mesh")S+=1,i.onLoadStart();V=S;for(j in G.geometries)n=G.geometries[j],n.type=="cube"?(B=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),L.geometries[j]=B):n.type=="plane"?(B=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),L.geometries[j]=B):n.type=="sphere"?
-(B=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),L.geometries[j]=B):n.type=="cylinder"?(B=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),L.geometries[j]=B):n.type=="torus"?(B=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),L.geometries[j]=B):n.type=="icosahedron"?(B=new THREE.IcosahedronGeometry(n.subdivisions),L.geometries[j]=B):n.type=="bin_mesh"?c.load(d(n.url,G.urlBaseType),g(j)):n.type=="ascii_mesh"?W.load(d(n.url,G.urlBaseType),
-g(j)):n.type=="embedded_mesh"&&(n=G.embeds[n.id])&&W.createModel(n,f(j),"");for(q in G.textures)if(j=G.textures[q],j.url instanceof Array){T+=j.url.length;for(n=0;n<j.url.length;n++)i.onLoadStart()}else T+=1,i.onLoadStart();k=T;for(q in G.textures){j=G.textures[q];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){n=[];for(var v=0;v<j.url.length;v++)n[v]=d(j.url[v],G.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,j.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(j.url,
-G.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)n.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)n.magFilter=THREE[j.magFilter];if(j.repeat){n.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}j.offset&&n.offset.set(j.offset[0],j.offset[1]);if(j.wrap){x={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(x[j.wrap[0]]!==void 0)n.wrapS=x[j.wrap[0]];if(x[j.wrap[1]]!==void 0)n.wrapT=
-x[j.wrap[1]]}}L.textures[q]=n}for(o in G.materials){q=G.materials[o];for(H in q.parameters)if(H=="envMap"||H=="map"||H=="lightMap")q.parameters[H]=L.textures[q.parameters[H]];else if(H=="shading")q.parameters[H]=q.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H=="blending")q.parameters[H]=THREE[q.parameters[H]]?THREE[q.parameters[H]]:THREE.NormalBlending;else if(H=="combine")q.parameters[H]=q.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(H==
-"vertexColors")if(q.parameters[H]=="face")q.parameters[H]=THREE.FaceColors;else if(q.parameters[H])q.parameters[H]=THREE.VertexColors;if(q.parameters.opacity!==void 0&&q.parameters.opacity<1)q.parameters.transparent=!0;if(q.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);n=q.parameters.color;x=q.parameters.specular;c=q.parameters.ambient;W=q.parameters.shininess;a.tNormal.texture=L.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)a.uNormalScale.value=
-q.parameters.normalMapFactor;if(q.parameters.map)a.tDiffuse.texture=q.parameters.map,a.enableDiffuse.value=!0;if(q.parameters.lightMap)a.tAO.texture=q.parameters.lightMap,a.enableAO.value=!0;if(q.parameters.specularMap)a.tSpecular.texture=L.textures[q.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(x);a.uAmbientColor.value.setHex(c);a.uShininess.value=W;if(q.parameters.opacity)a.uOpacity.value=q.parameters.opacity;q=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
-vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else q=new THREE[q.type](q.parameters);L.materials[o]=q}e();i.callbackSync(L);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function e(){var a;for(p in K.objects)if(!M.objects[p])if(r=K.objects[p],r.geometry!==void 0){if(I=M.geometries[r.geometry]){a=!1;for(L=0;L<r.materials.length;L++)A=M.materials[r.materials[L]],a=A instanceof THREE.ShaderMaterial;a&&I.computeTangents();y=r.position;G=r.rotation;w=r.quaternion;B=r.scale;w=0;A.length==0&&(A=new THREE.MeshFaceMaterial);A.length>1&&(A=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(I,A);a.name=p;a.position.set(y[0],y[1],y[2]);w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(G[0],G[1],G[2]);a.scale.set(B[0],B[1],B[2]);a.visible=r.visible;M.scene.add(a);M.objects[p]=a;if(r.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);M.scene.collisions.colliders.push(b)}if(r.castsShadow)b=new THREE.ShadowVolume(I),M.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;r.trigger&&r.trigger.toLowerCase()!="none"&&(b=
+{type:r.trigger,object:r},M.triggers[a.name]=b)}}else y=r.position,G=r.rotation,w=r.quaternion,B=r.scale,w=0,a=new THREE.Object3D,a.name=p,a.position.set(y[0],y[1],y[2]),w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(G[0],G[1],G[2]),a.scale.set(B[0],B[1],B[2]),a.visible=r.visible!==void 0?r.visible:!1,M.scene.add(a),M.objects[p]=a,M.empties[p]=a,r.trigger&&r.trigger.toLowerCase()!="none"&&(b={type:r.trigger,object:r},M.triggers[a.name]=b)}function g(a){return function(b){M.geometries[a]=
+b;e();T-=1;i.onLoadComplete();h()}}function f(a){return function(b){M.geometries[a]=b}}function h(){i.callbackProgress({totalModels:V,totalTextures:l,loadedModels:V-T,loadedTextures:l-$},M);i.onLoadProgress();T==0&&$==0&&b(M)}var i=this,j=THREE.Loader.prototype.extractUrlbase(c),k,o,p,m,s,n,q,r,t,u,y,G,w,B,F,I,R,x,A,K,X,T,$,V,l,M;K=a;c=new THREE.BinaryLoader;X=new THREE.JSONLoader;$=T=0;M={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+empties:{}};a=!1;for(p in K.objects)if(r=K.objects[p],r.meshCollider){a=!0;break}if(a)M.scene.collisions=new THREE.CollisionSystem;if(K.transform){a=K.transform.position;t=K.transform.rotation;var J=K.transform.scale;a&&M.scene.position.set(a[0],a[1],a[2]);t&&M.scene.rotation.set(t[0],t[1],t[2]);J&&M.scene.scale.set(J[0],J[1],J[2]);(a||t||J)&&M.scene.updateMatrix()}a=function(){$-=1;h();i.onLoadComplete()};for(s in K.cameras)t=K.cameras[s],t.type=="perspective"?R=new THREE.PerspectiveCamera(t.fov,
+t.aspect,t.near,t.far):t.type=="ortho"&&(R=new THREE.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far)),y=t.position,t=t.target,R.position.set(y[0],y[1],y[2]),R.target=new THREE.Vector3(t[0],t[1],t[2]),M.cameras[s]=R;for(m in K.lights)t=K.lights[m],s=t.color!==void 0?t.color:16777215,R=t.intensity!==void 0?t.intensity:1,t.type=="directional"?(y=t.direction,u=new THREE.DirectionalLight(s,R),u.position.set(y[0],y[1],y[2]),u.position.normalize()):t.type=="point"?(y=t.position,u=t.distance,
+u=new THREE.PointLight(s,R,u),u.position.set(y[0],y[1],y[2])):t.type=="ambient"&&(u=new THREE.AmbientLight(s)),M.scene.add(u),M.lights[m]=u;for(n in K.fogs)m=K.fogs[n],m.type=="linear"?x=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(x=new THREE.FogExp2(0,m.density)),t=m.color,x.color.setRGB(t[0],t[1],t[2]),M.fogs[n]=x;if(M.cameras&&K.defaults.camera)M.currentCamera=M.cameras[K.defaults.camera];if(M.fogs&&K.defaults.fog)M.scene.fog=M.fogs[K.defaults.fog];t=K.defaults.bgcolor;M.bgColor=new THREE.Color;
+M.bgColor.setRGB(t[0],t[1],t[2]);M.bgColorAlpha=K.defaults.bgalpha;for(k in K.geometries)if(n=K.geometries[k],n.type=="bin_mesh"||n.type=="ascii_mesh")T+=1,i.onLoadStart();V=T;for(k in K.geometries)n=K.geometries[k],n.type=="cube"?(I=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),M.geometries[k]=I):n.type=="plane"?(I=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),M.geometries[k]=I):n.type=="sphere"?
+(I=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),M.geometries[k]=I):n.type=="cylinder"?(I=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),M.geometries[k]=I):n.type=="torus"?(I=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),M.geometries[k]=I):n.type=="icosahedron"?(I=new THREE.IcosahedronGeometry(n.subdivisions),M.geometries[k]=I):n.type=="bin_mesh"?c.load(d(n.url,K.urlBaseType),g(k)):n.type=="ascii_mesh"?X.load(d(n.url,K.urlBaseType),
+g(k)):n.type=="embedded_mesh"&&(n=K.embeds[n.id])&&X.createModel(n,f(k),"");for(q in K.textures)if(k=K.textures[q],k.url instanceof Array){$+=k.url.length;for(n=0;n<k.url.length;n++)i.onLoadStart()}else $+=1,i.onLoadStart();l=$;for(q in K.textures){k=K.textures[q];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){n=[];for(var L=0;L<k.url.length;L++)n[L]=d(k.url[L],K.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,k.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(k.url,
+K.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)n.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=void 0)n.magFilter=THREE[k.magFilter];if(k.repeat){n.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}k.offset&&n.offset.set(k.offset[0],k.offset[1]);if(k.wrap){x={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(x[k.wrap[0]]!==void 0)n.wrapS=x[k.wrap[0]];if(x[k.wrap[1]]!==void 0)n.wrapT=
+x[k.wrap[1]]}}M.textures[q]=n}for(o in K.materials){q=K.materials[o];for(F in q.parameters)if(F=="envMap"||F=="map"||F=="lightMap")q.parameters[F]=M.textures[q.parameters[F]];else if(F=="shading")q.parameters[F]=q.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")q.parameters[F]=THREE[q.parameters[F]]?THREE[q.parameters[F]]:THREE.NormalBlending;else if(F=="combine")q.parameters[F]=q.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(F==
+"vertexColors")if(q.parameters[F]=="face")q.parameters[F]=THREE.FaceColors;else if(q.parameters[F])q.parameters[F]=THREE.VertexColors;if(q.parameters.opacity!==void 0&&q.parameters.opacity<1)q.parameters.transparent=!0;if(q.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);n=q.parameters.color;x=q.parameters.specular;c=q.parameters.ambient;X=q.parameters.shininess;a.tNormal.texture=M.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)a.uNormalScale.value=
+q.parameters.normalMapFactor;if(q.parameters.map)a.tDiffuse.texture=q.parameters.map,a.enableDiffuse.value=!0;if(q.parameters.lightMap)a.tAO.texture=q.parameters.lightMap,a.enableAO.value=!0;if(q.parameters.specularMap)a.tSpecular.texture=M.textures[q.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(x);a.uAmbientColor.value.setHex(c);a.uShininess.value=X;if(q.parameters.opacity)a.uOpacity.value=q.parameters.opacity;q=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
+vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else q=new THREE[q.type](q.parameters);M.materials[o]=q}e();i.callbackSync(M);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var d=new XMLHttpRequest,e=c.scale!==void 0?c.scale:1,g=c.offsetX!==void 0?c.offsetX:0,f=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 b,e,g,f,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;e<8;e++){for(var g=0,f=0;f<b;++f){var h=a.charCodeAt(f+d);g+=h>>1^-(h&1);c[8*f+e]=g}d+=b}b=a.length-d;g=new Uint16Array(b);for(e=f=0;e<b;e++)h=a.charCodeAt(e+d),g[e]=f-h,h==0&&f++;return[c,g]};
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],j=[];(function(a,f,i){for(var j,l,q,s=a.length;i<s;i+=f)j=a[i],l=a[i+1],q=a[i+2],j=j/16383*c,l=l/16383*c,q=q/16383*c,j+=d,l+=e,q+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,l,q)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,j.push(d,1-e)})(f[0],8,3);(function(a,
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,l.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,u,t,y,A=a.length;for(c=0;c<A;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;t=d;y=e;i=f;u=d;var D=e,F=f,H=g.materials[0],B=l[D*3],J=l[D*3+1],D=l[D*3+2],x=l[F*3],z=l[F*3+1],F=l[F*3+2];u=new THREE.Vector3(l[u*3],l[u*3+1],l[u*3+2]);D=new THREE.Vector3(B,J,D);F=new THREE.Vector3(x,z,F);g.faces.push(new THREE.Face3(t,y,i,[u,D,F],null,H));g=j[d*2];d=j[d*2+
-1];i=j[e*2];u=j[e*2+1];t=j[f*2];y=j[f*2+1];f=b.faceVertexUvs[0];e=i;i=u;u=[];u.push(new THREE.UV(g,d));u.push(new THREE.UV(e,i));u.push(new THREE.UV(t,y));f.push(u)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,f,i){for(var j,k,q,r=a.length;i<r;i+=f)j=a[i],k=a[i+1],q=a[i+2],j=j/16383*c,k=k/16383*c,q=q/16383*c,j+=d,k+=e,q+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,q)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(f[0],8,3);(function(a,
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,j.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,t,u,y,G=a.length;for(c=0;c<G;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;u=d;y=e;i=f;t=d;var w=e,B=f,F=g.materials[0],I=j[w*3],R=j[w*3+1],w=j[w*3+2],x=j[B*3],A=j[B*3+1],B=j[B*3+2];t=new THREE.Vector3(j[t*3],j[t*3+1],j[t*3+2]);w=new THREE.Vector3(I,R,w);B=new THREE.Vector3(x,A,B);g.faces.push(new THREE.Face3(u,y,i,[t,w,B],null,F));g=k[d*2];d=k[d*2+
+1];i=k[e*2];t=k[e*2+1];u=k[f*2];y=k[f*2+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(u,y));f.push(t)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=a;this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=0;this.hasNormal=
-this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,l,j,o){f=(f-j)/(o-j);j=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=l;e[g]=this.lerp(j[a],j[a+3],f);e[g+1]=this.lerp(j[a+1],j[a+4],f);e[g+2]=this.lerp(j[a+2],j[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,l,j,o){f=(f-j)/(o-j);j=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=l;b=a+this.yd*
-3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,l,j,o){f=(f-j)/(o-j);j=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=l+f*this.delta;b=a+this.zd*3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
-this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,l=g+this.yd,j=g+this.zd,o=i+this.yd,p=i+this.zd,m=g+this.yd+this.zd,r=i+this.yd+this.zd,n=0,q=this.field[g],s=this.field[i],u=this.field[l],t=this.field[o],y=this.field[j],A=this.field[p],D=this.field[m],F=this.field[r];q<f&&(n|=1);s<f&&(n|=2);u<f&&(n|=8);t<f&&(n|=4);y<f&&(n|=16);A<f&&(n|=32);D<f&&(n|=128);F<f&&(n|=64);var H=THREE.edgeTable[n];if(H===0)return 0;var B=this.delta,J=a+
-B,x=b+B,B=e+B;H&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,q,s));H&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(i*3,this.vlist,this.nlist,3,f,J,b,e,s,t));H&4&&(this.compNorm(l),this.compNorm(o),this.VIntX(l*3,this.vlist,this.nlist,6,f,a,x,e,u,t));H&8&&(this.compNorm(g),this.compNorm(l),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,q,u));H&16&&(this.compNorm(j),this.compNorm(p),this.VIntX(j*3,this.vlist,this.nlist,12,f,a,b,B,y,A));H&32&&(this.compNorm(p),
-this.compNorm(r),this.VIntY(p*3,this.vlist,this.nlist,15,f,J,b,B,A,F));H&64&&(this.compNorm(m),this.compNorm(r),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,x,B,D,F));H&128&&(this.compNorm(j),this.compNorm(m),this.VIntY(j*3,this.vlist,this.nlist,21,f,a,b,B,y,D));H&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,q,y));H&512&&(this.compNorm(i),this.compNorm(p),this.VIntZ(i*3,this.vlist,this.nlist,27,f,J,b,e,s,A));H&1024&&(this.compNorm(o),this.compNorm(r),this.VIntZ(o*
-3,this.vlist,this.nlist,30,f,J,x,e,t,F));H&2048&&(this.compNorm(l),this.compNorm(m),this.VIntZ(l*3,this.vlist,this.nlist,33,f,a,x,e,u,D));n<<=4;for(f=g=0;THREE.triTable[n+f]!=-1;)a=n+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
+this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,j,k,o){f=(f-k)/(o-k);k=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=j;e[g]=this.lerp(k[a],k[a+3],f);e[g+1]=this.lerp(k[a+1],k[a+4],f);e[g+2]=this.lerp(k[a+2],k[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,j,k,o){f=(f-k)/(o-k);k=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=j;b=a+this.yd*
+3;e[g]=this.lerp(k[a],k[b],f);e[g+1]=this.lerp(k[a+1],k[b+1],f);e[g+2]=this.lerp(k[a+2],k[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,j,k,o){f=(f-k)/(o-k);k=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=j+f*this.delta;b=a+this.zd*3;e[g]=this.lerp(k[a],k[b],f);e[g+1]=this.lerp(k[a+1],k[b+1],f);e[g+2]=this.lerp(k[a+2],k[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,j=g+this.yd,k=g+this.zd,o=i+this.yd,p=i+this.zd,m=g+this.yd+this.zd,s=i+this.yd+this.zd,n=0,q=this.field[g],r=this.field[i],t=this.field[j],u=this.field[o],y=this.field[k],G=this.field[p],w=this.field[m],B=this.field[s];q<f&&(n|=1);r<f&&(n|=2);t<f&&(n|=8);u<f&&(n|=4);y<f&&(n|=16);G<f&&(n|=32);w<f&&(n|=128);B<f&&(n|=64);var F=THREE.edgeTable[n];if(F===0)return 0;var I=this.delta,R=a+
+I,x=b+I,I=e+I;F&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,q,r));F&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(i*3,this.vlist,this.nlist,3,f,R,b,e,r,u));F&4&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,6,f,a,x,e,t,u));F&8&&(this.compNorm(g),this.compNorm(j),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,q,t));F&16&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,12,f,a,b,I,y,G));F&32&&(this.compNorm(p),
+this.compNorm(s),this.VIntY(p*3,this.vlist,this.nlist,15,f,R,b,I,G,B));F&64&&(this.compNorm(m),this.compNorm(s),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,x,I,w,B));F&128&&(this.compNorm(k),this.compNorm(m),this.VIntY(k*3,this.vlist,this.nlist,21,f,a,b,I,y,w));F&256&&(this.compNorm(g),this.compNorm(k),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,q,y));F&512&&(this.compNorm(i),this.compNorm(p),this.VIntZ(i*3,this.vlist,this.nlist,27,f,R,b,e,r,G));F&1024&&(this.compNorm(o),this.compNorm(s),this.VIntZ(o*
+3,this.vlist,this.nlist,30,f,R,x,e,u,B));F&2048&&(this.compNorm(j),this.compNorm(m),this.VIntZ(j*3,this.vlist,this.nlist,33,f,a,x,e,t,w));n<<=4;for(f=g=0;THREE.triTable[n+f]!=-1;)a=n+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
 4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=b[e];this.normalArray[i+1]=b[e+1];this.normalArray[i+2]=b[e+2];this.normalArray[i+3]=b[g];this.normalArray[i+4]=b[g+1];this.normalArray[i+5]=b[g+2];this.normalArray[i+6]=b[f];this.normalArray[i+7]=b[f+1];this.normalArray[i+8]=b[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,l=b*this.size,j=a*this.size,o=Math.floor(i-h);o<1&&(o=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var p=Math.floor(l-h);p<1&&(p=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var m=Math.floor(j-h);m<1&&(m=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
-1);for(var r,n,q,s,u,t;o<i;o++){j=this.size2*o;n=o/this.size-e;u=n*n;for(n=p;n<l;n++){q=j+this.size*n;r=n/this.size-b;t=r*r;for(r=m;r<h;r++)s=r/this.size-a,s=g/(1.0E-6+s*s+t+u)-f,s>0&&(this.field[q+r]+=s)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,l=this.size,j=this.yd,o=this.zd,p=this.field,m=l*Math.sqrt(a/b);m>l&&(m=l);for(e=0;e<m;e++)if(g=e/l,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<l;g++){i=e+g*j;for(f=0;f<l;f++)p[o*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,l,j=this.size,o=this.yd,p=
-this.zd,m=this.field,r=j*Math.sqrt(a/b);r>j&&(r=j);for(g=0;g<r;g++)if(e=g/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=g*o;for(e=0;e<j;e++){l=i+e;for(f=0;f<j;f++)m[p*f+l]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,l,j=this.size,o=this.yd,p=this.zd,m=this.field,r=j*Math.sqrt(a/b);r>j&&(r=j);for(f=0;f<r;f++)if(e=f/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=p*f;for(g=0;g<j;g++){l=i+g*o;for(e=0;e<j;e++)m[l+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=
-function(a){this.begin();var b,e,g,f,h,i,l,j,o,p=this.size-2;for(f=1;f<p;f++){o=this.size2*f;l=(f-this.halfsize)/this.halfsize;for(g=1;g<p;g++){j=o+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<p;e++)h=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(h,i,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,l,j,o,p,m;for(f=0;f<g.count;f++)p=f*3,j=p+1,m=p+2,h=g.positionArray[p],i=g.positionArray[j],l=
-g.positionArray[m],o=new THREE.Vector3(h,i,l),h=g.normalArray[p],i=g.normalArray[j],l=g.normalArray[m],p=new THREE.Vector3(h,i,l),p.normalize(),j=new THREE.Vertex(o),b.vertices.push(j),e.push(p);o=g.count/3;for(f=0;f<o;f++)p=(a+f)*3,j=p+1,m=p+2,h=e[p],i=e[j],l=e[m],p=new THREE.Face3(p,j,m,[h,i,l]),b.faces.push(p);a+=o;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,j=b*this.size,k=a*this.size,o=Math.floor(i-h);o<1&&(o=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var p=Math.floor(j-h);p<1&&(p=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var m=Math.floor(k-h);m<1&&(m=1);h=Math.floor(k+h);h>this.size-1&&(h=this.size-
+1);for(var s,n,q,r,t,u;o<i;o++){k=this.size2*o;n=o/this.size-e;t=n*n;for(n=p;n<j;n++){q=k+this.size*n;s=n/this.size-b;u=s*s;for(s=m;s<h;s++)r=s/this.size-a,r=g/(1.0E-6+r*r+u+t)-f,r>0&&(this.field[q+s]+=r)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,j=this.size,k=this.yd,o=this.zd,p=this.field,m=j*Math.sqrt(a/b);m>j&&(m=j);for(e=0;e<m;e++)if(g=e/j,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<j;g++){i=e+g*k;for(f=0;f<j;f++)p[o*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,j,k=this.size,o=this.yd,p=
+this.zd,m=this.field,s=k*Math.sqrt(a/b);s>k&&(s=k);for(g=0;g<s;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-b,h>0){i=g*o;for(e=0;e<k;e++){j=i+e;for(f=0;f<k;f++)m[p*f+j]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,j,k=this.size,o=this.yd,p=this.zd,m=this.field,s=k*Math.sqrt(a/b);s>k&&(s=k);for(f=0;f<s;f++)if(e=f/k,e*=e,h=a/(1.0E-4+e)-b,h>0){i=p*f;for(g=0;g<k;g++){j=i+g*o;for(e=0;e<k;e++)m[j+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=
+function(a){this.begin();var b,e,g,f,h,i,j,k,o,p=this.size-2;for(f=1;f<p;f++){o=this.size2*f;j=(f-this.halfsize)/this.halfsize;for(g=1;g<p;g++){k=o+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<p;e++)h=(e-this.halfsize)/this.halfsize,b=k+e,this.polygonize(h,i,j,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,j,k,o,p,m;for(f=0;f<g.count;f++)p=f*3,k=p+1,m=p+2,h=g.positionArray[p],i=g.positionArray[k],j=
+g.positionArray[m],o=new THREE.Vector3(h,i,j),h=g.normalArray[p],i=g.normalArray[k],j=g.normalArray[m],p=new THREE.Vector3(h,i,j),p.normalize(),k=new THREE.Vertex(o),b.vertices.push(k),e.push(p);o=g.count/3;for(f=0;f<o;f++)p=(a+f)*3,k=p+1,m=p+2,h=e[p],i=e[k],j=e[m],p=new THREE.Face3(p,k,m,[h,i,j]),b.faces.push(p);a+=o;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -694,29 +708,29 @@ d.vertices[e++]=1;d.vertices[e++]=-1;d.vertices[e++]=1;d.vertices[e++]=0;d.verti
 d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);d.tempTexture=b.createTexture();d.occlusionTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);
 b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(d.hasVertexTexture=!1,d.program=a(THREE.ShaderFlares.lensFlare)):(d.hasVertexTexture=
 !0,d.program=a(THREE.ShaderFlares.lensFlareVertexTexture));d.attributes={};d.uniforms={};d.attributes.vertex=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.renderType=b.getUniformLocation(d.program,"renderType");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.occlusionMap=b.getUniformLocation(d.program,"occlusionMap");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.color=b.getUniformLocation(d.program,
-"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i=a.length;if(i){var l=new THREE.Vector3,j=h/f,o=f*0.5,p=h*0.5,m=16/h,r=new THREE.Vector2(m*j,m),n=new THREE.Vector3(1,1,0),q=new THREE.Vector2(1,1),s=d.uniforms,m=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
-b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(s.occlusionMap,0);b.uniform1i(s.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(m.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(m.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var u,t,y,A,D;for(u=0;u<i;u++)if(m=16/h,r.set(m*j,m),A=a[u],l.set(A.matrixWorld.n14,A.matrixWorld.n24,A.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(l),
-g.projectionMatrix.multiplyVector3(l),n.copy(l),q.x=n.x*o+o,q.y=n.y*p+p,d.hasVertexTexture||q.x>0&&q.x<f&&q.y>0&&q.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,q.x-8,q.y-8,16,16,0);b.uniform1i(s.renderType,0);b.uniform2f(s.scale,r.x,r.y);b.uniform3f(s.screenPosition,n.x,n.y,n.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);
-b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,q.x-8,q.y-8,16,16,0);b.uniform1i(s.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);A.positionScreen.copy(n);A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares();b.uniform1i(s.renderType,2);b.enable(b.BLEND);t=0;for(y=A.lensFlares.length;t<y;t++)if(D=A.lensFlares[t],D.opacity>0.0010&&D.scale>0.0010)n.x=D.x,n.y=D.y,n.z=D.z,m=D.size*D.scale/
-h,r.x=m*j,r.y=m,b.uniform3f(s.screenPosition,n.x,n.y,n.z),b.uniform2f(s.scale,r.x,r.y),b.uniform1f(s.rotation,D.rotation),b.uniform1f(s.opacity,D.opacity),b.uniform3f(s.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)}}};
+"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i=a.length;if(i){var j=new THREE.Vector3,k=h/f,o=f*0.5,p=h*0.5,m=16/h,s=new THREE.Vector2(m*k,m),n=new THREE.Vector3(1,1,0),q=new THREE.Vector2(1,1),r=d.uniforms,m=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
+b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(r.occlusionMap,0);b.uniform1i(r.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(m.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(m.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var t,u,y,G,w;for(t=0;t<i;t++)if(m=16/h,s.set(m*k,m),G=a[t],j.set(G.matrixWorld.n14,G.matrixWorld.n24,G.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(j),
+g.projectionMatrix.multiplyVector3(j),n.copy(j),q.x=n.x*o+o,q.y=n.y*p+p,d.hasVertexTexture||q.x>0&&q.x<f&&q.y>0&&q.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,q.x-8,q.y-8,16,16,0);b.uniform1i(r.renderType,0);b.uniform2f(r.scale,s.x,s.y);b.uniform3f(r.screenPosition,n.x,n.y,n.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);
+b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,q.x-8,q.y-8,16,16,0);b.uniform1i(r.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);G.positionScreen.copy(n);G.customUpdateCallback?G.customUpdateCallback(G):G.updateLensFlares();b.uniform1i(r.renderType,2);b.enable(b.BLEND);u=0;for(y=G.lensFlares.length;u<y;u++)if(w=G.lensFlares[u],w.opacity>0.0010&&w.scale>0.0010)n.x=w.x,n.y=w.y,n.z=w.z,m=w.size*w.scale/
+h,s.x=m*k,s.y=m,b.uniform3f(r.screenPosition,n.x,n.y,n.z),b.uniform2f(r.scale,s.x,s.y),b.uniform1f(r.rotation,w.rotation),b.uniform1f(r.opacity,w.opacity),b.uniform3f(r.color,w.color.r,w.color.g,w.color.b),c.setBlending(w.blending),c.setTexture(w.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,g=new THREE.Frustum,f=new THREE.Matrix4;this.shadowMatrix=[];this.shadowMap=[];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(h){var i,l,j,o,p,m,r,n,q=0,s=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(l=s.length;i<l;i++)if(r=s[i],r.castShadow&&r instanceof THREE.SpotLight){this.shadowMap[q]||(this.shadowMap[q]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
-format:THREE.RGBAFormat}),this.shadowMatrix[q]=new THREE.Matrix4);j=this.shadowMap[q];o=this.shadowMatrix[q];e.position.copy(r.position);e.lookAt(r.target.position);e.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),h.add(e),b.autoUpdateScene&&h.updateMatrixWorld());e.matrixWorldInverse.getInverse(e.matrixWorld);o.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);o.multiplySelf(e.projectionMatrix);o.multiplySelf(e.matrixWorldInverse);if(!e._viewMatrixArray)e._viewMatrixArray=
-new Float32Array(16);e.matrixWorldInverse.flattenToArray(e._viewMatrixArray);if(!e._projectionMatrixArray)e._projectionMatrixArray=new Float32Array(16);e.projectionMatrix.flattenToArray(e._projectionMatrixArray);f.multiply(e.projectionMatrix,e.matrixWorldInverse);g.setFromMatrix(f);b.setRenderTarget(j);a.clearColor(1,0,1,1);b.clear();j=b.getClearColor();o=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,o);n=h.__webglObjects;j=0;for(o=n.length;j<o;j++)if(p=n[j],r=p.object,p.render=!1,r.visible&&r.castShadow&&
-(!(r instanceof THREE.Mesh)||!r.frustumCulled||g.contains(r)))r.matrixWorld.flattenToArray(r._objectMatrixArray),r._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,r.matrixWorld,r._modelViewMatrixArray),p.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);j=0;for(o=n.length;j<o;j++)if(p=n[j],p.render)r=p.object,p=p.buffer,b.setObjectFaces(r),m=r.customDepthMaterial?r.customDepthMaterial:r.geometry.morphTargets.length?d:c,b.renderBuffer(e,s,null,m,p,r);n=h.__webglObjectsImmediate;
-j=0;for(o=n.length;j<o;j++)p=n[j],r=p.object,r.visible&&r.castShadow&&(r.matrixAutoUpdate&&r.matrixWorld.flattenToArray(r._objectMatrixArray),r._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,r.matrixWorld,r._modelViewMatrixArray),b.renderImmediateObject(e,s,null,c,r));q++}}};
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(h){var i,j,k,o,p,m,s,n,q=0,r=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(j=r.length;i<j;i++)if(s=r[i],s.castShadow&&s instanceof THREE.SpotLight){this.shadowMap[q]||(this.shadowMap[q]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
+format:THREE.RGBAFormat}),this.shadowMatrix[q]=new THREE.Matrix4);k=this.shadowMap[q];o=this.shadowMatrix[q];e.position.copy(s.position);e.lookAt(s.target.position);e.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),h.add(e),b.autoUpdateScene&&h.updateMatrixWorld());e.matrixWorldInverse.getInverse(e.matrixWorld);o.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);o.multiplySelf(e.projectionMatrix);o.multiplySelf(e.matrixWorldInverse);if(!e._viewMatrixArray)e._viewMatrixArray=
+new Float32Array(16);e.matrixWorldInverse.flattenToArray(e._viewMatrixArray);if(!e._projectionMatrixArray)e._projectionMatrixArray=new Float32Array(16);e.projectionMatrix.flattenToArray(e._projectionMatrixArray);f.multiply(e.projectionMatrix,e.matrixWorldInverse);g.setFromMatrix(f);b.setRenderTarget(k);a.clearColor(1,0,1,1);b.clear();k=b.getClearColor();o=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,o);n=h.__webglObjects;k=0;for(o=n.length;k<o;k++)if(p=n[k],s=p.object,p.render=!1,s.visible&&s.castShadow&&
+(!(s instanceof THREE.Mesh)||!s.frustumCulled||g.contains(s)))s.matrixWorld.flattenToArray(s._objectMatrixArray),s._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,s.matrixWorld,s._modelViewMatrixArray),p.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);k=0;for(o=n.length;k<o;k++)if(p=n[k],p.render)s=p.object,p=p.buffer,b.setObjectFaces(s),m=s.customDepthMaterial?s.customDepthMaterial:s.geometry.morphTargets.length?d:c,b.renderBuffer(e,r,null,m,p,s);n=h.__webglObjectsImmediate;
+k=0;for(o=n.length;k<o;k++)p=n[k],s=p.object,s.visible&&s.castShadow&&(s.matrixAutoUpdate&&s.matrixWorld.flattenToArray(s._objectMatrixArray),s._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,s.matrixWorld,s._modelViewMatrixArray),b.renderImmediateObject(e,r,null,c,s));q++}}};
 THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d={};this.init=function(a){b=a.context;c=a;d.vertices=new Float32Array(16);d.faces=new Uint16Array(6);a=0;d.vertices[a++]=-1;d.vertices[a++]=-1;d.vertices[a++]=0;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=0;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=0;a=d.vertices[a++]=0;d.faces[a++]=0;d.faces[a++]=1;d.faces[a++]=
 2;d.faces[a++]=0;d.faces[a++]=2;d.faces[a++]=3;d.vertexBuffer=b.createBuffer();d.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,d.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,g=b.createProgram(),f=b.createShader(b.FRAGMENT_SHADER),h=b.createShader(b.VERTEX_SHADER);b.shaderSource(f,a.fragmentShader);b.shaderSource(h,a.vertexShader);
 b.compileShader(f);b.compileShader(h);b.attachShader(g,f);b.attachShader(g,h);b.linkProgram(g);d.program=g;d.attributes={};d.uniforms={};d.attributes.position=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.uvOffset=b.getUniformLocation(d.program,"uvOffset");d.uniforms.uvScale=b.getUniformLocation(d.program,"uvScale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.alignment=
 b.getUniformLocation(d.program,"alignment");d.uniforms.color=b.getUniformLocation(d.program,"color");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.useScreenCoordinates=b.getUniformLocation(d.program,"useScreenCoordinates");d.uniforms.affectedByDistance=b.getUniformLocation(d.program,"affectedByDistance");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.uniforms.modelViewMatrix=b.getUniformLocation(d.program,
-"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h){var e=e.__webglSprites,i=e.length;if(i){var l=d.attributes,j=d.uniforms,o=h/f;f*=0.5;var p=h*0.5,m=!0;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(l.position),b.enableVertexAttribArray(l.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(l.position,
-2,b.FLOAT,!1,16,0);b.vertexAttribPointer(l.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(j.projectionMatrix,!1,g._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(j.map,0);for(var r,n=[],l=0;l<i;l++)if(r=e[l],r.visible&&r.opacity!==0)r.useScreenCoordinates?r.z=-r.position.z:(r._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,r.matrixWorld,r._modelViewMatrixArray),r.z=-r._modelViewMatrix.n34);e.sort(a);for(l=0;l<i;l++)r=e[l],r.visible&&
-r.opacity!==0&&r.map&&r.map.image&&r.map.image.width&&(r.useScreenCoordinates?(b.uniform1i(j.useScreenCoordinates,1),b.uniform3f(j.screenPosition,(r.position.x-f)/f,(p-r.position.y)/p,Math.max(0,Math.min(1,r.position.z)))):(b.uniform1i(j.useScreenCoordinates,0),b.uniform1i(j.affectedByDistance,r.affectedByDistance?1:0),b.uniformMatrix4fv(j.modelViewMatrix,!1,r._modelViewMatrixArray)),g=r.map.image.width/(r.scaleByViewport?h:1),n[0]=g*o*r.scale.x,n[1]=g*r.scale.y,b.uniform2f(j.uvScale,r.uvScale.x,
-r.uvScale.y),b.uniform2f(j.uvOffset,r.uvOffset.x,r.uvOffset.y),b.uniform2f(j.alignment,r.alignment.x,r.alignment.y),b.uniform1f(j.opacity,r.opacity),b.uniform3f(j.color,r.color.r,r.color.g,r.color.b),b.uniform1f(j.rotation,r.rotation),b.uniform2fv(j.scale,n),r.mergeWith3D&&!m?(b.enable(b.DEPTH_TEST),m=!0):!r.mergeWith3D&&m&&(b.disable(b.DEPTH_TEST),m=!1),c.setBlending(r.blending),c.setTexture(r.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,l,j,o;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),r=new THREE.PerspectiveCamera(53,
-1,1,1E4);r.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:m}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
-n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(r);this.setSize=function(a,d){c.call(b,a,d);p.width=a;p.height=d;m.width=a;m.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||l!==c.near||j!==c.far||o!==c.fov){i=c.aspect;l=c.near;j=c.far;o=c.fov;var u=c.projectionMatrix.clone(),t=125/30*0.5,y=t*l/125,A=l*Math.tan(o*Math.PI/360),D;f.n14=t;h.n14=-t;t=-A*i+y;D=A*i+y;u.n11=2*l/(D-t);u.n13=(D+t)/(D-t);e.projectionMatrix.copy(u);t=-A*i-y;D=A*i-y;u.n11=
-2*l/(D-t);u.n13=(D+t)/(D-t);g.projectionMatrix.copy(u)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,p,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,m,!0);n.updateMatrixWorld();d.call(b,n,r)}};
+"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h){var e=e.__webglSprites,i=e.length;if(i){var j=d.attributes,k=d.uniforms,o=h/f;f*=0.5;var p=h*0.5,m=!0;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(j.position),b.enableVertexAttribArray(j.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(j.position,
+2,b.FLOAT,!1,16,0);b.vertexAttribPointer(j.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(k.projectionMatrix,!1,g._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(k.map,0);for(var s,n=[],j=0;j<i;j++)if(s=e[j],s.visible&&s.opacity!==0)s.useScreenCoordinates?s.z=-s.position.z:(s._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,s.matrixWorld,s._modelViewMatrixArray),s.z=-s._modelViewMatrix.n34);e.sort(a);for(j=0;j<i;j++)s=e[j],s.visible&&
+s.opacity!==0&&s.map&&s.map.image&&s.map.image.width&&(s.useScreenCoordinates?(b.uniform1i(k.useScreenCoordinates,1),b.uniform3f(k.screenPosition,(s.position.x-f)/f,(p-s.position.y)/p,Math.max(0,Math.min(1,s.position.z)))):(b.uniform1i(k.useScreenCoordinates,0),b.uniform1i(k.affectedByDistance,s.affectedByDistance?1:0),b.uniformMatrix4fv(k.modelViewMatrix,!1,s._modelViewMatrixArray)),g=s.map.image.width/(s.scaleByViewport?h:1),n[0]=g*o*s.scale.x,n[1]=g*s.scale.y,b.uniform2f(k.uvScale,s.uvScale.x,
+s.uvScale.y),b.uniform2f(k.uvOffset,s.uvOffset.x,s.uvOffset.y),b.uniform2f(k.alignment,s.alignment.x,s.alignment.y),b.uniform1f(k.opacity,s.opacity),b.uniform3f(k.color,s.color.r,s.color.g,s.color.b),b.uniform1f(k.rotation,s.rotation),b.uniform2fv(k.scale,n),s.mergeWith3D&&!m?(b.enable(b.DEPTH_TEST),m=!0):!s.mergeWith3D&&m&&(b.disable(b.DEPTH_TEST),m=!1),c.setBlending(s.blending),c.setTexture(s.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,o;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),s=new THREE.PerspectiveCamera(53,
+1,1,1E4);s.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:m}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
+n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(s);this.setSize=function(a,d){c.call(b,a,d);p.width=a;p.height=d;m.width=a;m.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||j!==c.near||k!==c.far||o!==c.fov){i=c.aspect;j=c.near;k=c.far;o=c.fov;var t=c.projectionMatrix.clone(),u=125/30*0.5,y=u*j/125,G=j*Math.tan(o*Math.PI/360),w;f.n14=u;h.n14=-u;u=-G*i+y;w=G*i+y;t.n11=2*j/(w-u);t.n13=(w+u)/(w-u);e.projectionMatrix.copy(t);u=-G*i-y;w=G*i-y;t.n11=
+2*j/(w-u);t.n13=(w+u)/(w-u);g.projectionMatrix.copy(t)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,p,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,m,!0);n.updateMatrixWorld();d.call(b,n,s)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,g,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;g=d};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=
 c.far;f.updateProjectionMatrix();f.position.copy(c.position);f.target.copy(c.target);f.translateX(b.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,g);d.call(b,a,f);this.setViewport(e,0,e,g);d.call(b,a,h,!1)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},

+ 79 - 75
build/custom/ThreeCanvas.js

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

+ 40 - 36
build/custom/ThreeDOM.js

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

+ 201 - 190
build/custom/ThreeExtras.js

@@ -1,19 +1,19 @@
 // ThreeExtras.js r47dev - http://github.com/mrdoob/three.js
 THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,e=a.b,g=Math.max(Math.max(c,d),e),f=Math.min(Math.min(c,d),e);if(f===g)f=c=0;else{var h=g-f,f=h/g,c=c===g?(d-e)/h:d===g?2+(e-c)/h:4+(c-d)/h;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=f;b.v=g;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,k=g.faces,j=a.faceVertexUvs[0],r=g.faceVertexUvs[0],o={},l=0;l<a.materials.length;l++)o[a.materials[l].id]=l;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var l=0,n=h.length;l<n;l++){var m=new THREE.Vertex(h[l].position.clone());c&&c.multiplyVector3(m.position);f.push(m)}l=
-0;for(n=k.length;l<n;l++){var f=k[l],q,p,s=f.vertexNormals,t=f.vertexColors;f instanceof THREE.Face3?q=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(q=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));q.normal.copy(f.normal);d&&d.multiplyVector3(q.normal);h=0;for(m=s.length;h<m;h++)p=s[h].clone(),d&&d.multiplyVector3(p),q.vertexNormals.push(p);q.color.copy(f.color);h=0;for(m=t.length;h<m;h++)p=t[h],q.vertexColors.push(p.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
-m=o[h.id];if(m===void 0)m=a.materials.length,a.materials.push(h);q.materialIndex=m}q.centroid.copy(f.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}l=0;for(n=r.length;l<n;l++){c=r[l];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var f=new THREE.Vertex(d[a].position.clone());b.vertices.push(f)}a=0;
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,f=a.vertices,h=g.vertices,i=a.faces,k=g.faces,j=a.faceVertexUvs[0],r=g.faceVertexUvs[0],p={},o=0;o<a.materials.length;o++)p[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,l=h.length;o<l;o++){var n=new THREE.Vertex(h[o].position.clone());c&&c.multiplyVector3(n.position);f.push(n)}o=
+0;for(l=k.length;o<l;o++){var f=k[o],q,m,s=f.vertexNormals,t=f.vertexColors;f instanceof THREE.Face3?q=new THREE.Face3(f.a+e,f.b+e,f.c+e):f instanceof THREE.Face4&&(q=new THREE.Face4(f.a+e,f.b+e,f.c+e,f.d+e));q.normal.copy(f.normal);d&&d.multiplyVector3(q.normal);h=0;for(n=s.length;h<n;h++)m=s[h].clone(),d&&d.multiplyVector3(m),q.vertexNormals.push(m);q.color.copy(f.color);h=0;for(n=t.length;h<n;h++)m=t[h],q.vertexColors.push(m.clone());if(f.materialIndex!==void 0){h=g.materials[f.materialIndex];
+n=p[h.id];if(n===void 0)n=a.materials.length,a.materials.push(h);q.materialIndex=n}q.centroid.copy(f.centroid);c&&c.multiplyVector3(q.centroid);i.push(q)}o=0;for(l=r.length;o<l;o++){c=r[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,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++){var f=new THREE.Vertex(d[a].position.clone());b.vertices.push(f)}a=0;
 for(c=e.length;a<c;a++){var h=e[a],i,k,j=h.vertexNormals,r=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(f=j.length;d<f;d++)k=j[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(f=r.length;d<f;d++)k=r[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}a=0;for(c=g.length;a<c;a++){e=g[a];i=[];d=0;for(f=e.length;d<
 f;d++)i.push(new THREE.UV(e[d].u,e[d].v));b.faceVertexUvs[0].push(i)}return b},randomPointInTriangle:function(a,b,c){var d,e,g,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();d+e>1&&(d=1-d,e=1-e);g=1-d-e;f.copy(a);f.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);f.addSelf(h);h.copy(c);h.multiplyScalar(g);f.addSelf(h);return f},randomPointInFace:function(a,b,c){var d,e,g;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,e=b.vertices[a.b].position,
 g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,g);else if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,f;c?a._area1&&a._area2?(c=a._area1,f=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b),a._area1=c,a._area2=f):(c=THREE.GeometryUtils.triangleArea(d,e,b),f=THREE.GeometryUtils.triangleArea(e,g,b));return THREE.GeometryUtils.random()*(c+
-f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(d,c){if(c<d)return d;var e=d+Math.floor((c-d)/2);return k[e]>a?b(d,e-1):k[e]<a?b(e+1,c):e}return b(0,k.length-1)}var d,e,g=a.faces,f=a.vertices,h=g.length,i=0,k=[],j,r,o,l;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)j=f[d.a].position,r=f[d.b].position,o=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,r,o);else if(d instanceof
-THREE.Face4)j=f[d.a].position,r=f[d.b].position,o=f[d.c].position,l=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,r,l),d._area2=THREE.GeometryUtils.triangleArea(r,o,l),d._area=d._area1+d._area2;i+=d._area;k[e]=i}d=[];f={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();
+f)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,g,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(d,c){if(c<d)return d;var e=d+Math.floor((c-d)/2);return k[e]>a?b(d,e-1):k[e]<a?b(e+1,c):e}return b(0,k.length-1)}var d,e,g=a.faces,f=a.vertices,h=g.length,i=0,k=[],j,r,p,o;for(e=0;e<h;e++){d=g[e];if(d instanceof THREE.Face3)j=f[d.a].position,r=f[d.b].position,p=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,r,p);else if(d instanceof
+THREE.Face4)j=f[d.a].position,r=f[d.b].position,p=f[d.c].position,o=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,r,o),d._area2=THREE.GeometryUtils.triangleArea(r,p,o),d._area=d._area1+d._area2;i+=d._area;k[e]=i}d=[];f={};for(e=0;e<b;e++)h=THREE.GeometryUtils.random()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();
 b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Matrix4;b.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(b);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin="";d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],g=new THREE.Texture(e,b),b=e.loadCount=0;for(d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(e.loadCount===6)g.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return g},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),k=i.data,j=0;j<d;j++)for(var r=1;r<e;r++){var o=r-1<0?e-1:r-1,l=(r+1)%e,n=j-1<0?d-1:j-1,m=(j+1)%d,q=[],p=[0,0,h[(r*d+j)*4]/255*b];q.push([-1,0,h[(r*d+n)*4]/255*b]);q.push([-1,-1,h[(o*d+n)*4]/255*b]);q.push([0,-1,h[(o*d+j)*4]/255*b]);q.push([1,-1,h[(o*d+m)*4]/255*b]);
-q.push([1,0,h[(r*d+m)*4]/255*b]);q.push([1,1,h[(l*d+m)*4]/255*b]);q.push([0,1,h[(l*d+j)*4]/255*b]);q.push([-1,1,h[(l*d+n)*4]/255*b]);o=[];n=q.length;for(l=0;l<n;l++){var m=q[l],s=q[(l+1)%n],m=[m[0]-p[0],m[1]-p[1],m[2]-p[2]],s=[s[0]-p[0],s[1]-p[1],s[2]-p[2]];o.push(c([m[1]*s[2]-m[2]*s[1],m[2]*s[0]-m[0]*s[2],m[0]*s[1]-m[1]*s[0]]))}q=[0,0,0];for(l=0;l<o.length;l++)q[0]+=o[l][0],q[1]+=o[l][1],q[2]+=o[l][2];q[0]/=o.length;q[1]/=o.length;q[2]/=o.length;p=(r*d+j)*4;k[p]=(q[0]+1)/2*255|0;k[p+1]=(q[1]+0.5)*
-255|0;k[p+2]=q[2]*255|0;k[p+3]=255}f.putImageData(i,0,0);return g}};
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,i=f.createImageData(d,e),k=i.data,j=0;j<d;j++)for(var r=1;r<e;r++){var p=r-1<0?e-1:r-1,o=(r+1)%e,l=j-1<0?d-1:j-1,n=(j+1)%d,q=[],m=[0,0,h[(r*d+j)*4]/255*b];q.push([-1,0,h[(r*d+l)*4]/255*b]);q.push([-1,-1,h[(p*d+l)*4]/255*b]);q.push([0,-1,h[(p*d+j)*4]/255*b]);q.push([1,-1,h[(p*d+n)*4]/255*b]);
+q.push([1,0,h[(r*d+n)*4]/255*b]);q.push([1,1,h[(o*d+n)*4]/255*b]);q.push([0,1,h[(o*d+j)*4]/255*b]);q.push([-1,1,h[(o*d+l)*4]/255*b]);p=[];l=q.length;for(o=0;o<l;o++){var n=q[o],s=q[(o+1)%l],n=[n[0]-m[0],n[1]-m[1],n[2]-m[2]],s=[s[0]-m[0],s[1]-m[1],s[2]-m[2]];p.push(c([n[1]*s[2]-n[2]*s[1],n[2]*s[0]-n[0]*s[2],n[0]*s[1]-n[1]*s[0]]))}q=[0,0,0];for(o=0;o<p.length;o++)q[0]+=p[o][0],q[1]+=p[o][1],q[2]+=p[o][2];q[0]/=p.length;q[1]/=p.length;q[2]/=p.length;m=(r*d+j)*4;k[m]=(q[0]+1)/2*255|0;k[m+1]=(q[1]+0.5)*
+255|0;k[m+2]=q[2]*255|0;k[m+3]=255}f.putImageData(i,0,0);return g}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var g=new THREE.Mesh(a,b[c]);e.add(g)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
 b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
 (b=new THREE.ParticleSystem(a.geometry,a.material),b.sortParticles=a.sortParticles):a instanceof THREE.Particle?b=new THREE.Particle(a.material):a instanceof THREE.Sprite?(b=new THREE.Sprite({}),b.color.copy(a.color),b.map=a.map,b.blending=a.blending,b.useScreenCoordinates=a.useScreenCoordinates,b.mergeWith3D=a.mergeWith3D,b.affectedByDistance=a.affectedByDistance,b.scaleByViewport=a.scaleByViewport,b.alignment=a.alignment,b.rotation3d.copy(a.rotation3d),b.rotation=a.rotation,b.opacity=a.opacity,
@@ -58,9 +58,9 @@ THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,g){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,g)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
 THREE.Path.prototype.arc=function(a,b,c,d,e,g){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,e,g));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,k,j,r,o,l,n,m;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];r=g[0];o=g[1];c.length>0?(f=c[c.length-1],l=f.x,n=f.y):(f=this.actions[d-1].args,l=f[f.length-2],n=f[f.length-1]);for(f=1;f<=a;f++)m=f/a,g=THREE.Shape.Utils.b2(m,l,r,h),m=THREE.Shape.Utils.b2(m,n,o,
-i),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];r=g[0];o=g[1];k=g[2];j=g[3];c.length>0?(f=c[c.length-1],l=f.x,n=f.y):(f=this.actions[d-1].args,l=f[f.length-2],n=f[f.length-1]);for(f=1;f<=a;f++)m=f/a,g=THREE.Shape.Utils.b3(m,l,r,k,h),m=THREE.Shape.Utils.b3(m,n,o,j,i),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];m=a*g[0].length;f=f.concat(g[0]);g=new THREE.SplineCurve(f);
-for(f=1;f<=m;f++)c.push(g.getPointAt(f/m));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=g[0];i=g[1];k=g[2];r=g[3];m=g[4];o=!!g[5];j=f[f.length-2];l=f[f.length-1];f.length==0&&(j=l=0);n=m-r;var q=a*2;for(f=1;f<=q;f++)m=f/q,o||(m=1-m),m=r+m*n,g=j+h+k*Math.cos(m),m=l+i+k*Math.sin(m),c.push(new THREE.Vector2(g,m))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,g,f,h,i,k,j,r,p,o,l,n;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];r=g[0];p=g[1];c.length>0?(f=c[c.length-1],o=f.x,l=f.y):(f=this.actions[d-1].args,o=f[f.length-2],l=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b2(n,o,r,h),n=THREE.Shape.Utils.b2(n,l,p,
+i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];r=g[0];p=g[1];k=g[2];j=g[3];c.length>0?(f=c[c.length-1],o=f.x,l=f.y):(f=this.actions[d-1].args,o=f[f.length-2],l=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,g=THREE.Shape.Utils.b3(n,o,r,k,h),n=THREE.Shape.Utils.b3(n,l,p,j,i),c.push(new THREE.Vector2(g,n));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];n=a*g[0].length;f=f.concat(g[0]);g=new THREE.SplineCurve(f);
+for(f=1;f<=n;f++)c.push(g.getPointAt(f/n));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=g[0];i=g[1];k=g[2];r=g[3];n=g[4];p=!!g[5];j=f[f.length-2];o=f[f.length-1];f.length==0&&(j=o=0);l=n-r;var q=a*2;for(f=1;f<=q;f++)n=f/q,p||(n=1-n),n=r+n*l,g=j+h+k*Math.cos(n),n=o+i+k*Math.sin(n),c.push(new THREE.Vector2(g,n))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
 THREE.Path.prototype.nltransform=function(a,b,c,d,e,g){var f=this.getPoints(),h,i,k,j,r;h=0;for(i=f.length;h<i;h++)k=f[h],j=k.x,r=k.y,k.x=a*j+b*r+c,k.y=d*r+e*j+g;return f};
 THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,e,a=0;for(c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
 this.getPoints();a=0;for(c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
@@ -68,29 +68,29 @@ THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],g=new THREE.Path;a=0;f
 d.curves):f.holes.push(d);g.push(f)}else{f=new THREE.Shape;a=0;for(b=e.length;a<b;a++)d=e[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f.actions=d.actions,f.curves=d.curves,g.push(f),f=new THREE.Shape):f.holes.push(d)}return g};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,k,j,r,o,l,n=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);g=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){o=k[e];l=[];for(r=0;r<c.length;r++)j=c[r],j=o.distanceToSquared(j),l.push(j),j<g&&(g=j,f=e,h=r)}e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:k.length-1;var m=[k[f],c[h],c[e]];r=THREE.FontUtils.Triangulate.area(m);var q=[k[f],k[g],c[h]];o=THREE.FontUtils.Triangulate.area(q);l=h;j=f;h+=1;f+=-1;h<
-0&&(h+=c.length);h%=c.length;f<0&&(f+=k.length);f%=k.length;e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:k.length-1;m=[k[f],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);q=[k[f],k[g],c[h]];q=THREE.FontUtils.Triangulate.area(q);r+o>m+q&&(h=l,f=j,h<0&&(h+=c.length),h%=c.length,f<0&&(f+=k.length),f%=k.length,e=h-1>=0?h-1:c.length-1,g=f-1>=0?f-1:k.length-1);r=c.slice(0,h);o=c.slice(h);l=k.slice(f);j=k.slice(0,f);g=[k[f],k[g],c[h]];n.push([k[f],c[h],c[e]]);n.push(g);c=r.concat(l).concat(j).concat(o)}return{shape:c,
-isolatedPts:n,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,f,h,i,k={};g=0;for(f=d.length;g<f;g++)i=d[g].x+":"+d[g].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=g;g=0;for(f=c.length;g<f;g++){h=c[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}g=0;for(f=e.length;g<f;g++){h=e[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}return c.concat(e)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,g,f,h,i,k,j,r,p,o,l=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);g=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){p=k[e];o=[];for(r=0;r<c.length;r++)j=c[r],j=p.distanceToSquared(j),o.push(j),j<g&&(g=j,f=e,h=r)}e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:k.length-1;var n=[k[f],c[h],c[e]];r=THREE.FontUtils.Triangulate.area(n);var q=[k[f],k[g],c[h]];p=THREE.FontUtils.Triangulate.area(q);o=h;j=f;h+=1;f+=-1;h<
+0&&(h+=c.length);h%=c.length;f<0&&(f+=k.length);f%=k.length;e=h-1>=0?h-1:c.length-1;g=f-1>=0?f-1:k.length-1;n=[k[f],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[k[f],k[g],c[h]];q=THREE.FontUtils.Triangulate.area(q);r+p>n+q&&(h=o,f=j,h<0&&(h+=c.length),h%=c.length,f<0&&(f+=k.length),f%=k.length,e=h-1>=0?h-1:c.length-1,g=f-1>=0?f-1:k.length-1);r=c.slice(0,h);p=c.slice(h);o=k.slice(f);j=k.slice(0,f);g=[k[f],k[g],c[h]];l.push([k[f],c[h],c[e]]);l.push(g);c=r.concat(o).concat(j).concat(p)}return{shape:c,
+isolatedPts:l,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,f,h,i,k={};g=0;for(f=d.length;g<f;g++)i=d[g].x+":"+d[g].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=g;g=0;for(f=c.length;g<f;g++){h=c[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}g=0;for(f=e.length;g<f;g++){h=e[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}return c.concat(e)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",e=b.weight!==void 0?b.weight:"normal",g=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=g};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
 THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var d=0;d<a.length;d++)a[d].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var d=0;d<a.hierarchy.length;d++){for(var c=0;c<a.hierarchy[d].keys.length;c++){if(a.hierarchy[d].keys[c].time<
-0)a.hierarchy[d].keys[c].time=0;if(a.hierarchy[d].keys[c].rot!==void 0&&!(a.hierarchy[d].keys[c].rot instanceof THREE.Quaternion)){var h=a.hierarchy[d].keys[c].rot;a.hierarchy[d].keys[c].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[d].keys[0].morphTargets!==void 0){h={};for(c=0;c<a.hierarchy[d].keys.length;c++)for(var i=0;i<a.hierarchy[d].keys[c].morphTargets.length;i++){var k=a.hierarchy[d].keys[c].morphTargets[i];h[k]=-1}a.hierarchy[d].usedMorphTargets=h;for(c=0;c<a.hierarchy[d].keys.length;c++){var j=
-{};for(k in h){for(i=0;i<a.hierarchy[d].keys[c].morphTargets.length;i++)if(a.hierarchy[d].keys[c].morphTargets[i]===k){j[k]=a.hierarchy[d].keys[c].morphTargetsInfluences[i];break}i===a.hierarchy[d].keys[c].morphTargets.length&&(j[k]=0)}a.hierarchy[d].keys[c].morphTargetsInfluences=j}}for(c=1;c<a.hierarchy[d].keys.length;c++)a.hierarchy[d].keys[c].time===a.hierarchy[d].keys[c-1].time&&(a.hierarchy[d].keys.splice(c,1),c--);for(c=1;c<a.hierarchy[d].keys.length;c++)a.hierarchy[d].keys[c].index=c}c=parseInt(a.length*
-a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(d=0;d<a.hierarchy.length;d++)a.JIT.hierarchy.push(Array(c));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
-2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===void 0)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
-THREE.Bone?e.skinMatrix:e.matrix;var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+0)a.hierarchy[d].keys[c].time=0;if(a.hierarchy[d].keys[c].rot!==void 0&&!(a.hierarchy[d].keys[c].rot instanceof THREE.Quaternion)){var h=a.hierarchy[d].keys[c].rot;a.hierarchy[d].keys[c].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[d].keys.length&&a.hierarchy[d].keys[0].morphTargets!==void 0){h={};for(c=0;c<a.hierarchy[d].keys.length;c++)for(var i=0;i<a.hierarchy[d].keys[c].morphTargets.length;i++){var k=a.hierarchy[d].keys[c].morphTargets[i];h[k]=-1}a.hierarchy[d].usedMorphTargets=
+h;for(c=0;c<a.hierarchy[d].keys.length;c++){var j={};for(k in h){for(i=0;i<a.hierarchy[d].keys[c].morphTargets.length;i++)if(a.hierarchy[d].keys[c].morphTargets[i]===k){j[k]=a.hierarchy[d].keys[c].morphTargetsInfluences[i];break}i===a.hierarchy[d].keys[c].morphTargets.length&&(j[k]=0)}a.hierarchy[d].keys[c].morphTargetsInfluences=j}}for(c=1;c<a.hierarchy[d].keys.length;c++)a.hierarchy[d].keys[c].time===a.hierarchy[d].keys[c-1].time&&(a.hierarchy[d].keys.splice(c,1),c--);for(c=0;c<a.hierarchy[d].keys.length;c++)a.hierarchy[d].keys[c].index=
+c}c=parseInt(a.length*a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(d=0;d<a.hierarchy.length;d++)a.JIT.hierarchy.push(Array(c));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=
+0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();
+THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3;a=0;for(b=this.hierarchy.length;a<b;a++)if(c=this.data.hierarchy[a].sids,d=this.hierarchy[a],this.data.hierarchy[a].keys.length){for(var e=
+0;e<c.length;e++){var g=c[e],f=this.getNextKeyWith(g,a,0);f&&f.apply(g)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}};
+THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,g;for(c=0;c<d;c++){e=this.hierarchy[c];g=this.data.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey=null,g.animationCache.nextKey=null,
+g.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:e.matrix;e=this.data.hierarchy[c].keys;if(e.length)g.animationCache.prevKey=e[0],g.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.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
-THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,g,f,h,i,k,j=this.data.JIT.hierarchy,r,o;this.currentTime+=a*this.timeScale;o=this.currentTime;r=this.currentTime%=this.data.length;k=parseInt(Math.min(r*this.data.fps,this.data.length*this.data.fps),10);for(var l=0,n=this.hierarchy.length;l<n;l++)if(a=this.hierarchy[l],i=a.animationCache,this.JITCompile&&j[l][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[l][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=j[l][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;m<3;m++){c=b[m];f=i.prevKey[c];h=i.nextKey[c];if(h.time<=o){if(r<o)if(this.loop){f=this.data.hierarchy[l].keys[0];for(h=this.getNextKeyWith(c,l,1);h.time<r;)f=h,h=this.getNextKeyWith(c,l,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(c,l,h.index+1);while(h.time<
-r)}i.prevKey[c]=f;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(r-f.time)/(h.time-f.time);e=f[c];g=h[c];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+l),d=d<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",l,f.index-1).pos,this.points[1]=e,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",l,h.index+1).pos,d=d*0.33+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(c===
-"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=e[0]+(g[0]-e[0])*d,c.y=e[1]+(g[1]-e[1])*d,c.z=e[2]+(g[2]-e[2])*d}}if(this.JITCompile&&j[0][k]===void 0){this.hierarchy[0].update(null,!0);for(l=0;l<this.hierarchy.length;l++)j[l][k]=this.hierarchy[l]instanceof THREE.Bone?this.hierarchy[l].skinMatrix.clone():this.hierarchy[l].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,g,f,h,i,k;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],i[0],k[0],e,c,f);d[1]=this.interpolate(g[1],h[1],i[1],k[1],e,c,f);d[2]=this.interpolate(g[2],h[2],i[2],k[2],e,c,f);return d};
-THREE.Animation.prototype.interpolate=function(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<d.length-1?c:d.length-1:c%=d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
-THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
+THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++){var b=this.hierarchy[a];if(b.animationCache!==void 0){var c=b.animationCache.originalMatrix;b instanceof THREE.Bone?(c.copy(b.skinMatrix),b.skinMatrix=c):(c.copy(b.matrix),b.matrix=c);delete b.animationCache}}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,g=this.data.JIT.hierarchy,f,h,i;this.currentTime+=a*this.timeScale;h=this.currentTime;f=this.currentTime%=this.data.length;if(f<this.startTimeMs)f=this.currentTime=this.startTimeMs+f;e=parseInt(Math.min(f*this.data.fps,this.data.length*this.data.fps),10);if((i=f<h)&&!this.loop){for(var a=0,k=this.hierarchy.length;a<k;a++){var j=this.data.hierarchy[a].keys,g=this.data.hierarchy[a].sids;d=j.length-1;e=this.hierarchy[a];if(j.length){for(j=
+0;j<g.length;j++)f=g[j],(h=this.getPrevKeyWith(f,a,d))&&h.apply(f);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(f<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,r=b.animationCache;if(this.JITCompile&&g[a][e]!==void 0)d instanceof THREE.Bone?(d.skinMatrix=g[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=g[a][e],d.matrixWorldNeedsUpdate=!0);else if(j.length){if(this.JITCompile&&r)d instanceof
+THREE.Bone?d.skinMatrix=r.originalMatrix:d.matrix=r.originalMatrix;b=r.prevKey;c=r.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=j[0];for(c=j[1];c.time<f;)b=c,c=j[b.index+1]}else if(!i)for(var p=j.length-1;c.time<f&&c.index!==p;)b=c,c=j[b.index+1];r.prevKey=b;r.nextKey=c}b.interpolate(c,f)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&g[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)g[a][e]=this.hierarchy[a]instanceof
+THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,g,f,h,i,k;e=(a.length-1)*b;g=Math.floor(e);e-=g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];k=a[c[3]];c=e*e;f=e*c;d[0]=this.interpolate(g[0],h[0],i[0],k[0],e,c,f);d[1]=this.interpolate(g[1],h[1],i[1],k[1],e,c,f);d[2]=this.interpolate(g[2],h[2],i[2],k[2],e,c,f);return d};
+THREE.Animation.prototype.interpolate=function(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<b.length-1?c:b.length-1:c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+b.length;c>=0;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=
 new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(d,d,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
@@ -110,14 +110,14 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.object.translateX(b);this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);c=a*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=
 1;this.constrainVertical&&(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*
 Math.sin(this.theta);this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
-THREE.PathControls=function(a,b){function c(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,p=0;f=q-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<q-1;f++)p=d*h.chunks[f]/h.total,b.keys[f]={time:p,pos:g[f]};e.hierarchy[0]=
+THREE.PathControls=function(a,b){function c(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function e(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),q=g.length,m=0;f=q-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<q-1;f++)m=d*h.chunks[f]/h.total,b.keys[f]={time:m,pos:g[f]};e.hierarchy[0]=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
 new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,h=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%f;this.phi=a>=0?a:a+f;b=this.verticalAngleMap.srcRange;
 a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=e(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
-this.debugPath,b=this.spline,f=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),l=0;l<b.points.length;l++)c=new THREE.Mesh(f,h),c.position.copy(b.points[l]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
+this.debugPath,b=this.spline,f=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),o=0;o<b.points.length;o++)c=new THREE.Mesh(f,h),c.position.copy(b.points[o]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
 !1)}};THREE.PathControlsIdCounter=0;
 THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
@@ -128,38 +128,38 @@ THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,argu
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,i=0,k=0,j=0,r=0,o=0,l=window.innerWidth/2,n=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
-this.rotateHorizontally(b*r);this.rotateVertically(b*o)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*k);this.object.translateY(b*j);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Matrix4,f=!1,h=1,i=0,k=0,j=0,r=0,p=0,o=window.innerWidth/2,l=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
+this.rotateHorizontally(b*r);this.rotateVertically(b*p)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*k);this.object.translateY(b*j);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
 e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;g.identity();g.n11=Math.cos(this.roll);g.n12=-Math.sin(this.roll);g.n21=Math.sin(this.roll);g.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(g);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){r=(a.clientX-l)/window.innerWidth;o=(a.clientY-n)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){r=(a.clientX-o)/window.innerWidth;p=(a.clientY-l)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
 function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:j=1;break;case 70:j=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:j=0;break;case 70:j=0}},!1)};
 THREE.TrackballControls=function(a,b){var c=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=b!==void 0?b:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];
-this.target=new THREE.Vector3(0,0,0);var e=!1,g=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,r=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
+this.target=new THREE.Vector3(0,0,0);var e=!1,g=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,r=new THREE.Vector2,p=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-
 c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=c.rotateSpeed;d.setFromAxisAngle(b,
--a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-k.y)*c.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),c.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(r);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));
-c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?r=o:r.addSelf(a.sub(o,r).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),f.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,f.setLength(c.minDistance))};this.update=function(){f.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();
-c.noPan||c.panCamera();c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=c.getMouseOnScreen(a.clientX,a.clientY),r=o=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),g!==d.NONE&&(g===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&
-!c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):g===d.PAN&&!c.noPan&&(o=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!c.noZoom?k=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(r=o=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
+-a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-k.y)*c.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),c.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=p.clone().subSelf(r);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));
+c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?r=p:r.addSelf(a.sub(p,r).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),f.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,f.setLength(c.minDistance))};this.update=function(){f.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();
+c.noPan||c.panCamera();c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=c.getMouseOnScreen(a.clientX,a.clientY),r=p=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),g!==d.NONE&&(g===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&
+!c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):g===d.PAN&&!c.noPan&&(p=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!c.noZoom?k=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(r=p=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
 function(a){if(c.enabled)a.preventDefault(),a.stopPropagation(),g=d.NONE},!1);window.addEventListener("keydown",function(a){if(c.enabled&&g===d.NONE){if(a.keyCode===c.keys[d.ROTATE]&&!c.noRotate)g=d.ROTATE;else if(a.keyCode===c.keys[d.ZOOM]&&!c.noZoom)g=d.ZOOM;else if(a.keyCode===c.keys[d.PAN]&&!c.noPan)g=d.PAN;g!==d.NONE&&(e=!0)}},!1);window.addEventListener("keyup",function(){if(c.enabled&&g!==d.NONE)g=d.NONE},!1)};
-THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,j,l){var m,o=d||1,n=e||1,p=h/2,q=i/2,r=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")m="y",n=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")m="x",o=g||1;var s=o+1,t=n+1,L=h/o,H=i/n,M=new THREE.Vector3;M[m]=j>0?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var J=new THREE.Vector3;J[a]=(i*L-p)*c;J[b]=(h*H-q)*f;J[m]=j;k.vertices.push(new THREE.Vertex(J))}for(h=0;h<n;h++)for(i=0;i<o;i++)a=
-new THREE.Face4(i+s*h+r,i+s*(h+1)+r,i+1+s*(h+1)+r,i+1+s*h+r),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=l,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/o,h/n),new THREE.UV(i/o,(h+1)/n),new THREE.UV((i+1)/o,(h+1)/n),new THREE.UV((i+1)/o,h/n)])}THREE.Geometry.call(this);var k=this,j=a/2,r=b/2,o=c/2,l,n,m,q,p,s;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(l=0;l<6;l++)this.materials.push(f)}l=0;q=1;n=2;p=
-3;m=4;s=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var t in h)this.sides[t]!==void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,j,l);this.sides.nx&&i("z","y",1,-1,c,b,-j,q);this.sides.py&&i("x","z",1,1,a,c,r,n);this.sides.ny&&i("x","z",1,-1,a,c,-r,p);this.sides.pz&&i("x","y",1,-1,a,b,o,m);this.sides.nz&&i("x","y",-1,-1,a,b,-o,s);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,j,n){var o,p=d||1,l=e||1,m=h/2,q=i/2,r=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")o="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")o="y",l=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")o="x",p=g||1;var s=p+1,t=l+1,M=h/p,H=i/l,N=new THREE.Vector3;N[o]=j>0?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var K=new THREE.Vector3;K[a]=(i*M-m)*c;K[b]=(h*H-q)*f;K[o]=j;k.vertices.push(new THREE.Vertex(K))}for(h=0;h<l;h++)for(i=0;i<p;i++)a=
+new THREE.Face4(i+s*h+r,i+s*(h+1)+r,i+1+s*(h+1)+r,i+1+s*h+r),a.normal.copy(N),a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone()),a.materialIndex=n,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/p,h/l),new THREE.UV(i/p,(h+1)/l),new THREE.UV((i+1)/p,(h+1)/l),new THREE.UV((i+1)/p,h/l)])}THREE.Geometry.call(this);var k=this,j=a/2,r=b/2,p=c/2,o,l,n,q,m,s;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(o=0;o<6;o++)this.materials.push(f)}o=0;q=1;l=2;m=
+3;n=4;s=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var t in h)this.sides[t]!==void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,j,o);this.sides.nx&&i("z","y",1,-1,c,b,-j,q);this.sides.py&&i("x","z",1,1,a,c,r,l);this.sides.ny&&i("x","z",1,-1,a,c,-r,m);this.sides.pz&&i("x","y",1,-1,a,b,p,n);this.sides.nz&&i("x","y",-1,-1,a,b,-p,s);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
 THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,d=d||8,e=e||1,h,i,k=[],j=[];for(i=0;i<=e;i++){var r=[],o=[],l=i/e,n=l*(b-a)+a;for(h=0;h<=d;h++){var m=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(n*Math.sin(m*Math.PI*2),-l*c+f,n*Math.cos(m*Math.PI*2))));r.push(this.vertices.length-1);o.push(new THREE.UV(m,l))}k.push(r);j.push(o)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=k[i][h],r=k[i+1][h],o=k[i+1][h+1],l=k[i][h+1],n=
-this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[r].position.clone().setY(0).normalize(),q=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[l].position.clone().setY(0).normalize(),s=j[i][h].clone(),t=j[i+1][h].clone(),w=j[i+1][h+1].clone(),y=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,r,o,l,[n,m,q,p]));this.faceVertexUvs[0].push([s,t,w,y])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=k[0][h],r=k[0][h+
-1],o=this.vertices.length-1,n=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),s=j[0][h].clone(),t=j[0][h+1].clone(),w=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,r,o,[n,m,q])),this.faceVertexUvs[0].push([s,t,w])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=k[i][h+1],r=k[i][h],o=this.vertices.length-1,n=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),s=j[i][h+1].clone(),t=j[i][h].clone(),
-w=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,r,o,[n,m,q])),this.faceVertexUvs[0].push([s,t,w])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,d=d||8,e=e||1,h,i,k=[],j=[];for(i=0;i<=e;i++){var r=[],p=[],o=i/e,l=o*(b-a)+a;for(h=0;h<=d;h++){var n=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(l*Math.sin(n*Math.PI*2),-o*c+f,l*Math.cos(n*Math.PI*2))));r.push(this.vertices.length-1);p.push(new THREE.UV(n,o))}k.push(r);j.push(p)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=k[i][h],r=k[i+1][h],p=k[i+1][h+1],o=k[i][h+1],l=
+this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[r].position.clone().setY(0).normalize(),q=this.vertices[p].position.clone().setY(0).normalize(),m=this.vertices[o].position.clone().setY(0).normalize(),s=j[i][h].clone(),t=j[i+1][h].clone(),w=j[i+1][h+1].clone(),y=j[i][h+1].clone();this.faces.push(new THREE.Face4(c,r,p,o,[l,n,q,m]));this.faceVertexUvs[0].push([s,t,w,y])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=k[0][h],r=k[0][h+
+1],p=this.vertices.length-1,l=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),s=j[0][h].clone(),t=j[0][h+1].clone(),w=new THREE.UV(t.u,0),this.faces.push(new THREE.Face3(c,r,p,[l,n,q])),this.faceVertexUvs[0].push([s,t,w])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=k[i][h+1],r=k[i][h],p=this.vertices.length-1,l=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),s=j[i][h+1].clone(),t=j[i][h].clone(),
+w=new THREE.UV(t.u,1),this.faces.push(new THREE.Face3(c,r,p,[l,n,q])),this.faceVertexUvs[0].push([s,t,w])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d=a.length,e;this.shapebb=a[d-1].getBoundingBox();for(c=0;c<d;c++)e=a[c],this.addShape(e,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
-THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
-h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(a){for(v=a.length;--v>=0;){J=v;N=v-1;N<0&&(N=a.length-1);for(var b=
-0,c=l+j*2,b=0;b<c;b++){var d=K*b,e=K*(b+1),f=Q+J+d,g=Q+J+e,k=f,d=Q+N+d,e=Q+N+e,m=g;k+=F;d+=F;e+=F;m+=F;A.faces.push(new THREE.Face4(k,d,e,m,null,null,w));w&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(A.vertices[f].position.z+i)/e,g=(A.vertices[g].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function g(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=F;b+=F;c+=F;A.faces.push(new THREE.Face3(a,b,c,null,
-null,t));if(t){var d=y.maxY,e=y.maxX,f=A.vertices[b].position.x,b=A.vertices[b].position.y,g=A.vertices[c].position.x,c=A.vertices[c].position.y;A.faceVertexUvs[0].push([new THREE.UV(A.vertices[a].position.x/e,A.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:i-2,j=b.bevelSegments!==void 0?b.bevelSegments:3,r=b.bevelEnabled!==void 0?b.bevelEnabled:!0,o=b.curveSegments!==
-void 0?b.curveSegments:12,l=b.steps!==void 0?b.steps:1,n=b.bendPath,m=b.extrudePath,q,p=!1,s=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,t=b.material,w=b.extrudeMaterial,y=this.shapebb;if(m)q=m.getPoints(o),l=q.length,p=!0,r=!1;r||(k=i=j=0);var u,x,z,A=this,F=this.vertices.length;n&&a.addWrapPath(n);o=s?a.extractAllSpacedPoints(o):a.extractAllPoints(o);n=o.shape;o=o.holes;if(m=!THREE.Shape.Utils.isClockWise(n)){n=n.reverse();x=0;for(z=o.length;x<z;x++)u=o[x],THREE.Shape.Utils.isClockWise(u)&&
-(o[x]=u.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(n,o);s=n;x=0;for(z=o.length;x<z;x++)u=o[x],n=n.concat(u);var v,D,B,G,I,E,K=n.length,O=m.length,C=[];v=0;D=s.length;J=D-1;for(N=v+1;v<D;v++,J++,N++)J===D&&(J=0),N===D&&(N=0),C[v]=d(s[v],s[J],s[N]);var L=[],H,M=C.concat();x=0;for(z=o.length;x<z;x++){u=o[x];H=[];v=0;D=u.length;J=D-1;for(N=v+1;v<D;v++,J++,N++)J===D&&(J=0),N===D&&(N=0),H[v]=d(u[v],u[J],u[N]);L.push(H);M=M.concat(H)}for(B=0;B<j;B++){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);v=
-0;for(D=s.length;v<D;v++)E=c(s[v],C[v],G),g(E.x,E.y,-I);x=0;for(z=o.length;x<z;x++){u=o[x];H=L[x];v=0;for(D=u.length;v<D;v++)E=c(u[v],H[v],G),g(E.x,E.y,-I)}}G=k;for(v=0;v<K;v++)E=r?c(n[v],M[v],G):n[v],p?g(E.x,E.y+q[0].y,q[0].x):g(E.x,E.y,0);for(B=1;B<=l;B++)for(v=0;v<K;v++)E=r?c(n[v],M[v],G):n[v],p?g(E.x,E.y+q[B-1].y,q[B-1].x):g(E.x,E.y,h/l*B);for(B=j-1;B>=0;B--){G=B/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);v=0;for(D=s.length;v<D;v++)E=c(s[v],C[v],G),g(E.x,E.y,h+I);x=0;for(z=o.length;x<z;x++){u=o[x];
-H=L[x];v=0;for(D=u.length;v<D;v++)E=c(u[v],H[v],G),p?g(E.x,E.y+q[l-1].y,q[l-1].x+I):g(E.x,E.y,h+I)}}if(r){r=K*0;for(v=0;v<O;v++)k=m[v],f(k[2]+r,k[1]+r,k[0]+r);r=K*(l+j*2);for(v=0;v<O;v++)k=m[v],f(k[0]+r,k[1]+r,k[2]+r)}else{for(v=0;v<O;v++)k=m[v],f(k[2],k[1],k[0]);for(v=0;v<O;v++)k=m[v],f(k[0]+K*l,k[1]+K*l,k[2]+K*l)}var J,N,Q=0;e(s);Q+=s.length;x=0;for(z=o.length;x<z;x++)u=o[x],e(u),Q+=u.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,e=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);d=d.normalize();f=f.normalize();e.set(-d.y,d.x);g.set(f.y,-f.x);h.copy(a).addSelf(e);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
+h.copy(b).addSelf(e);i.copy(c).addSelf(g);e=d.dot(g);g=i.subSelf(h).dot(g);e===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=e;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(a){for(v=a.length;--v>=0;){K=v;I=v-1;I<0&&(I=a.length-1);for(var b=
+0,c=o+j*2,b=0;b<c;b++){var d=L*b,f=L*(b+1),e=R+K+d,g=R+K+f,k=e,d=R+I+d,f=R+I+f,n=g;k+=F;d+=F;f+=F;n+=F;A.faces.push(new THREE.Face4(k,d,f,n,null,null,w));w&&(k=b/c,d=(b+1)/c,f=h+i*2,e=(A.vertices[e].position.z+i)/f,g=(A.vertices[g].position.z+i)/f,A.faceVertexUvs[0].push([new THREE.UV(e,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(e,d)]))}}}function g(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=F;b+=F;c+=F;A.faces.push(new THREE.Face3(a,b,c,null,
+null,t));if(t){var d=y.maxY,f=y.maxX,e=A.vertices[b].position.x,b=A.vertices[b].position.y,g=A.vertices[c].position.x,c=A.vertices[c].position.y;A.faceVertexUvs[0].push([new THREE.UV(A.vertices[a].position.x/f,A.vertices[a].position.y/d),new THREE.UV(e/f,b/d),new THREE.UV(g/f,c/d)])}}var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,k=b.bevelSize!==void 0?b.bevelSize:i-2,j=b.bevelSegments!==void 0?b.bevelSegments:3,r=b.bevelEnabled!==void 0?b.bevelEnabled:!0,p=b.curveSegments!==
+void 0?b.curveSegments:12,o=b.steps!==void 0?b.steps:1,l=b.bendPath,n=b.extrudePath,q,m=!1,s=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,t=b.material,w=b.extrudeMaterial,y=this.shapebb;if(n)q=n.getPoints(p),o=q.length,m=!0,r=!1;r||(k=i=j=0);var u,x,z,A=this,F=this.vertices.length;l&&a.addWrapPath(l);p=s?a.extractAllSpacedPoints(p):a.extractAllPoints(p);l=p.shape;p=p.holes;if(n=!THREE.Shape.Utils.isClockWise(l)){l=l.reverse();x=0;for(z=p.length;x<z;x++)u=p[x],THREE.Shape.Utils.isClockWise(u)&&
+(p[x]=u.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(l,p);s=l;x=0;for(z=p.length;x<z;x++)u=p[x],l=l.concat(u);var v,D,B,G,J,E,L=l.length,O=n.length,C=[];v=0;D=s.length;K=D-1;for(I=v+1;v<D;v++,K++,I++)K===D&&(K=0),I===D&&(I=0),C[v]=d(s[v],s[K],s[I]);var M=[],H,N=C.concat();x=0;for(z=p.length;x<z;x++){u=p[x];H=[];v=0;D=u.length;K=D-1;for(I=v+1;v<D;v++,K++,I++)K===D&&(K=0),I===D&&(I=0),H[v]=d(u[v],u[K],u[I]);M.push(H);N=N.concat(H)}for(B=0;B<j;B++){G=B/j;J=i*(1-G);G=k*Math.sin(G*Math.PI/2);v=
+0;for(D=s.length;v<D;v++)E=c(s[v],C[v],G),g(E.x,E.y,-J);x=0;for(z=p.length;x<z;x++){u=p[x];H=M[x];v=0;for(D=u.length;v<D;v++)E=c(u[v],H[v],G),g(E.x,E.y,-J)}}G=k;for(v=0;v<L;v++)E=r?c(l[v],N[v],G):l[v],m?g(E.x,E.y+q[0].y,q[0].x):g(E.x,E.y,0);for(B=1;B<=o;B++)for(v=0;v<L;v++)E=r?c(l[v],N[v],G):l[v],m?g(E.x,E.y+q[B-1].y,q[B-1].x):g(E.x,E.y,h/o*B);for(B=j-1;B>=0;B--){G=B/j;J=i*(1-G);G=k*Math.sin(G*Math.PI/2);v=0;for(D=s.length;v<D;v++)E=c(s[v],C[v],G),g(E.x,E.y,h+J);x=0;for(z=p.length;x<z;x++){u=p[x];
+H=M[x];v=0;for(D=u.length;v<D;v++)E=c(u[v],H[v],G),m?g(E.x,E.y+q[o-1].y,q[o-1].x+J):g(E.x,E.y,h+J)}}if(r){r=L*0;for(v=0;v<O;v++)k=n[v],f(k[2]+r,k[1]+r,k[0]+r);r=L*(o+j*2);for(v=0;v<O;v++)k=n[v],f(k[0]+r,k[1]+r,k[2]+r)}else{for(v=0;v<O;v++)k=n[v],f(k[2],k[1],k[0]);for(v=0;v<O;v++)k=n[v],f(k[0]+L*o,k[1]+L*o,k[2]+L*o)}var K,I,R=0;e(s);R+=s.length;x=0;for(z=p.length;x<z;x++)u=p[x],e(u),R+=u.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var f=e.vertices[a].position,g=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1-
 (Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-g.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}function d(a,c){var d=e.vertices[a].position,f=e.vertices[c].position;return b((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,
@@ -173,140 +173,151 @@ f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,g=b/2,c=c||1,d=d||1,f=c+1,h=d+1,i=a/c,k=b/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<f;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*k-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+f*a,b+f*(a+1),b+1+f*(a+1),b+1+f*a),e.normal.copy(j),e.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
 c,(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c,d,e,g,f){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,g=g!=void 0?g:0,f=f!=void 0?f:Math.PI,h,i,k=[],j=[];for(i=0;i<=c;i++){var r=[],o=[];for(h=0;h<=b;h++){var l=h/b,n=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+l*e)*Math.sin(g+n*f),a*Math.cos(g+n*f),a*Math.sin(d+l*e)*Math.sin(g+n*f))));r.push(this.vertices.length-1);o.push(new THREE.UV(l,n))}k.push(r);
-j.push(o)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],e=k[i][h],g=k[i+1][h],f=k[i+1][h+1],r=this.vertices[d].position.clone().normalize(),o=this.vertices[e].position.clone().normalize(),l=this.vertices[g].position.clone().normalize(),n=this.vertices[f].position.clone().normalize(),m=j[i][h+1].clone(),q=j[i][h].clone(),p=j[i+1][h].clone(),s=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,f,[r,l,n])),this.faceVertexUvs[0].push([m,p,s])):Math.abs(this.vertices[g].position.y)==
-a?(this.faces.push(new THREE.Face3(d,e,g,[r,o,l])),this.faceVertexUvs[0].push([m,q,p])):(this.faces.push(new THREE.Face4(d,e,g,f,[r,o,l,n])),this.faceVertexUvs[0].push([m,q,p,s]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
+THREE.SphereGeometry=function(a,b,c,d,e,g,f){THREE.Geometry.call(this);var a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=d!=void 0?d:0,e=e!=void 0?e:Math.PI*2,g=g!=void 0?g:0,f=f!=void 0?f:Math.PI,h,i,k=[],j=[];for(i=0;i<=c;i++){var r=[],p=[];for(h=0;h<=b;h++){var o=h/b,l=i/c;this.vertices.push(new THREE.Vertex(new THREE.Vector3(-a*Math.cos(d+o*e)*Math.sin(g+l*f),a*Math.cos(g+l*f),a*Math.sin(d+o*e)*Math.sin(g+l*f))));r.push(this.vertices.length-1);p.push(new THREE.UV(o,l))}k.push(r);
+j.push(p)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=k[i][h+1],e=k[i][h],g=k[i+1][h],f=k[i+1][h+1],r=this.vertices[d].position.clone().normalize(),p=this.vertices[e].position.clone().normalize(),o=this.vertices[g].position.clone().normalize(),l=this.vertices[f].position.clone().normalize(),n=j[i][h+1].clone(),q=j[i][h].clone(),m=j[i+1][h].clone(),s=j[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,f,[r,o,l])),this.faceVertexUvs[0].push([n,m,s])):Math.abs(this.vertices[g].position.y)==
+a?(this.faces.push(new THREE.Face3(d,e,g,[r,p,o])),this.faceVertexUvs[0].push([n,q,m])):(this.faces.push(new THREE.Face4(d,e,g,f,[r,p,o,l])),this.faceVertexUvs[0].push([n,q,m,s]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
-0,e=String(a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,k,j,r,o,l,n,m,q,p=b.glyphs[a]||b.glyphs["?"];if(p){if(p.o){b=p._cachedOutline||(p._cachedOutline=p.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,j));e.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,
-j));e.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;l=b[a++]*c+d;n=b[a++]*c;e.quadraticCurveTo(l,n,i,j);if(f=g[g.length-1]){r=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++){var s=f/h,t=THREE.Shape.Utils.b2(s,r,l,i),s=THREE.Shape.Utils.b2(s,o,n,j);g.push(new THREE.Vector2(t,s))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,l=b[a++]*c+d,n=b[a++]*-c,m=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,j,l,n,m,q),f=g[g.length-1]){r=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++)s=f/h,t=THREE.Shape.Utils.b3(s,r,l,
-m,i),s=THREE.Shape.Utils.b3(s,o,n,q,j),g.push(new THREE.Vector2(t,s))}}}return{offset:p.ha*c,points:g,path:e}}}};
-(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,k,j;if(b(a)>0)for(k=0;k<e;k++)f[k]=k;else for(k=0;k<e;k++)f[k]=e-1-k;var r=2*e;for(k=e-1;e>2;){if(r--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);j=k+1;e<=j&&(j=0);var o;a:{o=a;var l=i,n=k,m=j,q=e,p=f,s=void 0,t=void 0,w=void 0,
-y=void 0,u=void 0,x=void 0,z=void 0,A=void 0,F=void 0,t=o[p[l]].x,w=o[p[l]].y,y=o[p[n]].x,u=o[p[n]].y,x=o[p[m]].x,z=o[p[m]].y;if(1.0E-10>(y-t)*(z-w)-(u-w)*(x-t))o=!1;else{for(s=0;s<q;s++)if(!(s==l||s==n||s==m)){var A=o[p[s]].x,F=o[p[s]].y,v=void 0,D=void 0,B=void 0,G=void 0,I=void 0,E=void 0,K=void 0,O=void 0,C=void 0,L=void 0,H=void 0,M=void 0,v=B=I=void 0,v=x-y,D=z-u,B=t-x,G=w-z,I=y-t,E=u-w,K=A-t,O=F-w,C=A-y,L=F-u,H=A-x,M=F-z,v=v*L-D*C,I=I*O-E*K,B=B*M-G*H;if(v>=0&&B>=0&&I>=0){o=!1;break a}}o=!0}}if(o){g.push([a[f[i]],
+0,e=String(a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,k,j,r,p,o,l,n,q,m=b.glyphs[a]||b.glyphs["?"];if(m){if(m.o){b=m._cachedOutline||(m._cachedOutline=m.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,j));e.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;g.push(new THREE.Vector2(i,
+j));e.lineTo(i,j);break;case "q":i=b[a++]*c+d;j=b[a++]*c;o=b[a++]*c+d;l=b[a++]*c;e.quadraticCurveTo(o,l,i,j);if(f=g[g.length-1]){r=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++){var s=f/h,t=THREE.Shape.Utils.b2(s,r,o,i),s=THREE.Shape.Utils.b2(s,p,l,j);g.push(new THREE.Vector2(t,s))}}break;case "b":if(i=b[a++]*c+d,j=b[a++]*c,o=b[a++]*c+d,l=b[a++]*-c,n=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,j,o,l,n,q),f=g[g.length-1]){r=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++)s=f/h,t=THREE.Shape.Utils.b3(s,r,o,
+n,i),s=THREE.Shape.Utils.b3(s,p,l,q,j),g.push(new THREE.Vector2(t,s))}}}return{offset:m.ha*c,points:g,path:e}}}};
+(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,k,j;if(b(a)>0)for(k=0;k<e;k++)f[k]=k;else for(k=0;k<e;k++)f[k]=e-1-k;var r=2*e;for(k=e-1;e>2;){if(r--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);j=k+1;e<=j&&(j=0);var p;a:{p=a;var o=i,l=k,n=j,q=e,m=f,s=void 0,t=void 0,w=void 0,
+y=void 0,u=void 0,x=void 0,z=void 0,A=void 0,F=void 0,t=p[m[o]].x,w=p[m[o]].y,y=p[m[l]].x,u=p[m[l]].y,x=p[m[n]].x,z=p[m[n]].y;if(1.0E-10>(y-t)*(z-w)-(u-w)*(x-t))p=!1;else{for(s=0;s<q;s++)if(!(s==o||s==l||s==n)){var A=p[m[s]].x,F=p[m[s]].y,v=void 0,D=void 0,B=void 0,G=void 0,J=void 0,E=void 0,L=void 0,O=void 0,C=void 0,M=void 0,H=void 0,N=void 0,v=B=J=void 0,v=x-y,D=z-u,B=t-x,G=w-z,J=y-t,E=u-w,L=A-t,O=F-w,C=A-y,M=F-u,H=A-x,N=F-z,v=v*M-D*C,J=J*O-E*L,B=B*N-G*H;if(v>=0&&B>=0&&J>=0){p=!1;break a}}p=!0}}if(p){g.push([a[f[i]],
 a[f[k]],a[f[j]]]);h.push([f[i],f[k],f[j]]);i=k;for(j=k+1;j<e;i++,j++)f[i]=f[j];e--;r=2*e}}if(d)return h;return g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,f=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(g);e.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(g);h.z=
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,f=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,g,f,h,[b[e],b[g],b[f],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[f]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[e].clone(),a[g].clone(),a[f].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
-THREE.TorusKnotGeometry=function(a,b,c,d,e,g,f){function h(a,b,c,d,e,f){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,f*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<
+THREE.TorusKnotGeometry=function(a,b,c,d,e,g,f){function h(a,b,c,d,f,e){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(f*(2+c)*0.5*Math.cos(a),f*(2+c)*Math.sin(a)*0.5,e*f*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<
 this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,f=b/this.segmentsT*2*Math.PI,e=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);c.x=i.x-e.x;c.y=i.y-e.y;c.z=i.z-e.z;d.x=i.x+e.x;d.y=i.y+e.y;d.z=i.z+e.z;g.cross(c,d);d.cross(g,c);g.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);e.x+=i*d.x+f*g.x;e.y+=i*d.y+f*g.y;e.z+=i*d.z+f*g.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,
 e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var d=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,e=this.grid[a][b],c=this.grid[d][b],d=this.grid[d][g],g=this.grid[a][g],f=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(e,c,d,g));this.faceVertexUvs[0].push([f,i,k,j])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var k,m,l,n=0;n<4;n++){l=i[n];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<l.length;p++)m=h.vertexColors[l[p]-1],k.r+=m.r,k.g+=m.g,k.b+=m.b;k.r/=l.length;k.g/=l.length;k.b/=l.length;j.vertexColors[n]=k}}e.push(j);(!f.supportUVs||o.length!=0)&&g.push([o[a],o[b],o[c],o[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},r={},o=[],l,n,m,q,p,s=a.faceVertexUvs[0];l=0;for(n=s.length;l<n;l++){m=0;for(q=s[l].length;m<q;m++)p=d[l]["abcd".charAt(m)],o[p]||(o[p]=s[l][m])}var t;l=0;for(n=d.length;l<n;l++)if(p=d[l],k.push(p.centroid),i.push(new THREE.Vertex(p.centroid)),f.supportUVs&&o.length!=0){t=new THREE.UV;if(p instanceof THREE.Face3)t.u=o[p.a].u+o[p.b].u+o[p.c].u,t.v=o[p.a].v+o[p.b].v+o[p.c].v,t.u/=3,t.v/=3;else if(p instanceof THREE.Face4)t.u=
-o[p.a].u+o[p.b].u+o[p.c].u+o[p.d].u,t.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,t.u/=4,t.v/=4;o.push(t)}n=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var w=0,s=h.length,y,u,x={},z={},A=function(a,
-b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},F=function(a,b){z[a]===void 0&&(z[a]={});z[a][b]=null};for(l in n){t=n[l];y=l.split("_");u=y[0];y=y[1];A(u,[u,y]);A(y,[u,y]);m=0;for(q=t.length;m<q;m++)p=t[m],F(u,p,l),F(y,p,l);t.length<2&&(r[l]=!0)}for(l in n)if(t=n[l],p=t[0],t=t[1],y=l.split("_"),u=y[0],y=y[1],q=new THREE.Vector3,r[l]?(q.addSelf(h[u].position),q.addSelf(h[y].position),q.multiplyScalar(0.5)):(q.addSelf(k[p]),q.addSelf(k[t]),q.addSelf(h[u].position),q.addSelf(h[y].position),q.multiplyScalar(0.25)),
-j[l]=s+d.length+w,i.push(new THREE.Vertex(q)),w++,f.supportUVs&&o.length!=0)t=new THREE.UV,t.u=o[u].u+o[y].u,t.v=o[u].v+o[y].v,t.u/=2,t.v/=2,o.push(t);var v,D;y=["123","12","2","23"];q=["123","23","3","31"];var A=["123","31","1","12"],F=["1234","12","2","23"],B=["1234","23","3","34"],G=["1234","34","4","41"],I=["1234","41","1","12"];l=0;for(n=k.length;l<n;l++)p=d[l],t=s+l,p instanceof THREE.Face3?(w=c(p.a,p.b),u=c(p.b,p.c),v=c(p.c,p.a),b(t,j[w],p.b,j[u],p,y),b(t,j[u],p.c,j[v],p,q),b(t,j[v],p.a,j[w],
-p,A)):p instanceof THREE.Face4?(w=c(p.a,p.b),u=c(p.b,p.c),v=c(p.c,p.d),D=c(p.d,p.a),b(t,j[w],p.b,j[u],p,F),b(t,j[u],p.c,j[v],p,B),b(t,j[v],p.d,j[D],p,G),b(t,j[D],p.a,j[w],p,I)):console.log("face should be a face!",p);d=i;i=new THREE.Vector3;j=new THREE.Vector3;l=0;for(n=h.length;l<n;l++)if(x[l]!==void 0){i.set(0,0,0);j.set(0,0,0);p=new THREE.Vector3(0,0,0);t=0;for(m in z[l])i.addSelf(k[m]),t++;w=0;s=x[l].length;for(m=0;m<s;m++)r[c(x[l][m][0],x[l][m][1])]&&w++;if(w!=2){i.divideScalar(t);for(m=0;m<
-s;m++)t=x[l][m],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(s);p.addSelf(h[l].position);p.multiplyScalar(s-3);p.addSelf(i);p.addSelf(j.multiplyScalar(2));p.divideScalar(s);d[l].position=p}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var k,n,o,l=0;l<4;l++){o=i[l];k=new THREE.Color;k.setRGB(0,0,0);for(var m=0;m<o.length;m++)n=h.vertexColors[o[m]-1],k.r+=n.r,k.g+=n.g,k.b+=n.b;k.r/=o.length;k.g/=o.length;k.b/=o.length;j.vertexColors[l]=k}}e.push(j);(!f.supportUVs||p.length!=0)&&g.push([p[a],p[b],p[c],p[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},r={},p=[],o,l,n,q,m,s=a.faceVertexUvs[0];o=0;for(l=s.length;o<l;o++){n=0;for(q=s[o].length;n<q;n++)m=d[o]["abcd".charAt(n)],p[m]||(p[m]=s[o][n])}var t;o=0;for(l=d.length;o<l;o++)if(m=d[o],k.push(m.centroid),i.push(new THREE.Vertex(m.centroid)),f.supportUVs&&p.length!=0){t=new THREE.UV;if(m instanceof THREE.Face3)t.u=p[m.a].u+p[m.b].u+p[m.c].u,t.v=p[m.a].v+p[m.b].v+p[m.c].v,t.u/=3,t.v/=3;else if(m instanceof THREE.Face4)t.u=
+p[m.a].u+p[m.b].u+p[m.c].u+p[m.d].u,t.v=p[m.a].v+p[m.b].v+p[m.c].v+p[m.d].v,t.u/=4,t.v/=4;p.push(t)}l=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].push(d)}var d,f,e,g,h={};d=0;for(f=a.faces.length;d<f;d++)e=a.faces[d],e instanceof THREE.Face3?(g=c(e.a,e.b),b(h,g,d),g=c(e.b,e.c),b(h,g,d),g=c(e.c,e.a),b(h,g,d)):e instanceof THREE.Face4&&(g=c(e.a,e.b),b(h,g,d),g=c(e.b,e.c),b(h,g,d),g=c(e.c,e.d),b(h,g,d),g=c(e.d,e.a),b(h,g,d));return h}(a);var w=0,s=h.length,y,u,x={},z={},A=function(a,
+b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},F=function(a,b){z[a]===void 0&&(z[a]={});z[a][b]=null};for(o in l){t=l[o];y=o.split("_");u=y[0];y=y[1];A(u,[u,y]);A(y,[u,y]);n=0;for(q=t.length;n<q;n++)m=t[n],F(u,m,o),F(y,m,o);t.length<2&&(r[o]=!0)}for(o in l)if(t=l[o],m=t[0],t=t[1],y=o.split("_"),u=y[0],y=y[1],q=new THREE.Vector3,r[o]?(q.addSelf(h[u].position),q.addSelf(h[y].position),q.multiplyScalar(0.5)):(q.addSelf(k[m]),q.addSelf(k[t]),q.addSelf(h[u].position),q.addSelf(h[y].position),q.multiplyScalar(0.25)),
+j[o]=s+d.length+w,i.push(new THREE.Vertex(q)),w++,f.supportUVs&&p.length!=0)t=new THREE.UV,t.u=p[u].u+p[y].u,t.v=p[u].v+p[y].v,t.u/=2,t.v/=2,p.push(t);var v,D;y=["123","12","2","23"];q=["123","23","3","31"];var A=["123","31","1","12"],F=["1234","12","2","23"],B=["1234","23","3","34"],G=["1234","34","4","41"],J=["1234","41","1","12"];o=0;for(l=k.length;o<l;o++)m=d[o],t=s+o,m instanceof THREE.Face3?(w=c(m.a,m.b),u=c(m.b,m.c),v=c(m.c,m.a),b(t,j[w],m.b,j[u],m,y),b(t,j[u],m.c,j[v],m,q),b(t,j[v],m.a,j[w],
+m,A)):m instanceof THREE.Face4?(w=c(m.a,m.b),u=c(m.b,m.c),v=c(m.c,m.d),D=c(m.d,m.a),b(t,j[w],m.b,j[u],m,F),b(t,j[u],m.c,j[v],m,B),b(t,j[v],m.d,j[D],m,G),b(t,j[D],m.a,j[w],m,J)):console.log("face should be a face!",m);d=i;i=new THREE.Vector3;j=new THREE.Vector3;o=0;for(l=h.length;o<l;o++)if(x[o]!==void 0){i.set(0,0,0);j.set(0,0,0);m=new THREE.Vector3(0,0,0);t=0;for(n in z[o])i.addSelf(k[n]),t++;w=0;s=x[o].length;for(n=0;n<s;n++)r[c(x[o][n][0],x[o][n][1])]&&w++;if(w!=2){i.divideScalar(t);for(n=0;n<
+s;n++)t=x[o][n],t=h[t[0]].position.clone().addSelf(h[t[1]].position).divideScalar(2),j.addSelf(t);j.divideScalar(s);m.addSelf(h[o].position);m.multiplyScalar(s-3);m.addSelf(i);m.addSelf(j.multiplyScalar(2));m.divideScalar(s);d[o].position=m}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
 THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
-a}function d(a,b){var d=new Image;d.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=b;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,b,d)}else a.image=this;a.needsUpdate=!0};d.src=b}function e(a,c,f,e,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=f;if(e){a[c].repeat.set(e[0],e[1]);if(e[0]!=1)a[c].wrapS=THREE.RepeatWrapping;
-if(e[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[h[0]]!==void 0)a[c].wrapS=e[h[0]];if(e[h[1]]!==void 0)a[c].wrapT=e[h[1]]}d(a[c],b+"/"+f)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,h,i;h="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
-if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=g(a.colorDiffuse);
-else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=g(a.colorSpecular);if(a.colorAmbient)f.ambient=g(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&b&&e(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&b&&e(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var k=THREE.ShaderUtils.lib.normal,j=THREE.UniformsUtils.clone(k.uniforms),r=f.color;h=f.specular;i=f.ambient;var o=f.shininess;j.tNormal.texture=f.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(f.map)j.tDiffuse.texture=f.map,j.enableDiffuse.value=!0;if(f.specularMap)j.tSpecular.texture=f.specularMap,j.enableSpecular.value=!0;if(f.lightMap)j.tAO.texture=
-f.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(r);j.uSpecularColor.value.setHex(h);j.uAmbientColor.value.setHex(i);j.uShininess.value=o;if(f.opacity)j.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:j,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
-THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,b,c,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,b=d.callback,c=d.texture_path,d=d.bin_path;var c=c?c:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
+a}function d(a,b){var d=new Image;d.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=b;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,b,d)}else a.image=this;a.needsUpdate=!0};d.crossOrigin="";d.src=b}function e(a,c,f,e,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=f;if(e){a[c].repeat.set(e[0],e[1]);if(e[0]!=1)a[c].wrapS=
+THREE.RepeatWrapping;if(e[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[h[0]]!==void 0)a[c].wrapS=e[h[0]];if(e[h[1]]!==void 0)a[c].wrapT=e[h[1]]}d(a[c],b+"/"+f)}function g(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,h,i;h="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading==
+"Basic"&&(h="MeshBasicMaterial"));if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;
+if(a.colorDiffuse)f.color=g(a.colorDiffuse);else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=g(a.colorSpecular);if(a.colorAmbient)f.ambient=g(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&b&&e(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&e(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&e(f,"normalMap",a.mapNormal,a.mapNormalRepeat,
+a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&e(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var k=THREE.ShaderUtils.lib.normal,j=THREE.UniformsUtils.clone(k.uniforms),r=f.color;h=f.specular;i=f.ambient;var p=f.shininess;j.tNormal.texture=f.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(f.map)j.tDiffuse.texture=f.map,j.enableDiffuse.value=!0;if(f.specularMap)j.tSpecular.texture=f.specularMap,j.enableSpecular.value=
+!0;if(f.lightMap)j.tAO.texture=f.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(r);j.uSpecularColor.value.setHex(h);j.uAmbientColor.value.setHex(i);j.uShininess.value=p;if(f.opacity)j.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:j,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;
+THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
+THREE.BinaryLoader.prototype.load=function(a,b,c,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,b=d.callback,c=d.texture_path,d=d.bin_path;var c=c?c:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,g){var f=new XMLHttpRequest;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(h,c,e,d,g)}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+
 f.status+"]")};f.open("GET",b,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var g=new XMLHttpRequest,f=c+"/"+a.buffers,h=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("Couldn't load ["+f+"] ["+g.status+"]"):g.readyState==3?e&&(h==0&&(h=g.getResponseHeader("Content-Length")),e({total:h,loaded:g.responseText.length})):g.readyState==2&&(h=g.getResponseHeader("Content-Length"))};g.open("GET",f,!0);
 g.responseType="arraybuffer";g.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function k(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=t[e*2];e=t[e*2+1];i=t[f*2];j=t[f*2+1];f=t[g*2];k=t[g*2+1];g=m.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,j));n.push(new THREE.UV(f,k));g.push(n)}}
-function j(b,c){var d,e,f,g,h,i,j,k,l,n,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];f=p[d*4+1];g=p[d*4+2];h=p[d*4+3];i=t[e*2];e=t[e*2+1];j=t[f*2];l=t[f*2+1];k=t[g*2];n=t[g*2+1];g=t[h*2];f=t[h*2+1];h=m.faceVertexUvs[0];var o=[];o.push(new THREE.UV(i,e));o.push(new THREE.UV(j,l));o.push(new THREE.UV(k,n));o.push(new THREE.UV(g,f));h.push(o)}}function r(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],m.faces.push(new THREE.Face3(e,
-f,g,null,null,h))}function o(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],m.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function l(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=n[e];var p=s[k*3],o=s[k*3+1];k=s[k*3+2];var q=s[l*3],r=s[l*3+1];l=s[l*3+2];m.faces.push(new THREE.Face3(f,
-g,h,[new THREE.Vector3(s[j*3],s[j*3+1],s[j*3+2]),new THREE.Vector3(p,o,k),new THREE.Vector3(q,r,l)],null,i))}}function n(b,c,d,e){for(var f,g,h,i,j,k,l,n,p,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[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];n=d[e*4+2];p=d[e*4+3];j=o[e];var q=s[l*3],r=s[l*3+1];l=s[l*3+2];var t=s[n*3],u=s[n*3+1];n=s[n*3+2];var w=s[p*3],x=s[p*3+1];p=s[p*3+2];m.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(s[k*
-3],s[k*3+1],s[k*3+2]),new THREE.Vector3(q,r,l),new THREE.Vector3(t,u,n),new THREE.Vector3(w,x,p)],null,j))}}var m=this,q=0,p,s=[],t=[],w,y,u,x,z,A;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(m,d,b);p={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,q,12),header_bytes:e(a,q+12),vertex_coordinate_bytes:e(a,q+13),normal_coordinate_bytes:e(a,q+14),uv_coordinate_bytes:e(a,q+15),vertex_index_bytes:e(a,q+16),normal_index_bytes:e(a,
-q+17),uv_index_bytes:e(a,q+18),material_index_bytes:e(a,q+19),nvertices:i(a,q+20),nnormals:i(a,q+20+4),nuvs:i(a,q+20+8),ntri_flat:i(a,q+20+12),ntri_smooth:i(a,q+20+16),ntri_flat_uv:i(a,q+20+20),ntri_smooth_uv:i(a,q+20+24),nquad_flat:i(a,q+20+28),nquad_smooth:i(a,q+20+32),nquad_flat_uv:i(a,q+20+36),nquad_smooth_uv:i(a,q+20+40)};p.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");q+=p.header_bytes;b=p.vertex_index_bytes*3+p.material_index_bytes;A=p.vertex_index_bytes*
-4+p.material_index_bytes;w=p.ntri_flat*b;y=p.ntri_smooth*(b+p.normal_index_bytes*3);u=p.ntri_flat_uv*(b+p.uv_index_bytes*3);x=p.ntri_smooth_uv*(b+p.normal_index_bytes*3+p.uv_index_bytes*3);z=p.nquad_flat*A;b=p.nquad_smooth*(A+p.normal_index_bytes*4);A=p.nquad_flat_uv*(A+p.uv_index_bytes*4);q+=function(b){var c=p.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],m.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(q);
-q+=function(b){var c=p.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],s.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(q);q+=c(p.nnormals*3);q+=function(b){var c=p.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],t.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(q);w=q+w+c(p.ntri_flat*2);y=w+y+c(p.ntri_smooth*2);u=y+u+c(p.ntri_flat_uv*2);x=u+x+c(p.ntri_smooth_uv*2);z=x+z+c(p.nquad_flat*2);
-b=z+b+c(p.nquad_smooth*2);A=b+A+c(p.nquad_flat_uv*2);(function(a){var b=p.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;r(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,c)}})(y);(function(a){var b=p.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;l(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,d)}})(u);(function(a){var b=p.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
-c)}})(b);(function(a){var b=p.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;n(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(A);(function(a){var b=p.ntri_flat;b&&r(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(q);(function(a){var b=p.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;l(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(w);(function(a){var b=p.nquad_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(x);(function(a){var b=
-p.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;n(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(z);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
-THREE.ColladaLoader=function(){function a(a,d,e){P=a;d=d||ca;e!==void 0&&(a=e.split("/"),a.pop(),da=a.length<1?"":a.join("/")+"/");Z=b("//dae:library_images/dae:image",f,"image");$=b("//dae:library_materials/dae:material",z,"material");aa=b("//dae:library_effects/dae:effect",B,"effect");S=b("//dae:library_geometries/dae:geometry",q,"geometry");R=b("//dae:library_controllers/dae:controller",h,"controller");U=b("//dae:library_animations/dae:animation",I,"animation");ba=b(".//dae:library_visual_scenes/dae:visual_scene",
-j,"visual_scene");W=[];X=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),T=ba[a]):T=null;Y=new THREE.Object3D;for(a=0;a<T.nodes.length;a++)Y.add(g(T.nodes[a]));c();for(var i in U);i={scene:Y,morphs:W,skins:X,dae:{images:Z,materials:$,effects:aa,geometries:S,controllers:R,animations:U,visualScenes:ba,scene:T}};d&&d(i);return i}function b(a,b,c){for(var a=P.evaluate(a,P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(){var a=1E6,b=-a,c=0,d;for(d in U)for(var e=U[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof
-THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function e(a,b,e){var f=R[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=c(),b=T.getChildById(b.skeleton[0],!0)||T.getChildBySid(b.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
-for(e=0;e<g.frames;e++){var n=[],p=[];for(h=0;h<a.vertices.length;h++)p.push(new THREE.Vertex(new THREE.Vector3));d(b,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var o=0;o<i.joints.length;o++)if(j.sid==i.joints[o]){m=o;break}if(m>=0){o=i.invBindMatrices[m];j.invBindMatrix=o;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,o);j.weights=[];for(o=0;o<i.weights.length;o++)for(var q=0;q<i.weights[o].length;q++){var r=i.weights[o][q];r.joint==m&&j.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
-j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=p[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:p})}}}function g(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=R[a.controllers[f].url];switch(i.type){case "skin":if(S[i.skin.source]){var j=
-new m;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(R[i.skin.source]&&(d=i=R[i.skin.source],i.morph&&S[i.morph.source]))j=new m,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(S[i.morph.source])j=new m,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
-0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=S[i.url],k={},n=0,p;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var o=aa[$[p.target].instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;p=k[p.symbol]=o.material;n++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(n>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)n=
-i.faces[h],n.materials=[k[n.daeMaterial]]}if(c!==void 0)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=R[c.url],j.skinInstanceController=c,j.name="skin_"+X.length,X.push(j);else if(d!==void 0){h=i;k=d instanceof l?R[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(n=0;n<k.targets.length;n++)if(o=S[k.targets[n]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===
-h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+W.length;W.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(f=0;f<a.nodes.length;f++)b.add(g(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
-null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function r(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function l(){this.url=
-"";this.skeleton=[];this.instance_material=[]}function n(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function p(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";this.stride=this.count=0;this.params=[]}function y(){this.input={}}function u(){this.semantic=
-"";this.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function z(){this.name=this.id="";this.instance_effect=null}function A(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function F(a,b){this.type=a;this.effect=b;this.material=null}function v(a){this.effect=a;this.format=this.init_from=null}function D(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
-this.source=null}function B(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function G(){this.url=""}function I(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function E(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function K(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function O(a){var b=a.getAttribute("id");
-if(V[b]!=void 0)return V[b];V[b]=(new x(b)).parse(a);return V[b]}function C(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function L(a){for(var a=M(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=M(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function M(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function J(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function N(a,
-b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function Q(a,b){var c="";c+=N(a.x,b)+",";c+=N(a.y,b)+",";c+=N(a.z,b);return c}var P=null,Y=null,T,ca=null,V={},Z={},U={},R={},S={},$={},aa={},ba,da,W,X,ea=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
-c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
-0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new x).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new u).parse(d))}}return b};
-k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=L(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new x).parse(f);b[f.id]=f;break;case "joints":c=
-f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new u).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=
-a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new u).parse(g));break;case "v":c=H(g.textContent);break;case "vcount":d=H(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var n=e[l],m=c[g+n.offset];switch(n.semantic){case "JOINT":k.joint=m;break;case "WEIGHT":k.weight=b[n.source].data[m]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.prototype.getChildById=function(a,b){for(var c=
-0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new r).parse(c))}}return this};r.prototype.getChannelForTransform=
-function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};r.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
-b);if(d)return d}return null};r.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};r.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};r.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
-this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new r).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new l).parse(b));break;case "instance_geometry":this.geometries.push((new m).parse(b));break;case "instance_light":break;case "instance_node":b=
-b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new r).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in U)for(var e=U[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
-if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=
-this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};r.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
-this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=L(a.textContent);this.updateMatrix();return this};o.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
-case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};l.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=P.evaluate(".//dae:instance_material",c,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new n).parse(d)),d=c.iterateNext()}}return this};n.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};m.prototype.parse=function(a){this.url=
-a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=P.evaluate(".//dae:instance_material",c,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new n).parse(b)),b=a.iterateNext();break}}return this};q.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
-(new p(this)).parse(c)}}return this};p.prototype.parse=function(a){function b(a,c){var d=Q(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":O(d);break;case "vertices":this.vertices=(new y).parse(d);break;case "triangles":this.primitives.push((new t).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new s).parse(d))}}var e=
-{};this.geometry3js=new THREE.Geometry;d=V[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
-return this};p.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,n=0,m=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],q=[],r={},s=[];a.vcount&&(m=a.vcount[n++]);for(e=0;e<m;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=V[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=Q(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],
-l.data[k+1],l.data[k+2]));break;case "TEXCOORD":r[i.set]===void 0&&(r[i.set]=[]);r[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;m==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],s.length?s:new THREE.Color):m==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],s.length?s:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=r[o[f]],b.faceVertexUvs[f].push([e[0],
-e[1],e[2]]);d+=h.length*m}};s.prototype=new t;s.prototype.constructor=s;t.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};t.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=J(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new u).parse(a.childNodes[b]));break;case "vcount":this.vcount=
-H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=J(a,"count",0);this.stride=J(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};y.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
-"input"){var c=(new u).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};u.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=J(a,"set",-1);this.offset=J(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};x.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=M(c.textContent).split(/\s+/),
-e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=L(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=H(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=M(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new w).parse(c.childNodes[d]);break}}}return this};
-x.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};z.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new G).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return this.texture==null};A.prototype.isTexture=function(){return this.texture!=null};A.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=L(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
-c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new A).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",c,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};F.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=Z[this.effect.surface.init_from]))a.map=
-THREE.ImageUtils.loadTexture(da+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ea;return this.material=new THREE.MeshLambertMaterial(a)};v.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};D.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
-c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};B.prototype.create=function(){if(this.shader==null)return null};B.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
-B.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new v(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new D(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};B.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
-break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};B.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new F(c.nodeName,this)).parse(c)}}};G.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};I.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new x).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new K(this)).parse(c));break;case "channel":this.channel.push((new E(this)).parse(c))}}return this};E.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
-b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};K.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new u).parse(c))}}return this};
-K.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
-Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==
-200))ca=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ea=a},applySkin:e,geometries:S}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){function c(a){return a%4?4-a%4:0}function e(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function k(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=t[e*2];e=t[e*2+1];i=t[f*2];j=t[f*2+1];f=t[g*2];k=t[g*2+1];g=n.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,j));m.push(new THREE.UV(f,k));g.push(m)}}
+function j(b,c){var d,e,f,g,h,i,j,k,l,m,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];f=p[d*4+1];g=p[d*4+2];h=p[d*4+3];i=t[e*2];e=t[e*2+1];j=t[f*2];l=t[f*2+1];k=t[g*2];m=t[g*2+1];g=t[h*2];f=t[h*2+1];h=n.faceVertexUvs[0];var 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 r(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],n.faces.push(new THREE.Face3(e,
+f,g,null,null,h))}function p(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],n.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function o(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=m[e];var o=s[k*3],p=s[k*3+1];k=s[k*3+2];var q=s[l*3],r=s[l*3+1];l=s[l*3+2];n.faces.push(new THREE.Face3(f,
+g,h,[new THREE.Vector3(s[j*3],s[j*3+1],s[j*3+2]),new THREE.Vector3(o,p,k),new THREE.Vector3(q,r,l)],null,i))}}function l(b,c,d,e){for(var f,g,h,i,j,k,l,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];m=d[e*4+2];o=d[e*4+3];j=p[e];var q=s[l*3],r=s[l*3+1];l=s[l*3+2];var t=s[m*3],u=s[m*3+1];m=s[m*3+2];var w=s[o*3],x=s[o*3+1];o=s[o*3+2];n.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(s[k*
+3],s[k*3+1],s[k*3+2]),new THREE.Vector3(q,r,l),new THREE.Vector3(t,u,m),new THREE.Vector3(w,x,o)],null,j))}}var n=this,q=0,m,s=[],t=[],w,y,u,x,z,A;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);m={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,q,12),header_bytes:e(a,q+12),vertex_coordinate_bytes:e(a,q+13),normal_coordinate_bytes:e(a,q+14),uv_coordinate_bytes:e(a,q+15),vertex_index_bytes:e(a,q+16),normal_index_bytes:e(a,
+q+17),uv_index_bytes:e(a,q+18),material_index_bytes:e(a,q+19),nvertices:i(a,q+20),nnormals:i(a,q+20+4),nuvs:i(a,q+20+8),ntri_flat:i(a,q+20+12),ntri_smooth:i(a,q+20+16),ntri_flat_uv:i(a,q+20+20),ntri_smooth_uv:i(a,q+20+24),nquad_flat:i(a,q+20+28),nquad_smooth:i(a,q+20+32),nquad_flat_uv:i(a,q+20+36),nquad_smooth_uv:i(a,q+20+40)};m.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");q+=m.header_bytes;b=m.vertex_index_bytes*3+m.material_index_bytes;A=m.vertex_index_bytes*
+4+m.material_index_bytes;w=m.ntri_flat*b;y=m.ntri_smooth*(b+m.normal_index_bytes*3);u=m.ntri_flat_uv*(b+m.uv_index_bytes*3);x=m.ntri_smooth_uv*(b+m.normal_index_bytes*3+m.uv_index_bytes*3);z=m.nquad_flat*A;b=m.nquad_smooth*(A+m.normal_index_bytes*4);A=m.nquad_flat_uv*(A+m.uv_index_bytes*4);q+=function(b){var c=m.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],n.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(q);
+q+=function(b){var c=m.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],s.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(q);q+=c(m.nnormals*3);q+=function(b){var c=m.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],t.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(q);w=q+w+c(m.ntri_flat*2);y=w+y+c(m.ntri_smooth*2);u=y+u+c(m.ntri_flat_uv*2);x=u+x+c(m.ntri_smooth_uv*2);z=x+z+c(m.nquad_flat*2);
+b=z+b+c(m.nquad_smooth*2);A=b+A+c(m.nquad_flat_uv*2);(function(a){var b=m.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;r(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,c)}})(y);(function(a){var b=m.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;o(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);k(b,d)}})(u);(function(a){var b=m.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;p(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,
+c)}})(b);(function(a){var b=m.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;l(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);j(b,d)}})(A);(function(a){var b=m.ntri_flat;b&&r(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(q);(function(a){var b=m.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;o(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(w);(function(a){var b=m.nquad_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(x);(function(a){var b=
+m.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;l(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(z);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
+THREE.ColladaLoader=function(){function a(a,d,e){P=a;d=d||ia;e!==void 0&&(a=e.split("/"),a.pop(),ja=a.length<1?"":a.join("/")+"/");if((a=P.evaluate("//dae:asset",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.children)for(e=0;e<a.children.length;e++){var i=a.children[e];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":Z=i.textContent.charAt(0)}}if(!Q.convertUpAxis||Z===Q.upAxis)U=null;else switch(Z){case "X":U=Q.upAxis==="Y"?"XtoY":
+"XtoZ";break;case "Y":U=Q.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":U=Q.upAxis==="X"?"ZtoX":"ZtoY"}ca=b("//dae:library_images/dae:image",f,"image");da=b("//dae:library_materials/dae:material",z,"material");ea=b("//dae:library_effects/dae:effect",B,"effect");V=b("//dae:library_geometries/dae:geometry",q,"geometry");T=b("//dae:library_controllers/dae:controller",h,"controller");W=b("//dae:library_animations/dae:animation",J,"animation");fa=b(".//dae:library_visual_scenes/dae:visual_scene",j,"visual_scene");
+$=[];aa=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=fa[a]):S=null;X=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)X.add(g(S.nodes[a]));ga=[];c(X);a={scene:X,morphs:$,skins:aa,animations:ga,dae:{images:ca,materials:da,effects:ea,geometries:V,controllers:T,animations:W,visualScenes:fa,scene:S}};d&&d(a);return a}function b(a,b,c){for(var a=P.evaluate(a,P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=S.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};ga.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=T[b.url];if(!e||!e.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");
+else{var f,c=1E6,g=-c,h=0;for(f in W)for(var i=W[f],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}f={start:c,end:g,frames:h};for(var b=S.getChildById(b.skeleton[0],!0)||S.getChildBySid(b.skeleton[0],!0),l,n,g=new THREE.Vector3,m,j=0;j<a.vertices.length;j++)e.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);for(c=0;c<f.frames;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));
+d(b,h,c);j=h;k=e.skin;for(n=0;n<j.length;n++)if(l=j[n],m=-1,l.type=="JOINT"){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){m=o;break}if(m>=0){o=k.invBindMatrices[m];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==m&&l.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+l.sid+"'.";}for(j=0;j<h.length;j++)if(h[j].type==
+"JOINT")for(k=0;k<h[j].weights.length;k++)l=h[j].weights[k],n=l.index,l=l.weight,m=a.vertices[n],n=i[n],g.x=m.position.x,g.y=m.position.y,g.z=m.position.z,h[j].skinningMatrix.multiplyVector3(g),n.position.x+=g.x*l,n.position.y+=g.y*l,n.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function g(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=T[a.controllers[f].url];switch(i.type){case "skin":if(V[i.skin.source]){var j=new n;j.url=i.skin.source;j.instance_material=
+a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(T[i.skin.source]&&(d=i=T[i.skin.source],i.morph&&V[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(V[i.morph.source])j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var i=
+a.geometries[f],j=i.instance_material,i=V[i.url],k={},l=[],m=0,p;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var q=ea[da[p.target].instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=m;l.push(q.material);p=q.material;m++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(m>1){j=new THREE.MeshFaceMaterial;i.materials=l;for(h=0;h<i.faces.length;h++)l=
+i.faces[h],l.materialIndex=k[l.daeMaterial]}if(c!==void 0)e(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=T[c.url],j.skinInstanceController=c,j.name="skin_"+aa.length,aa.push(j);else if(d!==void 0){h=i;k=d instanceof o?T[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(m=V[k.targets[l]],m.mesh&&m.mesh.primitives&&m.mesh.primitives.length)m=m.mesh.primitives[0].geometry,m.vertices.length===
+h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:m.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+$.length;$.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";b.matrix=a.matrix;c=a.matrix.decompose();b.position=c[0];b.quaternion=c[1];b.useQuaternion=!0;b.scale=c[2];for(f=0;f<a.nodes.length;f++)b.add(g(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=
+this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function r(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=this.sid="";this.data=
+[];this.obj=null}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function l(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function q(){this.id="";this.mesh=null}function m(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){}function t(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";this.stride=this.count=0;this.params=[]}
+function y(){this.input={}}function u(){this.semantic="";this.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function z(){this.name=this.id="";this.instance_effect=null}function A(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function F(a,b){this.type=a;this.effect=b;this.material=null}function v(a){this.effect=a;this.format=this.init_from=null}function D(a){this.effect=
+a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function B(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function G(){this.url=""}function J(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function E(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function L(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=
+this.strideOut=this.output=this.input=null;this.duration=0}function O(a){this.targets=[];this.time=a}function C(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function M(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function N(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function K(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),
+10):c}function I(a,b){if(Q.convertUpAxis&&Z!==Q.upAxis)switch(U){case "XtoY":var c=a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function R(a,b){var c=[a[b],a[b+1],a[b+2]];I(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ba(a){if(Q.convertUpAxis){var b=[a[0],a[4],a[8]];I(b,-1);
+a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];I(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];I(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];I(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];I(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];I(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];I(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var P=null,
+X=null,S,ia=null,Y={},ca={},W={},T={},V={},da={},ea={},ga,fa,ja,$,aa,ka=THREE.SmoothShading,Q={convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Z="Y",U=null,ha=Math.PI/180;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=
+a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new x).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=
+0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new u).parse(d))}}return b};k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=
+0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=M(f.textContent);this.bindShapeMatrix=ba(f);break;case "source":f=(new x).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=
+(new u).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new u).parse(g));break;case "v":c=H(g.textContent);break;case "vcount":d=H(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=
+e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.prototype.parse=function(a){this.id=
+a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new r).parse(c))}}return this};r.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();
+for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};r.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};r.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};r.prototype.getTransformBySid=
+function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};r.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==
+1)switch(b.nodeName){case "node":this.nodes.push((new r).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new o).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new r).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));
+break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in W)for(var e=W[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(Q.convertUpAxis)switch(g){case "X":switch(U){case "XtoY":case "XtoZ":case "YtoX":g=
+"Y";break;case "ZtoX":g="Z"}break;case "Y":switch(U){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(U){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(var k=i.length;b<k;b++){var l=i[b],m=h.getData(j.type,b),q;q=null;for(var s=0,t=d.length;s<t&&q==null;s++){var u=d[s];if(u.time===l)q=u;else if(u.time>l)break}if(!q){q=
+new O(l);s=-1;t=0;for(u=d.length;t<u&&s==-1;t++)d[t].time>=l&&(s=t);l=s;d.splice(l==-1?d.length:l,0,q)}q.addTarget(f,j,g,m)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(q=d[b],!q.hasTarget(e)){h=d;f=q;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=i>=0?i:i+h.length;i>=0;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-
+i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;m=void 0;if(k.length){m=[];for(l=0;l<k.length;++l)m[l]=k[l]+(j[l]-k[l])*h}else m=k+(j-k)*h;f.addTarget(g,i.transform,i.member,m)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};r.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=M(a.textContent);this.convert();
+return this};p.prototype.convert=function(){switch(this.type){case "matrix":this.obj=ba(this.data);break;case "rotate":this.angle=this.data[3]*ha;case "translate":I(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":I(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};p.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)}};p.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=
+a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*ha;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*ha}}};o.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=P.evaluate(".//dae:instance_material",
+c,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new l).parse(d)),d=c.iterateNext()}}return this};l.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=
+P.evaluate(".//dae:instance_material",c,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new l).parse(b)),b=a.iterateNext();break}}return this};q.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new m(this)).parse(c)}}return this};m.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+switch(c.nodeName){case "source":var d=c.getAttribute("id");Y[d]==void 0&&(Y[d]=(new x(d)).parse(c));break;case "vertices":this.vertices=(new y).parse(c);break;case "triangles":this.primitives.push((new t).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new s).parse(c))}}this.geometry3js=new THREE.Geometry;a=Y[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(R(a,
+b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};m.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,l=0,m=3,n=[];for(d=0;d<g.length;d++)switch(h=g[d],h.semantic){case "TEXCOORD":n.push(h.set)}for(;c<f.length;){var o=[],p=[],
+q={},r=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=Y[h.source],i=f[c+d*g.length+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":o.push(i);break;case "NORMAL":p.push(R(k.data,j));break;case "TEXCOORD":q[h.set]===void 0&&(q[h.set]=[]);q[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(m===3)d.push(new THREE.Face3(o[0],o[1],o[2],[p[0],p[1],
+p[2]],r.length?r:new THREE.Color));else if(m===4)d.push(new THREE.Face4(o[0],o[1],o[2],o[3],[p[0],p[1],p[2],p[3]],r.length?r:new THREE.Color));else if(m>4&&Q.subdivideFaces){r=r.length?r:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(o[0],o[e],o[e+1],[p[0],p[e++],p[e]],r))}if(d.length){o=0;for(p=d.length;o<p;o++){e=d[o];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<n.length;e++)r=q[n[e]],r=m>4?[r[0],r[o+1],r[o+2]]:m===4?[r[0],r[1],r[2],r[3]]:[r[0],r[1],r[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=
+[]),b.faceVertexUvs[e].push(r)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=g.length*m}};s.prototype=new t;s.prototype.constructor=s;t.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};t.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=K(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new u).parse(a.childNodes[b]));
+break;case "vcount":this.vcount=H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=K(a,"count",0);this.stride=K(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};y.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
+"input"){var c=(new u).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};u.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=K(a,"set",-1);this.offset=K(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};x.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=N(c.textContent).split(/\s+/),
+e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=M(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=H(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=N(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new w).parse(c.childNodes[d]);break}}}return this};
+x.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),c=ba(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};z.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
+"instance_effect"){this.instance_effect=(new G).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return this.texture==null};A.prototype.isTexture=function(){return this.texture!=null};A.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=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.children)return this;a.children[0]&&a.children[0].nodeName==="extra"&&(a=a.children[0],a.children[0]&&a.children[0].nodeName==="technique"&&(a=a.children[0]));for(var b=0;b<a.children.length;b++){var c=a.children[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=
+parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new A).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",
+c,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};F.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==
+this.effect.surface.sid){var e=ca[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(ja+e.init_from),e.wrapS=d.texOpts.wrapU,e.wrapT=d.texOpts.wrapV,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ka;return this.material=
+new THREE.MeshLambertMaterial(a)};v.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};D.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;
+case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};B.prototype.create=function(){if(this.shader==null)return null};B.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=
+0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};B.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new v(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new D(this)).parse(d);this.sampler.sid=b;break;case "extra":break;
+default:console.log(d.nodeName)}}};B.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};B.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=
+(new F(c.nodeName,this)).parse(c)}}};G.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new x).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new L(this)).parse(c));break;case "channel":this.channel.push((new E(this)).parse(c))}}return this};
+E.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0;if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};L.prototype.parse=function(a){this.id=
+a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new u).parse(c))}}return this};L.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;
+case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};L.prototype.getData=function(a,b){var c;if(this.strideOut>1){c=[];b*=this.strideOut;for(var d=0;d<this.strideOut;++d)c[d]=this.output[b+
+d];if(this.strideOut===3)switch(a){case "rotate":case "translate":I(c,-1);break;case "scale":I(c,1)}}else c=this.output[b];return c};O.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,member:c,transform:b,data:d})};O.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};O.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};
+O.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};O.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(a.time-this.time),g=e.data,h=d.data;if(f<0||f>1)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=f<0?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,
+d.member)}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==200))d.responseXML?(ia=c,a(d.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ka=a},applySkin:e,
+geometries:V,options:Q}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
-THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0)try{var h=JSON.parse(g.responseText);a.createModel(h,c,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+g.status+"]");else g.readyState==3?e&&(f==0&&(f=g.getResponseHeader("Content-Length")),e({total:f,loaded:g.responseText.length})):
+THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){try{var h=JSON.parse(g.responseText)}catch(i){console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}a.createModel(h,c,d);a.onLoadComplete()}else console.error("Couldn't load ["+b+"] ["+g.status+"]");else g.readyState==3?e&&(f==0&&(f=g.getResponseHeader("Content-Length")),e({total:f,loaded:g.responseText.length})):
 g.readyState==2&&(f=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,k,j,r,o,l,n,m,q,p,s,t,w=a.faces;r=a.vertices;var y=a.normals,u=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=r.length;k<
-j;)o=new THREE.Vertex,o.position.x=r[k++]*b,o.position.y=r[k++]*b,o.position.z=r[k++]*b,d.vertices.push(o);k=0;for(j=w.length;k<j;){b=w[k++];r=b&1;i=b&2;c=b&4;e=b&8;l=b&16;o=b&32;m=b&64;b&=128;r?(q=new THREE.Face4,q.a=w[k++],q.b=w[k++],q.c=w[k++],q.d=w[k++],r=4):(q=new THREE.Face3,q.a=w[k++],q.b=w[k++],q.c=w[k++],r=3);if(i)i=w[k++],q.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)p=a.uvs[c],n=w[k++],t=p[n*2],n=p[n*2+1],d.faceUvs[c][i]=new THREE.UV(t,n);if(e)for(c=0;c<x;c++){p=a.uvs[c];s=[];
-for(e=0;e<r;e++)n=w[k++],t=p[n*2],n=p[n*2+1],s[e]=new THREE.UV(t,n);d.faceVertexUvs[c][i]=s}if(l)l=w[k++]*3,e=new THREE.Vector3,e.x=y[l++],e.y=y[l++],e.z=y[l],q.normal=e;if(o)for(c=0;c<r;c++)l=w[k++]*3,e=new THREE.Vector3,e.x=y[l++],e.y=y[l++],e.z=y[l],q.vertexNormals.push(e);if(m)o=w[k++],o=new THREE.Color(u[o]),q.color=o;if(b)for(c=0;c<r;c++)o=w[k++],o=new THREE.Color(u[o]),q.vertexColors.push(o);d.faces.push(q)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
-2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,k,j,r,o,l,n;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];l=d.morphTargets[c].vertices;
-n=a.morphTargets[c].vertices;i=0;for(k=n.length;i<k;i+=3)j=n[i]*b,r=n[i+1]*b,o=n[i+2]*b,l.push(new THREE.Vertex(new THREE.Vector3(j,r,o)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;j=a.morphColors[c].colors;b=0;for(i=j.length;b<i;b+=3)r=new THREE.Color(16755200),r.setRGB(j[b],j[b+1],j[b+2]),k.push(r)}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,k,j,r,p,o,l,n,q,m,s,t,w=a.faces;r=a.vertices;var y=a.normals,u=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=r.length;k<
+j;)p=new THREE.Vertex,p.position.x=r[k++]*b,p.position.y=r[k++]*b,p.position.z=r[k++]*b,d.vertices.push(p);k=0;for(j=w.length;k<j;){b=w[k++];r=b&1;i=b&2;c=b&4;e=b&8;o=b&16;p=b&32;n=b&64;b&=128;r?(q=new THREE.Face4,q.a=w[k++],q.b=w[k++],q.c=w[k++],q.d=w[k++],r=4):(q=new THREE.Face3,q.a=w[k++],q.b=w[k++],q.c=w[k++],r=3);if(i)i=w[k++],q.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)m=a.uvs[c],l=w[k++],t=m[l*2],l=m[l*2+1],d.faceUvs[c][i]=new THREE.UV(t,l);if(e)for(c=0;c<x;c++){m=a.uvs[c];s=[];
+for(e=0;e<r;e++)l=w[k++],t=m[l*2],l=m[l*2+1],s[e]=new THREE.UV(t,l);d.faceVertexUvs[c][i]=s}if(o)o=w[k++]*3,e=new THREE.Vector3,e.x=y[o++],e.y=y[o++],e.z=y[o],q.normal=e;if(p)for(c=0;c<r;c++)o=w[k++]*3,e=new THREE.Vector3,e.x=y[o++],e.y=y[o++],e.z=y[o],q.vertexNormals.push(e);if(n)p=w[k++],p=new THREE.Color(u[p]),q.color=p;if(b)for(c=0;c<r;c++)p=w[k++],p=new THREE.Color(u[p]),q.vertexColors.push(p);d.faces.push(q)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
+2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,k,j,r,p,o,l;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;
+l=a.morphTargets[c].vertices;i=0;for(k=l.length;i<k;i+=3)j=l[i]*b,r=l[i+1]*b,p=l[i+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(j,r,p)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;j=a.morphColors[c].colors;b=0;for(i=j.length;b<i;b+=3)r=new THREE.Color(16755200),r.setRGB(j[b],j[b+1],j[b+2]),k.push(r)}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
 d.computeTangents();b(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var e=JSON.parse(d.responseText);e.metadata===void 0||e.metadata.formatVersion===void 0||e.metadata.formatVersion!==3?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(g){console.error(g),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
 d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(o in B.objects)if(!C.objects[o])if(p=B.objects[o],p.geometry!==void 0){if(A=C.geometries[p.geometry]){a=!1;for(H=0;H<p.materials.length;H++)D=C.materials[p.materials[H]],a=D instanceof THREE.ShaderMaterial;a&&A.computeTangents();w=p.position;y=p.rotation;u=p.quaternion;x=p.scale;u=0;D.length==0&&(D=new THREE.MeshFaceMaterial);D.length>1&&(D=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(A,D);a.name=o;a.position.set(w[0],w[1],w[2]);u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]);a.scale.set(x[0],x[1],x[2]);a.visible=p.visible;C.scene.add(a);C.objects[o]=a;if(p.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(p.castsShadow)b=new THREE.ShadowVolume(A),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;p.trigger&&p.trigger.toLowerCase()!="none"&&(b=
-{type:p.trigger,object:p},C.triggers[a.name]=b)}}else w=p.position,y=p.rotation,u=p.quaternion,x=p.scale,u=0,a=new THREE.Object3D,a.name=o,a.position.set(w[0],w[1],w[2]),u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]),a.scale.set(x[0],x[1],x[2]),a.visible=p.visible!==void 0?p.visible:!1,C.scene.add(a),C.objects[o]=a,C.empties[o]=a,p.trigger&&p.trigger.toLowerCase()!="none"&&(b={type:p.trigger,object:p},C.triggers[a.name]=b)}function g(a){return function(b){C.geometries[a]=
-b;e();I-=1;i.onLoadComplete();h()}}function f(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:K,totalTextures:O,loadedModels:K-I,loadedTextures:O-E},C);i.onLoadProgress();I==0&&E==0&&b(C)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),j,r,o,l,n,m,q,p,s,t,w,y,u,x,z,A,F,v,D,B,G,I,E,K,O,C;B=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;E=I=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
-empties:{}};a=!1;for(o in B.objects)if(p=B.objects[o],p.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(B.transform){a=B.transform.position;s=B.transform.rotation;var L=B.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);s&&C.scene.rotation.set(s[0],s[1],s[2]);L&&C.scene.scale.set(L[0],L[1],L[2]);(a||s||L)&&C.scene.updateMatrix()}a=function(){E-=1;h();i.onLoadComplete()};for(n in B.cameras)s=B.cameras[n],s.type=="perspective"?F=new THREE.PerspectiveCamera(s.fov,
-s.aspect,s.near,s.far):s.type=="ortho"&&(F=new THREE.OrthographicCamera(s.left,s.right,s.top,s.bottom,s.near,s.far)),w=s.position,s=s.target,F.position.set(w[0],w[1],w[2]),F.target=new THREE.Vector3(s[0],s[1],s[2]),C.cameras[n]=F;for(l in B.lights)s=B.lights[l],n=s.color!==void 0?s.color:16777215,F=s.intensity!==void 0?s.intensity:1,s.type=="directional"?(w=s.direction,t=new THREE.DirectionalLight(n,F),t.position.set(w[0],w[1],w[2]),t.position.normalize()):s.type=="point"?(w=s.position,t=s.distance,
-t=new THREE.PointLight(n,F,t),t.position.set(w[0],w[1],w[2])):s.type=="ambient"&&(t=new THREE.AmbientLight(n)),C.scene.add(t),C.lights[l]=t;for(m in B.fogs)l=B.fogs[m],l.type=="linear"?v=new THREE.Fog(0,l.near,l.far):l.type=="exp2"&&(v=new THREE.FogExp2(0,l.density)),s=l.color,v.color.setRGB(s[0],s[1],s[2]),C.fogs[m]=v;if(C.cameras&&B.defaults.camera)C.currentCamera=C.cameras[B.defaults.camera];if(C.fogs&&B.defaults.fog)C.scene.fog=C.fogs[B.defaults.fog];s=B.defaults.bgcolor;C.bgColor=new THREE.Color;
-C.bgColor.setRGB(s[0],s[1],s[2]);C.bgColorAlpha=B.defaults.bgalpha;for(j in B.geometries)if(m=B.geometries[j],m.type=="bin_mesh"||m.type=="ascii_mesh")I+=1,i.onLoadStart();K=I;for(j in B.geometries)m=B.geometries[j],m.type=="cube"?(A=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),C.geometries[j]=A):m.type=="plane"?(A=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),C.geometries[j]=A):m.type=="sphere"?
-(A=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),C.geometries[j]=A):m.type=="cylinder"?(A=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),C.geometries[j]=A):m.type=="torus"?(A=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),C.geometries[j]=A):m.type=="icosahedron"?(A=new THREE.IcosahedronGeometry(m.subdivisions),C.geometries[j]=A):m.type=="bin_mesh"?c.load(d(m.url,B.urlBaseType),g(j)):m.type=="ascii_mesh"?G.load(d(m.url,B.urlBaseType),
-g(j)):m.type=="embedded_mesh"&&(m=B.embeds[m.id])&&G.createModel(m,f(j),"");for(q in B.textures)if(j=B.textures[q],j.url instanceof Array){E+=j.url.length;for(m=0;m<j.url.length;m++)i.onLoadStart()}else E+=1,i.onLoadStart();O=E;for(q in B.textures){j=B.textures[q];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){m=[];for(var H=0;H<j.url.length;H++)m[H]=d(j.url[H],B.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,j.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(j.url,
-B.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)m.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)m.magFilter=THREE[j.magFilter];if(j.repeat){m.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)m.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)m.wrapT=THREE.RepeatWrapping}j.offset&&m.offset.set(j.offset[0],j.offset[1]);if(j.wrap){v={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(v[j.wrap[0]]!==void 0)m.wrapS=v[j.wrap[0]];if(v[j.wrap[1]]!==void 0)m.wrapT=
-v[j.wrap[1]]}}C.textures[q]=m}for(r in B.materials){q=B.materials[r];for(z in q.parameters)if(z=="envMap"||z=="map"||z=="lightMap")q.parameters[z]=C.textures[q.parameters[z]];else if(z=="shading")q.parameters[z]=q.parameters[z]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(z=="blending")q.parameters[z]=THREE[q.parameters[z]]?THREE[q.parameters[z]]:THREE.NormalBlending;else if(z=="combine")q.parameters[z]=q.parameters[z]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(z==
-"vertexColors")if(q.parameters[z]=="face")q.parameters[z]=THREE.FaceColors;else if(q.parameters[z])q.parameters[z]=THREE.VertexColors;if(q.parameters.opacity!==void 0&&q.parameters.opacity<1)q.parameters.transparent=!0;if(q.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);m=q.parameters.color;v=q.parameters.specular;c=q.parameters.ambient;G=q.parameters.shininess;a.tNormal.texture=C.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)a.uNormalScale.value=
-q.parameters.normalMapFactor;if(q.parameters.map)a.tDiffuse.texture=q.parameters.map,a.enableDiffuse.value=!0;if(q.parameters.lightMap)a.tAO.texture=q.parameters.lightMap,a.enableAO.value=!0;if(q.parameters.specularMap)a.tSpecular.texture=C.textures[q.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(v);a.uAmbientColor.value.setHex(c);a.uShininess.value=G;if(q.parameters.opacity)a.uOpacity.value=q.parameters.opacity;q=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function e(){var a;for(p in B.objects)if(!C.objects[p])if(m=B.objects[p],m.geometry!==void 0){if(A=C.geometries[m.geometry]){a=!1;for(H=0;H<m.materials.length;H++)D=C.materials[m.materials[H]],a=D instanceof THREE.ShaderMaterial;a&&A.computeTangents();w=m.position;y=m.rotation;u=m.quaternion;x=m.scale;u=0;D.length==0&&(D=new THREE.MeshFaceMaterial);D.length>1&&(D=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(A,D);a.name=p;a.position.set(w[0],w[1],w[2]);u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]);a.scale.set(x[0],x[1],x[2]);a.visible=m.visible;C.scene.add(a);C.objects[p]=a;if(m.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(m.castsShadow)b=new THREE.ShadowVolume(A),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;m.trigger&&m.trigger.toLowerCase()!="none"&&(b=
+{type:m.trigger,object:m},C.triggers[a.name]=b)}}else w=m.position,y=m.rotation,u=m.quaternion,x=m.scale,u=0,a=new THREE.Object3D,a.name=p,a.position.set(w[0],w[1],w[2]),u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]),a.scale.set(x[0],x[1],x[2]),a.visible=m.visible!==void 0?m.visible:!1,C.scene.add(a),C.objects[p]=a,C.empties[p]=a,m.trigger&&m.trigger.toLowerCase()!="none"&&(b={type:m.trigger,object:m},C.triggers[a.name]=b)}function g(a){return function(b){C.geometries[a]=
+b;e();J-=1;i.onLoadComplete();h()}}function f(a){return function(b){C.geometries[a]=b}}function h(){i.callbackProgress({totalModels:L,totalTextures:O,loadedModels:L-J,loadedTextures:O-E},C);i.onLoadProgress();J==0&&E==0&&b(C)}var i=this,k=THREE.Loader.prototype.extractUrlbase(c),j,r,p,o,l,n,q,m,s,t,w,y,u,x,z,A,F,v,D,B,G,J,E,L,O,C;B=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;E=J=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+empties:{}};a=!1;for(p in B.objects)if(m=B.objects[p],m.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(B.transform){a=B.transform.position;s=B.transform.rotation;var M=B.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);s&&C.scene.rotation.set(s[0],s[1],s[2]);M&&C.scene.scale.set(M[0],M[1],M[2]);(a||s||M)&&C.scene.updateMatrix()}a=function(){E-=1;h();i.onLoadComplete()};for(l in B.cameras)s=B.cameras[l],s.type=="perspective"?F=new THREE.PerspectiveCamera(s.fov,
+s.aspect,s.near,s.far):s.type=="ortho"&&(F=new THREE.OrthographicCamera(s.left,s.right,s.top,s.bottom,s.near,s.far)),w=s.position,s=s.target,F.position.set(w[0],w[1],w[2]),F.target=new THREE.Vector3(s[0],s[1],s[2]),C.cameras[l]=F;for(o in B.lights)s=B.lights[o],l=s.color!==void 0?s.color:16777215,F=s.intensity!==void 0?s.intensity:1,s.type=="directional"?(w=s.direction,t=new THREE.DirectionalLight(l,F),t.position.set(w[0],w[1],w[2]),t.position.normalize()):s.type=="point"?(w=s.position,t=s.distance,
+t=new THREE.PointLight(l,F,t),t.position.set(w[0],w[1],w[2])):s.type=="ambient"&&(t=new THREE.AmbientLight(l)),C.scene.add(t),C.lights[o]=t;for(n in B.fogs)o=B.fogs[n],o.type=="linear"?v=new THREE.Fog(0,o.near,o.far):o.type=="exp2"&&(v=new THREE.FogExp2(0,o.density)),s=o.color,v.color.setRGB(s[0],s[1],s[2]),C.fogs[n]=v;if(C.cameras&&B.defaults.camera)C.currentCamera=C.cameras[B.defaults.camera];if(C.fogs&&B.defaults.fog)C.scene.fog=C.fogs[B.defaults.fog];s=B.defaults.bgcolor;C.bgColor=new THREE.Color;
+C.bgColor.setRGB(s[0],s[1],s[2]);C.bgColorAlpha=B.defaults.bgalpha;for(j in B.geometries)if(n=B.geometries[j],n.type=="bin_mesh"||n.type=="ascii_mesh")J+=1,i.onLoadStart();L=J;for(j in B.geometries)n=B.geometries[j],n.type=="cube"?(A=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),C.geometries[j]=A):n.type=="plane"?(A=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),C.geometries[j]=A):n.type=="sphere"?
+(A=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),C.geometries[j]=A):n.type=="cylinder"?(A=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),C.geometries[j]=A):n.type=="torus"?(A=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),C.geometries[j]=A):n.type=="icosahedron"?(A=new THREE.IcosahedronGeometry(n.subdivisions),C.geometries[j]=A):n.type=="bin_mesh"?c.load(d(n.url,B.urlBaseType),g(j)):n.type=="ascii_mesh"?G.load(d(n.url,B.urlBaseType),
+g(j)):n.type=="embedded_mesh"&&(n=B.embeds[n.id])&&G.createModel(n,f(j),"");for(q in B.textures)if(j=B.textures[q],j.url instanceof Array){E+=j.url.length;for(n=0;n<j.url.length;n++)i.onLoadStart()}else E+=1,i.onLoadStart();O=E;for(q in B.textures){j=B.textures[q];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){n=[];for(var H=0;H<j.url.length;H++)n[H]=d(j.url[H],B.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,j.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(j.url,
+B.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)n.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)n.magFilter=THREE[j.magFilter];if(j.repeat){n.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}j.offset&&n.offset.set(j.offset[0],j.offset[1]);if(j.wrap){v={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(v[j.wrap[0]]!==void 0)n.wrapS=v[j.wrap[0]];if(v[j.wrap[1]]!==void 0)n.wrapT=
+v[j.wrap[1]]}}C.textures[q]=n}for(r in B.materials){q=B.materials[r];for(z in q.parameters)if(z=="envMap"||z=="map"||z=="lightMap")q.parameters[z]=C.textures[q.parameters[z]];else if(z=="shading")q.parameters[z]=q.parameters[z]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(z=="blending")q.parameters[z]=THREE[q.parameters[z]]?THREE[q.parameters[z]]:THREE.NormalBlending;else if(z=="combine")q.parameters[z]=q.parameters[z]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(z==
+"vertexColors")if(q.parameters[z]=="face")q.parameters[z]=THREE.FaceColors;else if(q.parameters[z])q.parameters[z]=THREE.VertexColors;if(q.parameters.opacity!==void 0&&q.parameters.opacity<1)q.parameters.transparent=!0;if(q.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);n=q.parameters.color;v=q.parameters.specular;c=q.parameters.ambient;G=q.parameters.shininess;a.tNormal.texture=C.textures[q.parameters.normalMap];if(q.parameters.normalMapFactor)a.uNormalScale.value=
+q.parameters.normalMapFactor;if(q.parameters.map)a.tDiffuse.texture=q.parameters.map,a.enableDiffuse.value=!0;if(q.parameters.lightMap)a.tAO.texture=q.parameters.lightMap,a.enableAO.value=!0;if(q.parameters.specularMap)a.tSpecular.texture=C.textures[q.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(v);a.uAmbientColor.value.setHex(c);a.uShininess.value=G;if(q.parameters.opacity)a.uOpacity.value=q.parameters.opacity;q=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
 vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else q=new THREE[q.type](q.parameters);C.materials[r]=q}e();i.callbackSync(C);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var d=new XMLHttpRequest,e=c.scale!==void 0?c.scale:1,g=c.offsetX!==void 0?c.offsetX:0,f=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 b,e,g,f,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;e<8;e++){for(var g=0,f=0;f<b;++f){var h=a.charCodeAt(f+d);g+=h>>1^-(h&1);c[8*f+e]=g}d+=b}b=a.length-d;g=new Uint16Array(b);for(e=f=0;e<b;e++)h=a.charCodeAt(e+d),g[e]=f-h,h==0&&f++;return[c,g]};
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,f,i){for(var j,k,q,p=a.length;i<p;i+=f)j=a[i],k=a[i+1],q=a[i+2],j=j/16383*c,k=k/16383*c,q=q/16383*c,j+=d,k+=e,q+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,q)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,j.push(d,1-e)})(f[0],8,3);(function(a,
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,f,i){for(var j,k,q,m=a.length;i<m;i+=f)j=a[i],k=a[i+1],q=a[i+2],j=j/16383*c,k=k/16383*c,q=q/16383*c,j+=d,k+=e,q+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,q)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,j.push(d,1-e)})(f[0],8,3);(function(a,
 b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,k.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,s,t,w,y=a.length;for(c=0;c<y;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;t=d;w=e;i=f;s=d;var u=e,x=f,z=g.materials[0],A=k[u*3],F=k[u*3+1],u=k[u*3+2],v=k[x*3],D=k[x*3+1],x=k[x*3+2];s=new THREE.Vector3(k[s*3],k[s*3+1],k[s*3+2]);u=new THREE.Vector3(A,F,u);x=new THREE.Vector3(v,D,x);g.faces.push(new THREE.Face3(t,w,i,[s,u,x],null,z));g=j[d*2];d=j[d*2+
 1];i=j[e*2];s=j[e*2+1];t=j[f*2];w=j[f*2+1];f=b.faceVertexUvs[0];e=i;i=s;s=[];s.push(new THREE.UV(g,d));s.push(new THREE.UV(e,i));s.push(new THREE.UV(t,w));f.push(s)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
@@ -314,16 +325,16 @@ c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=a;this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=0;this.hasNormal=
 this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,k,j,r){f=(f-j)/(r-j);j=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=k;e[g]=this.lerp(j[a],j[a+3],f);e[g+1]=this.lerp(j[a+1],j[a+4],f);e[g+2]=this.lerp(j[a+2],j[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,k,j,r){f=(f-j)/(r-j);j=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=k;b=a+this.yd*
 3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,k,j,r){f=(f-j)/(r-j);j=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=k+f*this.delta;b=a+this.zd*3;e[g]=this.lerp(j[a],j[b],f);e[g+1]=this.lerp(j[a+1],j[b+1],f);e[g+2]=this.lerp(j[a+2],j[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
-this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,k=g+this.yd,j=g+this.zd,r=i+this.yd,o=i+this.zd,l=g+this.yd+this.zd,n=i+this.yd+this.zd,m=0,q=this.field[g],p=this.field[i],s=this.field[k],t=this.field[r],w=this.field[j],y=this.field[o],u=this.field[l],x=this.field[n];q<f&&(m|=1);p<f&&(m|=2);s<f&&(m|=8);t<f&&(m|=4);w<f&&(m|=16);y<f&&(m|=32);u<f&&(m|=128);x<f&&(m|=64);var z=THREE.edgeTable[m];if(z===0)return 0;var A=this.delta,F=a+
-A,v=b+A,A=e+A;z&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,q,p));z&2&&(this.compNorm(i),this.compNorm(r),this.VIntY(i*3,this.vlist,this.nlist,3,f,F,b,e,p,t));z&4&&(this.compNorm(k),this.compNorm(r),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,v,e,s,t));z&8&&(this.compNorm(g),this.compNorm(k),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,q,s));z&16&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,12,f,a,b,A,w,y));z&32&&(this.compNorm(o),
-this.compNorm(n),this.VIntY(o*3,this.vlist,this.nlist,15,f,F,b,A,y,x));z&64&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,18,f,a,v,A,u,x));z&128&&(this.compNorm(j),this.compNorm(l),this.VIntY(j*3,this.vlist,this.nlist,21,f,a,b,A,w,u));z&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,q,w));z&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,f,F,b,e,p,y));z&1024&&(this.compNorm(r),this.compNorm(n),this.VIntZ(r*
-3,this.vlist,this.nlist,30,f,F,v,e,t,x));z&2048&&(this.compNorm(k),this.compNorm(l),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,v,e,s,u));m<<=4;for(f=g=0;THREE.triTable[m+f]!=-1;)a=m+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,k=g+this.yd,j=g+this.zd,r=i+this.yd,p=i+this.zd,o=g+this.yd+this.zd,l=i+this.yd+this.zd,n=0,q=this.field[g],m=this.field[i],s=this.field[k],t=this.field[r],w=this.field[j],y=this.field[p],u=this.field[o],x=this.field[l];q<f&&(n|=1);m<f&&(n|=2);s<f&&(n|=8);t<f&&(n|=4);w<f&&(n|=16);y<f&&(n|=32);u<f&&(n|=128);x<f&&(n|=64);var z=THREE.edgeTable[n];if(z===0)return 0;var A=this.delta,F=a+
+A,v=b+A,A=e+A;z&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,q,m));z&2&&(this.compNorm(i),this.compNorm(r),this.VIntY(i*3,this.vlist,this.nlist,3,f,F,b,e,m,t));z&4&&(this.compNorm(k),this.compNorm(r),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,v,e,s,t));z&8&&(this.compNorm(g),this.compNorm(k),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,q,s));z&16&&(this.compNorm(j),this.compNorm(p),this.VIntX(j*3,this.vlist,this.nlist,12,f,a,b,A,w,y));z&32&&(this.compNorm(p),
+this.compNorm(l),this.VIntY(p*3,this.vlist,this.nlist,15,f,F,b,A,y,x));z&64&&(this.compNorm(o),this.compNorm(l),this.VIntX(o*3,this.vlist,this.nlist,18,f,a,v,A,u,x));z&128&&(this.compNorm(j),this.compNorm(o),this.VIntY(j*3,this.vlist,this.nlist,21,f,a,b,A,w,u));z&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,q,w));z&512&&(this.compNorm(i),this.compNorm(p),this.VIntZ(i*3,this.vlist,this.nlist,27,f,F,b,e,m,y));z&1024&&(this.compNorm(r),this.compNorm(l),this.VIntZ(r*
+3,this.vlist,this.nlist,30,f,F,v,e,t,x));z&2048&&(this.compNorm(k),this.compNorm(o),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,v,e,s,u));n<<=4;for(f=g=0;THREE.triTable[n+f]!=-1;)a=n+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
 4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=b[e];this.normalArray[i+1]=b[e+1];this.normalArray[i+2]=b[e+2];this.normalArray[i+3]=b[g];this.normalArray[i+4]=b[g+1];this.normalArray[i+5]=b[g+2];this.normalArray[i+6]=b[f];this.normalArray[i+7]=b[f+1];this.normalArray[i+8]=b[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,k=b*this.size,j=a*this.size,r=Math.floor(i-h);r<1&&(r=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(k-h);o<1&&(o=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var l=Math.floor(j-h);l<1&&(l=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
-1);for(var n,m,q,p,s,t;r<i;r++){j=this.size2*r;m=r/this.size-e;s=m*m;for(m=o;m<k;m++){q=j+this.size*m;n=m/this.size-b;t=n*n;for(n=l;n<h;n++)p=n/this.size-a,p=g/(1.0E-6+p*p+t+s)-f,p>0&&(this.field[q+n]+=p)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,k=this.size,j=this.yd,r=this.zd,o=this.field,l=k*Math.sqrt(a/b);l>k&&(l=k);for(e=0;e<l;e++)if(g=e/k,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<k;g++){i=e+g*j;for(f=0;f<k;f++)o[r*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,k,j=this.size,r=this.yd,o=
-this.zd,l=this.field,n=j*Math.sqrt(a/b);n>j&&(n=j);for(g=0;g<n;g++)if(e=g/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=g*r;for(e=0;e<j;e++){k=i+e;for(f=0;f<j;f++)l[o*f+k]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,k,j=this.size,r=this.yd,o=this.zd,l=this.field,n=j*Math.sqrt(a/b);n>j&&(n=j);for(f=0;f<n;f++)if(e=f/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=o*f;for(g=0;g<j;g++){k=i+g*r;for(e=0;e<j;e++)l[k+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=
-function(a){this.begin();var b,e,g,f,h,i,k,j,r,o=this.size-2;for(f=1;f<o;f++){r=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(g=1;g<o;g++){j=r+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<o;e++)h=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(h,i,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,k,j,r,o,l;for(f=0;f<g.count;f++)o=f*3,j=o+1,l=o+2,h=g.positionArray[o],i=g.positionArray[j],k=
-g.positionArray[l],r=new THREE.Vector3(h,i,k),h=g.normalArray[o],i=g.normalArray[j],k=g.normalArray[l],o=new THREE.Vector3(h,i,k),o.normalize(),j=new THREE.Vertex(r),b.vertices.push(j),e.push(o);r=g.count/3;for(f=0;f<r;f++)o=(a+f)*3,j=o+1,l=o+2,h=e[o],i=e[j],k=e[l],o=new THREE.Face3(o,j,l,[h,i,k]),b.faces.push(o);a+=r;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,k=b*this.size,j=a*this.size,r=Math.floor(i-h);r<1&&(r=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var p=Math.floor(k-h);p<1&&(p=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var o=Math.floor(j-h);o<1&&(o=1);h=Math.floor(j+h);h>this.size-1&&(h=this.size-
+1);for(var l,n,q,m,s,t;r<i;r++){j=this.size2*r;n=r/this.size-e;s=n*n;for(n=p;n<k;n++){q=j+this.size*n;l=n/this.size-b;t=l*l;for(l=o;l<h;l++)m=l/this.size-a,m=g/(1.0E-6+m*m+t+s)-f,m>0&&(this.field[q+l]+=m)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,k=this.size,j=this.yd,r=this.zd,p=this.field,o=k*Math.sqrt(a/b);o>k&&(o=k);for(e=0;e<o;e++)if(g=e/k,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<k;g++){i=e+g*j;for(f=0;f<k;f++)p[r*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,k,j=this.size,r=this.yd,p=
+this.zd,o=this.field,l=j*Math.sqrt(a/b);l>j&&(l=j);for(g=0;g<l;g++)if(e=g/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=g*r;for(e=0;e<j;e++){k=i+e;for(f=0;f<j;f++)o[p*f+k]+=h}}};this.addPlaneZ=function(a,b){var e,g,f,h,i,k,j=this.size,r=this.yd,p=this.zd,o=this.field,l=j*Math.sqrt(a/b);l>j&&(l=j);for(f=0;f<l;f++)if(e=f/j,e*=e,h=a/(1.0E-4+e)-b,h>0){i=p*f;for(g=0;g<j;g++){k=i+g*r;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[a*3]=0,this.field[a]=0};this.render=
+function(a){this.begin();var b,e,g,f,h,i,k,j,r,p=this.size-2;for(f=1;f<p;f++){r=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(g=1;g<p;g++){j=r+this.size*g;i=(g-this.halfsize)/this.halfsize;for(e=1;e<p;e++)h=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(h,i,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var f,h,i,k,j,r,p,o;for(f=0;f<g.count;f++)p=f*3,j=p+1,o=p+2,h=g.positionArray[p],i=g.positionArray[j],k=
+g.positionArray[o],r=new THREE.Vector3(h,i,k),h=g.normalArray[p],i=g.normalArray[j],k=g.normalArray[o],p=new THREE.Vector3(h,i,k),p.normalize(),j=new THREE.Vertex(r),b.vertices.push(j),e.push(p);r=g.count/3;for(f=0;f<r;f++)p=(a+f)*3,j=p+1,o=p+2,h=e[p],i=e[j],k=e[o],p=new THREE.Face3(p,j,o,[h,i,k]),b.faces.push(p);a+=r;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -355,29 +366,29 @@ d.vertices[e++]=1;d.vertices[e++]=-1;d.vertices[e++]=1;d.vertices[e++]=0;d.verti
 d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);d.tempTexture=b.createTexture();d.occlusionTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);
 b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(d.hasVertexTexture=!1,d.program=a(THREE.ShaderFlares.lensFlare)):(d.hasVertexTexture=
 !0,d.program=a(THREE.ShaderFlares.lensFlareVertexTexture));d.attributes={};d.uniforms={};d.attributes.vertex=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.renderType=b.getUniformLocation(d.program,"renderType");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.occlusionMap=b.getUniformLocation(d.program,"occlusionMap");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.color=b.getUniformLocation(d.program,
-"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i=a.length;if(i){var k=new THREE.Vector3,j=h/f,r=f*0.5,o=h*0.5,l=16/h,n=new THREE.Vector2(l*j,l),m=new THREE.Vector3(1,1,0),q=new THREE.Vector2(1,1),p=d.uniforms,l=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
-b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(p.occlusionMap,0);b.uniform1i(p.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(l.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(l.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var s,t,w,y,u;for(s=0;s<i;s++)if(l=16/h,n.set(l*j,l),y=a[s],k.set(y.matrixWorld.n14,y.matrixWorld.n24,y.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(k),
-g.projectionMatrix.multiplyVector3(k),m.copy(k),q.x=m.x*r+r,q.y=m.y*o+o,d.hasVertexTexture||q.x>0&&q.x<f&&q.y>0&&q.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,q.x-8,q.y-8,16,16,0);b.uniform1i(p.renderType,0);b.uniform2f(p.scale,n.x,n.y);b.uniform3f(p.screenPosition,m.x,m.y,m.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);
-b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,q.x-8,q.y-8,16,16,0);b.uniform1i(p.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);y.positionScreen.copy(m);y.customUpdateCallback?y.customUpdateCallback(y):y.updateLensFlares();b.uniform1i(p.renderType,2);b.enable(b.BLEND);t=0;for(w=y.lensFlares.length;t<w;t++)if(u=y.lensFlares[t],u.opacity>0.0010&&u.scale>0.0010)m.x=u.x,m.y=u.y,m.z=u.z,l=u.size*u.scale/
-h,n.x=l*j,n.y=l,b.uniform3f(p.screenPosition,m.x,m.y,m.z),b.uniform2f(p.scale,n.x,n.y),b.uniform1f(p.rotation,u.rotation),b.uniform1f(p.opacity,u.opacity),b.uniform3f(p.color,u.color.r,u.color.g,u.color.b),c.setBlending(u.blending),c.setTexture(u.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i=a.length;if(i){var k=new THREE.Vector3,j=h/f,r=f*0.5,p=h*0.5,o=16/h,l=new THREE.Vector2(o*j,o),n=new THREE.Vector3(1,1,0),q=new THREE.Vector2(1,1),m=d.uniforms,o=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
+b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(m.occlusionMap,0);b.uniform1i(m.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(o.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(o.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var s,t,w,y,u;for(s=0;s<i;s++)if(o=16/h,l.set(o*j,o),y=a[s],k.set(y.matrixWorld.n14,y.matrixWorld.n24,y.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(k),
+g.projectionMatrix.multiplyVector3(k),n.copy(k),q.x=n.x*r+r,q.y=n.y*p+p,d.hasVertexTexture||q.x>0&&q.x<f&&q.y>0&&q.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,q.x-8,q.y-8,16,16,0);b.uniform1i(m.renderType,0);b.uniform2f(m.scale,l.x,l.y);b.uniform3f(m.screenPosition,n.x,n.y,n.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);
+b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,q.x-8,q.y-8,16,16,0);b.uniform1i(m.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);y.positionScreen.copy(n);y.customUpdateCallback?y.customUpdateCallback(y):y.updateLensFlares();b.uniform1i(m.renderType,2);b.enable(b.BLEND);t=0;for(w=y.lensFlares.length;t<w;t++)if(u=y.lensFlares[t],u.opacity>0.0010&&u.scale>0.0010)n.x=u.x,n.y=u.y,n.z=u.z,o=u.size*u.scale/
+h,l.x=o*j,l.y=o,b.uniform3f(m.screenPosition,n.x,n.y,n.z),b.uniform2f(m.scale,l.x,l.y),b.uniform1f(m.rotation,u.rotation),b.uniform1f(m.opacity,u.opacity),b.uniform3f(m.color,u.color.r,u.color.g,u.color.b),c.setBlending(u.blending),c.setTexture(u.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e,g=new THREE.Frustum,f=new THREE.Matrix4;this.shadowMatrix=[];this.shadowMap=[];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(h){var i,k,j,r,o,l,n,m,q=0,p=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(k=p.length;i<k;i++)if(n=p[i],n.castShadow&&n instanceof THREE.SpotLight){this.shadowMap[q]||(this.shadowMap[q]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
-format:THREE.RGBAFormat}),this.shadowMatrix[q]=new THREE.Matrix4);j=this.shadowMap[q];r=this.shadowMatrix[q];e.position.copy(n.position);e.lookAt(n.target.position);e.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),h.add(e),b.autoUpdateScene&&h.updateMatrixWorld());e.matrixWorldInverse.getInverse(e.matrixWorld);r.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);r.multiplySelf(e.projectionMatrix);r.multiplySelf(e.matrixWorldInverse);if(!e._viewMatrixArray)e._viewMatrixArray=
-new Float32Array(16);e.matrixWorldInverse.flattenToArray(e._viewMatrixArray);if(!e._projectionMatrixArray)e._projectionMatrixArray=new Float32Array(16);e.projectionMatrix.flattenToArray(e._projectionMatrixArray);f.multiply(e.projectionMatrix,e.matrixWorldInverse);g.setFromMatrix(f);b.setRenderTarget(j);a.clearColor(1,0,1,1);b.clear();j=b.getClearColor();r=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,r);m=h.__webglObjects;j=0;for(r=m.length;j<r;j++)if(o=m[j],n=o.object,o.render=!1,n.visible&&n.castShadow&&
-(!(n instanceof THREE.Mesh)||!n.frustumCulled||g.contains(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),o.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);j=0;for(r=m.length;j<r;j++)if(o=m[j],o.render)n=o.object,o=o.buffer,b.setObjectFaces(n),l=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?d:c,b.renderBuffer(e,p,null,l,o,n);m=h.__webglObjectsImmediate;
-j=0;for(r=m.length;j<r;j++)o=m[j],n=o.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),n._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),b.renderImmediateObject(e,p,null,c,n));q++}}};
+function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(h){var i,k,j,r,p,o,l,n,q=0,m=h.lights;e||(e=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));i=0;for(k=m.length;i<k;i++)if(l=m[i],l.castShadow&&l instanceof THREE.SpotLight){this.shadowMap[q]||(this.shadowMap[q]=new THREE.WebGLRenderTarget(b.shadowMapWidth,b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
+format:THREE.RGBAFormat}),this.shadowMatrix[q]=new THREE.Matrix4);j=this.shadowMap[q];r=this.shadowMatrix[q];e.position.copy(l.position);e.lookAt(l.target.position);e.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),h.add(e),b.autoUpdateScene&&h.updateMatrixWorld());e.matrixWorldInverse.getInverse(e.matrixWorld);r.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);r.multiplySelf(e.projectionMatrix);r.multiplySelf(e.matrixWorldInverse);if(!e._viewMatrixArray)e._viewMatrixArray=
+new Float32Array(16);e.matrixWorldInverse.flattenToArray(e._viewMatrixArray);if(!e._projectionMatrixArray)e._projectionMatrixArray=new Float32Array(16);e.projectionMatrix.flattenToArray(e._projectionMatrixArray);f.multiply(e.projectionMatrix,e.matrixWorldInverse);g.setFromMatrix(f);b.setRenderTarget(j);a.clearColor(1,0,1,1);b.clear();j=b.getClearColor();r=b.getClearAlpha();a.clearColor(j.r,j.g,j.b,r);n=h.__webglObjects;j=0;for(r=n.length;j<r;j++)if(p=n[j],l=p.object,p.render=!1,l.visible&&l.castShadow&&
+(!(l instanceof THREE.Mesh)||!l.frustumCulled||g.contains(l)))l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),p.render=!0;b.setDepthTest(!0);b.setBlending(THREE.NormalBlending);j=0;for(r=n.length;j<r;j++)if(p=n[j],p.render)l=p.object,p=p.buffer,b.setObjectFaces(l),o=l.customDepthMaterial?l.customDepthMaterial:l.geometry.morphTargets.length?d:c,b.renderBuffer(e,m,null,o,p,l);n=h.__webglObjectsImmediate;
+j=0;for(r=n.length;j<r;j++)p=n[j],l=p.object,l.visible&&l.castShadow&&(l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),b.renderImmediateObject(e,m,null,c,l));q++}}};
 THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d={};this.init=function(a){b=a.context;c=a;d.vertices=new Float32Array(16);d.faces=new Uint16Array(6);a=0;d.vertices[a++]=-1;d.vertices[a++]=-1;d.vertices[a++]=0;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=0;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=0;a=d.vertices[a++]=0;d.faces[a++]=0;d.faces[a++]=1;d.faces[a++]=
 2;d.faces[a++]=0;d.faces[a++]=2;d.faces[a++]=3;d.vertexBuffer=b.createBuffer();d.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,d.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,g=b.createProgram(),f=b.createShader(b.FRAGMENT_SHADER),h=b.createShader(b.VERTEX_SHADER);b.shaderSource(f,a.fragmentShader);b.shaderSource(h,a.vertexShader);
 b.compileShader(f);b.compileShader(h);b.attachShader(g,f);b.attachShader(g,h);b.linkProgram(g);d.program=g;d.attributes={};d.uniforms={};d.attributes.position=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.uvOffset=b.getUniformLocation(d.program,"uvOffset");d.uniforms.uvScale=b.getUniformLocation(d.program,"uvScale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.alignment=
 b.getUniformLocation(d.program,"alignment");d.uniforms.color=b.getUniformLocation(d.program,"color");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.useScreenCoordinates=b.getUniformLocation(d.program,"useScreenCoordinates");d.uniforms.affectedByDistance=b.getUniformLocation(d.program,"affectedByDistance");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.uniforms.modelViewMatrix=b.getUniformLocation(d.program,
-"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h){var e=e.__webglSprites,i=e.length;if(i){var k=d.attributes,j=d.uniforms,r=h/f;f*=0.5;var o=h*0.5,l=!0;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(k.position),b.enableVertexAttribArray(k.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(k.position,
-2,b.FLOAT,!1,16,0);b.vertexAttribPointer(k.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(j.projectionMatrix,!1,g._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(j.map,0);for(var n,m=[],k=0;k<i;k++)if(n=e[k],n.visible&&n.opacity!==0)n.useScreenCoordinates?n.z=-n.position.z:(n._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray),n.z=-n._modelViewMatrix.n34);e.sort(a);for(k=0;k<i;k++)n=e[k],n.visible&&
-n.opacity!==0&&n.map&&n.map.image&&n.map.image.width&&(n.useScreenCoordinates?(b.uniform1i(j.useScreenCoordinates,1),b.uniform3f(j.screenPosition,(n.position.x-f)/f,(o-n.position.y)/o,Math.max(0,Math.min(1,n.position.z)))):(b.uniform1i(j.useScreenCoordinates,0),b.uniform1i(j.affectedByDistance,n.affectedByDistance?1:0),b.uniformMatrix4fv(j.modelViewMatrix,!1,n._modelViewMatrixArray)),g=n.map.image.width/(n.scaleByViewport?h:1),m[0]=g*r*n.scale.x,m[1]=g*n.scale.y,b.uniform2f(j.uvScale,n.uvScale.x,
-n.uvScale.y),b.uniform2f(j.uvOffset,n.uvOffset.x,n.uvOffset.y),b.uniform2f(j.alignment,n.alignment.x,n.alignment.y),b.uniform1f(j.opacity,n.opacity),b.uniform3f(j.color,n.color.r,n.color.g,n.color.b),b.uniform1f(j.rotation,n.rotation),b.uniform2fv(j.scale,m),n.mergeWith3D&&!l?(b.enable(b.DEPTH_TEST),l=!0):!n.mergeWith3D&&l&&(b.disable(b.DEPTH_TEST),l=!1),c.setBlending(n.blending),c.setTexture(n.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,r;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),l=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.PerspectiveCamera(53,
-1,1,1E4);n.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:l}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
-m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(n);this.setSize=function(a,d){c.call(b,a,d);o.width=a;o.height=d;l.width=a;l.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||k!==c.near||j!==c.far||r!==c.fov){i=c.aspect;k=c.near;j=c.far;r=c.fov;var s=c.projectionMatrix.clone(),t=125/30*0.5,w=t*k/125,y=k*Math.tan(r*Math.PI/360),u;f.n14=t;h.n14=-t;t=-y*i+w;u=y*i+w;s.n11=2*k/(u-t);s.n13=(u+t)/(u-t);e.projectionMatrix.copy(s);t=-y*i-w;u=y*i-w;s.n11=
-2*k/(u-t);s.n13=(u+t)/(u-t);g.projectionMatrix.copy(s)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,o,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,l,!0);m.updateMatrixWorld();d.call(b,m,n)}};
+"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h){var e=e.__webglSprites,i=e.length;if(i){var k=d.attributes,j=d.uniforms,r=h/f;f*=0.5;var p=h*0.5,o=!0;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(k.position),b.enableVertexAttribArray(k.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(k.position,
+2,b.FLOAT,!1,16,0);b.vertexAttribPointer(k.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(j.projectionMatrix,!1,g._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(j.map,0);for(var l,n=[],k=0;k<i;k++)if(l=e[k],l.visible&&l.opacity!==0)l.useScreenCoordinates?l.z=-l.position.z:(l._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),l.z=-l._modelViewMatrix.n34);e.sort(a);for(k=0;k<i;k++)l=e[k],l.visible&&
+l.opacity!==0&&l.map&&l.map.image&&l.map.image.width&&(l.useScreenCoordinates?(b.uniform1i(j.useScreenCoordinates,1),b.uniform3f(j.screenPosition,(l.position.x-f)/f,(p-l.position.y)/p,Math.max(0,Math.min(1,l.position.z)))):(b.uniform1i(j.useScreenCoordinates,0),b.uniform1i(j.affectedByDistance,l.affectedByDistance?1:0),b.uniformMatrix4fv(j.modelViewMatrix,!1,l._modelViewMatrixArray)),g=l.map.image.width/(l.scaleByViewport?h:1),n[0]=g*r*l.scale.x,n[1]=g*l.scale.y,b.uniform2f(j.uvScale,l.uvScale.x,
+l.uvScale.y),b.uniform2f(j.uvOffset,l.uvOffset.x,l.uvOffset.y),b.uniform2f(j.alignment,l.alignment.x,l.alignment.y),b.uniform1f(j.opacity,l.opacity),b.uniform3f(j.color,l.color.r,l.color.g,l.color.b),b.uniform1f(j.rotation,l.rotation),b.uniform2fv(j.scale,n),l.mergeWith3D&&!o?(b.enable(b.DEPTH_TEST),o=!0):!l.mergeWith3D&&o&&(b.disable(b.DEPTH_TEST),o=!1),c.setBlending(l.blending),c.setTexture(l.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,r;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),l=new THREE.PerspectiveCamera(53,
+1,1,1E4);l.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:o}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
+n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(l);this.setSize=function(a,d){c.call(b,a,d);p.width=a;p.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||r!==c.fov){i=c.aspect;k=c.near;j=c.far;r=c.fov;var s=c.projectionMatrix.clone(),t=125/30*0.5,w=t*k/125,y=k*Math.tan(r*Math.PI/360),u;f.n14=t;h.n14=-t;t=-y*i+w;u=y*i+w;s.n11=2*k/(u-t);s.n13=(u+t)/(u-t);e.projectionMatrix.copy(s);t=-y*i-w;u=y*i-w;s.n11=
+2*k/(u-t);s.n13=(u+t)/(u-t);g.projectionMatrix.copy(s)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,p,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,o,!0);n.updateMatrixWorld();d.call(b,n,l)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,g,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;g=d};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=
 c.far;f.updateProjectionMatrix();f.position.copy(c.position);f.target.copy(c.target);f.translateX(b.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,g);d.call(b,a,f);this.setViewport(e,0,e,g);d.call(b,a,h,!1)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},

+ 53 - 49
build/custom/ThreeSVG.js

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

+ 144 - 140
build/custom/ThreeWebGL.js

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

+ 1 - 1
examples/webgl_collada.html

@@ -31,13 +31,13 @@
 			var dae, skin;
 
 			var loader = new THREE.ColladaLoader();
+			loader.options.convertUpAxis = true;
 			loader.load( './models/monster.dae', function colladaReady( collada ) {
 
 				dae = collada.scene;
 				skin = collada.skins[ 0 ];
 
 				dae.scale.x = dae.scale.y = dae.scale.z = 0.002;
-				dae.rotation.x = -Math.PI/2;
 				dae.updateMatrix();
 
 				init();

+ 12 - 15
examples/webgl_geometries.html

@@ -27,7 +27,7 @@
 
 			var container, stats;
 
-			var camera, scene, group, renderer;
+			var camera, scene, renderer;
 
 			init();
 			animate();
@@ -55,29 +55,26 @@
 					new THREE.MeshBasicMaterial( { color: 0xffffff, wireframe: true, transparent: true, opacity: 0.1 } )
 				];
 
-				group = new THREE.Object3D();
-				scene.add( group );
-
 				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.CubeGeometry( 100, 100, 100, 4, 4, 4 ), materials );
 				object.position.set( -200, 0, 200 );
-				group.add( object );
+				scene.add( object );
 
 				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.CylinderGeometry( 25, 75, 100, 40, 5 ), materials );
 				object.position.set( 0, 0, 200 );
-				group.add( object );
+				scene.add( object );
 
 				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.IcosahedronGeometry( 2 ), materials );
 				object.position.set( 200, 0, 200 );
 				object.scale.x = object.scale.y = object.scale.z = 75;
-				group.add( object );
+				scene.add( object );
 
 				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.PlaneGeometry( 100, 100, 4, 4 ), materials );
 				object.position.set( -200, 0, 0 );
-				group.add( object );
+				scene.add( object );
 
 				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.SphereGeometry( 75, 20, 10 ), materials );
 				object.position.set( 0, 0, 0 );
-				group.add( object );
+				scene.add( object );
 
 				var points = [];
 
@@ -89,20 +86,20 @@
 
 				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.LatheGeometry( points, 20 ), materials );
 				object.position.set( 200, 0, 0 );
-				group.add( object );
+				scene.add( object );
 
 				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.TorusGeometry( 50, 20, 20, 20 ), materials );
 				object.position.set( -200, 0, -200 );
-				group.add( object );
+				scene.add( object );
 
 				object = THREE.SceneUtils.createMultiMaterialObject( new THREE.TorusKnotGeometry( 50, 10, 50, 20 ), materials );
 				object.position.set( 0, 0, -200 );
-				group.add( object );
+				scene.add( object );
 
 				object = new THREE.Axes();
 				object.position.set( 200, 0, -200 );
 				object.scale.x = object.scale.y = object.scale.z = 0.5;
-				group.add( object );
+				scene.add( object );
 
 				renderer = new THREE.WebGLRenderer();
 				renderer.setSize( window.innerWidth, window.innerHeight );
@@ -136,9 +133,9 @@
 
 				camera.lookAt( scene.position );
 
-				for ( var i = 0, l = group.children.length; i < l; i ++ ) {
+				for ( var i = 0, l = scene.children.length; i < l; i ++ ) {
 
-					var object = group.children[ i ];
+					var object = scene.children[ i ];
 
 					object.rotation.x += 0.01;
 					object.rotation.y += 0.005;

+ 9 - 7
examples/webgl_materials.html

@@ -64,11 +64,11 @@
 
 				// Materials
 
-				var generatedTexture = new THREE.Texture( generateTexture() );
-				generatedTexture.needsUpdate = true;
+				var texture = new THREE.Texture( generateTexture() );
+				texture.needsUpdate = true;
 
 				var materials = [];
-				materials.push( new THREE.MeshLambertMaterial( { map: generatedTexture } ) );
+				materials.push( new THREE.MeshLambertMaterial( { map: texture, transparent: true } ) );
 				materials.push( new THREE.MeshLambertMaterial( { color: 0xdddddd, shading: THREE.FlatShading } ) );
 				materials.push( new THREE.MeshPhongMaterial( { ambient: 0x030303, color: 0xdddddd, specular: 0x009900, shininess: 30, shading: THREE.FlatShading } ) );
 				materials.push( new THREE.MeshNormalMaterial( ) );
@@ -76,12 +76,12 @@
 				//materials.push( new THREE.MeshBasicMaterial( { color: 0xff0000, blending: THREE.SubtractiveBlending } ) );
 
 				materials.push( new THREE.MeshLambertMaterial( { color: 0xdddddd, shading: THREE.SmoothShading } ) );
-				materials.push( new THREE.MeshPhongMaterial( { ambient: 0x030303, color: 0xdddddd, specular: 0x009900, shininess: 30, shading: THREE.SmoothShading, map: THREE.ImageUtils.loadTexture( "textures/planets/earth_specular_2048.jpg" ) } ) );
+				materials.push( new THREE.MeshPhongMaterial( { ambient: 0x030303, color: 0xdddddd, specular: 0x009900, shininess: 30, shading: THREE.SmoothShading, map: texture, transparent: true } ) );
 				materials.push( new THREE.MeshNormalMaterial( { shading: THREE.SmoothShading } ) );
 				materials.push( new THREE.MeshBasicMaterial( { color: 0xffaa00, wireframe: true } ) );
 
 				materials.push( new THREE.MeshDepthMaterial() );
-				materials.push( new THREE.MeshBasicMaterial( { map: generatedTexture } ) );
+				materials.push( new THREE.MeshBasicMaterial( { map: texture, transparent: true } ) );
 
 				// Spheres geometry
 
@@ -188,8 +188,10 @@
 					x = j % 256;
 					y = x == 0 ? y + 1 : y;
 
-					image.data[ i + 2 ] = Math.floor( x ^ y );
-					image.data[ i + 3 ] = 255;
+					image.data[ i ] = 255;
+					image.data[ i + 1 ] = 255;
+					image.data[ i + 2 ] = 255;
+					image.data[ i + 3 ] = Math.floor( x ^ y );
 
 				}
 

+ 180 - 1
src/core/Matrix4.js

@@ -766,6 +766,185 @@ THREE.Matrix4.prototype = {
 
 		return this;
 
+	},
+
+	rotateByAxis: function ( axis, angle ) {
+
+  		// optimize by checking axis
+		if ( axis.x === 1 && axis.y === 0 && axis.z === 0 ) {
+
+			return this.rotateX( angle );
+
+		} else if ( axis.x === 0 && axis.y === 1 && axis.z === 0 ) {
+
+			return this.rotateY( angle );
+
+		} else if ( axis.x === 0 && axis.y === 0 && axis.z === 1 ) {
+
+			return this.rotateZ( angle );
+
+		}
+
+		var x = axis.x,
+			y = axis.y,
+			z = axis.z,
+			n = Math.sqrt(x * x + y * y + z * z);
+
+		x /= n;
+		y /= n;
+		z /= n;
+
+		var xx = x * x,
+			yy = y * y,
+			zz = z * z,
+			c = Math.cos(angle),
+			s = Math.sin(angle),
+			oneMinusCosine = 1 - c,
+			xy = x * y * oneMinusCosine,
+			xz = x * z * oneMinusCosine,
+			yz = y * z * oneMinusCosine,
+			xs = x * s,
+			ys = y * s,
+			zs = z * s,
+
+			r11 = xx + (1 - xx) * c,
+			r21 = xy + zs,
+			r31 = xz - ys,
+			r12 = xy - zs,
+			r22 = yy + (1 - yy) * c,
+			r32 = yz + xs,
+			r13 = xz + ys,
+			r23 = yz - xs,
+			r33 = zz + (1 - zz) * c,
+
+			m11 = this.n11,
+			m21 = this.n21,
+			m31 = this.n31,
+			m41 = this.n41,
+			m12 = this.n12,
+			m22 = this.n22,
+			m32 = this.n32,
+			m42 = this.n42,
+			m13 = this.n13,
+			m23 = this.n23,
+			m33 = this.n33,
+			m43 = this.n43,
+			m14 = this.n14,
+			m24 = this.n24,
+			m34 = this.n34,
+			m44 = this.n44;
+
+		this.n11 = r11 * m11 + r21 * m12 + r31 * m13;
+		this.n21 = r11 * m21 + r21 * m22 + r31 * m23;
+		this.n31 = r11 * m31 + r21 * m32 + r31 * m33;
+		this.n41 = r11 * m41 + r21 * m42 + r31 * m43;
+
+		this.n12 = r12 * m11 + r22 * m12 + r32 * m13;
+		this.n22 = r12 * m21 + r22 * m22 + r32 * m23;
+		this.n32 = r12 * m31 + r22 * m32 + r32 * m33;
+		this.n42 = r12 * m41 + r22 * m42 + r32 * m43;
+
+		this.n13 = r13 * m11 + r23 * m12 + r33 * m13;
+		this.n23 = r13 * m21 + r23 * m22 + r33 * m23;
+		this.n33 = r13 * m31 + r23 * m32 + r33 * m33;
+		this.n43 = r13 * m41 + r23 * m42 + r33 * m43;
+
+		return this;
+
+	},
+
+	rotateX: function ( angle ) {
+
+		var m12 = this.n12,
+			m22 = this.n22,
+			m32 = this.n32,
+			m42 = this.n42,
+			m13 = this.n13,
+			m23 = this.n23,
+			m33 = this.n33,
+			m43 = this.n43,
+			c = Math.cos(angle),
+			s = Math.sin(angle);
+
+		this.n12 = c * m12 + s * m13;
+		this.n22 = c * m22 + s * m23;
+		this.n32 = c * m32 + s * m33;
+		this.n42 = c * m42 + s * m43;
+
+		this.n13 = c * m13 - s * m12;
+		this.n23 = c * m23 - s * m22;
+		this.n33 = c * m33 - s * m32;
+		this.n43 = c * m43 - s * m42;
+
+		return this;
+
+  	},
+
+	rotateY: function ( angle ) {
+
+		var m11 = this.n11,
+			m21 = this.n21,
+			m31 = this.n31,
+			m41 = this.n41,
+			m13 = this.n13,
+			m23 = this.n23,
+			m33 = this.n33,
+			m43 = this.n43,
+			c = Math.cos(angle),
+			s = Math.sin(angle);
+
+		this.n11 = c * m11 - s * m13;
+		this.n21 = c * m21 - s * m23;
+		this.n31 = c * m31 - s * m33;
+		this.n41 = c * m41 - s * m43;
+
+		this.n13 = c * m13 + s * m11;
+		this.n23 = c * m23 + s * m21;
+		this.n33 = c * m33 + s * m31;
+		this.n43 = c * m43 + s * m41;
+
+		return this;
+
+	},
+
+	rotateZ: function ( angle ) {
+
+		var m11 = this.n11,
+			m21 = this.n21,
+			m31 = this.n31,
+			m41 = this.n41,
+			m12 = this.n12,
+			m22 = this.n22,
+			m32 = this.n32,
+			m42 = this.n42,
+			c = Math.cos(angle),
+			s = Math.sin(angle);
+
+		this.n11 = c * m11 + s * m12;
+		this.n21 = c * m21 + s * m22;
+		this.n31 = c * m31 + s * m32;
+		this.n41 = c * m41 + s * m42;
+
+		this.n12 = c * m12 - s * m11;
+		this.n22 = c * m22 - s * m21;
+		this.n32 = c * m32 - s * m31;
+		this.n42 = c * m42 - s * m41;
+
+		return this;
+
+	},
+
+	translate: function ( v ) {
+
+		var x = v.x, y = v.y, z = v.z;
+
+		this.n14 = this.n11 * x + this.n12 * y + this.n13 * z + this.n14;
+		this.n24 = this.n21 * x + this.n22 * y + this.n23 * z + this.n24;
+		this.n34 = this.n31 * x + this.n32 * y + this.n33 * z + this.n34;
+		this.n44 = this.n41 * x + this.n42 * y + this.n43 * z + this.n44;
+
+		return this;
+
 	}
 
 };
@@ -794,7 +973,7 @@ THREE.Matrix4.makeInvert3x3 = function ( m1 ) {
 
 	if ( det === 0 ) {
 
-		console.error( 'THREE.Matrix4.makeInvert3x3: Matrix not invertible.' );
+		return null;
 
 	}
 

+ 153 - 151
src/extras/animation/Animation.js

@@ -10,7 +10,7 @@ THREE.Animation = function( root, data, interpolationType, JITCompile ) {
 	this.data = THREE.AnimationHandler.get( data );
 	this.hierarchy = THREE.AnimationHandler.parse( root );
 	this.currentTime = 0;
-	this.timeScale = 1;
+	this.timeScale = 0.001;
 	this.isPlaying = false;
 	this.isPaused = true;
 	this.loop = true;
@@ -20,6 +20,37 @@ THREE.Animation = function( root, data, interpolationType, JITCompile ) {
 	this.points = [];
 	this.target = new THREE.Vector3();
 
+	// initialize to first keyframes
+
+	for ( var h = 0, hl = this.hierarchy.length; h < hl; h++ ) {
+
+		var keys = this.data.hierarchy[h].keys,
+			sids = this.data.hierarchy[h].sids,
+			obj = this.hierarchy[h];
+
+		if ( keys.length ) {
+
+			for ( var s = 0; s < sids.length; s++ ) {
+
+				var sid = sids[ s ],
+					next = this.getNextKeyWith( sid, h, 0 );
+
+				if ( next ) {
+
+					next.apply( sid );
+
+				}
+
+			}
+
+			obj.matrixAutoUpdate = false;
+			this.data.hierarchy[h].node.updateMatrix();
+			obj.matrixWorldNeedsUpdate = true;
+
+		}
+
+	}
+
 };
 
 // Play
@@ -31,16 +62,21 @@ THREE.Animation.prototype.play = function( loop, startTimeMS ) {
 		this.isPlaying = true;
 		this.loop = loop !== undefined ? loop : true;
 		this.currentTime = startTimeMS !== undefined ? startTimeMS : 0;
+		this.startTimeMs = startTimeMS;
+		this.startTime = 10000000;
+		this.endTime = -this.startTime;
 
 
 		// reset key cache
 
 		var h, hl = this.hierarchy.length,
-			object;
+			object,
+			node;
 
 		for ( h = 0; h < hl; h++ ) {
 
 			object = this.hierarchy[ h ];
+			node = this.data.hierarchy[ h ];
 
 			if ( this.interpolationType !== THREE.AnimationHandler.CATMULLROM_FORWARD ) {
 
@@ -48,27 +84,26 @@ THREE.Animation.prototype.play = function( loop, startTimeMS ) {
 
 			}
 
-			object.matrixAutoUpdate = true;
-
-			if ( object.animationCache === undefined ) {
+			if ( node.animationCache === undefined ) {
 
-				object.animationCache = {};
-				object.animationCache.prevKey = { pos: 0, rot: 0, scl: 0 };
-				object.animationCache.nextKey = { pos: 0, rot: 0, scl: 0 };
-				object.animationCache.originalMatrix = object instanceof THREE.Bone ? object.skinMatrix : object.matrix;
+				node.animationCache = {};
+				node.animationCache.prevKey = null;
+				node.animationCache.nextKey = null;
+				node.animationCache.originalMatrix = object instanceof THREE.Bone ? object.skinMatrix : object.matrix;
 
 			}
 
-			var prevKey = object.animationCache.prevKey;
-			var nextKey = object.animationCache.nextKey;
+			var keys = this.data.hierarchy[h].keys;
+
+			if (keys.length) {
 
-			prevKey.pos = this.data.hierarchy[ h ].keys[ 0 ];
-			prevKey.rot = this.data.hierarchy[ h ].keys[ 0 ];
-			prevKey.scl = this.data.hierarchy[ h ].keys[ 0 ];
+				node.animationCache.prevKey = keys[ 0 ];
+				node.animationCache.nextKey = keys[ 1 ];
 
-			nextKey.pos = this.getNextKeyWith( "pos", h, 1 );
-			nextKey.rot = this.getNextKeyWith( "rot", h, 1 );
-			nextKey.scl = this.getNextKeyWith( "scl", h, 1 );
+				this.startTime = Math.min( keys[0].time, this.startTime );
+				this.endTime = Math.max( keys[keys.length - 1].time, this.endTime );
+
+			}
 
 		}
 
@@ -116,20 +151,25 @@ THREE.Animation.prototype.stop = function() {
 
 	for ( var h = 0; h < this.hierarchy.length; h++ ) {
 
-		if ( this.hierarchy[ h ].animationCache !== undefined ) {
+		var obj = this.hierarchy[ h ];
+
+		if ( obj.animationCache !== undefined ) {
 
-			if( this.hierarchy[ h ] instanceof THREE.Bone ) {
+			var original = obj.animationCache.originalMatrix;
 
-				this.hierarchy[ h ].skinMatrix = this.hierarchy[ h ].animationCache.originalMatrix;
+			if( obj instanceof THREE.Bone ) {
+
+				original.copy( obj.skinMatrix );
+				obj.skinMatrix = original;
 
 			} else {
 
-				this.hierarchy[ h ].matrix = this.hierarchy[ h ].animationCache.originalMatrix;
+				original.copy( obj.matrix );
+				obj.matrix = original;
 
 			}
 
-
-			delete this.hierarchy[ h ].animationCache;
+			delete obj.animationCache;
 
 		}
 
@@ -149,18 +189,13 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
 
 	// vars
 
-	var types = [ "pos", "rot", "scl" ];
-	var type;
-	var scale;
-	var vector;
-	var prevXYZ, nextXYZ;
 	var prevKey, nextKey;
 	var object;
-	var animationCache;
+	var node;
 	var frame;
 	var JIThierarchy = this.data.JIT.hierarchy;
 	var currentTime, unloopedCurrentTime;
-	var currentPoint, forwardPoint, angle;
+	var looped;
 
 
 	// update
@@ -169,188 +204,155 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
 
 	unloopedCurrentTime = this.currentTime;
 	currentTime         = this.currentTime = this.currentTime % this.data.length;
-	frame               = parseInt( Math.min( currentTime * this.data.fps, this.data.length * this.data.fps ), 10 );
 
+	// if looped around, the current time should be based on the startTime
+	if ( currentTime < this.startTimeMs ) {
 
-	// update
-
-	for ( var h = 0, hl = this.hierarchy.length; h < hl; h++ ) {
-
-		object = this.hierarchy[ h ];
-		animationCache = object.animationCache;
-
-		// use JIT?
-
-		if ( this.JITCompile && JIThierarchy[ h ][ frame ] !== undefined ) {
-
-			if( object instanceof THREE.Bone ) {
-
-				object.skinMatrix = JIThierarchy[ h ][ frame ];
+		currentTime = this.currentTime = this.startTimeMs + currentTime;
 
-				object.matrixAutoUpdate = false;
-				object.matrixWorldNeedsUpdate = false;
-
-			} else {
+	}
 
-				object.matrix = JIThierarchy[ h ][ frame ];
+	frame               = parseInt( Math.min( currentTime * this.data.fps, this.data.length * this.data.fps ), 10 );
+	looped 				= currentTime < unloopedCurrentTime;
 
-				object.matrixAutoUpdate = false;
-				object.matrixWorldNeedsUpdate = true;
+	if ( looped && !this.loop ) {
 
-			}
+		// Set the animation to the last keyframes and stop
+		for ( var h = 0, hl = this.hierarchy.length; h < hl; h++ ) {
 
-		// use interpolation
+			var keys = this.data.hierarchy[h].keys,
+				sids = this.data.hierarchy[h].sids,
+				end = keys.length-1,
+				obj = this.hierarchy[h];
 
-		} else {
+			if ( keys.length ) {
 
-			// make sure so original matrix and not JIT matrix is set
+				for ( var s = 0; s < sids.length; s++ ) {
 
-			if ( this.JITCompile ) {
+					var sid = sids[ s ],
+						prev = this.getPrevKeyWith( sid, h, end );
 
-				if( object instanceof THREE.Bone ) {
+					if ( prev ) {
 
-					object.skinMatrix = object.animationCache.originalMatrix;
+						prev.apply( sid );
 
-				} else {
-
-					object.matrix = object.animationCache.originalMatrix;
+					}
 
 				}
 
-			}
-
-
-			// loop through pos/rot/scl
-
-			for ( var t = 0; t < 3; t++ ) {
-
-				// get keys
+				this.data.hierarchy[h].node.updateMatrix();
+				obj.matrixWorldNeedsUpdate = true;
 
-				type    = types[ t ];
-				prevKey = animationCache.prevKey[ type ];
-				nextKey = animationCache.nextKey[ type ];
-
-				// switch keys?
+			}
 
-				if ( nextKey.time <= unloopedCurrentTime ) {
+		}
 
-					// did we loop?
+		this.stop();
+		return;
 
-					if ( currentTime < unloopedCurrentTime ) {
+	}
 
-						if ( this.loop ) {
+	// check pre-infinity
+	if ( currentTime < this.startTime ) {
 
-							prevKey = this.data.hierarchy[ h ].keys[ 0 ];
-							nextKey = this.getNextKeyWith( type, h, 1 );
+		return;
 
-							while( nextKey.time < currentTime ) {
+	}
 
-								prevKey = nextKey;
-								nextKey = this.getNextKeyWith( type, h, nextKey.index + 1 );
+	// update
 
-							}
+	for ( var h = 0, hl = this.hierarchy.length; h < hl; h++ ) {
 
-						} else {
+		object = this.hierarchy[ h ];
+		node = this.data.hierarchy[ h ];
 
-							this.stop();
-							return;
+		var keys = node.keys,
+			animationCache = node.animationCache;
 
-						}
+		// use JIT?
 
-					} else {
+		if ( this.JITCompile && JIThierarchy[ h ][ frame ] !== undefined ) {
 
-						do {
+			if( object instanceof THREE.Bone ) {
 
-							prevKey = nextKey;
-							nextKey = this.getNextKeyWith( type, h, nextKey.index + 1 );
+				object.skinMatrix = JIThierarchy[ h ][ frame ];
+				object.matrixWorldNeedsUpdate = false;
 
-						} while( nextKey.time < currentTime )
+			} else {
 
-					}
+				object.matrix = JIThierarchy[ h ][ frame ];
+				object.matrixWorldNeedsUpdate = true;
 
-					animationCache.prevKey[ type ] = prevKey;
-					animationCache.nextKey[ type ] = nextKey;
+			}
 
-				}
+		// use interpolation
 
+		} else if ( keys.length ) {
 
-				object.matrixAutoUpdate = true;
-				object.matrixWorldNeedsUpdate = true;
+			// make sure so original matrix and not JIT matrix is set
 
-				scale = ( currentTime - prevKey.time ) / ( nextKey.time - prevKey.time );
-				prevXYZ = prevKey[ type ];
-				nextXYZ = nextKey[ type ];
+			if ( this.JITCompile && animationCache ) {
 
+				if( object instanceof THREE.Bone ) {
 
-				// check scale error
+					object.skinMatrix = animationCache.originalMatrix;
 
-				if ( scale < 0 || scale > 1 ) {
+				} else {
 
-					console.log( "THREE.Animation.update: Warning! Scale out of bounds:" + scale + " on bone " + h );
-					scale = scale < 0 ? 0 : 1;
+					object.matrix = animationCache.originalMatrix;
 
 				}
 
-				// interpolate
+			}
 
-				if ( type === "pos" ) {
+			prevKey = animationCache.prevKey;
+			nextKey = animationCache.nextKey;
 
-					vector = object.position;
+			if ( prevKey && nextKey ) {
 
-					if( this.interpolationType === THREE.AnimationHandler.LINEAR ) {
+				// switch keys?
 
-						vector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale;
-						vector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale;
-						vector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;
+				if ( nextKey.time <= unloopedCurrentTime ) {
+
+					// did we loop?
 
-					} else if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||
-							    this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
+					if ( looped && this.loop ) {
 
-						this.points[ 0 ] = this.getPrevKeyWith( "pos", h, prevKey.index - 1 )[ "pos" ];
-						this.points[ 1 ] = prevXYZ;
-						this.points[ 2 ] = nextXYZ;
-						this.points[ 3 ] = this.getNextKeyWith( "pos", h, nextKey.index + 1 )[ "pos" ];
+						prevKey = keys[ 0 ];
+						nextKey = keys[ 1 ];
 
-						scale = scale * 0.33 + 0.33;
+						while ( nextKey.time < currentTime ) {
 
-						currentPoint = this.interpolateCatmullRom( this.points, scale );
+							prevKey = nextKey;
+							nextKey = keys[ prevKey.index + 1 ];
 
-						vector.x = currentPoint[ 0 ];
-						vector.y = currentPoint[ 1 ];
-						vector.z = currentPoint[ 2 ];
+						}
 
-						if( this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {
+					} else if ( !looped ) {
 
-							forwardPoint = this.interpolateCatmullRom( this.points, scale * 1.01 );
+						var lastIndex = keys.length - 1;
 
-							this.target.set( forwardPoint[ 0 ], forwardPoint[ 1 ], forwardPoint[ 2 ] );
-							this.target.subSelf( vector );
-							this.target.y = 0;
-							this.target.normalize();
+						while ( nextKey.time < currentTime && nextKey.index !== lastIndex ) {
 
-							angle = Math.atan2( this.target.x, this.target.z );
-							object.rotation.set( 0, angle, 0 );
+							prevKey = nextKey;
+							nextKey = keys[ prevKey.index + 1 ];
 
 						}
 
 					}
 
-				} else if ( type === "rot" ) {
-
-					THREE.Quaternion.slerp( prevXYZ, nextXYZ, object.quaternion, scale );
-
-				} else if( type === "scl" ) {
-
-					vector = object.scale;
-
-					vector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale;
-					vector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale;
-					vector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;
+					animationCache.prevKey = prevKey;
+					animationCache.nextKey = nextKey;
 
 				}
 
+				prevKey.interpolate( nextKey, currentTime );
+
 			}
 
+			this.data.hierarchy[h].node.updateMatrix();
+			object.matrixWorldNeedsUpdate = true;
+
 		}
 
 	}
@@ -361,7 +363,7 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
 
 		if ( JIThierarchy[ 0 ][ frame ] === undefined ) {
 
-			this.hierarchy[ 0 ].update( null, true );
+			this.hierarchy[ 0 ].updateMatrixWorld( true );
 
 			for ( var h = 0; h < this.hierarchy.length; h++ ) {
 
@@ -429,7 +431,7 @@ THREE.Animation.prototype.interpolate = function( p0, p1, p2, p3, t, t2, t3 ) {
 
 // Get next key with
 
-THREE.Animation.prototype.getNextKeyWith = function( type, h, key ) {
+THREE.Animation.prototype.getNextKeyWith = function( sid, h, key ) {
 
 	var keys = this.data.hierarchy[ h ].keys;
 
@@ -446,7 +448,7 @@ THREE.Animation.prototype.getNextKeyWith = function( type, h, key ) {
 
 	for ( ; key < keys.length; key++ ) {
 
-		if ( keys[ key ][ type ] !== undefined ) {
+		if ( keys[ key ].hasTarget( sid ) ) {
 
 			return keys[ key ];
 
@@ -454,13 +456,13 @@ THREE.Animation.prototype.getNextKeyWith = function( type, h, key ) {
 
 	}
 
-	return this.data.hierarchy[ h ].keys[ 0 ];
+	return keys[ 0 ];
 
 };
 
 // Get previous key with
 
-THREE.Animation.prototype.getPrevKeyWith = function( type, h, key ) {
+THREE.Animation.prototype.getPrevKeyWith = function( sid, h, key ) {
 
 	var keys = this.data.hierarchy[ h ].keys;
 
@@ -478,7 +480,7 @@ THREE.Animation.prototype.getPrevKeyWith = function( type, h, key ) {
 
 	for ( ; key >= 0; key-- ) {
 
-		if ( keys[ key ][ type ] !== undefined ) {
+		if ( keys[ key ].hasTarget( sid ) ) {
 
 			return keys[ key ];
 
@@ -486,6 +488,6 @@ THREE.Animation.prototype.getPrevKeyWith = function( type, h, key ) {
 
 	}
 
-	return this.data.hierarchy[ h ].keys[ keys.length - 1 ];
+	return keys[ keys.length - 1 ];
 
 };

+ 2 - 2
src/extras/animation/AnimationHandler.js

@@ -149,7 +149,7 @@ THREE.AnimationHandler = (function() {
 
 			// prepare morph target keys
 
-			if( data.hierarchy[ h ].keys[ 0 ].morphTargets !== undefined ) {
+			if( data.hierarchy[h].keys.length && data.hierarchy[ h ].keys[ 0 ].morphTargets !== undefined ) {
 
 				// get all used
 
@@ -219,7 +219,7 @@ THREE.AnimationHandler = (function() {
 
 			// set index
 
-			for( var k = 1; k < data.hierarchy[ h ].keys.length; k ++ ) {
+			for( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) {
 
 				data.hierarchy[ h ].keys[ k ].index = k;
 

Fișier diff suprimat deoarece este prea mare
+ 574 - 131
src/extras/loaders/ColladaLoader.js


+ 4 - 4
src/extras/loaders/JSONLoader.js

@@ -52,16 +52,15 @@ THREE.JSONLoader.prototype.loadAjaxJSON = function( context, url, callback, text
 
 					var jsonObject = JSON.parse( xhr.responseText );
 
-					context.createModel( jsonObject, callback, texturePath );
-					context.onLoadComplete();
-
 				} catch ( error ) {
 
-					console.error( error );
 					console.warn( "DEPRECATED: [" + url + "] seems to be using old model format" );
 
 				}
 
+				context.createModel( jsonObject, callback, texturePath );
+				context.onLoadComplete();
+
 			} else {
 
 				console.error( "Couldn't load [" + url + "] [" + xhr.status + "]" );
@@ -396,6 +395,7 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 				dstVertices = geometry.morphTargets[ i ].vertices;
 				srcVertices = json.morphTargets [ i ].vertices;
 
+
 				for( v = 0, vl = srcVertices.length; v < vl; v += 3 ) {
 
 					x = srcVertices[ v ] * scale;

+ 6 - 7
src/extras/loaders/Loader.js

@@ -112,17 +112,16 @@ THREE.Loader.prototype = {
 		function load_image( where, url ) {
 
 			var image = new Image();
-
 			image.onload = function () {
 
 				if ( !is_pow2( this.width ) || !is_pow2( this.height ) ) {
 
-					var w = nearest_pow2( this.width ),
-						h = nearest_pow2( this.height );
+					var width = nearest_pow2( this.width );
+					var height = nearest_pow2( this.height );
 
-					where.image.width = w;
-					where.image.height = h;
-					where.image.getContext("2d").drawImage( this, 0, 0, w, h );
+					where.image.width = width;
+					where.image.height = height;
+					where.image.getContext( '2d' ).drawImage( this, 0, 0, width, height );
 
 				} else {
 
@@ -133,7 +132,7 @@ THREE.Loader.prototype = {
 				where.needsUpdate = true;
 
 			};
-
+			image.crossOrigin = '';
 			image.src = url;
 
 		}

+ 7 - 1
src/renderers/WebGLRenderer.js

@@ -4490,7 +4490,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		object._modelViewMatrix.multiplyToArray( camera.matrixWorldInverse, object.matrixWorld, object._modelViewMatrixArray );
 
-		THREE.Matrix4.makeInvert3x3( object._modelViewMatrix ).transposeIntoArray( object._normalMatrixArray );
+		var inverseMatrix = THREE.Matrix4.makeInvert3x3( object._modelViewMatrix );
+
+		if ( inverseMatrix ) {
+
+			inverseMatrix.transposeIntoArray( object._normalMatrixArray );
+
+		}
 
 	};
 

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff