Browse Source

Fixed too aggressive projection matrix uniform caching.

This was causing troubles for camera changing mid-frame (like for shadow maps).
alteredq 13 years ago
parent
commit
3c618a8696
3 changed files with 495 additions and 485 deletions
  1. 393 392
      build/Three.js
  2. 90 90
      build/custom/ThreeWebGL.js
  3. 12 3
      src/renderers/WebGLRenderer.js

+ 393 - 392
build/Three.js

@@ -19,66 +19,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){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);v=o.dot(p);x=o.dot(m);B=p.dot(p);D=p.dot(m);C=1/(u*B-v*v);A=(B*x-v*D)*C;F=(u*D-v*x)*C;return 0<=A&&0<=F&&1>A+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,k=new THREE.Vector3,i=new THREE.Vector3,l=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 r,s,j=a.geometry,t=j.vertices,y;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(o=0,p=j.faces.length;o<p;o++)if(b=j.faces[o],k.copy(this.origin),i.copy(this.direction),
-y=a.matrixWorld,l=y.multiplyVector3(l.copy(b.centroid)).subSelf(k),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),r=i.dot(n),!(1.0E-4>Math.abs(r))&&(s=n.dot(l)/r,!(0>s)&&(a.doubleSided||(a.flipSided?0<r:0>r))))if(q.add(k,i.multiplyScalar(s)),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:k.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:k.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,v,x,B,D,C,A,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,l,n){h=!1;b=f;c=g;d=l;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,l,n,q,o){h?(h=!1,b=f<l?f<q?f:q:l<q?l:q,c=g<n?g<o?g:o:n<o?n:o,d=f>l?f>q?f:q:l>q?l:q,e=g>n?g>o?g:o:n>o?n:o):(b=f<l?f<q?f<b?f:b:q<b?q:b:l<q?l<b?l: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>l?f>q?f>d?f:d:q>d?q:d:l>q?l>d?l: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>
+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);v=o.dot(p);x=o.dot(m);B=p.dot(p);D=p.dot(m);C=1/(u*B-v*v);A=(B*x-v*D)*C;H=(u*D-v*x)*C;return 0<=A&&0<=H&&1>A+H}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 r,s,j=a.geometry,t=j.vertices,y;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(o=0,p=j.faces.length;o<p;o++)if(b=j.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)),r=l.dot(n),!(1.0E-4>Math.abs(r))&&(s=n.dot(k)/r,!(0>s)&&(a.doubleSided||(a.flipSided?0<r:0>r))))if(q.add(i,l.multiplyScalar(s)),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,v,x,B,D,C,A,H};
+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,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,k,i,l,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,k||0,i||0,void 0!==l?l: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,k,i,l,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=k;this.n32=i;this.n33=l;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,k=a.n23,i=a.n24,l=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,v=b.n13,x=b.n14,B=b.n21,D=b.n22,C=b.n23,A=b.n24,F=b.n31,J=b.n32,K=b.n33,Z=b.n34,L=b.n41,O=b.n42,M=b.n43,H=b.n44;this.n11=c*t+d*B+e*F+f*L;this.n12=c*u+d*D+e*J+f*O;this.n13=c*v+d*C+e*K+f*M;this.n14=c*x+d*A+e*Z+f*H;this.n21=g*t+h*B+k*F+i*L;this.n22=g*u+h*D+k*J+i*O;this.n23=g*v+h*C+k*K+i*M;this.n24=g*x+h*A+k*Z+i*H;this.n31=l*t+n*B+q*F+o*L;this.n32=l*u+n*D+q*J+o*O;this.n33=l*v+n*C+q*K+o*M;this.n34=l*x+n*A+q*Z+o*H;this.n41=p*t+m*B+r*F+s*L;this.n42=p*u+m*D+r*J+s*O;this.n43=p*v+m*
-C+r*K+s*M;this.n44=p*x+m*A+r*Z+s*H;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
+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,v=b.n13,x=b.n14,B=b.n21,D=b.n22,C=b.n23,A=b.n24,H=b.n31,I=b.n32,N=b.n33,$=b.n34,K=b.n41,Q=b.n42,L=b.n43,G=b.n44;this.n11=c*t+d*B+e*H+f*K;this.n12=c*u+d*D+e*I+f*Q;this.n13=c*v+d*C+e*N+f*L;this.n14=c*x+d*A+e*$+f*G;this.n21=g*t+h*B+i*H+l*K;this.n22=g*u+h*D+i*I+l*Q;this.n23=g*v+h*C+i*N+l*L;this.n24=g*x+h*A+i*$+l*G;this.n31=k*t+n*B+q*H+o*K;this.n32=k*u+n*D+q*I+o*Q;this.n33=k*v+n*C+q*N+o*L;this.n34=k*x+n*A+q*$+o*G;this.n41=p*t+m*B+r*H+s*K;this.n42=p*u+m*D+r*I+s*Q;this.n43=p*v+m*
+C+r*N+s*L;this.n44=p*x+m*A+r*$+s*G;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
 a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*
 c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
-a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,h=this.n24,k=this.n31,i=this.n32,l=this.n33,n=this.n34,q=this.n41,o=this.n42,p=this.n43,m=this.n44;return d*g*i*q-c*h*i*q-d*f*l*q+b*h*l*q+c*f*n*q-b*g*n*q-d*g*k*o+c*h*k*o+d*e*l*o-a*h*l*o-c*e*n*o+a*g*n*o+d*f*k*p-b*h*k*p-d*e*i*p+a*h*i*p+b*e*n*p-a*f*n*p-c*f*k*m+b*g*k*m+c*e*i*m-a*g*i*m-b*e*l*m+a*f*l*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,k=e*f,i=e*g;this.set(k*f+c,k*g-d*h,k*h+d*g,0,k*g+d*h,i*g+c,i*h-d*f,0,k*h-d*g,i*h+d*f,e*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,e=a.n14,f=a.n21,g=a.n22,h=a.n23,k=a.n24,i=a.n31,l=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-k*n*p+k*l*m-g*q*m-h*l*r+g*n*r;this.n12=e*n*p-d*q*p-e*l*m+c*q*m+d*l*r-c*n*r;this.n13=d*k*p-e*h*p+e*g*m-c*k*m-d*g*r+c*h*r;this.n14=e*h*l-d*k*l-e*g*n+c*k*n+d*g*q-c*h*q;this.n21=k*n*o-h*q*o-k*i*m+f*q*m+h*i*r-f*n*r;this.n22=d*q*o-e*n*o+
-e*i*m-b*q*m-d*i*r+b*n*r;this.n23=e*h*o-d*k*o-e*f*m+b*k*m+d*f*r-b*h*r;this.n24=d*k*i-e*h*i+e*f*n-b*k*n-d*f*q+b*h*q;this.n31=g*q*o-k*l*o+k*i*p-f*q*p-g*i*r+f*l*r;this.n32=e*l*o-c*q*o-e*i*p+b*q*p+c*i*r-b*l*r;this.n33=c*k*o-e*g*o+e*f*p-b*k*p-c*f*r+b*g*r;this.n34=e*g*i-c*k*i-e*f*l+b*k*l+c*f*q-b*g*q;this.n41=h*l*o-g*n*o-h*i*p+f*n*p+g*i*m-f*l*m;this.n42=c*n*o-d*l*o+d*i*p-b*n*p-c*i*m+b*l*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*i-d*g*i+d*f*l-b*h*l-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 k=g*h,i=g*e,l=d*h,n=d*e;this.n11=k+n*c;this.n12=l*c-i;this.n13=f*d;this.n21=f*e;this.n22=f*h;this.n23=-c;this.n31=i*c-l;this.n32=n+k*c;this.n33=f*g;break;case "ZXY":k=g*h;i=g*e;l=d*h;n=d*e;this.n11=k-n*c;this.n12=-f*e;this.n13=l+i*c;this.n21=i+l*c;this.n22=f*h;this.n23=n-k*c;this.n31=-f*d;this.n32=c;this.n33=f*g;break;case "ZYX":k=
-f*h;i=f*e;l=c*h;n=c*e;this.n11=g*h;this.n12=l*d-i;this.n13=k*d+n;this.n21=g*e;this.n22=n*d+k;this.n23=i*d-l;this.n31=-d;this.n32=c*g;this.n33=f*g;break;case "YZX":k=f*g;i=f*d;l=c*g;n=c*d;this.n11=g*h;this.n12=n-k*e;this.n13=l*e+i;this.n21=e;this.n22=f*h;this.n23=-c*h;this.n31=-d*h;this.n32=i*e+l;this.n33=k-n*e;break;case "XZY":k=f*g;i=f*d;l=c*g;n=c*d;this.n11=g*h;this.n12=-e;this.n13=d*h;this.n21=k*e+n;this.n22=f*h;this.n23=i*e-l;this.n31=l*e-i;this.n32=c*h;this.n33=n*e+k;break;default:k=f*h,i=f*
-e,l=c*h,n=c*e,this.n11=g*h,this.n12=-g*e,this.n13=d,this.n21=i+l*d,this.n22=k-n*d,this.n23=-c*g,this.n31=n-k*d,this.n32=l+i*d,this.n33=f*g}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,h=d+d,a=b*f,k=b*g,b=b*h,i=c*g,c=c*h,d=d*h,f=e*f,g=e*g,e=e*h;this.n11=1-(i+d);this.n12=k-e;this.n13=b+g;this.n21=k+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
+setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,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,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,k=Math.cos(b),i=Math.sin(b),l=1-k,n=c*d*l,q=c*e*l,l=d*e*l,c=c*i,o=d*i,i=e*i,e=f+(1-f)*k,f=n+i,d=q-o,n=n-i,g=g+(1-g)*k,i=l+c,q=q+o,l=l-c,h=h+(1-h)*k,k=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,v=this.n23,x=this.n33,B=this.n43;this.n11=e*k+f*m+d*u;this.n21=e*c+f*r+d*v;this.n31=e*o+f*s+d*x;this.n41=e*p+f*t+d*B;this.n12=n*k+g*m+i*u;this.n22=
-n*c+g*r+i*v;this.n32=n*o+g*s+i*x;this.n42=n*p+g*t+i*B;this.n13=q*k+l*m+h*u;this.n23=q*c+l*r+h*v;this.n33=q*o+l*s+h*x;this.n43=q*p+l*t+h*B;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,k=this.n43,i=Math.cos(a),a=Math.sin(a);this.n12=i*b+a*f;this.n22=i*c+a*g;this.n32=i*d+a*h;this.n42=i*e+a*k;this.n13=i*f-a*b;this.n23=i*g-a*c;this.n33=i*h-a*d;this.n43=i*k-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,k=this.n43,i=Math.cos(a),a=Math.sin(a);this.n11=i*b-a*f;this.n21=i*c-a*g;this.n31=i*d-a*h;this.n41=i*e-a*k;this.n13=i*f+a*b;this.n23=i*g+a*c;this.n33=i*h+a*d;this.n43=i*k+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,k=this.n42,i=Math.cos(a),a=Math.sin(a);this.n11=i*b+a*f;this.n21=i*c+a*g;this.n31=i*d+a*h;this.n41=i*e+a*k;this.n12=i*f-a*b;this.n22=i*g-a*c;this.n32=i*h-a*d;this.n42=i*k-a*e;return this},
+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,v=this.n23,x=this.n33,B=this.n43;this.n11=e*i+f*m+d*u;this.n21=e*c+f*r+d*v;this.n31=e*o+f*s+d*x;this.n41=e*p+f*t+d*B;this.n12=n*i+g*m+l*u;this.n22=
+n*c+g*r+l*v;this.n32=n*o+g*s+l*x;this.n42=n*p+g*t+l*B;this.n13=q*i+k*m+h*u;this.n23=q*c+k*r+h*v;this.n33=q*o+k*s+h*x;this.n43=q*p+k*t+h*B;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,e=this.n42,f=this.n13,g=this.n23,h=this.n33,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,k=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,l=-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*i;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*k;c[6]=a*i;c[7]=a*l;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,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};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e,a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,h,k,i;g=new THREE.Matrix4;h=b-a;k=c-d;i=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/k;g.n23=0;g.n24=-((c+d)/k);g.n31=0;g.n32=0;g.n33=-2/i;g.n34=-((f+e)/i);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,h,i,l;g=new THREE.Matrix4;h=b-a;i=c-d;l=f-e;g.n11=2/h;g.n12=0;g.n13=0;g.n14=-((b+a)/h);g.n21=0;g.n22=2/i;g.n23=0;g.n24=-((c+d)/i);g.n31=0;g.n32=0;g.n33=-2/l;g.n34=-((f+e)/l);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.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=g[f]=g[f]||new THREE.RenderableObject;f++;return a}function b(){var a=i[k]=i[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;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,k,i=[],l,n,q=[],o,p=[],m,r,s=[],t,u,v=[],x={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,D=new THREE.Vector4,C=new THREE.Matrix4,A=new THREE.Matrix4,F=new THREE.Frustum,J=new THREE.Vector4,K=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);C.multiply(b.projectionMatrix,b.matrixWorldInverse);C.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);C.multiply(b.matrixWorld,
-b.projectionMatrixInverse);C.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;x.objects.length=0;x.sprites.length=0;x.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))?(C.multiplyVector3(B.copy(b.position)),e=a(),e.object=
-b,e.z=B.z,x.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(C.multiplyVector3(B.copy(b.position)),e=a(),e.object=b,e.z=B.z,x.sprites.push(e)):b instanceof THREE.Light&&x.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&x.objects.sort(c);return x};this.projectScene=function(a,e,f){var g=e.near,H=e.far,j,B,y,E,Q,S,aa,ja,ga,T,ba,$,da,ha,Qa,ka;u=r=o=n=0;x.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);C.multiply(e.projectionMatrix,e.matrixWorldInverse);F.setFromMatrix(C);x=this.projectGraph(a,!1);for(a=0,j=x.objects.length;a<j;a++)if(ga=x.objects[a].object,T=ga.matrixWorld,$=ga.material,k=0,ga instanceof THREE.Mesh){ba=ga.geometry;da=ga.geometry.materials;E=ba.vertices;ha=ba.faces;Qa=ba.faceVertexUvs;ba=ga.matrixRotationWorld.extractRotation(T);for(B=0,y=E.length;B<y;B++)h=b(),h.positionWorld.copy(E[B].position),T.multiplyVector3(h.positionWorld),
-h.positionScreen.copy(h.positionWorld),C.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<H;for(E=0,B=ha.length;E<B;E++){y=ha[E];if(y instanceof THREE.Face3)if(Q=i[y.a],S=i[y.b],aa=i[y.c],Q.visible&&S.visible&&aa.visible&&(ga.doubleSided||ga.flipSided!=0>(aa.positionScreen.x-Q.positionScreen.x)*(S.positionScreen.y-Q.positionScreen.y)-(aa.positionScreen.y-Q.positionScreen.y)*(S.positionScreen.x-
-Q.positionScreen.x)))ja=q[n]=q[n]||new THREE.RenderableFace3,n++,l=ja,l.v1.copy(Q),l.v2.copy(S),l.v3.copy(aa);else continue;else if(y instanceof THREE.Face4)if(Q=i[y.a],S=i[y.b],aa=i[y.c],ja=i[y.d],Q.visible&&S.visible&&aa.visible&&ja.visible&&(ga.doubleSided||ga.flipSided!=(0>(ja.positionScreen.x-Q.positionScreen.x)*(S.positionScreen.y-Q.positionScreen.y)-(ja.positionScreen.y-Q.positionScreen.y)*(S.positionScreen.x-Q.positionScreen.x)||0>(S.positionScreen.x-aa.positionScreen.x)*(ja.positionScreen.y-
-aa.positionScreen.y)-(S.positionScreen.y-aa.positionScreen.y)*(ja.positionScreen.x-aa.positionScreen.x))))ka=p[o]=p[o]||new THREE.RenderableFace4,o++,l=ka,l.v1.copy(Q),l.v2.copy(S),l.v3.copy(aa),l.v4.copy(ja);else continue;l.normalWorld.copy(y.normal);ba.multiplyVector3(l.normalWorld);l.centroidWorld.copy(y.centroid);T.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);C.multiplyVector3(l.centroidScreen);aa=y.vertexNormals;for(Q=0,S=aa.length;Q<S;Q++)ja=l.vertexNormalsWorld[Q],
-ja.copy(aa[Q]),ba.multiplyVector3(ja);for(Q=0,S=Qa.length;Q<S;Q++)if(ka=Qa[Q][E])for(aa=0,ja=ka.length;aa<ja;aa++)l.uvs[Q][aa]=ka[aa];l.material=$;l.faceMaterial=null!==y.materialIndex?da[y.materialIndex]:null;l.z=l.centroidScreen.z;x.elements.push(l)}}else if(ga instanceof THREE.Line){A.multiply(C,T);E=ga.geometry.vertices;Q=b();Q.positionScreen.copy(E[0].position);A.multiplyVector4(Q.positionScreen);for(B=1,y=E.length;B<y;B++)if(Q=b(),Q.positionScreen.copy(E[B].position),A.multiplyVector4(Q.positionScreen),
-S=i[k-2],J.copy(Q.positionScreen),K.copy(S.positionScreen),d(J,K))J.multiplyScalar(1/J.w),K.multiplyScalar(1/K.w),ga=s[r]=s[r]||new THREE.RenderableLine,r++,m=ga,m.v1.positionScreen.copy(J),m.v2.positionScreen.copy(K),m.z=Math.max(J.z,K.z),m.material=$,x.elements.push(m)}for(a=0,j=x.sprites.length;a<j;a++)if(ga=x.sprites[a].object,T=ga.matrixWorld,ga instanceof THREE.Particle&&(D.set(T.n14,T.n24,T.n34,1),C.multiplyVector4(D),D.z/=D.w,0<D.z&&1>D.z))g=v[u]=v[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=ga.rotation.z,t.scale.x=ga.scale.x*Math.abs(t.x-(D.x+e.projectionMatrix.n11)/(D.w+e.projectionMatrix.n14)),t.scale.y=ga.scale.y*Math.abs(t.y-(D.y+e.projectionMatrix.n22)/(D.w+e.projectionMatrix.n24)),t.material=ga.material,x.elements.push(t);f&&x.elements.sort(c);return x}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,void 0!==d?d:1)};
+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,q=[],o,p=[],m,r,s=[],t,u,v=[],x={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,D=new THREE.Vector4,C=new THREE.Matrix4,A=new THREE.Matrix4,H=new THREE.Frustum,I=new THREE.Vector4,N=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);C.multiply(b.projectionMatrix,b.matrixWorldInverse);C.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);C.multiply(b.matrixWorld,
+b.projectionMatrixInverse);C.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){f=0;x.objects.length=0;x.sprites.length=0;x.lights.length=0;var g=function(b){if(!1!==b.visible){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(!1===b.frustumCulled||H.contains(b))?(C.multiplyVector3(B.copy(b.position)),e=a(),e.object=
+b,e.z=B.z,x.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(C.multiplyVector3(B.copy(b.position)),e=a(),e.object=b,e.z=B.z,x.sprites.push(e)):b instanceof THREE.Light&&x.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)g(b.children[c])}};g(b);d&&x.objects.sort(c);return x};this.projectScene=function(a,e,f){var g=e.near,G=e.far,j,B,y,E,S,T,R,ka,ga,V,ba,ca,da,ha,Qa,la;u=r=o=n=0;x.elements.length=0;void 0===e.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);C.multiply(e.projectionMatrix,e.matrixWorldInverse);H.setFromMatrix(C);x=this.projectGraph(a,!1);for(a=0,j=x.objects.length;a<j;a++)if(ga=x.objects[a].object,V=ga.matrixWorld,ca=ga.material,i=0,ga instanceof THREE.Mesh){ba=ga.geometry;da=ga.geometry.materials;E=ba.vertices;ha=ba.faces;Qa=ba.faceVertexUvs;ba=ga.matrixRotationWorld.extractRotation(V);for(B=0,y=E.length;B<y;B++)h=b(),h.positionWorld.copy(E[B].position),V.multiplyVector3(h.positionWorld),
+h.positionScreen.copy(h.positionWorld),C.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>g&&h.positionScreen.z<G;for(E=0,B=ha.length;E<B;E++){y=ha[E];if(y instanceof THREE.Face3)if(S=l[y.a],T=l[y.b],R=l[y.c],S.visible&&T.visible&&R.visible&&(ga.doubleSided||ga.flipSided!=0>(R.positionScreen.x-S.positionScreen.x)*(T.positionScreen.y-S.positionScreen.y)-(R.positionScreen.y-S.positionScreen.y)*(T.positionScreen.x-
+S.positionScreen.x)))ka=q[n]=q[n]||new THREE.RenderableFace3,n++,k=ka,k.v1.copy(S),k.v2.copy(T),k.v3.copy(R);else continue;else if(y instanceof THREE.Face4)if(S=l[y.a],T=l[y.b],R=l[y.c],ka=l[y.d],S.visible&&T.visible&&R.visible&&ka.visible&&(ga.doubleSided||ga.flipSided!=(0>(ka.positionScreen.x-S.positionScreen.x)*(T.positionScreen.y-S.positionScreen.y)-(ka.positionScreen.y-S.positionScreen.y)*(T.positionScreen.x-S.positionScreen.x)||0>(T.positionScreen.x-R.positionScreen.x)*(ka.positionScreen.y-
+R.positionScreen.y)-(T.positionScreen.y-R.positionScreen.y)*(ka.positionScreen.x-R.positionScreen.x))))la=p[o]=p[o]||new THREE.RenderableFace4,o++,k=la,k.v1.copy(S),k.v2.copy(T),k.v3.copy(R),k.v4.copy(ka);else continue;k.normalWorld.copy(y.normal);ba.multiplyVector3(k.normalWorld);k.centroidWorld.copy(y.centroid);V.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);C.multiplyVector3(k.centroidScreen);R=y.vertexNormals;for(S=0,T=R.length;S<T;S++)ka=k.vertexNormalsWorld[S],ka.copy(R[S]),
+ba.multiplyVector3(ka);for(S=0,T=Qa.length;S<T;S++)if(la=Qa[S][E])for(R=0,ka=la.length;R<ka;R++)k.uvs[S][R]=la[R];k.material=ca;k.faceMaterial=null!==y.materialIndex?da[y.materialIndex]:null;k.z=k.centroidScreen.z;x.elements.push(k)}}else if(ga instanceof THREE.Line){A.multiply(C,V);E=ga.geometry.vertices;S=b();S.positionScreen.copy(E[0].position);A.multiplyVector4(S.positionScreen);for(B=1,y=E.length;B<y;B++)if(S=b(),S.positionScreen.copy(E[B].position),A.multiplyVector4(S.positionScreen),T=l[i-
+2],I.copy(S.positionScreen),N.copy(T.positionScreen),d(I,N))I.multiplyScalar(1/I.w),N.multiplyScalar(1/N.w),ga=s[r]=s[r]||new THREE.RenderableLine,r++,m=ga,m.v1.positionScreen.copy(I),m.v2.positionScreen.copy(N),m.z=Math.max(I.z,N.z),m.material=ca,x.elements.push(m)}for(a=0,j=x.sprites.length;a<j;a++)if(ga=x.sprites[a].object,V=ga.matrixWorld,ga instanceof THREE.Particle&&(D.set(V.n14,V.n24,V.n34,1),C.multiplyVector4(D),D.z/=D.w,0<D.z&&1>D.z))g=v[u]=v[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=ga.rotation.z,t.scale.x=ga.scale.x*Math.abs(t.x-(D.x+e.projectionMatrix.n11)/(D.w+e.projectionMatrix.n14)),t.scale.y=ga.scale.y*Math.abs(t.y-(D.y+e.projectionMatrix.n22)/(D.w+e.projectionMatrix.n24)),t.material=ga.material,x.elements.push(t);f&&x.elements.sort(c);return x}};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),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
-this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,k=this.w,i=k*c+g*e-h*d,l=k*d+h*c-f*e,n=k*e+f*d-g*c,c=-f*
-c-g*d-h*e;b.x=i*k+c*-f+l*-h-n*-g;b.y=l*k+c*-g+n*-f-i*-h;b.z=n*k+c*-h+i*-g-l*-f;return b}};
+this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,i=this.w,l=i*c+g*e-h*d,k=i*d+h*c-f*e,n=i*e+f*d-g*c,c=-f*
+c-g*d-h*e;b.x=l*i+c*-f+k*-h-n*-g;b.y=k*i+c*-g+n*-f-l*-h;b.z=n*i+c*-h+l*-g-k*-f;return b}};
 THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(0.0010>Math.abs(e))return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
@@ -89,14 +89,14 @@ 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,S){h=a.vertices[b].position;k=a.vertices[c].position;i=a.vertices[d].position;l=g[e];n=g[f];q=g[S];o=k.x-h.x;p=i.x-h.x;m=k.y-h.y;r=i.y-h.y;s=k.z-h.z;t=i.z-h.z;u=n.u-l.u;v=q.u-l.u;x=n.v-l.v;B=q.v-l.v;D=1/(u*B-v*x);J.set((B*o-x*p)*D,(B*m-x*r)*D,(B*s-x*t)*D);K.set((u*p-v*o)*D,(u*r-v*m)*D,(u*t-v*s)*D);A[b].addSelf(J);A[c].addSelf(J);A[d].addSelf(J);F[b].addSelf(K);F[c].addSelf(K);F[d].addSelf(K)}var b,c,d,e,f,g,h,k,i,l,n,q,o,p,m,r,s,t,u,v,x,B,D,C,A=[],F=[],J=new THREE.Vector3,K=new THREE.Vector3,
-Z=new THREE.Vector3,L=new THREE.Vector3,O=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)A[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 M=["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++)O.copy(f.vertexNormals[d]),e=f[M[d]],
-C=A[e],Z.copy(C),Z.subSelf(O.multiplyScalar(O.dot(C))).normalize(),L.cross(f.vertexNormals[d],C),e=L.dot(F[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(Z.x,Z.y,Z.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=
+b,c,d,e,f,T){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=g[e];n=g[f];q=g[T];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;v=q.u-k.u;x=n.v-k.v;B=q.v-k.v;D=1/(u*B-v*x);I.set((B*o-x*p)*D,(B*m-x*r)*D,(B*s-x*t)*D);N.set((u*p-v*o)*D,(u*r-v*m)*D,(u*t-v*s)*D);A[b].addSelf(I);A[c].addSelf(I);A[d].addSelf(I);H[b].addSelf(N);H[c].addSelf(N);H[d].addSelf(N)}var b,c,d,e,f,g,h,i,l,k,n,q,o,p,m,r,s,t,u,v,x,B,D,C,A=[],H=[],I=new THREE.Vector3,N=new THREE.Vector3,
+$=new THREE.Vector3,K=new THREE.Vector3,Q=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)A[b]=new THREE.Vector3,H[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var L=["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++)Q.copy(f.vertexNormals[d]),e=f[L[d]],
+C=A[e],$.copy(C),$.subSelf(Q.multiplyScalar(Q.dot(C))).normalize(),K.cross(f.vertexNormals[d],C),e=K.dot(H[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4($.x,$.y,$.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,k,i,l,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;i=this.points[c[0]];l=this.points[c[1]];
-n=this.points[c[2]];q=this.points[c[3]];h=g*g;k=g*h;d.x=b(i.x,l.x,n.x,q.x,g,h,k);d.y=b(i.y,l.y,n.y,q.y,g,h,k);d.z=b(i.z,l.z,n.z,q.z,g,h,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,f=new THREE.Vector3,g=new THREE.Vector3,h=[],k=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),k+=g.distanceTo(f),
-f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=k,e=b);h[h.length]=k;return{chunks:h,total:k}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],k=new THREE.Vector3,i=this.getLength();h.push(k.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=i.chunks[b]-i.chunks[b-1];g=Math.ceil(a*c/i.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(k.copy(d).clone());h.push(k.copy(this.points[b]).clone())}this.points=
+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;
 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;
@@ -129,7 +129,7 @@ a.fog?a.fog:!1;this.lights=void 0!==a.lights?a.lights:!1;this.vertexColors=void
 THREE.Texture=function(a,b,c,d,e,f,g,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
 !0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};
 THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;
-THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,e,f,g,h,k,i){THREE.Texture.call(this,null,f,g,h,k,i,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,e,f,g,h,i,l){THREE.Texture.call(this,null,f,g,h,i,l,d,e);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=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;
@@ -156,47 +156,47 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)-1===this.lights.indexOf(a)&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.objects.indexOf(a)){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);-1!==b&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),-1!==b&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
 THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};
-THREE.DOMRenderer=function(){var a=null,b=new THREE.Projector,c,d,e,f;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;f=d/2};this.render=function(c,d){var k,i,l,n,q,o,p,m;a=b.projectScene(c,d);for(k=0,i=a.length;k<i;k++)if(q=a[k],q instanceof THREE.RenderableParticle){p=q.x*e+e;m=q.y*f+f;for(l=0,n=q.material.length;l<n;l++)if(o=q.material[l],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(v!=a)m.strokeStyle=v=a}function e(a){if(x!=a)m.fillStyle=x=a}var a=a||{},f=this,g,h,k,i=new THREE.Projector,l=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
-n,q,o,p,m=l.getContext("2d"),r=new THREE.Color(0),s=0,t=1,u=0,v=null,x=null,B=null,D=null,C=null,A,F,J,K,Z=new THREE.RenderableVertex,L=new THREE.RenderableVertex,O,M,H,j,V,y,E,Q,S,aa,ja,ga,T=new THREE.Color,ba=new THREE.Color,$=new THREE.Color,da=new THREE.Color,ha=new THREE.Color,Qa=[],ka=[],Ba,Ga,Ia,za,Ua,jb,cb,Sa,Va,Ya,Ca=new THREE.Rectangle,ya=new THREE.Rectangle,la=new THREE.Rectangle,Sb=!1,ca=new THREE.Color,R=new THREE.Color,P=new THREE.Color,Ka=new THREE.Vector3,gc,hc,Lc,db,ic,uc,a=16;gc=
-document.createElement("canvas");gc.width=gc.height=2;hc=gc.getContext("2d");hc.fillStyle="rgba(0,0,0,1)";hc.fillRect(0,0,2,2);Lc=hc.getImageData(0,0,2,2);db=Lc.data;ic=document.createElement("canvas");ic.width=ic.height=a;uc=ic.getContext("2d");uc.translate(-a/2,-a/2);uc.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a;q=b;o=Math.floor(n/2);p=Math.floor(q/2);l.width=n;l.height=q;Ca.set(-o,
--p,o,p);ya.set(-o,-p,o,p);t=1;u=0;C=D=B=x=v=null};this.setClearColor=function(a,b){r.copy(a);s=b;ya.set(-o,-p,o,p)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;ya.set(-o,-p,o,p)};this.clear=function(){m.setTransform(1,0,0,-1,o,p);ya.isEmpty()||(ya.minSelf(Ca),ya.inflate(2),1>s&&m.clearRect(Math.floor(ya.getX()),Math.floor(ya.getY()),Math.floor(ya.getWidth()),Math.floor(ya.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(ya.getX()),Math.floor(ya.getY()),Math.floor(ya.getWidth()),Math.floor(ya.getHeight()))),ya.empty())};this.render=function(a,l){function q(a){var b,c,d,e;ca.setRGB(0,0,0);R.setRGB(0,0,0);P.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(ca.r+=e.r,ca.g+=e.g,ca.b+=e.b):d instanceof THREE.DirectionalLight?(R.r+=e.r,R.g+=e.g,R.b+=e.b):d instanceof THREE.PointLight&&(P.r+=e.r,P.g+=e.g,P.b+=e.b)}function n(a,b,c,d){var e,f,
-g,j,ca,h;for(e=0,f=a.length;e<f;e++)g=a[e],j=g.color,g instanceof THREE.DirectionalLight?(ca=g.matrixWorld.getPosition(),h=c.dot(ca),0>=h||(h*=g.intensity,d.r+=j.r*h,d.g+=j.g*h,d.b+=j.b*h)):g instanceof THREE.PointLight&&(ca=g.matrixWorld.getPosition(),h=c.dot(Ka.sub(ca,b).normalize()),0>=h||(h*=0==g.distance?1:1-Math.min(b.distanceTo(ca)/g.distance,1),0!=h&&(h*=g.intensity,d.r+=j.r*h,d.g+=j.g*h,d.b+=j.b*h)))}function r(a,f,g){b(g.opacity);c(g.blending);var j,ca,h,k,i,P;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)k=
-g.map.image,i=k.width>>1,P=k.height>>1,g=f.scale.x*o,h=f.scale.y*p,j=g*i,ca=h*P,la.set(a.x-j,a.y-ca,a.x+j,a.y+ca),Ca.intersects(la)&&(m.save(),m.translate(a.x,a.y),m.rotate(-f.rotation),m.scale(g,-h),m.translate(-i,-P),m.drawImage(k,0,0),m.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(j=f.scale.x*o,ca=f.scale.y*p,la.set(a.x-j,a.y-ca,a.x+j,a.y+ca),Ca.intersects(la)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),m.save(),m.translate(a.x,a.y),m.rotate(-f.rotation),m.scale(j,
-ca),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(B!=a)m.lineWidth=B=a;a=g.linecap;if(D!=a)m.lineCap=D=a;a=g.linejoin;if(C!=a)m.lineJoin=C=a;d(g.color.getContextStyle());m.stroke();la.inflate(2*g.linewidth)}}function t(a,d,e,g,h,i,P,R){f.info.render.vertices+=3;f.info.render.faces++;b(R.opacity);
-c(R.blending);O=a.positionScreen.x;M=a.positionScreen.y;H=d.positionScreen.x;j=d.positionScreen.y;V=e.positionScreen.x;y=e.positionScreen.y;v(O,M,H,j,V,y);if(R instanceof THREE.MeshBasicMaterial)if(R.map)R.map.mapping instanceof THREE.UVMapping&&(za=P.uvs[0],Mc(O,M,H,j,V,y,za[g].u,za[g].v,za[h].u,za[h].v,za[i].u,za[i].v,R.map));else if(R.envMap){if(R.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,Ka.copy(P.vertexNormalsWorld[g]),Ua=0.5*(Ka.x*a.n11+Ka.y*a.n12+Ka.z*
-a.n13)+0.5,jb=0.5*-(Ka.x*a.n21+Ka.y*a.n22+Ka.z*a.n23)+0.5,Ka.copy(P.vertexNormalsWorld[h]),cb=0.5*(Ka.x*a.n11+Ka.y*a.n12+Ka.z*a.n13)+0.5,Sa=0.5*-(Ka.x*a.n21+Ka.y*a.n22+Ka.z*a.n23)+0.5,Ka.copy(P.vertexNormalsWorld[i]),Va=0.5*(Ka.x*a.n11+Ka.y*a.n12+Ka.z*a.n13)+0.5,Ya=0.5*-(Ka.x*a.n21+Ka.y*a.n22+Ka.z*a.n23)+0.5,Mc(O,M,H,j,V,y,Ua,jb,cb,Sa,Va,Ya,R.envMap)}else R.wireframe?Eb(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):zb(R.color);else if(R instanceof THREE.MeshLambertMaterial)R.map&&
-!R.wireframe&&(R.map.mapping instanceof THREE.UVMapping&&(za=P.uvs[0],Mc(O,M,H,j,V,y,za[g].u,za[g].v,za[h].u,za[h].v,za[i].u,za[i].v,R.map)),c(THREE.SubtractiveBlending)),Sb?!R.wireframe&&R.shading==THREE.SmoothShading&&3==P.vertexNormalsWorld.length?(ba.r=$.r=da.r=ca.r,ba.g=$.g=da.g=ca.g,ba.b=$.b=da.b=ca.b,n(k,P.v1.positionWorld,P.vertexNormalsWorld[0],ba),n(k,P.v2.positionWorld,P.vertexNormalsWorld[1],$),n(k,P.v3.positionWorld,P.vertexNormalsWorld[2],da),ba.r=Math.max(0,Math.min(R.color.r*ba.r,
-1)),ba.g=Math.max(0,Math.min(R.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(R.color.b*ba.b,1)),$.r=Math.max(0,Math.min(R.color.r*$.r,1)),$.g=Math.max(0,Math.min(R.color.g*$.g,1)),$.b=Math.max(0,Math.min(R.color.b*$.b,1)),da.r=Math.max(0,Math.min(R.color.r*da.r,1)),da.g=Math.max(0,Math.min(R.color.g*da.g,1)),da.b=Math.max(0,Math.min(R.color.b*da.b,1)),ha.r=0.5*($.r+da.r),ha.g=0.5*($.g+da.g),ha.b=0.5*($.b+da.b),Ia=vc(ba,$,da,ha),Yb(O,M,H,j,V,y,0,0,1,0,0,1,Ia)):(T.r=ca.r,T.g=ca.g,T.b=ca.b,n(k,P.centroidWorld,
-P.normalWorld,T),T.r=Math.max(0,Math.min(R.color.r*T.r,1)),T.g=Math.max(0,Math.min(R.color.g*T.g,1)),T.b=Math.max(0,Math.min(R.color.b*T.b,1)),R.wireframe?Eb(T,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):zb(T)):R.wireframe?Eb(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):zb(R.color);else if(R instanceof THREE.MeshDepthMaterial)Ba=l.near,Ga=l.far,ba.r=ba.g=ba.b=1-Tb(a.positionScreen.z,Ba,Ga),$.r=$.g=$.b=1-Tb(d.positionScreen.z,Ba,Ga),da.r=da.g=da.b=1-Tb(e.positionScreen.z,
-Ba,Ga),ha.r=0.5*($.r+da.r),ha.g=0.5*($.g+da.g),ha.b=0.5*($.b+da.b),Ia=vc(ba,$,da,ha),Yb(O,M,H,j,V,y,0,0,1,0,0,1,Ia);else if(R instanceof THREE.MeshNormalMaterial)T.r=Zb(P.normalWorld.x),T.g=Zb(P.normalWorld.y),T.b=Zb(P.normalWorld.z),R.wireframe?Eb(T,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):zb(T)}function u(a,d,e,g,h,R,P,i,m){f.info.render.vertices+=4;f.info.render.faces++;b(i.opacity);c(i.blending);if(i.map||i.envMap)t(a,d,g,0,1,3,P,i,m),t(h,e,R,1,2,3,P,i,m);else if(O=a.positionScreen.x,
-M=a.positionScreen.y,H=d.positionScreen.x,j=d.positionScreen.y,V=e.positionScreen.x,y=e.positionScreen.y,E=g.positionScreen.x,Q=g.positionScreen.y,S=h.positionScreen.x,aa=h.positionScreen.y,ja=R.positionScreen.x,ga=R.positionScreen.y,i instanceof THREE.MeshBasicMaterial)x(O,M,H,j,V,y,E,Q),i.wireframe?Eb(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):zb(i.color);else if(i instanceof THREE.MeshLambertMaterial)Sb?!i.wireframe&&i.shading==THREE.SmoothShading&&4==P.vertexNormalsWorld.length?
-(ba.r=$.r=da.r=ha.r=ca.r,ba.g=$.g=da.g=ha.g=ca.g,ba.b=$.b=da.b=ha.b=ca.b,n(k,P.v1.positionWorld,P.vertexNormalsWorld[0],ba),n(k,P.v2.positionWorld,P.vertexNormalsWorld[1],$),n(k,P.v4.positionWorld,P.vertexNormalsWorld[3],da),n(k,P.v3.positionWorld,P.vertexNormalsWorld[2],ha),ba.r=Math.max(0,Math.min(i.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(i.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(i.color.b*ba.b,1)),$.r=Math.max(0,Math.min(i.color.r*$.r,1)),$.g=Math.max(0,Math.min(i.color.g*$.g,1)),$.b=Math.max(0,
-Math.min(i.color.b*$.b,1)),da.r=Math.max(0,Math.min(i.color.r*da.r,1)),da.g=Math.max(0,Math.min(i.color.g*da.g,1)),da.b=Math.max(0,Math.min(i.color.b*da.b,1)),ha.r=Math.max(0,Math.min(i.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(i.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(i.color.b*ha.b,1)),Ia=vc(ba,$,da,ha),v(O,M,H,j,E,Q),Yb(O,M,H,j,E,Q,0,0,1,0,0,1,Ia),v(S,aa,V,y,ja,ga),Yb(S,aa,V,y,ja,ga,1,0,1,1,0,1,Ia)):(T.r=ca.r,T.g=ca.g,T.b=ca.b,n(k,P.centroidWorld,P.normalWorld,T),T.r=Math.max(0,Math.min(i.color.r*
-T.r,1)),T.g=Math.max(0,Math.min(i.color.g*T.g,1)),T.b=Math.max(0,Math.min(i.color.b*T.b,1)),x(O,M,H,j,V,y,E,Q),i.wireframe?Eb(T,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):zb(T)):(x(O,M,H,j,V,y,E,Q),i.wireframe?Eb(i.color,i.wireframeLinewidth,i.wireframeLinecap,i.wireframeLinejoin):zb(i.color));else if(i instanceof THREE.MeshNormalMaterial)T.r=Zb(P.normalWorld.x),T.g=Zb(P.normalWorld.y),T.b=Zb(P.normalWorld.z),x(O,M,H,j,V,y,E,Q),i.wireframe?Eb(T,i.wireframeLinewidth,i.wireframeLinecap,
-i.wireframeLinejoin):zb(T);else if(i instanceof THREE.MeshDepthMaterial)Ba=l.near,Ga=l.far,ba.r=ba.g=ba.b=1-Tb(a.positionScreen.z,Ba,Ga),$.r=$.g=$.b=1-Tb(d.positionScreen.z,Ba,Ga),da.r=da.g=da.b=1-Tb(g.positionScreen.z,Ba,Ga),ha.r=ha.g=ha.b=1-Tb(e.positionScreen.z,Ba,Ga),Ia=vc(ba,$,da,ha),v(O,M,H,j,E,Q),Yb(O,M,H,j,E,Q,0,0,1,0,0,1,Ia),v(S,aa,V,y,ja,ga),Yb(S,aa,V,y,ja,ga,1,0,1,1,0,1,Ia)}function v(a,b,c,d,e,f){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(a,b);m.closePath()}function x(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(B!=b)m.lineWidth=B=b;if(D!=c)m.lineCap=D=c;if(C!=e)m.lineJoin=C=e;d(a.getContextStyle());m.stroke();la.inflate(2*b)}function zb(a){e(a.getContextStyle());m.fill()}function Mc(a,b,c,d,f,g,j,ca,h,i,R,k,P){if(0!=P.image.width){if(!0==P.needsUpdate||void 0==Qa[P.id]){var l=P.wrapS==THREE.RepeatWrapping,n=P.wrapT==THREE.RepeatWrapping;Qa[P.id]=m.createPattern(P.image,
-l&&n?"repeat":l&&!n?"repeat-x":!l&&n?"repeat-y":"no-repeat");P.needsUpdate=!1}e(Qa[P.id]);var l=P.offset.x/P.repeat.x,n=P.offset.y/P.repeat.y,q=P.image.width*P.repeat.x,o=P.image.height*P.repeat.y,j=(j+l)*q,ca=(ca+n)*o,c=c-a,d=d-b,f=f-a,g=g-b,h=(h+l)*q-j,i=(i+n)*o-ca,R=(R+l)*q-j,k=(k+n)*o-ca,l=h*k-R*i;if(0==l){if(void 0===ka[P.id])b=document.createElement("canvas"),b.width=P.image.width,b.height=P.image.height,b=b.getContext("2d"),b.drawImage(P.image,0,0),ka[P.id]=b.getImageData(0,0,P.image.width,
-P.image.height).data;b=ka[P.id];j=4*(Math.floor(j)+Math.floor(ca)*P.image.width);T.setRGB(b[j]/255,b[j+1]/255,b[j+2]/255);zb(T)}else l=1/l,P=(k*c-i*f)*l,i=(k*d-i*g)*l,c=(h*f-R*c)*l,d=(h*g-R*d)*l,a=a-P*j-c*ca,j=b-i*j-d*ca,m.save(),m.transform(P,i,c,d,a,j),m.fill(),m.restore()}}function Yb(a,b,c,d,e,f,g,j,ca,h,P,i,R){var k,l;k=R.width-1;l=R.height-1;g*=k;j*=l;c-=a;d-=b;e-=a;f-=b;ca=ca*k-g;h=h*l-j;P=P*k-g;i=i*l-j;l=1/(ca*i-P*h);k=(i*c-h*e)*l;h=(i*d-h*f)*l;c=(ca*e-P*c)*l;d=(ca*f-P*d)*l;a=a-k*g-c*j;b=
-b-h*g-d*j;m.save();m.transform(k,h,c,d,a,b);m.clip();m.drawImage(R,0,0);m.restore()}function vc(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),ca=~~(255*c.r),h=~~(255*c.g),c=~~(255*c.b),P=~~(255*d.r),i=~~(255*d.g),d=~~(255*d.b);db[0]=0>e?0:255<e?255:e;db[1]=0>f?0:255<f?255:f;db[2]=0>a?0:255<a?255:a;db[4]=0>g?0:255<g?255:g;db[5]=0>j?0:255<j?255:j;db[6]=0>b?0:255<b?255:b;db[8]=0>ca?0:255<ca?255:ca;db[9]=0>h?0:255<h?255:h;db[10]=0>c?0:255<c?255:c;db[12]=
-0>P?0:255<P?255:P;db[13]=0>i?0:255<i?255:i;db[14]=0>d?0:255<d?255:d;hc.putImageData(Lc,0,0);uc.drawImage(gc,0,0);return ic}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 wc,Wc,Na,hb;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,p);f.info.render.vertices=0;f.info.render.faces=0;g=i.projectScene(a,l,this.sortElements);h=g.elements;
-k=g.lights;(Sb=0<k.length)&&q(k);for(wc=0,Wc=h.length;wc<Wc;wc++)if(Na=h[wc],hb=Na.material,hb=hb instanceof THREE.MeshFaceMaterial?Na.faceMaterial:hb,!(null==hb||0==hb.opacity)){la.empty();if(Na instanceof THREE.RenderableParticle)A=Na,A.x*=o,A.y*=p,r(A,Na,hb,a);else if(Na instanceof THREE.RenderableLine)A=Na.v1,F=Na.v2,A.positionScreen.x*=o,A.positionScreen.y*=p,F.positionScreen.x*=o,F.positionScreen.y*=p,la.addPoint(A.positionScreen.x,A.positionScreen.y),la.addPoint(F.positionScreen.x,F.positionScreen.y),
-Ca.intersects(la)&&s(A,F,Na,hb,a);else if(Na instanceof THREE.RenderableFace3)A=Na.v1,F=Na.v2,J=Na.v3,A.positionScreen.x*=o,A.positionScreen.y*=p,F.positionScreen.x*=o,F.positionScreen.y*=p,J.positionScreen.x*=o,J.positionScreen.y*=p,hb.overdraw&&(Fb(A.positionScreen,F.positionScreen),Fb(F.positionScreen,J.positionScreen),Fb(J.positionScreen,A.positionScreen)),la.add3Points(A.positionScreen.x,A.positionScreen.y,F.positionScreen.x,F.positionScreen.y,J.positionScreen.x,J.positionScreen.y),Ca.intersects(la)&&
-t(A,F,J,0,1,2,Na,hb,a);else if(Na instanceof THREE.RenderableFace4)A=Na.v1,F=Na.v2,J=Na.v3,K=Na.v4,A.positionScreen.x*=o,A.positionScreen.y*=p,F.positionScreen.x*=o,F.positionScreen.y*=p,J.positionScreen.x*=o,J.positionScreen.y*=p,K.positionScreen.x*=o,K.positionScreen.y*=p,Z.positionScreen.copy(F.positionScreen),L.positionScreen.copy(K.positionScreen),hb.overdraw&&(Fb(A.positionScreen,F.positionScreen),Fb(F.positionScreen,K.positionScreen),Fb(K.positionScreen,A.positionScreen),Fb(J.positionScreen,
-Z.positionScreen),Fb(J.positionScreen,L.positionScreen)),la.addPoint(A.positionScreen.x,A.positionScreen.y),la.addPoint(F.positionScreen.x,F.positionScreen.y),la.addPoint(J.positionScreen.x,J.positionScreen.y),la.addPoint(K.positionScreen.x,K.positionScreen.y),Ca.intersects(la)&&u(A,F,J,K,Z,L,Na,hb,a);ya.addRectangle(la)}m.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,k;for(e=0,f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),k=c.dot(i),0>=k||(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),k=c.dot(A.sub(i,b).normalize()),0>=k||(k*=0==g.distance?1:1-Math.min(b.distanceTo(i)/g.distance,1),0!=k&&(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)))}function b(a){null==F[a]&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),0==O&&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,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),i,l,n,q,o,p,m,r,s=new THREE.Rectangle,t=new THREE.Rectangle,u=!1,v=new THREE.Color,x=new THREE.Color,B=new THREE.Color,D=new THREE.Color,C,A=new THREE.Vector3,F=[],J=[],K,Z,L,O=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
-faces:0}};this.setQuality=function(a){switch(a){case "high":O=1;break;case "low":O=0}};this.setSize=function(a,b){i=a;l=b;n=i/2;q=l/2;k.setAttribute("viewBox",-n+" "+-q+" "+i+" "+l);k.setAttribute("width",i);k.setAttribute("height",l);s.set(-n,-q,n,q)};this.clear=function(){for(;0<k.childNodes.length;)k.removeChild(k.childNodes[0])};this.render=function(i,l){var j,A,y,E;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(i,l,this.sortElements);f=e.elements;
-g=e.lights;L=Z=0;if(u=0<g.length){x.setRGB(0,0,0);B.setRGB(0,0,0);D.setRGB(0,0,0);for(j=0,A=g.length;j<A;j++)E=g[j],y=E.color,E instanceof THREE.AmbientLight?(x.r+=y.r,x.g+=y.g,x.b+=y.b):E instanceof THREE.DirectionalLight?(B.r+=y.r,B.g+=y.g,B.b+=y.b):E instanceof THREE.PointLight&&(D.r+=y.r,D.g+=y.g,D.b+=y.b)}for(j=0,A=f.length;j<A;j++)if(y=f[j],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*=-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 Q=p,S=L++;null==J[S]&&(J[S]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==O&&J[S].setAttribute("shape-rendering","crispEdges"));K=J[S];K.setAttribute("x1",y.positionScreen.x);K.setAttribute("y1",y.positionScreen.y);
-K.setAttribute("x2",Q.positionScreen.x);K.setAttribute("y2",Q.positionScreen.y);E instanceof THREE.LineBasicMaterial&&(K.setAttribute("style","fill: none; stroke: "+E.color.getContextStyle()+"; stroke-width: "+E.linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.linecap+"; stroke-linejoin: "+E.linejoin),k.appendChild(K))}}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 Q=o,S=p,aa=m;d.info.render.vertices+=3;d.info.render.faces++;K=b(Z++);K.setAttribute("d","M "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+S.positionScreen.x+" "+S.positionScreen.y+" L "+aa.positionScreen.x+","+aa.positionScreen.y+"z");E instanceof THREE.MeshBasicMaterial?v.copy(E.color):E instanceof THREE.MeshLambertMaterial?
-u?(v.r=x.r,v.g=x.g,v.b=x.b,a(g,y.centroidWorld,y.normalWorld,v),v.r=Math.max(0,Math.min(E.color.r*v.r,1)),v.g=Math.max(0,Math.min(E.color.g*v.g,1)),v.b=Math.max(0,Math.min(E.color.b*v.b,1))):v.copy(E.color):E instanceof THREE.MeshDepthMaterial?(C=1-E.__2near/(E.__farPlusNear-y.z*E.__farMinusNear),v.setRGB(C,C,C)):E instanceof THREE.MeshNormalMaterial&&v.setRGB(c(y.normalWorld.x),c(y.normalWorld.y),c(y.normalWorld.z));E.wireframe?K.setAttribute("style","fill: none; stroke: "+v.getContextStyle()+"; stroke-width: "+
-E.wireframeLinewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframeLinecap+"; stroke-linejoin: "+E.wireframeLinejoin):K.setAttribute("style","fill: "+v.getContextStyle()+"; fill-opacity: "+E.opacity);k.appendChild(K)}}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 Q=o,S=p,aa=m,F=r;d.info.render.vertices+=4;d.info.render.faces++;K=b(Z++);K.setAttribute("d","M "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+S.positionScreen.x+" "+S.positionScreen.y+" L "+aa.positionScreen.x+","+aa.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+"z");E instanceof THREE.MeshBasicMaterial?
-v.copy(E.color):E instanceof THREE.MeshLambertMaterial?u?(v.r=x.r,v.g=x.g,v.b=x.b,a(g,y.centroidWorld,y.normalWorld,v),v.r=Math.max(0,Math.min(E.color.r*v.r,1)),v.g=Math.max(0,Math.min(E.color.g*v.g,1)),v.b=Math.max(0,Math.min(E.color.b*v.b,1))):v.copy(E.color):E instanceof THREE.MeshDepthMaterial?(C=1-E.__2near/(E.__farPlusNear-y.z*E.__farMinusNear),v.setRGB(C,C,C)):E instanceof THREE.MeshNormalMaterial&&v.setRGB(c(y.normalWorld.x),c(y.normalWorld.y),c(y.normalWorld.z));E.wireframe?K.setAttribute("style",
-"fill: none; stroke: "+v.getContextStyle()+"; stroke-width: "+E.wireframeLinewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframeLinecap+"; stroke-linejoin: "+E.wireframeLinejoin):K.setAttribute("style","fill: "+v.getContextStyle()+"; fill-opacity: "+E.opacity);k.appendChild(K)}}};
+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(v!=a)m.strokeStyle=v=a}function e(a){if(x!=a)m.fillStyle=x=a}var a=a||{},f=this,g,h,i,l=new THREE.Projector,k=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
+n,q,o,p,m=k.getContext("2d"),r=new THREE.Color(0),s=0,t=1,u=0,v=null,x=null,B=null,D=null,C=null,A,H,I,N,$=new THREE.RenderableVertex,K=new THREE.RenderableVertex,Q,L,G,j,W,y,E,S,T,R,ka,ga,V=new THREE.Color,ba=new THREE.Color,ca=new THREE.Color,da=new THREE.Color,ha=new THREE.Color,Qa=[],la=[],za,Aa,Ja,Da,$a,Ta,ib,db,Wa,Xa,ra=new THREE.Rectangle,Ba=new THREE.Rectangle,ja=new THREE.Rectangle,ab=!1,aa=new THREE.Color,P=new THREE.Color,O=new THREE.Color,Ea=new THREE.Vector3,gc,hc,Kc,eb,ic,uc,a=16;gc=
+document.createElement("canvas");gc.width=gc.height=2;hc=gc.getContext("2d");hc.fillStyle="rgba(0,0,0,1)";hc.fillRect(0,0,2,2);Kc=hc.getImageData(0,0,2,2);eb=Kc.data;ic=document.createElement("canvas");ic.width=ic.height=a;uc=ic.getContext("2d");uc.translate(-a/2,-a/2);uc.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;ra.set(-o,
+-p,o,p);Ba.set(-o,-p,o,p);t=1;u=0;C=D=B=x=v=null};this.setClearColor=function(a,b){r.copy(a);s=b;Ba.set(-o,-p,o,p)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;Ba.set(-o,-p,o,p)};this.clear=function(){m.setTransform(1,0,0,-1,o,p);Ba.isEmpty()||(Ba.minSelf(ra),Ba.inflate(2),1>s&&m.clearRect(Math.floor(Ba.getX()),Math.floor(Ba.getY()),Math.floor(Ba.getWidth()),Math.floor(Ba.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(Ba.getX()),Math.floor(Ba.getY()),Math.floor(Ba.getWidth()),Math.floor(Ba.getHeight()))),Ba.empty())};this.render=function(a,k){function q(a){var b,c,d,e;aa.setRGB(0,0,0);P.setRGB(0,0,0);O.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(aa.r+=e.r,aa.g+=e.g,aa.b+=e.b):d instanceof THREE.DirectionalLight?(P.r+=e.r,P.g+=e.g,P.b+=e.b):d instanceof THREE.PointLight&&(O.r+=e.r,O.g+=e.g,O.b+=e.b)}function n(a,b,c,d){var e,f,
+g,aa,j,h;for(e=0,f=a.length;e<f;e++)g=a[e],aa=g.color,g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),h=c.dot(j),0>=h||(h*=g.intensity,d.r+=aa.r*h,d.g+=aa.g*h,d.b+=aa.b*h)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),h=c.dot(Ea.sub(j,b).normalize()),0>=h||(h*=0==g.distance?1:1-Math.min(b.distanceTo(j)/g.distance,1),0!=h&&(h*=g.intensity,d.r+=aa.r*h,d.g+=aa.g*h,d.b+=aa.b*h)))}function r(a,f,g){b(g.opacity);c(g.blending);var aa,j,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*p,aa=g*l,j=h*k,ja.set(a.x-aa,a.y-j,a.x+aa,a.y+j),ra.intersects(ja)&&(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&&(aa=f.scale.x*o,j=f.scale.y*p,ja.set(a.x-aa,a.y-j,a.x+aa,a.y+j),ra.intersects(ja)&&(d(g.color.getContextStyle()),e(g.color.getContextStyle()),m.save(),m.translate(a.x,a.y),m.rotate(-f.rotation),m.scale(aa,
+j),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(B!=a)m.lineWidth=B=a;a=g.linecap;if(D!=a)m.lineCap=D=a;a=g.linejoin;if(C!=a)m.lineJoin=C=a;d(g.color.getContextStyle());m.stroke();ja.inflate(2*g.linewidth)}}function t(a,d,e,g,h,l,P,O){f.info.render.vertices+=3;f.info.render.faces++;b(O.opacity);
+c(O.blending);Q=a.positionScreen.x;L=a.positionScreen.y;G=d.positionScreen.x;j=d.positionScreen.y;W=e.positionScreen.x;y=e.positionScreen.y;v(Q,L,G,j,W,y);if(O instanceof THREE.MeshBasicMaterial)if(O.map)O.map.mapping instanceof THREE.UVMapping&&(Da=P.uvs[0],Lc(Q,L,G,j,W,y,Da[g].u,Da[g].v,Da[h].u,Da[h].v,Da[l].u,Da[l].v,O.map));else if(O.envMap){if(O.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,Ea.copy(P.vertexNormalsWorld[g]),$a=0.5*(Ea.x*a.n11+Ea.y*a.n12+Ea.z*
+a.n13)+0.5,Ta=0.5*-(Ea.x*a.n21+Ea.y*a.n22+Ea.z*a.n23)+0.5,Ea.copy(P.vertexNormalsWorld[h]),ib=0.5*(Ea.x*a.n11+Ea.y*a.n12+Ea.z*a.n13)+0.5,db=0.5*-(Ea.x*a.n21+Ea.y*a.n22+Ea.z*a.n23)+0.5,Ea.copy(P.vertexNormalsWorld[l]),Wa=0.5*(Ea.x*a.n11+Ea.y*a.n12+Ea.z*a.n13)+0.5,Xa=0.5*-(Ea.x*a.n21+Ea.y*a.n22+Ea.z*a.n23)+0.5,Lc(Q,L,G,j,W,y,$a,Ta,ib,db,Wa,Xa,O.envMap)}else O.wireframe?Fb(O.color,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Ab(O.color);else if(O instanceof THREE.MeshLambertMaterial)O.map&&
+!O.wireframe&&(O.map.mapping instanceof THREE.UVMapping&&(Da=P.uvs[0],Lc(Q,L,G,j,W,y,Da[g].u,Da[g].v,Da[h].u,Da[h].v,Da[l].u,Da[l].v,O.map)),c(THREE.SubtractiveBlending)),ab?!O.wireframe&&O.shading==THREE.SmoothShading&&3==P.vertexNormalsWorld.length?(ba.r=ca.r=da.r=aa.r,ba.g=ca.g=da.g=aa.g,ba.b=ca.b=da.b=aa.b,n(i,P.v1.positionWorld,P.vertexNormalsWorld[0],ba),n(i,P.v2.positionWorld,P.vertexNormalsWorld[1],ca),n(i,P.v3.positionWorld,P.vertexNormalsWorld[2],da),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)),da.r=Math.max(0,Math.min(O.color.r*da.r,1)),da.g=Math.max(0,Math.min(O.color.g*da.g,1)),da.b=Math.max(0,Math.min(O.color.b*da.b,1)),ha.r=0.5*(ca.r+da.r),ha.g=0.5*(ca.g+da.g),ha.b=0.5*(ca.b+da.b),Ja=vc(ba,ca,da,ha),Yb(Q,L,G,j,W,y,0,0,1,0,0,1,Ja)):(V.r=aa.r,V.g=aa.g,V.b=aa.b,n(i,
+P.centroidWorld,P.normalWorld,V),V.r=Math.max(0,Math.min(O.color.r*V.r,1)),V.g=Math.max(0,Math.min(O.color.g*V.g,1)),V.b=Math.max(0,Math.min(O.color.b*V.b,1)),O.wireframe?Fb(V,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Ab(V)):O.wireframe?Fb(O.color,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Ab(O.color);else if(O instanceof THREE.MeshDepthMaterial)za=k.near,Aa=k.far,ba.r=ba.g=ba.b=1-Tb(a.positionScreen.z,za,Aa),ca.r=ca.g=ca.b=1-Tb(d.positionScreen.z,za,Aa),da.r=
+da.g=da.b=1-Tb(e.positionScreen.z,za,Aa),ha.r=0.5*(ca.r+da.r),ha.g=0.5*(ca.g+da.g),ha.b=0.5*(ca.b+da.b),Ja=vc(ba,ca,da,ha),Yb(Q,L,G,j,W,y,0,0,1,0,0,1,Ja);else if(O instanceof THREE.MeshNormalMaterial)V.r=Zb(P.normalWorld.x),V.g=Zb(P.normalWorld.y),V.b=Zb(P.normalWorld.z),O.wireframe?Fb(V,O.wireframeLinewidth,O.wireframeLinecap,O.wireframeLinejoin):Ab(V)}function u(a,d,e,g,h,O,l,P,m){f.info.render.vertices+=4;f.info.render.faces++;b(P.opacity);c(P.blending);if(P.map||P.envMap)t(a,d,g,0,1,3,l,P,m),
+t(h,e,O,1,2,3,l,P,m);else if(Q=a.positionScreen.x,L=a.positionScreen.y,G=d.positionScreen.x,j=d.positionScreen.y,W=e.positionScreen.x,y=e.positionScreen.y,E=g.positionScreen.x,S=g.positionScreen.y,T=h.positionScreen.x,R=h.positionScreen.y,ka=O.positionScreen.x,ga=O.positionScreen.y,P instanceof THREE.MeshBasicMaterial)x(Q,L,G,j,W,y,E,S),P.wireframe?Fb(P.color,P.wireframeLinewidth,P.wireframeLinecap,P.wireframeLinejoin):Ab(P.color);else if(P instanceof THREE.MeshLambertMaterial)ab?!P.wireframe&&P.shading==
+THREE.SmoothShading&&4==l.vertexNormalsWorld.length?(ba.r=ca.r=da.r=ha.r=aa.r,ba.g=ca.g=da.g=ha.g=aa.g,ba.b=ca.b=da.b=ha.b=aa.b,n(i,l.v1.positionWorld,l.vertexNormalsWorld[0],ba),n(i,l.v2.positionWorld,l.vertexNormalsWorld[1],ca),n(i,l.v4.positionWorld,l.vertexNormalsWorld[3],da),n(i,l.v3.positionWorld,l.vertexNormalsWorld[2],ha),ba.r=Math.max(0,Math.min(P.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(P.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(P.color.b*ba.b,1)),ca.r=Math.max(0,Math.min(P.color.r*ca.r,
+1)),ca.g=Math.max(0,Math.min(P.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(P.color.b*ca.b,1)),da.r=Math.max(0,Math.min(P.color.r*da.r,1)),da.g=Math.max(0,Math.min(P.color.g*da.g,1)),da.b=Math.max(0,Math.min(P.color.b*da.b,1)),ha.r=Math.max(0,Math.min(P.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(P.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(P.color.b*ha.b,1)),Ja=vc(ba,ca,da,ha),v(Q,L,G,j,E,S),Yb(Q,L,G,j,E,S,0,0,1,0,0,1,Ja),v(T,R,W,y,ka,ga),Yb(T,R,W,y,ka,ga,1,0,1,1,0,1,Ja)):(V.r=aa.r,V.g=aa.g,V.b=aa.b,n(i,
+l.centroidWorld,l.normalWorld,V),V.r=Math.max(0,Math.min(P.color.r*V.r,1)),V.g=Math.max(0,Math.min(P.color.g*V.g,1)),V.b=Math.max(0,Math.min(P.color.b*V.b,1)),x(Q,L,G,j,W,y,E,S),P.wireframe?Fb(V,P.wireframeLinewidth,P.wireframeLinecap,P.wireframeLinejoin):Ab(V)):(x(Q,L,G,j,W,y,E,S),P.wireframe?Fb(P.color,P.wireframeLinewidth,P.wireframeLinecap,P.wireframeLinejoin):Ab(P.color));else if(P instanceof THREE.MeshNormalMaterial)V.r=Zb(l.normalWorld.x),V.g=Zb(l.normalWorld.y),V.b=Zb(l.normalWorld.z),x(Q,
+L,G,j,W,y,E,S),P.wireframe?Fb(V,P.wireframeLinewidth,P.wireframeLinecap,P.wireframeLinejoin):Ab(V);else if(P instanceof THREE.MeshDepthMaterial)za=k.near,Aa=k.far,ba.r=ba.g=ba.b=1-Tb(a.positionScreen.z,za,Aa),ca.r=ca.g=ca.b=1-Tb(d.positionScreen.z,za,Aa),da.r=da.g=da.b=1-Tb(g.positionScreen.z,za,Aa),ha.r=ha.g=ha.b=1-Tb(e.positionScreen.z,za,Aa),Ja=vc(ba,ca,da,ha),v(Q,L,G,j,E,S),Yb(Q,L,G,j,E,S,0,0,1,0,0,1,Ja),v(T,R,W,y,ka,ga),Yb(T,R,W,y,ka,ga,1,0,1,1,0,1,Ja)}function v(a,b,c,d,e,f){m.beginPath();m.moveTo(a,
+b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(a,b);m.closePath()}function x(a,b,c,d,e,f,g,aa){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,f);m.lineTo(g,aa);m.lineTo(a,b);m.closePath()}function Fb(a,b,c,e){if(B!=b)m.lineWidth=B=b;if(D!=c)m.lineCap=D=c;if(C!=e)m.lineJoin=C=e;d(a.getContextStyle());m.stroke();ja.inflate(2*b)}function Ab(a){e(a.getContextStyle());m.fill()}function Lc(a,b,c,d,f,g,aa,j,h,P,i,l,O){if(0!=O.image.width){if(!0==O.needsUpdate||void 0==Qa[O.id]){var k=O.wrapS==THREE.RepeatWrapping,
+n=O.wrapT==THREE.RepeatWrapping;Qa[O.id]=m.createPattern(O.image,k&&n?"repeat":k&&!n?"repeat-x":!k&&n?"repeat-y":"no-repeat");O.needsUpdate=!1}e(Qa[O.id]);var k=O.offset.x/O.repeat.x,n=O.offset.y/O.repeat.y,q=O.image.width*O.repeat.x,Ea=O.image.height*O.repeat.y,aa=(aa+k)*q,j=(j+n)*Ea,c=c-a,d=d-b,f=f-a,g=g-b,h=(h+k)*q-aa,P=(P+n)*Ea-j,i=(i+k)*q-aa,l=(l+n)*Ea-j,k=h*l-i*P;if(0==k){if(void 0===la[O.id])b=document.createElement("canvas"),b.width=O.image.width,b.height=O.image.height,b=b.getContext("2d"),
+b.drawImage(O.image,0,0),la[O.id]=b.getImageData(0,0,O.image.width,O.image.height).data;b=la[O.id];aa=4*(Math.floor(aa)+Math.floor(j)*O.image.width);V.setRGB(b[aa]/255,b[aa+1]/255,b[aa+2]/255);Ab(V)}else k=1/k,O=(l*c-P*f)*k,P=(l*d-P*g)*k,c=(h*f-i*c)*k,d=(h*g-i*d)*k,a=a-O*aa-c*j,aa=b-P*aa-d*j,m.save(),m.transform(O,P,c,d,a,aa),m.fill(),m.restore()}}function Yb(a,b,c,d,e,f,g,aa,j,h,P,i,O){var l,k;l=O.width-1;k=O.height-1;g*=l;aa*=k;c-=a;d-=b;e-=a;f-=b;j=j*l-g;h=h*k-aa;P=P*l-g;i=i*k-aa;k=1/(j*i-P*h);
+l=(i*c-h*e)*k;h=(i*d-h*f)*k;c=(j*e-P*c)*k;d=(j*f-P*d)*k;a=a-l*g-c*aa;b=b-h*g-d*aa;m.save();m.transform(l,h,c,d,a,b);m.clip();m.drawImage(O,0,0);m.restore()}function vc(a,b,c,d){var e=~~(255*a.r),f=~~(255*a.g),a=~~(255*a.b),g=~~(255*b.r),aa=~~(255*b.g),b=~~(255*b.b),j=~~(255*c.r),h=~~(255*c.g),c=~~(255*c.b),P=~~(255*d.r),i=~~(255*d.g),d=~~(255*d.b);eb[0]=0>e?0:255<e?255:e;eb[1]=0>f?0:255<f?255:f;eb[2]=0>a?0:255<a?255:a;eb[4]=0>g?0:255<g?255:g;eb[5]=0>aa?0:255<aa?255:aa;eb[6]=0>b?0:255<b?255:b;eb[8]=
+0>j?0:255<j?255:j;eb[9]=0>h?0:255<h?255:h;eb[10]=0>c?0:255<c?255:c;eb[12]=0>P?0:255<P?255:P;eb[13]=0>i?0:255<i?255:i;eb[14]=0>d?0:255<d?255:d;hc.putImageData(Kc,0,0);uc.drawImage(gc,0,0);return ic}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 Gb(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 wc,Vc,Na,jb;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;(ab=0<i.length)&&q(i);for(wc=0,Vc=h.length;wc<Vc;wc++)if(Na=h[wc],jb=Na.material,jb=jb instanceof THREE.MeshFaceMaterial?Na.faceMaterial:jb,!(null==jb||0==jb.opacity)){ja.empty();if(Na instanceof THREE.RenderableParticle)A=Na,A.x*=o,A.y*=p,r(A,Na,jb,a);else if(Na instanceof THREE.RenderableLine)A=Na.v1,H=Na.v2,A.positionScreen.x*=o,A.positionScreen.y*=p,H.positionScreen.x*=o,H.positionScreen.y*=p,ja.addPoint(A.positionScreen.x,
+A.positionScreen.y),ja.addPoint(H.positionScreen.x,H.positionScreen.y),ra.intersects(ja)&&s(A,H,Na,jb,a);else if(Na instanceof THREE.RenderableFace3)A=Na.v1,H=Na.v2,I=Na.v3,A.positionScreen.x*=o,A.positionScreen.y*=p,H.positionScreen.x*=o,H.positionScreen.y*=p,I.positionScreen.x*=o,I.positionScreen.y*=p,jb.overdraw&&(Gb(A.positionScreen,H.positionScreen),Gb(H.positionScreen,I.positionScreen),Gb(I.positionScreen,A.positionScreen)),ja.add3Points(A.positionScreen.x,A.positionScreen.y,H.positionScreen.x,
+H.positionScreen.y,I.positionScreen.x,I.positionScreen.y),ra.intersects(ja)&&t(A,H,I,0,1,2,Na,jb,a);else if(Na instanceof THREE.RenderableFace4)A=Na.v1,H=Na.v2,I=Na.v3,N=Na.v4,A.positionScreen.x*=o,A.positionScreen.y*=p,H.positionScreen.x*=o,H.positionScreen.y*=p,I.positionScreen.x*=o,I.positionScreen.y*=p,N.positionScreen.x*=o,N.positionScreen.y*=p,$.positionScreen.copy(H.positionScreen),K.positionScreen.copy(N.positionScreen),jb.overdraw&&(Gb(A.positionScreen,H.positionScreen),Gb(H.positionScreen,
+N.positionScreen),Gb(N.positionScreen,A.positionScreen),Gb(I.positionScreen,$.positionScreen),Gb(I.positionScreen,K.positionScreen)),ja.addPoint(A.positionScreen.x,A.positionScreen.y),ja.addPoint(H.positionScreen.x,H.positionScreen.y),ja.addPoint(I.positionScreen.x,I.positionScreen.y),ja.addPoint(N.positionScreen.x,N.positionScreen.y),ra.intersects(ja)&&u(A,H,I,N,$,K,Na,jb,a);Ba.addRectangle(ja)}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(A.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==H[a]&&(H[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),0==Q&&H[a].setAttribute("shape-rendering","crispEdges"));return H[a]}function c(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}var d=this,e,f,g,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,n,q,o,p,m,r,s=new THREE.Rectangle,t=new THREE.Rectangle,u=!1,v=new THREE.Color,x=new THREE.Color,B=new THREE.Color,D=new THREE.Color,C,A=new THREE.Vector3,H=[],I=[],N,$,K,Q=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
+faces:0}};this.setQuality=function(a){switch(a){case "high":Q=1;break;case "low":Q=0}};this.setSize=function(a,b){l=a;k=b;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(l,k){var j,A,y,E;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(l,k,this.sortElements);f=e.elements;
+g=e.lights;K=$=0;if(u=0<g.length){x.setRGB(0,0,0);B.setRGB(0,0,0);D.setRGB(0,0,0);for(j=0,A=g.length;j<A;j++)E=g[j],y=E.color,E instanceof THREE.AmbientLight?(x.r+=y.r,x.g+=y.g,x.b+=y.b):E instanceof THREE.DirectionalLight?(B.r+=y.r,B.g+=y.g,B.b+=y.b):E instanceof THREE.PointLight&&(D.r+=y.r,D.g+=y.g,D.b+=y.b)}for(j=0,A=f.length;j<A;j++)if(y=f[j],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*=-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 S=p,T=K++;null==I[T]&&(I[T]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==Q&&I[T].setAttribute("shape-rendering","crispEdges"));N=I[T];N.setAttribute("x1",y.positionScreen.x);N.setAttribute("y1",y.positionScreen.y);
+N.setAttribute("x2",S.positionScreen.x);N.setAttribute("y2",S.positionScreen.y);E instanceof THREE.LineBasicMaterial&&(N.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(N))}}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 S=o,T=p,R=m;d.info.render.vertices+=3;d.info.render.faces++;N=b($++);N.setAttribute("d","M "+S.positionScreen.x+" "+S.positionScreen.y+" L "+T.positionScreen.x+" "+T.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+"z");E instanceof THREE.MeshBasicMaterial?v.copy(E.color):E instanceof THREE.MeshLambertMaterial?
+u?(v.r=x.r,v.g=x.g,v.b=x.b,a(g,y.centroidWorld,y.normalWorld,v),v.r=Math.max(0,Math.min(E.color.r*v.r,1)),v.g=Math.max(0,Math.min(E.color.g*v.g,1)),v.b=Math.max(0,Math.min(E.color.b*v.b,1))):v.copy(E.color):E instanceof THREE.MeshDepthMaterial?(C=1-E.__2near/(E.__farPlusNear-y.z*E.__farMinusNear),v.setRGB(C,C,C)):E instanceof THREE.MeshNormalMaterial&&v.setRGB(c(y.normalWorld.x),c(y.normalWorld.y),c(y.normalWorld.z));E.wireframe?N.setAttribute("style","fill: none; stroke: "+v.getContextStyle()+"; stroke-width: "+
+E.wireframeLinewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframeLinecap+"; stroke-linejoin: "+E.wireframeLinejoin):N.setAttribute("style","fill: "+v.getContextStyle()+"; fill-opacity: "+E.opacity);i.appendChild(N)}}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 S=o,T=p,R=m,H=r;d.info.render.vertices+=4;d.info.render.faces++;N=b($++);N.setAttribute("d","M "+S.positionScreen.x+" "+S.positionScreen.y+" L "+T.positionScreen.x+" "+T.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+" L "+H.positionScreen.x+","+H.positionScreen.y+"z");E instanceof THREE.MeshBasicMaterial?
+v.copy(E.color):E instanceof THREE.MeshLambertMaterial?u?(v.r=x.r,v.g=x.g,v.b=x.b,a(g,y.centroidWorld,y.normalWorld,v),v.r=Math.max(0,Math.min(E.color.r*v.r,1)),v.g=Math.max(0,Math.min(E.color.g*v.g,1)),v.b=Math.max(0,Math.min(E.color.b*v.b,1))):v.copy(E.color):E instanceof THREE.MeshDepthMaterial?(C=1-E.__2near/(E.__farPlusNear-y.z*E.__farMinusNear),v.setRGB(C,C,C)):E instanceof THREE.MeshNormalMaterial&&v.setRGB(c(y.normalWorld.x),c(y.normalWorld.y),c(y.normalWorld.z));E.wireframe?N.setAttribute("style",
+"fill: none; stroke: "+v.getContextStyle()+"; stroke-width: "+E.wireframeLinewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframeLinecap+"; stroke-linejoin: "+E.wireframeLinejoin):N.setAttribute("style","fill: "+v.getContextStyle()+"; fill-opacity: "+E.opacity);i.appendChild(N)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
@@ -232,121 +232,122 @@ 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,k=i.length,l=a.__vertexArray,n=a.__colorArray,m=a.__sortArray,q=a.__dirtyVertices,o=a.__dirtyColors,p=a.__webglCustomAttributesList;if(c.sortParticles){Sa.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,Va.copy(e),Sa.multiplyVector3(Va),m[d]=[Va.z,d];m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[m[d][1]].position,f=3*d,l[f]=e.x,l[f+1]=e.y,l[f+2]=e.z;for(d=0;d<k;d++)f=3*d,e=i[m[d][1]],n[f]=e.r,n[f+1]=e.g,n[f+2]=e.b;if(p)for(i=0,k=p.length;i<k;i++)if(h=p[i],
+var i=a.colors,l=i.length,k=a.__vertexArray,n=a.__colorArray,m=a.__sortArray,q=a.__dirtyVertices,o=a.__dirtyColors,p=a.__webglCustomAttributesList;if(c.sortParticles){Wa.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,Xa.copy(e),Wa.multiplyVector3(Xa),m[d]=[Xa.z,d];m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[m[d][1]].position,f=3*d,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[m[d][1]],n[f]=e.r,n[f+1]=e.g,n[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=m[d][1],h.array[d]=h.value[g];else if(2===h.size)for(d=0;d<e;d++)g=m[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<e;d++)g=m[d][1],g=h.value[g],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=m[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=m[d][1],g=h.value[g],
-h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}else{if(q)for(d=0;d<g;d++)e=h[d].position,f=3*d,l[f]=e.x,l[f+1]=e.y,l[f+2]=e.z;if(o)for(d=0;d<k;d++)e=i[d],f=3*d,n[f]=e.r,n[f+1]=e.g,n[f+2]=e.b;if(p)for(i=0,k=p.length;i<k;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,l,b);if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,
-n,b);if(p)for(i=0,k=p.length;i<k;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++)y=null,Q=S=$=ba=T=-1,a[d].render(b,c,Ua,jb),y=null,Q=S=$=ba=T=-1}function k(a,b,c,d,e,f,g,h){var j,i,k,l;b?(i=a.length-1,l=b=-1):(i=0,b=a.length,l=1);for(var n=i;n!==b;n+=l)if(j=a[n],j.render){i=j.object;k=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;g&&
-H.setBlending(j.blending);H.setDepthTest(j.depthTest);H.setDepthWrite(j.depthWrite);s(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}H.setObjectFaces(i);k instanceof THREE.BufferGeometry?H.renderBufferDirect(d,e,f,j,k,i):H.renderBuffer(d,e,f,j,k,i)}}function i(a,b,c,d,e,f,g){for(var h,j,i=0,k=a.length;i<k;i++)if(h=a[i],j=h.object,j.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&H.setBlending(h.blending);H.setDepthTest(h.depthTest);H.setDepthWrite(h.depthWrite);s(h.polygonOffset,h.polygonOffsetFactor,
-h.polygonOffsetUnits)}H.renderImmediateObject(c,d,e,h,j)}}function l(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||H.initMaterial(d,b,c,e);if(d.morphTargets&&
-!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(H.maxMorphTargets);for(var f=0,g=H.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==y&&(j.useProgram(f),y=f,h=!0);if(d.id!==Q)Q=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 k,l=0,n=0,m=0,q,o,p,r=Ca,s=r.directional.colors,t=r.directional.positions,E=r.point.colors,v=r.point.positions,x=r.point.distances,S=0,A=0,C=p=0;for(c=0,h=b.length;c<h;c++)if(k=b[c],!k.onlyShadow)if(q=k.color,o=k.intensity,p=k.distance,k instanceof THREE.AmbientLight)H.gammaInput?(l+=q.r*q.r,n+=q.g*q.g,m+=q.b*q.b):(l+=q.r,n+=q.g,m+=q.b);else if(k instanceof THREE.DirectionalLight)p=3*S,H.gammaInput?
-(s[p]=q.r*q.r*o*o,s[p+1]=q.g*q.g*o*o,s[p+2]=q.b*q.b*o*o):(s[p]=q.r*o,s[p+1]=q.g*o,s[p+2]=q.b*o),Ya.copy(k.matrixWorld.getPosition()),Ya.subSelf(k.target.matrixWorld.getPosition()),Ya.normalize(),t[p]=Ya.x,t[p+1]=Ya.y,t[p+2]=Ya.z,S+=1;else if(k instanceof THREE.PointLight||k instanceof THREE.SpotLight)C=3*A,H.gammaInput?(E[C]=q.r*q.r*o*o,E[C+1]=q.g*q.g*o*o,E[C+2]=q.b*q.b*o*o):(E[C]=q.r*o,E[C+1]=q.g*o,E[C+2]=q.b*o),k=k.matrixWorld.getPosition(),v[C]=k.x,v[C+1]=k.y,v[C+2]=k.z,x[A]=p,A+=1;for(c=3*S,h=
-s.length;c<h;c++)s[c]=0;for(c=3*A,h=E.length;c<h;c++)E[c]=0;r.point.length=A;r.directional.length=S;r.ambient[0]=l;r.ambient[1]=n;r.ambient[2]=m;c=Ca;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,H.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,H.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)H.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(l=b.length;h<l;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],m=h.type,l=h.value,"i"===m)j.uniform1i(n,l);else if("f"===m)j.uniform1f(n,l);else if("v2"===m)j.uniform2f(n,
-l.x,l.y);else if("v3"===m)j.uniform3f(n,l.x,l.y,l.z);else if("v4"===m)j.uniform4f(n,l.x,l.y,l.z,l.w);else if("c"===m)j.uniform3f(n,l.r,l.g,l.b);else if("fv1"===m)j.uniform1fv(n,l);else if("fv"===m)j.uniform3fv(n,l);else if("v2v"===m){if(!h._array)h._array=new Float32Array(2*l.length);for(m=0,r=l.length;m<r;m++)s=2*m,h._array[s]=l[m].x,h._array[s+1]=l[m].y;j.uniform2fv(n,h._array)}else if("v3v"===m){if(!h._array)h._array=new Float32Array(3*l.length);for(m=0,r=l.length;m<r;m++)s=3*m,h._array[s]=l[m].x,
-h._array[s+1]=l[m].y,h._array[s+2]=l[m].z;j.uniform3fv(n,h._array)}else if("v4v"==m){if(!h._array)h._array=new Float32Array(4*l.length);for(m=0,r=l.length;m<r;m++)s=4*m,h._array[s]=l[m].x,h._array[s+1]=l[m].y,h._array[s+2]=l[m].z,h._array[s+3]=l[m].w;j.uniform4fv(n,h._array)}else if("m4"===m){if(!h._array)h._array=new Float32Array(16);l.flattenToArray(h._array);j.uniformMatrix4fv(n,!1,h._array)}else if("m4v"===m){if(!h._array)h._array=new Float32Array(16*l.length);for(m=0,r=l.length;m<r;m++)l[m].flattenToArrayOffset(h._array,
-16*m);j.uniformMatrix4fv(n,!1,h._array)}else if("t"===m){if(j.uniform1i(n,l),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+l);j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);l=[];for(n=0;6>n;n++){m=l;r=n;if(H.autoScaleCubemaps){if(s=h.image[n],E=la,!(s.width<=E&&s.height<=E))v=Math.max(s.width,s.height),t=Math.floor(s.width*
-E/v),E=Math.floor(s.height*E/v),v=document.createElement("canvas"),v.width=t,v.height=E,v.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,t,E),s=v}else s=h.image[n];m[r]=s}n=l[0];m=0===(n.width&n.width-1)&&0===(n.height&n.height-1);r=B(h.format);s=B(h.type);u(j.TEXTURE_CUBE_MAP,h,m);for(n=0;6>n;n++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,r,r,s,l[n]);h.generateMipmaps&&m&&j.generateMipmap(j.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdated)h.onUpdated()}else j.activeTexture(j.TEXTURE0+
-l),j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(h=n,j.activeTexture(j.TEXTURE0+l),j.bindTexture(j.TEXTURE_CUBE_MAP,h.__webglTexture)):H.setTexture(n,l)}else if("tv"===m){if(!h._array){h._array=[];for(m=0,r=h.texture.length;m<r;m++)h._array[m]=l+m}j.uniform1iv(n,h._array);for(m=0,r=h.texture.length;m<r;m++)(n=h.texture[m])&&H.setTexture(n,h._array[m])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&
+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,n[f]=e.r,n[f+1]=e.g,n[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,
+n,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++)R=y=null,S=T=da=ca=ba=-1,a[d].render(b,c,Ta,ib),R=y=null,S=T=da=ca=ba=-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 n=i;n!==b;n+=k)if(j=a[n],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 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!==y&&(j.useProgram(f),y=f,h=!0);if(d.id!==S)S=d.id,h=!0;if(h||a!==R)j.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray),a!==R&&(R=a);if(h){if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof
+THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var l,k=0,n=0,m=0,q,o,p,r=Ba,s=r.directional.colors,t=r.directional.positions,E=r.point.colors,v=r.point.positions,x=r.point.distances,T=0,A=0,C=p=0;for(c=0,h=b.length;c<h;c++)if(l=b[c],!l.onlyShadow)if(q=l.color,o=l.intensity,p=l.distance,l instanceof THREE.AmbientLight)G.gammaInput?(k+=q.r*q.r,n+=q.g*q.g,m+=q.b*q.b):(k+=q.r,n+=q.g,m+=q.b);else if(l instanceof THREE.DirectionalLight)p=
+3*T,G.gammaInput?(s[p]=q.r*q.r*o*o,s[p+1]=q.g*q.g*o*o,s[p+2]=q.b*q.b*o*o):(s[p]=q.r*o,s[p+1]=q.g*o,s[p+2]=q.b*o),ra.copy(l.matrixWorld.getPosition()),ra.subSelf(l.target.matrixWorld.getPosition()),ra.normalize(),t[p]=ra.x,t[p+1]=ra.y,t[p+2]=ra.z,T+=1;else if(l instanceof THREE.PointLight||l instanceof THREE.SpotLight)C=3*A,G.gammaInput?(E[C]=q.r*q.r*o*o,E[C+1]=q.g*q.g*o*o,E[C+2]=q.b*q.b*o*o):(E[C]=q.r*o,E[C+1]=q.g*o,E[C+2]=q.b*o),l=l.matrixWorld.getPosition(),v[C]=l.x,v[C+1]=l.y,v[C+2]=l.z,x[A]=p,
+A+=1;for(c=3*T,h=s.length;c<h;c++)s[c]=0;for(c=3*A,h=E.length;c<h;c++)E[c]=0;r.point.length=A;r.directional.length=T;r.ambient[0]=k;r.ambient[1]=n;r.ambient[2]=m;c=Ba;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||
+d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,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(k=b.length;h<k;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],m=h.type,k=h.value,"i"===m)j.uniform1i(n,k);else if("f"===m)j.uniform1f(n,k);else if("v2"===m)j.uniform2f(n,
+k.x,k.y);else if("v3"===m)j.uniform3f(n,k.x,k.y,k.z);else if("v4"===m)j.uniform4f(n,k.x,k.y,k.z,k.w);else if("c"===m)j.uniform3f(n,k.r,k.g,k.b);else if("fv1"===m)j.uniform1fv(n,k);else if("fv"===m)j.uniform3fv(n,k);else if("v2v"===m){if(!h._array)h._array=new Float32Array(2*k.length);for(m=0,r=k.length;m<r;m++)s=2*m,h._array[s]=k[m].x,h._array[s+1]=k[m].y;j.uniform2fv(n,h._array)}else if("v3v"===m){if(!h._array)h._array=new Float32Array(3*k.length);for(m=0,r=k.length;m<r;m++)s=3*m,h._array[s]=k[m].x,
+h._array[s+1]=k[m].y,h._array[s+2]=k[m].z;j.uniform3fv(n,h._array)}else if("v4v"==m){if(!h._array)h._array=new Float32Array(4*k.length);for(m=0,r=k.length;m<r;m++)s=4*m,h._array[s]=k[m].x,h._array[s+1]=k[m].y,h._array[s+2]=k[m].z,h._array[s+3]=k[m].w;j.uniform4fv(n,h._array)}else if("m4"===m){if(!h._array)h._array=new Float32Array(16);k.flattenToArray(h._array);j.uniformMatrix4fv(n,!1,h._array)}else if("m4v"===m){if(!h._array)h._array=new Float32Array(16*k.length);for(m=0,r=k.length;m<r;m++)k[m].flattenToArrayOffset(h._array,
+16*m);j.uniformMatrix4fv(n,!1,h._array)}else if("t"===m){if(j.uniform1i(n,k),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+k);j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);k=[];for(n=0;6>n;n++){m=k;r=n;if(G.autoScaleCubemaps){if(s=h.image[n],E=ab,!(s.width<=E&&s.height<=E))v=Math.max(s.width,s.height),t=Math.floor(s.width*
+E/v),E=Math.floor(s.height*E/v),v=document.createElement("canvas"),v.width=t,v.height=E,v.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,t,E),s=v}else s=h.image[n];m[r]=s}n=k[0];m=0===(n.width&n.width-1)&&0===(n.height&n.height-1);r=B(h.format);s=B(h.type);u(j.TEXTURE_CUBE_MAP,h,m);for(n=0;6>n;n++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,r,r,s,k[n]);h.generateMipmaps&&m&&j.generateMipmap(j.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdated)h.onUpdated()}else j.activeTexture(j.TEXTURE0+
+k),j.bindTexture(j.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(h=n,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,h.__webglTexture)):G.setTexture(n,k)}else if("tv"===m){if(!h._array){h._array=[];for(m=0,r=h.texture.length;m<r;m++)h._array[m]=k+m}j.uniform1iv(n,h._array);for(m=0,r=h.texture.length;m<r;m++)(n=h.texture[m])&&G.setTexture(n,h._array[m])}(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){da!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),
-da=a);if(a&&(ha!==b||Qa!==c))j.polygonOffset(b,c),ha=b,Qa=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,B(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,B(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,B(b.magFilter)),
+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){ha!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),
+ha=a);if(a&&(Qa!==b||la!==c))j.polygonOffset(b,c),Qa=b,la=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,B(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,B(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,B(b.magFilter)),
 j.texParameteri(a,j.TEXTURE_MIN_FILTER,B(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,x(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,x(b.minFilter)))}function v(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 x(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function B(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"),C=void 0!==a.precision?a.precision:
-"mediump",A=void 0!==a.alpha?a.alpha:!0,F=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,J=void 0!==a.antialias?a.antialias:!1,K=void 0!==a.stencil?a.stencil:!0,Z=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,L=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),O=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 H=this,j,V=[],y=null,E=null,Q=-1,S=null,aa=0,ja=null,ga=null,T=null,ba=null,$=null,da=null,ha=null,
-Qa=null,ka=null,Ba=0,Ga=0,Ia=0,za=0,Ua=0,jb=0,cb=new THREE.Frustum,Sa=new THREE.Matrix4,Va=new THREE.Vector4,Ya=new THREE.Vector3,Ca={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",{alpha:A,premultipliedAlpha:F,antialias:J,stencil:K,preserveDrawingBuffer:Z})))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,O);this.context=j;var ya=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);
-var la=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=function(){return 0<ya};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){Ba=a;Ga=b;Ia=c;za=d;j.viewport(Ba,Ga,Ia,za)};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);O=
-b;j.clearColor(L.r,L.g,L.b,O)};this.setClearColor=function(a,b){L.copy(a);O=b;j.clearColor(L.r,L.g,L.b,O)};this.getClearColor=function(){return L};this.getClearAlpha=function(){return O};this.clear=function(a,b,c){var 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);
-H.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),H.info.memory.geometries--};this.deallocateTexture=
-function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),H.info.memory.textures--};this.updateShadowMap=function(a,b){y=null;Q=S=$=ba=T=-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,k,l,n,m,q=3*a.count;for(m=0;m<q;m+=9)c=a.normalArray,d=c[m],e=c[m+1],f=c[m+2],g=c[m+3],i=c[m+4],l=c[m+5],h=c[m+6],k=c[m+7],n=c[m+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+l+n)/3,c[m]=d,c[m+1]=e,c[m+2]=f,c[m+3]=d,c[m+4]=e,c[m+5]=f,c[m+6]=d,c[m+7]=e,c[m+8]=f}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!==S&&(S=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),H.info.render.calls++,H.info.render.vertices+=f[d].count,H.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!==S&&(S=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=[],k=-1,l=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]>k&&(l=n,k=h[l]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=k;i[l]=
-1;k=-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!==ka&&(j.lineWidth(d),ka=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)),H.info.render.calls++,H.info.render.vertices+=
-e.__webglFaceCount,H.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==ka&&(j.lineWidth(d),ka=d),j.drawArrays(f,0,e.__webglLineCount),H.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),H.info.render.calls++,H.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),H.info.render.calls++)}};this.render=
-function(a,b,c,d){var e,f,l,m,n=a.lights,q=a.fog;Q=-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);H.info.render.calls=0;H.info.render.vertices=0;H.info.render.faces=0;H.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);cb.setFromMatrix(Sa);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],l=f.object,f.render=!1,l.visible&&(!(l instanceof THREE.Mesh||l instanceof THREE.ParticleSystem)||!l.frustumCulled||cb.contains(l))){l.matrixWorld.flattenToArray(l._objectMatrixArray);
-r(l,b);var o=f,p=o.object,t=o.buffer,E=void 0,E=E=void 0,E=p.material;if(E instanceof THREE.MeshFaceMaterial){if(E=t.materialIndex,0<=E)E=p.geometry.materials[E],E.transparent?(o.transparent=E,o.opaque=null):(o.opaque=E,o.transparent=null)}else if(E)E.transparent?(o.transparent=E,o.opaque=null):(o.opaque=E,o.transparent=null);f.render=!0;if(this.sortObjects)l.renderDepth?f.z=l.renderDepth:(Va.copy(l.position),Sa.multiplyVector3(Va),f.z=Va.z)}this.sortObjects&&m.sort(g);m=a.__webglObjectsImmediate;
-for(d=0,e=m.length;d<e;d++)if(f=m[d],l=f.object,l.visible)l.matrixAutoUpdate&&l.matrixWorld.flattenToArray(l._objectMatrixArray),r(l,b),l=f.object.material,l.transparent?(f.transparent=l,f.opaque=null):(f.opaque=l,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),
-k(a.__webglObjects,!1,"",b,n,q,!0,a.overrideMaterial),i(a.__webglObjectsImmediate,"",b,n,q,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),k(a.__webglObjects,!0,"opaque",b,n,q,!1),i(a.__webglObjectsImmediate,"opaque",b,n,q,!1),k(a.__webglObjects,!1,"transparent",b,n,q,!0),i(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);S=-1;H.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,j,cb):e.render(function(a){H.renderBufferImmediate(a,f,d.shading)})};
-this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var g=a.__objectsAdded[0],h=a,i=void 0,k=void 0,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(k=
-g.geometry,k instanceof THREE.Geometry){if(void 0===k.geometryGroups){var r=k,s=void 0,E=void 0,t=void 0,v=void 0,Q=void 0,y=void 0,u=void 0,x={},S=r.morphTargets.length;r.geometryGroups={};for(s=0,E=r.faces.length;s<E;s++)t=r.faces[s],v=t.materialIndex,y=void 0!==v?v:-1,void 0===x[y]&&(x[y]={hash:y,counter:0}),u=x[y].hash+"_"+x[y].counter,void 0===r.geometryGroups[u]&&(r.geometryGroups[u]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:S}),Q=t instanceof THREE.Face3?3:4,65535<r.geometryGroups[u].vertices+
-Q&&(x[y].counter+=1,u=x[y].hash+"_"+x[y].counter,void 0===r.geometryGroups[u]&&(r.geometryGroups[u]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:S})),t instanceof THREE.Face3?r.geometryGroups[u].faces3.push(s):r.geometryGroups[u].faces4.push(s),r.geometryGroups[u].vertices+=Q;r.geometryGroupsList=[];var C=void 0;for(C in r.geometryGroups)r.geometryGroups[C].id=aa++,r.geometryGroupsList.push(r.geometryGroups[C])}for(i in k.geometryGroups)if(m=k.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 B=
-void 0,D=void 0;A.__webglMorphTargetsBuffers=[];for(B=0,D=A.numMorphTargets;B<D;B++)A.__webglMorphTargetsBuffers.push(j.createBuffer())}H.info.memory.geometries++;var F=m,T=g,M=T.geometry,L=F.faces3,J=F.faces4,K=3*L.length+4*J.length,ga=1*L.length+2*J.length,ba=3*L.length+4*J.length,$=c(T,F),O=e($),da=d($),ja=$.vertexColors?$.vertexColors:!1;F.__vertexArray=new Float32Array(3*K);if(da)F.__normalArray=new Float32Array(3*K);if(M.hasTangents)F.__tangentArray=new Float32Array(4*K);if(ja)F.__colorArray=
-new Float32Array(3*K);if(O){if(0<M.faceUvs.length||0<M.faceVertexUvs.length)F.__uvArray=new Float32Array(2*K);if(1<M.faceUvs.length||1<M.faceVertexUvs.length)F.__uv2Array=new Float32Array(2*K)}if(T.geometry.skinWeights.length&&T.geometry.skinIndices.length)F.__skinVertexAArray=new Float32Array(4*K),F.__skinVertexBArray=new Float32Array(4*K),F.__skinIndexArray=new Float32Array(4*K),F.__skinWeightArray=new Float32Array(4*K);F.__faceArray=new Uint16Array(3*ga);F.__lineArray=new Uint16Array(2*ba);if(F.numMorphTargets){F.__morphTargetsArrays=
-[];for(var ha=0,V=F.numMorphTargets;ha<V;ha++)F.__morphTargetsArrays.push(new Float32Array(3*K))}F.__webglFaceCount=3*ga;F.__webglLineCount=2*ba;if($.attributes){if(void 0===F.__webglCustomAttributesList)F.__webglCustomAttributesList=[];var Z=void 0;for(Z in $.attributes){var Qa=$.attributes[Z],ka={},Ba;for(Ba in Qa)ka[Ba]=Qa[Ba];if(!ka.__webglInitialized||ka.createUniqueBuffers){ka.__webglInitialized=!0;var la=1;"v2"===ka.type?la=2:"v3"===ka.type?la=3:"v4"===ka.type?la=4:"c"===ka.type&&(la=3);ka.size=
-la;ka.array=new Float32Array(K*la);ka.buffer=j.createBuffer();ka.buffer.belongsToAttribute=Z;Qa.needsUpdate=!0;ka.__original=Qa}F.__webglCustomAttributesList.push(ka)}}F.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}}else if(g instanceof THREE.Ribbon){if(k=g.geometry,!k.__webglVertexBuffer){var Ga=k;Ga.__webglVertexBuffer=j.createBuffer();Ga.__webglColorBuffer=j.createBuffer();H.info.memory.geometries++;
-var za=k,ya=za.vertices.length;za.__vertexArray=new Float32Array(3*ya);za.__colorArray=new Float32Array(3*ya);za.__webglVertexCount=ya;k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(g instanceof THREE.Line){if(k=g.geometry,!k.__webglVertexBuffer){var Ca=k;Ca.__webglVertexBuffer=j.createBuffer();Ca.__webglColorBuffer=j.createBuffer();H.info.memory.geometries++;var Ia=k,Va=g,Sa=Ia.vertices.length;Ia.__vertexArray=new Float32Array(3*Sa);Ia.__colorArray=new Float32Array(3*Sa);Ia.__webglLineCount=Sa;
-b(Ia,Va);k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(g instanceof THREE.ParticleSystem&&(k=g.geometry,!k.__webglVertexBuffer)){var Ya=k;Ya.__webglVertexBuffer=j.createBuffer();Ya.__webglColorBuffer=j.createBuffer();H.info.geometries++;var Ua=k,jb=g,cb=Ua.vertices.length;Ua.__vertexArray=new Float32Array(3*cb);Ua.__colorArray=new Float32Array(3*cb);Ua.__sortArray=[];Ua.__webglParticleCount=cb;b(Ua,jb);k.__dirtyVertices=!0;k.__dirtyColors=!0}if(!g.__webglActive){if(g instanceof THREE.Mesh)if(k=
-g.geometry,k instanceof THREE.BufferGeometry)l(h.__webglObjects,k,g);else for(i in k.geometryGroups)m=k.geometryGroups[i],l(h.__webglObjects,m,g);else g instanceof THREE.Ribbon||g instanceof THREE.Line||g instanceof THREE.ParticleSystem?(k=g.geometry,l(h.__webglObjects,k,g)):void 0!==THREE.MarchingCubes&&g instanceof THREE.MarchingCubes||g.immediateRenderCallback?h.__webglObjectsImmediate.push({object:g,opaque:null,transparent:null}):g instanceof THREE.Sprite?h.__webglSprites.push(g):g instanceof
-THREE.LensFlare&&h.__webglFlares.push(g);g.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var eb=a.__objectsRemoved[0],xc=a;eb instanceof THREE.Mesh||eb instanceof THREE.ParticleSystem||eb instanceof THREE.Ribbon||eb instanceof THREE.Line?o(xc.__webglObjects,eb):eb instanceof THREE.Sprite?p(xc.__webglSprites,eb):eb instanceof THREE.LensFlare?p(xc.__webglFlares,eb):(eb instanceof THREE.MarchingCubes||eb.immediateRenderCallback)&&o(xc.__webglObjectsImmediate,eb);eb.__webglActive=
-!1;a.__objectsRemoved.splice(0,1)}for(var Nc=0,id=a.__webglObjects.length;Nc<id;Nc++){var kb=a.__webglObjects[Nc].object,ia=kb.geometry,jc=void 0,$b=void 0,Wa=void 0;if(kb 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 Oc=0,jd=ia.geometryGroupsList.length;Oc<jd;Oc++)if(jc=ia.geometryGroupsList[Oc],Wa=c(kb,jc),$b=Wa.attributes&&n(Wa),ia.__dirtyVertices||ia.__dirtyMorphTargets||
-ia.__dirtyElements||ia.__dirtyUvs||ia.__dirtyNormals||ia.__dirtyColors||ia.__dirtyTangents||$b){var ea=jc,kd=kb,ab=j.DYNAMIC_DRAW,ld=!ia.dynamic,yc=Wa;if(ea.__inittedArrays){var Xc=d(yc),Pc=yc.vertexColors?yc.vertexColors:!1,Yc=e(yc),Zc=Xc===THREE.SmoothShading,G=void 0,U=void 0,ib=void 0,N=void 0,ac=void 0,Gb=void 0,lb=void 0,zc=void 0,Ab=void 0,bc=void 0,cc=void 0,W=void 0,X=void 0,Y=void 0,pa=void 0,mb=void 0,nb=void 0,ob=void 0,kc=void 0,pb=void 0,qb=void 0,rb=void 0,lc=void 0,sb=void 0,tb=void 0,
-ub=void 0,mc=void 0,vb=void 0,wb=void 0,xb=void 0,nc=void 0,Hb=void 0,Ib=void 0,Jb=void 0,Ac=void 0,Kb=void 0,Lb=void 0,Mb=void 0,Bc=void 0,ma=void 0,$c=void 0,Nb=void 0,dc=void 0,ec=void 0,bb=void 0,ad=void 0,Ja=void 0,Aa=0,Ha=0,Bb=0,Cb=0,fb=0,Pa=0,qa=0,Ra=0,Da=0,I=0,Ea=0,z=0,Za=void 0,La=ea.__vertexArray,oc=ea.__uvArray,pc=ea.__uv2Array,gb=ea.__normalArray,sa=ea.__tangentArray,Ma=ea.__colorArray,ta=ea.__skinVertexAArray,ua=ea.__skinVertexBArray,va=ea.__skinIndexArray,wa=ea.__skinWeightArray,Qc=
-ea.__morphTargetsArrays,Rc=ea.__webglCustomAttributesList,w=void 0,yb=ea.__faceArray,$a=ea.__lineArray,Ta=kd.geometry,md=Ta.__dirtyElements,bd=Ta.__dirtyUvs,nd=Ta.__dirtyNormals,od=Ta.__dirtyTangents,pd=Ta.__dirtyColors,qd=Ta.__dirtyMorphTargets,Ub=Ta.vertices,na=ea.faces3,oa=ea.faces4,Fa=Ta.faces,Sc=Ta.faceVertexUvs[0],Tc=Ta.faceVertexUvs[1],Vb=Ta.skinVerticesA,Wb=Ta.skinVerticesB,Xb=Ta.skinIndices,Ob=Ta.skinWeights,Pb=Ta.morphTargets;if(Ta.__dirtyVertices){for(G=0,U=na.length;G<U;G++)N=Fa[na[G]],
-W=Ub[N.a].position,X=Ub[N.b].position,Y=Ub[N.c].position,La[Ha]=W.x,La[Ha+1]=W.y,La[Ha+2]=W.z,La[Ha+3]=X.x,La[Ha+4]=X.y,La[Ha+5]=X.z,La[Ha+6]=Y.x,La[Ha+7]=Y.y,La[Ha+8]=Y.z,Ha+=9;for(G=0,U=oa.length;G<U;G++)N=Fa[oa[G]],W=Ub[N.a].position,X=Ub[N.b].position,Y=Ub[N.c].position,pa=Ub[N.d].position,La[Ha]=W.x,La[Ha+1]=W.y,La[Ha+2]=W.z,La[Ha+3]=X.x,La[Ha+4]=X.y,La[Ha+5]=X.z,La[Ha+6]=Y.x,La[Ha+7]=Y.y,La[Ha+8]=Y.z,La[Ha+9]=pa.x,La[Ha+10]=pa.y,La[Ha+11]=pa.z,Ha+=12;j.bindBuffer(j.ARRAY_BUFFER,ea.__webglVertexBuffer);
-j.bufferData(j.ARRAY_BUFFER,La,ab)}if(qd)for(bb=0,ad=Pb.length;bb<ad;bb++){Ea=0;for(G=0,U=na.length;G<U;G++)N=Fa[na[G]],W=Pb[bb].vertices[N.a].position,X=Pb[bb].vertices[N.b].position,Y=Pb[bb].vertices[N.c].position,Ja=Qc[bb],Ja[Ea]=W.x,Ja[Ea+1]=W.y,Ja[Ea+2]=W.z,Ja[Ea+3]=X.x,Ja[Ea+4]=X.y,Ja[Ea+5]=X.z,Ja[Ea+6]=Y.x,Ja[Ea+7]=Y.y,Ja[Ea+8]=Y.z,Ea+=9;for(G=0,U=oa.length;G<U;G++)N=Fa[oa[G]],W=Pb[bb].vertices[N.a].position,X=Pb[bb].vertices[N.b].position,Y=Pb[bb].vertices[N.c].position,pa=Pb[bb].vertices[N.d].position,
-Ja=Qc[bb],Ja[Ea]=W.x,Ja[Ea+1]=W.y,Ja[Ea+2]=W.z,Ja[Ea+3]=X.x,Ja[Ea+4]=X.y,Ja[Ea+5]=X.z,Ja[Ea+6]=Y.x,Ja[Ea+7]=Y.y,Ja[Ea+8]=Y.z,Ja[Ea+9]=pa.x,Ja[Ea+10]=pa.y,Ja[Ea+11]=pa.z,Ea+=12;j.bindBuffer(j.ARRAY_BUFFER,ea.__webglMorphTargetsBuffers[bb]);j.bufferData(j.ARRAY_BUFFER,Qc[bb],ab)}if(Ob.length){for(G=0,U=na.length;G<U;G++)N=Fa[na[G]],sb=Ob[N.a],tb=Ob[N.b],ub=Ob[N.c],wa[I]=sb.x,wa[I+1]=sb.y,wa[I+2]=sb.z,wa[I+3]=sb.w,wa[I+4]=tb.x,wa[I+5]=tb.y,wa[I+6]=tb.z,wa[I+7]=tb.w,wa[I+8]=ub.x,wa[I+9]=ub.y,wa[I+10]=
-ub.z,wa[I+11]=ub.w,vb=Xb[N.a],wb=Xb[N.b],xb=Xb[N.c],va[I]=vb.x,va[I+1]=vb.y,va[I+2]=vb.z,va[I+3]=vb.w,va[I+4]=wb.x,va[I+5]=wb.y,va[I+6]=wb.z,va[I+7]=wb.w,va[I+8]=xb.x,va[I+9]=xb.y,va[I+10]=xb.z,va[I+11]=xb.w,Hb=Vb[N.a],Ib=Vb[N.b],Jb=Vb[N.c],ta[I]=Hb.x,ta[I+1]=Hb.y,ta[I+2]=Hb.z,ta[I+3]=1,ta[I+4]=Ib.x,ta[I+5]=Ib.y,ta[I+6]=Ib.z,ta[I+7]=1,ta[I+8]=Jb.x,ta[I+9]=Jb.y,ta[I+10]=Jb.z,ta[I+11]=1,Kb=Wb[N.a],Lb=Wb[N.b],Mb=Wb[N.c],ua[I]=Kb.x,ua[I+1]=Kb.y,ua[I+2]=Kb.z,ua[I+3]=1,ua[I+4]=Lb.x,ua[I+5]=Lb.y,ua[I+6]=
-Lb.z,ua[I+7]=1,ua[I+8]=Mb.x,ua[I+9]=Mb.y,ua[I+10]=Mb.z,ua[I+11]=1,I+=12;for(G=0,U=oa.length;G<U;G++)N=Fa[oa[G]],sb=Ob[N.a],tb=Ob[N.b],ub=Ob[N.c],mc=Ob[N.d],wa[I]=sb.x,wa[I+1]=sb.y,wa[I+2]=sb.z,wa[I+3]=sb.w,wa[I+4]=tb.x,wa[I+5]=tb.y,wa[I+6]=tb.z,wa[I+7]=tb.w,wa[I+8]=ub.x,wa[I+9]=ub.y,wa[I+10]=ub.z,wa[I+11]=ub.w,wa[I+12]=mc.x,wa[I+13]=mc.y,wa[I+14]=mc.z,wa[I+15]=mc.w,vb=Xb[N.a],wb=Xb[N.b],xb=Xb[N.c],nc=Xb[N.d],va[I]=vb.x,va[I+1]=vb.y,va[I+2]=vb.z,va[I+3]=vb.w,va[I+4]=wb.x,va[I+5]=wb.y,va[I+6]=wb.z,
-va[I+7]=wb.w,va[I+8]=xb.x,va[I+9]=xb.y,va[I+10]=xb.z,va[I+11]=xb.w,va[I+12]=nc.x,va[I+13]=nc.y,va[I+14]=nc.z,va[I+15]=nc.w,Hb=Vb[N.a],Ib=Vb[N.b],Jb=Vb[N.c],Ac=Vb[N.d],ta[I]=Hb.x,ta[I+1]=Hb.y,ta[I+2]=Hb.z,ta[I+3]=1,ta[I+4]=Ib.x,ta[I+5]=Ib.y,ta[I+6]=Ib.z,ta[I+7]=1,ta[I+8]=Jb.x,ta[I+9]=Jb.y,ta[I+10]=Jb.z,ta[I+11]=1,ta[I+12]=Ac.x,ta[I+13]=Ac.y,ta[I+14]=Ac.z,ta[I+15]=1,Kb=Wb[N.a],Lb=Wb[N.b],Mb=Wb[N.c],Bc=Wb[N.d],ua[I]=Kb.x,ua[I+1]=Kb.y,ua[I+2]=Kb.z,ua[I+3]=1,ua[I+4]=Lb.x,ua[I+5]=Lb.y,ua[I+6]=Lb.z,ua[I+
-7]=1,ua[I+8]=Mb.x,ua[I+9]=Mb.y,ua[I+10]=Mb.z,ua[I+11]=1,ua[I+12]=Bc.x,ua[I+13]=Bc.y,ua[I+14]=Bc.z,ua[I+15]=1,I+=16;0<I&&(j.bindBuffer(j.ARRAY_BUFFER,ea.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,ta,ab),j.bindBuffer(j.ARRAY_BUFFER,ea.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,ua,ab),j.bindBuffer(j.ARRAY_BUFFER,ea.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,va,ab),j.bindBuffer(j.ARRAY_BUFFER,ea.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,wa,ab))}if(pd&&Pc){for(G=
-0,U=na.length;G<U;G++)N=Fa[na[G]],lb=N.vertexColors,zc=N.color,3===lb.length&&Pc===THREE.VertexColors?(pb=lb[0],qb=lb[1],rb=lb[2]):rb=qb=pb=zc,Ma[Da]=pb.r,Ma[Da+1]=pb.g,Ma[Da+2]=pb.b,Ma[Da+3]=qb.r,Ma[Da+4]=qb.g,Ma[Da+5]=qb.b,Ma[Da+6]=rb.r,Ma[Da+7]=rb.g,Ma[Da+8]=rb.b,Da+=9;for(G=0,U=oa.length;G<U;G++)N=Fa[oa[G]],lb=N.vertexColors,zc=N.color,4===lb.length&&Pc===THREE.VertexColors?(pb=lb[0],qb=lb[1],rb=lb[2],lc=lb[3]):lc=rb=qb=pb=zc,Ma[Da]=pb.r,Ma[Da+1]=pb.g,Ma[Da+2]=pb.b,Ma[Da+3]=qb.r,Ma[Da+4]=qb.g,
-Ma[Da+5]=qb.b,Ma[Da+6]=rb.r,Ma[Da+7]=rb.g,Ma[Da+8]=rb.b,Ma[Da+9]=lc.r,Ma[Da+10]=lc.g,Ma[Da+11]=lc.b,Da+=12;0<Da&&(j.bindBuffer(j.ARRAY_BUFFER,ea.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Ma,ab))}if(od&&Ta.hasTangents){for(G=0,U=na.length;G<U;G++)N=Fa[na[G]],Ab=N.vertexTangents,mb=Ab[0],nb=Ab[1],ob=Ab[2],sa[qa]=mb.x,sa[qa+1]=mb.y,sa[qa+2]=mb.z,sa[qa+3]=mb.w,sa[qa+4]=nb.x,sa[qa+5]=nb.y,sa[qa+6]=nb.z,sa[qa+7]=nb.w,sa[qa+8]=ob.x,sa[qa+9]=ob.y,sa[qa+10]=ob.z,sa[qa+11]=ob.w,qa+=12;for(G=0,U=oa.length;G<
-U;G++)N=Fa[oa[G]],Ab=N.vertexTangents,mb=Ab[0],nb=Ab[1],ob=Ab[2],kc=Ab[3],sa[qa]=mb.x,sa[qa+1]=mb.y,sa[qa+2]=mb.z,sa[qa+3]=mb.w,sa[qa+4]=nb.x,sa[qa+5]=nb.y,sa[qa+6]=nb.z,sa[qa+7]=nb.w,sa[qa+8]=ob.x,sa[qa+9]=ob.y,sa[qa+10]=ob.z,sa[qa+11]=ob.w,sa[qa+12]=kc.x,sa[qa+13]=kc.y,sa[qa+14]=kc.z,sa[qa+15]=kc.w,qa+=16;j.bindBuffer(j.ARRAY_BUFFER,ea.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,sa,ab)}if(nd&&Xc){for(G=0,U=na.length;G<U;G++)if(N=Fa[na[G]],ac=N.vertexNormals,Gb=N.normal,3===ac.length&&Zc)for(ma=
-0;3>ma;ma++)Nb=ac[ma],gb[Pa]=Nb.x,gb[Pa+1]=Nb.y,gb[Pa+2]=Nb.z,Pa+=3;else for(ma=0;3>ma;ma++)gb[Pa]=Gb.x,gb[Pa+1]=Gb.y,gb[Pa+2]=Gb.z,Pa+=3;for(G=0,U=oa.length;G<U;G++)if(N=Fa[oa[G]],ac=N.vertexNormals,Gb=N.normal,4===ac.length&&Zc)for(ma=0;4>ma;ma++)Nb=ac[ma],gb[Pa]=Nb.x,gb[Pa+1]=Nb.y,gb[Pa+2]=Nb.z,Pa+=3;else for(ma=0;4>ma;ma++)gb[Pa]=Gb.x,gb[Pa+1]=Gb.y,gb[Pa+2]=Gb.z,Pa+=3;j.bindBuffer(j.ARRAY_BUFFER,ea.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,gb,ab)}if(bd&&Sc&&Yc){for(G=0,U=na.length;G<U;G++)if(ib=
-na[G],N=Fa[ib],bc=Sc[ib],void 0!==bc)for(ma=0;3>ma;ma++)dc=bc[ma],oc[Bb]=dc.u,oc[Bb+1]=dc.v,Bb+=2;for(G=0,U=oa.length;G<U;G++)if(ib=oa[G],N=Fa[ib],bc=Sc[ib],void 0!==bc)for(ma=0;4>ma;ma++)dc=bc[ma],oc[Bb]=dc.u,oc[Bb+1]=dc.v,Bb+=2;0<Bb&&(j.bindBuffer(j.ARRAY_BUFFER,ea.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,oc,ab))}if(bd&&Tc&&Yc){for(G=0,U=na.length;G<U;G++)if(ib=na[G],N=Fa[ib],cc=Tc[ib],void 0!==cc)for(ma=0;3>ma;ma++)ec=cc[ma],pc[Cb]=ec.u,pc[Cb+1]=ec.v,Cb+=2;for(G=0,U=oa.length;G<U;G++)if(ib=
-oa[G],N=Fa[ib],cc=Tc[ib],void 0!==cc)for(ma=0;4>ma;ma++)ec=cc[ma],pc[Cb]=ec.u,pc[Cb+1]=ec.v,Cb+=2;0<Cb&&(j.bindBuffer(j.ARRAY_BUFFER,ea.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,pc,ab))}if(md){for(G=0,U=na.length;G<U;G++)N=Fa[na[G]],yb[fb]=Aa,yb[fb+1]=Aa+1,yb[fb+2]=Aa+2,fb+=3,$a[Ra]=Aa,$a[Ra+1]=Aa+1,$a[Ra+2]=Aa,$a[Ra+3]=Aa+2,$a[Ra+4]=Aa+1,$a[Ra+5]=Aa+2,Ra+=6,Aa+=3;for(G=0,U=oa.length;G<U;G++)N=Fa[oa[G]],yb[fb]=Aa,yb[fb+1]=Aa+1,yb[fb+2]=Aa+3,yb[fb+3]=Aa+1,yb[fb+4]=Aa+2,yb[fb+5]=Aa+3,fb+=6,$a[Ra]=
-Aa,$a[Ra+1]=Aa+1,$a[Ra+2]=Aa,$a[Ra+3]=Aa+3,$a[Ra+4]=Aa+1,$a[Ra+5]=Aa+2,$a[Ra+6]=Aa+2,$a[Ra+7]=Aa+3,Ra+=8,Aa+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ea.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,yb,ab);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ea.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,$a,ab)}if(Rc)for(ma=0,$c=Rc.length;ma<$c;ma++)if(w=Rc[ma],w.__original.needsUpdate){z=0;if(1===w.size)if(void 0===w.boundTo||"vertices"===w.boundTo){for(G=0,U=na.length;G<U;G++)N=Fa[na[G]],w.array[z]=
-w.value[N.a],w.array[z+1]=w.value[N.b],w.array[z+2]=w.value[N.c],z+=3;for(G=0,U=oa.length;G<U;G++)N=Fa[oa[G]],w.array[z]=w.value[N.a],w.array[z+1]=w.value[N.b],w.array[z+2]=w.value[N.c],w.array[z+3]=w.value[N.d],z+=4}else{if("faces"===w.boundTo){for(G=0,U=na.length;G<U;G++)Za=w.value[na[G]],w.array[z]=Za,w.array[z+1]=Za,w.array[z+2]=Za,z+=3;for(G=0,U=oa.length;G<U;G++)Za=w.value[oa[G]],w.array[z]=Za,w.array[z+1]=Za,w.array[z+2]=Za,w.array[z+3]=Za,z+=4}}else if(2===w.size)if(void 0===w.boundTo||"vertices"===
-w.boundTo){for(G=0,U=na.length;G<U;G++)N=Fa[na[G]],W=w.value[N.a],X=w.value[N.b],Y=w.value[N.c],w.array[z]=W.x,w.array[z+1]=W.y,w.array[z+2]=X.x,w.array[z+3]=X.y,w.array[z+4]=Y.x,w.array[z+5]=Y.y,z+=6;for(G=0,U=oa.length;G<U;G++)N=Fa[oa[G]],W=w.value[N.a],X=w.value[N.b],Y=w.value[N.c],pa=w.value[N.d],w.array[z]=W.x,w.array[z+1]=W.y,w.array[z+2]=X.x,w.array[z+3]=X.y,w.array[z+4]=Y.x,w.array[z+5]=Y.y,w.array[z+6]=pa.x,w.array[z+7]=pa.y,z+=8}else{if("faces"===w.boundTo){for(G=0,U=na.length;G<U;G++)Y=
-X=W=Za=w.value[na[G]],w.array[z]=W.x,w.array[z+1]=W.y,w.array[z+2]=X.x,w.array[z+3]=X.y,w.array[z+4]=Y.x,w.array[z+5]=Y.y,z+=6;for(G=0,U=oa.length;G<U;G++)pa=Y=X=W=Za=w.value[oa[G]],w.array[z]=W.x,w.array[z+1]=W.y,w.array[z+2]=X.x,w.array[z+3]=X.y,w.array[z+4]=Y.x,w.array[z+5]=Y.y,w.array[z+6]=pa.x,w.array[z+7]=pa.y,z+=8}}else if(3===w.size){var fa;fa="c"===w.type?["r","g","b"]:["x","y","z"];if(void 0===w.boundTo||"vertices"===w.boundTo){for(G=0,U=na.length;G<U;G++)N=Fa[na[G]],W=w.value[N.a],X=w.value[N.b],
-Y=w.value[N.c],w.array[z]=W[fa[0]],w.array[z+1]=W[fa[1]],w.array[z+2]=W[fa[2]],w.array[z+3]=X[fa[0]],w.array[z+4]=X[fa[1]],w.array[z+5]=X[fa[2]],w.array[z+6]=Y[fa[0]],w.array[z+7]=Y[fa[1]],w.array[z+8]=Y[fa[2]],z+=9;for(G=0,U=oa.length;G<U;G++)N=Fa[oa[G]],W=w.value[N.a],X=w.value[N.b],Y=w.value[N.c],pa=w.value[N.d],w.array[z]=W[fa[0]],w.array[z+1]=W[fa[1]],w.array[z+2]=W[fa[2]],w.array[z+3]=X[fa[0]],w.array[z+4]=X[fa[1]],w.array[z+5]=X[fa[2]],w.array[z+6]=Y[fa[0]],w.array[z+7]=Y[fa[1]],w.array[z+
-8]=Y[fa[2]],w.array[z+9]=pa[fa[0]],w.array[z+10]=pa[fa[1]],w.array[z+11]=pa[fa[2]],z+=12}else if("faces"===w.boundTo){for(G=0,U=na.length;G<U;G++)Y=X=W=Za=w.value[na[G]],w.array[z]=W[fa[0]],w.array[z+1]=W[fa[1]],w.array[z+2]=W[fa[2]],w.array[z+3]=X[fa[0]],w.array[z+4]=X[fa[1]],w.array[z+5]=X[fa[2]],w.array[z+6]=Y[fa[0]],w.array[z+7]=Y[fa[1]],w.array[z+8]=Y[fa[2]],z+=9;for(G=0,U=oa.length;G<U;G++)pa=Y=X=W=Za=w.value[oa[G]],w.array[z]=W[fa[0]],w.array[z+1]=W[fa[1]],w.array[z+2]=W[fa[2]],w.array[z+3]=
-X[fa[0]],w.array[z+4]=X[fa[1]],w.array[z+5]=X[fa[2]],w.array[z+6]=Y[fa[0]],w.array[z+7]=Y[fa[1]],w.array[z+8]=Y[fa[2]],w.array[z+9]=pa[fa[0]],w.array[z+10]=pa[fa[1]],w.array[z+11]=pa[fa[2]],z+=12}}else if(4===w.size)if(void 0===w.boundTo||"vertices"===w.boundTo){for(G=0,U=na.length;G<U;G++)N=Fa[na[G]],W=w.value[N.a],X=w.value[N.b],Y=w.value[N.c],w.array[z]=W.x,w.array[z+1]=W.y,w.array[z+2]=W.z,w.array[z+3]=W.w,w.array[z+4]=X.x,w.array[z+5]=X.y,w.array[z+6]=X.z,w.array[z+7]=X.w,w.array[z+8]=Y.x,w.array[z+
-9]=Y.y,w.array[z+10]=Y.z,w.array[z+11]=Y.w,z+=12;for(G=0,U=oa.length;G<U;G++)N=Fa[oa[G]],W=w.value[N.a],X=w.value[N.b],Y=w.value[N.c],pa=w.value[N.d],w.array[z]=W.x,w.array[z+1]=W.y,w.array[z+2]=W.z,w.array[z+3]=W.w,w.array[z+4]=X.x,w.array[z+5]=X.y,w.array[z+6]=X.z,w.array[z+7]=X.w,w.array[z+8]=Y.x,w.array[z+9]=Y.y,w.array[z+10]=Y.z,w.array[z+11]=Y.w,w.array[z+12]=pa.x,w.array[z+13]=pa.y,w.array[z+14]=pa.z,w.array[z+15]=pa.w,z+=16}else if("faces"===w.boundTo){for(G=0,U=na.length;G<U;G++)Y=X=W=Za=
-w.value[na[G]],w.array[z]=W.x,w.array[z+1]=W.y,w.array[z+2]=W.z,w.array[z+3]=W.w,w.array[z+4]=X.x,w.array[z+5]=X.y,w.array[z+6]=X.z,w.array[z+7]=X.w,w.array[z+8]=Y.x,w.array[z+9]=Y.y,w.array[z+10]=Y.z,w.array[z+11]=Y.w,z+=12;for(G=0,U=oa.length;G<U;G++)pa=Y=X=W=Za=w.value[oa[G]],w.array[z]=W.x,w.array[z+1]=W.y,w.array[z+2]=W.z,w.array[z+3]=W.w,w.array[z+4]=X.x,w.array[z+5]=X.y,w.array[z+6]=X.z,w.array[z+7]=X.w,w.array[z+8]=Y.x,w.array[z+9]=Y.y,w.array[z+10]=Y.z,w.array[z+11]=Y.w,w.array[z+12]=pa.x,
-w.array[z+13]=pa.y,w.array[z+14]=pa.z,w.array[z+15]=pa.w,z+=16}j.bindBuffer(j.ARRAY_BUFFER,w.buffer);j.bufferData(j.ARRAY_BUFFER,w.array,ab)}ld&&(delete ea.__inittedArrays,delete ea.__colorArray,delete ea.__normalArray,delete ea.__tangentArray,delete ea.__uvArray,delete ea.__uv2Array,delete ea.__faceArray,delete ea.__vertexArray,delete ea.__lineArray,delete ea.__skinVertexAArray,delete ea.__skinVertexBArray,delete ea.__skinIndexArray,delete ea.__skinWeightArray)}}ia.__dirtyVertices=!1;ia.__dirtyMorphTargets=
-!1;ia.__dirtyElements=!1;ia.__dirtyUvs=!1;ia.__dirtyNormals=!1;ia.__dirtyColors=!1;ia.__dirtyTangents=!1;Wa.attributes&&q(Wa)}else if(kb instanceof THREE.Ribbon){if(ia.__dirtyVertices||ia.__dirtyColors){var Qb=ia,cd=j.DYNAMIC_DRAW,qc=void 0,rc=void 0,Cc=void 0,Rb=void 0,Dc=void 0,dd=Qb.vertices,ed=Qb.colors,rd=dd.length,sd=ed.length,Ec=Qb.__vertexArray,Fc=Qb.__colorArray,td=Qb.__dirtyColors;if(Qb.__dirtyVertices){for(qc=0;qc<rd;qc++)Cc=dd[qc].position,Rb=3*qc,Ec[Rb]=Cc.x,Ec[Rb+1]=Cc.y,Ec[Rb+2]=Cc.z;
-j.bindBuffer(j.ARRAY_BUFFER,Qb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Ec,cd)}if(td){for(rc=0;rc<sd;rc++)Dc=ed[rc],Rb=3*rc,Fc[Rb]=Dc.r,Fc[Rb+1]=Dc.g,Fc[Rb+2]=Dc.b;j.bindBuffer(j.ARRAY_BUFFER,Qb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Fc,cd)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1}else if(kb instanceof THREE.Line){Wa=c(kb,jc);$b=Wa.attributes&&n(Wa);if(ia.__dirtyVertices||ia.__dirtyColors||$b){var Db=ia,Uc=j.DYNAMIC_DRAW,sc=void 0,tc=void 0,Gc=void 0,xa=void 0,Hc=void 0,fd=Db.vertices,
-gd=Db.colors,ud=fd.length,vd=gd.length,Ic=Db.__vertexArray,Jc=Db.__colorArray,wd=Db.__dirtyColors,Vc=Db.__webglCustomAttributesList,Kc=void 0,hd=void 0,Oa=void 0,fc=void 0,Xa=void 0,ra=void 0;if(Db.__dirtyVertices){for(sc=0;sc<ud;sc++)Gc=fd[sc].position,xa=3*sc,Ic[xa]=Gc.x,Ic[xa+1]=Gc.y,Ic[xa+2]=Gc.z;j.bindBuffer(j.ARRAY_BUFFER,Db.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Ic,Uc)}if(wd){for(tc=0;tc<vd;tc++)Hc=gd[tc],xa=3*tc,Jc[xa]=Hc.r,Jc[xa+1]=Hc.g,Jc[xa+2]=Hc.b;j.bindBuffer(j.ARRAY_BUFFER,
-Db.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Jc,Uc)}if(Vc)for(Kc=0,hd=Vc.length;Kc<hd;Kc++)if(ra=Vc[Kc],ra.needsUpdate&&(void 0===ra.boundTo||"vertices"===ra.boundTo)){xa=0;fc=ra.value.length;if(1===ra.size)for(Oa=0;Oa<fc;Oa++)ra.array[Oa]=ra.value[Oa];else if(2===ra.size)for(Oa=0;Oa<fc;Oa++)Xa=ra.value[Oa],ra.array[xa]=Xa.x,ra.array[xa+1]=Xa.y,xa+=2;else if(3===ra.size)if("c"===ra.type)for(Oa=0;Oa<fc;Oa++)Xa=ra.value[Oa],ra.array[xa]=Xa.r,ra.array[xa+1]=Xa.g,ra.array[xa+2]=Xa.b,xa+=3;else for(Oa=
-0;Oa<fc;Oa++)Xa=ra.value[Oa],ra.array[xa]=Xa.x,ra.array[xa+1]=Xa.y,ra.array[xa+2]=Xa.z,xa+=3;else if(4===ra.size)for(Oa=0;Oa<fc;Oa++)Xa=ra.value[Oa],ra.array[xa]=Xa.x,ra.array[xa+1]=Xa.y,ra.array[xa+2]=Xa.z,ra.array[xa+3]=Xa.w,xa+=4;j.bindBuffer(j.ARRAY_BUFFER,ra.buffer);j.bufferData(j.ARRAY_BUFFER,ra.array,Uc)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1;Wa.attributes&&q(Wa)}else if(kb instanceof THREE.ParticleSystem)Wa=c(kb,jc),$b=Wa.attributes&&n(Wa),(ia.__dirtyVertices||ia.__dirtyColors||kb.sortParticles||
-$b)&&f(ia,j.DYNAMIC_DRAW,kb),ia.__dirtyVertices=!1,ia.__dirtyColors=!1,Wa.attributes&&q(Wa)}};this.initMaterial=function(a,b,c,d){var e,f,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var k=
-THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var l,m;f=k=0;for(l=0,m=b.length;l<m;l++)e=b[l],e.onlyShadow||(e instanceof THREE.DirectionalLight&&f++,e instanceof THREE.PointLight&&k++,e instanceof THREE.SpotLight&&k++);k+f<=M?l=f:(l=Math.ceil(M*f/(k+f)),k=M-l);e=l;f=k;var n=0;for(k=0,l=b.length;k<l;k++)m=b[k],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:{l=a.fragmentShader;m=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: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(l),d.push(m));for(p in c)d.push(p),d.push(c[p]);i=d.join();for(p=0,d=V.length;p<d;p++)if(V[p].code===i){o=V[p].program;break a}p=j.createProgram();d=[0<ya?"#define VERTEX_TEXTURES":"",H.gammaInput?"#define GAMMA_INPUT":"",H.gammaOutput?"#define GAMMA_OUTPUT":"",H.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 "+C+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",H.gammaInput?"#define GAMMA_INPUT":"",H.gammaOutput?"#define GAMMA_OUTPUT":"",H.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(p,t("fragment",e+l));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 k)d.push(r);r=d;for(d=0,k=r.length;d<k;d++)l=r[d],p.uniforms[l]=j.getUniformLocation(p,l);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(r=0;r<c.maxMorphTargets;r++)d.push("morphTarget"+
-r);for(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=V.length;V.push({program:p,code:i});H.info.memory.programs=V.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),
+"mediump",A=void 0!==a.alpha?a.alpha:!0,H=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,I=void 0!==a.antialias?a.antialias:!1,N=void 0!==a.stencil?a.stencil:!0,$=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,K=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),Q=void 0!==a.clearAlpha?a.clearAlpha:0,L=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,W=[],y=null,E=null,S=-1,T=null,R=null,ka=0,ga=null,V=null,ba=null,ca=null,da=null,ha=null,
+Qa=null,la=null,za=null,Aa=0,Ja=0,Da=0,$a=0,Ta=0,ib=0,db=new THREE.Frustum,Wa=new THREE.Matrix4,Xa=new THREE.Vector4,ra=new THREE.Vector3,Ba={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};j=function(){var a;try{if(!(a=D.getContext("experimental-webgl",{alpha:A,premultipliedAlpha:H,antialias:I,stencil:N,preserveDrawingBuffer:$})))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(K.r,K.g,K.b,Q);this.context=j;var ja=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
+j.getParameter(j.MAX_TEXTURE_SIZE);var ab=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return j};this.supportsVertexTextures=function(){return 0<ja};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){Aa=a;Ja=b;Da=c;$a=d;j.viewport(Aa,Ja,Da,$a)};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){K.setHex(a);Q=b;j.clearColor(K.r,K.g,K.b,Q)};this.setClearColor=function(a,b){K.copy(a);Q=b;j.clearColor(K.r,K.g,K.b,Q)};this.getClearColor=function(){return K};this.getClearAlpha=function(){return Q};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){y=null;S=T=da=ca=ba=-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,n,m,q=3*a.count;for(m=0;m<q;m+=9)c=a.normalArray,d=c[m],e=c[m+1],f=c[m+2],g=c[m+3],i=c[m+4],k=c[m+5],h=c[m+6],l=c[m+7],n=c[m+8],d=(d+g+h)/3,e=(e+i+l)/3,f=(f+k+n)/3,c[m]=d,c[m+1]=e,c[m+2]=f,c[m+3]=d,c[m+4]=e,c[m+5]=f,
+c[m+6]=d,c[m+7]=e,c[m+8]=f}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!==T&&(T=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!==T&&(T=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!==za&&(j.lineWidth(d),za=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!==za&&(j.lineWidth(d),za=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;S=-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);Wa.multiply(b.projectionMatrix,b.matrixWorldInverse);db.setFromMatrix(Wa);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||db.contains(k))){k.matrixWorld.flattenToArray(k._objectMatrixArray);r(k,b);var o=f,p=o.object,t=o.buffer,E=void 0,E=E=void 0,E=p.material;if(E instanceof THREE.MeshFaceMaterial){if(E=t.materialIndex,0<=E)E=p.geometry.materials[E],E.transparent?(o.transparent=E,o.opaque=null):(o.opaque=E,o.transparent=null)}else if(E)E.transparent?
+(o.transparent=E,o.opaque=null):(o.opaque=E,o.transparent=null);f.render=!0;if(this.sortObjects)k.renderDepth?f.z=k.renderDepth:(Xa.copy(k.position),Wa.multiplyVector3(Xa),f.z=Xa.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);T=-1;G.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,j,db):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,E=void 0,t=void 0,v=void 0,S=void 0,y=void 0,u=void 0,x={},T=r.morphTargets.length;r.geometryGroups={};for(s=0,E=r.faces.length;s<E;s++)t=r.faces[s],v=t.materialIndex,y=void 0!==v?v:-1,void 0===x[y]&&(x[y]={hash:y,counter:0}),
+u=x[y].hash+"_"+x[y].counter,void 0===r.geometryGroups[u]&&(r.geometryGroups[u]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:T}),S=t instanceof THREE.Face3?3:4,65535<r.geometryGroups[u].vertices+S&&(x[y].counter+=1,u=x[y].hash+"_"+x[y].counter,void 0===r.geometryGroups[u]&&(r.geometryGroups[u]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:T})),t instanceof THREE.Face3?r.geometryGroups[u].faces3.push(s):r.geometryGroups[u].faces4.push(s),r.geometryGroups[u].vertices+=
+S;r.geometryGroupsList=[];var C=void 0;for(C in r.geometryGroups)r.geometryGroups[C].id=ka++,r.geometryGroupsList.push(r.geometryGroups[C])}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 B=void 0,D=void 0;A.__webglMorphTargetsBuffers=[];for(B=0,D=A.numMorphTargets;B<D;B++)A.__webglMorphTargetsBuffers.push(j.createBuffer())}G.info.memory.geometries++;var R=m,H=g,L=H.geometry,V=R.faces3,K=R.faces4,I=3*V.length+4*K.length,N=1*V.length+2*K.length,ga=3*V.length+4*K.length,ba=c(H,R),ca=
+e(ba),Q=d(ba),da=ba.vertexColors?ba.vertexColors:!1;R.__vertexArray=new Float32Array(3*I);if(Q)R.__normalArray=new Float32Array(3*I);if(L.hasTangents)R.__tangentArray=new Float32Array(4*I);if(da)R.__colorArray=new Float32Array(3*I);if(ca){if(0<L.faceUvs.length||0<L.faceVertexUvs.length)R.__uvArray=new Float32Array(2*I);if(1<L.faceUvs.length||1<L.faceVertexUvs.length)R.__uv2Array=new Float32Array(2*I)}if(H.geometry.skinWeights.length&&H.geometry.skinIndices.length)R.__skinVertexAArray=new Float32Array(4*
+I),R.__skinVertexBArray=new Float32Array(4*I),R.__skinIndexArray=new Float32Array(4*I),R.__skinWeightArray=new Float32Array(4*I);R.__faceArray=new Uint16Array(3*N);R.__lineArray=new Uint16Array(2*ga);if(R.numMorphTargets){R.__morphTargetsArrays=[];for(var ha=0,W=R.numMorphTargets;ha<W;ha++)R.__morphTargetsArrays.push(new Float32Array(3*I))}R.__webglFaceCount=3*N;R.__webglLineCount=2*ga;if(ba.attributes){if(void 0===R.__webglCustomAttributesList)R.__webglCustomAttributesList=[];var $=void 0;for($ in ba.attributes){var Qa=
+ba.attributes[$],la={},za;for(za in Qa)la[za]=Qa[za];if(!la.__webglInitialized||la.createUniqueBuffers){la.__webglInitialized=!0;var ja=1;"v2"===la.type?ja=2:"v3"===la.type?ja=3:"v4"===la.type?ja=4:"c"===la.type&&(ja=3);la.size=ja;la.array=new Float32Array(I*ja);la.buffer=j.createBuffer();la.buffer.belongsToAttribute=$;Qa.needsUpdate=!0;la.__original=Qa}R.__webglCustomAttributesList.push(la)}}R.__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 ra=l;ra.__webglVertexBuffer=j.createBuffer();ra.__webglColorBuffer=j.createBuffer();G.info.memory.geometries++;var Aa=l,Da=Aa.vertices.length;Aa.__vertexArray=new Float32Array(3*Da);Aa.__colorArray=new Float32Array(3*Da);Aa.__webglVertexCount=Da;l.__dirtyVertices=!0;l.__dirtyColors=!0}}else if(g instanceof THREE.Line){if(l=g.geometry,!l.__webglVertexBuffer){var Ba=l;Ba.__webglVertexBuffer=
+j.createBuffer();Ba.__webglColorBuffer=j.createBuffer();G.info.memory.geometries++;var Ja=l,Wa=g,$a=Ja.vertices.length;Ja.__vertexArray=new Float32Array(3*$a);Ja.__colorArray=new Float32Array(3*$a);Ja.__webglLineCount=$a;b(Ja,Wa);l.__dirtyVertices=!0;l.__dirtyColors=!0}}else if(g instanceof THREE.ParticleSystem&&(l=g.geometry,!l.__webglVertexBuffer)){var Xa=l;Xa.__webglVertexBuffer=j.createBuffer();Xa.__webglColorBuffer=j.createBuffer();G.info.geometries++;var Ta=l,db=g,ib=Ta.vertices.length;Ta.__vertexArray=
+new Float32Array(3*ib);Ta.__colorArray=new Float32Array(3*ib);Ta.__sortArray=[];Ta.__webglParticleCount=ib;b(Ta,db);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 fb=a.__objectsRemoved[0],ab=a;fb instanceof THREE.Mesh||fb instanceof THREE.ParticleSystem||fb instanceof THREE.Ribbon||fb instanceof THREE.Line?o(ab.__webglObjects,fb):fb instanceof
+THREE.Sprite?p(ab.__webglSprites,fb):fb instanceof THREE.LensFlare?p(ab.__webglFlares,fb):(fb instanceof THREE.MarchingCubes||fb.immediateRenderCallback)&&o(ab.__webglObjectsImmediate,fb);fb.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var Mc=0,hd=a.__webglObjects.length;Mc<hd;Mc++){var lb=a.__webglObjects[Mc].object,ia=lb.geometry,jc=void 0,$b=void 0,Ua=void 0;if(lb 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 Nc=0,id=ia.geometryGroupsList.length;Nc<id;Nc++)if(jc=ia.geometryGroupsList[Nc],Ua=c(lb,jc),$b=Ua.attributes&&n(Ua),ia.__dirtyVertices||ia.__dirtyMorphTargets||ia.__dirtyElements||ia.__dirtyUvs||ia.__dirtyNormals||ia.__dirtyColors||ia.__dirtyTangents||$b){var ea=jc,jd=lb,bb=j.DYNAMIC_DRAW,kd=!ia.dynamic,xc=Ua;if(ea.__inittedArrays){var Wc=d(xc),Oc=xc.vertexColors?xc.vertexColors:!1,Xc=e(xc),Yc=Wc===THREE.SmoothShading,F=void 0,U=void 0,kb=void 0,M=void 0,ac=void 0,
+Hb=void 0,mb=void 0,yc=void 0,Bb=void 0,bc=void 0,cc=void 0,X=void 0,Y=void 0,Z=void 0,pa=void 0,nb=void 0,ob=void 0,pb=void 0,kc=void 0,qb=void 0,rb=void 0,sb=void 0,lc=void 0,tb=void 0,ub=void 0,vb=void 0,mc=void 0,wb=void 0,xb=void 0,yb=void 0,nc=void 0,Ib=void 0,Jb=void 0,Kb=void 0,zc=void 0,Lb=void 0,Mb=void 0,Nb=void 0,Ac=void 0,ma=void 0,Zc=void 0,Ob=void 0,dc=void 0,ec=void 0,cb=void 0,$c=void 0,Ka=void 0,Ca=0,Ia=0,Cb=0,Db=0,gb=0,Pa=0,qa=0,Ra=0,Fa=0,J=0,Ga=0,z=0,Ya=void 0,La=ea.__vertexArray,
+oc=ea.__uvArray,pc=ea.__uv2Array,hb=ea.__normalArray,ta=ea.__tangentArray,Ma=ea.__colorArray,ua=ea.__skinVertexAArray,va=ea.__skinVertexBArray,wa=ea.__skinIndexArray,xa=ea.__skinWeightArray,Pc=ea.__morphTargetsArrays,Qc=ea.__webglCustomAttributesList,w=void 0,zb=ea.__faceArray,Za=ea.__lineArray,Sa=jd.geometry,ld=Sa.__dirtyElements,ad=Sa.__dirtyUvs,md=Sa.__dirtyNormals,nd=Sa.__dirtyTangents,od=Sa.__dirtyColors,pd=Sa.__dirtyMorphTargets,Ub=Sa.vertices,na=ea.faces3,oa=ea.faces4,Ha=Sa.faces,Rc=Sa.faceVertexUvs[0],
+Sc=Sa.faceVertexUvs[1],Vb=Sa.skinVerticesA,Wb=Sa.skinVerticesB,Xb=Sa.skinIndices,Pb=Sa.skinWeights,Qb=Sa.morphTargets;if(Sa.__dirtyVertices){for(F=0,U=na.length;F<U;F++)M=Ha[na[F]],X=Ub[M.a].position,Y=Ub[M.b].position,Z=Ub[M.c].position,La[Ia]=X.x,La[Ia+1]=X.y,La[Ia+2]=X.z,La[Ia+3]=Y.x,La[Ia+4]=Y.y,La[Ia+5]=Y.z,La[Ia+6]=Z.x,La[Ia+7]=Z.y,La[Ia+8]=Z.z,Ia+=9;for(F=0,U=oa.length;F<U;F++)M=Ha[oa[F]],X=Ub[M.a].position,Y=Ub[M.b].position,Z=Ub[M.c].position,pa=Ub[M.d].position,La[Ia]=X.x,La[Ia+1]=X.y,La[Ia+
+2]=X.z,La[Ia+3]=Y.x,La[Ia+4]=Y.y,La[Ia+5]=Y.z,La[Ia+6]=Z.x,La[Ia+7]=Z.y,La[Ia+8]=Z.z,La[Ia+9]=pa.x,La[Ia+10]=pa.y,La[Ia+11]=pa.z,Ia+=12;j.bindBuffer(j.ARRAY_BUFFER,ea.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,La,bb)}if(pd)for(cb=0,$c=Qb.length;cb<$c;cb++){Ga=0;for(F=0,U=na.length;F<U;F++)M=Ha[na[F]],X=Qb[cb].vertices[M.a].position,Y=Qb[cb].vertices[M.b].position,Z=Qb[cb].vertices[M.c].position,Ka=Pc[cb],Ka[Ga]=X.x,Ka[Ga+1]=X.y,Ka[Ga+2]=X.z,Ka[Ga+3]=Y.x,Ka[Ga+4]=Y.y,Ka[Ga+5]=Y.z,Ka[Ga+6]=Z.x,
+Ka[Ga+7]=Z.y,Ka[Ga+8]=Z.z,Ga+=9;for(F=0,U=oa.length;F<U;F++)M=Ha[oa[F]],X=Qb[cb].vertices[M.a].position,Y=Qb[cb].vertices[M.b].position,Z=Qb[cb].vertices[M.c].position,pa=Qb[cb].vertices[M.d].position,Ka=Pc[cb],Ka[Ga]=X.x,Ka[Ga+1]=X.y,Ka[Ga+2]=X.z,Ka[Ga+3]=Y.x,Ka[Ga+4]=Y.y,Ka[Ga+5]=Y.z,Ka[Ga+6]=Z.x,Ka[Ga+7]=Z.y,Ka[Ga+8]=Z.z,Ka[Ga+9]=pa.x,Ka[Ga+10]=pa.y,Ka[Ga+11]=pa.z,Ga+=12;j.bindBuffer(j.ARRAY_BUFFER,ea.__webglMorphTargetsBuffers[cb]);j.bufferData(j.ARRAY_BUFFER,Pc[cb],bb)}if(Pb.length){for(F=0,
+U=na.length;F<U;F++)M=Ha[na[F]],tb=Pb[M.a],ub=Pb[M.b],vb=Pb[M.c],xa[J]=tb.x,xa[J+1]=tb.y,xa[J+2]=tb.z,xa[J+3]=tb.w,xa[J+4]=ub.x,xa[J+5]=ub.y,xa[J+6]=ub.z,xa[J+7]=ub.w,xa[J+8]=vb.x,xa[J+9]=vb.y,xa[J+10]=vb.z,xa[J+11]=vb.w,wb=Xb[M.a],xb=Xb[M.b],yb=Xb[M.c],wa[J]=wb.x,wa[J+1]=wb.y,wa[J+2]=wb.z,wa[J+3]=wb.w,wa[J+4]=xb.x,wa[J+5]=xb.y,wa[J+6]=xb.z,wa[J+7]=xb.w,wa[J+8]=yb.x,wa[J+9]=yb.y,wa[J+10]=yb.z,wa[J+11]=yb.w,Ib=Vb[M.a],Jb=Vb[M.b],Kb=Vb[M.c],ua[J]=Ib.x,ua[J+1]=Ib.y,ua[J+2]=Ib.z,ua[J+3]=1,ua[J+4]=Jb.x,
+ua[J+5]=Jb.y,ua[J+6]=Jb.z,ua[J+7]=1,ua[J+8]=Kb.x,ua[J+9]=Kb.y,ua[J+10]=Kb.z,ua[J+11]=1,Lb=Wb[M.a],Mb=Wb[M.b],Nb=Wb[M.c],va[J]=Lb.x,va[J+1]=Lb.y,va[J+2]=Lb.z,va[J+3]=1,va[J+4]=Mb.x,va[J+5]=Mb.y,va[J+6]=Mb.z,va[J+7]=1,va[J+8]=Nb.x,va[J+9]=Nb.y,va[J+10]=Nb.z,va[J+11]=1,J+=12;for(F=0,U=oa.length;F<U;F++)M=Ha[oa[F]],tb=Pb[M.a],ub=Pb[M.b],vb=Pb[M.c],mc=Pb[M.d],xa[J]=tb.x,xa[J+1]=tb.y,xa[J+2]=tb.z,xa[J+3]=tb.w,xa[J+4]=ub.x,xa[J+5]=ub.y,xa[J+6]=ub.z,xa[J+7]=ub.w,xa[J+8]=vb.x,xa[J+9]=vb.y,xa[J+10]=vb.z,xa[J+
+11]=vb.w,xa[J+12]=mc.x,xa[J+13]=mc.y,xa[J+14]=mc.z,xa[J+15]=mc.w,wb=Xb[M.a],xb=Xb[M.b],yb=Xb[M.c],nc=Xb[M.d],wa[J]=wb.x,wa[J+1]=wb.y,wa[J+2]=wb.z,wa[J+3]=wb.w,wa[J+4]=xb.x,wa[J+5]=xb.y,wa[J+6]=xb.z,wa[J+7]=xb.w,wa[J+8]=yb.x,wa[J+9]=yb.y,wa[J+10]=yb.z,wa[J+11]=yb.w,wa[J+12]=nc.x,wa[J+13]=nc.y,wa[J+14]=nc.z,wa[J+15]=nc.w,Ib=Vb[M.a],Jb=Vb[M.b],Kb=Vb[M.c],zc=Vb[M.d],ua[J]=Ib.x,ua[J+1]=Ib.y,ua[J+2]=Ib.z,ua[J+3]=1,ua[J+4]=Jb.x,ua[J+5]=Jb.y,ua[J+6]=Jb.z,ua[J+7]=1,ua[J+8]=Kb.x,ua[J+9]=Kb.y,ua[J+10]=Kb.z,
+ua[J+11]=1,ua[J+12]=zc.x,ua[J+13]=zc.y,ua[J+14]=zc.z,ua[J+15]=1,Lb=Wb[M.a],Mb=Wb[M.b],Nb=Wb[M.c],Ac=Wb[M.d],va[J]=Lb.x,va[J+1]=Lb.y,va[J+2]=Lb.z,va[J+3]=1,va[J+4]=Mb.x,va[J+5]=Mb.y,va[J+6]=Mb.z,va[J+7]=1,va[J+8]=Nb.x,va[J+9]=Nb.y,va[J+10]=Nb.z,va[J+11]=1,va[J+12]=Ac.x,va[J+13]=Ac.y,va[J+14]=Ac.z,va[J+15]=1,J+=16;0<J&&(j.bindBuffer(j.ARRAY_BUFFER,ea.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,ua,bb),j.bindBuffer(j.ARRAY_BUFFER,ea.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,va,bb),
+j.bindBuffer(j.ARRAY_BUFFER,ea.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,wa,bb),j.bindBuffer(j.ARRAY_BUFFER,ea.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,xa,bb))}if(od&&Oc){for(F=0,U=na.length;F<U;F++)M=Ha[na[F]],mb=M.vertexColors,yc=M.color,3===mb.length&&Oc===THREE.VertexColors?(qb=mb[0],rb=mb[1],sb=mb[2]):sb=rb=qb=yc,Ma[Fa]=qb.r,Ma[Fa+1]=qb.g,Ma[Fa+2]=qb.b,Ma[Fa+3]=rb.r,Ma[Fa+4]=rb.g,Ma[Fa+5]=rb.b,Ma[Fa+6]=sb.r,Ma[Fa+7]=sb.g,Ma[Fa+8]=sb.b,Fa+=9;for(F=0,U=oa.length;F<U;F++)M=
+Ha[oa[F]],mb=M.vertexColors,yc=M.color,4===mb.length&&Oc===THREE.VertexColors?(qb=mb[0],rb=mb[1],sb=mb[2],lc=mb[3]):lc=sb=rb=qb=yc,Ma[Fa]=qb.r,Ma[Fa+1]=qb.g,Ma[Fa+2]=qb.b,Ma[Fa+3]=rb.r,Ma[Fa+4]=rb.g,Ma[Fa+5]=rb.b,Ma[Fa+6]=sb.r,Ma[Fa+7]=sb.g,Ma[Fa+8]=sb.b,Ma[Fa+9]=lc.r,Ma[Fa+10]=lc.g,Ma[Fa+11]=lc.b,Fa+=12;0<Fa&&(j.bindBuffer(j.ARRAY_BUFFER,ea.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Ma,bb))}if(nd&&Sa.hasTangents){for(F=0,U=na.length;F<U;F++)M=Ha[na[F]],Bb=M.vertexTangents,nb=Bb[0],ob=Bb[1],
+pb=Bb[2],ta[qa]=nb.x,ta[qa+1]=nb.y,ta[qa+2]=nb.z,ta[qa+3]=nb.w,ta[qa+4]=ob.x,ta[qa+5]=ob.y,ta[qa+6]=ob.z,ta[qa+7]=ob.w,ta[qa+8]=pb.x,ta[qa+9]=pb.y,ta[qa+10]=pb.z,ta[qa+11]=pb.w,qa+=12;for(F=0,U=oa.length;F<U;F++)M=Ha[oa[F]],Bb=M.vertexTangents,nb=Bb[0],ob=Bb[1],pb=Bb[2],kc=Bb[3],ta[qa]=nb.x,ta[qa+1]=nb.y,ta[qa+2]=nb.z,ta[qa+3]=nb.w,ta[qa+4]=ob.x,ta[qa+5]=ob.y,ta[qa+6]=ob.z,ta[qa+7]=ob.w,ta[qa+8]=pb.x,ta[qa+9]=pb.y,ta[qa+10]=pb.z,ta[qa+11]=pb.w,ta[qa+12]=kc.x,ta[qa+13]=kc.y,ta[qa+14]=kc.z,ta[qa+15]=
+kc.w,qa+=16;j.bindBuffer(j.ARRAY_BUFFER,ea.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,ta,bb)}if(md&&Wc){for(F=0,U=na.length;F<U;F++)if(M=Ha[na[F]],ac=M.vertexNormals,Hb=M.normal,3===ac.length&&Yc)for(ma=0;3>ma;ma++)Ob=ac[ma],hb[Pa]=Ob.x,hb[Pa+1]=Ob.y,hb[Pa+2]=Ob.z,Pa+=3;else for(ma=0;3>ma;ma++)hb[Pa]=Hb.x,hb[Pa+1]=Hb.y,hb[Pa+2]=Hb.z,Pa+=3;for(F=0,U=oa.length;F<U;F++)if(M=Ha[oa[F]],ac=M.vertexNormals,Hb=M.normal,4===ac.length&&Yc)for(ma=0;4>ma;ma++)Ob=ac[ma],hb[Pa]=Ob.x,hb[Pa+1]=Ob.y,hb[Pa+
+2]=Ob.z,Pa+=3;else for(ma=0;4>ma;ma++)hb[Pa]=Hb.x,hb[Pa+1]=Hb.y,hb[Pa+2]=Hb.z,Pa+=3;j.bindBuffer(j.ARRAY_BUFFER,ea.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,hb,bb)}if(ad&&Rc&&Xc){for(F=0,U=na.length;F<U;F++)if(kb=na[F],M=Ha[kb],bc=Rc[kb],void 0!==bc)for(ma=0;3>ma;ma++)dc=bc[ma],oc[Cb]=dc.u,oc[Cb+1]=dc.v,Cb+=2;for(F=0,U=oa.length;F<U;F++)if(kb=oa[F],M=Ha[kb],bc=Rc[kb],void 0!==bc)for(ma=0;4>ma;ma++)dc=bc[ma],oc[Cb]=dc.u,oc[Cb+1]=dc.v,Cb+=2;0<Cb&&(j.bindBuffer(j.ARRAY_BUFFER,ea.__webglUVBuffer),
+j.bufferData(j.ARRAY_BUFFER,oc,bb))}if(ad&&Sc&&Xc){for(F=0,U=na.length;F<U;F++)if(kb=na[F],M=Ha[kb],cc=Sc[kb],void 0!==cc)for(ma=0;3>ma;ma++)ec=cc[ma],pc[Db]=ec.u,pc[Db+1]=ec.v,Db+=2;for(F=0,U=oa.length;F<U;F++)if(kb=oa[F],M=Ha[kb],cc=Sc[kb],void 0!==cc)for(ma=0;4>ma;ma++)ec=cc[ma],pc[Db]=ec.u,pc[Db+1]=ec.v,Db+=2;0<Db&&(j.bindBuffer(j.ARRAY_BUFFER,ea.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,pc,bb))}if(ld){for(F=0,U=na.length;F<U;F++)M=Ha[na[F]],zb[gb]=Ca,zb[gb+1]=Ca+1,zb[gb+2]=Ca+2,gb+=3,Za[Ra]=
+Ca,Za[Ra+1]=Ca+1,Za[Ra+2]=Ca,Za[Ra+3]=Ca+2,Za[Ra+4]=Ca+1,Za[Ra+5]=Ca+2,Ra+=6,Ca+=3;for(F=0,U=oa.length;F<U;F++)M=Ha[oa[F]],zb[gb]=Ca,zb[gb+1]=Ca+1,zb[gb+2]=Ca+3,zb[gb+3]=Ca+1,zb[gb+4]=Ca+2,zb[gb+5]=Ca+3,gb+=6,Za[Ra]=Ca,Za[Ra+1]=Ca+1,Za[Ra+2]=Ca,Za[Ra+3]=Ca+3,Za[Ra+4]=Ca+1,Za[Ra+5]=Ca+2,Za[Ra+6]=Ca+2,Za[Ra+7]=Ca+3,Ra+=8,Ca+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ea.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,zb,bb);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ea.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,
+Za,bb)}if(Qc)for(ma=0,Zc=Qc.length;ma<Zc;ma++)if(w=Qc[ma],w.__original.needsUpdate){z=0;if(1===w.size)if(void 0===w.boundTo||"vertices"===w.boundTo){for(F=0,U=na.length;F<U;F++)M=Ha[na[F]],w.array[z]=w.value[M.a],w.array[z+1]=w.value[M.b],w.array[z+2]=w.value[M.c],z+=3;for(F=0,U=oa.length;F<U;F++)M=Ha[oa[F]],w.array[z]=w.value[M.a],w.array[z+1]=w.value[M.b],w.array[z+2]=w.value[M.c],w.array[z+3]=w.value[M.d],z+=4}else{if("faces"===w.boundTo){for(F=0,U=na.length;F<U;F++)Ya=w.value[na[F]],w.array[z]=
+Ya,w.array[z+1]=Ya,w.array[z+2]=Ya,z+=3;for(F=0,U=oa.length;F<U;F++)Ya=w.value[oa[F]],w.array[z]=Ya,w.array[z+1]=Ya,w.array[z+2]=Ya,w.array[z+3]=Ya,z+=4}}else if(2===w.size)if(void 0===w.boundTo||"vertices"===w.boundTo){for(F=0,U=na.length;F<U;F++)M=Ha[na[F]],X=w.value[M.a],Y=w.value[M.b],Z=w.value[M.c],w.array[z]=X.x,w.array[z+1]=X.y,w.array[z+2]=Y.x,w.array[z+3]=Y.y,w.array[z+4]=Z.x,w.array[z+5]=Z.y,z+=6;for(F=0,U=oa.length;F<U;F++)M=Ha[oa[F]],X=w.value[M.a],Y=w.value[M.b],Z=w.value[M.c],pa=w.value[M.d],
+w.array[z]=X.x,w.array[z+1]=X.y,w.array[z+2]=Y.x,w.array[z+3]=Y.y,w.array[z+4]=Z.x,w.array[z+5]=Z.y,w.array[z+6]=pa.x,w.array[z+7]=pa.y,z+=8}else{if("faces"===w.boundTo){for(F=0,U=na.length;F<U;F++)Z=Y=X=Ya=w.value[na[F]],w.array[z]=X.x,w.array[z+1]=X.y,w.array[z+2]=Y.x,w.array[z+3]=Y.y,w.array[z+4]=Z.x,w.array[z+5]=Z.y,z+=6;for(F=0,U=oa.length;F<U;F++)pa=Z=Y=X=Ya=w.value[oa[F]],w.array[z]=X.x,w.array[z+1]=X.y,w.array[z+2]=Y.x,w.array[z+3]=Y.y,w.array[z+4]=Z.x,w.array[z+5]=Z.y,w.array[z+6]=pa.x,w.array[z+
+7]=pa.y,z+=8}}else if(3===w.size){var fa;fa="c"===w.type?["r","g","b"]:["x","y","z"];if(void 0===w.boundTo||"vertices"===w.boundTo){for(F=0,U=na.length;F<U;F++)M=Ha[na[F]],X=w.value[M.a],Y=w.value[M.b],Z=w.value[M.c],w.array[z]=X[fa[0]],w.array[z+1]=X[fa[1]],w.array[z+2]=X[fa[2]],w.array[z+3]=Y[fa[0]],w.array[z+4]=Y[fa[1]],w.array[z+5]=Y[fa[2]],w.array[z+6]=Z[fa[0]],w.array[z+7]=Z[fa[1]],w.array[z+8]=Z[fa[2]],z+=9;for(F=0,U=oa.length;F<U;F++)M=Ha[oa[F]],X=w.value[M.a],Y=w.value[M.b],Z=w.value[M.c],
+pa=w.value[M.d],w.array[z]=X[fa[0]],w.array[z+1]=X[fa[1]],w.array[z+2]=X[fa[2]],w.array[z+3]=Y[fa[0]],w.array[z+4]=Y[fa[1]],w.array[z+5]=Y[fa[2]],w.array[z+6]=Z[fa[0]],w.array[z+7]=Z[fa[1]],w.array[z+8]=Z[fa[2]],w.array[z+9]=pa[fa[0]],w.array[z+10]=pa[fa[1]],w.array[z+11]=pa[fa[2]],z+=12}else if("faces"===w.boundTo){for(F=0,U=na.length;F<U;F++)Z=Y=X=Ya=w.value[na[F]],w.array[z]=X[fa[0]],w.array[z+1]=X[fa[1]],w.array[z+2]=X[fa[2]],w.array[z+3]=Y[fa[0]],w.array[z+4]=Y[fa[1]],w.array[z+5]=Y[fa[2]],w.array[z+
+6]=Z[fa[0]],w.array[z+7]=Z[fa[1]],w.array[z+8]=Z[fa[2]],z+=9;for(F=0,U=oa.length;F<U;F++)pa=Z=Y=X=Ya=w.value[oa[F]],w.array[z]=X[fa[0]],w.array[z+1]=X[fa[1]],w.array[z+2]=X[fa[2]],w.array[z+3]=Y[fa[0]],w.array[z+4]=Y[fa[1]],w.array[z+5]=Y[fa[2]],w.array[z+6]=Z[fa[0]],w.array[z+7]=Z[fa[1]],w.array[z+8]=Z[fa[2]],w.array[z+9]=pa[fa[0]],w.array[z+10]=pa[fa[1]],w.array[z+11]=pa[fa[2]],z+=12}}else if(4===w.size)if(void 0===w.boundTo||"vertices"===w.boundTo){for(F=0,U=na.length;F<U;F++)M=Ha[na[F]],X=w.value[M.a],
+Y=w.value[M.b],Z=w.value[M.c],w.array[z]=X.x,w.array[z+1]=X.y,w.array[z+2]=X.z,w.array[z+3]=X.w,w.array[z+4]=Y.x,w.array[z+5]=Y.y,w.array[z+6]=Y.z,w.array[z+7]=Y.w,w.array[z+8]=Z.x,w.array[z+9]=Z.y,w.array[z+10]=Z.z,w.array[z+11]=Z.w,z+=12;for(F=0,U=oa.length;F<U;F++)M=Ha[oa[F]],X=w.value[M.a],Y=w.value[M.b],Z=w.value[M.c],pa=w.value[M.d],w.array[z]=X.x,w.array[z+1]=X.y,w.array[z+2]=X.z,w.array[z+3]=X.w,w.array[z+4]=Y.x,w.array[z+5]=Y.y,w.array[z+6]=Y.z,w.array[z+7]=Y.w,w.array[z+8]=Z.x,w.array[z+
+9]=Z.y,w.array[z+10]=Z.z,w.array[z+11]=Z.w,w.array[z+12]=pa.x,w.array[z+13]=pa.y,w.array[z+14]=pa.z,w.array[z+15]=pa.w,z+=16}else if("faces"===w.boundTo){for(F=0,U=na.length;F<U;F++)Z=Y=X=Ya=w.value[na[F]],w.array[z]=X.x,w.array[z+1]=X.y,w.array[z+2]=X.z,w.array[z+3]=X.w,w.array[z+4]=Y.x,w.array[z+5]=Y.y,w.array[z+6]=Y.z,w.array[z+7]=Y.w,w.array[z+8]=Z.x,w.array[z+9]=Z.y,w.array[z+10]=Z.z,w.array[z+11]=Z.w,z+=12;for(F=0,U=oa.length;F<U;F++)pa=Z=Y=X=Ya=w.value[oa[F]],w.array[z]=X.x,w.array[z+1]=X.y,
+w.array[z+2]=X.z,w.array[z+3]=X.w,w.array[z+4]=Y.x,w.array[z+5]=Y.y,w.array[z+6]=Y.z,w.array[z+7]=Y.w,w.array[z+8]=Z.x,w.array[z+9]=Z.y,w.array[z+10]=Z.z,w.array[z+11]=Z.w,w.array[z+12]=pa.x,w.array[z+13]=pa.y,w.array[z+14]=pa.z,w.array[z+15]=pa.w,z+=16}j.bindBuffer(j.ARRAY_BUFFER,w.buffer);j.bufferData(j.ARRAY_BUFFER,w.array,bb)}kd&&(delete ea.__inittedArrays,delete ea.__colorArray,delete ea.__normalArray,delete ea.__tangentArray,delete ea.__uvArray,delete ea.__uv2Array,delete ea.__faceArray,delete ea.__vertexArray,
+delete ea.__lineArray,delete ea.__skinVertexAArray,delete ea.__skinVertexBArray,delete ea.__skinIndexArray,delete ea.__skinWeightArray)}}ia.__dirtyVertices=!1;ia.__dirtyMorphTargets=!1;ia.__dirtyElements=!1;ia.__dirtyUvs=!1;ia.__dirtyNormals=!1;ia.__dirtyColors=!1;ia.__dirtyTangents=!1;Ua.attributes&&q(Ua)}else if(lb instanceof THREE.Ribbon){if(ia.__dirtyVertices||ia.__dirtyColors){var Rb=ia,bd=j.DYNAMIC_DRAW,qc=void 0,rc=void 0,Bc=void 0,Sb=void 0,Cc=void 0,cd=Rb.vertices,dd=Rb.colors,qd=cd.length,
+rd=dd.length,Dc=Rb.__vertexArray,Ec=Rb.__colorArray,sd=Rb.__dirtyColors;if(Rb.__dirtyVertices){for(qc=0;qc<qd;qc++)Bc=cd[qc].position,Sb=3*qc,Dc[Sb]=Bc.x,Dc[Sb+1]=Bc.y,Dc[Sb+2]=Bc.z;j.bindBuffer(j.ARRAY_BUFFER,Rb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Dc,bd)}if(sd){for(rc=0;rc<rd;rc++)Cc=dd[rc],Sb=3*rc,Ec[Sb]=Cc.r,Ec[Sb+1]=Cc.g,Ec[Sb+2]=Cc.b;j.bindBuffer(j.ARRAY_BUFFER,Rb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Ec,bd)}}ia.__dirtyVertices=!1;ia.__dirtyColors=!1}else if(lb instanceof
+THREE.Line){Ua=c(lb,jc);$b=Ua.attributes&&n(Ua);if(ia.__dirtyVertices||ia.__dirtyColors||$b){var Eb=ia,Tc=j.DYNAMIC_DRAW,sc=void 0,tc=void 0,Fc=void 0,ya=void 0,Gc=void 0,ed=Eb.vertices,fd=Eb.colors,td=ed.length,ud=fd.length,Hc=Eb.__vertexArray,Ic=Eb.__colorArray,vd=Eb.__dirtyColors,Uc=Eb.__webglCustomAttributesList,Jc=void 0,gd=void 0,Oa=void 0,fc=void 0,Va=void 0,sa=void 0;if(Eb.__dirtyVertices){for(sc=0;sc<td;sc++)Fc=ed[sc].position,ya=3*sc,Hc[ya]=Fc.x,Hc[ya+1]=Fc.y,Hc[ya+2]=Fc.z;j.bindBuffer(j.ARRAY_BUFFER,
+Eb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Hc,Tc)}if(vd){for(tc=0;tc<ud;tc++)Gc=fd[tc],ya=3*tc,Ic[ya]=Gc.r,Ic[ya+1]=Gc.g,Ic[ya+2]=Gc.b;j.bindBuffer(j.ARRAY_BUFFER,Eb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Ic,Tc)}if(Uc)for(Jc=0,gd=Uc.length;Jc<gd;Jc++)if(sa=Uc[Jc],sa.needsUpdate&&(void 0===sa.boundTo||"vertices"===sa.boundTo)){ya=0;fc=sa.value.length;if(1===sa.size)for(Oa=0;Oa<fc;Oa++)sa.array[Oa]=sa.value[Oa];else if(2===sa.size)for(Oa=0;Oa<fc;Oa++)Va=sa.value[Oa],sa.array[ya]=Va.x,
+sa.array[ya+1]=Va.y,ya+=2;else if(3===sa.size)if("c"===sa.type)for(Oa=0;Oa<fc;Oa++)Va=sa.value[Oa],sa.array[ya]=Va.r,sa.array[ya+1]=Va.g,sa.array[ya+2]=Va.b,ya+=3;else for(Oa=0;Oa<fc;Oa++)Va=sa.value[Oa],sa.array[ya]=Va.x,sa.array[ya+1]=Va.y,sa.array[ya+2]=Va.z,ya+=3;else if(4===sa.size)for(Oa=0;Oa<fc;Oa++)Va=sa.value[Oa],sa.array[ya]=Va.x,sa.array[ya+1]=Va.y,sa.array[ya+2]=Va.z,sa.array[ya+3]=Va.w,ya+=4;j.bindBuffer(j.ARRAY_BUFFER,sa.buffer);j.bufferData(j.ARRAY_BUFFER,sa.array,Tc)}}ia.__dirtyVertices=
+!1;ia.__dirtyColors=!1;Ua.attributes&&q(Ua)}else if(lb instanceof THREE.ParticleSystem)Ua=c(lb,jc),$b=Ua.attributes&&n(Ua),(ia.__dirtyVertices||ia.__dirtyColors||lb.sortParticles||$b)&&f(ia,j.DYNAMIC_DRAW,lb),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.DirectionalLight&&f++,e instanceof THREE.PointLight&&l++,e instanceof THREE.SpotLight&&l++);l+f<=L?k=f:(k=
+Math.ceil(L*f/(l+f)),l=L-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=W.length;p<d;p++)if(W[p].code===i){o=W[p].program;break a}p=j.createProgram();d=[0<ja?"#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 "+C+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",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(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=W.length;W.push({program:p,code:i});G.info.memory.programs=W.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(ja!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ja=a.doubleSided;if(ga!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ga=a.flipSided};this.setDepthTest=function(a){ba!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),ba=a)};this.setDepthWrite=
-function(a){$!==a&&(j.depthMask(a),$=a)};this.setBlending=function(a){if(a!==T){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)}T=
-a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),H.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=B(a.format),f=B(a.type);u(j.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);
-a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(void 0===a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=B(a.format),e=B(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,
-a.__webglTexture);u(j.TEXTURE_CUBE_MAP,a,c);for(c=0;6>c;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,d,a.width,a.height,0,d,e,null);var f=a,g=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,g,f.__webglTexture,0);v(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=
-j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),u(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),v(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:
-a.__webglFramebuffer,d=a.width,a=a.height,c=e=0):(b=null,d=Ia,a=za,e=Ba,c=Ga);b!==E&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(e,c,d,a),E=b);Ua=d;jb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+"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(ga!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ga=a.doubleSided;if(V!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),V=a.flipSided};this.setDepthTest=function(a){ca!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),ca=a)};this.setDepthWrite=
+function(a){da!==a&&(j.depthMask(a),da=a)};this.setBlending=function(a){if(a!==ba){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)}ba=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),G.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=B(a.format),f=B(a.type);u(j.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&
+d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(void 0===a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=B(a.format),e=B(a.type);if(b){a.__webglFramebuffer=
+[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);u(j.TEXTURE_CUBE_MAP,a,c);for(c=0;6>c;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,d,a.width,a.height,0,d,e,null);var f=a,g=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,g,f.__webglTexture,0);v(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=
+j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),u(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),v(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,
+null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,d=a.width,a=a.height,c=e=0):(b=null,d=Da,a=$a,e=Aa,c=Ja);b!==E&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(e,c,d,a),E=b);Ta=d;ib=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:
 THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
@@ -356,20 +357,20 @@ 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,k=a.faces,i=f.faces,l=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=i.length;o<p;o++){var g=i[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);k.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));l.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],k,i,l=h.vertexNormals,n=h.vertexColors;h instanceof THREE.Face3?k=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(k=new THREE.Face4(h.a,h.b,h.c,h.d));k.normal.copy(h.normal);d=0;for(g=l.length;d<g;d++)i=l[d],k.vertexNormals.push(i.clone());k.color.copy(h.color);d=0;for(g=n.length;d<g;d++)i=n[d],k.vertexColors.push(i.clone());k.materialIndex=h.materialIndex;k.centroid.copy(h.centroid);b.faces.push(k)}for(a=0,c=f.length;a<c;a++){e=f[a];k=[];d=0;for(g=e.length;d<
-g;d++)k.push(new THREE.UV(e[d].u,e[d].v));b.faceVertexUvs[0].push(k)}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,
+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 i[e]>a?b(c,e-1):i[e]<a?b(e+1,d):e}return b(0,i.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,k=0,i=[],l,n,q,o;for(e=0;e<h;e++){d=f[e];if(d instanceof THREE.Face3)l=g[d.a].position,n=g[d.b].position,q=g[d.c].position,d._area=THREE.GeometryUtils.triangleArea(l,n,q);else if(d instanceof
-THREE.Face4)l=g[d.a].position,n=g[d.b].position,q=g[d.c].position,o=g[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(l,n,o),d._area2=THREE.GeometryUtils.triangleArea(n,q,o),d._area=d._area1+d._area2;k+=d._area;i[e]=k}d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*k,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,k=g.createImageData(d,e),i=k.data,l=0;l<d;l++)for(var n=1;n<e;n++){var q=0>n-1?e-1:n-1,o=(n+1)%e,p=0>l-1?d-1:l-1,m=(l+1)%d,r=[],s=[0,0,h[4*(n*d+l)]/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+l)]/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+l)]/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+l);i[s]=255*((r[0]+
-1)/2)|0;i[s+1]=255*(r[1]+0.5)|0;i[s+2]=255*r[2]|0;i[s+3]=255}g.putImageData(k,0,0);return f}};
+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?
 (b=new THREE.ParticleSystem(a.geometry,a.material),b.sortParticles=a.sortParticles):a instanceof THREE.Particle?b=new THREE.Particle(a.material):a instanceof THREE.Sprite?(b=new THREE.Sprite({}),b.color.copy(a.color),b.map=a.map,b.blending=a.blending,b.useScreenCoordinates=a.useScreenCoordinates,b.mergeWith3D=a.mergeWith3D,b.affectedByDistance=a.affectedByDistance,b.scaleByViewport=a.scaleByViewport,b.alignment=a.alignment,b.rotation3d.copy(a.rotation3d),b.rotation=a.rotation,b.opacity=a.opacity,
@@ -387,7 +388,7 @@ THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:
 THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.vertexColorArray=this.vertexUvArray=this.vertexNormalArray=this.vertexPositionArray=this.vertexIndexArray=this.vertexColorBuffer=this.vertexUvBuffer=this.vertexNormalBuffer=this.vertexPositionBuffer=this.vertexIndexBuffer=null;this.dynamic=!1;this.boundingSphere=this.boundingBox=null;this.morphTargets=[]};THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,computeBoundingBox:function(){},computeBoundingSphere:function(){}};
 THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
 THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
-THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,k;g<=h;)if(d=Math.floor(g+(h-g)/2),k=c[d]-f,0>k)g=d+1;else if(0<k)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
+THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,i;g<=h;)if(d=Math.floor(g+(h-g)/2),i=c[d]-f,0>i)g=d+1;else if(0<i)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
 THREE.Curve.prototype.getTangent=function(a){var b=a-1.0E-4,a=a+1.0E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);a=this.getPoint(a);return b.clone().subSelf(a).normalize()};THREE.Curve.prototype.getTangentAt=function(a){return this.getTangent(this.getUtoTmapping(a))};THREE.LineCurve=function(a,b){a instanceof THREE.Vector2?(this.v1=a,this.v2=b):THREE.LineCurve.oldConstructor.apply(this,arguments)};
 THREE.LineCurve.oldConstructor=function(a,b,c,d){this.constructor(new THREE.Vector2(a,b),new THREE.Vector2(c,d))};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.multiplyScalar(a).addSelf(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};
 THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};THREE.QuadraticBezierCurve=function(a,b,c){if(!(b instanceof THREE.Vector2))var d=Array.prototype.slice.call(arguments),a=new THREE.Vector2(d[0],d[1]),b=new THREE.Vector2(d[2],d[3]),c=new THREE.Vector2(d[4],d[5]);this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
@@ -405,10 +406,10 @@ THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},fu
 THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=!1};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};
 THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
 THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e;b=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var f,g,h,k;k=new THREE.Vector2;for(g=0,h=a.length;g<h;g++){f=a[g];if(f.x>b)b=f.x;else if(f.x<d)d=f.x;if(f.y>c)c=f.y;else if(f.y<c)e=f.y;k.addSelf(f.x,f.y)}return{minX:d,minY:e,maxX:b,maxY:c,centroid:k.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e;b=c=Number.NEGATIVE_INFINITY;d=e=Number.POSITIVE_INFINITY;var f,g,h,i;i=new THREE.Vector2;for(g=0,h=a.length;g<h;g++){f=a[g];if(f.x>b)b=f.x;else if(f.x<d)d=f.x;if(f.y>c)c=f.y;else if(f.y<c)e=f.y;i.addSelf(f.x,f.y)}return{minX:d,minY:e,maxX:b,maxY:c,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
 THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vertex(new THREE.Vector3(a[c].x,a[c].y,0)));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
 THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,e;if(!b)b=this.bends;for(d=0,e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;if(!b)b=this.bends;for(d=0,e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};
-THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,k;for(d=0,e=a.length;d<e;d++)f=a[d],g=f.x,h=f.y,k=g/c.maxX,k=b.getUtoTmapping(k,g),g=b.getPoint(k),h=b.getNormalVector(k).multiplyScalar(h),f.x=g.x+h.x,f.y=g.y+h.y;return a};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=new THREE.Object3D;THREE.Gyroscope.prototype.constructor=THREE.Gyroscope;
+THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,i;for(d=0,e=a.length;d<e;d++)f=a[d],g=f.x,h=f.y,i=g/c.maxX,i=b.getUtoTmapping(i,g),g=b.getPoint(i),h=b.getNormalVector(i).multiplyScalar(h),f.x=g.x+h.x,f.y=g.y+h.y;return a};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=new THREE.Object3D;THREE.Gyroscope.prototype.constructor=THREE.Gyroscope;
 THREE.Gyroscope.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?(this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(this.translationWorld,this.rotationWorld,this.scaleWorld),this.matrix.decompose(this.translationObject,this.rotationObject,this.scaleObject),this.matrixWorld.compose(this.translationWorld,this.rotationObject,this.scaleWorld)):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
 !1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)};THREE.Gyroscope.prototype.translationWorld=new THREE.Vector3;THREE.Gyroscope.prototype.translationObject=new THREE.Vector3;THREE.Gyroscope.prototype.rotationWorld=new THREE.Quaternion;THREE.Gyroscope.prototype.rotationObject=new THREE.Quaternion;THREE.Gyroscope.prototype.scaleWorld=new THREE.Vector3;THREE.Gyroscope.prototype.scaleObject=new THREE.Vector3;
 THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)};
@@ -417,37 +418,37 @@ THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,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,k,i,l,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];k=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,
-k),c.push(new THREE.Vector2(f,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];k=f[5];n=f[0];q=f[1];i=f[2];l=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,i,h),m=THREE.Shape.Utils.b3(m,p,q,l,k),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];k=f[1];i=f[2];n=f[3];m=f[4];q=!!f[5];l=g[g.length-2];o=g[g.length-1];0==g.length&&(l=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=l+h+i*Math.cos(m),m=o+k+i*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,k,i,l,n;for(h=0,k=g.length;h<k;h++)i=g[h],l=i.x,n=i.y,i.x=a*l+b*n+c,i.y=d*n+e*l+f;return g};
+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()};
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=new THREE.Path;for(a=0,b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&0!=f.actions.length&&(e.push(f),f=new THREE.Path),f[c].apply(f,d);0!=f.actions.length&&e.push(f);if(0==e.length)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(1==e.length)return f=e[0],g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves,d.push(g),d;if(a){g=new THREE.Shape;for(a=0,b=e.length;a<
 b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g.actions=f.actions,g.curves=f.curves,d.push(g),g=new THREE.Shape):g.holes.push(f)}else{for(a=0,b=e.length;a<b;a++)f=e[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(g&&d.push(g),g=new THREE.Shape,g.actions=f.actions,g.curves=f.curves):g.holes.push(f);d.push(g)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;
 THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};
 THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,k,i,l,n,q,o,p=[];for(k=0;k<b.length;k++){i=b[k];Array.prototype.push.apply(d,i);f=Number.POSITIVE_INFINITY;for(e=0;e<i.length;e++){q=i[e];o=[];for(n=0;n<c.length;n++)l=c[n],l=q.distanceToSquared(l),o.push(l),l<f&&(f=l,g=e,h=n)}e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:i.length-1;var m=[i[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(m);var r=[i[g],i[f],c[h]];q=THREE.FontUtils.Triangulate.area(r);o=h;l=g;h+=1;g+=-1;0>
-h&&(h+=c.length);h%=c.length;0>g&&(g+=i.length);g%=i.length;e=0<=h-1?h-1:c.length-1;f=0<=g-1?g-1:i.length-1;m=[i[g],c[h],c[e]];m=THREE.FontUtils.Triangulate.area(m);r=[i[g],i[f],c[h]];r=THREE.FontUtils.Triangulate.area(r);n+q>m+r&&(h=o,g=l,0>h&&(h+=c.length),h%=c.length,0>g&&(g+=i.length),g%=i.length,e=0<=h-1?h-1:c.length-1,f=0<=g-1?g-1:i.length-1);n=c.slice(0,h);q=c.slice(h);o=i.slice(g);l=i.slice(0,g);f=[i[g],i[f],c[h]];p.push([i[g],c[h],c[e]]);p.push(f);c=n.concat(o).concat(l).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,k,i={};for(f=0,g=d.length;f<g;f++)k=d[f].x+":"+d[f].y,void 0!==i[k]&&console.log("Duplicate point",k),i[k]=f;for(f=0,g=c.length;f<g;f++){h=c[f];for(d=0;3>d;d++)k=h[d].x+":"+h[d].y,k=i[k],void 0!==k&&(h[d]=k)}for(f=0,g=e.length;f<g;f++){h=e[f];for(d=0;3>d;d++)k=h[d].x+":"+h[d].y,k=i[k],void 0!==k&&(h[d]=k)}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};
 THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){-1===a.indexOf(b)&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);-1!==b&&a.splice(b,1)},add:function(a){void 0!==b[a.name]&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(!0!==a.initialized){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(0>a.hierarchy[c].keys[d].time)a.hierarchy[c].keys[d].time=
-0;if(void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var k=0;k<a.hierarchy[c].keys[d].morphTargets.length;k++){var i=a.hierarchy[c].keys[d].morphTargets[k];h[i]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var l=
-{};for(i in h){for(k=0;k<a.hierarchy[c].keys[d].morphTargets.length;k++)if(a.hierarchy[c].keys[d].morphTargets[k]===i){l[i]=a.hierarchy[c].keys[d].morphTargetsInfluences[k];break}k===a.hierarchy[c].keys[d].morphTargets.length&&(l[i]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
+0;if(void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var l=a.hierarchy[c].keys[d].morphTargets[i];h[l]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k=
+{};for(l in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===l){k[l]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(k[l]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if("string"===typeof a){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=
 1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=void 0!==c?c:THREE.AnimationHandler.LINEAR;this.JITCompile=void 0!==d?d:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(void 0===e.animationCache)e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof
 THREE.Bone?e.skinMatrix:e.matrix;var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(void 0!==this.hierarchy[a].animationCache)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,h,k,i,l=this.data.JIT.hierarchy,n,q;q=this.currentTime+=a*this.timeScale;n=this.currentTime%=this.data.length;i=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],k=a.animationCache,this.JITCompile&&void 0!==l[o][i])a instanceof THREE.Bone?(a.skinMatrix=l[o][i],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!1):(a.matrix=
-l[o][i],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=k.prevKey[c];h=k.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)}k.prevKey[c]=
-g;k.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]=
+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===l[0][i]){this.hierarchy[0].updateMatrixWorld(!0);for(o=0;o<this.hierarchy.length;o++)l[o][i]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,k,i;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];k=a[c[2]];i=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],k[0],i[0],e,c,g);d[1]=this.interpolate(f[1],h[1],k[1],i[1],e,c,g);d[2]=this.interpolate(f[2],h[2],k[2],i[2],e,c,g);return d};
+c)THREE.Quaternion.slerp(e,f,a.quaternion,d);else if("scl"===c)c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d}}if(this.JITCompile&&void 0===k[0][l]){this.hierarchy[0].updateMatrixWorld(!0);for(o=0;o<this.hierarchy.length;o++)k[o][l]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,i,l;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];i=a[c[2]];l=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],i[0],l[0],e,c,g);d[1]=this.interpolate(f[1],h[1],i[1],l[1],e,c,g);d[2]=this.interpolate(f[2],h[2],i[2],l[2],e,c,g);return d};
 THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};
 THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
@@ -455,9 +456,9 @@ d.matrixWorldNeedsUpdate=!0}}};
 THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++){e=this.hierarchy[c];f=this.data.hierarchy[c];e.useQuaternion=!0;if(void 0===f.animationCache)f.animationCache={},f.animationCache.prevKey=null,f.animationCache.nextKey=null,f.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:
 e.matrix;e=this.data.hierarchy[c].keys;if(e.length)f.animationCache.prevKey=e[0],f.animationCache.nextKey=e[1],this.startTime=Math.min(e[0].time,this.startTime),this.endTime=Math.max(e[e.length-1].time,this.endTime)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.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,k;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((k=g<h)&&!this.loop){for(var a=0,i=this.hierarchy.length;a<i;a++){var l=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=l.length-1;e=this.hierarchy[a];if(l.length){for(l=
-0;l<f.length;l++)g=f[l],(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(i=this.hierarchy.length;a<i;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var l=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(l.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(k&&this.loop){b=l[0];for(c=l[1];c.time<g;)b=c,c=l[b.index+1]}else if(!k)for(var q=l.length-1;c.time<g&&c.index!==q;)b=c,c=l[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.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 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=
@@ -496,69 +497,69 @@ 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,k=0,i=0,l=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<k||this.autoForward&&!(0>k)?1:k));this.object.translateX(b*i);this.object.translateY(b*l);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;q=(a.clientY-p)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:k=1;break;case 2:k=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:k=0;break;case 2:k=0}},!1);this.domElement.addEventListener("keydown",
-function(a){switch(a.keyCode){case 38:case 87:k=1;break;case 37:case 65:i=-1;break;case 40:case 83:k=-1;break;case 39:case 68:i=1;break;case 81:g=!0;h=1;break;case 69:g=!0;h=-1;break;case 82:l=1;break;case 70:l=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:k=0;break;case 37:case 65:i=0;break;case 40:case 83:k=0;break;case 39:case 68:i=0;break;case 81:g=!1;break;case 69:g=!1;break;case 82:l=0;break;case 70:l=0}},!1)};
+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,k=new THREE.Vector2,i=new THREE.Vector2,l=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*
+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*
 c.screen.height+c.screen.offsetTop-b)/c.radius,0),e=d.length();1<e?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(g.dot(h)/g.length()/h.length());if(a){var b=(new THREE.Vector3).cross(g,h).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;d.setFromAxisAngle(b,-a);d.multiplyVector3(f);d.multiplyVector3(c.object.up);
-d.multiplyVector3(h);c.staticMoving?g=h:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(g))}};this.zoomCamera=function(){var a=1+(i.y-k.y)*c.zoomSpeed;1!==a&&0<a&&(f.multiplyScalar(a),c.staticMoving?k=i:k.y+=(i.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=n.clone().subSelf(l);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);
-c.target.addSelf(b);c.staticMoving?l=n:l.addSelf(a.sub(n,l).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),f.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,f.setLength(c.minDistance))};this.update=function(){f.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();
-c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(d&&(g=h=c.getMouseProjectionOnBall(a.clientX,a.clientY),k=i=c.getMouseOnScreen(a.clientX,a.clientY),l=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?i=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?k=i=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(l=n=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),
+d.multiplyVector3(h);c.staticMoving?g=h:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(g))}};this.zoomCamera=function(){var a=1+(l.y-i.y)*c.zoomSpeed;1!==a&&0<a&&(f.multiplyScalar(a),c.staticMoving?i=l:i.y+=(l.y-i.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=n.clone().subSelf(k);if(a.lengthSq()){a.multiplyScalar(f.length()*c.panSpeed);var b=f.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);
+c.target.addSelf(b);c.staticMoving?k=n:k.addSelf(a.sub(n,k).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),f.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,f.setLength(c.minDistance))};this.update=function(){f.copy(c.object.position).subSelf(this.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();
+c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(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 k(a,b,c,g,h,k,l,n){var m,o=d||1,q=e||1,p=h/2,r=k/2,s=i.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 j=o+1,t=q+1,y=h/o,E=k/q,Q=new THREE.Vector3;Q[m]=0<l?1:-1;for(h=0;h<t;h++)for(k=0;k<j;k++){var u=new THREE.Vector3;u[a]=(k*y-p)*c;u[b]=(h*E-r)*g;u[m]=l;i.vertices.push(new THREE.Vertex(u))}for(h=0;h<q;h++)for(k=0;k<o;k++)a=
-new THREE.Face4(k+j*h+s,k+j*(h+1)+s,k+1+j*(h+1)+s,k+1+j*h+s),a.normal.copy(Q),a.vertexNormals.push(Q.clone(),Q.clone(),Q.clone(),Q.clone()),a.materialIndex=n,i.faces.push(a),i.faceVertexUvs[0].push([new THREE.UV(k/o,h/q),new THREE.UV(k/o,(h+1)/q),new THREE.UV((k+1)/o,(h+1)/q),new THREE.UV((k+1)/o,h/q)])}THREE.Geometry.call(this);var i=this,l=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&&k("z","y",-1,-1,c,b,l,o);this.sides.nx&&k("z","y",1,-1,c,b,-l,r);this.sides.py&&k("x","z",1,1,a,c,n,p);this.sides.ny&&k("x","z",1,-1,a,c,-n,s);this.sides.pz&&k("x","y",1,-1,a,b,q,m);this.sides.nz&&k("x","y",-1,-1,a,b,-q,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,r=i/2,s=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 j=o+1,t=q+1,y=h/o,E=i/q,S=new THREE.Vector3;S[m]=0<k?1:-1;for(h=0;h<t;h++)for(i=0;i<j;i++){var u=new THREE.Vector3;u[a]=(i*y-p)*c;u[b]=(h*E-r)*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+j*h+s,i+j*(h+1)+s,i+1+j*(h+1)+s,i+1+j*h+s),a.normal.copy(S),a.vertexNormals.push(S.clone(),S.clone(),S.clone(),S.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,k,i=[],l=[];for(k=0;k<=e;k++){var n=[],q=[],o=k/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))}i.push(n);l.push(q)}for(k=0;k<e;k++)for(h=0;h<d;h++){var c=i[k][h],n=i[k+1][h],
-q=i[k+1][h+1],o=i[k][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=l[k][h].clone(),u=l[k+1][h].clone(),v=l[k+1][h+1].clone(),x=l[k][h+1].clone();this.faces.push(new THREE.Face4(c,n,q,o,[p,m,r,s]));this.faceVertexUvs[0].push([t,u,v,x])}if(!f&&0<a){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,g,0)));for(h=
-0;h<d;h++)c=i[0][h],n=i[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=l[0][h].clone(),u=l[0][h+1].clone(),v=new THREE.UV(u.u,0),this.faces.push(new THREE.Face3(c,n,q,[p,m,r])),this.faceVertexUvs[0].push([t,u,v])}if(!f&&0<b){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-g,0)));for(h=0;h<d;h++)c=i[k][h+1],n=i[k][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=l[k][h+1].clone(),u=l[k][h].clone(),v=new THREE.UV(u.u,1),this.faces.push(new THREE.Face3(c,n,q,[p,m,r])),this.faceVertexUvs[0].push([t,u,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(a,b,c,d,e,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(),v=k[i+1][h+1].clone(),x=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,v,x])}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(),v=new THREE.UV(u.u,0),this.faces.push(new THREE.Face3(c,n,q,[p,m,r])),this.faceVertexUvs[0].push([t,u,v])}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(),v=new THREE.UV(u.u,1),this.faces.push(new THREE.Face3(c,n,q,[p,m,r])),this.faceVertexUvs[0].push([t,u,v])}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(j=a.length;0<=--j;){y=j;E=j-1;0>E&&(E=a.length-1);for(var b=
-0,c=o+2*l,b=0;b<c;b++){var d=O*b,e=O*(b+1),f=ja+y+d,g=ja+y+e,i=f,d=ja+E+d,e=ja+E+e,n=g,i=i+F,d=d+F,e=e+F,n=n+F;A.faces.push(new THREE.Face4(i,d,e,n,null,null,v));void 0!==v&&(i=b/c,d=(b+1)/c,e=h+2*k,f=(A.vertices[f].position.z+k)/e,g=(A.vertices[g].position.z+k)/e,A.faceVertexUvs[0].push([new THREE.UV(f,i),new THREE.UV(g,i),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=F;b+=F;c+=F;A.faces.push(new THREE.Face3(a,
-b,c,null,null,u));if(void 0!==u){var d=x.minX,e=x.minY,f=x.maxY,g=x.maxX,h=A.vertices[b].position.x-d,b=A.vertices[b].position.y-e,j=A.vertices[c].position.x-d,c=A.vertices[c].position.y-e;A.faceVertexUvs[0].push([new THREE.UV((A.vertices[a].position.x-d)/g,(A.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,k=void 0!==b.bevelThickness?b.bevelThickness:6,i=void 0!==b.bevelSize?b.bevelSize:k-2,l=void 0!==b.bevelSegments?b.bevelSegments:
-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,v=b.extrudeMaterial,x=this.shapebb;if(m)r=m.getPoints(q),o=r.length,s=!0,n=!1;n||(i=k=l=0);var B,D,C,A=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,C=q.length;D<C;D++)B=q[D],THREE.Shape.Utils.isClockWise(B)&&(q[D]=B.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(p,q);t=p;for(D=0,C=q.length;D<C;D++)B=q[D],p=p.concat(B);for(var J,K,Z,L,O=p.length,M=m.length,H=[],j=0,V=t.length,y=V-1,E=j+1;j<V;j++,y++,E++)y===V&&(y=0),E===V&&(E=0),H[j]=d(t[j],t[y],t[E]);var Q=[],S,aa=H.concat();for(D=0,C=q.length;D<C;D++){B=q[D];S=[];for(j=0,V=B.length,y=V-1,E=j+1;j<V;j++,y++,E++)y===V&&(y=0),E===V&&(E=0),S[j]=d(B[j],B[y],B[E]);Q.push(S);aa=aa.concat(S)}for(J=
-0;J<l;J++){K=J/l;Z=k*(1-K);K=i*Math.sin(K*Math.PI/2);for(j=0,V=t.length;j<V;j++)L=c(t[j],H[j],K),f(L.x,L.y,-Z);for(D=0,C=q.length;D<C;D++){B=q[D];S=Q[D];for(j=0,V=B.length;j<V;j++)L=c(B[j],S[j],K),f(L.x,L.y,-Z)}}K=i;for(j=0;j<O;j++)L=n?c(p[j],aa[j],K):p[j],s?f(L.x,L.y+r[0].y,r[0].x):f(L.x,L.y,0);for(J=1;J<=o;J++)for(j=0;j<O;j++)L=n?c(p[j],aa[j],K):p[j],s?f(L.x,L.y+r[J-1].y,r[J-1].x):f(L.x,L.y,h/o*J);for(J=l-1;0<=J;J--){K=J/l;Z=k*(1-K);K=i*Math.sin(K*Math.PI/2);for(j=0,V=t.length;j<V;j++)L=c(t[j],
-H[j],K),f(L.x,L.y,h+Z);for(D=0,C=q.length;D<C;D++){B=q[D];S=Q[D];for(j=0,V=B.length;j<V;j++)L=c(B[j],S[j],K),s?f(L.x,L.y+r[o-1].y,r[o-1].x+Z):f(L.x,L.y,h+Z)}}if(n){n=0*O;for(j=0;j<M;j++)i=m[j],g(i[2]+n,i[1]+n,i[0]+n);n=O*(o+2*l);for(j=0;j<M;j++)i=m[j],g(i[0]+n,i[1]+n,i[2]+n)}else{for(j=0;j<M;j++)i=m[j],g(i[2],i[1],i[0]);for(j=0;j<M;j++)i=m[j],g(i[0]+O*o,i[1]+O*o,i[2]+O*o)}var ja=0;e(t);ja+=t.length;for(D=0,C=q.length;D<C;D++)B=q[D],e(B),ja+=B.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+0,c=o+2*k,b=0;b<c;b++){var d=Q*b,e=Q*(b+1),f=ka+y+d,g=ka+y+e,l=f,d=ka+E+d,e=ka+E+e,n=g,l=l+H,d=d+H,e=e+H,n=n+H;A.faces.push(new THREE.Face4(l,d,e,n,null,null,v));void 0!==v&&(l=b/c,d=(b+1)/c,e=h+2*i,f=(A.vertices[f].position.z+i)/e,g=(A.vertices[g].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(f,l),new THREE.UV(g,l),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c){a+=H;b+=H;c+=H;A.faces.push(new THREE.Face3(a,
+b,c,null,null,u));if(void 0!==u){var d=x.minX,e=x.minY,f=x.maxY,g=x.maxX,h=A.vertices[b].position.x-d,b=A.vertices[b].position.y-e,j=A.vertices[c].position.x-d,c=A.vertices[c].position.y-e;A.faceVertexUvs[0].push([new THREE.UV((A.vertices[a].position.x-d)/g,(A.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,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,v=b.extrudeMaterial,x=this.shapebb;if(m)r=m.getPoints(q),o=r.length,s=!0,n=!1;n||(l=i=k=0);var B,D,C,A=this,H=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,C=q.length;D<C;D++)B=q[D],THREE.Shape.Utils.isClockWise(B)&&(q[D]=B.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(p,q);t=p;for(D=0,C=q.length;D<C;D++)B=q[D],p=p.concat(B);for(var I,N,$,K,Q=p.length,L=m.length,G=[],j=0,W=t.length,y=W-1,E=j+1;j<W;j++,y++,E++)y===W&&(y=0),E===W&&(E=0),G[j]=d(t[j],t[y],t[E]);var S=[],T,R=G.concat();for(D=0,C=q.length;D<C;D++){B=q[D];T=[];for(j=0,W=B.length,y=W-1,E=j+1;j<W;j++,y++,E++)y===W&&(y=0),E===W&&(E=0),T[j]=d(B[j],B[y],B[E]);S.push(T);R=R.concat(T)}for(I=
+0;I<k;I++){N=I/k;$=i*(1-N);N=l*Math.sin(N*Math.PI/2);for(j=0,W=t.length;j<W;j++)K=c(t[j],G[j],N),f(K.x,K.y,-$);for(D=0,C=q.length;D<C;D++){B=q[D];T=S[D];for(j=0,W=B.length;j<W;j++)K=c(B[j],T[j],N),f(K.x,K.y,-$)}}N=l;for(j=0;j<Q;j++)K=n?c(p[j],R[j],N):p[j],s?f(K.x,K.y+r[0].y,r[0].x):f(K.x,K.y,0);for(I=1;I<=o;I++)for(j=0;j<Q;j++)K=n?c(p[j],R[j],N):p[j],s?f(K.x,K.y+r[I-1].y,r[I-1].x):f(K.x,K.y,h/o*I);for(I=k-1;0<=I;I--){N=I/k;$=i*(1-N);N=l*Math.sin(N*Math.PI/2);for(j=0,W=t.length;j<W;j++)K=c(t[j],G[j],
+N),f(K.x,K.y,h+$);for(D=0,C=q.length;D<C;D++){B=q[D];T=S[D];for(j=0,W=B.length;j<W;j++)K=c(B[j],T[j],N),s?f(K.x,K.y+r[o-1].y,r[o-1].x+$):f(K.x,K.y,h+$)}}if(n){n=0*Q;for(j=0;j<L;j++)l=m[j],g(l[2]+n,l[1]+n,l[0]+n);n=Q*(o+2*k);for(j=0;j<L;j++)l=m[j],g(l[0]+n,l[1]+n,l[2]+n)}else{for(j=0;j<L;j++)l=m[j],g(l[2],l[1],l[0]);for(j=0;j<L;j++)l=m[j],g(l[0]+Q*o,l[1]+Q*o,l[2]+Q*o)}var ka=0;e(t);ka+=t.length;for(D=0,C=q.length;D<C;D++)B=q[D],e(B),ka+=B.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,
-f);c(0,1,7,f);c(0,7,10,f);c(0,10,11,f);c(1,5,9,f);c(5,11,4,f);c(11,10,2,f);c(10,7,6,f);c(7,1,8,f);c(3,9,4,f);c(3,4,2,f);c(3,2,6,f);c(3,6,8,f);c(3,8,9,f);c(4,9,5,f);c(2,4,11,f);c(6,2,10,f);c(8,6,7,f);c(9,8,1,f);for(var g=0;g<this.subdivisions;g++){for(var a=new THREE.Geometry,g=0,h=f.faces.length;g<h;g++){var k=f.faces[g],i=d(k.a,k.b),l=d(k.b,k.c),n=d(k.c,k.a);c(k.a,i,n,a);c(k.b,l,i,a);c(k.c,n,l,a);c(i,l,n,a)}f.faces=a.faces;f.faceVertexUvs[0]=a.faceVertexUvs[0]}e.faces=f.faces;e.faceVertexUvs[0]=
+f);c(0,1,7,f);c(0,7,10,f);c(0,10,11,f);c(1,5,9,f);c(5,11,4,f);c(11,10,2,f);c(10,7,6,f);c(7,1,8,f);c(3,9,4,f);c(3,4,2,f);c(3,2,6,f);c(3,6,8,f);c(3,8,9,f);c(4,9,5,f);c(2,4,11,f);c(6,2,10,f);c(8,6,7,f);c(9,8,1,f);for(var g=0;g<this.subdivisions;g++){for(var a=new THREE.Geometry,g=0,h=f.faces.length;g<h;g++){var i=f.faces[g],l=d(i.a,i.b),k=d(i.b,i.c),n=d(i.c,i.a);c(i.a,l,n,a);c(i.b,k,l,a);c(i.c,n,k,a);c(l,k,n,a)}f.faces=a.faces;f.faceVertexUvs[0]=a.faceVertexUvs[0]}e.faces=f.faces;e.faceVertexUvs[0]=
 f.faceVertexUvs[0];this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],f=[],g=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var k=0;k<=this.angle+0.0010;k+=b){for(h=0;h<c.length;h++)k<this.angle?(c[h]=g.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=f;0==k&&(f=d);
-for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-k/this.angle,h/a.length),new THREE.UV(1-k/this.angle,(h+1)/a.length),new THREE.UV(1-(k-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(k-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
+THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],f=[],g=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=g.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=f;0==i&&(f=d);
+for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,b){function c(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=g.vertices.push(c)-1;var d=Math.atan2(b.z,-b.x)/2/Math.PI+0.5,b=Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5;c.uv=new THREE.UV(d,b);return c}function d(a,b,c,h){1>h?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
 g.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),g.faceVertexUvs[0].push([f(a.uv,a.position,h),f(b.uv,b.position,h),f(c.uv,c.position,h)])):(h-=1,d(a,e(a,b),e(a,c),h),d(e(a,b),b,e(b,c),h),d(e(a,c),e(b,c),c,h),d(e(a,b),e(b,c),e(a,c),h))}function e(a,b){h[a.index]||(h[a.index]=[]);h[b.index]||(h[b.index]=[]);var d=h[a.index][b.index];void 0===d&&(h[a.index][b.index]=h[b.index][a.index]=d=c((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return d}function f(a,b,c){0>c&&1===a.u&&
-(a=new THREE.UV(a.u-1,a.v));0===b.x&&0===b.z&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var b=b||0,g=this;c(new THREE.Vector3(1,0,0));c(new THREE.Vector3(-1,0,0));c(new THREE.Vector3(0,1,0));c(new THREE.Vector3(0,-1,0));c(new THREE.Vector3(0,0,1));c(new THREE.Vector3(0,0,-1));var h=[],k=this.vertices;d(k[0],k[2],k[4],b);d(k[0],k[4],k[3],b);d(k[0],k[3],k[5],b);d(k[0],k[5],k[2],b);d(k[1],k[2],k[5],b);d(k[1],k[5],k[3],b);d(k[1],k[3],k[4],b);d(k[1],k[4],k[2],b);this.boundingSphere=
+(a=new THREE.UV(a.u-1,a.v));0===b.x&&0===b.z&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var b=b||0,g=this;c(new THREE.Vector3(1,0,0));c(new THREE.Vector3(-1,0,0));c(new THREE.Vector3(0,1,0));c(new THREE.Vector3(0,-1,0));c(new THREE.Vector3(0,0,1));c(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],b);d(i[0],i[4],i[3],b);d(i[0],i[3],i[5],b);d(i[0],i[5],i[2],b);d(i[1],i[2],i[5],b);d(i[1],i[5],i[3],b);d(i[1],i[3],i[4],b);d(i[1],i[4],i[2],b);this.boundingSphere=
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
-THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,f=b/2,c=c||1,d=d||1,g=c+1,h=d+1,k=a/c,i=b/d,l=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*k-e,-(a*i-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(l),e.vertexNormals.push(l.clone(),l.clone(),l.clone(),l.clone()),this.faces.push(e),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
+THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var e=a/2,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,k,i=[],l=[];for(k=0;k<=c;k++){var n=[],q=[];for(h=0;h<=b;h++){var o=h/b,p=k/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))}i.push(n);l.push(q)}for(k=0;k<c;k++)for(h=0;h<b;h++){var d=i[k][h+1],e=i[k][h],f=i[k+1][h],g=i[k+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=l[k][h+1].clone(),r=l[k][h].clone(),s=l[k+1][h].clone(),t=l[k+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,
+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,k,i,l,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(" "));i=b.length;for(a=0;a<i;)switch(k=b[a++],k){case "m":k=b[a++]*c+d;l=b[a++]*c;f.push(new THREE.Vector2(k,l));e.moveTo(k,l);break;case "l":k=b[a++]*c+d;l=b[a++]*c;f.push(new THREE.Vector2(k,
-l));e.lineTo(k,l);break;case "q":k=b[a++]*c+d;l=b[a++]*c;o=b[a++]*c+d;p=b[a++]*c;e.quadraticCurveTo(o,p,k,l);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,k),t=THREE.Shape.Utils.b2(t,q,p,l);f.push(new THREE.Vector2(u,t))}}break;case "b":if(k=b[a++]*c+d,l=b[a++]*c,o=b[a++]*c+d,p=b[a++]*-c,m=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(k,l,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,k),t=THREE.Shape.Utils.b3(t,q,p,r,l),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=[],k,i,l;if(0<b(a))for(i=0;i<e;i++)g[i]=i;else for(i=0;i<e;i++)g[i]=e-1-i;var n=2*e;for(i=e-1;2<e;){if(0>=n--){console.log("Warning, unable to triangulate polygon!");break}k=i;e<=k&&(k=0);i=k+1;e<=i&&(i=0);l=i+1;e<=l&&(l=0);var q;a:{q=a;var o=k,p=i,m=l,r=e,s=g,t=void 0,u=void 0,v=void 0,x=void 0,B=void 0,
-D=void 0,C=void 0,A=void 0,F=void 0,u=q[s[o]].x,v=q[s[o]].y,x=q[s[p]].x,B=q[s[p]].y,D=q[s[m]].x,C=q[s[m]].y;if(1.0E-10>(x-u)*(C-v)-(B-v)*(D-u))q=!1;else{for(t=0;t<r;t++)if(!(t==o||t==p||t==m)){var A=q[s[t]].x,F=q[s[t]].y,J=void 0,K=void 0,Z=void 0,L=void 0,O=void 0,M=void 0,H=void 0,j=void 0,V=void 0,y=void 0,E=void 0,Q=void 0,J=Z=O=void 0,J=D-x,K=C-B,Z=u-D,L=v-C,O=x-u,M=B-v,H=A-u,j=F-v,V=A-x,y=F-B,E=A-D,Q=F-C,J=J*y-K*V,O=O*j-M*H,Z=Z*Q-L*E;if(0<=J&&0<=Z&&0<=O){q=!1;break a}}q=!0}}if(q){f.push([a[g[k]],
-a[g[i]],a[g[l]]]);h.push([g[k],g[i],g[l]]);for(k=i,l=i+1;l<e;k++,l++)g[k]=g[l];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};
+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,v=void 0,x=void 0,B=void 0,
+D=void 0,C=void 0,A=void 0,H=void 0,u=q[s[o]].x,v=q[s[o]].y,x=q[s[p]].x,B=q[s[p]].y,D=q[s[m]].x,C=q[s[m]].y;if(1.0E-10>(x-u)*(C-v)-(B-v)*(D-u))q=!1;else{for(t=0;t<r;t++)if(!(t==o||t==p||t==m)){var A=q[s[t]].x,H=q[s[t]].y,I=void 0,N=void 0,$=void 0,K=void 0,Q=void 0,L=void 0,G=void 0,j=void 0,W=void 0,y=void 0,E=void 0,S=void 0,I=$=Q=void 0,I=D-x,N=C-B,$=u-D,K=v-C,Q=x-u,L=B-v,G=A-u,j=H-v,W=A-x,y=H-B,E=A-D,S=H-C,I=I*y-N*W,Q=Q*j-L*G,$=$*S-K*E;if(0<=I&&0<=$&&0<=Q){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,k=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);k.normal.addSelf(b[e]);k.normal.addSelf(b[f]);k.normal.addSelf(b[g]);k.normal.addSelf(b[h]);k.normal.normalize();this.faces.push(k);
+this.tube*Math.sin(g);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,f=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=0.5*e*(2+c);b=0.5*e*(2+c)*b;e=0.5*f*e*Math.sin(a);return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
-Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var k=2*(a/this.segmentsR)*this.p*Math.PI,g=2*(b/this.segmentsT)*Math.PI,f=h(k,g,this.q,this.p,this.radius,this.heightScale),k=h(k+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(k,f);d.add(k,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();k=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=k*d.x+g*e.x;f.y+=k*d.y+g*e.y;f.z+=k*d.z+g*e.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=
-0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),l=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,k,i,l])}this.computeCentroids();this.computeFaceNormals();
+Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=2*(a/this.segmentsR)*this.p*Math.PI,g=2*(b/this.segmentsT)*Math.PI,f=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(i,f);d.add(i,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=i*d.x+g*e.x;f.y+=i*d.y+g*e.y;f.z+=i*d.z+g*e.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=
+0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,f=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,e,f));this.faceVertexUvs[0].push([g,i,l,k])}this.computeCentroids();this.computeFaceNormals();
 this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
 THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.lineGeometry.vertices.push(new THREE.Vertex(new THREE.Vector3));d.lineGeometry.colors.push(new THREE.Color(b));void 0===d.pointMap[a]&&(d.pointMap[a]=[]);d.pointMap[a].push(d.lineGeometry.vertices.length-1)}THREE.Object3D.call(this);var d=this;this.lineGeometry=new THREE.Geometry;this.lineMaterial=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors});this.pointMap={};b("n1","n2",16755200);b("n2",
 "n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200);b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);
@@ -566,148 +567,148 @@ 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,k){var i=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(g.useOldVertexColors){i.vertexColors=[];for(var l,m,n,o=0;4>o;o++){n=k[o];l=new THREE.Color;l.setRGB(0,0,0);for(var p=0;p<n.length;p++)m=h.vertexColors[n[p]-1],l.r+=m.r,l.g+=m.g,l.b+=m.b;l.r/=n.length;l.g/=n.length;l.b/=n.length;i.vertexColors[o]=l}}e.push(i);(!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,k=h.concat(),i=[],l={},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],i.push(s.centroid),k.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=
+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 v=0,t=h.length,x,B,D={},C={},A=function(a,
-b){void 0===D[a]&&(D[a]=[]);D[a].push(b)},F=function(a,b){void 0===C[a]&&(C[a]={});C[a][b]=null};for(o in p){u=p[o];x=o.split("_");B=x[0];x=x[1];A(B,[B,x]);A(x,[B,x]);for(m=0,r=u.length;m<r;m++)s=u[m],F(B,s,o),F(x,s,o);2>u.length&&(n[o]=!0)}for(o in p)if(u=p[o],s=u[0],u=u[1],x=o.split("_"),B=x[0],x=x[1],r=new THREE.Vector3,n[o]?(r.addSelf(h[B].position),r.addSelf(h[x].position),r.multiplyScalar(0.5)):(r.addSelf(i[s]),r.addSelf(i[u]),r.addSelf(h[B].position),r.addSelf(h[x].position),r.multiplyScalar(0.25)),
-l[o]=t+d.length+v,k.push(new THREE.Vertex(r)),v++,g.supportUVs&&0!=q.length)u=new THREE.UV,u.u=q[B].u+q[x].u,u.v=q[B].v+q[x].v,u.u/=2,u.v/=2,q.push(u);var J,K;x=["123","12","2","23"];r=["123","23","3","31"];var A=["123","31","1","12"],F=["1234","12","2","23"],Z=["1234","23","3","34"],L=["1234","34","4","41"],O=["1234","41","1","12"];for(o=0,p=i.length;o<p;o++)s=d[o],u=t+o,s instanceof THREE.Face3?(v=c(s.a,s.b),B=c(s.b,s.c),J=c(s.c,s.a),b(u,l[v],s.b,l[B],s,x),b(u,l[B],s.c,l[J],s,r),b(u,l[J],s.a,l[v],
-s,A)):s instanceof THREE.Face4?(v=c(s.a,s.b),B=c(s.b,s.c),J=c(s.c,s.d),K=c(s.d,s.a),b(u,l[v],s.b,l[B],s,F),b(u,l[B],s.c,l[J],s,Z),b(u,l[J],s.d,l[K],s,L),b(u,l[K],s.a,l[v],s,O)):console.log("face should be a face!",s);d=k;k=new THREE.Vector3;l=new THREE.Vector3;for(o=0,p=h.length;o<p;o++)if(void 0!==D[o]){k.set(0,0,0);l.set(0,0,0);s=new THREE.Vector3(0,0,0);u=0;for(m in C[o])k.addSelf(i[m]),u++;v=0;t=D[o].length;for(m=0;m<t;m++)n[c(D[o][m][0],D[o][m][1])]&&v++;if(2!=v){k.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),l.addSelf(u);l.divideScalar(t);s.addSelf(h[o].position);s.multiplyScalar(t-3);s.addSelf(k);s.addSelf(l.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()};
+b){void 0===D[a]&&(D[a]=[]);D[a].push(b)},H=function(a,b){void 0===C[a]&&(C[a]={});C[a][b]=null};for(o in p){u=p[o];x=o.split("_");B=x[0];x=x[1];A(B,[B,x]);A(x,[B,x]);for(m=0,r=u.length;m<r;m++)s=u[m],H(B,s,o),H(x,s,o);2>u.length&&(n[o]=!0)}for(o in p)if(u=p[o],s=u[0],u=u[1],x=o.split("_"),B=x[0],x=x[1],r=new THREE.Vector3,n[o]?(r.addSelf(h[B].position),r.addSelf(h[x].position),r.multiplyScalar(0.5)):(r.addSelf(l[s]),r.addSelf(l[u]),r.addSelf(h[B].position),r.addSelf(h[x].position),r.multiplyScalar(0.25)),
+k[o]=t+d.length+v,i.push(new THREE.Vertex(r)),v++,g.supportUVs&&0!=q.length)u=new THREE.UV,u.u=q[B].u+q[x].u,u.v=q[B].v+q[x].v,u.u/=2,u.v/=2,q.push(u);var I,N;x=["123","12","2","23"];r=["123","23","3","31"];var A=["123","31","1","12"],H=["1234","12","2","23"],$=["1234","23","3","34"],K=["1234","34","4","41"],Q=["1234","41","1","12"];for(o=0,p=l.length;o<p;o++)s=d[o],u=t+o,s instanceof THREE.Face3?(v=c(s.a,s.b),B=c(s.b,s.c),I=c(s.c,s.a),b(u,k[v],s.b,k[B],s,x),b(u,k[B],s.c,k[I],s,r),b(u,k[I],s.a,k[v],
+s,A)):s instanceof THREE.Face4?(v=c(s.a,s.b),B=c(s.b,s.c),I=c(s.c,s.d),N=c(s.d,s.a),b(u,k[v],s.b,k[B],s,H),b(u,k[B],s.c,k[I],s,$),b(u,k[I],s.d,k[N],s,K),b(u,k[N],s.a,k[v],s,Q)):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 C[o])i.addSelf(l[m]),u++;v=0;t=D[o].length;for(m=0;m<t;m++)n[c(D[o][m][0],D[o][m][1])]&&v++;if(2!=v){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)+
 "%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return 1>a.length?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;
 return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=!0};e.crossOrigin=h.crossOrigin;e.src=b}function f(a,c,d,f,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=d;if(f){a[c].repeat.set(f[0],
-f[1]);if(1!=f[0])a[c].wrapS=THREE.RepeatWrapping;if(1!=f[1])a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==f[h[0]])a[c].wrapS=f[h[0]];if(void 0!==f[h[1]])a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,k="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&("Phong"==a.shading?
-k="MeshPhongMaterial":"Basic"==a.shading&&(k="MeshBasicMaterial"));if(a.blending)if("Additive"==a.blending)i.blending=THREE.AdditiveBlending;else if("Subtractive"==a.blending)i.blending=THREE.SubtractiveBlending;else if("Multiply"==a.blending)i.blending=THREE.MultiplyBlending;if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;if(void 0!==a.depthTest)i.depthTest=a.depthTest;if(void 0!==a.vertexColors)if("face"==a.vertexColors)i.vertexColors=THREE.FaceColors;else if(a.vertexColors)i.vertexColors=
-THREE.VertexColors;if(a.colorDiffuse)i.color=g(a.colorDiffuse);else if(a.DbgColor)i.color=a.DbgColor;if(a.colorSpecular)i.specular=g(a.colorSpecular);if(a.colorAmbient)i.ambient=g(a.colorAmbient);if(a.transparency)i.opacity=a.transparency;if(a.specularCoef)i.shininess=a.specularCoef;a.mapDiffuse&&b&&f(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(i,"normalMap",
-a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var k=THREE.ShaderUtils.lib.normal,l=THREE.UniformsUtils.clone(k.uniforms);l.tNormal.texture=i.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(i.map)l.tDiffuse.texture=i.map,l.enableDiffuse.value=!0;if(i.specularMap)l.tSpecular.texture=i.specularMap,l.enableSpecular.value=!0;if(i.lightMap)l.tAO.texture=
-i.lightMap,l.enableAO.value=!0;l.uDiffuseColor.value.setHex(i.color);l.uSpecularColor.value.setHex(i.specular);l.uAmbientColor.value.setHex(i.ambient);l.uShininess.value=i.shininess;if(void 0!==i.opacity)l.uOpacity.value=i.opacity;i=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:l,lights:!0,fog:!0})}else i=new THREE[k](i);if(void 0!==a.DbgName)i.name=a.DbgName;return i}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
+f[1]);if(1!=f[0])a[c].wrapS=THREE.RepeatWrapping;if(1!=f[1])a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==f[h[0]])a[c].wrapS=f[h[0]];if(void 0!==f[h[1]])a[c].wrapT=f[h[1]]}e(a[c],b+"/"+d)}function g(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,i="MeshLambertMaterial",l={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&("Phong"==a.shading?
+i="MeshPhongMaterial":"Basic"==a.shading&&(i="MeshBasicMaterial"));if(a.blending)if("Additive"==a.blending)l.blending=THREE.AdditiveBlending;else if("Subtractive"==a.blending)l.blending=THREE.SubtractiveBlending;else if("Multiply"==a.blending)l.blending=THREE.MultiplyBlending;if(void 0!==a.transparent||1>a.opacity)l.transparent=a.transparent;if(void 0!==a.depthTest)l.depthTest=a.depthTest;if(void 0!==a.vertexColors)if("face"==a.vertexColors)l.vertexColors=THREE.FaceColors;else if(a.vertexColors)l.vertexColors=
+THREE.VertexColors;if(a.colorDiffuse)l.color=g(a.colorDiffuse);else if(a.DbgColor)l.color=a.DbgColor;if(a.colorSpecular)l.specular=g(a.colorSpecular);if(a.colorAmbient)l.ambient=g(a.colorAmbient);if(a.transparency)l.opacity=a.transparency;if(a.specularCoef)l.shininess=a.specularCoef;a.mapDiffuse&&b&&f(l,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(l,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(l,"normalMap",
+a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&f(l,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var i=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(i.uniforms);k.tNormal.texture=l.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(l.map)k.tDiffuse.texture=l.map,k.enableDiffuse.value=!0;if(l.specularMap)k.tSpecular.texture=l.specularMap,k.enableSpecular.value=!0;if(l.lightMap)k.tAO.texture=
+l.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(l.color);k.uSpecularColor.value.setHex(l.specular);k.uAmbientColor.value.setHex(l.ambient);k.uShininess.value=l.shininess;if(void 0!==l.opacity)k.uOpacity.value=l.opacity;l=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:k,lights:!0,fog:!0})}else l=new THREE[i](l);if(void 0!==a.DbgName)l.name=a.DbgName;return l}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
 THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype.load=function(a,b,c,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,b=d.callback,c=d.texture_path,d=d.bin_path;var c=c?c:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
-THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(4==g.readyState)if(200==g.status||0==g.status)try{var h=JSON.parse(g.responseText);void 0===h.metadata||void 0===h.metadata.formatVersion||3!==h.metadata.formatVersion?console.error("Deprecated file format."):a.loadAjaxBuffers(h,c,e,d,f)}catch(k){console.error(k),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+
+THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(4==g.readyState)if(200==g.status||0==g.status)try{var h=JSON.parse(g.responseText);void 0===h.metadata||void 0===h.metadata.formatVersion||3!==h.metadata.formatVersion?console.error("Deprecated file format."):a.loadAjaxBuffers(h,c,e,d,f)}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+
 g.status+"]")};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,k,i,l,n,q,o,p,m,r,s,t,u,v,x;function B(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function C(a,b){return(new Uint32Array(a,b,1))[0]}function A(b,c){var d,e,f,g,h,i,k,l,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[3*d];f=m[3*d+1];g=m[3*d+2];h=j[2*e];e=j[2*e+1];i=j[2*f];k=j[2*f+1];f=j[2*g];l=j[2*g+1];g=O.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,k));
-n.push(new THREE.UV(f,l));g.push(n)}}function F(b,c){var d,e,f,g,h,i,k,l,m,n,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=j[2*e];e=j[2*e+1];k=j[2*f];m=j[2*f+1];l=j[2*g];n=j[2*g+1];g=j[2*h];f=j[2*h+1];h=O.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(k,m));p.push(new THREE.UV(l,n));p.push(new THREE.UV(g,f));h.push(p)}}function J(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],O.faces.push(new THREE.Face3(e,f,g,null,null,h))}function K(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],O.faces.push(new THREE.Face4(e,f,g,h,null,null,j))}function Z(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=H[3*k],o=H[3*k+1];k=
-H[3*k+2];var p=H[3*l],q=H[3*l+1];l=H[3*l+2];O.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(H[3*i],H[3*i+1],H[3*i+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,q,l)],null,j))}}function L(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=H[3*l],q=H[3*l+1];l=H[3*l+2];var r=H[3*m],s=H[3*m+1];m=H[3*m+2];var t=H[3*n],u=H[3*
-n+1];n=H[3*n+2];O.faces.push(new THREE.Face4(f,g,h,j,[new THREE.Vector3(H[3*k],H[3*k+1],H[3*k+2]),new THREE.Vector3(p,q,l),new THREE.Vector3(r,s,m),new THREE.Vector3(t,u,n)],null,i))}}var O=this,M=0,H=[],j=[],V,y;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(O,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,M,12);e=D(a,M+12);D(a,M+13);D(a,M+14);D(a,M+15);k=D(a,M+16);i=D(a,M+17);l=D(a,M+18);n=D(a,M+19);q=C(a,M+20);
-o=C(a,M+20+4);p=C(a,M+20+8);b=C(a,M+20+12);m=C(a,M+20+16);r=C(a,M+20+20);s=C(a,M+20+24);t=C(a,M+20+28);u=C(a,M+20+32);v=C(a,M+20+36);x=C(a,M+20+40);"Three.js 003"!==c&&console.warn("DEPRECATED: binary model seems to be using old format");M+=e;c=3*k+n;y=4*k+n;e=b*c;V=m*(c+3*i);k=r*(c+3*l);n=s*(c+3*i+3*l);c=t*y;i=u*(y+4*i);l=v*(y+4*l);M+=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],O.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*
-q*Float32Array.BYTES_PER_ELEMENT}(M);M+=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],H.push(d/127,e/127,f/127)}return 3*o*Int8Array.BYTES_PER_ELEMENT}(M);M+=B(3*o);M+=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],j.push(d,e)}return 2*p*Float32Array.BYTES_PER_ELEMENT}(M);e=M+e+B(2*b);V=e+V+B(2*m);k=V+k+B(2*r);n=k+n+B(2*s);c=n+c+B(2*t);i=c+i+B(2*u);l=i+l+B(2*v);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT;
-J(r,a,b+3*r*Uint32Array.BYTES_PER_ELEMENT);A(r,b)}})(V);(function(a){if(s){var b=a+3*s*Uint32Array.BYTES_PER_ELEMENT,c=b+3*s*Uint32Array.BYTES_PER_ELEMENT;Z(s,a,b,c+3*s*Uint32Array.BYTES_PER_ELEMENT);A(s,c)}})(k);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT;K(v,a,b+4*v*Uint32Array.BYTES_PER_ELEMENT);F(v,b)}})(i);(function(a){if(x){var b=a+4*x*Uint32Array.BYTES_PER_ELEMENT,c=b+4*x*Uint32Array.BYTES_PER_ELEMENT;L(x,a,b,c+4*x*Uint32Array.BYTES_PER_ELEMENT);F(x,c)}})(l);b&&J(b,M,M+3*b*
-Uint32Array.BYTES_PER_ELEMENT);(function(a){if(m){var b=a+3*m*Uint32Array.BYTES_PER_ELEMENT;Z(m,a,b,b+3*m*Uint32Array.BYTES_PER_ELEMENT)}})(e);t&&K(t,n,n+4*t*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;L(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){T=a;d=d||da;void 0!==e&&(a=e.split("/"),a.pop(),cb=1>a.length?"":a.join("/")+"/");if((a=T.evaluate("//dae:asset",T,V,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":ya=j.textContent.charAt(0)}}if(!Ca.convertUpAxis||ya===Ca.upAxis)la=null;else switch(ya){case "X":la="Y"===Ca.upAxis?
-"XtoY":"XtoZ";break;case "Y":la="X"===Ca.upAxis?"YtoX":"YtoZ";break;case "Z":la="X"===Ca.upAxis?"ZtoX":"ZtoY"}Qa=b("//dae:library_images/dae:image",g,"image");Ia=b("//dae:library_materials/dae:material",C,"material");za=b("//dae:library_effects/dae:effect",Z,"effect");Ga=b("//dae:library_geometries/dae:geometry",r,"geometry");Ba=b("//dae:library_controllers/dae:controller",h,"controller");ka=b("//dae:library_animations/dae:animation",O,"animation");jb=b(".//dae:library_visual_scenes/dae:visual_scene",
-l,"visual_scene");Sa=[];Va=[];(a=T.evaluate(".//dae:scene/dae:instance_visual_scene",T,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),$=jb[a]):$=null;ba=new THREE.Object3D;for(a=0;a<$.nodes.length;a++)ba.add(f($.nodes[a]));Ua=[];c(ba);a={scene:ba,morphs:Sa,skins:Va,animations:Ua,dae:{images:Qa,materials:Ia,effects:za,geometries:Ga,controllers:Ba,animations:ka,visualScenes:jb,scene:$}};d&&d(a);return a}function b(a,b,c){for(var a=T.evaluate(a,
-T,V,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=$.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};Ua.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=Ba[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||
-!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var c=1E6,g=-c,h=0;for(e in ka)for(var j=ka[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=$.getChildById(b.skeleton[0],!0)||$.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 '"+
-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=Ba[a.controllers[g].url];switch(j.type){case "skin":if(Ga[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(Ba[j.skin.source]&&(d=j=Ba[j.skin.source],j.morph&&Ga[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(Ga[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=Ga[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=za[Ia[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=
-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=Ba[c.url],i.skinInstanceController=c,i.name="skin_"+Va.length,Va.push(i);else if(void 0!==d){h=j;k=d instanceof o?Ba[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(n=Ga[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_"+Sa.length;Sa.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];Ca.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 k(){this.weights=this.targets=this.source=this.method=null}function i(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function l(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function n(){this.sid=this.name=this.id="";this.nodes=
+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,v,x;function B(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function C(a,b){return(new Uint32Array(a,b,1))[0]}function A(b,c){var d,e,f,g,h,i,l,k,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[3*d];f=m[3*d+1];g=m[3*d+2];h=j[2*e];e=j[2*e+1];i=j[2*f];l=j[2*f+1];f=j[2*g];k=j[2*g+1];g=Q.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,l));
+n.push(new THREE.UV(f,k));g.push(n)}}function H(b,c){var d,e,f,g,h,i,l,k,m,n,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=j[2*e];e=j[2*e+1];l=j[2*f];m=j[2*f+1];k=j[2*g];n=j[2*g+1];g=j[2*h];f=j[2*h+1];h=Q.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(l,m));p.push(new THREE.UV(k,n));p.push(new THREE.UV(g,f));h.push(p)}}function I(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],Q.faces.push(new THREE.Face3(e,f,g,null,null,h))}function N(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],Q.faces.push(new THREE.Face4(e,f,g,h,null,null,j))}function $(b,c,d,e){for(var f,g,h,j,i,l,k,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];l=d[3*e+1];k=d[3*e+2];j=m[e];var n=G[3*l],o=G[3*l+1];l=
+G[3*l+2];var p=G[3*k],q=G[3*k+1];k=G[3*k+2];Q.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(G[3*i],G[3*i+1],G[3*i+2]),new THREE.Vector3(n,o,l),new THREE.Vector3(p,q,k)],null,j))}}function K(b,c,d,e){for(var f,g,h,j,i,l,k,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];l=d[4*e];k=d[4*e+1];m=d[4*e+2];n=d[4*e+3];i=o[e];var p=G[3*k],q=G[3*k+1];k=G[3*k+2];var r=G[3*m],s=G[3*m+1];m=G[3*m+2];var t=G[3*n],u=G[3*
+n+1];n=G[3*n+2];Q.faces.push(new THREE.Face4(f,g,h,j,[new THREE.Vector3(G[3*l],G[3*l+1],G[3*l+2]),new THREE.Vector3(p,q,k),new THREE.Vector3(r,s,m),new THREE.Vector3(t,u,n)],null,i))}}var Q=this,L=0,G=[],j=[],W,y;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(Q,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,L,12);e=D(a,L+12);D(a,L+13);D(a,L+14);D(a,L+15);i=D(a,L+16);l=D(a,L+17);k=D(a,L+18);n=D(a,L+19);q=C(a,L+20);
+o=C(a,L+20+4);p=C(a,L+20+8);b=C(a,L+20+12);m=C(a,L+20+16);r=C(a,L+20+20);s=C(a,L+20+24);t=C(a,L+20+28);u=C(a,L+20+32);v=C(a,L+20+36);x=C(a,L+20+40);"Three.js 003"!==c&&console.warn("DEPRECATED: binary model seems to be using old format");L+=e;c=3*i+n;y=4*i+n;e=b*c;W=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=v*(y+4*k);L+=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],Q.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return 3*
+q*Float32Array.BYTES_PER_ELEMENT}(L);L+=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],G.push(d/127,e/127,f/127)}return 3*o*Int8Array.BYTES_PER_ELEMENT}(L);L+=B(3*o);L+=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],j.push(d,e)}return 2*p*Float32Array.BYTES_PER_ELEMENT}(L);e=L+e+B(2*b);W=e+W+B(2*m);i=W+i+B(2*r);n=i+n+B(2*s);c=n+c+B(2*t);l=c+l+B(2*u);k=l+k+B(2*v);(function(a){if(r){var b=a+3*r*Uint32Array.BYTES_PER_ELEMENT;
+I(r,a,b+3*r*Uint32Array.BYTES_PER_ELEMENT);A(r,b)}})(W);(function(a){if(s){var b=a+3*s*Uint32Array.BYTES_PER_ELEMENT,c=b+3*s*Uint32Array.BYTES_PER_ELEMENT;$(s,a,b,c+3*s*Uint32Array.BYTES_PER_ELEMENT);A(s,c)}})(i);(function(a){if(v){var b=a+4*v*Uint32Array.BYTES_PER_ELEMENT;N(v,a,b+4*v*Uint32Array.BYTES_PER_ELEMENT);H(v,b)}})(l);(function(a){if(x){var b=a+4*x*Uint32Array.BYTES_PER_ELEMENT,c=b+4*x*Uint32Array.BYTES_PER_ELEMENT;K(x,a,b,c+4*x*Uint32Array.BYTES_PER_ELEMENT);H(x,c)}})(k);b&&I(b,L,L+3*b*
+Uint32Array.BYTES_PER_ELEMENT);(function(a){if(m){var b=a+3*m*Uint32Array.BYTES_PER_ELEMENT;$(m,a,b,b+3*m*Uint32Array.BYTES_PER_ELEMENT)}})(e);t&&N(t,n,n+4*t*Uint32Array.BYTES_PER_ELEMENT);(function(a){if(u){var b=a+4*u*Uint32Array.BYTES_PER_ELEMENT;K(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){V=a;d=d||da;void 0!==e&&(a=e.split("/"),a.pop(),ib=1>a.length?"":a.join("/")+"/");if((a=V.evaluate("//dae:asset",V,W,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":Ba=j.textContent.charAt(0)}}if(!ra.convertUpAxis||Ba===ra.upAxis)ja=null;else switch(Ba){case "X":ja="Y"===ra.upAxis?
+"XtoY":"XtoZ";break;case "Y":ja="X"===ra.upAxis?"YtoX":"YtoZ";break;case "Z":ja="X"===ra.upAxis?"ZtoX":"ZtoY"}Qa=b("//dae:library_images/dae:image",g,"image");Ja=b("//dae:library_materials/dae:material",C,"material");Da=b("//dae:library_effects/dae:effect",$,"effect");Aa=b("//dae:library_geometries/dae:geometry",r,"geometry");za=b("//dae:library_controllers/dae:controller",h,"controller");la=b("//dae:library_animations/dae:animation",Q,"animation");Ta=b(".//dae:library_visual_scenes/dae:visual_scene",
+k,"visual_scene");db=[];Wa=[];(a=V.evaluate(".//dae:scene/dae:instance_visual_scene",V,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ca=Ta[a]):ca=null;ba=new THREE.Object3D;for(a=0;a<ca.nodes.length;a++)ba.add(f(ca.nodes[a]));$a=[];c(ba);a={scene:ba,morphs:db,skins:Wa,animations:$a,dae:{images:Qa,materials:Ja,effects:Da,geometries:Aa,controllers:za,animations:la,visualScenes:Ta,scene:ca}};d&&d(a);return a}function b(a,b,c){for(var a=V.evaluate(a,
+V,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||0==e.id.length)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=ca.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};$a.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 la)for(var j=la[e],i=0;i<j.sampler.length;i++){var l=j.sampler[i];l.create();c=Math.min(c,l.startTime);g=Math.max(g,l.endTime);h=Math.max(h,l.input.length)}e=h;for(var b=ca.getChildById(b.skeleton[0],!0)||ca.getChildBySid(b.skeleton[0],!0),k,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;l=f.skin;for(m=0;m<i.length;m++)if(k=i[m],n=-1,"JOINT"==k.type){for(var o=0;o<l.joints.length;o++)if(k.sid==l.joints[o]){n=o;break}if(0<=n){o=l.invBindMatrices[n];k.invBindMatrix=o;k.skinningMatrix=new THREE.Matrix4;k.skinningMatrix.multiply(k.world,o);k.weights=[];for(o=0;o<l.weights.length;o++)for(var p=0;p<l.weights[o].length;p++){var q=l.weights[o][p];q.joint==n&&k.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+
+k.sid+"'.";}for(i=0;i<h.length;i++)if("JOINT"==h[i].type)for(l=0;l<h[i].weights.length;l++)k=h[i].weights[l],m=k.index,k=k.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*k,m.position.y+=g.y*k,m.position.z+=g.z*k;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(Aa[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&&Aa[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(Aa[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=Aa[j.url],l={},k=[],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=Da[Ja[p.target].instance_effect.url].shader;q.material.opacity=!q.material.opacity?1:q.material.opacity;l[p.symbol]=n;k.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=
+k;for(h=0;h<j.faces.length;h++)k=j.faces[h],k.materialIndex=l[k.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_"+Wa.length,Wa.push(i);else if(void 0!==d){h=j;l=d instanceof o?za[d.url]:d;if(!l||!l.morph)console.log("could not find morph controller!");else{l=l.morph;for(k=0;k<l.targets.length;k++)if(n=Aa[l.targets[k]],n.mesh&&n.mesh.primitives&&n.mesh.primitives.length)n=n.mesh.primitives[0].geometry,
+n.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:n.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}i.morphTargets=!0;i=new THREE.Mesh(j,i);i.name="morph_"+db.length;db.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];ra.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 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 v(){this.source="";this.stride=this.count=0;this.params=[]}function x(){this.input={}}function B(){this.semantic="";this.offset=0;this.source="";this.set=0}function D(a){this.id=a;this.type=null}function C(){this.name=this.id="";this.instance_effect=null}function A(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}
-function F(a,b){this.type=a;this.effect=b;this.material=null}function J(a){this.effect=a;this.format=this.init_from=null}function K(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Z(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function L(){this.url=""}function O(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function M(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=
-this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function H(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function j(a){this.targets=[];this.time=a}function V(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function y(a){for(var a=Q(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function E(a){for(var a=Q(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],
-10));return b}function Q(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function S(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function aa(a,b){if(Ca.convertUpAxis&&ya!==Ca.upAxis)switch(la){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 ja(a,b){var c=[a[b],a[b+1],a[b+2]];aa(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ga(a){if(Ca.convertUpAxis){var b=[a[0],a[4],a[8]];aa(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];aa(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];aa(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];aa(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];aa(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];aa(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],
-a[11]];aa(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var T=null,ba=null,$,da=null,ha={},Qa={},ka={},Ba={},Ga={},Ia={},za={},Ua,jb,cb,Sa,Va,Ya=THREE.SmoothShading,Ca={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},ya="Y",la=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=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 i).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new k).parse(c),this.type=c.nodeName}}return this};k.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};k.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 B).parse(d))}}return b};
-i.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=ga(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,
-b);return this};i.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 B).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()}}};i.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 B).parse(g));break;
-case "v":c=E(g.textContent);break;case "vcount":d=E(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],j=[],i=0;i<h;i++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}j.push(k);g+=e.length}for(i=0;i<j.length;i++)j[i].index=f;this.weights.push(j)}};l.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};
-l.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};l.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 n).parse(c))}}return this};n.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],
+function H(a,b){this.type=a;this.effect=b;this.material=null}function I(a){this.effect=a;this.format=this.init_from=null}function N(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function $(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function K(){this.url=""}function Q(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function L(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=
+this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function G(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function j(a){this.targets=[];this.time=a}function W(a){return"dae"==a?"http://www.collada.org/2005/11/COLLADASchema":null}function y(a){for(var a=S(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function E(a){for(var a=S(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],
+10));return b}function S(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function T(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function R(a,b){if(ra.convertUpAxis&&Ba!==ra.upAxis)switch(ja){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 ka(a,b){var c=[a[b],a[b+1],a[b+2]];R(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function ga(a){if(ra.convertUpAxis){var b=[a[0],a[4],a[8]];R(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];R(b,-1);a[1]=b[0];a[5]=b[1];a[9]=b[2];b=[a[2],a[6],a[10]];R(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];R(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];R(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];R(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];
+R(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 V=null,ba=null,ca,da=null,ha={},Qa={},la={},za={},Aa={},Ja={},Da={},$a,Ta,ib,db,Wa,Xa=THREE.SmoothShading,ra={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},Ba="Y",ja=null,ab=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 B).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=ga(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,
+b);return this};l.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "input":var d=(new B).parse(d),e=b[d.source];if("JOINT"==d.semantic)this.joints=e.read();else if("INV_BIND_MATRIX"==d.semantic)this.invBindMatrices=e.read()}}};l.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(1==g.nodeType)switch(g.nodeName){case "input":e.push((new B).parse(g));break;
+case "v":c=E(g.textContent);break;case "vcount":d=E(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],j=[],i=0;i<h;i++){for(var l={},k=0;k<e.length;k++){var m=e[k],n=c[g+m.offset];switch(m.semantic){case "JOINT":l.joint=n;break;case "WEIGHT":l.weight=b[m.source].data[n]}}j.push(l);g+=e.length}for(i=0;i<j.length;i++)j[i].index=f;this.weights.push(j)}};k.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};
+k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "node":this.nodes.push((new n).parse(c))}}return this};n.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};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=T.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",T,V,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 ka)for(var e=ka[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(Ca.convertUpAxis)switch(g){case "X":switch(la){case "XtoY":case "XtoZ":case "YtoX":g="Y";break;case "ZtoX":g="Z"}break;case "Y":switch(la){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(la){case "XtoZ":g=
-"X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,k=this.getTransformBySid(b.sid);if(k){-1===a.indexOf(f)&&a.push(f);b=0;for(var l=i.length;b<l;b++){var p=i[b],r=h.getData(k.type,b),s;s=null;for(var t=0,u=d.length;t<u&&null==s;t++){var v=d[t];if(v.time===p)s=v;else if(v.time>p)break}if(!s){s=new j(p);t=-1;u=0;for(v=d.length;u<v&&-1==t;u++)d[u].time>=p&&(t=u);p=t;d.splice(-1==p?d.length:p,0,s)}s.addTarget(f,k,g,r)}}else console.log('Could not find transform "'+b.sid+'" in node '+
-this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(s=d[b],!s.hasTarget(e)){h=d;f=s;k=b;g=e;i=void 0;a:{i=k?k-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(l=h[i],l.hasTarget(g)){i=l;break a}i=null}l=void 0;a:{for(k+=1;k<h.length;k++)if(l=h[k],l.hasTarget(g))break a;l=null}if(i&&l){h=(f.time-i.time)/(l.time-i.time);i=i.getTarget(g);k=l.getTarget(g).data;l=i.data;r=void 0;if(l.length){r=[];for(p=0;p<l.length;++p)r[p]=l[p]+(k[p]-l[p])*h}else r=l+(k-l)*h;f.addTarget(g,i.transform,i.member,r)}}}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=ga(this.data);break;case "rotate":this.angle=this.data[3]*Sb;case "translate":aa(this.data,-1);this.obj=new THREE.Vector3(this.data[0],
-this.data[1],this.data[2]);break;case "scale":aa(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};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*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=T.evaluate(".//dae:instance_material",c,V,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=T.evaluate(".//dae:instance_material",c,V,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<
+"");(b=V.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",V,W,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 la)for(var e=la[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(ra.convertUpAxis)switch(g){case "X":switch(ja){case "XtoY":case "XtoZ":case "YtoX":g="Y";break;case "ZtoX":g="Z"}break;case "Y":switch(ja){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(ja){case "XtoZ":g=
+"X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,l=this.getTransformBySid(b.sid);if(l){-1===a.indexOf(f)&&a.push(f);b=0;for(var k=i.length;b<k;b++){var p=i[b],r=h.getData(l.type,b),s;s=null;for(var t=0,u=d.length;t<u&&null==s;t++){var v=d[t];if(v.time===p)s=v;else if(v.time>p)break}if(!s){s=new j(p);t=-1;u=0;for(v=d.length;u<v&&-1==t;u++)d[u].time>=p&&(t=u);p=t;d.splice(-1==p?d.length:p,0,s)}s.addTarget(f,l,g,r)}}else console.log('Could not find transform "'+b.sid+'" in node '+
+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(s=d[b],!s.hasTarget(e)){h=d;f=s;l=b;g=e;i=void 0;a:{i=l?l-1:0;for(i=0<=i?i:i+h.length;0<=i;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(l+=1;l<h.length;l++)if(k=h[l],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-i.time);i=i.getTarget(g);l=k.getTarget(g).data;k=i.data;r=void 0;if(k.length){r=[];for(p=0;p<k.length;++p)r[p]=k[p]+(l[p]-k[p])*h}else r=k+(l-k)*h;f.addTarget(g,i.transform,i.member,r)}}}this.keys=
+d;this.sids=a}this.updateMatrix();return this};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=ga(this.data);break;case "rotate":this.angle=this.data[3]*ab;case "translate":R(this.data,-1);this.obj=new THREE.Vector3(this.data[0],
+this.data[1],this.data[2]);break;case "scale":R(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*ab;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*ab}}};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=V.evaluate(".//dae:instance_material",c,W,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=V.evaluate(".//dae:instance_material",c,W,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 x).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(ja(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(ja(k.data,j));break;case "TEXCOORD":void 0===q[h.set]&&(q[h.set]=
-[]);q[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(3===m)d.push(new THREE.Face3(o[0],o[1],o[2],[p[0],p[1],p[2]],r.length?r:new THREE.Color));else if(4===m)d.push(new THREE.Face4(o[0],o[1],o[2],o[3],[p[0],p[1],p[2],p[3]],r.length?r:new THREE.Color));else if(4<m&&Ca.subdivideFaces){r=r.length?r:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(o[0],o[e],o[e+1],[p[0],p[e++],p[e]],r))}if(d.length){o=
+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(ka(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(ka(k.data,j));break;case "TEXCOORD":void 0===q[h.set]&&(q[h.set]=
+[]);q[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(k.data[j],k.data[j+1],k.data[j+2]))}e=null;d=[];if(3===m)d.push(new THREE.Face3(o[0],o[1],o[2],[p[0],p[1],p[2]],r.length?r:new THREE.Color));else if(4===m)d.push(new THREE.Face4(o[0],o[1],o[2],o[3],[p[0],p[1],p[2],p[3]],r.length?r:new THREE.Color));else if(4<m&&ra.subdivideFaces){r=r.length?r:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(o[0],o[e],o[e+1],[p[0],p[e++],p[e]],r))}if(d.length){o=
 0;for(p=d.length;o<p;o++){e=d[o];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<n.length;e++)r=q[n[e]],r=4<m?[r[0],r[o+1],r[o+2]]:4===m?[r[0],r[1],r[2],r[3]]:[r[0],r[1],r[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(r)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=g.length*m}};t.prototype=new u;t.prototype.constructor=t;u.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=
-a.input.POSITION.source};u.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=S(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new B).parse(a.childNodes[b]));break;case "vcount":this.vcount=E(c.textContent);break;case "p":this.p=E(c.textContent)}}return this};v.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=S(a,"count",0);this.stride=
-S(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};x.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){var c=(new B).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};B.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
-"");this.set=S(a,"set",-1);this.offset=S(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=Q(c.textContent),e=[],f=0;f<d.length;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=y(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
-E(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=Q(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new v).parse(c.childNodes[d]);break}}}return this};D.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=
-this.data.slice(b,b+16),c=ga(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};C.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new L).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return null==this.texture};A.prototype.isTexture=function(){return null!=this.texture};
+a.input.POSITION.source};u.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=T(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new B).parse(a.childNodes[b]));break;case "vcount":this.vcount=E(c.textContent);break;case "p":this.p=E(c.textContent)}}return this};v.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=T(a,"count",0);this.stride=
+T(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if("param"==c.nodeName){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};x.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if("input"==a.childNodes[b].nodeName){var c=(new B).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};B.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
+"");this.set=T(a,"set",-1);this.offset=T(a,"offset",0);if("TEXCOORD"==this.semantic&&0>this.set)this.set=0;return this};D.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=S(c.textContent),e=[],f=0;f<d.length;f++)e.push("true"==d[f]||"1"==d[f]?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=y(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
+E(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=S(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if("accessor"==c.childNodes[d].nodeName){this.accessor=(new v).parse(c.childNodes[d]);break}}}return this};D.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=
+this.data.slice(b,b+16),c=ga(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};C.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if("instance_effect"==a.childNodes[b].nodeName){this.instance_effect=(new K).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return null==this.texture};A.prototype.isTexture=function(){return null!=this.texture};
 A.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "color":c=y(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};A.prototype.parseTexture=function(a){if(!a.childNodes)return this;
-a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};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 A).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=T.evaluate(".//dae:float",c,V,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 A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=Qa[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(cb+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=Ya;return this.material=new THREE.MeshLambertMaterial(a)};J.prototype.parse=function(a){for(var b=0;b<
-a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "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};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 "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};Z.prototype.create=function(){if(null==this.shader)return null};Z.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};
-Z.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 J(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new K(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};Z.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
-break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};Z.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new F(c.nodeName,this)).parse(c)}}};L.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};O.prototype.parse=function(a){this.id=
-a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "source":c=(new D).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new H(this)).parse(c));break;case "channel":this.channel.push((new M(this)).parse(c))}}return this};M.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");
-b.shift();var a=b.shift(),c=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};H.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new B).parse(c))}}return this};
-H.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=
-0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};H.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":aa(c,-1);break;case "scale":aa(c,1)}}else c=this.output[b];return c};j.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,
+a.childNodes[1]&&"extra"===a.childNodes[1].nodeName&&(a=a.childNodes[1],a.childNodes[1]&&"technique"===a.childNodes[1].nodeName&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};H.prototype.parse=
+function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new A).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=V.evaluate(".//dae:float",c,W,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;0<d.length&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();
+return this};H.prototype.create=function(){var a={},b=void 0!==this.transparency&&1>this.transparency,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=Qa[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(ib+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=Xa;return this.material=new THREE.MeshLambertMaterial(a)};I.prototype.parse=function(a){for(var b=0;b<
+a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};N.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};$.prototype.create=function(){if(null==this.shader)return null};$.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};
+$.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "surface":this.surface=(new I(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new N(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};$.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(1==d.nodeType)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};$.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new H(c.nodeName,this)).parse(c)}}};K.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};Q.prototype.parse=function(a){this.id=
+a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "source":c=(new D).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new G(this)).parse(c));break;case "channel":this.channel.push((new L(this)).parse(c))}}return this};L.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");
+b.shift();var a=b.shift(),c=0<=a.indexOf("."),d=0<=a.indexOf("(");if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};G.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(1==c.nodeType)switch(c.nodeName){case "input":this.inputs.push((new B).parse(c))}}return this};
+G.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=
+0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};G.prototype.getData=function(a,b){var c;if(1<this.strideOut){c=[];for(var b=b*this.strideOut,d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(3===this.strideOut)switch(a){case "rotate":case "translate":R(c,-1);break;case "scale":R(c,1)}}else c=this.output[b];return c};j.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,
 member:c,transform:b,data:d})};j.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};j.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};j.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};j.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=
 this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(a.time-this.time),g=e.data,h=d.data;if(0>f||1<f)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=0>f?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};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?(da=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){Ya=a},applySkin:e,geometries:Ga,options:Ca}};
+function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(da=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){Xa=a},applySkin:e,geometries:Aa,options:ra}};
 THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
-THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var 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(k){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})):
+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,k,i,l,n,q,o,p,m,r,s,t,u,v=a.faces;n=a.vertices;var x=a.normals,B=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]=[];i=0;for(l=n.length;i<
-l;)q=new THREE.Vertex,q.position.x=n[i++]*b,q.position.y=n[i++]*b,q.position.z=n[i++]*b,d.vertices.push(q);i=0;for(l=v.length;i<l;){b=v[i++];n=b&1;k=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=v[i++],r.b=v[i++],r.c=v[i++],r.d=v[i++],n=4):(r=new THREE.Face3,r.a=v[i++],r.b=v[i++],r.c=v[i++],n=3);if(k)k=v[i++],r.materialIndex=k;k=d.faces.length;if(c)for(c=0;c<D;c++)s=a.uvs[c],p=v[i++],u=s[2*p],p=s[2*p+1],d.faceUvs[c][k]=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=v[i++],u=s[2*p],p=s[2*p+1],t[e]=new THREE.UV(u,p);d.faceVertexUvs[c][k]=t}if(o)o=3*v[i++],e=new THREE.Vector3,e.x=x[o++],e.y=x[o++],e.z=x[o],r.normal=e;if(q)for(c=0;c<n;c++)o=3*v[i++],e=new THREE.Vector3,e.x=x[o++],e.y=x[o++],e.z=x[o],r.vertexNormals.push(e);if(m)q=v[i++],q=new THREE.Color(B[q]),r.color=q;if(b)for(c=0;c<n;c++)q=v[i++],q=new THREE.Color(B[q]),r.vertexColors.push(q);d.faces.push(r)}}})(e);(function(){var b,c,e,k;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=
-2)e=a.skinWeights[b],k=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,k,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],k=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,k,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(void 0!==a.morphTargets){var c,e,k,i,l,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(k=0,i=p.length;k<i;k+=3)l=p[k]*b,n=p[k+1]*b,q=p[k+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(l,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=[];i=d.morphColors[c].colors;l=a.morphColors[c].colors;for(b=0,k=l.length;b<k;b+=3)n=new THREE.Color(16755200),n.setRGB(l[b],l[b+1],l[b+2]),i.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,v=a.faces;n=a.vertices;var x=a.normals,B=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=v.length;l<k;){b=v[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=v[l++],r.b=v[l++],r.c=v[l++],r.d=v[l++],n=4):(r=new THREE.Face3,r.a=v[l++],r.b=v[l++],r.c=v[l++],n=3);if(i)i=v[l++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<D;c++)s=a.uvs[c],p=v[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=v[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*v[l++],e=new THREE.Vector3,e.x=x[o++],e.y=x[o++],e.z=x[o],r.normal=e;if(q)for(c=0;c<n;c++)o=3*v[l++],e=new THREE.Vector3,e.x=x[o++],e.y=x[o++],e.z=x[o],r.vertexNormals.push(e);if(m)q=v[l++],q=new THREE.Color(B[q]),r.color=q;if(b)for(c=0;c<n;c++)q=v[l++],q=new THREE.Color(B[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:i+"/"+a}function e(){var a;for(q in L.objects)if(!y.objects[q])if(s=L.objects[q],void 0!==s.geometry){if(F=y.geometries[s.geometry]){a=!1;for(E=0;E<s.materials.length;E++)Z=y.materials[s.materials[E]],a=Z instanceof THREE.ShaderMaterial;a&&F.computeTangents();v=s.position;x=s.rotation;B=s.quaternion;D=s.scale;B=0;0==Z.length&&(Z=new THREE.MeshFaceMaterial);1<Z.length&&(Z=new THREE.MeshFaceMaterial);
-a=new THREE.Mesh(F,Z);a.name=q;a.position.set(v[0],v[1],v[2]);B?(a.quaternion.set(B[0],B[1],B[2],B[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[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=
+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 K.objects)if(!y.objects[q])if(s=K.objects[q],void 0!==s.geometry){if(H=y.geometries[s.geometry]){a=!1;for(E=0;E<s.materials.length;E++)$=y.materials[s.materials[E]],a=$ instanceof THREE.ShaderMaterial;a&&H.computeTangents();v=s.position;x=s.rotation;B=s.quaternion;D=s.scale;B=0;0==$.length&&($=new THREE.MeshFaceMaterial);1<$.length&&($=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(H,$);a.name=q;a.position.set(v[0],v[1],v[2]);B?(a.quaternion.set(B[0],B[1],B[2],B[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[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(H),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 v=s.position,x=s.rotation,B=s.quaternion,D=s.scale,B=0,a=new THREE.Object3D,a.name=q,a.position.set(v[0],v[1],v[2]),B?(a.quaternion.set(B[0],B[1],B[2],B[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[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();M-=1;k.onLoadComplete();h()}}function g(a){return function(b){y.geometries[a]=b}}function h(){k.callbackProgress({totalModels:j,totalTextures:V,loadedModels:j-M,loadedTextures:V-H},y);k.onLoadProgress();0==M&&0==H&&b(y)}var k=this,i=THREE.Loader.prototype.extractUrlbase(c),l,n,q,o,p,m,r,s,t,u,v,x,B,D,C,A,F,J,K,Z,L,O,M,H,j,V,y;L=a;c=new THREE.BinaryLoader;O=new THREE.JSONLoader;H=M=0;y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
-empties:{}};a=!1;for(q in L.objects)if(s=L.objects[q],s.meshCollider){a=!0;break}if(a)y.scene.collisions=new THREE.CollisionSystem;if(L.transform)a=L.transform.position,t=L.transform.rotation,C=L.transform.scale,a&&y.scene.position.set(a[0],a[1],a[2]),t&&y.scene.rotation.set(t[0],t[1],t[2]),C&&y.scene.scale.set(C[0],C[1],C[2]),(a||t||C)&&y.scene.updateMatrix();a=function(){H-=1;h();k.onLoadComplete()};for(p in L.cameras)C=L.cameras[p],"perspective"==C.type?J=new THREE.PerspectiveCamera(C.fov,C.aspect,
-C.near,C.far):"ortho"==C.type&&(J=new THREE.OrthographicCamera(C.left,C.right,C.top,C.bottom,C.near,C.far)),v=C.position,t=C.target,C=C.up,J.position.set(v[0],v[1],v[2]),J.target=new THREE.Vector3(t[0],t[1],t[2]),C&&J.up.set(C[0],C[1],C[2]),y.cameras[p]=J;for(o in L.lights)t=L.lights[o],p=void 0!==t.color?t.color:16777215,J=void 0!==t.intensity?t.intensity:1,"directional"==t.type?(v=t.direction,u=new THREE.DirectionalLight(p,J),u.position.set(v[0],v[1],v[2]),u.position.normalize()):"point"==t.type?
-(v=t.position,u=t.distance,u=new THREE.PointLight(p,J,u),u.position.set(v[0],v[1],v[2])):"ambient"==t.type&&(u=new THREE.AmbientLight(p)),y.scene.add(u),y.lights[o]=u;for(m in L.fogs)o=L.fogs[m],"linear"==o.type?K=new THREE.Fog(0,o.near,o.far):"exp2"==o.type&&(K=new THREE.FogExp2(0,o.density)),C=o.color,K.color.setRGB(C[0],C[1],C[2]),y.fogs[m]=K;if(y.cameras&&L.defaults.camera)y.currentCamera=y.cameras[L.defaults.camera];if(y.fogs&&L.defaults.fog)y.scene.fog=y.fogs[L.defaults.fog];C=L.defaults.bgcolor;
-y.bgColor=new THREE.Color;y.bgColor.setRGB(C[0],C[1],C[2]);y.bgColorAlpha=L.defaults.bgalpha;for(l in L.geometries)if(m=L.geometries[l],"bin_mesh"==m.type||"ascii_mesh"==m.type)M+=1,k.onLoadStart();j=M;for(l in L.geometries)m=L.geometries[l],"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[l]=F):"plane"==m.type?(F=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),y.geometries[l]=
-F):"sphere"==m.type?(F=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),y.geometries[l]=F):"cylinder"==m.type?(F=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),y.geometries[l]=F):"torus"==m.type?(F=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),y.geometries[l]=F):"icosahedron"==m.type?(F=new THREE.IcosahedronGeometry(m.subdivisions),y.geometries[l]=F):"bin_mesh"==m.type?c.load(d(m.url,L.urlBaseType),f(l)):"ascii_mesh"==m.type?O.load(d(m.url,
-L.urlBaseType),f(l)):"embedded_mesh"==m.type&&(m=L.embeds[m.id])&&O.createModel(m,g(l),"");for(r in L.textures)if(l=L.textures[r],l.url instanceof Array){H+=l.url.length;for(m=0;m<l.url.length;m++)k.onLoadStart()}else H+=1,k.onLoadStart();V=H;for(r in L.textures){l=L.textures[r];if(void 0!=l.mapping&&void 0!=THREE[l.mapping])l.mapping=new THREE[l.mapping];if(l.url instanceof Array){m=[];for(var E=0;E<l.url.length;E++)m[E]=d(l.url[E],L.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,l.mapping,a)}else{m=
-THREE.ImageUtils.loadTexture(d(l.url,L.urlBaseType),l.mapping,a);if(void 0!=THREE[l.minFilter])m.minFilter=THREE[l.minFilter];if(void 0!=THREE[l.magFilter])m.magFilter=THREE[l.magFilter];if(l.repeat){m.repeat.set(l.repeat[0],l.repeat[1]);if(1!=l.repeat[0])m.wrapS=THREE.RepeatWrapping;if(1!=l.repeat[1])m.wrapT=THREE.RepeatWrapping}l.offset&&m.offset.set(l.offset[0],l.offset[1]);if(l.wrap){K={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==K[l.wrap[0]])m.wrapS=K[l.wrap[0]];
-if(void 0!==K[l.wrap[1]])m.wrapT=K[l.wrap[1]]}}y.textures[r]=m}for(n in L.materials){r=L.materials[n];for(A in r.parameters)if("envMap"==A||"map"==A||"lightMap"==A)r.parameters[A]=y.textures[r.parameters[A]];else if("shading"==A)r.parameters[A]="flat"==r.parameters[A]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==A)r.parameters[A]=THREE[r.parameters[A]]?THREE[r.parameters[A]]:THREE.NormalBlending;else if("combine"==A)r.parameters[A]="MixOperation"==r.parameters[A]?THREE.MixOperation:THREE.MultiplyOperation;
-else if("vertexColors"==A)if("face"==r.parameters[A])r.parameters[A]=THREE.FaceColors;else if(r.parameters[A])r.parameters[A]=THREE.VertexColors;if(void 0!==r.parameters.opacity&&1>r.parameters.opacity)r.parameters.transparent=!0;if(r.parameters.normalMap){l=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(l.uniforms);m=r.parameters.color;K=r.parameters.specular;c=r.parameters.ambient;O=r.parameters.shininess;a.tNormal.texture=y.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)a.uNormalScale.value=
-r.parameters.normalMapFactor;if(r.parameters.map)a.tDiffuse.texture=r.parameters.map,a.enableDiffuse.value=!0;if(r.parameters.lightMap)a.tAO.texture=r.parameters.lightMap,a.enableAO.value=!0;if(r.parameters.specularMap)a.tSpecular.texture=y.textures[r.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(K);a.uAmbientColor.value.setHex(c);a.uShininess.value=O;if(r.parameters.opacity)a.uOpacity.value=r.parameters.opacity;r=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,
-vertexShader:l.vertexShader,uniforms:a,lights:!0,fog:!0})}else r=new THREE[r.type](r.parameters);y.materials[n]=r}e();k.callbackSync(y);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+b;e();L-=1;i.onLoadComplete();h()}}function g(a){return function(b){y.geometries[a]=b}}function h(){i.callbackProgress({totalModels:j,totalTextures:W,loadedModels:j-L,loadedTextures:W-G},y);i.onLoadProgress();0==L&&0==G&&b(y)}var i=this,l=THREE.Loader.prototype.extractUrlbase(c),k,n,q,o,p,m,r,s,t,u,v,x,B,D,C,A,H,I,N,$,K,Q,L,G,j,W,y;K=a;c=new THREE.BinaryLoader;Q=new THREE.JSONLoader;G=L=0;y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+empties:{}};a=!1;for(q in K.objects)if(s=K.objects[q],s.meshCollider){a=!0;break}if(a)y.scene.collisions=new THREE.CollisionSystem;if(K.transform)a=K.transform.position,t=K.transform.rotation,C=K.transform.scale,a&&y.scene.position.set(a[0],a[1],a[2]),t&&y.scene.rotation.set(t[0],t[1],t[2]),C&&y.scene.scale.set(C[0],C[1],C[2]),(a||t||C)&&y.scene.updateMatrix();a=function(){G-=1;h();i.onLoadComplete()};for(p in K.cameras)C=K.cameras[p],"perspective"==C.type?I=new THREE.PerspectiveCamera(C.fov,C.aspect,
+C.near,C.far):"ortho"==C.type&&(I=new THREE.OrthographicCamera(C.left,C.right,C.top,C.bottom,C.near,C.far)),v=C.position,t=C.target,C=C.up,I.position.set(v[0],v[1],v[2]),I.target=new THREE.Vector3(t[0],t[1],t[2]),C&&I.up.set(C[0],C[1],C[2]),y.cameras[p]=I;for(o in K.lights)t=K.lights[o],p=void 0!==t.color?t.color:16777215,I=void 0!==t.intensity?t.intensity:1,"directional"==t.type?(v=t.direction,u=new THREE.DirectionalLight(p,I),u.position.set(v[0],v[1],v[2]),u.position.normalize()):"point"==t.type?
+(v=t.position,u=t.distance,u=new THREE.PointLight(p,I,u),u.position.set(v[0],v[1],v[2])):"ambient"==t.type&&(u=new THREE.AmbientLight(p)),y.scene.add(u),y.lights[o]=u;for(m in K.fogs)o=K.fogs[m],"linear"==o.type?N=new THREE.Fog(0,o.near,o.far):"exp2"==o.type&&(N=new THREE.FogExp2(0,o.density)),C=o.color,N.color.setRGB(C[0],C[1],C[2]),y.fogs[m]=N;if(y.cameras&&K.defaults.camera)y.currentCamera=y.cameras[K.defaults.camera];if(y.fogs&&K.defaults.fog)y.scene.fog=y.fogs[K.defaults.fog];C=K.defaults.bgcolor;
+y.bgColor=new THREE.Color;y.bgColor.setRGB(C[0],C[1],C[2]);y.bgColorAlpha=K.defaults.bgalpha;for(k in K.geometries)if(m=K.geometries[k],"bin_mesh"==m.type||"ascii_mesh"==m.type)L+=1,i.onLoadStart();j=L;for(k in K.geometries)m=K.geometries[k],"cube"==m.type?(H=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),y.geometries[k]=H):"plane"==m.type?(H=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),y.geometries[k]=
+H):"sphere"==m.type?(H=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),y.geometries[k]=H):"cylinder"==m.type?(H=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),y.geometries[k]=H):"torus"==m.type?(H=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),y.geometries[k]=H):"icosahedron"==m.type?(H=new THREE.IcosahedronGeometry(m.subdivisions),y.geometries[k]=H):"bin_mesh"==m.type?c.load(d(m.url,K.urlBaseType),f(k)):"ascii_mesh"==m.type?Q.load(d(m.url,
+K.urlBaseType),f(k)):"embedded_mesh"==m.type&&(m=K.embeds[m.id])&&Q.createModel(m,g(k),"");for(r in K.textures)if(k=K.textures[r],k.url instanceof Array){G+=k.url.length;for(m=0;m<k.url.length;m++)i.onLoadStart()}else G+=1,i.onLoadStart();W=G;for(r in K.textures){k=K.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],K.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=
+THREE.ImageUtils.loadTexture(d(k.url,K.urlBaseType),k.mapping,a);if(void 0!=THREE[k.minFilter])m.minFilter=THREE[k.minFilter];if(void 0!=THREE[k.magFilter])m.magFilter=THREE[k.magFilter];if(k.repeat){m.repeat.set(k.repeat[0],k.repeat[1]);if(1!=k.repeat[0])m.wrapS=THREE.RepeatWrapping;if(1!=k.repeat[1])m.wrapT=THREE.RepeatWrapping}k.offset&&m.offset.set(k.offset[0],k.offset[1]);if(k.wrap){N={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(void 0!==N[k.wrap[0]])m.wrapS=N[k.wrap[0]];
+if(void 0!==N[k.wrap[1]])m.wrapT=N[k.wrap[1]]}}y.textures[r]=m}for(n in K.materials){r=K.materials[n];for(A in r.parameters)if("envMap"==A||"map"==A||"lightMap"==A)r.parameters[A]=y.textures[r.parameters[A]];else if("shading"==A)r.parameters[A]="flat"==r.parameters[A]?THREE.FlatShading:THREE.SmoothShading;else if("blending"==A)r.parameters[A]=THREE[r.parameters[A]]?THREE[r.parameters[A]]:THREE.NormalBlending;else if("combine"==A)r.parameters[A]="MixOperation"==r.parameters[A]?THREE.MixOperation:THREE.MultiplyOperation;
+else if("vertexColors"==A)if("face"==r.parameters[A])r.parameters[A]=THREE.FaceColors;else if(r.parameters[A])r.parameters[A]=THREE.VertexColors;if(void 0!==r.parameters.opacity&&1>r.parameters.opacity)r.parameters.transparent=!0;if(r.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);m=r.parameters.color;N=r.parameters.specular;c=r.parameters.ambient;Q=r.parameters.shininess;a.tNormal.texture=y.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)a.uNormalScale.value=
+r.parameters.normalMapFactor;if(r.parameters.map)a.tDiffuse.texture=r.parameters.map,a.enableDiffuse.value=!0;if(r.parameters.lightMap)a.tAO.texture=r.parameters.lightMap,a.enableAO.value=!0;if(r.parameters.specularMap)a.tSpecular.texture=y.textures[r.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(N);a.uAmbientColor.value.setHex(c);a.uShininess.value=Q;if(r.parameters.opacity)a.uOpacity.value=r.parameters.opacity;r=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
+vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else r=new THREE[r.type](r.parameters);y.materials[n]=r}e();i.callbackSync(y);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var d=new XMLHttpRequest,e=void 0!==c.scale?c.scale:1,f=void 0!==c.offsetX?c.offsetX:0,g=void 0!==c.offsetY?c.offsetY:0,h=void 0!==c.offsetZ?c.offsetZ:0;d.onreadystatechange=function(){4==d.readyState?200==d.status||0==d.status?THREE.UTF8Loader.prototype.createModel(d.responseText,
 b,e,f,g,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):3!=d.readyState&&2==d.readyState&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);57344<=b&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;8>e;e++){for(var f=0,g=0;g<b;++g){var h=a.charCodeAt(g+d),f=f+(h>>1^-(h&1));c[8*g+e]=f}d+=b}b=a.length-d;f=new Uint16Array(b);for(e=g=0;e<b;e++)h=a.charCodeAt(e+d),f[e]=g-h,0==h&&g++;return[c,f]};
-THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,f){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),i=[],l=[];(function(a,g,i){for(var k,l,r,s=a.length;i<s;i+=g)k=a[i],l=a[i+1],r=a[i+2],k=k/16383*c,l=l/16383*c,r=r/16383*c,k+=d,l+=e,r+=f,b.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,r)))})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,l.push(d,1-e)})(g[0],8,3);(function(a,
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,i.push(d,e,f)})(g[0],8,5);(function(a){var c,d,e,f,g,k,t,u,v,x=a.length;for(c=0;c<x;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;u=d;v=e;k=f;var B=i[3*e],D=i[3*e+1],C=i[3*e+2],A=i[3*f],F=i[3*f+1],J=i[3*f+2];t=new THREE.Vector3(i[3*d],i[3*d+1],i[3*d+2]);B=new THREE.Vector3(B,D,C);A=new THREE.Vector3(A,F,J);g.faces.push(new THREE.Face3(u,v,k,[t,B,A],null,0));g=l[2*d];d=l[2*d+1];k=l[2*e];t=l[2*e+1];u=l[2*
-f];v=l[2*f+1];f=b.faceVertexUvs[0];e=k;k=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,k));t.push(new THREE.UV(u,v));f.push(t)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};
+THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,f){var g=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var g=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],k=[];(function(a,g,i){for(var k,l,r,s=a.length;i<s;i+=g)k=a[i],l=a[i+1],r=a[i+2],k=k/16383*c,l=l/16383*c,r=r/16383*c,k+=d,l+=e,r+=f,b.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,r)))})(g[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(g[0],8,3);(function(a,
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,l.push(d,e,f)})(g[0],8,5);(function(a){var c,d,e,f,g,i,t,u,v,x=a.length;for(c=0;c<x;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;u=d;v=e;i=f;var B=l[3*e],D=l[3*e+1],C=l[3*e+2],A=l[3*f],H=l[3*f+1],I=l[3*f+2];t=new THREE.Vector3(l[3*d],l[3*d+1],l[3*d+2]);B=new THREE.Vector3(B,D,C);A=new THREE.Vector3(A,H,I);g.faces.push(new THREE.Face3(u,v,i,[t,B,A],null,0));g=k[2*d];d=k[2*d+1];i=k[2*e];t=k[2*e+1];u=k[2*
+f];v=k[2*f+1];f=b.faceVertexUvs[0];e=i;i=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,i));t.push(new THREE.UV(u,v));f.push(t)}})(g[1]);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c;c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
 c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=a;this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(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,k,i,l,n){g=(g-l)/(n-l);l=this.normal_cache;b[f]=h+g*this.delta;b[f+1]=k;b[f+2]=i;e[f]=this.lerp(l[a],l[a+3],g);e[f+1]=this.lerp(l[a+1],l[a+4],g);e[f+2]=this.lerp(l[a+2],l[a+5],g)};this.VIntY=function(a,b,e,f,g,h,k,i,l,n){g=(g-l)/(n-l);l=this.normal_cache;b[f]=h;b[f+1]=k+g*this.delta;b[f+2]=i;b=a+3*this.yd;
-e[f]=this.lerp(l[a],l[b],g);e[f+1]=this.lerp(l[a+1],l[b+1],g);e[f+2]=this.lerp(l[a+2],l[b+2],g)};this.VIntZ=function(a,b,e,f,g,h,k,i,l,n){g=(g-l)/(n-l);l=this.normal_cache;b[f]=h;b[f+1]=k;b[f+2]=i+g*this.delta;b=a+3*this.zd;e[f]=this.lerp(l[a],l[b],g);e[f+1]=this.lerp(l[a+1],l[b+1],g);e[f+2]=this.lerp(l[a+2],l[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 k=f+1,i=f+this.yd,l=f+this.zd,n=k+this.yd,q=k+this.zd,o=f+this.yd+this.zd,p=k+this.yd+this.zd,m=0,r=this.field[f],s=this.field[k],t=this.field[i],u=this.field[n],v=this.field[l],x=this.field[q],B=this.field[o],D=this.field[p];r<g&&(m|=1);s<g&&(m|=2);t<g&&(m|=8);u<g&&(m|=4);v<g&&(m|=16);x<g&&(m|=32);B<g&&(m|=128);D<g&&(m|=64);var C=THREE.edgeTable[m];if(0===C)return 0;var A=this.delta,F=a+
-A,J=b+A,A=e+A;C&1&&(this.compNorm(f),this.compNorm(k),this.VIntX(3*f,this.vlist,this.nlist,0,g,a,b,e,r,s));C&2&&(this.compNorm(k),this.compNorm(n),this.VIntY(3*k,this.vlist,this.nlist,3,g,F,b,e,s,u));C&4&&(this.compNorm(i),this.compNorm(n),this.VIntX(3*i,this.vlist,this.nlist,6,g,a,J,e,t,u));C&8&&(this.compNorm(f),this.compNorm(i),this.VIntY(3*f,this.vlist,this.nlist,9,g,a,b,e,r,t));C&16&&(this.compNorm(l),this.compNorm(q),this.VIntX(3*l,this.vlist,this.nlist,12,g,a,b,A,v,x));C&32&&(this.compNorm(q),
-this.compNorm(p),this.VIntY(3*q,this.vlist,this.nlist,15,g,F,b,A,x,D));C&64&&(this.compNorm(o),this.compNorm(p),this.VIntX(3*o,this.vlist,this.nlist,18,g,a,J,A,B,D));C&128&&(this.compNorm(l),this.compNorm(o),this.VIntY(3*l,this.vlist,this.nlist,21,g,a,b,A,v,B));C&256&&(this.compNorm(f),this.compNorm(l),this.VIntZ(3*f,this.vlist,this.nlist,24,g,a,b,e,r,v));C&512&&(this.compNorm(k),this.compNorm(q),this.VIntZ(3*k,this.vlist,this.nlist,27,g,F,b,e,s,x));C&1024&&(this.compNorm(n),this.compNorm(p),this.VIntZ(3*
-n,this.vlist,this.nlist,30,g,F,J,e,u,D));C&2048&&(this.compNorm(i),this.compNorm(o),this.VIntZ(3*i,this.vlist,this.nlist,33,g,a,J,e,t,B));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 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[f];this.positionArray[k+
-4]=a[f+1];this.positionArray[k+5]=a[f+2];this.positionArray[k+6]=a[g];this.positionArray[k+7]=a[g+1];this.positionArray[k+8]=a[g+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[f];this.normalArray[k+4]=b[f+1];this.normalArray[k+5]=b[f+2];this.normalArray[k+6]=b[g];this.normalArray[k+7]=b[g+1];this.normalArray[k+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),k=e*this.size,i=b*this.size,l=a*this.size,n=Math.floor(k-h);1>n&&(n=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var q=Math.floor(i-h);1>q&&(q=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(l-h);1>o&&(o=1);h=Math.floor(l+h);h>this.size-1&&(h=this.size-
-1);for(var p,m,r,s,t,u,v,l=n;l<k;l++){r=this.size2*l;t=l/this.size-e;u=t*t;for(n=q;n<i;n++){m=r+this.size*n;p=n/this.size-b;v=p*p;for(p=o;p<h;p++)s=p/this.size-a,s=f/(1.0E-6+s*s+v+u)-g,0<s&&(this.field[m+p]+=s)}}};this.addPlaneX=function(a,b){var e,f,g,h,k,i=this.size,l=this.yd,n=this.zd,q=this.field,o=i*Math.sqrt(a/b);o>i&&(o=i);for(e=0;e<o;e++)if(f=e/i,f*=f,h=a/(1.0E-4+f)-b,0<h)for(f=0;f<i;f++){k=e+f*l;for(g=0;g<i;g++)q[n*g+k]+=h}};this.addPlaneY=function(a,b){var e,f,g,h,k,i,l=this.size,n=this.yd,
-q=this.zd,o=this.field,p=l*Math.sqrt(a/b);p>l&&(p=l);for(f=0;f<p;f++)if(e=f/l,e*=e,h=a/(1.0E-4+e)-b,0<h){k=f*n;for(e=0;e<l;e++){i=k+e;for(g=0;g<l;g++)o[q*g+i]+=h}}};this.addPlaneZ=function(a,b){var e,f,g,h,k,i,l=this.size,n=this.yd,q=this.zd,o=this.field,p=l*Math.sqrt(a/b);p>l&&(p=l);for(g=0;g<p;g++)if(e=g/l,e*=e,h=a/(1.0E-4+e)-b,0<h){k=q*g;for(f=0;f<l;f++){i=k+f*n;for(e=0;e<l;e++)o[i+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,k,i,l,n,q=this.size-2;for(g=1;g<q;g++){n=this.size2*g;i=(g-this.halfsize)/this.halfsize;for(f=1;f<q;f++){l=n+this.size*f;k=(f-this.halfsize)/this.halfsize;for(e=1;e<q;e++)h=(e-this.halfsize)/this.halfsize,b=l+e,this.polygonize(h,k,i,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,k,i,l,n,q,o;for(g=0;g<f.count;g++)q=3*g,l=q+1,o=q+2,h=f.positionArray[q],k=f.positionArray[l],i=
-f.positionArray[o],n=new THREE.Vector3(h,k,i),h=f.normalArray[q],k=f.normalArray[l],i=f.normalArray[o],q=new THREE.Vector3(h,k,i),q.normalize(),l=new THREE.Vertex(n),b.vertices.push(l),e.push(q);n=f.count/3;for(g=0;g<n;g++)q=3*(a+g),l=q+1,o=q+2,h=e[q],k=e[l],i=e[o],q=new THREE.Face3(q,l,o,[h,k,i]),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;
+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,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],v=this.field[k],x=this.field[q],B=this.field[o],D=this.field[p];r<g&&(m|=1);s<g&&(m|=2);t<g&&(m|=8);u<g&&(m|=4);v<g&&(m|=16);x<g&&(m|=32);B<g&&(m|=128);D<g&&(m|=64);var C=THREE.edgeTable[m];if(0===C)return 0;var A=this.delta,H=a+
+A,I=b+A,A=e+A;C&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(3*f,this.vlist,this.nlist,0,g,a,b,e,r,s));C&2&&(this.compNorm(i),this.compNorm(n),this.VIntY(3*i,this.vlist,this.nlist,3,g,H,b,e,s,u));C&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(3*l,this.vlist,this.nlist,6,g,a,I,e,t,u));C&8&&(this.compNorm(f),this.compNorm(l),this.VIntY(3*f,this.vlist,this.nlist,9,g,a,b,e,r,t));C&16&&(this.compNorm(k),this.compNorm(q),this.VIntX(3*k,this.vlist,this.nlist,12,g,a,b,A,v,x));C&32&&(this.compNorm(q),
+this.compNorm(p),this.VIntY(3*q,this.vlist,this.nlist,15,g,H,b,A,x,D));C&64&&(this.compNorm(o),this.compNorm(p),this.VIntX(3*o,this.vlist,this.nlist,18,g,a,I,A,B,D));C&128&&(this.compNorm(k),this.compNorm(o),this.VIntY(3*k,this.vlist,this.nlist,21,g,a,b,A,v,B));C&256&&(this.compNorm(f),this.compNorm(k),this.VIntZ(3*f,this.vlist,this.nlist,24,g,a,b,e,r,v));C&512&&(this.compNorm(i),this.compNorm(q),this.VIntZ(3*i,this.vlist,this.nlist,27,g,H,b,e,s,x));C&1024&&(this.compNorm(n),this.compNorm(p),this.VIntZ(3*
+n,this.vlist,this.nlist,30,g,H,I,e,u,D));C&2048&&(this.compNorm(l),this.compNorm(o),this.VIntZ(3*l,this.vlist,this.nlist,33,g,a,I,e,t,B));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 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,v,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;v=p*p;for(p=o;p<h;p++)s=p/this.size-a,s=f/(1.0E-6+s*s+v+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]);
@@ -734,33 +735,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,k,i,l,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();k=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,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)?(i=!1,l=a(THREE.ShaderFlares.lensFlare)):(i=!0,l=a(THREE.ShaderFlares.lensFlareVertexTexture));n={};q={};n.vertex=b.getAttribLocation(l,"position");n.uv=b.getAttribLocation(l,"uv");q.renderType=b.getUniformLocation(l,"renderType");q.map=b.getUniformLocation(l,"map");q.occlusionMap=b.getUniformLocation(l,"occlusionMap");q.opacity=b.getUniformLocation(l,"opacity");q.color=b.getUniformLocation(l,
-"color");q.scale=b.getUniformLocation(l,"scale");q.rotation=b.getUniformLocation(l,"rotation");q.screenPosition=b.getUniformLocation(l,"screenPosition");o=!1};this.render=function(a,d,e,s){var a=a.__webglFlares,t=a.length;if(t){var u=new THREE.Vector3,v=s/e,x=0.5*e,B=0.5*s,D=16/s,C=new THREE.Vector2(D*v,D),A=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),J=q,D=n;b.useProgram(l);o||(b.enableVertexAttribArray(n.vertex),b.enableVertexAttribArray(n.uv),o=!0);b.uniform1i(J.occlusionMap,0);b.uniform1i(J.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 K,Z,L,O,M;for(K=0;K<t;K++)if(D=16/s,C.set(D*v,D),O=a[K],u.set(O.matrixWorld.n14,O.matrixWorld.n24,O.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(u),d.projectionMatrix.multiplyVector3(u),A.copy(u),F.x=A.x*x+x,F.y=A.y*B+B,i||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(J.renderType,0);b.uniform2f(J.scale,C.x,C.y);b.uniform3f(J.screenPosition,A.x,A.y,A.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,F.x-8,F.y-8,16,16,0);b.uniform1i(J.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);O.positionScreen.copy(A);O.customUpdateCallback?O.customUpdateCallback(O):O.updateLensFlares();b.uniform1i(J.renderType,2);b.enable(b.BLEND);for(Z=0,L=O.lensFlares.length;Z<L;Z++)if(M=O.lensFlares[Z],0.0010<M.opacity&&0.0010<M.scale)A.x=M.x,A.y=M.y,A.z=M.z,D=M.size*M.scale/s,C.x=D*v,C.y=D,b.uniform3f(J.screenPosition,A.x,A.y,A.z),b.uniform2f(J.scale,C.x,C.y),b.uniform1f(J.rotation,M.rotation),b.uniform1f(J.opacity,M.opacity),b.uniform3f(J.color,M.color.r,M.color.g,M.color.b),
-c.setBlending(M.blending),c.setTexture(M.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+THREE.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={};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,v=s/e,x=0.5*e,B=0.5*s,D=16/s,C=new THREE.Vector2(D*v,D),A=new THREE.Vector3(1,1,0),H=new THREE.Vector2(1,1),I=q,D=n;b.useProgram(k);o||(b.enableVertexAttribArray(n.vertex),b.enableVertexAttribArray(n.uv),o=!0);b.uniform1i(I.occlusionMap,0);b.uniform1i(I.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 N,$,K,Q,L;for(N=0;N<t;N++)if(D=16/s,C.set(D*v,D),Q=a[N],u.set(Q.matrixWorld.n14,Q.matrixWorld.n24,Q.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(u),d.projectionMatrix.multiplyVector3(u),A.copy(u),H.x=A.x*x+x,H.y=A.y*B+B,l||0<H.x&&H.x<e&&0<H.y&&H.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
+h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,H.x-8,H.y-8,16,16,0);b.uniform1i(I.renderType,0);b.uniform2f(I.scale,C.x,C.y);b.uniform3f(I.screenPosition,A.x,A.y,A.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,H.x-8,H.y-8,16,16,0);b.uniform1i(I.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
+6,b.UNSIGNED_SHORT,0);Q.positionScreen.copy(A);Q.customUpdateCallback?Q.customUpdateCallback(Q):Q.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);for($=0,K=Q.lensFlares.length;$<K;$++)if(L=Q.lensFlares[$],0.0010<L.opacity&&0.0010<L.scale)A.x=L.x,A.y=L.y,A.z=L.z,D=L.size*L.scale/s,C.x=D*v,C.y=D,b.uniform3f(I.screenPosition,A.x,A.y,A.z),b.uniform2f(I.scale,C.x,C.y),b.uniform1f(I.rotation,L.rotation),b.uniform1f(I.opacity,L.opacity),b.uniform3f(I.color,L.color.r,L.color.g,L.color.b),
+c.setBlending(L.blending),c.setTexture(L.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 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,k,i,l,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,k=r.length;h<k;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;
+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);i=p.shadowMap;l=p.shadowMatrix;n=p.shadowCamera;n.position.copy(p.matrixWorld.getPosition());n.lookAt(p.target.matrixWorld.getPosition());n.updateMatrixWorld();n.matrixWorldInverse.getInverse(n.matrixWorld);if(p.cameraHelper)p.cameraHelper.lines.visible=p.shadowCameraVisible;p.shadowCameraVisible&&p.cameraHelper.update(p.shadowCamera);l.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);l.multiplySelf(n.projectionMatrix);
-l.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(i);b.clear();m=g.__webglObjects;for(i=0,l=m.length;i<l;i++)if(q=m[i],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(i=0,l=m.length;i<l;i++)if(q=m[i],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(i=0,l=m.length;i<l;i++)q=m[i],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,k,i,l;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,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;k={};i={};k.position=b.getAttribLocation(h,"position");k.uv=b.getAttribLocation(h,"uv");i.uvOffset=b.getUniformLocation(h,"uvOffset");i.uvScale=b.getUniformLocation(h,
-"uvScale");i.rotation=b.getUniformLocation(h,"rotation");i.scale=b.getUniformLocation(h,"scale");i.alignment=b.getUniformLocation(h,"alignment");i.color=b.getUniformLocation(h,"color");i.map=b.getUniformLocation(h,"map");i.opacity=b.getUniformLocation(h,"opacity");i.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");i.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");i.screenPosition=b.getUniformLocation(h,"screenPosition");i.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
-i.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");l=!1};this.render=function(d,e,o,p){var d=d.__webglSprites,m=d.length;if(m){var r=k,s=i,t=p/o,o=0.5*o,u=0.5*p,v=!0;b.useProgram(h);l||(b.enableVertexAttribArray(r.position),b.enableVertexAttribArray(r.uv),l=!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,
+!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.updateMatrixWorld();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,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,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,v=!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 x,B=[],r=0;r<m;r++)if(x=d[r],x.visible&&0!==x.opacity)x.useScreenCoordinates?x.z=-x.position.z:(x._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,x.matrixWorld,x._modelViewMatrixArray),x.z=-x._modelViewMatrix.n34);d.sort(a);for(r=0;r<m;r++)x=d[r],x.visible&&0!==x.opacity&&x.map&&x.map.image&&x.map.image.width&&(x.useScreenCoordinates?(b.uniform1i(s.useScreenCoordinates,1),b.uniform3f(s.screenPosition,(x.position.x-
 o)/o,(u-x.position.y)/u,Math.max(0,Math.min(1,x.position.z)))):(b.uniform1i(s.useScreenCoordinates,0),b.uniform1i(s.affectedByDistance,x.affectedByDistance?1:0),b.uniformMatrix4fv(s.modelViewMatrix,!1,x._modelViewMatrixArray)),e=x.map.image.width/(x.scaleByViewport?p:1),B[0]=e*t*x.scale.x,B[1]=e*x.scale.y,b.uniform2f(s.uvScale,x.uvScale.x,x.uvScale.y),b.uniform2f(s.uvOffset,x.uvOffset.x,x.uvOffset.y),b.uniform2f(s.alignment,x.alignment.x,x.alignment.y),b.uniform1f(s.opacity,x.opacity),b.uniform3f(s.color,
 x.color.r,x.color.g,x.color.b),b.uniform1f(s.rotation,x.rotation),b.uniform2fv(s.scale,B),x.mergeWith3D&&!v?(b.enable(b.DEPTH_TEST),v=!0):!x.mergeWith3D&&v&&(b.disable(b.DEPTH_TEST),v=!1),c.setBlending(x.blending),c.setTexture(x.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,k,i,l,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,
+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(k!==c.aspect||i!==c.near||l!==c.far||n!==c.fov){k=c.aspect;i=c.near;l=c.far;n=c.fov;var t=c.projectionMatrix.clone(),u=0.5*(125/30),v=u*i/125,x=i*Math.tan(n*Math.PI/360),B;g.n14=u;h.n14=-u;u=-x*k+v;B=x*k+v;t.n11=2*i/(B-u);t.n13=(B+u)/(B-u);e.projectionMatrix.copy(t);u=-x*k-v;B=x*k-v;t.n11=
-2*i/(B-u);t.n13=(B+u)/(B-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)}};
+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),v=u*l/125,x=l*Math.tan(n*Math.PI/360),B;g.n14=u;h.n14=-u;u=-x*i+v;B=x*i+v;t.n11=2*l/(B-u);t.n13=(B+u)/(B-u);e.projectionMatrix.copy(t);u=-x*i-v;B=x*i-v;t.n11=
+2*l/(B-u);t.n13=(B+u)/(B-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}"},

+ 90 - 90
build/custom/ThreeWebGL.js

@@ -31,8 +31,8 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=
 THREE.Matrix4=function(a,b,c,d,e,f,h,i,k,l,j,n,p,o,m,r){this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,h||0,i||0,k||0,l||0,void 0!==j?j:1,n||0,p||0,o||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,f,h,i,k,l,j,n,p,o,m,r){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=h;this.n24=i;this.n31=k;this.n32=l;this.n33=j;this.n34=n;this.n41=p;this.n42=o;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,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,h=a.n21,i=a.n22,k=a.n23,l=a.n24,j=a.n31,n=a.n32,p=a.n33,o=a.n34,m=a.n41,r=a.n42,t=a.n43,
-z=a.n44,y=b.n11,J=b.n12,K=b.n13,u=b.n14,B=b.n21,H=b.n22,A=b.n23,M=b.n24,N=b.n31,I=b.n32,ia=b.n33,ua=b.n34,S=b.n41,$=b.n42,Y=b.n43,D=b.n44;this.n11=c*y+d*B+e*N+f*S;this.n12=c*J+d*H+e*I+f*$;this.n13=c*K+d*A+e*ia+f*Y;this.n14=c*u+d*M+e*ua+f*D;this.n21=h*y+i*B+k*N+l*S;this.n22=h*J+i*H+k*I+l*$;this.n23=h*K+i*A+k*ia+l*Y;this.n24=h*u+i*M+k*ua+l*D;this.n31=j*y+n*B+p*N+o*S;this.n32=j*J+n*H+p*I+o*$;this.n33=j*K+n*A+p*ia+o*Y;this.n34=j*u+n*M+p*ua+o*D;this.n41=m*y+r*B+t*N+z*S;this.n42=m*J+r*H+t*I+z*$;this.n43=
-m*K+r*A+t*ia+z*Y;this.n44=m*u+r*M+t*ua+z*D;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*=
+z=a.n44,y=b.n11,J=b.n12,K=b.n13,u=b.n14,B=b.n21,H=b.n22,A=b.n23,M=b.n24,N=b.n31,I=b.n32,S=b.n33,ua=b.n34,ka=b.n41,$=b.n42,Z=b.n43,D=b.n44;this.n11=c*y+d*B+e*N+f*ka;this.n12=c*J+d*H+e*I+f*$;this.n13=c*K+d*A+e*S+f*Z;this.n14=c*u+d*M+e*ua+f*D;this.n21=h*y+i*B+k*N+l*ka;this.n22=h*J+i*H+k*I+l*$;this.n23=h*K+i*A+k*S+l*Z;this.n24=h*u+i*M+k*ua+l*D;this.n31=j*y+n*B+p*N+o*ka;this.n32=j*J+n*H+p*I+o*$;this.n33=j*K+n*A+p*S+o*Z;this.n34=j*u+n*M+p*ua+o*D;this.n41=m*y+r*B+t*N+z*ka;this.n42=m*J+r*H+t*I+z*$;this.n43=
+m*K+r*A+t*S+z*Z;this.n44=m*u+r*M+t*ua+z*D;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,h=this.n23,i=this.n24,k=this.n31,l=this.n32,j=this.n33,n=this.n34,p=this.n41,o=this.n42,m=this.n43,r=this.n44;return d*h*l*p-c*i*l*p-d*f*j*p+b*i*j*p+c*f*n*p-b*h*n*p-d*h*k*o+c*i*k*o+d*e*j*o-a*i*j*o-c*e*n*o+a*h*n*o+d*f*k*m-b*i*k*m-d*e*l*m+a*i*l*m+b*e*n*m-a*f*n*m-c*f*k*r+b*h*k*r+c*e*l*r-a*h*l*r-
@@ -63,16 +63,16 @@ 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=h[f]=h[f]||new THREE.RenderableObject;f++;return a}function b(){var a=l[k]=l[k]||new THREE.RenderableVertex;k++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=g&&0<=f&&0<=h)return!0;if(0>e&&0>g||0>f&&0>h)return!1;0>e?c=Math.max(c,e/(e-g)):0>g&&(d=Math.min(d,e/(e-g)));0>f?c=Math.max(c,f/(f-h)):0>h&&(d=Math.min(d,f/(f-h)));if(d<c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}
-var e,f,h=[],i,k,l=[],j,n,p=[],o,m=[],r,t,z=[],y,J,K=[],u={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,H=new THREE.Vector4,A=new THREE.Matrix4,M=new THREE.Matrix4,N=new THREE.Frustum,I=new THREE.Vector4,ia=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);A.multiply(b.projectionMatrix,b.matrixWorldInverse);A.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);A.multiply(b.matrixWorld,
+var e,f,h=[],i,k,l=[],j,n,p=[],o,m=[],r,t,z=[],y,J,K=[],u={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,H=new THREE.Vector4,A=new THREE.Matrix4,M=new THREE.Matrix4,N=new THREE.Frustum,I=new THREE.Vector4,S=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);A.multiply(b.projectionMatrix,b.matrixWorldInverse);A.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);A.multiply(b.matrixWorld,
 b.projectionMatrixInverse);A.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;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||N.contains(b))?(A.multiplyVector3(B.copy(b.position)),e=a(),e.object=
-b,e.z=B.z,u.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(A.multiplyVector3(B.copy(b.position)),e=a(),e.object=b,e.z=B.z,u.sprites.push(e)):b instanceof THREE.Light&&u.lights.push(b);for(var c=0,g=b.children.length;c<g;c++)h(b.children[c])}};h(b);d&&u.objects.sort(c);return u};this.projectScene=function(a,e,f){var h=e.near,D=e.far,g,B,Z,oa,Q,L,qa,va,ba,ya,Ca,Ma,mb,Sa,Pa,Na;J=t=o=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);A.multiply(e.projectionMatrix,e.matrixWorldInverse);N.setFromMatrix(A);u=this.projectGraph(a,!1);for(a=0,g=u.objects.length;a<g;a++)if(ba=u.objects[a].object,ya=ba.matrixWorld,Ma=ba.material,k=0,ba instanceof THREE.Mesh){Ca=ba.geometry;mb=ba.geometry.materials;oa=Ca.vertices;Sa=Ca.faces;Pa=Ca.faceVertexUvs;Ca=ba.matrixRotationWorld.extractRotation(ya);for(B=0,Z=oa.length;B<Z;B++)i=b(),i.positionWorld.copy(oa[B].position),
-ya.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),A.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>h&&i.positionScreen.z<D;for(oa=0,B=Sa.length;oa<B;oa++){Z=Sa[oa];if(Z instanceof THREE.Face3)if(Q=l[Z.a],L=l[Z.b],qa=l[Z.c],Q.visible&&L.visible&&qa.visible&&(ba.doubleSided||ba.flipSided!=0>(qa.positionScreen.x-Q.positionScreen.x)*(L.positionScreen.y-Q.positionScreen.y)-(qa.positionScreen.y-
-Q.positionScreen.y)*(L.positionScreen.x-Q.positionScreen.x)))va=p[n]=p[n]||new THREE.RenderableFace3,n++,j=va,j.v1.copy(Q),j.v2.copy(L),j.v3.copy(qa);else continue;else if(Z instanceof THREE.Face4)if(Q=l[Z.a],L=l[Z.b],qa=l[Z.c],va=l[Z.d],Q.visible&&L.visible&&qa.visible&&va.visible&&(ba.doubleSided||ba.flipSided!=(0>(va.positionScreen.x-Q.positionScreen.x)*(L.positionScreen.y-Q.positionScreen.y)-(va.positionScreen.y-Q.positionScreen.y)*(L.positionScreen.x-Q.positionScreen.x)||0>(L.positionScreen.x-
-qa.positionScreen.x)*(va.positionScreen.y-qa.positionScreen.y)-(L.positionScreen.y-qa.positionScreen.y)*(va.positionScreen.x-qa.positionScreen.x))))Na=m[o]=m[o]||new THREE.RenderableFace4,o++,j=Na,j.v1.copy(Q),j.v2.copy(L),j.v3.copy(qa),j.v4.copy(va);else continue;j.normalWorld.copy(Z.normal);Ca.multiplyVector3(j.normalWorld);j.centroidWorld.copy(Z.centroid);ya.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);A.multiplyVector3(j.centroidScreen);qa=Z.vertexNormals;for(Q=0,L=
-qa.length;Q<L;Q++)va=j.vertexNormalsWorld[Q],va.copy(qa[Q]),Ca.multiplyVector3(va);for(Q=0,L=Pa.length;Q<L;Q++)if(Na=Pa[Q][oa])for(qa=0,va=Na.length;qa<va;qa++)j.uvs[Q][qa]=Na[qa];j.material=Ma;j.faceMaterial=null!==Z.materialIndex?mb[Z.materialIndex]:null;j.z=j.centroidScreen.z;u.elements.push(j)}}else if(ba instanceof THREE.Line){M.multiply(A,ya);oa=ba.geometry.vertices;Q=b();Q.positionScreen.copy(oa[0].position);M.multiplyVector4(Q.positionScreen);for(B=1,Z=oa.length;B<Z;B++)if(Q=b(),Q.positionScreen.copy(oa[B].position),
-M.multiplyVector4(Q.positionScreen),L=l[k-2],I.copy(Q.positionScreen),ia.copy(L.positionScreen),d(I,ia))I.multiplyScalar(1/I.w),ia.multiplyScalar(1/ia.w),ba=z[t]=z[t]||new THREE.RenderableLine,t++,r=ba,r.v1.positionScreen.copy(I),r.v2.positionScreen.copy(ia),r.z=Math.max(I.z,ia.z),r.material=Ma,u.elements.push(r)}for(a=0,g=u.sprites.length;a<g;a++)if(ba=u.sprites[a].object,ya=ba.matrixWorld,ba instanceof THREE.Particle&&(H.set(ya.n14,ya.n24,ya.n34,1),A.multiplyVector4(H),H.z/=H.w,0<H.z&&1>H.z))h=
-K[J]=K[J]||new THREE.RenderableParticle,J++,y=h,y.x=H.x/H.w,y.y=H.y/H.w,y.z=H.z,y.rotation=ba.rotation.z,y.scale.x=ba.scale.x*Math.abs(y.x-(H.x+e.projectionMatrix.n11)/(H.w+e.projectionMatrix.n14)),y.scale.y=ba.scale.y*Math.abs(y.y-(H.y+e.projectionMatrix.n22)/(H.w+e.projectionMatrix.n24)),y.material=ba.material,u.elements.push(y);f&&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)};
+b,e.z=B.z,u.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(A.multiplyVector3(B.copy(b.position)),e=a(),e.object=b,e.z=B.z,u.sprites.push(e)):b instanceof THREE.Light&&u.lights.push(b);for(var c=0,g=b.children.length;c<g;c++)h(b.children[c])}};h(b);d&&u.objects.sort(c);return u};this.projectScene=function(a,e,f){var h=e.near,D=e.far,g,B,ba,pa,Q,L,W,ya,ca,Ea,Ba,Na,Oa,Pa,Ta,Ua;J=t=o=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);A.multiply(e.projectionMatrix,e.matrixWorldInverse);N.setFromMatrix(A);u=this.projectGraph(a,!1);for(a=0,g=u.objects.length;a<g;a++)if(ca=u.objects[a].object,Ea=ca.matrixWorld,Na=ca.material,k=0,ca instanceof THREE.Mesh){Ba=ca.geometry;Oa=ca.geometry.materials;pa=Ba.vertices;Pa=Ba.faces;Ta=Ba.faceVertexUvs;Ba=ca.matrixRotationWorld.extractRotation(Ea);for(B=0,ba=pa.length;B<ba;B++)i=b(),i.positionWorld.copy(pa[B].position),
+Ea.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),A.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>h&&i.positionScreen.z<D;for(pa=0,B=Pa.length;pa<B;pa++){ba=Pa[pa];if(ba instanceof THREE.Face3)if(Q=l[ba.a],L=l[ba.b],W=l[ba.c],Q.visible&&L.visible&&W.visible&&(ca.doubleSided||ca.flipSided!=0>(W.positionScreen.x-Q.positionScreen.x)*(L.positionScreen.y-Q.positionScreen.y)-(W.positionScreen.y-
+Q.positionScreen.y)*(L.positionScreen.x-Q.positionScreen.x)))ya=p[n]=p[n]||new THREE.RenderableFace3,n++,j=ya,j.v1.copy(Q),j.v2.copy(L),j.v3.copy(W);else continue;else if(ba instanceof THREE.Face4)if(Q=l[ba.a],L=l[ba.b],W=l[ba.c],ya=l[ba.d],Q.visible&&L.visible&&W.visible&&ya.visible&&(ca.doubleSided||ca.flipSided!=(0>(ya.positionScreen.x-Q.positionScreen.x)*(L.positionScreen.y-Q.positionScreen.y)-(ya.positionScreen.y-Q.positionScreen.y)*(L.positionScreen.x-Q.positionScreen.x)||0>(L.positionScreen.x-
+W.positionScreen.x)*(ya.positionScreen.y-W.positionScreen.y)-(L.positionScreen.y-W.positionScreen.y)*(ya.positionScreen.x-W.positionScreen.x))))Ua=m[o]=m[o]||new THREE.RenderableFace4,o++,j=Ua,j.v1.copy(Q),j.v2.copy(L),j.v3.copy(W),j.v4.copy(ya);else continue;j.normalWorld.copy(ba.normal);Ba.multiplyVector3(j.normalWorld);j.centroidWorld.copy(ba.centroid);Ea.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);A.multiplyVector3(j.centroidScreen);W=ba.vertexNormals;for(Q=0,L=W.length;Q<
+L;Q++)ya=j.vertexNormalsWorld[Q],ya.copy(W[Q]),Ba.multiplyVector3(ya);for(Q=0,L=Ta.length;Q<L;Q++)if(Ua=Ta[Q][pa])for(W=0,ya=Ua.length;W<ya;W++)j.uvs[Q][W]=Ua[W];j.material=Na;j.faceMaterial=null!==ba.materialIndex?Oa[ba.materialIndex]:null;j.z=j.centroidScreen.z;u.elements.push(j)}}else if(ca instanceof THREE.Line){M.multiply(A,Ea);pa=ca.geometry.vertices;Q=b();Q.positionScreen.copy(pa[0].position);M.multiplyVector4(Q.positionScreen);for(B=1,ba=pa.length;B<ba;B++)if(Q=b(),Q.positionScreen.copy(pa[B].position),
+M.multiplyVector4(Q.positionScreen),L=l[k-2],I.copy(Q.positionScreen),S.copy(L.positionScreen),d(I,S))I.multiplyScalar(1/I.w),S.multiplyScalar(1/S.w),ca=z[t]=z[t]||new THREE.RenderableLine,t++,r=ca,r.v1.positionScreen.copy(I),r.v2.positionScreen.copy(S),r.z=Math.max(I.z,S.z),r.material=Na,u.elements.push(r)}for(a=0,g=u.sprites.length;a<g;a++)if(ca=u.sprites[a].object,Ea=ca.matrixWorld,ca instanceof THREE.Particle&&(H.set(Ea.n14,Ea.n24,Ea.n34,1),A.multiplyVector4(H),H.z/=H.w,0<H.z&&1>H.z))h=K[J]=K[J]||
+new THREE.RenderableParticle,J++,y=h,y.x=H.x/H.w,y.y=H.y/H.w,y.z=H.z,y.rotation=ca.rotation.z,y.scale.x=ca.scale.x*Math.abs(y.x-(H.x+e.projectionMatrix.n11)/(H.w+e.projectionMatrix.n14)),y.scale.y=ca.scale.y*Math.abs(y.y-(H.y+e.projectionMatrix.n22)/(H.w+e.projectionMatrix.n24)),y.material=ca.material,u.elements.push(y);f&&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),f=Math.cos(c),c=Math.sin(c),h=a*b,i=d*e;this.w=h*f-i*c;this.x=h*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
@@ -88,11 +88,11 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 b,c,d,e,f,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],f=this.vertices[c.c],h.sub(f.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,d,e,f,A){i=a.vertices[b].position;k=a.vertices[c].position;l=a.vertices[d].position;j=h[e];n=h[f];p=h[A];o=k.x-i.x;m=l.x-i.x;r=k.y-i.y;t=l.y-i.y;z=k.z-i.z;y=l.z-i.z;J=n.u-j.u;K=p.u-j.u;u=n.v-j.v;B=p.v-j.v;H=1/(J*B-K*u);I.set((B*o-u*m)*H,(B*r-u*t)*H,(B*z-u*y)*H);ia.set((J*m-K*o)*H,(J*t-K*r)*H,(J*y-K*z)*H);M[b].addSelf(I);M[c].addSelf(I);M[d].addSelf(I);N[b].addSelf(ia);N[c].addSelf(ia);N[d].addSelf(ia)}var b,c,d,e,f,h,i,k,l,j,n,p,o,m,r,t,z,y,J,K,u,B,H,A,M=[],N=[],I=new THREE.Vector3,ia=new THREE.Vector3,
-ua=new THREE.Vector3,S=new THREE.Vector3,$=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)M[b]=new THREE.Vector3,N[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],h=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 Y=["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++)$.copy(f.vertexNormals[d]),e=f[Y[d]],
-A=M[e],ua.copy(A),ua.subSelf($.multiplyScalar($.dot(A))).normalize(),S.cross(f.vertexNormals[d],A),e=S.dot(N[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(ua.x,ua.y,ua.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,h;for(f=0,h=this.vertices.length;f<h;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,h=this.faces.length;f<h;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;
+b,c,d,e,f,A){i=a.vertices[b].position;k=a.vertices[c].position;l=a.vertices[d].position;j=h[e];n=h[f];p=h[A];o=k.x-i.x;m=l.x-i.x;r=k.y-i.y;t=l.y-i.y;z=k.z-i.z;y=l.z-i.z;J=n.u-j.u;K=p.u-j.u;u=n.v-j.v;B=p.v-j.v;H=1/(J*B-K*u);I.set((B*o-u*m)*H,(B*r-u*t)*H,(B*z-u*y)*H);S.set((J*m-K*o)*H,(J*t-K*r)*H,(J*y-K*z)*H);M[b].addSelf(I);M[c].addSelf(I);M[d].addSelf(I);N[b].addSelf(S);N[c].addSelf(S);N[d].addSelf(S)}var b,c,d,e,f,h,i,k,l,j,n,p,o,m,r,t,z,y,J,K,u,B,H,A,M=[],N=[],I=new THREE.Vector3,S=new THREE.Vector3,
+ua=new THREE.Vector3,ka=new THREE.Vector3,$=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)M[b]=new THREE.Vector3,N[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],h=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 Z=["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++)$.copy(f.vertexNormals[d]),e=f[Z[d]],
+A=M[e],ua.copy(A),ua.subSelf($.multiplyScalar($.dot(A))).normalize(),ka.cross(f.vertexNormals[d],A),e=ka.dot(N[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(ua.x,ua.y,ua.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,h;for(f=0,h=this.vertices.length;f<h;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,h=this.faces.length;f<h;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,h){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,h,i,k,l,j,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);h=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]];j=this.points[c[1]];
 n=this.points[c[2]];p=this.points[c[3]];i=h*h;k=h*i;d.x=b(l.x,j.x,n.x,p.x,h,i,k);d.y=b(l.y,j.y,n.y,p.y,h,i,k);d.z=b(l.z,j.z,n.z,p.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,f=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),h.copy(d),j+=h.distanceTo(f),
 f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(i[b]=j,e=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,h,i=[],j=new THREE.Vector3,l=this.getLength();i.push(j.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=l.chunks[b]-l.chunks[b-1];h=Math.ceil(a*c/l.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<h-1;c++)d=e+c*(1/h)*(f-e),d=this.getPoint(d),i.push(j.copy(d).clone());i.push(j.copy(this.points[b]).clone())}this.points=
@@ -186,43 +186,43 @@ 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 h=1;"v2"===f.type?h=2:"v3"===f.type?h=3:"v4"===f.type?h=4:"c"===f.type&&(h=3);f.size=h;f.array=new Float32Array(c*h);f.buffer=g.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,h,i=a.vertices;h=i.length;
-var j=a.colors,l=j.length,n=a.__vertexArray,m=a.__colorArray,k=a.__sortArray,p=a.__dirtyVertices,o=a.__dirtyColors,r=a.__webglCustomAttributesList;if(c.sortParticles){Ta.multiplySelf(c.matrixWorld);for(d=0;d<h;d++)e=i[d].position,Ua.copy(e),Ta.multiplyVector3(Ua),k[d]=[Ua.z,d];k.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++)e=i[k[d][1]].position,f=3*d,n[f]=e.x,n[f+1]=e.y,n[f+2]=e.z;for(d=0;d<l;d++)f=3*d,e=j[k[d][1]],m[f]=e.r,m[f+1]=e.g,m[f+2]=e.b;if(r)for(j=0,l=r.length;j<l;j++)if(i=r[j],
+var j=a.colors,l=j.length,n=a.__vertexArray,m=a.__colorArray,k=a.__sortArray,p=a.__dirtyVertices,o=a.__dirtyColors,r=a.__webglCustomAttributesList;if(c.sortParticles){Va.multiplySelf(c.matrixWorld);for(d=0;d<h;d++)e=i[d].position,Ia.copy(e),Va.multiplyVector3(Ia),k[d]=[Ia.z,d];k.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++)e=i[k[d][1]].position,f=3*d,n[f]=e.x,n[f+1]=e.y,n[f+2]=e.z;for(d=0;d<l;d++)f=3*d,e=j[k[d][1]],m[f]=e.r,m[f+1]=e.g,m[f+2]=e.b;if(r)for(j=0,l=r.length;j<l;j++)if(i=r[j],
 void 0===i.boundTo||"vertices"===i.boundTo)if(f=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[f]=h.x,i.array[f+1]=h.y,f+=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[f]=h.r,i.array[f+1]=h.g,i.array[f+2]=h.b,f+=3;else for(d=0;d<e;d++)h=k[d][1],h=i.value[h],i.array[f]=h.x,i.array[f+1]=h.y,i.array[f+2]=h.z,f+=3;else if(4===i.size)for(d=0;d<e;d++)h=k[d][1],h=i.value[h],
 i.array[f]=h.x,i.array[f+1]=h.y,i.array[f+2]=h.z,i.array[f+3]=h.w,f+=4}else{if(p)for(d=0;d<h;d++)e=i[d].position,f=3*d,n[f]=e.x,n[f+1]=e.y,n[f+2]=e.z;if(o)for(d=0;d<l;d++)e=j[d],f=3*d,m[f]=e.r,m[f+1]=e.g,m[f+2]=e.b;if(r)for(j=0,l=r.length;j<l;j++)if(i=r[j],i.needsUpdate&&(void 0===i.boundTo||"vertices"===i.boundTo))if(e=i.value.length,f=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[f]=h.x,i.array[f+1]=h.y,f+=2;else if(3===i.size)if("c"===
 i.type)for(d=0;d<e;d++)h=i.value[d],i.array[f]=h.r,i.array[f+1]=h.g,i.array[f+2]=h.b,f+=3;else for(d=0;d<e;d++)h=i.value[d],i.array[f]=h.x,i.array[f+1]=h.y,i.array[f+2]=h.z,f+=3;else if(4===i.size)for(d=0;d<e;d++)h=i.value[d],i.array[f]=h.x,i.array[f+1]=h.y,i.array[f+2]=h.z,i.array[f+3]=h.w,f+=4}if(p||c.sortParticles)g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer),g.bufferData(g.ARRAY_BUFFER,n,b);if(o||c.sortParticles)g.bindBuffer(g.ARRAY_BUFFER,a.__webglColorBuffer),g.bufferData(g.ARRAY_BUFFER,
-m,b);if(r)for(j=0,l=r.length;j<l;j++)if(i=r[j],i.needsUpdate||c.sortParticles)g.bindBuffer(g.ARRAY_BUFFER,i.buffer),g.bufferData(g.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,g=a.length;d<g;d++)Z=null,Q=L=Ma=Ca=ya=-1,a[d].render(b,c,bc,cc),Z=null,Q=L=Ma=Ca=ya=-1}function k(a,b,c,d,g,e,f,h){var i,j,l,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;l=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;
+m,b);if(r)for(j=0,l=r.length;j<l;j++)if(i=r[j],i.needsUpdate||c.sortParticles)g.bindBuffer(g.ARRAY_BUFFER,i.buffer),g.bufferData(g.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,g=a.length;d<g;d++)W=ba=null,Q=L=Oa=Na=Ba=-1,a[d].render(b,c,cc,dc),W=ba=null,Q=L=Oa=Na=Ba=-1}function k(a,b,c,d,g,e,f,h){var i,j,l,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;l=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;
 f&&D.setBlending(i.blending);D.setDepthTest(i.depthTest);D.setDepthWrite(i.depthWrite);z(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}D.setObjectFaces(j);l instanceof THREE.BufferGeometry?D.renderBufferDirect(d,g,e,i,l,j):D.renderBuffer(d,g,e,i,l,j)}}function l(a,b,c,d,g,e,f){for(var h,i,j=0,l=a.length;j<l;j++)if(h=a[j],i=h.object,i.visible){if(f)h=f;else{h=h[b];if(!h)continue;e&&D.setBlending(h.blending);D.setDepthTest(h.depthTest);D.setDepthWrite(h.depthWrite);z(h.polygonOffset,h.polygonOffsetFactor,
 h.polygonOffsetUnits)}D.renderImmediateObject(c,d,g,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 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 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||D.initMaterial(d,b,c,e);if(d.morphTargets&&
-!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(D.maxMorphTargets);for(var f=0,h=D.maxMorphTargets;f<h;f++)e.__webglMorphTargetInfluences[f]=0}var i=!1,f=d.program,h=f.uniforms,j=d.uniforms;f!==Z&&(g.useProgram(f),Z=f,i=!0);if(d.id!==Q)Q=d.id,i=!0;if(i){g.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 l,n=0,m=0,k=0,p,o,r,t=dc,u=t.directional.colors,z=t.directional.positions,y=t.point.colors,A=t.point.positions,K=t.point.distances,M=0,I=0,N=r=0;for(c=0,i=b.length;c<i;c++)if(l=b[c],!l.onlyShadow)if(p=l.color,o=l.intensity,r=l.distance,l instanceof THREE.AmbientLight)D.gammaInput?(n+=p.r*p.r,m+=p.g*p.g,k+=p.b*p.b):(n+=p.r,m+=p.g,k+=p.b);else if(l instanceof THREE.DirectionalLight)r=3*M,D.gammaInput?
-(u[r]=p.r*p.r*o*o,u[r+1]=p.g*p.g*o*o,u[r+2]=p.b*p.b*o*o):(u[r]=p.r*o,u[r+1]=p.g*o,u[r+2]=p.b*o),Ia.copy(l.matrixWorld.getPosition()),Ia.subSelf(l.target.matrixWorld.getPosition()),Ia.normalize(),z[r]=Ia.x,z[r+1]=Ia.y,z[r+2]=Ia.z,M+=1;else if(l instanceof THREE.PointLight||l instanceof THREE.SpotLight)N=3*I,D.gammaInput?(y[N]=p.r*p.r*o*o,y[N+1]=p.g*p.g*o*o,y[N+2]=p.b*p.b*o*o):(y[N]=p.r*o,y[N+1]=p.g*o,y[N+2]=p.b*o),l=l.matrixWorld.getPosition(),A[N]=l.x,A[N+1]=l.y,A[N+2]=l.z,K[I]=r,I+=1;for(c=3*M,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=M;t.ambient[0]=n;t.ambient[1]=m;t.ambient[2]=k;c=dc;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||
+!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(D.maxMorphTargets);for(var f=0,h=D.maxMorphTargets;f<h;f++)e.__webglMorphTargetInfluences[f]=0}var i=!1,f=d.program,h=f.uniforms,j=d.uniforms;f!==ba&&(g.useProgram(f),ba=f,i=!0);if(d.id!==Q)Q=d.id,i=!0;if(i||a!==W)g.uniformMatrix4fv(h.projectionMatrix,!1,a._projectionMatrixArray),a!==W&&(W=a);if(i){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 l,n=0,m=0,k=0,p,o,r,t=ec,u=t.directional.colors,z=t.directional.positions,y=t.point.colors,A=t.point.positions,K=t.point.distances,M=0,I=0,N=r=0;for(c=0,i=b.length;c<i;c++)if(l=b[c],!l.onlyShadow)if(p=l.color,o=l.intensity,r=l.distance,l instanceof THREE.AmbientLight)D.gammaInput?(n+=p.r*p.r,m+=p.g*p.g,k+=p.b*p.b):(n+=p.r,m+=p.g,k+=p.b);else if(l instanceof THREE.DirectionalLight)r=
+3*M,D.gammaInput?(u[r]=p.r*p.r*o*o,u[r+1]=p.g*p.g*o*o,u[r+2]=p.b*p.b*o*o):(u[r]=p.r*o,u[r+1]=p.g*o,u[r+2]=p.b*o),ib.copy(l.matrixWorld.getPosition()),ib.subSelf(l.target.matrixWorld.getPosition()),ib.normalize(),z[r]=ib.x,z[r+1]=ib.y,z[r+2]=ib.z,M+=1;else if(l instanceof THREE.PointLight||l instanceof THREE.SpotLight)N=3*I,D.gammaInput?(y[N]=p.r*p.r*o*o,y[N+1]=p.g*p.g*o*o,y[N+2]=p.b*p.b*o*o):(y[N]=p.r*o,y[N+1]=p.g*o,y[N+2]=p.b*o),l=l.matrixWorld.getPosition(),A[N]=l.x,A[N+1]=l.y,A[N+2]=l.z,K[I]=r,
+I+=1;for(c=3*M,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=M;t.ambient[0]=n;t.ambient[1]=m;t.ambient[2]=k;c=ec;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,D.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,D.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)D.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(n=b.length;i<n;i++)if(m=b[i],m.castShadow&&(m instanceof THREE.SpotLight||m instanceof THREE.DirectionalLight))j.shadowMap.texture[c]=m.shadowMap,j.shadowMapSize.value[c]=m.shadowMapSize,j.shadowMatrix.value[c]=m.shadowMatrix,j.shadowDarkness.value[c]=m.shadowDarkness,j.shadowBias.value[c]=m.shadowBias,c++}b=d.uniformsList;for(j=0,c=b.length;j<c;j++)if(m=f.uniforms[b[j][1]])if(i=b[j][0],k=i.type,n=i.value,"i"===k)g.uniform1i(m,n);else if("f"===k)g.uniform1f(m,n);else if("v2"===k)g.uniform2f(m,
 n.x,n.y);else if("v3"===k)g.uniform3f(m,n.x,n.y,n.z);else if("v4"===k)g.uniform4f(m,n.x,n.y,n.z,n.w);else if("c"===k)g.uniform3f(m,n.r,n.g,n.b);else if("fv1"===k)g.uniform1fv(m,n);else if("fv"===k)g.uniform3fv(m,n);else if("v2v"===k){if(!i._array)i._array=new Float32Array(2*n.length);for(k=0,t=n.length;k<t;k++)u=2*k,i._array[u]=n[k].x,i._array[u+1]=n[k].y;g.uniform2fv(m,i._array)}else if("v3v"===k){if(!i._array)i._array=new Float32Array(3*n.length);for(k=0,t=n.length;k<t;k++)u=3*k,i._array[u]=n[k].x,
 i._array[u+1]=n[k].y,i._array[u+2]=n[k].z;g.uniform3fv(m,i._array)}else if("v4v"==k){if(!i._array)i._array=new Float32Array(4*n.length);for(k=0,t=n.length;k<t;k++)u=4*k,i._array[u]=n[k].x,i._array[u+1]=n[k].y,i._array[u+2]=n[k].z,i._array[u+3]=n[k].w;g.uniform4fv(m,i._array)}else if("m4"===k){if(!i._array)i._array=new Float32Array(16);n.flattenToArray(i._array);g.uniformMatrix4fv(m,!1,i._array)}else if("m4v"===k){if(!i._array)i._array=new Float32Array(16*n.length);for(k=0,t=n.length;k<t;k++)n[k].flattenToArrayOffset(i._array,
-16*k);g.uniformMatrix4fv(m,!1,i._array)}else if("t"===k){if(g.uniform1i(m,n),m=i.texture)if(m.image instanceof Array&&6===m.image.length){if(i=m,6===i.image.length)if(i.needsUpdate){if(!i.image.__webglTextureCube)i.image.__webglTextureCube=g.createTexture();g.activeTexture(g.TEXTURE0+n);g.bindTexture(g.TEXTURE_CUBE_MAP,i.image.__webglTextureCube);n=[];for(m=0;6>m;m++){k=n;t=m;if(D.autoScaleCubemaps){if(u=i.image[m],y=tc,!(u.width<=y&&u.height<=y))A=Math.max(u.width,u.height),z=Math.floor(u.width*
+16*k);g.uniformMatrix4fv(m,!1,i._array)}else if("t"===k){if(g.uniform1i(m,n),m=i.texture)if(m.image instanceof Array&&6===m.image.length){if(i=m,6===i.image.length)if(i.needsUpdate){if(!i.image.__webglTextureCube)i.image.__webglTextureCube=g.createTexture();g.activeTexture(g.TEXTURE0+n);g.bindTexture(g.TEXTURE_CUBE_MAP,i.image.__webglTextureCube);n=[];for(m=0;6>m;m++){k=n;t=m;if(D.autoScaleCubemaps){if(u=i.image[m],y=uc,!(u.width<=y&&u.height<=y))A=Math.max(u.width,u.height),z=Math.floor(u.width*
 y/A),y=Math.floor(u.height*y/A),A=document.createElement("canvas"),A.width=z,A.height=y,A.getContext("2d").drawImage(u,0,0,u.width,u.height,0,0,z,y),u=A}else u=i.image[m];k[t]=u}m=n[0];k=0===(m.width&m.width-1)&&0===(m.height&m.height-1);t=B(i.format);u=B(i.type);J(g.TEXTURE_CUBE_MAP,i,k);for(m=0;6>m;m++)g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,t,t,u,n[m]);i.generateMipmaps&&k&&g.generateMipmap(g.TEXTURE_CUBE_MAP);i.needsUpdate=!1;if(i.onUpdated)i.onUpdated()}else g.activeTexture(g.TEXTURE0+
 n),g.bindTexture(g.TEXTURE_CUBE_MAP,i.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(i=m,g.activeTexture(g.TEXTURE0+n),g.bindTexture(g.TEXTURE_CUBE_MAP,i.__webglTexture)):D.setTexture(m,n)}else if("tv"===k){if(!i._array){i._array=[];for(k=0,t=i.texture.length;k<t;k++)i._array[k]=n+k}g.uniform1iv(m,i._array);for(k=0,t=i.texture.length;k<t;k++)(m=i.texture[k])&&D.setTexture(m,i._array[k])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&
 null!==h.cameraPosition&&g.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&&g.uniformMatrix4fv(h.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(g.uniformMatrix4fv(h.cameraInverseMatrix,!1,a._viewMatrixArray),g.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices))}g.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrixArray);h.normalMatrix&&
-g.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&null!==h.objectMatrix&&g.uniformMatrix4fv(h.objectMatrix,!1,e._objectMatrixArray);return f}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){mb!==a&&(a?g.enable(g.POLYGON_OFFSET_FILL):g.disable(g.POLYGON_OFFSET_FILL),
-mb=a);if(a&&(Sa!==b||Pa!==c))g.polygonOffset(b,c),Sa=b,Pa=c}function y(a,b){var c;"fragment"===a?c=g.createShader(g.FRAGMENT_SHADER):"vertex"===a&&(c=g.createShader(g.VERTEX_SHADER));g.shaderSource(c,b);g.compileShader(c);return!g.getShaderParameter(c,g.COMPILE_STATUS)?(console.error(g.getShaderInfoLog(c)),console.error(b),null):c}function J(a,b,c){c?(g.texParameteri(a,g.TEXTURE_WRAP_S,B(b.wrapS)),g.texParameteri(a,g.TEXTURE_WRAP_T,B(b.wrapT)),g.texParameteri(a,g.TEXTURE_MAG_FILTER,B(b.magFilter)),
+g.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&null!==h.objectMatrix&&g.uniformMatrix4fv(h.objectMatrix,!1,e._objectMatrixArray);return f}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){Pa!==a&&(a?g.enable(g.POLYGON_OFFSET_FILL):g.disable(g.POLYGON_OFFSET_FILL),
+Pa=a);if(a&&(Ta!==b||Ua!==c))g.polygonOffset(b,c),Ta=b,Ua=c}function y(a,b){var c;"fragment"===a?c=g.createShader(g.FRAGMENT_SHADER):"vertex"===a&&(c=g.createShader(g.VERTEX_SHADER));g.shaderSource(c,b);g.compileShader(c);return!g.getShaderParameter(c,g.COMPILE_STATUS)?(console.error(g.getShaderInfoLog(c)),console.error(b),null):c}function J(a,b,c){c?(g.texParameteri(a,g.TEXTURE_WRAP_S,B(b.wrapS)),g.texParameteri(a,g.TEXTURE_WRAP_T,B(b.wrapT)),g.texParameteri(a,g.TEXTURE_MAG_FILTER,B(b.magFilter)),
 g.texParameteri(a,g.TEXTURE_MIN_FILTER,B(b.minFilter))):(g.texParameteri(a,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE),g.texParameteri(a,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE),g.texParameteri(a,g.TEXTURE_MAG_FILTER,u(b.magFilter)),g.texParameteri(a,g.TEXTURE_MIN_FILTER,u(b.minFilter)))}function K(a,b){g.bindRenderbuffer(g.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_COMPONENT16,b.width,b.height),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_ATTACHMENT,g.RENDERBUFFER,
 a)):b.depthBuffer&&b.stencilBuffer?(g.renderbufferStorage(g.RENDERBUFFER,g.DEPTH_STENCIL,b.width,b.height),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,a)):g.renderbufferStorage(g.RENDERBUFFER,g.RGBA4,b.width,b.height)}function u(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return g.NEAREST;default:return g.LINEAR}}function B(a){switch(a){case THREE.RepeatWrapping:return g.REPEAT;case THREE.ClampToEdgeWrapping:return g.CLAMP_TO_EDGE;
 case THREE.MirroredRepeatWrapping:return g.MIRRORED_REPEAT;case THREE.NearestFilter:return g.NEAREST;case THREE.NearestMipMapNearestFilter:return g.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return g.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return g.LINEAR;case THREE.LinearMipMapNearestFilter:return g.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return g.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return g.BYTE;case THREE.UnsignedByteType:return g.UNSIGNED_BYTE;case THREE.ShortType:return g.SHORT;
 case THREE.UnsignedShortType:return g.UNSIGNED_SHORT;case THREE.IntType:return g.INT;case THREE.UnsignedShortType:return g.UNSIGNED_INT;case THREE.FloatType:return g.FLOAT;case THREE.AlphaFormat:return g.ALPHA;case THREE.RGBFormat:return g.RGB;case THREE.RGBAFormat:return g.RGBA;case THREE.LuminanceFormat:return g.LUMINANCE;case THREE.LuminanceAlphaFormat:return g.LUMINANCE_ALPHA}return 0}var a=a||{},H=void 0!==a.canvas?a.canvas:document.createElement("canvas"),A=void 0!==a.precision?a.precision:
-"mediump",M=void 0!==a.alpha?a.alpha:!0,N=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,I=void 0!==a.antialias?a.antialias:!1,ia=void 0!==a.stencil?a.stencil:!0,ua=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,S=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),$=void 0!==a.clearAlpha?a.clearAlpha:0,Y=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 D=this,g,lb=[],Z=null,oa=null,Q=-1,L=null,qa=0,va=null,ba=null,ya=null,Ca=null,Ma=null,mb=null,Sa=
-null,Pa=null,Na=null,zb=0,Fb=0,Pb=0,Ab=0,bc=0,cc=0,Gb=new THREE.Frustum,Ta=new THREE.Matrix4,Ua=new THREE.Vector4,Ia=new THREE.Vector3,dc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};g=function(){var a;try{if(!(a=H.getContext("experimental-webgl",{alpha:M,premultipliedAlpha:N,antialias:I,stencil:ia,preserveDrawingBuffer:ua})))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}();g.clearColor(0,0,0,1);g.clearDepth(1);g.clearStencil(0);g.enable(g.DEPTH_TEST);g.depthFunc(g.LEQUAL);g.frontFace(g.CCW);g.cullFace(g.BACK);g.enable(g.CULL_FACE);g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA);g.clearColor(S.r,S.g,S.b,$);this.context=g;var ec=g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
-g.getParameter(g.MAX_TEXTURE_SIZE);var tc=g.getParameter(g.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return g};this.supportsVertexTextures=function(){return 0<ec};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){zb=a;Fb=b;Pb=c;Ab=d;g.viewport(zb,Fb,Pb,Ab)};this.setScissor=function(a,b,c,d){g.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?g.enable(g.SCISSOR_TEST):g.disable(g.SCISSOR_TEST)};this.setClearColorHex=
-function(a,b){S.setHex(a);$=b;g.clearColor(S.r,S.g,S.b,$)};this.setClearColor=function(a,b){S.copy(a);$=b;g.clearColor(S.r,S.g,S.b,$)};this.getClearColor=function(){return S};this.getClearAlpha=function(){return $};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=g.COLOR_BUFFER_BIT;if(void 0===b||b)d|=g.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=g.STENCIL_BUFFER_BIT;g.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);
+"mediump",M=void 0!==a.alpha?a.alpha:!0,N=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,I=void 0!==a.antialias?a.antialias:!1,S=void 0!==a.stencil?a.stencil:!0,ua=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ka=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),$=void 0!==a.clearAlpha?a.clearAlpha:0,Z=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 D=this,g,Sa=[],ba=null,pa=null,Q=-1,L=null,W=null,ya=0,ca=null,Ea=null,Ba=null,Na=null,Oa=null,Pa=
+null,Ta=null,Ua=null,nb=null,Fb=0,Pb=0,Ab=0,Gb=0,cc=0,dc=0,Qb=new THREE.Frustum,Va=new THREE.Matrix4,Ia=new THREE.Vector4,ib=new THREE.Vector3,ec={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};g=function(){var a;try{if(!(a=H.getContext("experimental-webgl",{alpha:M,premultipliedAlpha:N,antialias:I,stencil:S,preserveDrawingBuffer:ua})))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}();g.clearColor(0,0,0,1);g.clearDepth(1);g.clearStencil(0);g.enable(g.DEPTH_TEST);g.depthFunc(g.LEQUAL);g.frontFace(g.CCW);g.cullFace(g.BACK);g.enable(g.CULL_FACE);g.enable(g.BLEND);g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA);g.clearColor(ka.r,ka.g,ka.b,$);this.context=g;var fc=g.getParameter(g.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
+g.getParameter(g.MAX_TEXTURE_SIZE);var uc=g.getParameter(g.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return g};this.supportsVertexTextures=function(){return 0<fc};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){Fb=a;Pb=b;Ab=c;Gb=d;g.viewport(Fb,Pb,Ab,Gb)};this.setScissor=function(a,b,c,d){g.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?g.enable(g.SCISSOR_TEST):g.disable(g.SCISSOR_TEST)};this.setClearColorHex=
+function(a,b){ka.setHex(a);$=b;g.clearColor(ka.r,ka.g,ka.b,$)};this.setClearColor=function(a,b){ka.copy(a);$=b;g.clearColor(ka.r,ka.g,ka.b,$)};this.getClearColor=function(){return ka};this.getClearAlpha=function(){return $};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=g.COLOR_BUFFER_BIT;if(void 0===b||b)d|=g.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=g.STENCIL_BUFFER_BIT;g.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];g.deleteBuffer(c.__webglVertexBuffer);g.deleteBuffer(c.__webglNormalBuffer);g.deleteBuffer(c.__webglTangentBuffer);
 g.deleteBuffer(c.__webglColorBuffer);g.deleteBuffer(c.__webglUVBuffer);g.deleteBuffer(c.__webglUV2Buffer);g.deleteBuffer(c.__webglSkinVertexABuffer);g.deleteBuffer(c.__webglSkinVertexBBuffer);g.deleteBuffer(c.__webglSkinIndicesBuffer);g.deleteBuffer(c.__webglSkinWeightsBuffer);g.deleteBuffer(c.__webglFaceBuffer);g.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)g.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=
 void 0,c.__webglCustomAttributesList)g.deleteBuffer(c.__webglCustomAttributesList[d].buffer);D.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,g.deleteBuffer(a.__webglVertexBuffer),g.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,g.deleteBuffer(a.__webglVertexBuffer),g.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,g.deleteBuffer(a.__webglVertexBuffer),
-g.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,g.deleteTexture(a.__webglTexture),D.info.memory.textures--};this.updateShadowMap=function(a,b){Z=null;Q=L=Ma=Ca=ya=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=g.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=g.createBuffer();a.hasPos&&(g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer),
+g.deleteBuffer(a.__webglColorBuffer),D.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,g.deleteTexture(a.__webglTexture),D.info.memory.textures--};this.updateShadowMap=function(a,b){ba=null;Q=L=Oa=Na=Ba=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=g.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=g.createBuffer();a.hasPos&&(g.bindBuffer(g.ARRAY_BUFFER,a.__webglVertexBuffer),
 g.bufferData(g.ARRAY_BUFFER,a.positionArray,g.DYNAMIC_DRAW),g.enableVertexAttribArray(b.attributes.position),g.vertexAttribPointer(b.attributes.position,3,g.FLOAT,!1,0,0));if(a.hasNormal){g.bindBuffer(g.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,h,i,j,n,m,k,l,p=3*a.count;for(l=0;l<p;l+=9)c=a.normalArray,d=c[l],e=c[l+1],f=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,f=(f+m+k)/3,c[l]=d,c[l+1]=e,c[l+2]=f,c[l+3]=d,c[l+4]=e,c[l+5]=f,
 c[l+6]=d,c[l+7]=e,c[l+8]=f}g.bufferData(g.ARRAY_BUFFER,a.normalArray,g.DYNAMIC_DRAW);g.enableVertexAttribArray(b.attributes.normal);g.vertexAttribPointer(b.attributes.normal,3,g.FLOAT,!1,0,0)}g.drawArrays(g.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(0!==d.opacity&&(c=r(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==L&&(L=d,b=!0),f instanceof THREE.Mesh)){f=e.offsets;d=0;for(c=f.length;d<c;++d)b&&(g.bindBuffer(g.ARRAY_BUFFER,e.vertexPositionBuffer),
 g.vertexAttribPointer(a.position,e.vertexPositionBuffer.itemSize,g.FLOAT,!1,0,12*f[d].index),0<=a.normal&&e.vertexNormalBuffer&&(g.bindBuffer(g.ARRAY_BUFFER,e.vertexNormalBuffer),g.vertexAttribPointer(a.normal,e.vertexNormalBuffer.itemSize,g.FLOAT,!1,0,12*f[d].index)),0<=a.uv&&e.vertexUvBuffer&&(e.vertexUvBuffer?(g.bindBuffer(g.ARRAY_BUFFER,e.vertexUvBuffer),g.vertexAttribPointer(a.uv,e.vertexUvBuffer.itemSize,g.FLOAT,!1,0,8*f[d].index),g.enableVertexAttribArray(a.uv)):g.disableVertexAttribArray(a.uv)),
@@ -232,75 +232,75 @@ e.id+2*c.id+(d.wireframe?1:0);c!==L&&(L=c,a=!0);if(!d.morphTargets&&0<=b.positio
 n&&(l=m,n=i[l]);g.bindBuffer(g.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);g.vertexAttribPointer(c["morphTarget"+h],3,g.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[h]=n;j[l]=1;n=-1;h++}}null!==d.program.uniforms.morphTargetInfluences&&g.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__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]&&(g.bindBuffer(g.ARRAY_BUFFER,
 c.buffer),g.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,g.FLOAT,!1,0,0));0<=b.color&&(g.bindBuffer(g.ARRAY_BUFFER,e.__webglColorBuffer),g.vertexAttribPointer(b.color,3,g.FLOAT,!1,0,0));0<=b.normal&&(g.bindBuffer(g.ARRAY_BUFFER,e.__webglNormalBuffer),g.vertexAttribPointer(b.normal,3,g.FLOAT,!1,0,0));0<=b.tangent&&(g.bindBuffer(g.ARRAY_BUFFER,e.__webglTangentBuffer),g.vertexAttribPointer(b.tangent,4,g.FLOAT,!1,0,0));0<=b.uv&&(e.__webglUVBuffer?(g.bindBuffer(g.ARRAY_BUFFER,e.__webglUVBuffer),
 g.vertexAttribPointer(b.uv,2,g.FLOAT,!1,0,0),g.enableVertexAttribArray(b.uv)):g.disableVertexAttribArray(b.uv));0<=b.uv2&&(e.__webglUV2Buffer?(g.bindBuffer(g.ARRAY_BUFFER,e.__webglUV2Buffer),g.vertexAttribPointer(b.uv2,2,g.FLOAT,!1,0,0),g.enableVertexAttribArray(b.uv2)):g.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&0<=b.skinIndex&&0<=b.skinWeight&&(g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinVertexABuffer),g.vertexAttribPointer(b.skinVertexA,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,
-e.__webglSkinVertexBBuffer),g.vertexAttribPointer(b.skinVertexB,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),g.vertexAttribPointer(b.skinIndex,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),g.vertexAttribPointer(b.skinWeight,4,g.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==Na&&(g.lineWidth(d),Na=d),a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),g.drawElements(g.LINES,e.__webglLineCount,g.UNSIGNED_SHORT,
-0)):(a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),g.drawElements(g.TRIANGLES,e.__webglFaceCount,g.UNSIGNED_SHORT,0)),D.info.render.calls++,D.info.render.vertices+=e.__webglFaceCount,D.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?g.LINE_STRIP:g.LINES,d=d.linewidth,d!==Na&&(g.lineWidth(d),Na=d),g.drawArrays(f,0,e.__webglLineCount),D.info.render.calls++):f instanceof THREE.ParticleSystem?(g.drawArrays(g.POINTS,0,e.__webglParticleCount),D.info.render.calls++,
+e.__webglSkinVertexBBuffer),g.vertexAttribPointer(b.skinVertexB,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),g.vertexAttribPointer(b.skinIndex,4,g.FLOAT,!1,0,0),g.bindBuffer(g.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),g.vertexAttribPointer(b.skinWeight,4,g.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==nb&&(g.lineWidth(d),nb=d),a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),g.drawElements(g.LINES,e.__webglLineCount,g.UNSIGNED_SHORT,
+0)):(a&&g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),g.drawElements(g.TRIANGLES,e.__webglFaceCount,g.UNSIGNED_SHORT,0)),D.info.render.calls++,D.info.render.vertices+=e.__webglFaceCount,D.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?g.LINE_STRIP:g.LINES,d=d.linewidth,d!==nb&&(g.lineWidth(d),nb=d),g.drawArrays(f,0,e.__webglLineCount),D.info.render.calls++):f instanceof THREE.ParticleSystem?(g.drawArrays(g.POINTS,0,e.__webglParticleCount),D.info.render.calls++,
 D.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(g.drawArrays(g.TRIANGLE_STRIP,0,e.__webglVertexCount),D.info.render.calls++)}};this.render=function(a,b,c,d){var e,f,j,n,m=a.lights,p=a.fog;Q=-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);D.info.render.calls=0;D.info.render.vertices=0;D.info.render.faces=
-0;D.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);Gb.setFromMatrix(Ta);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(f=n[d],j=f.object,f.render=!1,j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||Gb.contains(j))){j.matrixWorld.flattenToArray(j._objectMatrixArray);t(j,b);var o=f,r=o.object,u=o.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?(o.transparent=y,o.opaque=null):(o.opaque=y,o.transparent=null)}else if(y)y.transparent?
-(o.transparent=y,o.opaque=null):(o.opaque=y,o.transparent=null);f.render=!0;if(this.sortObjects)j.renderDepth?f.z=j.renderDepth:(Ua.copy(j.position),Ta.multiplyVector3(Ua),f.z=Ua.z)}this.sortObjects&&n.sort(h);n=a.__webglObjectsImmediate;for(d=0,e=n.length;d<e;d++)if(f=n[d],j=f.object,j.visible)j.matrixAutoUpdate&&j.matrixWorld.flattenToArray(j._objectMatrixArray),t(j,b),j=f.object.material,j.transparent?(f.transparent=j,f.opaque=null):(f.opaque=j,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),
+0;D.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);Va.multiply(b.projectionMatrix,b.matrixWorldInverse);Qb.setFromMatrix(Va);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(f=n[d],j=f.object,f.render=!1,j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||Qb.contains(j))){j.matrixWorld.flattenToArray(j._objectMatrixArray);t(j,b);var o=f,r=o.object,u=o.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?(o.transparent=y,o.opaque=null):(o.opaque=y,o.transparent=null)}else if(y)y.transparent?
+(o.transparent=y,o.opaque=null):(o.opaque=y,o.transparent=null);f.render=!0;if(this.sortObjects)j.renderDepth?f.z=j.renderDepth:(Ia.copy(j.position),Va.multiplyVector3(Ia),f.z=Ia.z)}this.sortObjects&&n.sort(h);n=a.__webglObjectsImmediate;for(d=0,e=n.length;d<e;d++)if(f=n[d],j=f.object,j.visible)j.matrixAutoUpdate&&j.matrixWorld.flattenToArray(j._objectMatrixArray),t(j,b),j=f.object.material,j.transparent?(f.transparent=j,f.opaque=null):(f.opaque=j,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),
 this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),z(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),k(a.__webglObjects,!1,"",b,m,p,!0,a.overrideMaterial),l(a.__webglObjectsImmediate,"",b,m,p,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),k(a.__webglObjects,!0,"opaque",b,m,p,!1),l(a.__webglObjectsImmediate,"opaque",b,m,p,!1),k(a.__webglObjects,!1,"transparent",b,m,p,!0),l(a.__webglObjectsImmediate,
 "transparent",b,m,p,!0));i(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(g.bindTexture(g.TEXTURE_CUBE_MAP,c.__webglTexture),g.generateMipmap(g.TEXTURE_CUBE_MAP),g.bindTexture(g.TEXTURE_CUBE_MAP,null)):(g.bindTexture(g.TEXTURE_2D,c.__webglTexture),g.generateMipmap(g.TEXTURE_2D),g.bindTexture(g.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=
-function(a,b,c,d,e){var f=r(a,b,c,d,e);L=-1;D.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,g,Gb):e.render(function(a){D.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,l=void 0,k=void 0,r=void 0;if(!h.__webglInit)if(h.__webglInit=!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=
+function(a,b,c,d,e){var f=r(a,b,c,d,e);L=-1;D.setObjectFaces(e);e.immediateRenderCallback?e.immediateRenderCallback(f,g,Qb):e.render(function(a){D.renderBufferImmediate(a,f,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],i=a,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,A=void 0,H=void 0,B=void 0,J=void 0,K={},M=t.morphTargets.length;t.geometryGroups={};for(u=0,y=t.faces.length;u<y;u++)z=t.faces[u],A=z.materialIndex,B=void 0!==A?A:-1,void 0===K[B]&&(K[B]={hash:B,counter:0}),
 J=K[B].hash+"_"+K[B].counter,void 0===t.geometryGroups[J]&&(t.geometryGroups[J]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:M}),H=z instanceof THREE.Face3?3:4,65535<t.geometryGroups[J].vertices+H&&(K[B].counter+=1,J=K[B].hash+"_"+K[B].counter,void 0===t.geometryGroups[J]&&(t.geometryGroups[J]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:M})),z instanceof THREE.Face3?t.geometryGroups[J].faces3.push(u):t.geometryGroups[J].faces4.push(u),t.geometryGroups[J].vertices+=
-H;t.geometryGroupsList=[];var N=void 0;for(N in t.geometryGroups)t.geometryGroups[N].id=qa++,t.geometryGroupsList.push(t.geometryGroups[N])}for(l in k.geometryGroups)if(r=k.geometryGroups[l],!r.__webglVertexBuffer){var I=r;I.__webglVertexBuffer=g.createBuffer();I.__webglNormalBuffer=g.createBuffer();I.__webglTangentBuffer=g.createBuffer();I.__webglColorBuffer=g.createBuffer();I.__webglUVBuffer=g.createBuffer();I.__webglUV2Buffer=g.createBuffer();I.__webglSkinVertexABuffer=g.createBuffer();I.__webglSkinVertexBBuffer=
-g.createBuffer();I.__webglSkinIndicesBuffer=g.createBuffer();I.__webglSkinWeightsBuffer=g.createBuffer();I.__webglFaceBuffer=g.createBuffer();I.__webglLineBuffer=g.createBuffer();if(I.numMorphTargets){var Q=void 0,$=void 0;I.__webglMorphTargetsBuffers=[];for(Q=0,$=I.numMorphTargets;Q<$;Q++)I.__webglMorphTargetsBuffers.push(g.createBuffer())}D.info.memory.geometries++;var L=r,Y=h,Z=Y.geometry,ba=L.faces3,ia=L.faces4,S=3*ba.length+4*ia.length,ua=1*ba.length+2*ia.length,va=3*ba.length+4*ia.length,oa=
-c(Y,L),ya=e(oa),Ca=d(oa),Na=oa.vertexColors?oa.vertexColors:!1;L.__vertexArray=new Float32Array(3*S);if(Ca)L.__normalArray=new Float32Array(3*S);if(Z.hasTangents)L.__tangentArray=new Float32Array(4*S);if(Na)L.__colorArray=new Float32Array(3*S);if(ya){if(0<Z.faceUvs.length||0<Z.faceVertexUvs.length)L.__uvArray=new Float32Array(2*S);if(1<Z.faceUvs.length||1<Z.faceVertexUvs.length)L.__uv2Array=new Float32Array(2*S)}if(Y.geometry.skinWeights.length&&Y.geometry.skinIndices.length)L.__skinVertexAArray=
-new Float32Array(4*S),L.__skinVertexBArray=new Float32Array(4*S),L.__skinIndexArray=new Float32Array(4*S),L.__skinWeightArray=new Float32Array(4*S);L.__faceArray=new Uint16Array(3*ua);L.__lineArray=new Uint16Array(2*va);if(L.numMorphTargets){L.__morphTargetsArrays=[];for(var Ma=0,lb=L.numMorphTargets;Ma<lb;Ma++)L.__morphTargetsArrays.push(new Float32Array(3*S))}L.__webglFaceCount=3*ua;L.__webglLineCount=2*va;if(oa.attributes){if(void 0===L.__webglCustomAttributesList)L.__webglCustomAttributesList=
-[];var Sa=void 0;for(Sa in oa.attributes){var Pa=oa.attributes[Sa],Fa={},Ua;for(Ua in Pa)Fa[Ua]=Pa[Ua];if(!Fa.__webglInitialized||Fa.createUniqueBuffers){Fa.__webglInitialized=!0;var Ia=1;"v2"===Fa.type?Ia=2:"v3"===Fa.type?Ia=3:"v4"===Fa.type?Ia=4:"c"===Fa.type&&(Ia=3);Fa.size=Ia;Fa.array=new Float32Array(S*Ia);Fa.buffer=g.createBuffer();Fa.buffer.belongsToAttribute=Sa;Pa.needsUpdate=!0;Fa.__original=Pa}L.__webglCustomAttributesList.push(Fa)}}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 mb=k;mb.__webglVertexBuffer=g.createBuffer();mb.__webglColorBuffer=g.createBuffer();D.info.memory.geometries++;var Ta=k,zb=Ta.vertices.length;Ta.__vertexArray=new Float32Array(3*zb);Ta.__colorArray=new Float32Array(3*zb);Ta.__webglVertexCount=zb;k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(h instanceof THREE.Line){if(k=
-h.geometry,!k.__webglVertexBuffer){var Fb=k;Fb.__webglVertexBuffer=g.createBuffer();Fb.__webglColorBuffer=g.createBuffer();D.info.memory.geometries++;var Qb=k,Pb=h,Ab=Qb.vertices.length;Qb.__vertexArray=new Float32Array(3*Ab);Qb.__colorArray=new Float32Array(3*Ab);Qb.__webglLineCount=Ab;b(Qb,Pb);k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(h instanceof THREE.ParticleSystem&&(k=h.geometry,!k.__webglVertexBuffer)){var Gb=k;Gb.__webglVertexBuffer=g.createBuffer();Gb.__webglColorBuffer=g.createBuffer();
-D.info.geometries++;var Hb=k,bc=h,uc=Hb.vertices.length;Hb.__vertexArray=new Float32Array(3*uc);Hb.__colorArray=new Float32Array(3*uc);Hb.__sortArray=[];Hb.__webglParticleCount=uc;b(Hb,bc);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 Ja=a.__objectsRemoved[0],fc=a;Ja instanceof THREE.Mesh||Ja instanceof THREE.ParticleSystem||Ja instanceof THREE.Ribbon||
-Ja instanceof THREE.Line?o(fc.__webglObjects,Ja):Ja instanceof THREE.Sprite?m(fc.__webglSprites,Ja):Ja instanceof THREE.LensFlare?m(fc.__webglFlares,Ja):(Ja instanceof THREE.MarchingCubes||Ja.immediateRenderCallback)&&o(fc.__webglObjectsImmediate,Ja);Ja.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var vc=0,cc=a.__webglObjects.length;vc<cc;vc++){var Qa=a.__webglObjects[vc].object,R=Qa.geometry,Rb=void 0,Ib=void 0,Aa=void 0;if(Qa 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 wc=0,dc=R.geometryGroupsList.length;wc<dc;wc++)if(Rb=R.geometryGroupsList[wc],Aa=c(Qa,Rb),Ib=Aa.attributes&&n(Aa),R.__dirtyVertices||R.__dirtyMorphTargets||R.__dirtyElements||R.__dirtyUvs||R.__dirtyNormals||R.__dirtyColors||R.__dirtyTangents||Ib){var O=Rb,ec=Qa,Ga=g.DYNAMIC_DRAW,tc=!R.dynamic,gc=Aa;if(O.__inittedArrays){var Ec=d(gc),xc=gc.vertexColors?gc.vertexColors:!1,Fc=e(gc),Gc=Ec===THREE.SmoothShading,
-v=void 0,C=void 0,Oa=void 0,x=void 0,Jb=void 0,nb=void 0,Ra=void 0,hc=void 0,hb=void 0,Kb=void 0,Lb=void 0,E=void 0,F=void 0,G=void 0,W=void 0,Va=void 0,Wa=void 0,Xa=void 0,Sb=void 0,Ya=void 0,Za=void 0,$a=void 0,Tb=void 0,ab=void 0,bb=void 0,cb=void 0,Ub=void 0,db=void 0,eb=void 0,fb=void 0,Vb=void 0,ob=void 0,pb=void 0,qb=void 0,ic=void 0,rb=void 0,sb=void 0,tb=void 0,jc=void 0,T=void 0,Hc=void 0,ub=void 0,Mb=void 0,Nb=void 0,Ha=void 0,Ic=void 0,pa=void 0,ja=0,na=0,ib=0,jb=0,Ka=0,wa=0,X=0,xa=0,
-ka=0,w=0,la=0,s=0,Da=void 0,ra=O.__vertexArray,Wb=O.__uvArray,Xb=O.__uv2Array,La=O.__normalArray,ca=O.__tangentArray,sa=O.__colorArray,da=O.__skinVertexAArray,ea=O.__skinVertexBArray,fa=O.__skinIndexArray,ga=O.__skinWeightArray,yc=O.__morphTargetsArrays,zc=O.__webglCustomAttributesList,q=void 0,gb=O.__faceArray,Ea=O.__lineArray,za=ec.geometry,Qc=za.__dirtyElements,Jc=za.__dirtyUvs,Rc=za.__dirtyNormals,Sc=za.__dirtyTangents,Tc=za.__dirtyColors,Uc=za.__dirtyMorphTargets,Bb=za.vertices,U=O.faces3,V=
-O.faces4,ma=za.faces,Ac=za.faceVertexUvs[0],Bc=za.faceVertexUvs[1],Cb=za.skinVerticesA,Db=za.skinVerticesB,Eb=za.skinIndices,vb=za.skinWeights,wb=za.morphTargets;if(za.__dirtyVertices){for(v=0,C=U.length;v<C;v++)x=ma[U[v]],E=Bb[x.a].position,F=Bb[x.b].position,G=Bb[x.c].position,ra[na]=E.x,ra[na+1]=E.y,ra[na+2]=E.z,ra[na+3]=F.x,ra[na+4]=F.y,ra[na+5]=F.z,ra[na+6]=G.x,ra[na+7]=G.y,ra[na+8]=G.z,na+=9;for(v=0,C=V.length;v<C;v++)x=ma[V[v]],E=Bb[x.a].position,F=Bb[x.b].position,G=Bb[x.c].position,W=Bb[x.d].position,
-ra[na]=E.x,ra[na+1]=E.y,ra[na+2]=E.z,ra[na+3]=F.x,ra[na+4]=F.y,ra[na+5]=F.z,ra[na+6]=G.x,ra[na+7]=G.y,ra[na+8]=G.z,ra[na+9]=W.x,ra[na+10]=W.y,ra[na+11]=W.z,na+=12;g.bindBuffer(g.ARRAY_BUFFER,O.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,ra,Ga)}if(Uc)for(Ha=0,Ic=wb.length;Ha<Ic;Ha++){la=0;for(v=0,C=U.length;v<C;v++)x=ma[U[v]],E=wb[Ha].vertices[x.a].position,F=wb[Ha].vertices[x.b].position,G=wb[Ha].vertices[x.c].position,pa=yc[Ha],pa[la]=E.x,pa[la+1]=E.y,pa[la+2]=E.z,pa[la+3]=F.x,pa[la+4]=F.y,
-pa[la+5]=F.z,pa[la+6]=G.x,pa[la+7]=G.y,pa[la+8]=G.z,la+=9;for(v=0,C=V.length;v<C;v++)x=ma[V[v]],E=wb[Ha].vertices[x.a].position,F=wb[Ha].vertices[x.b].position,G=wb[Ha].vertices[x.c].position,W=wb[Ha].vertices[x.d].position,pa=yc[Ha],pa[la]=E.x,pa[la+1]=E.y,pa[la+2]=E.z,pa[la+3]=F.x,pa[la+4]=F.y,pa[la+5]=F.z,pa[la+6]=G.x,pa[la+7]=G.y,pa[la+8]=G.z,pa[la+9]=W.x,pa[la+10]=W.y,pa[la+11]=W.z,la+=12;g.bindBuffer(g.ARRAY_BUFFER,O.__webglMorphTargetsBuffers[Ha]);g.bufferData(g.ARRAY_BUFFER,yc[Ha],Ga)}if(vb.length){for(v=
-0,C=U.length;v<C;v++)x=ma[U[v]],ab=vb[x.a],bb=vb[x.b],cb=vb[x.c],ga[w]=ab.x,ga[w+1]=ab.y,ga[w+2]=ab.z,ga[w+3]=ab.w,ga[w+4]=bb.x,ga[w+5]=bb.y,ga[w+6]=bb.z,ga[w+7]=bb.w,ga[w+8]=cb.x,ga[w+9]=cb.y,ga[w+10]=cb.z,ga[w+11]=cb.w,db=Eb[x.a],eb=Eb[x.b],fb=Eb[x.c],fa[w]=db.x,fa[w+1]=db.y,fa[w+2]=db.z,fa[w+3]=db.w,fa[w+4]=eb.x,fa[w+5]=eb.y,fa[w+6]=eb.z,fa[w+7]=eb.w,fa[w+8]=fb.x,fa[w+9]=fb.y,fa[w+10]=fb.z,fa[w+11]=fb.w,ob=Cb[x.a],pb=Cb[x.b],qb=Cb[x.c],da[w]=ob.x,da[w+1]=ob.y,da[w+2]=ob.z,da[w+3]=1,da[w+4]=pb.x,
-da[w+5]=pb.y,da[w+6]=pb.z,da[w+7]=1,da[w+8]=qb.x,da[w+9]=qb.y,da[w+10]=qb.z,da[w+11]=1,rb=Db[x.a],sb=Db[x.b],tb=Db[x.c],ea[w]=rb.x,ea[w+1]=rb.y,ea[w+2]=rb.z,ea[w+3]=1,ea[w+4]=sb.x,ea[w+5]=sb.y,ea[w+6]=sb.z,ea[w+7]=1,ea[w+8]=tb.x,ea[w+9]=tb.y,ea[w+10]=tb.z,ea[w+11]=1,w+=12;for(v=0,C=V.length;v<C;v++)x=ma[V[v]],ab=vb[x.a],bb=vb[x.b],cb=vb[x.c],Ub=vb[x.d],ga[w]=ab.x,ga[w+1]=ab.y,ga[w+2]=ab.z,ga[w+3]=ab.w,ga[w+4]=bb.x,ga[w+5]=bb.y,ga[w+6]=bb.z,ga[w+7]=bb.w,ga[w+8]=cb.x,ga[w+9]=cb.y,ga[w+10]=cb.z,ga[w+
-11]=cb.w,ga[w+12]=Ub.x,ga[w+13]=Ub.y,ga[w+14]=Ub.z,ga[w+15]=Ub.w,db=Eb[x.a],eb=Eb[x.b],fb=Eb[x.c],Vb=Eb[x.d],fa[w]=db.x,fa[w+1]=db.y,fa[w+2]=db.z,fa[w+3]=db.w,fa[w+4]=eb.x,fa[w+5]=eb.y,fa[w+6]=eb.z,fa[w+7]=eb.w,fa[w+8]=fb.x,fa[w+9]=fb.y,fa[w+10]=fb.z,fa[w+11]=fb.w,fa[w+12]=Vb.x,fa[w+13]=Vb.y,fa[w+14]=Vb.z,fa[w+15]=Vb.w,ob=Cb[x.a],pb=Cb[x.b],qb=Cb[x.c],ic=Cb[x.d],da[w]=ob.x,da[w+1]=ob.y,da[w+2]=ob.z,da[w+3]=1,da[w+4]=pb.x,da[w+5]=pb.y,da[w+6]=pb.z,da[w+7]=1,da[w+8]=qb.x,da[w+9]=qb.y,da[w+10]=qb.z,
-da[w+11]=1,da[w+12]=ic.x,da[w+13]=ic.y,da[w+14]=ic.z,da[w+15]=1,rb=Db[x.a],sb=Db[x.b],tb=Db[x.c],jc=Db[x.d],ea[w]=rb.x,ea[w+1]=rb.y,ea[w+2]=rb.z,ea[w+3]=1,ea[w+4]=sb.x,ea[w+5]=sb.y,ea[w+6]=sb.z,ea[w+7]=1,ea[w+8]=tb.x,ea[w+9]=tb.y,ea[w+10]=tb.z,ea[w+11]=1,ea[w+12]=jc.x,ea[w+13]=jc.y,ea[w+14]=jc.z,ea[w+15]=1,w+=16;0<w&&(g.bindBuffer(g.ARRAY_BUFFER,O.__webglSkinVertexABuffer),g.bufferData(g.ARRAY_BUFFER,da,Ga),g.bindBuffer(g.ARRAY_BUFFER,O.__webglSkinVertexBBuffer),g.bufferData(g.ARRAY_BUFFER,ea,Ga),
-g.bindBuffer(g.ARRAY_BUFFER,O.__webglSkinIndicesBuffer),g.bufferData(g.ARRAY_BUFFER,fa,Ga),g.bindBuffer(g.ARRAY_BUFFER,O.__webglSkinWeightsBuffer),g.bufferData(g.ARRAY_BUFFER,ga,Ga))}if(Tc&&xc){for(v=0,C=U.length;v<C;v++)x=ma[U[v]],Ra=x.vertexColors,hc=x.color,3===Ra.length&&xc===THREE.VertexColors?(Ya=Ra[0],Za=Ra[1],$a=Ra[2]):$a=Za=Ya=hc,sa[ka]=Ya.r,sa[ka+1]=Ya.g,sa[ka+2]=Ya.b,sa[ka+3]=Za.r,sa[ka+4]=Za.g,sa[ka+5]=Za.b,sa[ka+6]=$a.r,sa[ka+7]=$a.g,sa[ka+8]=$a.b,ka+=9;for(v=0,C=V.length;v<C;v++)x=ma[V[v]],
-Ra=x.vertexColors,hc=x.color,4===Ra.length&&xc===THREE.VertexColors?(Ya=Ra[0],Za=Ra[1],$a=Ra[2],Tb=Ra[3]):Tb=$a=Za=Ya=hc,sa[ka]=Ya.r,sa[ka+1]=Ya.g,sa[ka+2]=Ya.b,sa[ka+3]=Za.r,sa[ka+4]=Za.g,sa[ka+5]=Za.b,sa[ka+6]=$a.r,sa[ka+7]=$a.g,sa[ka+8]=$a.b,sa[ka+9]=Tb.r,sa[ka+10]=Tb.g,sa[ka+11]=Tb.b,ka+=12;0<ka&&(g.bindBuffer(g.ARRAY_BUFFER,O.__webglColorBuffer),g.bufferData(g.ARRAY_BUFFER,sa,Ga))}if(Sc&&za.hasTangents){for(v=0,C=U.length;v<C;v++)x=ma[U[v]],hb=x.vertexTangents,Va=hb[0],Wa=hb[1],Xa=hb[2],ca[X]=
-Va.x,ca[X+1]=Va.y,ca[X+2]=Va.z,ca[X+3]=Va.w,ca[X+4]=Wa.x,ca[X+5]=Wa.y,ca[X+6]=Wa.z,ca[X+7]=Wa.w,ca[X+8]=Xa.x,ca[X+9]=Xa.y,ca[X+10]=Xa.z,ca[X+11]=Xa.w,X+=12;for(v=0,C=V.length;v<C;v++)x=ma[V[v]],hb=x.vertexTangents,Va=hb[0],Wa=hb[1],Xa=hb[2],Sb=hb[3],ca[X]=Va.x,ca[X+1]=Va.y,ca[X+2]=Va.z,ca[X+3]=Va.w,ca[X+4]=Wa.x,ca[X+5]=Wa.y,ca[X+6]=Wa.z,ca[X+7]=Wa.w,ca[X+8]=Xa.x,ca[X+9]=Xa.y,ca[X+10]=Xa.z,ca[X+11]=Xa.w,ca[X+12]=Sb.x,ca[X+13]=Sb.y,ca[X+14]=Sb.z,ca[X+15]=Sb.w,X+=16;g.bindBuffer(g.ARRAY_BUFFER,O.__webglTangentBuffer);
-g.bufferData(g.ARRAY_BUFFER,ca,Ga)}if(Rc&&Ec){for(v=0,C=U.length;v<C;v++)if(x=ma[U[v]],Jb=x.vertexNormals,nb=x.normal,3===Jb.length&&Gc)for(T=0;3>T;T++)ub=Jb[T],La[wa]=ub.x,La[wa+1]=ub.y,La[wa+2]=ub.z,wa+=3;else for(T=0;3>T;T++)La[wa]=nb.x,La[wa+1]=nb.y,La[wa+2]=nb.z,wa+=3;for(v=0,C=V.length;v<C;v++)if(x=ma[V[v]],Jb=x.vertexNormals,nb=x.normal,4===Jb.length&&Gc)for(T=0;4>T;T++)ub=Jb[T],La[wa]=ub.x,La[wa+1]=ub.y,La[wa+2]=ub.z,wa+=3;else for(T=0;4>T;T++)La[wa]=nb.x,La[wa+1]=nb.y,La[wa+2]=nb.z,wa+=3;
-g.bindBuffer(g.ARRAY_BUFFER,O.__webglNormalBuffer);g.bufferData(g.ARRAY_BUFFER,La,Ga)}if(Jc&&Ac&&Fc){for(v=0,C=U.length;v<C;v++)if(Oa=U[v],x=ma[Oa],Kb=Ac[Oa],void 0!==Kb)for(T=0;3>T;T++)Mb=Kb[T],Wb[ib]=Mb.u,Wb[ib+1]=Mb.v,ib+=2;for(v=0,C=V.length;v<C;v++)if(Oa=V[v],x=ma[Oa],Kb=Ac[Oa],void 0!==Kb)for(T=0;4>T;T++)Mb=Kb[T],Wb[ib]=Mb.u,Wb[ib+1]=Mb.v,ib+=2;0<ib&&(g.bindBuffer(g.ARRAY_BUFFER,O.__webglUVBuffer),g.bufferData(g.ARRAY_BUFFER,Wb,Ga))}if(Jc&&Bc&&Fc){for(v=0,C=U.length;v<C;v++)if(Oa=U[v],x=ma[Oa],
-Lb=Bc[Oa],void 0!==Lb)for(T=0;3>T;T++)Nb=Lb[T],Xb[jb]=Nb.u,Xb[jb+1]=Nb.v,jb+=2;for(v=0,C=V.length;v<C;v++)if(Oa=V[v],x=ma[Oa],Lb=Bc[Oa],void 0!==Lb)for(T=0;4>T;T++)Nb=Lb[T],Xb[jb]=Nb.u,Xb[jb+1]=Nb.v,jb+=2;0<jb&&(g.bindBuffer(g.ARRAY_BUFFER,O.__webglUV2Buffer),g.bufferData(g.ARRAY_BUFFER,Xb,Ga))}if(Qc){for(v=0,C=U.length;v<C;v++)x=ma[U[v]],gb[Ka]=ja,gb[Ka+1]=ja+1,gb[Ka+2]=ja+2,Ka+=3,Ea[xa]=ja,Ea[xa+1]=ja+1,Ea[xa+2]=ja,Ea[xa+3]=ja+2,Ea[xa+4]=ja+1,Ea[xa+5]=ja+2,xa+=6,ja+=3;for(v=0,C=V.length;v<C;v++)x=
-ma[V[v]],gb[Ka]=ja,gb[Ka+1]=ja+1,gb[Ka+2]=ja+3,gb[Ka+3]=ja+1,gb[Ka+4]=ja+2,gb[Ka+5]=ja+3,Ka+=6,Ea[xa]=ja,Ea[xa+1]=ja+1,Ea[xa+2]=ja,Ea[xa+3]=ja+3,Ea[xa+4]=ja+1,Ea[xa+5]=ja+2,Ea[xa+6]=ja+2,Ea[xa+7]=ja+3,xa+=8,ja+=4;g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,O.__webglFaceBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,gb,Ga);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,O.__webglLineBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Ea,Ga)}if(zc)for(T=0,Hc=zc.length;T<Hc;T++)if(q=zc[T],q.__original.needsUpdate){s=0;if(1===q.size)if(void 0===
-q.boundTo||"vertices"===q.boundTo){for(v=0,C=U.length;v<C;v++)x=ma[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],s+=3;for(v=0,C=V.length;v<C;v++)x=ma[V[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=U.length;v<C;v++)Da=q.value[U[v]],q.array[s]=Da,q.array[s+1]=Da,q.array[s+2]=Da,s+=3;for(v=0,C=V.length;v<C;v++)Da=q.value[V[v]],q.array[s]=Da,q.array[s+1]=Da,q.array[s+
-2]=Da,q.array[s+3]=Da,s+=4}}else if(2===q.size)if(void 0===q.boundTo||"vertices"===q.boundTo){for(v=0,C=U.length;v<C;v++)x=ma[U[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=V.length;v<C;v++)x=ma[V[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],W=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]=W.x,q.array[s+
-7]=W.y,s+=8}else{if("faces"===q.boundTo){for(v=0,C=U.length;v<C;v++)G=F=E=Da=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,s+=6;for(v=0,C=V.length;v<C;v++)W=G=F=E=Da=q.value[V[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]=W.x,q.array[s+7]=W.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=U.length;v<C;v++)x=ma[U[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=V.length;v<C;v++)x=ma[V[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],W=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]=W[P[0]],q.array[s+10]=W[P[1]],q.array[s+11]=W[P[2]],s+=12}else if("faces"===q.boundTo){for(v=0,C=U.length;v<C;v++)G=F=E=Da=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]],s+=9;for(v=0,C=V.length;v<C;v++)W=G=F=E=Da=q.value[V[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]=W[P[0]],q.array[s+10]=W[P[1]],q.array[s+11]=W[P[2]],s+=12}}else if(4===q.size)if(void 0===q.boundTo||"vertices"===q.boundTo){for(v=0,C=U.length;v<C;v++)x=ma[U[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=V.length;v<C;v++)x=ma[V[v]],E=q.value[x.a],F=q.value[x.b],G=q.value[x.c],W=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]=W.x,q.array[s+13]=W.y,q.array[s+14]=W.z,q.array[s+15]=W.w,s+=16}else if("faces"===q.boundTo){for(v=0,C=U.length;v<C;v++)G=F=E=Da=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,s+=12;for(v=0,C=V.length;v<C;v++)W=G=F=E=Da=q.value[V[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]=W.x,q.array[s+13]=W.y,
-q.array[s+14]=W.z,q.array[s+15]=W.w,s+=16}g.bindBuffer(g.ARRAY_BUFFER,q.buffer);g.bufferData(g.ARRAY_BUFFER,q.array,Ga)}tc&&(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;Aa.attributes&&p(Aa)}else if(Qa instanceof THREE.Ribbon){if(R.__dirtyVertices||R.__dirtyColors){var xb=R,Kc=g.DYNAMIC_DRAW,Yb=void 0,Zb=void 0,kc=void 0,yb=void 0,lc=void 0,Lc=xb.vertices,Mc=xb.colors,Vc=Lc.length,Wc=Mc.length,mc=xb.__vertexArray,nc=xb.__colorArray,Xc=xb.__dirtyColors;if(xb.__dirtyVertices){for(Yb=0;Yb<Vc;Yb++)kc=Lc[Yb].position,yb=3*Yb,mc[yb]=kc.x,mc[yb+1]=kc.y,mc[yb+2]=kc.z;g.bindBuffer(g.ARRAY_BUFFER,xb.__webglVertexBuffer);
-g.bufferData(g.ARRAY_BUFFER,mc,Kc)}if(Xc){for(Zb=0;Zb<Wc;Zb++)lc=Mc[Zb],yb=3*Zb,nc[yb]=lc.r,nc[yb+1]=lc.g,nc[yb+2]=lc.b;g.bindBuffer(g.ARRAY_BUFFER,xb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,nc,Kc)}}R.__dirtyVertices=!1;R.__dirtyColors=!1}else if(Qa instanceof THREE.Line){Aa=c(Qa,Rb);Ib=Aa.attributes&&n(Aa);if(R.__dirtyVertices||R.__dirtyColors||Ib){var kb=R,Cc=g.DYNAMIC_DRAW,$b=void 0,ac=void 0,oc=void 0,ha=void 0,pc=void 0,Nc=kb.vertices,Oc=kb.colors,Yc=Nc.length,Zc=Oc.length,qc=kb.__vertexArray,
-rc=kb.__colorArray,$c=kb.__dirtyColors,Dc=kb.__webglCustomAttributesList,sc=void 0,Pc=void 0,ta=void 0,Ob=void 0,Ba=void 0,aa=void 0;if(kb.__dirtyVertices){for($b=0;$b<Yc;$b++)oc=Nc[$b].position,ha=3*$b,qc[ha]=oc.x,qc[ha+1]=oc.y,qc[ha+2]=oc.z;g.bindBuffer(g.ARRAY_BUFFER,kb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,qc,Cc)}if($c){for(ac=0;ac<Zc;ac++)pc=Oc[ac],ha=3*ac,rc[ha]=pc.r,rc[ha+1]=pc.g,rc[ha+2]=pc.b;g.bindBuffer(g.ARRAY_BUFFER,kb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,rc,Cc)}if(Dc)for(sc=
-0,Pc=Dc.length;sc<Pc;sc++)if(aa=Dc[sc],aa.needsUpdate&&(void 0===aa.boundTo||"vertices"===aa.boundTo)){ha=0;Ob=aa.value.length;if(1===aa.size)for(ta=0;ta<Ob;ta++)aa.array[ta]=aa.value[ta];else if(2===aa.size)for(ta=0;ta<Ob;ta++)Ba=aa.value[ta],aa.array[ha]=Ba.x,aa.array[ha+1]=Ba.y,ha+=2;else if(3===aa.size)if("c"===aa.type)for(ta=0;ta<Ob;ta++)Ba=aa.value[ta],aa.array[ha]=Ba.r,aa.array[ha+1]=Ba.g,aa.array[ha+2]=Ba.b,ha+=3;else for(ta=0;ta<Ob;ta++)Ba=aa.value[ta],aa.array[ha]=Ba.x,aa.array[ha+1]=Ba.y,
-aa.array[ha+2]=Ba.z,ha+=3;else if(4===aa.size)for(ta=0;ta<Ob;ta++)Ba=aa.value[ta],aa.array[ha]=Ba.x,aa.array[ha+1]=Ba.y,aa.array[ha+2]=Ba.z,aa.array[ha+3]=Ba.w,ha+=4;g.bindBuffer(g.ARRAY_BUFFER,aa.buffer);g.bufferData(g.ARRAY_BUFFER,aa.array,Cc)}}R.__dirtyVertices=!1;R.__dirtyColors=!1;Aa.attributes&&p(Aa)}else if(Qa instanceof THREE.ParticleSystem)Aa=c(Qa,Rb),Ib=Aa.attributes&&n(Aa),(R.__dirtyVertices||R.__dirtyColors||Qa.sortParticles||Ib)&&f(R,g.DYNAMIC_DRAW,Qa),R.__dirtyVertices=!1,R.__dirtyColors=
-!1,Aa.attributes&&p(Aa)}};this.initMaterial=function(a,b,c,d){var e,f,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;f=k=0;for(n=0,l=b.length;n<l;n++)e=b[n],e.onlyShadow||(e instanceof THREE.DirectionalLight&&f++,e instanceof THREE.PointLight&&k++,e instanceof THREE.SpotLight&&k++);k+f<=Y?n=f:(n=Math.ceil(Y*f/(k+f)),k=Y-n);e=n;f=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 p=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var o;a:{n=a.fragmentShader;
+H;t.geometryGroupsList=[];var N=void 0;for(N in t.geometryGroups)t.geometryGroups[N].id=ya++,t.geometryGroupsList.push(t.geometryGroups[N])}for(l in k.geometryGroups)if(r=k.geometryGroups[l],!r.__webglVertexBuffer){var I=r;I.__webglVertexBuffer=g.createBuffer();I.__webglNormalBuffer=g.createBuffer();I.__webglTangentBuffer=g.createBuffer();I.__webglColorBuffer=g.createBuffer();I.__webglUVBuffer=g.createBuffer();I.__webglUV2Buffer=g.createBuffer();I.__webglSkinVertexABuffer=g.createBuffer();I.__webglSkinVertexBBuffer=
+g.createBuffer();I.__webglSkinIndicesBuffer=g.createBuffer();I.__webglSkinWeightsBuffer=g.createBuffer();I.__webglFaceBuffer=g.createBuffer();I.__webglLineBuffer=g.createBuffer();if(I.numMorphTargets){var Q=void 0,$=void 0;I.__webglMorphTargetsBuffers=[];for(Q=0,$=I.numMorphTargets;Q<$;Q++)I.__webglMorphTargetsBuffers.push(g.createBuffer())}D.info.memory.geometries++;var L=r,Z=h,W=Z.geometry,ba=L.faces3,ca=L.faces4,S=3*ba.length+4*ca.length,ka=1*ba.length+2*ca.length,ua=3*ba.length+4*ca.length,pa=
+c(Z,L),Ba=e(pa),Ea=d(pa),Na=pa.vertexColors?pa.vertexColors:!1;L.__vertexArray=new Float32Array(3*S);if(Ea)L.__normalArray=new Float32Array(3*S);if(W.hasTangents)L.__tangentArray=new Float32Array(4*S);if(Na)L.__colorArray=new Float32Array(3*S);if(Ba){if(0<W.faceUvs.length||0<W.faceVertexUvs.length)L.__uvArray=new Float32Array(2*S);if(1<W.faceUvs.length||1<W.faceVertexUvs.length)L.__uv2Array=new Float32Array(2*S)}if(Z.geometry.skinWeights.length&&Z.geometry.skinIndices.length)L.__skinVertexAArray=
+new Float32Array(4*S),L.__skinVertexBArray=new Float32Array(4*S),L.__skinIndexArray=new Float32Array(4*S),L.__skinWeightArray=new Float32Array(4*S);L.__faceArray=new Uint16Array(3*ka);L.__lineArray=new Uint16Array(2*ua);if(L.numMorphTargets){L.__morphTargetsArrays=[];for(var Oa=0,Ua=L.numMorphTargets;Oa<Ua;Oa++)L.__morphTargetsArrays.push(new Float32Array(3*S))}L.__webglFaceCount=3*ka;L.__webglLineCount=2*ua;if(pa.attributes){if(void 0===L.__webglCustomAttributesList)L.__webglCustomAttributesList=
+[];var Sa=void 0;for(Sa in pa.attributes){var Pa=pa.attributes[Sa],Fa={},Ta;for(Ta in Pa)Fa[Ta]=Pa[Ta];if(!Fa.__webglInitialized||Fa.createUniqueBuffers){Fa.__webglInitialized=!0;var Ia=1;"v2"===Fa.type?Ia=2:"v3"===Fa.type?Ia=3:"v4"===Fa.type?Ia=4:"c"===Fa.type&&(Ia=3);Fa.size=Ia;Fa.array=new Float32Array(S*Ia);Fa.buffer=g.createBuffer();Fa.buffer.belongsToAttribute=Sa;Pa.needsUpdate=!0;Fa.__original=Pa}L.__webglCustomAttributesList.push(Fa)}}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 ib=k;ib.__webglVertexBuffer=g.createBuffer();ib.__webglColorBuffer=g.createBuffer();D.info.memory.geometries++;var Va=k,nb=Va.vertices.length;Va.__vertexArray=new Float32Array(3*nb);Va.__colorArray=new Float32Array(3*nb);Va.__webglVertexCount=nb;k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(h instanceof THREE.Line){if(k=
+h.geometry,!k.__webglVertexBuffer){var Fb=k;Fb.__webglVertexBuffer=g.createBuffer();Fb.__webglColorBuffer=g.createBuffer();D.info.memory.geometries++;var Rb=k,Pb=h,Ab=Rb.vertices.length;Rb.__vertexArray=new Float32Array(3*Ab);Rb.__colorArray=new Float32Array(3*Ab);Rb.__webglLineCount=Ab;b(Rb,Pb);k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(h instanceof THREE.ParticleSystem&&(k=h.geometry,!k.__webglVertexBuffer)){var Gb=k;Gb.__webglVertexBuffer=g.createBuffer();Gb.__webglColorBuffer=g.createBuffer();
+D.info.geometries++;var Hb=k,Qb=h,vc=Hb.vertices.length;Hb.__vertexArray=new Float32Array(3*vc);Hb.__colorArray=new Float32Array(3*vc);Hb.__sortArray=[];Hb.__webglParticleCount=vc;b(Hb,Qb);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 Ja=a.__objectsRemoved[0],gc=a;Ja instanceof THREE.Mesh||Ja instanceof THREE.ParticleSystem||Ja instanceof THREE.Ribbon||
+Ja instanceof THREE.Line?o(gc.__webglObjects,Ja):Ja instanceof THREE.Sprite?m(gc.__webglSprites,Ja):Ja instanceof THREE.LensFlare?m(gc.__webglFlares,Ja):(Ja instanceof THREE.MarchingCubes||Ja.immediateRenderCallback)&&o(gc.__webglObjectsImmediate,Ja);Ja.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var wc=0,cc=a.__webglObjects.length;wc<cc;wc++){var Qa=a.__webglObjects[wc].object,R=Qa.geometry,Sb=void 0,Ib=void 0,za=void 0;if(Qa 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 xc=0,dc=R.geometryGroupsList.length;xc<dc;xc++)if(Sb=R.geometryGroupsList[xc],za=c(Qa,Sb),Ib=za.attributes&&n(za),R.__dirtyVertices||R.__dirtyMorphTargets||R.__dirtyElements||R.__dirtyUvs||R.__dirtyNormals||R.__dirtyColors||R.__dirtyTangents||Ib){var O=Sb,ec=Qa,Ga=g.DYNAMIC_DRAW,fc=!R.dynamic,hc=za;if(O.__inittedArrays){var Fc=d(hc),yc=hc.vertexColors?hc.vertexColors:!1,Gc=e(hc),Hc=Fc===THREE.SmoothShading,
+v=void 0,C=void 0,Ma=void 0,x=void 0,Jb=void 0,ob=void 0,Ra=void 0,ic=void 0,jb=void 0,Kb=void 0,Lb=void 0,E=void 0,F=void 0,G=void 0,X=void 0,Wa=void 0,Xa=void 0,Ya=void 0,Tb=void 0,Za=void 0,$a=void 0,ab=void 0,Ub=void 0,bb=void 0,cb=void 0,db=void 0,Vb=void 0,eb=void 0,fb=void 0,gb=void 0,Wb=void 0,pb=void 0,qb=void 0,rb=void 0,jc=void 0,sb=void 0,tb=void 0,ub=void 0,kc=void 0,T=void 0,Ic=void 0,vb=void 0,Mb=void 0,Nb=void 0,Ha=void 0,Jc=void 0,qa=void 0,ja=0,oa=0,kb=0,lb=0,Ka=0,va=0,Y=0,wa=0,
+la=0,w=0,ma=0,s=0,Ca=void 0,ra=O.__vertexArray,Xb=O.__uvArray,Yb=O.__uv2Array,La=O.__normalArray,da=O.__tangentArray,sa=O.__colorArray,ea=O.__skinVertexAArray,fa=O.__skinVertexBArray,ga=O.__skinIndexArray,ha=O.__skinWeightArray,zc=O.__morphTargetsArrays,Ac=O.__webglCustomAttributesList,q=void 0,hb=O.__faceArray,Da=O.__lineArray,xa=ec.geometry,uc=xa.__dirtyElements,Kc=xa.__dirtyUvs,Rc=xa.__dirtyNormals,Sc=xa.__dirtyTangents,Tc=xa.__dirtyColors,Uc=xa.__dirtyMorphTargets,Bb=xa.vertices,U=O.faces3,V=
+O.faces4,na=xa.faces,Bc=xa.faceVertexUvs[0],Cc=xa.faceVertexUvs[1],Cb=xa.skinVerticesA,Db=xa.skinVerticesB,Eb=xa.skinIndices,wb=xa.skinWeights,xb=xa.morphTargets;if(xa.__dirtyVertices){for(v=0,C=U.length;v<C;v++)x=na[U[v]],E=Bb[x.a].position,F=Bb[x.b].position,G=Bb[x.c].position,ra[oa]=E.x,ra[oa+1]=E.y,ra[oa+2]=E.z,ra[oa+3]=F.x,ra[oa+4]=F.y,ra[oa+5]=F.z,ra[oa+6]=G.x,ra[oa+7]=G.y,ra[oa+8]=G.z,oa+=9;for(v=0,C=V.length;v<C;v++)x=na[V[v]],E=Bb[x.a].position,F=Bb[x.b].position,G=Bb[x.c].position,X=Bb[x.d].position,
+ra[oa]=E.x,ra[oa+1]=E.y,ra[oa+2]=E.z,ra[oa+3]=F.x,ra[oa+4]=F.y,ra[oa+5]=F.z,ra[oa+6]=G.x,ra[oa+7]=G.y,ra[oa+8]=G.z,ra[oa+9]=X.x,ra[oa+10]=X.y,ra[oa+11]=X.z,oa+=12;g.bindBuffer(g.ARRAY_BUFFER,O.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,ra,Ga)}if(Uc)for(Ha=0,Jc=xb.length;Ha<Jc;Ha++){ma=0;for(v=0,C=U.length;v<C;v++)x=na[U[v]],E=xb[Ha].vertices[x.a].position,F=xb[Ha].vertices[x.b].position,G=xb[Ha].vertices[x.c].position,qa=zc[Ha],qa[ma]=E.x,qa[ma+1]=E.y,qa[ma+2]=E.z,qa[ma+3]=F.x,qa[ma+4]=F.y,
+qa[ma+5]=F.z,qa[ma+6]=G.x,qa[ma+7]=G.y,qa[ma+8]=G.z,ma+=9;for(v=0,C=V.length;v<C;v++)x=na[V[v]],E=xb[Ha].vertices[x.a].position,F=xb[Ha].vertices[x.b].position,G=xb[Ha].vertices[x.c].position,X=xb[Ha].vertices[x.d].position,qa=zc[Ha],qa[ma]=E.x,qa[ma+1]=E.y,qa[ma+2]=E.z,qa[ma+3]=F.x,qa[ma+4]=F.y,qa[ma+5]=F.z,qa[ma+6]=G.x,qa[ma+7]=G.y,qa[ma+8]=G.z,qa[ma+9]=X.x,qa[ma+10]=X.y,qa[ma+11]=X.z,ma+=12;g.bindBuffer(g.ARRAY_BUFFER,O.__webglMorphTargetsBuffers[Ha]);g.bufferData(g.ARRAY_BUFFER,zc[Ha],Ga)}if(wb.length){for(v=
+0,C=U.length;v<C;v++)x=na[U[v]],bb=wb[x.a],cb=wb[x.b],db=wb[x.c],ha[w]=bb.x,ha[w+1]=bb.y,ha[w+2]=bb.z,ha[w+3]=bb.w,ha[w+4]=cb.x,ha[w+5]=cb.y,ha[w+6]=cb.z,ha[w+7]=cb.w,ha[w+8]=db.x,ha[w+9]=db.y,ha[w+10]=db.z,ha[w+11]=db.w,eb=Eb[x.a],fb=Eb[x.b],gb=Eb[x.c],ga[w]=eb.x,ga[w+1]=eb.y,ga[w+2]=eb.z,ga[w+3]=eb.w,ga[w+4]=fb.x,ga[w+5]=fb.y,ga[w+6]=fb.z,ga[w+7]=fb.w,ga[w+8]=gb.x,ga[w+9]=gb.y,ga[w+10]=gb.z,ga[w+11]=gb.w,pb=Cb[x.a],qb=Cb[x.b],rb=Cb[x.c],ea[w]=pb.x,ea[w+1]=pb.y,ea[w+2]=pb.z,ea[w+3]=1,ea[w+4]=qb.x,
+ea[w+5]=qb.y,ea[w+6]=qb.z,ea[w+7]=1,ea[w+8]=rb.x,ea[w+9]=rb.y,ea[w+10]=rb.z,ea[w+11]=1,sb=Db[x.a],tb=Db[x.b],ub=Db[x.c],fa[w]=sb.x,fa[w+1]=sb.y,fa[w+2]=sb.z,fa[w+3]=1,fa[w+4]=tb.x,fa[w+5]=tb.y,fa[w+6]=tb.z,fa[w+7]=1,fa[w+8]=ub.x,fa[w+9]=ub.y,fa[w+10]=ub.z,fa[w+11]=1,w+=12;for(v=0,C=V.length;v<C;v++)x=na[V[v]],bb=wb[x.a],cb=wb[x.b],db=wb[x.c],Vb=wb[x.d],ha[w]=bb.x,ha[w+1]=bb.y,ha[w+2]=bb.z,ha[w+3]=bb.w,ha[w+4]=cb.x,ha[w+5]=cb.y,ha[w+6]=cb.z,ha[w+7]=cb.w,ha[w+8]=db.x,ha[w+9]=db.y,ha[w+10]=db.z,ha[w+
+11]=db.w,ha[w+12]=Vb.x,ha[w+13]=Vb.y,ha[w+14]=Vb.z,ha[w+15]=Vb.w,eb=Eb[x.a],fb=Eb[x.b],gb=Eb[x.c],Wb=Eb[x.d],ga[w]=eb.x,ga[w+1]=eb.y,ga[w+2]=eb.z,ga[w+3]=eb.w,ga[w+4]=fb.x,ga[w+5]=fb.y,ga[w+6]=fb.z,ga[w+7]=fb.w,ga[w+8]=gb.x,ga[w+9]=gb.y,ga[w+10]=gb.z,ga[w+11]=gb.w,ga[w+12]=Wb.x,ga[w+13]=Wb.y,ga[w+14]=Wb.z,ga[w+15]=Wb.w,pb=Cb[x.a],qb=Cb[x.b],rb=Cb[x.c],jc=Cb[x.d],ea[w]=pb.x,ea[w+1]=pb.y,ea[w+2]=pb.z,ea[w+3]=1,ea[w+4]=qb.x,ea[w+5]=qb.y,ea[w+6]=qb.z,ea[w+7]=1,ea[w+8]=rb.x,ea[w+9]=rb.y,ea[w+10]=rb.z,
+ea[w+11]=1,ea[w+12]=jc.x,ea[w+13]=jc.y,ea[w+14]=jc.z,ea[w+15]=1,sb=Db[x.a],tb=Db[x.b],ub=Db[x.c],kc=Db[x.d],fa[w]=sb.x,fa[w+1]=sb.y,fa[w+2]=sb.z,fa[w+3]=1,fa[w+4]=tb.x,fa[w+5]=tb.y,fa[w+6]=tb.z,fa[w+7]=1,fa[w+8]=ub.x,fa[w+9]=ub.y,fa[w+10]=ub.z,fa[w+11]=1,fa[w+12]=kc.x,fa[w+13]=kc.y,fa[w+14]=kc.z,fa[w+15]=1,w+=16;0<w&&(g.bindBuffer(g.ARRAY_BUFFER,O.__webglSkinVertexABuffer),g.bufferData(g.ARRAY_BUFFER,ea,Ga),g.bindBuffer(g.ARRAY_BUFFER,O.__webglSkinVertexBBuffer),g.bufferData(g.ARRAY_BUFFER,fa,Ga),
+g.bindBuffer(g.ARRAY_BUFFER,O.__webglSkinIndicesBuffer),g.bufferData(g.ARRAY_BUFFER,ga,Ga),g.bindBuffer(g.ARRAY_BUFFER,O.__webglSkinWeightsBuffer),g.bufferData(g.ARRAY_BUFFER,ha,Ga))}if(Tc&&yc){for(v=0,C=U.length;v<C;v++)x=na[U[v]],Ra=x.vertexColors,ic=x.color,3===Ra.length&&yc===THREE.VertexColors?(Za=Ra[0],$a=Ra[1],ab=Ra[2]):ab=$a=Za=ic,sa[la]=Za.r,sa[la+1]=Za.g,sa[la+2]=Za.b,sa[la+3]=$a.r,sa[la+4]=$a.g,sa[la+5]=$a.b,sa[la+6]=ab.r,sa[la+7]=ab.g,sa[la+8]=ab.b,la+=9;for(v=0,C=V.length;v<C;v++)x=na[V[v]],
+Ra=x.vertexColors,ic=x.color,4===Ra.length&&yc===THREE.VertexColors?(Za=Ra[0],$a=Ra[1],ab=Ra[2],Ub=Ra[3]):Ub=ab=$a=Za=ic,sa[la]=Za.r,sa[la+1]=Za.g,sa[la+2]=Za.b,sa[la+3]=$a.r,sa[la+4]=$a.g,sa[la+5]=$a.b,sa[la+6]=ab.r,sa[la+7]=ab.g,sa[la+8]=ab.b,sa[la+9]=Ub.r,sa[la+10]=Ub.g,sa[la+11]=Ub.b,la+=12;0<la&&(g.bindBuffer(g.ARRAY_BUFFER,O.__webglColorBuffer),g.bufferData(g.ARRAY_BUFFER,sa,Ga))}if(Sc&&xa.hasTangents){for(v=0,C=U.length;v<C;v++)x=na[U[v]],jb=x.vertexTangents,Wa=jb[0],Xa=jb[1],Ya=jb[2],da[Y]=
+Wa.x,da[Y+1]=Wa.y,da[Y+2]=Wa.z,da[Y+3]=Wa.w,da[Y+4]=Xa.x,da[Y+5]=Xa.y,da[Y+6]=Xa.z,da[Y+7]=Xa.w,da[Y+8]=Ya.x,da[Y+9]=Ya.y,da[Y+10]=Ya.z,da[Y+11]=Ya.w,Y+=12;for(v=0,C=V.length;v<C;v++)x=na[V[v]],jb=x.vertexTangents,Wa=jb[0],Xa=jb[1],Ya=jb[2],Tb=jb[3],da[Y]=Wa.x,da[Y+1]=Wa.y,da[Y+2]=Wa.z,da[Y+3]=Wa.w,da[Y+4]=Xa.x,da[Y+5]=Xa.y,da[Y+6]=Xa.z,da[Y+7]=Xa.w,da[Y+8]=Ya.x,da[Y+9]=Ya.y,da[Y+10]=Ya.z,da[Y+11]=Ya.w,da[Y+12]=Tb.x,da[Y+13]=Tb.y,da[Y+14]=Tb.z,da[Y+15]=Tb.w,Y+=16;g.bindBuffer(g.ARRAY_BUFFER,O.__webglTangentBuffer);
+g.bufferData(g.ARRAY_BUFFER,da,Ga)}if(Rc&&Fc){for(v=0,C=U.length;v<C;v++)if(x=na[U[v]],Jb=x.vertexNormals,ob=x.normal,3===Jb.length&&Hc)for(T=0;3>T;T++)vb=Jb[T],La[va]=vb.x,La[va+1]=vb.y,La[va+2]=vb.z,va+=3;else for(T=0;3>T;T++)La[va]=ob.x,La[va+1]=ob.y,La[va+2]=ob.z,va+=3;for(v=0,C=V.length;v<C;v++)if(x=na[V[v]],Jb=x.vertexNormals,ob=x.normal,4===Jb.length&&Hc)for(T=0;4>T;T++)vb=Jb[T],La[va]=vb.x,La[va+1]=vb.y,La[va+2]=vb.z,va+=3;else for(T=0;4>T;T++)La[va]=ob.x,La[va+1]=ob.y,La[va+2]=ob.z,va+=3;
+g.bindBuffer(g.ARRAY_BUFFER,O.__webglNormalBuffer);g.bufferData(g.ARRAY_BUFFER,La,Ga)}if(Kc&&Bc&&Gc){for(v=0,C=U.length;v<C;v++)if(Ma=U[v],x=na[Ma],Kb=Bc[Ma],void 0!==Kb)for(T=0;3>T;T++)Mb=Kb[T],Xb[kb]=Mb.u,Xb[kb+1]=Mb.v,kb+=2;for(v=0,C=V.length;v<C;v++)if(Ma=V[v],x=na[Ma],Kb=Bc[Ma],void 0!==Kb)for(T=0;4>T;T++)Mb=Kb[T],Xb[kb]=Mb.u,Xb[kb+1]=Mb.v,kb+=2;0<kb&&(g.bindBuffer(g.ARRAY_BUFFER,O.__webglUVBuffer),g.bufferData(g.ARRAY_BUFFER,Xb,Ga))}if(Kc&&Cc&&Gc){for(v=0,C=U.length;v<C;v++)if(Ma=U[v],x=na[Ma],
+Lb=Cc[Ma],void 0!==Lb)for(T=0;3>T;T++)Nb=Lb[T],Yb[lb]=Nb.u,Yb[lb+1]=Nb.v,lb+=2;for(v=0,C=V.length;v<C;v++)if(Ma=V[v],x=na[Ma],Lb=Cc[Ma],void 0!==Lb)for(T=0;4>T;T++)Nb=Lb[T],Yb[lb]=Nb.u,Yb[lb+1]=Nb.v,lb+=2;0<lb&&(g.bindBuffer(g.ARRAY_BUFFER,O.__webglUV2Buffer),g.bufferData(g.ARRAY_BUFFER,Yb,Ga))}if(uc){for(v=0,C=U.length;v<C;v++)x=na[U[v]],hb[Ka]=ja,hb[Ka+1]=ja+1,hb[Ka+2]=ja+2,Ka+=3,Da[wa]=ja,Da[wa+1]=ja+1,Da[wa+2]=ja,Da[wa+3]=ja+2,Da[wa+4]=ja+1,Da[wa+5]=ja+2,wa+=6,ja+=3;for(v=0,C=V.length;v<C;v++)x=
+na[V[v]],hb[Ka]=ja,hb[Ka+1]=ja+1,hb[Ka+2]=ja+3,hb[Ka+3]=ja+1,hb[Ka+4]=ja+2,hb[Ka+5]=ja+3,Ka+=6,Da[wa]=ja,Da[wa+1]=ja+1,Da[wa+2]=ja,Da[wa+3]=ja+3,Da[wa+4]=ja+1,Da[wa+5]=ja+2,Da[wa+6]=ja+2,Da[wa+7]=ja+3,wa+=8,ja+=4;g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,O.__webglFaceBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,hb,Ga);g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,O.__webglLineBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,Da,Ga)}if(Ac)for(T=0,Ic=Ac.length;T<Ic;T++)if(q=Ac[T],q.__original.needsUpdate){s=0;if(1===q.size)if(void 0===
+q.boundTo||"vertices"===q.boundTo){for(v=0,C=U.length;v<C;v++)x=na[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],s+=3;for(v=0,C=V.length;v<C;v++)x=na[V[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=U.length;v<C;v++)Ca=q.value[U[v]],q.array[s]=Ca,q.array[s+1]=Ca,q.array[s+2]=Ca,s+=3;for(v=0,C=V.length;v<C;v++)Ca=q.value[V[v]],q.array[s]=Ca,q.array[s+1]=Ca,q.array[s+
+2]=Ca,q.array[s+3]=Ca,s+=4}}else if(2===q.size)if(void 0===q.boundTo||"vertices"===q.boundTo){for(v=0,C=U.length;v<C;v++)x=na[U[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=V.length;v<C;v++)x=na[V[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=U.length;v<C;v++)G=F=E=Ca=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,s+=6;for(v=0,C=V.length;v<C;v++)X=G=F=E=Ca=q.value[V[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=U.length;v<C;v++)x=na[U[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=V.length;v<C;v++)x=na[V[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=U.length;v<C;v++)G=F=E=Ca=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]],s+=9;for(v=0,C=V.length;v<C;v++)X=G=F=E=Ca=q.value[V[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=U.length;v<C;v++)x=na[U[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=V.length;v<C;v++)x=na[V[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=U.length;v<C;v++)G=F=E=Ca=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,s+=12;for(v=0,C=V.length;v<C;v++)X=G=F=E=Ca=q.value[V[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}g.bindBuffer(g.ARRAY_BUFFER,q.buffer);g.bufferData(g.ARRAY_BUFFER,q.array,Ga)}fc&&(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&&p(za)}else if(Qa instanceof THREE.Ribbon){if(R.__dirtyVertices||R.__dirtyColors){var yb=R,Lc=g.DYNAMIC_DRAW,Zb=void 0,$b=void 0,lc=void 0,zb=void 0,mc=void 0,Mc=yb.vertices,Nc=yb.colors,Vc=Mc.length,Wc=Nc.length,nc=yb.__vertexArray,oc=yb.__colorArray,Xc=yb.__dirtyColors;if(yb.__dirtyVertices){for(Zb=0;Zb<Vc;Zb++)lc=Mc[Zb].position,zb=3*Zb,nc[zb]=lc.x,nc[zb+1]=lc.y,nc[zb+2]=lc.z;g.bindBuffer(g.ARRAY_BUFFER,yb.__webglVertexBuffer);
+g.bufferData(g.ARRAY_BUFFER,nc,Lc)}if(Xc){for($b=0;$b<Wc;$b++)mc=Nc[$b],zb=3*$b,oc[zb]=mc.r,oc[zb+1]=mc.g,oc[zb+2]=mc.b;g.bindBuffer(g.ARRAY_BUFFER,yb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,oc,Lc)}}R.__dirtyVertices=!1;R.__dirtyColors=!1}else if(Qa instanceof THREE.Line){za=c(Qa,Sb);Ib=za.attributes&&n(za);if(R.__dirtyVertices||R.__dirtyColors||Ib){var mb=R,Dc=g.DYNAMIC_DRAW,ac=void 0,bc=void 0,pc=void 0,ia=void 0,qc=void 0,Oc=mb.vertices,Pc=mb.colors,Yc=Oc.length,Zc=Pc.length,rc=mb.__vertexArray,
+sc=mb.__colorArray,$c=mb.__dirtyColors,Ec=mb.__webglCustomAttributesList,tc=void 0,Qc=void 0,ta=void 0,Ob=void 0,Aa=void 0,aa=void 0;if(mb.__dirtyVertices){for(ac=0;ac<Yc;ac++)pc=Oc[ac].position,ia=3*ac,rc[ia]=pc.x,rc[ia+1]=pc.y,rc[ia+2]=pc.z;g.bindBuffer(g.ARRAY_BUFFER,mb.__webglVertexBuffer);g.bufferData(g.ARRAY_BUFFER,rc,Dc)}if($c){for(bc=0;bc<Zc;bc++)qc=Pc[bc],ia=3*bc,sc[ia]=qc.r,sc[ia+1]=qc.g,sc[ia+2]=qc.b;g.bindBuffer(g.ARRAY_BUFFER,mb.__webglColorBuffer);g.bufferData(g.ARRAY_BUFFER,sc,Dc)}if(Ec)for(tc=
+0,Qc=Ec.length;tc<Qc;tc++)if(aa=Ec[tc],aa.needsUpdate&&(void 0===aa.boundTo||"vertices"===aa.boundTo)){ia=0;Ob=aa.value.length;if(1===aa.size)for(ta=0;ta<Ob;ta++)aa.array[ta]=aa.value[ta];else if(2===aa.size)for(ta=0;ta<Ob;ta++)Aa=aa.value[ta],aa.array[ia]=Aa.x,aa.array[ia+1]=Aa.y,ia+=2;else if(3===aa.size)if("c"===aa.type)for(ta=0;ta<Ob;ta++)Aa=aa.value[ta],aa.array[ia]=Aa.r,aa.array[ia+1]=Aa.g,aa.array[ia+2]=Aa.b,ia+=3;else for(ta=0;ta<Ob;ta++)Aa=aa.value[ta],aa.array[ia]=Aa.x,aa.array[ia+1]=Aa.y,
+aa.array[ia+2]=Aa.z,ia+=3;else if(4===aa.size)for(ta=0;ta<Ob;ta++)Aa=aa.value[ta],aa.array[ia]=Aa.x,aa.array[ia+1]=Aa.y,aa.array[ia+2]=Aa.z,aa.array[ia+3]=Aa.w,ia+=4;g.bindBuffer(g.ARRAY_BUFFER,aa.buffer);g.bufferData(g.ARRAY_BUFFER,aa.array,Dc)}}R.__dirtyVertices=!1;R.__dirtyColors=!1;za.attributes&&p(za)}else if(Qa instanceof THREE.ParticleSystem)za=c(Qa,Sb),Ib=za.attributes&&n(za),(R.__dirtyVertices||R.__dirtyColors||Qa.sortParticles||Ib)&&f(R,g.DYNAMIC_DRAW,Qa),R.__dirtyVertices=!1,R.__dirtyColors=
+!1,za.attributes&&p(za)}};this.initMaterial=function(a,b,c,d){var e,f,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;f=k=0;for(n=0,l=b.length;n<l;n++)e=b[n],e.onlyShadow||(e instanceof THREE.DirectionalLight&&f++,e instanceof THREE.PointLight&&k++,e instanceof THREE.SpotLight&&k++);k+f<=Z?n=f:(n=Math.ceil(Z*f/(k+f)),k=Z-n);e=n;f=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 p=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var o;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:f,maxBones:p,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=lb.length;r<d;r++)if(lb[r].code===j){o=lb[r].program;break a}r=g.createProgram();d=[0<ec?"#define VERTEX_TEXTURES":"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.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,
+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=Sa.length;r<d;r++)if(Sa[r].code===j){o=Sa[r].program;break a}r=g.createProgram();d=[0<fc?"#define VERTEX_TEXTURES":"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.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 "+A+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.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");g.attachShader(r,y("fragment",e+n));g.attachShader(r,y("vertex",d+l));g.linkProgram(r);g.getProgramParameter(r,g.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+
 g.getProgramParameter(r,g.VALIDATE_STATUS)+", gl error ["+g.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]=g.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(o in b)d.push(o);o=d;for(t=0,b=o.length;t<b;t++)c=o[t],r.attributes[c]=g.getAttribLocation(r,c);r.id=lb.length;lb.push({program:r,code:j});D.info.memory.programs=lb.length;o=r}a.program=o;o=a.program.attributes;0<=o.position&&g.enableVertexAttribArray(o.position);0<=o.color&&g.enableVertexAttribArray(o.color);0<=o.normal&&g.enableVertexAttribArray(o.normal);0<=o.tangent&&g.enableVertexAttribArray(o.tangent);a.skinning&&0<=o.skinVertexA&&0<=o.skinVertexB&&0<=o.skinIndex&&0<=o.skinWeight&&(g.enableVertexAttribArray(o.skinVertexA),
+t);for(o in b)d.push(o);o=d;for(t=0,b=o.length;t<b;t++)c=o[t],r.attributes[c]=g.getAttribLocation(r,c);r.id=Sa.length;Sa.push({program:r,code:j});D.info.memory.programs=Sa.length;o=r}a.program=o;o=a.program.attributes;0<=o.position&&g.enableVertexAttribArray(o.position);0<=o.color&&g.enableVertexAttribArray(o.color);0<=o.normal&&g.enableVertexAttribArray(o.normal);0<=o.tangent&&g.enableVertexAttribArray(o.tangent);a.skinning&&0<=o.skinVertexA&&0<=o.skinVertexB&&0<=o.skinIndex&&0<=o.skinWeight&&(g.enableVertexAttribArray(o.skinVertexA),
 g.enableVertexAttribArray(o.skinVertexB),g.enableVertexAttribArray(o.skinIndex),g.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(i in a.attributes)void 0!==o[i]&&0<=o[i]&&g.enableVertexAttribArray(o[i]);if(a.morphTargets)for(i=a.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)t="morphTarget"+i,0<=o[t]&&(g.enableVertexAttribArray(o[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?g.frontFace(g.CCW):g.frontFace(g.CW),"back"===a?g.cullFace(g.BACK):"front"===a?g.cullFace(g.FRONT):g.cullFace(g.FRONT_AND_BACK),g.enable(g.CULL_FACE)):g.disable(g.CULL_FACE)};this.setObjectFaces=function(a){if(va!==a.doubleSided)a.doubleSided?g.disable(g.CULL_FACE):g.enable(g.CULL_FACE),va=a.doubleSided;if(ba!==a.flipSided)a.flipSided?g.frontFace(g.CW):g.frontFace(g.CCW),ba=a.flipSided};this.setDepthTest=function(a){Ca!==a&&(a?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST),Ca=a)};this.setDepthWrite=
-function(a){Ma!==a&&(g.depthMask(a),Ma=a)};this.setBlending=function(a){if(a!==ya){switch(a){case THREE.AdditiveBlending:g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE);break;case THREE.SubtractiveBlending:g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,g.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,g.SRC_COLOR);break;default:g.blendEquationSeparate(g.FUNC_ADD,g.FUNC_ADD),g.blendFuncSeparate(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA,g.ONE,
-g.ONE_MINUS_SRC_ALPHA)}ya=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=g.createTexture(),D.info.memory.textures++;g.activeTexture(g.TEXTURE0+b);g.bindTexture(g.TEXTURE_2D,a.__webglTexture);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=B(a.format),f=B(a.type);J(g.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?g.texImage2D(g.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):g.texImage2D(g.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&
+"ccw"===b?g.frontFace(g.CCW):g.frontFace(g.CW),"back"===a?g.cullFace(g.BACK):"front"===a?g.cullFace(g.FRONT):g.cullFace(g.FRONT_AND_BACK),g.enable(g.CULL_FACE)):g.disable(g.CULL_FACE)};this.setObjectFaces=function(a){if(ca!==a.doubleSided)a.doubleSided?g.disable(g.CULL_FACE):g.enable(g.CULL_FACE),ca=a.doubleSided;if(Ea!==a.flipSided)a.flipSided?g.frontFace(g.CW):g.frontFace(g.CCW),Ea=a.flipSided};this.setDepthTest=function(a){Na!==a&&(a?g.enable(g.DEPTH_TEST):g.disable(g.DEPTH_TEST),Na=a)};this.setDepthWrite=
+function(a){Oa!==a&&(g.depthMask(a),Oa=a)};this.setBlending=function(a){if(a!==Ba){switch(a){case THREE.AdditiveBlending:g.blendEquation(g.FUNC_ADD);g.blendFunc(g.SRC_ALPHA,g.ONE);break;case THREE.SubtractiveBlending:g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,g.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:g.blendEquation(g.FUNC_ADD);g.blendFunc(g.ZERO,g.SRC_COLOR);break;default:g.blendEquationSeparate(g.FUNC_ADD,g.FUNC_ADD),g.blendFuncSeparate(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA,g.ONE,
+g.ONE_MINUS_SRC_ALPHA)}Ba=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=g.createTexture(),D.info.memory.textures++;g.activeTexture(g.TEXTURE0+b);g.bindTexture(g.TEXTURE_2D,a.__webglTexture);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=B(a.format),f=B(a.type);J(g.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?g.texImage2D(g.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data):g.texImage2D(g.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&
 d&&g.generateMipmap(g.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else g.activeTexture(g.TEXTURE0+b),g.bindTexture(g.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(void 0===a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=!0;a.__webglTexture=g.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=B(a.format),e=B(a.type);if(b){a.__webglFramebuffer=
 [];a.__webglRenderbuffer=[];g.bindTexture(g.TEXTURE_CUBE_MAP,a.__webglTexture);J(g.TEXTURE_CUBE_MAP,a,c);for(c=0;6>c;c++){a.__webglFramebuffer[c]=g.createFramebuffer();a.__webglRenderbuffer[c]=g.createRenderbuffer();g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,d,a.width,a.height,0,d,e,null);var f=a,h=g.TEXTURE_CUBE_MAP_POSITIVE_X+c;g.bindFramebuffer(g.FRAMEBUFFER,a.__webglFramebuffer[c]);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,h,f.__webglTexture,0);K(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=
 g.createFramebuffer(),a.__webglRenderbuffer=g.createRenderbuffer(),g.bindTexture(g.TEXTURE_2D,a.__webglTexture),J(g.TEXTURE_2D,a,c),g.texImage2D(g.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=g.TEXTURE_2D,g.bindFramebuffer(g.FRAMEBUFFER,a.__webglFramebuffer),g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,d,a.__webglTexture,0),K(a.__webglRenderbuffer,a);b?g.bindTexture(g.TEXTURE_CUBE_MAP,null):g.bindTexture(g.TEXTURE_2D,null);g.bindRenderbuffer(g.RENDERBUFFER,null);g.bindFramebuffer(g.FRAMEBUFFER,
-null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,d=a.width,a=a.height,c=e=0):(b=null,d=Pb,a=Ab,e=zb,c=Fb);b!==oa&&(g.bindFramebuffer(g.FRAMEBUFFER,b),g.viewport(e,c,d,a),oa=b);bc=d;cc=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,d=a.width,a=a.height,c=e=0):(b=null,d=Ab,a=Gb,e=Fb,c=Pb);b!==pa&&(g.bindFramebuffer(g.FRAMEBUFFER,b),g.viewport(e,c,d,a),pa=b);cc=d;dc=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:
 THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
@@ -359,10 +359,10 @@ THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.creat
 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)?(l=!1,j=a(THREE.ShaderFlares.lensFlare)):(l=!0,j=a(THREE.ShaderFlares.lensFlareVertexTexture));n={};p={};n.vertex=b.getAttribLocation(j,"position");n.uv=b.getAttribLocation(j,"uv");p.renderType=b.getUniformLocation(j,"renderType");p.map=b.getUniformLocation(j,"map");p.occlusionMap=b.getUniformLocation(j,"occlusionMap");p.opacity=b.getUniformLocation(j,"opacity");p.color=b.getUniformLocation(j,
 "color");p.scale=b.getUniformLocation(j,"scale");p.rotation=b.getUniformLocation(j,"rotation");p.screenPosition=b.getUniformLocation(j,"screenPosition");o=!1};this.render=function(a,d,e,z){var a=a.__webglFlares,y=a.length;if(y){var J=new THREE.Vector3,K=z/e,u=0.5*e,B=0.5*z,H=16/z,A=new THREE.Vector2(H*K,H),M=new THREE.Vector3(1,1,0),N=new THREE.Vector2(1,1),I=p,H=n;b.useProgram(j);o||(b.enableVertexAttribArray(n.vertex),b.enableVertexAttribArray(n.uv),o=!0);b.uniform1i(I.occlusionMap,0);b.uniform1i(I.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,f);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 ia,ua,S,$,Y;for(ia=0;ia<y;ia++)if(H=16/z,A.set(H*K,H),$=a[ia],J.set($.matrixWorld.n14,$.matrixWorld.n24,$.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(J),d.projectionMatrix.multiplyVector3(J),M.copy(J),N.x=M.x*u+u,N.y=M.y*B+B,l||0<N.x&&N.x<e&&0<N.y&&N.y<z){b.activeTexture(b.TEXTURE1);
+1);b.bindBuffer(b.ARRAY_BUFFER,f);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 S,ua,ka,$,Z;for(S=0;S<y;S++)if(H=16/z,A.set(H*K,H),$=a[S],J.set($.matrixWorld.n14,$.matrixWorld.n24,$.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(J),d.projectionMatrix.multiplyVector3(J),M.copy(J),N.x=M.x*u+u,N.y=M.y*B+B,l||0<N.x&&N.x<e&&0<N.y&&N.y<z){b.activeTexture(b.TEXTURE1);
 b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,N.x-8,N.y-8,16,16,0);b.uniform1i(I.renderType,0);b.uniform2f(I.scale,A.x,A.y);b.uniform3f(I.screenPosition,M.x,M.y,M.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,N.x-8,N.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);$.positionScreen.copy(M);$.customUpdateCallback?$.customUpdateCallback($):$.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);for(ua=0,S=$.lensFlares.length;ua<S;ua++)if(Y=$.lensFlares[ua],0.0010<Y.opacity&&0.0010<Y.scale)M.x=Y.x,M.y=Y.y,M.z=Y.z,H=Y.size*Y.scale/z,A.x=H*K,A.y=H,b.uniform3f(I.screenPosition,M.x,M.y,M.z),b.uniform2f(I.scale,A.x,A.y),b.uniform1f(I.rotation,Y.rotation),b.uniform1f(I.opacity,Y.opacity),b.uniform3f(I.color,
-Y.color.r,Y.color.g,Y.color.b),c.setBlending(Y.blending),c.setTexture(Y.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
+i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);$.positionScreen.copy(M);$.customUpdateCallback?$.customUpdateCallback($):$.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);for(ua=0,ka=$.lensFlares.length;ua<ka;ua++)if(Z=$.lensFlares[ua],0.0010<Z.opacity&&0.0010<Z.scale)M.x=Z.x,M.y=Z.y,M.z=Z.z,H=Z.size*Z.scale/z,A.x=H*K,A.y=H,b.uniform3f(I.screenPosition,M.x,M.y,M.z),b.uniform2f(I.scale,A.x,A.y),b.uniform1f(I.rotation,Z.rotation),b.uniform1f(I.opacity,Z.opacity),b.uniform3f(I.color,
+Z.color.r,Z.color.g,Z.color.b),c.setBlending(Z.blending),c.setTexture(Z.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(h){var i,k,l,j,n,p,o,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,k=t.length;i<k;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&&

+ 12 - 3
src/renderers/WebGLRenderer.js

@@ -108,6 +108,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	_currentFramebuffer = null,
 	_currentMaterialId = -1,
 	_currentGeometryGroupHash = null,
+	_currentCamera = null,
 	_geometryGroupCounter = 0,
 
 	// GL state cache
@@ -3291,6 +3292,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		for ( var i = 0, il = plugins.length; i < il; i ++ ) {
 
 			_currentProgram = null;
+			_currentCamera = null;
 			_oldBlending = -1;
 			_oldDepthTest = -1;
 			_oldDepthWrite = -1;
@@ -3300,6 +3302,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			plugins[ i ].render( scene, camera, _currentWidth, _currentHeight );
 
 			_currentProgram = null;
+			_currentCamera = null;
 			_oldBlending = -1;
 			_oldDepthTest = -1;
 			_oldDepthWrite = -1;
@@ -4169,10 +4172,16 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		if ( refreshMaterial ) {
+		if ( refreshMaterial || camera !== _currentCamera ) {
 
 			_gl.uniformMatrix4fv( p_uniforms.projectionMatrix, false, camera._projectionMatrixArray );
 
+			if ( camera !== _currentCamera ) _currentCamera = camera;
+
+		}
+
+		if ( refreshMaterial ) {
+
 			// refresh uniforms common to several materials
 
 			if ( fog && material.fog ) {
@@ -4245,7 +4254,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 				 material instanceof THREE.MeshPhongMaterial ||
 				 material.envMap ) {
 
-				if( p_uniforms.cameraPosition !== null ) {
+				if ( p_uniforms.cameraPosition !== null ) {
 
 					_gl.uniform3f( p_uniforms.cameraPosition, camera.position.x, camera.position.y, camera.position.z );
 
@@ -4258,7 +4267,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 				 material instanceof THREE.ShaderMaterial ||
 				 material.skinning ) {
 
-				if( p_uniforms.viewMatrix !== null ) {
+				if ( p_uniforms.viewMatrix !== null ) {
 
 					_gl.uniformMatrix4fv( p_uniforms.viewMatrix, false, camera._viewMatrixArray );