Browse Source

Added shadows for DirectionalLights.

After shadow mapping fixes orthographic shadow projection finally started to work.

Work in progress. Still need to figure out some way to set up shadow camera automagically with respect to the actual camera (so that whole scene is shadowed when the camera moves). For the moment shadow camera needs to be handled manually (like for SpotLight).
alteredq 13 years ago
parent
commit
6b0edfddaa

+ 253 - 253
build/Three.js

@@ -18,39 +18,39 @@ b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this
 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.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
 THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
 THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);r=o.dot(b);s=q.add(a,m.copy(b).multiplyScalar(r));return t=c.distanceTo(s)}function d(a,b,c,d){o.sub(d,b);q.sub(c,b);m.sub(a,b);u=o.dot(o);x=o.dot(q);w=o.dot(m);A=q.dot(q);D=q.dot(m);B=1/(u*A-x*x);C=(A*w-x*D)*B;F=(u*D-x*w)*B;return 0<=C&&0<=F&&1>C+F}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=[];for(b=0,
-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,i=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector3;this.intersectObject=function(a){for(var b,m=[],o=0,q=a.children.length;o<q;o++)Array.prototype.push.apply(m,this.intersectObject(a.children[o]));if(a instanceof THREE.Particle){o=
-c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.scale.x)return[];b={distance:o,point:a.position,face:null,object:a};m.push(b)}else if(a instanceof THREE.Mesh){o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return m;var j,r,s=a.geometry,t=s.vertices,y;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(o=0,q=s.faces.length;o<q;o++)if(b=s.faces[o],i.copy(this.origin),l.copy(this.direction),
-y=a.matrixWorld,k=y.multiplyVector3(k.copy(b.centroid)).subSelf(i),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),j=l.dot(n),!(1.0E-4>Math.abs(j))&&(r=n.dot(k)/j,!(0>r)&&(a.doubleSided||(a.flipSided?0<j:0>j))))if(p.add(i,l.multiplyScalar(r)),b instanceof THREE.Face3)e=y.multiplyVector3(e.copy(t[b.a].position)),f=y.multiplyVector3(f.copy(t[b.b].position)),g=y.multiplyVector3(g.copy(t[b.c].position)),d(p,e,f,g)&&(b={distance:i.distanceTo(p),point:p.clone(),face:b,object:a},m.push(b));else if(b instanceof
-THREE.Face4&&(e=y.multiplyVector3(e.copy(t[b.a].position)),f=y.multiplyVector3(f.copy(t[b.b].position)),g=y.multiplyVector3(g.copy(t[b.c].position)),h=y.multiplyVector3(h.copy(t[b.d].position)),d(p,e,f,h)||d(p,f,g,h)))b={distance:i.distanceTo(p),point:p.clone(),face:b,object:a},m.push(b)}return m};var o=new THREE.Vector3,q=new THREE.Vector3,m=new THREE.Vector3,r,s,t,u,x,w,A,D,B,C,F};
+THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);r=o.dot(b);s=p.add(a,m.copy(b).multiplyScalar(r));return t=c.distanceTo(s)}function d(a,b,c,d){o.sub(d,b);p.sub(c,b);m.sub(a,b);u=o.dot(o);x=o.dot(p);w=o.dot(m);A=p.dot(p);D=p.dot(m);B=1/(u*A-x*x);C=(A*w-x*D)*B;F=(u*D-x*w)*B;return 0<=C&&0<=F&&1>C+F}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=[];for(b=0,
+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,i=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3;this.intersectObject=function(a){for(var b,m=[],o=0,p=a.children.length;o<p;o++)Array.prototype.push.apply(m,this.intersectObject(a.children[o]));if(a instanceof THREE.Particle){o=
+c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.scale.x)return[];b={distance:o,point:a.position,face:null,object:a};m.push(b)}else if(a instanceof THREE.Mesh){o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return m;var j,r,s=a.geometry,t=s.vertices,y;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(o=0,p=s.faces.length;o<p;o++)if(b=s.faces[o],i.copy(this.origin),l.copy(this.direction),
+y=a.matrixWorld,k=y.multiplyVector3(k.copy(b.centroid)).subSelf(i),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),j=l.dot(n),!(1.0E-4>Math.abs(j))&&(r=n.dot(k)/j,!(0>r)&&(a.doubleSided||(a.flipSided?0<j:0>j))))if(q.add(i,l.multiplyScalar(r)),b instanceof THREE.Face3)e=y.multiplyVector3(e.copy(t[b.a].position)),f=y.multiplyVector3(f.copy(t[b.b].position)),g=y.multiplyVector3(g.copy(t[b.c].position)),d(q,e,f,g)&&(b={distance:i.distanceTo(q),point:q.clone(),face:b,object:a},m.push(b));else if(b instanceof
+THREE.Face4&&(e=y.multiplyVector3(e.copy(t[b.a].position)),f=y.multiplyVector3(f.copy(t[b.b].position)),g=y.multiplyVector3(g.copy(t[b.c].position)),h=y.multiplyVector3(h.copy(t[b.d].position)),d(q,e,f,h)||d(q,f,g,h)))b={distance:i.distanceTo(q),point:q.clone(),face:b,object:a},m.push(b)}return m};var o=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,r,s,t,u,x,w,A,D,B,C,F};
 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,n){h=!1;b=f;c=g;d=k;e=n;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,n,p,o){h?(h=!1,b=f<k?f<p?f:p:k<p?k:p,c=g<n?g<o?g:o:n<o?n:o,d=f>k?f>p?f:p:k>p?k:p,e=g>n?g>o?g:o:n>o?n:o):(b=f<k?f<p?f<b?f:b:p<b?p:b:k<p?k<b?k:b:p<b?p:b,c=g<n?g<o?g<c?g:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c,d=f>k?f>p?f>d?f:d:p>d?p:d:k>p?k>d?k:d:p>d?p:d,e=g>n?g>o?g>e?g:e:o>e?o:e:n>o?n>e?n: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>
+function(f,g,k,n,q,o){h?(h=!1,b=f<k?f<q?f:q:k<q?k:q,c=g<n?g<o?g:o:n<o?n:o,d=f>k?f>q?f:q:k>q?k:q,e=g>n?g>o?g:o:n>o?n:o):(b=f<k?f<q?f<b?f:b:q<b?q:b:k<q?k<b?k:b:q<b?q:b,c=g<n?g<o?g<c?g:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c,d=f>k?f>q?f>d?f:d:q>d?q:d:k>q?k>d?k:d:q>d?q:d,e=g>n?g>o?g>e?g:e:o>e?o:e:n>o?n>e?n:e:o>e?o:e);a()};this.addRectangle=function(f){h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),e=e>
 f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())}};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,i,l,k,n,p,o,q,m){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,i||0,l||0,void 0!==k?k:1,n||0,p||0,o||0,q||0,void 0!==m?m: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,i,l,k,n,p,o,q,m){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=i;this.n32=l;this.n33=k;this.n34=n;this.n41=p;this.n42=o;this.n43=q;this.n44=m;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).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,i=a.n23,l=a.n24,k=a.n31,n=a.n32,p=a.n33,o=a.n34,q=a.n41,m=a.n42,r=a.n43,
-s=a.n44,t=b.n11,u=b.n12,x=b.n13,w=b.n14,A=b.n21,D=b.n22,B=b.n23,C=b.n24,F=b.n31,K=b.n32,L=b.n33,T=b.n34,M=b.n41,G=b.n42,j=b.n43,Q=b.n44;this.n11=c*t+d*A+e*F+f*M;this.n12=c*u+d*D+e*K+f*G;this.n13=c*x+d*B+e*L+f*j;this.n14=c*w+d*C+e*T+f*Q;this.n21=g*t+h*A+i*F+l*M;this.n22=g*u+h*D+i*K+l*G;this.n23=g*x+h*B+i*L+l*j;this.n24=g*w+h*C+i*T+l*Q;this.n31=k*t+n*A+p*F+o*M;this.n32=k*u+n*D+p*K+o*G;this.n33=k*x+n*B+p*L+o*j;this.n34=k*w+n*C+p*T+o*Q;this.n41=q*t+m*A+r*F+s*M;this.n42=q*u+m*D+r*K+s*G;this.n43=q*x+m*
-B+r*L+s*j;this.n44=q*w+m*C+r*T+s*Q;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,i,l,k,n,q,o,p,m){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,i||0,l||0,void 0!==k?k:1,n||0,q||0,o||0,p||0,void 0!==m?m: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,i,l,k,n,q,o,p,m){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=h;this.n31=i;this.n32=l;this.n33=k;this.n34=n;this.n41=q;this.n42=o;this.n43=p;this.n44=m;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());e.cross(f,d).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,i=a.n23,l=a.n24,k=a.n31,n=a.n32,q=a.n33,o=a.n34,p=a.n41,m=a.n42,r=a.n43,
+s=a.n44,t=b.n11,u=b.n12,x=b.n13,w=b.n14,A=b.n21,D=b.n22,B=b.n23,C=b.n24,F=b.n31,K=b.n32,L=b.n33,T=b.n34,M=b.n41,G=b.n42,j=b.n43,Q=b.n44;this.n11=c*t+d*A+e*F+f*M;this.n12=c*u+d*D+e*K+f*G;this.n13=c*x+d*B+e*L+f*j;this.n14=c*w+d*C+e*T+f*Q;this.n21=g*t+h*A+i*F+l*M;this.n22=g*u+h*D+i*K+l*G;this.n23=g*x+h*B+i*L+l*j;this.n24=g*w+h*C+i*T+l*Q;this.n31=k*t+n*A+q*F+o*M;this.n32=k*u+n*D+q*K+o*G;this.n33=k*x+n*B+q*L+o*j;this.n34=k*w+n*C+q*T+o*Q;this.n41=p*t+m*A+r*F+s*M;this.n42=p*u+m*D+r*K+s*G;this.n43=p*x+m*
+B+r*L+s*j;this.n44=p*w+m*C+r*T+s*Q;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*
 c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
-a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,i=this.n31,l=this.n32,k=this.n33,n=this.n34,p=this.n41,o=this.n42,q=this.n43,m=this.n44;return d*g*l*p-c*h*l*p-d*f*k*p+b*h*k*p+c*f*n*p-b*g*n*p-d*g*i*o+c*h*i*o+d*e*k*o-a*h*k*o-c*e*n*o+a*g*n*o+d*f*i*q-b*h*i*q-d*e*l*q+a*h*l*q+b*e*n*q-a*f*n*q-c*f*i*m+b*g*i*m+c*e*l*m-a*g*l*m-b*e*k*m+a*f*k*m},transpose:function(){var a;
+a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,i=this.n31,l=this.n32,k=this.n33,n=this.n34,q=this.n41,o=this.n42,p=this.n43,m=this.n44;return d*g*l*q-c*h*l*q-d*f*k*q+b*h*k*q+c*f*n*q-b*g*n*q-d*g*i*o+c*h*i*o+d*e*k*o-a*h*k*o-c*e*n*o+a*g*n*o+d*f*i*p-b*h*i*p-d*e*l*p+a*h*l*p+b*e*n*p-a*f*n*p-c*f*i*m+b*g*i*m+c*e*l*m-a*g*l*m-b*e*k*m+a*f*k*m},transpose:function(){var a;
 a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;return this},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,i=e*f,l=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,l*g+c,l*h-d*f,0,i*h-d*g,l*h+d*f,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,i=a.n24,l=a.n31,k=a.n32,n=a.n33,p=a.n34,o=a.n41,q=a.n42,m=a.n43,r=a.n44;this.n11=h*p*q-i*n*q+i*k*m-g*p*m-h*k*r+g*n*r;this.n12=e*n*q-d*p*q-e*k*m+c*p*m+d*k*r-c*n*r;this.n13=d*i*q-e*h*q+e*g*m-c*i*m-d*g*r+c*h*r;this.n14=e*h*k-d*i*k-e*g*n+c*i*n+d*g*p-c*h*p;this.n21=i*n*o-h*p*o-i*l*m+f*p*m+h*l*r-f*n*r;this.n22=d*p*o-e*n*o+
-e*l*m-b*p*m-d*l*r+b*n*r;this.n23=e*h*o-d*i*o-e*f*m+b*i*m+d*f*r-b*h*r;this.n24=d*i*l-e*h*l+e*f*n-b*i*n-d*f*p+b*h*p;this.n31=g*p*o-i*k*o+i*l*q-f*p*q-g*l*r+f*k*r;this.n32=e*k*o-c*p*o-e*l*q+b*p*q+c*l*r-b*k*r;this.n33=c*i*o-e*g*o+e*f*q-b*i*q-c*f*r+b*g*r;this.n34=e*g*l-c*i*l-e*f*k+b*i*k+c*f*p-b*g*p;this.n41=h*k*o-g*n*o-h*l*q+f*n*q+g*l*m-f*k*m;this.n42=c*n*o-d*k*o+d*l*q-b*n*q-c*l*m+b*k*m;this.n43=d*g*o-c*h*o-d*f*q+b*h*q+c*f*m-b*g*m;this.n44=c*h*l-d*g*l+d*f*k-b*h*k-c*f*n+b*g*n;this.multiplyScalar(1/a.determinant());
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,i=a.n24,l=a.n31,k=a.n32,n=a.n33,q=a.n34,o=a.n41,p=a.n42,m=a.n43,r=a.n44;this.n11=h*q*p-i*n*p+i*k*m-g*q*m-h*k*r+g*n*r;this.n12=e*n*p-d*q*p-e*k*m+c*q*m+d*k*r-c*n*r;this.n13=d*i*p-e*h*p+e*g*m-c*i*m-d*g*r+c*h*r;this.n14=e*h*k-d*i*k-e*g*n+c*i*n+d*g*q-c*h*q;this.n21=i*n*o-h*q*o-i*l*m+f*q*m+h*l*r-f*n*r;this.n22=d*q*o-e*n*o+
+e*l*m-b*q*m-d*l*r+b*n*r;this.n23=e*h*o-d*i*o-e*f*m+b*i*m+d*f*r-b*h*r;this.n24=d*i*l-e*h*l+e*f*n-b*i*n-d*f*q+b*h*q;this.n31=g*q*o-i*k*o+i*l*p-f*q*p-g*l*r+f*k*r;this.n32=e*k*o-c*q*o-e*l*p+b*q*p+c*l*r-b*k*r;this.n33=c*i*o-e*g*o+e*f*p-b*i*p-c*f*r+b*g*r;this.n34=e*g*l-c*i*l-e*f*k+b*i*k+c*f*q-b*g*q;this.n41=h*k*o-g*n*o-h*l*p+f*n*p+g*l*m-f*k*m;this.n42=c*n*o-d*k*o+d*l*p-b*n*p-c*l*m+b*k*m;this.n43=d*g*o-c*h*o-d*f*p+b*h*p+c*f*m-b*g*m;this.n44=c*h*l-d*g*l+d*f*k-b*h*k-c*f*n+b*g*n;this.multiplyScalar(1/a.determinant());
 return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=g*h,l=g*e,k=d*h,n=d*e;this.n11=i+n*c;this.n12=k*c-l;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=l*c-k;this.n32=n+i*c;this.n33=f*g;break;case "ZXY":i=g*h;l=g*e;k=d*h;n=d*e;this.n11=i-n*c;this.n12=-f*e;this.n13=k+l*c;this.n21=l+k*c;this.n22=f*h;this.n23=n-i*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":i=
 f*h;l=f*e;k=c*h;n=c*e;this.n11=g*h;this.n12=k*d-l;this.n13=i*d+n;this.n21=g*e;this.n22=n*d+i;this.n23=l*d-k;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":i=f*g;l=f*d;k=c*g;n=c*d;this.n11=g*h;this.n12=n-i*e;this.n13=k*e+l;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=l*e+k;this.n33=i-n*e;break;case "XZY":i=f*g;l=f*d;k=c*g;n=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=i*e+n;this.n22=f*h;this.n23=l*e-k;this.n31=k*e-l;this.n32=c*h;this.n33=n*e+i;break;default:i=f*h,l=f*
 e,k=c*h,n=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=l+k*d,this.n22=i-n*d,this.n23=-c*g,this.n31=n-i*d,this.n32=k+l*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,i=b*g,b=b*h,l=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(l+d);this.n12=i-e;this.n13=b+g;this.n21=i+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+l);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
 a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);e.setScale(c.x,c.y,c.z);this.multiply(d,e);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);e.set(this.n12,this.n22,this.n32);f.set(this.n13,
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=e.length();c.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===
-a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,i=Math.cos(b),l=Math.sin(b),k=1-i,n=c*d*k,p=c*e*k,k=d*e*k,c=c*l,o=d*l,l=e*l,e=f+(1-f)*i,f=n+l,d=p-o,n=n-l,g=g+(1-g)*i,l=k+c,p=p+o,k=k-c,h=h+(1-h)*i,i=this.n11,c=this.n21,o=this.n31,q=this.n41,m=this.n12,r=this.n22,s=this.n32,t=this.n42,u=this.n13,x=this.n23,w=this.n33,A=this.n43;this.n11=e*i+f*m+d*u;this.n21=e*c+f*r+d*x;this.n31=e*o+f*s+d*w;this.n41=e*q+f*t+d*A;this.n12=n*i+g*m+l*u;this.n22=
-n*c+g*r+l*x;this.n32=n*o+g*s+l*w;this.n42=n*q+g*t+l*A;this.n13=p*i+k*m+h*u;this.n23=p*c+k*r+h*x;this.n33=p*o+k*s+h*w;this.n43=p*q+k*t+h*A;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,i=this.n43,l=Math.cos(a),a=Math.sin(a);this.n12=l*b+a*f;this.n22=l*c+a*g;this.n32=l*d+a*h;this.n42=l*e+a*i;this.n13=l*f-a*b;this.n23=l*g-a*c;this.n33=l*h-a*d;this.n43=l*i-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,
+a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,f=Math.sqrt(c*c+d*d+e*e),c=c/f,d=d/f,e=e/f,f=c*c,g=d*d,h=e*e,i=Math.cos(b),l=Math.sin(b),k=1-i,n=c*d*k,q=c*e*k,k=d*e*k,c=c*l,o=d*l,l=e*l,e=f+(1-f)*i,f=n+l,d=q-o,n=n-l,g=g+(1-g)*i,l=k+c,q=q+o,k=k-c,h=h+(1-h)*i,i=this.n11,c=this.n21,o=this.n31,p=this.n41,m=this.n12,r=this.n22,s=this.n32,t=this.n42,u=this.n13,x=this.n23,w=this.n33,A=this.n43;this.n11=e*i+f*m+d*u;this.n21=e*c+f*r+d*x;this.n31=e*o+f*s+d*w;this.n41=e*p+f*t+d*A;this.n12=n*i+g*m+l*u;this.n22=
+n*c+g*r+l*x;this.n32=n*o+g*s+l*w;this.n42=n*p+g*t+l*A;this.n13=q*i+k*m+h*u;this.n23=q*c+k*r+h*x;this.n33=q*o+k*s+h*w;this.n43=q*p+k*t+h*A;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,i=this.n43,l=Math.cos(a),a=Math.sin(a);this.n12=l*b+a*f;this.n22=l*c+a*g;this.n32=l*d+a*h;this.n42=l*e+a*i;this.n13=l*f-a*b;this.n23=l*g-a*c;this.n33=l*h-a*d;this.n43=l*i-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,
 f=this.n13,g=this.n23,h=this.n33,i=this.n43,l=Math.cos(a),a=Math.sin(a);this.n11=l*b-a*f;this.n21=l*c-a*g;this.n31=l*d-a*h;this.n41=l*e-a*i;this.n13=l*f+a*b;this.n23=l*g+a*c;this.n33=l*h+a*d;this.n43=l*i+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,f=this.n12,g=this.n22,h=this.n32,i=this.n42,l=Math.cos(a),a=Math.sin(a);this.n11=l*b+a*f;this.n21=l*c+a*g;this.n31=l*d+a*h;this.n41=l*e+a*i;this.n12=l*f-a*b;this.n22=l*g-a*c;this.n32=l*h-a*d;this.n42=l*i-a*e;return this},
 translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}};
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*g+a.n31*l;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*h;c[5]=a*i;c[6]=a*l;c[7]=a*k;c[8]=a*n;return b};
@@ -63,13 +63,13 @@ this.children.indexOf(a)){void 0!==a.parent&&a.parent.remove(a);a.parent=this;th
 a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function a(){var a=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=l[i]=l[i]||new THREE.RenderableVertex;i++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
-var e,f,g=[],h,i,l=[],k,n,p=[],o,q=[],m,r,s=[],t,u,x=[],w={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,D=new THREE.Vector4,B=new THREE.Matrix4,C=new THREE.Matrix4,F=new THREE.Frustum,K=new THREE.Vector4,L=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);B.multiply(b.projectionMatrix,b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);B.multiply(b.matrixWorld,
+var e,f,g=[],h,i,l=[],k,n,q=[],o,p=[],m,r,s=[],t,u,x=[],w={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,D=new THREE.Vector4,B=new THREE.Matrix4,C=new THREE.Matrix4,F=new THREE.Frustum,K=new THREE.Vector4,L=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);B.multiply(b.projectionMatrix,b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);B.multiply(b.matrixWorld,
 b.projectionMatrixInverse);B.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;w.objects.length=0;w.sprites.length=0;w.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||F.contains(b))?(B.multiplyVector3(A.copy(b.position)),e=a(),e.object=
 b,e.z=A.z,w.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(B.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,w.sprites.push(e)):b instanceof THREE.Light&&w.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&w.objects.sort(c);return w};this.projectScene=function(a,e,f){var g=e.near,A=e.far,I,R,y,E,P,$,Z,ga,fa,S,aa,ba,ca,ha,Na,ja;u=r=o=n=0;w.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
 a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);B.multiply(e.projectionMatrix,e.matrixWorldInverse);F.setFromMatrix(B);w=this.projectGraph(a,!1);for(a=0,I=w.objects.length;a<I;a++)if(fa=w.objects[a].object,S=fa.matrixWorld,ba=fa.material,i=0,fa instanceof THREE.Mesh){aa=fa.geometry;ca=fa.geometry.materials;E=aa.vertices;ha=aa.faces;Na=aa.faceVertexUvs;aa=fa.matrixRotationWorld.extractRotation(S);for(R=0,y=E.length;R<y;R++)h=b(),h.positionWorld.copy(E[R].position),S.multiplyVector3(h.positionWorld),
 h.positionScreen.copy(h.positionWorld),B.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;for(E=0,R=ha.length;E<R;E++){y=ha[E];if(y instanceof THREE.Face3)if(P=l[y.a],$=l[y.b],Z=l[y.c],P.visible&&$.visible&&Z.visible&&(fa.doubleSided||fa.flipSided!=0>(Z.positionScreen.x-P.positionScreen.x)*($.positionScreen.y-P.positionScreen.y)-(Z.positionScreen.y-P.positionScreen.y)*($.positionScreen.x-
-P.positionScreen.x)))ga=p[n]=p[n]||new THREE.RenderableFace3,n++,k=ga,k.v1.copy(P),k.v2.copy($),k.v3.copy(Z);else continue;else if(y instanceof THREE.Face4)if(P=l[y.a],$=l[y.b],Z=l[y.c],ga=l[y.d],P.visible&&$.visible&&Z.visible&&ga.visible&&(fa.doubleSided||fa.flipSided!=(0>(ga.positionScreen.x-P.positionScreen.x)*($.positionScreen.y-P.positionScreen.y)-(ga.positionScreen.y-P.positionScreen.y)*($.positionScreen.x-P.positionScreen.x)||0>($.positionScreen.x-Z.positionScreen.x)*(ga.positionScreen.y-
-Z.positionScreen.y)-($.positionScreen.y-Z.positionScreen.y)*(ga.positionScreen.x-Z.positionScreen.x))))ja=q[o]=q[o]||new THREE.RenderableFace4,o++,k=ja,k.v1.copy(P),k.v2.copy($),k.v3.copy(Z),k.v4.copy(ga);else continue;k.normalWorld.copy(y.normal);aa.multiplyVector3(k.normalWorld);k.centroidWorld.copy(y.centroid);S.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);B.multiplyVector3(k.centroidScreen);Z=y.vertexNormals;for(P=0,$=Z.length;P<$;P++)ga=k.vertexNormalsWorld[P],ga.copy(Z[P]),
+P.positionScreen.x)))ga=q[n]=q[n]||new THREE.RenderableFace3,n++,k=ga,k.v1.copy(P),k.v2.copy($),k.v3.copy(Z);else continue;else if(y instanceof THREE.Face4)if(P=l[y.a],$=l[y.b],Z=l[y.c],ga=l[y.d],P.visible&&$.visible&&Z.visible&&ga.visible&&(fa.doubleSided||fa.flipSided!=(0>(ga.positionScreen.x-P.positionScreen.x)*($.positionScreen.y-P.positionScreen.y)-(ga.positionScreen.y-P.positionScreen.y)*($.positionScreen.x-P.positionScreen.x)||0>($.positionScreen.x-Z.positionScreen.x)*(ga.positionScreen.y-
+Z.positionScreen.y)-($.positionScreen.y-Z.positionScreen.y)*(ga.positionScreen.x-Z.positionScreen.x))))ja=p[o]=p[o]||new THREE.RenderableFace4,o++,k=ja,k.v1.copy(P),k.v2.copy($),k.v3.copy(Z),k.v4.copy(ga);else continue;k.normalWorld.copy(y.normal);aa.multiplyVector3(k.normalWorld);k.centroidWorld.copy(y.centroid);S.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);B.multiplyVector3(k.centroidScreen);Z=y.vertexNormals;for(P=0,$=Z.length;P<$;P++)ga=k.vertexNormalsWorld[P],ga.copy(Z[P]),
 aa.multiplyVector3(ga);for(P=0,$=Na.length;P<$;P++)if(ja=Na[P][E])for(Z=0,ga=ja.length;Z<ga;Z++)k.uvs[P][Z]=ja[Z];k.material=ba;k.faceMaterial=null!==y.materialIndex?ca[y.materialIndex]:null;k.z=k.centroidScreen.z;w.elements.push(k)}}else if(fa instanceof THREE.Line){C.multiply(B,S);E=fa.geometry.vertices;P=b();P.positionScreen.copy(E[0].position);C.multiplyVector4(P.positionScreen);for(R=1,y=E.length;R<y;R++)if(P=b(),P.positionScreen.copy(E[R].position),C.multiplyVector4(P.positionScreen),$=l[i-
 2],K.copy(P.positionScreen),L.copy($.positionScreen),d(K,L))K.multiplyScalar(1/K.w),L.multiplyScalar(1/L.w),fa=s[r]=s[r]||new THREE.RenderableLine,r++,m=fa,m.v1.positionScreen.copy(K),m.v2.positionScreen.copy(L),m.z=Math.max(K.z,L.z),m.material=ba,w.elements.push(m)}for(a=0,I=w.sprites.length;a<I;a++)if(fa=w.sprites[a].object,S=fa.matrixWorld,fa instanceof THREE.Particle&&(D.set(S.n14,S.n24,S.n34,1),B.multiplyVector4(D),D.z/=D.w,0<D.z&&1>D.z))g=x[u]=x[u]||new THREE.RenderableParticle,u++,t=g,t.x=
 D.x/D.w,t.y=D.y/D.w,t.z=D.z,t.rotation=fa.rotation.z,t.scale.x=fa.scale.x*Math.abs(t.x-(D.x+e.projectionMatrix.n11)/(D.w+e.projectionMatrix.n14)),t.scale.y=fa.scale.y*Math.abs(t.y-(D.y+e.projectionMatrix.n22)/(D.w+e.projectionMatrix.n24)),t.material=fa.material,w.elements.push(t);f&&w.elements.sort(c);return w}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,void 0!==d?d:1)};
@@ -88,13 +88,13 @@ 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;for(a=0,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(void 0===this.__tmpVertices){d=this.__tmpVertices=Array(this.vertices.length);for(a=0,b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;for(a=0,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;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),
 d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,
-b,c,d,e,f,j){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=g[e];n=g[f];p=g[j];o=i.x-h.x;q=l.x-h.x;m=i.y-h.y;r=l.y-h.y;s=i.z-h.z;t=l.z-h.z;u=n.u-k.u;x=p.u-k.u;w=n.v-k.v;A=p.v-k.v;D=1/(u*A-x*w);K.set((A*o-w*q)*D,(A*m-w*r)*D,(A*s-w*t)*D);L.set((u*q-x*o)*D,(u*r-x*m)*D,(u*t-x*s)*D);C[b].addSelf(K);C[c].addSelf(K);C[d].addSelf(K);F[b].addSelf(L);F[c].addSelf(L);F[d].addSelf(L)}var b,c,d,e,f,g,h,i,l,k,n,p,o,q,m,r,s,t,u,x,w,A,D,B,C=[],F=[],K=new THREE.Vector3,L=new THREE.Vector3,
+b,c,d,e,f,j){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=g[e];n=g[f];q=g[j];o=i.x-h.x;p=l.x-h.x;m=i.y-h.y;r=l.y-h.y;s=i.z-h.z;t=l.z-h.z;u=n.u-k.u;x=q.u-k.u;w=n.v-k.v;A=q.v-k.v;D=1/(u*A-x*w);K.set((A*o-w*p)*D,(A*m-w*r)*D,(A*s-w*t)*D);L.set((u*p-x*o)*D,(u*r-x*m)*D,(u*t-x*s)*D);C[b].addSelf(K);C[c].addSelf(K);C[d].addSelf(K);F[b].addSelf(L);F[c].addSelf(L);F[d].addSelf(L)}var b,c,d,e,f,g,h,i,l,k,n,q,o,p,m,r,s,t,u,x,w,A,D,B,C=[],F=[],K=new THREE.Vector3,L=new THREE.Vector3,
 T=new THREE.Vector3,M=new THREE.Vector3,G=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)C[b]=new THREE.Vector3,F[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var j=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)G.copy(f.vertexNormals[d]),e=f[j[d]],
 B=C[e],T.copy(B),T.subSelf(G.multiplyScalar(G.dot(B))).normalize(),M.cross(f.vertexNormals[d],B),e=M.dot(F[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(T.x,T.y,T.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox?(this.boundingBox.min.copy(a),this.boundingBox.max.copy(a)):this.boundingBox={min:a.clone(),max:a.clone()};for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<e;d++){a=
 this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}},computeBoundingSphere:function(){for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere={radius:b}},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;for(f=0,g=this.vertices.length;f<g;f++)d=this.vertices[f].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*
 e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];for(f=0,g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,l,k,n,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;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?f:f+1;c[3]=f>this.points.length-3?f:f+2;l=this.points[c[0]];k=this.points[c[1]];
-n=this.points[c[2]];p=this.points[c[3]];h=g*g;i=g*h;d.x=b(l.x,k.x,n.x,p.x,g,h,i);d.y=b(l.y,k.y,n.y,p.y,g,h,i);d.z=b(l.z,k.z,n.z,p.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),
+THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,l,k,n,q;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?f:f+1;c[3]=f>this.points.length-3?f:f+2;l=this.points[c[0]];k=this.points[c[1]];
+n=this.points[c[2]];q=this.points[c[3]];h=g*g;i=g*h;d.x=b(l.x,k.x,n.x,q.x,g,h,i);d.y=b(l.y,k.y,n.y,q.y,g,h,i);d.z=b(l.z,k.z,n.z,q.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),
 f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,l=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=l.chunks[b]-l.chunks[b-1];g=Math.ceil(a*c/l.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
 h}};THREE.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,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
@@ -102,8 +102,8 @@ THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.Or
 THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((void 0!==b?b:43.25)/(2*a));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
-THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=new THREE.Light;
-THREE.PointLight.prototype.constructor=THREE.PointLight;
+THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.onlyShadow=this.castShadow=!1;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=this.shadowMapSize=
+this.shadowMap=null};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.SpotLight=function(a,b,c,d){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.castShadow=void 0!==d?d:!1;this.onlyShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};
 THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
 THREE.Material=function(a){a=a||{};this.name="";this.id=THREE.MaterialCount++;this.opacity=void 0!==a.opacity?a.opacity:1;this.transparent=void 0!==a.transparent?a.transparent:!1;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.depthTest=void 0!==a.depthTest?a.depthTest:!0;this.depthWrite=void 0!==a.depthWrite?a.depthWrite:!0;this.polygonOffset=void 0!==a.polygonOffset?a.polygonOffset:!1;this.polygonOffsetFactor=void 0!==a.polygonOffsetFactor?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
@@ -155,45 +155,45 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)-1===this.lights.indexOf(a)&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.objects.indexOf(a)){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);-1!==b&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),-1!==b&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
 THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};
-THREE.DOMRenderer=function(){var a=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 i,l,k,n,p,o,q,m;a=b.projectScene(c,d);for(i=0,l=a.length;i<l;i++)if(p=a[i],p instanceof THREE.RenderableParticle){q=p.x*e+e;m=p.y*f+f;for(k=0,n=p.material.length;k<n;k++)if(o=p.material[k],o instanceof THREE.ParticleDOMMaterial)o=o.domElement,o.style.left=q+"px",o.style.top=m+"px"}}};
+THREE.DOMRenderer=function(){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 i,l,k,n,q,o,p,m;a=b.projectScene(c,d);for(i=0,l=a.length;i<l;i++)if(q=a[i],q instanceof THREE.RenderableParticle){p=q.x*e+e;m=q.y*f+f;for(k=0,n=q.material.length;k<n;k++)if(o=q.material[k],o instanceof THREE.ParticleDOMMaterial)o=o.domElement,o.style.left=p+"px",o.style.top=m+"px"}}};
 THREE.CanvasRenderer=function(a){function b(a){if(t!=a)m.globalAlpha=t=a}function c(a){if(u!=a){switch(a){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}u=a}}function d(a){if(x!=a)m.strokeStyle=x=a}function e(a){if(w!=a)m.fillStyle=w=a}var a=a||{},f=this,g,h,i,l=new THREE.Projector,k=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
-n,p,o,q,m=k.getContext("2d"),r=new THREE.Color(0),s=0,t=1,u=0,x=null,w=null,A=null,D=null,B=null,C,F,K,L,T=new THREE.RenderableVertex,M=new THREE.RenderableVertex,G,j,Q,I,R,y,E,P,$,Z,ga,fa,S=new THREE.Color,aa=new THREE.Color,ba=new THREE.Color,ca=new THREE.Color,ha=new THREE.Color,Na=[],ja=[],za,qa,Ga,Ea,Sa,Ta,Wa,fb,Za,lb,Oa=new THREE.Rectangle,Ka=new THREE.Rectangle,xa=new THREE.Rectangle,Sb=!1,V=new THREE.Color,O=new THREE.Color,ib=new THREE.Color,Ha=new THREE.Vector3,hc,ic,Mc,bb,jc,vc,a=16;hc=
-document.createElement("canvas");hc.width=hc.height=2;ic=hc.getContext("2d");ic.fillStyle="rgba(0,0,0,1)";ic.fillRect(0,0,2,2);Mc=ic.getImageData(0,0,2,2);bb=Mc.data;jc=document.createElement("canvas");jc.width=jc.height=a;vc=jc.getContext("2d");vc.translate(-a/2,-a/2);vc.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){n=a;p=b;o=Math.floor(n/2);q=Math.floor(p/2);k.width=n;k.height=p;Oa.set(-o,
--q,o,q);Ka.set(-o,-q,o,q);t=1;u=0;B=D=A=w=x=null};this.setClearColor=function(a,b){r.copy(a);s=b;Ka.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;Ka.set(-o,-q,o,q)};this.clear=function(){m.setTransform(1,0,0,-1,o,q);Ka.isEmpty()||(Ka.minSelf(Oa),Ka.inflate(2),1>s&&m.clearRect(Math.floor(Ka.getX()),Math.floor(Ka.getY()),Math.floor(Ka.getWidth()),Math.floor(Ka.getHeight())),0<s&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*
-r.b)+","+s+")"),m.fillRect(Math.floor(Ka.getX()),Math.floor(Ka.getY()),Math.floor(Ka.getWidth()),Math.floor(Ka.getHeight()))),Ka.empty())};this.render=function(a,k){function p(a){var b,c,d,e;V.setRGB(0,0,0);O.setRGB(0,0,0);ib.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(V.r+=e.r,V.g+=e.g,V.b+=e.b):d instanceof THREE.DirectionalLight?(O.r+=e.r,O.g+=e.g,O.b+=e.b):d instanceof THREE.PointLight&&(ib.r+=e.r,ib.g+=e.g,ib.b+=e.b)}function n(a,b,c,d){var e,f,
+n,q,o,p,m=k.getContext("2d"),r=new THREE.Color(0),s=0,t=1,u=0,x=null,w=null,A=null,D=null,B=null,C,F,K,L,T=new THREE.RenderableVertex,M=new THREE.RenderableVertex,G,j,Q,I,R,y,E,P,$,Z,ga,fa,S=new THREE.Color,aa=new THREE.Color,ba=new THREE.Color,ca=new THREE.Color,ha=new THREE.Color,Na=[],ja=[],za,qa,Ga,Ea,Sa,Ta,Wa,fb,Za,kb,Oa=new THREE.Rectangle,Ka=new THREE.Rectangle,xa=new THREE.Rectangle,Rb=!1,V=new THREE.Color,O=new THREE.Color,Sb=new THREE.Color,Ha=new THREE.Vector3,hc,ic,Mc,bb,jc,vc,a=16;hc=
+document.createElement("canvas");hc.width=hc.height=2;ic=hc.getContext("2d");ic.fillStyle="rgba(0,0,0,1)";ic.fillRect(0,0,2,2);Mc=ic.getImageData(0,0,2,2);bb=Mc.data;jc=document.createElement("canvas");jc.width=jc.height=a;vc=jc.getContext("2d");vc.translate(-a/2,-a/2);vc.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){n=a;q=b;o=Math.floor(n/2);p=Math.floor(q/2);k.width=n;k.height=q;Oa.set(-o,
+-p,o,p);Ka.set(-o,-p,o,p);t=1;u=0;B=D=A=w=x=null};this.setClearColor=function(a,b){r.copy(a);s=b;Ka.set(-o,-p,o,p)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;Ka.set(-o,-p,o,p)};this.clear=function(){m.setTransform(1,0,0,-1,o,p);Ka.isEmpty()||(Ka.minSelf(Oa),Ka.inflate(2),1>s&&m.clearRect(Math.floor(Ka.getX()),Math.floor(Ka.getY()),Math.floor(Ka.getWidth()),Math.floor(Ka.getHeight())),0<s&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*
+r.b)+","+s+")"),m.fillRect(Math.floor(Ka.getX()),Math.floor(Ka.getY()),Math.floor(Ka.getWidth()),Math.floor(Ka.getHeight()))),Ka.empty())};this.render=function(a,k){function q(a){var b,c,d,e;V.setRGB(0,0,0);O.setRGB(0,0,0);Sb.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(V.r+=e.r,V.g+=e.g,V.b+=e.b):d instanceof THREE.DirectionalLight?(O.r+=e.r,O.g+=e.g,O.b+=e.b):d instanceof THREE.PointLight&&(Sb.r+=e.r,Sb.g+=e.g,Sb.b+=e.b)}function n(a,b,c,d){var e,f,
 g,j,h,V;for(e=0,f=a.length;e<f;e++)g=a[e],j=g.color,g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),V=c.dot(h),0>=V||(V*=g.intensity,d.r+=j.r*V,d.g+=j.g*V,d.b+=j.b*V)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),V=c.dot(Ha.sub(h,b).normalize()),0>=V||(V*=0==g.distance?1:1-Math.min(b.distanceTo(h)/g.distance,1),0!=V&&(V*=g.intensity,d.r+=j.r*V,d.g+=j.g*V,d.b+=j.b*V)))}function r(a,f,g){b(g.opacity);c(g.blending);var j,V,h,i,l,k;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)i=
-g.map.image,l=i.width>>1,k=i.height>>1,g=f.scale.x*o,h=f.scale.y*q,j=g*l,V=h*k,xa.set(a.x-j,a.y-V,a.x+j,a.y+V),Oa.intersects(xa)&&(m.save(),m.translate(a.x,a.y),m.rotate(-f.rotation),m.scale(g,-h),m.translate(-l,-k),m.drawImage(i,0,0),m.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(j=f.scale.x*o,V=f.scale.y*q,xa.set(a.x-j,a.y-V,a.x+j,a.y+V),Oa.intersects(xa)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),m.save(),m.translate(a.x,a.y),m.rotate(-f.rotation),m.scale(j,V),g.program(m),
+g.map.image,l=i.width>>1,k=i.height>>1,g=f.scale.x*o,h=f.scale.y*p,j=g*l,V=h*k,xa.set(a.x-j,a.y-V,a.x+j,a.y+V),Oa.intersects(xa)&&(m.save(),m.translate(a.x,a.y),m.rotate(-f.rotation),m.scale(g,-h),m.translate(-l,-k),m.drawImage(i,0,0),m.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(j=f.scale.x*o,V=f.scale.y*p,xa.set(a.x-j,a.y-V,a.x+j,a.y+V),Oa.intersects(xa)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),m.save(),m.translate(a.x,a.y),m.rotate(-f.rotation),m.scale(j,V),g.program(m),
 m.restore()))}function s(a,e,f,g){b(g.opacity);c(g.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(e.positionScreen.x,e.positionScreen.y);m.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(A!=a)m.lineWidth=A=a;a=g.linecap;if(D!=a)m.lineCap=D=a;a=g.linejoin;if(B!=a)m.lineJoin=B=a;d(g.color.getContextStyle());m.stroke();xa.inflate(2*g.linewidth)}}function t(a,d,e,g,h,l,O,m){f.info.render.vertices+=3;f.info.render.faces++;b(m.opacity);c(m.blending);
 G=a.positionScreen.x;j=a.positionScreen.y;Q=d.positionScreen.x;I=d.positionScreen.y;R=e.positionScreen.x;y=e.positionScreen.y;x(G,j,Q,I,R,y);if(m instanceof THREE.MeshBasicMaterial)if(m.map)m.map.mapping instanceof THREE.UVMapping&&(Ea=O.uvs[0],Nc(G,j,Q,I,R,y,Ea[g].u,Ea[g].v,Ea[h].u,Ea[h].v,Ea[l].u,Ea[l].v,m.map));else if(m.envMap){if(m.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,Ha.copy(O.vertexNormalsWorld[g]),Sa=0.5*(Ha.x*a.n11+Ha.y*a.n12+Ha.z*a.n13)+0.5,Ta=
-0.5*-(Ha.x*a.n21+Ha.y*a.n22+Ha.z*a.n23)+0.5,Ha.copy(O.vertexNormalsWorld[h]),Wa=0.5*(Ha.x*a.n11+Ha.y*a.n12+Ha.z*a.n13)+0.5,fb=0.5*-(Ha.x*a.n21+Ha.y*a.n22+Ha.z*a.n23)+0.5,Ha.copy(O.vertexNormalsWorld[l]),Za=0.5*(Ha.x*a.n11+Ha.y*a.n12+Ha.z*a.n13)+0.5,lb=0.5*-(Ha.x*a.n21+Ha.y*a.n22+Ha.z*a.n23)+0.5,Nc(G,j,Q,I,R,y,Sa,Ta,Wa,fb,Za,lb,m.envMap)}else m.wireframe?Eb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):zb(m.color);else if(m instanceof THREE.MeshLambertMaterial)m.map&&!m.wireframe&&
-(m.map.mapping instanceof THREE.UVMapping&&(Ea=O.uvs[0],Nc(G,j,Q,I,R,y,Ea[g].u,Ea[g].v,Ea[h].u,Ea[h].v,Ea[l].u,Ea[l].v,m.map)),c(THREE.SubtractiveBlending)),Sb?!m.wireframe&&m.shading==THREE.SmoothShading&&3==O.vertexNormalsWorld.length?(aa.r=ba.r=ca.r=V.r,aa.g=ba.g=ca.g=V.g,aa.b=ba.b=ca.b=V.b,n(i,O.v1.positionWorld,O.vertexNormalsWorld[0],aa),n(i,O.v2.positionWorld,O.vertexNormalsWorld[1],ba),n(i,O.v3.positionWorld,O.vertexNormalsWorld[2],ca),aa.r=Math.max(0,Math.min(m.color.r*aa.r,1)),aa.g=Math.max(0,
+0.5*-(Ha.x*a.n21+Ha.y*a.n22+Ha.z*a.n23)+0.5,Ha.copy(O.vertexNormalsWorld[h]),Wa=0.5*(Ha.x*a.n11+Ha.y*a.n12+Ha.z*a.n13)+0.5,fb=0.5*-(Ha.x*a.n21+Ha.y*a.n22+Ha.z*a.n23)+0.5,Ha.copy(O.vertexNormalsWorld[l]),Za=0.5*(Ha.x*a.n11+Ha.y*a.n12+Ha.z*a.n13)+0.5,kb=0.5*-(Ha.x*a.n21+Ha.y*a.n22+Ha.z*a.n23)+0.5,Nc(G,j,Q,I,R,y,Sa,Ta,Wa,fb,Za,kb,m.envMap)}else m.wireframe?Db(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):yb(m.color);else if(m instanceof THREE.MeshLambertMaterial)m.map&&!m.wireframe&&
+(m.map.mapping instanceof THREE.UVMapping&&(Ea=O.uvs[0],Nc(G,j,Q,I,R,y,Ea[g].u,Ea[g].v,Ea[h].u,Ea[h].v,Ea[l].u,Ea[l].v,m.map)),c(THREE.SubtractiveBlending)),Rb?!m.wireframe&&m.shading==THREE.SmoothShading&&3==O.vertexNormalsWorld.length?(aa.r=ba.r=ca.r=V.r,aa.g=ba.g=ca.g=V.g,aa.b=ba.b=ca.b=V.b,n(i,O.v1.positionWorld,O.vertexNormalsWorld[0],aa),n(i,O.v2.positionWorld,O.vertexNormalsWorld[1],ba),n(i,O.v3.positionWorld,O.vertexNormalsWorld[2],ca),aa.r=Math.max(0,Math.min(m.color.r*aa.r,1)),aa.g=Math.max(0,
 Math.min(m.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(m.color.b*aa.b,1)),ba.r=Math.max(0,Math.min(m.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(m.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(m.color.b*ba.b,1)),ca.r=Math.max(0,Math.min(m.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(m.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(m.color.b*ca.b,1)),ha.r=0.5*(ba.r+ca.r),ha.g=0.5*(ba.g+ca.g),ha.b=0.5*(ba.b+ca.b),Ga=wc(aa,ba,ca,ha),Yb(G,j,Q,I,R,y,0,0,1,0,0,1,Ga)):(S.r=V.r,S.g=V.g,S.b=V.b,n(i,O.centroidWorld,O.normalWorld,
-S),S.r=Math.max(0,Math.min(m.color.r*S.r,1)),S.g=Math.max(0,Math.min(m.color.g*S.g,1)),S.b=Math.max(0,Math.min(m.color.b*S.b,1)),m.wireframe?Eb(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):zb(S)):m.wireframe?Eb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):zb(m.color);else if(m instanceof THREE.MeshDepthMaterial)za=k.near,qa=k.far,aa.r=aa.g=aa.b=1-Tb(a.positionScreen.z,za,qa),ba.r=ba.g=ba.b=1-Tb(d.positionScreen.z,za,qa),ca.r=ca.g=ca.b=1-Tb(e.positionScreen.z,
-za,qa),ha.r=0.5*(ba.r+ca.r),ha.g=0.5*(ba.g+ca.g),ha.b=0.5*(ba.b+ca.b),Ga=wc(aa,ba,ca,ha),Yb(G,j,Q,I,R,y,0,0,1,0,0,1,Ga);else if(m instanceof THREE.MeshNormalMaterial)S.r=Zb(O.normalWorld.x),S.g=Zb(O.normalWorld.y),S.b=Zb(O.normalWorld.z),m.wireframe?Eb(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):zb(S)}function u(a,d,e,g,h,l,m,O,p){f.info.render.vertices+=4;f.info.render.faces++;b(O.opacity);c(O.blending);if(O.map||O.envMap)t(a,d,g,0,1,3,m,O,p),t(h,e,l,1,2,3,m,O,p);else if(G=a.positionScreen.x,
-j=a.positionScreen.y,Q=d.positionScreen.x,I=d.positionScreen.y,R=e.positionScreen.x,y=e.positionScreen.y,E=g.positionScreen.x,P=g.positionScreen.y,$=h.positionScreen.x,Z=h.positionScreen.y,ga=l.positionScreen.x,fa=l.positionScreen.y,O instanceof THREE.MeshBasicMaterial)w(G,j,Q,I,R,y,E,P),O.wireframe?Eb(O.color,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):zb(O.color);else if(O instanceof THREE.MeshLambertMaterial)Sb?!O.wireframe&&O.shading==THREE.SmoothShading&&4==m.vertexNormalsWorld.length?
+S),S.r=Math.max(0,Math.min(m.color.r*S.r,1)),S.g=Math.max(0,Math.min(m.color.g*S.g,1)),S.b=Math.max(0,Math.min(m.color.b*S.b,1)),m.wireframe?Db(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):yb(S)):m.wireframe?Db(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):yb(m.color);else if(m instanceof THREE.MeshDepthMaterial)za=k.near,qa=k.far,aa.r=aa.g=aa.b=1-Tb(a.positionScreen.z,za,qa),ba.r=ba.g=ba.b=1-Tb(d.positionScreen.z,za,qa),ca.r=ca.g=ca.b=1-Tb(e.positionScreen.z,
+za,qa),ha.r=0.5*(ba.r+ca.r),ha.g=0.5*(ba.g+ca.g),ha.b=0.5*(ba.b+ca.b),Ga=wc(aa,ba,ca,ha),Yb(G,j,Q,I,R,y,0,0,1,0,0,1,Ga);else if(m instanceof THREE.MeshNormalMaterial)S.r=Zb(O.normalWorld.x),S.g=Zb(O.normalWorld.y),S.b=Zb(O.normalWorld.z),m.wireframe?Db(S,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):yb(S)}function u(a,d,e,g,h,l,m,O,q){f.info.render.vertices+=4;f.info.render.faces++;b(O.opacity);c(O.blending);if(O.map||O.envMap)t(a,d,g,0,1,3,m,O,q),t(h,e,l,1,2,3,m,O,q);else if(G=a.positionScreen.x,
+j=a.positionScreen.y,Q=d.positionScreen.x,I=d.positionScreen.y,R=e.positionScreen.x,y=e.positionScreen.y,E=g.positionScreen.x,P=g.positionScreen.y,$=h.positionScreen.x,Z=h.positionScreen.y,ga=l.positionScreen.x,fa=l.positionScreen.y,O instanceof THREE.MeshBasicMaterial)w(G,j,Q,I,R,y,E,P),O.wireframe?Db(O.color,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):yb(O.color);else if(O instanceof THREE.MeshLambertMaterial)Rb?!O.wireframe&&O.shading==THREE.SmoothShading&&4==m.vertexNormalsWorld.length?
 (aa.r=ba.r=ca.r=ha.r=V.r,aa.g=ba.g=ca.g=ha.g=V.g,aa.b=ba.b=ca.b=ha.b=V.b,n(i,m.v1.positionWorld,m.vertexNormalsWorld[0],aa),n(i,m.v2.positionWorld,m.vertexNormalsWorld[1],ba),n(i,m.v4.positionWorld,m.vertexNormalsWorld[3],ca),n(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ha),aa.r=Math.max(0,Math.min(O.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(O.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(O.color.b*aa.b,1)),ba.r=Math.max(0,Math.min(O.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(O.color.g*ba.g,1)),ba.b=
 Math.max(0,Math.min(O.color.b*ba.b,1)),ca.r=Math.max(0,Math.min(O.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(O.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(O.color.b*ca.b,1)),ha.r=Math.max(0,Math.min(O.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(O.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(O.color.b*ha.b,1)),Ga=wc(aa,ba,ca,ha),x(G,j,Q,I,E,P),Yb(G,j,Q,I,E,P,0,0,1,0,0,1,Ga),x($,Z,R,y,ga,fa),Yb($,Z,R,y,ga,fa,1,0,1,1,0,1,Ga)):(S.r=V.r,S.g=V.g,S.b=V.b,n(i,m.centroidWorld,m.normalWorld,S),S.r=Math.max(0,Math.min(O.color.r*
-S.r,1)),S.g=Math.max(0,Math.min(O.color.g*S.g,1)),S.b=Math.max(0,Math.min(O.color.b*S.b,1)),w(G,j,Q,I,R,y,E,P),O.wireframe?Eb(S,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):zb(S)):(w(G,j,Q,I,R,y,E,P),O.wireframe?Eb(O.color,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):zb(O.color));else if(O instanceof THREE.MeshNormalMaterial)S.r=Zb(m.normalWorld.x),S.g=Zb(m.normalWorld.y),S.b=Zb(m.normalWorld.z),w(G,j,Q,I,R,y,E,P),O.wireframe?Eb(S,O.wireframeLinewidth,O.wireframeLinecap,
-O.wireframeLinejoin):zb(S);else if(O instanceof THREE.MeshDepthMaterial)za=k.near,qa=k.far,aa.r=aa.g=aa.b=1-Tb(a.positionScreen.z,za,qa),ba.r=ba.g=ba.b=1-Tb(d.positionScreen.z,za,qa),ca.r=ca.g=ca.b=1-Tb(g.positionScreen.z,za,qa),ha.r=ha.g=ha.b=1-Tb(e.positionScreen.z,za,qa),Ga=wc(aa,ba,ca,ha),x(G,j,Q,I,E,P),Yb(G,j,Q,I,E,P,0,0,1,0,0,1,Ga),x($,Z,R,y,ga,fa),Yb($,Z,R,y,ga,fa,1,0,1,1,0,1,Ga)}function x(a,b,c,d,e,f){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(a,b);m.closePath()}function w(a,
-b,c,d,e,f,g,j){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(g,j);m.lineTo(a,b);m.closePath()}function Eb(a,b,c,e){if(A!=b)m.lineWidth=A=b;if(D!=c)m.lineCap=D=c;if(B!=e)m.lineJoin=B=e;d(a.getContextStyle());m.stroke();xa.inflate(2*b)}function zb(a){e(a.getContextStyle());m.fill()}function Nc(a,b,c,d,f,g,j,h,V,i,l,O,k){if(0!=k.image.width){if(!0==k.needsUpdate||void 0==Na[k.id]){var n=k.wrapS==THREE.RepeatWrapping,p=k.wrapT==THREE.RepeatWrapping;Na[k.id]=m.createPattern(k.image,
-n&&p?"repeat":n&&!p?"repeat-x":!n&&p?"repeat-y":"no-repeat");k.needsUpdate=!1}e(Na[k.id]);var n=k.offset.x/k.repeat.x,p=k.offset.y/k.repeat.y,o=k.image.width*k.repeat.x,ib=k.image.height*k.repeat.y,j=(j+n)*o,h=(h+p)*ib,c=c-a,d=d-b,f=f-a,g=g-b,V=(V+n)*o-j,i=(i+p)*ib-h,l=(l+n)*o-j,O=(O+p)*ib-h,n=V*O-l*i;if(0==n){if(void 0===ja[k.id])b=document.createElement("canvas"),b.width=k.image.width,b.height=k.image.height,b=b.getContext("2d"),b.drawImage(k.image,0,0),ja[k.id]=b.getImageData(0,0,k.image.width,
-k.image.height).data;b=ja[k.id];j=4*(Math.floor(j)+Math.floor(h)*k.image.width);S.setRGB(b[j]/255,b[j+1]/255,b[j+2]/255);zb(S)}else n=1/n,k=(O*c-i*f)*n,i=(O*d-i*g)*n,c=(V*f-l*c)*n,d=(V*g-l*d)*n,a=a-k*j-c*h,j=b-i*j-d*h,m.save(),m.transform(k,i,c,d,a,j),m.fill(),m.restore()}}function Yb(a,b,c,d,e,f,g,j,h,V,i,l,k){var O,n;O=k.width-1;n=k.height-1;g*=O;j*=n;c-=a;d-=b;e-=a;f-=b;h=h*O-g;V=V*n-j;i=i*O-g;l=l*n-j;n=1/(h*l-i*V);O=(l*c-V*e)*n;V=(l*d-V*f)*n;c=(h*e-i*c)*n;d=(h*f-i*d)*n;a=a-O*g-c*j;b=b-V*g-d*j;
-m.save();m.transform(O,V,c,d,a,b);m.clip();m.drawImage(k,0,0);m.restore()}function wc(a,b,c,d){var e=~~(255*a.r),f=~~(255*a.g),a=~~(255*a.b),g=~~(255*b.r),j=~~(255*b.g),b=~~(255*b.b),h=~~(255*c.r),V=~~(255*c.g),c=~~(255*c.b),i=~~(255*d.r),l=~~(255*d.g),d=~~(255*d.b);bb[0]=0>e?0:255<e?255:e;bb[1]=0>f?0:255<f?255:f;bb[2]=0>a?0:255<a?255:a;bb[4]=0>g?0:255<g?255:g;bb[5]=0>j?0:255<j?255:j;bb[6]=0>b?0:255<b?255:b;bb[8]=0>h?0:255<h?255:h;bb[9]=0>V?0:255<V?255:V;bb[10]=0>c?0:255<c?255:c;bb[12]=0>i?0:255<
-i?255:i;bb[13]=0>l?0:255<l?255:l;bb[14]=0>d?0:255<d?255:d;ic.putImageData(Mc,0,0);vc.drawImage(hc,0,0);return jc}function Tb(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Zb(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Fb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var yc,Yc,La,gb;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,q);f.info.render.vertices=0;f.info.render.faces=0;g=l.projectScene(a,k,this.sortElements);h=g.elements;i=
-g.lights;(Sb=0<i.length)&&p(i);for(yc=0,Yc=h.length;yc<Yc;yc++)if(La=h[yc],gb=La.material,gb=gb instanceof THREE.MeshFaceMaterial?La.faceMaterial:gb,!(null==gb||0==gb.opacity)){xa.empty();if(La instanceof THREE.RenderableParticle)C=La,C.x*=o,C.y*=q,r(C,La,gb,a);else if(La instanceof THREE.RenderableLine)C=La.v1,F=La.v2,C.positionScreen.x*=o,C.positionScreen.y*=q,F.positionScreen.x*=o,F.positionScreen.y*=q,xa.addPoint(C.positionScreen.x,C.positionScreen.y),xa.addPoint(F.positionScreen.x,F.positionScreen.y),
-Oa.intersects(xa)&&s(C,F,La,gb,a);else if(La instanceof THREE.RenderableFace3)C=La.v1,F=La.v2,K=La.v3,C.positionScreen.x*=o,C.positionScreen.y*=q,F.positionScreen.x*=o,F.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,gb.overdraw&&(Fb(C.positionScreen,F.positionScreen),Fb(F.positionScreen,K.positionScreen),Fb(K.positionScreen,C.positionScreen)),xa.add3Points(C.positionScreen.x,C.positionScreen.y,F.positionScreen.x,F.positionScreen.y,K.positionScreen.x,K.positionScreen.y),Oa.intersects(xa)&&
-t(C,F,K,0,1,2,La,gb,a);else if(La instanceof THREE.RenderableFace4)C=La.v1,F=La.v2,K=La.v3,L=La.v4,C.positionScreen.x*=o,C.positionScreen.y*=q,F.positionScreen.x*=o,F.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,L.positionScreen.x*=o,L.positionScreen.y*=q,T.positionScreen.copy(F.positionScreen),M.positionScreen.copy(L.positionScreen),gb.overdraw&&(Fb(C.positionScreen,F.positionScreen),Fb(F.positionScreen,L.positionScreen),Fb(L.positionScreen,C.positionScreen),Fb(K.positionScreen,
-T.positionScreen),Fb(K.positionScreen,M.positionScreen)),xa.addPoint(C.positionScreen.x,C.positionScreen.y),xa.addPoint(F.positionScreen.x,F.positionScreen.y),xa.addPoint(K.positionScreen.x,K.positionScreen.y),xa.addPoint(L.positionScreen.x,L.positionScreen.y),Oa.intersects(xa)&&u(C,F,K,L,T,M,La,gb,a);Ka.addRectangle(xa)}m.setTransform(1,0,0,1,0,0)}};
+S.r,1)),S.g=Math.max(0,Math.min(O.color.g*S.g,1)),S.b=Math.max(0,Math.min(O.color.b*S.b,1)),w(G,j,Q,I,R,y,E,P),O.wireframe?Db(S,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):yb(S)):(w(G,j,Q,I,R,y,E,P),O.wireframe?Db(O.color,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):yb(O.color));else if(O instanceof THREE.MeshNormalMaterial)S.r=Zb(m.normalWorld.x),S.g=Zb(m.normalWorld.y),S.b=Zb(m.normalWorld.z),w(G,j,Q,I,R,y,E,P),O.wireframe?Db(S,O.wireframeLinewidth,O.wireframeLinecap,
+O.wireframeLinejoin):yb(S);else if(O instanceof THREE.MeshDepthMaterial)za=k.near,qa=k.far,aa.r=aa.g=aa.b=1-Tb(a.positionScreen.z,za,qa),ba.r=ba.g=ba.b=1-Tb(d.positionScreen.z,za,qa),ca.r=ca.g=ca.b=1-Tb(g.positionScreen.z,za,qa),ha.r=ha.g=ha.b=1-Tb(e.positionScreen.z,za,qa),Ga=wc(aa,ba,ca,ha),x(G,j,Q,I,E,P),Yb(G,j,Q,I,E,P,0,0,1,0,0,1,Ga),x($,Z,R,y,ga,fa),Yb($,Z,R,y,ga,fa,1,0,1,1,0,1,Ga)}function x(a,b,c,d,e,f){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(a,b);m.closePath()}function w(a,
+b,c,d,e,f,g,j){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(g,j);m.lineTo(a,b);m.closePath()}function Db(a,b,c,e){if(A!=b)m.lineWidth=A=b;if(D!=c)m.lineCap=D=c;if(B!=e)m.lineJoin=B=e;d(a.getContextStyle());m.stroke();xa.inflate(2*b)}function yb(a){e(a.getContextStyle());m.fill()}function Nc(a,b,c,d,f,g,j,h,V,i,l,O,k){if(0!=k.image.width){if(!0==k.needsUpdate||void 0==Na[k.id]){var n=k.wrapS==THREE.RepeatWrapping,q=k.wrapT==THREE.RepeatWrapping;Na[k.id]=m.createPattern(k.image,
+n&&q?"repeat":n&&!q?"repeat-x":!n&&q?"repeat-y":"no-repeat");k.needsUpdate=!1}e(Na[k.id]);var n=k.offset.x/k.repeat.x,q=k.offset.y/k.repeat.y,o=k.image.width*k.repeat.x,p=k.image.height*k.repeat.y,j=(j+n)*o,h=(h+q)*p,c=c-a,d=d-b,f=f-a,g=g-b,V=(V+n)*o-j,i=(i+q)*p-h,l=(l+n)*o-j,O=(O+q)*p-h,n=V*O-l*i;if(0==n){if(void 0===ja[k.id])b=document.createElement("canvas"),b.width=k.image.width,b.height=k.image.height,b=b.getContext("2d"),b.drawImage(k.image,0,0),ja[k.id]=b.getImageData(0,0,k.image.width,k.image.height).data;
+b=ja[k.id];j=4*(Math.floor(j)+Math.floor(h)*k.image.width);S.setRGB(b[j]/255,b[j+1]/255,b[j+2]/255);yb(S)}else n=1/n,k=(O*c-i*f)*n,i=(O*d-i*g)*n,c=(V*f-l*c)*n,d=(V*g-l*d)*n,a=a-k*j-c*h,j=b-i*j-d*h,m.save(),m.transform(k,i,c,d,a,j),m.fill(),m.restore()}}function Yb(a,b,c,d,e,f,g,j,h,V,i,l,k){var O,n;O=k.width-1;n=k.height-1;g*=O;j*=n;c-=a;d-=b;e-=a;f-=b;h=h*O-g;V=V*n-j;i=i*O-g;l=l*n-j;n=1/(h*l-i*V);O=(l*c-V*e)*n;V=(l*d-V*f)*n;c=(h*e-i*c)*n;d=(h*f-i*d)*n;a=a-O*g-c*j;b=b-V*g-d*j;m.save();m.transform(O,
+V,c,d,a,b);m.clip();m.drawImage(k,0,0);m.restore()}function wc(a,b,c,d){var e=~~(255*a.r),f=~~(255*a.g),a=~~(255*a.b),g=~~(255*b.r),j=~~(255*b.g),b=~~(255*b.b),h=~~(255*c.r),V=~~(255*c.g),c=~~(255*c.b),i=~~(255*d.r),l=~~(255*d.g),d=~~(255*d.b);bb[0]=0>e?0:255<e?255:e;bb[1]=0>f?0:255<f?255:f;bb[2]=0>a?0:255<a?255:a;bb[4]=0>g?0:255<g?255:g;bb[5]=0>j?0:255<j?255:j;bb[6]=0>b?0:255<b?255:b;bb[8]=0>h?0:255<h?255:h;bb[9]=0>V?0:255<V?255:V;bb[10]=0>c?0:255<c?255:c;bb[12]=0>i?0:255<i?255:i;bb[13]=0>l?0:255<
+l?255:l;bb[14]=0>d?0:255<d?255:d;ic.putImageData(Mc,0,0);vc.drawImage(hc,0,0);return jc}function Tb(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Zb(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Eb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!=e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var yc,Yc,La,gb;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,p);f.info.render.vertices=0;f.info.render.faces=0;g=l.projectScene(a,k,this.sortElements);h=g.elements;i=g.lights;(Rb=0<i.length)&&
+q(i);for(yc=0,Yc=h.length;yc<Yc;yc++)if(La=h[yc],gb=La.material,gb=gb instanceof THREE.MeshFaceMaterial?La.faceMaterial:gb,!(null==gb||0==gb.opacity)){xa.empty();if(La instanceof THREE.RenderableParticle)C=La,C.x*=o,C.y*=p,r(C,La,gb,a);else if(La instanceof THREE.RenderableLine)C=La.v1,F=La.v2,C.positionScreen.x*=o,C.positionScreen.y*=p,F.positionScreen.x*=o,F.positionScreen.y*=p,xa.addPoint(C.positionScreen.x,C.positionScreen.y),xa.addPoint(F.positionScreen.x,F.positionScreen.y),Oa.intersects(xa)&&
+s(C,F,La,gb,a);else if(La instanceof THREE.RenderableFace3)C=La.v1,F=La.v2,K=La.v3,C.positionScreen.x*=o,C.positionScreen.y*=p,F.positionScreen.x*=o,F.positionScreen.y*=p,K.positionScreen.x*=o,K.positionScreen.y*=p,gb.overdraw&&(Eb(C.positionScreen,F.positionScreen),Eb(F.positionScreen,K.positionScreen),Eb(K.positionScreen,C.positionScreen)),xa.add3Points(C.positionScreen.x,C.positionScreen.y,F.positionScreen.x,F.positionScreen.y,K.positionScreen.x,K.positionScreen.y),Oa.intersects(xa)&&t(C,F,K,0,
+1,2,La,gb,a);else if(La instanceof THREE.RenderableFace4)C=La.v1,F=La.v2,K=La.v3,L=La.v4,C.positionScreen.x*=o,C.positionScreen.y*=p,F.positionScreen.x*=o,F.positionScreen.y*=p,K.positionScreen.x*=o,K.positionScreen.y*=p,L.positionScreen.x*=o,L.positionScreen.y*=p,T.positionScreen.copy(F.positionScreen),M.positionScreen.copy(L.positionScreen),gb.overdraw&&(Eb(C.positionScreen,F.positionScreen),Eb(F.positionScreen,L.positionScreen),Eb(L.positionScreen,C.positionScreen),Eb(K.positionScreen,T.positionScreen),
+Eb(K.positionScreen,M.positionScreen)),xa.addPoint(C.positionScreen.x,C.positionScreen.y),xa.addPoint(F.positionScreen.x,F.positionScreen.y),xa.addPoint(K.positionScreen.x,K.positionScreen.y),xa.addPoint(L.positionScreen.x,L.positionScreen.y),Oa.intersects(xa)&&u(C,F,K,L,T,M,La,gb,a);Ka.addRectangle(xa)}m.setTransform(1,0,0,1,0,0)}};
 THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,l;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),l=c.dot(i),0>=l||(l*=g.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),l=c.dot(C.sub(i,b).normalize()),0>=l||(l*=0==g.distance?1:1-Math.min(b.distanceTo(i)/g.distance,1),0!=l&&(l*=g.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)))}function b(a){null==F[a]&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),0==G&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,n,p,o,q,m,r,s=new THREE.Rectangle,t=new THREE.Rectangle,u=!1,x=new THREE.Color,w=new THREE.Color,A=new THREE.Color,D=new THREE.Color,B,C=new THREE.Vector3,F=[],K=[],L,T,M,G=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":G=1;break;case "low":G=0}};this.setSize=function(a,b){l=a;k=b;n=l/2;p=k/2;i.setAttribute("viewBox",-n+" "+-p+" "+l+" "+k);i.setAttribute("width",l);i.setAttribute("height",k);s.set(-n,-p,n,p)};this.clear=function(){for(;0<i.childNodes.length;)i.removeChild(i.childNodes[0])};this.render=function(j,l){var k,C,y,E;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(j,l,this.sortElements);f=e.elements;
+"path"),0==G&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,n,q,o,p,m,r,s=new THREE.Rectangle,t=new THREE.Rectangle,u=!1,x=new THREE.Color,w=new THREE.Color,A=new THREE.Color,D=new THREE.Color,B,C=new THREE.Vector3,F=[],K=[],L,T,M,G=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":G=1;break;case "low":G=0}};this.setSize=function(a,b){l=a;k=b;n=l/2;q=k/2;i.setAttribute("viewBox",-n+" "+-q+" "+l+" "+k);i.setAttribute("width",l);i.setAttribute("height",k);s.set(-n,-q,n,q)};this.clear=function(){for(;0<i.childNodes.length;)i.removeChild(i.childNodes[0])};this.render=function(j,l){var k,C,y,E;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(j,l,this.sortElements);f=e.elements;
 g=e.lights;M=T=0;if(u=0<g.length){w.setRGB(0,0,0);A.setRGB(0,0,0);D.setRGB(0,0,0);for(k=0,C=g.length;k<C;k++)E=g[k],y=E.color,E instanceof THREE.AmbientLight?(w.r+=y.r,w.g+=y.g,w.b+=y.b):E instanceof THREE.DirectionalLight?(A.r+=y.r,A.g+=y.g,A.b+=y.b):E instanceof THREE.PointLight&&(D.r+=y.r,D.g+=y.g,D.b+=y.b)}for(k=0,C=f.length;k<C;k++)if(y=f[k],E=y.material,E=E instanceof THREE.MeshFaceMaterial?y.faceMaterial:E,!(null==E||0==E.opacity))if(t.empty(),y instanceof THREE.RenderableParticle)o=y,o.x*=
-n,o.y*=-p;else if(y instanceof THREE.RenderableLine){if(o=y.v1,q=y.v2,o.positionScreen.x*=n,o.positionScreen.y*=-p,q.positionScreen.x*=n,q.positionScreen.y*=-p,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),s.intersects(t)){y=o;var P=q,$=M++;null==K[$]&&(K[$]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==G&&K[$].setAttribute("shape-rendering","crispEdges"));L=K[$];L.setAttribute("x1",y.positionScreen.x);L.setAttribute("y1",y.positionScreen.y);
-L.setAttribute("x2",P.positionScreen.x);L.setAttribute("y2",P.positionScreen.y);E instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+E.color.getContextStyle()+"; stroke-width: "+E.linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.linecap+"; stroke-linejoin: "+E.linejoin),i.appendChild(L))}}else if(y instanceof THREE.RenderableFace3){if(o=y.v1,q=y.v2,m=y.v3,o.positionScreen.x*=n,o.positionScreen.y*=-p,q.positionScreen.x*=n,q.positionScreen.y*=-p,m.positionScreen.x*=
-n,m.positionScreen.y*=-p,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),s.intersects(t)){var P=o,$=q,Z=m;d.info.render.vertices+=3;d.info.render.faces++;L=b(T++);L.setAttribute("d","M "+P.positionScreen.x+" "+P.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+"z");E instanceof THREE.MeshBasicMaterial?x.copy(E.color):E instanceof THREE.MeshLambertMaterial?
+n,o.y*=-q;else if(y instanceof THREE.RenderableLine){if(o=y.v1,p=y.v2,o.positionScreen.x*=n,o.positionScreen.y*=-q,p.positionScreen.x*=n,p.positionScreen.y*=-q,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(p.positionScreen.x,p.positionScreen.y),s.intersects(t)){y=o;var P=p,$=M++;null==K[$]&&(K[$]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==G&&K[$].setAttribute("shape-rendering","crispEdges"));L=K[$];L.setAttribute("x1",y.positionScreen.x);L.setAttribute("y1",y.positionScreen.y);
+L.setAttribute("x2",P.positionScreen.x);L.setAttribute("y2",P.positionScreen.y);E instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+E.color.getContextStyle()+"; stroke-width: "+E.linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.linecap+"; stroke-linejoin: "+E.linejoin),i.appendChild(L))}}else if(y instanceof THREE.RenderableFace3){if(o=y.v1,p=y.v2,m=y.v3,o.positionScreen.x*=n,o.positionScreen.y*=-q,p.positionScreen.x*=n,p.positionScreen.y*=-q,m.positionScreen.x*=
+n,m.positionScreen.y*=-q,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(p.positionScreen.x,p.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),s.intersects(t)){var P=o,$=p,Z=m;d.info.render.vertices+=3;d.info.render.faces++;L=b(T++);L.setAttribute("d","M "+P.positionScreen.x+" "+P.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+"z");E instanceof THREE.MeshBasicMaterial?x.copy(E.color):E instanceof THREE.MeshLambertMaterial?
 u?(x.r=w.r,x.g=w.g,x.b=w.b,a(g,y.centroidWorld,y.normalWorld,x),x.r=Math.max(0,Math.min(E.color.r*x.r,1)),x.g=Math.max(0,Math.min(E.color.g*x.g,1)),x.b=Math.max(0,Math.min(E.color.b*x.b,1))):x.copy(E.color):E instanceof THREE.MeshDepthMaterial?(B=1-E.__2near/(E.__farPlusNear-y.z*E.__farMinusNear),x.setRGB(B,B,B)):E instanceof THREE.MeshNormalMaterial&&x.setRGB(c(y.normalWorld.x),c(y.normalWorld.y),c(y.normalWorld.z));E.wireframe?L.setAttribute("style","fill: none; stroke: "+x.getContextStyle()+"; stroke-width: "+
-E.wireframeLinewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframeLinecap+"; stroke-linejoin: "+E.wireframeLinejoin):L.setAttribute("style","fill: "+x.getContextStyle()+"; fill-opacity: "+E.opacity);i.appendChild(L)}}else if(y instanceof THREE.RenderableFace4&&(o=y.v1,q=y.v2,m=y.v3,r=y.v4,o.positionScreen.x*=n,o.positionScreen.y*=-p,q.positionScreen.x*=n,q.positionScreen.y*=-p,m.positionScreen.x*=n,m.positionScreen.y*=-p,r.positionScreen.x*=n,r.positionScreen.y*=-p,t.addPoint(o.positionScreen.x,
-o.positionScreen.y),t.addPoint(q.positionScreen.x,q.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(r.positionScreen.x,r.positionScreen.y),s.intersects(t))){var P=o,$=q,Z=m,F=r;d.info.render.vertices+=4;d.info.render.faces++;L=b(T++);L.setAttribute("d","M "+P.positionScreen.x+" "+P.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+"z");E instanceof THREE.MeshBasicMaterial?
+E.wireframeLinewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframeLinecap+"; stroke-linejoin: "+E.wireframeLinejoin):L.setAttribute("style","fill: "+x.getContextStyle()+"; fill-opacity: "+E.opacity);i.appendChild(L)}}else if(y instanceof THREE.RenderableFace4&&(o=y.v1,p=y.v2,m=y.v3,r=y.v4,o.positionScreen.x*=n,o.positionScreen.y*=-q,p.positionScreen.x*=n,p.positionScreen.y*=-q,m.positionScreen.x*=n,m.positionScreen.y*=-q,r.positionScreen.x*=n,r.positionScreen.y*=-q,t.addPoint(o.positionScreen.x,
+o.positionScreen.y),t.addPoint(p.positionScreen.x,p.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(r.positionScreen.x,r.positionScreen.y),s.intersects(t))){var P=o,$=p,Z=m,F=r;d.info.render.vertices+=4;d.info.render.faces++;L=b(T++);L.setAttribute("d","M "+P.positionScreen.x+" "+P.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+"z");E instanceof THREE.MeshBasicMaterial?
 x.copy(E.color):E instanceof THREE.MeshLambertMaterial?u?(x.r=w.r,x.g=w.g,x.b=w.b,a(g,y.centroidWorld,y.normalWorld,x),x.r=Math.max(0,Math.min(E.color.r*x.r,1)),x.g=Math.max(0,Math.min(E.color.g*x.g,1)),x.b=Math.max(0,Math.min(E.color.b*x.b,1))):x.copy(E.color):E instanceof THREE.MeshDepthMaterial?(B=1-E.__2near/(E.__farPlusNear-y.z*E.__farMinusNear),x.setRGB(B,B,B)):E instanceof THREE.MeshNormalMaterial&&x.setRGB(c(y.normalWorld.x),c(y.normalWorld.y),c(y.normalWorld.z));E.wireframe?L.setAttribute("style",
 "fill: none; stroke: "+x.getContextStyle()+"; stroke-width: "+E.wireframeLinewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframeLinecap+"; stroke-linejoin: "+E.wireframeLinejoin):L.setAttribute("style","fill: "+x.getContextStyle()+"; fill-opacity: "+E.opacity);i.appendChild(L)}}};
 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",
@@ -231,113 +231,113 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragme
 THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(void 0===a.__webglCustomAttributesList)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;"v2"===f.type?g=2:"v3"===f.type?g=3:"v4"===f.type?g=4:"c"===f.type&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
 function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(0<=b.materialIndex)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?!0:!1}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;
-var i=a.colors,l=i.length,k=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,p=a.__dirtyVertices,o=a.__dirtyColors,q=a.__webglCustomAttributesList;if(c.sortParticles){Ta.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,Wa.copy(e),Ta.multiplyVector3(Wa),n[d]=[Wa.z,d];n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[n[d][1]].position,f=3*d,k[f]=e.x,k[f+1]=e.y,k[f+2]=e.z;for(d=0;d<l;d++)f=3*d,e=i[n[d][1]],m[f]=e.r,m[f+1]=e.g,m[f+2]=e.b;if(q)for(i=0,l=q.length;i<l;i++)if(h=q[i],
+var i=a.colors,l=i.length,k=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,q=a.__dirtyVertices,o=a.__dirtyColors,p=a.__webglCustomAttributesList;if(c.sortParticles){Ta.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,Wa.copy(e),Ta.multiplyVector3(Wa),n[d]=[Wa.z,d];n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[n[d][1]].position,f=3*d,k[f]=e.x,k[f+1]=e.y,k[f+2]=e.z;for(d=0;d<l;d++)f=3*d,e=i[n[d][1]],m[f]=e.r,m[f+1]=e.g,m[f+2]=e.b;if(p)for(i=0,l=p.length;i<l;i++)if(h=p[i],
 void 0===h.boundTo||"vertices"===h.boundTo)if(f=0,e=h.value.length,1===h.size)for(d=0;d<e;d++)g=n[d][1],h.array[d]=h.value[g];else if(2===h.size)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],
-h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}else{if(p)for(d=0;d<g;d++)e=h[d].position,f=3*d,k[f]=e.x,k[f+1]=e.y,k[f+2]=e.z;if(o)for(d=0;d<l;d++)e=i[d],f=3*d,m[f]=e.r,m[f+1]=e.g,m[f+2]=e.b;if(q)for(i=0,l=q.length;i<l;i++)if(h=q[i],h.needsUpdate&&(void 0===h.boundTo||"vertices"===h.boundTo))if(e=h.value.length,f=0,1===h.size)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(2===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===
-h.type)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,
-m,b);if(q)for(i=0,l=q.length;i<l;i++)if(h=q[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}function g(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)I=null,y=E=S=fa=ga=-1,a[d].render(b,c,Ga,Ea),I=null,y=E=S=fa=ga=-1}function i(a,b,c,d,e,f,g,h){var j,i,l,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(j=a[m],j.render){i=j.object;l=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;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(q)for(d=0;d<g;d++)e=h[d].position,f=3*d,k[f]=e.x,k[f+1]=e.y,k[f+2]=e.z;if(o)for(d=0;d<l;d++)e=i[d],f=3*d,m[f]=e.r,m[f+1]=e.g,m[f+2]=e.b;if(p)for(i=0,l=p.length;i<l;i++)if(h=p[i],h.needsUpdate&&(void 0===h.boundTo||"vertices"===h.boundTo))if(e=h.value.length,f=0,1===h.size)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(2===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===
+h.type)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}if(q||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,
+m,b);if(p)for(i=0,l=p.length;i<l;i++)if(h=p[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}function g(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)I=null,y=E=S=fa=ga=-1,a[d].render(b,c,Ga,Ea),I=null,y=E=S=fa=ga=-1}function i(a,b,c,d,e,f,g,h){var j,i,l,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(j=a[m],j.render){i=j.object;l=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;g&&
 G.setBlending(j.blending);G.setDepthTest(j.depthTest);G.setDepthWrite(j.depthWrite);s(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}G.setObjectFaces(i);l instanceof THREE.BufferGeometry?G.renderBufferDirect(d,e,f,j,l,i):G.renderBuffer(d,e,f,j,l,i)}}function l(a,b,c,d,e,f,g){for(var h,j,i=0,l=a.length;i<l;i++)if(h=a[i],j=h.object,j.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&G.setBlending(h.blending);G.setDepthTest(h.depthTest);G.setDepthWrite(h.depthWrite);s(h.polygonOffset,h.polygonOffsetFactor,
-h.polygonOffsetUnits)}G.renderImmediateObject(c,d,e,h,j)}}function k(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function o(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function q(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function m(a,b,c,d,e){d.program||G.initMaterial(d,b,c,e);if(d.morphTargets&&
+h.polygonOffsetUnits)}G.renderImmediateObject(c,d,e,h,j)}}function k(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function q(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function o(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function p(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function m(a,b,c,d,e){d.program||G.initMaterial(d,b,c,e);if(d.morphTargets&&
 !e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(G.maxMorphTargets);for(var f=0,g=G.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==I&&(j.useProgram(f),I=f,h=!0);if(d.id!==y)y=d.id,h=!0;if(h){j.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){var l,k,m=0,n=0,p=0,o,q,r=fb,s=r.directional.colors,t=r.directional.positions,E=r.point.colors,P=r.point.positions,x=r.point.distances,w=0,C=0,B=q=0;for(c=0,h=b.length;c<h;c++)if(l=b[c],k=l.color,o=l.intensity,q=l.distance,l instanceof THREE.AmbientLight)G.gammaInput?(m+=k.r*k.r,n+=k.g*k.g,p+=k.b*k.b):(m+=k.r,n+=k.g,p+=k.b);else if(l instanceof THREE.DirectionalLight)q=3*w,G.gammaInput?(s[q]=k.r*k.r*
-o*o,s[q+1]=k.g*k.g*o*o,s[q+2]=k.b*k.b*o*o):(s[q]=k.r*o,s[q+1]=k.g*o,s[q+2]=k.b*o),l=l.matrixWorld.getPosition(),k=1/l.length(),t[q]=l.x*k,t[q+1]=l.y*k,t[q+2]=l.z*k,w+=1;else if(l instanceof THREE.SpotLight&&!l.onlyShadow)q=3*w,G.gammaInput?(s[q]=k.r*k.r*o*o,s[q+1]=k.g*k.g*o*o,s[q+2]=k.b*k.b*o*o):(s[q]=k.r*o,s[q+1]=k.g*o,s[q+2]=k.b*o),l=l.matrixWorld.getPosition(),k=1/l.length(),t[q]=l.x*k,t[q+1]=l.y*k,t[q+2]=l.z*k,w+=1;else if(l instanceof THREE.PointLight)B=3*C,G.gammaInput?(E[B]=k.r*k.r*o*o,E[B+
-1]=k.g*k.g*o*o,E[B+2]=k.b*k.b*o*o):(E[B]=k.r*o,E[B+1]=k.g*o,E[B+2]=k.b*o),l=l.matrixWorld.getPosition(),P[B]=l.x,P[B+1]=l.y,P[B+2]=l.z,x[C]=q,C+=1;for(c=3*w,h=s.length;c<h;c++)s[c]=0;for(c=3*C,h=E.length;c<h;c++)E[c]=0;r.point.length=C;r.directional.length=w;r.ambient[0]=m;r.ambient[1]=n;r.ambient[2]=p;c=fb;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=
+c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var l,k,m=0,n=0,q=0,o,p,r=fb,s=r.directional.colors,t=r.directional.positions,E=r.point.colors,P=r.point.positions,x=r.point.distances,w=0,C=0,B=p=0;for(c=0,h=b.length;c<h;c++)if(l=b[c],!l.onlyShadow)if(k=l.color,o=l.intensity,p=l.distance,l instanceof THREE.AmbientLight)G.gammaInput?(m+=k.r*k.r,n+=k.g*k.g,q+=k.b*k.b):(m+=k.r,n+=k.g,q+=k.b);else if(l instanceof THREE.DirectionalLight)p=3*w,G.gammaInput?
+(s[p]=k.r*k.r*o*o,s[p+1]=k.g*k.g*o*o,s[p+2]=k.b*k.b*o*o):(s[p]=k.r*o,s[p+1]=k.g*o,s[p+2]=k.b*o),l=l.matrixWorld.getPosition(),k=1/l.length(),t[p]=l.x*k,t[p+1]=l.y*k,t[p+2]=l.z*k,w+=1;else if(l instanceof THREE.SpotLight)p=3*w,G.gammaInput?(s[p]=k.r*k.r*o*o,s[p+1]=k.g*k.g*o*o,s[p+2]=k.b*k.b*o*o):(s[p]=k.r*o,s[p+1]=k.g*o,s[p+2]=k.b*o),l=l.matrixWorld.getPosition(),k=1/l.length(),t[p]=l.x*k,t[p+1]=l.y*k,t[p+2]=l.z*k,w+=1;else if(l instanceof THREE.PointLight)B=3*C,G.gammaInput?(E[B]=k.r*k.r*o*o,E[B+
+1]=k.g*k.g*o*o,E[B+2]=k.b*k.b*o*o):(E[B]=k.r*o,E[B+1]=k.g*o,E[B+2]=k.b*o),l=l.matrixWorld.getPosition(),P[B]=l.x,P[B+1]=l.y,P[B+2]=l.z,x[C]=p,C+=1;for(c=3*w,h=s.length;c<h;c++)s[c]=0;for(c=3*C,h=E.length;c<h;c++)E[c]=0;r.point.length=C;r.directional.length=w;r.ambient[0]=m;r.ambient[1]=n;r.ambient[2]=q;c=fb;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=
 c.point.positions;i.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,G.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=D.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=
 d.shininess,G.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)G.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient,d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;
-else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){h=c=0;for(m=b.length;h<m;h++)if(n=b[h],n.castShadow&&n instanceof THREE.SpotLight)i.shadowMap.texture[c]=n.shadowMap,i.shadowMapSize.value[c]=n.shadowMapSize,i.shadowMatrix.value[c]=n.shadowMatrix,i.shadowDarkness.value[c]=n.shadowDarkness,i.shadowBias.value[c]=n.shadowBias,c++}b=d.uniformsList;for(i=0,c=b.length;i<c;i++)if(n=f.uniforms[b[i][1]])if(h=b[i][0],p=h.type,m=h.value,
-"i"===p)j.uniform1i(n,m);else if("f"===p)j.uniform1f(n,m);else if("v2"===p)j.uniform2f(n,m.x,m.y);else if("v3"===p)j.uniform3f(n,m.x,m.y,m.z);else if("v4"===p)j.uniform4f(n,m.x,m.y,m.z,m.w);else if("c"===p)j.uniform3f(n,m.r,m.g,m.b);else if("fv1"===p)j.uniform1fv(n,m);else if("fv"===p)j.uniform3fv(n,m);else if("v2v"===p){if(!h._array)h._array=new Float32Array(2*m.length);for(p=0,r=m.length;p<r;p++)s=2*p,h._array[s]=m[p].x,h._array[s+1]=m[p].y;j.uniform2fv(n,h._array)}else if("v3v"===p){if(!h._array)h._array=
-new Float32Array(3*m.length);for(p=0,r=m.length;p<r;p++)s=3*p,h._array[s]=m[p].x,h._array[s+1]=m[p].y,h._array[s+2]=m[p].z;j.uniform3fv(n,h._array)}else if("m4"===p){if(!h._array)h._array=new Float32Array(16);m.flattenToArray(h._array);j.uniformMatrix4fv(n,!1,h._array)}else if("m4v"===p){if(!h._array)h._array=new Float32Array(16*m.length);for(p=0,r=m.length;p<r;p++)m[p].flattenToArrayOffset(h._array,16*p);j.uniformMatrix4fv(n,!1,h._array)}else if("t"===p){if(j.uniform1i(n,m),n=h.texture)if(n.image instanceof
-Array&&6===n.image.length){if(h=n,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+m);j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);m=[];for(n=0;6>n;n++){p=m;r=n;if(G.autoScaleCubemaps){if(s=h.image[n],E=lb,!(s.width<=E&&s.height<=E))P=Math.max(s.width,s.height),t=Math.floor(s.width*E/P),E=Math.floor(s.height*E/P),P=document.createElement("canvas"),P.width=t,P.height=E,P.getContext("2d").drawImage(s,
-0,0,s.width,s.height,0,0,t,E),s=P}else s=h.image[n];p[r]=s}n=m[0];p=0===(n.width&n.width-1)&&0===(n.height&n.height-1);r=A(h.format);s=A(h.type);u(j.TEXTURE_CUBE_MAP,h,p);for(n=0;6>n;n++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,r,r,s,m[n]);h.generateMipmaps&&p&&j.generateMipmap(j.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdated)h.onUpdated()}else j.activeTexture(j.TEXTURE0+m),j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(h=n,j.activeTexture(j.TEXTURE0+
-m),j.bindTexture(j.TEXTURE_CUBE_MAP,h.__webglTexture)):G.setTexture(n,m)}else if("tv"===p){if(!h._array){h._array=[];for(p=0,r=h.texture.length;p<r;p++)h._array[p]=m+p}j.uniform1iv(n,h._array);for(p=0,r=h.texture.length;p<r;p++)(n=h.texture[p])&&G.setTexture(n,h._array[p])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==g.cameraPosition&&j.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)&&null!==g.viewMatrix&&j.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(j.uniformMatrix4fv(g.cameraInverseMatrix,!1,a._viewMatrixArray),j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&
-null!==g.objectMatrix&&j.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function r(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function s(a,b,c){aa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),aa=a);if(a&&(ba!==b||ca!==c))j.polygonOffset(b,c),ba=b,ca=c}function t(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):
-"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(b),null):c}function u(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,A(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,A(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,A(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,A(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,
-j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,w(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,w(b.minFilter)))}function x(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,
-j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function w(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function A(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;
-case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;
-case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var a=a||{},D=void 0!==a.canvas?a.canvas:document.createElement("canvas"),B=void 0!==a.precision?a.precision:"mediump",C=void 0!==a.antialias?a.antialias:!1,F=void 0!==a.stencil?a.stencil:!0,K=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,L=void 0!==a.clearColor?new THREE.Color(a.clearColor):
-new THREE.Color(0),T=void 0!==a.clearAlpha?a.clearAlpha:0,M=void 0!==a.maxLights?a.maxLights:4;this.domElement=D;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.autoScaleCubemaps=!0;this.renderPluginsPre=
-[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var G=this,j,Q=[],I=null,R=null,y=-1,E=null,P=0,$=null,Z=null,ga=null,fa=null,S=null,aa=null,ba=null,ca=null,ha=null,Na=0,ja=0,za=0,qa=0,Ga=0,Ea=0,Sa=new THREE.Frustum,Ta=new THREE.Matrix4,Wa=new THREE.Vector4,fb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};j=function(){var a;try{if(!(a=D.getContext("experimental-webgl",
-{antialias:C,stencil:F,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}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);
-j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(L.r,L.g,L.b,T);this.context=j;var Za=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.TEXTURE_SIZE);var lb=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=function(){return 0<Za};this.setSize=function(a,b){D.width=a;D.height=b;this.setViewport(0,0,D.width,D.height)};this.setViewport=function(a,b,c,d){Na=a;ja=b;za=c;qa=d;j.viewport(Na,ja,za,qa)};this.setScissor=
-function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){L.setHex(a);T=b;j.clearColor(L.r,L.g,L.b,T)};this.setClearColor=function(a,b){L.copy(a);T=b;j.clearColor(L.r,L.g,L.b,T)};this.getClearColor=function(){return L};this.getClearAlpha=function(){return T};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;
-j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];
-j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<
-e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);G.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--;
-else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),G.info.memory.textures--};this.updateShadowMap=function(a,b){I=null;y=E=S=fa=ga=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=
-j.createBuffer();a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,l,k,m,n,p=3*a.count;for(n=0;n<p;n+=9)c=a.normalArray,d=c[n],e=c[n+1],f=c[n+2],g=c[n+3],i=c[n+4],k=c[n+5],h=c[n+6],l=c[n+7],m=c[n+8],d=(d+g+h)/
-3,e=(e+i+l)/3,f=(f+k+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}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(0!==d.opacity&&(c=m(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==E&&(E=d,b=!0),f instanceof THREE.Mesh)){f=
-e.offsets;d=0;for(c=f.length;d<c;++d)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexPositionBuffer),j.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,j.FLOAT,!1,0,12*f[d].index),0<=a.normal&&e.vertexNormalBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexNormalBuffer),j.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,j.FLOAT,!1,0,12*f[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.vertexUvBuffer),j.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,
-j.FLOAT,!1,0,8*f[d].index),j.enableVertexAttribArray(a.uv)):j.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexColorBuffer),j.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,j.FLOAT,!1,0,16*f[d].index)),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),j.drawElements(j.TRIANGLES,f[d].count,j.UNSIGNED_SHORT,2*f[d].start),G.info.render.calls++,G.info.render.vertices+=f[d].count,G.info.render.faces+=f[d].count/3}};this.renderBuffer=
-function(a,b,c,d,e,f){if(0!==d.opacity){var g,h,c=m(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==E&&(E=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&
-(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],l=-1,k=0;h=f.morphTargetInfluences;var n,p=h.length;g=0;for(-1!==f.morphTargetBase&&
-(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(n=0;n<p;n++)!i[n]&&h[n]>l&&(k=n,l=h[k]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=l;i[k]=1;l=-1;g++}}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(g=0,h=e.__webglCustomAttributesList.length;g<h;g++)c=
-e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0));0<=b.color&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));0<=b.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));0<=b.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,
-4,j.FLOAT,!1,0,0));0<=b.uv&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));0<=b.uv2&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(j.bindBuffer(j.ARRAY_BUFFER,
-e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ha&&(j.lineWidth(d),ha=d),
-a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),G.info.render.calls++,G.info.render.vertices+=e.__webglFaceCount,G.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==ha&&(j.lineWidth(d),ha=d),j.drawArrays(f,0,e.__webglLineCount),
-G.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),G.info.render.calls++,G.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),G.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,k,m,n=a.lights,p=a.fog;y=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));
-this.autoUpdateScene&&a.updateMatrixWorld();h(this.renderPluginsPre,a,b);G.info.render.calls=0;G.info.render.vertices=0;G.info.render.faces=0;G.info.render.points=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);Ta.multiply(b.projectionMatrix,b.matrixWorldInverse);
-Sa.setFromMatrix(Ta);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;for(d=0,e=m.length;d<e;d++)if(f=m[d],k=f.object,f.render=!1,k.visible&&(!(k instanceof THREE.Mesh||k instanceof THREE.ParticleSystem)||!k.frustumCulled||Sa.contains(k))){k.matrixWorld.flattenToArray(k._objectMatrixArray);r(k,b);var o=f,q=o.object,E=o.buffer,t=void 0,t=t=void 0,t=q.material;if(t instanceof THREE.MeshFaceMaterial){if(t=E.materialIndex,
-0<=t)t=q.geometry.materials[t],t.transparent?(o.transparent=t,o.opaque=null):(o.opaque=t,o.transparent=null)}else if(t)t.transparent?(o.transparent=t,o.opaque=null):(o.opaque=t,o.transparent=null);f.render=!0;if(this.sortObjects)k.renderDepth?f.z=k.renderDepth:(Wa.copy(k.position),Ta.multiplyVector3(Wa),f.z=Wa.z)}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;for(d=0,e=m.length;d<e;d++)if(f=m[d],k=f.object,k.visible)k.matrixAutoUpdate&&k.matrixWorld.flattenToArray(k._objectMatrixArray),r(k,
-b),k=f.object.material,k.transparent?(f.transparent=k,f.opaque=null):(f.opaque=k,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),s(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,n,p,!0,a.overrideMaterial),l(a.__webglObjectsImmediate,"",b,n,p,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),
-i(a.__webglObjects,!0,"opaque",b,n,p,!1),l(a.__webglObjectsImmediate,"opaque",b,n,p,!1),i(a.__webglObjects,!1,"transparent",b,n,p,!0),l(a.__webglObjectsImmediate,"transparent",b,n,p,!0));h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,
-c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,e){var f=m(a,b,c,d,e);E=-1;G.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,j,Sa):e.render(function(a){G.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var g=
-a.__objectsAdded[0],h=a,i=void 0,l=void 0,m=void 0;if(!g.__webglInit)if(g.__webglInit=!0,g._modelViewMatrix=new THREE.Matrix4,g._normalMatrixArray=new Float32Array(9),g._modelViewMatrixArray=new Float32Array(16),g._objectMatrixArray=new Float32Array(16),g.matrixWorld.flattenToArray(g._objectMatrixArray),g instanceof THREE.Mesh){if(l=g.geometry,l instanceof THREE.Geometry){if(void 0===l.geometryGroups){var r=l,s=void 0,t=void 0,E=void 0,w=void 0,y=void 0,x=void 0,u=void 0,B={},C=r.morphTargets.length;
-r.geometryGroups={};for(s=0,t=r.faces.length;s<t;s++)E=r.faces[s],w=E.materialIndex,x=void 0!==w?w:-1,void 0===B[x]&&(B[x]={hash:x,counter:0}),u=B[x].hash+"_"+B[x].counter,void 0===r.geometryGroups[u]&&(r.geometryGroups[u]={faces3:[],faces4:[],materialIndex:w,vertices:0,numMorphTargets:C}),y=E instanceof THREE.Face3?3:4,65535<r.geometryGroups[u].vertices+y&&(B[x].counter+=1,u=B[x].hash+"_"+B[x].counter,void 0===r.geometryGroups[u]&&(r.geometryGroups[u]={faces3:[],faces4:[],materialIndex:w,vertices:0,
-numMorphTargets:C})),E instanceof THREE.Face3?r.geometryGroups[u].faces3.push(s):r.geometryGroups[u].faces4.push(s),r.geometryGroups[u].vertices+=y;r.geometryGroupsList=[];var $=void 0;for($ in r.geometryGroups)r.geometryGroups[$].id=P++,r.geometryGroupsList.push(r.geometryGroups[$])}for(i in l.geometryGroups)if(m=l.geometryGroups[i],!m.__webglVertexBuffer){var A=m;A.__webglVertexBuffer=j.createBuffer();A.__webglNormalBuffer=j.createBuffer();A.__webglTangentBuffer=j.createBuffer();A.__webglColorBuffer=
-j.createBuffer();A.__webglUVBuffer=j.createBuffer();A.__webglUV2Buffer=j.createBuffer();A.__webglSkinVertexABuffer=j.createBuffer();A.__webglSkinVertexBBuffer=j.createBuffer();A.__webglSkinIndicesBuffer=j.createBuffer();A.__webglSkinWeightsBuffer=j.createBuffer();A.__webglFaceBuffer=j.createBuffer();A.__webglLineBuffer=j.createBuffer();if(A.numMorphTargets){var D=void 0,I=void 0;A.__webglMorphTargetsBuffers=[];for(D=0,I=A.numMorphTargets;D<I;D++)A.__webglMorphTargetsBuffers.push(j.createBuffer())}G.info.memory.geometries++;
-var F=m,S=g,Z=S.geometry,L=F.faces3,K=F.faces4,M=3*L.length+4*K.length,fa=1*L.length+2*K.length,Q=3*L.length+4*K.length,aa=c(S,F),ba=e(aa),ca=d(aa),ga=aa.vertexColors?aa.vertexColors:!1;F.__vertexArray=new Float32Array(3*M);if(ca)F.__normalArray=new Float32Array(3*M);if(Z.hasTangents)F.__tangentArray=new Float32Array(4*M);if(ga)F.__colorArray=new Float32Array(3*M);if(ba){if(0<Z.faceUvs.length||0<Z.faceVertexUvs.length)F.__uvArray=new Float32Array(2*M);if(1<Z.faceUvs.length||1<Z.faceVertexUvs.length)F.__uv2Array=
-new Float32Array(2*M)}if(S.geometry.skinWeights.length&&S.geometry.skinIndices.length)F.__skinVertexAArray=new Float32Array(4*M),F.__skinVertexBArray=new Float32Array(4*M),F.__skinIndexArray=new Float32Array(4*M),F.__skinWeightArray=new Float32Array(4*M);F.__faceArray=new Uint16Array(3*fa);F.__lineArray=new Uint16Array(2*Q);if(F.numMorphTargets){F.__morphTargetsArrays=[];for(var R=0,ha=F.numMorphTargets;R<ha;R++)F.__morphTargetsArrays.push(new Float32Array(3*M))}F.__webglFaceCount=3*fa;F.__webglLineCount=
-2*Q;if(aa.attributes){if(void 0===F.__webglCustomAttributesList)F.__webglCustomAttributesList=[];var T=void 0;for(T in aa.attributes){var Na=aa.attributes[T],ja={},za;for(za in Na)ja[za]=Na[za];if(!ja.__webglInitialized||ja.createUniqueBuffers){ja.__webglInitialized=!0;var qa=1;"v2"===ja.type?qa=2:"v3"===ja.type?qa=3:"v4"===ja.type?qa=4:"c"===ja.type&&(qa=3);ja.size=qa;ja.array=new Float32Array(M*qa);ja.buffer=j.createBuffer();ja.buffer.belongsToAttribute=T;Na.needsUpdate=!0;ja.__original=Na}F.__webglCustomAttributesList.push(ja)}}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(g instanceof THREE.Ribbon){if(l=g.geometry,!l.__webglVertexBuffer){var Ea=l;Ea.__webglVertexBuffer=j.createBuffer();Ea.__webglColorBuffer=j.createBuffer();G.info.memory.geometries++;var Ga=l,Ta=Ga.vertices.length;Ga.__vertexArray=new Float32Array(3*Ta);Ga.__colorArray=new Float32Array(3*Ta);Ga.__webglVertexCount=Ta;l.__dirtyVertices=!0;l.__dirtyColors=
-!0}}else if(g instanceof THREE.Line){if(l=g.geometry,!l.__webglVertexBuffer){var Wa=l;Wa.__webglVertexBuffer=j.createBuffer();Wa.__webglColorBuffer=j.createBuffer();G.info.memory.geometries++;var Sa=l,fb=g,Za=Sa.vertices.length;Sa.__vertexArray=new Float32Array(3*Za);Sa.__colorArray=new Float32Array(3*Za);Sa.__webglLineCount=Za;b(Sa,fb);l.__dirtyVertices=!0;l.__dirtyColors=!0}}else if(g instanceof THREE.ParticleSystem&&(l=g.geometry,!l.__webglVertexBuffer)){var lb=l;lb.__webglVertexBuffer=j.createBuffer();
-lb.__webglColorBuffer=j.createBuffer();G.info.geometries++;var $b=l,kd=g,Oc=$b.vertices.length;$b.__vertexArray=new Float32Array(3*Oc);$b.__colorArray=new Float32Array(3*Oc);$b.__sortArray=[];$b.__webglParticleCount=Oc;b($b,kd);l.__dirtyVertices=!0;l.__dirtyColors=!0}if(!g.__webglActive){if(g instanceof THREE.Mesh)if(l=g.geometry,l instanceof THREE.BufferGeometry)k(h.__webglObjects,l,g);else for(i in l.geometryGroups)m=l.geometryGroups[i],k(h.__webglObjects,m,g);else g instanceof THREE.Ribbon||g instanceof
-THREE.Line||g instanceof THREE.ParticleSystem?(l=g.geometry,k(h.__webglObjects,l,g)):void 0!==THREE.MarchingCubes&&g instanceof THREE.MarchingCubes||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof THREE.LensFlare&&h.__webglFlares.push(g);g.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var cb=a.__objectsRemoved[0],xc=a;cb instanceof THREE.Mesh||cb instanceof
-THREE.ParticleSystem||cb instanceof THREE.Ribbon||cb instanceof THREE.Line?o(xc.__webglObjects,cb):cb instanceof THREE.Sprite?q(xc.__webglSprites,cb):cb instanceof THREE.LensFlare?q(xc.__webglFlares,cb):(cb instanceof THREE.MarchingCubes||cb.immediateRenderCallback)&&o(xc.__webglObjectsImmediate,cb);cb.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var Pc=0,ld=a.__webglObjects.length;Pc<ld;Pc++){var jb=a.__webglObjects[Pc].object,ia=jb.geometry,kc=void 0,ac=void 0,Ua=void 0;if(jb instanceof THREE.Mesh)if(ia instanceof
-THREE.BufferGeometry)ia.__dirtyVertices=!1,ia.__dirtyElements=!1,ia.__dirtyUvs=!1,ia.__dirtyNormals=!1,ia.__dirtyColors=!1;else{for(var Qc=0,md=ia.geometryGroupsList.length;Qc<md;Qc++)if(kc=ia.geometryGroupsList[Qc],Ua=c(jb,kc),ac=Ua.attributes&&n(Ua),ia.__dirtyVertices||ia.__dirtyMorphTargets||ia.__dirtyElements||ia.__dirtyUvs||ia.__dirtyNormals||ia.__dirtyColors||ia.__dirtyTangents||ac){var da=kc,nd=jb,$a=j.DYNAMIC_DRAW,od=!ia.dynamic,zc=Ua;if(da.__inittedArrays){var Zc=d(zc),Rc=zc.vertexColors?
-zc.vertexColors:!1,$c=e(zc),ad=Zc===THREE.SmoothShading,H=void 0,U=void 0,hb=void 0,N=void 0,bc=void 0,Gb=void 0,kb=void 0,Ac=void 0,Ab=void 0,cc=void 0,dc=void 0,W=void 0,X=void 0,Y=void 0,na=void 0,mb=void 0,nb=void 0,ob=void 0,lc=void 0,pb=void 0,qb=void 0,rb=void 0,mc=void 0,sb=void 0,tb=void 0,ub=void 0,nc=void 0,vb=void 0,wb=void 0,xb=void 0,oc=void 0,Hb=void 0,Ib=void 0,Jb=void 0,Bc=void 0,Kb=void 0,Lb=void 0,Mb=void 0,Cc=void 0,ka=void 0,bd=void 0,Nb=void 0,ec=void 0,fc=void 0,ab=void 0,cd=
-void 0,Fa=void 0,ya=0,Da=0,Bb=0,Cb=0,db=0,Pa=0,oa=0,Qa=0,Aa=0,J=0,Ba=0,z=0,Xa=void 0,Ia=da.__vertexArray,pc=da.__uvArray,qc=da.__uv2Array,eb=da.__normalArray,ra=da.__tangentArray,Ja=da.__colorArray,sa=da.__skinVertexAArray,ta=da.__skinVertexBArray,ua=da.__skinIndexArray,va=da.__skinWeightArray,Sc=da.__morphTargetsArrays,Tc=da.__webglCustomAttributesList,v=void 0,yb=da.__faceArray,Ya=da.__lineArray,Ra=nd.geometry,pd=Ra.__dirtyElements,dd=Ra.__dirtyUvs,qd=Ra.__dirtyNormals,rd=Ra.__dirtyTangents,sd=
-Ra.__dirtyColors,td=Ra.__dirtyMorphTargets,Ub=Ra.vertices,la=da.faces3,ma=da.faces4,Ca=Ra.faces,Uc=Ra.faceVertexUvs[0],Vc=Ra.faceVertexUvs[1],Vb=Ra.skinVerticesA,Wb=Ra.skinVerticesB,Xb=Ra.skinIndices,Ob=Ra.skinWeights,Pb=Ra.morphTargets;if(Ra.__dirtyVertices){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],W=Ub[N.a].position,X=Ub[N.b].position,Y=Ub[N.c].position,Ia[Da]=W.x,Ia[Da+1]=W.y,Ia[Da+2]=W.z,Ia[Da+3]=X.x,Ia[Da+4]=X.y,Ia[Da+5]=X.z,Ia[Da+6]=Y.x,Ia[Da+7]=Y.y,Ia[Da+8]=Y.z,Da+=9;for(H=0,U=ma.length;H<U;H++)N=
-Ca[ma[H]],W=Ub[N.a].position,X=Ub[N.b].position,Y=Ub[N.c].position,na=Ub[N.d].position,Ia[Da]=W.x,Ia[Da+1]=W.y,Ia[Da+2]=W.z,Ia[Da+3]=X.x,Ia[Da+4]=X.y,Ia[Da+5]=X.z,Ia[Da+6]=Y.x,Ia[Da+7]=Y.y,Ia[Da+8]=Y.z,Ia[Da+9]=na.x,Ia[Da+10]=na.y,Ia[Da+11]=na.z,Da+=12;j.bindBuffer(j.ARRAY_BUFFER,da.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Ia,$a)}if(td)for(ab=0,cd=Pb.length;ab<cd;ab++){Ba=0;for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],W=Pb[ab].vertices[N.a].position,X=Pb[ab].vertices[N.b].position,Y=Pb[ab].vertices[N.c].position,
-Fa=Sc[ab],Fa[Ba]=W.x,Fa[Ba+1]=W.y,Fa[Ba+2]=W.z,Fa[Ba+3]=X.x,Fa[Ba+4]=X.y,Fa[Ba+5]=X.z,Fa[Ba+6]=Y.x,Fa[Ba+7]=Y.y,Fa[Ba+8]=Y.z,Ba+=9;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],W=Pb[ab].vertices[N.a].position,X=Pb[ab].vertices[N.b].position,Y=Pb[ab].vertices[N.c].position,na=Pb[ab].vertices[N.d].position,Fa=Sc[ab],Fa[Ba]=W.x,Fa[Ba+1]=W.y,Fa[Ba+2]=W.z,Fa[Ba+3]=X.x,Fa[Ba+4]=X.y,Fa[Ba+5]=X.z,Fa[Ba+6]=Y.x,Fa[Ba+7]=Y.y,Fa[Ba+8]=Y.z,Fa[Ba+9]=na.x,Fa[Ba+10]=na.y,Fa[Ba+11]=na.z,Ba+=12;j.bindBuffer(j.ARRAY_BUFFER,
-da.__webglMorphTargetsBuffers[ab]);j.bufferData(j.ARRAY_BUFFER,Sc[ab],$a)}if(Ob.length){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],sb=Ob[N.a],tb=Ob[N.b],ub=Ob[N.c],va[J]=sb.x,va[J+1]=sb.y,va[J+2]=sb.z,va[J+3]=sb.w,va[J+4]=tb.x,va[J+5]=tb.y,va[J+6]=tb.z,va[J+7]=tb.w,va[J+8]=ub.x,va[J+9]=ub.y,va[J+10]=ub.z,va[J+11]=ub.w,vb=Xb[N.a],wb=Xb[N.b],xb=Xb[N.c],ua[J]=vb.x,ua[J+1]=vb.y,ua[J+2]=vb.z,ua[J+3]=vb.w,ua[J+4]=wb.x,ua[J+5]=wb.y,ua[J+6]=wb.z,ua[J+7]=wb.w,ua[J+8]=xb.x,ua[J+9]=xb.y,ua[J+10]=xb.z,ua[J+11]=
-xb.w,Hb=Vb[N.a],Ib=Vb[N.b],Jb=Vb[N.c],sa[J]=Hb.x,sa[J+1]=Hb.y,sa[J+2]=Hb.z,sa[J+3]=1,sa[J+4]=Ib.x,sa[J+5]=Ib.y,sa[J+6]=Ib.z,sa[J+7]=1,sa[J+8]=Jb.x,sa[J+9]=Jb.y,sa[J+10]=Jb.z,sa[J+11]=1,Kb=Wb[N.a],Lb=Wb[N.b],Mb=Wb[N.c],ta[J]=Kb.x,ta[J+1]=Kb.y,ta[J+2]=Kb.z,ta[J+3]=1,ta[J+4]=Lb.x,ta[J+5]=Lb.y,ta[J+6]=Lb.z,ta[J+7]=1,ta[J+8]=Mb.x,ta[J+9]=Mb.y,ta[J+10]=Mb.z,ta[J+11]=1,J+=12;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],sb=Ob[N.a],tb=Ob[N.b],ub=Ob[N.c],nc=Ob[N.d],va[J]=sb.x,va[J+1]=sb.y,va[J+2]=sb.z,va[J+3]=sb.w,
-va[J+4]=tb.x,va[J+5]=tb.y,va[J+6]=tb.z,va[J+7]=tb.w,va[J+8]=ub.x,va[J+9]=ub.y,va[J+10]=ub.z,va[J+11]=ub.w,va[J+12]=nc.x,va[J+13]=nc.y,va[J+14]=nc.z,va[J+15]=nc.w,vb=Xb[N.a],wb=Xb[N.b],xb=Xb[N.c],oc=Xb[N.d],ua[J]=vb.x,ua[J+1]=vb.y,ua[J+2]=vb.z,ua[J+3]=vb.w,ua[J+4]=wb.x,ua[J+5]=wb.y,ua[J+6]=wb.z,ua[J+7]=wb.w,ua[J+8]=xb.x,ua[J+9]=xb.y,ua[J+10]=xb.z,ua[J+11]=xb.w,ua[J+12]=oc.x,ua[J+13]=oc.y,ua[J+14]=oc.z,ua[J+15]=oc.w,Hb=Vb[N.a],Ib=Vb[N.b],Jb=Vb[N.c],Bc=Vb[N.d],sa[J]=Hb.x,sa[J+1]=Hb.y,sa[J+2]=Hb.z,sa[J+
-3]=1,sa[J+4]=Ib.x,sa[J+5]=Ib.y,sa[J+6]=Ib.z,sa[J+7]=1,sa[J+8]=Jb.x,sa[J+9]=Jb.y,sa[J+10]=Jb.z,sa[J+11]=1,sa[J+12]=Bc.x,sa[J+13]=Bc.y,sa[J+14]=Bc.z,sa[J+15]=1,Kb=Wb[N.a],Lb=Wb[N.b],Mb=Wb[N.c],Cc=Wb[N.d],ta[J]=Kb.x,ta[J+1]=Kb.y,ta[J+2]=Kb.z,ta[J+3]=1,ta[J+4]=Lb.x,ta[J+5]=Lb.y,ta[J+6]=Lb.z,ta[J+7]=1,ta[J+8]=Mb.x,ta[J+9]=Mb.y,ta[J+10]=Mb.z,ta[J+11]=1,ta[J+12]=Cc.x,ta[J+13]=Cc.y,ta[J+14]=Cc.z,ta[J+15]=1,J+=16;0<J&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,sa,
-$a),j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,ta,$a),j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,ua,$a),j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,va,$a))}if(sd&&Rc){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],kb=N.vertexColors,Ac=N.color,3===kb.length&&Rc===THREE.VertexColors?(pb=kb[0],qb=kb[1],rb=kb[2]):rb=qb=pb=Ac,Ja[Aa]=pb.r,Ja[Aa+1]=pb.g,Ja[Aa+2]=pb.b,Ja[Aa+3]=qb.r,Ja[Aa+
-4]=qb.g,Ja[Aa+5]=qb.b,Ja[Aa+6]=rb.r,Ja[Aa+7]=rb.g,Ja[Aa+8]=rb.b,Aa+=9;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],kb=N.vertexColors,Ac=N.color,4===kb.length&&Rc===THREE.VertexColors?(pb=kb[0],qb=kb[1],rb=kb[2],mc=kb[3]):mc=rb=qb=pb=Ac,Ja[Aa]=pb.r,Ja[Aa+1]=pb.g,Ja[Aa+2]=pb.b,Ja[Aa+3]=qb.r,Ja[Aa+4]=qb.g,Ja[Aa+5]=qb.b,Ja[Aa+6]=rb.r,Ja[Aa+7]=rb.g,Ja[Aa+8]=rb.b,Ja[Aa+9]=mc.r,Ja[Aa+10]=mc.g,Ja[Aa+11]=mc.b,Aa+=12;0<Aa&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Ja,$a))}if(rd&&
-Ra.hasTangents){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],Ab=N.vertexTangents,mb=Ab[0],nb=Ab[1],ob=Ab[2],ra[oa]=mb.x,ra[oa+1]=mb.y,ra[oa+2]=mb.z,ra[oa+3]=mb.w,ra[oa+4]=nb.x,ra[oa+5]=nb.y,ra[oa+6]=nb.z,ra[oa+7]=nb.w,ra[oa+8]=ob.x,ra[oa+9]=ob.y,ra[oa+10]=ob.z,ra[oa+11]=ob.w,oa+=12;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],Ab=N.vertexTangents,mb=Ab[0],nb=Ab[1],ob=Ab[2],lc=Ab[3],ra[oa]=mb.x,ra[oa+1]=mb.y,ra[oa+2]=mb.z,ra[oa+3]=mb.w,ra[oa+4]=nb.x,ra[oa+5]=nb.y,ra[oa+6]=nb.z,ra[oa+7]=nb.w,ra[oa+8]=ob.x,ra[oa+
-9]=ob.y,ra[oa+10]=ob.z,ra[oa+11]=ob.w,ra[oa+12]=lc.x,ra[oa+13]=lc.y,ra[oa+14]=lc.z,ra[oa+15]=lc.w,oa+=16;j.bindBuffer(j.ARRAY_BUFFER,da.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,ra,$a)}if(qd&&Zc){for(H=0,U=la.length;H<U;H++)if(N=Ca[la[H]],bc=N.vertexNormals,Gb=N.normal,3===bc.length&&ad)for(ka=0;3>ka;ka++)Nb=bc[ka],eb[Pa]=Nb.x,eb[Pa+1]=Nb.y,eb[Pa+2]=Nb.z,Pa+=3;else for(ka=0;3>ka;ka++)eb[Pa]=Gb.x,eb[Pa+1]=Gb.y,eb[Pa+2]=Gb.z,Pa+=3;for(H=0,U=ma.length;H<U;H++)if(N=Ca[ma[H]],bc=N.vertexNormals,
-Gb=N.normal,4===bc.length&&ad)for(ka=0;4>ka;ka++)Nb=bc[ka],eb[Pa]=Nb.x,eb[Pa+1]=Nb.y,eb[Pa+2]=Nb.z,Pa+=3;else for(ka=0;4>ka;ka++)eb[Pa]=Gb.x,eb[Pa+1]=Gb.y,eb[Pa+2]=Gb.z,Pa+=3;j.bindBuffer(j.ARRAY_BUFFER,da.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,eb,$a)}if(dd&&Uc&&$c){for(H=0,U=la.length;H<U;H++)if(hb=la[H],N=Ca[hb],cc=Uc[hb],void 0!==cc)for(ka=0;3>ka;ka++)ec=cc[ka],pc[Bb]=ec.u,pc[Bb+1]=ec.v,Bb+=2;for(H=0,U=ma.length;H<U;H++)if(hb=ma[H],N=Ca[hb],cc=Uc[hb],void 0!==cc)for(ka=0;4>ka;ka++)ec=
-cc[ka],pc[Bb]=ec.u,pc[Bb+1]=ec.v,Bb+=2;0<Bb&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,pc,$a))}if(dd&&Vc&&$c){for(H=0,U=la.length;H<U;H++)if(hb=la[H],N=Ca[hb],dc=Vc[hb],void 0!==dc)for(ka=0;3>ka;ka++)fc=dc[ka],qc[Cb]=fc.u,qc[Cb+1]=fc.v,Cb+=2;for(H=0,U=ma.length;H<U;H++)if(hb=ma[H],N=Ca[hb],dc=Vc[hb],void 0!==dc)for(ka=0;4>ka;ka++)fc=dc[ka],qc[Cb]=fc.u,qc[Cb+1]=fc.v,Cb+=2;0<Cb&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,qc,$a))}if(pd){for(H=
-0,U=la.length;H<U;H++)N=Ca[la[H]],yb[db]=ya,yb[db+1]=ya+1,yb[db+2]=ya+2,db+=3,Ya[Qa]=ya,Ya[Qa+1]=ya+1,Ya[Qa+2]=ya,Ya[Qa+3]=ya+2,Ya[Qa+4]=ya+1,Ya[Qa+5]=ya+2,Qa+=6,ya+=3;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],yb[db]=ya,yb[db+1]=ya+1,yb[db+2]=ya+3,yb[db+3]=ya+1,yb[db+4]=ya+2,yb[db+5]=ya+3,db+=6,Ya[Qa]=ya,Ya[Qa+1]=ya+1,Ya[Qa+2]=ya,Ya[Qa+3]=ya+3,Ya[Qa+4]=ya+1,Ya[Qa+5]=ya+2,Ya[Qa+6]=ya+2,Ya[Qa+7]=ya+3,Qa+=8,ya+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,da.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,
-yb,$a);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,da.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Ya,$a)}if(Tc)for(ka=0,bd=Tc.length;ka<bd;ka++)if(v=Tc[ka],v.__original.needsUpdate){z=0;if(1===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],v.array[z]=v.value[N.a],v.array[z+1]=v.value[N.b],v.array[z+2]=v.value[N.c],z+=3;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],v.array[z]=v.value[N.a],v.array[z+1]=v.value[N.b],v.array[z+2]=v.value[N.c],v.array[z+3]=v.value[N.d],
-z+=4}else{if("faces"===v.boundTo){for(H=0,U=la.length;H<U;H++)Xa=v.value[la[H]],v.array[z]=Xa,v.array[z+1]=Xa,v.array[z+2]=Xa,z+=3;for(H=0,U=ma.length;H<U;H++)Xa=v.value[ma[H]],v.array[z]=Xa,v.array[z+1]=Xa,v.array[z+2]=Xa,v.array[z+3]=Xa,z+=4}}else if(2===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],W=v.value[N.a],X=v.value[N.b],Y=v.value[N.c],v.array[z]=W.x,v.array[z+1]=W.y,v.array[z+2]=X.x,v.array[z+3]=X.y,v.array[z+4]=Y.x,v.array[z+5]=Y.y,z+=6;
-for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],W=v.value[N.a],X=v.value[N.b],Y=v.value[N.c],na=v.value[N.d],v.array[z]=W.x,v.array[z+1]=W.y,v.array[z+2]=X.x,v.array[z+3]=X.y,v.array[z+4]=Y.x,v.array[z+5]=Y.y,v.array[z+6]=na.x,v.array[z+7]=na.y,z+=8}else{if("faces"===v.boundTo){for(H=0,U=la.length;H<U;H++)Y=X=W=Xa=v.value[la[H]],v.array[z]=W.x,v.array[z+1]=W.y,v.array[z+2]=X.x,v.array[z+3]=X.y,v.array[z+4]=Y.x,v.array[z+5]=Y.y,z+=6;for(H=0,U=ma.length;H<U;H++)na=Y=X=W=Xa=v.value[ma[H]],v.array[z]=W.x,v.array[z+
-1]=W.y,v.array[z+2]=X.x,v.array[z+3]=X.y,v.array[z+4]=Y.x,v.array[z+5]=Y.y,v.array[z+6]=na.x,v.array[z+7]=na.y,z+=8}}else if(3===v.size){var ea;ea="c"===v.type?["r","g","b"]:["x","y","z"];if(void 0===v.boundTo||"vertices"===v.boundTo){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],W=v.value[N.a],X=v.value[N.b],Y=v.value[N.c],v.array[z]=W[ea[0]],v.array[z+1]=W[ea[1]],v.array[z+2]=W[ea[2]],v.array[z+3]=X[ea[0]],v.array[z+4]=X[ea[1]],v.array[z+5]=X[ea[2]],v.array[z+6]=Y[ea[0]],v.array[z+7]=Y[ea[1]],v.array[z+
-8]=Y[ea[2]],z+=9;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],W=v.value[N.a],X=v.value[N.b],Y=v.value[N.c],na=v.value[N.d],v.array[z]=W[ea[0]],v.array[z+1]=W[ea[1]],v.array[z+2]=W[ea[2]],v.array[z+3]=X[ea[0]],v.array[z+4]=X[ea[1]],v.array[z+5]=X[ea[2]],v.array[z+6]=Y[ea[0]],v.array[z+7]=Y[ea[1]],v.array[z+8]=Y[ea[2]],v.array[z+9]=na[ea[0]],v.array[z+10]=na[ea[1]],v.array[z+11]=na[ea[2]],z+=12}else if("faces"===v.boundTo){for(H=0,U=la.length;H<U;H++)Y=X=W=Xa=v.value[la[H]],v.array[z]=W[ea[0]],v.array[z+
-1]=W[ea[1]],v.array[z+2]=W[ea[2]],v.array[z+3]=X[ea[0]],v.array[z+4]=X[ea[1]],v.array[z+5]=X[ea[2]],v.array[z+6]=Y[ea[0]],v.array[z+7]=Y[ea[1]],v.array[z+8]=Y[ea[2]],z+=9;for(H=0,U=ma.length;H<U;H++)na=Y=X=W=Xa=v.value[ma[H]],v.array[z]=W[ea[0]],v.array[z+1]=W[ea[1]],v.array[z+2]=W[ea[2]],v.array[z+3]=X[ea[0]],v.array[z+4]=X[ea[1]],v.array[z+5]=X[ea[2]],v.array[z+6]=Y[ea[0]],v.array[z+7]=Y[ea[1]],v.array[z+8]=Y[ea[2]],v.array[z+9]=na[ea[0]],v.array[z+10]=na[ea[1]],v.array[z+11]=na[ea[2]],z+=12}}else if(4===
-v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],W=v.value[N.a],X=v.value[N.b],Y=v.value[N.c],v.array[z]=W.x,v.array[z+1]=W.y,v.array[z+2]=W.z,v.array[z+3]=W.w,v.array[z+4]=X.x,v.array[z+5]=X.y,v.array[z+6]=X.z,v.array[z+7]=X.w,v.array[z+8]=Y.x,v.array[z+9]=Y.y,v.array[z+10]=Y.z,v.array[z+11]=Y.w,z+=12;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],W=v.value[N.a],X=v.value[N.b],Y=v.value[N.c],na=v.value[N.d],v.array[z]=W.x,v.array[z+1]=W.y,v.array[z+2]=W.z,v.array[z+
-3]=W.w,v.array[z+4]=X.x,v.array[z+5]=X.y,v.array[z+6]=X.z,v.array[z+7]=X.w,v.array[z+8]=Y.x,v.array[z+9]=Y.y,v.array[z+10]=Y.z,v.array[z+11]=Y.w,v.array[z+12]=na.x,v.array[z+13]=na.y,v.array[z+14]=na.z,v.array[z+15]=na.w,z+=16}else if("faces"===v.boundTo){for(H=0,U=la.length;H<U;H++)Y=X=W=Xa=v.value[la[H]],v.array[z]=W.x,v.array[z+1]=W.y,v.array[z+2]=W.z,v.array[z+3]=W.w,v.array[z+4]=X.x,v.array[z+5]=X.y,v.array[z+6]=X.z,v.array[z+7]=X.w,v.array[z+8]=Y.x,v.array[z+9]=Y.y,v.array[z+10]=Y.z,v.array[z+
-11]=Y.w,z+=12;for(H=0,U=ma.length;H<U;H++)na=Y=X=W=Xa=v.value[ma[H]],v.array[z]=W.x,v.array[z+1]=W.y,v.array[z+2]=W.z,v.array[z+3]=W.w,v.array[z+4]=X.x,v.array[z+5]=X.y,v.array[z+6]=X.z,v.array[z+7]=X.w,v.array[z+8]=Y.x,v.array[z+9]=Y.y,v.array[z+10]=Y.z,v.array[z+11]=Y.w,v.array[z+12]=na.x,v.array[z+13]=na.y,v.array[z+14]=na.z,v.array[z+15]=na.w,z+=16}j.bindBuffer(j.ARRAY_BUFFER,v.buffer);j.bufferData(j.ARRAY_BUFFER,v.array,$a)}od&&(delete da.__inittedArrays,delete da.__colorArray,delete da.__normalArray,
-delete da.__tangentArray,delete da.__uvArray,delete da.__uv2Array,delete da.__faceArray,delete da.__vertexArray,delete da.__lineArray,delete da.__skinVertexAArray,delete da.__skinVertexBArray,delete da.__skinIndexArray,delete da.__skinWeightArray)}}ia.__dirtyVertices=!1;ia.__dirtyMorphTargets=!1;ia.__dirtyElements=!1;ia.__dirtyUvs=!1;ia.__dirtyNormals=!1;ia.__dirtyColors=!1;ia.__dirtyTangents=!1;Ua.attributes&&p(Ua)}else if(jb instanceof THREE.Ribbon){if(ia.__dirtyVertices||ia.__dirtyColors){var Qb=
-ia,ed=j.DYNAMIC_DRAW,rc=void 0,sc=void 0,Dc=void 0,Rb=void 0,Ec=void 0,fd=Qb.vertices,gd=Qb.colors,ud=fd.length,vd=gd.length,Fc=Qb.__vertexArray,Gc=Qb.__colorArray,wd=Qb.__dirtyColors;if(Qb.__dirtyVertices){for(rc=0;rc<ud;rc++)Dc=fd[rc].position,Rb=3*rc,Fc[Rb]=Dc.x,Fc[Rb+1]=Dc.y,Fc[Rb+2]=Dc.z;j.bindBuffer(j.ARRAY_BUFFER,Qb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Fc,ed)}if(wd){for(sc=0;sc<vd;sc++)Ec=gd[sc],Rb=3*sc,Gc[Rb]=Ec.r,Gc[Rb+1]=Ec.g,Gc[Rb+2]=Ec.b;j.bindBuffer(j.ARRAY_BUFFER,Qb.__webglColorBuffer);
-j.bufferData(j.ARRAY_BUFFER,Gc,ed)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1}else if(jb instanceof THREE.Line){Ua=c(jb,kc);ac=Ua.attributes&&n(Ua);if(ia.__dirtyVertices||ia.__dirtyColors||ac){var Db=ia,Wc=j.DYNAMIC_DRAW,tc=void 0,uc=void 0,Hc=void 0,wa=void 0,Ic=void 0,hd=Db.vertices,id=Db.colors,xd=hd.length,yd=id.length,Jc=Db.__vertexArray,Kc=Db.__colorArray,zd=Db.__dirtyColors,Xc=Db.__webglCustomAttributesList,Lc=void 0,jd=void 0,Ma=void 0,gc=void 0,Va=void 0,pa=void 0;if(Db.__dirtyVertices){for(tc=
-0;tc<xd;tc++)Hc=hd[tc].position,wa=3*tc,Jc[wa]=Hc.x,Jc[wa+1]=Hc.y,Jc[wa+2]=Hc.z;j.bindBuffer(j.ARRAY_BUFFER,Db.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Jc,Wc)}if(zd){for(uc=0;uc<yd;uc++)Ic=id[uc],wa=3*uc,Kc[wa]=Ic.r,Kc[wa+1]=Ic.g,Kc[wa+2]=Ic.b;j.bindBuffer(j.ARRAY_BUFFER,Db.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Kc,Wc)}if(Xc)for(Lc=0,jd=Xc.length;Lc<jd;Lc++)if(pa=Xc[Lc],pa.needsUpdate&&(void 0===pa.boundTo||"vertices"===pa.boundTo)){wa=0;gc=pa.value.length;if(1===pa.size)for(Ma=0;Ma<
-gc;Ma++)pa.array[Ma]=pa.value[Ma];else if(2===pa.size)for(Ma=0;Ma<gc;Ma++)Va=pa.value[Ma],pa.array[wa]=Va.x,pa.array[wa+1]=Va.y,wa+=2;else if(3===pa.size)if("c"===pa.type)for(Ma=0;Ma<gc;Ma++)Va=pa.value[Ma],pa.array[wa]=Va.r,pa.array[wa+1]=Va.g,pa.array[wa+2]=Va.b,wa+=3;else for(Ma=0;Ma<gc;Ma++)Va=pa.value[Ma],pa.array[wa]=Va.x,pa.array[wa+1]=Va.y,pa.array[wa+2]=Va.z,wa+=3;else if(4===pa.size)for(Ma=0;Ma<gc;Ma++)Va=pa.value[Ma],pa.array[wa]=Va.x,pa.array[wa+1]=Va.y,pa.array[wa+2]=Va.z,pa.array[wa+
-3]=Va.w,wa+=4;j.bindBuffer(j.ARRAY_BUFFER,pa.buffer);j.bufferData(j.ARRAY_BUFFER,pa.array,Wc)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1;Ua.attributes&&p(Ua)}else if(jb instanceof THREE.ParticleSystem)Ua=c(jb,kc),ac=Ua.attributes&&n(Ua),(ia.__dirtyVertices||ia.__dirtyColors||jb.sortParticles||ac)&&f(ia,j.DYNAMIC_DRAW,jb),ia.__dirtyVertices=!1,ia.__dirtyColors=!1,Ua.attributes&&p(Ua)}};this.initMaterial=function(a,b,c,d){var e,f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?
-i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var l=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(l.uniforms);a.vertexShader=l.vertexShader;a.fragmentShader=l.fragmentShader}var k,m;f=l=0;for(k=0,m=b.length;k<m;k++)e=b[k],e instanceof THREE.SpotLight&&!e.onlyShadow&&
-f++,e instanceof THREE.DirectionalLight&&f++,e instanceof THREE.PointLight&&l++;l+f<=M?k=f:(k=Math.ceil(M*f/(l+f)),l=M-k);e=k;f=l;var n=0;for(l=0,k=b.length;l<k;l++)m=b[l],m instanceof THREE.SpotLight&&m.castShadow&&n++;var p=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var o;a:{k=a.fragmentShader;m=a.vertexShader;var l=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:e,maxPointLights:f,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround},q,d=[];i?d.push(i):(d.push(k),d.push(m));for(q in c)d.push(q),d.push(c[q]);i=d.join();for(q=0,d=Q.length;q<d;q++)if(Q[q].code===i){o=Q[q].program;break a}q=j.createProgram();d=[0<Za?"#define VERTEX_TEXTURES":
-"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":
-"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",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");
+else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){h=c=0;for(m=b.length;h<m;h++)if(n=b[h],n.castShadow&&(n instanceof THREE.SpotLight||n instanceof THREE.DirectionalLight))i.shadowMap.texture[c]=n.shadowMap,i.shadowMapSize.value[c]=n.shadowMapSize,i.shadowMatrix.value[c]=n.shadowMatrix,i.shadowDarkness.value[c]=n.shadowDarkness,i.shadowBias.value[c]=n.shadowBias,c++}b=d.uniformsList;for(i=0,c=b.length;i<c;i++)if(n=f.uniforms[b[i][1]])if(h=
+b[i][0],q=h.type,m=h.value,"i"===q)j.uniform1i(n,m);else if("f"===q)j.uniform1f(n,m);else if("v2"===q)j.uniform2f(n,m.x,m.y);else if("v3"===q)j.uniform3f(n,m.x,m.y,m.z);else if("v4"===q)j.uniform4f(n,m.x,m.y,m.z,m.w);else if("c"===q)j.uniform3f(n,m.r,m.g,m.b);else if("fv1"===q)j.uniform1fv(n,m);else if("fv"===q)j.uniform3fv(n,m);else if("v2v"===q){if(!h._array)h._array=new Float32Array(2*m.length);for(q=0,r=m.length;q<r;q++)s=2*q,h._array[s]=m[q].x,h._array[s+1]=m[q].y;j.uniform2fv(n,h._array)}else if("v3v"===
+q){if(!h._array)h._array=new Float32Array(3*m.length);for(q=0,r=m.length;q<r;q++)s=3*q,h._array[s]=m[q].x,h._array[s+1]=m[q].y,h._array[s+2]=m[q].z;j.uniform3fv(n,h._array)}else if("m4"===q){if(!h._array)h._array=new Float32Array(16);m.flattenToArray(h._array);j.uniformMatrix4fv(n,!1,h._array)}else if("m4v"===q){if(!h._array)h._array=new Float32Array(16*m.length);for(q=0,r=m.length;q<r;q++)m[q].flattenToArrayOffset(h._array,16*q);j.uniformMatrix4fv(n,!1,h._array)}else if("t"===q){if(j.uniform1i(n,
+m),n=h.texture)if(n.image instanceof Array&&6===n.image.length){if(h=n,6===h.image.length)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+m);j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);m=[];for(n=0;6>n;n++){q=m;r=n;if(G.autoScaleCubemaps){if(s=h.image[n],E=kb,!(s.width<=E&&s.height<=E))P=Math.max(s.width,s.height),t=Math.floor(s.width*E/P),E=Math.floor(s.height*E/P),P=document.createElement("canvas"),P.width=
+t,P.height=E,P.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,t,E),s=P}else s=h.image[n];q[r]=s}n=m[0];q=0===(n.width&n.width-1)&&0===(n.height&n.height-1);r=A(h.format);s=A(h.type);u(j.TEXTURE_CUBE_MAP,h,q);for(n=0;6>n;n++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,r,r,s,m[n]);h.generateMipmaps&&q&&j.generateMipmap(j.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdated)h.onUpdated()}else j.activeTexture(j.TEXTURE0+m),j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else n instanceof
+THREE.WebGLRenderTargetCube?(h=n,j.activeTexture(j.TEXTURE0+m),j.bindTexture(j.TEXTURE_CUBE_MAP,h.__webglTexture)):G.setTexture(n,m)}else if("tv"===q){if(!h._array){h._array=[];for(q=0,r=h.texture.length;q<r;q++)h._array[q]=m+q}j.uniform1iv(n,h._array);for(q=0,r=h.texture.length;q<r;q++)(n=h.texture[q])&&G.setTexture(n,h._array[q])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==g.cameraPosition&&j.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)&&null!==g.viewMatrix&&j.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(j.uniformMatrix4fv(g.cameraInverseMatrix,!1,a._viewMatrixArray),j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||
+d.envMap||d.skinning||e.receiveShadow)&&null!==g.objectMatrix&&j.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function r(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function s(a,b,c){aa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),aa=a);if(a&&(ba!==b||ca!==c))j.polygonOffset(b,c),ba=b,ca=c}function t(a,
+b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(b),null):c}function u(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,A(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,A(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,A(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,A(b.minFilter))):(j.texParameteri(a,
+j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,w(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,w(b.minFilter)))}function x(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,
+j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function w(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function A(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;
+case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;
+case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var a=a||{},D=void 0!==a.canvas?a.canvas:document.createElement("canvas"),B=void 0!==a.precision?a.precision:"mediump",C=void 0!==a.antialias?a.antialias:!1,F=void 0!==
+a.stencil?a.stencil:!0,K=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,L=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),T=void 0!==a.clearAlpha?a.clearAlpha:0,M=void 0!==a.maxLights?a.maxLights:4;this.domElement=D;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=
+this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var G=this,j,Q=[],I=null,R=null,y=-1,E=null,P=0,$=null,Z=null,ga=null,fa=null,S=null,aa=null,ba=null,ca=null,ha=null,Na=0,ja=0,za=0,qa=0,Ga=0,Ea=0,Sa=new THREE.Frustum,Ta=new THREE.Matrix4,Wa=new THREE.Vector4,fb={ambient:[0,0,0],directional:{length:0,colors:[],
+positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};j=function(){var a;try{if(!(a=D.getContext("experimental-webgl",{antialias:C,stencil:F,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}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);
+j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(L.r,L.g,L.b,T);this.context=j;var Za=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.TEXTURE_SIZE);var kb=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=function(){return 0<Za};this.setSize=function(a,b){D.width=a;D.height=b;this.setViewport(0,
+0,D.width,D.height)};this.setViewport=function(a,b,c,d){Na=a;ja=b;za=c;qa=d;j.viewport(Na,ja,za,qa)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){L.setHex(a);T=b;j.clearColor(L.r,L.g,L.b,T)};this.setClearColor=function(a,b){L.copy(a);T=b;j.clearColor(L.r,L.g,L.b,T)};this.getClearColor=function(){return L};this.getClearAlpha=function(){return T};this.clear=function(a,
+b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,
+delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);
+j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);G.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--;else if(a instanceof
+THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),G.info.memory.textures--};this.updateShadowMap=function(a,b){I=null;y=E=S=fa=ga=-1;this.shadowMapPlugin.update(a,b)};
+this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,
+e,f,g,h,i,l,k,m,n,q=3*a.count;for(n=0;n<q;n+=9)c=a.normalArray,d=c[n],e=c[n+1],f=c[n+2],g=c[n+3],i=c[n+4],k=c[n+5],h=c[n+6],l=c[n+7],m=c[n+8],d=(d+g+h)/3,e=(e+i+l)/3,f=(f+k+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}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,
+b,c,d,e,f){if(0!==d.opacity&&(c=m(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==E&&(E=d,b=!0),f instanceof THREE.Mesh)){f=e.offsets;d=0;for(c=f.length;d<c;++d)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexPositionBuffer),j.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,j.FLOAT,!1,0,12*f[d].index),0<=a.normal&&e.vertexNormalBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexNormalBuffer),j.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,j.FLOAT,!1,0,12*
+f[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.vertexUvBuffer),j.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,j.FLOAT,!1,0,8*f[d].index),j.enableVertexAttribArray(a.uv)):j.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(j.bindBuffer(j.ARRAY_BUFFER,e.vertexColorBuffer),j.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,j.FLOAT,!1,0,16*f[d].index)),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),j.drawElements(j.TRIANGLES,
+f[d].count,j.UNSIGNED_SHORT,2*f[d].start),G.info.render.calls++,G.info.render.vertices+=f[d].count,G.info.render.faces+=f[d].count/3}};this.renderBuffer=function(a,b,c,d,e,f){if(0!==d.opacity){var g,h,c=m(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==E&&(E=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase?
+(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,
+!1,0,0),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],l=-1,k=0;h=f.morphTargetInfluences;var n,q=h.length;g=0;for(-1!==f.morphTargetBase&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(n=0;n<q;n++)!i[n]&&h[n]>l&&(k=n,l=h[k]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=l;i[k]=1;l=-1;g++}}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,
+f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(g=0,h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0));0<=b.color&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));0<=b.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,
+3,j.FLOAT,!1,0,0));0<=b.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));0<=b.uv&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));0<=b.uv2&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));
+d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,
+4,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ha&&(j.lineWidth(d),ha=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),G.info.render.calls++,G.info.render.vertices+=e.__webglFaceCount,G.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===
+THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==ha&&(j.lineWidth(d),ha=d),j.drawArrays(f,0,e.__webglLineCount),G.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),G.info.render.calls++,G.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),G.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,k,m,n=a.lights,q=a.fog;y=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);
+void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();h(this.renderPluginsPre,a,b);G.info.render.calls=0;G.info.render.vertices=0;G.info.render.faces=0;G.info.render.points=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);Ta.multiply(b.projectionMatrix,b.matrixWorldInverse);Sa.setFromMatrix(Ta);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);m=a.__webglObjects;for(d=0,e=m.length;d<e;d++)if(f=m[d],k=f.object,f.render=!1,k.visible&&(!(k instanceof THREE.Mesh||k instanceof THREE.ParticleSystem)||!k.frustumCulled||Sa.contains(k))){k.matrixWorld.flattenToArray(k._objectMatrixArray);r(k,b);var o=
+f,p=o.object,E=o.buffer,t=void 0,t=t=void 0,t=p.material;if(t instanceof THREE.MeshFaceMaterial){if(t=E.materialIndex,0<=t)t=p.geometry.materials[t],t.transparent?(o.transparent=t,o.opaque=null):(o.opaque=t,o.transparent=null)}else if(t)t.transparent?(o.transparent=t,o.opaque=null):(o.opaque=t,o.transparent=null);f.render=!0;if(this.sortObjects)k.renderDepth?f.z=k.renderDepth:(Wa.copy(k.position),Ta.multiplyVector3(Wa),f.z=Wa.z)}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;for(d=0,e=m.length;d<
+e;d++)if(f=m[d],k=f.object,k.visible)k.matrixAutoUpdate&&k.matrixWorld.flattenToArray(k._objectMatrixArray),r(k,b),k=f.object.material,k.transparent?(f.transparent=k,f.opaque=null):(f.opaque=k,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),s(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,
+!1,"",b,n,q,!0,a.overrideMaterial),l(a.__webglObjectsImmediate,"",b,n,q,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,n,q,!1),l(a.__webglObjectsImmediate,"opaque",b,n,q,!1),i(a.__webglObjects,!1,"transparent",b,n,q,!0),l(a.__webglObjectsImmediate,"transparent",b,n,q,!0));h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,
+c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,e){var f=m(a,b,c,d,e);E=-1;G.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,j,Sa):e.render(function(a){G.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=
+[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,i=void 0,l=void 0,m=void 0;if(!g.__webglInit)if(g.__webglInit=!0,g._modelViewMatrix=new THREE.Matrix4,g._normalMatrixArray=new Float32Array(9),g._modelViewMatrixArray=new Float32Array(16),g._objectMatrixArray=new Float32Array(16),g.matrixWorld.flattenToArray(g._objectMatrixArray),g instanceof THREE.Mesh){if(l=g.geometry,l instanceof THREE.Geometry){if(void 0===l.geometryGroups){var r=
+l,s=void 0,t=void 0,E=void 0,w=void 0,y=void 0,x=void 0,u=void 0,B={},C=r.morphTargets.length;r.geometryGroups={};for(s=0,t=r.faces.length;s<t;s++)E=r.faces[s],w=E.materialIndex,x=void 0!==w?w:-1,void 0===B[x]&&(B[x]={hash:x,counter:0}),u=B[x].hash+"_"+B[x].counter,void 0===r.geometryGroups[u]&&(r.geometryGroups[u]={faces3:[],faces4:[],materialIndex:w,vertices:0,numMorphTargets:C}),y=E instanceof THREE.Face3?3:4,65535<r.geometryGroups[u].vertices+y&&(B[x].counter+=1,u=B[x].hash+"_"+B[x].counter,void 0===
+r.geometryGroups[u]&&(r.geometryGroups[u]={faces3:[],faces4:[],materialIndex:w,vertices:0,numMorphTargets:C})),E instanceof THREE.Face3?r.geometryGroups[u].faces3.push(s):r.geometryGroups[u].faces4.push(s),r.geometryGroups[u].vertices+=y;r.geometryGroupsList=[];var $=void 0;for($ in r.geometryGroups)r.geometryGroups[$].id=P++,r.geometryGroupsList.push(r.geometryGroups[$])}for(i in l.geometryGroups)if(m=l.geometryGroups[i],!m.__webglVertexBuffer){var A=m;A.__webglVertexBuffer=j.createBuffer();A.__webglNormalBuffer=
+j.createBuffer();A.__webglTangentBuffer=j.createBuffer();A.__webglColorBuffer=j.createBuffer();A.__webglUVBuffer=j.createBuffer();A.__webglUV2Buffer=j.createBuffer();A.__webglSkinVertexABuffer=j.createBuffer();A.__webglSkinVertexBBuffer=j.createBuffer();A.__webglSkinIndicesBuffer=j.createBuffer();A.__webglSkinWeightsBuffer=j.createBuffer();A.__webglFaceBuffer=j.createBuffer();A.__webglLineBuffer=j.createBuffer();if(A.numMorphTargets){var D=void 0,I=void 0;A.__webglMorphTargetsBuffers=[];for(D=0,I=
+A.numMorphTargets;D<I;D++)A.__webglMorphTargetsBuffers.push(j.createBuffer())}G.info.memory.geometries++;var F=m,S=g,Z=S.geometry,L=F.faces3,K=F.faces4,M=3*L.length+4*K.length,fa=1*L.length+2*K.length,Q=3*L.length+4*K.length,aa=c(S,F),ba=e(aa),ca=d(aa),ga=aa.vertexColors?aa.vertexColors:!1;F.__vertexArray=new Float32Array(3*M);if(ca)F.__normalArray=new Float32Array(3*M);if(Z.hasTangents)F.__tangentArray=new Float32Array(4*M);if(ga)F.__colorArray=new Float32Array(3*M);if(ba){if(0<Z.faceUvs.length||
+0<Z.faceVertexUvs.length)F.__uvArray=new Float32Array(2*M);if(1<Z.faceUvs.length||1<Z.faceVertexUvs.length)F.__uv2Array=new Float32Array(2*M)}if(S.geometry.skinWeights.length&&S.geometry.skinIndices.length)F.__skinVertexAArray=new Float32Array(4*M),F.__skinVertexBArray=new Float32Array(4*M),F.__skinIndexArray=new Float32Array(4*M),F.__skinWeightArray=new Float32Array(4*M);F.__faceArray=new Uint16Array(3*fa);F.__lineArray=new Uint16Array(2*Q);if(F.numMorphTargets){F.__morphTargetsArrays=[];for(var R=
+0,ha=F.numMorphTargets;R<ha;R++)F.__morphTargetsArrays.push(new Float32Array(3*M))}F.__webglFaceCount=3*fa;F.__webglLineCount=2*Q;if(aa.attributes){if(void 0===F.__webglCustomAttributesList)F.__webglCustomAttributesList=[];var T=void 0;for(T in aa.attributes){var Na=aa.attributes[T],ja={},za;for(za in Na)ja[za]=Na[za];if(!ja.__webglInitialized||ja.createUniqueBuffers){ja.__webglInitialized=!0;var qa=1;"v2"===ja.type?qa=2:"v3"===ja.type?qa=3:"v4"===ja.type?qa=4:"c"===ja.type&&(qa=3);ja.size=qa;ja.array=
+new Float32Array(M*qa);ja.buffer=j.createBuffer();ja.buffer.belongsToAttribute=T;Na.needsUpdate=!0;ja.__original=Na}F.__webglCustomAttributesList.push(ja)}}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(g instanceof THREE.Ribbon){if(l=g.geometry,!l.__webglVertexBuffer){var Ea=l;Ea.__webglVertexBuffer=j.createBuffer();Ea.__webglColorBuffer=j.createBuffer();G.info.memory.geometries++;
+var Ga=l,Ta=Ga.vertices.length;Ga.__vertexArray=new Float32Array(3*Ta);Ga.__colorArray=new Float32Array(3*Ta);Ga.__webglVertexCount=Ta;l.__dirtyVertices=!0;l.__dirtyColors=!0}}else if(g instanceof THREE.Line){if(l=g.geometry,!l.__webglVertexBuffer){var Wa=l;Wa.__webglVertexBuffer=j.createBuffer();Wa.__webglColorBuffer=j.createBuffer();G.info.memory.geometries++;var Sa=l,fb=g,Za=Sa.vertices.length;Sa.__vertexArray=new Float32Array(3*Za);Sa.__colorArray=new Float32Array(3*Za);Sa.__webglLineCount=Za;
+b(Sa,fb);l.__dirtyVertices=!0;l.__dirtyColors=!0}}else if(g instanceof THREE.ParticleSystem&&(l=g.geometry,!l.__webglVertexBuffer)){var kb=l;kb.__webglVertexBuffer=j.createBuffer();kb.__webglColorBuffer=j.createBuffer();G.info.geometries++;var $b=l,kd=g,Oc=$b.vertices.length;$b.__vertexArray=new Float32Array(3*Oc);$b.__colorArray=new Float32Array(3*Oc);$b.__sortArray=[];$b.__webglParticleCount=Oc;b($b,kd);l.__dirtyVertices=!0;l.__dirtyColors=!0}if(!g.__webglActive){if(g instanceof THREE.Mesh)if(l=
+g.geometry,l instanceof THREE.BufferGeometry)k(h.__webglObjects,l,g);else for(i in l.geometryGroups)m=l.geometryGroups[i],k(h.__webglObjects,m,g);else g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem?(l=g.geometry,k(h.__webglObjects,l,g)):void 0!==THREE.MarchingCubes&&g instanceof THREE.MarchingCubes||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof
+THREE.LensFlare&&h.__webglFlares.push(g);g.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var cb=a.__objectsRemoved[0],xc=a;cb instanceof THREE.Mesh||cb instanceof THREE.ParticleSystem||cb instanceof THREE.Ribbon||cb instanceof THREE.Line?o(xc.__webglObjects,cb):cb instanceof THREE.Sprite?p(xc.__webglSprites,cb):cb instanceof THREE.LensFlare?p(xc.__webglFlares,cb):(cb instanceof THREE.MarchingCubes||cb.immediateRenderCallback)&&o(xc.__webglObjectsImmediate,cb);cb.__webglActive=
+!1;a.__objectsRemoved.splice(0,1)}for(var Pc=0,ld=a.__webglObjects.length;Pc<ld;Pc++){var ib=a.__webglObjects[Pc].object,ia=ib.geometry,kc=void 0,ac=void 0,Ua=void 0;if(ib instanceof THREE.Mesh)if(ia instanceof THREE.BufferGeometry)ia.__dirtyVertices=!1,ia.__dirtyElements=!1,ia.__dirtyUvs=!1,ia.__dirtyNormals=!1,ia.__dirtyColors=!1;else{for(var Qc=0,md=ia.geometryGroupsList.length;Qc<md;Qc++)if(kc=ia.geometryGroupsList[Qc],Ua=c(ib,kc),ac=Ua.attributes&&n(Ua),ia.__dirtyVertices||ia.__dirtyMorphTargets||
+ia.__dirtyElements||ia.__dirtyUvs||ia.__dirtyNormals||ia.__dirtyColors||ia.__dirtyTangents||ac){var da=kc,nd=ib,$a=j.DYNAMIC_DRAW,od=!ia.dynamic,zc=Ua;if(da.__inittedArrays){var Zc=d(zc),Rc=zc.vertexColors?zc.vertexColors:!1,$c=e(zc),ad=Zc===THREE.SmoothShading,H=void 0,U=void 0,hb=void 0,N=void 0,bc=void 0,Fb=void 0,jb=void 0,Ac=void 0,zb=void 0,cc=void 0,dc=void 0,W=void 0,X=void 0,Y=void 0,na=void 0,lb=void 0,mb=void 0,nb=void 0,lc=void 0,ob=void 0,pb=void 0,qb=void 0,mc=void 0,rb=void 0,sb=void 0,
+tb=void 0,nc=void 0,ub=void 0,vb=void 0,wb=void 0,oc=void 0,Gb=void 0,Hb=void 0,Ib=void 0,Bc=void 0,Jb=void 0,Kb=void 0,Lb=void 0,Cc=void 0,ka=void 0,bd=void 0,Mb=void 0,ec=void 0,fc=void 0,ab=void 0,cd=void 0,Fa=void 0,ya=0,Da=0,Ab=0,Bb=0,db=0,Pa=0,oa=0,Qa=0,Aa=0,J=0,Ba=0,z=0,Xa=void 0,Ia=da.__vertexArray,pc=da.__uvArray,qc=da.__uv2Array,eb=da.__normalArray,ra=da.__tangentArray,Ja=da.__colorArray,sa=da.__skinVertexAArray,ta=da.__skinVertexBArray,ua=da.__skinIndexArray,va=da.__skinWeightArray,Sc=
+da.__morphTargetsArrays,Tc=da.__webglCustomAttributesList,v=void 0,xb=da.__faceArray,Ya=da.__lineArray,Ra=nd.geometry,pd=Ra.__dirtyElements,dd=Ra.__dirtyUvs,qd=Ra.__dirtyNormals,rd=Ra.__dirtyTangents,sd=Ra.__dirtyColors,td=Ra.__dirtyMorphTargets,Ub=Ra.vertices,la=da.faces3,ma=da.faces4,Ca=Ra.faces,Uc=Ra.faceVertexUvs[0],Vc=Ra.faceVertexUvs[1],Vb=Ra.skinVerticesA,Wb=Ra.skinVerticesB,Xb=Ra.skinIndices,Nb=Ra.skinWeights,Ob=Ra.morphTargets;if(Ra.__dirtyVertices){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],
+W=Ub[N.a].position,X=Ub[N.b].position,Y=Ub[N.c].position,Ia[Da]=W.x,Ia[Da+1]=W.y,Ia[Da+2]=W.z,Ia[Da+3]=X.x,Ia[Da+4]=X.y,Ia[Da+5]=X.z,Ia[Da+6]=Y.x,Ia[Da+7]=Y.y,Ia[Da+8]=Y.z,Da+=9;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],W=Ub[N.a].position,X=Ub[N.b].position,Y=Ub[N.c].position,na=Ub[N.d].position,Ia[Da]=W.x,Ia[Da+1]=W.y,Ia[Da+2]=W.z,Ia[Da+3]=X.x,Ia[Da+4]=X.y,Ia[Da+5]=X.z,Ia[Da+6]=Y.x,Ia[Da+7]=Y.y,Ia[Da+8]=Y.z,Ia[Da+9]=na.x,Ia[Da+10]=na.y,Ia[Da+11]=na.z,Da+=12;j.bindBuffer(j.ARRAY_BUFFER,da.__webglVertexBuffer);
+j.bufferData(j.ARRAY_BUFFER,Ia,$a)}if(td)for(ab=0,cd=Ob.length;ab<cd;ab++){Ba=0;for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],W=Ob[ab].vertices[N.a].position,X=Ob[ab].vertices[N.b].position,Y=Ob[ab].vertices[N.c].position,Fa=Sc[ab],Fa[Ba]=W.x,Fa[Ba+1]=W.y,Fa[Ba+2]=W.z,Fa[Ba+3]=X.x,Fa[Ba+4]=X.y,Fa[Ba+5]=X.z,Fa[Ba+6]=Y.x,Fa[Ba+7]=Y.y,Fa[Ba+8]=Y.z,Ba+=9;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],W=Ob[ab].vertices[N.a].position,X=Ob[ab].vertices[N.b].position,Y=Ob[ab].vertices[N.c].position,na=Ob[ab].vertices[N.d].position,
+Fa=Sc[ab],Fa[Ba]=W.x,Fa[Ba+1]=W.y,Fa[Ba+2]=W.z,Fa[Ba+3]=X.x,Fa[Ba+4]=X.y,Fa[Ba+5]=X.z,Fa[Ba+6]=Y.x,Fa[Ba+7]=Y.y,Fa[Ba+8]=Y.z,Fa[Ba+9]=na.x,Fa[Ba+10]=na.y,Fa[Ba+11]=na.z,Ba+=12;j.bindBuffer(j.ARRAY_BUFFER,da.__webglMorphTargetsBuffers[ab]);j.bufferData(j.ARRAY_BUFFER,Sc[ab],$a)}if(Nb.length){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],rb=Nb[N.a],sb=Nb[N.b],tb=Nb[N.c],va[J]=rb.x,va[J+1]=rb.y,va[J+2]=rb.z,va[J+3]=rb.w,va[J+4]=sb.x,va[J+5]=sb.y,va[J+6]=sb.z,va[J+7]=sb.w,va[J+8]=tb.x,va[J+9]=tb.y,va[J+10]=
+tb.z,va[J+11]=tb.w,ub=Xb[N.a],vb=Xb[N.b],wb=Xb[N.c],ua[J]=ub.x,ua[J+1]=ub.y,ua[J+2]=ub.z,ua[J+3]=ub.w,ua[J+4]=vb.x,ua[J+5]=vb.y,ua[J+6]=vb.z,ua[J+7]=vb.w,ua[J+8]=wb.x,ua[J+9]=wb.y,ua[J+10]=wb.z,ua[J+11]=wb.w,Gb=Vb[N.a],Hb=Vb[N.b],Ib=Vb[N.c],sa[J]=Gb.x,sa[J+1]=Gb.y,sa[J+2]=Gb.z,sa[J+3]=1,sa[J+4]=Hb.x,sa[J+5]=Hb.y,sa[J+6]=Hb.z,sa[J+7]=1,sa[J+8]=Ib.x,sa[J+9]=Ib.y,sa[J+10]=Ib.z,sa[J+11]=1,Jb=Wb[N.a],Kb=Wb[N.b],Lb=Wb[N.c],ta[J]=Jb.x,ta[J+1]=Jb.y,ta[J+2]=Jb.z,ta[J+3]=1,ta[J+4]=Kb.x,ta[J+5]=Kb.y,ta[J+6]=
+Kb.z,ta[J+7]=1,ta[J+8]=Lb.x,ta[J+9]=Lb.y,ta[J+10]=Lb.z,ta[J+11]=1,J+=12;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],rb=Nb[N.a],sb=Nb[N.b],tb=Nb[N.c],nc=Nb[N.d],va[J]=rb.x,va[J+1]=rb.y,va[J+2]=rb.z,va[J+3]=rb.w,va[J+4]=sb.x,va[J+5]=sb.y,va[J+6]=sb.z,va[J+7]=sb.w,va[J+8]=tb.x,va[J+9]=tb.y,va[J+10]=tb.z,va[J+11]=tb.w,va[J+12]=nc.x,va[J+13]=nc.y,va[J+14]=nc.z,va[J+15]=nc.w,ub=Xb[N.a],vb=Xb[N.b],wb=Xb[N.c],oc=Xb[N.d],ua[J]=ub.x,ua[J+1]=ub.y,ua[J+2]=ub.z,ua[J+3]=ub.w,ua[J+4]=vb.x,ua[J+5]=vb.y,ua[J+6]=vb.z,
+ua[J+7]=vb.w,ua[J+8]=wb.x,ua[J+9]=wb.y,ua[J+10]=wb.z,ua[J+11]=wb.w,ua[J+12]=oc.x,ua[J+13]=oc.y,ua[J+14]=oc.z,ua[J+15]=oc.w,Gb=Vb[N.a],Hb=Vb[N.b],Ib=Vb[N.c],Bc=Vb[N.d],sa[J]=Gb.x,sa[J+1]=Gb.y,sa[J+2]=Gb.z,sa[J+3]=1,sa[J+4]=Hb.x,sa[J+5]=Hb.y,sa[J+6]=Hb.z,sa[J+7]=1,sa[J+8]=Ib.x,sa[J+9]=Ib.y,sa[J+10]=Ib.z,sa[J+11]=1,sa[J+12]=Bc.x,sa[J+13]=Bc.y,sa[J+14]=Bc.z,sa[J+15]=1,Jb=Wb[N.a],Kb=Wb[N.b],Lb=Wb[N.c],Cc=Wb[N.d],ta[J]=Jb.x,ta[J+1]=Jb.y,ta[J+2]=Jb.z,ta[J+3]=1,ta[J+4]=Kb.x,ta[J+5]=Kb.y,ta[J+6]=Kb.z,ta[J+
+7]=1,ta[J+8]=Lb.x,ta[J+9]=Lb.y,ta[J+10]=Lb.z,ta[J+11]=1,ta[J+12]=Cc.x,ta[J+13]=Cc.y,ta[J+14]=Cc.z,ta[J+15]=1,J+=16;0<J&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,sa,$a),j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,ta,$a),j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,ua,$a),j.bindBuffer(j.ARRAY_BUFFER,da.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,va,$a))}if(sd&&Rc){for(H=
+0,U=la.length;H<U;H++)N=Ca[la[H]],jb=N.vertexColors,Ac=N.color,3===jb.length&&Rc===THREE.VertexColors?(ob=jb[0],pb=jb[1],qb=jb[2]):qb=pb=ob=Ac,Ja[Aa]=ob.r,Ja[Aa+1]=ob.g,Ja[Aa+2]=ob.b,Ja[Aa+3]=pb.r,Ja[Aa+4]=pb.g,Ja[Aa+5]=pb.b,Ja[Aa+6]=qb.r,Ja[Aa+7]=qb.g,Ja[Aa+8]=qb.b,Aa+=9;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],jb=N.vertexColors,Ac=N.color,4===jb.length&&Rc===THREE.VertexColors?(ob=jb[0],pb=jb[1],qb=jb[2],mc=jb[3]):mc=qb=pb=ob=Ac,Ja[Aa]=ob.r,Ja[Aa+1]=ob.g,Ja[Aa+2]=ob.b,Ja[Aa+3]=pb.r,Ja[Aa+4]=pb.g,
+Ja[Aa+5]=pb.b,Ja[Aa+6]=qb.r,Ja[Aa+7]=qb.g,Ja[Aa+8]=qb.b,Ja[Aa+9]=mc.r,Ja[Aa+10]=mc.g,Ja[Aa+11]=mc.b,Aa+=12;0<Aa&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Ja,$a))}if(rd&&Ra.hasTangents){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],zb=N.vertexTangents,lb=zb[0],mb=zb[1],nb=zb[2],ra[oa]=lb.x,ra[oa+1]=lb.y,ra[oa+2]=lb.z,ra[oa+3]=lb.w,ra[oa+4]=mb.x,ra[oa+5]=mb.y,ra[oa+6]=mb.z,ra[oa+7]=mb.w,ra[oa+8]=nb.x,ra[oa+9]=nb.y,ra[oa+10]=nb.z,ra[oa+11]=nb.w,oa+=12;for(H=0,U=ma.length;H<
+U;H++)N=Ca[ma[H]],zb=N.vertexTangents,lb=zb[0],mb=zb[1],nb=zb[2],lc=zb[3],ra[oa]=lb.x,ra[oa+1]=lb.y,ra[oa+2]=lb.z,ra[oa+3]=lb.w,ra[oa+4]=mb.x,ra[oa+5]=mb.y,ra[oa+6]=mb.z,ra[oa+7]=mb.w,ra[oa+8]=nb.x,ra[oa+9]=nb.y,ra[oa+10]=nb.z,ra[oa+11]=nb.w,ra[oa+12]=lc.x,ra[oa+13]=lc.y,ra[oa+14]=lc.z,ra[oa+15]=lc.w,oa+=16;j.bindBuffer(j.ARRAY_BUFFER,da.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,ra,$a)}if(qd&&Zc){for(H=0,U=la.length;H<U;H++)if(N=Ca[la[H]],bc=N.vertexNormals,Fb=N.normal,3===bc.length&&ad)for(ka=
+0;3>ka;ka++)Mb=bc[ka],eb[Pa]=Mb.x,eb[Pa+1]=Mb.y,eb[Pa+2]=Mb.z,Pa+=3;else for(ka=0;3>ka;ka++)eb[Pa]=Fb.x,eb[Pa+1]=Fb.y,eb[Pa+2]=Fb.z,Pa+=3;for(H=0,U=ma.length;H<U;H++)if(N=Ca[ma[H]],bc=N.vertexNormals,Fb=N.normal,4===bc.length&&ad)for(ka=0;4>ka;ka++)Mb=bc[ka],eb[Pa]=Mb.x,eb[Pa+1]=Mb.y,eb[Pa+2]=Mb.z,Pa+=3;else for(ka=0;4>ka;ka++)eb[Pa]=Fb.x,eb[Pa+1]=Fb.y,eb[Pa+2]=Fb.z,Pa+=3;j.bindBuffer(j.ARRAY_BUFFER,da.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,eb,$a)}if(dd&&Uc&&$c){for(H=0,U=la.length;H<U;H++)if(hb=
+la[H],N=Ca[hb],cc=Uc[hb],void 0!==cc)for(ka=0;3>ka;ka++)ec=cc[ka],pc[Ab]=ec.u,pc[Ab+1]=ec.v,Ab+=2;for(H=0,U=ma.length;H<U;H++)if(hb=ma[H],N=Ca[hb],cc=Uc[hb],void 0!==cc)for(ka=0;4>ka;ka++)ec=cc[ka],pc[Ab]=ec.u,pc[Ab+1]=ec.v,Ab+=2;0<Ab&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,pc,$a))}if(dd&&Vc&&$c){for(H=0,U=la.length;H<U;H++)if(hb=la[H],N=Ca[hb],dc=Vc[hb],void 0!==dc)for(ka=0;3>ka;ka++)fc=dc[ka],qc[Bb]=fc.u,qc[Bb+1]=fc.v,Bb+=2;for(H=0,U=ma.length;H<U;H++)if(hb=
+ma[H],N=Ca[hb],dc=Vc[hb],void 0!==dc)for(ka=0;4>ka;ka++)fc=dc[ka],qc[Bb]=fc.u,qc[Bb+1]=fc.v,Bb+=2;0<Bb&&(j.bindBuffer(j.ARRAY_BUFFER,da.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,qc,$a))}if(pd){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],xb[db]=ya,xb[db+1]=ya+1,xb[db+2]=ya+2,db+=3,Ya[Qa]=ya,Ya[Qa+1]=ya+1,Ya[Qa+2]=ya,Ya[Qa+3]=ya+2,Ya[Qa+4]=ya+1,Ya[Qa+5]=ya+2,Qa+=6,ya+=3;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],xb[db]=ya,xb[db+1]=ya+1,xb[db+2]=ya+3,xb[db+3]=ya+1,xb[db+4]=ya+2,xb[db+5]=ya+3,db+=6,Ya[Qa]=
+ya,Ya[Qa+1]=ya+1,Ya[Qa+2]=ya,Ya[Qa+3]=ya+3,Ya[Qa+4]=ya+1,Ya[Qa+5]=ya+2,Ya[Qa+6]=ya+2,Ya[Qa+7]=ya+3,Qa+=8,ya+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,da.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,xb,$a);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,da.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Ya,$a)}if(Tc)for(ka=0,bd=Tc.length;ka<bd;ka++)if(v=Tc[ka],v.__original.needsUpdate){z=0;if(1===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],v.array[z]=
+v.value[N.a],v.array[z+1]=v.value[N.b],v.array[z+2]=v.value[N.c],z+=3;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],v.array[z]=v.value[N.a],v.array[z+1]=v.value[N.b],v.array[z+2]=v.value[N.c],v.array[z+3]=v.value[N.d],z+=4}else{if("faces"===v.boundTo){for(H=0,U=la.length;H<U;H++)Xa=v.value[la[H]],v.array[z]=Xa,v.array[z+1]=Xa,v.array[z+2]=Xa,z+=3;for(H=0,U=ma.length;H<U;H++)Xa=v.value[ma[H]],v.array[z]=Xa,v.array[z+1]=Xa,v.array[z+2]=Xa,v.array[z+3]=Xa,z+=4}}else if(2===v.size)if(void 0===v.boundTo||"vertices"===
+v.boundTo){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],W=v.value[N.a],X=v.value[N.b],Y=v.value[N.c],v.array[z]=W.x,v.array[z+1]=W.y,v.array[z+2]=X.x,v.array[z+3]=X.y,v.array[z+4]=Y.x,v.array[z+5]=Y.y,z+=6;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],W=v.value[N.a],X=v.value[N.b],Y=v.value[N.c],na=v.value[N.d],v.array[z]=W.x,v.array[z+1]=W.y,v.array[z+2]=X.x,v.array[z+3]=X.y,v.array[z+4]=Y.x,v.array[z+5]=Y.y,v.array[z+6]=na.x,v.array[z+7]=na.y,z+=8}else{if("faces"===v.boundTo){for(H=0,U=la.length;H<U;H++)Y=
+X=W=Xa=v.value[la[H]],v.array[z]=W.x,v.array[z+1]=W.y,v.array[z+2]=X.x,v.array[z+3]=X.y,v.array[z+4]=Y.x,v.array[z+5]=Y.y,z+=6;for(H=0,U=ma.length;H<U;H++)na=Y=X=W=Xa=v.value[ma[H]],v.array[z]=W.x,v.array[z+1]=W.y,v.array[z+2]=X.x,v.array[z+3]=X.y,v.array[z+4]=Y.x,v.array[z+5]=Y.y,v.array[z+6]=na.x,v.array[z+7]=na.y,z+=8}}else if(3===v.size){var ea;ea="c"===v.type?["r","g","b"]:["x","y","z"];if(void 0===v.boundTo||"vertices"===v.boundTo){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],W=v.value[N.a],X=v.value[N.b],
+Y=v.value[N.c],v.array[z]=W[ea[0]],v.array[z+1]=W[ea[1]],v.array[z+2]=W[ea[2]],v.array[z+3]=X[ea[0]],v.array[z+4]=X[ea[1]],v.array[z+5]=X[ea[2]],v.array[z+6]=Y[ea[0]],v.array[z+7]=Y[ea[1]],v.array[z+8]=Y[ea[2]],z+=9;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],W=v.value[N.a],X=v.value[N.b],Y=v.value[N.c],na=v.value[N.d],v.array[z]=W[ea[0]],v.array[z+1]=W[ea[1]],v.array[z+2]=W[ea[2]],v.array[z+3]=X[ea[0]],v.array[z+4]=X[ea[1]],v.array[z+5]=X[ea[2]],v.array[z+6]=Y[ea[0]],v.array[z+7]=Y[ea[1]],v.array[z+
+8]=Y[ea[2]],v.array[z+9]=na[ea[0]],v.array[z+10]=na[ea[1]],v.array[z+11]=na[ea[2]],z+=12}else if("faces"===v.boundTo){for(H=0,U=la.length;H<U;H++)Y=X=W=Xa=v.value[la[H]],v.array[z]=W[ea[0]],v.array[z+1]=W[ea[1]],v.array[z+2]=W[ea[2]],v.array[z+3]=X[ea[0]],v.array[z+4]=X[ea[1]],v.array[z+5]=X[ea[2]],v.array[z+6]=Y[ea[0]],v.array[z+7]=Y[ea[1]],v.array[z+8]=Y[ea[2]],z+=9;for(H=0,U=ma.length;H<U;H++)na=Y=X=W=Xa=v.value[ma[H]],v.array[z]=W[ea[0]],v.array[z+1]=W[ea[1]],v.array[z+2]=W[ea[2]],v.array[z+3]=
+X[ea[0]],v.array[z+4]=X[ea[1]],v.array[z+5]=X[ea[2]],v.array[z+6]=Y[ea[0]],v.array[z+7]=Y[ea[1]],v.array[z+8]=Y[ea[2]],v.array[z+9]=na[ea[0]],v.array[z+10]=na[ea[1]],v.array[z+11]=na[ea[2]],z+=12}}else if(4===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){for(H=0,U=la.length;H<U;H++)N=Ca[la[H]],W=v.value[N.a],X=v.value[N.b],Y=v.value[N.c],v.array[z]=W.x,v.array[z+1]=W.y,v.array[z+2]=W.z,v.array[z+3]=W.w,v.array[z+4]=X.x,v.array[z+5]=X.y,v.array[z+6]=X.z,v.array[z+7]=X.w,v.array[z+8]=Y.x,v.array[z+
+9]=Y.y,v.array[z+10]=Y.z,v.array[z+11]=Y.w,z+=12;for(H=0,U=ma.length;H<U;H++)N=Ca[ma[H]],W=v.value[N.a],X=v.value[N.b],Y=v.value[N.c],na=v.value[N.d],v.array[z]=W.x,v.array[z+1]=W.y,v.array[z+2]=W.z,v.array[z+3]=W.w,v.array[z+4]=X.x,v.array[z+5]=X.y,v.array[z+6]=X.z,v.array[z+7]=X.w,v.array[z+8]=Y.x,v.array[z+9]=Y.y,v.array[z+10]=Y.z,v.array[z+11]=Y.w,v.array[z+12]=na.x,v.array[z+13]=na.y,v.array[z+14]=na.z,v.array[z+15]=na.w,z+=16}else if("faces"===v.boundTo){for(H=0,U=la.length;H<U;H++)Y=X=W=Xa=
+v.value[la[H]],v.array[z]=W.x,v.array[z+1]=W.y,v.array[z+2]=W.z,v.array[z+3]=W.w,v.array[z+4]=X.x,v.array[z+5]=X.y,v.array[z+6]=X.z,v.array[z+7]=X.w,v.array[z+8]=Y.x,v.array[z+9]=Y.y,v.array[z+10]=Y.z,v.array[z+11]=Y.w,z+=12;for(H=0,U=ma.length;H<U;H++)na=Y=X=W=Xa=v.value[ma[H]],v.array[z]=W.x,v.array[z+1]=W.y,v.array[z+2]=W.z,v.array[z+3]=W.w,v.array[z+4]=X.x,v.array[z+5]=X.y,v.array[z+6]=X.z,v.array[z+7]=X.w,v.array[z+8]=Y.x,v.array[z+9]=Y.y,v.array[z+10]=Y.z,v.array[z+11]=Y.w,v.array[z+12]=na.x,
+v.array[z+13]=na.y,v.array[z+14]=na.z,v.array[z+15]=na.w,z+=16}j.bindBuffer(j.ARRAY_BUFFER,v.buffer);j.bufferData(j.ARRAY_BUFFER,v.array,$a)}od&&(delete da.__inittedArrays,delete da.__colorArray,delete da.__normalArray,delete da.__tangentArray,delete da.__uvArray,delete da.__uv2Array,delete da.__faceArray,delete da.__vertexArray,delete da.__lineArray,delete da.__skinVertexAArray,delete da.__skinVertexBArray,delete da.__skinIndexArray,delete da.__skinWeightArray)}}ia.__dirtyVertices=!1;ia.__dirtyMorphTargets=
+!1;ia.__dirtyElements=!1;ia.__dirtyUvs=!1;ia.__dirtyNormals=!1;ia.__dirtyColors=!1;ia.__dirtyTangents=!1;Ua.attributes&&q(Ua)}else if(ib instanceof THREE.Ribbon){if(ia.__dirtyVertices||ia.__dirtyColors){var Pb=ia,ed=j.DYNAMIC_DRAW,rc=void 0,sc=void 0,Dc=void 0,Qb=void 0,Ec=void 0,fd=Pb.vertices,gd=Pb.colors,ud=fd.length,vd=gd.length,Fc=Pb.__vertexArray,Gc=Pb.__colorArray,wd=Pb.__dirtyColors;if(Pb.__dirtyVertices){for(rc=0;rc<ud;rc++)Dc=fd[rc].position,Qb=3*rc,Fc[Qb]=Dc.x,Fc[Qb+1]=Dc.y,Fc[Qb+2]=Dc.z;
+j.bindBuffer(j.ARRAY_BUFFER,Pb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Fc,ed)}if(wd){for(sc=0;sc<vd;sc++)Ec=gd[sc],Qb=3*sc,Gc[Qb]=Ec.r,Gc[Qb+1]=Ec.g,Gc[Qb+2]=Ec.b;j.bindBuffer(j.ARRAY_BUFFER,Pb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Gc,ed)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1}else if(ib instanceof THREE.Line){Ua=c(ib,kc);ac=Ua.attributes&&n(Ua);if(ia.__dirtyVertices||ia.__dirtyColors||ac){var Cb=ia,Wc=j.DYNAMIC_DRAW,tc=void 0,uc=void 0,Hc=void 0,wa=void 0,Ic=void 0,hd=Cb.vertices,
+id=Cb.colors,xd=hd.length,yd=id.length,Jc=Cb.__vertexArray,Kc=Cb.__colorArray,zd=Cb.__dirtyColors,Xc=Cb.__webglCustomAttributesList,Lc=void 0,jd=void 0,Ma=void 0,gc=void 0,Va=void 0,pa=void 0;if(Cb.__dirtyVertices){for(tc=0;tc<xd;tc++)Hc=hd[tc].position,wa=3*tc,Jc[wa]=Hc.x,Jc[wa+1]=Hc.y,Jc[wa+2]=Hc.z;j.bindBuffer(j.ARRAY_BUFFER,Cb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Jc,Wc)}if(zd){for(uc=0;uc<yd;uc++)Ic=id[uc],wa=3*uc,Kc[wa]=Ic.r,Kc[wa+1]=Ic.g,Kc[wa+2]=Ic.b;j.bindBuffer(j.ARRAY_BUFFER,
+Cb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Kc,Wc)}if(Xc)for(Lc=0,jd=Xc.length;Lc<jd;Lc++)if(pa=Xc[Lc],pa.needsUpdate&&(void 0===pa.boundTo||"vertices"===pa.boundTo)){wa=0;gc=pa.value.length;if(1===pa.size)for(Ma=0;Ma<gc;Ma++)pa.array[Ma]=pa.value[Ma];else if(2===pa.size)for(Ma=0;Ma<gc;Ma++)Va=pa.value[Ma],pa.array[wa]=Va.x,pa.array[wa+1]=Va.y,wa+=2;else if(3===pa.size)if("c"===pa.type)for(Ma=0;Ma<gc;Ma++)Va=pa.value[Ma],pa.array[wa]=Va.r,pa.array[wa+1]=Va.g,pa.array[wa+2]=Va.b,wa+=3;else for(Ma=
+0;Ma<gc;Ma++)Va=pa.value[Ma],pa.array[wa]=Va.x,pa.array[wa+1]=Va.y,pa.array[wa+2]=Va.z,wa+=3;else if(4===pa.size)for(Ma=0;Ma<gc;Ma++)Va=pa.value[Ma],pa.array[wa]=Va.x,pa.array[wa+1]=Va.y,pa.array[wa+2]=Va.z,pa.array[wa+3]=Va.w,wa+=4;j.bindBuffer(j.ARRAY_BUFFER,pa.buffer);j.bufferData(j.ARRAY_BUFFER,pa.array,Wc)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1;Ua.attributes&&q(Ua)}else if(ib instanceof THREE.ParticleSystem)Ua=c(ib,kc),ac=Ua.attributes&&n(Ua),(ia.__dirtyVertices||ia.__dirtyColors||ib.sortParticles||
+ac)&&f(ia,j.DYNAMIC_DRAW,ib),ia.__dirtyVertices=!1,ia.__dirtyColors=!1,Ua.attributes&&q(Ua)}};this.initMaterial=function(a,b,c,d){var e,f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var l=
+THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(l.uniforms);a.vertexShader=l.vertexShader;a.fragmentShader=l.fragmentShader}var k,m;f=l=0;for(k=0,m=b.length;k<m;k++)e=b[k],e.onlyShadow||(e instanceof THREE.SpotLight&&f++,e instanceof THREE.DirectionalLight&&f++,e instanceof THREE.PointLight&&l++);l+f<=M?k=f:(k=Math.ceil(M*f/(l+f)),l=M-k);e=k;f=l;var n=0;for(l=0,k=b.length;l<k;l++)m=b[l],m.castShadow&&(m instanceof THREE.SpotLight||m instanceof THREE.DirectionalLight)&&n++;var q=50;if(void 0!==
+d&&d instanceof THREE.SkinnedMesh)q=d.bones.length;var o;a:{k=a.fragmentShader;m=a.vertexShader;var l=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:e,maxPointLights:f,maxBones:q,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,maxShadows:n,alphaTest:a.alphaTest,
+metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround},p,d=[];i?d.push(i):(d.push(k),d.push(m));for(p in c)d.push(p),d.push(c[p]);i=d.join();for(p=0,d=Q.length;p<d;p++)if(Q[p].code===i){o=Q[p].program;break a}p=j.createProgram();d=[0<Za?"#define VERTEX_TEXTURES":"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+
+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",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");
 e=["precision "+B+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?
-"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(q,t("fragment",e+k));j.attachShader(q,t("vertex",d+m));j.linkProgram(q);j.getProgramParameter(q,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+
-j.getProgramParameter(q,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");q.uniforms={};q.attributes={};var r,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,cameraInverseMatrix,boneGlobalMatrices,morphTargetInfluences".split(",");for(r in l)d.push(r);r=d;for(d=0,l=r.length;d<l;d++)k=r[d],q.uniforms[k]=j.getUniformLocation(q,k);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(r=0;r<c.maxMorphTargets;r++)d.push("morphTarget"+
-r);for(o in b)d.push(o);o=d;for(r=0,b=o.length;r<b;r++)c=o[r],q.attributes[c]=j.getAttribLocation(q,c);q.id=Q.length;Q.push({program:q,code:i});G.info.memory.programs=Q.length;o=q}a.program=o;o=a.program.attributes;0<=o.position&&j.enableVertexAttribArray(o.position);0<=o.color&&j.enableVertexAttribArray(o.color);0<=o.normal&&j.enableVertexAttribArray(o.normal);0<=o.tangent&&j.enableVertexAttribArray(o.tangent);a.skinning&&0<=o.skinVertexA&&0<=o.skinVertexB&&0<=o.skinIndex&&0<=o.skinWeight&&(j.enableVertexAttribArray(o.skinVertexA),
+"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(p,t("fragment",e+k));j.attachShader(p,t("vertex",d+m));j.linkProgram(p);j.getProgramParameter(p,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+
+j.getProgramParameter(p,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");p.uniforms={};p.attributes={};var r,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,cameraInverseMatrix,boneGlobalMatrices,morphTargetInfluences".split(",");for(r in l)d.push(r);r=d;for(d=0,l=r.length;d<l;d++)k=r[d],p.uniforms[k]=j.getUniformLocation(p,k);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(r=0;r<c.maxMorphTargets;r++)d.push("morphTarget"+
+r);for(o in b)d.push(o);o=d;for(r=0,b=o.length;r<b;r++)c=o[r],p.attributes[c]=j.getAttribLocation(p,c);p.id=Q.length;Q.push({program:p,code:i});G.info.memory.programs=Q.length;o=p}a.program=o;o=a.program.attributes;0<=o.position&&j.enableVertexAttribArray(o.position);0<=o.color&&j.enableVertexAttribArray(o.color);0<=o.normal&&j.enableVertexAttribArray(o.normal);0<=o.tangent&&j.enableVertexAttribArray(o.tangent);a.skinning&&0<=o.skinVertexA&&0<=o.skinVertexB&&0<=o.skinIndex&&0<=o.skinWeight&&(j.enableVertexAttribArray(o.skinVertexA),
 j.enableVertexAttribArray(o.skinVertexB),j.enableVertexAttribArray(o.skinIndex),j.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(h in a.attributes)void 0!==o[h]&&0<=o[h]&&j.enableVertexAttribArray(o[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)r="morphTarget"+h,0<=o[r]&&(j.enableVertexAttribArray(o[r]),a.numSupportedMorphTargets++);a.uniformsList=[];for(g in a.uniforms)a.uniformsList.push([a.uniforms[g],g])};this.setFaceCulling=function(a,b){a?(!b||
 "ccw"===b?j.frontFace(j.CCW):j.frontFace(j.CW),"back"===a?j.cullFace(j.BACK):"front"===a?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.setObjectFaces=function(a){if($!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),$=a.doubleSided;if(Z!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),Z=a.flipSided};this.setDepthTest=function(a){fa!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),fa=a)};this.setDepthWrite=
 function(a){S!==a&&(j.depthMask(a),S=a)};this.setBlending=function(a){if(a!==ga){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}ga=
@@ -355,19 +355,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,f=Math.max(Math.max(c,d),e),g=Math.min(Math.min(c,d),e);if(g===f)g=c=0;else{var h=f-g,g=h/f,c=(c===f?(d-e)/h:d===f?2+(e-c)/h:4+(c-d)/h)/6;0>c&&(c+=1);1<c&&(c-=1)}void 0===b&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=f;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,l=f.faces,k=a.faceVertexUvs[0],n=f.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,q=h.length;o<q;o++){var m=new THREE.Vertex(h[o].position.clone());c&&c.multiplyVector3(m.position);g.push(m)}for(o=
-0,q=l.length;o<q;o++){var g=l[o],r,s,t=g.vertexNormals,u=g.vertexColors;g instanceof THREE.Face3?r=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(r=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));r.normal.copy(g.normal);d&&d.multiplyVector3(r.normal);h=0;for(m=t.length;h<m;h++)s=t[h].clone(),d&&d.multiplyVector3(s),r.vertexNormals.push(s);r.color.copy(g.color);h=0;for(m=u.length;h<m;h++)s=u[h],r.vertexColors.push(s.clone());if(void 0!==g.materialIndex){h=f.materials[g.materialIndex];m=h.id;
-u=p[m];if(void 0===u)u=a.materials.length,p[m]=u,a.materials.push(h);r.materialIndex=u}r.centroid.copy(g.centroid);c&&c.multiplyVector3(r.centroid);i.push(r)}for(o=0,q=n.length;o<q;o++){c=n[o];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++){var g=new THREE.Vertex(d[a].position.clone());b.vertices.push(g)}for(a=
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,l=f.faces,k=a.faceVertexUvs[0],n=f.faceVertexUvs[0],q={},o=0;o<a.materials.length;o++)q[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,p=h.length;o<p;o++){var m=new THREE.Vertex(h[o].position.clone());c&&c.multiplyVector3(m.position);g.push(m)}for(o=
+0,p=l.length;o<p;o++){var g=l[o],r,s,t=g.vertexNormals,u=g.vertexColors;g instanceof THREE.Face3?r=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(r=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));r.normal.copy(g.normal);d&&d.multiplyVector3(r.normal);h=0;for(m=t.length;h<m;h++)s=t[h].clone(),d&&d.multiplyVector3(s),r.vertexNormals.push(s);r.color.copy(g.color);h=0;for(m=u.length;h<m;h++)s=u[h],r.vertexColors.push(s.clone());if(void 0!==g.materialIndex){h=f.materials[g.materialIndex];m=h.id;
+u=q[m];if(void 0===u)u=a.materials.length,q[m]=u,a.materials.push(h);r.materialIndex=u}r.centroid.copy(g.centroid);c&&c.multiplyVector3(r.centroid);i.push(r)}for(o=0,p=n.length;o<p;o++){c=n[o];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++){var g=new THREE.Vertex(d[a].position.clone());b.vertices.push(g)}for(a=
 0,c=e.length;a<c;a++){var h=e[a],i,l,k=h.vertexNormals,n=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(g=k.length;d<g;d++)l=k[d],i.vertexNormals.push(l.clone());i.color.copy(h.color);d=0;for(g=n.length;d<g;d++)l=n[d],i.vertexColors.push(l.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);b.faces.push(i)}for(a=0,c=f.length;a<c;a++){e=f[a];i=[];d=0;for(g=e.length;d<
 g;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,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,e=b.vertices[a.b].position,
 f=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(a instanceof THREE.Face4){d=b.vertices[a.a].position;e=b.vertices[a.b].position;f=b.vertices[a.c].position;var b=b.vertices[a.d].position,g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*(c+g)<c?
-THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return l[e]>a?b(c,e-1):l[e]<a?b(e+1,d):e}return b(0,l.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,l=[],k,n,p,o;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3)k=g[d.a].position,n=g[d.b].position,p=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,n,p);else if(d instanceof
-THREE.Face4)k=g[d.a].position,n=g[d.b].position,p=g[d.c].position,o=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,n,o),d._area2=THREE.GeometryUtils.triangleArea(n,p,o),d._area=d._area1+d._area2;i+=d._area;l[e]=i}d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*
+THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return l[e]>a?b(c,e-1):l[e]<a?b(e+1,d):e}return b(0,l.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,l=[],k,n,q,o;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3)k=g[d.a].position,n=g[d.b].position,q=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,n,q);else if(d instanceof
+THREE.Face4)k=g[d.a].position,n=g[d.b].position,q=g[d.c].position,o=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,n,o),d._area2=THREE.GeometryUtils.triangleArea(n,q,o),d._area=d._area1+d._area2;i+=d._area;l[e]=i}d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.length();b=0.5*(d+a+c);return Math.sqrt(b*
 (b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).setTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++)1!==d[e].u&&(d[e].u-=Math.floor(d[e].u)),1!==d[e].v&&(d[e].v-=Math.floor(d[e].v))}};THREE.GeometryUtils.random=THREE.Math.random16;
 THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={crossOrigin:"",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],f=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)f.needsUpdate=!0;c&&c(this)},e[b].crossOrigin="",e[b].src=a[b];return f},getNormalMap:function(a,b){var c=function(a){var b=
-Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),l=i.data,k=0;k<d;k++)for(var n=1;n<e;n++){var p=0>n-1?e-1:n-1,o=(n+1)%e,q=0>k-1?d-1:k-1,m=(k+1)%d,r=[],s=[0,0,h[4*(n*d+k)]/255*b];r.push([-1,0,h[4*(n*d+q)]/255*b]);r.push([-1,-1,h[4*(p*d+q)]/255*b]);r.push([0,-1,h[4*(p*d+k)]/255*b]);r.push([1,
--1,h[4*(p*d+m)]/255*b]);r.push([1,0,h[4*(n*d+m)]/255*b]);r.push([1,1,h[4*(o*d+m)]/255*b]);r.push([0,1,h[4*(o*d+k)]/255*b]);r.push([-1,1,h[4*(o*d+q)]/255*b]);p=[];q=r.length;for(o=0;o<q;o++){var m=r[o],t=r[(o+1)%q],m=[m[0]-s[0],m[1]-s[1],m[2]-s[2]],t=[t[0]-s[0],t[1]-s[1],t[2]-s[2]];p.push(c([m[1]*t[2]-m[2]*t[1],m[2]*t[0]-m[0]*t[2],m[0]*t[1]-m[1]*t[0]]))}r=[0,0,0];for(o=0;o<p.length;o++)r[0]+=p[o][0],r[1]+=p[o][1],r[2]+=p[o][2];r[0]/=p.length;r[1]/=p.length;r[2]/=p.length;s=4*(n*d+k);l[s]=255*((r[0]+
+Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),l=i.data,k=0;k<d;k++)for(var n=1;n<e;n++){var q=0>n-1?e-1:n-1,o=(n+1)%e,p=0>k-1?d-1:k-1,m=(k+1)%d,r=[],s=[0,0,h[4*(n*d+k)]/255*b];r.push([-1,0,h[4*(n*d+p)]/255*b]);r.push([-1,-1,h[4*(q*d+p)]/255*b]);r.push([0,-1,h[4*(q*d+k)]/255*b]);r.push([1,
+-1,h[4*(q*d+m)]/255*b]);r.push([1,0,h[4*(n*d+m)]/255*b]);r.push([1,1,h[4*(o*d+m)]/255*b]);r.push([0,1,h[4*(o*d+k)]/255*b]);r.push([-1,1,h[4*(o*d+p)]/255*b]);q=[];p=r.length;for(o=0;o<p;o++){var m=r[o],t=r[(o+1)%p],m=[m[0]-s[0],m[1]-s[1],m[2]-s[2]],t=[t[0]-s[0],t[1]-s[1],t[2]-s[2]];q.push(c([m[1]*t[2]-m[2]*t[1],m[2]*t[0]-m[0]*t[2],m[0]*t[1]-m[1]*t[0]]))}r=[0,0,0];for(o=0;o<q.length;o++)r[0]+=q[o][0],r[1]+=q[o][1],r[2]+=q[o][2];r[0]/=q.length;r[1]/=q.length;r[2]/=q.length;s=4*(n*d+k);l[s]=255*((r[0]+
 1)/2)|0;l[s+1]=255*(r[1]+0.5)|0;l[s+2]=255*r[2]|0;l[s+3]=255}g.putImageData(i,0,0);return f}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,e=a.children.length;for(d=0;d<e;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,e=new THREE.Object3D;for(c=0;c<d;c++){var f=new THREE.Mesh(a,b[c]);e.add(f)}return e},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
 b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
@@ -414,9 +414,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,f){var g=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,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
 THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,e,f));this.actions.push({action:THREE.PathActions.ARC,args:g})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,e,f,g,h,i,l,k,n,p,o,q,m;for(d=0,e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];n=f[0];p=f[1];0<c.length?(g=c[c.length-1],o=g.x,q=g.y):(g=this.actions[d-1].args,o=g[g.length-2],q=g[g.length-1]);for(g=1;g<=a;g++)m=g/a,f=THREE.Shape.Utils.b2(m,o,n,h),m=THREE.Shape.Utils.b2(m,q,p,
-i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];n=f[0];p=f[1];l=f[2];k=f[3];0<c.length?(g=c[c.length-1],o=g.x,q=g.y):(g=this.actions[d-1].args,o=g[g.length-2],q=g[g.length-1]);for(g=1;g<=a;g++)m=g/a,f=THREE.Shape.Utils.b3(m,o,n,l,h),m=THREE.Shape.Utils.b3(m,q,p,k,i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];m=a*f[0].length;g=g.concat(f[0]);f=new THREE.SplineCurve(g);
-for(g=1;g<=m;g++)c.push(f.getPointAt(g/m));break;case THREE.PathActions.ARC:g=this.actions[d-1].args;h=f[0];i=f[1];l=f[2];n=f[3];m=f[4];p=!!f[5];k=g[g.length-2];o=g[g.length-1];0==g.length&&(k=o=0);q=m-n;var r=2*a;for(g=1;g<=r;g++)m=g/r,p||(m=1-m),m=n+m*q,f=k+h+l*Math.cos(m),m=o+i+l*Math.sin(m),c.push(new THREE.Vector2(f,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,f,g,h,i,l,k,n,q,o,p,m;for(d=0,e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];n=f[0];q=f[1];0<c.length?(g=c[c.length-1],o=g.x,p=g.y):(g=this.actions[d-1].args,o=g[g.length-2],p=g[g.length-1]);for(g=1;g<=a;g++)m=g/a,f=THREE.Shape.Utils.b2(m,o,n,h),m=THREE.Shape.Utils.b2(m,p,q,
+i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];n=f[0];q=f[1];l=f[2];k=f[3];0<c.length?(g=c[c.length-1],o=g.x,p=g.y):(g=this.actions[d-1].args,o=g[g.length-2],p=g[g.length-1]);for(g=1;g<=a;g++)m=g/a,f=THREE.Shape.Utils.b3(m,o,n,l,h),m=THREE.Shape.Utils.b3(m,p,q,k,i),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];m=a*f[0].length;g=g.concat(f[0]);f=new THREE.SplineCurve(g);
+for(g=1;g<=m;g++)c.push(f.getPointAt(g/m));break;case THREE.PathActions.ARC:g=this.actions[d-1].args;h=f[0];i=f[1];l=f[2];n=f[3];m=f[4];q=!!f[5];k=g[g.length-2];o=g[g.length-1];0==g.length&&(k=o=0);p=m-n;var r=2*a;for(g=1;g<=r;g++)m=g/r,q||(m=1-m),m=n+m*p,f=k+h+l*Math.cos(m),m=o+i+l*Math.sin(m),c.push(new THREE.Vector2(f,m))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
 THREE.Path.prototype.nltransform=function(a,b,c,d,e,f){var g=this.getPoints(),h,i,l,k,n;for(h=0,i=g.length;h<i;h++)l=g[h],k=l.x,n=l.y,l.x=a*k+b*n+c,l.y=d*n+e*k+f;return g};
 THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,e;for(a=0,c=this.actions.length;a<c;a++)d=this.actions[a],e=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,e);b.stroke();b.closePath();b.strokeStyle="red";d=
 this.getPoints();for(a=0,c=d.length;a<c;a++)e=d[a],b.beginPath(),b.arc(e.x,e.y,1.5,0,2*Math.PI,!1),b.stroke(),b.closePath()};
@@ -424,9 +424,9 @@ THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;for(a
 b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g.actions=f.actions,g.curves=f.curves,d.push(g),g=new THREE.Shape):g.holes.push(f)}else{for(a=0,b=e.length;a<b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g&&d.push(g),g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves):g.holes.push(f);d.push(g)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;
 THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};
 THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,l,k,n,p,o,q=[];for(i=0;i<b.length;i++){l=b[i];Array.prototype.push.apply(d,l);f=Number.POSITIVE_INFINITY;for(e=0;e<l.length;e++){p=l[e];o=[];for(n=0;n<c.length;n++)k=c[n],k=p.distanceToSquared(k),o.push(k),k<f&&(f=k,g=e,h=n)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:l.length-1;var m=[l[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(m);var r=[l[g],l[f],c[h]];p=THREE.FontUtils.Triangulate.area(r);o=h;k=g;h+=1;g+=-1;0>
-h&&(h+=c.length);h%=c.length;0>g&&(g+=l.length);g%=l.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:l.length-1;m=[l[g],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);r=[l[g],l[f],c[h]];r=THREE.FontUtils.Triangulate.area(r);n+p>m+r&&(h=o,g=k,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=l.length),g%=l.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:l.length-1);n=c.slice(0,h);p=c.slice(h);o=l.slice(g);k=l.slice(0,g);f=[l[g],l[f],c[h]];q.push([l[g],c[h],c[e]]);q.push(f);c=n.concat(o).concat(k).concat(p)}return{shape:c,
-isolatedPts:q,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,i,l={};for(f=0,g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,void 0!==l[i]&&console.log("Duplicate point",i),l[i]=f;for(f=0,g=c.length;f<g;f++){h=c[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=l[i],void 0!==i&&(h[d]=i)}for(f=0,g=e.length;f<g;f++){h=e[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=l[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,l,k,n,q,o,p=[];for(i=0;i<b.length;i++){l=b[i];Array.prototype.push.apply(d,l);f=Number.POSITIVE_INFINITY;for(e=0;e<l.length;e++){q=l[e];o=[];for(n=0;n<c.length;n++)k=c[n],k=q.distanceToSquared(k),o.push(k),k<f&&(f=k,g=e,h=n)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:l.length-1;var m=[l[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(m);var r=[l[g],l[f],c[h]];q=THREE.FontUtils.Triangulate.area(r);o=h;k=g;h+=1;g+=-1;0>
+h&&(h+=c.length);h%=c.length;0>g&&(g+=l.length);g%=l.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:l.length-1;m=[l[g],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);r=[l[g],l[f],c[h]];r=THREE.FontUtils.Triangulate.area(r);n+q>m+r&&(h=o,g=k,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=l.length),g%=l.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:l.length-1);n=c.slice(0,h);q=c.slice(h);o=l.slice(g);k=l.slice(0,g);f=[l[g],l[f],c[h]];p.push([l[g],c[h],c[e]]);p.push(f);c=n.concat(o).concat(k).concat(q)}return{shape:c,
+isolatedPts:p,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,g,h,i,l={};for(f=0,g=d.length;f<g;f++)i=d[f].x+":"+d[f].y,void 0!==l[i]&&console.log("Duplicate point",i),l[i]=f;for(f=0,g=c.length;f<g;f++){h=c[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=l[i],void 0!==i&&(h[d]=i)}for(f=0,g=e.length;f<g;f++){h=e[f];for(d=0;3>d;d++)i=h[d].x+":"+h[d].y,i=l[i],void 0!==i&&(h[d]=i)}return c.concat(e)},
 isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 this.b3p3(a,e)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){b=b||this.parameters;this.text=a;var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
@@ -439,8 +439,8 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
 THREE.Bone?e.skinMatrix:e.matrix;var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(void 0!==this.hierarchy[a].animationCache)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,l,k=this.data.JIT.hierarchy,n,p;p=this.currentTime+=a*this.timeScale;n=this.currentTime%=this.data.length;l=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,q=this.hierarchy.length;o<q;o++)if(a=this.hierarchy[o],i=a.animationCache,this.JITCompile&&void 0!==k[o][l])a instanceof THREE.Bone?(a.skinMatrix=k[o][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
-k[o][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;3>m;m++){c=b[m];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=p){if(n<p)if(this.loop){g=this.data.hierarchy[o].keys[0];for(h=this.getNextKeyWith(c,o,1);h.time<n;)g=h,h=this.getNextKeyWith(c,o,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,o,h.index+1);while(h.time<n)}i.prevKey[c]=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,i,l,k=this.data.JIT.hierarchy,n,q;q=this.currentTime+=a*this.timeScale;n=this.currentTime%=this.data.length;l=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,p=this.hierarchy.length;o<p;o++)if(a=this.hierarchy[o],i=a.animationCache,this.JITCompile&&void 0!==k[o][l])a instanceof THREE.Bone?(a.skinMatrix=k[o][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
+k[o][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;3>m;m++){c=b[m];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=q){if(n<q)if(this.loop){g=this.data.hierarchy[o].keys[0];for(h=this.getNextKeyWith(c,o,1);h.time<n;)g=h,h=this.getNextKeyWith(c,o,h.index+1)}else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,o,h.index+1);while(h.time<n)}i.prevKey[c]=
 g;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(n-g.time)/(h.time-g.time);e=g[c];f=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o),d=0>d?0:1;if("pos"===c)if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",o,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",o,h.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,1.01*d),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if("rot"===
 c)THREE.Quaternion.slerp(e,f,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d}}if(this.JITCompile&&void 0===k[0][l]){this.hierarchy[0].updateMatrixWorld(!0);for(o=0;o<this.hierarchy.length;o++)k[o][l]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
@@ -454,7 +454,7 @@ e.matrix;e=this.data.hierarchy[c].keys;if(e.length)f.animationCache.prevKey=e[0]
 THREE.KeyFrameAnimation.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(void 0!==b.animationCache){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.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,i;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,l=this.hierarchy.length;a<l;a++){var k=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=k.length-1;e=this.hierarchy[a];if(k.length){for(k=
 0;k<f.length;k++)g=f[k],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(l=this.hierarchy.length;a<l;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,n=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(k.length){if(this.JITCompile&&n)d instanceof
-THREE.Bone?d.skinMatrix=n.originalMatrix:d.matrix=n.originalMatrix;b=n.prevKey;c=n.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=k[0];for(c=k[1];c.time<g;)b=c,c=k[b.index+1]}else if(!i)for(var p=k.length-1;c.time<g&&c.index!==p;)b=c,c=k[b.index+1];n.prevKey=b;n.nextKey=c}b.interpolate(c,g)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=this.hierarchy[a]instanceof
+THREE.Bone?d.skinMatrix=n.originalMatrix:d.matrix=n.originalMatrix;b=n.prevKey;c=n.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=k[0];for(c=k[1];c.time<g;)b=c,c=k[b.index+1]}else if(!i)for(var q=k.length-1;c.time<g&&c.index!==q;)b=c,c=k[b.index+1];n.prevKey=b;n.nextKey=c}b.interpolate(c,g)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e]){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<this.hierarchy.length;a++)f[a][e]=this.hierarchy[a]instanceof
 THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
 THREE.CubeCamera=function(a,b,c,d){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
 this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
@@ -493,12 +493,12 @@ THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,argu
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=void 0!==b?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=!1,h=1,i=0,l=0,k=0,n=0,p=0,o=window.innerWidth/2,q=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
-this.rotateHorizontally(b*n);this.rotateVertically(b*p)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*l);this.object.translateY(b*k);g&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
+THREE.RollControls=function(a,b){this.object=a;this.domElement=void 0!==b?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Matrix4,g=!1,h=1,i=0,l=0,k=0,n=0,q=0,o=window.innerWidth/2,p=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
+this.rotateHorizontally(b*n);this.rotateVertically(b*q)}b=a*this.movementSpeed;this.object.translateZ(-b*(0<i||this.autoForward&&!(0>i)?1:i));this.object.translateX(b*l);this.object.translateY(b*k);g&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();e.copy(this.forward);d.set(0,1,0);c.cross(d,
 e).normalize();d.cross(e,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=e.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=e.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=e.z;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){n=(a.clientX-o)/window.innerWidth;p=(a.clientY-q)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){n=(a.clientX-o)/window.innerWidth;q=(a.clientY-p)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
 function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:l=-1;break;case 40:case 83:i=-1;break;case 39:case 68:l=1;break;case 81:g=!0;h=1;break;case 69:g=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:l=0;break;case 40:case 83:i=0;break;case 39:case 68:l=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
 THREE.TrackballControls=function(a,b){var c=this;this.object=a;this.domElement=void 0!==b?b:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
 0,0);var d=!1,e=-1,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector2,l=new THREE.Vector2,k=new THREE.Vector2,n=new THREE.Vector2;this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2(0.5*((a-c.screen.offsetLeft)/c.radius),0.5*((b-c.screen.offsetTop)/c.radius))};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-0.5*c.screen.width-c.screen.offsetLeft)/c.radius,(0.5*
@@ -508,23 +508,23 @@ c.target.addSelf(b);c.staticMoving?k=n:k.addSelf(a.sub(n,k).multiplyScalar(c.dyn
 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&&(d&&(g=h=c.getMouseProjectionOnBall(a.clientX,a.clientY),i=l=c.getMouseOnScreen(a.clientX,a.clientY),k=n=c.getMouseOnScreen(a.clientX,a.clientY),d=!1),-1!==e&&(0===e&&!c.noRotate?h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?l=c.getMouseOnScreen(a.clientX,
 a.clientY):2===e&&!c.noPan&&(n=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===e))e=a.button,0===e&&!c.noRotate?g=h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===e&&!c.noZoom?i=l=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(k=n=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),
 e=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&-1===e&&(a.keyCode===c.keys[0]&&!c.noRotate?e=0:a.keyCode===c.keys[1]&&!c.noZoom?e=1:a.keyCode===c.keys[2]&&!c.noPan&&(e=2),-1!==e&&(d=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&-1!==e&&(e=-1)},!1)};
-THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,k,n){var m,o=d||1,p=e||1,q=h/2,j=i/2,r=l.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)m="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)m="y",p=f||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)m="x",o=f||1;var s=o+1,t=p+1,y=h/o,E=i/p,P=new THREE.Vector3;P[m]=0<k?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var u=new THREE.Vector3;u[a]=(i*y-q)*c;u[b]=(h*E-j)*g;u[m]=k;l.vertices.push(new THREE.Vertex(u))}for(h=0;h<p;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(P),a.vertexNormals.push(P.clone(),P.clone(),P.clone(),P.clone()),a.materialIndex=n,l.faces.push(a),l.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var l=this,k=a/2,n=b/2,p=c/2,o,q,m,r,s,t;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;6>o;o++)this.materials.push(g)}o=0;r=1;q=2;s=
-3;m=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var u in h)void 0!==this.sides[u]&&(this.sides[u]=h[u]);this.sides.px&&i("z","y",-1,-1,c,b,k,o);this.sides.nx&&i("z","y",1,-1,c,b,-k,r);this.sides.py&&i("x","z",1,1,a,c,n,q);this.sides.ny&&i("x","z",1,-1,a,c,-n,s);this.sides.pz&&i("x","y",1,-1,a,b,p,m);this.sides.nz&&i("x","y",-1,-1,a,b,-p,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,g,h,i,k,n){var m,o=d||1,q=e||1,p=h/2,j=i/2,r=l.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)m="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)m="y",q=f||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)m="x",o=f||1;var s=o+1,t=q+1,y=h/o,E=i/q,P=new THREE.Vector3;P[m]=0<k?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var u=new THREE.Vector3;u[a]=(i*y-p)*c;u[b]=(h*E-j)*g;u[m]=k;l.vertices.push(new THREE.Vertex(u))}for(h=0;h<q;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(P),a.vertexNormals.push(P.clone(),P.clone(),P.clone(),P.clone()),a.materialIndex=n,l.faces.push(a),l.faceVertexUvs[0].push([new THREE.UV(i/o,h/q),new THREE.UV(i/o,(h+1)/q),new THREE.UV((i+1)/o,(h+1)/q),new THREE.UV((i+1)/o,h/q)])}THREE.Geometry.call(this);var l=this,k=a/2,n=b/2,q=c/2,o,p,m,r,s,t;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;6>o;o++)this.materials.push(g)}o=0;r=1;p=2;s=
+3;m=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var u in h)void 0!==this.sides[u]&&(this.sides[u]=h[u]);this.sides.px&&i("z","y",-1,-1,c,b,k,o);this.sides.nx&&i("z","y",1,-1,c,b,-k,r);this.sides.py&&i("x","z",1,1,a,c,n,p);this.sides.ny&&i("x","z",1,-1,a,c,-n,s);this.sides.pz&&i("x","y",1,-1,a,b,q,m);this.sides.nz&&i("x","y",-1,-1,a,b,-q,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,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,l=[],k=[];for(i=0;i<=e;i++){var n=[],p=[],o=i/e,q=o*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,r=q*Math.sin(2*m*Math.PI),s=-o*c+g,t=q*Math.cos(2*m*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(r,s,t)));n.push(this.vertices.length-1);p.push(new THREE.UV(m,o))}l.push(n);k.push(p)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=l[i][h],n=l[i+1][h],
-p=l[i+1][h+1],o=l[i][h+1],q=this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[n].position.clone().setY(0).normalize(),r=this.vertices[p].position.clone().setY(0).normalize(),s=this.vertices[o].position.clone().setY(0).normalize(),t=k[i][h].clone(),u=k[i+1][h].clone(),x=k[i+1][h+1].clone(),w=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,n,p,o,[q,m,r,s]));this.faceVertexUvs[0].push([t,u,x,w])}if(!f&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
-0;h<d;h++)c=l[0][h],n=l[0][h+1],p=this.vertices.length-1,q=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),t=k[0][h].clone(),u=k[0][h+1].clone(),x=new THREE.UV(u.u,0),this.faces.push(new THREE.Face3(c,n,p,[q,m,r])),this.faceVertexUvs[0].push([t,u,x])}if(!f&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=l[i][h+1],n=l[i][h],p=this.vertices.length-1,q=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,
-0),t=k[i][h+1].clone(),u=k[i][h].clone(),x=new THREE.UV(u.u,1),this.faces.push(new THREE.Face3(c,n,p,[q,m,r])),this.faceVertexUvs[0].push([t,u,x])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,l=[],k=[];for(i=0;i<=e;i++){var n=[],q=[],o=i/e,p=o*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,r=p*Math.sin(2*m*Math.PI),s=-o*c+g,t=p*Math.cos(2*m*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(r,s,t)));n.push(this.vertices.length-1);q.push(new THREE.UV(m,o))}l.push(n);k.push(q)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=l[i][h],n=l[i+1][h],
+q=l[i+1][h+1],o=l[i][h+1],p=this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[n].position.clone().setY(0).normalize(),r=this.vertices[q].position.clone().setY(0).normalize(),s=this.vertices[o].position.clone().setY(0).normalize(),t=k[i][h].clone(),u=k[i+1][h].clone(),x=k[i+1][h+1].clone(),w=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,n,q,o,[p,m,r,s]));this.faceVertexUvs[0].push([t,u,x,w])}if(!f&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
+0;h<d;h++)c=l[0][h],n=l[0][h+1],q=this.vertices.length-1,p=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),t=k[0][h].clone(),u=k[0][h+1].clone(),x=new THREE.UV(u.u,0),this.faces.push(new THREE.Face3(c,n,q,[p,m,r])),this.faceVertexUvs[0].push([t,u,x])}if(!f&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=l[i][h+1],n=l[i][h],q=this.vertices.length-1,p=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,
+0),t=k[i][h+1].clone(),u=k[i][h].clone(),x=new THREE.UV(u.u,1),this.faces.push(new THREE.Face3(c,n,q,[p,m,r])),this.faceVertexUvs[0].push([t,u,x])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,b){if("undefined"!==typeof a){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d,e=a.length;this.shapebb=a[e-1].getBoundingBox();for(d=0;d<e;d++)c=a[d],this.addShape(c,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,j=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);j.copy(a).addSelf(g);if(h.equals(j))return g.clone();
 h.copy(b).addSelf(f);j.copy(c).addSelf(g);f=d.dot(g);g=j.subSelf(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(a){for(I=a.length;0<=--I;){y=I;E=I-1;0>E&&(E=a.length-1);for(var b=
 0,c=o+2*k,b=0;b<c;b++){var d=G*b,e=G*(b+1),f=ga+y+d,g=ga+y+e,j=f,d=ga+E+d,e=ga+E+e,l=g,j=j+F,d=d+F,e=e+F,l=l+F;C.faces.push(new THREE.Face4(j,d,e,l,null,null,x));void 0!==x&&(j=b/c,d=(b+1)/c,e=h+2*i,f=(C.vertices[f].position.z+i)/e,g=(C.vertices[g].position.z+i)/e,C.faceVertexUvs[0].push([new THREE.UV(f,j),new THREE.UV(g,j),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){C.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=F;b+=F;c+=F;C.faces.push(new THREE.Face3(a,
 b,c,null,null,u));if(void 0!==u){var d=w.minX,e=w.minY,f=w.maxY,g=w.maxX,h=C.vertices[b].position.x-d,b=C.vertices[b].position.y-e,j=C.vertices[c].position.x-d,c=C.vertices[c].position.y-e;C.faceVertexUvs[0].push([new THREE.UV((C.vertices[a].position.x-d)/g,(C.vertices[a].position.y-e)/f),new THREE.UV(h/g,b/f),new THREE.UV(j/g,c/f)])}}var h=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,l=void 0!==b.bevelSize?b.bevelSize:i-2,k=void 0!==b.bevelSegments?b.bevelSegments:
-3,n=void 0!==b.bevelEnabled?b.bevelEnabled:!0,p=void 0!==b.curveSegments?b.curveSegments:12,o=void 0!==b.steps?b.steps:1,q=b.bendPath,m=b.extrudePath,r,s=!1,t=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,u=b.material,x=b.extrudeMaterial,w=this.shapebb;if(m)r=m.getPoints(p),o=r.length,s=!0,n=!1;n||(l=i=k=0);var A,D,B,C=this,F=this.vertices.length;q&&a.addWrapPath(q);p=t?a.extractAllSpacedPoints(p):a.extractAllPoints(p);q=p.shape;p=p.holes;if(m=!THREE.Shape.Utils.isClockWise(q)){q=q.reverse();for(D=
-0,B=p.length;D<B;D++)A=p[D],THREE.Shape.Utils.isClockWise(A)&&(p[D]=A.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(q,p);t=q;for(D=0,B=p.length;D<B;D++)A=p[D],q=q.concat(A);for(var K,L,T,M,G=q.length,j=m.length,Q=[],I=0,R=t.length,y=R-1,E=I+1;I<R;I++,y++,E++)y===R&&(y=0),E===R&&(E=0),Q[I]=d(t[I],t[y],t[E]);var P=[],$,Z=Q.concat();for(D=0,B=p.length;D<B;D++){A=p[D];$=[];for(I=0,R=A.length,y=R-1,E=I+1;I<R;I++,y++,E++)y===R&&(y=0),E===R&&(E=0),$[I]=d(A[I],A[y],A[E]);P.push($);Z=Z.concat($)}for(K=
-0;K<k;K++){L=K/k;T=i*(1-L);L=l*Math.sin(L*Math.PI/2);for(I=0,R=t.length;I<R;I++)M=c(t[I],Q[I],L),f(M.x,M.y,-T);for(D=0,B=p.length;D<B;D++){A=p[D];$=P[D];for(I=0,R=A.length;I<R;I++)M=c(A[I],$[I],L),f(M.x,M.y,-T)}}L=l;for(I=0;I<G;I++)M=n?c(q[I],Z[I],L):q[I],s?f(M.x,M.y+r[0].y,r[0].x):f(M.x,M.y,0);for(K=1;K<=o;K++)for(I=0;I<G;I++)M=n?c(q[I],Z[I],L):q[I],s?f(M.x,M.y+r[K-1].y,r[K-1].x):f(M.x,M.y,h/o*K);for(K=k-1;0<=K;K--){L=K/k;T=i*(1-L);L=l*Math.sin(L*Math.PI/2);for(I=0,R=t.length;I<R;I++)M=c(t[I],Q[I],
-L),f(M.x,M.y,h+T);for(D=0,B=p.length;D<B;D++){A=p[D];$=P[D];for(I=0,R=A.length;I<R;I++)M=c(A[I],$[I],L),s?f(M.x,M.y+r[o-1].y,r[o-1].x+T):f(M.x,M.y,h+T)}}if(n){n=0*G;for(I=0;I<j;I++)l=m[I],g(l[2]+n,l[1]+n,l[0]+n);n=G*(o+2*k);for(I=0;I<j;I++)l=m[I],g(l[0]+n,l[1]+n,l[2]+n)}else{for(I=0;I<j;I++)l=m[I],g(l[2],l[1],l[0]);for(I=0;I<j;I++)l=m[I],g(l[0]+G*o,l[1]+G*o,l[2]+G*o)}var ga=0;e(t);ga+=t.length;for(D=0,B=p.length;D<B;D++)A=p[D],e(A),ga+=A.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+3,n=void 0!==b.bevelEnabled?b.bevelEnabled:!0,q=void 0!==b.curveSegments?b.curveSegments:12,o=void 0!==b.steps?b.steps:1,p=b.bendPath,m=b.extrudePath,r,s=!1,t=void 0!==b.useSpacedPoints?b.useSpacedPoints:!1,u=b.material,x=b.extrudeMaterial,w=this.shapebb;if(m)r=m.getPoints(q),o=r.length,s=!0,n=!1;n||(l=i=k=0);var A,D,B,C=this,F=this.vertices.length;p&&a.addWrapPath(p);q=t?a.extractAllSpacedPoints(q):a.extractAllPoints(q);p=q.shape;q=q.holes;if(m=!THREE.Shape.Utils.isClockWise(p)){p=p.reverse();for(D=
+0,B=q.length;D<B;D++)A=q[D],THREE.Shape.Utils.isClockWise(A)&&(q[D]=A.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(p,q);t=p;for(D=0,B=q.length;D<B;D++)A=q[D],p=p.concat(A);for(var K,L,T,M,G=p.length,j=m.length,Q=[],I=0,R=t.length,y=R-1,E=I+1;I<R;I++,y++,E++)y===R&&(y=0),E===R&&(E=0),Q[I]=d(t[I],t[y],t[E]);var P=[],$,Z=Q.concat();for(D=0,B=q.length;D<B;D++){A=q[D];$=[];for(I=0,R=A.length,y=R-1,E=I+1;I<R;I++,y++,E++)y===R&&(y=0),E===R&&(E=0),$[I]=d(A[I],A[y],A[E]);P.push($);Z=Z.concat($)}for(K=
+0;K<k;K++){L=K/k;T=i*(1-L);L=l*Math.sin(L*Math.PI/2);for(I=0,R=t.length;I<R;I++)M=c(t[I],Q[I],L),f(M.x,M.y,-T);for(D=0,B=q.length;D<B;D++){A=q[D];$=P[D];for(I=0,R=A.length;I<R;I++)M=c(A[I],$[I],L),f(M.x,M.y,-T)}}L=l;for(I=0;I<G;I++)M=n?c(p[I],Z[I],L):p[I],s?f(M.x,M.y+r[0].y,r[0].x):f(M.x,M.y,0);for(K=1;K<=o;K++)for(I=0;I<G;I++)M=n?c(p[I],Z[I],L):p[I],s?f(M.x,M.y+r[K-1].y,r[K-1].x):f(M.x,M.y,h/o*K);for(K=k-1;0<=K;K--){L=K/k;T=i*(1-L);L=l*Math.sin(L*Math.PI/2);for(I=0,R=t.length;I<R;I++)M=c(t[I],Q[I],
+L),f(M.x,M.y,h+T);for(D=0,B=q.length;D<B;D++){A=q[D];$=P[D];for(I=0,R=A.length;I<R;I++)M=c(A[I],$[I],L),s?f(M.x,M.y+r[o-1].y,r[o-1].x+T):f(M.x,M.y,h+T)}}if(n){n=0*G;for(I=0;I<j;I++)l=m[I],g(l[2]+n,l[1]+n,l[0]+n);n=G*(o+2*k);for(I=0;I<j;I++)l=m[I],g(l[0]+n,l[1]+n,l[2]+n)}else{for(I=0;I<j;I++)l=m[I],g(l[2],l[1],l[0]);for(I=0;I<j;I++)l=m[I],g(l[0]+G*o,l[1]+G*o,l[2]+G*o)}var ga=0;e(t);ga+=t.length;for(D=0,B=q.length;D<B;D++)A=q[D],e(A),ga+=A.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var f=e.vertices[a].position,g=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-0.5*((Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI),0.5-f.y/2),new THREE.UV(1-
 0.5*((Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI),0.5-g.y/2),new THREE.UV(1-0.5*((Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI),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,f=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,f);c(0,5,1,
@@ -538,17 +538,17 @@ g.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),g.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,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,l=b/d,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-e,-(a*l-f),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)e=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a),e.normal.copy(k),e.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
 c,(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,f=void 0!==f?f:0,g=void 0!==g?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,l=[],k=[];for(i=0;i<=c;i++){var n=[],p=[];for(h=0;h<=b;h++){var o=h/b,q=i/c,m=-a*Math.cos(d+o*e)*Math.sin(f+q*g),r=a*Math.cos(f+q*g),s=a*Math.sin(d+o*e)*Math.sin(f+q*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,r,s)));n.push(this.vertices.length-1);p.push(new THREE.UV(o,
-q))}l.push(n);k.push(p)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=l[i][h+1],e=l[i][h],f=l[i+1][h],g=l[i+1][h+1],n=this.vertices[d].position.clone().normalize(),p=this.vertices[e].position.clone().normalize(),o=this.vertices[f].position.clone().normalize(),q=this.vertices[g].position.clone().normalize(),m=k[i][h+1].clone(),r=k[i][h].clone(),s=k[i+1][h].clone(),t=k[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,f,g,[n,o,q])),this.faceVertexUvs[0].push([m,
-s,t])):Math.abs(this.vertices[f].position.y)==a?(this.faces.push(new THREE.Face3(d,e,f,[n,p,o])),this.faceVertexUvs[0].push([m,r,s])):(this.faces.push(new THREE.Face4(d,e,f,g,[n,p,o,q])),this.faceVertexUvs[0].push([m,r,s,t]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
+THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);var a=a||50,d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,f=void 0!==f?f:0,g=void 0!==g?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,l=[],k=[];for(i=0;i<=c;i++){var n=[],q=[];for(h=0;h<=b;h++){var o=h/b,p=i/c,m=-a*Math.cos(d+o*e)*Math.sin(f+p*g),r=a*Math.cos(f+p*g),s=a*Math.sin(d+o*e)*Math.sin(f+p*g);this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,r,s)));n.push(this.vertices.length-1);q.push(new THREE.UV(o,
+p))}l.push(n);k.push(q)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=l[i][h+1],e=l[i][h],f=l[i+1][h],g=l[i+1][h+1],n=this.vertices[d].position.clone().normalize(),q=this.vertices[e].position.clone().normalize(),o=this.vertices[f].position.clone().normalize(),p=this.vertices[g].position.clone().normalize(),m=k[i][h+1].clone(),r=k[i][h].clone(),s=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,f,g,[n,o,p])),this.faceVertexUvs[0].push([m,
+s,t])):Math.abs(this.vertices[f].position.y)==a?(this.faces.push(new THREE.Face3(d,e,f,[n,q,o])),this.faceVertexUvs[0].push([m,r,s])):(this.faces.push(new THREE.Face4(d,e,f,g,[n,q,o,p])),this.faceVertexUvs[0].push([m,r,s,t]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=void 0!==b.height?b.height:50;if(void 0===b.bevelThickness)b.bevelThickness=10;if(void 0===b.bevelSize)b.bevelSize=8;if(void 0===b.bevelEnabled)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
-0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,l,k,n,p,o,q,m,r,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));l=b.length;for(a=0;a<l;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(i,k));e.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(i,
-k));e.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;o=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(o,q,i,k);if(g=f[f.length-1]){n=g.x;p=g.y;for(g=1,h=this.divisions;g<=h;g++){var t=g/h,u=THREE.Shape.Utils.b2(t,n,o,i),t=THREE.Shape.Utils.b2(t,p,q,k);f.push(new THREE.Vector2(u,t))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,o=b[a++]*c+d,q=b[a++]*-c,m=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,k,o,q,m,r),g=f[f.length-1]){n=g.x;p=g.y;for(g=1,h=this.divisions;g<=h;g++)t=g/h,u=THREE.Shape.Utils.b3(t,n,o,
-m,i),t=THREE.Shape.Utils.b3(t,p,q,r,k),f.push(new THREE.Vector2(u,t))}}}return{offset:s.ha*c,points:f,path:e}}}};
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,l,k;if(0<b(a))for(l=0;l<e;l++)g[l]=l;else for(l=0;l<e;l++)g[l]=e-1-l;var n=2*e;for(l=e-1;2<e;){if(0>=n--){console.log("Warning, unable to triangulate polygon!");break}i=l;e<=i&&(i=0);l=i+1;e<=l&&(l=0);k=l+1;e<=k&&(k=0);var p;a:{p=a;var o=i,q=l,m=k,r=e,s=g,t=void 0,u=void 0,x=void 0,w=void 0,A=void 0,
-D=void 0,B=void 0,C=void 0,F=void 0,u=p[s[o]].x,x=p[s[o]].y,w=p[s[q]].x,A=p[s[q]].y,D=p[s[m]].x,B=p[s[m]].y;if(1.0E-10>(w-u)*(B-x)-(A-x)*(D-u))p=!1;else{for(t=0;t<r;t++)if(!(t==o||t==q||t==m)){var C=p[s[t]].x,F=p[s[t]].y,K=void 0,L=void 0,T=void 0,M=void 0,G=void 0,j=void 0,Q=void 0,I=void 0,R=void 0,y=void 0,E=void 0,P=void 0,K=T=G=void 0,K=D-w,L=B-A,T=u-D,M=x-B,G=w-u,j=A-x,Q=C-u,I=F-x,R=C-w,y=F-A,E=C-D,P=F-B,K=K*y-L*R,G=G*I-j*Q,T=T*P-M*E;if(0<=K&&0<=T&&0<=G){p=!1;break a}}p=!0}}if(p){f.push([a[g[i]],
+0,e=(""+a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,l,k,n,q,o,p,m,r,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));l=b.length;for(a=0;a<l;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(i,k));e.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;f.push(new THREE.Vector2(i,
+k));e.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;o=b[a++]*c+d;p=b[a++]*c;e.quadraticCurveTo(o,p,i,k);if(g=f[f.length-1]){n=g.x;q=g.y;for(g=1,h=this.divisions;g<=h;g++){var t=g/h,u=THREE.Shape.Utils.b2(t,n,o,i),t=THREE.Shape.Utils.b2(t,q,p,k);f.push(new THREE.Vector2(u,t))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,o=b[a++]*c+d,p=b[a++]*-c,m=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,k,o,p,m,r),g=f[f.length-1]){n=g.x;q=g.y;for(g=1,h=this.divisions;g<=h;g++)t=g/h,u=THREE.Shape.Utils.b3(t,n,o,
+m,i),t=THREE.Shape.Utils.b3(t,q,p,r,k),f.push(new THREE.Vector2(u,t))}}}return{offset:s.ha*c,points:f,path:e}}}};
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,l,k;if(0<b(a))for(l=0;l<e;l++)g[l]=l;else for(l=0;l<e;l++)g[l]=e-1-l;var n=2*e;for(l=e-1;2<e;){if(0>=n--){console.log("Warning, unable to triangulate polygon!");break}i=l;e<=i&&(i=0);l=i+1;e<=l&&(l=0);k=l+1;e<=k&&(k=0);var q;a:{q=a;var o=i,p=l,m=k,r=e,s=g,t=void 0,u=void 0,x=void 0,w=void 0,A=void 0,
+D=void 0,B=void 0,C=void 0,F=void 0,u=q[s[o]].x,x=q[s[o]].y,w=q[s[p]].x,A=q[s[p]].y,D=q[s[m]].x,B=q[s[m]].y;if(1.0E-10>(w-u)*(B-x)-(A-x)*(D-u))q=!1;else{for(t=0;t<r;t++)if(!(t==o||t==p||t==m)){var C=q[s[t]].x,F=q[s[t]].y,K=void 0,L=void 0,T=void 0,M=void 0,G=void 0,j=void 0,Q=void 0,I=void 0,R=void 0,y=void 0,E=void 0,P=void 0,K=T=G=void 0,K=D-w,L=B-A,T=u-D,M=x-B,G=w-u,j=A-x,Q=C-u,I=F-x,R=C-w,y=F-A,E=C-D,P=F-B,K=K*y-L*R,G=G*I-j*Q,T=T*P-M*E;if(0<=K&&0<=T&&0<=G){q=!1;break a}}q=!0}}if(q){f.push([a[g[i]],
 a[g[l]],a[g[k]]]);h.push([g[i],g[l],g[k]]);for(i=l,k=l+1;k<e;i++,k++)g[i]=g[k];e--;n=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,g=2*c/this.segmentsR*Math.PI;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(f);h.z=
 this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
@@ -563,12 +563,12 @@ this.update(a);this.lines=new THREE.Line(this.lineGeometry,this.lineMaterial,THR
 THREE.CameraHelper.prototype.update=function(a){function b(a,b,f,g){THREE.CameraHelper.__v.set(b,f,g);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=c.pointMap[a];if(void 0!==a){b=0;for(f=a.length;b<f;b++)c.lineGeometry.vertices[a[b]].position.copy(THREE.CameraHelper.__v)}}var c=this;THREE.CameraHelper.__c.projectionMatrix.copy(a.projectionMatrix);b("c",0,0,-1);b("t",0,0,1);b("n1",-1,-1,-1);b("n2",1,-1,-1);b("n3",-1,1,-1);b("n4",1,1,-1);b("f1",-1,-1,
 1);b("f2",1,-1,1);b("f3",-1,1,1);b("f4",1,1,1);b("u1",0.7,1.1,-1);b("u2",-0.7,1.1,-1);b("u3",0,2,-1);b("cf1",-1,0,1);b("cf2",1,0,1);b("cf3",0,-1,1);b("cf4",0,1,1);b("cn1",-1,0,-1);b("cn2",1,0,-1);b("cn3",0,-1,-1);b("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=!0};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 THREE.SubdivisionModifier=function(a){this.subdivisions=void 0===a?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;0<b--;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var l=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(g.useOldVertexColors){l.vertexColors=[];for(var k,m,n,o=0;4>o;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;l.vertexColors[o]=k}}e.push(l);(!g.supportUVs||0!=p.length)&&f.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=[],f=[],g=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],k={},n={},p=[],o,q,m,r,s,t=a.faceVertexUvs[0];for(o=0,q=t.length;o<q;o++)for(m=0,r=t[o].length;m<r;m++)s=d[o]["abcd".charAt(m)],p[s]||(p[s]=t[o][m]);var u;for(o=0,q=d.length;o<q;o++)if(s=d[o],l.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),g.supportUVs&&0!=p.length){u=new THREE.UV;if(s instanceof THREE.Face3)u.u=p[s.a].u+p[s.b].u+p[s.c].u,u.v=p[s.a].v+p[s.b].v+p[s.c].v,u.u/=3,u.v/=3;else if(s instanceof THREE.Face4)u.u=
-p[s.a].u+p[s.b].u+p[s.c].u+p[s.d].u,u.v=p[s.a].v+p[s.b].v+p[s.c].v+p[s.d].v,u.u/=4,u.v/=4;p.push(u)}q=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var x=0,t=h.length,w,A,D={},B={},C=function(a,
-b){void 0===D[a]&&(D[a]=[]);D[a].push(b)},F=function(a,b){void 0===B[a]&&(B[a]={});B[a][b]=null};for(o in q){u=q[o];w=o.split("_");A=w[0];w=w[1];C(A,[A,w]);C(w,[A,w]);for(m=0,r=u.length;m<r;m++)s=u[m],F(A,s,o),F(w,s,o);2>u.length&&(n[o]=!0)}for(o in q)if(u=q[o],s=u[0],u=u[1],w=o.split("_"),A=w[0],w=w[1],r=new THREE.Vector3,n[o]?(r.addSelf(h[A].position),r.addSelf(h[w].position),r.multiplyScalar(0.5)):(r.addSelf(l[s]),r.addSelf(l[u]),r.addSelf(h[A].position),r.addSelf(h[w].position),r.multiplyScalar(0.25)),
-k[o]=t+d.length+x,i.push(new THREE.Vertex(r)),x++,g.supportUVs&&0!=p.length)u=new THREE.UV,u.u=p[A].u+p[w].u,u.v=p[A].v+p[w].v,u.u/=2,u.v/=2,p.push(u);var K,L;w=["123","12","2","23"];r=["123","23","3","31"];var C=["123","31","1","12"],F=["1234","12","2","23"],T=["1234","23","3","34"],M=["1234","34","4","41"],G=["1234","41","1","12"];for(o=0,q=l.length;o<q;o++)s=d[o],u=t+o,s instanceof THREE.Face3?(x=c(s.a,s.b),A=c(s.b,s.c),K=c(s.c,s.a),b(u,k[x],s.b,k[A],s,w),b(u,k[A],s.c,k[K],s,r),b(u,k[K],s.a,k[x],
-s,C)):s instanceof THREE.Face4?(x=c(s.a,s.b),A=c(s.b,s.c),K=c(s.c,s.d),L=c(s.d,s.a),b(u,k[x],s.b,k[A],s,F),b(u,k[A],s.c,k[K],s,T),b(u,k[K],s.d,k[L],s,M),b(u,k[L],s.a,k[x],s,G)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;k=new THREE.Vector3;for(o=0,q=h.length;o<q;o++)if(void 0!==D[o]){i.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);u=0;for(m in B[o])i.addSelf(l[m]),u++;x=0;t=D[o].length;for(m=0;m<t;m++)n[c(D[o][m][0],D[o][m][1])]&&x++;if(2!=x){i.divideScalar(u);for(m=0;m<
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var l=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(g.useOldVertexColors){l.vertexColors=[];for(var k,m,n,o=0;4>o;o++){n=i[o];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<n.length;p++)m=h.vertexColors[n[p]-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;l.vertexColors[o]=k}}e.push(l);(!g.supportUVs||0!=q.length)&&f.push([q[a],q[b],q[c],q[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],e=[],f=[],g=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],k={},n={},q=[],o,p,m,r,s,t=a.faceVertexUvs[0];for(o=0,p=t.length;o<p;o++)for(m=0,r=t[o].length;m<r;m++)s=d[o]["abcd".charAt(m)],q[s]||(q[s]=t[o][m]);var u;for(o=0,p=d.length;o<p;o++)if(s=d[o],l.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),g.supportUVs&&0!=q.length){u=new THREE.UV;if(s instanceof THREE.Face3)u.u=q[s.a].u+q[s.b].u+q[s.c].u,u.v=q[s.a].v+q[s.b].v+q[s.c].v,u.u/=3,u.v/=3;else if(s instanceof THREE.Face4)u.u=
+q[s.a].u+q[s.b].u+q[s.c].u+q[s.d].u,u.v=q[s.a].v+q[s.b].v+q[s.c].v+q[s.d].v,u.u/=4,u.v/=4;q.push(u)}p=function(a){function b(a,c,d){void 0===a[c]&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var x=0,t=h.length,w,A,D={},B={},C=function(a,
+b){void 0===D[a]&&(D[a]=[]);D[a].push(b)},F=function(a,b){void 0===B[a]&&(B[a]={});B[a][b]=null};for(o in p){u=p[o];w=o.split("_");A=w[0];w=w[1];C(A,[A,w]);C(w,[A,w]);for(m=0,r=u.length;m<r;m++)s=u[m],F(A,s,o),F(w,s,o);2>u.length&&(n[o]=!0)}for(o in p)if(u=p[o],s=u[0],u=u[1],w=o.split("_"),A=w[0],w=w[1],r=new THREE.Vector3,n[o]?(r.addSelf(h[A].position),r.addSelf(h[w].position),r.multiplyScalar(0.5)):(r.addSelf(l[s]),r.addSelf(l[u]),r.addSelf(h[A].position),r.addSelf(h[w].position),r.multiplyScalar(0.25)),
+k[o]=t+d.length+x,i.push(new THREE.Vertex(r)),x++,g.supportUVs&&0!=q.length)u=new THREE.UV,u.u=q[A].u+q[w].u,u.v=q[A].v+q[w].v,u.u/=2,u.v/=2,q.push(u);var K,L;w=["123","12","2","23"];r=["123","23","3","31"];var C=["123","31","1","12"],F=["1234","12","2","23"],T=["1234","23","3","34"],M=["1234","34","4","41"],G=["1234","41","1","12"];for(o=0,p=l.length;o<p;o++)s=d[o],u=t+o,s instanceof THREE.Face3?(x=c(s.a,s.b),A=c(s.b,s.c),K=c(s.c,s.a),b(u,k[x],s.b,k[A],s,w),b(u,k[A],s.c,k[K],s,r),b(u,k[K],s.a,k[x],
+s,C)):s instanceof THREE.Face4?(x=c(s.a,s.b),A=c(s.b,s.c),K=c(s.c,s.d),L=c(s.d,s.a),b(u,k[x],s.b,k[A],s,F),b(u,k[A],s.c,k[K],s,T),b(u,k[K],s.d,k[L],s,M),b(u,k[L],s.a,k[x],s,G)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;k=new THREE.Vector3;for(o=0,p=h.length;o<p;o++)if(void 0!==D[o]){i.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);u=0;for(m in B[o])i.addSelf(l[m]),u++;x=0;t=D[o].length;for(m=0;m<t;m++)n[c(D[o][m][0],D[o][m][1])]&&x++;if(2!=x){i.divideScalar(u);for(m=0;m<
 t;m++)u=D[o][m],u=h[u[0]].position.clone().addSelf(h[u[1]].position).divideScalar(2),k.addSelf(u);k.divideScalar(t);s.addSelf(h[o].position);s.multiplyScalar(t-3);s.addSelf(i);s.addSelf(k.multiplyScalar(2));s.divideScalar(t);d[o].position=s}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
 THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/a.total).toFixed(0)+
@@ -585,13 +585,13 @@ THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHtt
 g.status+"]")};g.open("GET",b,!0);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){4==f.readyState?200==f.status||0==f.status?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("Couldn't load ["+g+"] ["+f.status+"]"):3==f.readyState?e&&(0==h&&(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):2==f.readyState&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",g,!0);
 f.responseType="arraybuffer";f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,l,k,n,p,o,q,m,r,s,t,u,x,w;function A(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function B(a,b){return(new Uint32Array(a,b,1))[0]}function C(b,c){var d,e,f,g,h,j,i,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[3*d];f=l[3*d+1];g=l[3*d+2];h=I[2*e];e=I[2*e+1];j=I[2*f];i=I[2*f+1];f=I[2*g];k=I[2*g+1];g=G.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(j,i));
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,l,k,n,q,o,p,m,r,s,t,u,x,w;function A(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function B(a,b){return(new Uint32Array(a,b,1))[0]}function C(b,c){var d,e,f,g,h,j,i,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[3*d];f=l[3*d+1];g=l[3*d+2];h=I[2*e];e=I[2*e+1];j=I[2*f];i=I[2*f+1];f=I[2*g];k=I[2*g+1];g=G.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(j,i));
 m.push(new THREE.UV(f,k));g.push(m)}}function F(b,c){var d,e,f,g,h,j,i,k,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[4*d];f=n[4*d+1];g=n[4*d+2];h=n[4*d+3];j=I[2*e];e=I[2*e+1];i=I[2*f];l=I[2*f+1];k=I[2*g];m=I[2*g+1];g=I[2*h];f=I[2*h+1];h=G.faceVertexUvs[0];var o=[];o.push(new THREE.UV(j,e));o.push(new THREE.UV(i,l));o.push(new THREE.UV(k,m));o.push(new THREE.UV(g,f));h.push(o)}}function K(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*
 d+1],g=c[3*d+2],h=j[d],G.faces.push(new THREE.Face3(e,f,g,null,null,h))}function L(b,c,d){for(var e,f,g,h,j,c=new Uint32Array(a,c,4*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],j=i[d],G.faces.push(new THREE.Face4(e,f,g,h,null,null,j))}function T(b,c,d,e){for(var f,g,h,j,i,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];i=d[3*e];k=d[3*e+1];l=d[3*e+2];j=m[e];var n=Q[3*k],o=Q[3*k+1];k=
-Q[3*k+2];var p=Q[3*l],q=Q[3*l+1];l=Q[3*l+2];G.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(Q[3*i],Q[3*i+1],Q[3*i+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,q,l)],null,j))}}function M(b,c,d,e){for(var f,g,h,j,i,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];j=c[4*e+3];k=d[4*e];l=d[4*e+1];m=d[4*e+2];n=d[4*e+3];i=o[e];var p=Q[3*l],q=Q[3*l+1];l=Q[3*l+2];var r=Q[3*m],s=Q[3*m+1];m=Q[3*m+2];var t=Q[3*n],u=Q[3*
-n+1];n=Q[3*n+2];G.faces.push(new THREE.Face4(f,g,h,j,[new THREE.Vector3(Q[3*k],Q[3*k+1],Q[3*k+2]),new THREE.Vector3(p,q,l),new THREE.Vector3(r,s,m),new THREE.Vector3(t,u,n)],null,i))}}var G=this,j=0,Q=[],I=[],R,y;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(G,d,b);c=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,j,12);e=D(a,j+12);D(a,j+13);D(a,j+14);D(a,j+15);i=D(a,j+16);l=D(a,j+17);k=D(a,j+18);n=D(a,j+19);p=B(a,j+20);
-o=B(a,j+20+4);q=B(a,j+20+8);b=B(a,j+20+12);m=B(a,j+20+16);r=B(a,j+20+20);s=B(a,j+20+24);t=B(a,j+20+28);u=B(a,j+20+32);x=B(a,j+20+36);w=B(a,j+20+40);"Three.js 003"!==c&&console.warn("DEPRECATED: binary model seems to be using old format");j+=e;c=3*i+n;y=4*i+n;e=b*c;R=m*(c+3*l);i=r*(c+3*k);n=s*(c+3*l+3*k);c=t*y;l=u*(y+4*l);k=x*(y+4*k);j+=function(b){var b=new Float32Array(a,b,3*p),c,d,e,f;for(c=0;c<p;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],G.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*
-p*Float32Array.BYTES_PER_ELEMENT}(j);j+=function(b){if(o){var b=new Int8Array(a,b,3*o),c,d,e,f;for(c=0;c<o;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],Q.push(d/127,e/127,f/127)}return 3*o*Int8Array.BYTES_PER_ELEMENT}(j);j+=A(3*o);j+=function(b){if(q){var b=new Float32Array(a,b,2*q),c,d,e;for(c=0;c<q;c++)d=b[2*c],e=b[2*c+1],I.push(d,e)}return 2*q*Float32Array.BYTES_PER_ELEMENT}(j);e=j+e+A(2*b);R=e+R+A(2*m);i=R+i+A(2*r);n=i+n+A(2*s);c=n+c+A(2*t);l=c+l+A(2*u);k=l+k+A(2*x);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT;
+Q[3*k+2];var q=Q[3*l],p=Q[3*l+1];l=Q[3*l+2];G.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(Q[3*i],Q[3*i+1],Q[3*i+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(q,p,l)],null,j))}}function M(b,c,d,e){for(var f,g,h,j,i,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];j=c[4*e+3];k=d[4*e];l=d[4*e+1];m=d[4*e+2];n=d[4*e+3];i=o[e];var q=Q[3*l],p=Q[3*l+1];l=Q[3*l+2];var r=Q[3*m],s=Q[3*m+1];m=Q[3*m+2];var t=Q[3*n],u=Q[3*
+n+1];n=Q[3*n+2];G.faces.push(new THREE.Face4(f,g,h,j,[new THREE.Vector3(Q[3*k],Q[3*k+1],Q[3*k+2]),new THREE.Vector3(q,p,l),new THREE.Vector3(r,s,m),new THREE.Vector3(t,u,n)],null,i))}}var G=this,j=0,Q=[],I=[],R,y;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(G,d,b);c=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,j,12);e=D(a,j+12);D(a,j+13);D(a,j+14);D(a,j+15);i=D(a,j+16);l=D(a,j+17);k=D(a,j+18);n=D(a,j+19);q=B(a,j+20);
+o=B(a,j+20+4);p=B(a,j+20+8);b=B(a,j+20+12);m=B(a,j+20+16);r=B(a,j+20+20);s=B(a,j+20+24);t=B(a,j+20+28);u=B(a,j+20+32);x=B(a,j+20+36);w=B(a,j+20+40);"Three.js 003"!==c&&console.warn("DEPRECATED: binary model seems to be using old format");j+=e;c=3*i+n;y=4*i+n;e=b*c;R=m*(c+3*l);i=r*(c+3*k);n=s*(c+3*l+3*k);c=t*y;l=u*(y+4*l);k=x*(y+4*k);j+=function(b){var b=new Float32Array(a,b,3*q),c,d,e,f;for(c=0;c<q;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],G.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*
+q*Float32Array.BYTES_PER_ELEMENT}(j);j+=function(b){if(o){var b=new Int8Array(a,b,3*o),c,d,e,f;for(c=0;c<o;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],Q.push(d/127,e/127,f/127)}return 3*o*Int8Array.BYTES_PER_ELEMENT}(j);j+=A(3*o);j+=function(b){if(p){var b=new Float32Array(a,b,2*p),c,d,e;for(c=0;c<p;c++)d=b[2*c],e=b[2*c+1],I.push(d,e)}return 2*p*Float32Array.BYTES_PER_ELEMENT}(j);e=j+e+A(2*b);R=e+R+A(2*m);i=R+i+A(2*r);n=i+n+A(2*s);c=n+c+A(2*t);l=c+l+A(2*u);k=l+k+A(2*x);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT;
 K(r,a,b+3*r*Uint32Array.BYTES_PER_ELEMENT);C(r,b)}})(R);(function(a){if(s){var b=a+3*s*Uint32Array.BYTES_PER_ELEMENT,c=b+3*s*Uint32Array.BYTES_PER_ELEMENT;T(s,a,b,c+3*s*Uint32Array.BYTES_PER_ELEMENT);C(s,c)}})(i);(function(a){if(x){var b=a+4*x*Uint32Array.BYTES_PER_ELEMENT;L(x,a,b+4*x*Uint32Array.BYTES_PER_ELEMENT);F(x,b)}})(l);(function(a){if(w){var b=a+4*w*Uint32Array.BYTES_PER_ELEMENT,c=b+4*w*Uint32Array.BYTES_PER_ELEMENT;M(w,a,b,c+4*w*Uint32Array.BYTES_PER_ELEMENT);F(w,c)}})(k);b&&K(b,j,j+3*b*
 Uint32Array.BYTES_PER_ELEMENT);(function(a){if(m){var b=a+3*m*Uint32Array.BYTES_PER_ELEMENT;T(m,a,b,b+3*m*Uint32Array.BYTES_PER_ELEMENT)}})(e);t&&L(t,n,n+4*t*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;M(u,a,b,b+4*u*Uint32Array.BYTES_PER_ELEMENT)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
 THREE.ColladaLoader=function(){function a(a,d,e){S=a;d=d||ca;void 0!==e&&(a=e.split("/"),a.pop(),Wa=1>a.length?"":a.join("/")+"/");if((a=S.evaluate("//dae:asset",S,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(e=0;e<a.childNodes.length;e++){var j=a.childNodes[e];switch(j.nodeName){case "unit":(j=j.getAttribute("meter"))&&parseFloat(j);break;case "up_axis":Ka=j.textContent.charAt(0)}}if(!Oa.convertUpAxis||Ka===Oa.upAxis)xa=null;else switch(Ka){case "X":xa="Y"===Oa.upAxis?
@@ -600,20 +600,20 @@ k,"visual_scene");fb=[];Za=[];(a=S.evaluate(".//dae:scene/dae:instance_visual_sc
 S,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=ba.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};Sa.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d={hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=
 0,g=c(a.children[e]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function e(a,b,c){var e,f=za[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||
 !b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var c=1E6,g=-c,h=0;for(e in ja)for(var j=ja[e],i=0;i<j.sampler.length;i++){var k=j.sampler[i];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=ba.getChildById(b.skeleton[0],!0)||ba.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,n,i=0;i<a.vertices.length;i++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[i].position);for(c=0;c<e;c++){h=
-[];j=[];for(i=0;i<a.vertices.length;i++)j.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);i=h;k=f.skin;for(m=0;m<i.length;m++)if(l=i[m],n=-1,"JOINT"==l.type){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(0<=n){o=k.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<k.weights.length;o++)for(var p=0;p<k.weights[o].length;p++){var q=k.weights[o][p];q.joint==n&&l.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+
+[];j=[];for(i=0;i<a.vertices.length;i++)j.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);i=h;k=f.skin;for(m=0;m<i.length;m++)if(l=i[m],n=-1,"JOINT"==l.type){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(0<=n){o=k.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<k.weights.length;o++)for(var q=0;q<k.weights[o].length;q++){var p=k.weights[o][q];p.joint==n&&l.weights.push(p)}}else throw"ColladaLoader: Could not find joint '"+
 l.sid+"'.";}for(i=0;i<h.length;i++)if("JOINT"==h[i].type)for(k=0;k<h[i].weights.length;k++)l=h[i].weights[k],m=l.index,l=l.weight,n=a.vertices[m],m=j[m],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[i].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:j})}}}function f(a){var b=new THREE.Object3D,c,d,g,h;for(g=0;g<a.controllers.length;g++){var j=za[a.controllers[g].url];switch(j.type){case "skin":if(qa[j.skin.source]){var i=
 new m;i.url=j.skin.source;i.instance_material=a.controllers[g].instance_material;a.geometries.push(i);c=a.controllers[g]}else if(za[j.skin.source]&&(d=j=za[j.skin.source],j.morph&&qa[j.morph.source]))i=new m,i.url=j.morph.source,i.instance_material=a.controllers[g].instance_material,a.geometries.push(i);break;case "morph":if(qa[j.morph.source])i=new m,i.url=j.morph.source,i.instance_material=a.controllers[g].instance_material,a.geometries.push(i),d=a.controllers[g];console.log("ColladaLoader: Morph-controller partially supported.")}}for(g=
-0;g<a.geometries.length;g++){var j=a.geometries[g],i=j.instance_material,j=qa[j.url],k={},l=[],n=0,p;if(j&&j.mesh&&j.mesh.primitives){if(0==b.name.length)b.name=j.id;if(i)for(h=0;h<i.length;h++){p=i[h];var q=Ea[Ga[p.target].instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;k[p.symbol]=n;l.push(q.material);p=q.material;n++}i=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});j=j.mesh.geometry3js;if(1<n){i=new THREE.MeshFaceMaterial;j.materials=
+0;g<a.geometries.length;g++){var j=a.geometries[g],i=j.instance_material,j=qa[j.url],k={},l=[],n=0,q;if(j&&j.mesh&&j.mesh.primitives){if(0==b.name.length)b.name=j.id;if(i)for(h=0;h<i.length;h++){q=i[h];var p=Ea[Ga[q.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;k[q.symbol]=n;l.push(p.material);q=p.material;n++}i=q||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});j=j.mesh.geometry3js;if(1<n){i=new THREE.MeshFaceMaterial;j.materials=
 l;for(h=0;h<j.faces.length;h++)l=j.faces[h],l.materialIndex=k[l.daeMaterial]}if(void 0!==c)e(j,c),i.morphTargets=!0,i=new THREE.SkinnedMesh(j,i),i.skeleton=c.skeleton,i.skinController=za[c.url],i.skinInstanceController=c,i.name="skin_"+Za.length,Za.push(i);else if(void 0!==d){h=j;k=d instanceof o?za[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(n=qa[k.targets[l]],n.mesh&&n.mesh.primitives&&n.mesh.primitives.length)n=n.mesh.primitives[0].geometry,
 n.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:n.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}i.morphTargets=!0;i=new THREE.Mesh(j,i);i.name="morph_"+fb.length;fb.push(i)}else i=new THREE.Mesh(j,i);1<a.geometries.length?b.add(i):b=i}}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];Oa.centerGeometry&&b.geometry&&(c=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(c.multiplySelf(b.scale)),
 b.position.subSelf(c));for(g=0;g<a.nodes.length;g++)b.add(f(a.nodes[g],a));return b}function g(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function n(){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 q(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function u(){this.material="";this.count=
+[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function q(){this.type=this.sid="";this.data=[];this.obj=null}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function p(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function s(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 x(){this.source="";this.stride=this.count=0;this.params=[]}function w(){this.input={}}function A(){this.semantic="";this.offset=0;this.source="";this.set=0}function D(a){this.id=a;this.type=null}function B(){this.name=this.id="";this.instance_effect=null}function C(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}
 function F(a,b){this.type=a;this.effect=b;this.material=null}function K(a){this.effect=a;this.format=this.init_from=null}function L(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function T(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function M(){this.url=""}function G(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function j(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=
 this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function Q(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 I(a){this.targets=[];this.time=a}function R(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function y(a){for(var a=P(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function E(a){for(var a=P(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],
 10));return b}function P(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function $(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function Z(a,b){if(Oa.convertUpAxis&&Ka!==Oa.upAxis)switch(xa){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 ga(a,b){var c=[a[b],a[b+1],a[b+2]];Z(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function fa(a){if(Oa.convertUpAxis){var b=[a[0],a[4],a[8]];Z(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];Z(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];Z(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];Z(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];Z(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];Z(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];
-Z(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var S=null,aa=null,ba,ca=null,ha={},Na={},ja={},za={},qa={},Ga={},Ea={},Sa,Ta,Wa,fb,Za,lb=THREE.SmoothShading,Oa={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Ka="Y",xa=null,Sb=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=
+Z(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var S=null,aa=null,ba,ca=null,ha={},Na={},ja={},za={},qa={},Ga={},Ea={},Sa,Ta,Wa,fb,Za,kb=THREE.SmoothShading,Oa={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Ka="Y",xa=null,Rb=Math.PI/180;g.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("init_from"==c.nodeName)this.init_from=
 c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new l).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
 0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new D).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new A).parse(d))}}return b};
 l.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=y(f.textContent);this.bindShapeMatrix=fa(f);break;case "source":f=(new D).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,
@@ -623,15 +623,15 @@ k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var
 d=c.target.split("/");d.shift();var e=d.shift(),f=0<=e.indexOf("."),g=0<=e.indexOf("("),h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};n.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};n.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};n.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};n.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type="JOINT"==this.type?this.type:
 "NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],1==b.nodeType)switch(b.nodeName){case "node":this.nodes.push((new n).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 m).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,
-"");(b=S.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",S,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new n).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 ja)for(var e=ja[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(),
+"");(b=S.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",S,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new n).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new q).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in ja)for(var e=ja[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),
 g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(Oa.convertUpAxis)switch(g){case "X":switch(xa){case "XtoY":case "XtoZ":case "YtoX":g="Y";break;case "ZtoX":g="Z"}break;case "Y":switch(xa){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(xa){case "XtoZ":g=
-"X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){-1===a.indexOf(f)&&a.push(f);b=0;for(var k=i.length;b<k;b++){var l=i[b],q=h.getData(j.type,b),r;r=null;for(var s=0,t=d.length;s<t&&null==r;s++){var u=d[s];if(u.time===l)r=u;else if(u.time>l)break}if(!r){r=new I(l);s=-1;t=0;for(u=d.length;t<u&&-1==s;t++)d[t].time>=l&&(s=t);l=s;d.splice(-1==l?d.length:l,0,r)}r.addTarget(f,j,g,q)}}else console.log('Could not find transform "'+b.sid+'" in node '+
-this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(r=d[b],!r.hasTarget(e)){h=d;f=r;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;q=void 0;if(k.length){q=[];for(l=0;l<k.length;++l)q[l]=k[l]+(j[l]-k[l])*h}else q=k+(j-k)*h;f.addTarget(g,i.transform,i.member,q)}}}this.keys=
-d;this.sids=a}this.updateMatrix();return this};n.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=y(a.textContent);this.convert();return this};p.prototype.convert=function(){switch(this.type){case "matrix":this.obj=fa(this.data);break;case "rotate":this.angle=this.data[3]*Sb;case "translate":Z(this.data,-1);this.obj=new THREE.Vector3(this.data[0],
-this.data[1],this.data[2]);break;case "scale":Z(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*Sb;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*Sb}}};o.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=
-[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=S.evaluate(".//dae:instance_material",c,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new q).parse(d)),d=c.iterateNext()}}return this};q.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,
-"");return this};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType&&"bind_material"==c.nodeName){if(a=S.evaluate(".//dae:instance_material",c,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new q).parse(b)),b=a.iterateNext();break}}return this};r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<
+"X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){-1===a.indexOf(f)&&a.push(f);b=0;for(var k=i.length;b<k;b++){var l=i[b],p=h.getData(j.type,b),r;r=null;for(var s=0,t=d.length;s<t&&null==r;s++){var u=d[s];if(u.time===l)r=u;else if(u.time>l)break}if(!r){r=new I(l);s=-1;t=0;for(u=d.length;t<u&&-1==s;t++)d[t].time>=l&&(s=t);l=s;d.splice(-1==l?d.length:l,0,r)}r.addTarget(f,j,g,p)}}else console.log('Could not find transform "'+b.sid+'" in node '+
+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(r=d[b],!r.hasTarget(e)){h=d;f=r;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;p=void 0;if(k.length){p=[];for(l=0;l<k.length;++l)p[l]=k[l]+(j[l]-k[l])*h}else p=k+(j-k)*h;f.addTarget(g,i.transform,i.member,p)}}}this.keys=
+d;this.sids=a}this.updateMatrix();return this};n.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};q.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=y(a.textContent);this.convert();return this};q.prototype.convert=function(){switch(this.type){case "matrix":this.obj=fa(this.data);break;case "rotate":this.angle=this.data[3]*Rb;case "translate":Z(this.data,-1);this.obj=new THREE.Vector3(this.data[0],
+this.data[1],this.data[2]);break;case "scale":Z(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)}};q.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)}};q.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*Rb;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*Rb}}};o.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=
+[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=S.evaluate(".//dae:instance_material",c,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new p).parse(d)),d=c.iterateNext()}}return this};p.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,
+"");return this};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType&&"bind_material"==c.nodeName){if(a=S.evaluate(".//dae:instance_material",c,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new p).parse(b)),b=a.iterateNext();break}}return this};r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<
 a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new s(this)).parse(c)}}return this};s.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "source":var d=c.getAttribute("id");void 0==ha[d]&&(ha[d]=(new D(d)).parse(c));break;case "vertices":this.vertices=(new w).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=ha[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(ga(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};s.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,l=0,m=3,n=[];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=ha[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(ga(k.data,j));break;case "TEXCOORD":void 0===q[h.set]&&(q[h.set]=
@@ -646,7 +646,7 @@ C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.chi
 a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};F.prototype.parse=
 function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=S.evaluate(".//dae:float",c,R,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();
 return this};F.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=Na[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(Wa+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,
-e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else"diffuse"==c?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=lb;return this.material=new THREE.MeshLambertMaterial(a)};K.prototype.parse=function(a){for(var b=0;b<
+e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else"diffuse"==c?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=kb;return this.material=new THREE.MeshLambertMaterial(a)};K.prototype.parse=function(a){for(var b=0;b<
 a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};L.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=
 c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};T.prototype.create=function(){if(null==this.shader)return null};T.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
 T.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=(new K(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new L(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};T.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
@@ -657,26 +657,26 @@ Q.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.i
 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}};Q.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":Z(c,-1);break;case "scale":Z(c,1)}}else c=this.output[b];return c};I.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,
 member:c,transform:b,data:d})};I.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)}};I.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};I.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};I.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=
 this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(a.time-this.time),g=e.data,h=d.data;if(0>f||1<f)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=0>f?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=
-function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(ca=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==f.readyState&&d&&(0==e&&(e=f.getResponseHeader("Content-Length")),d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){lb=a},applySkin:e,geometries:qa,options:Oa}};
+function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(ca=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else 3==f.readyState&&d&&(0==e&&(e=f.getResponseHeader("Content-Length")),d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){kb=a},applySkin:e,geometries:qa,options:Oa}};
 THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a,b,c){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 f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(4==f.readyState)if(200==f.status||0==f.status){try{var h=JSON.parse(f.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+"] ["+f.status+"]");else 3==f.readyState?e&&(0==g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):
 2==f.readyState&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(void 0===a.metadata||void 0===a.metadata.formatVersion||3!==a.metadata.formatVersion)console.error("Deprecated file format.");else{var c,e,i,l,k,n,p,o,q,m,r,s,t,u,x=a.faces;n=a.vertices;var w=a.normals,A=a.colors,D=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&D++;for(c=0;c<D;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(k=n.length;l<
-k;)p=new THREE.Vertex,p.position.x=n[l++]*b,p.position.y=n[l++]*b,p.position.z=n[l++]*b,d.vertices.push(p);l=0;for(k=x.length;l<k;){b=x[l++];n=b&1;i=b&2;c=b&4;e=b&8;o=b&16;p=b&32;m=b&64;b&=128;n?(r=new THREE.Face4,r.a=x[l++],r.b=x[l++],r.c=x[l++],r.d=x[l++],n=4):(r=new THREE.Face3,r.a=x[l++],r.b=x[l++],r.c=x[l++],n=3);if(i)i=x[l++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<D;c++)s=a.uvs[c],q=x[l++],u=s[2*q],q=s[2*q+1],d.faceUvs[c][i]=new THREE.UV(u,q);if(e)for(c=0;c<D;c++){s=a.uvs[c];t=[];
-for(e=0;e<n;e++)q=x[l++],u=s[2*q],q=s[2*q+1],t[e]=new THREE.UV(u,q);d.faceVertexUvs[c][i]=t}if(o)o=3*x[l++],e=new THREE.Vector3,e.x=w[o++],e.y=w[o++],e.z=w[o],r.normal=e;if(p)for(c=0;c<n;c++)o=3*x[l++],e=new THREE.Vector3,e.x=w[o++],e.y=w[o++],e.z=w[o],r.vertexNormals.push(e);if(m)p=x[l++],p=new THREE.Color(A[p]),r.color=p;if(b)for(c=0;c<n;c++)p=x[l++],p=new THREE.Color(A[p]),r.vertexColors.push(p);d.faces.push(r)}}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=
-2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,e,i,l,k,n,p,o,q;for(c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;
-q=a.morphTargets[c].vertices;for(i=0,l=q.length;i<l;i+=3)k=q[i]*b,n=q[i+1]*b,p=q[i+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(k,n,p)))}}if(void 0!==a.morphColors)for(c=0,e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;k=a.morphColors[c].colors;for(b=0,i=k.length;b<i;b+=3)n=new THREE.Color(16755200),n.setRGB(k[b],k[b+1],k[b+2]),l.push(n)}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(void 0===a.metadata||void 0===a.metadata.formatVersion||3!==a.metadata.formatVersion)console.error("Deprecated file format.");else{var c,e,i,l,k,n,q,o,p,m,r,s,t,u,x=a.faces;n=a.vertices;var w=a.normals,A=a.colors,D=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&D++;for(c=0;c<D;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(k=n.length;l<
+k;)q=new THREE.Vertex,q.position.x=n[l++]*b,q.position.y=n[l++]*b,q.position.z=n[l++]*b,d.vertices.push(q);l=0;for(k=x.length;l<k;){b=x[l++];n=b&1;i=b&2;c=b&4;e=b&8;o=b&16;q=b&32;m=b&64;b&=128;n?(r=new THREE.Face4,r.a=x[l++],r.b=x[l++],r.c=x[l++],r.d=x[l++],n=4):(r=new THREE.Face3,r.a=x[l++],r.b=x[l++],r.c=x[l++],n=3);if(i)i=x[l++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<D;c++)s=a.uvs[c],p=x[l++],u=s[2*p],p=s[2*p+1],d.faceUvs[c][i]=new THREE.UV(u,p);if(e)for(c=0;c<D;c++){s=a.uvs[c];t=[];
+for(e=0;e<n;e++)p=x[l++],u=s[2*p],p=s[2*p+1],t[e]=new THREE.UV(u,p);d.faceVertexUvs[c][i]=t}if(o)o=3*x[l++],e=new THREE.Vector3,e.x=w[o++],e.y=w[o++],e.z=w[o],r.normal=e;if(q)for(c=0;c<n;c++)o=3*x[l++],e=new THREE.Vector3,e.x=w[o++],e.y=w[o++],e.z=w[o],r.vertexNormals.push(e);if(m)q=x[l++],q=new THREE.Color(A[q]),r.color=q;if(b)for(c=0;c<n;c++)q=x[l++],q=new THREE.Color(A[q]),r.vertexColors.push(q);d.faces.push(r)}}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=
+2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,e,i,l,k,n,q,o,p;for(c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;
+p=a.morphTargets[c].vertices;for(i=0,l=p.length;i<l;i+=3)k=p[i]*b,n=p[i+1]*b,q=p[i+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(k,n,q)))}}if(void 0!==a.morphColors)for(c=0,e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;k=a.morphColors[c].colors;for(b=0,i=k.length;b<i;b+=3)n=new THREE.Color(16755200),n.setRGB(k[b],k[b+1],k[b+2]),l.push(n)}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
 d.computeTangents();b(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status||0==d.status)try{var e=JSON.parse(d.responseText);void 0===e.metadata||void 0===e.metadata.formatVersion||3!==e.metadata.formatVersion?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(f){console.error(f),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
 d.open("GET",a,!0);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
-THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:l+"/"+a}function e(){var a;for(p in M.objects)if(!y.objects[p])if(s=M.objects[p],void 0!==s.geometry){if(F=y.geometries[s.geometry]){a=!1;for(E=0;E<s.materials.length;E++)T=y.materials[s.materials[E]],a=T instanceof THREE.ShaderMaterial;a&&F.computeTangents();x=s.position;w=s.rotation;A=s.quaternion;D=s.scale;A=0;0==T.length&&(T=new THREE.MeshFaceMaterial);1<T.length&&(T=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(F,T);a.name=p;a.position.set(x[0],x[1],x[2]);A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]);a.scale.set(D[0],D[1],D[2]);a.visible=s.visible;y.scene.add(a);y.objects[p]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);y.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(F),y.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&"none"!=s.trigger.toLowerCase()&&(b=
-{type:s.trigger,object:s},y.triggers[a.name]=b)}}else x=s.position,w=s.rotation,A=s.quaternion,D=s.scale,A=0,a=new THREE.Object3D,a.name=p,a.position.set(x[0],x[1],x[2]),A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]),a.scale.set(D[0],D[1],D[2]),a.visible=void 0!==s.visible?s.visible:!1,y.scene.add(a),y.objects[p]=a,y.empties[p]=a,s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},y.triggers[a.name]=b)}function f(a){return function(b){y.geometries[a]=
-b;e();j-=1;i.onLoadComplete();h()}}function g(a){return function(b){y.geometries[a]=b}}function h(){i.callbackProgress({totalModels:I,totalTextures:R,loadedModels:I-j,loadedTextures:R-Q},y);i.onLoadProgress();0==j&&0==Q&&b(y)}var i=this,l=THREE.Loader.prototype.extractUrlbase(c),k,n,p,o,q,m,r,s,t,u,x,w,A,D,B,C,F,K,L,T,M,G,j,Q,I,R,y;M=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;Q=j=0;y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
-empties:{}};a=!1;for(p in M.objects)if(s=M.objects[p],s.meshCollider){a=!0;break}if(a)y.scene.collisions=new THREE.CollisionSystem;if(M.transform)a=M.transform.position,t=M.transform.rotation,B=M.transform.scale,a&&y.scene.position.set(a[0],a[1],a[2]),t&&y.scene.rotation.set(t[0],t[1],t[2]),B&&y.scene.scale.set(B[0],B[1],B[2]),(a||t||B)&&y.scene.updateMatrix();a=function(){Q-=1;h();i.onLoadComplete()};for(q in M.cameras)B=M.cameras[q],"perspective"==B.type?K=new THREE.PerspectiveCamera(B.fov,B.aspect,
-B.near,B.far):"ortho"==B.type&&(K=new THREE.OrthographicCamera(B.left,B.right,B.top,B.bottom,B.near,B.far)),x=B.position,t=B.target,B=B.up,K.position.set(x[0],x[1],x[2]),K.target=new THREE.Vector3(t[0],t[1],t[2]),B&&K.up.set(B[0],B[1],B[2]),y.cameras[q]=K;for(o in M.lights)t=M.lights[o],q=void 0!==t.color?t.color:16777215,K=void 0!==t.intensity?t.intensity:1,"directional"==t.type?(x=t.direction,u=new THREE.DirectionalLight(q,K),u.position.set(x[0],x[1],x[2]),u.position.normalize()):"point"==t.type?
-(x=t.position,u=t.distance,u=new THREE.PointLight(q,K,u),u.position.set(x[0],x[1],x[2])):"ambient"==t.type&&(u=new THREE.AmbientLight(q)),y.scene.add(u),y.lights[o]=u;for(m in M.fogs)o=M.fogs[m],"linear"==o.type?L=new THREE.Fog(0,o.near,o.far):"exp2"==o.type&&(L=new THREE.FogExp2(0,o.density)),B=o.color,L.color.setRGB(B[0],B[1],B[2]),y.fogs[m]=L;if(y.cameras&&M.defaults.camera)y.currentCamera=y.cameras[M.defaults.camera];if(y.fogs&&M.defaults.fog)y.scene.fog=y.fogs[M.defaults.fog];B=M.defaults.bgcolor;
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:l+"/"+a}function e(){var a;for(q in M.objects)if(!y.objects[q])if(s=M.objects[q],void 0!==s.geometry){if(F=y.geometries[s.geometry]){a=!1;for(E=0;E<s.materials.length;E++)T=y.materials[s.materials[E]],a=T instanceof THREE.ShaderMaterial;a&&F.computeTangents();x=s.position;w=s.rotation;A=s.quaternion;D=s.scale;A=0;0==T.length&&(T=new THREE.MeshFaceMaterial);1<T.length&&(T=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(F,T);a.name=q;a.position.set(x[0],x[1],x[2]);A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]);a.scale.set(D[0],D[1],D[2]);a.visible=s.visible;y.scene.add(a);y.objects[q]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);y.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(F),y.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&"none"!=s.trigger.toLowerCase()&&(b=
+{type:s.trigger,object:s},y.triggers[a.name]=b)}}else x=s.position,w=s.rotation,A=s.quaternion,D=s.scale,A=0,a=new THREE.Object3D,a.name=q,a.position.set(x[0],x[1],x[2]),A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]),a.scale.set(D[0],D[1],D[2]),a.visible=void 0!==s.visible?s.visible:!1,y.scene.add(a),y.objects[q]=a,y.empties[q]=a,s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},y.triggers[a.name]=b)}function f(a){return function(b){y.geometries[a]=
+b;e();j-=1;i.onLoadComplete();h()}}function g(a){return function(b){y.geometries[a]=b}}function h(){i.callbackProgress({totalModels:I,totalTextures:R,loadedModels:I-j,loadedTextures:R-Q},y);i.onLoadProgress();0==j&&0==Q&&b(y)}var i=this,l=THREE.Loader.prototype.extractUrlbase(c),k,n,q,o,p,m,r,s,t,u,x,w,A,D,B,C,F,K,L,T,M,G,j,Q,I,R,y;M=a;c=new THREE.BinaryLoader;G=new THREE.JSONLoader;Q=j=0;y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+empties:{}};a=!1;for(q in M.objects)if(s=M.objects[q],s.meshCollider){a=!0;break}if(a)y.scene.collisions=new THREE.CollisionSystem;if(M.transform)a=M.transform.position,t=M.transform.rotation,B=M.transform.scale,a&&y.scene.position.set(a[0],a[1],a[2]),t&&y.scene.rotation.set(t[0],t[1],t[2]),B&&y.scene.scale.set(B[0],B[1],B[2]),(a||t||B)&&y.scene.updateMatrix();a=function(){Q-=1;h();i.onLoadComplete()};for(p in M.cameras)B=M.cameras[p],"perspective"==B.type?K=new THREE.PerspectiveCamera(B.fov,B.aspect,
+B.near,B.far):"ortho"==B.type&&(K=new THREE.OrthographicCamera(B.left,B.right,B.top,B.bottom,B.near,B.far)),x=B.position,t=B.target,B=B.up,K.position.set(x[0],x[1],x[2]),K.target=new THREE.Vector3(t[0],t[1],t[2]),B&&K.up.set(B[0],B[1],B[2]),y.cameras[p]=K;for(o in M.lights)t=M.lights[o],p=void 0!==t.color?t.color:16777215,K=void 0!==t.intensity?t.intensity:1,"directional"==t.type?(x=t.direction,u=new THREE.DirectionalLight(p,K),u.position.set(x[0],x[1],x[2]),u.position.normalize()):"point"==t.type?
+(x=t.position,u=t.distance,u=new THREE.PointLight(p,K,u),u.position.set(x[0],x[1],x[2])):"ambient"==t.type&&(u=new THREE.AmbientLight(p)),y.scene.add(u),y.lights[o]=u;for(m in M.fogs)o=M.fogs[m],"linear"==o.type?L=new THREE.Fog(0,o.near,o.far):"exp2"==o.type&&(L=new THREE.FogExp2(0,o.density)),B=o.color,L.color.setRGB(B[0],B[1],B[2]),y.fogs[m]=L;if(y.cameras&&M.defaults.camera)y.currentCamera=y.cameras[M.defaults.camera];if(y.fogs&&M.defaults.fog)y.scene.fog=y.fogs[M.defaults.fog];B=M.defaults.bgcolor;
 y.bgColor=new THREE.Color;y.bgColor.setRGB(B[0],B[1],B[2]);y.bgColorAlpha=M.defaults.bgalpha;for(k in M.geometries)if(m=M.geometries[k],"bin_mesh"==m.type||"ascii_mesh"==m.type)j+=1,i.onLoadStart();I=j;for(k in M.geometries)m=M.geometries[k],"cube"==m.type?(F=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),y.geometries[k]=F):"plane"==m.type?(F=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),y.geometries[k]=
 F):"sphere"==m.type?(F=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),y.geometries[k]=F):"cylinder"==m.type?(F=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),y.geometries[k]=F):"torus"==m.type?(F=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),y.geometries[k]=F):"icosahedron"==m.type?(F=new THREE.IcosahedronGeometry(m.subdivisions),y.geometries[k]=F):"bin_mesh"==m.type?c.load(d(m.url,M.urlBaseType),f(k)):"ascii_mesh"==m.type?G.load(d(m.url,
 M.urlBaseType),f(k)):"embedded_mesh"==m.type&&(m=M.embeds[m.id])&&G.createModel(m,g(k),"");for(r in M.textures)if(k=M.textures[r],k.url instanceof Array){Q+=k.url.length;for(m=0;m<k.url.length;m++)i.onLoadStart()}else Q+=1,i.onLoadStart();R=Q;for(r in M.textures){k=M.textures[r];if(void 0!=k.mapping&&void 0!=THREE[k.mapping])k.mapping=new THREE[k.mapping];if(k.url instanceof Array){m=[];for(var E=0;E<k.url.length;E++)m[E]=d(k.url[E],M.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=
@@ -695,16 +695,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(3*this.size3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=0;this.hasNormal=
 this.hasPos=!1;this.positionArray=new Float32Array(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,f,g,h,i,l,k,n){g=(g-k)/(n-k);k=this.normal_cache;b[f]=h+g*this.delta;b[f+1]=i;b[f+2]=l;e[f]=this.lerp(k[a],k[a+3],g);e[f+1]=this.lerp(k[a+1],k[a+4],g);e[f+2]=this.lerp(k[a+2],k[a+5],g)};this.VIntY=function(a,b,e,f,g,h,i,l,k,n){g=(g-k)/(n-k);k=this.normal_cache;b[f]=h;b[f+1]=i+g*this.delta;b[f+2]=l;b=a+3*this.yd;
 e[f]=this.lerp(k[a],k[b],g);e[f+1]=this.lerp(k[a+1],k[b+1],g);e[f+2]=this.lerp(k[a+2],k[b+2],g)};this.VIntZ=function(a,b,e,f,g,h,i,l,k,n){g=(g-k)/(n-k);k=this.normal_cache;b[f]=h;b[f+1]=i;b[f+2]=l+g*this.delta;b=a+3*this.zd;e[f]=this.lerp(k[a],k[b],g);e[f+1]=this.lerp(k[a+1],k[b+1],g);e[f+2]=this.lerp(k[a+2],k[b+2],g)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
-this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,f,g,h){var i=f+1,l=f+this.yd,k=f+this.zd,n=i+this.yd,p=i+this.zd,o=f+this.yd+this.zd,q=i+this.yd+this.zd,m=0,r=this.field[f],s=this.field[i],t=this.field[l],u=this.field[n],x=this.field[k],w=this.field[p],A=this.field[o],D=this.field[q];r<g&&(m|=1);s<g&&(m|=2);t<g&&(m|=8);u<g&&(m|=4);x<g&&(m|=16);w<g&&(m|=32);A<g&&(m|=128);D<g&&(m|=64);var B=THREE.edgeTable[m];if(0===B)return 0;var C=this.delta,F=a+
-C,K=b+C,C=e+C;B&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(3*f,this.vlist,this.nlist,0,g,a,b,e,r,s));B&2&&(this.compNorm(i),this.compNorm(n),this.VIntY(3*i,this.vlist,this.nlist,3,g,F,b,e,s,u));B&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(3*l,this.vlist,this.nlist,6,g,a,K,e,t,u));B&8&&(this.compNorm(f),this.compNorm(l),this.VIntY(3*f,this.vlist,this.nlist,9,g,a,b,e,r,t));B&16&&(this.compNorm(k),this.compNorm(p),this.VIntX(3*k,this.vlist,this.nlist,12,g,a,b,C,x,w));B&32&&(this.compNorm(p),
-this.compNorm(q),this.VIntY(3*p,this.vlist,this.nlist,15,g,F,b,C,w,D));B&64&&(this.compNorm(o),this.compNorm(q),this.VIntX(3*o,this.vlist,this.nlist,18,g,a,K,C,A,D));B&128&&(this.compNorm(k),this.compNorm(o),this.VIntY(3*k,this.vlist,this.nlist,21,g,a,b,C,x,A));B&256&&(this.compNorm(f),this.compNorm(k),this.VIntZ(3*f,this.vlist,this.nlist,24,g,a,b,e,r,x));B&512&&(this.compNorm(i),this.compNorm(p),this.VIntZ(3*i,this.vlist,this.nlist,27,g,F,b,e,s,w));B&1024&&(this.compNorm(n),this.compNorm(q),this.VIntZ(3*
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,f,g,h){var i=f+1,l=f+this.yd,k=f+this.zd,n=i+this.yd,q=i+this.zd,o=f+this.yd+this.zd,p=i+this.yd+this.zd,m=0,r=this.field[f],s=this.field[i],t=this.field[l],u=this.field[n],x=this.field[k],w=this.field[q],A=this.field[o],D=this.field[p];r<g&&(m|=1);s<g&&(m|=2);t<g&&(m|=8);u<g&&(m|=4);x<g&&(m|=16);w<g&&(m|=32);A<g&&(m|=128);D<g&&(m|=64);var B=THREE.edgeTable[m];if(0===B)return 0;var C=this.delta,F=a+
+C,K=b+C,C=e+C;B&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(3*f,this.vlist,this.nlist,0,g,a,b,e,r,s));B&2&&(this.compNorm(i),this.compNorm(n),this.VIntY(3*i,this.vlist,this.nlist,3,g,F,b,e,s,u));B&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(3*l,this.vlist,this.nlist,6,g,a,K,e,t,u));B&8&&(this.compNorm(f),this.compNorm(l),this.VIntY(3*f,this.vlist,this.nlist,9,g,a,b,e,r,t));B&16&&(this.compNorm(k),this.compNorm(q),this.VIntX(3*k,this.vlist,this.nlist,12,g,a,b,C,x,w));B&32&&(this.compNorm(q),
+this.compNorm(p),this.VIntY(3*q,this.vlist,this.nlist,15,g,F,b,C,w,D));B&64&&(this.compNorm(o),this.compNorm(p),this.VIntX(3*o,this.vlist,this.nlist,18,g,a,K,C,A,D));B&128&&(this.compNorm(k),this.compNorm(o),this.VIntY(3*k,this.vlist,this.nlist,21,g,a,b,C,x,A));B&256&&(this.compNorm(f),this.compNorm(k),this.VIntZ(3*f,this.vlist,this.nlist,24,g,a,b,e,r,x));B&512&&(this.compNorm(i),this.compNorm(q),this.VIntZ(3*i,this.vlist,this.nlist,27,g,F,b,e,s,w));B&1024&&(this.compNorm(n),this.compNorm(p),this.VIntZ(3*
 n,this.vlist,this.nlist,30,g,F,K,e,u,D));B&2048&&(this.compNorm(l),this.compNorm(o),this.VIntZ(3*l,this.vlist,this.nlist,33,g,a,K,e,t,A));m<<=4;for(g=f=0;-1!=THREE.triTable[m+g];)a=m+g,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),g+=3,f++;return f};this.posnormtriv=function(a,b,e,f,g,h){var i=3*this.count;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[f];this.positionArray[i+
 4]=a[f+1];this.positionArray[i+5]=a[f+2];this.positionArray[i+6]=a[g];this.positionArray[i+7]=a[g+1];this.positionArray[i+8]=a[g+2];this.normalArray[i]=b[e];this.normalArray[i+1]=b[e+1];this.normalArray[i+2]=b[e+2];this.normalArray[i+3]=b[f];this.normalArray[i+4]=b[f+1];this.normalArray[i+5]=b[f+2];this.normalArray[i+6]=b[g];this.normalArray[i+7]=b[g+1];this.normalArray[i+8]=b[g+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,f,g){var h=this.size*Math.sqrt(f/g),i=e*this.size,l=b*this.size,k=a*this.size,n=Math.floor(i-h);1>n&&(n=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var p=Math.floor(l-h);1>p&&(p=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var o=Math.floor(k-h);1>o&&(o=1);h=Math.floor(k+h);h>this.size-1&&(h=this.size-
-1);for(var q,m,r,s,t,u,x,k=n;k<i;k++){r=this.size2*k;t=k/this.size-e;u=t*t;for(n=p;n<l;n++){m=r+this.size*n;q=n/this.size-b;x=q*q;for(q=o;q<h;q++)s=q/this.size-a,s=f/(1.0E-6+s*s+x+u)-g,0<s&&(this.field[m+q]+=s)}}};this.addPlaneX=function(a,b){var e,f,g,h,i,l=this.size,k=this.yd,n=this.zd,p=this.field,o=l*Math.sqrt(a/b);o>l&&(o=l);for(e=0;e<o;e++)if(f=e/l,f*=f,h=a/(1.0E-4+f)-b,0<h)for(f=0;f<l;f++){i=e+f*k;for(g=0;g<l;g++)p[n*g+i]+=h}};this.addPlaneY=function(a,b){var e,f,g,h,i,l,k=this.size,n=this.yd,
-p=this.zd,o=this.field,q=k*Math.sqrt(a/b);q>k&&(q=k);for(f=0;f<q;f++)if(e=f/k,e*=e,h=a/(1.0E-4+e)-b,0<h){i=f*n;for(e=0;e<k;e++){l=i+e;for(g=0;g<k;g++)o[p*g+l]+=h}}};this.addPlaneZ=function(a,b){var e,f,g,h,i,l,k=this.size,n=this.yd,p=this.zd,o=this.field,q=k*Math.sqrt(a/b);q>k&&(q=k);for(g=0;g<q;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-b,0<h){i=p*g;for(f=0;f<k;f++){l=i+f*n;for(e=0;e<k;e++)o[l+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
-function(a){this.begin();var b,e,f,g,h,i,l,k,n,p=this.size-2;for(g=1;g<p;g++){n=this.size2*g;l=(g-this.halfsize)/this.halfsize;for(f=1;f<p;f++){k=n+this.size*f;i=(f-this.halfsize)/this.halfsize;for(e=1;e<p;e++)h=(e-this.halfsize)/this.halfsize,b=k+e,this.polygonize(h,i,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(f){var g,h,i,l,k,n,p,o;for(g=0;g<f.count;g++)p=3*g,k=p+1,o=p+2,h=f.positionArray[p],i=f.positionArray[k],l=
-f.positionArray[o],n=new THREE.Vector3(h,i,l),h=f.normalArray[p],i=f.normalArray[k],l=f.normalArray[o],p=new THREE.Vector3(h,i,l),p.normalize(),k=new THREE.Vertex(n),b.vertices.push(k),e.push(p);n=f.count/3;for(g=0;g<n;g++)p=3*(a+g),k=p+1,o=p+2,h=e[p],i=e[k],l=e[o],p=new THREE.Face3(p,k,o,[h,i,l]),b.faces.push(p);a+=n;f.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(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,f,g){var h=this.size*Math.sqrt(f/g),i=e*this.size,l=b*this.size,k=a*this.size,n=Math.floor(i-h);1>n&&(n=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var q=Math.floor(l-h);1>q&&(q=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var o=Math.floor(k-h);1>o&&(o=1);h=Math.floor(k+h);h>this.size-1&&(h=this.size-
+1);for(var p,m,r,s,t,u,x,k=n;k<i;k++){r=this.size2*k;t=k/this.size-e;u=t*t;for(n=q;n<l;n++){m=r+this.size*n;p=n/this.size-b;x=p*p;for(p=o;p<h;p++)s=p/this.size-a,s=f/(1.0E-6+s*s+x+u)-g,0<s&&(this.field[m+p]+=s)}}};this.addPlaneX=function(a,b){var e,f,g,h,i,l=this.size,k=this.yd,n=this.zd,q=this.field,o=l*Math.sqrt(a/b);o>l&&(o=l);for(e=0;e<o;e++)if(f=e/l,f*=f,h=a/(1.0E-4+f)-b,0<h)for(f=0;f<l;f++){i=e+f*k;for(g=0;g<l;g++)q[n*g+i]+=h}};this.addPlaneY=function(a,b){var e,f,g,h,i,l,k=this.size,n=this.yd,
+q=this.zd,o=this.field,p=k*Math.sqrt(a/b);p>k&&(p=k);for(f=0;f<p;f++)if(e=f/k,e*=e,h=a/(1.0E-4+e)-b,0<h){i=f*n;for(e=0;e<k;e++){l=i+e;for(g=0;g<k;g++)o[q*g+l]+=h}}};this.addPlaneZ=function(a,b){var e,f,g,h,i,l,k=this.size,n=this.yd,q=this.zd,o=this.field,p=k*Math.sqrt(a/b);p>k&&(p=k);for(g=0;g<p;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-b,0<h){i=q*g;for(f=0;f<k;f++){l=i+f*n;for(e=0;e<k;e++)o[l+e]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
+function(a){this.begin();var b,e,f,g,h,i,l,k,n,q=this.size-2;for(g=1;g<q;g++){n=this.size2*g;l=(g-this.halfsize)/this.halfsize;for(f=1;f<q;f++){k=n+this.size*f;i=(f-this.halfsize)/this.halfsize;for(e=1;e<q;e++)h=(e-this.halfsize)/this.halfsize,b=k+e,this.polygonize(h,i,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(f){var g,h,i,l,k,n,q,o;for(g=0;g<f.count;g++)q=3*g,k=q+1,o=q+2,h=f.positionArray[q],i=f.positionArray[k],l=
+f.positionArray[o],n=new THREE.Vector3(h,i,l),h=f.normalArray[q],i=f.normalArray[k],l=f.normalArray[o],q=new THREE.Vector3(h,i,l),q.normalize(),k=new THREE.Vertex(n),b.vertices.push(k),e.push(q);n=f.count/3;for(g=0;g<n;g++)q=3*(a+g),k=q+1,o=q+2,h=e[q],i=e[k],l=e[o],q=new THREE.Face3(q,k,o,[h,i,l]),b.faces.push(q);a+=n;f.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -731,33 +731,33 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;
 THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
 THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,i,l,k,n,p,o;this.init=function(q){b=q.context;c=q;d=new Float32Array(16);e=new Uint16Array(6);q=0;d[q++]=-1;d[q++]=-1;d[q++]=0;d[q++]=0;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=
-0;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=0;d[q++]=1;q=0;e[q++]=0;e[q++]=1;e[q++]=2;e[q++]=0;e[q++]=2;e[q++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,f,g,h,i,l,k,n,q,o;this.init=function(p){b=p.context;c=p;d=new Float32Array(16);e=new Uint16Array(6);p=0;d[p++]=-1;d[p++]=-1;d[p++]=0;d[p++]=0;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]=
+0;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]=0;d[p++]=1;p=0;e[p++]=0;e[p++]=1;e[p++]=2;e[p++]=0;e[p++]=2;e[p++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
 b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(l=!1,k=a(THREE.ShaderFlares.lensFlare)):(l=!0,k=a(THREE.ShaderFlares.lensFlareVertexTexture));n={};p={};n.vertex=b.getAttribLocation(k,"position");n.uv=b.getAttribLocation(k,"uv");p.renderType=b.getUniformLocation(k,"renderType");p.map=b.getUniformLocation(k,"map");p.occlusionMap=b.getUniformLocation(k,"occlusionMap");p.opacity=b.getUniformLocation(k,"opacity");p.color=b.getUniformLocation(k,
-"color");p.scale=b.getUniformLocation(k,"scale");p.rotation=b.getUniformLocation(k,"rotation");p.screenPosition=b.getUniformLocation(k,"screenPosition");o=!1};this.render=function(a,d,e,s){var a=a.__webglFlares,t=a.length;if(t){var u=new THREE.Vector3,x=s/e,w=0.5*e,A=0.5*s,D=16/s,B=new THREE.Vector2(D*x,D),C=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),K=p,D=n;b.useProgram(k);o||(b.enableVertexAttribArray(n.vertex),b.enableVertexAttribArray(n.uv),o=!0);b.uniform1i(K.occlusionMap,0);b.uniform1i(K.map,
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(l=!1,k=a(THREE.ShaderFlares.lensFlare)):(l=!0,k=a(THREE.ShaderFlares.lensFlareVertexTexture));n={};q={};n.vertex=b.getAttribLocation(k,"position");n.uv=b.getAttribLocation(k,"uv");q.renderType=b.getUniformLocation(k,"renderType");q.map=b.getUniformLocation(k,"map");q.occlusionMap=b.getUniformLocation(k,"occlusionMap");q.opacity=b.getUniformLocation(k,"opacity");q.color=b.getUniformLocation(k,
+"color");q.scale=b.getUniformLocation(k,"scale");q.rotation=b.getUniformLocation(k,"rotation");q.screenPosition=b.getUniformLocation(k,"screenPosition");o=!1};this.render=function(a,d,e,s){var a=a.__webglFlares,t=a.length;if(t){var u=new THREE.Vector3,x=s/e,w=0.5*e,A=0.5*s,D=16/s,B=new THREE.Vector2(D*x,D),C=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),K=q,D=n;b.useProgram(k);o||(b.enableVertexAttribArray(n.vertex),b.enableVertexAttribArray(n.uv),o=!0);b.uniform1i(K.occlusionMap,0);b.uniform1i(K.map,
 1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(D.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(D.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var L,T,M,G,j;for(L=0;L<t;L++)if(D=16/s,B.set(D*x,D),G=a[L],u.set(G.matrixWorld.n14,G.matrixWorld.n24,G.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(u),d.projectionMatrix.multiplyVector3(u),C.copy(u),F.x=C.x*w+w,F.y=C.y*A+A,l||0<F.x&&F.x<e&&0<F.y&&F.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
 h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,F.x-8,F.y-8,16,16,0);b.uniform1i(K.renderType,0);b.uniform2f(K.scale,B.x,B.y);b.uniform3f(K.screenPosition,C.x,C.y,C.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,F.x-8,F.y-8,16,16,0);b.uniform1i(K.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
 6,b.UNSIGNED_SHORT,0);G.positionScreen.copy(C);G.customUpdateCallback?G.customUpdateCallback(G):G.updateLensFlares();b.uniform1i(K.renderType,2);b.enable(b.BLEND);for(T=0,M=G.lensFlares.length;T<M;T++)if(j=G.lensFlares[T],0.0010<j.opacity&&0.0010<j.scale)C.x=j.x,C.y=j.y,C.z=j.z,D=j.size*j.scale/s,B.x=D*x,B.y=D,b.uniform3f(K.screenPosition,C.x,C.y,C.z),b.uniform2f(K.scale,B.x,B.y),b.uniform1f(K.rotation,j.rotation),b.uniform1f(K.opacity,j.opacity),b.uniform3f(K.color,j.color.r,j.color.g,j.color.b),
 c.setBlending(j.blending),c.setTexture(j.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e=new THREE.Frustum,f=new THREE.Matrix4;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(g){var h,i,l,k,n,p,o,q,m,r=g.lights;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(h=0,i=r.length;h<i;h++)if(q=r[h],q.castShadow&&q instanceof THREE.SpotLight){if(!q.shadowMap)q.shadowMap=new THREE.WebGLRenderTarget(q.shadowMapWidth,q.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),q.shadowMapSize=new THREE.Vector2(q.shadowMapWidth,q.shadowMapHeight),
-q.shadowCamera=new THREE.PerspectiveCamera(q.shadowCameraFov,q.shadowMapWidth/q.shadowMapHeight,q.shadowCameraNear,q.shadowCameraFar),q.shadowMatrix=new THREE.Matrix4,g.add(q.shadowCamera),b.autoUpdateScene&&g.updateMatrixWorld();if(q.shadowCameraVisible&&!q.cameraHelper)q.cameraHelper=new THREE.CameraHelper(q.shadowCamera),q.shadowCamera.add(q.cameraHelper);l=q.shadowMap;k=q.shadowMatrix;n=q.shadowCamera;n.position.copy(q.matrixWorld.getPosition());n.lookAt(q.target.matrixWorld.getPosition());n.matrixWorldInverse.getInverse(n.matrixWorld);
-if(q.cameraHelper)q.cameraHelper.lines.visible=q.shadowCameraVisible;q.shadowCameraVisible&&q.cameraHelper.update(q.shadowCamera);k.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);k.multiplySelf(n.projectionMatrix);k.multiplySelf(n.matrixWorldInverse);if(!n._viewMatrixArray)n._viewMatrixArray=new Float32Array(16);n.matrixWorldInverse.flattenToArray(n._viewMatrixArray);if(!n._projectionMatrixArray)n._projectionMatrixArray=new Float32Array(16);n.projectionMatrix.flattenToArray(n._projectionMatrixArray);
-f.multiply(n.projectionMatrix,n.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(l);b.clear();m=g.__webglObjects;for(l=0,k=m.length;l<k;l++)if(p=m[l],q=p.object,p.render=!1,q.visible&&q.castShadow&&(!(q instanceof THREE.Mesh)||!q.frustumCulled||e.contains(q)))q.matrixWorld.flattenToArray(q._objectMatrixArray),q._modelViewMatrix.multiplyToArray(n.matrixWorldInverse,q.matrixWorld,q._modelViewMatrixArray),p.render=!0;for(l=0,k=m.length;l<k;l++)if(p=m[l],p.render)q=p.object,p=p.buffer,b.setObjectFaces(q),
-o=q.customDepthMaterial?q.customDepthMaterial:q.geometry.morphTargets.length?d:c,p instanceof THREE.BufferGeometry?b.renderBufferDirect(n,r,null,o,p,q):b.renderBuffer(n,r,null,o,p,q);m=g.__webglObjectsImmediate;for(l=0,k=m.length;l<k;l++)p=m[l],q=p.object,q.visible&&q.castShadow&&(q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),q._modelViewMatrix.multiplyToArray(n.matrixWorldInverse,q.matrixWorld,q._modelViewMatrixArray),b.renderImmediateObject(n,r,null,c,q))}g=b.getClearColor();
-h=b.getClearAlpha();a.clearColor(g.r,g.g,g.b,h);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};
+this.update(a,c)};this.update=function(g){var h,i,l,k,n,q,o,p,m,r=g.lights;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(h=0,i=r.length;h<i;h++)if(p=r[h],p.castShadow){if(!p.shadowMap)p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4;
+if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}g.add(p.shadowCamera);b.autoUpdateScene&&g.updateMatrixWorld()}if(p.shadowCameraVisible&&
+!p.cameraHelper)p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper);l=p.shadowMap;k=p.shadowMatrix;n=p.shadowCamera;n.position.copy(p.matrixWorld.getPosition());n.lookAt(p.target.matrixWorld.getPosition());n.matrixWorldInverse.getInverse(n.matrixWorld);if(p.cameraHelper)p.cameraHelper.lines.visible=p.shadowCameraVisible;p.shadowCameraVisible&&p.cameraHelper.update(p.shadowCamera);k.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);k.multiplySelf(n.projectionMatrix);
+k.multiplySelf(n.matrixWorldInverse);if(!n._viewMatrixArray)n._viewMatrixArray=new Float32Array(16);n.matrixWorldInverse.flattenToArray(n._viewMatrixArray);if(!n._projectionMatrixArray)n._projectionMatrixArray=new Float32Array(16);n.projectionMatrix.flattenToArray(n._projectionMatrixArray);f.multiply(n.projectionMatrix,n.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(l);b.clear();m=g.__webglObjects;for(l=0,k=m.length;l<k;l++)if(q=m[l],p=q.object,q.render=!1,p.visible&&p.castShadow&&(!(p instanceof
+THREE.Mesh)||!p.frustumCulled||e.contains(p)))p.matrixWorld.flattenToArray(p._objectMatrixArray),p._modelViewMatrix.multiplyToArray(n.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),q.render=!0;for(l=0,k=m.length;l<k;l++)if(q=m[l],q.render)p=q.object,q=q.buffer,b.setObjectFaces(p),o=p.customDepthMaterial?p.customDepthMaterial:p.geometry.morphTargets.length?d:c,q instanceof THREE.BufferGeometry?b.renderBufferDirect(n,r,null,o,q,p):b.renderBuffer(n,r,null,o,q,p);m=g.__webglObjectsImmediate;
+for(l=0,k=m.length;l<k;l++)q=m[l],p=q.object,p.visible&&p.castShadow&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),p._modelViewMatrix.multiplyToArray(n.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),b.renderImmediateObject(n,r,null,c,p))}g=b.getClearColor();h=b.getClearAlpha();a.clearColor(g.r,g.g,g.b,h);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};
 THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,f,g,h,i,l,k;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,p=b.createProgram(),o=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(o);b.compileShader(q);b.attachShader(p,o);b.attachShader(p,q);b.linkProgram(p);h=p;i={};l={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");l.uvOffset=b.getUniformLocation(h,"uvOffset");l.uvScale=b.getUniformLocation(h,
+g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,q=b.createProgram(),o=b.createShader(b.FRAGMENT_SHADER),p=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,a.fragmentShader);b.shaderSource(p,a.vertexShader);b.compileShader(o);b.compileShader(p);b.attachShader(q,o);b.attachShader(q,p);b.linkProgram(q);h=q;i={};l={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");l.uvOffset=b.getUniformLocation(h,"uvOffset");l.uvScale=b.getUniformLocation(h,
 "uvScale");l.rotation=b.getUniformLocation(h,"rotation");l.scale=b.getUniformLocation(h,"scale");l.alignment=b.getUniformLocation(h,"alignment");l.color=b.getUniformLocation(h,"color");l.map=b.getUniformLocation(h,"map");l.opacity=b.getUniformLocation(h,"opacity");l.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");l.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");l.screenPosition=b.getUniformLocation(h,"screenPosition");l.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
-l.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=!1};this.render=function(d,e,o,q){var d=d.__webglSprites,m=d.length;if(m){var r=i,s=l,t=q/o,o=0.5*o,u=0.5*q,x=!0;b.useProgram(h);k||(b.enableVertexAttribArray(r.position),b.enableVertexAttribArray(r.uv),k=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(s.projectionMatrix,
+l.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=!1};this.render=function(d,e,o,p){var d=d.__webglSprites,m=d.length;if(m){var r=i,s=l,t=p/o,o=0.5*o,u=0.5*p,x=!0;b.useProgram(h);k||(b.enableVertexAttribArray(r.position),b.enableVertexAttribArray(r.uv),k=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(s.projectionMatrix,
 !1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var w,A=[],r=0;r<m;r++)if(w=d[r],w.visible&&0!==w.opacity)w.useScreenCoordinates?w.z=-w.position.z:(w._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,w.matrixWorld,w._modelViewMatrixArray),w.z=-w._modelViewMatrix.n34);d.sort(a);for(r=0;r<m;r++)w=d[r],w.visible&&0!==w.opacity&&w.map&&w.map.image&&w.map.image.width&&(w.useScreenCoordinates?(b.uniform1i(s.useScreenCoordinates,1),b.uniform3f(s.screenPosition,(w.position.x-
-o)/o,(u-w.position.y)/u,Math.max(0,Math.min(1,w.position.z)))):(b.uniform1i(s.useScreenCoordinates,0),b.uniform1i(s.affectedByDistance,w.affectedByDistance?1:0),b.uniformMatrix4fv(s.modelViewMatrix,!1,w._modelViewMatrixArray)),e=w.map.image.width/(w.scaleByViewport?q:1),A[0]=e*t*w.scale.x,A[1]=e*w.scale.y,b.uniform2f(s.uvScale,w.uvScale.x,w.uvScale.y),b.uniform2f(s.uvOffset,w.uvOffset.x,w.uvOffset.y),b.uniform2f(s.alignment,w.alignment.x,w.alignment.y),b.uniform1f(s.opacity,w.opacity),b.uniform3f(s.color,
+o)/o,(u-w.position.y)/u,Math.max(0,Math.min(1,w.position.z)))):(b.uniform1i(s.useScreenCoordinates,0),b.uniform1i(s.affectedByDistance,w.affectedByDistance?1:0),b.uniformMatrix4fv(s.modelViewMatrix,!1,w._modelViewMatrixArray)),e=w.map.image.width/(w.scaleByViewport?p:1),A[0]=e*t*w.scale.x,A[1]=e*w.scale.y,b.uniform2f(s.uvScale,w.uvScale.x,w.uvScale.y),b.uniform2f(s.uvOffset,w.uvOffset.x,w.uvOffset.y),b.uniform2f(s.alignment,w.alignment.x,w.alignment.y),b.uniform1f(s.opacity,w.opacity),b.uniform3f(s.color,
 w.color.r,w.color.g,w.color.b),b.uniform1f(s.rotation,w.rotation),b.uniform2fv(s.scale,A),w.mergeWith3D&&!x?(b.enable(b.DEPTH_TEST),x=!0):!w.mergeWith3D&&x&&(b.disable(b.DEPTH_TEST),x=!1),c.setBlending(w.blending),c.setTexture(w.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,l,k,n;e.matrixAutoUpdate=f.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),q=new THREE.PerspectiveCamera(53,
-1,1,1E4);q.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:o}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
-m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(q);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||l!==c.near||k!==c.far||n!==c.fov){i=c.aspect;l=c.near;k=c.far;n=c.fov;var t=c.projectionMatrix.clone(),u=0.5*(125/30),x=u*l/125,w=l*Math.tan(n*Math.PI/360),A;g.n14=u;h.n14=-u;u=-w*i+x;A=w*i+x;t.n11=2*l/(A-u);t.n13=(A+u)/(A-u);e.projectionMatrix.copy(t);u=-w*i-x;A=w*i-x;t.n11=
-2*l/(A-u);t.n13=(A+u)/(A-u);f.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);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,o,!0);m.updateMatrixWorld();d.call(b,m,q)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,g=new THREE.Matrix4,h=new THREE.Matrix4,i,l,k,n;e.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},q=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.PerspectiveCamera(53,
+1,1,1E4);p.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:q},mapRight:{type:"t",value:1,texture:o}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
+m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(p);this.setSize=function(a,d){c.call(b,a,d);q.width=a;q.height=d;o.width=a;o.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||l!==c.near||k!==c.far||n!==c.fov){i=c.aspect;l=c.near;k=c.far;n=c.fov;var t=c.projectionMatrix.clone(),u=0.5*(125/30),x=u*l/125,w=l*Math.tan(n*Math.PI/360),A;g.n14=u;h.n14=-u;u=-w*i+x;A=w*i+x;t.n11=2*l/(A-u);t.n13=(A+u)/(A-u);e.projectionMatrix.copy(t);u=-w*i-x;A=w*i-x;t.n11=
+2*l/(A-u);t.n13=(A+u)/(A-u);f.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,q,!0);f.matrixWorld.copy(c.matrixWorld).multiplySelf(g);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,o,!0);m.updateMatrixWorld();d.call(b,m,p)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,f,g=new THREE.PerspectiveCamera;g.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&void 0!==a.separation)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;f=d};this.render=function(a,c){this.clear();g.fov=c.fov;g.aspect=0.5*c.aspect;g.near=c.near;g.far=
 c.far;g.updateProjectionMatrix();g.position.copy(c.position);g.target.copy(c.target);g.translateX(b.separation);g.lookAt(g.target);h.projectionMatrix=g.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,f);d.call(b,a,g);this.setViewport(e,0,e,f);d.call(b,a,h,!1)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},

+ 2 - 2
build/custom/ThreeCanvas.js

@@ -97,8 +97,8 @@ THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projec
 THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((void 0!==b?b:43.25)/(2*a));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
-THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=new THREE.Light;
-THREE.PointLight.prototype.constructor=THREE.PointLight;
+THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.onlyShadow=this.castShadow=!1;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=this.shadowMapSize=
+this.shadowMap=null};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.Material=function(a){a=a||{};this.name="";this.id=THREE.MaterialCount++;this.opacity=void 0!==a.opacity?a.opacity:1;this.transparent=void 0!==a.transparent?a.transparent:!1;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.depthTest=void 0!==a.depthTest?a.depthTest:!0;this.depthWrite=void 0!==a.depthWrite?a.depthWrite:!0;this.polygonOffset=void 0!==a.polygonOffset?a.polygonOffset:!1;this.polygonOffsetFactor=void 0!==a.polygonOffsetFactor?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
 void 0!==a.polygonOffsetUnits?a.polygonOffsetUnits:0;this.alphaTest=void 0!==a.alphaTest?a.alphaTest:0;this.overdraw=void 0!==a.overdraw?a.overdraw:!1};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;
 THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=void 0!==a.linewidth?a.linewidth:1;this.linecap=void 0!==a.linecap?a.linecap:"round";this.linejoin=void 0!==a.linejoin?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1;this.fog=void 0!==a.fog?a.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;

+ 19 - 19
build/custom/ThreeExtras.js

@@ -154,8 +154,8 @@ c.target.addSelf(b);c.staticMoving?j=m:j.addSelf(a.sub(m,j).multiplyScalar(c.dyn
 c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(d&&(e=h=c.getMouseProjectionOnBall(a.clientX,a.clientY),i=k=c.getMouseOnScreen(a.clientX,a.clientY),j=m=c.getMouseOnScreen(a.clientX,a.clientY),d=!1),-1!==f&&(0===f&&!c.noRotate?h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,
 a.clientY):2===f&&!c.noPan&&(m=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),-1===f))f=a.button,0===f&&!c.noRotate?e=h=c.getMouseProjectionOnBall(a.clientX,a.clientY):1===f&&!c.noZoom?i=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(j=m=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),
 f=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&-1===f&&(a.keyCode===c.keys[0]&&!c.noRotate?f=0:a.keyCode===c.keys[1]&&!c.noZoom?f=1:a.keyCode===c.keys[2]&&!c.noPan&&(f=2),-1!==f&&(d=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&-1!==f&&(f=-1)},!1)};
-THREE.CubeGeometry=function(a,b,c,d,f,g,e,h){function i(a,b,c,e,h,i,j,m){var p,l=d||1,o=f||1,n=h/2,r=i/2,q=k.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)p="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)p="y",o=g||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)p="x",l=g||1;var s=l+1,t=o+1,C=h/l,L=i/o,N=new THREE.Vector3;N[p]=0<j?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var M=new THREE.Vector3;M[a]=(i*C-n)*c;M[b]=(h*L-r)*e;M[p]=j;k.vertices.push(new THREE.Vertex(M))}for(h=0;h<o;h++)for(i=0;i<l;i++)a=
-new THREE.Face4(i+s*h+q,i+s*(h+1)+q,i+1+s*(h+1)+q,i+1+s*h+q),a.normal.copy(N),a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone()),a.materialIndex=m,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/l,h/o),new THREE.UV(i/l,(h+1)/o),new THREE.UV((i+1)/l,(h+1)/o),new THREE.UV((i+1)/l,h/o)])}THREE.Geometry.call(this);var k=this,j=a/2,m=b/2,p=c/2,n,l,o,q,r,s;if(void 0!==e){if(e instanceof Array)this.materials=e;else{this.materials=[];for(n=0;6>n;n++)this.materials.push(e)}n=0;q=1;l=2;r=
+THREE.CubeGeometry=function(a,b,c,d,f,g,e,h){function i(a,b,c,e,h,i,j,m){var l,p=d||1,o=f||1,n=h/2,r=i/2,q=k.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)l="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)l="y",o=g||1;else if("z"===a&&"y"===b||"y"===a&&"z"===b)l="x",p=g||1;var s=p+1,t=o+1,C=h/p,L=i/o,N=new THREE.Vector3;N[l]=0<j?1:-1;for(h=0;h<t;h++)for(i=0;i<s;i++){var M=new THREE.Vector3;M[a]=(i*C-n)*c;M[b]=(h*L-r)*e;M[l]=j;k.vertices.push(new THREE.Vertex(M))}for(h=0;h<o;h++)for(i=0;i<p;i++)a=
+new THREE.Face4(i+s*h+q,i+s*(h+1)+q,i+1+s*(h+1)+q,i+1+s*h+q),a.normal.copy(N),a.vertexNormals.push(N.clone(),N.clone(),N.clone(),N.clone()),a.materialIndex=m,k.faces.push(a),k.faceVertexUvs[0].push([new THREE.UV(i/p,h/o),new THREE.UV(i/p,(h+1)/o),new THREE.UV((i+1)/p,(h+1)/o),new THREE.UV((i+1)/p,h/o)])}THREE.Geometry.call(this);var k=this,j=a/2,m=b/2,p=c/2,n,l,o,q,r,s;if(void 0!==e){if(e instanceof Array)this.materials=e;else{this.materials=[];for(n=0;6>n;n++)this.materials.push(e)}n=0;q=1;l=2;r=
 3;o=4;s=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var t in h)void 0!==this.sides[t]&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,c,b,j,n);this.sides.nx&&i("z","y",1,-1,c,b,-j,q);this.sides.py&&i("x","z",1,1,a,c,m,l);this.sides.ny&&i("x","z",1,-1,a,c,-m,r);this.sides.pz&&i("x","y",1,-1,a,b,p,o);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,f,g){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,e=c/2,d=d||8,f=f||1,h,i,k=[],j=[];for(i=0;i<=f;i++){var m=[],p=[],n=i/f,l=n*(b-a)+a;for(h=0;h<=d;h++){var o=h/d,q=l*Math.sin(2*o*Math.PI),r=-n*c+e,s=l*Math.cos(2*o*Math.PI);this.vertices.push(new THREE.Vertex(new THREE.Vector3(q,r,s)));m.push(this.vertices.length-1);p.push(new THREE.UV(o,n))}k.push(m);j.push(p)}for(i=0;i<f;i++)for(h=0;h<d;h++){var c=k[i][h],m=k[i+1][h],
@@ -232,10 +232,10 @@ e.status+"]")};e.open("GET",b,!0);e.overrideMimeType&&e.overrideMimeType("text/p
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,f){var g=new XMLHttpRequest,e=c+"/"+a.buffers,h=0;g.onreadystatechange=function(){4==g.readyState?200==g.status||0==g.status?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("Couldn't load ["+e+"] ["+g.status+"]"):3==g.readyState?f&&(0==h&&(h=g.getResponseHeader("Content-Length")),f({total:h,loaded:g.responseText.length})):2==g.readyState&&(h=g.getResponseHeader("Content-Length"))};g.open("GET",e,!0);
 g.responseType="arraybuffer";g.send(null)};
 THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,i,k,j,m,p,n,l,o,q,r,s,t,v,u;function w(a){return a%4?4-a%4:0}function z(a,b){return(new Uint8Array(a,b,1))[0]}function x(a,b){return(new Uint32Array(a,b,1))[0]}function A(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[3*d];f=l[3*d+1];g=l[3*d+2];h=y[2*e];e=y[2*e+1];i=y[2*f];j=y[2*f+1];f=y[2*g];k=y[2*g+1];g=G.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 F(b,c){var d,e,f,g,h,i,j,k,m,l,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[4*d];f=o[4*d+1];g=o[4*d+2];h=o[4*d+3];i=y[2*e];e=y[2*e+1];j=y[2*f];m=y[2*f+1];k=y[2*g];l=y[2*g+1];g=y[2*h];f=y[2*h+1];h=G.faceVertexUvs[0];var n=[];n.push(new THREE.UV(i,e));n.push(new THREE.UV(j,m));n.push(new THREE.UV(k,l));n.push(new THREE.UV(g,f));h.push(n)}}function E(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*
-d+1],g=c[3*d+2],h=i[d],G.faces.push(new THREE.Face3(e,f,g,null,null,h))}function I(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],G.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function J(b,c,d,e){for(var f,g,h,i,j,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),l=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];k=d[3*e+1];m=d[3*e+2];i=l[e];var o=H[3*k],n=H[3*k+1];k=
-H[3*k+2];var p=H[3*m],r=H[3*m+1];m=H[3*m+2];G.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(H[3*j],H[3*j+1],H[3*j+2]),new THREE.Vector3(o,n,k),new THREE.Vector3(p,r,m)],null,i))}}function B(b,c,d,e){for(var f,g,h,i,j,k,m,l,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];k=d[4*e];m=d[4*e+1];l=d[4*e+2];o=d[4*e+3];j=n[e];var p=H[3*m],r=H[3*m+1];m=H[3*m+2];var q=H[3*l],s=H[3*l+1];l=H[3*l+2];var t=H[3*o],u=H[3*
-o+1];o=H[3*o+2];G.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(H[3*k],H[3*k+1],H[3*k+2]),new THREE.Vector3(p,r,m),new THREE.Vector3(q,s,l),new THREE.Vector3(t,u,o)],null,j))}}var G=this,D=0,H=[],y=[],K,C;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(G,d,b);c=function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,D,12);f=z(a,D+12);z(a,D+13);z(a,D+14);z(a,D+15);i=z(a,D+16);k=z(a,D+17);j=z(a,D+18);m=z(a,D+19);p=x(a,D+20);
+m.push(new THREE.UV(f,k));g.push(m)}}function F(b,c){var d,e,f,g,h,i,j,k,l,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[4*d];f=o[4*d+1];g=o[4*d+2];h=o[4*d+3];i=y[2*e];e=y[2*e+1];j=y[2*f];l=y[2*f+1];k=y[2*g];m=y[2*g+1];g=y[2*h];f=y[2*h+1];h=G.faceVertexUvs[0];var n=[];n.push(new THREE.UV(i,e));n.push(new THREE.UV(j,l));n.push(new THREE.UV(k,m));n.push(new THREE.UV(g,f));h.push(n)}}function E(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*
+d+1],g=c[3*d+2],h=i[d],G.faces.push(new THREE.Face3(e,f,g,null,null,h))}function I(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],G.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function J(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];k=d[3*e+1];l=d[3*e+2];i=m[e];var o=H[3*k],n=H[3*k+1];k=
+H[3*k+2];var p=H[3*l],r=H[3*l+1];l=H[3*l+2];G.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(H[3*j],H[3*j+1],H[3*j+2]),new THREE.Vector3(o,n,k),new THREE.Vector3(p,r,l)],null,i))}}function B(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),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];k=d[4*e];l=d[4*e+1];m=d[4*e+2];o=d[4*e+3];j=n[e];var p=H[3*l],r=H[3*l+1];l=H[3*l+2];var q=H[3*m],s=H[3*m+1];m=H[3*m+2];var t=H[3*o],u=H[3*
+o+1];o=H[3*o+2];G.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(H[3*k],H[3*k+1],H[3*k+2]),new THREE.Vector3(p,r,l),new THREE.Vector3(q,s,m),new THREE.Vector3(t,u,o)],null,j))}}var G=this,D=0,H=[],y=[],K,C;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(G,d,b);c=function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,D,12);f=z(a,D+12);z(a,D+13);z(a,D+14);z(a,D+15);i=z(a,D+16);k=z(a,D+17);j=z(a,D+18);m=z(a,D+19);p=x(a,D+20);
 n=x(a,D+20+4);l=x(a,D+20+8);b=x(a,D+20+12);o=x(a,D+20+16);q=x(a,D+20+20);r=x(a,D+20+24);s=x(a,D+20+28);t=x(a,D+20+32);v=x(a,D+20+36);u=x(a,D+20+40);"Three.js 003"!==c&&console.warn("DEPRECATED: binary model seems to be using old format");D+=f;c=3*i+m;C=4*i+m;f=b*c;K=o*(c+3*k);i=q*(c+3*j);m=r*(c+3*k+3*j);c=s*C;k=t*(C+4*k);j=v*(C+4*j);D+=function(b){var b=new Float32Array(a,b,3*p),c,d,e,f;for(c=0;c<p;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],G.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*
 p*Float32Array.BYTES_PER_ELEMENT}(D);D+=function(b){if(n){var b=new Int8Array(a,b,3*n),c,d,e,f;for(c=0;c<n;c++)d=b[3*c],e=b[3*c+1],f=b[3*c+2],H.push(d/127,e/127,f/127)}return 3*n*Int8Array.BYTES_PER_ELEMENT}(D);D+=w(3*n);D+=function(b){if(l){var b=new Float32Array(a,b,2*l),c,d,e;for(c=0;c<l;c++)d=b[2*c],e=b[2*c+1],y.push(d,e)}return 2*l*Float32Array.BYTES_PER_ELEMENT}(D);f=D+f+w(2*b);K=f+K+w(2*o);i=K+i+w(2*q);m=i+m+w(2*r);c=m+c+w(2*s);k=c+k+w(2*t);j=k+j+w(2*v);(function(a){if(q){var b=a+3*q*Uint32Array.BYTES_PER_ELEMENT;
 E(q,a,b+3*q*Uint32Array.BYTES_PER_ELEMENT);A(q,b)}})(K);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT,c=b+3*r*Uint32Array.BYTES_PER_ELEMENT;J(r,a,b,c+3*r*Uint32Array.BYTES_PER_ELEMENT);A(r,c)}})(i);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT;I(v,a,b+4*v*Uint32Array.BYTES_PER_ELEMENT);F(v,b)}})(k);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT,c=b+4*u*Uint32Array.BYTES_PER_ELEMENT;B(u,a,b,c+4*u*Uint32Array.BYTES_PER_ELEMENT);F(u,c)}})(j);b&&E(b,D,D+3*b*
@@ -245,13 +245,13 @@ THREE.ColladaLoader=function(){function a(a,d,f){P=a;d=d||ia;void 0!==f&&(a=f.sp
 "visual_scene");$=[];aa=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=ga[a]):S=null;X=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)X.add(g(S.nodes[a]));fa=[];c(X);a={scene:X,morphs:$,skins:aa,animations:fa,dae:{images:ca,materials:da,effects:ea,geometries:U,controllers:T,animations:W,visualScenes:ga,scene:S}};d&&d(a);return a}function b(a,b,c){for(var a=P.evaluate(a,P,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=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};fa.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d={hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=0,g=c(a.children[e]).hierarchy.length;b<
 g;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function f(a,b,c){var e,f=T[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");
-else{var c=1E6,g=-c,h=0;for(e in W)for(var i=W[e],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=S.getChildById(b.skeleton[0],!0)||S.getChildBySid(b.skeleton[0],!0),m,l,g=new THREE.Vector3,o,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;
-k=f.skin;for(l=0;l<j.length;l++)if(m=j[l],o=-1,"JOINT"==m.type){for(var n=0;n<k.joints.length;n++)if(m.sid==k.joints[n]){o=n;break}if(0<=o){n=k.invBindMatrices[o];m.invBindMatrix=n;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,n);m.weights=[];for(n=0;n<k.weights.length;n++)for(var p=0;p<k.weights[n].length;p++){var r=k.weights[n][p];r.joint==o&&m.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+m.sid+"'.";}for(j=0;j<h.length;j++)if("JOINT"==h[j].type)for(k=
-0;k<h[j].weights.length;k++)m=h[j].weights[k],l=m.index,m=m.weight,o=a.vertices[l],l=i[l],g.x=o.position.x,g.y=o.position.y,g.z=o.position.z,h[j].skinningMatrix.multiplyVector3(g),l.position.x+=g.x*m,l.position.y+=g.y*m,l.position.z+=g.z*m;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function g(a){var b=new THREE.Object3D,c,d,e,h;for(e=0;e<a.controllers.length;e++){var i=T[a.controllers[e].url];switch(i.type){case "skin":if(U[i.skin.source]){var j=new o;j.url=i.skin.source;j.instance_material=
+else{var c=1E6,g=-c,h=0;for(e in W)for(var i=W[e],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=S.getChildById(b.skeleton[0],!0)||S.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,o,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;
+k=f.skin;for(m=0;m<j.length;m++)if(l=j[m],o=-1,"JOINT"==l.type){for(var n=0;n<k.joints.length;n++)if(l.sid==k.joints[n]){o=n;break}if(0<=o){n=k.invBindMatrices[o];l.invBindMatrix=n;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,n);l.weights=[];for(n=0;n<k.weights.length;n++)for(var p=0;p<k.weights[n].length;p++){var r=k.weights[n][p];r.joint==o&&l.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+l.sid+"'.";}for(j=0;j<h.length;j++)if("JOINT"==h[j].type)for(k=
+0;k<h[j].weights.length;k++)l=h[j].weights[k],m=l.index,l=l.weight,o=a.vertices[m],m=i[m],g.x=o.position.x,g.y=o.position.y,g.z=o.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,e,h;for(e=0;e<a.controllers.length;e++){var i=T[a.controllers[e].url];switch(i.type){case "skin":if(U[i.skin.source]){var j=new o;j.url=i.skin.source;j.instance_material=
 a.controllers[e].instance_material;a.geometries.push(j);c=a.controllers[e]}else if(T[i.skin.source]&&(d=i=T[i.skin.source],i.morph&&U[i.morph.source]))j=new o,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j);break;case "morph":if(U[i.morph.source])j=new o,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j),d=a.controllers[e];console.log("ColladaLoader: Morph-controller partially supported.")}}for(e=0;e<a.geometries.length;e++){var i=
-a.geometries[e],j=i.instance_material,i=U[i.url],k={},m=[],l=0,p;if(i&&i.mesh&&i.mesh.primitives){if(0==b.name.length)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var r=ea[da[p.target].instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;k[p.symbol]=l;m.push(r.material);p=r.material;l++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(1<l){j=new THREE.MeshFaceMaterial;i.materials=m;for(h=0;h<i.faces.length;h++)m=
-i.faces[h],m.materialIndex=k[m.daeMaterial]}if(void 0!==c)f(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(void 0!==d){h=i;k=d instanceof n?T[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(m=0;m<k.targets.length;m++)if(l=U[k.targets[m]],l.mesh&&l.mesh.primitives&&l.mesh.primitives.length)l=l.mesh.primitives[0].geometry,l.vertices.length===
-h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:l.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);1<a.geometries.length?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];Q.centerGeometry&&b.geometry&&(c=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(c.multiplySelf(b.scale)),
+a.geometries[e],j=i.instance_material,i=U[i.url],k={},l=[],m=0,p;if(i&&i.mesh&&i.mesh.primitives){if(0==b.name.length)b.name=i.id;if(j)for(h=0;h<j.length;h++){p=j[h];var r=ea[da[p.target].instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;k[p.symbol]=m;l.push(r.material);p=r.material;m++}j=p||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(1<m){j=new THREE.MeshFaceMaterial;i.materials=l;for(h=0;h<i.faces.length;h++)l=
+i.faces[h],l.materialIndex=k[l.daeMaterial]}if(void 0!==c)f(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(void 0!==d){h=i;k=d instanceof n?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=U[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);1<a.geometries.length?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];Q.centerGeometry&&b.geometry&&(c=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(c.multiplySelf(b.scale)),
 b.position.subSelf(c));for(e=0;e<a.nodes.length;e++)b.add(g(a.nodes[e],a));return b}function e(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function m(){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 n(){this.url="";this.skeleton=[];this.instance_material=[]}function l(){this.target=this.symbol=""}function o(){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 s(){}function t(){this.material="";this.count=
 0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){this.source="";this.stride=this.count=0;this.params=[]}function u(){this.input={}}function w(){this.semantic="";this.offset=0;this.source="";this.set=0}function z(a){this.id=a;this.type=null}function x(){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}
@@ -264,7 +264,7 @@ h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttrib
 a.childNodes[d];if(1==e.nodeType)switch(e.nodeName){case "source":e=(new z).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":b.push((new w).parse(d))}}return b};
 k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(1==f.nodeType)switch(f.nodeName){case "bind_shape_matrix":f=C(f.textContent);this.bindShapeMatrix=ba(f);break;case "source":f=(new z).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,
 b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new w).parse(d),e=b[d.source];if("JOINT"==d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new w).parse(g));break;
-case "v":c=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={},m=0;m<e.length;m++){var l=e[m],o=c[g+l.offset];switch(l.semantic){case "JOINT":k.joint=o;break;case "WEIGHT":k.weight=b[l.source].data[o]}}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};
+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],o=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=o;break;case "WEIGHT":k.weight=b[m.source].data[o]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};
 j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "node":this.nodes.push((new m).parse(c))}}return this};m.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],
 d=c.target.split("/");d.shift();var e=d.shift(),f=0<=e.indexOf("."),g=0<=e.indexOf("("),h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};m.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};m.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};m.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};m.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type="JOINT"==this.type?this.type:
@@ -387,12 +387,12 @@ h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,F.x-8,F.y-8,16,16,0);b.uniform1i(E.rend
 6,b.UNSIGNED_SHORT,0);G.positionScreen.copy(A);G.customUpdateCallback?G.customUpdateCallback(G):G.updateLensFlares();b.uniform1i(E.renderType,2);b.enable(b.BLEND);for(J=0,B=G.lensFlares.length;J<B;J++)if(D=G.lensFlares[J],0.0010<D.opacity&&0.0010<D.scale)A.x=D.x,A.y=D.y,A.z=D.z,z=D.size*D.scale/r,x.x=z*v,x.y=z,b.uniform3f(E.screenPosition,A.x,A.y,A.z),b.uniform2f(E.scale,x.x,x.y),b.uniform1f(E.rotation,D.rotation),b.uniform1f(E.opacity,D.opacity),b.uniform3f(E.color,D.color.r,D.color.g,D.color.b),
 c.setBlending(D.blending),c.setTexture(D.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,f=new THREE.Frustum,g=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&
-this.update(a,c)};this.update=function(e){var h,i,k,j,m,p,n,l,o,q=e.lights;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(h=0,i=q.length;h<i;h++)if(l=q[h],l.castShadow&&l instanceof THREE.SpotLight){if(!l.shadowMap)l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,l.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),l.shadowMapSize=new THREE.Vector2(l.shadowMapWidth,l.shadowMapHeight),
-l.shadowCamera=new THREE.PerspectiveCamera(l.shadowCameraFov,l.shadowMapWidth/l.shadowMapHeight,l.shadowCameraNear,l.shadowCameraFar),l.shadowMatrix=new THREE.Matrix4,e.add(l.shadowCamera),b.autoUpdateScene&&e.updateMatrixWorld();if(l.shadowCameraVisible&&!l.cameraHelper)l.cameraHelper=new THREE.CameraHelper(l.shadowCamera),l.shadowCamera.add(l.cameraHelper);k=l.shadowMap;j=l.shadowMatrix;m=l.shadowCamera;m.position.copy(l.matrixWorld.getPosition());m.lookAt(l.target.matrixWorld.getPosition());m.matrixWorldInverse.getInverse(m.matrixWorld);
-if(l.cameraHelper)l.cameraHelper.lines.visible=l.shadowCameraVisible;l.shadowCameraVisible&&l.cameraHelper.update(l.shadowCamera);j.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);j.multiplySelf(m.projectionMatrix);j.multiplySelf(m.matrixWorldInverse);if(!m._viewMatrixArray)m._viewMatrixArray=new Float32Array(16);m.matrixWorldInverse.flattenToArray(m._viewMatrixArray);if(!m._projectionMatrixArray)m._projectionMatrixArray=new Float32Array(16);m.projectionMatrix.flattenToArray(m._projectionMatrixArray);
-g.multiply(m.projectionMatrix,m.matrixWorldInverse);f.setFromMatrix(g);b.setRenderTarget(k);b.clear();o=e.__webglObjects;for(k=0,j=o.length;k<j;k++)if(p=o[k],l=p.object,p.render=!1,l.visible&&l.castShadow&&(!(l instanceof THREE.Mesh)||!l.frustumCulled||f.contains(l)))l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),p.render=!0;for(k=0,j=o.length;k<j;k++)if(p=o[k],p.render)l=p.object,p=p.buffer,b.setObjectFaces(l),
-n=l.customDepthMaterial?l.customDepthMaterial:l.geometry.morphTargets.length?d:c,p instanceof THREE.BufferGeometry?b.renderBufferDirect(m,q,null,n,p,l):b.renderBuffer(m,q,null,n,p,l);o=e.__webglObjectsImmediate;for(k=0,j=o.length;k<j;k++)p=o[k],l=p.object,l.visible&&l.castShadow&&(l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),b.renderImmediateObject(m,q,null,c,l))}e=b.getClearColor();
-h=b.getClearAlpha();a.clearColor(e.r,e.g,e.b,h);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};
+this.update(a,c)};this.update=function(e){var h,i,k,j,m,p,n,l,o,q=e.lights;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(h=0,i=q.length;h<i;h++)if(l=q[h],l.castShadow){if(!l.shadowMap)l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,l.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),l.shadowMapSize=new THREE.Vector2(l.shadowMapWidth,l.shadowMapHeight),l.shadowMatrix=new THREE.Matrix4;
+if(!l.shadowCamera){if(l instanceof THREE.SpotLight)l.shadowCamera=new THREE.PerspectiveCamera(l.shadowCameraFov,l.shadowMapWidth/l.shadowMapHeight,l.shadowCameraNear,l.shadowCameraFar);else if(l instanceof THREE.DirectionalLight)l.shadowCamera=new THREE.OrthographicCamera(l.shadowCameraLeft,l.shadowCameraRight,l.shadowCameraTop,l.shadowCameraBottom,l.shadowCameraNear,l.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}e.add(l.shadowCamera);b.autoUpdateScene&&e.updateMatrixWorld()}if(l.shadowCameraVisible&&
+!l.cameraHelper)l.cameraHelper=new THREE.CameraHelper(l.shadowCamera),l.shadowCamera.add(l.cameraHelper);k=l.shadowMap;j=l.shadowMatrix;m=l.shadowCamera;m.position.copy(l.matrixWorld.getPosition());m.lookAt(l.target.matrixWorld.getPosition());m.matrixWorldInverse.getInverse(m.matrixWorld);if(l.cameraHelper)l.cameraHelper.lines.visible=l.shadowCameraVisible;l.shadowCameraVisible&&l.cameraHelper.update(l.shadowCamera);j.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);j.multiplySelf(m.projectionMatrix);
+j.multiplySelf(m.matrixWorldInverse);if(!m._viewMatrixArray)m._viewMatrixArray=new Float32Array(16);m.matrixWorldInverse.flattenToArray(m._viewMatrixArray);if(!m._projectionMatrixArray)m._projectionMatrixArray=new Float32Array(16);m.projectionMatrix.flattenToArray(m._projectionMatrixArray);g.multiply(m.projectionMatrix,m.matrixWorldInverse);f.setFromMatrix(g);b.setRenderTarget(k);b.clear();o=e.__webglObjects;for(k=0,j=o.length;k<j;k++)if(p=o[k],l=p.object,p.render=!1,l.visible&&l.castShadow&&(!(l instanceof
+THREE.Mesh)||!l.frustumCulled||f.contains(l)))l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),p.render=!0;for(k=0,j=o.length;k<j;k++)if(p=o[k],p.render)l=p.object,p=p.buffer,b.setObjectFaces(l),n=l.customDepthMaterial?l.customDepthMaterial:l.geometry.morphTargets.length?d:c,p instanceof THREE.BufferGeometry?b.renderBufferDirect(m,q,null,n,p,l):b.renderBuffer(m,q,null,n,p,l);o=e.__webglObjectsImmediate;
+for(k=0,j=o.length;k<j;k++)p=o[k],l=p.object,l.visible&&l.castShadow&&(l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),b.renderImmediateObject(m,q,null,c,l))}e=b.getClearColor();h=b.getClearAlpha();a.clearColor(e.r,e.g,e.b,h);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};
 THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,f,g,e,h,i,k,j;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);f=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;g=b.createBuffer();e=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
 e);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,p=b.createProgram(),n=b.createShader(b.FRAGMENT_SHADER),l=b.createShader(b.VERTEX_SHADER);b.shaderSource(n,a.fragmentShader);b.shaderSource(l,a.vertexShader);b.compileShader(n);b.compileShader(l);b.attachShader(p,n);b.attachShader(p,l);b.linkProgram(p);h=p;i={};k={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");k.uvOffset=b.getUniformLocation(h,"uvOffset");k.uvScale=b.getUniformLocation(h,
 "uvScale");k.rotation=b.getUniformLocation(h,"rotation");k.scale=b.getUniformLocation(h,"scale");k.alignment=b.getUniformLocation(h,"alignment");k.color=b.getUniformLocation(h,"color");k.map=b.getUniformLocation(h,"map");k.opacity=b.getUniformLocation(h,"opacity");k.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");k.screenPosition=b.getUniformLocation(h,"screenPosition");k.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");

+ 2 - 2
build/custom/ThreeSVG.js

@@ -97,8 +97,8 @@ THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projec
 THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((void 0!==b?b:43.25)/(2*a));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
-THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=new THREE.Light;
-THREE.PointLight.prototype.constructor=THREE.PointLight;
+THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.onlyShadow=this.castShadow=!1;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=this.shadowMapSize=
+this.shadowMap=null};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.Material=function(a){a=a||{};this.name="";this.id=THREE.MaterialCount++;this.opacity=void 0!==a.opacity?a.opacity:1;this.transparent=void 0!==a.transparent?a.transparent:!1;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.depthTest=void 0!==a.depthTest?a.depthTest:!0;this.depthWrite=void 0!==a.depthWrite?a.depthWrite:!0;this.polygonOffset=void 0!==a.polygonOffset?a.polygonOffset:!1;this.polygonOffsetFactor=void 0!==a.polygonOffsetFactor?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
 void 0!==a.polygonOffsetUnits?a.polygonOffsetUnits:0;this.alphaTest=void 0!==a.alphaTest?a.alphaTest:0;this.overdraw=void 0!==a.overdraw?a.overdraw:!1};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;
 THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=void 0!==a.linewidth?a.linewidth:1;this.linecap=void 0!==a.linecap?a.linecap:"round";this.linejoin=void 0!==a.linejoin?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1;this.fog=void 0!==a.fog?a.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;

+ 170 - 169
build/custom/ThreeWebGL.js

@@ -16,66 +16,66 @@ b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this
 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.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
 THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
 THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),e=0;6>e;e++)if(a=b[e].x*c.n14+b[e].y*c.n24+b[e].z*c.n34+b[e].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
-THREE.Ray=function(a,b){function c(a,b,c){p.sub(c,a);t=p.dot(b);z=l.add(a,r.copy(b).multiplyScalar(t));return y=c.distanceTo(z)}function d(a,b,c,d){p.sub(d,b);l.sub(c,b);r.sub(a,b);K=p.dot(p);N=p.dot(l);u=p.dot(r);J=l.dot(l);H=l.dot(r);B=1/(K*J-N*N);D=(J*u-N*H)*B;M=(K*H-N*u)*B;return 0<=D&&0<=M&&1>D+M}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=[];for(b=0,
-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,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3,j=new THREE.Vector3,n=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(a){for(var b,l=[],p=0,r=a.children.length;p<r;p++)Array.prototype.push.apply(l,this.intersectObject(a.children[p]));if(a instanceof THREE.Particle){p=
-c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.scale.x)return[];b={distance:p,point:a.position,face:null,object:a};l.push(b)}else if(a instanceof THREE.Mesh){p=c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return l;var f,t,u=a.geometry,z=u.vertices,y;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(p=0,r=u.faces.length;p<r;p++)if(b=u.faces[p],k.copy(this.origin),m.copy(this.direction),
-y=a.matrixWorld,j=y.multiplyVector3(j.copy(b.centroid)).subSelf(k),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),f=m.dot(n),!(1.0E-4>Math.abs(f))&&(t=n.dot(j)/f,!(0>t)&&(a.doubleSided||(a.flipSided?0<f:0>f))))if(o.add(k,m.multiplyScalar(t)),b instanceof THREE.Face3)e=y.multiplyVector3(e.copy(z[b.a].position)),g=y.multiplyVector3(g.copy(z[b.b].position)),h=y.multiplyVector3(h.copy(z[b.c].position)),d(o,e,g,h)&&(b={distance:k.distanceTo(o),point:o.clone(),face:b,object:a},l.push(b));else if(b instanceof
-THREE.Face4&&(e=y.multiplyVector3(e.copy(z[b.a].position)),g=y.multiplyVector3(g.copy(z[b.b].position)),h=y.multiplyVector3(h.copy(z[b.c].position)),i=y.multiplyVector3(i.copy(z[b.d].position)),d(o,e,g,i)||d(o,g,h,i)))b={distance:k.distanceTo(o),point:o.clone(),face:b,object:a},l.push(b)}return l};var p=new THREE.Vector3,l=new THREE.Vector3,r=new THREE.Vector3,t,z,y,K,N,u,J,H,B,D,M};
+THREE.Ray=function(a,b){function c(a,b,c){p.sub(c,a);t=p.dot(b);z=m.add(a,r.copy(b).multiplyScalar(t));return y=c.distanceTo(z)}function d(a,b,c,d){p.sub(d,b);m.sub(c,b);r.sub(a,b);K=p.dot(p);N=p.dot(m);u=p.dot(r);J=m.dot(m);H=m.dot(r);B=1/(K*J-N*N);D=(J*u-N*H)*B;M=(K*H-N*u)*B;return 0<=D&&0<=M&&1>D+M}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=[];for(b=0,
+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,h=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3,j=new THREE.Vector3,n=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(a){for(var b,m=[],p=0,r=a.children.length;p<r;p++)Array.prototype.push.apply(m,this.intersectObject(a.children[p]));if(a instanceof THREE.Particle){p=
+c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.scale.x)return[];b={distance:p,point:a.position,face:null,object:a};m.push(b)}else if(a instanceof THREE.Mesh){p=c(this.origin,this.direction,a.matrixWorld.getPosition());if(p>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return m;var f,t,u=a.geometry,z=u.vertices,y;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(p=0,r=u.faces.length;p<r;p++)if(b=u.faces[p],l.copy(this.origin),k.copy(this.direction),
+y=a.matrixWorld,j=y.multiplyVector3(j.copy(b.centroid)).subSelf(l),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),f=k.dot(n),!(1.0E-4>Math.abs(f))&&(t=n.dot(j)/f,!(0>t)&&(a.doubleSided||(a.flipSided?0<f:0>f))))if(o.add(l,k.multiplyScalar(t)),b instanceof THREE.Face3)e=y.multiplyVector3(e.copy(z[b.a].position)),g=y.multiplyVector3(g.copy(z[b.b].position)),h=y.multiplyVector3(h.copy(z[b.c].position)),d(o,e,g,h)&&(b={distance:l.distanceTo(o),point:o.clone(),face:b,object:a},m.push(b));else if(b instanceof
+THREE.Face4&&(e=y.multiplyVector3(e.copy(z[b.a].position)),g=y.multiplyVector3(g.copy(z[b.b].position)),h=y.multiplyVector3(h.copy(z[b.c].position)),i=y.multiplyVector3(i.copy(z[b.d].position)),d(o,e,g,i)||d(o,g,h,i)))b={distance:l.distanceTo(o),point:o.clone(),face:b,object:a},m.push(b)}return m};var p=new THREE.Vector3,m=new THREE.Vector3,r=new THREE.Vector3,t,z,y,K,N,u,J,H,B,D,M};
 THREE.Rectangle=function(){function a(){g=d-b;h=e-c}var b,c,d,e,g,h,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(g,h,j,n){i=!1;b=g;c=h;d=j;e=n;a()};this.addPoint=function(g,h){i?(i=!1,b=g,c=h,d=g,e=h):(b=b<g?b:g,c=c<h?c:h,d=d>g?d:g,e=e>h?e:h);a()};this.add3Points=
 function(g,h,j,n,o,p){i?(i=!1,b=g<j?g<o?g:o:j<o?j:o,c=h<n?h<p?h:p:n<p?n:p,d=g>j?g>o?g:o:j>o?j:o,e=h>n?h>p?h:p:n>p?n:p):(b=g<j?g<o?g<b?g:b:o<b?o:b:j<o?j<b?j:b:o<b?o:b,c=h<n?h<p?h<c?h:c:p<c?p:c:n<p?n<c?n:c:p<c?p:c,d=g>j?g>o?g>d?g:d:o>d?o:d:j>o?j>d?j:d:o>d?o:d,e=h>n?h>p?h>e?h:e:p>e?p:e:n>p?n>e?n:e:p>e?p:e);a()};this.addRectangle=function(g){i?(i=!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 d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())}};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,h,i,k,m,j,n,o,p,l,r){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==g?g:1,h||0,i||0,k||0,m||0,void 0!==j?j:1,n||0,o||0,p||0,l||0,void 0!==r?r:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,h,i,k,m,j,n,o,p,l,r){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=i;this.n31=k;this.n32=m;this.n33=j;this.n34=n;this.n41=o;this.n42=p;this.n43=l;this.n44=r;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(0===g.length())g.z=1;d.cross(c,g).normalize();0===d.length()&&(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,h=a.n21,i=a.n22,k=a.n23,m=a.n24,j=a.n31,n=a.n32,o=a.n33,p=a.n34,l=a.n41,r=a.n42,t=a.n43,
-z=a.n44,y=b.n11,K=b.n12,N=b.n13,u=b.n14,J=b.n21,H=b.n22,B=b.n23,D=b.n24,M=b.n31,I=b.n32,Q=b.n33,ga=b.n34,xa=b.n41,A=b.n42,f=b.n43,Ga=b.n44;this.n11=c*y+d*J+e*M+g*xa;this.n12=c*K+d*H+e*I+g*A;this.n13=c*N+d*B+e*Q+g*f;this.n14=c*u+d*D+e*ga+g*Ga;this.n21=h*y+i*J+k*M+m*xa;this.n22=h*K+i*H+k*I+m*A;this.n23=h*N+i*B+k*Q+m*f;this.n24=h*u+i*D+k*ga+m*Ga;this.n31=j*y+n*J+o*M+p*xa;this.n32=j*K+n*H+o*I+p*A;this.n33=j*N+n*B+o*Q+p*f;this.n34=j*u+n*D+o*ga+p*Ga;this.n41=l*y+r*J+t*M+z*xa;this.n42=l*K+r*H+t*I+z*A;this.n43=
-l*N+r*B+t*Q+z*f;this.n44=l*u+r*D+t*ga+z*Ga;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*=
+THREE.Matrix4=function(a,b,c,d,e,g,h,i,l,k,j,n,o,p,m,r){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==g?g:1,h||0,i||0,l||0,k||0,void 0!==j?j:1,n||0,o||0,p||0,m||0,void 0!==r?r:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,h,i,l,k,j,n,o,p,m,r){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=i;this.n31=l;this.n32=k;this.n33=j;this.n34=n;this.n41=o;this.n42=p;this.n43=m;this.n44=r;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(0===g.length())g.z=1;d.cross(c,g).normalize();0===d.length()&&(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,h=a.n21,i=a.n22,l=a.n23,k=a.n24,j=a.n31,n=a.n32,o=a.n33,p=a.n34,m=a.n41,r=a.n42,t=a.n43,
+z=a.n44,y=b.n11,K=b.n12,N=b.n13,u=b.n14,J=b.n21,H=b.n22,B=b.n23,D=b.n24,M=b.n31,I=b.n32,Q=b.n33,ga=b.n34,xa=b.n41,A=b.n42,f=b.n43,Ga=b.n44;this.n11=c*y+d*J+e*M+g*xa;this.n12=c*K+d*H+e*I+g*A;this.n13=c*N+d*B+e*Q+g*f;this.n14=c*u+d*D+e*ga+g*Ga;this.n21=h*y+i*J+l*M+k*xa;this.n22=h*K+i*H+l*I+k*A;this.n23=h*N+i*B+l*Q+k*f;this.n24=h*u+i*D+l*ga+k*Ga;this.n31=j*y+n*J+o*M+p*xa;this.n32=j*K+n*H+o*I+p*A;this.n33=j*N+n*B+o*Q+p*f;this.n34=j*u+n*D+o*ga+p*Ga;this.n41=m*y+r*J+t*M+z*xa;this.n42=m*K+r*H+t*I+z*A;this.n43=
+m*N+r*B+t*Q+z*f;this.n44=m*u+r*D+t*ga+z*Ga;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,h=this.n23,i=this.n24,k=this.n31,m=this.n32,j=this.n33,n=this.n34,o=this.n41,p=this.n42,l=this.n43,r=this.n44;return d*h*m*o-c*i*m*o-d*g*j*o+b*i*j*o+c*g*n*o-b*h*n*o-d*h*k*p+c*i*k*p+d*e*j*p-a*i*j*p-c*e*n*p+a*h*n*p+d*g*k*l-b*i*k*l-d*e*m*l+a*i*m*l+b*e*n*l-a*g*n*l-c*g*k*r+b*h*k*r+c*e*m*r-a*h*m*r-
+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,h=this.n23,i=this.n24,l=this.n31,k=this.n32,j=this.n33,n=this.n34,o=this.n41,p=this.n42,m=this.n43,r=this.n44;return d*h*k*o-c*i*k*o-d*g*j*o+b*i*j*o+c*g*n*o-b*h*n*o-d*h*l*p+c*i*l*p+d*e*j*p-a*i*j*p-c*e*n*p+a*h*n*p+d*g*l*m-b*i*l*m-d*e*k*m+a*i*k*m+b*e*n*m-a*g*n*m-c*g*l*r+b*h*l*r+c*e*k*r-a*h*k*r-
 b*e*j*r+a*g*j*r},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,h=a.y,i=a.z,k=e*g,m=e*h;this.set(k*g+c,k*h-d*i,k*i+d*h,0,k*h+d*i,m*h+c,m*i-d*g,0,k*i-d*h,m*i+d*g,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,g=a.n21,h=a.n22,i=a.n23,k=a.n24,m=a.n31,j=a.n32,n=a.n33,o=a.n34,p=a.n41,l=a.n42,r=a.n43,t=a.n44;this.n11=i*o*l-k*n*l+k*j*r-h*o*r-i*j*t+h*n*t;this.n12=e*n*l-d*o*l-e*j*r+c*o*r+d*j*t-c*n*t;this.n13=d*k*l-e*i*l+e*h*r-c*k*r-d*h*t+c*i*t;this.n14=e*i*j-d*k*j-e*h*n+c*k*n+d*h*o-c*i*o;this.n21=k*n*p-i*o*p-k*m*r+g*o*r+i*m*t-g*n*t;this.n22=d*o*p-e*n*p+
-e*m*r-b*o*r-d*m*t+b*n*t;this.n23=e*i*p-d*k*p-e*g*r+b*k*r+d*g*t-b*i*t;this.n24=d*k*m-e*i*m+e*g*n-b*k*n-d*g*o+b*i*o;this.n31=h*o*p-k*j*p+k*m*l-g*o*l-h*m*t+g*j*t;this.n32=e*j*p-c*o*p-e*m*l+b*o*l+c*m*t-b*j*t;this.n33=c*k*p-e*h*p+e*g*l-b*k*l-c*g*t+b*h*t;this.n34=e*h*m-c*k*m-e*g*j+b*k*j+c*g*o-b*h*o;this.n41=i*j*p-h*n*p-i*m*l+g*n*l+h*m*r-g*j*r;this.n42=c*n*p-d*j*p+d*m*l-b*n*l-c*m*r+b*j*r;this.n43=d*h*p-c*i*p-d*g*l+b*i*l+c*g*r-b*h*r;this.n44=c*i*m-d*h*m+d*g*j-b*i*j-c*g*n+b*h*n;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),h=Math.cos(d),d=Math.sin(d),i=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var k=h*i,m=h*e,j=d*i,n=d*e;this.n11=k+n*c;this.n12=j*c-m;this.n13=g*d;this.n21=g*e;this.n22=g*i;this.n23=-c;this.n31=m*c-j;this.n32=n+k*c;this.n33=g*h;break;case "ZXY":k=h*i;m=h*e;j=d*i;n=d*e;this.n11=k-n*c;this.n12=-g*e;this.n13=j+m*c;this.n21=m+j*c;this.n22=g*i;this.n23=n-k*c;this.n31=-g*d;this.n32=c;this.n33=g*h;break;case "ZYX":k=
-g*i;m=g*e;j=c*i;n=c*e;this.n11=h*i;this.n12=j*d-m;this.n13=k*d+n;this.n21=h*e;this.n22=n*d+k;this.n23=m*d-j;this.n31=-d;this.n32=c*h;this.n33=g*h;break;case "YZX":k=g*h;m=g*d;j=c*h;n=c*d;this.n11=h*i;this.n12=n-k*e;this.n13=j*e+m;this.n21=e;this.n22=g*i;this.n23=-c*i;this.n31=-d*i;this.n32=m*e+j;this.n33=k-n*e;break;case "XZY":k=g*h;m=g*d;j=c*h;n=c*d;this.n11=h*i;this.n12=-e;this.n13=d*i;this.n21=k*e+n;this.n22=g*i;this.n23=m*e-j;this.n31=j*e-m;this.n32=c*i;this.n33=n*e+k;break;default:k=g*i,m=g*
-e,j=c*i,n=c*e,this.n11=h*i,this.n12=-h*e,this.n13=d,this.n21=m+j*d,this.n22=k-n*d,this.n23=-c*h,this.n31=n-k*d,this.n32=j+m*d,this.n33=g*h}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,h=c+c,i=d+d,a=b*g,k=b*h,b=b*i,m=c*h,c=c*i,d=d*i,g=e*g,h=e*h,e=e*i;this.n11=1-(m+d);this.n12=k-e;this.n13=b+h;this.n21=k+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;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*=
+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,h=a.y,i=a.z,l=e*g,k=e*h;this.set(l*g+c,l*h-d*i,l*i+d*h,0,l*h+d*i,k*h+c,k*i-d*g,0,l*i-d*h,k*i+d*g,e*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,g=a.n21,h=a.n22,i=a.n23,l=a.n24,k=a.n31,j=a.n32,n=a.n33,o=a.n34,p=a.n41,m=a.n42,r=a.n43,t=a.n44;this.n11=i*o*m-l*n*m+l*j*r-h*o*r-i*j*t+h*n*t;this.n12=e*n*m-d*o*m-e*j*r+c*o*r+d*j*t-c*n*t;this.n13=d*l*m-e*i*m+e*h*r-c*l*r-d*h*t+c*i*t;this.n14=e*i*j-d*l*j-e*h*n+c*l*n+d*h*o-c*i*o;this.n21=l*n*p-i*o*p-l*k*r+g*o*r+i*k*t-g*n*t;this.n22=d*o*p-e*n*p+
+e*k*r-b*o*r-d*k*t+b*n*t;this.n23=e*i*p-d*l*p-e*g*r+b*l*r+d*g*t-b*i*t;this.n24=d*l*k-e*i*k+e*g*n-b*l*n-d*g*o+b*i*o;this.n31=h*o*p-l*j*p+l*k*m-g*o*m-h*k*t+g*j*t;this.n32=e*j*p-c*o*p-e*k*m+b*o*m+c*k*t-b*j*t;this.n33=c*l*p-e*h*p+e*g*m-b*l*m-c*g*t+b*h*t;this.n34=e*h*k-c*l*k-e*g*j+b*l*j+c*g*o-b*h*o;this.n41=i*j*p-h*n*p-i*k*m+g*n*m+h*k*r-g*j*r;this.n42=c*n*p-d*j*p+d*k*m-b*n*m-c*k*r+b*j*r;this.n43=d*h*p-c*i*p-d*g*m+b*i*m+c*g*r-b*h*r;this.n44=c*i*k-d*h*k+d*g*j-b*i*j-c*g*n+b*h*n;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),h=Math.cos(d),d=Math.sin(d),i=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var l=h*i,k=h*e,j=d*i,n=d*e;this.n11=l+n*c;this.n12=j*c-k;this.n13=g*d;this.n21=g*e;this.n22=g*i;this.n23=-c;this.n31=k*c-j;this.n32=n+l*c;this.n33=g*h;break;case "ZXY":l=h*i;k=h*e;j=d*i;n=d*e;this.n11=l-n*c;this.n12=-g*e;this.n13=j+k*c;this.n21=k+j*c;this.n22=g*i;this.n23=n-l*c;this.n31=-g*d;this.n32=c;this.n33=g*h;break;case "ZYX":l=
+g*i;k=g*e;j=c*i;n=c*e;this.n11=h*i;this.n12=j*d-k;this.n13=l*d+n;this.n21=h*e;this.n22=n*d+l;this.n23=k*d-j;this.n31=-d;this.n32=c*h;this.n33=g*h;break;case "YZX":l=g*h;k=g*d;j=c*h;n=c*d;this.n11=h*i;this.n12=n-l*e;this.n13=j*e+k;this.n21=e;this.n22=g*i;this.n23=-c*i;this.n31=-d*i;this.n32=k*e+j;this.n33=l-n*e;break;case "XZY":l=g*h;k=g*d;j=c*h;n=c*d;this.n11=h*i;this.n12=-e;this.n13=d*i;this.n21=l*e+n;this.n22=g*i;this.n23=k*e-j;this.n31=j*e-k;this.n32=c*i;this.n33=n*e+l;break;default:l=g*i,k=g*
+e,j=c*i,n=c*e,this.n11=h*i,this.n12=-h*e,this.n13=d,this.n21=k+j*d,this.n22=l-n*d,this.n23=-c*h,this.n31=n-l*d,this.n32=j+k*d,this.n33=g*h}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,g=b+b,h=c+c,i=d+d,a=b*g,l=b*h,b=b*i,k=c*h,c=c*i,d=d*i,g=e*g,h=e*h,e=e*i;this.n11=1-(k+d);this.n12=l-e;this.n13=b+h;this.n21=l+e;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+k);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
 a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var 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},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===
-a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,g=Math.sqrt(c*c+d*d+e*e),c=c/g,d=d/g,e=e/g,g=c*c,h=d*d,i=e*e,k=Math.cos(b),m=Math.sin(b),j=1-k,n=c*d*j,o=c*e*j,j=d*e*j,c=c*m,p=d*m,m=e*m,e=g+(1-g)*k,g=n+m,d=o-p,n=n-m,h=h+(1-h)*k,m=j+c,o=o+p,j=j-c,i=i+(1-i)*k,k=this.n11,c=this.n21,p=this.n31,l=this.n41,r=this.n12,t=this.n22,z=this.n32,y=this.n42,K=this.n13,N=this.n23,u=this.n33,J=this.n43;this.n11=e*k+g*r+d*K;this.n21=e*c+g*t+d*N;this.n31=e*p+g*z+d*u;this.n41=e*l+g*y+d*J;this.n12=n*k+h*r+m*K;this.n22=
-n*c+h*t+m*N;this.n32=n*p+h*z+m*u;this.n42=n*l+h*y+m*J;this.n13=o*k+j*r+i*K;this.n23=o*c+j*t+i*N;this.n33=o*p+j*z+i*u;this.n43=o*l+j*y+i*J;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,g=this.n13,h=this.n23,i=this.n33,k=this.n43,m=Math.cos(a),a=Math.sin(a);this.n12=m*b+a*g;this.n22=m*c+a*h;this.n32=m*d+a*i;this.n42=m*e+a*k;this.n13=m*g-a*b;this.n23=m*h-a*c;this.n33=m*i-a*d;this.n43=m*k-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,
-g=this.n13,h=this.n23,i=this.n33,k=this.n43,m=Math.cos(a),a=Math.sin(a);this.n11=m*b-a*g;this.n21=m*c-a*h;this.n31=m*d-a*i;this.n41=m*e-a*k;this.n13=m*g+a*b;this.n23=m*h+a*c;this.n33=m*i+a*d;this.n43=m*k+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=this.n41,g=this.n12,h=this.n22,i=this.n32,k=this.n42,m=Math.cos(a),a=Math.sin(a);this.n11=m*b+a*g;this.n21=m*c+a*h;this.n31=m*d+a*i;this.n41=m*e+a*k;this.n12=m*g-a*b;this.n22=m*h-a*c;this.n32=m*i-a*d;this.n42=m*k-a*e;return this},
+a.z)return this.rotateZ(b);var c=a.x,d=a.y,e=a.z,g=Math.sqrt(c*c+d*d+e*e),c=c/g,d=d/g,e=e/g,g=c*c,h=d*d,i=e*e,l=Math.cos(b),k=Math.sin(b),j=1-l,n=c*d*j,o=c*e*j,j=d*e*j,c=c*k,p=d*k,k=e*k,e=g+(1-g)*l,g=n+k,d=o-p,n=n-k,h=h+(1-h)*l,k=j+c,o=o+p,j=j-c,i=i+(1-i)*l,l=this.n11,c=this.n21,p=this.n31,m=this.n41,r=this.n12,t=this.n22,z=this.n32,y=this.n42,K=this.n13,N=this.n23,u=this.n33,J=this.n43;this.n11=e*l+g*r+d*K;this.n21=e*c+g*t+d*N;this.n31=e*p+g*z+d*u;this.n41=e*m+g*y+d*J;this.n12=n*l+h*r+k*K;this.n22=
+n*c+h*t+k*N;this.n32=n*p+h*z+k*u;this.n42=n*m+h*y+k*J;this.n13=o*l+j*r+i*K;this.n23=o*c+j*t+i*N;this.n33=o*p+j*z+i*u;this.n43=o*m+j*y+i*J;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=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*c+a*h;this.n32=k*d+a*i;this.n42=k*e+a*l;this.n13=k*g-a*b;this.n23=k*h-a*c;this.n33=k*i-a*d;this.n43=k*l-a*e;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,e=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*c-a*h;this.n31=k*d-a*i;this.n41=k*e-a*l;this.n13=k*g+a*b;this.n23=k*h+a*c;this.n33=k*i+a*d;this.n43=k*l+a*e;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,e=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*c+a*h;this.n31=k*d+a*i;this.n41=k*e+a*l;this.n12=k*g-a*b;this.n22=k*h-a*c;this.n32=k*i-a*d;this.n42=k*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,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,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,n=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*h+a.n31*m;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*h;c[4]=a*i;c[5]=a*k;c[6]=a*m;c[7]=a*j;c[8]=a*n;return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,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,n=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*h+a.n31*k;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*g;c[3]=a*h;c[4]=a*i;c[5]=a*l;c[6]=a*k;c[7]=a*j;c[8]=a*n;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,g){var h;h=new THREE.Matrix4;h.n11=2*e/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*e/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+e)/(g-e);h.n34=-2*g*e/(g-e);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};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 h,i,k,m;h=new THREE.Matrix4;i=b-a;k=c-d;m=g-e;h.n11=2/i;h.n12=0;h.n13=0;h.n14=-((b+a)/i);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((c+d)/k);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+e)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,e,g){var h,i,l,k;h=new THREE.Matrix4;i=b-a;l=c-d;k=g-e;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=-((c+d)/l);h.n31=0;h.n32=0;h.n33=-2/k;h.n34=-((g+e)/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(-1===
 this.children.indexOf(a)){void 0!==a.parent&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.removeObject(a)}},getChildByName:function(a,b){var c,d,e;for(c=0,d=this.children.length;c<d;c++){e=this.children[c];if(e.name===
 a||b&&(e=e.getChildByName(a,b),void 0!==e))return e}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=h[g]=h[g]||new THREE.RenderableObject;g++;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,f=1,d=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=d&&0<=e&&0<=g&&0<=h)return!0;if(0>d&&0>e||0>g&&0>h)return!1;0>d?c=Math.max(c,d/(d-e)):0>e&&(f=Math.min(f,d/(d-e)));0>g?c=Math.max(c,g/(g-h)):0>h&&(f=Math.min(f,g/(g-h)));if(f<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-f);return!0}
-var e,g,h=[],i,k,m=[],j,n,o=[],p,l=[],r,t,z=[],y,K,N=[],u={objects:[],sprites:[],lights:[],elements:[]},J=new THREE.Vector3,H=new THREE.Vector4,B=new THREE.Matrix4,D=new THREE.Matrix4,M=new THREE.Frustum,I=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);B.multiply(b.projectionMatrix,b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);B.multiply(b.matrixWorld,
+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 c(a,b){return b.z-a.z}function d(a,b){var c=0,f=1,d=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=d&&0<=e&&0<=g&&0<=h)return!0;if(0>d&&0>e||0>g&&0>h)return!1;0>d?c=Math.max(c,d/(d-e)):0>e&&(f=Math.min(f,d/(d-e)));0>g?c=Math.max(c,g/(g-h)):0>h&&(f=Math.min(f,g/(g-h)));if(f<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-f);return!0}
+var e,g,h=[],i,l,k=[],j,n,o=[],p,m=[],r,t,z=[],y,K,N=[],u={objects:[],sprites:[],lights:[],elements:[]},J=new THREE.Vector3,H=new THREE.Vector4,B=new THREE.Matrix4,D=new THREE.Matrix4,M=new THREE.Frustum,I=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);B.multiply(b.projectionMatrix,b.matrixWorldInverse);B.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);B.multiply(b.matrixWorld,
 b.projectionMatrixInverse);B.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;u.objects.length=0;u.sprites.length=0;u.lights.length=0;var h=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||M.contains(b))?(B.multiplyVector3(J.copy(b.position)),e=a(),e.object=
 b,e.z=J.z,u.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(B.multiplyVector3(J.copy(b.position)),e=a(),e.object=b,e.z=J.z,u.sprites.push(e)):b instanceof THREE.Light&&u.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)h(b.children[c])}};h(b);d&&u.objects.sort(c);return u};this.projectScene=function(a,e,g){var f=e.near,h=e.far,J,sa,L,ma,V,na,ha,W,Z,va,Ka,Ra,lb,Ma,gb,Na;K=t=p=n=0;u.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);B.multiply(e.projectionMatrix,e.matrixWorldInverse);M.setFromMatrix(B);u=this.projectGraph(a,!1);for(a=0,J=u.objects.length;a<J;a++)if(Z=u.objects[a].object,va=Z.matrixWorld,Ra=Z.material,k=0,Z instanceof THREE.Mesh){Ka=Z.geometry;lb=Z.geometry.materials;ma=Ka.vertices;Ma=Ka.faces;gb=Ka.faceVertexUvs;Ka=Z.matrixRotationWorld.extractRotation(va);for(sa=0,L=ma.length;sa<L;sa++)i=b(),i.positionWorld.copy(ma[sa].position),
-va.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),B.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>f&&i.positionScreen.z<h;for(ma=0,sa=Ma.length;ma<sa;ma++){L=Ma[ma];if(L instanceof THREE.Face3)if(V=m[L.a],na=m[L.b],ha=m[L.c],V.visible&&na.visible&&ha.visible&&(Z.doubleSided||Z.flipSided!=0>(ha.positionScreen.x-V.positionScreen.x)*(na.positionScreen.y-V.positionScreen.y)-(ha.positionScreen.y-
-V.positionScreen.y)*(na.positionScreen.x-V.positionScreen.x)))W=o[n]=o[n]||new THREE.RenderableFace3,n++,j=W,j.v1.copy(V),j.v2.copy(na),j.v3.copy(ha);else continue;else if(L instanceof THREE.Face4)if(V=m[L.a],na=m[L.b],ha=m[L.c],W=m[L.d],V.visible&&na.visible&&ha.visible&&W.visible&&(Z.doubleSided||Z.flipSided!=(0>(W.positionScreen.x-V.positionScreen.x)*(na.positionScreen.y-V.positionScreen.y)-(W.positionScreen.y-V.positionScreen.y)*(na.positionScreen.x-V.positionScreen.x)||0>(na.positionScreen.x-
-ha.positionScreen.x)*(W.positionScreen.y-ha.positionScreen.y)-(na.positionScreen.y-ha.positionScreen.y)*(W.positionScreen.x-ha.positionScreen.x))))Na=l[p]=l[p]||new THREE.RenderableFace4,p++,j=Na,j.v1.copy(V),j.v2.copy(na),j.v3.copy(ha),j.v4.copy(W);else continue;j.normalWorld.copy(L.normal);Ka.multiplyVector3(j.normalWorld);j.centroidWorld.copy(L.centroid);va.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);B.multiplyVector3(j.centroidScreen);ha=L.vertexNormals;for(V=0,na=
+a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);B.multiply(e.projectionMatrix,e.matrixWorldInverse);M.setFromMatrix(B);u=this.projectGraph(a,!1);for(a=0,J=u.objects.length;a<J;a++)if(Z=u.objects[a].object,va=Z.matrixWorld,Ra=Z.material,l=0,Z instanceof THREE.Mesh){Ka=Z.geometry;lb=Z.geometry.materials;ma=Ka.vertices;Ma=Ka.faces;gb=Ka.faceVertexUvs;Ka=Z.matrixRotationWorld.extractRotation(va);for(sa=0,L=ma.length;sa<L;sa++)i=b(),i.positionWorld.copy(ma[sa].position),
+va.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),B.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>f&&i.positionScreen.z<h;for(ma=0,sa=Ma.length;ma<sa;ma++){L=Ma[ma];if(L instanceof THREE.Face3)if(V=k[L.a],na=k[L.b],ha=k[L.c],V.visible&&na.visible&&ha.visible&&(Z.doubleSided||Z.flipSided!=0>(ha.positionScreen.x-V.positionScreen.x)*(na.positionScreen.y-V.positionScreen.y)-(ha.positionScreen.y-
+V.positionScreen.y)*(na.positionScreen.x-V.positionScreen.x)))W=o[n]=o[n]||new THREE.RenderableFace3,n++,j=W,j.v1.copy(V),j.v2.copy(na),j.v3.copy(ha);else continue;else if(L instanceof THREE.Face4)if(V=k[L.a],na=k[L.b],ha=k[L.c],W=k[L.d],V.visible&&na.visible&&ha.visible&&W.visible&&(Z.doubleSided||Z.flipSided!=(0>(W.positionScreen.x-V.positionScreen.x)*(na.positionScreen.y-V.positionScreen.y)-(W.positionScreen.y-V.positionScreen.y)*(na.positionScreen.x-V.positionScreen.x)||0>(na.positionScreen.x-
+ha.positionScreen.x)*(W.positionScreen.y-ha.positionScreen.y)-(na.positionScreen.y-ha.positionScreen.y)*(W.positionScreen.x-ha.positionScreen.x))))Na=m[p]=m[p]||new THREE.RenderableFace4,p++,j=Na,j.v1.copy(V),j.v2.copy(na),j.v3.copy(ha),j.v4.copy(W);else continue;j.normalWorld.copy(L.normal);Ka.multiplyVector3(j.normalWorld);j.centroidWorld.copy(L.centroid);va.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);B.multiplyVector3(j.centroidScreen);ha=L.vertexNormals;for(V=0,na=
 ha.length;V<na;V++)W=j.vertexNormalsWorld[V],W.copy(ha[V]),Ka.multiplyVector3(W);for(V=0,na=gb.length;V<na;V++)if(Na=gb[V][ma])for(ha=0,W=Na.length;ha<W;ha++)j.uvs[V][ha]=Na[ha];j.material=Ra;j.faceMaterial=null!==L.materialIndex?lb[L.materialIndex]:null;j.z=j.centroidScreen.z;u.elements.push(j)}}else if(Z instanceof THREE.Line){D.multiply(B,va);ma=Z.geometry.vertices;V=b();V.positionScreen.copy(ma[0].position);D.multiplyVector4(V.positionScreen);for(sa=1,L=ma.length;sa<L;sa++)if(V=b(),V.positionScreen.copy(ma[sa].position),
-D.multiplyVector4(V.positionScreen),na=m[k-2],I.copy(V.positionScreen),Q.copy(na.positionScreen),d(I,Q))I.multiplyScalar(1/I.w),Q.multiplyScalar(1/Q.w),Z=z[t]=z[t]||new THREE.RenderableLine,t++,r=Z,r.v1.positionScreen.copy(I),r.v2.positionScreen.copy(Q),r.z=Math.max(I.z,Q.z),r.material=Ra,u.elements.push(r)}for(a=0,J=u.sprites.length;a<J;a++)if(Z=u.sprites[a].object,va=Z.matrixWorld,Z instanceof THREE.Particle&&(H.set(va.n14,va.n24,va.n34,1),B.multiplyVector4(H),H.z/=H.w,0<H.z&&1>H.z))f=N[K]=N[K]||
+D.multiplyVector4(V.positionScreen),na=k[l-2],I.copy(V.positionScreen),Q.copy(na.positionScreen),d(I,Q))I.multiplyScalar(1/I.w),Q.multiplyScalar(1/Q.w),Z=z[t]=z[t]||new THREE.RenderableLine,t++,r=Z,r.v1.positionScreen.copy(I),r.v2.positionScreen.copy(Q),r.z=Math.max(I.z,Q.z),r.material=Ra,u.elements.push(r)}for(a=0,J=u.sprites.length;a<J;a++)if(Z=u.sprites[a].object,va=Z.matrixWorld,Z instanceof THREE.Particle&&(H.set(va.n14,va.n24,va.n34,1),B.multiplyVector4(H),H.z/=H.w,0<H.z&&1>H.z))f=N[K]=N[K]||
 new THREE.RenderableParticle,K++,y=f,y.x=H.x/H.w,y.y=H.y/H.w,y.z=H.z,y.rotation=Z.rotation.z,y.scale.x=Z.scale.x*Math.abs(y.x-(H.x+e.projectionMatrix.n11)/(H.w+e.projectionMatrix.n14)),y.scale.y=Z.scale.y*Math.abs(y.y-(H.y+e.projectionMatrix.n22)/(H.w+e.projectionMatrix.n24)),y.material=Z.material,u.elements.push(y);g&&u.elements.sort(c);return u}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,void 0!==d?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),h=a*b,i=d*e;this.w=h*g-i*c;this.x=h*c+i*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=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
-this.x,c=this.y,d=this.z,e=this.w,g=a.x,h=a.y,i=a.z,a=a.w;this.x=b*a+e*g+c*i-d*h;this.y=c*a+e*h+d*g-b*i;this.z=d*a+e*i+b*h-c*g;this.w=e*a-b*g-c*h-d*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,h=this.y,i=this.z,k=this.w,m=k*c+h*e-i*d,j=k*d+i*c-g*e,n=k*e+g*d-h*c,c=-g*
-c-h*d-i*e;b.x=m*k+c*-g+j*-i-n*-h;b.y=j*k+c*-h+n*-g-m*-i;b.z=n*k+c*-i+m*-h-j*-g;return b}};
+this.x,c=this.y,d=this.z,e=this.w,g=a.x,h=a.y,i=a.z,a=a.w;this.x=b*a+e*g+c*i-d*h;this.y=c*a+e*h+d*g-b*i;this.z=d*a+e*i+b*h-c*g;this.w=e*a-b*g-c*h-d*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,h=this.y,i=this.z,l=this.w,k=l*c+h*e-i*d,j=l*d+i*c-g*e,n=l*e+g*d-h*c,c=-g*
+c-h*d-i*e;b.x=k*l+c*-g+j*-i-n*-h;b.y=j*l+c*-h+n*-g-k*-i;b.z=n*l+c*-i+k*-h-j*-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;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),e=Math.sqrt(1-e*e);if(0.0010>Math.abs(e))return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*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,h){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=h;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
@@ -86,22 +86,22 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 b,c,d,e,g,h=new THREE.Vector3,i=new THREE.Vector3;for(a=0,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],h.sub(g.position,e.position),i.sub(d.position,e.position),h.crossSelf(i),h.isZero()||h.normalize(),c.normal.copy(h)},computeVertexNormals:function(){var a,b,c,d;if(void 0===this.__tmpVertices){d=this.__tmpVertices=Array(this.vertices.length);for(a=0,b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;for(a=0,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;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),
 d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,
-b,c,f,d,e,g){i=a.vertices[b].position;k=a.vertices[c].position;m=a.vertices[f].position;j=h[d];n=h[e];o=h[g];p=k.x-i.x;l=m.x-i.x;r=k.y-i.y;t=m.y-i.y;z=k.z-i.z;y=m.z-i.z;K=n.u-j.u;N=o.u-j.u;u=n.v-j.v;J=o.v-j.v;H=1/(K*J-N*u);I.set((J*p-u*l)*H,(J*r-u*t)*H,(J*z-u*y)*H);Q.set((K*l-N*p)*H,(K*t-N*r)*H,(K*y-N*z)*H);D[b].addSelf(I);D[c].addSelf(I);D[f].addSelf(I);M[b].addSelf(Q);M[c].addSelf(Q);M[f].addSelf(Q)}var b,c,d,e,g,h,i,k,m,j,n,o,p,l,r,t,z,y,K,N,u,J,H,B,D=[],M=[],I=new THREE.Vector3,Q=new THREE.Vector3,
+b,c,f,d,e,g){i=a.vertices[b].position;l=a.vertices[c].position;k=a.vertices[f].position;j=h[d];n=h[e];o=h[g];p=l.x-i.x;m=k.x-i.x;r=l.y-i.y;t=k.y-i.y;z=l.z-i.z;y=k.z-i.z;K=n.u-j.u;N=o.u-j.u;u=n.v-j.v;J=o.v-j.v;H=1/(K*J-N*u);I.set((J*p-u*m)*H,(J*r-u*t)*H,(J*z-u*y)*H);Q.set((K*m-N*p)*H,(K*t-N*r)*H,(K*y-N*z)*H);D[b].addSelf(I);D[c].addSelf(I);D[f].addSelf(I);M[b].addSelf(Q);M[c].addSelf(Q);M[f].addSelf(Q)}var b,c,d,e,g,h,i,l,k,j,n,o,p,m,r,t,z,y,K,N,u,J,H,B,D=[],M=[],I=new THREE.Vector3,Q=new THREE.Vector3,
 ga=new THREE.Vector3,xa=new THREE.Vector3,A=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)D[b]=new THREE.Vector3,M[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)g=this.faces[b],h=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var f=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)A.copy(g.vertexNormals[d]),e=g[f[d]],
 B=D[e],ga.copy(B),ga.subSelf(A.multiplyScalar(A.dot(B))).normalize(),xa.cross(g.vertexNormals[d],B),e=xa.dot(M[e]),e=0>e?-1:1,g.vertexTangents[d]=new THREE.Vector4(ga.x,ga.y,ga.z,e)}this.hasTangents=!0},computeBoundingBox:function(){if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox?(this.boundingBox.min.copy(a),this.boundingBox.max.copy(a)):this.boundingBox={min:a.clone(),max:a.clone()};for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;d<
 e;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}},computeBoundingSphere:function(){for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere={radius:b}},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),g,h;for(g=0,h=this.vertices.length;g<h;g++)d=this.vertices[g].position,d=[Math.round(d.x*e),Math.round(d.y*e),
 Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];for(g=0,h=this.faces.length;g<h;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,d,e,g,h){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,g,h,i,k,m,j,n,o;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);h=e-g;c[0]=0===g?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;m=this.points[c[0]];j=this.points[c[1]];
-n=this.points[c[2]];o=this.points[c[3]];i=h*h;k=h*i;d.x=b(m.x,j.x,n.x,o.x,h,i,k);d.y=b(m.y,j.y,n.y,o.y,h,i,k);d.z=b(m.z,j.z,n.z,o.z,h,i,k);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,h=new THREE.Vector3,i=[],j=0;i[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),h.copy(d),j+=h.distanceTo(g),
-g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(i[b]=j,e=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,d,e,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++){c=m.chunks[b]-m.chunks[b-1];h=Math.ceil(a*c/m.total);e=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<h-1;c++)d=e+c*(1/h)*(g-e),d=this.getPoint(d),i.push(j.copy(d).clone());i.push(j.copy(this.points[b]).clone())}this.points=
+THREE.Spline=function(a){function b(a,b,c,d,e,g,h){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,g,h,i,l,k,j,n,o;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);h=e-g;c[0]=0===g?g:g-1;c[1]=g;c[2]=g>this.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;k=this.points[c[0]];j=this.points[c[1]];
+n=this.points[c[2]];o=this.points[c[3]];i=h*h;l=h*i;d.x=b(k.x,j.x,n.x,o.x,h,i,l);d.y=b(k.y,j.y,n.y,o.y,h,i,l);d.z=b(k.z,j.z,n.z,o.z,h,i,l);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,h=new THREE.Vector3,i=[],j=0;i[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),h.copy(d),j+=h.distanceTo(g),
+g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(i[b]=j,e=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,d,e,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++){c=k.chunks[b]-k.chunks[b-1];h=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<h-1;c++)d=e+c*(1/h)*(g-e),d=this.getPoint(d),i.push(j.copy(d).clone());i.push(j.copy(this.points[b]).clone())}this.points=
 i}};THREE.Edge=function(a,b,c,d){this.vertices=[a,b];this.vertexIndices=[c,d];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};
 THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,e,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==g?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=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
 THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((void 0!==b?b:43.25)/(2*a));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
-THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=new THREE.Light;
-THREE.PointLight.prototype.constructor=THREE.PointLight;
+THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.onlyShadow=this.castShadow=!1;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=this.shadowMapSize=
+this.shadowMap=null};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.SpotLight=function(a,b,c,d){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.castShadow=void 0!==d?d:!1;this.onlyShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};
 THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
 THREE.Material=function(a){a=a||{};this.name="";this.id=THREE.MaterialCount++;this.opacity=void 0!==a.opacity?a.opacity:1;this.transparent=void 0!==a.transparent?a.transparent:!1;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.depthTest=void 0!==a.depthTest?a.depthTest:!0;this.depthWrite=void 0!==a.depthWrite?a.depthWrite:!0;this.polygonOffset=void 0!==a.polygonOffset?a.polygonOffset:!1;this.polygonOffsetFactor=void 0!==a.polygonOffsetFactor?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
@@ -125,7 +125,7 @@ a.fog?a.fog:!1;this.lights=void 0!==a.lights?a.lights:!1;this.vertexColors=void
 THREE.Texture=function(a,b,c,d,e,g,h,i){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==g?g:THREE.LinearMipMapLinearFilter;this.format=void 0!==h?h:THREE.RGBAFormat;this.type=void 0!==i?i:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
 !0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};
 THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;
-THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,e,g,h,i,k,m){THREE.Texture.call(this,null,g,h,i,k,m,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,e,g,h,i,l,k){THREE.Texture.call(this,null,g,h,i,l,k,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.sortParticles=!1;if(this.geometry)this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius;this.frustumCulled=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
 THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=void 0!==c?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
@@ -184,111 +184,112 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragme
 THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(void 0===a.__webglCustomAttributesList)a.__webglCustomAttributesList=[];for(var e in d.attributes){var g=d.attributes[e];if(!g.__webglInitialized||g.createUniqueBuffers){g.__webglInitialized=!0;var h=1;"v2"===g.type?h=2:"v3"===g.type?h=3:"v4"===g.type?h=4:"c"===g.type&&(h=3);g.size=h;g.array=new Float32Array(c*h);g.buffer=f.createBuffer();g.buffer.belongsToAttribute=e;g.needsUpdate=!0}a.__webglCustomAttributesList.push(g)}}}
 function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(0<=b.materialIndex)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?!0:!1}function g(a,b,c){var d,e,g,h,i=a.vertices;h=i.length;
-var j=a.colors,m=j.length,n=a.__vertexArray,l=a.__colorArray,k=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,r=a.__webglCustomAttributesList;if(c.sortParticles){Sa.multiplySelf(c.matrixWorld);for(d=0;d<h;d++)e=i[d].position,Oa.copy(e),Sa.multiplyVector3(Oa),k[d]=[Oa.z,d];k.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++)e=i[k[d][1]].position,g=3*d,n[g]=e.x,n[g+1]=e.y,n[g+2]=e.z;for(d=0;d<m;d++)g=3*d,e=j[k[d][1]],l[g]=e.r,l[g+1]=e.g,l[g+2]=e.b;if(r)for(j=0,m=r.length;j<m;j++)if(i=r[j],
-void 0===i.boundTo||"vertices"===i.boundTo)if(g=0,e=i.value.length,1===i.size)for(d=0;d<e;d++)h=k[d][1],i.array[d]=i.value[h];else if(2===i.size)for(d=0;d<e;d++)h=k[d][1],h=i.value[h],i.array[g]=h.x,i.array[g+1]=h.y,g+=2;else if(3===i.size)if("c"===i.type)for(d=0;d<e;d++)h=k[d][1],h=i.value[h],i.array[g]=h.r,i.array[g+1]=h.g,i.array[g+2]=h.b,g+=3;else for(d=0;d<e;d++)h=k[d][1],h=i.value[h],i.array[g]=h.x,i.array[g+1]=h.y,i.array[g+2]=h.z,g+=3;else if(4===i.size)for(d=0;d<e;d++)h=k[d][1],h=i.value[h],
-i.array[g]=h.x,i.array[g+1]=h.y,i.array[g+2]=h.z,i.array[g+3]=h.w,g+=4}else{if(o)for(d=0;d<h;d++)e=i[d].position,g=3*d,n[g]=e.x,n[g+1]=e.y,n[g+2]=e.z;if(p)for(d=0;d<m;d++)e=j[d],g=3*d,l[g]=e.r,l[g+1]=e.g,l[g+2]=e.b;if(r)for(j=0,m=r.length;j<m;j++)if(i=r[j],i.needsUpdate&&(void 0===i.boundTo||"vertices"===i.boundTo))if(e=i.value.length,g=0,1===i.size)for(d=0;d<e;d++)i.array[d]=i.value[d];else if(2===i.size)for(d=0;d<e;d++)h=i.value[d],i.array[g]=h.x,i.array[g+1]=h.y,g+=2;else if(3===i.size)if("c"===
+var j=a.colors,k=j.length,n=a.__vertexArray,m=a.__colorArray,l=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,r=a.__webglCustomAttributesList;if(c.sortParticles){Sa.multiplySelf(c.matrixWorld);for(d=0;d<h;d++)e=i[d].position,Oa.copy(e),Sa.multiplyVector3(Oa),l[d]=[Oa.z,d];l.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++)e=i[l[d][1]].position,g=3*d,n[g]=e.x,n[g+1]=e.y,n[g+2]=e.z;for(d=0;d<k;d++)g=3*d,e=j[l[d][1]],m[g]=e.r,m[g+1]=e.g,m[g+2]=e.b;if(r)for(j=0,k=r.length;j<k;j++)if(i=r[j],
+void 0===i.boundTo||"vertices"===i.boundTo)if(g=0,e=i.value.length,1===i.size)for(d=0;d<e;d++)h=l[d][1],i.array[d]=i.value[h];else if(2===i.size)for(d=0;d<e;d++)h=l[d][1],h=i.value[h],i.array[g]=h.x,i.array[g+1]=h.y,g+=2;else if(3===i.size)if("c"===i.type)for(d=0;d<e;d++)h=l[d][1],h=i.value[h],i.array[g]=h.r,i.array[g+1]=h.g,i.array[g+2]=h.b,g+=3;else for(d=0;d<e;d++)h=l[d][1],h=i.value[h],i.array[g]=h.x,i.array[g+1]=h.y,i.array[g+2]=h.z,g+=3;else if(4===i.size)for(d=0;d<e;d++)h=l[d][1],h=i.value[h],
+i.array[g]=h.x,i.array[g+1]=h.y,i.array[g+2]=h.z,i.array[g+3]=h.w,g+=4}else{if(o)for(d=0;d<h;d++)e=i[d].position,g=3*d,n[g]=e.x,n[g+1]=e.y,n[g+2]=e.z;if(p)for(d=0;d<k;d++)e=j[d],g=3*d,m[g]=e.r,m[g+1]=e.g,m[g+2]=e.b;if(r)for(j=0,k=r.length;j<k;j++)if(i=r[j],i.needsUpdate&&(void 0===i.boundTo||"vertices"===i.boundTo))if(e=i.value.length,g=0,1===i.size)for(d=0;d<e;d++)i.array[d]=i.value[d];else if(2===i.size)for(d=0;d<e;d++)h=i.value[d],i.array[g]=h.x,i.array[g+1]=h.y,g+=2;else if(3===i.size)if("c"===
 i.type)for(d=0;d<e;d++)h=i.value[d],i.array[g]=h.r,i.array[g+1]=h.g,i.array[g+2]=h.b,g+=3;else for(d=0;d<e;d++)h=i.value[d],i.array[g]=h.x,i.array[g+1]=h.y,i.array[g+2]=h.z,g+=3;else if(4===i.size)for(d=0;d<e;d++)h=i.value[d],i.array[g]=h.x,i.array[g+1]=h.y,i.array[g+2]=h.z,i.array[g+3]=h.w,g+=4}if(o||c.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,a.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,n,b);if(p||c.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,a.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,
-l,b);if(r)for(j=0,m=r.length;j<m;j++)if(i=r[j],i.needsUpdate||c.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,i.buffer),f.bufferData(f.ARRAY_BUFFER,i.array,b)}function h(a,b){return b.z-a.z}function i(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++)fb=null,L=ma=va=Z=W=-1,a[d].render(b,c,Nb,ac),fb=null,L=ma=va=Z=W=-1}function k(a,b,c,d,f,e,g,h){var i,j,m,n;b?(j=a.length-1,n=b=-1):(j=0,b=a.length,n=1);for(var l=j;l!==b;l+=n)if(i=a[l],i.render){j=i.object;m=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;
-g&&A.setBlending(i.blending);A.setDepthTest(i.depthTest);A.setDepthWrite(i.depthWrite);z(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}A.setObjectFaces(j);m instanceof THREE.BufferGeometry?A.renderBufferDirect(d,f,e,i,m,j):A.renderBuffer(d,f,e,i,m,j)}}function m(a,b,c,d,f,e,g){for(var h,i,j=0,m=a.length;j<m;j++)if(h=a[j],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;e&&A.setBlending(h.blending);A.setDepthTest(h.depthTest);A.setDepthWrite(h.depthWrite);z(h.polygonOffset,h.polygonOffsetFactor,
-h.polygonOffsetUnits)}A.renderImmediateObject(c,d,f,h,i)}}function j(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function o(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function p(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function l(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function r(a,b,c,d,e){d.program||A.initMaterial(d,b,c,e);if(d.morphTargets&&
+m,b);if(r)for(j=0,k=r.length;j<k;j++)if(i=r[j],i.needsUpdate||c.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,i.buffer),f.bufferData(f.ARRAY_BUFFER,i.array,b)}function h(a,b){return b.z-a.z}function i(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++)fb=null,L=ma=va=Z=W=-1,a[d].render(b,c,Nb,ac),fb=null,L=ma=va=Z=W=-1}function l(a,b,c,d,f,e,g,h){var i,j,k,n;b?(j=a.length-1,n=b=-1):(j=0,b=a.length,n=1);for(var m=j;m!==b;m+=n)if(i=a[m],i.render){j=i.object;k=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;
+g&&A.setBlending(i.blending);A.setDepthTest(i.depthTest);A.setDepthWrite(i.depthWrite);z(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}A.setObjectFaces(j);k instanceof THREE.BufferGeometry?A.renderBufferDirect(d,f,e,i,k,j):A.renderBuffer(d,f,e,i,k,j)}}function k(a,b,c,d,f,e,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;e&&A.setBlending(h.blending);A.setDepthTest(h.depthTest);A.setDepthWrite(h.depthWrite);z(h.polygonOffset,h.polygonOffsetFactor,
+h.polygonOffsetUnits)}A.renderImmediateObject(c,d,f,h,i)}}function j(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function o(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function p(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function m(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function r(a,b,c,d,e){d.program||A.initMaterial(d,b,c,e);if(d.morphTargets&&
 !e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(A.maxMorphTargets);for(var g=0,h=A.maxMorphTargets;g<h;g++)e.__webglMorphTargetInfluences[g]=0}var i=!1,g=d.program,h=g.uniforms,j=d.uniforms;g!==fb&&(f.useProgram(g),fb=g,i=!0);if(d.id!==L)L=d.id,i=!0;if(i){f.uniformMatrix4fv(h.projectionMatrix,!1,a._projectionMatrixArray);if(c&&d.fog)if(j.fogColor.value=c.color,c instanceof THREE.Fog)j.fogNear.value=c.near,j.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)j.fogDensity.value=
-c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var m,n,l=0,k=0,o=0,p,r,t=bc,u=t.directional.colors,z=t.directional.positions,y=t.point.colors,B=t.point.positions,N=t.point.distances,D=0,I=0,M=r=0;for(c=0,i=b.length;c<i;c++)if(m=b[c],n=m.color,p=m.intensity,r=m.distance,m instanceof THREE.AmbientLight)A.gammaInput?(l+=n.r*n.r,k+=n.g*n.g,o+=n.b*n.b):(l+=n.r,k+=n.g,o+=n.b);else if(m instanceof THREE.DirectionalLight)r=3*D,A.gammaInput?(u[r]=n.r*n.r*
-p*p,u[r+1]=n.g*n.g*p*p,u[r+2]=n.b*n.b*p*p):(u[r]=n.r*p,u[r+1]=n.g*p,u[r+2]=n.b*p),m=m.matrixWorld.getPosition(),n=1/m.length(),z[r]=m.x*n,z[r+1]=m.y*n,z[r+2]=m.z*n,D+=1;else if(m instanceof THREE.SpotLight&&!m.onlyShadow)r=3*D,A.gammaInput?(u[r]=n.r*n.r*p*p,u[r+1]=n.g*n.g*p*p,u[r+2]=n.b*n.b*p*p):(u[r]=n.r*p,u[r+1]=n.g*p,u[r+2]=n.b*p),m=m.matrixWorld.getPosition(),n=1/m.length(),z[r]=m.x*n,z[r+1]=m.y*n,z[r+2]=m.z*n,D+=1;else if(m instanceof THREE.PointLight)M=3*I,A.gammaInput?(y[M]=n.r*n.r*p*p,y[M+
-1]=n.g*n.g*p*p,y[M+2]=n.b*n.b*p*p):(y[M]=n.r*p,y[M+1]=n.g*p,y[M+2]=n.b*p),m=m.matrixWorld.getPosition(),B[M]=m.x,B[M+1]=m.y,B[M+2]=m.z,N[I]=r,I+=1;for(c=3*D,i=u.length;c<i;c++)u[c]=0;for(c=3*I,i=y.length;c<i;c++)y[c]=0;t.point.length=I;t.directional.length=D;t.ambient[0]=l;t.ambient[1]=k;t.ambient[2]=o;c=bc;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=
+c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var k,n,m=0,l=0,o=0,p,r,t=bc,u=t.directional.colors,z=t.directional.positions,y=t.point.colors,B=t.point.positions,N=t.point.distances,D=0,I=0,M=r=0;for(c=0,i=b.length;c<i;c++)if(k=b[c],!k.onlyShadow)if(n=k.color,p=k.intensity,r=k.distance,k instanceof THREE.AmbientLight)A.gammaInput?(m+=n.r*n.r,l+=n.g*n.g,o+=n.b*n.b):(m+=n.r,l+=n.g,o+=n.b);else if(k instanceof THREE.DirectionalLight)r=3*D,A.gammaInput?
+(u[r]=n.r*n.r*p*p,u[r+1]=n.g*n.g*p*p,u[r+2]=n.b*n.b*p*p):(u[r]=n.r*p,u[r+1]=n.g*p,u[r+2]=n.b*p),k=k.matrixWorld.getPosition(),n=1/k.length(),z[r]=k.x*n,z[r+1]=k.y*n,z[r+2]=k.z*n,D+=1;else if(k instanceof THREE.SpotLight)r=3*D,A.gammaInput?(u[r]=n.r*n.r*p*p,u[r+1]=n.g*n.g*p*p,u[r+2]=n.b*n.b*p*p):(u[r]=n.r*p,u[r+1]=n.g*p,u[r+2]=n.b*p),k=k.matrixWorld.getPosition(),n=1/k.length(),z[r]=k.x*n,z[r+1]=k.y*n,z[r+2]=k.z*n,D+=1;else if(k instanceof THREE.PointLight)M=3*I,A.gammaInput?(y[M]=n.r*n.r*p*p,y[M+
+1]=n.g*n.g*p*p,y[M+2]=n.b*n.b*p*p):(y[M]=n.r*p,y[M+1]=n.g*p,y[M+2]=n.b*p),k=k.matrixWorld.getPosition(),B[M]=k.x,B[M+1]=k.y,B[M+2]=k.z,N[I]=r,I+=1;for(c=3*D,i=u.length;c<i;c++)u[c]=0;for(c=3*I,i=y.length;c<i;c++)y[c]=0;t.point.length=I;t.directional.length=D;t.ambient[0]=m;t.ambient[1]=l;t.ambient[2]=o;c=bc;j.ambientLightColor.value=c.ambient;j.directionalLightColor.value=c.directional.colors;j.directionalLightDirection.value=c.directional.positions;j.pointLightColor.value=c.point.colors;j.pointLightPosition.value=
 c.point.positions;j.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)j.opacity.value=d.opacity,A.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color,(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),j.lightMap.texture=d.lightMap,j.envMap.texture=d.envMap,j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?
 1:-1,j.reflectivity.value=d.reflectivity,j.refractionRatio.value=d.refractionRatio,j.combine.value=d.combine,j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)j.diffuse.value=d.color,j.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)j.psColor.value=d.color,j.opacity.value=d.opacity,j.size.value=d.size,j.scale.value=H.height/2,j.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)j.shininess.value=
 d.shininess,A.gammaInput?(j.ambient.value.copyGammaToLinear(d.ambient),j.specular.value.copyGammaToLinear(d.specular)):(j.ambient.value=d.ambient,j.specular.value=d.specular),d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)A.gammaInput?j.ambient.value.copyGammaToLinear(d.ambient):j.ambient.value=d.ambient,d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshDepthMaterial)j.mNear.value=a.near,j.mFar.value=a.far,j.opacity.value=d.opacity;
-else if(d instanceof THREE.MeshNormalMaterial)j.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&j.shadowMatrix){i=c=0;for(l=b.length;i<l;i++)if(k=b[i],k.castShadow&&k instanceof THREE.SpotLight)j.shadowMap.texture[c]=k.shadowMap,j.shadowMapSize.value[c]=k.shadowMapSize,j.shadowMatrix.value[c]=k.shadowMatrix,j.shadowDarkness.value[c]=k.shadowDarkness,j.shadowBias.value[c]=k.shadowBias,c++}b=d.uniformsList;for(j=0,c=b.length;j<c;j++)if(k=g.uniforms[b[j][1]])if(i=b[j][0],o=i.type,l=i.value,
-"i"===o)f.uniform1i(k,l);else if("f"===o)f.uniform1f(k,l);else if("v2"===o)f.uniform2f(k,l.x,l.y);else if("v3"===o)f.uniform3f(k,l.x,l.y,l.z);else if("v4"===o)f.uniform4f(k,l.x,l.y,l.z,l.w);else if("c"===o)f.uniform3f(k,l.r,l.g,l.b);else if("fv1"===o)f.uniform1fv(k,l);else if("fv"===o)f.uniform3fv(k,l);else if("v2v"===o){if(!i._array)i._array=new Float32Array(2*l.length);for(o=0,t=l.length;o<t;o++)u=2*o,i._array[u]=l[o].x,i._array[u+1]=l[o].y;f.uniform2fv(k,i._array)}else if("v3v"===o){if(!i._array)i._array=
-new Float32Array(3*l.length);for(o=0,t=l.length;o<t;o++)u=3*o,i._array[u]=l[o].x,i._array[u+1]=l[o].y,i._array[u+2]=l[o].z;f.uniform3fv(k,i._array)}else if("m4"===o){if(!i._array)i._array=new Float32Array(16);l.flattenToArray(i._array);f.uniformMatrix4fv(k,!1,i._array)}else if("m4v"===o){if(!i._array)i._array=new Float32Array(16*l.length);for(o=0,t=l.length;o<t;o++)l[o].flattenToArrayOffset(i._array,16*o);f.uniformMatrix4fv(k,!1,i._array)}else if("t"===o){if(f.uniform1i(k,l),k=i.texture)if(k.image instanceof
-Array&&6===k.image.length){if(i=k,6===i.image.length)if(i.needsUpdate){if(!i.image.__webglTextureCube)i.image.__webglTextureCube=f.createTexture();f.activeTexture(f.TEXTURE0+l);f.bindTexture(f.TEXTURE_CUBE_MAP,i.image.__webglTextureCube);l=[];for(k=0;6>k;k++){o=l;t=k;if(A.autoScaleCubemaps){if(u=i.image[k],y=rc,!(u.width<=y&&u.height<=y))B=Math.max(u.width,u.height),z=Math.floor(u.width*y/B),y=Math.floor(u.height*y/B),B=document.createElement("canvas"),B.width=z,B.height=y,B.getContext("2d").drawImage(u,
-0,0,u.width,u.height,0,0,z,y),u=B}else u=i.image[k];o[t]=u}k=l[0];o=0===(k.width&k.width-1)&&0===(k.height&k.height-1);t=J(i.format);u=J(i.type);K(f.TEXTURE_CUBE_MAP,i,o);for(k=0;6>k;k++)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,t,t,u,l[k]);i.generateMipmaps&&o&&f.generateMipmap(f.TEXTURE_CUBE_MAP);i.needsUpdate=!1;if(i.onUpdated)i.onUpdated()}else f.activeTexture(f.TEXTURE0+l),f.bindTexture(f.TEXTURE_CUBE_MAP,i.image.__webglTextureCube)}else k instanceof THREE.WebGLRenderTargetCube?(i=k,f.activeTexture(f.TEXTURE0+
-l),f.bindTexture(f.TEXTURE_CUBE_MAP,i.__webglTexture)):A.setTexture(k,l)}else if("tv"===o){if(!i._array){i._array=[];for(o=0,t=i.texture.length;o<t;o++)i._array[o]=l+o}f.uniform1iv(k,i._array);for(o=0,t=i.texture.length;o<t;o++)(k=i.texture[o])&&A.setTexture(k,i._array[o])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition&&f.uniform3f(h.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof
-THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&f.uniformMatrix4fv(h.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(f.uniformMatrix4fv(h.cameraInverseMatrix,!1,a._viewMatrixArray),f.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices))}f.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrixArray);h.normalMatrix&&f.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&
-null!==h.objectMatrix&&f.uniformMatrix4fv(h.objectMatrix,!1,e._objectMatrixArray);return g}function t(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function z(a,b,c){Ka!==a&&(a?f.enable(f.POLYGON_OFFSET_FILL):f.disable(f.POLYGON_OFFSET_FILL),Ka=a);if(a&&(Ra!==b||lb!==c))f.polygonOffset(b,c),Ra=b,lb=c}function y(a,b){var c;"fragment"===a?c=f.createShader(f.FRAGMENT_SHADER):
-"vertex"===a&&(c=f.createShader(f.VERTEX_SHADER));f.shaderSource(c,b);f.compileShader(c);return!f.getShaderParameter(c,f.COMPILE_STATUS)?(console.error(f.getShaderInfoLog(c)),console.error(b),null):c}function K(a,b,c){c?(f.texParameteri(a,f.TEXTURE_WRAP_S,J(b.wrapS)),f.texParameteri(a,f.TEXTURE_WRAP_T,J(b.wrapT)),f.texParameteri(a,f.TEXTURE_MAG_FILTER,J(b.magFilter)),f.texParameteri(a,f.TEXTURE_MIN_FILTER,J(b.minFilter))):(f.texParameteri(a,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(a,f.TEXTURE_WRAP_T,
-f.CLAMP_TO_EDGE),f.texParameteri(a,f.TEXTURE_MAG_FILTER,u(b.magFilter)),f.texParameteri(a,f.TEXTURE_MIN_FILTER,u(b.minFilter)))}function N(a,b){f.bindRenderbuffer(f.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,b.width,b.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_STENCIL,b.width,b.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,
-f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,a)):f.renderbufferStorage(f.RENDERBUFFER,f.RGBA4,b.width,b.height)}function u(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;default:return f.LINEAR}}function J(a){switch(a){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;
-case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return f.BYTE;case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;
-case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}var a=a||{},H=void 0!==a.canvas?a.canvas:document.createElement("canvas"),B=void 0!==a.precision?a.precision:"mediump",D=void 0!==a.antialias?a.antialias:!1,M=void 0!==a.stencil?a.stencil:!0,I=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,Q=void 0!==a.clearColor?new THREE.Color(a.clearColor):
-new THREE.Color(0),ga=void 0!==a.clearAlpha?a.clearAlpha:0,xa=void 0!==a.maxLights?a.maxLights:4;this.domElement=H;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.autoScaleCubemaps=!0;this.renderPluginsPre=
-[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var A=this,f,Ga=[],fb=null,sa=null,L=-1,ma=null,V=0,na=null,ha=null,W=null,Z=null,va=null,Ka=null,Ra=null,lb=null,Ma=null,gb=0,Na=0,yb=0,Db=0,Nb=0,ac=0,Ob=new THREE.Frustum,Sa=new THREE.Matrix4,Oa=new THREE.Vector4,bc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};f=function(){var a;try{if(!(a=H.getContext("experimental-webgl",
-{antialias:D,stencil:M,preserveDrawingBuffer:I})))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}();f.clearColor(0,0,0,1);f.clearDepth(1);f.clearStencil(0);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendEquation(f.FUNC_ADD);
-f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);f.clearColor(Q.r,Q.g,Q.b,ga);this.context=f;var cc=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS);f.getParameter(f.TEXTURE_SIZE);var rc=f.getParameter(f.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return f};this.supportsVertexTextures=function(){return 0<cc};this.setSize=function(a,b){H.width=a;H.height=b;this.setViewport(0,0,H.width,H.height)};this.setViewport=function(a,b,c,d){gb=a;Na=b;yb=c;Db=d;f.viewport(gb,Na,yb,Db)};this.setScissor=
-function(a,b,c,d){f.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.setClearColorHex=function(a,b){Q.setHex(a);ga=b;f.clearColor(Q.r,Q.g,Q.b,ga)};this.setClearColor=function(a,b){Q.copy(a);ga=b;f.clearColor(Q.r,Q.g,Q.b,ga)};this.getClearColor=function(){return Q};this.getClearAlpha=function(){return ga};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=f.COLOR_BUFFER_BIT;if(void 0===b||b)d|=f.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=
-f.STENCIL_BUFFER_BIT;f.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];f.deleteBuffer(c.__webglVertexBuffer);f.deleteBuffer(c.__webglNormalBuffer);f.deleteBuffer(c.__webglTangentBuffer);f.deleteBuffer(c.__webglColorBuffer);f.deleteBuffer(c.__webglUVBuffer);f.deleteBuffer(c.__webglUV2Buffer);f.deleteBuffer(c.__webglSkinVertexABuffer);f.deleteBuffer(c.__webglSkinVertexBBuffer);f.deleteBuffer(c.__webglSkinIndicesBuffer);f.deleteBuffer(c.__webglSkinWeightsBuffer);f.deleteBuffer(c.__webglFaceBuffer);f.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=
-0,e=c.numMorphTargets;d<e;d++)f.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)f.deleteBuffer(c.__webglCustomAttributesList[d].buffer);A.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,f.deleteBuffer(a.__webglVertexBuffer),f.deleteBuffer(a.__webglColorBuffer),A.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,f.deleteBuffer(a.__webglVertexBuffer),f.deleteBuffer(a.__webglColorBuffer),
-A.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,f.deleteBuffer(a.__webglVertexBuffer),f.deleteBuffer(a.__webglColorBuffer),A.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,f.deleteTexture(a.__webglTexture),A.info.memory.textures--};this.updateShadowMap=function(a,b){fb=null;L=ma=va=Z=W=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=f.createBuffer();
-if(!a.__webglNormalBuffer)a.__webglNormalBuffer=f.createBuffer();a.hasPos&&(f.bindBuffer(f.ARRAY_BUFFER,a.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,a.positionArray,f.DYNAMIC_DRAW),f.enableVertexAttribArray(b.attributes.position),f.vertexAttribPointer(b.attributes.position,3,f.FLOAT,!1,0,0));if(a.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,g,h,i,j,n,m,k,l,o=3*a.count;for(l=0;l<o;l+=9)c=a.normalArray,d=c[l],e=c[l+1],g=c[l+2],h=c[l+3],j=c[l+
-4],m=c[l+5],i=c[l+6],n=c[l+7],k=c[l+8],d=(d+h+i)/3,e=(e+j+n)/3,g=(g+m+k)/3,c[l]=d,c[l+1]=e,c[l+2]=g,c[l+3]=d,c[l+4]=e,c[l+5]=g,c[l+6]=d,c[l+7]=e,c[l+8]=g}f.bufferData(f.ARRAY_BUFFER,a.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(b.attributes.normal);f.vertexAttribPointer(b.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,g){if(0!==d.opacity&&(c=r(a,b,c,d,g),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?
-1:0),d!==ma&&(ma=d,b=!0),g instanceof THREE.Mesh)){g=e.offsets;d=0;for(c=g.length;d<c;++d)b&&(f.bindBuffer(f.ARRAY_BUFFER,e.vertexPositionBuffer),f.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,f.FLOAT,!1,0,12*g[d].index),0<=a.normal&&e.vertexNormalBuffer&&(f.bindBuffer(f.ARRAY_BUFFER,e.vertexNormalBuffer),f.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,f.FLOAT,!1,0,12*g[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(f.bindBuffer(f.ARRAY_BUFFER,e.vertexUvBuffer),
-f.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,f.FLOAT,!1,0,8*g[d].index),f.enableVertexAttribArray(a.uv)):f.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(f.bindBuffer(f.ARRAY_BUFFER,e.vertexColorBuffer),f.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,f.FLOAT,!1,0,16*g[d].index)),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),f.drawElements(f.TRIANGLES,g[d].count,f.UNSIGNED_SHORT,2*g[d].start),A.info.render.calls++,A.info.render.vertices+=g[d].count,
-A.info.render.faces+=g[d].count/3}};this.renderBuffer=function(a,b,c,d,e,g){if(0!==d.opacity){var h,i,c=r(a,b,c,d,g),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==ma&&(ma=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(f.bindBuffer(f.ARRAY_BUFFER,e.__webglVertexBuffer),f.vertexAttribPointer(b.position,3,f.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;-1!==g.morphTargetBase?(f.bindBuffer(f.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[g.morphTargetBase]),f.vertexAttribPointer(c.position,
-3,f.FLOAT,!1,0,0)):0<=c.position&&(f.bindBuffer(f.ARRAY_BUFFER,e.__webglVertexBuffer),f.vertexAttribPointer(c.position,3,f.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){h=0;var j=g.morphTargetForcedOrder;for(i=g.morphTargetInfluences;h<d.numSupportedMorphTargets&&h<j.length;)f.bindBuffer(f.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j[h]]),f.vertexAttribPointer(c["morphTarget"+h],3,f.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[h]=i[j[h]],h++}else{var j=[],l=-1,n=0;i=g.morphTargetInfluences;var m,
-k=i.length;h=0;for(-1!==g.morphTargetBase&&(j[g.morphTargetBase]=!0);h<d.numSupportedMorphTargets;){for(m=0;m<k;m++)!j[m]&&i[m]>l&&(n=m,l=i[n]);f.bindBuffer(f.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]);f.vertexAttribPointer(c["morphTarget"+h],3,f.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[h]=l;j[n]=1;l=-1;h++}}null!==d.program.uniforms.morphTargetInfluences&&f.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(h=0,i=
-e.__webglCustomAttributesList.length;h<i;h++)c=e.__webglCustomAttributesList[h],0<=b[c.buffer.belongsToAttribute]&&(f.bindBuffer(f.ARRAY_BUFFER,c.buffer),f.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,f.FLOAT,!1,0,0));0<=b.color&&(f.bindBuffer(f.ARRAY_BUFFER,e.__webglColorBuffer),f.vertexAttribPointer(b.color,3,f.FLOAT,!1,0,0));0<=b.normal&&(f.bindBuffer(f.ARRAY_BUFFER,e.__webglNormalBuffer),f.vertexAttribPointer(b.normal,3,f.FLOAT,!1,0,0));0<=b.tangent&&(f.bindBuffer(f.ARRAY_BUFFER,
-e.__webglTangentBuffer),f.vertexAttribPointer(b.tangent,4,f.FLOAT,!1,0,0));0<=b.uv&&(e.__webglUVBuffer?(f.bindBuffer(f.ARRAY_BUFFER,e.__webglUVBuffer),f.vertexAttribPointer(b.uv,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv)):f.disableVertexAttribArray(b.uv));0<=b.uv2&&(e.__webglUV2Buffer?(f.bindBuffer(f.ARRAY_BUFFER,e.__webglUV2Buffer),f.vertexAttribPointer(b.uv2,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv2)):f.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&
-0<=b.skinIndex&&0<=b.skinWeight&&(f.bindBuffer(f.ARRAY_BUFFER,e.__webglSkinVertexABuffer),f.vertexAttribPointer(b.skinVertexA,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),f.vertexAttribPointer(b.skinVertexB,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),f.vertexAttribPointer(b.skinIndex,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),f.vertexAttribPointer(b.skinWeight,4,f.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?
-(d=d.wireframeLinewidth,d!==Ma&&(f.lineWidth(d),Ma=d),a&&f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),f.drawElements(f.LINES,e.__webglLineCount,f.UNSIGNED_SHORT,0)):(a&&f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),f.drawElements(f.TRIANGLES,e.__webglFaceCount,f.UNSIGNED_SHORT,0)),A.info.render.calls++,A.info.render.vertices+=e.__webglFaceCount,A.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?f.LINE_STRIP:f.LINES,d=d.linewidth,d!==
-Ma&&(f.lineWidth(d),Ma=d),f.drawArrays(g,0,e.__webglLineCount),A.info.render.calls++):g instanceof THREE.ParticleSystem?(f.drawArrays(f.POINTS,0,e.__webglParticleCount),A.info.render.calls++,A.info.render.points+=e.__webglParticleCount):g instanceof THREE.Ribbon&&(f.drawArrays(f.TRIANGLE_STRIP,0,e.__webglVertexCount),A.info.render.calls++)}};this.render=function(a,b,c,d){var e,g,j,l,n=a.lights,o=a.fog;L=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);void 0===b.parent&&(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);A.info.render.calls=0;A.info.render.vertices=0;A.info.render.faces=0;A.info.render.points=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);Sa.multiply(b.projectionMatrix,
-b.matrixWorldInverse);Ob.setFromMatrix(Sa);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);l=a.__webglObjects;for(d=0,e=l.length;d<e;d++)if(g=l[d],j=g.object,g.render=!1,j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||Ob.contains(j))){j.matrixWorld.flattenToArray(j._objectMatrixArray);t(j,b);var p=g,r=p.object,u=p.buffer,y=void 0,y=y=void 0,y=r.material;if(y instanceof THREE.MeshFaceMaterial){if(y=
-u.materialIndex,0<=y)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);g.render=!0;if(this.sortObjects)j.renderDepth?g.z=j.renderDepth:(Oa.copy(j.position),Sa.multiplyVector3(Oa),g.z=Oa.z)}this.sortObjects&&l.sort(h);l=a.__webglObjectsImmediate;for(d=0,e=l.length;d<e;d++)if(g=l[d],j=g.object,j.visible)j.matrixAutoUpdate&&j.matrixWorld.flattenToArray(j._objectMatrixArray),
-t(j,b),j=g.object.material,j.transparent?(g.transparent=j,g.opaque=null):(g.opaque=j,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),z(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),k(a.__webglObjects,!1,"",b,n,o,!0,a.overrideMaterial),m(a.__webglObjectsImmediate,"",b,n,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),
-k(a.__webglObjects,!0,"opaque",b,n,o,!1),m(a.__webglObjectsImmediate,"opaque",b,n,o,!1),k(a.__webglObjects,!1,"transparent",b,n,o,!0),m(a.__webglObjectsImmediate,"transparent",b,n,o,!0));i(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(f.bindTexture(f.TEXTURE_CUBE_MAP,c.__webglTexture),f.generateMipmap(f.TEXTURE_CUBE_MAP),f.bindTexture(f.TEXTURE_CUBE_MAP,null)):(f.bindTexture(f.TEXTURE_2D,
-c.__webglTexture),f.generateMipmap(f.TEXTURE_2D),f.bindTexture(f.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,e){var g=r(a,b,c,d,e);ma=-1;A.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(g,f,Ob):e.render(function(a){A.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 h=
-a.__objectsAdded[0],i=a,m=void 0,k=void 0,r=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){if(k=h.geometry,k instanceof THREE.Geometry){if(void 0===k.geometryGroups){var t=k,u=void 0,y=void 0,z=void 0,B=void 0,H=void 0,K=void 0,D=void 0,J={},N=t.morphTargets.length;
-t.geometryGroups={};for(u=0,y=t.faces.length;u<y;u++)z=t.faces[u],B=z.materialIndex,K=void 0!==B?B:-1,void 0===J[K]&&(J[K]={hash:K,counter:0}),D=J[K].hash+"_"+J[K].counter,void 0===t.geometryGroups[D]&&(t.geometryGroups[D]={faces3:[],faces4:[],materialIndex:B,vertices:0,numMorphTargets:N}),H=z instanceof THREE.Face3?3:4,65535<t.geometryGroups[D].vertices+H&&(J[K].counter+=1,D=J[K].hash+"_"+J[K].counter,void 0===t.geometryGroups[D]&&(t.geometryGroups[D]={faces3:[],faces4:[],materialIndex:B,vertices:0,
-numMorphTargets:N})),z instanceof THREE.Face3?t.geometryGroups[D].faces3.push(u):t.geometryGroups[D].faces4.push(u),t.geometryGroups[D].vertices+=H;t.geometryGroupsList=[];var M=void 0;for(M in t.geometryGroups)t.geometryGroups[M].id=V++,t.geometryGroupsList.push(t.geometryGroups[M])}for(m in k.geometryGroups)if(r=k.geometryGroups[m],!r.__webglVertexBuffer){var I=r;I.__webglVertexBuffer=f.createBuffer();I.__webglNormalBuffer=f.createBuffer();I.__webglTangentBuffer=f.createBuffer();I.__webglColorBuffer=
-f.createBuffer();I.__webglUVBuffer=f.createBuffer();I.__webglUV2Buffer=f.createBuffer();I.__webglSkinVertexABuffer=f.createBuffer();I.__webglSkinVertexBBuffer=f.createBuffer();I.__webglSkinIndicesBuffer=f.createBuffer();I.__webglSkinWeightsBuffer=f.createBuffer();I.__webglFaceBuffer=f.createBuffer();I.__webglLineBuffer=f.createBuffer();if(I.numMorphTargets){var Q=void 0,Z=void 0;I.__webglMorphTargetsBuffers=[];for(Q=0,Z=I.numMorphTargets;Q<Z;Q++)I.__webglMorphTargetsBuffers.push(f.createBuffer())}A.info.memory.geometries++;
-var L=r,ha=h,ga=ha.geometry,ma=L.faces3,na=L.faces4,W=3*ma.length+4*na.length,va=1*ma.length+2*na.length,xa=3*ma.length+4*na.length,sa=c(ha,L),Ga=e(sa),Ka=d(sa),Na=sa.vertexColors?sa.vertexColors:!1;L.__vertexArray=new Float32Array(3*W);if(Ka)L.__normalArray=new Float32Array(3*W);if(ga.hasTangents)L.__tangentArray=new Float32Array(4*W);if(Na)L.__colorArray=new Float32Array(3*W);if(Ga){if(0<ga.faceUvs.length||0<ga.faceVertexUvs.length)L.__uvArray=new Float32Array(2*W);if(1<ga.faceUvs.length||1<ga.faceVertexUvs.length)L.__uv2Array=
-new Float32Array(2*W)}if(ha.geometry.skinWeights.length&&ha.geometry.skinIndices.length)L.__skinVertexAArray=new Float32Array(4*W),L.__skinVertexBArray=new Float32Array(4*W),L.__skinIndexArray=new Float32Array(4*W),L.__skinWeightArray=new Float32Array(4*W);L.__faceArray=new Uint16Array(3*va);L.__lineArray=new Uint16Array(2*xa);if(L.numMorphTargets){L.__morphTargetsArrays=[];for(var Ma=0,gb=L.numMorphTargets;Ma<gb;Ma++)L.__morphTargetsArrays.push(new Float32Array(3*W))}L.__webglFaceCount=3*va;L.__webglLineCount=
-2*xa;if(sa.attributes){if(void 0===L.__webglCustomAttributesList)L.__webglCustomAttributesList=[];var Ra=void 0;for(Ra in sa.attributes){var Oa=sa.attributes[Ra],Da={},fb;for(fb in Oa)Da[fb]=Oa[fb];if(!Da.__webglInitialized||Da.createUniqueBuffers){Da.__webglInitialized=!0;var Eb=1;"v2"===Da.type?Eb=2:"v3"===Da.type?Eb=3:"v4"===Da.type?Eb=4:"c"===Da.type&&(Eb=3);Da.size=Eb;Da.array=new Float32Array(W*Eb);Da.buffer=f.createBuffer();Da.buffer.belongsToAttribute=Ra;Oa.needsUpdate=!0;Da.__original=Oa}L.__webglCustomAttributesList.push(Da)}}L.__inittedArrays=
-!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}}else if(h instanceof THREE.Ribbon){if(k=h.geometry,!k.__webglVertexBuffer){var lb=k;lb.__webglVertexBuffer=f.createBuffer();lb.__webglColorBuffer=f.createBuffer();A.info.memory.geometries++;var Sa=k,yb=Sa.vertices.length;Sa.__vertexArray=new Float32Array(3*yb);Sa.__colorArray=new Float32Array(3*yb);Sa.__webglVertexCount=yb;k.__dirtyVertices=!0;k.__dirtyColors=
-!0}}else if(h instanceof THREE.Line){if(k=h.geometry,!k.__webglVertexBuffer){var Db=k;Db.__webglVertexBuffer=f.createBuffer();Db.__webglColorBuffer=f.createBuffer();A.info.memory.geometries++;var Pb=k,Ob=h,sc=Pb.vertices.length;Pb.__vertexArray=new Float32Array(3*sc);Pb.__colorArray=new Float32Array(3*sc);Pb.__webglLineCount=sc;b(Pb,Ob);k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(h instanceof THREE.ParticleSystem&&(k=h.geometry,!k.__webglVertexBuffer)){var Nb=k;Nb.__webglVertexBuffer=f.createBuffer();
-Nb.__webglColorBuffer=f.createBuffer();A.info.geometries++;var Fb=k,ac=h,tc=Fb.vertices.length;Fb.__vertexArray=new Float32Array(3*tc);Fb.__colorArray=new Float32Array(3*tc);Fb.__sortArray=[];Fb.__webglParticleCount=tc;b(Fb,ac);k.__dirtyVertices=!0;k.__dirtyColors=!0}if(!h.__webglActive){if(h instanceof THREE.Mesh)if(k=h.geometry,k instanceof THREE.BufferGeometry)j(i.__webglObjects,k,h);else for(m in k.geometryGroups)r=k.geometryGroups[m],j(i.__webglObjects,r,h);else h instanceof THREE.Ribbon||h instanceof
-THREE.Line||h instanceof THREE.ParticleSystem?(k=h.geometry,j(i.__webglObjects,k,h)):void 0!==THREE.MarchingCubes&&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;){var Ha=a.__objectsRemoved[0],dc=a;Ha instanceof THREE.Mesh||Ha instanceof
-THREE.ParticleSystem||Ha instanceof THREE.Ribbon||Ha instanceof THREE.Line?p(dc.__webglObjects,Ha):Ha instanceof THREE.Sprite?l(dc.__webglSprites,Ha):Ha instanceof THREE.LensFlare?l(dc.__webglFlares,Ha):(Ha instanceof THREE.MarchingCubes||Ha.immediateRenderCallback)&&p(dc.__webglObjectsImmediate,Ha);Ha.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var uc=0,bc=a.__webglObjects.length;uc<bc;uc++){var Pa=a.__webglObjects[uc].object,R=Pa.geometry,Qb=void 0,Gb=void 0,za=void 0;if(Pa instanceof THREE.Mesh)if(R instanceof
-THREE.BufferGeometry)R.__dirtyVertices=!1,R.__dirtyElements=!1,R.__dirtyUvs=!1,R.__dirtyNormals=!1,R.__dirtyColors=!1;else{for(var vc=0,cc=R.geometryGroupsList.length;vc<cc;vc++)if(Qb=R.geometryGroupsList[vc],za=c(Pa,Qb),Gb=za.attributes&&n(za),R.__dirtyVertices||R.__dirtyMorphTargets||R.__dirtyElements||R.__dirtyUvs||R.__dirtyNormals||R.__dirtyColors||R.__dirtyTangents||Gb){var O=Qb,rc=Pa,Ea=f.DYNAMIC_DRAW,Pc=!R.dynamic,ec=za;if(O.__inittedArrays){var Dc=d(ec),wc=ec.vertexColors?ec.vertexColors:
-!1,Ec=e(ec),Fc=Dc===THREE.SmoothShading,v=void 0,C=void 0,La=void 0,x=void 0,Hb=void 0,mb=void 0,Qa=void 0,fc=void 0,hb=void 0,Ib=void 0,Jb=void 0,E=void 0,F=void 0,G=void 0,X=void 0,Ta=void 0,Ua=void 0,Va=void 0,Rb=void 0,Wa=void 0,Xa=void 0,Ya=void 0,Sb=void 0,Za=void 0,$a=void 0,ab=void 0,Tb=void 0,bb=void 0,cb=void 0,db=void 0,Ub=void 0,nb=void 0,ob=void 0,pb=void 0,gc=void 0,qb=void 0,rb=void 0,sb=void 0,hc=void 0,S=void 0,Gc=void 0,tb=void 0,Kb=void 0,Lb=void 0,Fa=void 0,Hc=void 0,pa=void 0,
-ia=0,oa=0,ib=0,jb=0,Ia=0,ua=0,Y=0,wa=0,ja=0,w=0,ka=0,s=0,Ba=void 0,qa=O.__vertexArray,Vb=O.__uvArray,Wb=O.__uv2Array,Ja=O.__normalArray,aa=O.__tangentArray,ra=O.__colorArray,ba=O.__skinVertexAArray,ca=O.__skinVertexBArray,da=O.__skinIndexArray,ea=O.__skinWeightArray,xc=O.__morphTargetsArrays,yc=O.__webglCustomAttributesList,q=void 0,eb=O.__faceArray,Ca=O.__lineArray,ya=rc.geometry,Qc=ya.__dirtyElements,Ic=ya.__dirtyUvs,Rc=ya.__dirtyNormals,Sc=ya.__dirtyTangents,Tc=ya.__dirtyColors,Uc=ya.__dirtyMorphTargets,
-zb=ya.vertices,T=O.faces3,U=O.faces4,la=ya.faces,zc=ya.faceVertexUvs[0],Ac=ya.faceVertexUvs[1],Ab=ya.skinVerticesA,Bb=ya.skinVerticesB,Cb=ya.skinIndices,ub=ya.skinWeights,vb=ya.morphTargets;if(ya.__dirtyVertices){for(v=0,C=T.length;v<C;v++)x=la[T[v]],E=zb[x.a].position,F=zb[x.b].position,G=zb[x.c].position,qa[oa]=E.x,qa[oa+1]=E.y,qa[oa+2]=E.z,qa[oa+3]=F.x,qa[oa+4]=F.y,qa[oa+5]=F.z,qa[oa+6]=G.x,qa[oa+7]=G.y,qa[oa+8]=G.z,oa+=9;for(v=0,C=U.length;v<C;v++)x=la[U[v]],E=zb[x.a].position,F=zb[x.b].position,
-G=zb[x.c].position,X=zb[x.d].position,qa[oa]=E.x,qa[oa+1]=E.y,qa[oa+2]=E.z,qa[oa+3]=F.x,qa[oa+4]=F.y,qa[oa+5]=F.z,qa[oa+6]=G.x,qa[oa+7]=G.y,qa[oa+8]=G.z,qa[oa+9]=X.x,qa[oa+10]=X.y,qa[oa+11]=X.z,oa+=12;f.bindBuffer(f.ARRAY_BUFFER,O.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,qa,Ea)}if(Uc)for(Fa=0,Hc=vb.length;Fa<Hc;Fa++){ka=0;for(v=0,C=T.length;v<C;v++)x=la[T[v]],E=vb[Fa].vertices[x.a].position,F=vb[Fa].vertices[x.b].position,G=vb[Fa].vertices[x.c].position,pa=xc[Fa],pa[ka]=E.x,pa[ka+1]=E.y,pa[ka+
-2]=E.z,pa[ka+3]=F.x,pa[ka+4]=F.y,pa[ka+5]=F.z,pa[ka+6]=G.x,pa[ka+7]=G.y,pa[ka+8]=G.z,ka+=9;for(v=0,C=U.length;v<C;v++)x=la[U[v]],E=vb[Fa].vertices[x.a].position,F=vb[Fa].vertices[x.b].position,G=vb[Fa].vertices[x.c].position,X=vb[Fa].vertices[x.d].position,pa=xc[Fa],pa[ka]=E.x,pa[ka+1]=E.y,pa[ka+2]=E.z,pa[ka+3]=F.x,pa[ka+4]=F.y,pa[ka+5]=F.z,pa[ka+6]=G.x,pa[ka+7]=G.y,pa[ka+8]=G.z,pa[ka+9]=X.x,pa[ka+10]=X.y,pa[ka+11]=X.z,ka+=12;f.bindBuffer(f.ARRAY_BUFFER,O.__webglMorphTargetsBuffers[Fa]);f.bufferData(f.ARRAY_BUFFER,
-xc[Fa],Ea)}if(ub.length){for(v=0,C=T.length;v<C;v++)x=la[T[v]],Za=ub[x.a],$a=ub[x.b],ab=ub[x.c],ea[w]=Za.x,ea[w+1]=Za.y,ea[w+2]=Za.z,ea[w+3]=Za.w,ea[w+4]=$a.x,ea[w+5]=$a.y,ea[w+6]=$a.z,ea[w+7]=$a.w,ea[w+8]=ab.x,ea[w+9]=ab.y,ea[w+10]=ab.z,ea[w+11]=ab.w,bb=Cb[x.a],cb=Cb[x.b],db=Cb[x.c],da[w]=bb.x,da[w+1]=bb.y,da[w+2]=bb.z,da[w+3]=bb.w,da[w+4]=cb.x,da[w+5]=cb.y,da[w+6]=cb.z,da[w+7]=cb.w,da[w+8]=db.x,da[w+9]=db.y,da[w+10]=db.z,da[w+11]=db.w,nb=Ab[x.a],ob=Ab[x.b],pb=Ab[x.c],ba[w]=nb.x,ba[w+1]=nb.y,ba[w+
-2]=nb.z,ba[w+3]=1,ba[w+4]=ob.x,ba[w+5]=ob.y,ba[w+6]=ob.z,ba[w+7]=1,ba[w+8]=pb.x,ba[w+9]=pb.y,ba[w+10]=pb.z,ba[w+11]=1,qb=Bb[x.a],rb=Bb[x.b],sb=Bb[x.c],ca[w]=qb.x,ca[w+1]=qb.y,ca[w+2]=qb.z,ca[w+3]=1,ca[w+4]=rb.x,ca[w+5]=rb.y,ca[w+6]=rb.z,ca[w+7]=1,ca[w+8]=sb.x,ca[w+9]=sb.y,ca[w+10]=sb.z,ca[w+11]=1,w+=12;for(v=0,C=U.length;v<C;v++)x=la[U[v]],Za=ub[x.a],$a=ub[x.b],ab=ub[x.c],Tb=ub[x.d],ea[w]=Za.x,ea[w+1]=Za.y,ea[w+2]=Za.z,ea[w+3]=Za.w,ea[w+4]=$a.x,ea[w+5]=$a.y,ea[w+6]=$a.z,ea[w+7]=$a.w,ea[w+8]=ab.x,
-ea[w+9]=ab.y,ea[w+10]=ab.z,ea[w+11]=ab.w,ea[w+12]=Tb.x,ea[w+13]=Tb.y,ea[w+14]=Tb.z,ea[w+15]=Tb.w,bb=Cb[x.a],cb=Cb[x.b],db=Cb[x.c],Ub=Cb[x.d],da[w]=bb.x,da[w+1]=bb.y,da[w+2]=bb.z,da[w+3]=bb.w,da[w+4]=cb.x,da[w+5]=cb.y,da[w+6]=cb.z,da[w+7]=cb.w,da[w+8]=db.x,da[w+9]=db.y,da[w+10]=db.z,da[w+11]=db.w,da[w+12]=Ub.x,da[w+13]=Ub.y,da[w+14]=Ub.z,da[w+15]=Ub.w,nb=Ab[x.a],ob=Ab[x.b],pb=Ab[x.c],gc=Ab[x.d],ba[w]=nb.x,ba[w+1]=nb.y,ba[w+2]=nb.z,ba[w+3]=1,ba[w+4]=ob.x,ba[w+5]=ob.y,ba[w+6]=ob.z,ba[w+7]=1,ba[w+8]=
-pb.x,ba[w+9]=pb.y,ba[w+10]=pb.z,ba[w+11]=1,ba[w+12]=gc.x,ba[w+13]=gc.y,ba[w+14]=gc.z,ba[w+15]=1,qb=Bb[x.a],rb=Bb[x.b],sb=Bb[x.c],hc=Bb[x.d],ca[w]=qb.x,ca[w+1]=qb.y,ca[w+2]=qb.z,ca[w+3]=1,ca[w+4]=rb.x,ca[w+5]=rb.y,ca[w+6]=rb.z,ca[w+7]=1,ca[w+8]=sb.x,ca[w+9]=sb.y,ca[w+10]=sb.z,ca[w+11]=1,ca[w+12]=hc.x,ca[w+13]=hc.y,ca[w+14]=hc.z,ca[w+15]=1,w+=16;0<w&&(f.bindBuffer(f.ARRAY_BUFFER,O.__webglSkinVertexABuffer),f.bufferData(f.ARRAY_BUFFER,ba,Ea),f.bindBuffer(f.ARRAY_BUFFER,O.__webglSkinVertexBBuffer),f.bufferData(f.ARRAY_BUFFER,
-ca,Ea),f.bindBuffer(f.ARRAY_BUFFER,O.__webglSkinIndicesBuffer),f.bufferData(f.ARRAY_BUFFER,da,Ea),f.bindBuffer(f.ARRAY_BUFFER,O.__webglSkinWeightsBuffer),f.bufferData(f.ARRAY_BUFFER,ea,Ea))}if(Tc&&wc){for(v=0,C=T.length;v<C;v++)x=la[T[v]],Qa=x.vertexColors,fc=x.color,3===Qa.length&&wc===THREE.VertexColors?(Wa=Qa[0],Xa=Qa[1],Ya=Qa[2]):Ya=Xa=Wa=fc,ra[ja]=Wa.r,ra[ja+1]=Wa.g,ra[ja+2]=Wa.b,ra[ja+3]=Xa.r,ra[ja+4]=Xa.g,ra[ja+5]=Xa.b,ra[ja+6]=Ya.r,ra[ja+7]=Ya.g,ra[ja+8]=Ya.b,ja+=9;for(v=0,C=U.length;v<C;v++)x=
-la[U[v]],Qa=x.vertexColors,fc=x.color,4===Qa.length&&wc===THREE.VertexColors?(Wa=Qa[0],Xa=Qa[1],Ya=Qa[2],Sb=Qa[3]):Sb=Ya=Xa=Wa=fc,ra[ja]=Wa.r,ra[ja+1]=Wa.g,ra[ja+2]=Wa.b,ra[ja+3]=Xa.r,ra[ja+4]=Xa.g,ra[ja+5]=Xa.b,ra[ja+6]=Ya.r,ra[ja+7]=Ya.g,ra[ja+8]=Ya.b,ra[ja+9]=Sb.r,ra[ja+10]=Sb.g,ra[ja+11]=Sb.b,ja+=12;0<ja&&(f.bindBuffer(f.ARRAY_BUFFER,O.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,ra,Ea))}if(Sc&&ya.hasTangents){for(v=0,C=T.length;v<C;v++)x=la[T[v]],hb=x.vertexTangents,Ta=hb[0],Ua=hb[1],Va=hb[2],
-aa[Y]=Ta.x,aa[Y+1]=Ta.y,aa[Y+2]=Ta.z,aa[Y+3]=Ta.w,aa[Y+4]=Ua.x,aa[Y+5]=Ua.y,aa[Y+6]=Ua.z,aa[Y+7]=Ua.w,aa[Y+8]=Va.x,aa[Y+9]=Va.y,aa[Y+10]=Va.z,aa[Y+11]=Va.w,Y+=12;for(v=0,C=U.length;v<C;v++)x=la[U[v]],hb=x.vertexTangents,Ta=hb[0],Ua=hb[1],Va=hb[2],Rb=hb[3],aa[Y]=Ta.x,aa[Y+1]=Ta.y,aa[Y+2]=Ta.z,aa[Y+3]=Ta.w,aa[Y+4]=Ua.x,aa[Y+5]=Ua.y,aa[Y+6]=Ua.z,aa[Y+7]=Ua.w,aa[Y+8]=Va.x,aa[Y+9]=Va.y,aa[Y+10]=Va.z,aa[Y+11]=Va.w,aa[Y+12]=Rb.x,aa[Y+13]=Rb.y,aa[Y+14]=Rb.z,aa[Y+15]=Rb.w,Y+=16;f.bindBuffer(f.ARRAY_BUFFER,
-O.__webglTangentBuffer);f.bufferData(f.ARRAY_BUFFER,aa,Ea)}if(Rc&&Dc){for(v=0,C=T.length;v<C;v++)if(x=la[T[v]],Hb=x.vertexNormals,mb=x.normal,3===Hb.length&&Fc)for(S=0;3>S;S++)tb=Hb[S],Ja[ua]=tb.x,Ja[ua+1]=tb.y,Ja[ua+2]=tb.z,ua+=3;else for(S=0;3>S;S++)Ja[ua]=mb.x,Ja[ua+1]=mb.y,Ja[ua+2]=mb.z,ua+=3;for(v=0,C=U.length;v<C;v++)if(x=la[U[v]],Hb=x.vertexNormals,mb=x.normal,4===Hb.length&&Fc)for(S=0;4>S;S++)tb=Hb[S],Ja[ua]=tb.x,Ja[ua+1]=tb.y,Ja[ua+2]=tb.z,ua+=3;else for(S=0;4>S;S++)Ja[ua]=mb.x,Ja[ua+1]=
-mb.y,Ja[ua+2]=mb.z,ua+=3;f.bindBuffer(f.ARRAY_BUFFER,O.__webglNormalBuffer);f.bufferData(f.ARRAY_BUFFER,Ja,Ea)}if(Ic&&zc&&Ec){for(v=0,C=T.length;v<C;v++)if(La=T[v],x=la[La],Ib=zc[La],void 0!==Ib)for(S=0;3>S;S++)Kb=Ib[S],Vb[ib]=Kb.u,Vb[ib+1]=Kb.v,ib+=2;for(v=0,C=U.length;v<C;v++)if(La=U[v],x=la[La],Ib=zc[La],void 0!==Ib)for(S=0;4>S;S++)Kb=Ib[S],Vb[ib]=Kb.u,Vb[ib+1]=Kb.v,ib+=2;0<ib&&(f.bindBuffer(f.ARRAY_BUFFER,O.__webglUVBuffer),f.bufferData(f.ARRAY_BUFFER,Vb,Ea))}if(Ic&&Ac&&Ec){for(v=0,C=T.length;v<
-C;v++)if(La=T[v],x=la[La],Jb=Ac[La],void 0!==Jb)for(S=0;3>S;S++)Lb=Jb[S],Wb[jb]=Lb.u,Wb[jb+1]=Lb.v,jb+=2;for(v=0,C=U.length;v<C;v++)if(La=U[v],x=la[La],Jb=Ac[La],void 0!==Jb)for(S=0;4>S;S++)Lb=Jb[S],Wb[jb]=Lb.u,Wb[jb+1]=Lb.v,jb+=2;0<jb&&(f.bindBuffer(f.ARRAY_BUFFER,O.__webglUV2Buffer),f.bufferData(f.ARRAY_BUFFER,Wb,Ea))}if(Qc){for(v=0,C=T.length;v<C;v++)x=la[T[v]],eb[Ia]=ia,eb[Ia+1]=ia+1,eb[Ia+2]=ia+2,Ia+=3,Ca[wa]=ia,Ca[wa+1]=ia+1,Ca[wa+2]=ia,Ca[wa+3]=ia+2,Ca[wa+4]=ia+1,Ca[wa+5]=ia+2,wa+=6,ia+=3;
-for(v=0,C=U.length;v<C;v++)x=la[U[v]],eb[Ia]=ia,eb[Ia+1]=ia+1,eb[Ia+2]=ia+3,eb[Ia+3]=ia+1,eb[Ia+4]=ia+2,eb[Ia+5]=ia+3,Ia+=6,Ca[wa]=ia,Ca[wa+1]=ia+1,Ca[wa+2]=ia,Ca[wa+3]=ia+3,Ca[wa+4]=ia+1,Ca[wa+5]=ia+2,Ca[wa+6]=ia+2,Ca[wa+7]=ia+3,wa+=8,ia+=4;f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,O.__webglFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,eb,Ea);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,O.__webglLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,Ca,Ea)}if(yc)for(S=0,Gc=yc.length;S<Gc;S++)if(q=yc[S],q.__original.needsUpdate){s=
-0;if(1===q.size)if(void 0===q.boundTo||"vertices"===q.boundTo){for(v=0,C=T.length;v<C;v++)x=la[T[v]],q.array[s]=q.value[x.a],q.array[s+1]=q.value[x.b],q.array[s+2]=q.value[x.c],s+=3;for(v=0,C=U.length;v<C;v++)x=la[U[v]],q.array[s]=q.value[x.a],q.array[s+1]=q.value[x.b],q.array[s+2]=q.value[x.c],q.array[s+3]=q.value[x.d],s+=4}else{if("faces"===q.boundTo){for(v=0,C=T.length;v<C;v++)Ba=q.value[T[v]],q.array[s]=Ba,q.array[s+1]=Ba,q.array[s+2]=Ba,s+=3;for(v=0,C=U.length;v<C;v++)Ba=q.value[U[v]],q.array[s]=
-Ba,q.array[s+1]=Ba,q.array[s+2]=Ba,q.array[s+3]=Ba,s+=4}}else if(2===q.size)if(void 0===q.boundTo||"vertices"===q.boundTo){for(v=0,C=T.length;v<C;v++)x=la[T[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=F.x,q.array[s+3]=F.y,q.array[s+4]=G.x,q.array[s+5]=G.y,s+=6;for(v=0,C=U.length;v<C;v++)x=la[U[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],X=q.value[x.d],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=F.x,q.array[s+3]=F.y,q.array[s+4]=G.x,q.array[s+
-5]=G.y,q.array[s+6]=X.x,q.array[s+7]=X.y,s+=8}else{if("faces"===q.boundTo){for(v=0,C=T.length;v<C;v++)G=F=E=Ba=q.value[T[v]],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=F.x,q.array[s+3]=F.y,q.array[s+4]=G.x,q.array[s+5]=G.y,s+=6;for(v=0,C=U.length;v<C;v++)X=G=F=E=Ba=q.value[U[v]],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=F.x,q.array[s+3]=F.y,q.array[s+4]=G.x,q.array[s+5]=G.y,q.array[s+6]=X.x,q.array[s+7]=X.y,s+=8}}else if(3===q.size){var P;P="c"===q.type?["r","g","b"]:["x","y","z"];if(void 0===
-q.boundTo||"vertices"===q.boundTo){for(v=0,C=T.length;v<C;v++)x=la[T[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],q.array[s]=E[P[0]],q.array[s+1]=E[P[1]],q.array[s+2]=E[P[2]],q.array[s+3]=F[P[0]],q.array[s+4]=F[P[1]],q.array[s+5]=F[P[2]],q.array[s+6]=G[P[0]],q.array[s+7]=G[P[1]],q.array[s+8]=G[P[2]],s+=9;for(v=0,C=U.length;v<C;v++)x=la[U[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],X=q.value[x.d],q.array[s]=E[P[0]],q.array[s+1]=E[P[1]],q.array[s+2]=E[P[2]],q.array[s+3]=F[P[0]],q.array[s+4]=
-F[P[1]],q.array[s+5]=F[P[2]],q.array[s+6]=G[P[0]],q.array[s+7]=G[P[1]],q.array[s+8]=G[P[2]],q.array[s+9]=X[P[0]],q.array[s+10]=X[P[1]],q.array[s+11]=X[P[2]],s+=12}else if("faces"===q.boundTo){for(v=0,C=T.length;v<C;v++)G=F=E=Ba=q.value[T[v]],q.array[s]=E[P[0]],q.array[s+1]=E[P[1]],q.array[s+2]=E[P[2]],q.array[s+3]=F[P[0]],q.array[s+4]=F[P[1]],q.array[s+5]=F[P[2]],q.array[s+6]=G[P[0]],q.array[s+7]=G[P[1]],q.array[s+8]=G[P[2]],s+=9;for(v=0,C=U.length;v<C;v++)X=G=F=E=Ba=q.value[U[v]],q.array[s]=E[P[0]],
-q.array[s+1]=E[P[1]],q.array[s+2]=E[P[2]],q.array[s+3]=F[P[0]],q.array[s+4]=F[P[1]],q.array[s+5]=F[P[2]],q.array[s+6]=G[P[0]],q.array[s+7]=G[P[1]],q.array[s+8]=G[P[2]],q.array[s+9]=X[P[0]],q.array[s+10]=X[P[1]],q.array[s+11]=X[P[2]],s+=12}}else if(4===q.size)if(void 0===q.boundTo||"vertices"===q.boundTo){for(v=0,C=T.length;v<C;v++)x=la[T[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=E.z,q.array[s+3]=E.w,q.array[s+4]=F.x,q.array[s+5]=F.y,q.array[s+6]=
-F.z,q.array[s+7]=F.w,q.array[s+8]=G.x,q.array[s+9]=G.y,q.array[s+10]=G.z,q.array[s+11]=G.w,s+=12;for(v=0,C=U.length;v<C;v++)x=la[U[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],X=q.value[x.d],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=E.z,q.array[s+3]=E.w,q.array[s+4]=F.x,q.array[s+5]=F.y,q.array[s+6]=F.z,q.array[s+7]=F.w,q.array[s+8]=G.x,q.array[s+9]=G.y,q.array[s+10]=G.z,q.array[s+11]=G.w,q.array[s+12]=X.x,q.array[s+13]=X.y,q.array[s+14]=X.z,q.array[s+15]=X.w,s+=16}else if("faces"===q.boundTo){for(v=
-0,C=T.length;v<C;v++)G=F=E=Ba=q.value[T[v]],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=E.z,q.array[s+3]=E.w,q.array[s+4]=F.x,q.array[s+5]=F.y,q.array[s+6]=F.z,q.array[s+7]=F.w,q.array[s+8]=G.x,q.array[s+9]=G.y,q.array[s+10]=G.z,q.array[s+11]=G.w,s+=12;for(v=0,C=U.length;v<C;v++)X=G=F=E=Ba=q.value[U[v]],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=E.z,q.array[s+3]=E.w,q.array[s+4]=F.x,q.array[s+5]=F.y,q.array[s+6]=F.z,q.array[s+7]=F.w,q.array[s+8]=G.x,q.array[s+9]=G.y,q.array[s+10]=G.z,q.array[s+
-11]=G.w,q.array[s+12]=X.x,q.array[s+13]=X.y,q.array[s+14]=X.z,q.array[s+15]=X.w,s+=16}f.bindBuffer(f.ARRAY_BUFFER,q.buffer);f.bufferData(f.ARRAY_BUFFER,q.array,Ea)}Pc&&(delete O.__inittedArrays,delete O.__colorArray,delete O.__normalArray,delete O.__tangentArray,delete O.__uvArray,delete O.__uv2Array,delete O.__faceArray,delete O.__vertexArray,delete O.__lineArray,delete O.__skinVertexAArray,delete O.__skinVertexBArray,delete O.__skinIndexArray,delete O.__skinWeightArray)}}R.__dirtyVertices=!1;R.__dirtyMorphTargets=
-!1;R.__dirtyElements=!1;R.__dirtyUvs=!1;R.__dirtyNormals=!1;R.__dirtyColors=!1;R.__dirtyTangents=!1;za.attributes&&o(za)}else if(Pa instanceof THREE.Ribbon){if(R.__dirtyVertices||R.__dirtyColors){var wb=R,Jc=f.DYNAMIC_DRAW,Xb=void 0,Yb=void 0,ic=void 0,xb=void 0,jc=void 0,Kc=wb.vertices,Lc=wb.colors,Vc=Kc.length,Wc=Lc.length,kc=wb.__vertexArray,lc=wb.__colorArray,Xc=wb.__dirtyColors;if(wb.__dirtyVertices){for(Xb=0;Xb<Vc;Xb++)ic=Kc[Xb].position,xb=3*Xb,kc[xb]=ic.x,kc[xb+1]=ic.y,kc[xb+2]=ic.z;f.bindBuffer(f.ARRAY_BUFFER,
-wb.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,kc,Jc)}if(Xc){for(Yb=0;Yb<Wc;Yb++)jc=Lc[Yb],xb=3*Yb,lc[xb]=jc.r,lc[xb+1]=jc.g,lc[xb+2]=jc.b;f.bindBuffer(f.ARRAY_BUFFER,wb.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,lc,Jc)}}R.__dirtyVertices=!1;R.__dirtyColors=!1}else if(Pa instanceof THREE.Line){za=c(Pa,Qb);Gb=za.attributes&&n(za);if(R.__dirtyVertices||R.__dirtyColors||Gb){var kb=R,Bc=f.DYNAMIC_DRAW,Zb=void 0,$b=void 0,mc=void 0,fa=void 0,nc=void 0,Mc=kb.vertices,Nc=kb.colors,Yc=Mc.length,
-Zc=Nc.length,oc=kb.__vertexArray,pc=kb.__colorArray,$c=kb.__dirtyColors,Cc=kb.__webglCustomAttributesList,qc=void 0,Oc=void 0,ta=void 0,Mb=void 0,Aa=void 0,$=void 0;if(kb.__dirtyVertices){for(Zb=0;Zb<Yc;Zb++)mc=Mc[Zb].position,fa=3*Zb,oc[fa]=mc.x,oc[fa+1]=mc.y,oc[fa+2]=mc.z;f.bindBuffer(f.ARRAY_BUFFER,kb.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,oc,Bc)}if($c){for($b=0;$b<Zc;$b++)nc=Nc[$b],fa=3*$b,pc[fa]=nc.r,pc[fa+1]=nc.g,pc[fa+2]=nc.b;f.bindBuffer(f.ARRAY_BUFFER,kb.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,
-pc,Bc)}if(Cc)for(qc=0,Oc=Cc.length;qc<Oc;qc++)if($=Cc[qc],$.needsUpdate&&(void 0===$.boundTo||"vertices"===$.boundTo)){fa=0;Mb=$.value.length;if(1===$.size)for(ta=0;ta<Mb;ta++)$.array[ta]=$.value[ta];else if(2===$.size)for(ta=0;ta<Mb;ta++)Aa=$.value[ta],$.array[fa]=Aa.x,$.array[fa+1]=Aa.y,fa+=2;else if(3===$.size)if("c"===$.type)for(ta=0;ta<Mb;ta++)Aa=$.value[ta],$.array[fa]=Aa.r,$.array[fa+1]=Aa.g,$.array[fa+2]=Aa.b,fa+=3;else for(ta=0;ta<Mb;ta++)Aa=$.value[ta],$.array[fa]=Aa.x,$.array[fa+1]=Aa.y,
-$.array[fa+2]=Aa.z,fa+=3;else if(4===$.size)for(ta=0;ta<Mb;ta++)Aa=$.value[ta],$.array[fa]=Aa.x,$.array[fa+1]=Aa.y,$.array[fa+2]=Aa.z,$.array[fa+3]=Aa.w,fa+=4;f.bindBuffer(f.ARRAY_BUFFER,$.buffer);f.bufferData(f.ARRAY_BUFFER,$.array,Bc)}}R.__dirtyVertices=!1;R.__dirtyColors=!1;za.attributes&&o(za)}else if(Pa instanceof THREE.ParticleSystem)za=c(Pa,Qb),Gb=za.attributes&&n(za),(R.__dirtyVertices||R.__dirtyColors||Pa.sortParticles||Gb)&&g(R,f.DYNAMIC_DRAW,Pa),R.__dirtyVertices=!1,R.__dirtyColors=!1,
-za.attributes&&o(za)}};this.initMaterial=function(a,b,c,d){var e,g,h,i,j;a instanceof THREE.MeshDepthMaterial?j="depth":a instanceof THREE.MeshNormalMaterial?j="normal":a instanceof THREE.MeshBasicMaterial?j="basic":a instanceof THREE.MeshLambertMaterial?j="lambert":a instanceof THREE.MeshPhongMaterial?j="phong":a instanceof THREE.LineBasicMaterial?j="basic":a instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);
-a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var l,n;g=k=0;for(l=0,n=b.length;l<n;l++)e=b[l],e instanceof THREE.SpotLight&&!e.onlyShadow&&g++,e instanceof THREE.DirectionalLight&&g++,e instanceof THREE.PointLight&&k++;k+g<=xa?l=g:(l=Math.ceil(xa*g/(k+g)),k=xa-l);e=l;g=k;var m=0;for(k=0,l=b.length;k<l;k++)n=b[k],n instanceof THREE.SpotLight&&n.castShadow&&m++;var o=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)o=d.bones.length;var p;a:{l=a.fragmentShader;n=a.vertexShader;var k=
-a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:e,maxPointLights:g,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround},r,d=[];j?d.push(j):(d.push(l),
-d.push(n));for(r in c)d.push(r),d.push(c[r]);j=d.join();for(r=0,d=Ga.length;r<d;r++)if(Ga[r].code===j){p=Ga[r].program;break a}r=f.createProgram();d=[0<cc?"#define VERTEX_TEXTURES":"",A.gammaInput?"#define GAMMA_INPUT":"",A.gammaOutput?"#define GAMMA_OUTPUT":"",A.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.wrapAround?"#define WRAP_AROUND":"",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");
+else if(d instanceof THREE.MeshNormalMaterial)j.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&j.shadowMatrix){i=c=0;for(m=b.length;i<m;i++)if(l=b[i],l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight))j.shadowMap.texture[c]=l.shadowMap,j.shadowMapSize.value[c]=l.shadowMapSize,j.shadowMatrix.value[c]=l.shadowMatrix,j.shadowDarkness.value[c]=l.shadowDarkness,j.shadowBias.value[c]=l.shadowBias,c++}b=d.uniformsList;for(j=0,c=b.length;j<c;j++)if(l=g.uniforms[b[j][1]])if(i=
+b[j][0],o=i.type,m=i.value,"i"===o)f.uniform1i(l,m);else if("f"===o)f.uniform1f(l,m);else if("v2"===o)f.uniform2f(l,m.x,m.y);else if("v3"===o)f.uniform3f(l,m.x,m.y,m.z);else if("v4"===o)f.uniform4f(l,m.x,m.y,m.z,m.w);else if("c"===o)f.uniform3f(l,m.r,m.g,m.b);else if("fv1"===o)f.uniform1fv(l,m);else if("fv"===o)f.uniform3fv(l,m);else if("v2v"===o){if(!i._array)i._array=new Float32Array(2*m.length);for(o=0,t=m.length;o<t;o++)u=2*o,i._array[u]=m[o].x,i._array[u+1]=m[o].y;f.uniform2fv(l,i._array)}else if("v3v"===
+o){if(!i._array)i._array=new Float32Array(3*m.length);for(o=0,t=m.length;o<t;o++)u=3*o,i._array[u]=m[o].x,i._array[u+1]=m[o].y,i._array[u+2]=m[o].z;f.uniform3fv(l,i._array)}else if("m4"===o){if(!i._array)i._array=new Float32Array(16);m.flattenToArray(i._array);f.uniformMatrix4fv(l,!1,i._array)}else if("m4v"===o){if(!i._array)i._array=new Float32Array(16*m.length);for(o=0,t=m.length;o<t;o++)m[o].flattenToArrayOffset(i._array,16*o);f.uniformMatrix4fv(l,!1,i._array)}else if("t"===o){if(f.uniform1i(l,
+m),l=i.texture)if(l.image instanceof Array&&6===l.image.length){if(i=l,6===i.image.length)if(i.needsUpdate){if(!i.image.__webglTextureCube)i.image.__webglTextureCube=f.createTexture();f.activeTexture(f.TEXTURE0+m);f.bindTexture(f.TEXTURE_CUBE_MAP,i.image.__webglTextureCube);m=[];for(l=0;6>l;l++){o=m;t=l;if(A.autoScaleCubemaps){if(u=i.image[l],y=rc,!(u.width<=y&&u.height<=y))B=Math.max(u.width,u.height),z=Math.floor(u.width*y/B),y=Math.floor(u.height*y/B),B=document.createElement("canvas"),B.width=
+z,B.height=y,B.getContext("2d").drawImage(u,0,0,u.width,u.height,0,0,z,y),u=B}else u=i.image[l];o[t]=u}l=m[0];o=0===(l.width&l.width-1)&&0===(l.height&l.height-1);t=J(i.format);u=J(i.type);K(f.TEXTURE_CUBE_MAP,i,o);for(l=0;6>l;l++)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,t,t,u,m[l]);i.generateMipmaps&&o&&f.generateMipmap(f.TEXTURE_CUBE_MAP);i.needsUpdate=!1;if(i.onUpdated)i.onUpdated()}else f.activeTexture(f.TEXTURE0+m),f.bindTexture(f.TEXTURE_CUBE_MAP,i.image.__webglTextureCube)}else l instanceof
+THREE.WebGLRenderTargetCube?(i=l,f.activeTexture(f.TEXTURE0+m),f.bindTexture(f.TEXTURE_CUBE_MAP,i.__webglTexture)):A.setTexture(l,m)}else if("tv"===o){if(!i._array){i._array=[];for(o=0,t=i.texture.length;o<t;o++)i._array[o]=m+o}f.uniform1iv(l,i._array);for(o=0,t=i.texture.length;o<t;o++)(l=i.texture[o])&&A.setTexture(l,i._array[o])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition&&f.uniform3f(h.cameraPosition,a.position.x,a.position.y,a.position.z);
+(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&f.uniformMatrix4fv(h.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(f.uniformMatrix4fv(h.cameraInverseMatrix,!1,a._viewMatrixArray),f.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices))}f.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrixArray);h.normalMatrix&&f.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||
+d.envMap||d.skinning||e.receiveShadow)&&null!==h.objectMatrix&&f.uniformMatrix4fv(h.objectMatrix,!1,e._objectMatrixArray);return g}function t(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function z(a,b,c){Ka!==a&&(a?f.enable(f.POLYGON_OFFSET_FILL):f.disable(f.POLYGON_OFFSET_FILL),Ka=a);if(a&&(Ra!==b||lb!==c))f.polygonOffset(b,c),Ra=b,lb=c}function y(a,
+b){var c;"fragment"===a?c=f.createShader(f.FRAGMENT_SHADER):"vertex"===a&&(c=f.createShader(f.VERTEX_SHADER));f.shaderSource(c,b);f.compileShader(c);return!f.getShaderParameter(c,f.COMPILE_STATUS)?(console.error(f.getShaderInfoLog(c)),console.error(b),null):c}function K(a,b,c){c?(f.texParameteri(a,f.TEXTURE_WRAP_S,J(b.wrapS)),f.texParameteri(a,f.TEXTURE_WRAP_T,J(b.wrapT)),f.texParameteri(a,f.TEXTURE_MAG_FILTER,J(b.magFilter)),f.texParameteri(a,f.TEXTURE_MIN_FILTER,J(b.minFilter))):(f.texParameteri(a,
+f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(a,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(a,f.TEXTURE_MAG_FILTER,u(b.magFilter)),f.texParameteri(a,f.TEXTURE_MIN_FILTER,u(b.minFilter)))}function N(a,b){f.bindRenderbuffer(f.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,b.width,b.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,
+f.DEPTH_STENCIL,b.width,b.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,a)):f.renderbufferStorage(f.RENDERBUFFER,f.RGBA4,b.width,b.height)}function u(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;default:return f.LINEAR}}function J(a){switch(a){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;
+case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return f.BYTE;case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;
+case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}var a=a||{},H=void 0!==a.canvas?a.canvas:document.createElement("canvas"),B=void 0!==a.precision?a.precision:"mediump",D=void 0!==a.antialias?a.antialias:!1,M=void 0!==
+a.stencil?a.stencil:!0,I=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,Q=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),ga=void 0!==a.clearAlpha?a.clearAlpha:0,xa=void 0!==a.maxLights?a.maxLights:4;this.domElement=H;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=
+this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var A=this,f,Ga=[],fb=null,sa=null,L=-1,ma=null,V=0,na=null,ha=null,W=null,Z=null,va=null,Ka=null,Ra=null,lb=null,Ma=null,gb=0,Na=0,yb=0,Db=0,Nb=0,ac=0,Ob=new THREE.Frustum,Sa=new THREE.Matrix4,Oa=new THREE.Vector4,bc={ambient:[0,0,0],directional:{length:0,
+colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};f=function(){var a;try{if(!(a=H.getContext("experimental-webgl",{antialias:D,stencil:M,preserveDrawingBuffer:I})))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}();f.clearColor(0,0,0,1);f.clearDepth(1);f.clearStencil(0);
+f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);f.clearColor(Q.r,Q.g,Q.b,ga);this.context=f;var cc=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS);f.getParameter(f.TEXTURE_SIZE);var rc=f.getParameter(f.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return f};this.supportsVertexTextures=function(){return 0<cc};this.setSize=function(a,b){H.width=
+a;H.height=b;this.setViewport(0,0,H.width,H.height)};this.setViewport=function(a,b,c,d){gb=a;Na=b;yb=c;Db=d;f.viewport(gb,Na,yb,Db)};this.setScissor=function(a,b,c,d){f.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.setClearColorHex=function(a,b){Q.setHex(a);ga=b;f.clearColor(Q.r,Q.g,Q.b,ga)};this.setClearColor=function(a,b){Q.copy(a);ga=b;f.clearColor(Q.r,Q.g,Q.b,ga)};this.getClearColor=function(){return Q};this.getClearAlpha=function(){return ga};
+this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=f.COLOR_BUFFER_BIT;if(void 0===b||b)d|=f.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=f.STENCIL_BUFFER_BIT;f.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];f.deleteBuffer(c.__webglVertexBuffer);f.deleteBuffer(c.__webglNormalBuffer);f.deleteBuffer(c.__webglTangentBuffer);f.deleteBuffer(c.__webglColorBuffer);f.deleteBuffer(c.__webglUVBuffer);f.deleteBuffer(c.__webglUV2Buffer);f.deleteBuffer(c.__webglSkinVertexABuffer);f.deleteBuffer(c.__webglSkinVertexBBuffer);f.deleteBuffer(c.__webglSkinIndicesBuffer);
+f.deleteBuffer(c.__webglSkinWeightsBuffer);f.deleteBuffer(c.__webglFaceBuffer);f.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)f.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)f.deleteBuffer(c.__webglCustomAttributesList[d].buffer);A.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,f.deleteBuffer(a.__webglVertexBuffer),f.deleteBuffer(a.__webglColorBuffer),
+A.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,f.deleteBuffer(a.__webglVertexBuffer),f.deleteBuffer(a.__webglColorBuffer),A.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,f.deleteBuffer(a.__webglVertexBuffer),f.deleteBuffer(a.__webglColorBuffer),A.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,f.deleteTexture(a.__webglTexture),A.info.memory.textures--};this.updateShadowMap=function(a,b){fb=null;
+L=ma=va=Z=W=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=f.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=f.createBuffer();a.hasPos&&(f.bindBuffer(f.ARRAY_BUFFER,a.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,a.positionArray,f.DYNAMIC_DRAW),f.enableVertexAttribArray(b.attributes.position),f.vertexAttribPointer(b.attributes.position,3,f.FLOAT,!1,0,0));if(a.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,a.__webglNormalBuffer);
+if(c===THREE.FlatShading){var d,e,g,h,i,j,n,k,m,l,o=3*a.count;for(l=0;l<o;l+=9)c=a.normalArray,d=c[l],e=c[l+1],g=c[l+2],h=c[l+3],j=c[l+4],k=c[l+5],i=c[l+6],n=c[l+7],m=c[l+8],d=(d+h+i)/3,e=(e+j+n)/3,g=(g+k+m)/3,c[l]=d,c[l+1]=e,c[l+2]=g,c[l+3]=d,c[l+4]=e,c[l+5]=g,c[l+6]=d,c[l+7]=e,c[l+8]=g}f.bufferData(f.ARRAY_BUFFER,a.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(b.attributes.normal);f.vertexAttribPointer(b.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,a.count);a.count=0};
+this.renderBufferDirect=function(a,b,c,d,e,g){if(0!==d.opacity&&(c=r(a,b,c,d,g),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==ma&&(ma=d,b=!0),g instanceof THREE.Mesh)){g=e.offsets;d=0;for(c=g.length;d<c;++d)b&&(f.bindBuffer(f.ARRAY_BUFFER,e.vertexPositionBuffer),f.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,f.FLOAT,!1,0,12*g[d].index),0<=a.normal&&e.vertexNormalBuffer&&(f.bindBuffer(f.ARRAY_BUFFER,e.vertexNormalBuffer),f.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,
+f.FLOAT,!1,0,12*g[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(f.bindBuffer(f.ARRAY_BUFFER,e.vertexUvBuffer),f.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,f.FLOAT,!1,0,8*g[d].index),f.enableVertexAttribArray(a.uv)):f.disableVertexAttribArray(a.uv)),0<=a.color&&e.vertexColorBuffer&&(f.bindBuffer(f.ARRAY_BUFFER,e.vertexColorBuffer),f.vertexAttribPointer(a.color,e.vertexColorBuffer.itemSize,f.FLOAT,!1,0,16*g[d].index)),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)),f.drawElements(f.TRIANGLES,
+g[d].count,f.UNSIGNED_SHORT,2*g[d].start),A.info.render.calls++,A.info.render.vertices+=g[d].count,A.info.render.faces+=g[d].count/3}};this.renderBuffer=function(a,b,c,d,e,g){if(0!==d.opacity){var h,i,c=r(a,b,c,d,g),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==ma&&(ma=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(f.bindBuffer(f.ARRAY_BUFFER,e.__webglVertexBuffer),f.vertexAttribPointer(b.position,3,f.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;-1!==g.morphTargetBase?
+(f.bindBuffer(f.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[g.morphTargetBase]),f.vertexAttribPointer(c.position,3,f.FLOAT,!1,0,0)):0<=c.position&&(f.bindBuffer(f.ARRAY_BUFFER,e.__webglVertexBuffer),f.vertexAttribPointer(c.position,3,f.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){h=0;var j=g.morphTargetForcedOrder;for(i=g.morphTargetInfluences;h<d.numSupportedMorphTargets&&h<j.length;)f.bindBuffer(f.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j[h]]),f.vertexAttribPointer(c["morphTarget"+h],3,f.FLOAT,
+!1,0,0),g.__webglMorphTargetInfluences[h]=i[j[h]],h++}else{var j=[],l=-1,n=0;i=g.morphTargetInfluences;var k,m=i.length;h=0;for(-1!==g.morphTargetBase&&(j[g.morphTargetBase]=!0);h<d.numSupportedMorphTargets;){for(k=0;k<m;k++)!j[k]&&i[k]>l&&(n=k,l=i[n]);f.bindBuffer(f.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]);f.vertexAttribPointer(c["morphTarget"+h],3,f.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[h]=l;j[n]=1;l=-1;h++}}null!==d.program.uniforms.morphTargetInfluences&&f.uniform1fv(d.program.uniforms.morphTargetInfluences,
+g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(h=0,i=e.__webglCustomAttributesList.length;h<i;h++)c=e.__webglCustomAttributesList[h],0<=b[c.buffer.belongsToAttribute]&&(f.bindBuffer(f.ARRAY_BUFFER,c.buffer),f.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,f.FLOAT,!1,0,0));0<=b.color&&(f.bindBuffer(f.ARRAY_BUFFER,e.__webglColorBuffer),f.vertexAttribPointer(b.color,3,f.FLOAT,!1,0,0));0<=b.normal&&(f.bindBuffer(f.ARRAY_BUFFER,e.__webglNormalBuffer),f.vertexAttribPointer(b.normal,
+3,f.FLOAT,!1,0,0));0<=b.tangent&&(f.bindBuffer(f.ARRAY_BUFFER,e.__webglTangentBuffer),f.vertexAttribPointer(b.tangent,4,f.FLOAT,!1,0,0));0<=b.uv&&(e.__webglUVBuffer?(f.bindBuffer(f.ARRAY_BUFFER,e.__webglUVBuffer),f.vertexAttribPointer(b.uv,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv)):f.disableVertexAttribArray(b.uv));0<=b.uv2&&(e.__webglUV2Buffer?(f.bindBuffer(f.ARRAY_BUFFER,e.__webglUV2Buffer),f.vertexAttribPointer(b.uv2,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv2)):f.disableVertexAttribArray(b.uv2));
+d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(f.bindBuffer(f.ARRAY_BUFFER,e.__webglSkinVertexABuffer),f.vertexAttribPointer(b.skinVertexA,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),f.vertexAttribPointer(b.skinVertexB,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),f.vertexAttribPointer(b.skinIndex,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),f.vertexAttribPointer(b.skinWeight,
+4,f.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==Ma&&(f.lineWidth(d),Ma=d),a&&f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),f.drawElements(f.LINES,e.__webglLineCount,f.UNSIGNED_SHORT,0)):(a&&f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),f.drawElements(f.TRIANGLES,e.__webglFaceCount,f.UNSIGNED_SHORT,0)),A.info.render.calls++,A.info.render.vertices+=e.__webglFaceCount,A.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===
+THREE.LineStrip?f.LINE_STRIP:f.LINES,d=d.linewidth,d!==Ma&&(f.lineWidth(d),Ma=d),f.drawArrays(g,0,e.__webglLineCount),A.info.render.calls++):g instanceof THREE.ParticleSystem?(f.drawArrays(f.POINTS,0,e.__webglParticleCount),A.info.render.calls++,A.info.render.points+=e.__webglParticleCount):g instanceof THREE.Ribbon&&(f.drawArrays(f.TRIANGLE_STRIP,0,e.__webglVertexCount),A.info.render.calls++)}};this.render=function(a,b,c,d){var e,g,j,n,m=a.lights,o=a.fog;L=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);
+void 0===b.parent&&(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);A.info.render.calls=0;A.info.render.vertices=0;A.info.render.faces=0;A.info.render.points=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);Sa.multiply(b.projectionMatrix,b.matrixWorldInverse);Ob.setFromMatrix(Sa);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);n=a.__webglObjects;for(d=0,e=n.length;d<e;d++)if(g=n[d],j=g.object,g.render=!1,j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||Ob.contains(j))){j.matrixWorld.flattenToArray(j._objectMatrixArray);t(j,b);var p=
+g,r=p.object,u=p.buffer,y=void 0,y=y=void 0,y=r.material;if(y instanceof THREE.MeshFaceMaterial){if(y=u.materialIndex,0<=y)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);g.render=!0;if(this.sortObjects)j.renderDepth?g.z=j.renderDepth:(Oa.copy(j.position),Sa.multiplyVector3(Oa),g.z=Oa.z)}this.sortObjects&&n.sort(h);n=a.__webglObjectsImmediate;for(d=0,e=n.length;d<
+e;d++)if(g=n[d],j=g.object,j.visible)j.matrixAutoUpdate&&j.matrixWorld.flattenToArray(j._objectMatrixArray),t(j,b),j=g.object.material,j.transparent?(g.transparent=j,g.opaque=null):(g.opaque=j,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),z(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),l(a.__webglObjects,
+!1,"",b,m,o,!0,a.overrideMaterial),k(a.__webglObjectsImmediate,"",b,m,o,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),l(a.__webglObjects,!0,"opaque",b,m,o,!1),k(a.__webglObjectsImmediate,"opaque",b,m,o,!1),l(a.__webglObjects,!1,"transparent",b,m,o,!0),k(a.__webglObjectsImmediate,"transparent",b,m,o,!0));i(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(f.bindTexture(f.TEXTURE_CUBE_MAP,
+c.__webglTexture),f.generateMipmap(f.TEXTURE_CUBE_MAP),f.bindTexture(f.TEXTURE_CUBE_MAP,null)):(f.bindTexture(f.TEXTURE_2D,c.__webglTexture),f.generateMipmap(f.TEXTURE_2D),f.bindTexture(f.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,e){var g=r(a,b,c,d,e);ma=-1;A.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(g,f,Ob):e.render(function(a){A.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 h=a.__objectsAdded[0],i=a,l=void 0,k=void 0,r=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){if(k=h.geometry,k instanceof THREE.Geometry){if(void 0===k.geometryGroups){var t=
+k,u=void 0,y=void 0,z=void 0,B=void 0,H=void 0,K=void 0,D=void 0,J={},N=t.morphTargets.length;t.geometryGroups={};for(u=0,y=t.faces.length;u<y;u++)z=t.faces[u],B=z.materialIndex,K=void 0!==B?B:-1,void 0===J[K]&&(J[K]={hash:K,counter:0}),D=J[K].hash+"_"+J[K].counter,void 0===t.geometryGroups[D]&&(t.geometryGroups[D]={faces3:[],faces4:[],materialIndex:B,vertices:0,numMorphTargets:N}),H=z instanceof THREE.Face3?3:4,65535<t.geometryGroups[D].vertices+H&&(J[K].counter+=1,D=J[K].hash+"_"+J[K].counter,void 0===
+t.geometryGroups[D]&&(t.geometryGroups[D]={faces3:[],faces4:[],materialIndex:B,vertices:0,numMorphTargets:N})),z instanceof THREE.Face3?t.geometryGroups[D].faces3.push(u):t.geometryGroups[D].faces4.push(u),t.geometryGroups[D].vertices+=H;t.geometryGroupsList=[];var M=void 0;for(M in t.geometryGroups)t.geometryGroups[M].id=V++,t.geometryGroupsList.push(t.geometryGroups[M])}for(l in k.geometryGroups)if(r=k.geometryGroups[l],!r.__webglVertexBuffer){var I=r;I.__webglVertexBuffer=f.createBuffer();I.__webglNormalBuffer=
+f.createBuffer();I.__webglTangentBuffer=f.createBuffer();I.__webglColorBuffer=f.createBuffer();I.__webglUVBuffer=f.createBuffer();I.__webglUV2Buffer=f.createBuffer();I.__webglSkinVertexABuffer=f.createBuffer();I.__webglSkinVertexBBuffer=f.createBuffer();I.__webglSkinIndicesBuffer=f.createBuffer();I.__webglSkinWeightsBuffer=f.createBuffer();I.__webglFaceBuffer=f.createBuffer();I.__webglLineBuffer=f.createBuffer();if(I.numMorphTargets){var Q=void 0,Z=void 0;I.__webglMorphTargetsBuffers=[];for(Q=0,Z=
+I.numMorphTargets;Q<Z;Q++)I.__webglMorphTargetsBuffers.push(f.createBuffer())}A.info.memory.geometries++;var L=r,ha=h,ga=ha.geometry,ma=L.faces3,na=L.faces4,W=3*ma.length+4*na.length,va=1*ma.length+2*na.length,xa=3*ma.length+4*na.length,sa=c(ha,L),Ga=e(sa),Ka=d(sa),Na=sa.vertexColors?sa.vertexColors:!1;L.__vertexArray=new Float32Array(3*W);if(Ka)L.__normalArray=new Float32Array(3*W);if(ga.hasTangents)L.__tangentArray=new Float32Array(4*W);if(Na)L.__colorArray=new Float32Array(3*W);if(Ga){if(0<ga.faceUvs.length||
+0<ga.faceVertexUvs.length)L.__uvArray=new Float32Array(2*W);if(1<ga.faceUvs.length||1<ga.faceVertexUvs.length)L.__uv2Array=new Float32Array(2*W)}if(ha.geometry.skinWeights.length&&ha.geometry.skinIndices.length)L.__skinVertexAArray=new Float32Array(4*W),L.__skinVertexBArray=new Float32Array(4*W),L.__skinIndexArray=new Float32Array(4*W),L.__skinWeightArray=new Float32Array(4*W);L.__faceArray=new Uint16Array(3*va);L.__lineArray=new Uint16Array(2*xa);if(L.numMorphTargets){L.__morphTargetsArrays=[];for(var Ma=
+0,gb=L.numMorphTargets;Ma<gb;Ma++)L.__morphTargetsArrays.push(new Float32Array(3*W))}L.__webglFaceCount=3*va;L.__webglLineCount=2*xa;if(sa.attributes){if(void 0===L.__webglCustomAttributesList)L.__webglCustomAttributesList=[];var Ra=void 0;for(Ra in sa.attributes){var Oa=sa.attributes[Ra],Da={},fb;for(fb in Oa)Da[fb]=Oa[fb];if(!Da.__webglInitialized||Da.createUniqueBuffers){Da.__webglInitialized=!0;var Eb=1;"v2"===Da.type?Eb=2:"v3"===Da.type?Eb=3:"v4"===Da.type?Eb=4:"c"===Da.type&&(Eb=3);Da.size=
+Eb;Da.array=new Float32Array(W*Eb);Da.buffer=f.createBuffer();Da.buffer.belongsToAttribute=Ra;Oa.needsUpdate=!0;Da.__original=Oa}L.__webglCustomAttributesList.push(Da)}}L.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}}else if(h instanceof THREE.Ribbon){if(k=h.geometry,!k.__webglVertexBuffer){var lb=k;lb.__webglVertexBuffer=f.createBuffer();lb.__webglColorBuffer=f.createBuffer();A.info.memory.geometries++;
+var Sa=k,yb=Sa.vertices.length;Sa.__vertexArray=new Float32Array(3*yb);Sa.__colorArray=new Float32Array(3*yb);Sa.__webglVertexCount=yb;k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(h instanceof THREE.Line){if(k=h.geometry,!k.__webglVertexBuffer){var Db=k;Db.__webglVertexBuffer=f.createBuffer();Db.__webglColorBuffer=f.createBuffer();A.info.memory.geometries++;var Pb=k,Ob=h,sc=Pb.vertices.length;Pb.__vertexArray=new Float32Array(3*sc);Pb.__colorArray=new Float32Array(3*sc);Pb.__webglLineCount=sc;
+b(Pb,Ob);k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(h instanceof THREE.ParticleSystem&&(k=h.geometry,!k.__webglVertexBuffer)){var Nb=k;Nb.__webglVertexBuffer=f.createBuffer();Nb.__webglColorBuffer=f.createBuffer();A.info.geometries++;var Fb=k,ac=h,tc=Fb.vertices.length;Fb.__vertexArray=new Float32Array(3*tc);Fb.__colorArray=new Float32Array(3*tc);Fb.__sortArray=[];Fb.__webglParticleCount=tc;b(Fb,ac);k.__dirtyVertices=!0;k.__dirtyColors=!0}if(!h.__webglActive){if(h instanceof THREE.Mesh)if(k=
+h.geometry,k instanceof THREE.BufferGeometry)j(i.__webglObjects,k,h);else for(l in k.geometryGroups)r=k.geometryGroups[l],j(i.__webglObjects,r,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(k=h.geometry,j(i.__webglObjects,k,h)):void 0!==THREE.MarchingCubes&&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;){var Ha=a.__objectsRemoved[0],dc=a;Ha instanceof THREE.Mesh||Ha instanceof THREE.ParticleSystem||Ha instanceof THREE.Ribbon||Ha instanceof THREE.Line?p(dc.__webglObjects,Ha):Ha instanceof THREE.Sprite?m(dc.__webglSprites,Ha):Ha instanceof THREE.LensFlare?m(dc.__webglFlares,Ha):(Ha instanceof THREE.MarchingCubes||Ha.immediateRenderCallback)&&p(dc.__webglObjectsImmediate,Ha);Ha.__webglActive=
+!1;a.__objectsRemoved.splice(0,1)}for(var uc=0,bc=a.__webglObjects.length;uc<bc;uc++){var Pa=a.__webglObjects[uc].object,R=Pa.geometry,Qb=void 0,Gb=void 0,za=void 0;if(Pa instanceof THREE.Mesh)if(R instanceof THREE.BufferGeometry)R.__dirtyVertices=!1,R.__dirtyElements=!1,R.__dirtyUvs=!1,R.__dirtyNormals=!1,R.__dirtyColors=!1;else{for(var vc=0,cc=R.geometryGroupsList.length;vc<cc;vc++)if(Qb=R.geometryGroupsList[vc],za=c(Pa,Qb),Gb=za.attributes&&n(za),R.__dirtyVertices||R.__dirtyMorphTargets||R.__dirtyElements||
+R.__dirtyUvs||R.__dirtyNormals||R.__dirtyColors||R.__dirtyTangents||Gb){var O=Qb,rc=Pa,Ea=f.DYNAMIC_DRAW,Pc=!R.dynamic,ec=za;if(O.__inittedArrays){var Dc=d(ec),wc=ec.vertexColors?ec.vertexColors:!1,Ec=e(ec),Fc=Dc===THREE.SmoothShading,v=void 0,C=void 0,La=void 0,x=void 0,Hb=void 0,mb=void 0,Qa=void 0,fc=void 0,hb=void 0,Ib=void 0,Jb=void 0,E=void 0,F=void 0,G=void 0,X=void 0,Ta=void 0,Ua=void 0,Va=void 0,Rb=void 0,Wa=void 0,Xa=void 0,Ya=void 0,Sb=void 0,Za=void 0,$a=void 0,ab=void 0,Tb=void 0,bb=
+void 0,cb=void 0,db=void 0,Ub=void 0,nb=void 0,ob=void 0,pb=void 0,gc=void 0,qb=void 0,rb=void 0,sb=void 0,hc=void 0,S=void 0,Gc=void 0,tb=void 0,Kb=void 0,Lb=void 0,Fa=void 0,Hc=void 0,pa=void 0,ia=0,oa=0,ib=0,jb=0,Ia=0,ua=0,Y=0,wa=0,ja=0,w=0,ka=0,s=0,Ba=void 0,qa=O.__vertexArray,Vb=O.__uvArray,Wb=O.__uv2Array,Ja=O.__normalArray,aa=O.__tangentArray,ra=O.__colorArray,ba=O.__skinVertexAArray,ca=O.__skinVertexBArray,da=O.__skinIndexArray,ea=O.__skinWeightArray,xc=O.__morphTargetsArrays,yc=O.__webglCustomAttributesList,
+q=void 0,eb=O.__faceArray,Ca=O.__lineArray,ya=rc.geometry,Qc=ya.__dirtyElements,Ic=ya.__dirtyUvs,Rc=ya.__dirtyNormals,Sc=ya.__dirtyTangents,Tc=ya.__dirtyColors,Uc=ya.__dirtyMorphTargets,zb=ya.vertices,T=O.faces3,U=O.faces4,la=ya.faces,zc=ya.faceVertexUvs[0],Ac=ya.faceVertexUvs[1],Ab=ya.skinVerticesA,Bb=ya.skinVerticesB,Cb=ya.skinIndices,ub=ya.skinWeights,vb=ya.morphTargets;if(ya.__dirtyVertices){for(v=0,C=T.length;v<C;v++)x=la[T[v]],E=zb[x.a].position,F=zb[x.b].position,G=zb[x.c].position,qa[oa]=
+E.x,qa[oa+1]=E.y,qa[oa+2]=E.z,qa[oa+3]=F.x,qa[oa+4]=F.y,qa[oa+5]=F.z,qa[oa+6]=G.x,qa[oa+7]=G.y,qa[oa+8]=G.z,oa+=9;for(v=0,C=U.length;v<C;v++)x=la[U[v]],E=zb[x.a].position,F=zb[x.b].position,G=zb[x.c].position,X=zb[x.d].position,qa[oa]=E.x,qa[oa+1]=E.y,qa[oa+2]=E.z,qa[oa+3]=F.x,qa[oa+4]=F.y,qa[oa+5]=F.z,qa[oa+6]=G.x,qa[oa+7]=G.y,qa[oa+8]=G.z,qa[oa+9]=X.x,qa[oa+10]=X.y,qa[oa+11]=X.z,oa+=12;f.bindBuffer(f.ARRAY_BUFFER,O.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,qa,Ea)}if(Uc)for(Fa=0,Hc=vb.length;Fa<
+Hc;Fa++){ka=0;for(v=0,C=T.length;v<C;v++)x=la[T[v]],E=vb[Fa].vertices[x.a].position,F=vb[Fa].vertices[x.b].position,G=vb[Fa].vertices[x.c].position,pa=xc[Fa],pa[ka]=E.x,pa[ka+1]=E.y,pa[ka+2]=E.z,pa[ka+3]=F.x,pa[ka+4]=F.y,pa[ka+5]=F.z,pa[ka+6]=G.x,pa[ka+7]=G.y,pa[ka+8]=G.z,ka+=9;for(v=0,C=U.length;v<C;v++)x=la[U[v]],E=vb[Fa].vertices[x.a].position,F=vb[Fa].vertices[x.b].position,G=vb[Fa].vertices[x.c].position,X=vb[Fa].vertices[x.d].position,pa=xc[Fa],pa[ka]=E.x,pa[ka+1]=E.y,pa[ka+2]=E.z,pa[ka+3]=
+F.x,pa[ka+4]=F.y,pa[ka+5]=F.z,pa[ka+6]=G.x,pa[ka+7]=G.y,pa[ka+8]=G.z,pa[ka+9]=X.x,pa[ka+10]=X.y,pa[ka+11]=X.z,ka+=12;f.bindBuffer(f.ARRAY_BUFFER,O.__webglMorphTargetsBuffers[Fa]);f.bufferData(f.ARRAY_BUFFER,xc[Fa],Ea)}if(ub.length){for(v=0,C=T.length;v<C;v++)x=la[T[v]],Za=ub[x.a],$a=ub[x.b],ab=ub[x.c],ea[w]=Za.x,ea[w+1]=Za.y,ea[w+2]=Za.z,ea[w+3]=Za.w,ea[w+4]=$a.x,ea[w+5]=$a.y,ea[w+6]=$a.z,ea[w+7]=$a.w,ea[w+8]=ab.x,ea[w+9]=ab.y,ea[w+10]=ab.z,ea[w+11]=ab.w,bb=Cb[x.a],cb=Cb[x.b],db=Cb[x.c],da[w]=bb.x,
+da[w+1]=bb.y,da[w+2]=bb.z,da[w+3]=bb.w,da[w+4]=cb.x,da[w+5]=cb.y,da[w+6]=cb.z,da[w+7]=cb.w,da[w+8]=db.x,da[w+9]=db.y,da[w+10]=db.z,da[w+11]=db.w,nb=Ab[x.a],ob=Ab[x.b],pb=Ab[x.c],ba[w]=nb.x,ba[w+1]=nb.y,ba[w+2]=nb.z,ba[w+3]=1,ba[w+4]=ob.x,ba[w+5]=ob.y,ba[w+6]=ob.z,ba[w+7]=1,ba[w+8]=pb.x,ba[w+9]=pb.y,ba[w+10]=pb.z,ba[w+11]=1,qb=Bb[x.a],rb=Bb[x.b],sb=Bb[x.c],ca[w]=qb.x,ca[w+1]=qb.y,ca[w+2]=qb.z,ca[w+3]=1,ca[w+4]=rb.x,ca[w+5]=rb.y,ca[w+6]=rb.z,ca[w+7]=1,ca[w+8]=sb.x,ca[w+9]=sb.y,ca[w+10]=sb.z,ca[w+11]=
+1,w+=12;for(v=0,C=U.length;v<C;v++)x=la[U[v]],Za=ub[x.a],$a=ub[x.b],ab=ub[x.c],Tb=ub[x.d],ea[w]=Za.x,ea[w+1]=Za.y,ea[w+2]=Za.z,ea[w+3]=Za.w,ea[w+4]=$a.x,ea[w+5]=$a.y,ea[w+6]=$a.z,ea[w+7]=$a.w,ea[w+8]=ab.x,ea[w+9]=ab.y,ea[w+10]=ab.z,ea[w+11]=ab.w,ea[w+12]=Tb.x,ea[w+13]=Tb.y,ea[w+14]=Tb.z,ea[w+15]=Tb.w,bb=Cb[x.a],cb=Cb[x.b],db=Cb[x.c],Ub=Cb[x.d],da[w]=bb.x,da[w+1]=bb.y,da[w+2]=bb.z,da[w+3]=bb.w,da[w+4]=cb.x,da[w+5]=cb.y,da[w+6]=cb.z,da[w+7]=cb.w,da[w+8]=db.x,da[w+9]=db.y,da[w+10]=db.z,da[w+11]=db.w,
+da[w+12]=Ub.x,da[w+13]=Ub.y,da[w+14]=Ub.z,da[w+15]=Ub.w,nb=Ab[x.a],ob=Ab[x.b],pb=Ab[x.c],gc=Ab[x.d],ba[w]=nb.x,ba[w+1]=nb.y,ba[w+2]=nb.z,ba[w+3]=1,ba[w+4]=ob.x,ba[w+5]=ob.y,ba[w+6]=ob.z,ba[w+7]=1,ba[w+8]=pb.x,ba[w+9]=pb.y,ba[w+10]=pb.z,ba[w+11]=1,ba[w+12]=gc.x,ba[w+13]=gc.y,ba[w+14]=gc.z,ba[w+15]=1,qb=Bb[x.a],rb=Bb[x.b],sb=Bb[x.c],hc=Bb[x.d],ca[w]=qb.x,ca[w+1]=qb.y,ca[w+2]=qb.z,ca[w+3]=1,ca[w+4]=rb.x,ca[w+5]=rb.y,ca[w+6]=rb.z,ca[w+7]=1,ca[w+8]=sb.x,ca[w+9]=sb.y,ca[w+10]=sb.z,ca[w+11]=1,ca[w+12]=hc.x,
+ca[w+13]=hc.y,ca[w+14]=hc.z,ca[w+15]=1,w+=16;0<w&&(f.bindBuffer(f.ARRAY_BUFFER,O.__webglSkinVertexABuffer),f.bufferData(f.ARRAY_BUFFER,ba,Ea),f.bindBuffer(f.ARRAY_BUFFER,O.__webglSkinVertexBBuffer),f.bufferData(f.ARRAY_BUFFER,ca,Ea),f.bindBuffer(f.ARRAY_BUFFER,O.__webglSkinIndicesBuffer),f.bufferData(f.ARRAY_BUFFER,da,Ea),f.bindBuffer(f.ARRAY_BUFFER,O.__webglSkinWeightsBuffer),f.bufferData(f.ARRAY_BUFFER,ea,Ea))}if(Tc&&wc){for(v=0,C=T.length;v<C;v++)x=la[T[v]],Qa=x.vertexColors,fc=x.color,3===Qa.length&&
+wc===THREE.VertexColors?(Wa=Qa[0],Xa=Qa[1],Ya=Qa[2]):Ya=Xa=Wa=fc,ra[ja]=Wa.r,ra[ja+1]=Wa.g,ra[ja+2]=Wa.b,ra[ja+3]=Xa.r,ra[ja+4]=Xa.g,ra[ja+5]=Xa.b,ra[ja+6]=Ya.r,ra[ja+7]=Ya.g,ra[ja+8]=Ya.b,ja+=9;for(v=0,C=U.length;v<C;v++)x=la[U[v]],Qa=x.vertexColors,fc=x.color,4===Qa.length&&wc===THREE.VertexColors?(Wa=Qa[0],Xa=Qa[1],Ya=Qa[2],Sb=Qa[3]):Sb=Ya=Xa=Wa=fc,ra[ja]=Wa.r,ra[ja+1]=Wa.g,ra[ja+2]=Wa.b,ra[ja+3]=Xa.r,ra[ja+4]=Xa.g,ra[ja+5]=Xa.b,ra[ja+6]=Ya.r,ra[ja+7]=Ya.g,ra[ja+8]=Ya.b,ra[ja+9]=Sb.r,ra[ja+10]=
+Sb.g,ra[ja+11]=Sb.b,ja+=12;0<ja&&(f.bindBuffer(f.ARRAY_BUFFER,O.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,ra,Ea))}if(Sc&&ya.hasTangents){for(v=0,C=T.length;v<C;v++)x=la[T[v]],hb=x.vertexTangents,Ta=hb[0],Ua=hb[1],Va=hb[2],aa[Y]=Ta.x,aa[Y+1]=Ta.y,aa[Y+2]=Ta.z,aa[Y+3]=Ta.w,aa[Y+4]=Ua.x,aa[Y+5]=Ua.y,aa[Y+6]=Ua.z,aa[Y+7]=Ua.w,aa[Y+8]=Va.x,aa[Y+9]=Va.y,aa[Y+10]=Va.z,aa[Y+11]=Va.w,Y+=12;for(v=0,C=U.length;v<C;v++)x=la[U[v]],hb=x.vertexTangents,Ta=hb[0],Ua=hb[1],Va=hb[2],Rb=hb[3],aa[Y]=Ta.x,aa[Y+1]=
+Ta.y,aa[Y+2]=Ta.z,aa[Y+3]=Ta.w,aa[Y+4]=Ua.x,aa[Y+5]=Ua.y,aa[Y+6]=Ua.z,aa[Y+7]=Ua.w,aa[Y+8]=Va.x,aa[Y+9]=Va.y,aa[Y+10]=Va.z,aa[Y+11]=Va.w,aa[Y+12]=Rb.x,aa[Y+13]=Rb.y,aa[Y+14]=Rb.z,aa[Y+15]=Rb.w,Y+=16;f.bindBuffer(f.ARRAY_BUFFER,O.__webglTangentBuffer);f.bufferData(f.ARRAY_BUFFER,aa,Ea)}if(Rc&&Dc){for(v=0,C=T.length;v<C;v++)if(x=la[T[v]],Hb=x.vertexNormals,mb=x.normal,3===Hb.length&&Fc)for(S=0;3>S;S++)tb=Hb[S],Ja[ua]=tb.x,Ja[ua+1]=tb.y,Ja[ua+2]=tb.z,ua+=3;else for(S=0;3>S;S++)Ja[ua]=mb.x,Ja[ua+1]=mb.y,
+Ja[ua+2]=mb.z,ua+=3;for(v=0,C=U.length;v<C;v++)if(x=la[U[v]],Hb=x.vertexNormals,mb=x.normal,4===Hb.length&&Fc)for(S=0;4>S;S++)tb=Hb[S],Ja[ua]=tb.x,Ja[ua+1]=tb.y,Ja[ua+2]=tb.z,ua+=3;else for(S=0;4>S;S++)Ja[ua]=mb.x,Ja[ua+1]=mb.y,Ja[ua+2]=mb.z,ua+=3;f.bindBuffer(f.ARRAY_BUFFER,O.__webglNormalBuffer);f.bufferData(f.ARRAY_BUFFER,Ja,Ea)}if(Ic&&zc&&Ec){for(v=0,C=T.length;v<C;v++)if(La=T[v],x=la[La],Ib=zc[La],void 0!==Ib)for(S=0;3>S;S++)Kb=Ib[S],Vb[ib]=Kb.u,Vb[ib+1]=Kb.v,ib+=2;for(v=0,C=U.length;v<C;v++)if(La=
+U[v],x=la[La],Ib=zc[La],void 0!==Ib)for(S=0;4>S;S++)Kb=Ib[S],Vb[ib]=Kb.u,Vb[ib+1]=Kb.v,ib+=2;0<ib&&(f.bindBuffer(f.ARRAY_BUFFER,O.__webglUVBuffer),f.bufferData(f.ARRAY_BUFFER,Vb,Ea))}if(Ic&&Ac&&Ec){for(v=0,C=T.length;v<C;v++)if(La=T[v],x=la[La],Jb=Ac[La],void 0!==Jb)for(S=0;3>S;S++)Lb=Jb[S],Wb[jb]=Lb.u,Wb[jb+1]=Lb.v,jb+=2;for(v=0,C=U.length;v<C;v++)if(La=U[v],x=la[La],Jb=Ac[La],void 0!==Jb)for(S=0;4>S;S++)Lb=Jb[S],Wb[jb]=Lb.u,Wb[jb+1]=Lb.v,jb+=2;0<jb&&(f.bindBuffer(f.ARRAY_BUFFER,O.__webglUV2Buffer),
+f.bufferData(f.ARRAY_BUFFER,Wb,Ea))}if(Qc){for(v=0,C=T.length;v<C;v++)x=la[T[v]],eb[Ia]=ia,eb[Ia+1]=ia+1,eb[Ia+2]=ia+2,Ia+=3,Ca[wa]=ia,Ca[wa+1]=ia+1,Ca[wa+2]=ia,Ca[wa+3]=ia+2,Ca[wa+4]=ia+1,Ca[wa+5]=ia+2,wa+=6,ia+=3;for(v=0,C=U.length;v<C;v++)x=la[U[v]],eb[Ia]=ia,eb[Ia+1]=ia+1,eb[Ia+2]=ia+3,eb[Ia+3]=ia+1,eb[Ia+4]=ia+2,eb[Ia+5]=ia+3,Ia+=6,Ca[wa]=ia,Ca[wa+1]=ia+1,Ca[wa+2]=ia,Ca[wa+3]=ia+3,Ca[wa+4]=ia+1,Ca[wa+5]=ia+2,Ca[wa+6]=ia+2,Ca[wa+7]=ia+3,wa+=8,ia+=4;f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,O.__webglFaceBuffer);
+f.bufferData(f.ELEMENT_ARRAY_BUFFER,eb,Ea);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,O.__webglLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,Ca,Ea)}if(yc)for(S=0,Gc=yc.length;S<Gc;S++)if(q=yc[S],q.__original.needsUpdate){s=0;if(1===q.size)if(void 0===q.boundTo||"vertices"===q.boundTo){for(v=0,C=T.length;v<C;v++)x=la[T[v]],q.array[s]=q.value[x.a],q.array[s+1]=q.value[x.b],q.array[s+2]=q.value[x.c],s+=3;for(v=0,C=U.length;v<C;v++)x=la[U[v]],q.array[s]=q.value[x.a],q.array[s+1]=q.value[x.b],q.array[s+2]=
+q.value[x.c],q.array[s+3]=q.value[x.d],s+=4}else{if("faces"===q.boundTo){for(v=0,C=T.length;v<C;v++)Ba=q.value[T[v]],q.array[s]=Ba,q.array[s+1]=Ba,q.array[s+2]=Ba,s+=3;for(v=0,C=U.length;v<C;v++)Ba=q.value[U[v]],q.array[s]=Ba,q.array[s+1]=Ba,q.array[s+2]=Ba,q.array[s+3]=Ba,s+=4}}else if(2===q.size)if(void 0===q.boundTo||"vertices"===q.boundTo){for(v=0,C=T.length;v<C;v++)x=la[T[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=F.x,q.array[s+3]=F.y,q.array[s+
+4]=G.x,q.array[s+5]=G.y,s+=6;for(v=0,C=U.length;v<C;v++)x=la[U[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],X=q.value[x.d],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=F.x,q.array[s+3]=F.y,q.array[s+4]=G.x,q.array[s+5]=G.y,q.array[s+6]=X.x,q.array[s+7]=X.y,s+=8}else{if("faces"===q.boundTo){for(v=0,C=T.length;v<C;v++)G=F=E=Ba=q.value[T[v]],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=F.x,q.array[s+3]=F.y,q.array[s+4]=G.x,q.array[s+5]=G.y,s+=6;for(v=0,C=U.length;v<C;v++)X=G=F=E=Ba=q.value[U[v]],
+q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=F.x,q.array[s+3]=F.y,q.array[s+4]=G.x,q.array[s+5]=G.y,q.array[s+6]=X.x,q.array[s+7]=X.y,s+=8}}else if(3===q.size){var P;P="c"===q.type?["r","g","b"]:["x","y","z"];if(void 0===q.boundTo||"vertices"===q.boundTo){for(v=0,C=T.length;v<C;v++)x=la[T[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],q.array[s]=E[P[0]],q.array[s+1]=E[P[1]],q.array[s+2]=E[P[2]],q.array[s+3]=F[P[0]],q.array[s+4]=F[P[1]],q.array[s+5]=F[P[2]],q.array[s+6]=G[P[0]],q.array[s+7]=G[P[1]],
+q.array[s+8]=G[P[2]],s+=9;for(v=0,C=U.length;v<C;v++)x=la[U[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],X=q.value[x.d],q.array[s]=E[P[0]],q.array[s+1]=E[P[1]],q.array[s+2]=E[P[2]],q.array[s+3]=F[P[0]],q.array[s+4]=F[P[1]],q.array[s+5]=F[P[2]],q.array[s+6]=G[P[0]],q.array[s+7]=G[P[1]],q.array[s+8]=G[P[2]],q.array[s+9]=X[P[0]],q.array[s+10]=X[P[1]],q.array[s+11]=X[P[2]],s+=12}else if("faces"===q.boundTo){for(v=0,C=T.length;v<C;v++)G=F=E=Ba=q.value[T[v]],q.array[s]=E[P[0]],q.array[s+1]=E[P[1]],
+q.array[s+2]=E[P[2]],q.array[s+3]=F[P[0]],q.array[s+4]=F[P[1]],q.array[s+5]=F[P[2]],q.array[s+6]=G[P[0]],q.array[s+7]=G[P[1]],q.array[s+8]=G[P[2]],s+=9;for(v=0,C=U.length;v<C;v++)X=G=F=E=Ba=q.value[U[v]],q.array[s]=E[P[0]],q.array[s+1]=E[P[1]],q.array[s+2]=E[P[2]],q.array[s+3]=F[P[0]],q.array[s+4]=F[P[1]],q.array[s+5]=F[P[2]],q.array[s+6]=G[P[0]],q.array[s+7]=G[P[1]],q.array[s+8]=G[P[2]],q.array[s+9]=X[P[0]],q.array[s+10]=X[P[1]],q.array[s+11]=X[P[2]],s+=12}}else if(4===q.size)if(void 0===q.boundTo||
+"vertices"===q.boundTo){for(v=0,C=T.length;v<C;v++)x=la[T[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=E.z,q.array[s+3]=E.w,q.array[s+4]=F.x,q.array[s+5]=F.y,q.array[s+6]=F.z,q.array[s+7]=F.w,q.array[s+8]=G.x,q.array[s+9]=G.y,q.array[s+10]=G.z,q.array[s+11]=G.w,s+=12;for(v=0,C=U.length;v<C;v++)x=la[U[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],X=q.value[x.d],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=E.z,q.array[s+3]=E.w,q.array[s+4]=F.x,q.array[s+
+5]=F.y,q.array[s+6]=F.z,q.array[s+7]=F.w,q.array[s+8]=G.x,q.array[s+9]=G.y,q.array[s+10]=G.z,q.array[s+11]=G.w,q.array[s+12]=X.x,q.array[s+13]=X.y,q.array[s+14]=X.z,q.array[s+15]=X.w,s+=16}else if("faces"===q.boundTo){for(v=0,C=T.length;v<C;v++)G=F=E=Ba=q.value[T[v]],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=E.z,q.array[s+3]=E.w,q.array[s+4]=F.x,q.array[s+5]=F.y,q.array[s+6]=F.z,q.array[s+7]=F.w,q.array[s+8]=G.x,q.array[s+9]=G.y,q.array[s+10]=G.z,q.array[s+11]=G.w,s+=12;for(v=0,C=U.length;v<C;v++)X=
+G=F=E=Ba=q.value[U[v]],q.array[s]=E.x,q.array[s+1]=E.y,q.array[s+2]=E.z,q.array[s+3]=E.w,q.array[s+4]=F.x,q.array[s+5]=F.y,q.array[s+6]=F.z,q.array[s+7]=F.w,q.array[s+8]=G.x,q.array[s+9]=G.y,q.array[s+10]=G.z,q.array[s+11]=G.w,q.array[s+12]=X.x,q.array[s+13]=X.y,q.array[s+14]=X.z,q.array[s+15]=X.w,s+=16}f.bindBuffer(f.ARRAY_BUFFER,q.buffer);f.bufferData(f.ARRAY_BUFFER,q.array,Ea)}Pc&&(delete O.__inittedArrays,delete O.__colorArray,delete O.__normalArray,delete O.__tangentArray,delete O.__uvArray,
+delete O.__uv2Array,delete O.__faceArray,delete O.__vertexArray,delete O.__lineArray,delete O.__skinVertexAArray,delete O.__skinVertexBArray,delete O.__skinIndexArray,delete O.__skinWeightArray)}}R.__dirtyVertices=!1;R.__dirtyMorphTargets=!1;R.__dirtyElements=!1;R.__dirtyUvs=!1;R.__dirtyNormals=!1;R.__dirtyColors=!1;R.__dirtyTangents=!1;za.attributes&&o(za)}else if(Pa instanceof THREE.Ribbon){if(R.__dirtyVertices||R.__dirtyColors){var wb=R,Jc=f.DYNAMIC_DRAW,Xb=void 0,Yb=void 0,ic=void 0,xb=void 0,
+jc=void 0,Kc=wb.vertices,Lc=wb.colors,Vc=Kc.length,Wc=Lc.length,kc=wb.__vertexArray,lc=wb.__colorArray,Xc=wb.__dirtyColors;if(wb.__dirtyVertices){for(Xb=0;Xb<Vc;Xb++)ic=Kc[Xb].position,xb=3*Xb,kc[xb]=ic.x,kc[xb+1]=ic.y,kc[xb+2]=ic.z;f.bindBuffer(f.ARRAY_BUFFER,wb.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,kc,Jc)}if(Xc){for(Yb=0;Yb<Wc;Yb++)jc=Lc[Yb],xb=3*Yb,lc[xb]=jc.r,lc[xb+1]=jc.g,lc[xb+2]=jc.b;f.bindBuffer(f.ARRAY_BUFFER,wb.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,lc,Jc)}}R.__dirtyVertices=
+!1;R.__dirtyColors=!1}else if(Pa instanceof THREE.Line){za=c(Pa,Qb);Gb=za.attributes&&n(za);if(R.__dirtyVertices||R.__dirtyColors||Gb){var kb=R,Bc=f.DYNAMIC_DRAW,Zb=void 0,$b=void 0,mc=void 0,fa=void 0,nc=void 0,Mc=kb.vertices,Nc=kb.colors,Yc=Mc.length,Zc=Nc.length,oc=kb.__vertexArray,pc=kb.__colorArray,$c=kb.__dirtyColors,Cc=kb.__webglCustomAttributesList,qc=void 0,Oc=void 0,ta=void 0,Mb=void 0,Aa=void 0,$=void 0;if(kb.__dirtyVertices){for(Zb=0;Zb<Yc;Zb++)mc=Mc[Zb].position,fa=3*Zb,oc[fa]=mc.x,oc[fa+
+1]=mc.y,oc[fa+2]=mc.z;f.bindBuffer(f.ARRAY_BUFFER,kb.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,oc,Bc)}if($c){for($b=0;$b<Zc;$b++)nc=Nc[$b],fa=3*$b,pc[fa]=nc.r,pc[fa+1]=nc.g,pc[fa+2]=nc.b;f.bindBuffer(f.ARRAY_BUFFER,kb.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,pc,Bc)}if(Cc)for(qc=0,Oc=Cc.length;qc<Oc;qc++)if($=Cc[qc],$.needsUpdate&&(void 0===$.boundTo||"vertices"===$.boundTo)){fa=0;Mb=$.value.length;if(1===$.size)for(ta=0;ta<Mb;ta++)$.array[ta]=$.value[ta];else if(2===$.size)for(ta=0;ta<
+Mb;ta++)Aa=$.value[ta],$.array[fa]=Aa.x,$.array[fa+1]=Aa.y,fa+=2;else if(3===$.size)if("c"===$.type)for(ta=0;ta<Mb;ta++)Aa=$.value[ta],$.array[fa]=Aa.r,$.array[fa+1]=Aa.g,$.array[fa+2]=Aa.b,fa+=3;else for(ta=0;ta<Mb;ta++)Aa=$.value[ta],$.array[fa]=Aa.x,$.array[fa+1]=Aa.y,$.array[fa+2]=Aa.z,fa+=3;else if(4===$.size)for(ta=0;ta<Mb;ta++)Aa=$.value[ta],$.array[fa]=Aa.x,$.array[fa+1]=Aa.y,$.array[fa+2]=Aa.z,$.array[fa+3]=Aa.w,fa+=4;f.bindBuffer(f.ARRAY_BUFFER,$.buffer);f.bufferData(f.ARRAY_BUFFER,$.array,
+Bc)}}R.__dirtyVertices=!1;R.__dirtyColors=!1;za.attributes&&o(za)}else if(Pa instanceof THREE.ParticleSystem)za=c(Pa,Qb),Gb=za.attributes&&n(za),(R.__dirtyVertices||R.__dirtyColors||Pa.sortParticles||Gb)&&g(R,f.DYNAMIC_DRAW,Pa),R.__dirtyVertices=!1,R.__dirtyColors=!1,za.attributes&&o(za)}};this.initMaterial=function(a,b,c,d){var e,g,h,i,j;a instanceof THREE.MeshDepthMaterial?j="depth":a instanceof THREE.MeshNormalMaterial?j="normal":a instanceof THREE.MeshBasicMaterial?j="basic":a instanceof THREE.MeshLambertMaterial?
+j="lambert":a instanceof THREE.MeshPhongMaterial?j="phong":a instanceof THREE.LineBasicMaterial?j="basic":a instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var n,l;g=k=0;for(n=0,l=b.length;n<l;n++)e=b[n],e.onlyShadow||(e instanceof THREE.SpotLight&&g++,e instanceof THREE.DirectionalLight&&g++,e instanceof THREE.PointLight&&k++);k+g<=xa?n=g:(n=
+Math.ceil(xa*g/(k+g)),k=xa-n);e=n;g=k;var m=0;for(k=0,n=b.length;k<n;k++)l=b[k],l.castShadow&&(l instanceof THREE.SpotLight||l instanceof THREE.DirectionalLight)&&m++;var o=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)o=d.bones.length;var p;a:{n=a.fragmentShader;l=a.vertexShader;var k=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,
+maxDirLights:e,maxPointLights:g,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround},r,d=[];j?d.push(j):(d.push(n),d.push(l));for(r in c)d.push(r),d.push(c[r]);j=d.join();for(r=0,d=Ga.length;r<d;r++)if(Ga[r].code===j){p=Ga[r].program;break a}r=f.createProgram();d=[0<cc?"#define VERTEX_TEXTURES":"",A.gammaInput?"#define GAMMA_INPUT":"",A.gammaOutput?"#define GAMMA_OUTPUT":
+"",A.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.wrapAround?"#define WRAP_AROUND":
+"",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");
 e=["precision "+B+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",A.gammaInput?"#define GAMMA_INPUT":"",A.gammaOutput?"#define GAMMA_OUTPUT":"",A.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?
-"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");f.attachShader(r,y("fragment",e+l));f.attachShader(r,y("vertex",d+n));f.linkProgram(r);f.getProgramParameter(r,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+
-f.getProgramParameter(r,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");r.uniforms={};r.attributes={};var t,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,cameraInverseMatrix,boneGlobalMatrices,morphTargetInfluences".split(",");for(t in k)d.push(t);t=d;for(d=0,k=t.length;d<k;d++)l=t[d],r.uniforms[l]=f.getUniformLocation(r,l);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(t=0;t<c.maxMorphTargets;t++)d.push("morphTarget"+
+"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");f.attachShader(r,y("fragment",e+n));f.attachShader(r,y("vertex",d+l));f.linkProgram(r);f.getProgramParameter(r,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+
+f.getProgramParameter(r,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");r.uniforms={};r.attributes={};var t,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,cameraInverseMatrix,boneGlobalMatrices,morphTargetInfluences".split(",");for(t in k)d.push(t);t=d;for(d=0,k=t.length;d<k;d++)n=t[d],r.uniforms[n]=f.getUniformLocation(r,n);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(t=0;t<c.maxMorphTargets;t++)d.push("morphTarget"+
 t);for(p in b)d.push(p);p=d;for(t=0,b=p.length;t<b;t++)c=p[t],r.attributes[c]=f.getAttribLocation(r,c);r.id=Ga.length;Ga.push({program:r,code:j});A.info.memory.programs=Ga.length;p=r}a.program=p;p=a.program.attributes;0<=p.position&&f.enableVertexAttribArray(p.position);0<=p.color&&f.enableVertexAttribArray(p.color);0<=p.normal&&f.enableVertexAttribArray(p.normal);0<=p.tangent&&f.enableVertexAttribArray(p.tangent);a.skinning&&0<=p.skinVertexA&&0<=p.skinVertexB&&0<=p.skinIndex&&0<=p.skinWeight&&(f.enableVertexAttribArray(p.skinVertexA),
 f.enableVertexAttribArray(p.skinVertexB),f.enableVertexAttribArray(p.skinIndex),f.enableVertexAttribArray(p.skinWeight));if(a.attributes)for(i in a.attributes)void 0!==p[i]&&0<=p[i]&&f.enableVertexAttribArray(p[i]);if(a.morphTargets)for(i=a.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)t="morphTarget"+i,0<=p[t]&&(f.enableVertexAttribArray(p[t]),a.numSupportedMorphTargets++);a.uniformsList=[];for(h in a.uniforms)a.uniformsList.push([a.uniforms[h],h])};this.setFaceCulling=function(a,b){a?(!b||
 "ccw"===b?f.frontFace(f.CCW):f.frontFace(f.CW),"back"===a?f.cullFace(f.BACK):"front"===a?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK),f.enable(f.CULL_FACE)):f.disable(f.CULL_FACE)};this.setObjectFaces=function(a){if(na!==a.doubleSided)a.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE),na=a.doubleSided;if(ha!==a.flipSided)a.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW),ha=a.flipSided};this.setDepthTest=function(a){Z!==a&&(a?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST),Z=a)};this.setDepthWrite=
@@ -315,18 +316,18 @@ THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[]
 THREE.LensFlare.prototype.add=function(a,b,c,d,e,g){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===g&&(g=1);void 0===e&&(e=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:g,color:e,blending:d})};
 THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=a;this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(3*this.size3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=0;this.hasNormal=
-this.hasPos=!1;this.positionArray=new Float32Array(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,h,i,k,m,j,n){h=(h-j)/(n-j);j=this.normal_cache;b[g]=i+h*this.delta;b[g+1]=k;b[g+2]=m;e[g]=this.lerp(j[a],j[a+3],h);e[g+1]=this.lerp(j[a+1],j[a+4],h);e[g+2]=this.lerp(j[a+2],j[a+5],h)};this.VIntY=function(a,b,e,g,h,i,k,m,j,n){h=(h-j)/(n-j);j=this.normal_cache;b[g]=i;b[g+1]=k+h*this.delta;b[g+2]=m;b=a+3*this.yd;
-e[g]=this.lerp(j[a],j[b],h);e[g+1]=this.lerp(j[a+1],j[b+1],h);e[g+2]=this.lerp(j[a+2],j[b+2],h)};this.VIntZ=function(a,b,e,g,h,i,k,m,j,n){h=(h-j)/(n-j);j=this.normal_cache;b[g]=i;b[g+1]=k;b[g+2]=m+h*this.delta;b=a+3*this.zd;e[g]=this.lerp(j[a],j[b],h);e[g+1]=this.lerp(j[a+1],j[b+1],h);e[g+2]=this.lerp(j[a+2],j[b+2],h)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
-this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,h,i){var k=g+1,m=g+this.yd,j=g+this.zd,n=k+this.yd,o=k+this.zd,p=g+this.yd+this.zd,l=k+this.yd+this.zd,r=0,t=this.field[g],z=this.field[k],y=this.field[m],K=this.field[n],N=this.field[j],u=this.field[o],J=this.field[p],H=this.field[l];t<h&&(r|=1);z<h&&(r|=2);y<h&&(r|=8);K<h&&(r|=4);N<h&&(r|=16);u<h&&(r|=32);J<h&&(r|=128);H<h&&(r|=64);var B=THREE.edgeTable[r];if(0===B)return 0;var D=this.delta,M=a+
-D,I=b+D,D=e+D;B&1&&(this.compNorm(g),this.compNorm(k),this.VIntX(3*g,this.vlist,this.nlist,0,h,a,b,e,t,z));B&2&&(this.compNorm(k),this.compNorm(n),this.VIntY(3*k,this.vlist,this.nlist,3,h,M,b,e,z,K));B&4&&(this.compNorm(m),this.compNorm(n),this.VIntX(3*m,this.vlist,this.nlist,6,h,a,I,e,y,K));B&8&&(this.compNorm(g),this.compNorm(m),this.VIntY(3*g,this.vlist,this.nlist,9,h,a,b,e,t,y));B&16&&(this.compNorm(j),this.compNorm(o),this.VIntX(3*j,this.vlist,this.nlist,12,h,a,b,D,N,u));B&32&&(this.compNorm(o),
-this.compNorm(l),this.VIntY(3*o,this.vlist,this.nlist,15,h,M,b,D,u,H));B&64&&(this.compNorm(p),this.compNorm(l),this.VIntX(3*p,this.vlist,this.nlist,18,h,a,I,D,J,H));B&128&&(this.compNorm(j),this.compNorm(p),this.VIntY(3*j,this.vlist,this.nlist,21,h,a,b,D,N,J));B&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(3*g,this.vlist,this.nlist,24,h,a,b,e,t,N));B&512&&(this.compNorm(k),this.compNorm(o),this.VIntZ(3*k,this.vlist,this.nlist,27,h,M,b,e,z,u));B&1024&&(this.compNorm(n),this.compNorm(l),this.VIntZ(3*
-n,this.vlist,this.nlist,30,h,M,I,e,K,H));B&2048&&(this.compNorm(m),this.compNorm(p),this.VIntZ(3*m,this.vlist,this.nlist,33,h,a,I,e,y,J));r<<=4;for(h=g=0;-1!=THREE.triTable[r+h];)a=r+h,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],i),h+=3,g++;return g};this.posnormtriv=function(a,b,e,g,h,i){var k=3*this.count;this.positionArray[k]=a[e];this.positionArray[k+1]=a[e+1];this.positionArray[k+2]=a[e+2];this.positionArray[k+3]=a[g];this.positionArray[k+
-4]=a[g+1];this.positionArray[k+5]=a[g+2];this.positionArray[k+6]=a[h];this.positionArray[k+7]=a[h+1];this.positionArray[k+8]=a[h+2];this.normalArray[k]=b[e];this.normalArray[k+1]=b[e+1];this.normalArray[k+2]=b[e+2];this.normalArray[k+3]=b[g];this.normalArray[k+4]=b[g+1];this.normalArray[k+5]=b[g+2];this.normalArray[k+6]=b[h];this.normalArray[k+7]=b[h+1];this.normalArray[k+8]=b[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&i(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(a){if(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,h){var i=this.size*Math.sqrt(g/h),k=e*this.size,m=b*this.size,j=a*this.size,n=Math.floor(k-i);1>n&&(n=1);k=Math.floor(k+i);k>this.size-1&&(k=this.size-1);var o=Math.floor(m-i);1>o&&(o=1);m=Math.floor(m+i);m>this.size-1&&(m=this.size-1);var p=Math.floor(j-i);1>p&&(p=1);i=Math.floor(j+i);i>this.size-1&&(i=this.size-
-1);for(var l,r,t,z,y,K,N,j=n;j<k;j++){t=this.size2*j;y=j/this.size-e;K=y*y;for(n=o;n<m;n++){r=t+this.size*n;l=n/this.size-b;N=l*l;for(l=p;l<i;l++)z=l/this.size-a,z=g/(1.0E-6+z*z+N+K)-h,0<z&&(this.field[r+l]+=z)}}};this.addPlaneX=function(a,b){var e,g,h,i,k,m=this.size,j=this.yd,n=this.zd,o=this.field,p=m*Math.sqrt(a/b);p>m&&(p=m);for(e=0;e<p;e++)if(g=e/m,g*=g,i=a/(1.0E-4+g)-b,0<i)for(g=0;g<m;g++){k=e+g*j;for(h=0;h<m;h++)o[n*h+k]+=i}};this.addPlaneY=function(a,b){var e,g,h,i,k,m,j=this.size,n=this.yd,
-o=this.zd,p=this.field,l=j*Math.sqrt(a/b);l>j&&(l=j);for(g=0;g<l;g++)if(e=g/j,e*=e,i=a/(1.0E-4+e)-b,0<i){k=g*n;for(e=0;e<j;e++){m=k+e;for(h=0;h<j;h++)p[o*h+m]+=i}}};this.addPlaneZ=function(a,b){var e,g,h,i,k,m,j=this.size,n=this.yd,o=this.zd,p=this.field,l=j*Math.sqrt(a/b);l>j&&(l=j);for(h=0;h<l;h++)if(e=h/j,e*=e,i=a/(1.0E-4+e)-b,0<i){k=o*h;for(g=0;g<j;g++){m=k+g*n;for(e=0;e<j;e++)p[m+e]+=i}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
-function(a){this.begin();var b,e,g,h,i,k,m,j,n,o=this.size-2;for(h=1;h<o;h++){n=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<o;g++){j=n+this.size*g;k=(g-this.halfsize)/this.halfsize;for(e=1;e<o;e++)i=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(i,k,m,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var h,i,k,m,j,n,o,p;for(h=0;h<g.count;h++)o=3*h,j=o+1,p=o+2,i=g.positionArray[o],k=g.positionArray[j],m=
-g.positionArray[p],n=new THREE.Vector3(i,k,m),i=g.normalArray[o],k=g.normalArray[j],m=g.normalArray[p],o=new THREE.Vector3(i,k,m),o.normalize(),j=new THREE.Vertex(n),b.vertices.push(j),e.push(o);n=g.count/3;for(h=0;h<n;h++)o=3*(a+h),j=o+1,p=o+2,i=e[o],k=e[j],m=e[p],o=new THREE.Face3(o,j,p,[i,k,m]),b.faces.push(o);a+=n;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+this.hasPos=!1;this.positionArray=new Float32Array(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,h,i,l,k,j,n){h=(h-j)/(n-j);j=this.normal_cache;b[g]=i+h*this.delta;b[g+1]=l;b[g+2]=k;e[g]=this.lerp(j[a],j[a+3],h);e[g+1]=this.lerp(j[a+1],j[a+4],h);e[g+2]=this.lerp(j[a+2],j[a+5],h)};this.VIntY=function(a,b,e,g,h,i,l,k,j,n){h=(h-j)/(n-j);j=this.normal_cache;b[g]=i;b[g+1]=l+h*this.delta;b[g+2]=k;b=a+3*this.yd;
+e[g]=this.lerp(j[a],j[b],h);e[g+1]=this.lerp(j[a+1],j[b+1],h);e[g+2]=this.lerp(j[a+2],j[b+2],h)};this.VIntZ=function(a,b,e,g,h,i,l,k,j,n){h=(h-j)/(n-j);j=this.normal_cache;b[g]=i;b[g+1]=l;b[g+2]=k+h*this.delta;b=a+3*this.zd;e[g]=this.lerp(j[a],j[b],h);e[g+1]=this.lerp(j[a+1],j[b+1],h);e[g+2]=this.lerp(j[a+2],j[b+2],h)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,h,i){var l=g+1,k=g+this.yd,j=g+this.zd,n=l+this.yd,o=l+this.zd,p=g+this.yd+this.zd,m=l+this.yd+this.zd,r=0,t=this.field[g],z=this.field[l],y=this.field[k],K=this.field[n],N=this.field[j],u=this.field[o],J=this.field[p],H=this.field[m];t<h&&(r|=1);z<h&&(r|=2);y<h&&(r|=8);K<h&&(r|=4);N<h&&(r|=16);u<h&&(r|=32);J<h&&(r|=128);H<h&&(r|=64);var B=THREE.edgeTable[r];if(0===B)return 0;var D=this.delta,M=a+
+D,I=b+D,D=e+D;B&1&&(this.compNorm(g),this.compNorm(l),this.VIntX(3*g,this.vlist,this.nlist,0,h,a,b,e,t,z));B&2&&(this.compNorm(l),this.compNorm(n),this.VIntY(3*l,this.vlist,this.nlist,3,h,M,b,e,z,K));B&4&&(this.compNorm(k),this.compNorm(n),this.VIntX(3*k,this.vlist,this.nlist,6,h,a,I,e,y,K));B&8&&(this.compNorm(g),this.compNorm(k),this.VIntY(3*g,this.vlist,this.nlist,9,h,a,b,e,t,y));B&16&&(this.compNorm(j),this.compNorm(o),this.VIntX(3*j,this.vlist,this.nlist,12,h,a,b,D,N,u));B&32&&(this.compNorm(o),
+this.compNorm(m),this.VIntY(3*o,this.vlist,this.nlist,15,h,M,b,D,u,H));B&64&&(this.compNorm(p),this.compNorm(m),this.VIntX(3*p,this.vlist,this.nlist,18,h,a,I,D,J,H));B&128&&(this.compNorm(j),this.compNorm(p),this.VIntY(3*j,this.vlist,this.nlist,21,h,a,b,D,N,J));B&256&&(this.compNorm(g),this.compNorm(j),this.VIntZ(3*g,this.vlist,this.nlist,24,h,a,b,e,t,N));B&512&&(this.compNorm(l),this.compNorm(o),this.VIntZ(3*l,this.vlist,this.nlist,27,h,M,b,e,z,u));B&1024&&(this.compNorm(n),this.compNorm(m),this.VIntZ(3*
+n,this.vlist,this.nlist,30,h,M,I,e,K,H));B&2048&&(this.compNorm(k),this.compNorm(p),this.VIntZ(3*k,this.vlist,this.nlist,33,h,a,I,e,y,J));r<<=4;for(h=g=0;-1!=THREE.triTable[r+h];)a=r+h,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],i),h+=3,g++;return g};this.posnormtriv=function(a,b,e,g,h,i){var l=3*this.count;this.positionArray[l]=a[e];this.positionArray[l+1]=a[e+1];this.positionArray[l+2]=a[e+2];this.positionArray[l+3]=a[g];this.positionArray[l+
+4]=a[g+1];this.positionArray[l+5]=a[g+2];this.positionArray[l+6]=a[h];this.positionArray[l+7]=a[h+1];this.positionArray[l+8]=a[h+2];this.normalArray[l]=b[e];this.normalArray[l+1]=b[e+1];this.normalArray[l+2]=b[e+2];this.normalArray[l+3]=b[g];this.normalArray[l+4]=b[g+1];this.normalArray[l+5]=b[g+2];this.normalArray[l+6]=b[h];this.normalArray[l+7]=b[h+1];this.normalArray[l+8]=b[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&i(this)};this.begin=function(){this.count=0;
+this.hasNormal=this.hasPos=!1};this.end=function(a){if(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,h){var i=this.size*Math.sqrt(g/h),l=e*this.size,k=b*this.size,j=a*this.size,n=Math.floor(l-i);1>n&&(n=1);l=Math.floor(l+i);l>this.size-1&&(l=this.size-1);var o=Math.floor(k-i);1>o&&(o=1);k=Math.floor(k+i);k>this.size-1&&(k=this.size-1);var p=Math.floor(j-i);1>p&&(p=1);i=Math.floor(j+i);i>this.size-1&&(i=this.size-
+1);for(var m,r,t,z,y,K,N,j=n;j<l;j++){t=this.size2*j;y=j/this.size-e;K=y*y;for(n=o;n<k;n++){r=t+this.size*n;m=n/this.size-b;N=m*m;for(m=p;m<i;m++)z=m/this.size-a,z=g/(1.0E-6+z*z+N+K)-h,0<z&&(this.field[r+m]+=z)}}};this.addPlaneX=function(a,b){var e,g,h,i,l,k=this.size,j=this.yd,n=this.zd,o=this.field,p=k*Math.sqrt(a/b);p>k&&(p=k);for(e=0;e<p;e++)if(g=e/k,g*=g,i=a/(1.0E-4+g)-b,0<i)for(g=0;g<k;g++){l=e+g*j;for(h=0;h<k;h++)o[n*h+l]+=i}};this.addPlaneY=function(a,b){var e,g,h,i,l,k,j=this.size,n=this.yd,
+o=this.zd,p=this.field,m=j*Math.sqrt(a/b);m>j&&(m=j);for(g=0;g<m;g++)if(e=g/j,e*=e,i=a/(1.0E-4+e)-b,0<i){l=g*n;for(e=0;e<j;e++){k=l+e;for(h=0;h<j;h++)p[o*h+k]+=i}}};this.addPlaneZ=function(a,b){var e,g,h,i,l,k,j=this.size,n=this.yd,o=this.zd,p=this.field,m=j*Math.sqrt(a/b);m>j&&(m=j);for(h=0;h<m;h++)if(e=h/j,e*=e,i=a/(1.0E-4+e)-b,0<i){l=o*h;for(g=0;g<j;g++){k=l+g*n;for(e=0;e<j;e++)p[k+e]+=i}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
+function(a){this.begin();var b,e,g,h,i,l,k,j,n,o=this.size-2;for(h=1;h<o;h++){n=this.size2*h;k=(h-this.halfsize)/this.halfsize;for(g=1;g<o;g++){j=n+this.size*g;l=(g-this.halfsize)/this.halfsize;for(e=1;e<o;e++)i=(e-this.halfsize)/this.halfsize,b=j+e,this.polygonize(i,l,k,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,e=[];this.render(function(g){var h,i,l,k,j,n,o,p;for(h=0;h<g.count;h++)o=3*h,j=o+1,p=o+2,i=g.positionArray[o],l=g.positionArray[j],k=
+g.positionArray[p],n=new THREE.Vector3(i,l,k),i=g.normalArray[o],l=g.normalArray[j],k=g.normalArray[p],o=new THREE.Vector3(i,l,k),o.normalize(),j=new THREE.Vertex(n),b.vertices.push(j),e.push(o);n=g.count/3;for(h=0;h<n;h++)o=3*(a+h),j=o+1,p=o+2,i=e[o],l=e[j],k=e[p],o=new THREE.Face3(o,j,p,[i,l,k]),b.faces.push(o);a+=n;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]);
@@ -351,34 +352,34 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
 4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,g,h,i,k,m,j,n,o,p;this.init=function(l){b=l.context;c=l;d=new Float32Array(16);e=new Uint16Array(6);l=0;d[l++]=-1;d[l++]=-1;d[l++]=0;d[l++]=0;d[l++]=1;d[l++]=-1;d[l++]=1;d[l++]=
-0;d[l++]=1;d[l++]=1;d[l++]=1;d[l++]=1;d[l++]=-1;d[l++]=1;d[l++]=0;d[l++]=1;l=0;e[l++]=0;e[l++]=1;e[l++]=2;e[l++]=0;e[l++]=2;e[l++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);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,k);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(m=!1,j=a(THREE.ShaderFlares.lensFlare)):(m=!0,j=a(THREE.ShaderFlares.lensFlareVertexTexture));n={};o={};n.vertex=b.getAttribLocation(j,"position");n.uv=b.getAttribLocation(j,"uv");o.renderType=b.getUniformLocation(j,"renderType");o.map=b.getUniformLocation(j,"map");o.occlusionMap=b.getUniformLocation(j,"occlusionMap");o.opacity=b.getUniformLocation(j,"opacity");o.color=b.getUniformLocation(j,
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,e,g,h,i,l,k,j,n,o,p;this.init=function(m){b=m.context;c=m;d=new Float32Array(16);e=new Uint16Array(6);m=0;d[m++]=-1;d[m++]=-1;d[m++]=0;d[m++]=0;d[m++]=1;d[m++]=-1;d[m++]=1;d[m++]=
+0;d[m++]=1;d[m++]=1;d[m++]=1;d[m++]=1;d[m++]=-1;d[m++]=1;d[m++]=0;d[m++]=1;m=0;e[m++]=0;e[m++]=1;e[m++]=2;e[m++]=0;e[m++]=2;e[m++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);i=b.createTexture();l=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);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,l);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(k=!1,j=a(THREE.ShaderFlares.lensFlare)):(k=!0,j=a(THREE.ShaderFlares.lensFlareVertexTexture));n={};o={};n.vertex=b.getAttribLocation(j,"position");n.uv=b.getAttribLocation(j,"uv");o.renderType=b.getUniformLocation(j,"renderType");o.map=b.getUniformLocation(j,"map");o.occlusionMap=b.getUniformLocation(j,"occlusionMap");o.opacity=b.getUniformLocation(j,"opacity");o.color=b.getUniformLocation(j,
 "color");o.scale=b.getUniformLocation(j,"scale");o.rotation=b.getUniformLocation(j,"rotation");o.screenPosition=b.getUniformLocation(j,"screenPosition");p=!1};this.render=function(a,d,e,z){var a=a.__webglFlares,y=a.length;if(y){var K=new THREE.Vector3,N=z/e,u=0.5*e,J=0.5*z,H=16/z,B=new THREE.Vector2(H*N,H),D=new THREE.Vector3(1,1,0),M=new THREE.Vector2(1,1),I=o,H=n;b.useProgram(j);p||(b.enableVertexAttribArray(n.vertex),b.enableVertexAttribArray(n.uv),p=!0);b.uniform1i(I.occlusionMap,0);b.uniform1i(I.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(H.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(H.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var Q,ga,xa,A,f;for(Q=0;Q<y;Q++)if(H=16/z,B.set(H*N,H),A=a[Q],K.set(A.matrixWorld.n14,A.matrixWorld.n24,A.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(K),d.projectionMatrix.multiplyVector3(K),D.copy(K),M.x=D.x*u+u,M.y=D.y*J+J,m||0<M.x&&M.x<e&&0<M.y&&M.y<z){b.activeTexture(b.TEXTURE1);
-b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,M.x-8,M.y-8,16,16,0);b.uniform1i(I.renderType,0);b.uniform2f(I.scale,B.x,B.y);b.uniform3f(I.screenPosition,D.x,D.y,D.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,M.x-8,M.y-8,16,16,0);b.uniform1i(I.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
+1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(H.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(H.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var Q,ga,xa,A,f;for(Q=0;Q<y;Q++)if(H=16/z,B.set(H*N,H),A=a[Q],K.set(A.matrixWorld.n14,A.matrixWorld.n24,A.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(K),d.projectionMatrix.multiplyVector3(K),D.copy(K),M.x=D.x*u+u,M.y=D.y*J+J,k||0<M.x&&M.x<e&&0<M.y&&M.y<z){b.activeTexture(b.TEXTURE1);
+b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,M.x-8,M.y-8,16,16,0);b.uniform1i(I.renderType,0);b.uniform2f(I.scale,B.x,B.y);b.uniform3f(I.screenPosition,D.x,D.y,D.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,l);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,M.x-8,M.y-8,16,16,0);b.uniform1i(I.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
 i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);A.positionScreen.copy(D);A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);for(ga=0,xa=A.lensFlares.length;ga<xa;ga++)if(f=A.lensFlares[ga],0.0010<f.opacity&&0.0010<f.scale)D.x=f.x,D.y=f.y,D.z=f.z,H=f.size*f.scale/z,B.x=H*N,B.y=H,b.uniform3f(I.screenPosition,D.x,D.y,D.z),b.uniform2f(I.scale,B.x,B.y),b.uniform1f(I.rotation,f.rotation),b.uniform1f(I.opacity,f.opacity),b.uniform3f(I.color,
 f.color.r,f.color.g,f.color.b),c.setBlending(f.blending),c.setTexture(f.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e=new THREE.Frustum,g=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,g=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:g});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:g,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,m,j,n,o,p,l,r,t=h.lights;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(i=0,k=t.length;i<k;i++)if(l=t[i],l.castShadow&&l instanceof THREE.SpotLight){if(!l.shadowMap)l.shadowMap=new THREE.WebGLRenderTarget(l.shadowMapWidth,l.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),l.shadowMapSize=new THREE.Vector2(l.shadowMapWidth,l.shadowMapHeight),
-l.shadowCamera=new THREE.PerspectiveCamera(l.shadowCameraFov,l.shadowMapWidth/l.shadowMapHeight,l.shadowCameraNear,l.shadowCameraFar),l.shadowMatrix=new THREE.Matrix4,h.add(l.shadowCamera),b.autoUpdateScene&&h.updateMatrixWorld();if(l.shadowCameraVisible&&!l.cameraHelper)l.cameraHelper=new THREE.CameraHelper(l.shadowCamera),l.shadowCamera.add(l.cameraHelper);m=l.shadowMap;j=l.shadowMatrix;n=l.shadowCamera;n.position.copy(l.matrixWorld.getPosition());n.lookAt(l.target.matrixWorld.getPosition());n.matrixWorldInverse.getInverse(n.matrixWorld);
-if(l.cameraHelper)l.cameraHelper.lines.visible=l.shadowCameraVisible;l.shadowCameraVisible&&l.cameraHelper.update(l.shadowCamera);j.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);j.multiplySelf(n.projectionMatrix);j.multiplySelf(n.matrixWorldInverse);if(!n._viewMatrixArray)n._viewMatrixArray=new Float32Array(16);n.matrixWorldInverse.flattenToArray(n._viewMatrixArray);if(!n._projectionMatrixArray)n._projectionMatrixArray=new Float32Array(16);n.projectionMatrix.flattenToArray(n._projectionMatrixArray);
-g.multiply(n.projectionMatrix,n.matrixWorldInverse);e.setFromMatrix(g);b.setRenderTarget(m);b.clear();r=h.__webglObjects;for(m=0,j=r.length;m<j;m++)if(o=r[m],l=o.object,o.render=!1,l.visible&&l.castShadow&&(!(l instanceof THREE.Mesh)||!l.frustumCulled||e.contains(l)))l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(n.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),o.render=!0;for(m=0,j=r.length;m<j;m++)if(o=r[m],o.render)l=o.object,o=o.buffer,b.setObjectFaces(l),
-p=l.customDepthMaterial?l.customDepthMaterial:l.geometry.morphTargets.length?d:c,o instanceof THREE.BufferGeometry?b.renderBufferDirect(n,t,null,p,o,l):b.renderBuffer(n,t,null,p,o,l);r=h.__webglObjectsImmediate;for(m=0,j=r.length;m<j;m++)o=r[m],l=o.object,l.visible&&l.castShadow&&(l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),l._modelViewMatrix.multiplyToArray(n.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray),b.renderImmediateObject(n,t,null,c,l))}h=b.getClearColor();
-i=b.getClearAlpha();a.clearColor(h.r,h.g,h.b,i);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};
-THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,g,h,i,k,m,j;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,o=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),l=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(l,a.vertexShader);b.compileShader(p);b.compileShader(l);b.attachShader(o,p);b.attachShader(o,l);b.linkProgram(o);i=o;k={};m={};k.position=b.getAttribLocation(i,"position");k.uv=b.getAttribLocation(i,"uv");m.uvOffset=b.getUniformLocation(i,"uvOffset");m.uvScale=b.getUniformLocation(i,
-"uvScale");m.rotation=b.getUniformLocation(i,"rotation");m.scale=b.getUniformLocation(i,"scale");m.alignment=b.getUniformLocation(i,"alignment");m.color=b.getUniformLocation(i,"color");m.map=b.getUniformLocation(i,"map");m.opacity=b.getUniformLocation(i,"opacity");m.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");m.affectedByDistance=b.getUniformLocation(i,"affectedByDistance");m.screenPosition=b.getUniformLocation(i,"screenPosition");m.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");
-m.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");j=!1};this.render=function(d,e,p,l){var d=d.__webglSprites,r=d.length;if(r){var t=k,z=m,y=l/p,p=0.5*p,K=0.5*l,N=!0;b.useProgram(i);j||(b.enableVertexAttribArray(t.position),b.enableVertexAttribArray(t.uv),j=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(t.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(t.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.uniformMatrix4fv(z.projectionMatrix,
+this.update(a,c)};this.update=function(h){var i,l,k,j,n,o,p,m,r,t=h.lights;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(i=0,l=t.length;i<l;i++)if(m=t[i],m.castShadow){if(!m.shadowMap)m.shadowMap=new THREE.WebGLRenderTarget(m.shadowMapWidth,m.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),m.shadowMapSize=new THREE.Vector2(m.shadowMapWidth,m.shadowMapHeight),m.shadowMatrix=new THREE.Matrix4;
+if(!m.shadowCamera){if(m instanceof THREE.SpotLight)m.shadowCamera=new THREE.PerspectiveCamera(m.shadowCameraFov,m.shadowMapWidth/m.shadowMapHeight,m.shadowCameraNear,m.shadowCameraFar);else if(m instanceof THREE.DirectionalLight)m.shadowCamera=new THREE.OrthographicCamera(m.shadowCameraLeft,m.shadowCameraRight,m.shadowCameraTop,m.shadowCameraBottom,m.shadowCameraNear,m.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}h.add(m.shadowCamera);b.autoUpdateScene&&h.updateMatrixWorld()}if(m.shadowCameraVisible&&
+!m.cameraHelper)m.cameraHelper=new THREE.CameraHelper(m.shadowCamera),m.shadowCamera.add(m.cameraHelper);k=m.shadowMap;j=m.shadowMatrix;n=m.shadowCamera;n.position.copy(m.matrixWorld.getPosition());n.lookAt(m.target.matrixWorld.getPosition());n.matrixWorldInverse.getInverse(n.matrixWorld);if(m.cameraHelper)m.cameraHelper.lines.visible=m.shadowCameraVisible;m.shadowCameraVisible&&m.cameraHelper.update(m.shadowCamera);j.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);j.multiplySelf(n.projectionMatrix);
+j.multiplySelf(n.matrixWorldInverse);if(!n._viewMatrixArray)n._viewMatrixArray=new Float32Array(16);n.matrixWorldInverse.flattenToArray(n._viewMatrixArray);if(!n._projectionMatrixArray)n._projectionMatrixArray=new Float32Array(16);n.projectionMatrix.flattenToArray(n._projectionMatrixArray);g.multiply(n.projectionMatrix,n.matrixWorldInverse);e.setFromMatrix(g);b.setRenderTarget(k);b.clear();r=h.__webglObjects;for(k=0,j=r.length;k<j;k++)if(o=r[k],m=o.object,o.render=!1,m.visible&&m.castShadow&&(!(m instanceof
+THREE.Mesh)||!m.frustumCulled||e.contains(m)))m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(n.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),o.render=!0;for(k=0,j=r.length;k<j;k++)if(o=r[k],o.render)m=o.object,o=o.buffer,b.setObjectFaces(m),p=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?d:c,o instanceof THREE.BufferGeometry?b.renderBufferDirect(n,t,null,p,o,m):b.renderBuffer(n,t,null,p,o,m);r=h.__webglObjectsImmediate;
+for(k=0,j=r.length;k<j;k++)o=r[k],m=o.object,m.visible&&m.castShadow&&(m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(n.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),b.renderImmediateObject(n,t,null,c,m))}h=b.getClearColor();i=b.getClearAlpha();a.clearColor(h.r,h.g,h.b,i);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};
+THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,e,g,h,i,l,k,j;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,o=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),m=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(m,a.vertexShader);b.compileShader(p);b.compileShader(m);b.attachShader(o,p);b.attachShader(o,m);b.linkProgram(o);i=o;l={};k={};l.position=b.getAttribLocation(i,"position");l.uv=b.getAttribLocation(i,"uv");k.uvOffset=b.getUniformLocation(i,"uvOffset");k.uvScale=b.getUniformLocation(i,
+"uvScale");k.rotation=b.getUniformLocation(i,"rotation");k.scale=b.getUniformLocation(i,"scale");k.alignment=b.getUniformLocation(i,"alignment");k.color=b.getUniformLocation(i,"color");k.map=b.getUniformLocation(i,"map");k.opacity=b.getUniformLocation(i,"opacity");k.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");k.affectedByDistance=b.getUniformLocation(i,"affectedByDistance");k.screenPosition=b.getUniformLocation(i,"screenPosition");k.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");
+k.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");j=!1};this.render=function(d,e,p,m){var d=d.__webglSprites,r=d.length;if(r){var t=l,z=k,y=m/p,p=0.5*p,K=0.5*m,N=!0;b.useProgram(i);j||(b.enableVertexAttribArray(t.position),b.enableVertexAttribArray(t.uv),j=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(t.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(t.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.uniformMatrix4fv(z.projectionMatrix,
 !1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(z.map,0);for(var u,J=[],t=0;t<r;t++)if(u=d[t],u.visible&&0!==u.opacity)u.useScreenCoordinates?u.z=-u.position.z:(u._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,u.matrixWorld,u._modelViewMatrixArray),u.z=-u._modelViewMatrix.n34);d.sort(a);for(t=0;t<r;t++)u=d[t],u.visible&&0!==u.opacity&&u.map&&u.map.image&&u.map.image.width&&(u.useScreenCoordinates?(b.uniform1i(z.useScreenCoordinates,1),b.uniform3f(z.screenPosition,(u.position.x-
-p)/p,(K-u.position.y)/K,Math.max(0,Math.min(1,u.position.z)))):(b.uniform1i(z.useScreenCoordinates,0),b.uniform1i(z.affectedByDistance,u.affectedByDistance?1:0),b.uniformMatrix4fv(z.modelViewMatrix,!1,u._modelViewMatrixArray)),e=u.map.image.width/(u.scaleByViewport?l:1),J[0]=e*y*u.scale.x,J[1]=e*u.scale.y,b.uniform2f(z.uvScale,u.uvScale.x,u.uvScale.y),b.uniform2f(z.uvOffset,u.uvOffset.x,u.uvOffset.y),b.uniform2f(z.alignment,u.alignment.x,u.alignment.y),b.uniform1f(z.opacity,u.opacity),b.uniform3f(z.color,
+p)/p,(K-u.position.y)/K,Math.max(0,Math.min(1,u.position.z)))):(b.uniform1i(z.useScreenCoordinates,0),b.uniform1i(z.affectedByDistance,u.affectedByDistance?1:0),b.uniformMatrix4fv(z.modelViewMatrix,!1,u._modelViewMatrixArray)),e=u.map.image.width/(u.scaleByViewport?m:1),J[0]=e*y*u.scale.x,J[1]=e*u.scale.y,b.uniform2f(z.uvScale,u.uvScale.x,u.uvScale.y),b.uniform2f(z.uvOffset,u.uvOffset.x,u.uvOffset.y),b.uniform2f(z.alignment,u.alignment.x,u.alignment.y),b.uniform1f(z.opacity,u.opacity),b.uniform3f(z.color,
 u.color.r,u.color.g,u.color.b),b.uniform1f(z.rotation,u.rotation),b.uniform2fv(z.scale,J),u.mergeWith3D&&!N?(b.enable(b.DEPTH_TEST),N=!0):!u.mergeWith3D&&N&&(b.disable(b.DEPTH_TEST),N=!1),c.setBlending(u.blending),c.setTexture(u.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:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
 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:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
 THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
 fragmentShader:"precision mediump float;\nuniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\n}"}};
 THREE.ImageUtils={crossOrigin:"",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b);d.onload=function(){e.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return e},loadTextureCube:function(a,b,c){var d,e=[],g=new THREE.Texture(e,b);e.loadCount=0;for(b=0,d=a.length;b<d;++b)e[b]=new Image,e[b].onload=function(){e.loadCount+=1;if(6===e.loadCount)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=b|1,d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var h=g.getContext("2d");h.drawImage(a,0,0);for(var i=h.getImageData(0,0,d,e).data,k=h.createImageData(d,e),m=k.data,j=0;j<d;j++)for(var n=1;n<e;n++){var o=0>n-1?e-1:n-1,p=(n+1)%e,l=0>j-1?d-1:j-1,r=(j+1)%d,t=[],z=[0,0,i[4*(n*d+j)]/255*b];t.push([-1,0,i[4*(n*d+l)]/255*b]);t.push([-1,-1,i[4*(o*d+l)]/255*b]);t.push([0,-1,i[4*(o*d+j)]/255*b]);t.push([1,
--1,i[4*(o*d+r)]/255*b]);t.push([1,0,i[4*(n*d+r)]/255*b]);t.push([1,1,i[4*(p*d+r)]/255*b]);t.push([0,1,i[4*(p*d+j)]/255*b]);t.push([-1,1,i[4*(p*d+l)]/255*b]);o=[];l=t.length;for(p=0;p<l;p++){var r=t[p],y=t[(p+1)%l],r=[r[0]-z[0],r[1]-z[1],r[2]-z[2]],y=[y[0]-z[0],y[1]-z[1],y[2]-z[2]];o.push(c([r[1]*y[2]-r[2]*y[1],r[2]*y[0]-r[0]*y[2],r[0]*y[1]-r[1]*y[0]]))}t=[0,0,0];for(p=0;p<o.length;p++)t[0]+=o[p][0],t[1]+=o[p][1],t[2]+=o[p][2];t[0]/=o.length;t[1]/=o.length;t[2]/=o.length;z=4*(n*d+j);m[z]=255*((t[0]+
-1)/2)|0;m[z+1]=255*(t[1]+0.5)|0;m[z+2]=255*t[2]|0;m[z+3]=255}h.putImageData(k,0,0);return g}};
+Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var h=g.getContext("2d");h.drawImage(a,0,0);for(var i=h.getImageData(0,0,d,e).data,l=h.createImageData(d,e),k=l.data,j=0;j<d;j++)for(var n=1;n<e;n++){var o=0>n-1?e-1:n-1,p=(n+1)%e,m=0>j-1?d-1:j-1,r=(j+1)%d,t=[],z=[0,0,i[4*(n*d+j)]/255*b];t.push([-1,0,i[4*(n*d+m)]/255*b]);t.push([-1,-1,i[4*(o*d+m)]/255*b]);t.push([0,-1,i[4*(o*d+j)]/255*b]);t.push([1,
+-1,i[4*(o*d+r)]/255*b]);t.push([1,0,i[4*(n*d+r)]/255*b]);t.push([1,1,i[4*(p*d+r)]/255*b]);t.push([0,1,i[4*(p*d+j)]/255*b]);t.push([-1,1,i[4*(p*d+m)]/255*b]);o=[];m=t.length;for(p=0;p<m;p++){var r=t[p],y=t[(p+1)%m],r=[r[0]-z[0],r[1]-z[1],r[2]-z[2]],y=[y[0]-z[0],y[1]-z[1],y[2]-z[2]];o.push(c([r[1]*y[2]-r[2]*y[1],r[2]*y[0]-r[0]*y[2],r[0]*y[1]-r[1]*y[0]]))}t=[0,0,0];for(p=0;p<o.length;p++)t[0]+=o[p][0],t[1]+=o[p][1],t[2]+=o[p][2];t[0]/=o.length;t[1]/=o.length;t[2]/=o.length;z=4*(n*d+j);k[z]=255*((t[0]+
+1)/2)|0;k[z+1]=255*(t[1]+0.5)|0;k[z+2]=255*t[2]|0;k[z+3]=255}h.putImageData(l,0,0);return g}};

+ 95 - 79
src/extras/plugins/ShadowMapPlugin.js

@@ -61,157 +61,173 @@ THREE.ShadowMapPlugin = function ( ) {
 
 			light = lights[ i ];
 
-			if ( light.castShadow && light instanceof THREE.SpotLight ) {
+			if ( ! light.castShadow ) continue;
 
-				if ( ! light.shadowMap ) {
+			if ( ! light.shadowMap ) {
 
-					var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat };
+				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat };
 
-					light.shadowMap = new THREE.WebGLRenderTarget( light.shadowMapWidth, light.shadowMapHeight, pars );
-					light.shadowMapSize = new THREE.Vector2( light.shadowMapWidth, light.shadowMapHeight );
+				light.shadowMap = new THREE.WebGLRenderTarget( light.shadowMapWidth, light.shadowMapHeight, pars );
+				light.shadowMapSize = new THREE.Vector2( light.shadowMapWidth, light.shadowMapHeight );
+
+				light.shadowMatrix = new THREE.Matrix4();
+
+			}
+
+			if ( ! light.shadowCamera ) {
+
+				if ( light instanceof THREE.SpotLight ) {
 
 					light.shadowCamera = new THREE.PerspectiveCamera( light.shadowCameraFov, light.shadowMapWidth / light.shadowMapHeight, light.shadowCameraNear, light.shadowCameraFar );
-					light.shadowMatrix = new THREE.Matrix4();
 
-					scene.add( light.shadowCamera );
+				} else if ( light instanceof THREE.DirectionalLight ) {
+
+					light.shadowCamera = new THREE.OrthographicCamera( light.shadowCameraLeft, light.shadowCameraRight, light.shadowCameraTop, light.shadowCameraBottom, light.shadowCameraNear, light.shadowCameraFar );
 
-					if ( _renderer.autoUpdateScene ) scene.updateMatrixWorld();
+				} else {
+
+					console.error( "Unsupported light type for shadow" );
+					continue;
 
 				}
 
-				if ( light.shadowCameraVisible && ! light.cameraHelper ) {
+				scene.add( light.shadowCamera );
 
-					light.cameraHelper = new THREE.CameraHelper( light.shadowCamera );
-					light.shadowCamera.add( light.cameraHelper );
+				if ( _renderer.autoUpdateScene ) scene.updateMatrixWorld();
 
-				}
+			}
 
-				shadowMap = light.shadowMap;
-				shadowMatrix = light.shadowMatrix;
-				shadowCamera = light.shadowCamera;
 
-				shadowCamera.position.copy( light.matrixWorld.getPosition() );
-				shadowCamera.lookAt( light.target.matrixWorld.getPosition() );
+			if ( light.shadowCameraVisible && ! light.cameraHelper ) {
 
-				shadowCamera.matrixWorldInverse.getInverse( shadowCamera.matrixWorld );
+				light.cameraHelper = new THREE.CameraHelper( light.shadowCamera );
+				light.shadowCamera.add( light.cameraHelper );
 
-				if ( light.cameraHelper ) light.cameraHelper.lines.visible = light.shadowCameraVisible;
-				if ( light.shadowCameraVisible ) light.cameraHelper.update( light.shadowCamera );
+			}
 
+			shadowMap = light.shadowMap;
+			shadowMatrix = light.shadowMatrix;
+			shadowCamera = light.shadowCamera;
 
-				// compute shadow matrix
+			shadowCamera.position.copy( light.matrixWorld.getPosition() );
+			shadowCamera.lookAt( light.target.matrixWorld.getPosition() );
 
-				shadowMatrix.set( 0.5, 0.0, 0.0, 0.5,
-								  0.0, 0.5, 0.0, 0.5,
-								  0.0, 0.0, 0.5, 0.5,
-								  0.0, 0.0, 0.0, 1.0 );
+			shadowCamera.matrixWorldInverse.getInverse( shadowCamera.matrixWorld );
 
-				shadowMatrix.multiplySelf( shadowCamera.projectionMatrix );
-				shadowMatrix.multiplySelf( shadowCamera.matrixWorldInverse );
+			if ( light.cameraHelper ) light.cameraHelper.lines.visible = light.shadowCameraVisible;
+			if ( light.shadowCameraVisible ) light.cameraHelper.update( light.shadowCamera );
 
-				// render shadow map
+			// compute shadow matrix
 
-				if ( ! shadowCamera._viewMatrixArray ) shadowCamera._viewMatrixArray = new Float32Array( 16 );
-				shadowCamera.matrixWorldInverse.flattenToArray( shadowCamera._viewMatrixArray );
+			shadowMatrix.set( 0.5, 0.0, 0.0, 0.5,
+							  0.0, 0.5, 0.0, 0.5,
+							  0.0, 0.0, 0.5, 0.5,
+							  0.0, 0.0, 0.0, 1.0 );
 
-				if ( ! shadowCamera._projectionMatrixArray ) shadowCamera._projectionMatrixArray = new Float32Array( 16 );
-				shadowCamera.projectionMatrix.flattenToArray( shadowCamera._projectionMatrixArray );
+			shadowMatrix.multiplySelf( shadowCamera.projectionMatrix );
+			shadowMatrix.multiplySelf( shadowCamera.matrixWorldInverse );
 
-				_projScreenMatrix.multiply( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );
-				_frustum.setFromMatrix( _projScreenMatrix );
+			// render shadow map
 
-				_renderer.setRenderTarget( shadowMap );
-				_renderer.clear();
+			if ( ! shadowCamera._viewMatrixArray ) shadowCamera._viewMatrixArray = new Float32Array( 16 );
+			shadowCamera.matrixWorldInverse.flattenToArray( shadowCamera._viewMatrixArray );
 
-				// set matrices & frustum culling
+			if ( ! shadowCamera._projectionMatrixArray ) shadowCamera._projectionMatrixArray = new Float32Array( 16 );
+			shadowCamera.projectionMatrix.flattenToArray( shadowCamera._projectionMatrixArray );
 
-				renderList = scene.__webglObjects;
+			_projScreenMatrix.multiply( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );
+			_frustum.setFromMatrix( _projScreenMatrix );
 
-				for ( j = 0, jl = renderList.length; j < jl; j ++ ) {
+			_renderer.setRenderTarget( shadowMap );
+			_renderer.clear();
 
-					webglObject = renderList[ j ];
-					object = webglObject.object;
+			// set matrices & frustum culling
 
-					webglObject.render = false;
+			renderList = scene.__webglObjects;
 
-					if ( object.visible && object.castShadow ) {
+			for ( j = 0, jl = renderList.length; j < jl; j ++ ) {
 
-						if ( ! ( object instanceof THREE.Mesh ) || ! ( object.frustumCulled ) || _frustum.contains( object ) ) {
+				webglObject = renderList[ j ];
+				object = webglObject.object;
 
-							object.matrixWorld.flattenToArray( object._objectMatrixArray );
-							object._modelViewMatrix.multiplyToArray( shadowCamera.matrixWorldInverse, object.matrixWorld, object._modelViewMatrixArray );
+				webglObject.render = false;
 
-							webglObject.render = true;
+				if ( object.visible && object.castShadow ) {
 
-						}
+					if ( ! ( object instanceof THREE.Mesh ) || ! ( object.frustumCulled ) || _frustum.contains( object ) ) {
+
+						object.matrixWorld.flattenToArray( object._objectMatrixArray );
+						object._modelViewMatrix.multiplyToArray( shadowCamera.matrixWorldInverse, object.matrixWorld, object._modelViewMatrixArray );
+
+						webglObject.render = true;
 
 					}
 
 				}
 
-				// render regular objects
+			}
 
-				for ( j = 0, jl = renderList.length; j < jl; j ++ ) {
+			// render regular objects
 
-					webglObject = renderList[ j ];
+			for ( j = 0, jl = renderList.length; j < jl; j ++ ) {
 
-					if ( webglObject.render ) {
+				webglObject = renderList[ j ];
 
-						object = webglObject.object;
-						buffer = webglObject.buffer;
+				if ( webglObject.render ) {
 
-						_renderer.setObjectFaces( object );
+					object = webglObject.object;
+					buffer = webglObject.buffer;
 
-						if ( object.customDepthMaterial ) {
+					_renderer.setObjectFaces( object );
 
-							material = object.customDepthMaterial;
+					if ( object.customDepthMaterial ) {
 
-						} else if ( object.geometry.morphTargets.length ) {
+						material = object.customDepthMaterial;
 
-							material = _depthMaterialMorph;
+					} else if ( object.geometry.morphTargets.length ) {
 
-						} else {
+						material = _depthMaterialMorph;
 
-							material = _depthMaterial;
+					} else {
 
-						}
+						material = _depthMaterial;
 
-						if ( buffer instanceof THREE.BufferGeometry ) {
+					}
 
-							_renderer.renderBufferDirect( shadowCamera, lights, fog, material, buffer, object );
+					if ( buffer instanceof THREE.BufferGeometry ) {
 
-						} else {
+						_renderer.renderBufferDirect( shadowCamera, lights, fog, material, buffer, object );
 
-							_renderer.renderBuffer( shadowCamera, lights, fog, material, buffer, object );
+					} else {
 
-						}
+						_renderer.renderBuffer( shadowCamera, lights, fog, material, buffer, object );
 
 					}
 
 				}
 
-				// set matrices and render immediate objects
+			}
 
-				renderList = scene.__webglObjectsImmediate;
+			// set matrices and render immediate objects
 
-				for ( j = 0, jl = renderList.length; j < jl; j ++ ) {
+			renderList = scene.__webglObjectsImmediate;
 
-					webglObject = renderList[ j ];
-					object = webglObject.object;
+			for ( j = 0, jl = renderList.length; j < jl; j ++ ) {
 
-					if ( object.visible && object.castShadow ) {
+				webglObject = renderList[ j ];
+				object = webglObject.object;
 
-						if( object.matrixAutoUpdate ) {
+				if ( object.visible && object.castShadow ) {
 
-							object.matrixWorld.flattenToArray( object._objectMatrixArray );
+					if( object.matrixAutoUpdate ) {
 
-						}
+						object.matrixWorld.flattenToArray( object._objectMatrixArray );
 
-						object._modelViewMatrix.multiplyToArray( shadowCamera.matrixWorldInverse, object.matrixWorld, object._modelViewMatrixArray );
+					}
 
-						_renderer.renderImmediateObject( shadowCamera, lights, fog, _depthMaterial, object );
+					object._modelViewMatrix.multiplyToArray( shadowCamera.matrixWorldInverse, object.matrixWorld, object._modelViewMatrixArray );
 
-					}
+					_renderer.renderImmediateObject( shadowCamera, lights, fog, _depthMaterial, object );
 
 				}
 

+ 28 - 0
src/lights/DirectionalLight.js

@@ -1,5 +1,6 @@
 /**
  * @author mr.doob / http://mrdoob.com/
+ * @author alteredq / http://alteredqualia.com/
  */
 
 THREE.DirectionalLight = function ( hex, intensity, distance ) {
@@ -7,9 +8,36 @@ THREE.DirectionalLight = function ( hex, intensity, distance ) {
 	THREE.Light.call( this, hex );
 
 	this.position = new THREE.Vector3( 0, 1, 0 );
+	this.target = new THREE.Object3D();
+
 	this.intensity = ( intensity !== undefined ) ? intensity : 1;
 	this.distance = ( distance !== undefined ) ? distance : 0;
 
+	this.castShadow = false;
+	this.onlyShadow = false;
+
+	//
+
+	this.shadowCameraLeft = -500;
+	this.shadowCameraRight = 500;
+	this.shadowCameraTop = 500;
+	this.shadowCameraBottom = -500;
+
+	this.shadowCameraVisible = false;
+
+	this.shadowBias = 0;
+	this.shadowDarkness = 0.5;
+
+	this.shadowMapWidth = 512;
+	this.shadowMapHeight = 512;
+
+	//
+
+	this.shadowMap = null;
+	this.shadowMapSize = null;
+	this.shadowCamera = null;
+	this.shadowMatrix = null;
+
 };
 
 THREE.DirectionalLight.prototype = new THREE.Light();

+ 13 - 5
src/renderers/WebGLRenderer.js

@@ -4436,7 +4436,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				var light = lights[ i ];
 
-				if ( light.castShadow && light instanceof THREE.SpotLight ) {
+				if ( ! light.castShadow ) continue;
+
+				if ( light instanceof THREE.SpotLight || light instanceof THREE.DirectionalLight ) {
 
 					uniforms.shadowMap.texture[ j ] = light.shadowMap;
 					uniforms.shadowMapSize.value[ j ] = light.shadowMapSize;
@@ -4711,8 +4713,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 		for ( l = 0, ll = lights.length; l < ll; l ++ ) {
 
 			light = lights[ l ];
-			color = light.color;
 
+			if ( light.onlyShadow ) continue;
+
+			color = light.color;
 			intensity = light.intensity;
 			distance = light.distance;
 
@@ -4760,7 +4764,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				dlength += 1;
 
-			} else if ( light instanceof THREE.SpotLight && ! light.onlyShadow ) { // hack, not a proper spotlight
+			} else if ( light instanceof THREE.SpotLight ) { // hack, not a proper spotlight
 
 				doffset = dlength * 3;
 
@@ -5750,7 +5754,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			light = lights[ l ];
 
-			if ( light instanceof THREE.SpotLight && ! light.onlyShadow ) dirLights ++; // hack, not a proper spotlight
+			if ( light.onlyShadow ) continue;
+
+			if ( light instanceof THREE.SpotLight ) dirLights ++; // hack, not a proper spotlight
 			if ( light instanceof THREE.DirectionalLight ) dirLights ++;
 			if ( light instanceof THREE.PointLight ) pointLights ++;
 
@@ -5780,7 +5786,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			light = lights[ l ];
 
-			if ( light instanceof THREE.SpotLight && light.castShadow ) maxShadows ++;
+			if ( ! light.castShadow ) continue;
+
+			if ( light instanceof THREE.SpotLight || light instanceof THREE.DirectionalLight ) maxShadows ++;
 
 		}