Kaynağa Gözat

Refactored SceneLoader to use plugins for async geometry loaders.

Still unsolved: how to pass custom parameters to such loaders.

See discussion: https://github.com/alteredq/three.js/commit/5c43e9467c9d7ce9682d684f6a753a85449e58b2
alteredq 13 yıl önce
ebeveyn
işleme
d059385036
3 değiştirilmiş dosya ile 371 ekleme ve 359 silme
  1. 343 342
      build/three.min.js
  2. 2 0
      examples/webgl_loader_scene.html
  3. 26 17
      src/loaders/SceneLoader.js

+ 343 - 342
build/three.min.js

@@ -18,9 +18,9 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
 a;this.z=this.z+a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y=
 this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},
 setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,
-a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,f=d[0],e=d[4],g=d[8],h=d[1],i=d[5],l=d[9],j=d[2],n=d[6],d=d[10];if(b===void 0||b==="XYZ"){this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-l,d);this.z=Math.atan2(-e,f)}else{this.x=Math.atan2(h,i);this.z=0}}else if(b==="YXZ"){this.x=Math.asin(-c(l));if(Math.abs(l)<
-0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(h,i)}else{this.y=Math.atan2(-j,f);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(n));if(Math.abs(n)<0.99999){this.y=Math.atan2(-j,d);this.z=Math.atan2(-e,i)}else{this.y=0;this.z=Math.atan2(g,f)}}else if(b==="ZYX"){this.y=Math.asin(-c(j));if(Math.abs(j)<0.99999){this.x=Math.atan2(n,d);this.z=Math.atan2(h,f)}else{this.x=0;this.z=Math.atan2(-e,i)}}else if(b==="YZX"){this.z=Math.asin(c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(-l,i);this.y=Math.atan2(-j,
-f)}else{this.x=0;this.y=Math.atan2(j,d)}}else if(b==="XZY"){this.z=Math.asin(-c(e));if(Math.abs(e)<0.99999){this.x=Math.atan2(n,i);this.y=Math.atan2(g,f)}else{this.x=Math.atan2(-g,d);this.y=0}}return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,f=a.y*a.y,e=a.z*a.z,g=a.w*a.w;if(b===void 0||b==="XYZ"){this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-f+e);this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w)));this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-f-e)}else if(b===
+a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,f=d[0],e=d[4],g=d[8],h=d[1],i=d[5],l=d[9],j=d[2],o=d[6],d=d[10];if(b===void 0||b==="XYZ"){this.y=Math.asin(c(g));if(Math.abs(g)<0.99999){this.x=Math.atan2(-l,d);this.z=Math.atan2(-e,f)}else{this.x=Math.atan2(h,i);this.z=0}}else if(b==="YXZ"){this.x=Math.asin(-c(l));if(Math.abs(l)<
+0.99999){this.y=Math.atan2(g,d);this.z=Math.atan2(h,i)}else{this.y=Math.atan2(-j,f);this.z=0}}else if(b==="ZXY"){this.x=Math.asin(c(o));if(Math.abs(o)<0.99999){this.y=Math.atan2(-j,d);this.z=Math.atan2(-e,i)}else{this.y=0;this.z=Math.atan2(g,f)}}else if(b==="ZYX"){this.y=Math.asin(-c(j));if(Math.abs(j)<0.99999){this.x=Math.atan2(o,d);this.z=Math.atan2(h,f)}else{this.x=0;this.z=Math.atan2(-e,i)}}else if(b==="YZX"){this.z=Math.asin(c(h));if(Math.abs(h)<0.99999){this.x=Math.atan2(-l,i);this.y=Math.atan2(-j,
+f)}else{this.x=0;this.y=Math.atan2(j,d)}}else if(b==="XZY"){this.z=Math.asin(-c(e));if(Math.abs(e)<0.99999){this.x=Math.atan2(o,i);this.y=Math.atan2(g,f)}else{this.x=Math.atan2(-g,d);this.y=0}}return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,f=a.y*a.y,e=a.z*a.z,g=a.w*a.w;if(b===void 0||b==="XYZ"){this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-f+e);this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w)));this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-f-e)}else if(b===
 "YXZ"){this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z)));this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-d-f+e);this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+f-e)}else if(b==="ZXY"){this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z)));this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-f+e);this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+f-e)}else if(b==="ZYX"){this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-f+e);this.y=Math.asin(c(2*(a.y*a.w-a.x*a.z)));this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-f-e)}else if(b==="YZX"){this.x=Math.atan2(2*(a.x*a.w-a.z*
 a.y),g-d+f-e);this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-f-e);this.z=Math.asin(c(2*(a.x*a.y+a.z*a.w)))}else if(b==="XZY"){this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+f-e);this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-f-e);this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y)))}return this},getScaleFromMatrix:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=
 b;this.y=c;this.z=a;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return this.lengthSq()<1E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
@@ -30,41 +30,41 @@ lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(thi
 Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1E-4){this.x=1;this.z=this.y=0}else{this.x=a.x/b;this.y=a.y/b;this.z=a.z/b}return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,f=a[0];d=a[4];var e=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var l=a[10];if(Math.abs(d-g)<0.01&&Math.abs(e-c)<0.01&&Math.abs(i-b)<0.01){if(Math.abs(d+g)<0.1&&Math.abs(e+c)<0.1&&Math.abs(i+b)<0.1&&Math.abs(f+h+l-3)<0.1){this.set(1,0,0,0);return this}a=Math.PI;f=(f+1)/2;h=(h+1)/2;l=(l+1)/2;d=(d+g)/4;e=
 (e+c)/4;i=(i+b)/4;if(f>h&&f>l)if(f<0.01){b=0;d=c=0.707106781}else{b=Math.sqrt(f);c=d/b;d=e/b}else if(h>l)if(h<0.01){b=0.707106781;c=0;d=0.707106781}else{c=Math.sqrt(h);b=d/c;d=i/c}else if(l<0.01){c=b=0.707106781;d=0}else{d=Math.sqrt(l);b=e/d;c=i/d}this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(e-c)*(e-c)+(g-d)*(g-d));Math.abs(a)<0.001&&(a=1);this.x=(b-i)/a;this.y=(e-c)/a;this.z=(g-d)/a;this.w=Math.acos((f+h+l-1)/2);return this}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],f=-b[10]*b[4]+b[6]*b[8],e=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],h=b[9]*b[4]-b[5]*b[8],i=-b[9]*b[0]+b[1]*b[8],l=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*f+b[2]*h;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,j=this.elements;j[0]=b*a;j[1]=b*c;j[2]=b*d;j[3]=b*f;j[4]=b*e;j[5]=b*g;j[6]=b*h;j[7]=b*i;j[8]=b*l;return this},
-transpose:function(){var a,b=this.elements;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,f,e,g,h,i,l,j,n,m,q,o,p){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,i||0,l||0,j!==void 0?j:1,n||0,m||0,q||0,o||0,p!==void 0?p:1)};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,i,l,j,n,m,q,o,p){var s=this.elements;s[0]=a;s[4]=b;s[8]=c;s[12]=d;s[1]=f;s[5]=e;s[9]=g;s[13]=h;s[2]=i;s[6]=l;s[10]=j;s[14]=n;s[3]=m;s[7]=q;s[11]=o;s[15]=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
-f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;f.cross(c,g).normalize();if(f.length()===0){g.x=g.x+1E-4;f.cross(c,g).normalize()}e.cross(g,f);d[0]=f.x;d[4]=e.x;d[8]=g.x;d[1]=f.y;d[5]=e.y;d[9]=g.y;d[2]=f.z;d[6]=e.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,f=this.elements,e=c[0],g=c[4],h=c[8],i=c[12],l=c[1],j=c[5],n=c[9],m=c[13],q=c[2],o=c[6],p=c[10],s=c[14],r=c[3],u=c[7],v=c[11],c=c[15],t=d[0],A=d[4],
-y=d[8],B=d[12],G=d[1],x=d[5],I=d[9],F=d[13],L=d[2],E=d[6],P=d[10],H=d[14],D=d[3],S=d[7],R=d[11],d=d[15];f[0]=e*t+g*G+h*L+i*D;f[4]=e*A+g*x+h*E+i*S;f[8]=e*y+g*I+h*P+i*R;f[12]=e*B+g*F+h*H+i*d;f[1]=l*t+j*G+n*L+m*D;f[5]=l*A+j*x+n*E+m*S;f[9]=l*y+j*I+n*P+m*R;f[13]=l*B+j*F+n*H+m*d;f[2]=q*t+o*G+p*L+s*D;f[6]=q*A+o*x+p*E+s*S;f[10]=q*y+o*I+p*P+s*R;f[14]=q*B+o*F+p*H+s*d;f[3]=r*t+u*G+v*L+c*D;f[7]=r*A+u*x+v*E+c*S;f[11]=r*y+u*I+v*P+c*R;f[15]=r*B+u*F+v*H+c*d;return this},multiplySelf:function(a){return this.multiply(this,
+transpose:function(){var a,b=this.elements;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,f,e,g,h,i,l,j,o,m,p,q,n){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,i||0,l||0,j!==void 0?j:1,o||0,m||0,p||0,q||0,n!==void 0?n:1)};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,i,l,j,o,m,p,q,n){var t=this.elements;t[0]=a;t[4]=b;t[8]=c;t[12]=d;t[1]=f;t[5]=e;t[9]=g;t[13]=h;t[2]=i;t[6]=l;t[10]=j;t[14]=o;t[3]=m;t[7]=p;t[11]=q;t[15]=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
+f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;f.cross(c,g).normalize();if(f.length()===0){g.x=g.x+1E-4;f.cross(c,g).normalize()}e.cross(g,f);d[0]=f.x;d[4]=e.x;d[8]=g.x;d[1]=f.y;d[5]=e.y;d[9]=g.y;d[2]=f.z;d[6]=e.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,f=this.elements,e=c[0],g=c[4],h=c[8],i=c[12],l=c[1],j=c[5],o=c[9],m=c[13],p=c[2],q=c[6],n=c[10],t=c[14],s=c[3],u=c[7],v=c[11],c=c[15],r=d[0],A=d[4],
+x=d[8],B=d[12],C=d[1],z=d[5],F=d[9],G=d[13],M=d[2],E=d[6],N=d[10],I=d[14],K=d[3],Q=d[7],H=d[11],d=d[15];f[0]=e*r+g*C+h*M+i*K;f[4]=e*A+g*z+h*E+i*Q;f[8]=e*x+g*F+h*N+i*H;f[12]=e*B+g*G+h*I+i*d;f[1]=l*r+j*C+o*M+m*K;f[5]=l*A+j*z+o*E+m*Q;f[9]=l*x+j*F+o*N+m*H;f[13]=l*B+j*G+o*I+m*d;f[2]=p*r+q*C+n*M+t*K;f[6]=p*A+q*z+n*E+t*Q;f[10]=p*x+q*F+n*N+t*H;f[14]=p*B+q*G+n*I+t*d;f[3]=s*r+u*C+v*M+c*K;f[7]=s*A+u*z+v*E+c*Q;f[11]=s*x+u*F+v*N+c*H;f[15]=s*B+u*G+v*I+c*d;return this},multiplySelf:function(a){return this.multiply(this,
 a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
 b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=1/(b[3]*c+b[7]*d+b[11]*f+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*f+b[12])*e;a.y=(b[1]*c+b[5]*d+b[9]*f+b[13])*e;a.z=(b[2]*c+b[6]*d+b[10]*f+b[14])*e;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=a.w;a.x=b[0]*c+b[4]*d+b[8]*f+b[12]*e;a.y=b[1]*c+b[5]*d+b[9]*f+b[13]*e;a.z=b[2]*c+b[6]*d+b[10]*f+b[14]*e;a.w=b[3]*c+b[7]*d+b[11]*f+b[15]*e;return a},multiplyVector3Array:function(a){for(var b=THREE.Matrix4.__v1,
 c=0,d=a.length;c<d;c=c+3){b.x=a[c];b.y=a[c+1];b.z=a[c+2];this.multiplyVector3(b);a[c]=b.x;a[c+1]=b.y;a[c+2]=b.z}return a},rotateAxis:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z;a.x=c*b[0]+d*b[4]+f*b[8];a.y=c*b[1]+d*b[5]+f*b[9];a.z=c*b[2]+d*b[6]+f*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*
-a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],f=a[12],e=a[1],g=a[5],h=a[9],i=a[13],l=a[2],j=a[6],n=a[10],m=a[14],q=a[3],o=a[7],p=a[11],a=a[15];return f*h*j*q-d*i*j*q-f*g*n*q+c*i*n*q+d*g*m*q-c*h*m*q-f*h*l*o+d*i*l*o+f*e*n*o-b*i*n*o-d*e*m*o+b*h*m*o+f*g*l*p-c*i*l*p-f*e*j*p+b*i*j*p+c*e*m*p-b*g*m*p-d*g*l*a+c*h*l*a+d*e*j*a-b*h*j*a-c*e*n*a+b*g*n*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;
+a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],f=a[12],e=a[1],g=a[5],h=a[9],i=a[13],l=a[2],j=a[6],o=a[10],m=a[14],p=a[3],q=a[7],n=a[11],a=a[15];return f*h*j*p-d*i*j*p-f*g*o*p+c*i*o*p+d*g*m*p-c*h*m*p-f*h*l*q+d*i*l*q+f*e*o*q-b*i*o*q-d*e*m*q+b*h*m*q+f*g*l*n-c*i*l*n-f*e*j*n+b*i*j*n+c*e*m*n-b*g*m*n-d*g*l*a+c*h*l*a+d*e*j*a-b*h*j*a-c*e*o*a+b*g*o*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;
 b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=
 c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],
-a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],f=c[4],e=c[8],g=c[12],h=c[1],i=c[5],l=c[9],j=c[13],n=c[2],m=c[6],q=c[10],o=c[14],p=c[3],s=c[7],r=c[11],c=c[15];b[0]=l*o*s-j*q*s+j*m*r-i*o*r-l*m*c+i*q*c;b[4]=g*q*s-e*o*s-g*m*r+f*o*r+e*m*c-f*q*c;b[8]=e*j*s-g*l*s+g*i*r-f*j*r-e*i*c+f*l*c;b[12]=g*l*m-e*j*m-g*i*q+f*j*q+e*i*o-f*l*o;b[1]=j*q*p-l*o*p-j*n*r+h*o*r+l*n*c-h*q*c;b[5]=e*o*p-g*q*p+g*n*r-d*o*r-e*n*c+d*q*c;b[9]=g*l*p-e*j*p-g*h*r+d*j*r+e*h*c-d*l*c;b[13]=e*j*n-g*l*n+g*h*q-d*
-j*q-e*h*o+d*l*o;b[2]=i*o*p-j*m*p+j*n*s-h*o*s-i*n*c+h*m*c;b[6]=g*m*p-f*o*p-g*n*s+d*o*s+f*n*c-d*m*c;b[10]=f*j*p-g*i*p+g*h*s-d*j*s-f*h*c+d*i*c;b[14]=g*i*n-f*j*n-g*h*m+d*j*m+f*h*o-d*i*o;b[3]=l*m*p-i*q*p-l*n*s+h*q*s+i*n*r-h*m*r;b[7]=f*q*p-e*m*p+e*n*s-d*q*s-f*n*r+d*m*r;b[11]=e*i*p-f*l*p-e*h*s+d*l*s+f*h*r-d*i*r;b[15]=f*l*n-e*i*n+e*h*m-d*l*m-f*h*q+d*i*q;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,f=a.y,e=a.z,g=Math.cos(d),d=Math.sin(d),
-h=Math.cos(f),f=Math.sin(f),i=Math.cos(e),e=Math.sin(e);if(b===void 0||b==="XYZ"){var l=g*i,j=g*e,n=d*i,m=d*e;c[0]=h*i;c[4]=-h*e;c[8]=f;c[1]=j+n*f;c[5]=l-m*f;c[9]=-d*h;c[2]=m-l*f;c[6]=n+j*f;c[10]=g*h}else if(b==="YXZ"){l=h*i;j=h*e;n=f*i;m=f*e;c[0]=l+m*d;c[4]=n*d-j;c[8]=g*f;c[1]=g*e;c[5]=g*i;c[9]=-d;c[2]=j*d-n;c[6]=m+l*d;c[10]=g*h}else if(b==="ZXY"){l=h*i;j=h*e;n=f*i;m=f*e;c[0]=l-m*d;c[4]=-g*e;c[8]=n+j*d;c[1]=j+n*d;c[5]=g*i;c[9]=m-l*d;c[2]=-g*f;c[6]=d;c[10]=g*h}else if(b==="ZYX"){l=g*i;j=g*e;n=d*i;
-m=d*e;c[0]=h*i;c[4]=n*f-j;c[8]=l*f+m;c[1]=h*e;c[5]=m*f+l;c[9]=j*f-n;c[2]=-f;c[6]=d*h;c[10]=g*h}else if(b==="YZX"){l=g*h;j=g*f;n=d*h;m=d*f;c[0]=h*i;c[4]=m-l*e;c[8]=n*e+j;c[1]=e;c[5]=g*i;c[9]=-d*i;c[2]=-f*i;c[6]=j*e+n;c[10]=l-m*e}else if(b==="XZY"){l=g*h;j=g*f;n=d*h;m=d*f;c[0]=h*i;c[4]=-e;c[8]=f*i;c[1]=l*e+m;c[5]=g*i;c[9]=j*e-n;c[2]=n*e-j;c[6]=d*i;c[10]=m*e+l}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=a.w,g=c+c,h=d+d,i=f+f,a=c*g,l=c*h,c=c*i,j=d*h,d=d*
+a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],f=c[4],e=c[8],g=c[12],h=c[1],i=c[5],l=c[9],j=c[13],o=c[2],m=c[6],p=c[10],q=c[14],n=c[3],t=c[7],s=c[11],c=c[15];b[0]=l*q*t-j*p*t+j*m*s-i*q*s-l*m*c+i*p*c;b[4]=g*p*t-e*q*t-g*m*s+f*q*s+e*m*c-f*p*c;b[8]=e*j*t-g*l*t+g*i*s-f*j*s-e*i*c+f*l*c;b[12]=g*l*m-e*j*m-g*i*p+f*j*p+e*i*q-f*l*q;b[1]=j*p*n-l*q*n-j*o*s+h*q*s+l*o*c-h*p*c;b[5]=e*q*n-g*p*n+g*o*s-d*q*s-e*o*c+d*p*c;b[9]=g*l*n-e*j*n-g*h*s+d*j*s+e*h*c-d*l*c;b[13]=e*j*o-g*l*o+g*h*p-d*
+j*p-e*h*q+d*l*q;b[2]=i*q*n-j*m*n+j*o*t-h*q*t-i*o*c+h*m*c;b[6]=g*m*n-f*q*n-g*o*t+d*q*t+f*o*c-d*m*c;b[10]=f*j*n-g*i*n+g*h*t-d*j*t-f*h*c+d*i*c;b[14]=g*i*o-f*j*o-g*h*m+d*j*m+f*h*q-d*i*q;b[3]=l*m*n-i*p*n-l*o*t+h*p*t+i*o*s-h*m*s;b[7]=f*p*n-e*m*n+e*o*t-d*p*t-f*o*s+d*m*s;b[11]=e*i*n-f*l*n-e*h*t+d*l*t+f*h*s-d*i*s;b[15]=f*l*o-e*i*o+e*h*m-d*l*m-f*h*p+d*i*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,f=a.y,e=a.z,g=Math.cos(d),d=Math.sin(d),
+h=Math.cos(f),f=Math.sin(f),i=Math.cos(e),e=Math.sin(e);if(b===void 0||b==="XYZ"){var l=g*i,j=g*e,o=d*i,m=d*e;c[0]=h*i;c[4]=-h*e;c[8]=f;c[1]=j+o*f;c[5]=l-m*f;c[9]=-d*h;c[2]=m-l*f;c[6]=o+j*f;c[10]=g*h}else if(b==="YXZ"){l=h*i;j=h*e;o=f*i;m=f*e;c[0]=l+m*d;c[4]=o*d-j;c[8]=g*f;c[1]=g*e;c[5]=g*i;c[9]=-d;c[2]=j*d-o;c[6]=m+l*d;c[10]=g*h}else if(b==="ZXY"){l=h*i;j=h*e;o=f*i;m=f*e;c[0]=l-m*d;c[4]=-g*e;c[8]=o+j*d;c[1]=j+o*d;c[5]=g*i;c[9]=m-l*d;c[2]=-g*f;c[6]=d;c[10]=g*h}else if(b==="ZYX"){l=g*i;j=g*e;o=d*i;
+m=d*e;c[0]=h*i;c[4]=o*f-j;c[8]=l*f+m;c[1]=h*e;c[5]=m*f+l;c[9]=j*f-o;c[2]=-f;c[6]=d*h;c[10]=g*h}else if(b==="YZX"){l=g*h;j=g*f;o=d*h;m=d*f;c[0]=h*i;c[4]=m-l*e;c[8]=o*e+j;c[1]=e;c[5]=g*i;c[9]=-d*i;c[2]=-f*i;c[6]=j*e+o;c[10]=l-m*e}else if(b==="XZY"){l=g*h;j=g*f;o=d*h;m=d*f;c[0]=h*i;c[4]=-e;c[8]=f*i;c[1]=l*e+m;c[5]=g*i;c[9]=j*e-o;c[2]=o*e-j;c[6]=d*i;c[10]=m*e+l}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=a.w,g=c+c,h=d+d,i=f+f,a=c*g,l=c*h,c=c*i,j=d*h,d=d*
 i,f=f*i,g=e*g,h=e*h,e=e*i;b[0]=1-(j+f);b[4]=l-e;b[8]=c+h;b[1]=l+e;b[5]=1-(a+f);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+j);return this},compose:function(a,b,c){var d=this.elements,f=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;f.identity();f.setRotationFromQuaternion(b);e.makeScale(c.x,c.y,c.z);this.multiply(f,e);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;f.set(d[0],d[1],d[2]);e.set(d[4],d[5],d[6]);
 g.set(d[8],d[9],d[10]);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=f.length();c.y=e.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]=d.elements[0]/c.x;d.elements[1]=d.elements[1]/c.x;d.elements[2]=d.elements[2]/c.x;d.elements[4]=d.elements[4]/c.y;d.elements[5]=d.elements[5]/c.y;d.elements[6]=d.elements[6]/c.y;d.elements[8]=d.elements[8]/
 c.z;d.elements[9]=d.elements[9]/c.z;d.elements[10]=d.elements[10]/c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),f=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*f;b[5]=a[5]*f;b[6]=a[6]*f;b[8]=a[8]*c;b[9]=a[9]*
 c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],f=b[6],e=b[7],g=b[8],h=b[9],i=b[10],l=b[11],j=Math.cos(a),a=Math.sin(a);b[4]=j*c+a*g;b[5]=j*d+a*h;b[6]=j*f+a*i;b[7]=j*e+a*l;b[8]=j*g-a*c;b[9]=j*h-a*d;b[10]=j*i-a*f;b[11]=j*l-a*e;return this},rotateY:function(a){var b=
 this.elements,c=b[0],d=b[1],f=b[2],e=b[3],g=b[8],h=b[9],i=b[10],l=b[11],j=Math.cos(a),a=Math.sin(a);b[0]=j*c-a*g;b[1]=j*d-a*h;b[2]=j*f-a*i;b[3]=j*e-a*l;b[8]=j*g+a*c;b[9]=j*h+a*d;b[10]=j*i+a*f;b[11]=j*l+a*e;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],f=b[2],e=b[3],g=b[4],h=b[5],i=b[6],l=b[7],j=Math.cos(a),a=Math.sin(a);b[0]=j*c+a*g;b[1]=j*d+a*h;b[2]=j*f+a*i;b[3]=j*e+a*l;b[4]=j*g-a*c;b[5]=j*h-a*d;b[6]=j*i-a*f;b[7]=j*l-a*e;return this},rotateByAxis:function(a,b){var c=this.elements;
-if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,f=a.y,e=a.z,g=Math.sqrt(d*d+f*f+e*e),d=d/g,f=f/g,e=e/g,g=d*d,h=f*f,i=e*e,l=Math.cos(b),j=Math.sin(b),n=1-l,m=d*f*n,q=d*e*n,n=f*e*n,d=d*j,o=f*j,j=e*j,e=g+(1-g)*l,g=m+j,f=q-o,m=m-j,h=h+(1-h)*l,j=n+d,q=q+o,n=n-d,i=i+(1-i)*l,l=c[0],d=c[1],o=c[2],p=c[3],s=c[4],r=c[5],u=c[6],v=c[7],t=c[8],A=c[9],y=c[10],B=c[11];c[0]=e*l+g*s+f*t;c[1]=e*d+g*
-r+f*A;c[2]=e*o+g*u+f*y;c[3]=e*p+g*v+f*B;c[4]=m*l+h*s+j*t;c[5]=m*d+h*r+j*A;c[6]=m*o+h*u+j*y;c[7]=m*p+h*v+j*B;c[8]=q*l+n*s+i*t;c[9]=q*d+n*r+i*A;c[10]=q*o+n*u+i*y;c[11]=q*p+n*v+i*B;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+
+if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,f=a.y,e=a.z,g=Math.sqrt(d*d+f*f+e*e),d=d/g,f=f/g,e=e/g,g=d*d,h=f*f,i=e*e,l=Math.cos(b),j=Math.sin(b),o=1-l,m=d*f*o,p=d*e*o,o=f*e*o,d=d*j,q=f*j,j=e*j,e=g+(1-g)*l,g=m+j,f=p-q,m=m-j,h=h+(1-h)*l,j=o+d,p=p+q,o=o-d,i=i+(1-i)*l,l=c[0],d=c[1],q=c[2],n=c[3],t=c[4],s=c[5],u=c[6],v=c[7],r=c[8],A=c[9],x=c[10],B=c[11];c[0]=e*l+g*t+f*r;c[1]=e*d+g*
+s+f*A;c[2]=e*q+g*u+f*x;c[3]=e*n+g*v+f*B;c[4]=m*l+h*t+j*r;c[5]=m*d+h*s+j*A;c[6]=m*q+h*u+j*x;c[7]=m*n+h*v+j*B;c[8]=p*l+o*t+i*r;c[9]=p*d+o*s+i*A;c[10]=p*q+o*u+i*x;c[11]=p*n+o*v+i*B;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+
 a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX: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},makeRotationY: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},makeRotationZ: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},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,e=a.x,g=a.y,h=a.z,i=f*e,l=f*g;this.set(i*e+c,i*g-d*h,i*h+d*g,0,i*g+d*h,l*g+c,l*h-d*e,0,i*h-d*g,l*h+d*e,f*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,f,e){var g=this.elements;g[0]=2*f/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*f/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(e+f)/(e-f);g[14]=-2*e*f/(e-f);g[3]=
 0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),f=-a;return this.makeFrustum(f*b,a*b,f,a,c,d)},makeOrthographic:function(a,b,c,d,f,e){var g=this.elements,h=b-a,i=c-d,l=e-f;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/l;g[14]=-((e+f)/l);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],
 a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};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.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]===void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);d!==-1&&a[b].splice(d,1)}};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=this.planes,c=a.elements,a=c[0],d=c[1],f=c[2],e=c[3],g=c[4],h=c[5],i=c[6],l=c[7],j=c[8],n=c[9],m=c[10],q=c[11],o=c[12],p=c[13],s=c[14],c=c[15];b[0].set(e-a,l-g,q-j,c-o);b[1].set(e+a,l+g,q+j,c+o);b[2].set(e+d,l+h,q+n,c+p);b[3].set(e-d,l-h,q-n,c-p);b[4].set(e-f,l-i,q-m,c-s);b[5].set(e+f,l+i,q+m,c+s);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
+THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],f=c[2],e=c[3],g=c[4],h=c[5],i=c[6],l=c[7],j=c[8],o=c[9],m=c[10],p=c[11],q=c[12],n=c[13],t=c[14],c=c[15];b[0].set(e-a,l-g,p-j,c-q);b[1].set(e+a,l+g,p+j,c+q);b[2].set(e+d,l+h,p+o,c+n);b[3].set(e-d,l-h,p-o,c-n);b[4].set(e-f,l-i,p-m,c-t);b[5].set(e+f,l+i,p+m,c+t);for(d=0;d<6;d++){a=b[d];a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))}};
 THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),f=0;f<6;f++){b=c[f].x*d[12]+c[f].y*d[13]+c[f].z*d[14]+c[f].w;if(b<=a)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
-(function(a){a.Ray=function(b,c,d,f){this.origin=b||new a.Vector3;this.direction=c||new a.Vector3;this.near=d||0;this.far=f||Infinity};var b=new a.Vector3,c=new a.Vector3,d=new a.Vector3,f=new a.Vector3,e=new a.Vector3,g=new a.Vector3,h=new a.Matrix4,i=function(a,b){return a.distance-b.distance},l=new a.Vector3,j=new a.Vector3,n=new a.Vector3,m=function(a,b,c){l.sub(c,a);var d=l.dot(b),a=j.add(a,n.copy(b).multiplyScalar(d));return c.distanceTo(a)},q=function(a,b,c,d){l.sub(d,b);j.sub(c,b);n.sub(a,
-b);var a=l.dot(l),b=l.dot(j),c=l.dot(n),f=j.dot(j),d=j.dot(n),e=1/(a*f-b*b),f=(f*c-b*d)*e,a=(a*d-b*c)*e;return f>=0&&a>=0&&f+a<1},o=function(i,j,l){var n,o;if(i instanceof a.Particle){n=m(j.origin,j.direction,i.matrixWorld.getPosition());if(n>i.scale.x)return l;o={distance:n,point:i.position,face:null,object:i};l.push(o)}else if(i instanceof a.Mesh){var p=i.geometry.boundingSphere.radius*i.matrixWorld.getMaxScaleOnAxis();n=m(j.origin,j.direction,i.matrixWorld.getPosition());if(n>p)return l;var y,
-B,G=i.geometry,x=G.vertices,I,F,L;I=i.geometry.materials;F=i.material instanceof a.MeshFaceMaterial;var E,P=j.precision;i.matrixRotationWorld.extractRotation(i.matrixWorld);b.copy(j.origin);h.getInverse(i.matrixWorld);c.copy(b);h.multiplyVector3(c);d.copy(j.direction);h.rotateAxis(d).normalize();p=0;for(y=G.faces.length;p<y;p++){o=G.faces[p];n=F===true?I[o.materialIndex]:i.material;if(n!==void 0){L=n.side;f.sub(o.centroid,c);e=o.normal;n=d.dot(e);if(!(Math.abs(n)<P)){B=e.dot(f)/n;if(!(B<0)&&(L===
-a.DoubleSide||(L===a.FrontSide?n<0:n>0))){g.add(c,d.multiplyScalar(B));if(o instanceof a.Face3){n=x[o.a];B=x[o.b];L=x[o.c];if(q(g,n,B,L)){B=i.matrixWorld.multiplyVector3(g.clone());n=b.distanceTo(B);if(!(n<j.near||n>j.far)){o={distance:n,point:B,face:o,faceIndex:p,object:i};l.push(o)}}}else if(o instanceof a.Face4){n=x[o.a];B=x[o.b];L=x[o.c];E=x[o.d];if(q(g,n,B,E)||q(g,B,L,E)){B=i.matrixWorld.multiplyVector3(g.clone());n=b.distanceTo(B);if(!(n<j.near||n>j.far)){o={distance:n,point:B,face:o,faceIndex:p,
-object:i};l.push(o)}}}}}}}}},p=function(a,b,c){for(var a=a.getDescendants(),d=0,f=a.length;d<f;d++)o(a[d],b,c)};a.Ray.prototype.precision=1E-4;a.Ray.prototype.set=function(a,b){this.origin=a;this.direction=b};a.Ray.prototype.intersectObject=function(a,b){var c=[];b===true&&p(a,this,c);o(a,this,c);c.sort(i);return c};a.Ray.prototype.intersectObjects=function(a,b){for(var c=[],d=0,f=a.length;d<f;d++){o(a[d],this,c);b===true&&p(a[d],this,c)}c.sort(i);return c}})(THREE);
-THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b=0,c=0,d=0,f=0,e=0,g=0,h=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,j,n){h=false;b=e;c=g;d=j;f=n;a()};this.addPoint=function(e,g){if(h===true){h=false;b=e;c=g;d=e;f=g}else{b=b<e?b:e;c=c<g?c:
-g;d=d>e?d:e;f=f>g?f:g}a()};this.add3Points=function(e,g,j,n,m,q){if(h===true){h=false;b=e<j?e<m?e:m:j<m?j:m;c=g<n?g<q?g:q:n<q?n:q;d=e>j?e>m?e:m:j>m?j:m;f=g>n?g>q?g:q:n>q?n:q}else{b=e<j?e<m?e<b?e:b:m<b?m:b:j<m?j<b?j:b:m<b?m:b;c=g<n?g<q?g<c?g:c:q<c?q:c:n<q?n<c?n:c:q<c?q:c;d=e>j?e>m?e>d?e:d:m>d?m:d:j>m?j>d?j:d:m>d?m:d;f=g>n?g>q?g>f?g:f:q>f?q:f:n>q?n>f?n:f:q>f?q:f}a()};this.addRectangle=function(e){if(h===true){h=false;b=e.getLeft();c=e.getTop();d=e.getRight();f=e.getBottom()}else{b=b<e.getLeft()?b:e.getLeft();
+(function(a){a.Ray=function(b,c,d,f){this.origin=b||new a.Vector3;this.direction=c||new a.Vector3;this.near=d||0;this.far=f||Infinity};var b=new a.Vector3,c=new a.Vector3,d=new a.Vector3,f=new a.Vector3,e=new a.Vector3,g=new a.Vector3,h=new a.Matrix4,i=function(a,b){return a.distance-b.distance},l=new a.Vector3,j=new a.Vector3,o=new a.Vector3,m=function(a,b,c){l.sub(c,a);var d=l.dot(b),a=j.add(a,o.copy(b).multiplyScalar(d));return c.distanceTo(a)},p=function(a,b,c,d){l.sub(d,b);j.sub(c,b);o.sub(a,
+b);var a=l.dot(l),b=l.dot(j),c=l.dot(o),f=j.dot(j),d=j.dot(o),e=1/(a*f-b*b),f=(f*c-b*d)*e,a=(a*d-b*c)*e;return f>=0&&a>=0&&f+a<1},q=function(i,j,l){var o,n;if(i instanceof a.Particle){o=m(j.origin,j.direction,i.matrixWorld.getPosition());if(o>i.scale.x)return l;n={distance:o,point:i.position,face:null,object:i};l.push(n)}else if(i instanceof a.Mesh){var q=i.geometry.boundingSphere.radius*i.matrixWorld.getMaxScaleOnAxis();o=m(j.origin,j.direction,i.matrixWorld.getPosition());if(o>q)return l;var x,
+B,C=i.geometry,z=C.vertices,F,G,M;F=i.geometry.materials;G=i.material instanceof a.MeshFaceMaterial;var E,N=j.precision;i.matrixRotationWorld.extractRotation(i.matrixWorld);b.copy(j.origin);h.getInverse(i.matrixWorld);c.copy(b);h.multiplyVector3(c);d.copy(j.direction);h.rotateAxis(d).normalize();q=0;for(x=C.faces.length;q<x;q++){n=C.faces[q];o=G===true?F[n.materialIndex]:i.material;if(o!==void 0){M=o.side;f.sub(n.centroid,c);e=n.normal;o=d.dot(e);if(!(Math.abs(o)<N)){B=e.dot(f)/o;if(!(B<0)&&(M===
+a.DoubleSide||(M===a.FrontSide?o<0:o>0))){g.add(c,d.multiplyScalar(B));if(n instanceof a.Face3){o=z[n.a];B=z[n.b];M=z[n.c];if(p(g,o,B,M)){B=i.matrixWorld.multiplyVector3(g.clone());o=b.distanceTo(B);if(!(o<j.near||o>j.far)){n={distance:o,point:B,face:n,faceIndex:q,object:i};l.push(n)}}}else if(n instanceof a.Face4){o=z[n.a];B=z[n.b];M=z[n.c];E=z[n.d];if(p(g,o,B,E)||p(g,B,M,E)){B=i.matrixWorld.multiplyVector3(g.clone());o=b.distanceTo(B);if(!(o<j.near||o>j.far)){n={distance:o,point:B,face:n,faceIndex:q,
+object:i};l.push(n)}}}}}}}}},n=function(a,b,c){for(var a=a.getDescendants(),d=0,f=a.length;d<f;d++)q(a[d],b,c)};a.Ray.prototype.precision=1E-4;a.Ray.prototype.set=function(a,b){this.origin=a;this.direction=b};a.Ray.prototype.intersectObject=function(a,b){var c=[];b===true&&n(a,this,c);q(a,this,c);c.sort(i);return c};a.Ray.prototype.intersectObjects=function(a,b){for(var c=[],d=0,f=a.length;d<f;d++){q(a[d],this,c);b===true&&n(a[d],this,c)}c.sort(i);return c}})(THREE);
+THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b=0,c=0,d=0,f=0,e=0,g=0,h=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,j,o){h=false;b=e;c=g;d=j;f=o;a()};this.addPoint=function(e,g){if(h===true){h=false;b=e;c=g;d=e;f=g}else{b=b<e?b:e;c=c<g?c:
+g;d=d>e?d:e;f=f>g?f:g}a()};this.add3Points=function(e,g,j,o,m,p){if(h===true){h=false;b=e<j?e<m?e:m:j<m?j:m;c=g<o?g<p?g:p:o<p?o:p;d=e>j?e>m?e:m:j>m?j:m;f=g>o?g>p?g:p:o>p?o:p}else{b=e<j?e<m?e<b?e:b:m<b?m:b:j<m?j<b?j:b:m<b?m:b;c=g<o?g<p?g<c?g:c:p<c?p:c:o<p?o<c?o:c:p<c?p:c;d=e>j?e>m?e>d?e:d:m>d?m:d:j>m?j>d?j:d:m>d?m:d;f=g>o?g>p?g>f?g:f:p>f?p:f:o>p?o>f?o:f:p>f?p:f}a()};this.addRectangle=function(e){if(h===true){h=false;b=e.getLeft();c=e.getTop();d=e.getRight();f=e.getBottom()}else{b=b<e.getLeft()?b:e.getLeft();
 c=c<e.getTop()?c:e.getTop();d=d>e.getRight()?d:e.getRight();f=f>e.getBottom()?f:e.getBottom()}a()};this.inflate=function(e){b=b-e;c=c-e;d=d+e;f=f+e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||f<a.getTop()||c>a.getBottom()?false:true};this.empty=function(){h=true;f=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,f){return d+(a-b)*(f-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return a<0?-1:a>0?1:0}};
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.properties={};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.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=true;this.quaternion=
@@ -75,25 +75,25 @@ else if(a instanceof THREE.Object3D){a.parent!==void 0&&a.parent.remove(a);a.par
 if(f.name===a)return f;if(b){f=f.getChildByName(a,b);if(f!==void 0)return f}}},getDescendants:function(a){a===void 0&&(a=[]);Array.prototype.push.apply(a,this.children);for(var b=0,c=this.children.length;b<c;b++)this.children[b].getDescendants(a);return a},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion===false?this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder):this.matrix.setRotationFromQuaternion(this.quaternion);if(this.scale.x!==1||this.scale.y!==
 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(a){this.matrixAutoUpdate===true&&this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||a===true){this.parent===void 0?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},
 clone:function(){}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){if(e===h){var a=new THREE.RenderableObject;g.push(a);h++;e++;return a}return g[e++]}function b(){if(l===n){var a=new THREE.RenderableVertex;j.push(a);n++;l++;return a}return j[l++]}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(f>=0&&e>=0&&g>=0&&h>=0)return true;if(f<0&&e<0||g<0&&h<0)return false;f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));
-if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var f,e,g=[],h=0,i,l,j=[],n=0,m,q,o=[],p=0,s,r=[],u=0,v,t,A=[],y=0,B,G,x=[],I=0,F={objects:[],sprites:[],lights:[],elements:[]},L=new THREE.Vector3,E=new THREE.Vector4,P=new THREE.Matrix4,H=new THREE.Matrix4,D=new THREE.Frustum,S=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);P.multiply(b.projectionMatrix,b.matrixWorldInverse);P.multiplyVector3(a);return a};this.unprojectVector=
-function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);P.multiply(b.matrixWorld,b.projectionMatrixInverse);P.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.projectScene=function(g,h,n){var K=h.near,fa=h.far,O=false,ra,va,da,ba,M,W,ha,ia,oa,ta,Ca,Ia,Wa,ja,ob,Na,Xa;G=t=s=q=0;F.elements.length=0;g.updateMatrixWorld();h.parent===
-void 0&&h.updateMatrixWorld();h.matrixWorldInverse.getInverse(h.matrixWorld);P.multiply(h.projectionMatrix,h.matrixWorldInverse);D.setFromMatrix(P);e=0;F.objects.length=0;F.sprites.length=0;F.lights.length=0;var pb=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||D.contains(b)===true)){L.copy(b.matrixWorld.getPosition());P.multiplyVector3(L);f=a();f.object=b;f.z=L.z;F.objects.push(f)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){L.copy(b.matrixWorld.getPosition());
-P.multiplyVector3(L);f=a();f.object=b;f.z=L.z;F.sprites.push(f)}else b instanceof THREE.Light&&F.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)pb(b.children[c])}};pb(g);g=0;for(ra=F.objects.length;g<ra;g++){oa=F.objects[g].object;ta=oa.matrixWorld;l=0;if(oa instanceof THREE.Mesh){Ca=oa.geometry;Ia=oa.geometry.materials;ba=Ca.vertices;Wa=Ca.faces;ob=Ca.faceVertexUvs;Ca=oa.matrixRotationWorld.extractRotation(ta);Xa=oa.material instanceof THREE.MeshFaceMaterial;va=0;for(da=ba.length;va<da;va++){i=
-b();i.positionWorld.copy(ba[va]);ta.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);P.multiplyVector4(i.positionScreen);i.positionScreen.x=i.positionScreen.x/i.positionScreen.w;i.positionScreen.y=i.positionScreen.y/i.positionScreen.w;i.visible=i.positionScreen.z>K&&i.positionScreen.z<fa}ba=0;for(va=Wa.length;ba<va;ba++){ia=Wa[ba];da=Xa===true?Ia[ia.materialIndex]:oa.material;if(da!==void 0){ha=da.side;if(ia instanceof THREE.Face3){M=j[ia.a];W=j[ia.b];ja=j[ia.c];if(M.visible===
-true&&W.visible===true&&ja.visible===true){O=(ja.positionScreen.x-M.positionScreen.x)*(W.positionScreen.y-M.positionScreen.y)-(ja.positionScreen.y-M.positionScreen.y)*(W.positionScreen.x-M.positionScreen.x)<0;if(ha===THREE.DoubleSide||O===(ha===THREE.FrontSide)){if(q===p){Na=new THREE.RenderableFace3;o.push(Na);p++;q++;m=Na}else m=o[q++];m.v1.copy(M);m.v2.copy(W);m.v3.copy(ja)}else continue}else continue}else if(ia instanceof THREE.Face4){M=j[ia.a];W=j[ia.b];ja=j[ia.c];Na=j[ia.d];if(M.visible===true&&
-W.visible===true&&ja.visible===true&&Na.visible===true){O=(Na.positionScreen.x-M.positionScreen.x)*(W.positionScreen.y-M.positionScreen.y)-(Na.positionScreen.y-M.positionScreen.y)*(W.positionScreen.x-M.positionScreen.x)<0||(W.positionScreen.x-ja.positionScreen.x)*(Na.positionScreen.y-ja.positionScreen.y)-(W.positionScreen.y-ja.positionScreen.y)*(Na.positionScreen.x-ja.positionScreen.x)<0;if(ha===THREE.DoubleSide||O===(ha===THREE.FrontSide)){if(s===u){var wb=new THREE.RenderableFace4;r.push(wb);u++;
-s++;m=wb}else m=r[s++];m.v1.copy(M);m.v2.copy(W);m.v3.copy(ja);m.v4.copy(Na)}else continue}else continue}m.normalWorld.copy(ia.normal);O===false&&(ha===THREE.BackSide||ha===THREE.DoubleSide)&&m.normalWorld.negate();Ca.multiplyVector3(m.normalWorld);m.centroidWorld.copy(ia.centroid);ta.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);P.multiplyVector3(m.centroidScreen);ia=ia.vertexNormals;M=0;for(W=ia.length;M<W;M++){ja=m.vertexNormalsWorld[M];ja.copy(ia[M]);O===false&&(ha===
-THREE.BackSide||ha===THREE.DoubleSide)&&ja.negate();Ca.multiplyVector3(ja)}m.vertexNormalsLength=ia.length;M=0;for(W=ob.length;M<W;M++){ja=ob[M][ba];if(ja!==void 0){ha=0;for(ia=ja.length;ha<ia;ha++)m.uvs[M][ha]=ja[ha]}}m.material=da;m.z=m.centroidScreen.z;F.elements.push(m)}}}else if(oa instanceof THREE.Line){H.multiply(P,ta);ba=oa.geometry.vertices;M=b();M.positionScreen.copy(ba[0]);H.multiplyVector4(M.positionScreen);ta=oa.type===THREE.LinePieces?2:1;va=1;for(da=ba.length;va<da;va++){M=b();M.positionScreen.copy(ba[va]);
-H.multiplyVector4(M.positionScreen);if(!((va+1)%ta>0)){W=j[l-2];S.copy(M.positionScreen);R.copy(W.positionScreen);if(d(S,R)===true){S.multiplyScalar(1/S.w);R.multiplyScalar(1/R.w);if(t===y){Ia=new THREE.RenderableLine;A.push(Ia);y++;t++;v=Ia}else v=A[t++];v.v1.positionScreen.copy(S);v.v2.positionScreen.copy(R);v.z=Math.max(S.z,R.z);v.material=oa.material;F.elements.push(v)}}}}}g=0;for(ra=F.sprites.length;g<ra;g++){oa=F.sprites[g].object;ta=oa.matrixWorld;if(oa instanceof THREE.Particle){E.set(ta.elements[12],
-ta.elements[13],ta.elements[14],1);P.multiplyVector4(E);E.z=E.z/E.w;if(E.z>0&&E.z<1){if(G===I){K=new THREE.RenderableParticle;x.push(K);I++;G++;B=K}else B=x[G++];B.object=oa;B.x=E.x/E.w;B.y=E.y/E.w;B.z=E.z;B.rotation=oa.rotation.z;B.scale.x=oa.scale.x*Math.abs(B.x-(E.x+h.projectionMatrix.elements[0])/(E.w+h.projectionMatrix.elements[12]));B.scale.y=oa.scale.y*Math.abs(B.y-(E.y+h.projectionMatrix.elements[5])/(E.w+h.projectionMatrix.elements[13]));B.material=oa.material;F.elements.push(B)}}}n&&F.elements.sort(c);
-return F}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
+THREE.Projector=function(){function a(){if(e===h){var a=new THREE.RenderableObject;g.push(a);h++;e++;return a}return g[e++]}function b(){if(l===o){var a=new THREE.RenderableVertex;j.push(a);o++;l++;return a}return j[l++]}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(f>=0&&e>=0&&g>=0&&h>=0)return true;if(f<0&&e<0||g<0&&h<0)return false;f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));
+if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var f,e,g=[],h=0,i,l,j=[],o=0,m,p,q=[],n=0,t,s=[],u=0,v,r,A=[],x=0,B,C,z=[],F=0,G={objects:[],sprites:[],lights:[],elements:[]},M=new THREE.Vector3,E=new THREE.Vector4,N=new THREE.Matrix4,I=new THREE.Matrix4,K=new THREE.Frustum,Q=new THREE.Vector4,H=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);N.multiply(b.projectionMatrix,b.matrixWorldInverse);N.multiplyVector3(a);return a};this.unprojectVector=
+function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);N.multiply(b.matrixWorld,b.projectionMatrixInverse);N.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.projectScene=function(g,h,o){var J=h.near,ca=h.far,O=false,ra,va,da,ea,V,U,ha,ia,oa,ta,Da,Ja,Xa,ja,pb,Oa,Ya;C=r=t=p=0;G.elements.length=0;g.updateMatrixWorld();h.parent===
+void 0&&h.updateMatrixWorld();h.matrixWorldInverse.getInverse(h.matrixWorld);N.multiply(h.projectionMatrix,h.matrixWorldInverse);K.setFromMatrix(N);e=0;G.objects.length=0;G.sprites.length=0;G.lights.length=0;var qb=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||K.contains(b)===true)){M.copy(b.matrixWorld.getPosition());N.multiplyVector3(M);f=a();f.object=b;f.z=M.z;G.objects.push(f)}else if(b instanceof THREE.Sprite||b instanceof THREE.Particle){M.copy(b.matrixWorld.getPosition());
+N.multiplyVector3(M);f=a();f.object=b;f.z=M.z;G.sprites.push(f)}else b instanceof THREE.Light&&G.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)qb(b.children[c])}};qb(g);g=0;for(ra=G.objects.length;g<ra;g++){oa=G.objects[g].object;ta=oa.matrixWorld;l=0;if(oa instanceof THREE.Mesh){Da=oa.geometry;Ja=oa.geometry.materials;ea=Da.vertices;Xa=Da.faces;pb=Da.faceVertexUvs;Da=oa.matrixRotationWorld.extractRotation(ta);Ya=oa.material instanceof THREE.MeshFaceMaterial;va=0;for(da=ea.length;va<da;va++){i=
+b();i.positionWorld.copy(ea[va]);ta.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);N.multiplyVector4(i.positionScreen);i.positionScreen.x=i.positionScreen.x/i.positionScreen.w;i.positionScreen.y=i.positionScreen.y/i.positionScreen.w;i.visible=i.positionScreen.z>J&&i.positionScreen.z<ca}ea=0;for(va=Xa.length;ea<va;ea++){ia=Xa[ea];da=Ya===true?Ja[ia.materialIndex]:oa.material;if(da!==void 0){ha=da.side;if(ia instanceof THREE.Face3){V=j[ia.a];U=j[ia.b];ja=j[ia.c];if(V.visible===
+true&&U.visible===true&&ja.visible===true){O=(ja.positionScreen.x-V.positionScreen.x)*(U.positionScreen.y-V.positionScreen.y)-(ja.positionScreen.y-V.positionScreen.y)*(U.positionScreen.x-V.positionScreen.x)<0;if(ha===THREE.DoubleSide||O===(ha===THREE.FrontSide)){if(p===n){Oa=new THREE.RenderableFace3;q.push(Oa);n++;p++;m=Oa}else m=q[p++];m.v1.copy(V);m.v2.copy(U);m.v3.copy(ja)}else continue}else continue}else if(ia instanceof THREE.Face4){V=j[ia.a];U=j[ia.b];ja=j[ia.c];Oa=j[ia.d];if(V.visible===true&&
+U.visible===true&&ja.visible===true&&Oa.visible===true){O=(Oa.positionScreen.x-V.positionScreen.x)*(U.positionScreen.y-V.positionScreen.y)-(Oa.positionScreen.y-V.positionScreen.y)*(U.positionScreen.x-V.positionScreen.x)<0||(U.positionScreen.x-ja.positionScreen.x)*(Oa.positionScreen.y-ja.positionScreen.y)-(U.positionScreen.y-ja.positionScreen.y)*(Oa.positionScreen.x-ja.positionScreen.x)<0;if(ha===THREE.DoubleSide||O===(ha===THREE.FrontSide)){if(t===u){var wb=new THREE.RenderableFace4;s.push(wb);u++;
+t++;m=wb}else m=s[t++];m.v1.copy(V);m.v2.copy(U);m.v3.copy(ja);m.v4.copy(Oa)}else continue}else continue}m.normalWorld.copy(ia.normal);O===false&&(ha===THREE.BackSide||ha===THREE.DoubleSide)&&m.normalWorld.negate();Da.multiplyVector3(m.normalWorld);m.centroidWorld.copy(ia.centroid);ta.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);N.multiplyVector3(m.centroidScreen);ia=ia.vertexNormals;V=0;for(U=ia.length;V<U;V++){ja=m.vertexNormalsWorld[V];ja.copy(ia[V]);O===false&&(ha===
+THREE.BackSide||ha===THREE.DoubleSide)&&ja.negate();Da.multiplyVector3(ja)}m.vertexNormalsLength=ia.length;V=0;for(U=pb.length;V<U;V++){ja=pb[V][ea];if(ja!==void 0){ha=0;for(ia=ja.length;ha<ia;ha++)m.uvs[V][ha]=ja[ha]}}m.material=da;m.z=m.centroidScreen.z;G.elements.push(m)}}}else if(oa instanceof THREE.Line){I.multiply(N,ta);ea=oa.geometry.vertices;V=b();V.positionScreen.copy(ea[0]);I.multiplyVector4(V.positionScreen);ta=oa.type===THREE.LinePieces?2:1;va=1;for(da=ea.length;va<da;va++){V=b();V.positionScreen.copy(ea[va]);
+I.multiplyVector4(V.positionScreen);if(!((va+1)%ta>0)){U=j[l-2];Q.copy(V.positionScreen);H.copy(U.positionScreen);if(d(Q,H)===true){Q.multiplyScalar(1/Q.w);H.multiplyScalar(1/H.w);if(r===x){Ja=new THREE.RenderableLine;A.push(Ja);x++;r++;v=Ja}else v=A[r++];v.v1.positionScreen.copy(Q);v.v2.positionScreen.copy(H);v.z=Math.max(Q.z,H.z);v.material=oa.material;G.elements.push(v)}}}}}g=0;for(ra=G.sprites.length;g<ra;g++){oa=G.sprites[g].object;ta=oa.matrixWorld;if(oa instanceof THREE.Particle){E.set(ta.elements[12],
+ta.elements[13],ta.elements[14],1);N.multiplyVector4(E);E.z=E.z/E.w;if(E.z>0&&E.z<1){if(C===F){J=new THREE.RenderableParticle;z.push(J);F++;C++;B=J}else B=z[C++];B.object=oa;B.x=E.x/E.w;B.y=E.y/E.w;B.z=E.z;B.rotation=oa.rotation.z;B.scale.x=oa.scale.x*Math.abs(B.x-(E.x+h.projectionMatrix.elements[0])/(E.w+h.projectionMatrix.elements[12]));B.scale.y=oa.scale.y*Math.abs(B.y-(E.y+h.projectionMatrix.elements[5])/(E.w+h.projectionMatrix.elements[13]));B.material=oa.material;G.elements.push(B)}}}o&&G.elements.sort(c);
+return G}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),f=Math.cos(a.z/2),e=Math.sin(a.x/2),g=Math.sin(a.y/2),h=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=e*d*f+c*g*h;this.y=c*g*f-e*d*h;this.z=c*d*h+e*g*f;this.w=c*d*f-e*g*h}else if(b==="YXZ"){this.x=e*d*f+c*g*h;this.y=c*g*f-e*d*h;this.z=
 c*d*h-e*g*f;this.w=c*d*f+e*g*h}else if(b==="ZXY"){this.x=e*d*f-c*g*h;this.y=c*g*f+e*d*h;this.z=c*d*h+e*g*f;this.w=c*d*f-e*g*h}else if(b==="ZYX"){this.x=e*d*f-c*g*h;this.y=c*g*f+e*d*h;this.z=c*d*h-e*g*f;this.w=c*d*f+e*g*h}else if(b==="YZX"){this.x=e*d*f+c*g*h;this.y=c*g*f+e*d*h;this.z=c*d*h-e*g*f;this.w=c*d*f-e*g*h}else if(b==="XZY"){this.x=e*d*f-c*g*h;this.y=c*g*f-e*d*h;this.z=c*d*h+e*g*f;this.w=c*d*f+e*g*h}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=a.elements,c=b[0],a=b[4],d=b[8],f=b[1],e=b[5],g=b[9],h=b[2],i=b[6],b=b[10],l=c+e+b;if(l>0){c=0.5/Math.sqrt(l+1);this.w=0.25/c;this.x=(i-g)*c;this.y=(d-h)*c;this.z=(f-a)*c}else if(c>e&&c>b){c=2*Math.sqrt(1+c-e-b);this.w=(i-g)/c;this.x=0.25*c;this.y=(a+f)/c;this.z=(d+h)/c}else if(e>b){c=2*Math.sqrt(1+e-c-b);this.w=(d-h)/c;this.x=(a+f)/c;this.y=0.25*c;this.z=(g+i)/c}else{c=2*Math.sqrt(1+b-c-e);this.w=(f-a)/c;this.x=
 (d+h)/c;this.y=(g+i)/c;this.z=0.25*c}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=this.x*-1;this.y=this.y*-1;this.z=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);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=
 this.y*a;this.z=this.z*a;this.w=this.w*a}return this},multiply:function(a,b){var c=a.x,d=a.y,f=a.z,e=a.w,g=b.x,h=b.y,i=b.z,l=b.w;this.x=c*l+d*i-f*h+e*g;this.y=-c*i+d*l+f*g+e*h;this.z=c*h-d*g+f*l+e*i;this.w=-c*g-d*h-f*i+e*l;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=
-this.y,h=this.z,i=this.w,l=i*c+g*f-h*d,j=i*d+h*c-e*f,n=i*f+e*d-g*c,c=-e*c-g*d-h*f;b.x=l*i+c*-e+j*-h-n*-g;b.y=j*i+c*-g+n*-e-l*-h;b.z=n*i+c*-h+l*-g-j*-e;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,f=this.z,e=this.w,g=e*a.w+c*a.x+d*a.y+f*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=e;this.x=c;this.y=d;this.z=f;return this}var h=Math.acos(g),i=Math.sqrt(1-g*g);if(Math.abs(i)<0.001){this.w=0.5*(e+this.w);this.x=0.5*(c+this.x);this.y=0.5*
+this.y,h=this.z,i=this.w,l=i*c+g*f-h*d,j=i*d+h*c-e*f,o=i*f+e*d-g*c,c=-e*c-g*d-h*f;b.x=l*i+c*-e+j*-h-o*-g;b.y=j*i+c*-g+o*-e-l*-h;b.z=o*i+c*-h+l*-g-j*-e;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,f=this.z,e=this.w,g=e*a.w+c*a.x+d*a.y+f*a.z;if(g<0){this.w=-a.w;this.x=-a.x;this.y=-a.y;this.z=-a.z;g=-g}else this.copy(a);if(g>=1){this.w=e;this.x=c;this.y=d;this.z=f;return this}var h=Math.acos(g),i=Math.sqrt(1-g*g);if(Math.abs(i)<0.001){this.w=0.5*(e+this.w);this.x=0.5*(c+this.x);this.y=0.5*
 (d+this.y);this.z=0.5*(f+this.z);return this}g=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;this.w=e*g+this.w*h;this.x=c*g+this.x*h;this.y=d*g+this.y*h;this.z=f*g+this.z*h;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
 THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(f<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;f=-f}else c.copy(b);if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var b=Math.acos(f),e=Math.sqrt(1-f*f);if(Math.abs(e)<0.001){c.w=0.5*(a.w+c.w);c.x=0.5*(a.x+c.x);c.y=0.5*(a.y+c.y);c.z=0.5*(a.z+c.z);return c}f=Math.sin((1-d)*b)/e;d=Math.sin(d*b)/e;c.w=a.w*f+c.w*d;c.x=a.x*f+c.x*d;c.y=a.y*f+c.y*d;c.z=a.z*f+c.z*d;return c};
 THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.Face3=function(a,b,c,d,f,e){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=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
@@ -109,24 +109,24 @@ else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Ve
 for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(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])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeMorphNormals:function(){var a,b,c,d,f;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.__originalFaceNormal?
 f.__originalFaceNormal.copy(f.normal):f.__originalFaceNormal=f.normal.clone();if(!f.__originalVertexNormals)f.__originalVertexNormals=[];a=0;for(b=f.vertexNormals.length;a<b;a++)f.__originalVertexNormals[a]?f.__originalVertexNormals[a].copy(f.vertexNormals[a]):f.__originalVertexNormals[a]=f.vertexNormals[a].clone()}var e=new THREE.Geometry;e.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
 [];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,l;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];i=new THREE.Vector3;l=f instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(i);h.push(l)}}g=this.morphNormals[a];e.vertices=this.morphTargets[a].vertices;e.computeFaceNormals();e.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];
-i=g.faceNormals[c];l=g.vertexNormals[c];i.copy(f.normal);if(f instanceof THREE.Face3){l.a.copy(f.vertexNormals[0]);l.b.copy(f.vertexNormals[1]);l.c.copy(f.vertexNormals[2])}else{l.a.copy(f.vertexNormals[0]);l.b.copy(f.vertexNormals[1]);l.c.copy(f.vertexNormals[2]);l.d.copy(f.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.normal=f.__originalFaceNormal;f.vertexNormals=f.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,f,e,E){h=a.vertices[b];i=a.vertices[c];
-l=a.vertices[d];j=g[f];n=g[e];m=g[E];q=i.x-h.x;o=l.x-h.x;p=i.y-h.y;s=l.y-h.y;r=i.z-h.z;u=l.z-h.z;v=n.u-j.u;t=m.u-j.u;A=n.v-j.v;y=m.v-j.v;B=1/(v*y-t*A);F.set((y*q-A*o)*B,(y*p-A*s)*B,(y*r-A*u)*B);L.set((v*o-t*q)*B,(v*s-t*p)*B,(v*u-t*r)*B);x[b].addSelf(F);x[c].addSelf(F);x[d].addSelf(F);I[b].addSelf(L);I[c].addSelf(L);I[d].addSelf(L)}var b,c,d,f,e,g,h,i,l,j,n,m,q,o,p,s,r,u,v,t,A,y,B,G,x=[],I=[],F=new THREE.Vector3,L=new THREE.Vector3,E=new THREE.Vector3,P=new THREE.Vector3,H=new THREE.Vector3;b=0;for(c=
-this.vertices.length;b<c;b++){x[b]=new THREE.Vector3;I[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];g=this.faceVertexUvs[0][b];if(e instanceof THREE.Face3)a(this,e.a,e.b,e.c,0,1,2);else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.d,0,1,3);a(this,e.b,e.c,e.d,1,2,3)}}var D=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++){H.copy(e.vertexNormals[d]);f=e[D[d]];G=x[f];E.copy(G);E.subSelf(H.multiplyScalar(H.dot(G))).normalize();
-P.cross(e.vertexNormals[d],G);f=P.dot(I[f]);f=f<0?-1:1;e.vertexTangents[d]=new THREE.Vector4(E.x,E.y,E.z,f)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,f=this.vertices.length;d<f;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
+i=g.faceNormals[c];l=g.vertexNormals[c];i.copy(f.normal);if(f instanceof THREE.Face3){l.a.copy(f.vertexNormals[0]);l.b.copy(f.vertexNormals[1]);l.c.copy(f.vertexNormals[2])}else{l.a.copy(f.vertexNormals[0]);l.b.copy(f.vertexNormals[1]);l.c.copy(f.vertexNormals[2]);l.d.copy(f.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.normal=f.__originalFaceNormal;f.vertexNormals=f.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,f,e,C){h=a.vertices[b];i=a.vertices[c];
+l=a.vertices[d];j=g[f];o=g[e];m=g[C];p=i.x-h.x;q=l.x-h.x;n=i.y-h.y;t=l.y-h.y;s=i.z-h.z;u=l.z-h.z;v=o.u-j.u;r=m.u-j.u;A=o.v-j.v;x=m.v-j.v;B=1/(v*x-r*A);G.set((x*p-A*q)*B,(x*n-A*t)*B,(x*s-A*u)*B);M.set((v*q-r*p)*B,(v*t-r*n)*B,(v*u-r*s)*B);z[b].addSelf(G);z[c].addSelf(G);z[d].addSelf(G);F[b].addSelf(M);F[c].addSelf(M);F[d].addSelf(M)}var b,c,d,f,e,g,h,i,l,j,o,m,p,q,n,t,s,u,v,r,A,x,B,C,z=[],F=[],G=new THREE.Vector3,M=new THREE.Vector3,E=new THREE.Vector3,N=new THREE.Vector3,I=new THREE.Vector3;b=0;for(c=
+this.vertices.length;b<c;b++){z[b]=new THREE.Vector3;F[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];g=this.faceVertexUvs[0][b];if(e instanceof THREE.Face3)a(this,e.a,e.b,e.c,0,1,2);else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.d,0,1,3);a(this,e.b,e.c,e.d,1,2,3)}}var K=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++){I.copy(e.vertexNormals[d]);f=e[K[d]];C=z[f];E.copy(C);E.subSelf(I.multiplyScalar(I.dot(C))).normalize();
+N.cross(e.vertexNormals[d],C);f=N.dot(F[f]);f=f<0?-1:1;e.vertexTangents[d]=new THREE.Vector4(E.x,E.y,E.z,f)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,f=this.vertices.length;d<f;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
 a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){var a=0;if(this.boundingSphere===null)this.boundingSphere={radius:0};for(var b=0,c=this.vertices.length;b<c;b++){var d=this.vertices[b].lengthSq();d>a&&(a=d)}this.boundingSphere.radius=Math.sqrt(a)},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g,h,i;e=0;for(g=this.vertices.length;e<g;e++){d=
 this.vertices[e];d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_");if(a[d]===void 0){a[d]=e;b.push(this.vertices[e]);c[e]=b.length-1}else c[e]=c[a[d]]}e=0;for(g=this.faces.length;e<g;e++){a=this.faces[e];if(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];d=[a.a,a.b,a.c,a.d];for(f=3;f>0;f--)if(d.indexOf(a["abcd"[f]])!==f){d.splice(f,1);this.faces[e]=new THREE.Face3(d[0],d[1],d[2],a.normal,a.color,
 a.materialIndex);d=0;for(h=this.faceVertexUvs.length;d<h;d++)(i=this.faceVertexUvs[d][e])&&i.splice(f,1);this.faces[e].vertexColors=a.vertexColors;break}}}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){}};THREE.GeometryCount=0;THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.attributes={};this.dynamic=false;this.boundingSphere=this.boundingBox=null;this.hasTangents=false;this.morphTargets=[]};
 THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;if(this.attributes.position)b=this.attributes.position.array;if(this.attributes.normal)c=this.attributes.normal.array;if(b!==void 0){a.multiplyVector3Array(b);this.verticesNeedUpdate=true}if(c!==void 0){b=new THREE.Matrix4;b.extractRotation(a);b.multiplyVector3Array(c);this.normalsNeedUpdate=true}},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3(Infinity,Infinity,
 Infinity),max:new THREE.Vector3(-Infinity,-Infinity,-Infinity)};var a=this.attributes.position.array;if(a)for(var b=this.boundingBox,c,d,f,e=0,g=a.length;e<g;e=e+3){c=a[e];d=a[e+1];f=a[e+2];if(c<b.min.x)b.min.x=c;else if(c>b.max.x)b.max.x=c;if(d<b.min.y)b.min.y=d;else if(d>b.max.y)b.max.y=d;if(f<b.min.z)b.min.z=f;else if(f>b.max.z)b.max.z=f}if(a===void 0||a.length===0){this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere=
 {radius:0};var a=this.attributes.position.array;if(a){for(var b,c=0,d,f,e=0,g=a.length;e<g;e=e+3){b=a[e];d=a[e+1];f=a[e+2];b=b*b+d*d+f*f;b>c&&(c=b)}this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position&&this.attributes.index){var a,b,c,d;a=this.attributes.position.array.length;if(this.attributes.normal===void 0)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=
-0}var f=this.offsets,e=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,i,l,j,n,m,q,o=new THREE.Vector3,p=new THREE.Vector3,s=new THREE.Vector3,r=new THREE.Vector3,u=new THREE.Vector3;c=0;for(d=f.length;c<d;++c){b=f[c].start;i=f[c].count;var v=f[c].index;a=b;for(b=b+i;a<b;a=a+3){i=v+e[a];l=v+e[a+1];j=v+e[a+2];n=g[i*3];m=g[i*3+1];q=g[i*3+2];o.set(n,m,q);n=g[l*3];m=g[l*3+1];q=g[l*3+2];p.set(n,m,q);n=g[j*3];m=g[j*3+1];q=g[j*3+2];s.set(n,m,q);r.sub(s,p);u.sub(o,
-p);r.crossSelf(u);h[i*3]=h[i*3]+r.x;h[i*3+1]=h[i*3+1]+r.y;h[i*3+2]=h[i*3+2]+r.z;h[l*3]=h[l*3]+r.x;h[l*3+1]=h[l*3+1]+r.y;h[l*3+2]=h[l*3+2]+r.z;h[j*3]=h[j*3]+r.x;h[j*3+1]=h[j*3+1]+r.y;h[j*3+2]=h[j*3+2]+r.z}}a=0;for(b=h.length;a<b;a=a+3){n=h[a];m=h[a+1];q=h[a+2];c=1/Math.sqrt(n*n+m*m+q*q);h[a]=h[a]*c;h[a+1]=h[a+1]*c;h[a+2]=h[a+2]*c}this.normalsNeedUpdate=true}},computeTangents:function(){function a(a){N.x=d[a*3];N.y=d[a*3+1];N.z=d[a*3+2];Y.copy(N);fa=i[a];R.copy(fa);R.subSelf(N.multiplyScalar(N.dot(fa))).normalize();
-J.cross(Y,fa);O=J.dot(l[a]);K=O<0?-1:1;h[a*4]=R.x;h[a*4+1]=R.y;h[a*4+2]=R.z;h[a*4+3]=K}if(this.attributes.index===void 0||this.attributes.position===void 0||this.attributes.normal===void 0||this.attributes.uv===void 0)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,f=this.attributes.uv.array,e=c.length/3;if(this.attributes.tangent===
-void 0){var g=4*e;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,i=[],l=[],g=0;g<e;g++){i[g]=new THREE.Vector3;l[g]=new THREE.Vector3}var j,n,m,q,o,p,s,r,u,v,t,A,y,B,G,e=new THREE.Vector3,g=new THREE.Vector3,x,I,F,L,E,P,H,D=this.offsets;F=0;for(L=D.length;F<L;++F){I=D[F].start;E=D[F].count;var S=D[F].index;x=I;for(I=I+E;x<I;x=x+3){E=S+b[x];P=S+b[x+1];H=S+b[x+2];j=c[E*3];n=c[E*3+1];m=c[E*3+2];q=c[P*3];o=c[P*3+1];p=c[P*3+2];s=c[H*3];
-r=c[H*3+1];u=c[H*3+2];v=f[E*2];t=f[E*2+1];A=f[P*2];y=f[P*2+1];B=f[H*2];G=f[H*2+1];q=q-j;j=s-j;o=o-n;n=r-n;p=p-m;m=u-m;A=A-v;v=B-v;y=y-t;t=G-t;G=1/(A*t-v*y);e.set((t*q-y*j)*G,(t*o-y*n)*G,(t*p-y*m)*G);g.set((A*j-v*q)*G,(A*n-v*o)*G,(A*m-v*p)*G);i[E].addSelf(e);i[P].addSelf(e);i[H].addSelf(e);l[E].addSelf(g);l[P].addSelf(g);l[H].addSelf(g)}}var R=new THREE.Vector3,J=new THREE.Vector3,N=new THREE.Vector3,Y=new THREE.Vector3,K,fa,O;F=0;for(L=D.length;F<L;++F){I=D[F].start;E=D[F].count;S=D[F].index;x=I;
-for(I=I+E;x<I;x=x+3){E=S+b[x];P=S+b[x+1];H=S+b[x+2];a(E);a(P);a(H)}}this.tangentsNeedUpdate=this.hasTangents=true}}};
-THREE.Spline=function(a){function b(a,b,c,d,f,e,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*e+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},f,e,g,h,i,l,j,n,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;e=Math.floor(f);g=f-e;c[0]=e===0?e:e-1;c[1]=e;c[2]=e>this.points.length-2?this.points.length-1:e+1;c[3]=e>this.points.length-3?this.points.length-1:
-e+2;l=this.points[c[0]];j=this.points[c[1]];n=this.points[c[2]];m=this.points[c[3]];h=g*g;i=g*h;d.x=b(l.x,j.x,n.x,m.x,g,h,i);d.y=b(l.y,j.y,n.y,m.y,g,h,i);d.z=b(l.z,j.z,n.z,m.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++){b=this.points[a];d[a]=[b.x,b.y,b.z]}return d};this.getLength=function(a){var b,c,d,f=b=b=0,e=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;e.copy(this.points[0]);for(a=1;a<c;a++){b=
+0}var f=this.offsets,e=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,i,l,j,o,m,p,q=new THREE.Vector3,n=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector3,u=new THREE.Vector3;c=0;for(d=f.length;c<d;++c){b=f[c].start;i=f[c].count;var v=f[c].index;a=b;for(b=b+i;a<b;a=a+3){i=v+e[a];l=v+e[a+1];j=v+e[a+2];o=g[i*3];m=g[i*3+1];p=g[i*3+2];q.set(o,m,p);o=g[l*3];m=g[l*3+1];p=g[l*3+2];n.set(o,m,p);o=g[j*3];m=g[j*3+1];p=g[j*3+2];t.set(o,m,p);s.sub(t,n);u.sub(q,
+n);s.crossSelf(u);h[i*3]=h[i*3]+s.x;h[i*3+1]=h[i*3+1]+s.y;h[i*3+2]=h[i*3+2]+s.z;h[l*3]=h[l*3]+s.x;h[l*3+1]=h[l*3+1]+s.y;h[l*3+2]=h[l*3+2]+s.z;h[j*3]=h[j*3]+s.x;h[j*3+1]=h[j*3+1]+s.y;h[j*3+2]=h[j*3+2]+s.z}}a=0;for(b=h.length;a<b;a=a+3){o=h[a];m=h[a+1];p=h[a+2];c=1/Math.sqrt(o*o+m*m+p*p);h[a]=h[a]*c;h[a+1]=h[a+1]*c;h[a+2]=h[a+2]*c}this.normalsNeedUpdate=true}},computeTangents:function(){function a(a){aa.x=d[a*3];aa.y=d[a*3+1];aa.z=d[a*3+2];Z.copy(aa);ca=i[a];H.copy(ca);H.subSelf(aa.multiplyScalar(aa.dot(ca))).normalize();
+L.cross(Z,ca);O=L.dot(l[a]);J=O<0?-1:1;h[a*4]=H.x;h[a*4+1]=H.y;h[a*4+2]=H.z;h[a*4+3]=J}if(this.attributes.index===void 0||this.attributes.position===void 0||this.attributes.normal===void 0||this.attributes.uv===void 0)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,f=this.attributes.uv.array,e=c.length/3;if(this.attributes.tangent===
+void 0){var g=4*e;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,i=[],l=[],g=0;g<e;g++){i[g]=new THREE.Vector3;l[g]=new THREE.Vector3}var j,o,m,p,q,n,t,s,u,v,r,A,x,B,C,e=new THREE.Vector3,g=new THREE.Vector3,z,F,G,M,E,N,I,K=this.offsets;G=0;for(M=K.length;G<M;++G){F=K[G].start;E=K[G].count;var Q=K[G].index;z=F;for(F=F+E;z<F;z=z+3){E=Q+b[z];N=Q+b[z+1];I=Q+b[z+2];j=c[E*3];o=c[E*3+1];m=c[E*3+2];p=c[N*3];q=c[N*3+1];n=c[N*3+2];t=c[I*3];
+s=c[I*3+1];u=c[I*3+2];v=f[E*2];r=f[E*2+1];A=f[N*2];x=f[N*2+1];B=f[I*2];C=f[I*2+1];p=p-j;j=t-j;q=q-o;o=s-o;n=n-m;m=u-m;A=A-v;v=B-v;x=x-r;r=C-r;C=1/(A*r-v*x);e.set((r*p-x*j)*C,(r*q-x*o)*C,(r*n-x*m)*C);g.set((A*j-v*p)*C,(A*o-v*q)*C,(A*m-v*n)*C);i[E].addSelf(e);i[N].addSelf(e);i[I].addSelf(e);l[E].addSelf(g);l[N].addSelf(g);l[I].addSelf(g)}}var H=new THREE.Vector3,L=new THREE.Vector3,aa=new THREE.Vector3,Z=new THREE.Vector3,J,ca,O;G=0;for(M=K.length;G<M;++G){F=K[G].start;E=K[G].count;Q=K[G].index;z=F;
+for(F=F+E;z<F;z=z+3){E=Q+b[z];N=Q+b[z+1];I=Q+b[z+2];a(E);a(N);a(I)}}this.tangentsNeedUpdate=this.hasTangents=true}}};
+THREE.Spline=function(a){function b(a,b,c,d,f,e,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*e+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},f,e,g,h,i,l,j,o,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;e=Math.floor(f);g=f-e;c[0]=e===0?e:e-1;c[1]=e;c[2]=e>this.points.length-2?this.points.length-1:e+1;c[3]=e>this.points.length-3?this.points.length-1:
+e+2;l=this.points[c[0]];j=this.points[c[1]];o=this.points[c[2]];m=this.points[c[3]];h=g*g;i=g*h;d.x=b(l.x,j.x,o.x,m.x,g,h,i);d.y=b(l.y,j.y,o.y,m.y,g,h,i);d.z=b(l.z,j.z,o.z,m.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++){b=this.points[a];d[a]=[b.x,b.y,b.z]}return d};this.getLength=function(a){var b,c,d,f=b=b=0,e=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;e.copy(this.points[0]);for(a=1;a<c;a++){b=
 a/c;d=this.getPoint(b);g.copy(d);i=i+g.distanceTo(e);e.copy(d);b=(this.points.length-1)*b;b=Math.floor(b);if(b!=f){h[b]=i;f=b}}h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,f,e,g,h=[],i=new THREE.Vector3,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];g=Math.ceil(a*c/j.total);f=(b-1)/(this.points.length-1);e=b/(this.points.length-1);for(c=1;c<g-1;c++){d=f+c*(1/g)*(e-f);d=this.getPoint(d);
 h.push(i.copy(d).clone())}h.push(i.copy(this.points[b]).clone())}this.points=h}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate===true&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};
 THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
@@ -141,8 +141,8 @@ THREE.SpotLight=function(a,b,c,d,f){THREE.Light.call(this,a);this.position=new T
 this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
-Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function f(a,f,e,h,i,l,s){var r=document.createElement("canvas");a[f]=new THREE.Texture(r);a[f].sourceFile=e;if(h){a[f].repeat.set(h[0],h[1]);if(h[0]!==1)a[f].wrapS=THREE.RepeatWrapping;if(h[1]!==1)a[f].wrapT=THREE.RepeatWrapping}i&&a[f].offset.set(i[0],i[1]);if(l){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[l[0]]!==void 0)a[f].wrapS=h[l[0]];if(h[l[1]]!==
-void 0)a[f].wrapT=h[l[1]]}if(s)a[f].anisotropy=s;var u=a[f],a=b+"/"+e,f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);u.image.width=a;u.image.height=b;u.image.getContext("2d").drawImage(this,0,0,a,b)}else u.image=this;u.needsUpdate=true};f.crossOrigin=g.crossOrigin;f.src=a}function e(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var g=this,h="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,
+Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function f(a,f,e,h,i,l,t){var s=document.createElement("canvas");a[f]=new THREE.Texture(s);a[f].sourceFile=e;if(h){a[f].repeat.set(h[0],h[1]);if(h[0]!==1)a[f].wrapS=THREE.RepeatWrapping;if(h[1]!==1)a[f].wrapT=THREE.RepeatWrapping}i&&a[f].offset.set(i[0],i[1]);if(l){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[l[0]]!==void 0)a[f].wrapS=h[l[0]];if(h[l[1]]!==
+void 0)a[f].wrapT=h[l[1]]}if(t)a[f].anisotropy=t;var u=a[f],a=b+"/"+e,f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);u.image.width=a;u.image.height=b;u.image.getContext("2d").drawImage(this,0,0,a,b)}else u.image=this;u.needsUpdate=true};f.crossOrigin=g.crossOrigin;f.src=a}function e(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var g=this,h="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,
 wireframe:false};if(a.shading){var l=a.shading.toLowerCase();l==="phong"?h="MeshPhongMaterial":l==="basic"&&(h="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)i.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)i.transparent=a.transparent;if(a.depthTest!==void 0)i.depthTest=a.depthTest;if(a.depthWrite!==void 0)i.depthWrite=a.depthWrite;if(a.visible!==void 0)i.visible=a.visible;if(a.flipSided!==void 0)i.side=THREE.BackSide;if(a.doubleSided!==void 0)i.side=THREE.DoubleSide;
 if(a.wireframe!==void 0)i.wireframe=a.wireframe;if(a.vertexColors!==void 0)if(a.vertexColors=="face")i.vertexColors=THREE.FaceColors;else if(a.vertexColors)i.vertexColors=THREE.VertexColors;if(a.colorDiffuse)i.color=e(a.colorDiffuse);else if(a.DbgColor)i.color=a.DbgColor;if(a.colorSpecular)i.specular=e(a.colorSpecular);if(a.colorAmbient)i.ambient=e(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.mapDiffuseAnisotropy);a.mapLight&&b&&f(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&f(i,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&f(i,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&f(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap,
@@ -152,54 +152,55 @@ THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBas
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,f,e){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,f,d,e)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,f){var e=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;e.onreadystatechange=function(){if(e.readyState==4)if(e.status==200||e.status==0){var c=e.response;if(c===void 0)c=(new Uint8Array(e.responseBody)).buffer;THREE.BinaryLoader.prototype.createBinModel(c,b,d,a.materials)}else console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+e.status+"]");else if(e.readyState==3){if(f){h==0&&(h=e.getResponseHeader("Content-Length"));f({total:h,loaded:e.responseText.length})}}else e.readyState==
 2&&(h=e.getResponseHeader("Content-Length"))};e.open("GET",g,true);e.responseType="arraybuffer";e.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,i,l,j,n,m,q,o,p,s,r,u,v,t;function A(a){return a%4?4-a%4:0}function y(a,b){return(new Uint8Array(a,b,1))[0]}function B(a,b){return(new Uint32Array(a,b,1))[0]}function G(b,c){var d,f,e,g,h,i,j,l,n=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=n[d*3];e=n[d*3+1];g=n[d*3+2];h=S[f*2];f=S[f*2+1];i=S[e*2];j=S[e*2+1];e=S[g*2];l=S[g*2+1];g=P.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,f));m.push(new THREE.UV(i,j));m.push(new THREE.UV(e,
-l));g.push(m)}}function x(b,c){var d,f,e,g,h,i,j,l,n,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=o[d*4];e=o[d*4+1];g=o[d*4+2];h=o[d*4+3];i=S[f*2];f=S[f*2+1];j=S[e*2];n=S[e*2+1];l=S[g*2];m=S[g*2+1];g=S[h*2];e=S[h*2+1];h=P.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,f));p.push(new THREE.UV(j,n));p.push(new THREE.UV(l,m));p.push(new THREE.UV(g,e));h.push(p)}}function I(b,c,d){for(var f,e,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*3];e=c[d*3+1];g=c[d*3+2];h=i[d];
-P.faces.push(new THREE.Face3(f,e,g,null,null,h))}}function F(b,c,d){for(var f,e,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*4];e=c[d*4+1];g=c[d*4+2];h=c[d*4+3];i=j[d];P.faces.push(new THREE.Face4(f,e,g,h,null,null,i))}}function L(b,c,d,f){for(var e,g,h,i,j,l,n,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*3];g=c[f*3+1];h=c[f*3+2];j=d[f*3];l=d[f*3+1];n=d[f*3+2];i=m[f];var o=D[l*3],p=D[l*3+1];l=D[l*3+2];var q=D[n*3],
-t=D[n*3+1];n=D[n*3+2];P.faces.push(new THREE.Face3(e,g,h,[new THREE.Vector3(D[j*3],D[j*3+1],D[j*3+2]),new THREE.Vector3(o,p,l),new THREE.Vector3(q,t,n)],null,i))}}function E(b,c,d,f){for(var e,g,h,i,j,l,n,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*4];g=c[f*4+1];h=c[f*4+2];i=c[f*4+3];l=d[f*4];n=d[f*4+1];m=d[f*4+2];o=d[f*4+3];j=p[f];var q=D[n*3],t=D[n*3+1];n=D[n*3+2];var r=D[m*3],s=D[m*3+1];m=D[m*3+2];var u=D[o*3],v=D[o*3+1];o=D[o*3+2];P.faces.push(new THREE.Face4(e,
-g,h,i,[new THREE.Vector3(D[l*3],D[l*3+1],D[l*3+2]),new THREE.Vector3(q,t,n),new THREE.Vector3(r,s,m),new THREE.Vector3(u,v,o)],null,j))}}var P=this,H=0,D=[],S=[],R,J,N;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(P,d,b);t=a;J=H;b=new Uint8Array(t,J,12);p="";for(u=0;u<12;u++)p=p+String.fromCharCode(b[J+u]);c=y(t,J+12);y(t,J+13);y(t,J+14);y(t,J+15);f=y(t,J+16);i=y(t,J+17);l=y(t,J+18);j=y(t,J+19);n=B(t,J+20);m=B(t,J+20+4);q=B(t,J+20+8);o=B(t,J+20+12);p=B(t,J+20+16);s=B(t,J+20+20);r=
-B(t,J+20+24);u=B(t,J+20+28);b=B(t,J+20+32);v=B(t,J+20+36);t=B(t,J+20+40);H=H+c;J=f*3+j;N=f*4+j;R=o*J;c=p*(J+i*3);f=s*(J+l*3);j=r*(J+i*3+l*3);J=u*N;i=b*(N+i*4);l=v*(N+l*4);N=H;var H=new Float32Array(a,H,n*3),Y,K,fa,O;for(Y=0;Y<n;Y++){K=H[Y*3];fa=H[Y*3+1];O=H[Y*3+2];P.vertices.push(new THREE.Vector3(K,fa,O))}n=H=N+n*3*Float32Array.BYTES_PER_ELEMENT;if(m){H=new Int8Array(a,H,m*3);for(N=0;N<m;N++){Y=H[N*3];K=H[N*3+1];fa=H[N*3+2];D.push(Y/127,K/127,fa/127)}}H=n+m*3*Int8Array.BYTES_PER_ELEMENT;m=H=H+A(m*
-3);if(q){H=new Float32Array(a,H,q*2);for(n=0;n<q;n++){N=H[n*2];Y=H[n*2+1];S.push(N,Y)}}q=H=m+q*2*Float32Array.BYTES_PER_ELEMENT;R=q+R+A(o*2);m=R+c+A(p*2);c=m+f+A(s*2);f=c+j+A(r*2);J=f+J+A(u*2);j=J+i+A(b*2);i=j+l+A(v*2);if(s){l=m+s*Uint32Array.BYTES_PER_ELEMENT*3;I(s,m,l+s*Uint32Array.BYTES_PER_ELEMENT*3);G(s,l)}if(r){s=c+r*Uint32Array.BYTES_PER_ELEMENT*3;l=s+r*Uint32Array.BYTES_PER_ELEMENT*3;L(r,c,s,l+r*Uint32Array.BYTES_PER_ELEMENT*3);G(r,l)}if(v){r=j+v*Uint32Array.BYTES_PER_ELEMENT*4;F(v,j,r+v*
-Uint32Array.BYTES_PER_ELEMENT*4);x(v,r)}if(t){v=i+t*Uint32Array.BYTES_PER_ELEMENT*4;r=v+t*Uint32Array.BYTES_PER_ELEMENT*4;E(t,i,v,r+t*Uint32Array.BYTES_PER_ELEMENT*4);x(t,r)}o&&I(o,q,q+o*Uint32Array.BYTES_PER_ELEMENT*3);if(p){o=R+p*Uint32Array.BYTES_PER_ELEMENT*3;L(p,R,o,o+p*Uint32Array.BYTES_PER_ELEMENT*3)}u&&F(u,f,f+u*Uint32Array.BYTES_PER_ELEMENT*4);if(b){p=J+b*Uint32Array.BYTES_PER_ELEMENT*4;E(b,J,p,p+b*Uint32Array.BYTES_PER_ELEMENT*4)}this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&
-this.computeTangents()};f.prototype=Object.create(THREE.Geometry.prototype);b(new f(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,i,l,j,o,m,p,q,n,t,s,u,v,r;function A(a){return a%4?4-a%4:0}function x(a,b){return(new Uint8Array(a,b,1))[0]}function B(a,b){return(new Uint32Array(a,b,1))[0]}function C(b,c){var d,f,e,g,h,i,j,l,o=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=o[d*3];e=o[d*3+1];g=o[d*3+2];h=Q[f*2];f=Q[f*2+1];i=Q[e*2];j=Q[e*2+1];e=Q[g*2];l=Q[g*2+1];g=N.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,f));m.push(new THREE.UV(i,j));m.push(new THREE.UV(e,
+l));g.push(m)}}function z(b,c){var d,f,e,g,h,i,j,l,o,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=n[d*4];e=n[d*4+1];g=n[d*4+2];h=n[d*4+3];i=Q[f*2];f=Q[f*2+1];j=Q[e*2];o=Q[e*2+1];l=Q[g*2];m=Q[g*2+1];g=Q[h*2];e=Q[h*2+1];h=N.faceVertexUvs[0];var q=[];q.push(new THREE.UV(i,f));q.push(new THREE.UV(j,o));q.push(new THREE.UV(l,m));q.push(new THREE.UV(g,e));h.push(q)}}function F(b,c,d){for(var f,e,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*3];e=c[d*3+1];g=c[d*3+2];h=i[d];
+N.faces.push(new THREE.Face3(f,e,g,null,null,h))}}function G(b,c,d){for(var f,e,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*4];e=c[d*4+1];g=c[d*4+2];h=c[d*4+3];i=j[d];N.faces.push(new THREE.Face4(f,e,g,h,null,null,i))}}function M(b,c,d,f){for(var e,g,h,i,j,l,o,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*3];g=c[f*3+1];h=c[f*3+2];j=d[f*3];l=d[f*3+1];o=d[f*3+2];i=m[f];var n=K[l*3],q=K[l*3+1];l=K[l*3+2];var p=K[o*3],
+r=K[o*3+1];o=K[o*3+2];N.faces.push(new THREE.Face3(e,g,h,[new THREE.Vector3(K[j*3],K[j*3+1],K[j*3+2]),new THREE.Vector3(n,q,l),new THREE.Vector3(p,r,o)],null,i))}}function E(b,c,d,f){for(var e,g,h,i,j,l,o,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*4];g=c[f*4+1];h=c[f*4+2];i=c[f*4+3];l=d[f*4];o=d[f*4+1];m=d[f*4+2];n=d[f*4+3];j=q[f];var p=K[o*3],r=K[o*3+1];o=K[o*3+2];var s=K[m*3],t=K[m*3+1];m=K[m*3+2];var u=K[n*3],v=K[n*3+1];n=K[n*3+2];N.faces.push(new THREE.Face4(e,
+g,h,i,[new THREE.Vector3(K[l*3],K[l*3+1],K[l*3+2]),new THREE.Vector3(p,r,o),new THREE.Vector3(s,t,m),new THREE.Vector3(u,v,n)],null,j))}}var N=this,I=0,K=[],Q=[],H,L,aa;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(N,d,b);r=a;L=I;b=new Uint8Array(r,L,12);n="";for(u=0;u<12;u++)n=n+String.fromCharCode(b[L+u]);c=x(r,L+12);x(r,L+13);x(r,L+14);x(r,L+15);f=x(r,L+16);i=x(r,L+17);l=x(r,L+18);j=x(r,L+19);o=B(r,L+20);m=B(r,L+20+4);p=B(r,L+20+8);q=B(r,L+20+12);n=B(r,L+20+16);t=B(r,L+20+20);
+s=B(r,L+20+24);u=B(r,L+20+28);b=B(r,L+20+32);v=B(r,L+20+36);r=B(r,L+20+40);I=I+c;L=f*3+j;aa=f*4+j;H=q*L;c=n*(L+i*3);f=t*(L+l*3);j=s*(L+i*3+l*3);L=u*aa;i=b*(aa+i*4);l=v*(aa+l*4);aa=I;var I=new Float32Array(a,I,o*3),Z,J,ca,O;for(Z=0;Z<o;Z++){J=I[Z*3];ca=I[Z*3+1];O=I[Z*3+2];N.vertices.push(new THREE.Vector3(J,ca,O))}o=I=aa+o*3*Float32Array.BYTES_PER_ELEMENT;if(m){I=new Int8Array(a,I,m*3);for(aa=0;aa<m;aa++){Z=I[aa*3];J=I[aa*3+1];ca=I[aa*3+2];K.push(Z/127,J/127,ca/127)}}I=o+m*3*Int8Array.BYTES_PER_ELEMENT;
+m=I=I+A(m*3);if(p){I=new Float32Array(a,I,p*2);for(o=0;o<p;o++){aa=I[o*2];Z=I[o*2+1];Q.push(aa,Z)}}p=I=m+p*2*Float32Array.BYTES_PER_ELEMENT;H=p+H+A(q*2);m=H+c+A(n*2);c=m+f+A(t*2);f=c+j+A(s*2);L=f+L+A(u*2);j=L+i+A(b*2);i=j+l+A(v*2);if(t){l=m+t*Uint32Array.BYTES_PER_ELEMENT*3;F(t,m,l+t*Uint32Array.BYTES_PER_ELEMENT*3);C(t,l)}if(s){t=c+s*Uint32Array.BYTES_PER_ELEMENT*3;l=t+s*Uint32Array.BYTES_PER_ELEMENT*3;M(s,c,t,l+s*Uint32Array.BYTES_PER_ELEMENT*3);C(s,l)}if(v){s=j+v*Uint32Array.BYTES_PER_ELEMENT*
+4;G(v,j,s+v*Uint32Array.BYTES_PER_ELEMENT*4);z(v,s)}if(r){v=i+r*Uint32Array.BYTES_PER_ELEMENT*4;s=v+r*Uint32Array.BYTES_PER_ELEMENT*4;E(r,i,v,s+r*Uint32Array.BYTES_PER_ELEMENT*4);z(r,s)}q&&F(q,p,p+q*Uint32Array.BYTES_PER_ELEMENT*3);if(n){q=H+n*Uint32Array.BYTES_PER_ELEMENT*3;M(n,H,q,q+n*Uint32Array.BYTES_PER_ELEMENT*3)}u&&G(u,f,f+u*Uint32Array.BYTES_PER_ELEMENT*4);if(b){n=L+b*Uint32Array.BYTES_PER_ELEMENT*4;E(b,L,n,n+b*Uint32Array.BYTES_PER_ELEMENT*4)}this.computeCentroids();this.computeFaceNormals();
+THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=Object.create(THREE.Geometry.prototype);b(new f(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b){var c=this;b===void 0&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},false);b.addEventListener("error",function(){c.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(c.crossOrigin)b.crossOrigin=c.crossOrigin;b.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);
 THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,f){var e=new XMLHttpRequest,g=0;e.onreadystatechange=function(){if(e.readyState===e.DONE)if(e.status===200||e.status===0){if(e.responseText){var h=JSON.parse(e.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+e.status+"]");else if(e.readyState===e.LOADING){if(f){g===0&&(g=e.getResponseHeader("Content-Length"));
 f({total:g,loaded:e.responseText.length})}}else e.readyState===e.HEADERS_RECEIVED&&(g=e.getResponseHeader("Content-Length"))};e.open("GET",b,true);e.overrideMimeType&&e.overrideMimeType("application/json; charset=x-user-defined");e.setRequestHeader("Content-Type","application/json");e.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);var e,g,h,i,l,j,n,m,q,o,p,s,r,u,v=a.faces;q=a.vertices;var t=a.normals,A=a.colors,y=0;for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&y++;for(e=0;e<y;e++){d.faceUvs[e]=[];d.faceVertexUvs[e]=[]}c=0;for(i=q.length;c<i;){l=new THREE.Vector3;l.x=q[c++]*f;l.y=q[c++]*f;l.z=q[c++]*f;d.vertices.push(l)}c=0;for(i=v.length;c<i;){q=v[c++];l=q&1;h=q&2;e=q&4;g=q&8;n=q&
-16;j=q&32;o=q&64;q=q&128;if(l){p=new THREE.Face4;p.a=v[c++];p.b=v[c++];p.c=v[c++];p.d=v[c++];l=4}else{p=new THREE.Face3;p.a=v[c++];p.b=v[c++];p.c=v[c++];l=3}if(h){h=v[c++];p.materialIndex=h}h=d.faces.length;if(e)for(e=0;e<y;e++){s=a.uvs[e];m=v[c++];u=s[m*2];m=s[m*2+1];d.faceUvs[e][h]=new THREE.UV(u,m)}if(g)for(e=0;e<y;e++){s=a.uvs[e];r=[];for(g=0;g<l;g++){m=v[c++];u=s[m*2];m=s[m*2+1];r[g]=new THREE.UV(u,m)}d.faceVertexUvs[e][h]=r}if(n){n=v[c++]*3;g=new THREE.Vector3;g.x=t[n++];g.y=t[n++];g.z=t[n];
-p.normal=g}if(j)for(e=0;e<l;e++){n=v[c++]*3;g=new THREE.Vector3;g.x=t[n++];g.y=t[n++];g.z=t[n];p.vertexNormals.push(g)}if(o){j=v[c++];j=new THREE.Color(A[j]);p.color=j}if(q)for(e=0;e<l;e++){j=v[c++];j=new THREE.Color(A[j]);p.vertexColors.push(j)}d.faces.push(p)}if(a.skinWeights){c=0;for(i=a.skinWeights.length;c<i;c=c+2){v=a.skinWeights[c];t=a.skinWeights[c+1];d.skinWeights.push(new THREE.Vector4(v,t,0,0))}}if(a.skinIndices){c=0;for(i=a.skinIndices.length;c<i;c=c+2){v=a.skinIndices[c];t=a.skinIndices[c+
-1];d.skinIndices.push(new THREE.Vector4(v,t,0,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets!==void 0){c=0;for(i=a.morphTargets.length;c<i;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];A=d.morphTargets[c].vertices;y=a.morphTargets[c].vertices;v=0;for(t=y.length;v<t;v=v+3){q=new THREE.Vector3;q.x=y[v]*f;q.y=y[v+1]*f;q.z=y[v+2]*f;A.push(q)}}}if(a.morphColors!==void 0){c=0;for(i=a.morphColors.length;c<i;c++){d.morphColors[c]={};
-d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];t=d.morphColors[c].colors;A=a.morphColors[c].colors;f=0;for(v=A.length;f<v;f=f+3){y=new THREE.Color(16755200);y.setRGB(A[f],A[f+1],A[f+2]);t.push(y)}}}d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);var e,g,h,i,l,j,o,m,p,q,n,t,s,u,v=a.faces;p=a.vertices;var r=a.normals,A=a.colors,x=0;for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&x++;for(e=0;e<x;e++){d.faceUvs[e]=[];d.faceVertexUvs[e]=[]}c=0;for(i=p.length;c<i;){l=new THREE.Vector3;l.x=p[c++]*f;l.y=p[c++]*f;l.z=p[c++]*f;d.vertices.push(l)}c=0;for(i=v.length;c<i;){p=v[c++];l=p&1;h=p&2;e=p&4;g=p&8;o=p&
+16;j=p&32;q=p&64;p=p&128;if(l){n=new THREE.Face4;n.a=v[c++];n.b=v[c++];n.c=v[c++];n.d=v[c++];l=4}else{n=new THREE.Face3;n.a=v[c++];n.b=v[c++];n.c=v[c++];l=3}if(h){h=v[c++];n.materialIndex=h}h=d.faces.length;if(e)for(e=0;e<x;e++){t=a.uvs[e];m=v[c++];u=t[m*2];m=t[m*2+1];d.faceUvs[e][h]=new THREE.UV(u,m)}if(g)for(e=0;e<x;e++){t=a.uvs[e];s=[];for(g=0;g<l;g++){m=v[c++];u=t[m*2];m=t[m*2+1];s[g]=new THREE.UV(u,m)}d.faceVertexUvs[e][h]=s}if(o){o=v[c++]*3;g=new THREE.Vector3;g.x=r[o++];g.y=r[o++];g.z=r[o];
+n.normal=g}if(j)for(e=0;e<l;e++){o=v[c++]*3;g=new THREE.Vector3;g.x=r[o++];g.y=r[o++];g.z=r[o];n.vertexNormals.push(g)}if(q){j=v[c++];j=new THREE.Color(A[j]);n.color=j}if(p)for(e=0;e<l;e++){j=v[c++];j=new THREE.Color(A[j]);n.vertexColors.push(j)}d.faces.push(n)}if(a.skinWeights){c=0;for(i=a.skinWeights.length;c<i;c=c+2){v=a.skinWeights[c];r=a.skinWeights[c+1];d.skinWeights.push(new THREE.Vector4(v,r,0,0))}}if(a.skinIndices){c=0;for(i=a.skinIndices.length;c<i;c=c+2){v=a.skinIndices[c];r=a.skinIndices[c+
+1];d.skinIndices.push(new THREE.Vector4(v,r,0,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets!==void 0){c=0;for(i=a.morphTargets.length;c<i;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];A=d.morphTargets[c].vertices;x=a.morphTargets[c].vertices;v=0;for(r=x.length;v<r;v=v+3){p=new THREE.Vector3;p.x=x[v]*f;p.y=x[v+1]*f;p.z=x[v+2]*f;A.push(p)}}}if(a.morphColors!==void 0){c=0;for(i=a.morphColors.length;c<i;c++){d.morphColors[c]={};
+d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];r=d.morphColors[c].colors;A=a.morphColors[c].colors;f=0;for(v=A.length;f<v;f=f+3){x=new THREE.Color(16755200);x.setRGB(A[f],A[f+1],A[f+2]);r.push(x)}}}d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
 THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a){var b=this,c=null;if(b.path===null){var d=a.split("/");d.pop();b.path=d.length<1?".":d.join("/")}d=new XMLHttpRequest;d.addEventListener("load",function(d){d.target.responseText?c=b.parse(JSON.parse(d.target.responseText),f):b.dispatchEvent({type:"error",message:"Invalid file ["+a+"]"})},false);d.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);d.open("GET",
 a,true);d.setRequestHeader("Content-Type","application/json");d.send(null);var f=new THREE.LoadingMonitor;f.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});f.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;if(a.materials){d.materials=[];for(var e=0;e<a.materials.length;++e){var g=a.materials[e],h=function(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a},i=function(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))},
 l=function(a,d,f,e,g,j){a[d]=new THREE.Texture;a[d].sourceFile=f;if(e){a[d].repeat.set(e[0],e[1]);if(e[0]!==1)a[d].wrapS=THREE.RepeatWrapping;if(e[1]!==1)a[d].wrapT=THREE.RepeatWrapping}g&&a[d].offset.set(g[0],g[1]);if(j){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[j[0]]!==void 0)a[d].wrapS=e[j[0]];if(e[j[1]]!==void 0)a[d].wrapT=e[j[1]]}var l=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!h(a.width)||!h(a.height)){var b=i(a.width),c=
-i(a.height);l.image=document.createElement("canvas");l.image.width=b;l.image.height=c;l.image.getContext("2d").drawImage(a,0,0,b,c)}else l.image=a;l.needsUpdate=true});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+f);b&&b.add(a)},j=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},n="MeshLambertMaterial",m={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:false};if(g.shading){var q=g.shading.toLowerCase();q==="phong"?n="MeshPhongMaterial":q==="basic"&&(n=
+i(a.height);l.image=document.createElement("canvas");l.image.width=b;l.image.height=c;l.image.getContext("2d").drawImage(a,0,0,b,c)}else l.image=a;l.needsUpdate=true});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+f);b&&b.add(a)},j=function(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255},o="MeshLambertMaterial",m={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:false};if(g.shading){var p=g.shading.toLowerCase();p==="phong"?o="MeshPhongMaterial":p==="basic"&&(o=
 "MeshBasicMaterial")}if(g.blending!==void 0&&THREE[g.blending]!==void 0)m.blending=THREE[g.blending];if(g.transparent!==void 0||g.opacity<1)m.transparent=g.transparent;if(g.depthTest!==void 0)m.depthTest=g.depthTest;if(g.depthWrite!==void 0)m.depthWrite=g.depthWrite;if(g.vertexColors!==void 0)if(g.vertexColors=="face")m.vertexColors=THREE.FaceColors;else if(g.vertexColors)m.vertexColors=THREE.VertexColors;if(g.colorDiffuse)m.color=j(g.colorDiffuse);else if(g.DbgColor)m.color=g.DbgColor;if(g.colorSpecular)m.specular=
 j(g.colorSpecular);if(g.colorAmbient)m.ambient=j(g.colorAmbient);if(g.transparency)m.opacity=g.transparency;if(g.specularCoef)m.shininess=g.specularCoef;if(g.visible!==void 0)m.visible=g.visible;if(g.flipSided!==void 0)m.side=THREE.BackSide;if(g.doubleSided!==void 0)m.side=THREE.DoubleSide;if(g.wireframe!==void 0)m.wireframe=g.wireframe;g.mapDiffuse&&l(m,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&l(m,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,
 g.mapLightWrap);g.mapBump&&l(m,"bumpMap",g.mapBump,g.mapBumpRepeat,g.mapBumpOffset,g.mapBumpWrap);g.mapNormal&&l(m,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&l(m,"specularMap",g.mapSpecular,g.mapSpecularRepeat,g.mapSpecularOffset,g.mapSpecularWrap);if(g.mapNormal){l=THREE.ShaderUtils.lib.normal;j=THREE.UniformsUtils.clone(l.uniforms);j.tNormal.value=m.normalMap;g.mapNormalFactor&&j.uNormalScale.value.set(g.mapNormalFactor,g.mapNormalFactor);if(m.map){j.tDiffuse.value=
-m.map;j.enableDiffuse.value=true}if(m.specularMap){j.tSpecular.value=m.specularMap;j.enableSpecular.value=true}if(m.lightMap){j.tAO.value=m.lightMap;j.enableAO.value=true}j.uDiffuseColor.value.setHex(m.color);j.uSpecularColor.value.setHex(m.specular);j.uAmbientColor.value.setHex(m.ambient);j.uShininess.value=m.shininess;if(m.opacity!==void 0)j.uOpacity.value=m.opacity;m=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:j,lights:true,fog:true})}else m=new THREE[n](m);
-if(g.DbgName!==void 0)m.name=g.DbgName;d.materials[e]=m}}var g=a.faces,o=a.vertices,m=a.normals,l=a.colors,j=0;if(a.uvs)for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&j++;for(e=0;e<j;e++){d.faceUvs[e]=[];d.faceVertexUvs[e]=[]}n=0;for(q=o.length;n<q;){var p=new THREE.Vector3;p.x=o[n++]*f;p.y=o[n++]*f;p.z=o[n++]*f;d.vertices.push(p)}n=0;for(q=g.length;n<q;){var s=g[n++],r=s&2,e=s&4,u=s&8,v=s&16,o=s&32,t=s&64,p=s&128;if(s&1){s=new THREE.Face4;s.a=g[n++];s.b=g[n++];s.c=g[n++];s.d=g[n++];var A=4}else{s=new THREE.Face3;
-s.a=g[n++];s.b=g[n++];s.c=g[n++];A=3}if(r){r=g[n++];s.materialIndex=r}var y=d.faces.length;if(e)for(e=0;e<j;e++){var B=a.uvs[e],r=g[n++],G=B[r*2],r=B[r*2+1];d.faceUvs[e][y]=new THREE.UV(G,r)}if(u)for(e=0;e<j;e++){for(var B=a.uvs[e],u=[],x=0;x<A;x++){r=g[n++];G=B[r*2];r=B[r*2+1];u[x]=new THREE.UV(G,r)}d.faceVertexUvs[e][y]=u}if(v){v=g[n++]*3;r=new THREE.Vector3;r.x=m[v++];r.y=m[v++];r.z=m[v];s.normal=r}if(o)for(e=0;e<A;e++){v=g[n++]*3;r=new THREE.Vector3;r.x=m[v++];r.y=m[v++];r.z=m[v];s.vertexNormals.push(r)}if(t){o=
-g[n++];s.color=new THREE.Color(l[o])}if(p)for(e=0;e<A;e++){o=g[n++];s.vertexColors.push(new THREE.Color(l[o]))}d.faces.push(s)}if(a.skinWeights){e=0;for(g=a.skinWeights.length;e<g;e=e+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[e],a.skinWeights[e+1],0,0))}if(a.skinIndices){e=0;for(g=a.skinIndices.length;e<g;e=e+2){m=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[e],a.skinIndices[e+1],m,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){e=0;for(g=a.morphTargets.length;e<
-g;e++){d.morphTargets[e]={};d.morphTargets[e].name=a.morphTargets[e].name;d.morphTargets[e].vertices=[];m=d.morphTargets[e].vertices;l=a.morphTargets[e].vertices;r=0;for(j=l.length;r<j;r=r+3){p=new THREE.Vector3;p.x=l[r]*f;p.y=l[r+1]*f;p.z=l[r+2]*f;m.push(p)}}}if(a.morphColors){e=0;for(g=a.morphColors.length;e<g;e++){d.morphColors[e]={};d.morphColors[e].name=a.morphColors[e].name;d.morphColors[e].colors=[];f=d.morphColors[e].colors;l=a.morphColors[e].colors;m=0;for(j=l.length;m<j;m=m+3){n=new THREE.Color(16755200);
-n.setRGB(l[m],l[m+1],l[m+2]);f.push(n)}}}d.computeCentroids();d.computeFaceNormals();return 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;
+m.map;j.enableDiffuse.value=true}if(m.specularMap){j.tSpecular.value=m.specularMap;j.enableSpecular.value=true}if(m.lightMap){j.tAO.value=m.lightMap;j.enableAO.value=true}j.uDiffuseColor.value.setHex(m.color);j.uSpecularColor.value.setHex(m.specular);j.uAmbientColor.value.setHex(m.ambient);j.uShininess.value=m.shininess;if(m.opacity!==void 0)j.uOpacity.value=m.opacity;m=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:j,lights:true,fog:true})}else m=new THREE[o](m);
+if(g.DbgName!==void 0)m.name=g.DbgName;d.materials[e]=m}}var g=a.faces,q=a.vertices,m=a.normals,l=a.colors,j=0;if(a.uvs)for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&j++;for(e=0;e<j;e++){d.faceUvs[e]=[];d.faceVertexUvs[e]=[]}o=0;for(p=q.length;o<p;){var n=new THREE.Vector3;n.x=q[o++]*f;n.y=q[o++]*f;n.z=q[o++]*f;d.vertices.push(n)}o=0;for(p=g.length;o<p;){var t=g[o++],s=t&2,e=t&4,u=t&8,v=t&16,q=t&32,r=t&64,n=t&128;if(t&1){t=new THREE.Face4;t.a=g[o++];t.b=g[o++];t.c=g[o++];t.d=g[o++];var A=4}else{t=new THREE.Face3;
+t.a=g[o++];t.b=g[o++];t.c=g[o++];A=3}if(s){s=g[o++];t.materialIndex=s}var x=d.faces.length;if(e)for(e=0;e<j;e++){var B=a.uvs[e],s=g[o++],C=B[s*2],s=B[s*2+1];d.faceUvs[e][x]=new THREE.UV(C,s)}if(u)for(e=0;e<j;e++){for(var B=a.uvs[e],u=[],z=0;z<A;z++){s=g[o++];C=B[s*2];s=B[s*2+1];u[z]=new THREE.UV(C,s)}d.faceVertexUvs[e][x]=u}if(v){v=g[o++]*3;s=new THREE.Vector3;s.x=m[v++];s.y=m[v++];s.z=m[v];t.normal=s}if(q)for(e=0;e<A;e++){v=g[o++]*3;s=new THREE.Vector3;s.x=m[v++];s.y=m[v++];s.z=m[v];t.vertexNormals.push(s)}if(r){q=
+g[o++];t.color=new THREE.Color(l[q])}if(n)for(e=0;e<A;e++){q=g[o++];t.vertexColors.push(new THREE.Color(l[q]))}d.faces.push(t)}if(a.skinWeights){e=0;for(g=a.skinWeights.length;e<g;e=e+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[e],a.skinWeights[e+1],0,0))}if(a.skinIndices){e=0;for(g=a.skinIndices.length;e<g;e=e+2){m=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[e],a.skinIndices[e+1],m,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){e=0;for(g=a.morphTargets.length;e<
+g;e++){d.morphTargets[e]={};d.morphTargets[e].name=a.morphTargets[e].name;d.morphTargets[e].vertices=[];m=d.morphTargets[e].vertices;l=a.morphTargets[e].vertices;s=0;for(j=l.length;s<j;s=s+3){n=new THREE.Vector3;n.x=l[s]*f;n.y=l[s+1]*f;n.z=l[s+2]*f;m.push(n)}}}if(a.morphColors){e=0;for(g=a.morphColors.length;e<g;e++){d.morphColors[e]={};d.morphColors[e].name=a.morphColors[e].name;d.morphColors[e].colors=[];f=d.morphColors[e].colors;l=a.morphColors[e].colors;m=0;for(j=l.length;m<j;m=m+3){o=new THREE.Color(16755200);
+o.setRGB(l[m],l[m+1],l[m+2]);f.push(o)}}}d.computeCentroids();d.computeFaceNormals();return d}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlerMap={};this.addGeometryHandler("ascii_mesh",THREE.JSONLoader);this.addGeometryHandler("bin_mesh",THREE.BinaryLoader)};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState===4)if(d.status===200||d.status===0){var f=JSON.parse(d.responseText);c.parse(f,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.overrideMimeType&&d.overrideMimeType("application/json; charset=x-user-defined");d.setRequestHeader("Content-Type","application/json");d.send(null)};
-THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function f(a,b){var c;for(m in b)if(J.objects[m]===void 0){r=b[m];if(r.geometry!==void 0){if(F=J.geometries[r.geometry]){c=false;L=J.materials[r.materials[0]];(c=L instanceof THREE.ShaderMaterial)&&F.computeTangents();A=r.position;y=r.rotation;B=r.quaternion;G=r.scale;u=r.matrix;B=0;r.materials.length==0&&(L=new THREE.MeshFaceMaterial);r.materials.length>1&&(L=new THREE.MeshFaceMaterial);c=new THREE.Mesh(F,
-L);c.name=m;if(u){c.matrixAutoUpdate=false;c.matrix.set(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15])}else{c.position.set(A[0],A[1],A[2]);if(B){c.quaternion.set(B[0],B[1],B[2],B[3]);c.useQuaternion=true}else c.rotation.set(y[0],y[1],y[2]);c.scale.set(G[0],G[1],G[2])}c.visible=r.visible;c.castShadow=r.castShadow;c.receiveShadow=r.receiveShadow;a.add(c);J.objects[m]=c}}else{A=r.position;y=r.rotation;B=r.quaternion;G=r.scale;B=0;c=new THREE.Object3D;c.name=m;
-c.position.set(A[0],A[1],A[2]);if(B){c.quaternion.set(B[0],B[1],B[2],B[3]);c.useQuaternion=true}else c.rotation.set(y[0],y[1],y[2]);c.scale.set(G[0],G[1],G[2]);c.visible=r.visible!==void 0?r.visible:false;a.add(c);J.objects[m]=c;J.empties[m]=c}if(r.properties!==void 0)for(var d in r.properties)c.properties[d]=r.properties[d];r.children!==void 0&&f(c,r.children)}}function e(a){return function(b){J.geometries[a]=b;f(J.scene,N.objects);H=H-1;i.onLoadComplete();h()}}function g(a){return function(b){J.geometries[a]=
-b}}function h(){i.callbackProgress({totalModels:S,totalTextures:R,loadedModels:S-H,loadedTextures:R-D},J);i.onLoadProgress();H===0&&D===0&&b(J)}var i=this,l=THREE.Loader.prototype.extractUrlBase(c),j,n,m,q,o,p,s,r,u,v,t,A,y,B,G,x,I,F,L,E,P,H,D,S,R,J,N=a,c=new THREE.BinaryLoader,Y=new THREE.JSONLoader,K=new THREE.CTMLoader;D=H=0;J={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(N.transform){a=N.transform.position;v=N.transform.rotation;
-x=N.transform.scale;a&&J.scene.position.set(a[0],a[1],a[2]);v&&J.scene.rotation.set(v[0],v[1],v[2]);x&&J.scene.scale.set(x[0],x[1],x[2]);if(a||v||x){J.scene.updateMatrix();J.scene.updateMatrixWorld()}}a=function(a){return function(){D=D-a;h();i.onLoadComplete()}};for(o in N.cameras){x=N.cameras[o];x.type==="perspective"?E=new THREE.PerspectiveCamera(x.fov,x.aspect,x.near,x.far):x.type==="ortho"&&(E=new THREE.OrthographicCamera(x.left,x.right,x.top,x.bottom,x.near,x.far));A=x.position;v=x.target;x=
-x.up;E.position.set(A[0],A[1],A[2]);E.target=new THREE.Vector3(v[0],v[1],v[2]);x&&E.up.set(x[0],x[1],x[2]);J.cameras[o]=E}for(q in N.lights){v=N.lights[q];o=v.color!==void 0?v.color:16777215;E=v.intensity!==void 0?v.intensity:1;if(v.type==="directional"){A=v.direction;t=new THREE.DirectionalLight(o,E);t.position.set(A[0],A[1],A[2]);t.position.normalize()}else if(v.type==="point"){A=v.position;t=v.distance;t=new THREE.PointLight(o,E,t);t.position.set(A[0],A[1],A[2])}else v.type==="ambient"&&(t=new THREE.AmbientLight(o));
-J.scene.add(t);J.lights[q]=t}for(p in N.fogs){q=N.fogs[p];q.type==="linear"?P=new THREE.Fog(0,q.near,q.far):q.type==="exp2"&&(P=new THREE.FogExp2(0,q.density));x=q.color;P.color.setRGB(x[0],x[1],x[2]);J.fogs[p]=P}if(J.cameras&&N.defaults.camera)J.currentCamera=J.cameras[N.defaults.camera];if(J.fogs&&N.defaults.fog)J.scene.fog=J.fogs[N.defaults.fog];x=N.defaults.bgcolor;J.bgColor=new THREE.Color;J.bgColor.setRGB(x[0],x[1],x[2]);J.bgColorAlpha=N.defaults.bgalpha;for(j in N.geometries){p=N.geometries[j];
-if(p.type==="bin_mesh"||p.type==="ascii_mesh"||p.type==="ctm_mesh"){H=H+1;i.onLoadStart()}}S=H;for(j in N.geometries){p=N.geometries[j];if(p.type==="cube"){F=new THREE.CubeGeometry(p.width,p.height,p.depth,p.segmentsWidth,p.segmentsHeight,p.segmentsDepth,null,p.flipped,p.sides);J.geometries[j]=F}else if(p.type==="plane"){F=new THREE.PlaneGeometry(p.width,p.height,p.segmentsWidth,p.segmentsHeight);J.geometries[j]=F}else if(p.type==="sphere"){F=new THREE.SphereGeometry(p.radius,p.segmentsWidth,p.segmentsHeight);
-J.geometries[j]=F}else if(p.type==="cylinder"){F=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs);J.geometries[j]=F}else if(p.type==="torus"){F=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,p.segmentsT);J.geometries[j]=F}else if(p.type==="icosahedron"){F=new THREE.IcosahedronGeometry(p.radius,p.subdivisions);J.geometries[j]=F}else if(p.type==="ctm_mesh"){P=N.useWorker!==void 0?N.useWorker:true;q=N.useBuffers!==void 0?N.useBuffers:true;K.load(d(p.url,N.urlBaseType),
-e(j),P,q)}else if(p.type==="bin_mesh")c.load(d(p.url,N.urlBaseType),e(j));else if(p.type==="ascii_mesh")Y.load(d(p.url,N.urlBaseType),e(j));else if(p.type==="embedded_mesh"){p=N.embeds[p.id];p.metadata=N.metadata;p&&Y.createModel(p,g(j),"")}}for(s in N.textures){j=N.textures[s];if(j.url instanceof Array){D=D+j.url.length;for(c=0;c<j.url.length;c++)i.onLoadStart()}else{D=D+1;i.onLoadStart()}}R=D;for(s in N.textures){j=N.textures[s];if(j.mapping!==void 0&&THREE[j.mapping]!==void 0)j.mapping=new THREE[j.mapping];
-if(j.url instanceof Array){c=j.url.length;Y=[];for(K=0;K<c;K++)Y[K]=d(j.url[K],N.urlBaseType);c=THREE.ImageUtils.loadTextureCube(Y,j.mapping,a(c))}else{c=THREE.ImageUtils.loadTexture(d(j.url,N.urlBaseType),j.mapping,a(1));if(THREE[j.minFilter]!==void 0)c.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!==void 0)c.magFilter=THREE[j.magFilter];if(j.anisotropy)c.anisotropy=j.anisotropy;if(j.repeat){c.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!==1)c.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!==
-1)c.wrapT=THREE.RepeatWrapping}j.offset&&c.offset.set(j.offset[0],j.offset[1]);if(j.wrap){Y={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Y[j.wrap[0]]!==void 0)c.wrapS=Y[j.wrap[0]];if(Y[j.wrap[1]]!==void 0)c.wrapT=Y[j.wrap[1]]}}J.textures[s]=c}for(n in N.materials){u=N.materials[n];for(I in u.parameters)if(I==="envMap"||I==="map"||I==="lightMap"||I==="bumpMap")u.parameters[I]=J.textures[u.parameters[I]];else if(I==="shading")u.parameters[I]=u.parameters[I]=="flat"?THREE.FlatShading:
-THREE.SmoothShading;else if(I==="blending")u.parameters[I]=u.parameters[I]in THREE?THREE[u.parameters[I]]:THREE.NormalBlending;else if(I==="combine")u.parameters[I]=u.parameters[I]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(I==="vertexColors")if(u.parameters[I]=="face")u.parameters[I]=THREE.FaceColors;else if(u.parameters[I])u.parameters[I]=THREE.VertexColors;if(u.parameters.opacity!==void 0&&u.parameters.opacity<1)u.parameters.transparent=true;if(u.parameters.normalMap){s=
-THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(s.uniforms);j=u.parameters.color;c=u.parameters.specular;Y=u.parameters.ambient;K=u.parameters.shininess;a.tNormal.value=J.textures[u.parameters.normalMap];u.parameters.normalScale&&a.uNormalScale.value.set(u.parameters.normalScale[0],u.parameters.normalScale[1]);if(u.parameters.map){a.tDiffuse.value=u.parameters.map;a.enableDiffuse.value=true}if(u.parameters.envMap){a.tCube.value=u.parameters.envMap;a.enableReflection.value=true;a.uReflectivity.value=
-u.parameters.reflectivity}if(u.parameters.lightMap){a.tAO.value=u.parameters.lightMap;a.enableAO.value=true}if(u.parameters.specularMap){a.tSpecular.value=J.textures[u.parameters.specularMap];a.enableSpecular.value=true}if(u.parameters.displacementMap){a.tDisplacement.value=J.textures[u.parameters.displacementMap];a.enableDisplacement.value=true;a.uDisplacementBias.value=u.parameters.displacementBias;a.uDisplacementScale.value=u.parameters.displacementScale}a.uDiffuseColor.value.setHex(j);a.uSpecularColor.value.setHex(c);
-a.uAmbientColor.value.setHex(Y);a.uShininess.value=K;if(u.parameters.opacity)a.uOpacity.value=u.parameters.opacity;L=new THREE.ShaderMaterial({fragmentShader:s.fragmentShader,vertexShader:s.vertexShader,uniforms:a,lights:true,fog:true})}else L=new THREE[u.type](u.parameters);J.materials[n]=L}f(J.scene,N.objects);i.callbackSync(J);h()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
+THREE.SceneLoader.prototype.addGeometryHandler=function(a,b){this.geometryHandlerMap[a]={loaderClass:b}};
+THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function f(a,b){var c;for(m in b)if(H.objects[m]===void 0){s=b[m];if(s.geometry!==void 0){if(F=H.geometries[s.geometry]){c=false;G=H.materials[s.materials[0]];(c=G instanceof THREE.ShaderMaterial)&&F.computeTangents();r=s.position;A=s.rotation;x=s.quaternion;B=s.scale;u=s.matrix;x=0;s.materials.length==0&&(G=new THREE.MeshFaceMaterial);s.materials.length>1&&(G=new THREE.MeshFaceMaterial);c=new THREE.Mesh(F,
+G);c.name=m;if(u){c.matrixAutoUpdate=false;c.matrix.set(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15])}else{c.position.set(r[0],r[1],r[2]);if(x){c.quaternion.set(x[0],x[1],x[2],x[3]);c.useQuaternion=true}else c.rotation.set(A[0],A[1],A[2]);c.scale.set(B[0],B[1],B[2])}c.visible=s.visible;c.castShadow=s.castShadow;c.receiveShadow=s.receiveShadow;a.add(c);H.objects[m]=c}}else{r=s.position;A=s.rotation;x=s.quaternion;B=s.scale;x=0;c=new THREE.Object3D;c.name=m;
+c.position.set(r[0],r[1],r[2]);if(x){c.quaternion.set(x[0],x[1],x[2],x[3]);c.useQuaternion=true}else c.rotation.set(A[0],A[1],A[2]);c.scale.set(B[0],B[1],B[2]);c.visible=s.visible!==void 0?s.visible:false;a.add(c);H.objects[m]=c;H.empties[m]=c}if(s.properties!==void 0)for(var d in s.properties)c.properties[d]=s.properties[d];s.children!==void 0&&f(c,s.children)}}function e(a){return function(b){H.geometries[a]=b;f(H.scene,L.objects);N=N-1;i.onLoadComplete();h()}}function g(a){return function(b){H.geometries[a]=
+b}}function h(){i.callbackProgress({totalModels:K,totalTextures:Q,loadedModels:K-N,loadedTextures:Q-I},H);i.onLoadProgress();N===0&&I===0&&b(H)}var i=this,l=THREE.Loader.prototype.extractUrlBase(c),j,o,m,p,q,n,t,s,u,v,r,A,x,B,C,z,F,G,M,E,N,I,K,Q,H,L=a;for(C in this.geometryHandlerMap)this.geometryHandlerMap[C].loaderObject=new this.geometryHandlerMap[C].loaderClass;I=N=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(L.transform){a=
+L.transform.position;c=L.transform.rotation;C=L.transform.scale;a&&H.scene.position.set(a[0],a[1],a[2]);c&&H.scene.rotation.set(c[0],c[1],c[2]);C&&H.scene.scale.set(C[0],C[1],C[2]);if(a||c||C){H.scene.updateMatrix();H.scene.updateMatrixWorld()}}a=function(a){return function(){I=I-a;h();i.onLoadComplete()}};for(q in L.cameras){C=L.cameras[q];C.type==="perspective"?M=new THREE.PerspectiveCamera(C.fov,C.aspect,C.near,C.far):C.type==="ortho"&&(M=new THREE.OrthographicCamera(C.left,C.right,C.top,C.bottom,
+C.near,C.far));r=C.position;c=C.target;C=C.up;M.position.set(r[0],r[1],r[2]);M.target=new THREE.Vector3(c[0],c[1],c[2]);C&&M.up.set(C[0],C[1],C[2]);H.cameras[q]=M}for(p in L.lights){c=L.lights[p];q=c.color!==void 0?c.color:16777215;M=c.intensity!==void 0?c.intensity:1;if(c.type==="directional"){r=c.direction;v=new THREE.DirectionalLight(q,M);v.position.set(r[0],r[1],r[2]);v.position.normalize()}else if(c.type==="point"){r=c.position;v=c.distance;v=new THREE.PointLight(q,M,v);v.position.set(r[0],r[1],
+r[2])}else c.type==="ambient"&&(v=new THREE.AmbientLight(q));H.scene.add(v);H.lights[p]=v}for(n in L.fogs){p=L.fogs[n];p.type==="linear"?E=new THREE.Fog(0,p.near,p.far):p.type==="exp2"&&(E=new THREE.FogExp2(0,p.density));C=p.color;E.color.setRGB(C[0],C[1],C[2]);H.fogs[n]=E}if(H.cameras&&L.defaults.camera)H.currentCamera=H.cameras[L.defaults.camera];if(H.fogs&&L.defaults.fog)H.scene.fog=H.fogs[L.defaults.fog];C=L.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(C[0],C[1],C[2]);H.bgColorAlpha=
+L.defaults.bgalpha;for(j in L.geometries){n=L.geometries[j];if(n.type in this.geometryHandlerMap){N=N+1;i.onLoadStart()}}K=N;for(j in L.geometries){n=L.geometries[j];if(n.type==="cube"){F=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides);H.geometries[j]=F}else if(n.type==="plane"){F=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight);H.geometries[j]=F}else if(n.type==="sphere"){F=new THREE.SphereGeometry(n.radius,
+n.segmentsWidth,n.segmentsHeight);H.geometries[j]=F}else if(n.type==="cylinder"){F=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs);H.geometries[j]=F}else if(n.type==="torus"){F=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT);H.geometries[j]=F}else if(n.type==="icosahedron"){F=new THREE.IcosahedronGeometry(n.radius,n.subdivisions);H.geometries[j]=F}else if(n.type in this.geometryHandlerMap)this.geometryHandlerMap[n.type].loaderObject.load(d(n.url,L.urlBaseType),
+e(j));else if(n.type==="embedded_mesh"){n=L.embeds[n.id];n.metadata=L.metadata;n&&this.geometryHandlerMap.ascii_mesh.loaderObject.createModel(n,g(j),"")}}for(t in L.textures){j=L.textures[t];if(j.url instanceof Array){I=I+j.url.length;for(n=0;n<j.url.length;n++)i.onLoadStart()}else{I=I+1;i.onLoadStart()}}Q=I;for(t in L.textures){j=L.textures[t];if(j.mapping!==void 0&&THREE[j.mapping]!==void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){n=j.url.length;E=[];for(p=0;p<n;p++)E[p]=d(j.url[p],
+L.urlBaseType);n=THREE.ImageUtils.loadTextureCube(E,j.mapping,a(n))}else{n=THREE.ImageUtils.loadTexture(d(j.url,L.urlBaseType),j.mapping,a(1));if(THREE[j.minFilter]!==void 0)n.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!==void 0)n.magFilter=THREE[j.magFilter];if(j.anisotropy)n.anisotropy=j.anisotropy;if(j.repeat){n.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!==1)n.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!==1)n.wrapT=THREE.RepeatWrapping}j.offset&&n.offset.set(j.offset[0],j.offset[1]);
+if(j.wrap){E={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(E[j.wrap[0]]!==void 0)n.wrapS=E[j.wrap[0]];if(E[j.wrap[1]]!==void 0)n.wrapT=E[j.wrap[1]]}}H.textures[t]=n}for(o in L.materials){u=L.materials[o];for(z in u.parameters)if(z==="envMap"||z==="map"||z==="lightMap"||z==="bumpMap")u.parameters[z]=H.textures[u.parameters[z]];else if(z==="shading")u.parameters[z]=u.parameters[z]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(z==="blending")u.parameters[z]=u.parameters[z]in
+THREE?THREE[u.parameters[z]]:THREE.NormalBlending;else if(z==="combine")u.parameters[z]=u.parameters[z]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(z==="vertexColors")if(u.parameters[z]=="face")u.parameters[z]=THREE.FaceColors;else if(u.parameters[z])u.parameters[z]=THREE.VertexColors;if(u.parameters.opacity!==void 0&&u.parameters.opacity<1)u.parameters.transparent=true;if(u.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(t.uniforms);j=u.parameters.color;
+n=u.parameters.specular;E=u.parameters.ambient;p=u.parameters.shininess;a.tNormal.value=H.textures[u.parameters.normalMap];u.parameters.normalScale&&a.uNormalScale.value.set(u.parameters.normalScale[0],u.parameters.normalScale[1]);if(u.parameters.map){a.tDiffuse.value=u.parameters.map;a.enableDiffuse.value=true}if(u.parameters.envMap){a.tCube.value=u.parameters.envMap;a.enableReflection.value=true;a.uReflectivity.value=u.parameters.reflectivity}if(u.parameters.lightMap){a.tAO.value=u.parameters.lightMap;
+a.enableAO.value=true}if(u.parameters.specularMap){a.tSpecular.value=H.textures[u.parameters.specularMap];a.enableSpecular.value=true}if(u.parameters.displacementMap){a.tDisplacement.value=H.textures[u.parameters.displacementMap];a.enableDisplacement.value=true;a.uDisplacementBias.value=u.parameters.displacementBias;a.uDisplacementScale.value=u.parameters.displacementScale}a.uDiffuseColor.value.setHex(j);a.uSpecularColor.value.setHex(n);a.uAmbientColor.value.setHex(E);a.uShininess.value=p;if(u.parameters.opacity)a.uOpacity.value=
+u.parameters.opacity;G=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:a,lights:true,fog:true})}else G=new THREE[u.type](u.parameters);H.materials[o]=G}f(H.scene,L.objects);i.callbackSync(H);h()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
 THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=true;b.dispatchEvent({type:"load",content:a})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};
 THREE.Material=function(){this.id=THREE.MaterialCount++;this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=false;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=true;this.polygonOffset=false;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.overdraw=false;this.needsUpdate=this.visible=true};
 THREE.Material.prototype.setValues=function(a){if(a!==void 0)for(var b in a){var c=a[b];if(c===void 0)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color&&c instanceof THREE.Color?d.copy(c):d instanceof THREE.Color&&typeof c==="number"?d.setHex(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]=c}}};
@@ -259,35 +260,35 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light){this.__lights.indexOf(a)===-1&&this.__lights.push(a);a.target&&a.target.parent===void 0&&this.add(a.target)}else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
 THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);b!==-1&&this.__lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.__objects.indexOf(a);if(b!==-1){this.__objects.splice(b,1);this.__objectsRemoved.push(a);b=this.__objectsAdded.indexOf(a);b!==-1&&this.__objectsAdded.splice(b,1)}}for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
 THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
-THREE.CanvasRenderer=function(a){function b(a){if(u!==a)u=p.globalAlpha=a}function c(a){if(v!==a){if(a===THREE.NormalBlending)p.globalCompositeOperation="source-over";else if(a===THREE.AdditiveBlending)p.globalCompositeOperation="lighter";else if(a===THREE.SubtractiveBlending)p.globalCompositeOperation="darker";v=a}}function d(a){if(t!==a)t=p.strokeStyle=a}function f(a){if(A!==a)A=p.fillStyle=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},e=this,g,h,i,l=new THREE.Projector,j=a.canvas!==
-void 0?a.canvas:document.createElement("canvas"),n,m,q,o,p=j.getContext("2d"),s=new THREE.Color(0),r=0,u=1,v=0,t=null,A=null,y=null,B=null,G=null,x,I,F,L,E=new THREE.RenderableVertex,P=new THREE.RenderableVertex,H,D,S,R,J,N,Y,K,fa,O,ra,va,da=new THREE.Color,ba=new THREE.Color,M=new THREE.Color,W=new THREE.Color,ha=new THREE.Color,ia={},oa={},ta,Ca,Ia,Wa,ja,ob,Na,Xa,pb,wb,eb=new THREE.Rectangle,Fa=new THREE.Rectangle,xa=new THREE.Rectangle,xb=false,Ga=new THREE.Color,Za=new THREE.Color,qb=new THREE.Color,
-Da=new THREE.Vector3,$a,ab,fb,Oa,Pa,gb,a=16;$a=document.createElement("canvas");$a.width=$a.height=2;ab=$a.getContext("2d");ab.fillStyle="rgba(0,0,0,1)";ab.fillRect(0,0,2,2);fb=ab.getImageData(0,0,2,2);Oa=fb.data;Pa=document.createElement("canvas");Pa.width=Pa.height=a;gb=Pa.getContext("2d");gb.translate(-a/2,-a/2);gb.scale(a,a);a--;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a;m=b;q=Math.floor(n/2);
-o=Math.floor(m/2);j.width=n;j.height=m;eb.set(-q,-o,q,o);Fa.set(-q,-o,q,o);u=1;v=0;G=B=y=A=t=null};this.setClearColor=function(a,b){s.copy(a);r=b!==void 0?b:1;Fa.set(-q,-o,q,o)};this.setClearColorHex=function(a,b){s.setHex(a);r=b!==void 0?b:1;Fa.set(-q,-o,q,o)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){p.setTransform(1,0,0,-1,q,o);if(Fa.isEmpty()===false){Fa.minSelf(eb);Fa.inflate(2);r<1&&p.clearRect(Math.floor(Fa.getX()),Math.floor(Fa.getY()),Math.floor(Fa.getWidth()),Math.floor(Fa.getHeight()));
-if(r>0){c(THREE.NormalBlending);b(1);f("rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+r+")");p.fillRect(Math.floor(Fa.getX()),Math.floor(Fa.getY()),Math.floor(Fa.getWidth()),Math.floor(Fa.getHeight()))}Fa.empty()}};this.render=function(a,k){function j(a,b,c){for(var d=0,f=i.length;d<f;d++){var e=i[d],g=e.color;if(e instanceof THREE.DirectionalLight){var h=e.matrixWorld.getPosition().normalize(),k=b.dot(h);if(!(k<=0)){k=k*e.intensity;c.r=c.r+g.r*k;c.g=c.g+g.g*k;c.b=
-c.b+g.b*k}}else if(e instanceof THREE.PointLight){h=e.matrixWorld.getPosition();k=b.dot(Da.sub(h,a).normalize());if(!(k<=0)){k=k*(e.distance==0?1:1-Math.min(a.distanceTo(h)/e.distance,1));if(k!=0){k=k*e.intensity;c.r=c.r+g.r*k;c.g=c.g+g.g*k;c.b=c.b+g.b*k}}}}}function n(a,d,f,g,h,i,l,o){e.info.render.vertices=e.info.render.vertices+3;e.info.render.faces++;b(o.opacity);c(o.blending);H=a.positionScreen.x;D=a.positionScreen.y;S=d.positionScreen.x;R=d.positionScreen.y;J=f.positionScreen.x;N=f.positionScreen.y;
-m(H,D,S,R,J,N);if((o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial)&&o.map===null&&o.map===null)if(xb===true){g=o.color;h=o.emissive;if(o.wireframe===false&&o.shading==THREE.SmoothShading&&l.vertexNormalsLength==3){ba.r=M.r=W.r=Ga.r;ba.g=M.g=W.g=Ga.g;ba.b=M.b=W.b=Ga.b;j(l.v1.positionWorld,l.vertexNormalsWorld[0],ba);j(l.v2.positionWorld,l.vertexNormalsWorld[1],M);j(l.v3.positionWorld,l.vertexNormalsWorld[2],W);ba.r=g.r*ba.r+h.r;ba.g=g.g*ba.g+h.g;ba.b=g.b*ba.b+h.b;M.r=
-g.r*M.r+h.r;M.g=g.g*M.g+h.g;M.b=g.b*M.b+h.b;W.r=g.r*W.r+h.r;W.g=g.g*W.g+h.g;W.b=g.b*W.b+h.b;ha.r=(M.r+W.r)*0.5;ha.g=(M.g+W.g)*0.5;ha.b=(M.b+W.b)*0.5;Ia=rb(ba,M,W,ha);v(H,D,S,R,J,N,0,0,1,0,0,1,Ia)}else{da.r=Ga.r;da.g=Ga.g;da.b=Ga.b;j(l.centroidWorld,l.normalWorld,da);da.r=g.r*da.r+h.r;da.g=g.g*da.g+h.g;da.b=g.b*da.b+h.b;o.wireframe===true?r(da,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):s(da)}}else o.wireframe===true?r(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):
-s(o.color);else if(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial)if(o.map!==null){if(o.map.mapping instanceof THREE.UVMapping){Wa=l.uvs[0];u(H,D,S,R,J,N,Wa[g].u,Wa[g].v,Wa[h].u,Wa[h].v,Wa[i].u,Wa[i].v,o.map)}}else if(o.envMap!==null){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=k.matrixWorldInverse;Da.copy(l.vertexNormalsWorld[g]);ja=(Da.x*a.elements[0]+Da.y*a.elements[4]+Da.z*a.elements[8])*0.5+0.5;ob=(Da.x*
-a.elements[1]+Da.y*a.elements[5]+Da.z*a.elements[9])*0.5+0.5;Da.copy(l.vertexNormalsWorld[h]);Na=(Da.x*a.elements[0]+Da.y*a.elements[4]+Da.z*a.elements[8])*0.5+0.5;Xa=(Da.x*a.elements[1]+Da.y*a.elements[5]+Da.z*a.elements[9])*0.5+0.5;Da.copy(l.vertexNormalsWorld[i]);pb=(Da.x*a.elements[0]+Da.y*a.elements[4]+Da.z*a.elements[8])*0.5+0.5;wb=(Da.x*a.elements[1]+Da.y*a.elements[5]+Da.z*a.elements[9])*0.5+0.5;u(H,D,S,R,J,N,ja,ob,Na,Xa,pb,wb,o.envMap)}}else o.wireframe===true?r(o.color,o.wireframeLinewidth,
-o.wireframeLinecap,o.wireframeLinejoin):s(o.color);else if(o instanceof THREE.MeshDepthMaterial){ta=k.near;Ca=k.far;ba.r=ba.g=ba.b=1-fc(a.positionScreen.z,ta,Ca);M.r=M.g=M.b=1-fc(d.positionScreen.z,ta,Ca);W.r=W.g=W.b=1-fc(f.positionScreen.z,ta,Ca);ha.r=(M.r+W.r)*0.5;ha.g=(M.g+W.g)*0.5;ha.b=(M.b+W.b)*0.5;Ia=rb(ba,M,W,ha);v(H,D,S,R,J,N,0,0,1,0,0,1,Ia)}else if(o instanceof THREE.MeshNormalMaterial){da.r=jc(l.normalWorld.x);da.g=jc(l.normalWorld.y);da.b=jc(l.normalWorld.z);o.wireframe===true?r(da,o.wireframeLinewidth,
-o.wireframeLinecap,o.wireframeLinejoin):s(da)}}function m(a,b,c,d,f,e){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(f,e);p.closePath()}function t(a,b,c,d,f,e,g,h){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(f,e);p.lineTo(g,h);p.closePath()}function r(a,b,c,f){if(y!==b)y=p.lineWidth=b;if(B!==c)B=p.lineCap=c;if(G!==f)G=p.lineJoin=f;d(a.getContextStyle());p.stroke();xa.inflate(b*2)}function s(a){f(a.getContextStyle());p.fill()}function u(a,b,c,d,e,g,h,i,k,j,l,n,m){if(!(m instanceof THREE.DataTexture||
-m.image===void 0||m.image.width==0)){if(m.needsUpdate===true||ia[m.id]===void 0){var o=m.wrapS==THREE.RepeatWrapping,rb=m.wrapT==THREE.RepeatWrapping;ia[m.id]=p.createPattern(m.image,o===true&&rb===true?"repeat":o===true&&rb===false?"repeat-x":o===false&&rb===true?"repeat-y":"no-repeat");m.needsUpdate=false}f(ia[m.id]);var o=m.offset.x/m.repeat.x,rb=m.offset.y/m.repeat.y,q=m.image.width*m.repeat.x,sb=m.image.height*m.repeat.y,h=(h+o)*q,i=(1-i+rb)*sb,c=c-a,d=d-b,e=e-a,g=g-b,k=(k+o)*q-h,j=(1-j+rb)*
-sb-i,l=(l+o)*q-h,n=(1-n+rb)*sb-i,o=k*n-l*j;if(o===0){if(oa[m.id]===void 0){b=document.createElement("canvas");b.width=m.image.width;b.height=m.image.height;b=b.getContext("2d");b.drawImage(m.image,0,0);oa[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data}b=oa[m.id];h=(Math.floor(h)+Math.floor(i)*m.image.width)*4;da.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);s(da)}else{o=1/o;m=(n*c-j*e)*o;j=(n*d-j*g)*o;c=(k*e-l*c)*o;d=(k*g-l*d)*o;a=a-m*h-c*i;h=b-j*h-d*i;p.save();p.transform(m,j,c,d,a,h);p.fill();
-p.restore()}}}function v(a,b,c,d,f,e,g,h,i,k,j,l,m){var n,o;n=m.width-1;o=m.height-1;g=g*n;h=h*o;c=c-a;d=d-b;f=f-a;e=e-b;i=i*n-g;k=k*o-h;j=j*n-g;l=l*o-h;o=1/(i*l-j*k);n=(l*c-k*f)*o;k=(l*d-k*e)*o;c=(i*f-j*c)*o;d=(i*e-j*d)*o;a=a-n*g-c*h;b=b-k*g-d*h;p.save();p.transform(n,k,c,d,a,b);p.clip();p.drawImage(m,0,0);p.restore()}function rb(a,b,c,d){Oa[0]=a.r*255|0;Oa[1]=a.g*255|0;Oa[2]=a.b*255|0;Oa[4]=b.r*255|0;Oa[5]=b.g*255|0;Oa[6]=b.b*255|0;Oa[8]=c.r*255|0;Oa[9]=c.g*255|0;Oa[10]=c.b*255|0;Oa[12]=d.r*255|
-0;Oa[13]=d.g*255|0;Oa[14]=d.b*255|0;ab.putImageData(fb,0,0);gb.drawImage($a,0,0);return Pa}function fc(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function jc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function sb(a,b){var c=b.x-a.x,d=b.y-a.y,f=c*c+d*d;if(f!==0){f=1/Math.sqrt(f);c=c*f;d=d*f;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}if(k instanceof THREE.Camera===false)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{var Vb,Ec,A,Z;this.autoClear===true?this.clear():
-p.setTransform(1,0,0,-1,q,o);e.info.render.vertices=0;e.info.render.faces=0;g=l.projectScene(a,k,this.sortElements);h=g.elements;i=g.lights;xb=i.length>0;if(xb===true){Ga.setRGB(0,0,0);Za.setRGB(0,0,0);qb.setRGB(0,0,0);Vb=0;for(Ec=i.length;Vb<Ec;Vb++){Z=i[Vb];var ca=Z.color;if(Z instanceof THREE.AmbientLight){Ga.r=Ga.r+ca.r;Ga.g=Ga.g+ca.g;Ga.b=Ga.b+ca.b}else if(Z instanceof THREE.DirectionalLight){Za.r=Za.r+ca.r;Za.g=Za.g+ca.g;Za.b=Za.b+ca.b}else if(Z instanceof THREE.PointLight){qb.r=qb.r+ca.r;qb.g=
-qb.g+ca.g;qb.b=qb.b+ca.b}}}Vb=0;for(Ec=h.length;Vb<Ec;Vb++){A=h[Vb];Z=A.material;if(!(Z===void 0||Z.visible===false)){xa.empty();if(A instanceof THREE.RenderableParticle){x=A;x.x=x.x*q;x.y=x.y*o;var ca=x,pa=A;b(Z.opacity);c(Z.blending);var Ea=void 0,tb=void 0,ib=void 0,jb=void 0,Wb=void 0,Tc=A=void 0;if(Z instanceof THREE.ParticleBasicMaterial)if(Z.map===null){ib=pa.object.scale.x;jb=pa.object.scale.y;ib=ib*pa.scale.x*q;jb=jb*pa.scale.y*o;xa.set(ca.x-ib,ca.y-jb,ca.x+ib,ca.y+jb);if(eb.intersects(xa)!==
-false){f(Z.color.getContextStyle());p.save();p.translate(ca.x,ca.y);p.rotate(-pa.rotation);p.scale(ib,jb);p.fillRect(-1,-1,2,2);p.restore()}}else{Wb=Z.map.image;A=Wb.width>>1;Tc=Wb.height>>1;ib=pa.scale.x*q;jb=pa.scale.y*o;Ea=ib*A;tb=jb*Tc;xa.set(ca.x-Ea,ca.y-tb,ca.x+Ea,ca.y+tb);if(eb.intersects(xa)!==false){p.save();p.translate(ca.x,ca.y);p.rotate(-pa.rotation);p.scale(ib,-jb);p.translate(-A,-Tc);p.drawImage(Wb,0,0);p.restore()}}else if(Z instanceof THREE.ParticleCanvasMaterial){Ea=pa.scale.x*q;
-tb=pa.scale.y*o;xa.set(ca.x-Ea,ca.y-tb,ca.x+Ea,ca.y+tb);if(eb.intersects(xa)!==false){d(Z.color.getContextStyle());f(Z.color.getContextStyle());p.save();p.translate(ca.x,ca.y);p.rotate(-pa.rotation);p.scale(Ea,tb);Z.program(p);p.restore()}}}else if(A instanceof THREE.RenderableLine){x=A.v1;I=A.v2;x.positionScreen.x=x.positionScreen.x*q;x.positionScreen.y=x.positionScreen.y*o;I.positionScreen.x=I.positionScreen.x*q;I.positionScreen.y=I.positionScreen.y*o;xa.addPoint(x.positionScreen.x,x.positionScreen.y);
-xa.addPoint(I.positionScreen.x,I.positionScreen.y);if(eb.intersects(xa)===true){ca=x;pa=I;b(Z.opacity);c(Z.blending);p.beginPath();p.moveTo(ca.positionScreen.x,ca.positionScreen.y);p.lineTo(pa.positionScreen.x,pa.positionScreen.y);if(Z instanceof THREE.LineBasicMaterial){ca=Z.linewidth;if(y!==ca)y=p.lineWidth=ca;ca=Z.linecap;if(B!==ca)B=p.lineCap=ca;ca=Z.linejoin;if(G!==ca)G=p.lineJoin=ca;d(Z.color.getContextStyle());p.stroke();xa.inflate(Z.linewidth*2)}}}else if(A instanceof THREE.RenderableFace3){x=
-A.v1;I=A.v2;F=A.v3;x.positionScreen.x=x.positionScreen.x*q;x.positionScreen.y=x.positionScreen.y*o;I.positionScreen.x=I.positionScreen.x*q;I.positionScreen.y=I.positionScreen.y*o;F.positionScreen.x=F.positionScreen.x*q;F.positionScreen.y=F.positionScreen.y*o;if(Z.overdraw===true){sb(x.positionScreen,I.positionScreen);sb(I.positionScreen,F.positionScreen);sb(F.positionScreen,x.positionScreen)}xa.add3Points(x.positionScreen.x,x.positionScreen.y,I.positionScreen.x,I.positionScreen.y,F.positionScreen.x,
-F.positionScreen.y);eb.intersects(xa)===true&&n(x,I,F,0,1,2,A,Z,a)}else if(A instanceof THREE.RenderableFace4){x=A.v1;I=A.v2;F=A.v3;L=A.v4;x.positionScreen.x=x.positionScreen.x*q;x.positionScreen.y=x.positionScreen.y*o;I.positionScreen.x=I.positionScreen.x*q;I.positionScreen.y=I.positionScreen.y*o;F.positionScreen.x=F.positionScreen.x*q;F.positionScreen.y=F.positionScreen.y*o;L.positionScreen.x=L.positionScreen.x*q;L.positionScreen.y=L.positionScreen.y*o;E.positionScreen.copy(I.positionScreen);P.positionScreen.copy(L.positionScreen);
-if(Z.overdraw===true){sb(x.positionScreen,I.positionScreen);sb(I.positionScreen,L.positionScreen);sb(L.positionScreen,x.positionScreen);sb(F.positionScreen,E.positionScreen);sb(F.positionScreen,P.positionScreen)}xa.addPoint(x.positionScreen.x,x.positionScreen.y);xa.addPoint(I.positionScreen.x,I.positionScreen.y);xa.addPoint(F.positionScreen.x,F.positionScreen.y);xa.addPoint(L.positionScreen.x,L.positionScreen.y);if(eb.intersects(xa)===true){pa=x;Ea=I;tb=F;ib=L;jb=E;Wb=P;ca=A;A=a;e.info.render.vertices=
-e.info.render.vertices+4;e.info.render.faces++;b(Z.opacity);c(Z.blending);if(Z.map!==void 0&&Z.map!==null||Z.envMap!==void 0&&Z.envMap!==null){n(pa,Ea,ib,0,1,3,ca,Z,A);n(jb,tb,Wb,1,2,3,ca,Z,A)}else{H=pa.positionScreen.x;D=pa.positionScreen.y;S=Ea.positionScreen.x;R=Ea.positionScreen.y;J=tb.positionScreen.x;N=tb.positionScreen.y;Y=ib.positionScreen.x;K=ib.positionScreen.y;fa=jb.positionScreen.x;O=jb.positionScreen.y;ra=Wb.positionScreen.x;va=Wb.positionScreen.y;if(Z instanceof THREE.MeshLambertMaterial||
-Z instanceof THREE.MeshPhongMaterial)if(xb===true){pa=Z.color;Ea=Z.emissive;if(Z.wireframe===false&&Z.shading==THREE.SmoothShading&&ca.vertexNormalsLength==4){ba.r=M.r=W.r=ha.r=Ga.r;ba.g=M.g=W.g=ha.g=Ga.g;ba.b=M.b=W.b=ha.b=Ga.b;j(ca.v1.positionWorld,ca.vertexNormalsWorld[0],ba);j(ca.v2.positionWorld,ca.vertexNormalsWorld[1],M);j(ca.v4.positionWorld,ca.vertexNormalsWorld[3],W);j(ca.v3.positionWorld,ca.vertexNormalsWorld[2],ha);ba.r=pa.r*ba.r+Ea.r;ba.g=pa.g*ba.g+Ea.g;ba.b=pa.b*ba.b+Ea.b;M.r=pa.r*M.r+
-Ea.r;M.g=pa.g*M.g+Ea.g;M.b=pa.b*M.b+Ea.b;W.r=pa.r*W.r+Ea.r;W.g=pa.g*W.g+Ea.g;W.b=pa.b*W.b+Ea.b;ha.r=pa.r*ha.r+Ea.r;ha.g=pa.g*ha.g+Ea.g;ha.b=pa.b*ha.b+Ea.b;Ia=rb(ba,M,W,ha);m(H,D,S,R,Y,K);v(H,D,S,R,Y,K,0,0,1,0,0,1,Ia);m(fa,O,J,N,ra,va);v(fa,O,J,N,ra,va,1,0,1,1,0,1,Ia)}else{da.r=Ga.r;da.g=Ga.g;da.b=Ga.b;j(ca.centroidWorld,ca.normalWorld,da);da.r=pa.r*da.r+Ea.r;da.g=pa.g*da.g+Ea.g;da.b=pa.b*da.b+Ea.b;t(H,D,S,R,J,N,Y,K);Z.wireframe===true?r(da,Z.wireframeLinewidth,Z.wireframeLinecap,Z.wireframeLinejoin):
-s(da)}}else{t(H,D,S,R,J,N,Y,K);Z.wireframe===true?r(Z.color,Z.wireframeLinewidth,Z.wireframeLinecap,Z.wireframeLinejoin):s(Z.color)}else if(Z instanceof THREE.MeshBasicMaterial){t(H,D,S,R,J,N,Y,K);Z.wireframe===true?r(Z.color,Z.wireframeLinewidth,Z.wireframeLinecap,Z.wireframeLinejoin):s(Z.color)}else if(Z instanceof THREE.MeshNormalMaterial){da.r=jc(ca.normalWorld.x);da.g=jc(ca.normalWorld.y);da.b=jc(ca.normalWorld.z);t(H,D,S,R,J,N,Y,K);Z.wireframe===true?r(da,Z.wireframeLinewidth,Z.wireframeLinecap,
-Z.wireframeLinejoin):s(da)}else if(Z instanceof THREE.MeshDepthMaterial){ta=k.near;Ca=k.far;ba.r=ba.g=ba.b=1-fc(pa.positionScreen.z,ta,Ca);M.r=M.g=M.b=1-fc(Ea.positionScreen.z,ta,Ca);W.r=W.g=W.b=1-fc(ib.positionScreen.z,ta,Ca);ha.r=ha.g=ha.b=1-fc(tb.positionScreen.z,ta,Ca);Ia=rb(ba,M,W,ha);m(H,D,S,R,Y,K);v(H,D,S,R,Y,K,0,0,1,0,0,1,Ia);m(fa,O,J,N,ra,va);v(fa,O,J,N,ra,va,1,0,1,1,0,1,Ia)}}}}Fa.addRectangle(xa)}}p.setTransform(1,0,0,1,0,0)}}};
+THREE.CanvasRenderer=function(a){function b(a){if(u!==a)u=n.globalAlpha=a}function c(a){if(v!==a){if(a===THREE.NormalBlending)n.globalCompositeOperation="source-over";else if(a===THREE.AdditiveBlending)n.globalCompositeOperation="lighter";else if(a===THREE.SubtractiveBlending)n.globalCompositeOperation="darker";v=a}}function d(a){if(r!==a)r=n.strokeStyle=a}function f(a){if(A!==a)A=n.fillStyle=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},e=this,g,h,i,l=new THREE.Projector,j=a.canvas!==
+void 0?a.canvas:document.createElement("canvas"),o,m,p,q,n=j.getContext("2d"),t=new THREE.Color(0),s=0,u=1,v=0,r=null,A=null,x=null,B=null,C=null,z,F,G,M,E=new THREE.RenderableVertex,N=new THREE.RenderableVertex,I,K,Q,H,L,aa,Z,J,ca,O,ra,va,da=new THREE.Color,ea=new THREE.Color,V=new THREE.Color,U=new THREE.Color,ha=new THREE.Color,ia={},oa={},ta,Da,Ja,Xa,ja,pb,Oa,Ya,qb,wb,fb=new THREE.Rectangle,Ga=new THREE.Rectangle,ya=new THREE.Rectangle,xb=false,Ha=new THREE.Color,$a=new THREE.Color,rb=new THREE.Color,
+Ea=new THREE.Vector3,ab,bb,gb,Pa,Qa,hb,a=16;ab=document.createElement("canvas");ab.width=ab.height=2;bb=ab.getContext("2d");bb.fillStyle="rgba(0,0,0,1)";bb.fillRect(0,0,2,2);gb=bb.getImageData(0,0,2,2);Pa=gb.data;Qa=document.createElement("canvas");Qa.width=Qa.height=a;hb=Qa.getContext("2d");hb.translate(-a/2,-a/2);hb.scale(a,a);a--;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;m=b;p=Math.floor(o/2);
+q=Math.floor(m/2);j.width=o;j.height=m;fb.set(-p,-q,p,q);Ga.set(-p,-q,p,q);u=1;v=0;C=B=x=A=r=null};this.setClearColor=function(a,b){t.copy(a);s=b!==void 0?b:1;Ga.set(-p,-q,p,q)};this.setClearColorHex=function(a,b){t.setHex(a);s=b!==void 0?b:1;Ga.set(-p,-q,p,q)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){n.setTransform(1,0,0,-1,p,q);if(Ga.isEmpty()===false){Ga.minSelf(fb);Ga.inflate(2);s<1&&n.clearRect(Math.floor(Ga.getX()),Math.floor(Ga.getY()),Math.floor(Ga.getWidth()),Math.floor(Ga.getHeight()));
+if(s>0){c(THREE.NormalBlending);b(1);f("rgba("+Math.floor(t.r*255)+","+Math.floor(t.g*255)+","+Math.floor(t.b*255)+","+s+")");n.fillRect(Math.floor(Ga.getX()),Math.floor(Ga.getY()),Math.floor(Ga.getWidth()),Math.floor(Ga.getHeight()))}Ga.empty()}};this.render=function(a,k){function j(a,b,c){for(var d=0,f=i.length;d<f;d++){var e=i[d],g=e.color;if(e instanceof THREE.DirectionalLight){var h=e.matrixWorld.getPosition().normalize(),k=b.dot(h);if(!(k<=0)){k=k*e.intensity;c.r=c.r+g.r*k;c.g=c.g+g.g*k;c.b=
+c.b+g.b*k}}else if(e instanceof THREE.PointLight){h=e.matrixWorld.getPosition();k=b.dot(Ea.sub(h,a).normalize());if(!(k<=0)){k=k*(e.distance==0?1:1-Math.min(a.distanceTo(h)/e.distance,1));if(k!=0){k=k*e.intensity;c.r=c.r+g.r*k;c.g=c.g+g.g*k;c.b=c.b+g.b*k}}}}}function o(a,d,f,g,h,i,l,n){e.info.render.vertices=e.info.render.vertices+3;e.info.render.faces++;b(n.opacity);c(n.blending);I=a.positionScreen.x;K=a.positionScreen.y;Q=d.positionScreen.x;H=d.positionScreen.y;L=f.positionScreen.x;aa=f.positionScreen.y;
+m(I,K,Q,H,L,aa);if((n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial)&&n.map===null&&n.map===null)if(xb===true){g=n.color;h=n.emissive;if(n.wireframe===false&&n.shading==THREE.SmoothShading&&l.vertexNormalsLength==3){ea.r=V.r=U.r=Ha.r;ea.g=V.g=U.g=Ha.g;ea.b=V.b=U.b=Ha.b;j(l.v1.positionWorld,l.vertexNormalsWorld[0],ea);j(l.v2.positionWorld,l.vertexNormalsWorld[1],V);j(l.v3.positionWorld,l.vertexNormalsWorld[2],U);ea.r=g.r*ea.r+h.r;ea.g=g.g*ea.g+h.g;ea.b=g.b*ea.b+h.b;V.r=
+g.r*V.r+h.r;V.g=g.g*V.g+h.g;V.b=g.b*V.b+h.b;U.r=g.r*U.r+h.r;U.g=g.g*U.g+h.g;U.b=g.b*U.b+h.b;ha.r=(V.r+U.r)*0.5;ha.g=(V.g+U.g)*0.5;ha.b=(V.b+U.b)*0.5;Ja=wa(ea,V,U,ha);v(I,K,Q,H,L,aa,0,0,1,0,0,1,Ja)}else{da.r=Ha.r;da.g=Ha.g;da.b=Ha.b;j(l.centroidWorld,l.normalWorld,da);da.r=g.r*da.r+h.r;da.g=g.g*da.g+h.g;da.b=g.b*da.b+h.b;n.wireframe===true?s(da,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):t(da)}}else n.wireframe===true?s(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):
+t(n.color);else if(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial)if(n.map!==null){if(n.map.mapping instanceof THREE.UVMapping){Xa=l.uvs[0];u(I,K,Q,H,L,aa,Xa[g].u,Xa[g].v,Xa[h].u,Xa[h].v,Xa[i].u,Xa[i].v,n.map)}}else if(n.envMap!==null){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=k.matrixWorldInverse;Ea.copy(l.vertexNormalsWorld[g]);ja=(Ea.x*a.elements[0]+Ea.y*a.elements[4]+Ea.z*a.elements[8])*0.5+0.5;pb=(Ea.x*
+a.elements[1]+Ea.y*a.elements[5]+Ea.z*a.elements[9])*0.5+0.5;Ea.copy(l.vertexNormalsWorld[h]);Oa=(Ea.x*a.elements[0]+Ea.y*a.elements[4]+Ea.z*a.elements[8])*0.5+0.5;Ya=(Ea.x*a.elements[1]+Ea.y*a.elements[5]+Ea.z*a.elements[9])*0.5+0.5;Ea.copy(l.vertexNormalsWorld[i]);qb=(Ea.x*a.elements[0]+Ea.y*a.elements[4]+Ea.z*a.elements[8])*0.5+0.5;wb=(Ea.x*a.elements[1]+Ea.y*a.elements[5]+Ea.z*a.elements[9])*0.5+0.5;u(I,K,Q,H,L,aa,ja,pb,Oa,Ya,qb,wb,n.envMap)}}else n.wireframe===true?s(n.color,n.wireframeLinewidth,
+n.wireframeLinecap,n.wireframeLinejoin):t(n.color);else if(n instanceof THREE.MeshDepthMaterial){ta=k.near;Da=k.far;ea.r=ea.g=ea.b=1-fc(a.positionScreen.z,ta,Da);V.r=V.g=V.b=1-fc(d.positionScreen.z,ta,Da);U.r=U.g=U.b=1-fc(f.positionScreen.z,ta,Da);ha.r=(V.r+U.r)*0.5;ha.g=(V.g+U.g)*0.5;ha.b=(V.b+U.b)*0.5;Ja=wa(ea,V,U,ha);v(I,K,Q,H,L,aa,0,0,1,0,0,1,Ja)}else if(n instanceof THREE.MeshNormalMaterial){da.r=jc(l.normalWorld.x);da.g=jc(l.normalWorld.y);da.b=jc(l.normalWorld.z);n.wireframe===true?s(da,n.wireframeLinewidth,
+n.wireframeLinecap,n.wireframeLinejoin):t(da)}}function m(a,b,c,d,f,e){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(f,e);n.closePath()}function r(a,b,c,d,f,e,g,h){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(f,e);n.lineTo(g,h);n.closePath()}function s(a,b,c,f){if(x!==b)x=n.lineWidth=b;if(B!==c)B=n.lineCap=c;if(C!==f)C=n.lineJoin=f;d(a.getContextStyle());n.stroke();ya.inflate(b*2)}function t(a){f(a.getContextStyle());n.fill()}function u(a,b,c,d,e,g,h,i,k,j,l,o,m){if(!(m instanceof THREE.DataTexture||
+m.image===void 0||m.image.width==0)){if(m.needsUpdate===true||ia[m.id]===void 0){var wa=m.wrapS==THREE.RepeatWrapping,q=m.wrapT==THREE.RepeatWrapping;ia[m.id]=n.createPattern(m.image,wa===true&&q===true?"repeat":wa===true&&q===false?"repeat-x":wa===false&&q===true?"repeat-y":"no-repeat");m.needsUpdate=false}f(ia[m.id]);var wa=m.offset.x/m.repeat.x,q=m.offset.y/m.repeat.y,p=m.image.width*m.repeat.x,sb=m.image.height*m.repeat.y,h=(h+wa)*p,i=(1-i+q)*sb,c=c-a,d=d-b,e=e-a,g=g-b,k=(k+wa)*p-h,j=(1-j+q)*
+sb-i,l=(l+wa)*p-h,o=(1-o+q)*sb-i,wa=k*o-l*j;if(wa===0){if(oa[m.id]===void 0){b=document.createElement("canvas");b.width=m.image.width;b.height=m.image.height;b=b.getContext("2d");b.drawImage(m.image,0,0);oa[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data}b=oa[m.id];h=(Math.floor(h)+Math.floor(i)*m.image.width)*4;da.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);t(da)}else{wa=1/wa;m=(o*c-j*e)*wa;j=(o*d-j*g)*wa;c=(k*e-l*c)*wa;d=(k*g-l*d)*wa;a=a-m*h-c*i;h=b-j*h-d*i;n.save();n.transform(m,j,c,d,a,
+h);n.fill();n.restore()}}}function v(a,b,c,d,f,e,g,h,i,k,j,l,m){var o,wa;o=m.width-1;wa=m.height-1;g=g*o;h=h*wa;c=c-a;d=d-b;f=f-a;e=e-b;i=i*o-g;k=k*wa-h;j=j*o-g;l=l*wa-h;wa=1/(i*l-j*k);o=(l*c-k*f)*wa;k=(l*d-k*e)*wa;c=(i*f-j*c)*wa;d=(i*e-j*d)*wa;a=a-o*g-c*h;b=b-k*g-d*h;n.save();n.transform(o,k,c,d,a,b);n.clip();n.drawImage(m,0,0);n.restore()}function wa(a,b,c,d){Pa[0]=a.r*255|0;Pa[1]=a.g*255|0;Pa[2]=a.b*255|0;Pa[4]=b.r*255|0;Pa[5]=b.g*255|0;Pa[6]=b.b*255|0;Pa[8]=c.r*255|0;Pa[9]=c.g*255|0;Pa[10]=c.b*
+255|0;Pa[12]=d.r*255|0;Pa[13]=d.g*255|0;Pa[14]=d.b*255|0;bb.putImageData(gb,0,0);hb.drawImage(ab,0,0);return Qa}function fc(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function jc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function sb(a,b){var c=b.x-a.x,d=b.y-a.y,f=c*c+d*d;if(f!==0){f=1/Math.sqrt(f);c=c*f;d=d*f;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}if(k instanceof THREE.Camera===false)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{var Vb,Ec,A,X;this.autoClear===
+true?this.clear():n.setTransform(1,0,0,-1,p,q);e.info.render.vertices=0;e.info.render.faces=0;g=l.projectScene(a,k,this.sortElements);h=g.elements;i=g.lights;xb=i.length>0;if(xb===true){Ha.setRGB(0,0,0);$a.setRGB(0,0,0);rb.setRGB(0,0,0);Vb=0;for(Ec=i.length;Vb<Ec;Vb++){X=i[Vb];var ba=X.color;if(X instanceof THREE.AmbientLight){Ha.r=Ha.r+ba.r;Ha.g=Ha.g+ba.g;Ha.b=Ha.b+ba.b}else if(X instanceof THREE.DirectionalLight){$a.r=$a.r+ba.r;$a.g=$a.g+ba.g;$a.b=$a.b+ba.b}else if(X instanceof THREE.PointLight){rb.r=
+rb.r+ba.r;rb.g=rb.g+ba.g;rb.b=rb.b+ba.b}}}Vb=0;for(Ec=h.length;Vb<Ec;Vb++){A=h[Vb];X=A.material;if(!(X===void 0||X.visible===false)){ya.empty();if(A instanceof THREE.RenderableParticle){z=A;z.x=z.x*p;z.y=z.y*q;var ba=z,pa=A;b(X.opacity);c(X.blending);var Fa=void 0,tb=void 0,jb=void 0,kb=void 0,Wb=void 0,Tc=A=void 0;if(X instanceof THREE.ParticleBasicMaterial)if(X.map===null){jb=pa.object.scale.x;kb=pa.object.scale.y;jb=jb*pa.scale.x*p;kb=kb*pa.scale.y*q;ya.set(ba.x-jb,ba.y-kb,ba.x+jb,ba.y+kb);if(fb.intersects(ya)!==
+false){f(X.color.getContextStyle());n.save();n.translate(ba.x,ba.y);n.rotate(-pa.rotation);n.scale(jb,kb);n.fillRect(-1,-1,2,2);n.restore()}}else{Wb=X.map.image;A=Wb.width>>1;Tc=Wb.height>>1;jb=pa.scale.x*p;kb=pa.scale.y*q;Fa=jb*A;tb=kb*Tc;ya.set(ba.x-Fa,ba.y-tb,ba.x+Fa,ba.y+tb);if(fb.intersects(ya)!==false){n.save();n.translate(ba.x,ba.y);n.rotate(-pa.rotation);n.scale(jb,-kb);n.translate(-A,-Tc);n.drawImage(Wb,0,0);n.restore()}}else if(X instanceof THREE.ParticleCanvasMaterial){Fa=pa.scale.x*p;
+tb=pa.scale.y*q;ya.set(ba.x-Fa,ba.y-tb,ba.x+Fa,ba.y+tb);if(fb.intersects(ya)!==false){d(X.color.getContextStyle());f(X.color.getContextStyle());n.save();n.translate(ba.x,ba.y);n.rotate(-pa.rotation);n.scale(Fa,tb);X.program(n);n.restore()}}}else if(A instanceof THREE.RenderableLine){z=A.v1;F=A.v2;z.positionScreen.x=z.positionScreen.x*p;z.positionScreen.y=z.positionScreen.y*q;F.positionScreen.x=F.positionScreen.x*p;F.positionScreen.y=F.positionScreen.y*q;ya.addPoint(z.positionScreen.x,z.positionScreen.y);
+ya.addPoint(F.positionScreen.x,F.positionScreen.y);if(fb.intersects(ya)===true){ba=z;pa=F;b(X.opacity);c(X.blending);n.beginPath();n.moveTo(ba.positionScreen.x,ba.positionScreen.y);n.lineTo(pa.positionScreen.x,pa.positionScreen.y);if(X instanceof THREE.LineBasicMaterial){ba=X.linewidth;if(x!==ba)x=n.lineWidth=ba;ba=X.linecap;if(B!==ba)B=n.lineCap=ba;ba=X.linejoin;if(C!==ba)C=n.lineJoin=ba;d(X.color.getContextStyle());n.stroke();ya.inflate(X.linewidth*2)}}}else if(A instanceof THREE.RenderableFace3){z=
+A.v1;F=A.v2;G=A.v3;z.positionScreen.x=z.positionScreen.x*p;z.positionScreen.y=z.positionScreen.y*q;F.positionScreen.x=F.positionScreen.x*p;F.positionScreen.y=F.positionScreen.y*q;G.positionScreen.x=G.positionScreen.x*p;G.positionScreen.y=G.positionScreen.y*q;if(X.overdraw===true){sb(z.positionScreen,F.positionScreen);sb(F.positionScreen,G.positionScreen);sb(G.positionScreen,z.positionScreen)}ya.add3Points(z.positionScreen.x,z.positionScreen.y,F.positionScreen.x,F.positionScreen.y,G.positionScreen.x,
+G.positionScreen.y);fb.intersects(ya)===true&&o(z,F,G,0,1,2,A,X,a)}else if(A instanceof THREE.RenderableFace4){z=A.v1;F=A.v2;G=A.v3;M=A.v4;z.positionScreen.x=z.positionScreen.x*p;z.positionScreen.y=z.positionScreen.y*q;F.positionScreen.x=F.positionScreen.x*p;F.positionScreen.y=F.positionScreen.y*q;G.positionScreen.x=G.positionScreen.x*p;G.positionScreen.y=G.positionScreen.y*q;M.positionScreen.x=M.positionScreen.x*p;M.positionScreen.y=M.positionScreen.y*q;E.positionScreen.copy(F.positionScreen);N.positionScreen.copy(M.positionScreen);
+if(X.overdraw===true){sb(z.positionScreen,F.positionScreen);sb(F.positionScreen,M.positionScreen);sb(M.positionScreen,z.positionScreen);sb(G.positionScreen,E.positionScreen);sb(G.positionScreen,N.positionScreen)}ya.addPoint(z.positionScreen.x,z.positionScreen.y);ya.addPoint(F.positionScreen.x,F.positionScreen.y);ya.addPoint(G.positionScreen.x,G.positionScreen.y);ya.addPoint(M.positionScreen.x,M.positionScreen.y);if(fb.intersects(ya)===true){pa=z;Fa=F;tb=G;jb=M;kb=E;Wb=N;ba=A;A=a;e.info.render.vertices=
+e.info.render.vertices+4;e.info.render.faces++;b(X.opacity);c(X.blending);if(X.map!==void 0&&X.map!==null||X.envMap!==void 0&&X.envMap!==null){o(pa,Fa,jb,0,1,3,ba,X,A);o(kb,tb,Wb,1,2,3,ba,X,A)}else{I=pa.positionScreen.x;K=pa.positionScreen.y;Q=Fa.positionScreen.x;H=Fa.positionScreen.y;L=tb.positionScreen.x;aa=tb.positionScreen.y;Z=jb.positionScreen.x;J=jb.positionScreen.y;ca=kb.positionScreen.x;O=kb.positionScreen.y;ra=Wb.positionScreen.x;va=Wb.positionScreen.y;if(X instanceof THREE.MeshLambertMaterial||
+X instanceof THREE.MeshPhongMaterial)if(xb===true){pa=X.color;Fa=X.emissive;if(X.wireframe===false&&X.shading==THREE.SmoothShading&&ba.vertexNormalsLength==4){ea.r=V.r=U.r=ha.r=Ha.r;ea.g=V.g=U.g=ha.g=Ha.g;ea.b=V.b=U.b=ha.b=Ha.b;j(ba.v1.positionWorld,ba.vertexNormalsWorld[0],ea);j(ba.v2.positionWorld,ba.vertexNormalsWorld[1],V);j(ba.v4.positionWorld,ba.vertexNormalsWorld[3],U);j(ba.v3.positionWorld,ba.vertexNormalsWorld[2],ha);ea.r=pa.r*ea.r+Fa.r;ea.g=pa.g*ea.g+Fa.g;ea.b=pa.b*ea.b+Fa.b;V.r=pa.r*V.r+
+Fa.r;V.g=pa.g*V.g+Fa.g;V.b=pa.b*V.b+Fa.b;U.r=pa.r*U.r+Fa.r;U.g=pa.g*U.g+Fa.g;U.b=pa.b*U.b+Fa.b;ha.r=pa.r*ha.r+Fa.r;ha.g=pa.g*ha.g+Fa.g;ha.b=pa.b*ha.b+Fa.b;Ja=wa(ea,V,U,ha);m(I,K,Q,H,Z,J);v(I,K,Q,H,Z,J,0,0,1,0,0,1,Ja);m(ca,O,L,aa,ra,va);v(ca,O,L,aa,ra,va,1,0,1,1,0,1,Ja)}else{da.r=Ha.r;da.g=Ha.g;da.b=Ha.b;j(ba.centroidWorld,ba.normalWorld,da);da.r=pa.r*da.r+Fa.r;da.g=pa.g*da.g+Fa.g;da.b=pa.b*da.b+Fa.b;r(I,K,Q,H,L,aa,Z,J);X.wireframe===true?s(da,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):
+t(da)}}else{r(I,K,Q,H,L,aa,Z,J);X.wireframe===true?s(X.color,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):t(X.color)}else if(X instanceof THREE.MeshBasicMaterial){r(I,K,Q,H,L,aa,Z,J);X.wireframe===true?s(X.color,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):t(X.color)}else if(X instanceof THREE.MeshNormalMaterial){da.r=jc(ba.normalWorld.x);da.g=jc(ba.normalWorld.y);da.b=jc(ba.normalWorld.z);r(I,K,Q,H,L,aa,Z,J);X.wireframe===true?s(da,X.wireframeLinewidth,X.wireframeLinecap,
+X.wireframeLinejoin):t(da)}else if(X instanceof THREE.MeshDepthMaterial){ta=k.near;Da=k.far;ea.r=ea.g=ea.b=1-fc(pa.positionScreen.z,ta,Da);V.r=V.g=V.b=1-fc(Fa.positionScreen.z,ta,Da);U.r=U.g=U.b=1-fc(jb.positionScreen.z,ta,Da);ha.r=ha.g=ha.b=1-fc(tb.positionScreen.z,ta,Da);Ja=wa(ea,V,U,ha);m(I,K,Q,H,Z,J);v(I,K,Q,H,Z,J,0,0,1,0,0,1,Ja);m(ca,O,L,aa,ra,va);v(ca,O,L,aa,ra,va,1,0,1,1,0,1,Ja)}}}}Ga.addRectangle(ya)}}n.setTransform(1,0,0,1,0,0)}}};
 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\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
 envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 mPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 mPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 mPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
@@ -333,147 +334,147 @@ THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment
 THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var f in d.attributes){var e=d.attributes[f];if(!e.__webglInitialized||e.createUniqueBuffers){e.__webglInitialized=true;var g=1;e.type==="v2"?g=2:e.type==="v3"?g=3:e.type==="v4"?g=4:e.type==="c"&&(g=3);e.size=g;e.array=new Float32Array(c*g);e.buffer=k.createBuffer();e.buffer.belongsToAttribute=f;e.needsUpdate=true}a.__webglCustomAttributesList.push(e)}}}
 function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?false:a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?true:false}function e(a){var b,
-c,d;for(b in a.attributes){d=b==="index"?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER;c=a.attributes[b];c.buffer=k.createBuffer();k.bindBuffer(d,c.buffer);k.bufferData(d,c.array,k.STATIC_DRAW)}}function g(a,b,c){var d,f,e,g,h=a.vertices;g=h.length;var i=a.colors,j=i.length,l=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,o=a.verticesNeedUpdate,p=a.colorsNeedUpdate,q=a.__webglCustomAttributesList;if(c.sortParticles){fb.copy(ab);fb.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){f=h[d];Oa.copy(f);fb.multiplyVector3(Oa);
-n[d]=[Oa.z,d]}n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){f=h[n[d][1]];e=d*3;l[e]=f.x;l[e+1]=f.y;l[e+2]=f.z}for(d=0;d<j;d++){e=d*3;f=i[n[d][1]];m[e]=f.r;m[e+1]=f.g;m[e+2]=f.b}if(q){i=0;for(j=q.length;i<j;i++){h=q[i];if(h.boundTo===void 0||h.boundTo==="vertices"){e=0;f=h.value.length;if(h.size===1)for(d=0;d<f;d++){g=n[d][1];h.array[d]=h.value[g]}else if(h.size===2)for(d=0;d<f;d++){g=n[d][1];g=h.value[g];h.array[e]=g.x;h.array[e+1]=g.y;e=e+2}else if(h.size===3)if(h.type==="c")for(d=0;d<
-f;d++){g=n[d][1];g=h.value[g];h.array[e]=g.r;h.array[e+1]=g.g;h.array[e+2]=g.b;e=e+3}else for(d=0;d<f;d++){g=n[d][1];g=h.value[g];h.array[e]=g.x;h.array[e+1]=g.y;h.array[e+2]=g.z;e=e+3}else if(h.size===4)for(d=0;d<f;d++){g=n[d][1];g=h.value[g];h.array[e]=g.x;h.array[e+1]=g.y;h.array[e+2]=g.z;h.array[e+3]=g.w;e=e+4}}}}}else{if(o)for(d=0;d<g;d++){f=h[d];e=d*3;l[e]=f.x;l[e+1]=f.y;l[e+2]=f.z}if(p)for(d=0;d<j;d++){f=i[d];e=d*3;m[e]=f.r;m[e+1]=f.g;m[e+2]=f.b}if(q){i=0;for(j=q.length;i<j;i++){h=q[i];if(h.needsUpdate&&
+c,d;for(b in a.attributes){d=b==="index"?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER;c=a.attributes[b];c.buffer=k.createBuffer();k.bindBuffer(d,c.buffer);k.bufferData(d,c.array,k.STATIC_DRAW)}}function g(a,b,c){var d,f,e,g,h=a.vertices;g=h.length;var i=a.colors,j=i.length,l=a.__vertexArray,m=a.__colorArray,o=a.__sortArray,n=a.verticesNeedUpdate,q=a.colorsNeedUpdate,p=a.__webglCustomAttributesList;if(c.sortParticles){gb.copy(bb);gb.multiplySelf(c.matrixWorld);for(d=0;d<g;d++){f=h[d];Pa.copy(f);gb.multiplyVector3(Pa);
+o[d]=[Pa.z,d]}o.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++){f=h[o[d][1]];e=d*3;l[e]=f.x;l[e+1]=f.y;l[e+2]=f.z}for(d=0;d<j;d++){e=d*3;f=i[o[d][1]];m[e]=f.r;m[e+1]=f.g;m[e+2]=f.b}if(p){i=0;for(j=p.length;i<j;i++){h=p[i];if(h.boundTo===void 0||h.boundTo==="vertices"){e=0;f=h.value.length;if(h.size===1)for(d=0;d<f;d++){g=o[d][1];h.array[d]=h.value[g]}else if(h.size===2)for(d=0;d<f;d++){g=o[d][1];g=h.value[g];h.array[e]=g.x;h.array[e+1]=g.y;e=e+2}else if(h.size===3)if(h.type==="c")for(d=0;d<
+f;d++){g=o[d][1];g=h.value[g];h.array[e]=g.r;h.array[e+1]=g.g;h.array[e+2]=g.b;e=e+3}else for(d=0;d<f;d++){g=o[d][1];g=h.value[g];h.array[e]=g.x;h.array[e+1]=g.y;h.array[e+2]=g.z;e=e+3}else if(h.size===4)for(d=0;d<f;d++){g=o[d][1];g=h.value[g];h.array[e]=g.x;h.array[e+1]=g.y;h.array[e+2]=g.z;h.array[e+3]=g.w;e=e+4}}}}}else{if(n)for(d=0;d<g;d++){f=h[d];e=d*3;l[e]=f.x;l[e+1]=f.y;l[e+2]=f.z}if(q)for(d=0;d<j;d++){f=i[d];e=d*3;m[e]=f.r;m[e+1]=f.g;m[e+2]=f.b}if(p){i=0;for(j=p.length;i<j;i++){h=p[i];if(h.needsUpdate&&
 (h.boundTo===void 0||h.boundTo==="vertices")){f=h.value.length;e=0;if(h.size===1)for(d=0;d<f;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<f;d++){g=h.value[d];h.array[e]=g.x;h.array[e+1]=g.y;e=e+2}else if(h.size===3)if(h.type==="c")for(d=0;d<f;d++){g=h.value[d];h.array[e]=g.r;h.array[e+1]=g.g;h.array[e+2]=g.b;e=e+3}else for(d=0;d<f;d++){g=h.value[d];h.array[e]=g.x;h.array[e+1]=g.y;h.array[e+2]=g.z;e=e+3}else if(h.size===4)for(d=0;d<f;d++){g=h.value[d];h.array[e]=g.x;h.array[e+1]=g.y;h.array[e+
-2]=g.z;h.array[e+3]=g.w;e=e+4}}}}}if(o||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,l,b)}if(p||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,b)}if(q){i=0;for(j=q.length;i<j;i++){h=q[i];if(h.needsUpdate||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.bufferData(k.ARRAY_BUFFER,h.array,b)}}}}function h(a,b,c){var d=a.attributes,f=d.index,e=d.position,g=d.normal,h=d.uv,i=d.color,d=d.tangent;
+2]=g.z;h.array[e+3]=g.w;e=e+4}}}}}if(n||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,l,b)}if(q||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,b)}if(p){i=0;for(j=p.length;i<j;i++){h=p[i];if(h.needsUpdate||c.sortParticles){k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.bufferData(k.ARRAY_BUFFER,h.array,b)}}}}function h(a,b,c){var d=a.attributes,f=d.index,e=d.position,g=d.normal,h=d.uv,i=d.color,d=d.tangent;
 if(a.elementsNeedUpdate&&f!==void 0){k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,f.buffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,f.array,b)}if(a.verticesNeedUpdate&&e!==void 0){k.bindBuffer(k.ARRAY_BUFFER,e.buffer);k.bufferData(k.ARRAY_BUFFER,e.array,b)}if(a.normalsNeedUpdate&&g!==void 0){k.bindBuffer(k.ARRAY_BUFFER,g.buffer);k.bufferData(k.ARRAY_BUFFER,g.array,b)}if(a.uvsNeedUpdate&&h!==void 0){k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.bufferData(k.ARRAY_BUFFER,h.array,b)}if(a.colorsNeedUpdate&&i!==void 0){k.bindBuffer(k.ARRAY_BUFFER,
-i.buffer);k.bufferData(k.ARRAY_BUFFER,i.array,b)}if(a.tangentsNeedUpdate&&d!==void 0){k.bindBuffer(k.ARRAY_BUFFER,d.buffer);k.bufferData(k.ARRAY_BUFFER,d.array,b)}if(c)for(var j in a.attributes)delete a.attributes[j].array}function i(a,b){return b.z-a.z}function l(a,b){return b[1]-a[1]}function j(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++){ha=da=null;M=W=Ca=ta=Xa=Na=Ia=-1;gb=true;a[d].render(b,c,qb,Da);ha=da=null;M=W=Ca=ta=Xa=Na=Ia=-1;gb=true}}function n(a,b,c,d,f,e,g,h){var i,k,j,l;if(b){k=
+i.buffer);k.bufferData(k.ARRAY_BUFFER,i.array,b)}if(a.tangentsNeedUpdate&&d!==void 0){k.bindBuffer(k.ARRAY_BUFFER,d.buffer);k.bufferData(k.ARRAY_BUFFER,d.array,b)}if(c)for(var j in a.attributes)delete a.attributes[j].array}function i(a,b){return b.z-a.z}function l(a,b){return b[1]-a[1]}function j(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++){ha=da=null;V=U=Da=ta=Ya=Oa=Ja=-1;hb=true;a[d].render(b,c,rb,Ea);ha=da=null;V=U=Da=ta=Ya=Oa=Ja=-1;hb=true}}function o(a,b,c,d,f,e,g,h){var i,k,j,l;if(b){k=
 a.length-1;l=b=-1}else{k=0;b=a.length;l=1}for(var m=k;m!==b;m=m+l){i=a[m];if(i.render){k=i.object;j=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&O.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);O.setDepthTest(i.depthTest);O.setDepthWrite(i.depthWrite);B(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}O.setMaterialFaces(i);j instanceof THREE.BufferGeometry?O.renderBufferDirect(d,f,e,i,j,k):O.renderBuffer(d,f,e,i,j,k)}}}function m(a,b,c,d,f,e,g){for(var h,i,k=0,j=a.length;k<
-j;k++){h=a[k];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;e&&O.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);O.setDepthTest(h.depthTest);O.setDepthWrite(h.depthWrite);B(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}O.renderImmediateObject(c,d,f,h,i)}}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function o(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=
-false}function s(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function r(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function u(a,b,c,d,f){oa=0;if(d.needsUpdate){d.program&&O.deallocateMaterial(d);O.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(O.maxMorphTargets);var e=false,g=d.program,h=g.uniforms,i=d.uniforms;if(g!==da){k.useProgram(g);da=g;e=true}if(d.id!==M){M=d.id;
+j;k++){h=a[k];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;e&&O.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);O.setDepthTest(h.depthTest);O.setDepthWrite(h.depthWrite);B(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}O.renderImmediateObject(c,d,f,h,i)}}}function p(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function q(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function n(a){for(var b in a.attributes)a.attributes[b].needsUpdate=
+false}function t(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function s(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function u(a,b,c,d,f){oa=0;if(d.needsUpdate){d.program&&O.deallocateMaterial(d);O.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(O.maxMorphTargets);var e=false,g=d.program,h=g.uniforms,i=d.uniforms;if(g!==da){k.useProgram(g);da=g;e=true}if(d.id!==V){V=d.id;
 e=true}if(e||a!==ha){k.uniformMatrix4fv(h.projectionMatrix,false,a._projectionMatrixArray);a!==ha&&(ha=a)}if(d.skinning)if(ec&&f.useVertexTexture){if(h.boneTexture!==null){var j=v();k.uniform1i(h.boneTexture,j);O.setTexture(f.boneTexture,j)}}else h.boneGlobalMatrices!==null&&k.uniformMatrix4fv(h.boneGlobalMatrices,false,f.boneMatrices);if(e){if(c&&d.fog){i.fogColor.value=c.color;if(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){if(gb){for(var l=0,m=0,n=0,o,p,q,t,r=qc,s=r.directional.colors,u=r.directional.positions,x=r.point.colors,B=r.point.positions,G=r.point.distances,F=r.spot.colors,K=r.spot.positions,D=r.spot.distances,H=r.spot.directions,J=r.spot.angles,L=r.spot.exponents,N=r.hemi.skyColors,W=r.hemi.groundColors,R=r.hemi.positions,S=0,Y=0,ba=0,fa=0,c=o=q=q=p=0,e=b.length;c<e;c++){j=b[c];if(!j.onlyShadow&&j.visible){o=
-j.color;t=j.intensity;p=j.distance;if(j instanceof THREE.AmbientLight)if(O.gammaInput){l=l+o.r*o.r;m=m+o.g*o.g;n=n+o.b*o.b}else{l=l+o.r;m=m+o.g;n=n+o.b}else if(j instanceof THREE.DirectionalLight){p=S*3;O.gammaInput?A(s,p,o,t*t):y(s,p,o,t);Pa.copy(j.matrixWorld.getPosition());Pa.subSelf(j.target.matrixWorld.getPosition());Pa.normalize();u[p]=Pa.x;u[p+1]=Pa.y;u[p+2]=Pa.z;S=S+1}else if(j instanceof THREE.PointLight){q=Y*3;O.gammaInput?A(x,q,o,t*t):y(x,q,o,t);t=j.matrixWorld.getPosition();B[q]=t.x;B[q+
-1]=t.y;B[q+2]=t.z;G[Y]=p;Y=Y+1}else if(j instanceof THREE.SpotLight){q=ba*3;O.gammaInput?A(F,q,o,t*t):y(F,q,o,t);t=j.matrixWorld.getPosition();K[q]=t.x;K[q+1]=t.y;K[q+2]=t.z;D[ba]=p;Pa.copy(t);Pa.subSelf(j.target.matrixWorld.getPosition());Pa.normalize();H[q]=Pa.x;H[q+1]=Pa.y;H[q+2]=Pa.z;J[ba]=Math.cos(j.angle);L[ba]=j.exponent;ba=ba+1}else if(j instanceof THREE.HemisphereLight){p=j.color;q=j.groundColor;o=fa*3;if(O.gammaInput){t=t*t;A(N,o,p,t);A(W,o,q,t)}else{y(N,o,p,t);y(W,o,q,t)}t=j.matrixWorld.getPosition();
-R[o]=t.x;R[o+1]=t.y;R[o+2]=t.z;fa=fa+1}}}c=S*3;for(e=s.length;c<e;c++)s[c]=0;c=Y*3;for(e=x.length;c<e;c++)x[c]=0;c=ba*3;for(e=F.length;c<e;c++)F[c]=0;c=fa*3;for(e=N.length;c<e;c++)N[c]=0;c=fa*3;for(e=W.length;c<e;c++)W[c]=0;r.directional.length=S;r.point.length=Y;r.spot.length=ba;r.hemi.length=fa;r.ambient[0]=l;r.ambient[1]=m;r.ambient[2]=n;gb=false}c=qc;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;
+c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(hb){for(var l=0,m=0,o=0,n,q,p,r,s=qc,t=s.directional.colors,u=s.directional.positions,z=s.point.colors,B=s.point.positions,C=s.point.distances,H=s.spot.colors,G=s.spot.positions,I=s.spot.distances,J=s.spot.directions,K=s.spot.angles,M=s.spot.exponents,L=s.hemi.skyColors,U=s.hemi.groundColors,Q=s.hemi.positions,ea=0,Z=0,ca=0,aa=0,c=n=p=p=q=0,e=b.length;c<e;c++){j=b[c];if(!j.onlyShadow&&j.visible){n=
+j.color;r=j.intensity;q=j.distance;if(j instanceof THREE.AmbientLight)if(O.gammaInput){l=l+n.r*n.r;m=m+n.g*n.g;o=o+n.b*n.b}else{l=l+n.r;m=m+n.g;o=o+n.b}else if(j instanceof THREE.DirectionalLight){q=ea*3;O.gammaInput?A(t,q,n,r*r):x(t,q,n,r);Qa.copy(j.matrixWorld.getPosition());Qa.subSelf(j.target.matrixWorld.getPosition());Qa.normalize();u[q]=Qa.x;u[q+1]=Qa.y;u[q+2]=Qa.z;ea=ea+1}else if(j instanceof THREE.PointLight){p=Z*3;O.gammaInput?A(z,p,n,r*r):x(z,p,n,r);r=j.matrixWorld.getPosition();B[p]=r.x;
+B[p+1]=r.y;B[p+2]=r.z;C[Z]=q;Z=Z+1}else if(j instanceof THREE.SpotLight){p=ca*3;O.gammaInput?A(H,p,n,r*r):x(H,p,n,r);r=j.matrixWorld.getPosition();G[p]=r.x;G[p+1]=r.y;G[p+2]=r.z;I[ca]=q;Qa.copy(r);Qa.subSelf(j.target.matrixWorld.getPosition());Qa.normalize();J[p]=Qa.x;J[p+1]=Qa.y;J[p+2]=Qa.z;K[ca]=Math.cos(j.angle);M[ca]=j.exponent;ca=ca+1}else if(j instanceof THREE.HemisphereLight){q=j.color;p=j.groundColor;n=aa*3;if(O.gammaInput){r=r*r;A(L,n,q,r);A(U,n,p,r)}else{x(L,n,q,r);x(U,n,p,r)}r=j.matrixWorld.getPosition();
+Q[n]=r.x;Q[n+1]=r.y;Q[n+2]=r.z;aa=aa+1}}}c=ea*3;for(e=t.length;c<e;c++)t[c]=0;c=Z*3;for(e=z.length;c<e;c++)z[c]=0;c=ca*3;for(e=H.length;c<e;c++)H[c]=0;c=aa*3;for(e=L.length;c<e;c++)L[c]=0;c=aa*3;for(e=U.length;c<e;c++)U[c]=0;s.directional.length=ea;s.point.length=Z;s.spot.length=ca;s.hemi.length=aa;s.ambient[0]=l;s.ambient[1]=m;s.ambient[2]=o;hb=false}c=qc;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;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngle.value=c.spot.angles;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightPosition.value=
 c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;O.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;if(d.bumpMap){i.bumpMap.value=d.bumpMap;i.bumpScale.value=d.bumpScale}if(d.normalMap){i.normalMap.value=d.normalMap;i.normalScale.value.copy(d.normalScale)}var ia;if(d.map)ia=d.map;
 else if(d.specularMap)ia=d.specularMap;else if(d.normalMap)ia=d.normalMap;else if(d.bumpMap)ia=d.bumpMap;if(ia!==void 0){c=ia.offset;ia=ia.repeat;i.offsetRepeat.value.set(c.x,c.y,ia.x,ia.y)}i.envMap.value=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=P.height/2;i.map.value=d.map}else if(d instanceof THREE.MeshPhongMaterial){i.shininess.value=d.shininess;if(O.gammaInput){i.ambient.value.copyGammaToLinear(d.ambient);i.emissive.value.copyGammaToLinear(d.emissive);i.specular.value.copyGammaToLinear(d.specular)}else{i.ambient.value=d.ambient;i.emissive.value=d.emissive;i.specular.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=N.height/2;i.map.value=d.map}else if(d instanceof THREE.MeshPhongMaterial){i.shininess.value=d.shininess;if(O.gammaInput){i.ambient.value.copyGammaToLinear(d.ambient);i.emissive.value.copyGammaToLinear(d.emissive);i.specular.value.copyGammaToLinear(d.specular)}else{i.ambient.value=d.ambient;i.emissive.value=d.emissive;i.specular.value=
 d.specular}d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshLambertMaterial){if(O.gammaInput){i.ambient.value.copyGammaToLinear(d.ambient);i.emissive.value.copyGammaToLinear(d.emissive)}else{i.ambient.value=d.ambient;i.emissive.value=d.emissive}d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)}else if(d instanceof THREE.MeshDepthMaterial){i.mNear.value=a.near;i.mFar.value=a.far;i.opacity.value=d.opacity}else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;
 if(f.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=ia=0;for(e=b.length;c<e;c++){j=b[c];if(j.castShadow&&(j instanceof THREE.SpotLight||j instanceof THREE.DirectionalLight&&!j.shadowCascade)){i.shadowMap.value[ia]=j.shadowMap;i.shadowMapSize.value[ia]=j.shadowMapSize;i.shadowMatrix.value[ia]=j.shadowMatrix;i.shadowDarkness.value[ia]=j.shadowDarkness;i.shadowBias.value[ia]=j.shadowBias;ia++}}}b=d.uniformsList;i=0;for(ia=b.length;i<ia;i++)if(e=g.uniforms[b[i][1]]){c=b[i][0];l=c.type;j=c.value;if(l===
-"i")k.uniform1i(e,j);else if(l==="f")k.uniform1f(e,j);else if(l==="v2")k.uniform2f(e,j.x,j.y);else if(l==="v3")k.uniform3f(e,j.x,j.y,j.z);else if(l==="v4")k.uniform4f(e,j.x,j.y,j.z,j.w);else if(l==="c")k.uniform3f(e,j.r,j.g,j.b);else if(l==="iv1")k.uniform1iv(e,j);else if(l==="iv")k.uniform3iv(e,j);else if(l==="fv1")k.uniform1fv(e,j);else if(l==="fv")k.uniform3fv(e,j);else if(l==="v2v"){if(c._array===void 0)c._array=new Float32Array(2*j.length);l=0;for(m=j.length;l<m;l++){n=l*2;c._array[n]=j[l].x;
-c._array[n+1]=j[l].y}k.uniform2fv(e,c._array)}else if(l==="v3v"){if(c._array===void 0)c._array=new Float32Array(3*j.length);l=0;for(m=j.length;l<m;l++){n=l*3;c._array[n]=j[l].x;c._array[n+1]=j[l].y;c._array[n+2]=j[l].z}k.uniform3fv(e,c._array)}else if(l==="v4v"){if(c._array===void 0)c._array=new Float32Array(4*j.length);l=0;for(m=j.length;l<m;l++){n=l*4;c._array[n]=j[l].x;c._array[n+1]=j[l].y;c._array[n+2]=j[l].z;c._array[n+3]=j[l].w}k.uniform4fv(e,c._array)}else if(l==="m4"){if(c._array===void 0)c._array=
-new Float32Array(16);j.flattenToArray(c._array);k.uniformMatrix4fv(e,false,c._array)}else if(l==="m4v"){if(c._array===void 0)c._array=new Float32Array(16*j.length);l=0;for(m=j.length;l<m;l++)j[l].flattenToArrayOffset(c._array,l*16);k.uniformMatrix4fv(e,false,c._array)}else if(l==="t"){n=j;j=v();k.uniform1i(e,j);if(n)if(n.image instanceof Array&&n.image.length===6){c=n;e=j;if(c.image.length===6)if(c.needsUpdate){if(!c.image.__webglTextureCube)c.image.__webglTextureCube=k.createTexture();k.activeTexture(k.TEXTURE0+
-e);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,c.flipY);e=[];for(j=0;j<6;j++)if(O.autoScaleCubemaps){l=e;m=j;n=c.image[j];s=Sc;if(!(n.width<=s&&n.height<=s)){u=Math.max(n.width,n.height);r=Math.floor(n.width*s/u);s=Math.floor(n.height*s/u);u=document.createElement("canvas");u.width=r;u.height=s;u.getContext("2d").drawImage(n,0,0,n.width,n.height,0,0,r,s);n=u}l[m]=n}else e[j]=c.image[j];j=e[0];l=(j.width&j.width-1)===0&&(j.height&j.height-1)===0;
-m=E(c.format);n=E(c.type);I(k.TEXTURE_CUBE_MAP,c,l);for(j=0;j<6;j++)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,m,m,n,e[j]);c.generateMipmaps&&l&&k.generateMipmap(k.TEXTURE_CUBE_MAP);c.needsUpdate=false;if(c.onUpdate)c.onUpdate()}else{k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}}else if(n instanceof THREE.WebGLRenderTargetCube){c=n;k.activeTexture(k.TEXTURE0+j);k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture)}else O.setTexture(n,j)}else if(l==="tv"){if(c._array===
-void 0)c._array=[];l=0;for(m=c.value.length;l<m;l++)c._array[l]=v();k.uniform1iv(e,c._array);l=0;for(m=c.value.length;l<m;l++){n=c.value[l];j=c._array[l];n&&O.setTexture(n,j)}}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&h.cameraPosition!==null){b=a.matrixWorld.getPosition();k.uniform3f(h.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&h.viewMatrix!==
-null&&k.uniformMatrix4fv(h.viewMatrix,false,a._viewMatrixArray)}k.uniformMatrix4fv(h.modelViewMatrix,false,f._modelViewMatrix.elements);h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,false,f._normalMatrix.elements);h.modelMatrix!==null&&k.uniformMatrix4fv(h.modelMatrix,false,f.matrixWorld.elements);return g}function v(){var a=oa;a>=Dc&&console.warn("Trying to use "+a+" texture units while this GPU supports only "+Dc);oa=oa+1;return a}function t(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,
-a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function A(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function y(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function B(a,b,c){if(pb!==a){a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL);pb=a}if(a&&(wb!==b||eb!==c)){k.polygonOffset(b,c);wb=b;eb=c}}function G(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function x(a,b){var c;a==="fragment"?
-c=k.createShader(k.FRAGMENT_SHADER):a==="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS)){console.error(k.getShaderInfoLog(c));console.error(G(b));return null}return c}function I(a,b,c){if(c){k.texParameteri(a,k.TEXTURE_WRAP_S,E(b.wrapS));k.texParameteri(a,k.TEXTURE_WRAP_T,E(b.wrapT));k.texParameteri(a,k.TEXTURE_MAG_FILTER,E(b.magFilter));k.texParameteri(a,k.TEXTURE_MIN_FILTER,E(b.minFilter))}else{k.texParameteri(a,k.TEXTURE_WRAP_S,
-k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_MAG_FILTER,L(b.magFilter));k.texParameteri(a,k.TEXTURE_MIN_FILTER,L(b.minFilter))}if(Pb&&b.type!==THREE.FloatType&&(b.anisotropy>1||b.__oldAnisotropy)){k.texParameterf(a,Pb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,rc));b.__oldAnisotropy=b.anisotropy}}function F(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,
-b.width,b.height);k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height);k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)}else k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}function L(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?k.NEAREST:k.LINEAR}function E(a){if(a===
+"i")k.uniform1i(e,j);else if(l==="f")k.uniform1f(e,j);else if(l==="v2")k.uniform2f(e,j.x,j.y);else if(l==="v3")k.uniform3f(e,j.x,j.y,j.z);else if(l==="v4")k.uniform4f(e,j.x,j.y,j.z,j.w);else if(l==="c")k.uniform3f(e,j.r,j.g,j.b);else if(l==="iv1")k.uniform1iv(e,j);else if(l==="iv")k.uniform3iv(e,j);else if(l==="fv1")k.uniform1fv(e,j);else if(l==="fv")k.uniform3fv(e,j);else if(l==="v2v"){if(c._array===void 0)c._array=new Float32Array(2*j.length);l=0;for(m=j.length;l<m;l++){o=l*2;c._array[o]=j[l].x;
+c._array[o+1]=j[l].y}k.uniform2fv(e,c._array)}else if(l==="v3v"){if(c._array===void 0)c._array=new Float32Array(3*j.length);l=0;for(m=j.length;l<m;l++){o=l*3;c._array[o]=j[l].x;c._array[o+1]=j[l].y;c._array[o+2]=j[l].z}k.uniform3fv(e,c._array)}else if(l==="v4v"){if(c._array===void 0)c._array=new Float32Array(4*j.length);l=0;for(m=j.length;l<m;l++){o=l*4;c._array[o]=j[l].x;c._array[o+1]=j[l].y;c._array[o+2]=j[l].z;c._array[o+3]=j[l].w}k.uniform4fv(e,c._array)}else if(l==="m4"){if(c._array===void 0)c._array=
+new Float32Array(16);j.flattenToArray(c._array);k.uniformMatrix4fv(e,false,c._array)}else if(l==="m4v"){if(c._array===void 0)c._array=new Float32Array(16*j.length);l=0;for(m=j.length;l<m;l++)j[l].flattenToArrayOffset(c._array,l*16);k.uniformMatrix4fv(e,false,c._array)}else if(l==="t"){o=j;j=v();k.uniform1i(e,j);if(o)if(o.image instanceof Array&&o.image.length===6){c=o;e=j;if(c.image.length===6)if(c.needsUpdate){if(!c.image.__webglTextureCube)c.image.__webglTextureCube=k.createTexture();k.activeTexture(k.TEXTURE0+
+e);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,c.flipY);e=[];for(j=0;j<6;j++)if(O.autoScaleCubemaps){l=e;m=j;o=c.image[j];t=Sc;if(!(o.width<=t&&o.height<=t)){u=Math.max(o.width,o.height);s=Math.floor(o.width*t/u);t=Math.floor(o.height*t/u);u=document.createElement("canvas");u.width=s;u.height=t;u.getContext("2d").drawImage(o,0,0,o.width,o.height,0,0,s,t);o=u}l[m]=o}else e[j]=c.image[j];j=e[0];l=(j.width&j.width-1)===0&&(j.height&j.height-1)===0;
+m=E(c.format);o=E(c.type);F(k.TEXTURE_CUBE_MAP,c,l);for(j=0;j<6;j++)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,m,m,o,e[j]);c.generateMipmaps&&l&&k.generateMipmap(k.TEXTURE_CUBE_MAP);c.needsUpdate=false;if(c.onUpdate)c.onUpdate()}else{k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}}else if(o instanceof THREE.WebGLRenderTargetCube){c=o;k.activeTexture(k.TEXTURE0+j);k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture)}else O.setTexture(o,j)}else if(l==="tv"){if(c._array===
+void 0)c._array=[];l=0;for(m=c.value.length;l<m;l++)c._array[l]=v();k.uniform1iv(e,c._array);l=0;for(m=c.value.length;l<m;l++){o=c.value[l];j=c._array[l];o&&O.setTexture(o,j)}}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&h.cameraPosition!==null){b=a.matrixWorld.getPosition();k.uniform3f(h.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&h.viewMatrix!==
+null&&k.uniformMatrix4fv(h.viewMatrix,false,a._viewMatrixArray)}k.uniformMatrix4fv(h.modelViewMatrix,false,f._modelViewMatrix.elements);h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,false,f._normalMatrix.elements);h.modelMatrix!==null&&k.uniformMatrix4fv(h.modelMatrix,false,f.matrixWorld.elements);return g}function v(){var a=oa;a>=Dc&&console.warn("Trying to use "+a+" texture units while this GPU supports only "+Dc);oa=oa+1;return a}function r(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,
+a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function A(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function x(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function B(a,b,c){if(qb!==a){a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL);qb=a}if(a&&(wb!==b||fb!==c)){k.polygonOffset(b,c);wb=b;fb=c}}function C(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function z(a,b){var c;a==="fragment"?
+c=k.createShader(k.FRAGMENT_SHADER):a==="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS)){console.error(k.getShaderInfoLog(c));console.error(C(b));return null}return c}function F(a,b,c){if(c){k.texParameteri(a,k.TEXTURE_WRAP_S,E(b.wrapS));k.texParameteri(a,k.TEXTURE_WRAP_T,E(b.wrapT));k.texParameteri(a,k.TEXTURE_MAG_FILTER,E(b.magFilter));k.texParameteri(a,k.TEXTURE_MIN_FILTER,E(b.minFilter))}else{k.texParameteri(a,k.TEXTURE_WRAP_S,
+k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_MAG_FILTER,M(b.magFilter));k.texParameteri(a,k.TEXTURE_MIN_FILTER,M(b.minFilter))}if(Pb&&b.type!==THREE.FloatType&&(b.anisotropy>1||b.__oldAnisotropy)){k.texParameterf(a,Pb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,rc));b.__oldAnisotropy=b.anisotropy}}function G(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,
+b.width,b.height);k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a)}else if(b.depthBuffer&&b.stencilBuffer){k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height);k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)}else k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}function M(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?k.NEAREST:k.LINEAR}function E(a){if(a===
 THREE.RepeatWrapping)return k.REPEAT;if(a===THREE.ClampToEdgeWrapping)return k.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return k.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return k.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return k.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return k.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return k.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return k.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return k.LINEAR_MIPMAP_LINEAR;
 if(a===THREE.UnsignedByteType)return k.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return k.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return k.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return k.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return k.BYTE;if(a===THREE.ShortType)return k.SHORT;if(a===THREE.UnsignedShortType)return k.UNSIGNED_SHORT;if(a===THREE.IntType)return k.INT;if(a===THREE.UnsignedIntType)return k.UNSIGNED_INT;if(a===THREE.FloatType)return k.FLOAT;
 if(a===THREE.AlphaFormat)return k.ALPHA;if(a===THREE.RGBFormat)return k.RGB;if(a===THREE.RGBAFormat)return k.RGBA;if(a===THREE.LuminanceFormat)return k.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return k.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return k.FUNC_ADD;if(a===THREE.SubtractEquation)return k.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return k.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return k.ZERO;if(a===THREE.OneFactor)return k.ONE;if(a===THREE.SrcColorFactor)return k.SRC_COLOR;
 if(a===THREE.OneMinusSrcColorFactor)return k.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return k.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return k.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return k.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return k.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return k.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return k.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return k.SRC_ALPHA_SATURATE;if(yb!==void 0){if(a===THREE.RGB_S3TC_DXT1_Format)return yb.COMPRESSED_RGB_S3TC_DXT1_EXT;
-if(a===THREE.RGBA_S3TC_DXT1_Format)return yb.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return yb.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return yb.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},P=a.canvas!==void 0?a.canvas:document.createElement("canvas"),H=a.precision!==void 0?a.precision:"highp",D=a.alpha!==void 0?a.alpha:true,S=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,R=a.antialias!==
-void 0?a.antialias:false,J=a.stencil!==void 0?a.stencil:true,N=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,Y=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),K=a.clearAlpha!==void 0?a.clearAlpha:0,fa=a.maxLights!==void 0?a.maxLights:4;this.domElement=P;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=
-this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=true;this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var O=this,ra=[],va=0,da=null,ba=null,M=-1,W=null,ha=null,ia=0,oa=0,ta=-1,Ca=-1,Ia=-1,Wa=-1,ja=-1,ob=-1,Na=-1,
-Xa=-1,pb=null,wb=null,eb=null,Fa=null,xa=0,xb=0,Ga=0,Za=0,qb=0,Da=0,$a=new THREE.Frustum,ab=new THREE.Matrix4,fb=new THREE.Matrix4,Oa=new THREE.Vector4,Pa=new THREE.Vector3,gb=true,qc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},k,Pb,yb;try{if(!(k=P.getContext("experimental-webgl",
-{alpha:D,premultipliedAlpha:S,antialias:R,stencil:J,preserveDrawingBuffer:N})))throw"Error creating WebGL context.";}catch(Rc){console.error(Rc)}a=k.getExtension("OES_texture_float");D=k.getExtension("OES_standard_derivatives");Pb=k.getExtension("EXT_texture_filter_anisotropic")||k.getExtension("MOZ_EXT_texture_filter_anisotropic")||k.getExtension("WEBKIT_EXT_texture_filter_anisotropic");yb=k.getExtension("WEBGL_compressed_texture_s3tc")||k.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||k.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");
-a||console.log("THREE.WebGLRenderer: Float textures not supported.");D||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");Pb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");yb||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");k.clearColor(0,0,0,1);k.clearDepth(1);k.clearStencil(0);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);
-k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(Y.r,Y.g,Y.b,K);this.context=k;var Dc=k.getParameter(k.MAX_TEXTURE_IMAGE_UNITS),D=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS);k.getParameter(k.MAX_TEXTURE_SIZE);var Sc=k.getParameter(k.MAX_CUBE_MAP_TEXTURE_SIZE),rc=Pb?k.getParameter(Pb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,ic=D>0,ec=ic&&a;yb&&k.getParameter(k.COMPRESSED_TEXTURE_FORMATS);this.getContext=function(){return k};this.supportsVertexTextures=function(){return ic};this.getMaxAnisotropy=
-function(){return rc};this.setSize=function(a,b){P.width=a;P.height=b;this.setViewport(0,0,P.width,P.height)};this.setViewport=function(a,b,c,d){xa=a!==void 0?a:0;xb=b!==void 0?b:0;Ga=c!==void 0?c:P.width;Za=d!==void 0?d:P.height;k.viewport(xa,xb,Ga,Za)};this.setScissor=function(a,b,c,d){k.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.setClearColorHex=function(a,b){Y.setHex(a);K=b;k.clearColor(Y.r,Y.g,Y.b,K)};this.setClearColor=function(a,
-b){Y.copy(a);K=b;k.clearColor(Y.r,Y.g,Y.b,K)};this.getClearColor=function(){return Y};this.getClearAlpha=function(){return K};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d=d|k.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|k.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|k.STENCIL_BUFFER_BIT;k.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};
+if(a===THREE.RGBA_S3TC_DXT1_Format)return yb.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return yb.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return yb.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},N=a.canvas!==void 0?a.canvas:document.createElement("canvas"),I=a.precision!==void 0?a.precision:"highp",K=a.alpha!==void 0?a.alpha:true,Q=a.premultipliedAlpha!==void 0?a.premultipliedAlpha:true,H=a.antialias!==
+void 0?a.antialias:false,L=a.stencil!==void 0?a.stencil:true,aa=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:false,Z=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),J=a.clearAlpha!==void 0?a.clearAlpha:0,ca=a.maxLights!==void 0?a.maxLights:4;this.domElement=N;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=true;this.shadowMapEnabled=this.physicallyBasedShading=
+this.gammaOutput=this.gammaInput=false;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=true;this.shadowMapCascade=this.shadowMapDebug=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=true;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var O=this,ra=[],va=0,da=null,ea=null,V=-1,U=null,ha=null,ia=0,oa=0,ta=-1,Da=-1,Ja=-1,Xa=-1,ja=-1,pb=-1,Oa=-1,
+Ya=-1,qb=null,wb=null,fb=null,Ga=null,ya=0,xb=0,Ha=0,$a=0,rb=0,Ea=0,ab=new THREE.Frustum,bb=new THREE.Matrix4,gb=new THREE.Matrix4,Pa=new THREE.Vector4,Qa=new THREE.Vector3,hb=true,qc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},k,Pb,yb;try{if(!(k=N.getContext("experimental-webgl",
+{alpha:K,premultipliedAlpha:Q,antialias:H,stencil:L,preserveDrawingBuffer:aa})))throw"Error creating WebGL context.";}catch(Rc){console.error(Rc)}a=k.getExtension("OES_texture_float");K=k.getExtension("OES_standard_derivatives");Pb=k.getExtension("EXT_texture_filter_anisotropic")||k.getExtension("MOZ_EXT_texture_filter_anisotropic")||k.getExtension("WEBKIT_EXT_texture_filter_anisotropic");yb=k.getExtension("WEBGL_compressed_texture_s3tc")||k.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||k.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");
+a||console.log("THREE.WebGLRenderer: Float textures not supported.");K||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");Pb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");yb||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");k.clearColor(0,0,0,1);k.clearDepth(1);k.clearStencil(0);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);
+k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(Z.r,Z.g,Z.b,J);this.context=k;var Dc=k.getParameter(k.MAX_TEXTURE_IMAGE_UNITS),K=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS);k.getParameter(k.MAX_TEXTURE_SIZE);var Sc=k.getParameter(k.MAX_CUBE_MAP_TEXTURE_SIZE),rc=Pb?k.getParameter(Pb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,ic=K>0,ec=ic&&a;yb&&k.getParameter(k.COMPRESSED_TEXTURE_FORMATS);this.getContext=function(){return k};this.supportsVertexTextures=function(){return ic};this.getMaxAnisotropy=
+function(){return rc};this.setSize=function(a,b){N.width=a;N.height=b;this.setViewport(0,0,N.width,N.height)};this.setViewport=function(a,b,c,d){ya=a!==void 0?a:0;xb=b!==void 0?b:0;Ha=c!==void 0?c:N.width;$a=d!==void 0?d:N.height;k.viewport(ya,xb,Ha,$a)};this.setScissor=function(a,b,c,d){k.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.setClearColorHex=function(a,b){Z.setHex(a);J=b;k.clearColor(Z.r,Z.g,Z.b,J)};this.setClearColor=function(a,
+b){Z.copy(a);J=b;k.clearColor(Z.r,Z.g,Z.b,J)};this.getClearColor=function(){return Z};this.getClearAlpha=function(){return J};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d=d|k.COLOR_BUFFER_BIT;if(b===void 0||b)d=d|k.DEPTH_BUFFER_BIT;if(c===void 0||c)d=d|k.STENCIL_BUFFER_BIT;k.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};
 this.deallocateObject=function(a){if(a.__webglInit){a.__webglInit=false;delete a._modelViewMatrix;delete a._normalMatrix;delete a._normalMatrixArray;delete a._modelViewMatrixArray;delete a._modelMatrixArray;if(a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];k.deleteBuffer(c.__webglVertexBuffer);k.deleteBuffer(c.__webglNormalBuffer);k.deleteBuffer(c.__webglTangentBuffer);k.deleteBuffer(c.__webglColorBuffer);k.deleteBuffer(c.__webglUVBuffer);k.deleteBuffer(c.__webglUV2Buffer);
 k.deleteBuffer(c.__webglSkinIndicesBuffer);k.deleteBuffer(c.__webglSkinWeightsBuffer);k.deleteBuffer(c.__webglFaceBuffer);k.deleteBuffer(c.__webglLineBuffer);var d=void 0,f=void 0;if(c.numMorphTargets){d=0;for(f=c.numMorphTargets;d<f;d++)k.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(f=c.numMorphNormals;d<f;d++)k.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList){d=void 0;for(d in c.__webglCustomAttributesList)k.deleteBuffer(c.__webglCustomAttributesList[d].buffer)}O.info.memory.geometries--}else if(a instanceof
 THREE.Ribbon){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);O.info.memory.geometries--}else if(a instanceof THREE.Line){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);O.info.memory.geometries--}else if(a instanceof THREE.ParticleSystem){a=a.geometry;k.deleteBuffer(a.__webglVertexBuffer);k.deleteBuffer(a.__webglColorBuffer);O.info.memory.geometries--}}};this.deallocateTexture=function(a){if(a.__webglInit){a.__webglInit=
 false;k.deleteTexture(a.__webglTexture);O.info.memory.textures--}};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture){k.deleteTexture(a.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;b<6;b++){k.deleteFramebuffer(a.__webglFramebuffer[b]);k.deleteRenderbuffer(a.__webglRenderbuffer[b])}else{k.deleteFramebuffer(a.__webglFramebuffer);k.deleteRenderbuffer(a.__webglRenderbuffer)}}};this.deallocateMaterial=function(a){var b=a.program;if(b){a.program=void 0;var c,d,f=
-false,a=0;for(c=ra.length;a<c;a++){d=ra[a];if(d.program===b){d.usedTimes--;d.usedTimes===0&&(f=true);break}}if(f){f=[];a=0;for(c=ra.length;a<c;a++){d=ra[a];d.program!==b&&f.push(d)}ra=f;k.deleteProgram(b);O.info.memory.programs--}}};this.updateShadowMap=function(a,b){da=null;M=W=Xa=Na=Ia=-1;gb=true;Ca=ta=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(a.hasPositions&&!a.__webglVertexBuffer)a.__webglVertexBuffer=k.createBuffer();if(a.hasNormals&&!a.__webglNormalBuffer)a.__webglNormalBuffer=
+false,a=0;for(c=ra.length;a<c;a++){d=ra[a];if(d.program===b){d.usedTimes--;d.usedTimes===0&&(f=true);break}}if(f){f=[];a=0;for(c=ra.length;a<c;a++){d=ra[a];d.program!==b&&f.push(d)}ra=f;k.deleteProgram(b);O.info.memory.programs--}}};this.updateShadowMap=function(a,b){da=null;V=U=Ya=Oa=Ja=-1;hb=true;Da=ta=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(a.hasPositions&&!a.__webglVertexBuffer)a.__webglVertexBuffer=k.createBuffer();if(a.hasNormals&&!a.__webglNormalBuffer)a.__webglNormalBuffer=
 k.createBuffer();if(a.hasUvs&&!a.__webglUvBuffer)a.__webglUvBuffer=k.createBuffer();if(a.hasColors&&!a.__webglColorBuffer)a.__webglColorBuffer=k.createBuffer();if(a.hasPositions){k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,a.positionArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.position);k.vertexAttribPointer(b.attributes.position,3,k.FLOAT,false,0,0)}if(a.hasNormals){k.bindBuffer(k.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,
-f,e,g,h,i,j,l,n,m,o,p=a.count*3;for(o=0;o<p;o=o+9){m=a.normalArray;d=m[o];f=m[o+1];e=m[o+2];g=m[o+3];i=m[o+4];l=m[o+5];h=m[o+6];j=m[o+7];n=m[o+8];d=(d+g+h)/3;f=(f+i+j)/3;e=(e+l+n)/3;m[o]=d;m[o+1]=f;m[o+2]=e;m[o+3]=d;m[o+4]=f;m[o+5]=e;m[o+6]=d;m[o+7]=f;m[o+8]=e}}k.bufferData(k.ARRAY_BUFFER,a.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.normal);k.vertexAttribPointer(b.attributes.normal,3,k.FLOAT,false,0,0)}if(a.hasUvs&&c.map){k.bindBuffer(k.ARRAY_BUFFER,a.__webglUvBuffer);k.bufferData(k.ARRAY_BUFFER,
+f,e,g,h,i,j,l,o,m,n,q=a.count*3;for(n=0;n<q;n=n+9){m=a.normalArray;d=m[n];f=m[n+1];e=m[n+2];g=m[n+3];i=m[n+4];l=m[n+5];h=m[n+6];j=m[n+7];o=m[n+8];d=(d+g+h)/3;f=(f+i+j)/3;e=(e+l+o)/3;m[n]=d;m[n+1]=f;m[n+2]=e;m[n+3]=d;m[n+4]=f;m[n+5]=e;m[n+6]=d;m[n+7]=f;m[n+8]=e}}k.bufferData(k.ARRAY_BUFFER,a.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.normal);k.vertexAttribPointer(b.attributes.normal,3,k.FLOAT,false,0,0)}if(a.hasUvs&&c.map){k.bindBuffer(k.ARRAY_BUFFER,a.__webglUvBuffer);k.bufferData(k.ARRAY_BUFFER,
 a.uvArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.uv);k.vertexAttribPointer(b.attributes.uv,2,k.FLOAT,false,0,0)}if(a.hasColors&&c.vertexColors!==THREE.NoColors){k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,a.colorArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.color);k.vertexAttribPointer(b.attributes.color,3,k.FLOAT,false,0,0)}k.drawArrays(k.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,f,e){if(d.visible!==false){c=
-u(a,b,c,d,e);a=c.attributes;b=false;d=f.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==W){W=d;b=true}if(e instanceof THREE.Mesh){e=f.offsets;e.length>1&&(b=true);d=0;for(c=e.length;d<c;++d){var g=e[d].index;if(b){var h=f.attributes.position,i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.position,i,k.FLOAT,false,0,g*i*4);h=f.attributes.normal;if(a.normal>=0&&h){i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.normal,i,k.FLOAT,false,0,g*i*4)}h=f.attributes.uv;
+u(a,b,c,d,e);a=c.attributes;b=false;d=f.id*16777215+c.id*2+(d.wireframe?1:0);if(d!==U){U=d;b=true}if(e instanceof THREE.Mesh){e=f.offsets;e.length>1&&(b=true);d=0;for(c=e.length;d<c;++d){var g=e[d].index;if(b){var h=f.attributes.position,i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.position,i,k.FLOAT,false,0,g*i*4);h=f.attributes.normal;if(a.normal>=0&&h){i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.normal,i,k.FLOAT,false,0,g*i*4)}h=f.attributes.uv;
 if(a.uv>=0&&h)if(h.buffer){i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.uv,i,k.FLOAT,false,0,g*i*4);k.enableVertexAttribArray(a.uv)}else k.disableVertexAttribArray(a.uv);i=f.attributes.color;if(a.color>=0&&i){var j=i.itemSize;k.bindBuffer(k.ARRAY_BUFFER,i.buffer);k.vertexAttribPointer(a.color,j,k.FLOAT,false,0,g*j*4)}h=f.attributes.tangent;if(a.tangent>=0&&h){i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.tangent,i,k.FLOAT,false,0,g*i*4)}k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,
 f.attributes.index.buffer)}k.drawElements(k.TRIANGLES,e[d].count,k.UNSIGNED_SHORT,e[d].start*2);O.info.render.calls++;O.info.render.vertices=O.info.render.vertices+e[d].count;O.info.render.faces=O.info.render.faces+e[d].count/3}}else if(e instanceof THREE.ParticleSystem&&b){h=f.attributes.position;i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.position,i,k.FLOAT,false,0,0);i=f.attributes.color;if(a.color>=0&&i){j=i.itemSize;k.bindBuffer(k.ARRAY_BUFFER,i.buffer);k.vertexAttribPointer(a.color,
-j,k.FLOAT,false,0,0)}k.drawArrays(k.POINTS,0,h.numItems/3);O.info.render.calls++;O.info.render.points=O.info.render.points+h.numItems/3}}};this.renderBuffer=function(a,b,c,d,f,e){if(d.visible!==false){var g,h,c=u(a,b,c,d,e),b=c.attributes,a=false,c=f.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==W){W=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){k.bindBuffer(k.ARRAY_BUFFER,f.__webglVertexBuffer);k.vertexAttribPointer(b.position,3,k.FLOAT,false,0,0)}}else if(e.morphTargetBase){c=d.program.attributes;
+j,k.FLOAT,false,0,0)}k.drawArrays(k.POINTS,0,h.numItems/3);O.info.render.calls++;O.info.render.points=O.info.render.points+h.numItems/3}}};this.renderBuffer=function(a,b,c,d,f,e){if(d.visible!==false){var g,h,c=u(a,b,c,d,e),b=c.attributes,a=false,c=f.id*16777215+c.id*2+(d.wireframe?1:0);if(c!==U){U=c;a=true}if(!d.morphTargets&&b.position>=0){if(a){k.bindBuffer(k.ARRAY_BUFFER,f.__webglVertexBuffer);k.vertexAttribPointer(b.position,3,k.FLOAT,false,0,0)}}else if(e.morphTargetBase){c=d.program.attributes;
 if(e.morphTargetBase!==-1){k.bindBuffer(k.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[e.morphTargetBase]);k.vertexAttribPointer(c.position,3,k.FLOAT,false,0,0)}else if(c.position>=0){k.bindBuffer(k.ARRAY_BUFFER,f.__webglVertexBuffer);k.vertexAttribPointer(c.position,3,k.FLOAT,false,0,0)}if(e.morphTargetForcedOrder.length){var i=0;h=e.morphTargetForcedOrder;for(g=e.morphTargetInfluences;i<d.numSupportedMorphTargets&&i<h.length;){k.bindBuffer(k.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[h[i]]);k.vertexAttribPointer(c["morphTarget"+
 i],3,k.FLOAT,false,0,0);if(d.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,f.__webglMorphNormalsBuffers[h[i]]);k.vertexAttribPointer(c["morphNormal"+i],3,k.FLOAT,false,0,0)}e.__webglMorphTargetInfluences[i]=g[h[i]];i++}}else{h=[];g=e.morphTargetInfluences;var j,m=g.length;for(j=0;j<m;j++){i=g[j];i>0&&h.push([j,i])}if(h.length>d.numSupportedMorphTargets){h.sort(l);h.length=d.numSupportedMorphTargets}else h.length>d.numSupportedMorphNormals?h.sort(l):h.length===0&&h.push([0,0]);for(i=0;i<d.numSupportedMorphTargets;){if(h[i]){j=
 h[i][0];k.bindBuffer(k.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[j]);k.vertexAttribPointer(c["morphTarget"+i],3,k.FLOAT,false,0,0);if(d.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,f.__webglMorphNormalsBuffers[j]);k.vertexAttribPointer(c["morphNormal"+i],3,k.FLOAT,false,0,0)}e.__webglMorphTargetInfluences[i]=g[j]}else{k.vertexAttribPointer(c["morphTarget"+i],3,k.FLOAT,false,0,0);d.morphNormals&&k.vertexAttribPointer(c["morphNormal"+i],3,k.FLOAT,false,0,0);e.__webglMorphTargetInfluences[i]=0}i++}}d.program.uniforms.morphTargetInfluences!==
 null&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,e.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){g=0;for(h=f.__webglCustomAttributesList.length;g<h;g++){c=f.__webglCustomAttributesList[g];if(b[c.buffer.belongsToAttribute]>=0){k.bindBuffer(k.ARRAY_BUFFER,c.buffer);k.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,k.FLOAT,false,0,0)}}}if(b.color>=0){k.bindBuffer(k.ARRAY_BUFFER,f.__webglColorBuffer);k.vertexAttribPointer(b.color,3,k.FLOAT,false,0,0)}if(b.normal>=
 0){k.bindBuffer(k.ARRAY_BUFFER,f.__webglNormalBuffer);k.vertexAttribPointer(b.normal,3,k.FLOAT,false,0,0)}if(b.tangent>=0){k.bindBuffer(k.ARRAY_BUFFER,f.__webglTangentBuffer);k.vertexAttribPointer(b.tangent,4,k.FLOAT,false,0,0)}if(b.uv>=0)if(f.__webglUVBuffer){k.bindBuffer(k.ARRAY_BUFFER,f.__webglUVBuffer);k.vertexAttribPointer(b.uv,2,k.FLOAT,false,0,0);k.enableVertexAttribArray(b.uv)}else k.disableVertexAttribArray(b.uv);if(b.uv2>=0)if(f.__webglUV2Buffer){k.bindBuffer(k.ARRAY_BUFFER,f.__webglUV2Buffer);
-k.vertexAttribPointer(b.uv2,2,k.FLOAT,false,0,0);k.enableVertexAttribArray(b.uv2)}else k.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinIndex>=0&&b.skinWeight>=0){k.bindBuffer(k.ARRAY_BUFFER,f.__webglSkinIndicesBuffer);k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,f.__webglSkinWeightsBuffer);k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,false,0,0)}}if(e instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==Fa){k.lineWidth(d);Fa=d}a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,
-f.__webglLineBuffer);k.drawElements(k.LINES,f.__webglLineCount,k.UNSIGNED_SHORT,0)}else{a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer);k.drawElements(k.TRIANGLES,f.__webglFaceCount,k.UNSIGNED_SHORT,0)}O.info.render.calls++;O.info.render.vertices=O.info.render.vertices+f.__webglFaceCount;O.info.render.faces=O.info.render.faces+f.__webglFaceCount/3}else if(e instanceof THREE.Line){e=e.type===THREE.LineStrip?k.LINE_STRIP:k.LINES;d=d.linewidth;if(d!==Fa){k.lineWidth(d);Fa=d}k.drawArrays(e,
+k.vertexAttribPointer(b.uv2,2,k.FLOAT,false,0,0);k.enableVertexAttribArray(b.uv2)}else k.disableVertexAttribArray(b.uv2);if(d.skinning&&b.skinIndex>=0&&b.skinWeight>=0){k.bindBuffer(k.ARRAY_BUFFER,f.__webglSkinIndicesBuffer);k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,false,0,0);k.bindBuffer(k.ARRAY_BUFFER,f.__webglSkinWeightsBuffer);k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,false,0,0)}}if(e instanceof THREE.Mesh){if(d.wireframe){d=d.wireframeLinewidth;if(d!==Ga){k.lineWidth(d);Ga=d}a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,
+f.__webglLineBuffer);k.drawElements(k.LINES,f.__webglLineCount,k.UNSIGNED_SHORT,0)}else{a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer);k.drawElements(k.TRIANGLES,f.__webglFaceCount,k.UNSIGNED_SHORT,0)}O.info.render.calls++;O.info.render.vertices=O.info.render.vertices+f.__webglFaceCount;O.info.render.faces=O.info.render.faces+f.__webglFaceCount/3}else if(e instanceof THREE.Line){e=e.type===THREE.LineStrip?k.LINE_STRIP:k.LINES;d=d.linewidth;if(d!==Ga){k.lineWidth(d);Ga=d}k.drawArrays(e,
 0,f.__webglLineCount);O.info.render.calls++}else if(e instanceof THREE.ParticleSystem){k.drawArrays(k.POINTS,0,f.__webglParticleCount);O.info.render.calls++;O.info.render.points=O.info.render.points+f.__webglParticleCount}else if(e instanceof THREE.Ribbon){k.drawArrays(k.TRIANGLE_STRIP,0,f.__webglVertexCount);O.info.render.calls++}}};this.render=function(a,b,c,d){if(b instanceof THREE.Camera===false)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var f,
-e,g,h,l=a.__lights,o=a.fog;M=-1;gb=true;this.autoUpdateScene&&a.updateMatrixWorld();b.parent===void 0&&b.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);ab.multiply(b.projectionMatrix,b.matrixWorldInverse);$a.setFromMatrix(ab);this.autoUpdateObjects&&
-this.initWebGLObjects(a);j(this.renderPluginsPre,a,b);O.info.render.calls=0;O.info.render.vertices=0;O.info.render.faces=0;O.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(f=h.length;d<f;d++){e=h[d];g=e.object;e.render=false;if(g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||$a.contains(g))){t(g,b);var p=e,q=p.object,r=p.buffer,s=void 0,
-s=s=void 0,s=q.material;if(s instanceof THREE.MeshFaceMaterial){s=r.materialIndex;if(s>=0){s=q.geometry.materials[s];if(s.transparent){p.transparent=s;p.opaque=null}else{p.opaque=s;p.transparent=null}}}else if(s)if(s.transparent){p.transparent=s;p.opaque=null}else{p.opaque=s;p.transparent=null}e.render=true;if(this.sortObjects)if(g.renderDepth)e.z=g.renderDepth;else{Oa.copy(g.matrixWorld.getPosition());ab.multiplyVector3(Oa);e.z=Oa.z}}}this.sortObjects&&h.sort(i);h=a.__webglObjectsImmediate;d=0;for(f=
-h.length;d<f;d++){e=h[d];g=e.object;if(g.visible){t(g,b);g=e.object.material;if(g.transparent){e.transparent=g;e.opaque=null}else{e.opaque=g;e.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);B(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);n(a.__webglObjects,false,"",b,l,o,true,d);m(a.__webglObjectsImmediate,"",b,l,o,false,d)}else{this.setBlending(THREE.NormalBlending);
-n(a.__webglObjects,true,"opaque",b,l,o,false);m(a.__webglObjectsImmediate,"opaque",b,l,o,false);n(a.__webglObjects,false,"transparent",b,l,o,true);m(a.__webglObjectsImmediate,"transparent",b,l,o,true)}j(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture);k.generateMipmap(k.TEXTURE_CUBE_MAP);k.bindTexture(k.TEXTURE_CUBE_MAP,null)}else{k.bindTexture(k.TEXTURE_2D,
-c.__webglTexture);k.generateMipmap(k.TEXTURE_2D);k.bindTexture(k.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)}};this.renderImmediateObject=function(a,b,c,d,f){var e=u(a,b,c,d,f);W=-1;O.setMaterialFaces(d);f.immediateRenderCallback?f.immediateRenderCallback(e,k,$a):f.render(function(a){O.renderBufferImmediate(a,e,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var i=
-a.__objectsAdded[0],j=a,l=void 0,m=void 0,n=void 0;if(!i.__webglInit){i.__webglInit=true;i._modelViewMatrix=new THREE.Matrix4;i._normalMatrix=new THREE.Matrix3;if(i instanceof THREE.Mesh){m=i.geometry;if(m instanceof THREE.Geometry){if(m.geometryGroups===void 0){var t=m,u=void 0,v=void 0,x=void 0,y=void 0,A=void 0,B=void 0,G=void 0,E={},F=t.morphTargets.length,K=t.morphNormals.length;t.geometryGroups={};u=0;for(v=t.faces.length;u<v;u++){x=t.faces[u];y=x.materialIndex;B=y!==void 0?y:-1;E[B]===void 0&&
-(E[B]={hash:B,counter:0});G=E[B].hash+"_"+E[B].counter;t.geometryGroups[G]===void 0&&(t.geometryGroups[G]={faces3:[],faces4:[],materialIndex:y,vertices:0,numMorphTargets:F,numMorphNormals:K});A=x instanceof THREE.Face3?3:4;if(t.geometryGroups[G].vertices+A>65535){E[B].counter=E[B].counter+1;G=E[B].hash+"_"+E[B].counter;t.geometryGroups[G]===void 0&&(t.geometryGroups[G]={faces3:[],faces4:[],materialIndex:y,vertices:0,numMorphTargets:F,numMorphNormals:K})}x instanceof THREE.Face3?t.geometryGroups[G].faces3.push(u):
-t.geometryGroups[G].faces4.push(u);t.geometryGroups[G].vertices=t.geometryGroups[G].vertices+A}t.geometryGroupsList=[];var H=void 0;for(H in t.geometryGroups){t.geometryGroups[H].id=ia++;t.geometryGroupsList.push(t.geometryGroups[H])}}for(l in m.geometryGroups){n=m.geometryGroups[l];if(!n.__webglVertexBuffer){var D=n;D.__webglVertexBuffer=k.createBuffer();D.__webglNormalBuffer=k.createBuffer();D.__webglTangentBuffer=k.createBuffer();D.__webglColorBuffer=k.createBuffer();D.__webglUVBuffer=k.createBuffer();
-D.__webglUV2Buffer=k.createBuffer();D.__webglSkinIndicesBuffer=k.createBuffer();D.__webglSkinWeightsBuffer=k.createBuffer();D.__webglFaceBuffer=k.createBuffer();D.__webglLineBuffer=k.createBuffer();var I=void 0,J=void 0;if(D.numMorphTargets){D.__webglMorphTargetsBuffers=[];I=0;for(J=D.numMorphTargets;I<J;I++)D.__webglMorphTargetsBuffers.push(k.createBuffer())}if(D.numMorphNormals){D.__webglMorphNormalsBuffers=[];I=0;for(J=D.numMorphNormals;I<J;I++)D.__webglMorphNormalsBuffers.push(k.createBuffer())}O.info.memory.geometries++;
-var M=n,L=i,N=L.geometry,P=M.faces3,da=M.faces4,W=P.length*3+da.length*4,R=P.length*1+da.length*2,S=P.length*3+da.length*4,Y=c(L,M),ba=f(Y),ha=d(Y),fa=Y.vertexColors?Y.vertexColors:false;M.__vertexArray=new Float32Array(W*3);if(ha)M.__normalArray=new Float32Array(W*3);if(N.hasTangents)M.__tangentArray=new Float32Array(W*4);if(fa)M.__colorArray=new Float32Array(W*3);if(ba){if(N.faceUvs.length>0||N.faceVertexUvs.length>0)M.__uvArray=new Float32Array(W*2);if(N.faceUvs.length>1||N.faceVertexUvs.length>
-1)M.__uv2Array=new Float32Array(W*2)}if(L.geometry.skinWeights.length&&L.geometry.skinIndices.length){M.__skinIndexArray=new Float32Array(W*4);M.__skinWeightArray=new Float32Array(W*4)}M.__faceArray=new Uint16Array(R*3);M.__lineArray=new Uint16Array(S*2);var oa=void 0,ta=void 0;if(M.numMorphTargets){M.__morphTargetsArrays=[];oa=0;for(ta=M.numMorphTargets;oa<ta;oa++)M.__morphTargetsArrays.push(new Float32Array(W*3))}if(M.numMorphNormals){M.__morphNormalsArrays=[];oa=0;for(ta=M.numMorphNormals;oa<ta;oa++)M.__morphNormalsArrays.push(new Float32Array(W*
-3))}M.__webglFaceCount=R*3;M.__webglLineCount=S*2;if(Y.attributes){if(M.__webglCustomAttributesList===void 0)M.__webglCustomAttributesList=[];var ra=void 0;for(ra in Y.attributes){var Ca=Y.attributes[ra],ja={},Ia;for(Ia in Ca)ja[Ia]=Ca[Ia];if(!ja.__webglInitialized||ja.createUniqueBuffers){ja.__webglInitialized=true;var va=1;ja.type==="v2"?va=2:ja.type==="v3"?va=3:ja.type==="v4"?va=4:ja.type==="c"&&(va=3);ja.size=va;ja.array=new Float32Array(W*va);ja.buffer=k.createBuffer();ja.buffer.belongsToAttribute=
-ra;Ca.needsUpdate=true;ja.__original=Ca}M.__webglCustomAttributesList.push(ja)}}M.__inittedArrays=true;m.verticesNeedUpdate=true;m.morphTargetsNeedUpdate=true;m.elementsNeedUpdate=true;m.uvsNeedUpdate=true;m.normalsNeedUpdate=true;m.tangentsNeedUpdate=true;m.colorsNeedUpdate=true}}}else m instanceof THREE.BufferGeometry&&e(m)}else if(i instanceof THREE.Ribbon){m=i.geometry;if(!m.__webglVertexBuffer){var Da=m;Da.__webglVertexBuffer=k.createBuffer();Da.__webglColorBuffer=k.createBuffer();O.info.memory.geometries++;
-var xa=m,Ga=xa.vertices.length;xa.__vertexArray=new Float32Array(Ga*3);xa.__colorArray=new Float32Array(Ga*3);xa.__webglVertexCount=Ga;m.verticesNeedUpdate=true;m.colorsNeedUpdate=true}}else if(i instanceof THREE.Line){m=i.geometry;if(!m.__webglVertexBuffer){var Na=m;Na.__webglVertexBuffer=k.createBuffer();Na.__webglColorBuffer=k.createBuffer();O.info.memory.geometries++;var Fa=m,Oa=i,Pa=Fa.vertices.length;Fa.__vertexArray=new Float32Array(Pa*3);Fa.__colorArray=new Float32Array(Pa*3);Fa.__webglLineCount=
-Pa;b(Fa,Oa);m.verticesNeedUpdate=true;m.colorsNeedUpdate=true}}else if(i instanceof THREE.ParticleSystem){m=i.geometry;if(!m.__webglVertexBuffer)if(m instanceof THREE.Geometry){var Wa=m;Wa.__webglVertexBuffer=k.createBuffer();Wa.__webglColorBuffer=k.createBuffer();O.info.geometries++;var Xa=m,ob=i,eb=Xa.vertices.length;Xa.__vertexArray=new Float32Array(eb*3);Xa.__colorArray=new Float32Array(eb*3);Xa.__sortArray=[];Xa.__webglParticleCount=eb;b(Xa,ob);m.verticesNeedUpdate=true;m.colorsNeedUpdate=true}else m instanceof
-THREE.BufferGeometry&&e(m)}}if(!i.__webglActive){if(i instanceof THREE.Mesh){m=i.geometry;if(m instanceof THREE.BufferGeometry)q(j.__webglObjects,m,i);else for(l in m.geometryGroups){n=m.geometryGroups[l];q(j.__webglObjects,n,i)}}else if(i instanceof THREE.Ribbon||i instanceof THREE.Line||i instanceof THREE.ParticleSystem){m=i.geometry;q(j.__webglObjects,m,i)}else i instanceof THREE.ImmediateRenderObject||i.immediateRenderCallback?j.__webglObjectsImmediate.push({object:i,opaque:null,transparent:null}):
-i instanceof THREE.Sprite?j.__webglSprites.push(i):i instanceof THREE.LensFlare&&j.__webglFlares.push(i);i.__webglActive=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var kb=a.__objectsRemoved[0],Za=a;kb instanceof THREE.Mesh||kb instanceof THREE.ParticleSystem||kb instanceof THREE.Ribbon||kb instanceof THREE.Line?s(Za.__webglObjects,kb):kb instanceof THREE.Sprite?r(Za.__webglSprites,kb):kb instanceof THREE.LensFlare?r(Za.__webglFlares,kb):(kb instanceof THREE.ImmediateRenderObject||
-kb.immediateRenderCallback)&&s(Za.__webglObjectsImmediate,kb);kb.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var gb=0,qb=a.__webglObjects.length;gb<qb;gb++){var ub=a.__webglObjects[gb].object,ea=ub.geometry,ab=void 0,$a=void 0,bb=void 0;if(ub instanceof THREE.Mesh)if(ea instanceof THREE.BufferGeometry){(ea.verticesNeedUpdate||ea.elementsNeedUpdate||ea.uvsNeedUpdate||ea.normalsNeedUpdate||ea.colorsNeedUpdate||ea.tangentsNeedUpdate)&&h(ea,k.DYNAMIC_DRAW,!ea.dynamic);ea.verticesNeedUpdate=
-false;ea.elementsNeedUpdate=false;ea.uvsNeedUpdate=false;ea.normalsNeedUpdate=false;ea.colorsNeedUpdate=false;ea.tangentsNeedUpdate=false}else{for(var pb=0,wb=ea.geometryGroupsList.length;pb<wb;pb++){ab=ea.geometryGroupsList[pb];bb=c(ub,ab);$a=bb.attributes&&o(bb);if(ea.verticesNeedUpdate||ea.morphTargetsNeedUpdate||ea.elementsNeedUpdate||ea.uvsNeedUpdate||ea.normalsNeedUpdate||ea.colorsNeedUpdate||ea.tangentsNeedUpdate||$a){var la=ab,xb=ub,lb=k.DYNAMIC_DRAW,yb=!ea.dynamic,fb=bb;if(la.__inittedArrays){var Pb=
-d(fb),ec=fb.vertexColors?fb.vertexColors:false,ic=f(fb),Fc=Pb===THREE.SmoothShading,C=void 0,X=void 0,Xb=void 0,Q=void 0,kc=void 0,Yb=void 0,vb=void 0,Gc=void 0,Qb=void 0,lc=void 0,mc=void 0,T=void 0,U=void 0,V=void 0,ka=void 0,zb=void 0,Ab=void 0,Bb=void 0,sc=void 0,Cb=void 0,Db=void 0,Eb=void 0,tc=void 0,Fb=void 0,Gb=void 0,Hb=void 0,uc=void 0,Ib=void 0,Jb=void 0,Kb=void 0,vc=void 0,Lb=void 0,Mb=void 0,Nb=void 0,wc=void 0,qa=void 0,qc=void 0,Zb=void 0,nc=void 0,oc=void 0,Qa=void 0,rc=void 0,La=
-void 0,Ma=void 0,$b=void 0,Rb=void 0,Ha=0,Ka=0,Sb=0,Tb=0,mb=0,Ua=0,ua=0,Ya=0,Ja=0,aa=0,ga=0,z=0,sa=void 0,Ra=la.__vertexArray,xc=la.__uvArray,yc=la.__uv2Array,nb=la.__normalArray,ya=la.__tangentArray,Sa=la.__colorArray,za=la.__skinIndexArray,Aa=la.__skinWeightArray,Uc=la.__morphTargetsArrays,Vc=la.__morphNormalsArrays,Wc=la.__webglCustomAttributesList,w=void 0,Ob=la.__faceArray,hb=la.__lineArray,cb=xb.geometry,Dc=cb.elementsNeedUpdate,ad=cb.uvsNeedUpdate,Rc=cb.normalsNeedUpdate,Sc=cb.tangentsNeedUpdate,
-hd=cb.colorsNeedUpdate,id=cb.morphTargetsNeedUpdate,gc=cb.vertices,ma=la.faces3,na=la.faces4,Va=cb.faces,Xc=cb.faceVertexUvs[0],Yc=cb.faceVertexUvs[1],hc=cb.skinIndices,ac=cb.skinWeights,bc=cb.morphTargets,Hc=cb.morphNormals;if(cb.verticesNeedUpdate){C=0;for(X=ma.length;C<X;C++){Q=Va[ma[C]];T=gc[Q.a];U=gc[Q.b];V=gc[Q.c];Ra[Ka]=T.x;Ra[Ka+1]=T.y;Ra[Ka+2]=T.z;Ra[Ka+3]=U.x;Ra[Ka+4]=U.y;Ra[Ka+5]=U.z;Ra[Ka+6]=V.x;Ra[Ka+7]=V.y;Ra[Ka+8]=V.z;Ka=Ka+9}C=0;for(X=na.length;C<X;C++){Q=Va[na[C]];T=gc[Q.a];U=gc[Q.b];
-V=gc[Q.c];ka=gc[Q.d];Ra[Ka]=T.x;Ra[Ka+1]=T.y;Ra[Ka+2]=T.z;Ra[Ka+3]=U.x;Ra[Ka+4]=U.y;Ra[Ka+5]=U.z;Ra[Ka+6]=V.x;Ra[Ka+7]=V.y;Ra[Ka+8]=V.z;Ra[Ka+9]=ka.x;Ra[Ka+10]=ka.y;Ra[Ka+11]=ka.z;Ka=Ka+12}k.bindBuffer(k.ARRAY_BUFFER,la.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Ra,lb)}if(id){Qa=0;for(rc=bc.length;Qa<rc;Qa++){C=ga=0;for(X=ma.length;C<X;C++){$b=ma[C];Q=Va[$b];T=bc[Qa].vertices[Q.a];U=bc[Qa].vertices[Q.b];V=bc[Qa].vertices[Q.c];La=Uc[Qa];La[ga]=T.x;La[ga+1]=T.y;La[ga+2]=T.z;La[ga+3]=U.x;La[ga+
-4]=U.y;La[ga+5]=U.z;La[ga+6]=V.x;La[ga+7]=V.y;La[ga+8]=V.z;if(fb.morphNormals){if(Fc){Rb=Hc[Qa].vertexNormals[$b];Cb=Rb.a;Db=Rb.b;Eb=Rb.c}else Eb=Db=Cb=Hc[Qa].faceNormals[$b];Ma=Vc[Qa];Ma[ga]=Cb.x;Ma[ga+1]=Cb.y;Ma[ga+2]=Cb.z;Ma[ga+3]=Db.x;Ma[ga+4]=Db.y;Ma[ga+5]=Db.z;Ma[ga+6]=Eb.x;Ma[ga+7]=Eb.y;Ma[ga+8]=Eb.z}ga=ga+9}C=0;for(X=na.length;C<X;C++){$b=na[C];Q=Va[$b];T=bc[Qa].vertices[Q.a];U=bc[Qa].vertices[Q.b];V=bc[Qa].vertices[Q.c];ka=bc[Qa].vertices[Q.d];La=Uc[Qa];La[ga]=T.x;La[ga+1]=T.y;La[ga+2]=T.z;
-La[ga+3]=U.x;La[ga+4]=U.y;La[ga+5]=U.z;La[ga+6]=V.x;La[ga+7]=V.y;La[ga+8]=V.z;La[ga+9]=ka.x;La[ga+10]=ka.y;La[ga+11]=ka.z;if(fb.morphNormals){if(Fc){Rb=Hc[Qa].vertexNormals[$b];Cb=Rb.a;Db=Rb.b;Eb=Rb.c;tc=Rb.d}else tc=Eb=Db=Cb=Hc[Qa].faceNormals[$b];Ma=Vc[Qa];Ma[ga]=Cb.x;Ma[ga+1]=Cb.y;Ma[ga+2]=Cb.z;Ma[ga+3]=Db.x;Ma[ga+4]=Db.y;Ma[ga+5]=Db.z;Ma[ga+6]=Eb.x;Ma[ga+7]=Eb.y;Ma[ga+8]=Eb.z;Ma[ga+9]=tc.x;Ma[ga+10]=tc.y;Ma[ga+11]=tc.z}ga=ga+12}k.bindBuffer(k.ARRAY_BUFFER,la.__webglMorphTargetsBuffers[Qa]);k.bufferData(k.ARRAY_BUFFER,
-Uc[Qa],lb);if(fb.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,la.__webglMorphNormalsBuffers[Qa]);k.bufferData(k.ARRAY_BUFFER,Vc[Qa],lb)}}}if(ac.length){C=0;for(X=ma.length;C<X;C++){Q=Va[ma[C]];Ib=ac[Q.a];Jb=ac[Q.b];Kb=ac[Q.c];Aa[aa]=Ib.x;Aa[aa+1]=Ib.y;Aa[aa+2]=Ib.z;Aa[aa+3]=Ib.w;Aa[aa+4]=Jb.x;Aa[aa+5]=Jb.y;Aa[aa+6]=Jb.z;Aa[aa+7]=Jb.w;Aa[aa+8]=Kb.x;Aa[aa+9]=Kb.y;Aa[aa+10]=Kb.z;Aa[aa+11]=Kb.w;Lb=hc[Q.a];Mb=hc[Q.b];Nb=hc[Q.c];za[aa]=Lb.x;za[aa+1]=Lb.y;za[aa+2]=Lb.z;za[aa+3]=Lb.w;za[aa+4]=Mb.x;za[aa+5]=
-Mb.y;za[aa+6]=Mb.z;za[aa+7]=Mb.w;za[aa+8]=Nb.x;za[aa+9]=Nb.y;za[aa+10]=Nb.z;za[aa+11]=Nb.w;aa=aa+12}C=0;for(X=na.length;C<X;C++){Q=Va[na[C]];Ib=ac[Q.a];Jb=ac[Q.b];Kb=ac[Q.c];vc=ac[Q.d];Aa[aa]=Ib.x;Aa[aa+1]=Ib.y;Aa[aa+2]=Ib.z;Aa[aa+3]=Ib.w;Aa[aa+4]=Jb.x;Aa[aa+5]=Jb.y;Aa[aa+6]=Jb.z;Aa[aa+7]=Jb.w;Aa[aa+8]=Kb.x;Aa[aa+9]=Kb.y;Aa[aa+10]=Kb.z;Aa[aa+11]=Kb.w;Aa[aa+12]=vc.x;Aa[aa+13]=vc.y;Aa[aa+14]=vc.z;Aa[aa+15]=vc.w;Lb=hc[Q.a];Mb=hc[Q.b];Nb=hc[Q.c];wc=hc[Q.d];za[aa]=Lb.x;za[aa+1]=Lb.y;za[aa+2]=Lb.z;za[aa+
-3]=Lb.w;za[aa+4]=Mb.x;za[aa+5]=Mb.y;za[aa+6]=Mb.z;za[aa+7]=Mb.w;za[aa+8]=Nb.x;za[aa+9]=Nb.y;za[aa+10]=Nb.z;za[aa+11]=Nb.w;za[aa+12]=wc.x;za[aa+13]=wc.y;za[aa+14]=wc.z;za[aa+15]=wc.w;aa=aa+16}if(aa>0){k.bindBuffer(k.ARRAY_BUFFER,la.__webglSkinIndicesBuffer);k.bufferData(k.ARRAY_BUFFER,za,lb);k.bindBuffer(k.ARRAY_BUFFER,la.__webglSkinWeightsBuffer);k.bufferData(k.ARRAY_BUFFER,Aa,lb)}}if(hd&&ec){C=0;for(X=ma.length;C<X;C++){Q=Va[ma[C]];vb=Q.vertexColors;Gc=Q.color;if(vb.length===3&&ec===THREE.VertexColors){Fb=
-vb[0];Gb=vb[1];Hb=vb[2]}else Hb=Gb=Fb=Gc;Sa[Ja]=Fb.r;Sa[Ja+1]=Fb.g;Sa[Ja+2]=Fb.b;Sa[Ja+3]=Gb.r;Sa[Ja+4]=Gb.g;Sa[Ja+5]=Gb.b;Sa[Ja+6]=Hb.r;Sa[Ja+7]=Hb.g;Sa[Ja+8]=Hb.b;Ja=Ja+9}C=0;for(X=na.length;C<X;C++){Q=Va[na[C]];vb=Q.vertexColors;Gc=Q.color;if(vb.length===4&&ec===THREE.VertexColors){Fb=vb[0];Gb=vb[1];Hb=vb[2];uc=vb[3]}else uc=Hb=Gb=Fb=Gc;Sa[Ja]=Fb.r;Sa[Ja+1]=Fb.g;Sa[Ja+2]=Fb.b;Sa[Ja+3]=Gb.r;Sa[Ja+4]=Gb.g;Sa[Ja+5]=Gb.b;Sa[Ja+6]=Hb.r;Sa[Ja+7]=Hb.g;Sa[Ja+8]=Hb.b;Sa[Ja+9]=uc.r;Sa[Ja+10]=uc.g;Sa[Ja+
-11]=uc.b;Ja=Ja+12}if(Ja>0){k.bindBuffer(k.ARRAY_BUFFER,la.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Sa,lb)}}if(Sc&&cb.hasTangents){C=0;for(X=ma.length;C<X;C++){Q=Va[ma[C]];Qb=Q.vertexTangents;zb=Qb[0];Ab=Qb[1];Bb=Qb[2];ya[ua]=zb.x;ya[ua+1]=zb.y;ya[ua+2]=zb.z;ya[ua+3]=zb.w;ya[ua+4]=Ab.x;ya[ua+5]=Ab.y;ya[ua+6]=Ab.z;ya[ua+7]=Ab.w;ya[ua+8]=Bb.x;ya[ua+9]=Bb.y;ya[ua+10]=Bb.z;ya[ua+11]=Bb.w;ua=ua+12}C=0;for(X=na.length;C<X;C++){Q=Va[na[C]];Qb=Q.vertexTangents;zb=Qb[0];Ab=Qb[1];Bb=Qb[2];sc=Qb[3];ya[ua]=
-zb.x;ya[ua+1]=zb.y;ya[ua+2]=zb.z;ya[ua+3]=zb.w;ya[ua+4]=Ab.x;ya[ua+5]=Ab.y;ya[ua+6]=Ab.z;ya[ua+7]=Ab.w;ya[ua+8]=Bb.x;ya[ua+9]=Bb.y;ya[ua+10]=Bb.z;ya[ua+11]=Bb.w;ya[ua+12]=sc.x;ya[ua+13]=sc.y;ya[ua+14]=sc.z;ya[ua+15]=sc.w;ua=ua+16}k.bindBuffer(k.ARRAY_BUFFER,la.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,ya,lb)}if(Rc&&Pb){C=0;for(X=ma.length;C<X;C++){Q=Va[ma[C]];kc=Q.vertexNormals;Yb=Q.normal;if(kc.length===3&&Fc)for(qa=0;qa<3;qa++){Zb=kc[qa];nb[Ua]=Zb.x;nb[Ua+1]=Zb.y;nb[Ua+2]=Zb.z;Ua=Ua+3}else for(qa=
-0;qa<3;qa++){nb[Ua]=Yb.x;nb[Ua+1]=Yb.y;nb[Ua+2]=Yb.z;Ua=Ua+3}}C=0;for(X=na.length;C<X;C++){Q=Va[na[C]];kc=Q.vertexNormals;Yb=Q.normal;if(kc.length===4&&Fc)for(qa=0;qa<4;qa++){Zb=kc[qa];nb[Ua]=Zb.x;nb[Ua+1]=Zb.y;nb[Ua+2]=Zb.z;Ua=Ua+3}else for(qa=0;qa<4;qa++){nb[Ua]=Yb.x;nb[Ua+1]=Yb.y;nb[Ua+2]=Yb.z;Ua=Ua+3}}k.bindBuffer(k.ARRAY_BUFFER,la.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,nb,lb)}if(ad&&Xc&&ic){C=0;for(X=ma.length;C<X;C++){Xb=ma[C];lc=Xc[Xb];if(lc!==void 0)for(qa=0;qa<3;qa++){nc=lc[qa];
-xc[Sb]=nc.u;xc[Sb+1]=nc.v;Sb=Sb+2}}C=0;for(X=na.length;C<X;C++){Xb=na[C];lc=Xc[Xb];if(lc!==void 0)for(qa=0;qa<4;qa++){nc=lc[qa];xc[Sb]=nc.u;xc[Sb+1]=nc.v;Sb=Sb+2}}if(Sb>0){k.bindBuffer(k.ARRAY_BUFFER,la.__webglUVBuffer);k.bufferData(k.ARRAY_BUFFER,xc,lb)}}if(ad&&Yc&&ic){C=0;for(X=ma.length;C<X;C++){Xb=ma[C];mc=Yc[Xb];if(mc!==void 0)for(qa=0;qa<3;qa++){oc=mc[qa];yc[Tb]=oc.u;yc[Tb+1]=oc.v;Tb=Tb+2}}C=0;for(X=na.length;C<X;C++){Xb=na[C];mc=Yc[Xb];if(mc!==void 0)for(qa=0;qa<4;qa++){oc=mc[qa];yc[Tb]=oc.u;
-yc[Tb+1]=oc.v;Tb=Tb+2}}if(Tb>0){k.bindBuffer(k.ARRAY_BUFFER,la.__webglUV2Buffer);k.bufferData(k.ARRAY_BUFFER,yc,lb)}}if(Dc){C=0;for(X=ma.length;C<X;C++){Ob[mb]=Ha;Ob[mb+1]=Ha+1;Ob[mb+2]=Ha+2;mb=mb+3;hb[Ya]=Ha;hb[Ya+1]=Ha+1;hb[Ya+2]=Ha;hb[Ya+3]=Ha+2;hb[Ya+4]=Ha+1;hb[Ya+5]=Ha+2;Ya=Ya+6;Ha=Ha+3}C=0;for(X=na.length;C<X;C++){Ob[mb]=Ha;Ob[mb+1]=Ha+1;Ob[mb+2]=Ha+3;Ob[mb+3]=Ha+1;Ob[mb+4]=Ha+2;Ob[mb+5]=Ha+3;mb=mb+6;hb[Ya]=Ha;hb[Ya+1]=Ha+1;hb[Ya+2]=Ha;hb[Ya+3]=Ha+3;hb[Ya+4]=Ha+1;hb[Ya+5]=Ha+2;hb[Ya+6]=Ha+2;
-hb[Ya+7]=Ha+3;Ya=Ya+8;Ha=Ha+4}k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,la.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Ob,lb);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,la.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,hb,lb)}if(Wc){qa=0;for(qc=Wc.length;qa<qc;qa++){w=Wc[qa];if(w.__original.needsUpdate){z=0;if(w.size===1)if(w.boundTo===void 0||w.boundTo==="vertices"){C=0;for(X=ma.length;C<X;C++){Q=Va[ma[C]];w.array[z]=w.value[Q.a];w.array[z+1]=w.value[Q.b];w.array[z+2]=w.value[Q.c];z=z+3}C=
-0;for(X=na.length;C<X;C++){Q=Va[na[C]];w.array[z]=w.value[Q.a];w.array[z+1]=w.value[Q.b];w.array[z+2]=w.value[Q.c];w.array[z+3]=w.value[Q.d];z=z+4}}else{if(w.boundTo==="faces"){C=0;for(X=ma.length;C<X;C++){sa=w.value[ma[C]];w.array[z]=sa;w.array[z+1]=sa;w.array[z+2]=sa;z=z+3}C=0;for(X=na.length;C<X;C++){sa=w.value[na[C]];w.array[z]=sa;w.array[z+1]=sa;w.array[z+2]=sa;w.array[z+3]=sa;z=z+4}}}else if(w.size===2)if(w.boundTo===void 0||w.boundTo==="vertices"){C=0;for(X=ma.length;C<X;C++){Q=Va[ma[C]];T=
-w.value[Q.a];U=w.value[Q.b];V=w.value[Q.c];w.array[z]=T.x;w.array[z+1]=T.y;w.array[z+2]=U.x;w.array[z+3]=U.y;w.array[z+4]=V.x;w.array[z+5]=V.y;z=z+6}C=0;for(X=na.length;C<X;C++){Q=Va[na[C]];T=w.value[Q.a];U=w.value[Q.b];V=w.value[Q.c];ka=w.value[Q.d];w.array[z]=T.x;w.array[z+1]=T.y;w.array[z+2]=U.x;w.array[z+3]=U.y;w.array[z+4]=V.x;w.array[z+5]=V.y;w.array[z+6]=ka.x;w.array[z+7]=ka.y;z=z+8}}else{if(w.boundTo==="faces"){C=0;for(X=ma.length;C<X;C++){V=U=T=sa=w.value[ma[C]];w.array[z]=T.x;w.array[z+
-1]=T.y;w.array[z+2]=U.x;w.array[z+3]=U.y;w.array[z+4]=V.x;w.array[z+5]=V.y;z=z+6}C=0;for(X=na.length;C<X;C++){ka=V=U=T=sa=w.value[na[C]];w.array[z]=T.x;w.array[z+1]=T.y;w.array[z+2]=U.x;w.array[z+3]=U.y;w.array[z+4]=V.x;w.array[z+5]=V.y;w.array[z+6]=ka.x;w.array[z+7]=ka.y;z=z+8}}}else if(w.size===3){var $;$=w.type==="c"?["r","g","b"]:["x","y","z"];if(w.boundTo===void 0||w.boundTo==="vertices"){C=0;for(X=ma.length;C<X;C++){Q=Va[ma[C]];T=w.value[Q.a];U=w.value[Q.b];V=w.value[Q.c];w.array[z]=T[$[0]];
-w.array[z+1]=T[$[1]];w.array[z+2]=T[$[2]];w.array[z+3]=U[$[0]];w.array[z+4]=U[$[1]];w.array[z+5]=U[$[2]];w.array[z+6]=V[$[0]];w.array[z+7]=V[$[1]];w.array[z+8]=V[$[2]];z=z+9}C=0;for(X=na.length;C<X;C++){Q=Va[na[C]];T=w.value[Q.a];U=w.value[Q.b];V=w.value[Q.c];ka=w.value[Q.d];w.array[z]=T[$[0]];w.array[z+1]=T[$[1]];w.array[z+2]=T[$[2]];w.array[z+3]=U[$[0]];w.array[z+4]=U[$[1]];w.array[z+5]=U[$[2]];w.array[z+6]=V[$[0]];w.array[z+7]=V[$[1]];w.array[z+8]=V[$[2]];w.array[z+9]=ka[$[0]];w.array[z+10]=ka[$[1]];
-w.array[z+11]=ka[$[2]];z=z+12}}else if(w.boundTo==="faces"){C=0;for(X=ma.length;C<X;C++){V=U=T=sa=w.value[ma[C]];w.array[z]=T[$[0]];w.array[z+1]=T[$[1]];w.array[z+2]=T[$[2]];w.array[z+3]=U[$[0]];w.array[z+4]=U[$[1]];w.array[z+5]=U[$[2]];w.array[z+6]=V[$[0]];w.array[z+7]=V[$[1]];w.array[z+8]=V[$[2]];z=z+9}C=0;for(X=na.length;C<X;C++){ka=V=U=T=sa=w.value[na[C]];w.array[z]=T[$[0]];w.array[z+1]=T[$[1]];w.array[z+2]=T[$[2]];w.array[z+3]=U[$[0]];w.array[z+4]=U[$[1]];w.array[z+5]=U[$[2]];w.array[z+6]=V[$[0]];
-w.array[z+7]=V[$[1]];w.array[z+8]=V[$[2]];w.array[z+9]=ka[$[0]];w.array[z+10]=ka[$[1]];w.array[z+11]=ka[$[2]];z=z+12}}else if(w.boundTo==="faceVertices"){C=0;for(X=ma.length;C<X;C++){sa=w.value[ma[C]];T=sa[0];U=sa[1];V=sa[2];w.array[z]=T[$[0]];w.array[z+1]=T[$[1]];w.array[z+2]=T[$[2]];w.array[z+3]=U[$[0]];w.array[z+4]=U[$[1]];w.array[z+5]=U[$[2]];w.array[z+6]=V[$[0]];w.array[z+7]=V[$[1]];w.array[z+8]=V[$[2]];z=z+9}C=0;for(X=na.length;C<X;C++){sa=w.value[na[C]];T=sa[0];U=sa[1];V=sa[2];ka=sa[3];w.array[z]=
-T[$[0]];w.array[z+1]=T[$[1]];w.array[z+2]=T[$[2]];w.array[z+3]=U[$[0]];w.array[z+4]=U[$[1]];w.array[z+5]=U[$[2]];w.array[z+6]=V[$[0]];w.array[z+7]=V[$[1]];w.array[z+8]=V[$[2]];w.array[z+9]=ka[$[0]];w.array[z+10]=ka[$[1]];w.array[z+11]=ka[$[2]];z=z+12}}}else if(w.size===4)if(w.boundTo===void 0||w.boundTo==="vertices"){C=0;for(X=ma.length;C<X;C++){Q=Va[ma[C]];T=w.value[Q.a];U=w.value[Q.b];V=w.value[Q.c];w.array[z]=T.x;w.array[z+1]=T.y;w.array[z+2]=T.z;w.array[z+3]=T.w;w.array[z+4]=U.x;w.array[z+5]=
-U.y;w.array[z+6]=U.z;w.array[z+7]=U.w;w.array[z+8]=V.x;w.array[z+9]=V.y;w.array[z+10]=V.z;w.array[z+11]=V.w;z=z+12}C=0;for(X=na.length;C<X;C++){Q=Va[na[C]];T=w.value[Q.a];U=w.value[Q.b];V=w.value[Q.c];ka=w.value[Q.d];w.array[z]=T.x;w.array[z+1]=T.y;w.array[z+2]=T.z;w.array[z+3]=T.w;w.array[z+4]=U.x;w.array[z+5]=U.y;w.array[z+6]=U.z;w.array[z+7]=U.w;w.array[z+8]=V.x;w.array[z+9]=V.y;w.array[z+10]=V.z;w.array[z+11]=V.w;w.array[z+12]=ka.x;w.array[z+13]=ka.y;w.array[z+14]=ka.z;w.array[z+15]=ka.w;z=z+
-16}}else if(w.boundTo==="faces"){C=0;for(X=ma.length;C<X;C++){V=U=T=sa=w.value[ma[C]];w.array[z]=T.x;w.array[z+1]=T.y;w.array[z+2]=T.z;w.array[z+3]=T.w;w.array[z+4]=U.x;w.array[z+5]=U.y;w.array[z+6]=U.z;w.array[z+7]=U.w;w.array[z+8]=V.x;w.array[z+9]=V.y;w.array[z+10]=V.z;w.array[z+11]=V.w;z=z+12}C=0;for(X=na.length;C<X;C++){ka=V=U=T=sa=w.value[na[C]];w.array[z]=T.x;w.array[z+1]=T.y;w.array[z+2]=T.z;w.array[z+3]=T.w;w.array[z+4]=U.x;w.array[z+5]=U.y;w.array[z+6]=U.z;w.array[z+7]=U.w;w.array[z+8]=V.x;
-w.array[z+9]=V.y;w.array[z+10]=V.z;w.array[z+11]=V.w;w.array[z+12]=ka.x;w.array[z+13]=ka.y;w.array[z+14]=ka.z;w.array[z+15]=ka.w;z=z+16}}else if(w.boundTo==="faceVertices"){C=0;for(X=ma.length;C<X;C++){sa=w.value[ma[C]];T=sa[0];U=sa[1];V=sa[2];w.array[z]=T.x;w.array[z+1]=T.y;w.array[z+2]=T.z;w.array[z+3]=T.w;w.array[z+4]=U.x;w.array[z+5]=U.y;w.array[z+6]=U.z;w.array[z+7]=U.w;w.array[z+8]=V.x;w.array[z+9]=V.y;w.array[z+10]=V.z;w.array[z+11]=V.w;z=z+12}C=0;for(X=na.length;C<X;C++){sa=w.value[na[C]];
-T=sa[0];U=sa[1];V=sa[2];ka=sa[3];w.array[z]=T.x;w.array[z+1]=T.y;w.array[z+2]=T.z;w.array[z+3]=T.w;w.array[z+4]=U.x;w.array[z+5]=U.y;w.array[z+6]=U.z;w.array[z+7]=U.w;w.array[z+8]=V.x;w.array[z+9]=V.y;w.array[z+10]=V.z;w.array[z+11]=V.w;w.array[z+12]=ka.x;w.array[z+13]=ka.y;w.array[z+14]=ka.z;w.array[z+15]=ka.w;z=z+16}}k.bindBuffer(k.ARRAY_BUFFER,w.buffer);k.bufferData(k.ARRAY_BUFFER,w.array,lb)}}}if(yb){delete la.__inittedArrays;delete la.__colorArray;delete la.__normalArray;delete la.__tangentArray;
-delete la.__uvArray;delete la.__uv2Array;delete la.__faceArray;delete la.__vertexArray;delete la.__lineArray;delete la.__skinIndexArray;delete la.__skinWeightArray}}}}ea.verticesNeedUpdate=false;ea.morphTargetsNeedUpdate=false;ea.elementsNeedUpdate=false;ea.uvsNeedUpdate=false;ea.normalsNeedUpdate=false;ea.colorsNeedUpdate=false;ea.tangentsNeedUpdate=false;bb.attributes&&p(bb)}else if(ub instanceof THREE.Ribbon){if(ea.verticesNeedUpdate||ea.colorsNeedUpdate){var cc=ea,bd=k.DYNAMIC_DRAW,zc=void 0,
-Ac=void 0,Ic=void 0,dc=void 0,Jc=void 0,cd=cc.vertices,dd=cc.colors,jd=cd.length,kd=dd.length,Kc=cc.__vertexArray,Lc=cc.__colorArray,ld=cc.colorsNeedUpdate;if(cc.verticesNeedUpdate){for(zc=0;zc<jd;zc++){Ic=cd[zc];dc=zc*3;Kc[dc]=Ic.x;Kc[dc+1]=Ic.y;Kc[dc+2]=Ic.z}k.bindBuffer(k.ARRAY_BUFFER,cc.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Kc,bd)}if(ld){for(Ac=0;Ac<kd;Ac++){Jc=dd[Ac];dc=Ac*3;Lc[dc]=Jc.r;Lc[dc+1]=Jc.g;Lc[dc+2]=Jc.b}k.bindBuffer(k.ARRAY_BUFFER,cc.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,
-Lc,bd)}}ea.verticesNeedUpdate=false;ea.colorsNeedUpdate=false}else if(ub instanceof THREE.Line){bb=c(ub,ab);$a=bb.attributes&&o(bb);if(ea.verticesNeedUpdate||ea.colorsNeedUpdate||$a){var Ub=ea,Zc=k.DYNAMIC_DRAW,Bc=void 0,Cc=void 0,Mc=void 0,Ba=void 0,Nc=void 0,ed=Ub.vertices,fd=Ub.colors,md=ed.length,nd=fd.length,Oc=Ub.__vertexArray,Pc=Ub.__colorArray,od=Ub.colorsNeedUpdate,$c=Ub.__webglCustomAttributesList,Qc=void 0,gd=void 0,Ta=void 0,pc=void 0,db=void 0,wa=void 0;if(Ub.verticesNeedUpdate){for(Bc=
-0;Bc<md;Bc++){Mc=ed[Bc];Ba=Bc*3;Oc[Ba]=Mc.x;Oc[Ba+1]=Mc.y;Oc[Ba+2]=Mc.z}k.bindBuffer(k.ARRAY_BUFFER,Ub.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Oc,Zc)}if(od){for(Cc=0;Cc<nd;Cc++){Nc=fd[Cc];Ba=Cc*3;Pc[Ba]=Nc.r;Pc[Ba+1]=Nc.g;Pc[Ba+2]=Nc.b}k.bindBuffer(k.ARRAY_BUFFER,Ub.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Pc,Zc)}if($c){Qc=0;for(gd=$c.length;Qc<gd;Qc++){wa=$c[Qc];if(wa.needsUpdate&&(wa.boundTo===void 0||wa.boundTo==="vertices")){Ba=0;pc=wa.value.length;if(wa.size===1)for(Ta=0;Ta<pc;Ta++)wa.array[Ta]=
-wa.value[Ta];else if(wa.size===2)for(Ta=0;Ta<pc;Ta++){db=wa.value[Ta];wa.array[Ba]=db.x;wa.array[Ba+1]=db.y;Ba=Ba+2}else if(wa.size===3)if(wa.type==="c")for(Ta=0;Ta<pc;Ta++){db=wa.value[Ta];wa.array[Ba]=db.r;wa.array[Ba+1]=db.g;wa.array[Ba+2]=db.b;Ba=Ba+3}else for(Ta=0;Ta<pc;Ta++){db=wa.value[Ta];wa.array[Ba]=db.x;wa.array[Ba+1]=db.y;wa.array[Ba+2]=db.z;Ba=Ba+3}else if(wa.size===4)for(Ta=0;Ta<pc;Ta++){db=wa.value[Ta];wa.array[Ba]=db.x;wa.array[Ba+1]=db.y;wa.array[Ba+2]=db.z;wa.array[Ba+3]=db.w;Ba=
-Ba+4}k.bindBuffer(k.ARRAY_BUFFER,wa.buffer);k.bufferData(k.ARRAY_BUFFER,wa.array,Zc)}}}}ea.verticesNeedUpdate=false;ea.colorsNeedUpdate=false;bb.attributes&&p(bb)}else if(ub instanceof THREE.ParticleSystem)if(ea instanceof THREE.BufferGeometry){(ea.verticesNeedUpdate||ea.colorsNeedUpdate)&&h(ea,k.DYNAMIC_DRAW,!ea.dynamic);ea.verticesNeedUpdate=false;ea.colorsNeedUpdate=false}else{bb=c(ub,ab);$a=bb.attributes&&o(bb);(ea.verticesNeedUpdate||ea.colorsNeedUpdate||ub.sortParticles||$a)&&g(ea,k.DYNAMIC_DRAW,
-ub);ea.verticesNeedUpdate=false;ea.colorsNeedUpdate=false;bb.attributes&&p(bb)}}};this.initMaterial=function(a,b,c,d){var f,e,g,h,i,j,l,m,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof THREE.LineBasicMaterial?n="basic":a instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var o=
-THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(o.uniforms);a.vertexShader=o.vertexShader;a.fragmentShader=o.fragmentShader}var p,q;p=h=e=f=o=0;for(g=b.length;p<g;p++){q=b[p];if(!q.onlyShadow){q instanceof THREE.DirectionalLight&&h++;q instanceof THREE.PointLight&&e++;q instanceof THREE.SpotLight&&f++;q instanceof THREE.HemisphereLight&&o++}}if(e+f+h+o<=fa){p=h;g=f}else{p=Math.ceil(fa*h/(e+h));g=e=fa-p;o=p}f=p;h=o;o=m=0;for(p=b.length;o<p;o++){q=b[o];if(q.castShadow){q instanceof THREE.SpotLight&&
-m++;q instanceof THREE.DirectionalLight&&!q.shadowCascade&&m++}}if(ec&&d&&d.useVertexTexture)l=1024;else{b=k.getParameter(k.MAX_VERTEX_UNIFORM_VECTORS);b=Math.floor((b-20)/4);if(d!==void 0&&d instanceof THREE.SkinnedMesh){b=Math.min(d.bones.length,b);b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")}l=b}var t;a:{q=a.fragmentShader;p=a.vertexShader;var o=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,
+e,g,h,l=a.__lights,n=a.fog;V=-1;hb=true;this.autoUpdateScene&&a.updateMatrixWorld();b.parent===void 0&&b.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);bb.multiply(b.projectionMatrix,b.matrixWorldInverse);ab.setFromMatrix(bb);this.autoUpdateObjects&&
+this.initWebGLObjects(a);j(this.renderPluginsPre,a,b);O.info.render.calls=0;O.info.render.vertices=0;O.info.render.faces=0;O.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(f=h.length;d<f;d++){e=h[d];g=e.object;e.render=false;if(g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||ab.contains(g))){r(g,b);var q=e,p=q.object,s=q.buffer,t=void 0,
+t=t=void 0,t=p.material;if(t instanceof THREE.MeshFaceMaterial){t=s.materialIndex;if(t>=0){t=p.geometry.materials[t];if(t.transparent){q.transparent=t;q.opaque=null}else{q.opaque=t;q.transparent=null}}}else if(t)if(t.transparent){q.transparent=t;q.opaque=null}else{q.opaque=t;q.transparent=null}e.render=true;if(this.sortObjects)if(g.renderDepth)e.z=g.renderDepth;else{Pa.copy(g.matrixWorld.getPosition());bb.multiplyVector3(Pa);e.z=Pa.z}}}this.sortObjects&&h.sort(i);h=a.__webglObjectsImmediate;d=0;for(f=
+h.length;d<f;d++){e=h[d];g=e.object;if(g.visible){r(g,b);g=e.object.material;if(g.transparent){e.transparent=g;e.opaque=null}else{e.opaque=g;e.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);B(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);o(a.__webglObjects,false,"",b,l,n,true,d);m(a.__webglObjectsImmediate,"",b,l,n,false,d)}else{this.setBlending(THREE.NormalBlending);
+o(a.__webglObjects,true,"opaque",b,l,n,false);m(a.__webglObjectsImmediate,"opaque",b,l,n,false);o(a.__webglObjects,false,"transparent",b,l,n,true);m(a.__webglObjectsImmediate,"transparent",b,l,n,true)}j(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture);k.generateMipmap(k.TEXTURE_CUBE_MAP);k.bindTexture(k.TEXTURE_CUBE_MAP,null)}else{k.bindTexture(k.TEXTURE_2D,
+c.__webglTexture);k.generateMipmap(k.TEXTURE_2D);k.bindTexture(k.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)}};this.renderImmediateObject=function(a,b,c,d,f){var e=u(a,b,c,d,f);U=-1;O.setMaterialFaces(d);f.immediateRenderCallback?f.immediateRenderCallback(e,k,ab):f.render(function(a){O.renderBufferImmediate(a,e,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var i=
+a.__objectsAdded[0],j=a,l=void 0,m=void 0,o=void 0;if(!i.__webglInit){i.__webglInit=true;i._modelViewMatrix=new THREE.Matrix4;i._normalMatrix=new THREE.Matrix3;if(i instanceof THREE.Mesh){m=i.geometry;if(m instanceof THREE.Geometry){if(m.geometryGroups===void 0){var r=m,u=void 0,v=void 0,x=void 0,z=void 0,A=void 0,B=void 0,C=void 0,E={},H=r.morphTargets.length,G=r.morphNormals.length;r.geometryGroups={};u=0;for(v=r.faces.length;u<v;u++){x=r.faces[u];z=x.materialIndex;B=z!==void 0?z:-1;E[B]===void 0&&
+(E[B]={hash:B,counter:0});C=E[B].hash+"_"+E[B].counter;r.geometryGroups[C]===void 0&&(r.geometryGroups[C]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:H,numMorphNormals:G});A=x instanceof THREE.Face3?3:4;if(r.geometryGroups[C].vertices+A>65535){E[B].counter=E[B].counter+1;C=E[B].hash+"_"+E[B].counter;r.geometryGroups[C]===void 0&&(r.geometryGroups[C]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:H,numMorphNormals:G})}x instanceof THREE.Face3?r.geometryGroups[C].faces3.push(u):
+r.geometryGroups[C].faces4.push(u);r.geometryGroups[C].vertices=r.geometryGroups[C].vertices+A}r.geometryGroupsList=[];var I=void 0;for(I in r.geometryGroups){r.geometryGroups[I].id=ia++;r.geometryGroupsList.push(r.geometryGroups[I])}}for(l in m.geometryGroups){o=m.geometryGroups[l];if(!o.__webglVertexBuffer){var J=o;J.__webglVertexBuffer=k.createBuffer();J.__webglNormalBuffer=k.createBuffer();J.__webglTangentBuffer=k.createBuffer();J.__webglColorBuffer=k.createBuffer();J.__webglUVBuffer=k.createBuffer();
+J.__webglUV2Buffer=k.createBuffer();J.__webglSkinIndicesBuffer=k.createBuffer();J.__webglSkinWeightsBuffer=k.createBuffer();J.__webglFaceBuffer=k.createBuffer();J.__webglLineBuffer=k.createBuffer();var K=void 0,V=void 0;if(J.numMorphTargets){J.__webglMorphTargetsBuffers=[];K=0;for(V=J.numMorphTargets;K<V;K++)J.__webglMorphTargetsBuffers.push(k.createBuffer())}if(J.numMorphNormals){J.__webglMorphNormalsBuffers=[];K=0;for(V=J.numMorphNormals;K<V;K++)J.__webglMorphNormalsBuffers.push(k.createBuffer())}O.info.memory.geometries++;
+var F=o,M=i,L=M.geometry,N=F.faces3,da=F.faces4,U=N.length*3+da.length*4,Q=N.length*1+da.length*2,ea=N.length*3+da.length*4,Z=c(M,F),ha=f(Z),ca=d(Z),aa=Z.vertexColors?Z.vertexColors:false;F.__vertexArray=new Float32Array(U*3);if(ca)F.__normalArray=new Float32Array(U*3);if(L.hasTangents)F.__tangentArray=new Float32Array(U*4);if(aa)F.__colorArray=new Float32Array(U*3);if(ha){if(L.faceUvs.length>0||L.faceVertexUvs.length>0)F.__uvArray=new Float32Array(U*2);if(L.faceUvs.length>1||L.faceVertexUvs.length>
+1)F.__uv2Array=new Float32Array(U*2)}if(M.geometry.skinWeights.length&&M.geometry.skinIndices.length){F.__skinIndexArray=new Float32Array(U*4);F.__skinWeightArray=new Float32Array(U*4)}F.__faceArray=new Uint16Array(Q*3);F.__lineArray=new Uint16Array(ea*2);var oa=void 0,ta=void 0;if(F.numMorphTargets){F.__morphTargetsArrays=[];oa=0;for(ta=F.numMorphTargets;oa<ta;oa++)F.__morphTargetsArrays.push(new Float32Array(U*3))}if(F.numMorphNormals){F.__morphNormalsArrays=[];oa=0;for(ta=F.numMorphNormals;oa<
+ta;oa++)F.__morphNormalsArrays.push(new Float32Array(U*3))}F.__webglFaceCount=Q*3;F.__webglLineCount=ea*2;if(Z.attributes){if(F.__webglCustomAttributesList===void 0)F.__webglCustomAttributesList=[];var ra=void 0;for(ra in Z.attributes){var Da=Z.attributes[ra],ja={},Ja;for(Ja in Da)ja[Ja]=Da[Ja];if(!ja.__webglInitialized||ja.createUniqueBuffers){ja.__webglInitialized=true;var va=1;ja.type==="v2"?va=2:ja.type==="v3"?va=3:ja.type==="v4"?va=4:ja.type==="c"&&(va=3);ja.size=va;ja.array=new Float32Array(U*
+va);ja.buffer=k.createBuffer();ja.buffer.belongsToAttribute=ra;Da.needsUpdate=true;ja.__original=Da}F.__webglCustomAttributesList.push(ja)}}F.__inittedArrays=true;m.verticesNeedUpdate=true;m.morphTargetsNeedUpdate=true;m.elementsNeedUpdate=true;m.uvsNeedUpdate=true;m.normalsNeedUpdate=true;m.tangentsNeedUpdate=true;m.colorsNeedUpdate=true}}}else m instanceof THREE.BufferGeometry&&e(m)}else if(i instanceof THREE.Ribbon){m=i.geometry;if(!m.__webglVertexBuffer){var Ea=m;Ea.__webglVertexBuffer=k.createBuffer();
+Ea.__webglColorBuffer=k.createBuffer();O.info.memory.geometries++;var ya=m,Ha=ya.vertices.length;ya.__vertexArray=new Float32Array(Ha*3);ya.__colorArray=new Float32Array(Ha*3);ya.__webglVertexCount=Ha;m.verticesNeedUpdate=true;m.colorsNeedUpdate=true}}else if(i instanceof THREE.Line){m=i.geometry;if(!m.__webglVertexBuffer){var Oa=m;Oa.__webglVertexBuffer=k.createBuffer();Oa.__webglColorBuffer=k.createBuffer();O.info.memory.geometries++;var Ga=m,Pa=i,Qa=Ga.vertices.length;Ga.__vertexArray=new Float32Array(Qa*
+3);Ga.__colorArray=new Float32Array(Qa*3);Ga.__webglLineCount=Qa;b(Ga,Pa);m.verticesNeedUpdate=true;m.colorsNeedUpdate=true}}else if(i instanceof THREE.ParticleSystem){m=i.geometry;if(!m.__webglVertexBuffer)if(m instanceof THREE.Geometry){var Xa=m;Xa.__webglVertexBuffer=k.createBuffer();Xa.__webglColorBuffer=k.createBuffer();O.info.geometries++;var Ya=m,pb=i,fb=Ya.vertices.length;Ya.__vertexArray=new Float32Array(fb*3);Ya.__colorArray=new Float32Array(fb*3);Ya.__sortArray=[];Ya.__webglParticleCount=
+fb;b(Ya,pb);m.verticesNeedUpdate=true;m.colorsNeedUpdate=true}else m instanceof THREE.BufferGeometry&&e(m)}}if(!i.__webglActive){if(i instanceof THREE.Mesh){m=i.geometry;if(m instanceof THREE.BufferGeometry)p(j.__webglObjects,m,i);else for(l in m.geometryGroups){o=m.geometryGroups[l];p(j.__webglObjects,o,i)}}else if(i instanceof THREE.Ribbon||i instanceof THREE.Line||i instanceof THREE.ParticleSystem){m=i.geometry;p(j.__webglObjects,m,i)}else i instanceof THREE.ImmediateRenderObject||i.immediateRenderCallback?
+j.__webglObjectsImmediate.push({object:i,opaque:null,transparent:null}):i instanceof THREE.Sprite?j.__webglSprites.push(i):i instanceof THREE.LensFlare&&j.__webglFlares.push(i);i.__webglActive=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var lb=a.__objectsRemoved[0],$a=a;lb instanceof THREE.Mesh||lb instanceof THREE.ParticleSystem||lb instanceof THREE.Ribbon||lb instanceof THREE.Line?t($a.__webglObjects,lb):lb instanceof THREE.Sprite?s($a.__webglSprites,lb):lb instanceof THREE.LensFlare?
+s($a.__webglFlares,lb):(lb instanceof THREE.ImmediateRenderObject||lb.immediateRenderCallback)&&t($a.__webglObjectsImmediate,lb);lb.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var hb=0,rb=a.__webglObjects.length;hb<rb;hb++){var ub=a.__webglObjects[hb].object,fa=ub.geometry,bb=void 0,ab=void 0,cb=void 0;if(ub instanceof THREE.Mesh)if(fa instanceof THREE.BufferGeometry){(fa.verticesNeedUpdate||fa.elementsNeedUpdate||fa.uvsNeedUpdate||fa.normalsNeedUpdate||fa.colorsNeedUpdate||fa.tangentsNeedUpdate)&&
+h(fa,k.DYNAMIC_DRAW,!fa.dynamic);fa.verticesNeedUpdate=false;fa.elementsNeedUpdate=false;fa.uvsNeedUpdate=false;fa.normalsNeedUpdate=false;fa.colorsNeedUpdate=false;fa.tangentsNeedUpdate=false}else{for(var qb=0,wb=fa.geometryGroupsList.length;qb<wb;qb++){bb=fa.geometryGroupsList[qb];cb=c(ub,bb);ab=cb.attributes&&q(cb);if(fa.verticesNeedUpdate||fa.morphTargetsNeedUpdate||fa.elementsNeedUpdate||fa.uvsNeedUpdate||fa.normalsNeedUpdate||fa.colorsNeedUpdate||fa.tangentsNeedUpdate||ab){var la=bb,xb=ub,mb=
+k.DYNAMIC_DRAW,yb=!fa.dynamic,gb=cb;if(la.__inittedArrays){var Pb=d(gb),ec=gb.vertexColors?gb.vertexColors:false,ic=f(gb),Fc=Pb===THREE.SmoothShading,D=void 0,W=void 0,Xb=void 0,P=void 0,kc=void 0,Yb=void 0,vb=void 0,Gc=void 0,Qb=void 0,lc=void 0,mc=void 0,R=void 0,S=void 0,T=void 0,ka=void 0,zb=void 0,Ab=void 0,Bb=void 0,sc=void 0,Cb=void 0,Db=void 0,Eb=void 0,tc=void 0,Fb=void 0,Gb=void 0,Hb=void 0,uc=void 0,Ib=void 0,Jb=void 0,Kb=void 0,vc=void 0,Lb=void 0,Mb=void 0,Nb=void 0,wc=void 0,qa=void 0,
+qc=void 0,Zb=void 0,nc=void 0,oc=void 0,Ra=void 0,rc=void 0,Ma=void 0,Na=void 0,$b=void 0,Rb=void 0,Ia=0,La=0,Sb=0,Tb=0,nb=0,Va=0,ua=0,Za=0,Ka=0,$=0,ga=0,y=0,sa=void 0,Sa=la.__vertexArray,xc=la.__uvArray,yc=la.__uv2Array,ob=la.__normalArray,za=la.__tangentArray,Ta=la.__colorArray,Aa=la.__skinIndexArray,Ba=la.__skinWeightArray,Uc=la.__morphTargetsArrays,Vc=la.__morphNormalsArrays,Wc=la.__webglCustomAttributesList,w=void 0,Ob=la.__faceArray,ib=la.__lineArray,db=xb.geometry,Dc=db.elementsNeedUpdate,
+ad=db.uvsNeedUpdate,Rc=db.normalsNeedUpdate,Sc=db.tangentsNeedUpdate,hd=db.colorsNeedUpdate,id=db.morphTargetsNeedUpdate,gc=db.vertices,ma=la.faces3,na=la.faces4,Wa=db.faces,Xc=db.faceVertexUvs[0],Yc=db.faceVertexUvs[1],hc=db.skinIndices,ac=db.skinWeights,bc=db.morphTargets,Hc=db.morphNormals;if(db.verticesNeedUpdate){D=0;for(W=ma.length;D<W;D++){P=Wa[ma[D]];R=gc[P.a];S=gc[P.b];T=gc[P.c];Sa[La]=R.x;Sa[La+1]=R.y;Sa[La+2]=R.z;Sa[La+3]=S.x;Sa[La+4]=S.y;Sa[La+5]=S.z;Sa[La+6]=T.x;Sa[La+7]=T.y;Sa[La+8]=
+T.z;La=La+9}D=0;for(W=na.length;D<W;D++){P=Wa[na[D]];R=gc[P.a];S=gc[P.b];T=gc[P.c];ka=gc[P.d];Sa[La]=R.x;Sa[La+1]=R.y;Sa[La+2]=R.z;Sa[La+3]=S.x;Sa[La+4]=S.y;Sa[La+5]=S.z;Sa[La+6]=T.x;Sa[La+7]=T.y;Sa[La+8]=T.z;Sa[La+9]=ka.x;Sa[La+10]=ka.y;Sa[La+11]=ka.z;La=La+12}k.bindBuffer(k.ARRAY_BUFFER,la.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Sa,mb)}if(id){Ra=0;for(rc=bc.length;Ra<rc;Ra++){D=ga=0;for(W=ma.length;D<W;D++){$b=ma[D];P=Wa[$b];R=bc[Ra].vertices[P.a];S=bc[Ra].vertices[P.b];T=bc[Ra].vertices[P.c];
+Ma=Uc[Ra];Ma[ga]=R.x;Ma[ga+1]=R.y;Ma[ga+2]=R.z;Ma[ga+3]=S.x;Ma[ga+4]=S.y;Ma[ga+5]=S.z;Ma[ga+6]=T.x;Ma[ga+7]=T.y;Ma[ga+8]=T.z;if(gb.morphNormals){if(Fc){Rb=Hc[Ra].vertexNormals[$b];Cb=Rb.a;Db=Rb.b;Eb=Rb.c}else Eb=Db=Cb=Hc[Ra].faceNormals[$b];Na=Vc[Ra];Na[ga]=Cb.x;Na[ga+1]=Cb.y;Na[ga+2]=Cb.z;Na[ga+3]=Db.x;Na[ga+4]=Db.y;Na[ga+5]=Db.z;Na[ga+6]=Eb.x;Na[ga+7]=Eb.y;Na[ga+8]=Eb.z}ga=ga+9}D=0;for(W=na.length;D<W;D++){$b=na[D];P=Wa[$b];R=bc[Ra].vertices[P.a];S=bc[Ra].vertices[P.b];T=bc[Ra].vertices[P.c];ka=
+bc[Ra].vertices[P.d];Ma=Uc[Ra];Ma[ga]=R.x;Ma[ga+1]=R.y;Ma[ga+2]=R.z;Ma[ga+3]=S.x;Ma[ga+4]=S.y;Ma[ga+5]=S.z;Ma[ga+6]=T.x;Ma[ga+7]=T.y;Ma[ga+8]=T.z;Ma[ga+9]=ka.x;Ma[ga+10]=ka.y;Ma[ga+11]=ka.z;if(gb.morphNormals){if(Fc){Rb=Hc[Ra].vertexNormals[$b];Cb=Rb.a;Db=Rb.b;Eb=Rb.c;tc=Rb.d}else tc=Eb=Db=Cb=Hc[Ra].faceNormals[$b];Na=Vc[Ra];Na[ga]=Cb.x;Na[ga+1]=Cb.y;Na[ga+2]=Cb.z;Na[ga+3]=Db.x;Na[ga+4]=Db.y;Na[ga+5]=Db.z;Na[ga+6]=Eb.x;Na[ga+7]=Eb.y;Na[ga+8]=Eb.z;Na[ga+9]=tc.x;Na[ga+10]=tc.y;Na[ga+11]=tc.z}ga=ga+
+12}k.bindBuffer(k.ARRAY_BUFFER,la.__webglMorphTargetsBuffers[Ra]);k.bufferData(k.ARRAY_BUFFER,Uc[Ra],mb);if(gb.morphNormals){k.bindBuffer(k.ARRAY_BUFFER,la.__webglMorphNormalsBuffers[Ra]);k.bufferData(k.ARRAY_BUFFER,Vc[Ra],mb)}}}if(ac.length){D=0;for(W=ma.length;D<W;D++){P=Wa[ma[D]];Ib=ac[P.a];Jb=ac[P.b];Kb=ac[P.c];Ba[$]=Ib.x;Ba[$+1]=Ib.y;Ba[$+2]=Ib.z;Ba[$+3]=Ib.w;Ba[$+4]=Jb.x;Ba[$+5]=Jb.y;Ba[$+6]=Jb.z;Ba[$+7]=Jb.w;Ba[$+8]=Kb.x;Ba[$+9]=Kb.y;Ba[$+10]=Kb.z;Ba[$+11]=Kb.w;Lb=hc[P.a];Mb=hc[P.b];Nb=hc[P.c];
+Aa[$]=Lb.x;Aa[$+1]=Lb.y;Aa[$+2]=Lb.z;Aa[$+3]=Lb.w;Aa[$+4]=Mb.x;Aa[$+5]=Mb.y;Aa[$+6]=Mb.z;Aa[$+7]=Mb.w;Aa[$+8]=Nb.x;Aa[$+9]=Nb.y;Aa[$+10]=Nb.z;Aa[$+11]=Nb.w;$=$+12}D=0;for(W=na.length;D<W;D++){P=Wa[na[D]];Ib=ac[P.a];Jb=ac[P.b];Kb=ac[P.c];vc=ac[P.d];Ba[$]=Ib.x;Ba[$+1]=Ib.y;Ba[$+2]=Ib.z;Ba[$+3]=Ib.w;Ba[$+4]=Jb.x;Ba[$+5]=Jb.y;Ba[$+6]=Jb.z;Ba[$+7]=Jb.w;Ba[$+8]=Kb.x;Ba[$+9]=Kb.y;Ba[$+10]=Kb.z;Ba[$+11]=Kb.w;Ba[$+12]=vc.x;Ba[$+13]=vc.y;Ba[$+14]=vc.z;Ba[$+15]=vc.w;Lb=hc[P.a];Mb=hc[P.b];Nb=hc[P.c];wc=hc[P.d];
+Aa[$]=Lb.x;Aa[$+1]=Lb.y;Aa[$+2]=Lb.z;Aa[$+3]=Lb.w;Aa[$+4]=Mb.x;Aa[$+5]=Mb.y;Aa[$+6]=Mb.z;Aa[$+7]=Mb.w;Aa[$+8]=Nb.x;Aa[$+9]=Nb.y;Aa[$+10]=Nb.z;Aa[$+11]=Nb.w;Aa[$+12]=wc.x;Aa[$+13]=wc.y;Aa[$+14]=wc.z;Aa[$+15]=wc.w;$=$+16}if($>0){k.bindBuffer(k.ARRAY_BUFFER,la.__webglSkinIndicesBuffer);k.bufferData(k.ARRAY_BUFFER,Aa,mb);k.bindBuffer(k.ARRAY_BUFFER,la.__webglSkinWeightsBuffer);k.bufferData(k.ARRAY_BUFFER,Ba,mb)}}if(hd&&ec){D=0;for(W=ma.length;D<W;D++){P=Wa[ma[D]];vb=P.vertexColors;Gc=P.color;if(vb.length===
+3&&ec===THREE.VertexColors){Fb=vb[0];Gb=vb[1];Hb=vb[2]}else Hb=Gb=Fb=Gc;Ta[Ka]=Fb.r;Ta[Ka+1]=Fb.g;Ta[Ka+2]=Fb.b;Ta[Ka+3]=Gb.r;Ta[Ka+4]=Gb.g;Ta[Ka+5]=Gb.b;Ta[Ka+6]=Hb.r;Ta[Ka+7]=Hb.g;Ta[Ka+8]=Hb.b;Ka=Ka+9}D=0;for(W=na.length;D<W;D++){P=Wa[na[D]];vb=P.vertexColors;Gc=P.color;if(vb.length===4&&ec===THREE.VertexColors){Fb=vb[0];Gb=vb[1];Hb=vb[2];uc=vb[3]}else uc=Hb=Gb=Fb=Gc;Ta[Ka]=Fb.r;Ta[Ka+1]=Fb.g;Ta[Ka+2]=Fb.b;Ta[Ka+3]=Gb.r;Ta[Ka+4]=Gb.g;Ta[Ka+5]=Gb.b;Ta[Ka+6]=Hb.r;Ta[Ka+7]=Hb.g;Ta[Ka+8]=Hb.b;Ta[Ka+
+9]=uc.r;Ta[Ka+10]=uc.g;Ta[Ka+11]=uc.b;Ka=Ka+12}if(Ka>0){k.bindBuffer(k.ARRAY_BUFFER,la.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Ta,mb)}}if(Sc&&db.hasTangents){D=0;for(W=ma.length;D<W;D++){P=Wa[ma[D]];Qb=P.vertexTangents;zb=Qb[0];Ab=Qb[1];Bb=Qb[2];za[ua]=zb.x;za[ua+1]=zb.y;za[ua+2]=zb.z;za[ua+3]=zb.w;za[ua+4]=Ab.x;za[ua+5]=Ab.y;za[ua+6]=Ab.z;za[ua+7]=Ab.w;za[ua+8]=Bb.x;za[ua+9]=Bb.y;za[ua+10]=Bb.z;za[ua+11]=Bb.w;ua=ua+12}D=0;for(W=na.length;D<W;D++){P=Wa[na[D]];Qb=P.vertexTangents;zb=Qb[0];
+Ab=Qb[1];Bb=Qb[2];sc=Qb[3];za[ua]=zb.x;za[ua+1]=zb.y;za[ua+2]=zb.z;za[ua+3]=zb.w;za[ua+4]=Ab.x;za[ua+5]=Ab.y;za[ua+6]=Ab.z;za[ua+7]=Ab.w;za[ua+8]=Bb.x;za[ua+9]=Bb.y;za[ua+10]=Bb.z;za[ua+11]=Bb.w;za[ua+12]=sc.x;za[ua+13]=sc.y;za[ua+14]=sc.z;za[ua+15]=sc.w;ua=ua+16}k.bindBuffer(k.ARRAY_BUFFER,la.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,za,mb)}if(Rc&&Pb){D=0;for(W=ma.length;D<W;D++){P=Wa[ma[D]];kc=P.vertexNormals;Yb=P.normal;if(kc.length===3&&Fc)for(qa=0;qa<3;qa++){Zb=kc[qa];ob[Va]=Zb.x;ob[Va+
+1]=Zb.y;ob[Va+2]=Zb.z;Va=Va+3}else for(qa=0;qa<3;qa++){ob[Va]=Yb.x;ob[Va+1]=Yb.y;ob[Va+2]=Yb.z;Va=Va+3}}D=0;for(W=na.length;D<W;D++){P=Wa[na[D]];kc=P.vertexNormals;Yb=P.normal;if(kc.length===4&&Fc)for(qa=0;qa<4;qa++){Zb=kc[qa];ob[Va]=Zb.x;ob[Va+1]=Zb.y;ob[Va+2]=Zb.z;Va=Va+3}else for(qa=0;qa<4;qa++){ob[Va]=Yb.x;ob[Va+1]=Yb.y;ob[Va+2]=Yb.z;Va=Va+3}}k.bindBuffer(k.ARRAY_BUFFER,la.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,ob,mb)}if(ad&&Xc&&ic){D=0;for(W=ma.length;D<W;D++){Xb=ma[D];lc=Xc[Xb];if(lc!==
+void 0)for(qa=0;qa<3;qa++){nc=lc[qa];xc[Sb]=nc.u;xc[Sb+1]=nc.v;Sb=Sb+2}}D=0;for(W=na.length;D<W;D++){Xb=na[D];lc=Xc[Xb];if(lc!==void 0)for(qa=0;qa<4;qa++){nc=lc[qa];xc[Sb]=nc.u;xc[Sb+1]=nc.v;Sb=Sb+2}}if(Sb>0){k.bindBuffer(k.ARRAY_BUFFER,la.__webglUVBuffer);k.bufferData(k.ARRAY_BUFFER,xc,mb)}}if(ad&&Yc&&ic){D=0;for(W=ma.length;D<W;D++){Xb=ma[D];mc=Yc[Xb];if(mc!==void 0)for(qa=0;qa<3;qa++){oc=mc[qa];yc[Tb]=oc.u;yc[Tb+1]=oc.v;Tb=Tb+2}}D=0;for(W=na.length;D<W;D++){Xb=na[D];mc=Yc[Xb];if(mc!==void 0)for(qa=
+0;qa<4;qa++){oc=mc[qa];yc[Tb]=oc.u;yc[Tb+1]=oc.v;Tb=Tb+2}}if(Tb>0){k.bindBuffer(k.ARRAY_BUFFER,la.__webglUV2Buffer);k.bufferData(k.ARRAY_BUFFER,yc,mb)}}if(Dc){D=0;for(W=ma.length;D<W;D++){Ob[nb]=Ia;Ob[nb+1]=Ia+1;Ob[nb+2]=Ia+2;nb=nb+3;ib[Za]=Ia;ib[Za+1]=Ia+1;ib[Za+2]=Ia;ib[Za+3]=Ia+2;ib[Za+4]=Ia+1;ib[Za+5]=Ia+2;Za=Za+6;Ia=Ia+3}D=0;for(W=na.length;D<W;D++){Ob[nb]=Ia;Ob[nb+1]=Ia+1;Ob[nb+2]=Ia+3;Ob[nb+3]=Ia+1;Ob[nb+4]=Ia+2;Ob[nb+5]=Ia+3;nb=nb+6;ib[Za]=Ia;ib[Za+1]=Ia+1;ib[Za+2]=Ia;ib[Za+3]=Ia+3;ib[Za+
+4]=Ia+1;ib[Za+5]=Ia+2;ib[Za+6]=Ia+2;ib[Za+7]=Ia+3;Za=Za+8;Ia=Ia+4}k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,la.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Ob,mb);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,la.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,ib,mb)}if(Wc){qa=0;for(qc=Wc.length;qa<qc;qa++){w=Wc[qa];if(w.__original.needsUpdate){y=0;if(w.size===1)if(w.boundTo===void 0||w.boundTo==="vertices"){D=0;for(W=ma.length;D<W;D++){P=Wa[ma[D]];w.array[y]=w.value[P.a];w.array[y+1]=w.value[P.b];
+w.array[y+2]=w.value[P.c];y=y+3}D=0;for(W=na.length;D<W;D++){P=Wa[na[D]];w.array[y]=w.value[P.a];w.array[y+1]=w.value[P.b];w.array[y+2]=w.value[P.c];w.array[y+3]=w.value[P.d];y=y+4}}else{if(w.boundTo==="faces"){D=0;for(W=ma.length;D<W;D++){sa=w.value[ma[D]];w.array[y]=sa;w.array[y+1]=sa;w.array[y+2]=sa;y=y+3}D=0;for(W=na.length;D<W;D++){sa=w.value[na[D]];w.array[y]=sa;w.array[y+1]=sa;w.array[y+2]=sa;w.array[y+3]=sa;y=y+4}}}else if(w.size===2)if(w.boundTo===void 0||w.boundTo==="vertices"){D=0;for(W=
+ma.length;D<W;D++){P=Wa[ma[D]];R=w.value[P.a];S=w.value[P.b];T=w.value[P.c];w.array[y]=R.x;w.array[y+1]=R.y;w.array[y+2]=S.x;w.array[y+3]=S.y;w.array[y+4]=T.x;w.array[y+5]=T.y;y=y+6}D=0;for(W=na.length;D<W;D++){P=Wa[na[D]];R=w.value[P.a];S=w.value[P.b];T=w.value[P.c];ka=w.value[P.d];w.array[y]=R.x;w.array[y+1]=R.y;w.array[y+2]=S.x;w.array[y+3]=S.y;w.array[y+4]=T.x;w.array[y+5]=T.y;w.array[y+6]=ka.x;w.array[y+7]=ka.y;y=y+8}}else{if(w.boundTo==="faces"){D=0;for(W=ma.length;D<W;D++){T=S=R=sa=w.value[ma[D]];
+w.array[y]=R.x;w.array[y+1]=R.y;w.array[y+2]=S.x;w.array[y+3]=S.y;w.array[y+4]=T.x;w.array[y+5]=T.y;y=y+6}D=0;for(W=na.length;D<W;D++){ka=T=S=R=sa=w.value[na[D]];w.array[y]=R.x;w.array[y+1]=R.y;w.array[y+2]=S.x;w.array[y+3]=S.y;w.array[y+4]=T.x;w.array[y+5]=T.y;w.array[y+6]=ka.x;w.array[y+7]=ka.y;y=y+8}}}else if(w.size===3){var Y;Y=w.type==="c"?["r","g","b"]:["x","y","z"];if(w.boundTo===void 0||w.boundTo==="vertices"){D=0;for(W=ma.length;D<W;D++){P=Wa[ma[D]];R=w.value[P.a];S=w.value[P.b];T=w.value[P.c];
+w.array[y]=R[Y[0]];w.array[y+1]=R[Y[1]];w.array[y+2]=R[Y[2]];w.array[y+3]=S[Y[0]];w.array[y+4]=S[Y[1]];w.array[y+5]=S[Y[2]];w.array[y+6]=T[Y[0]];w.array[y+7]=T[Y[1]];w.array[y+8]=T[Y[2]];y=y+9}D=0;for(W=na.length;D<W;D++){P=Wa[na[D]];R=w.value[P.a];S=w.value[P.b];T=w.value[P.c];ka=w.value[P.d];w.array[y]=R[Y[0]];w.array[y+1]=R[Y[1]];w.array[y+2]=R[Y[2]];w.array[y+3]=S[Y[0]];w.array[y+4]=S[Y[1]];w.array[y+5]=S[Y[2]];w.array[y+6]=T[Y[0]];w.array[y+7]=T[Y[1]];w.array[y+8]=T[Y[2]];w.array[y+9]=ka[Y[0]];
+w.array[y+10]=ka[Y[1]];w.array[y+11]=ka[Y[2]];y=y+12}}else if(w.boundTo==="faces"){D=0;for(W=ma.length;D<W;D++){T=S=R=sa=w.value[ma[D]];w.array[y]=R[Y[0]];w.array[y+1]=R[Y[1]];w.array[y+2]=R[Y[2]];w.array[y+3]=S[Y[0]];w.array[y+4]=S[Y[1]];w.array[y+5]=S[Y[2]];w.array[y+6]=T[Y[0]];w.array[y+7]=T[Y[1]];w.array[y+8]=T[Y[2]];y=y+9}D=0;for(W=na.length;D<W;D++){ka=T=S=R=sa=w.value[na[D]];w.array[y]=R[Y[0]];w.array[y+1]=R[Y[1]];w.array[y+2]=R[Y[2]];w.array[y+3]=S[Y[0]];w.array[y+4]=S[Y[1]];w.array[y+5]=
+S[Y[2]];w.array[y+6]=T[Y[0]];w.array[y+7]=T[Y[1]];w.array[y+8]=T[Y[2]];w.array[y+9]=ka[Y[0]];w.array[y+10]=ka[Y[1]];w.array[y+11]=ka[Y[2]];y=y+12}}else if(w.boundTo==="faceVertices"){D=0;for(W=ma.length;D<W;D++){sa=w.value[ma[D]];R=sa[0];S=sa[1];T=sa[2];w.array[y]=R[Y[0]];w.array[y+1]=R[Y[1]];w.array[y+2]=R[Y[2]];w.array[y+3]=S[Y[0]];w.array[y+4]=S[Y[1]];w.array[y+5]=S[Y[2]];w.array[y+6]=T[Y[0]];w.array[y+7]=T[Y[1]];w.array[y+8]=T[Y[2]];y=y+9}D=0;for(W=na.length;D<W;D++){sa=w.value[na[D]];R=sa[0];
+S=sa[1];T=sa[2];ka=sa[3];w.array[y]=R[Y[0]];w.array[y+1]=R[Y[1]];w.array[y+2]=R[Y[2]];w.array[y+3]=S[Y[0]];w.array[y+4]=S[Y[1]];w.array[y+5]=S[Y[2]];w.array[y+6]=T[Y[0]];w.array[y+7]=T[Y[1]];w.array[y+8]=T[Y[2]];w.array[y+9]=ka[Y[0]];w.array[y+10]=ka[Y[1]];w.array[y+11]=ka[Y[2]];y=y+12}}}else if(w.size===4)if(w.boundTo===void 0||w.boundTo==="vertices"){D=0;for(W=ma.length;D<W;D++){P=Wa[ma[D]];R=w.value[P.a];S=w.value[P.b];T=w.value[P.c];w.array[y]=R.x;w.array[y+1]=R.y;w.array[y+2]=R.z;w.array[y+3]=
+R.w;w.array[y+4]=S.x;w.array[y+5]=S.y;w.array[y+6]=S.z;w.array[y+7]=S.w;w.array[y+8]=T.x;w.array[y+9]=T.y;w.array[y+10]=T.z;w.array[y+11]=T.w;y=y+12}D=0;for(W=na.length;D<W;D++){P=Wa[na[D]];R=w.value[P.a];S=w.value[P.b];T=w.value[P.c];ka=w.value[P.d];w.array[y]=R.x;w.array[y+1]=R.y;w.array[y+2]=R.z;w.array[y+3]=R.w;w.array[y+4]=S.x;w.array[y+5]=S.y;w.array[y+6]=S.z;w.array[y+7]=S.w;w.array[y+8]=T.x;w.array[y+9]=T.y;w.array[y+10]=T.z;w.array[y+11]=T.w;w.array[y+12]=ka.x;w.array[y+13]=ka.y;w.array[y+
+14]=ka.z;w.array[y+15]=ka.w;y=y+16}}else if(w.boundTo==="faces"){D=0;for(W=ma.length;D<W;D++){T=S=R=sa=w.value[ma[D]];w.array[y]=R.x;w.array[y+1]=R.y;w.array[y+2]=R.z;w.array[y+3]=R.w;w.array[y+4]=S.x;w.array[y+5]=S.y;w.array[y+6]=S.z;w.array[y+7]=S.w;w.array[y+8]=T.x;w.array[y+9]=T.y;w.array[y+10]=T.z;w.array[y+11]=T.w;y=y+12}D=0;for(W=na.length;D<W;D++){ka=T=S=R=sa=w.value[na[D]];w.array[y]=R.x;w.array[y+1]=R.y;w.array[y+2]=R.z;w.array[y+3]=R.w;w.array[y+4]=S.x;w.array[y+5]=S.y;w.array[y+6]=S.z;
+w.array[y+7]=S.w;w.array[y+8]=T.x;w.array[y+9]=T.y;w.array[y+10]=T.z;w.array[y+11]=T.w;w.array[y+12]=ka.x;w.array[y+13]=ka.y;w.array[y+14]=ka.z;w.array[y+15]=ka.w;y=y+16}}else if(w.boundTo==="faceVertices"){D=0;for(W=ma.length;D<W;D++){sa=w.value[ma[D]];R=sa[0];S=sa[1];T=sa[2];w.array[y]=R.x;w.array[y+1]=R.y;w.array[y+2]=R.z;w.array[y+3]=R.w;w.array[y+4]=S.x;w.array[y+5]=S.y;w.array[y+6]=S.z;w.array[y+7]=S.w;w.array[y+8]=T.x;w.array[y+9]=T.y;w.array[y+10]=T.z;w.array[y+11]=T.w;y=y+12}D=0;for(W=na.length;D<
+W;D++){sa=w.value[na[D]];R=sa[0];S=sa[1];T=sa[2];ka=sa[3];w.array[y]=R.x;w.array[y+1]=R.y;w.array[y+2]=R.z;w.array[y+3]=R.w;w.array[y+4]=S.x;w.array[y+5]=S.y;w.array[y+6]=S.z;w.array[y+7]=S.w;w.array[y+8]=T.x;w.array[y+9]=T.y;w.array[y+10]=T.z;w.array[y+11]=T.w;w.array[y+12]=ka.x;w.array[y+13]=ka.y;w.array[y+14]=ka.z;w.array[y+15]=ka.w;y=y+16}}k.bindBuffer(k.ARRAY_BUFFER,w.buffer);k.bufferData(k.ARRAY_BUFFER,w.array,mb)}}}if(yb){delete la.__inittedArrays;delete la.__colorArray;delete la.__normalArray;
+delete la.__tangentArray;delete la.__uvArray;delete la.__uv2Array;delete la.__faceArray;delete la.__vertexArray;delete la.__lineArray;delete la.__skinIndexArray;delete la.__skinWeightArray}}}}fa.verticesNeedUpdate=false;fa.morphTargetsNeedUpdate=false;fa.elementsNeedUpdate=false;fa.uvsNeedUpdate=false;fa.normalsNeedUpdate=false;fa.colorsNeedUpdate=false;fa.tangentsNeedUpdate=false;cb.attributes&&n(cb)}else if(ub instanceof THREE.Ribbon){if(fa.verticesNeedUpdate||fa.colorsNeedUpdate){var cc=fa,bd=
+k.DYNAMIC_DRAW,zc=void 0,Ac=void 0,Ic=void 0,dc=void 0,Jc=void 0,cd=cc.vertices,dd=cc.colors,jd=cd.length,kd=dd.length,Kc=cc.__vertexArray,Lc=cc.__colorArray,ld=cc.colorsNeedUpdate;if(cc.verticesNeedUpdate){for(zc=0;zc<jd;zc++){Ic=cd[zc];dc=zc*3;Kc[dc]=Ic.x;Kc[dc+1]=Ic.y;Kc[dc+2]=Ic.z}k.bindBuffer(k.ARRAY_BUFFER,cc.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Kc,bd)}if(ld){for(Ac=0;Ac<kd;Ac++){Jc=dd[Ac];dc=Ac*3;Lc[dc]=Jc.r;Lc[dc+1]=Jc.g;Lc[dc+2]=Jc.b}k.bindBuffer(k.ARRAY_BUFFER,cc.__webglColorBuffer);
+k.bufferData(k.ARRAY_BUFFER,Lc,bd)}}fa.verticesNeedUpdate=false;fa.colorsNeedUpdate=false}else if(ub instanceof THREE.Line){cb=c(ub,bb);ab=cb.attributes&&q(cb);if(fa.verticesNeedUpdate||fa.colorsNeedUpdate||ab){var Ub=fa,Zc=k.DYNAMIC_DRAW,Bc=void 0,Cc=void 0,Mc=void 0,Ca=void 0,Nc=void 0,ed=Ub.vertices,fd=Ub.colors,md=ed.length,nd=fd.length,Oc=Ub.__vertexArray,Pc=Ub.__colorArray,od=Ub.colorsNeedUpdate,$c=Ub.__webglCustomAttributesList,Qc=void 0,gd=void 0,Ua=void 0,pc=void 0,eb=void 0,xa=void 0;if(Ub.verticesNeedUpdate){for(Bc=
+0;Bc<md;Bc++){Mc=ed[Bc];Ca=Bc*3;Oc[Ca]=Mc.x;Oc[Ca+1]=Mc.y;Oc[Ca+2]=Mc.z}k.bindBuffer(k.ARRAY_BUFFER,Ub.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Oc,Zc)}if(od){for(Cc=0;Cc<nd;Cc++){Nc=fd[Cc];Ca=Cc*3;Pc[Ca]=Nc.r;Pc[Ca+1]=Nc.g;Pc[Ca+2]=Nc.b}k.bindBuffer(k.ARRAY_BUFFER,Ub.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Pc,Zc)}if($c){Qc=0;for(gd=$c.length;Qc<gd;Qc++){xa=$c[Qc];if(xa.needsUpdate&&(xa.boundTo===void 0||xa.boundTo==="vertices")){Ca=0;pc=xa.value.length;if(xa.size===1)for(Ua=0;Ua<pc;Ua++)xa.array[Ua]=
+xa.value[Ua];else if(xa.size===2)for(Ua=0;Ua<pc;Ua++){eb=xa.value[Ua];xa.array[Ca]=eb.x;xa.array[Ca+1]=eb.y;Ca=Ca+2}else if(xa.size===3)if(xa.type==="c")for(Ua=0;Ua<pc;Ua++){eb=xa.value[Ua];xa.array[Ca]=eb.r;xa.array[Ca+1]=eb.g;xa.array[Ca+2]=eb.b;Ca=Ca+3}else for(Ua=0;Ua<pc;Ua++){eb=xa.value[Ua];xa.array[Ca]=eb.x;xa.array[Ca+1]=eb.y;xa.array[Ca+2]=eb.z;Ca=Ca+3}else if(xa.size===4)for(Ua=0;Ua<pc;Ua++){eb=xa.value[Ua];xa.array[Ca]=eb.x;xa.array[Ca+1]=eb.y;xa.array[Ca+2]=eb.z;xa.array[Ca+3]=eb.w;Ca=
+Ca+4}k.bindBuffer(k.ARRAY_BUFFER,xa.buffer);k.bufferData(k.ARRAY_BUFFER,xa.array,Zc)}}}}fa.verticesNeedUpdate=false;fa.colorsNeedUpdate=false;cb.attributes&&n(cb)}else if(ub instanceof THREE.ParticleSystem)if(fa instanceof THREE.BufferGeometry){(fa.verticesNeedUpdate||fa.colorsNeedUpdate)&&h(fa,k.DYNAMIC_DRAW,!fa.dynamic);fa.verticesNeedUpdate=false;fa.colorsNeedUpdate=false}else{cb=c(ub,bb);ab=cb.attributes&&q(cb);(fa.verticesNeedUpdate||fa.colorsNeedUpdate||ub.sortParticles||ab)&&g(fa,k.DYNAMIC_DRAW,
+ub);fa.verticesNeedUpdate=false;fa.colorsNeedUpdate=false;cb.attributes&&n(cb)}}};this.initMaterial=function(a,b,c,d){var f,e,g,h,i,j,l,m,o;a instanceof THREE.MeshDepthMaterial?o="depth":a instanceof THREE.MeshNormalMaterial?o="normal":a instanceof THREE.MeshBasicMaterial?o="basic":a instanceof THREE.MeshLambertMaterial?o="lambert":a instanceof THREE.MeshPhongMaterial?o="phong":a instanceof THREE.LineBasicMaterial?o="basic":a instanceof THREE.ParticleBasicMaterial&&(o="particle_basic");if(o){var n=
+THREE.ShaderLib[o];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var q,p;q=h=e=f=n=0;for(g=b.length;q<g;q++){p=b[q];if(!p.onlyShadow){p instanceof THREE.DirectionalLight&&h++;p instanceof THREE.PointLight&&e++;p instanceof THREE.SpotLight&&f++;p instanceof THREE.HemisphereLight&&n++}}if(e+f+h+n<=ca){q=h;g=f}else{q=Math.ceil(ca*h/(e+h));g=e=ca-q;n=q}f=q;h=n;n=m=0;for(q=b.length;n<q;n++){p=b[n];if(p.castShadow){p instanceof THREE.SpotLight&&
+m++;p instanceof THREE.DirectionalLight&&!p.shadowCascade&&m++}}if(ec&&d&&d.useVertexTexture)l=1024;else{b=k.getParameter(k.MAX_VERTEX_UNIFORM_VECTORS);b=Math.floor((b-20)/4);if(d!==void 0&&d instanceof THREE.SkinnedMesh){b=Math.min(d.bones.length,b);b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")}l=b}var r;a:{p=a.fragmentShader;q=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,
 lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:l,useVertexTexture:ec&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:f,maxPointLights:e,maxSpotLights:g,
-maxHemiLights:h,maxShadows:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},s,d=[];if(n)d.push(n);else{d.push(q);d.push(p)}for(s in c){d.push(s);d.push(c[s])}n=d.join();s=0;for(d=ra.length;s<d;s++){f=ra[s];if(f.code===n){f.usedTimes++;
-t=f.program;break a}}s=k.createProgram();d=["precision "+H+" float;",ic?"#define VERTEX_TEXTURES":"",O.gammaInput?"#define GAMMA_INPUT":"",O.gammaOutput?"#define GAMMA_OUTPUT":"",O.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":
+maxHemiLights:h,maxShadows:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},t,d=[];if(o)d.push(o);else{d.push(p);d.push(q)}for(t in c){d.push(t);d.push(c[t])}o=d.join();t=0;for(d=ra.length;t<d;t++){f=ra[t];if(f.code===o){f.usedTimes++;
+r=f.program;break a}}t=k.createProgram();d=["precision "+I+" float;",ic?"#define VERTEX_TEXTURES":"",O.gammaInput?"#define GAMMA_INPUT":"",O.gammaOutput?"#define GAMMA_OUTPUT":"",O.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#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.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":
 "",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-f=["precision "+H+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",O.gammaInput?"#define GAMMA_INPUT":"",O.gammaOutput?"#define GAMMA_OUTPUT":"",O.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",
+f=["precision "+I+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",O.gammaInput?"#define GAMMA_INPUT":"",O.gammaOutput?"#define GAMMA_OUTPUT":"",O.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.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?
-"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");f=x("fragment",f+q);d=x("vertex",d+p);k.attachShader(s,d);k.attachShader(s,f);k.linkProgram(s);k.getProgramParameter(s,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(s,
-k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");k.deleteShader(f);k.deleteShader(d);s.uniforms={};s.attributes={};var r,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences"];c.useVertexTexture?d.push("boneTexture"):d.push("boneGlobalMatrices");for(r in o)d.push(r);r=d;d=0;for(o=r.length;d<o;d++){f=r[d];s.uniforms[f]=k.getUniformLocation(s,f)}d=["position","normal","uv","uv2","tangent","color","skinIndex","skinWeight"];for(r=
-0;r<c.maxMorphTargets;r++)d.push("morphTarget"+r);for(r=0;r<c.maxMorphNormals;r++)d.push("morphNormal"+r);for(t in b)d.push(t);t=d;r=0;for(c=t.length;r<c;r++){d=t[r];s.attributes[d]=k.getAttribLocation(s,d)}s.id=va++;ra.push({program:s,code:n,usedTimes:1});O.info.memory.programs=ra.length;t=s}a.program=t;t=a.program.attributes;t.position>=0&&k.enableVertexAttribArray(t.position);t.color>=0&&k.enableVertexAttribArray(t.color);t.normal>=0&&k.enableVertexAttribArray(t.normal);t.tangent>=0&&k.enableVertexAttribArray(t.tangent);
-if(a.skinning&&t.skinIndex>=0&&t.skinWeight>=0){k.enableVertexAttribArray(t.skinIndex);k.enableVertexAttribArray(t.skinWeight)}if(a.attributes)for(j in a.attributes)t[j]!==void 0&&t[j]>=0&&k.enableVertexAttribArray(t[j]);if(a.morphTargets){a.numSupportedMorphTargets=0;s="morphTarget";for(j=0;j<this.maxMorphTargets;j++){r=s+j;if(t[r]>=0){k.enableVertexAttribArray(t[r]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;s="morphNormal";for(j=0;j<this.maxMorphNormals;j++){r=
-s+j;if(t[r]>=0){k.enableVertexAttribArray(t[r]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){if(a){!b||b==="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW);a==="back"?k.cullFace(k.BACK):a==="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK);k.enable(k.CULL_FACE)}else k.disable(k.CULL_FACE)};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;if(ta!==b){b?k.disable(k.CULL_FACE):
-k.enable(k.CULL_FACE);ta=b}if(Ca!==a){a?k.frontFace(k.CW):k.frontFace(k.CCW);Ca=a}};this.setDepthTest=function(a){if(Na!==a){a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST);Na=a}};this.setDepthWrite=function(a){if(Xa!==a){k.depthMask(a);Xa=a}};this.setBlending=function(a,b,c,d){if(a!==Ia){if(a===THREE.NoBlending)k.disable(k.BLEND);else if(a===THREE.AdditiveBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE)}else if(a===THREE.SubtractiveBlending){k.enable(k.BLEND);
-k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR)}else if(a===THREE.MultiplyBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR)}else if(a===THREE.CustomBlending)k.enable(k.BLEND);else{k.enable(k.BLEND);k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD);k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}Ia=a}if(a===THREE.CustomBlending){if(b!==Wa){k.blendEquation(E(b));Wa=b}if(c!==ja||d!==ob){k.blendFunc(E(c),E(d));
-ja=c;ob=d}}else ob=ja=Wa=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=k.createTexture();O.info.memory.textures++}k.activeTexture(k.TEXTURE0+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,a.flipY);k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,f=E(a.format),e=E(a.type);I(k.TEXTURE_2D,a,d);if(a instanceof THREE.CompressedTexture)for(var e=
+"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");f=z("fragment",f+p);d=z("vertex",d+q);k.attachShader(t,d);k.attachShader(t,f);k.linkProgram(t);k.getProgramParameter(t,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(t,
+k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");k.deleteShader(f);k.deleteShader(d);t.uniforms={};t.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences"];c.useVertexTexture?d.push("boneTexture"):d.push("boneGlobalMatrices");for(s in n)d.push(s);s=d;d=0;for(n=s.length;d<n;d++){f=s[d];t.uniforms[f]=k.getUniformLocation(t,f)}d=["position","normal","uv","uv2","tangent","color","skinIndex","skinWeight"];for(s=
+0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(r in b)d.push(r);r=d;s=0;for(c=r.length;s<c;s++){d=r[s];t.attributes[d]=k.getAttribLocation(t,d)}t.id=va++;ra.push({program:t,code:o,usedTimes:1});O.info.memory.programs=ra.length;r=t}a.program=r;r=a.program.attributes;r.position>=0&&k.enableVertexAttribArray(r.position);r.color>=0&&k.enableVertexAttribArray(r.color);r.normal>=0&&k.enableVertexAttribArray(r.normal);r.tangent>=0&&k.enableVertexAttribArray(r.tangent);
+if(a.skinning&&r.skinIndex>=0&&r.skinWeight>=0){k.enableVertexAttribArray(r.skinIndex);k.enableVertexAttribArray(r.skinWeight)}if(a.attributes)for(j in a.attributes)r[j]!==void 0&&r[j]>=0&&k.enableVertexAttribArray(r[j]);if(a.morphTargets){a.numSupportedMorphTargets=0;t="morphTarget";for(j=0;j<this.maxMorphTargets;j++){s=t+j;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;t="morphNormal";for(j=0;j<this.maxMorphNormals;j++){s=
+t+j;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){if(a){!b||b==="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW);a==="back"?k.cullFace(k.BACK):a==="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK);k.enable(k.CULL_FACE)}else k.disable(k.CULL_FACE)};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;if(ta!==b){b?k.disable(k.CULL_FACE):
+k.enable(k.CULL_FACE);ta=b}if(Da!==a){a?k.frontFace(k.CW):k.frontFace(k.CCW);Da=a}};this.setDepthTest=function(a){if(Oa!==a){a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST);Oa=a}};this.setDepthWrite=function(a){if(Ya!==a){k.depthMask(a);Ya=a}};this.setBlending=function(a,b,c,d){if(a!==Ja){if(a===THREE.NoBlending)k.disable(k.BLEND);else if(a===THREE.AdditiveBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE)}else if(a===THREE.SubtractiveBlending){k.enable(k.BLEND);
+k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR)}else if(a===THREE.MultiplyBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR)}else if(a===THREE.CustomBlending)k.enable(k.BLEND);else{k.enable(k.BLEND);k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD);k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}Ja=a}if(a===THREE.CustomBlending){if(b!==Xa){k.blendEquation(E(b));Xa=b}if(c!==ja||d!==pb){k.blendFunc(E(c),E(d));
+ja=c;pb=d}}else pb=ja=Xa=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=k.createTexture();O.info.memory.textures++}k.activeTexture(k.TEXTURE0+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,a.flipY);k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,f=E(a.format),e=E(a.type);F(k.TEXTURE_2D,a,d);if(a instanceof THREE.CompressedTexture)for(var e=
 a.mipmaps,g=0,h=e.length;g<h;g++){c=e[g];k.compressedTexImage2D(k.TEXTURE_2D,g,f,c.width,c.height,0,c.data)}else a instanceof THREE.DataTexture?k.texImage2D(k.TEXTURE_2D,0,f,c.width,c.height,0,f,e,c.data):k.texImage2D(k.TEXTURE_2D,0,f,f,e,a.image);a.generateMipmaps&&d&&k.generateMipmap(k.TEXTURE_2D);a.needsUpdate=false;if(a.onUpdate)a.onUpdate()}else{k.activeTexture(k.TEXTURE0+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture)}};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;
-if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=k.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=E(a.format),f=E(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];k.bindTexture(k.TEXTURE_CUBE_MAP,a.__webglTexture);I(k.TEXTURE_CUBE_MAP,a,c);for(var e=0;e<6;e++){a.__webglFramebuffer[e]=k.createFramebuffer();a.__webglRenderbuffer[e]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+
-e,0,d,a.width,a.height,0,d,f,null);var g=a,h=k.TEXTURE_CUBE_MAP_POSITIVE_X+e;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer[e]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,h,g.__webglTexture,0);F(a.__webglRenderbuffer[e],a)}c&&k.generateMipmap(k.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=k.createFramebuffer();a.__webglRenderbuffer=k.createRenderbuffer();k.bindTexture(k.TEXTURE_2D,a.__webglTexture);I(k.TEXTURE_2D,a,c);k.texImage2D(k.TEXTURE_2D,0,d,a.width,a.height,0,d,f,null);d=
-k.TEXTURE_2D;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,d,a.__webglTexture,0);F(a.__webglRenderbuffer,a);c&&k.generateMipmap(k.TEXTURE_2D)}b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;f=d=0}else{b=null;c=Ga;a=Za;d=xa;f=xb}if(b!==ba){k.bindFramebuffer(k.FRAMEBUFFER,
-b);k.viewport(d,f,c,a);ba=b}qb=c;Da=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
+if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=true;if(a.stencilBuffer===void 0)a.stencilBuffer=true;a.__webglTexture=k.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=E(a.format),f=E(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];k.bindTexture(k.TEXTURE_CUBE_MAP,a.__webglTexture);F(k.TEXTURE_CUBE_MAP,a,c);for(var e=0;e<6;e++){a.__webglFramebuffer[e]=k.createFramebuffer();a.__webglRenderbuffer[e]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+
+e,0,d,a.width,a.height,0,d,f,null);var g=a,h=k.TEXTURE_CUBE_MAP_POSITIVE_X+e;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer[e]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,h,g.__webglTexture,0);G(a.__webglRenderbuffer[e],a)}c&&k.generateMipmap(k.TEXTURE_CUBE_MAP)}else{a.__webglFramebuffer=k.createFramebuffer();a.__webglRenderbuffer=k.createRenderbuffer();k.bindTexture(k.TEXTURE_2D,a.__webglTexture);F(k.TEXTURE_2D,a,c);k.texImage2D(k.TEXTURE_2D,0,d,a.width,a.height,0,d,f,null);d=
+k.TEXTURE_2D;k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,d,a.__webglTexture,0);G(a.__webglRenderbuffer,a);c&&k.generateMipmap(k.TEXTURE_2D)}b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}if(a){b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer;c=a.width;a=a.height;f=d=0}else{b=null;c=Ha;a=$a;d=ya;f=xb}if(b!==ea){k.bindFramebuffer(k.FRAMEBUFFER,
+b);k.viewport(d,f,c,a);ea=b}rb=c;Ea=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=c.anisotropy!==void 0?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:
 THREE.RGBAFormat;this.type=c.type!==void 0?c.type:THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:true;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:true;this.generateMipmaps=true};
 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.anisotropy=this.anisotropy;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;a.generateMipmaps=this.generateMipmaps;return a};
@@ -483,34 +484,34 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=this.object=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 f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+b,0,1);f.s=THREE.Math.clamp(f.s+c,0,1);f.v=THREE.Math.clamp(f.v+d,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,f=a.b,e=Math.max(Math.max(c,d),f),g=Math.min(Math.min(c,d),f);if(g===e)g=c=0;else{var h=e-g,g=h/e,c=(c===e?(d-f)/h:d===e?2+(f-c)/h:4+(c-d)/h)/6;c<0&&(c=c+1);c>1&&(c=c-1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=e;return b}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,f=a.vertices.length,e=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=e.vertices,i=a.faces,l=e.faces,j=a.faceVertexUvs[0],n=e.faceVertexUvs[0],m={},q=0;q<a.materials.length;q++)m[a.materials[q].id]=q;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var q=0,o=h.length;q<o;q++){var p=h[q].clone();c&&c.multiplyVector3(p);g.push(p)}q=0;for(o=l.length;q<o;q++){var g=
-l[q],s,r,u=g.vertexNormals,v=g.vertexColors;g instanceof THREE.Face3?s=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(s=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));s.normal.copy(g.normal);d&&d.multiplyVector3(s.normal);h=0;for(p=u.length;h<p;h++){r=u[h].clone();d&&d.multiplyVector3(r);s.vertexNormals.push(r)}s.color.copy(g.color);h=0;for(p=v.length;h<p;h++){r=v[h];s.vertexColors.push(r.clone())}if(g.materialIndex!==void 0){h=e.materials[g.materialIndex];p=h.id;v=m[p];if(v===void 0){v=
-a.materials.length;m[p]=v;a.materials.push(h)}s.materialIndex=v}s.centroid.copy(g.centroid);c&&c.multiplyVector3(s.centroid);i.push(s)}q=0;for(o=n.length;q<o;q++){c=n[q];d=[];h=0;for(p=c.length;h<p;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,f=a.faces,e=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=f.length;a<c;a++)b.faces.push(f[a].clone());a=0;
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,f=a.vertices.length,e=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=e.vertices,i=a.faces,l=e.faces,j=a.faceVertexUvs[0],o=e.faceVertexUvs[0],m={},p=0;p<a.materials.length;p++)m[a.materials[p].id]=p;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var p=0,q=h.length;p<q;p++){var n=h[p].clone();c&&c.multiplyVector3(n);g.push(n)}p=0;for(q=l.length;p<q;p++){var g=
+l[p],t,s,u=g.vertexNormals,v=g.vertexColors;g instanceof THREE.Face3?t=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(t=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));t.normal.copy(g.normal);d&&d.multiplyVector3(t.normal);h=0;for(n=u.length;h<n;h++){s=u[h].clone();d&&d.multiplyVector3(s);t.vertexNormals.push(s)}t.color.copy(g.color);h=0;for(n=v.length;h<n;h++){s=v[h];t.vertexColors.push(s.clone())}if(g.materialIndex!==void 0){h=e.materials[g.materialIndex];n=h.id;v=m[n];if(v===void 0){v=
+a.materials.length;m[n]=v;a.materials.push(h)}t.materialIndex=v}t.centroid.copy(g.centroid);c&&c.multiplyVector3(t.centroid);i.push(t)}p=0;for(q=o.length;p<q;p++){c=o[p];d=[];h=0;for(n=c.length;h<n;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,f=a.faces,e=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=f.length;a<c;a++)b.faces.push(f[a].clone());a=0;
 for(c=e.length;a<c;a++){for(var d=e[a],f=[],g=0,h=d.length;g<h;g++)f.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(f)}return b},randomPointInTriangle:function(a,b,c){var d,f,e,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();if(d+f>1){d=1-d;f=1-f}e=1-d-f;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(f);g.addSelf(h);h.copy(c);h.multiplyScalar(e);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,f,e;if(a instanceof
 THREE.Face3){d=b.vertices[a.a];f=b.vertices[a.b];e=b.vertices[a.c];return THREE.GeometryUtils.randomPointInTriangle(d,f,e)}if(a instanceof THREE.Face4){d=b.vertices[a.a];f=b.vertices[a.b];e=b.vertices[a.c];var b=b.vertices[a.d],g;if(c)if(a._area1&&a._area2){c=a._area1;g=a._area2}else{c=THREE.GeometryUtils.triangleArea(d,f,b);g=THREE.GeometryUtils.triangleArea(f,e,b);a._area1=c;a._area2=g}else{c=THREE.GeometryUtils.triangleArea(d,f,b);g=THREE.GeometryUtils.triangleArea(f,e,b)}return THREE.GeometryUtils.random()*
-(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,f,b):THREE.GeometryUtils.randomPointInTriangle(f,e,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var f=c+Math.floor((d-c)/2);return l[f]>a?b(c,f-1):l[f]<a?b(f+1,d):f}return b(0,l.length-1)}var d,f,e=a.faces,g=a.vertices,h=e.length,i=0,l=[],j,n,m,q;for(f=0;f<h;f++){d=e[f];if(d instanceof THREE.Face3){j=g[d.a];n=g[d.b];m=g[d.c];d._area=THREE.GeometryUtils.triangleArea(j,n,m)}else if(d instanceof THREE.Face4){j=
-g[d.a];n=g[d.b];m=g[d.c];q=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(j,n,q);d._area2=THREE.GeometryUtils.triangleArea(n,m,q);d._area=d._area1+d._area2}i=i+d._area;l[f]=i}d=[];for(f=0;f<b;f++){g=THREE.GeometryUtils.random()*i;g=c(g);d[f]=THREE.GeometryUtils.randomPointInFace(e[g],a,true)}return d},triangleArea:function(a,b,c){var d,f=THREE.GeometryUtils.__v1;f.sub(a,b);d=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();
+(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,f,b):THREE.GeometryUtils.randomPointInTriangle(f,e,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var f=c+Math.floor((d-c)/2);return l[f]>a?b(c,f-1):l[f]<a?b(f+1,d):f}return b(0,l.length-1)}var d,f,e=a.faces,g=a.vertices,h=e.length,i=0,l=[],j,o,m,p;for(f=0;f<h;f++){d=e[f];if(d instanceof THREE.Face3){j=g[d.a];o=g[d.b];m=g[d.c];d._area=THREE.GeometryUtils.triangleArea(j,o,m)}else if(d instanceof THREE.Face4){j=
+g[d.a];o=g[d.b];m=g[d.c];p=g[d.d];d._area1=THREE.GeometryUtils.triangleArea(j,o,p);d._area2=THREE.GeometryUtils.triangleArea(o,m,p);d._area=d._area1+d._area2}i=i+d._area;l[f]=i}d=[];for(f=0;f<b;f++){g=THREE.GeometryUtils.random()*i;g=c(g);d[f]=THREE.GeometryUtils.randomPointInFace(e[g],a,true)}return d},triangleArea:function(a,b,c){var d,f=THREE.GeometryUtils.__v1;f.sub(a,b);d=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();
 var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],f=0,e=d.length;f<e;f++){if(d[f].u!==1)d[f].u=d[f].u-Math.floor(d[f].u);if(d[f].v!==1)d[f].v=d[f].v-Math.floor(d[f].v)}},triangulateQuads:function(a){var b,c,d,f,e=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<
-c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){d=a.faces[b];if(d instanceof THREE.Face4){f=d.a;var i=d.b,l=d.c,j=d.d,n=new THREE.Face3,m=new THREE.Face3;n.color.copy(d.color);m.color.copy(d.color);n.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;n.a=f;n.b=i;n.c=j;m.a=i;m.b=l;m.c=j;if(d.vertexColors.length===4){n.vertexColors[0]=d.vertexColors[0].clone();n.vertexColors[1]=d.vertexColors[1].clone();n.vertexColors[2]=d.vertexColors[3].clone();m.vertexColors[0]=d.vertexColors[1].clone();
-m.vertexColors[1]=d.vertexColors[2].clone();m.vertexColors[2]=d.vertexColors[3].clone()}e.push(n,m);d=0;for(f=a.faceVertexUvs.length;d<f;d++)if(a.faceVertexUvs[d].length){n=a.faceVertexUvs[d][b];i=n[1];l=n[2];j=n[3];n=[n[0].clone(),i.clone(),j.clone()];i=[i.clone(),l.clone(),j.clone()];h[d].push(n,i)}d=0;for(f=a.faceUvs.length;d<f;d++)if(a.faceUvs[d].length){i=a.faceUvs[d][b];g[d].push(i,i)}}else{e.push(d);d=0;for(f=a.faceUvs.length;d<f;d++)g[d].push(a.faceUvs[d][b]);d=0;for(f=a.faceVertexUvs.length;d<
+c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){d=a.faces[b];if(d instanceof THREE.Face4){f=d.a;var i=d.b,l=d.c,j=d.d,o=new THREE.Face3,m=new THREE.Face3;o.color.copy(d.color);m.color.copy(d.color);o.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;o.a=f;o.b=i;o.c=j;m.a=i;m.b=l;m.c=j;if(d.vertexColors.length===4){o.vertexColors[0]=d.vertexColors[0].clone();o.vertexColors[1]=d.vertexColors[1].clone();o.vertexColors[2]=d.vertexColors[3].clone();m.vertexColors[0]=d.vertexColors[1].clone();
+m.vertexColors[1]=d.vertexColors[2].clone();m.vertexColors[2]=d.vertexColors[3].clone()}e.push(o,m);d=0;for(f=a.faceVertexUvs.length;d<f;d++)if(a.faceVertexUvs[d].length){o=a.faceVertexUvs[d][b];i=o[1];l=o[2];j=o[3];o=[o[0].clone(),i.clone(),j.clone()];i=[i.clone(),l.clone(),j.clone()];h[d].push(o,i)}d=0;for(f=a.faceUvs.length;d<f;d++)if(a.faceUvs[d].length){i=a.faceUvs[d][b];g[d].push(i,i)}}else{e.push(d);d=0;for(f=a.faceUvs.length;d<f;d++)g[d].push(a.faceUvs[d][b]);d=0;for(f=a.faceVertexUvs.length;d<
 f;d++)h[d].push(a.faceVertexUvs[d][b])}}a.faces=e;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var f=b.length,e=a.faces[c];if(e instanceof THREE.Face4){var g=e.a,h=e.b,i=e.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],l=a.vertices[e.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());b.push(l.clone());e.a=f;e.b=f+1;e.c=f+2;e.d=f+3}else{g=
-e.a;h=e.b;i=e.c;g=a.vertices[g];h=a.vertices[h];i=a.vertices[i];b.push(g.clone());b.push(h.clone());b.push(i.clone());e.a=f;e.b=f+1;e.c=f+2}}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,f,e,g,h,i,l,j,n,m,q,o,p,s,r,u,v,t,A=[],y=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)y[c]=[];c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){e=f.a;g=f.b;h=f.c;l=a.vertices[e];j=a.vertices[g];n=a.vertices[h];q=l.distanceTo(j);o=j.distanceTo(n);m=l.distanceTo(n);if(q>
-b||o>b||m>b){i=a.vertices.length;v=f.clone();t=f.clone();if(q>=o&&q>=m){l=l.clone();l.lerpSelf(j,0.5);v.a=e;v.b=i;v.c=h;t.a=i;t.b=g;t.c=h;if(f.vertexNormals.length===3){e=f.vertexNormals[0].clone();e.lerpSelf(f.vertexNormals[1],0.5);v.vertexNormals[1].copy(e);t.vertexNormals[0].copy(e)}if(f.vertexColors.length===3){e=f.vertexColors[0].clone();e.lerpSelf(f.vertexColors[1],0.5);v.vertexColors[1].copy(e);t.vertexColors[0].copy(e)}f=0}else if(o>=q&&o>=m){l=j.clone();l.lerpSelf(n,0.5);v.a=e;v.b=g;v.c=
-i;t.a=i;t.b=h;t.c=e;if(f.vertexNormals.length===3){e=f.vertexNormals[1].clone();e.lerpSelf(f.vertexNormals[2],0.5);v.vertexNormals[2].copy(e);t.vertexNormals[0].copy(e);t.vertexNormals[1].copy(f.vertexNormals[2]);t.vertexNormals[2].copy(f.vertexNormals[0])}if(f.vertexColors.length===3){e=f.vertexColors[1].clone();e.lerpSelf(f.vertexColors[2],0.5);v.vertexColors[2].copy(e);t.vertexColors[0].copy(e);t.vertexColors[1].copy(f.vertexColors[2]);t.vertexColors[2].copy(f.vertexColors[0])}f=1}else{l=l.clone();
-l.lerpSelf(n,0.5);v.a=e;v.b=g;v.c=i;t.a=i;t.b=g;t.c=h;if(f.vertexNormals.length===3){e=f.vertexNormals[0].clone();e.lerpSelf(f.vertexNormals[2],0.5);v.vertexNormals[2].copy(e);t.vertexNormals[0].copy(e)}if(f.vertexColors.length===3){e=f.vertexColors[0].clone();e.lerpSelf(f.vertexColors[2],0.5);v.vertexColors[2].copy(e);t.vertexColors[0].copy(e)}f=2}A.push(v,t);a.vertices.push(l);e=0;for(g=a.faceVertexUvs.length;e<g;e++)if(a.faceVertexUvs[e].length){l=a.faceVertexUvs[e][c];t=l[0];h=l[1];v=l[2];if(f===
-0){j=t.clone();j.lerpSelf(h,0.5);l=[t.clone(),j.clone(),v.clone()];h=[j.clone(),h.clone(),v.clone()]}else if(f===1){j=h.clone();j.lerpSelf(v,0.5);l=[t.clone(),h.clone(),j.clone()];h=[j.clone(),v.clone(),t.clone()]}else{j=t.clone();j.lerpSelf(v,0.5);l=[t.clone(),h.clone(),j.clone()];h=[j.clone(),h.clone(),v.clone()]}y[e].push(l,h)}}else{A.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)y[e].push(a.faceVertexUvs[e][c])}}else{e=f.a;g=f.b;h=f.c;i=f.d;l=a.vertices[e];j=a.vertices[g];n=a.vertices[h];m=
-a.vertices[i];q=l.distanceTo(j);o=j.distanceTo(n);p=n.distanceTo(m);s=l.distanceTo(m);if(q>b||o>b||p>b||s>b){r=a.vertices.length;u=a.vertices.length+1;v=f.clone();t=f.clone();if(q>=o&&q>=p&&q>=s||p>=o&&p>=q&&p>=s){q=l.clone();q.lerpSelf(j,0.5);j=n.clone();j.lerpSelf(m,0.5);v.a=e;v.b=r;v.c=u;v.d=i;t.a=r;t.b=g;t.c=h;t.d=u;if(f.vertexNormals.length===4){e=f.vertexNormals[0].clone();e.lerpSelf(f.vertexNormals[1],0.5);g=f.vertexNormals[2].clone();g.lerpSelf(f.vertexNormals[3],0.5);v.vertexNormals[1].copy(e);
-v.vertexNormals[2].copy(g);t.vertexNormals[0].copy(e);t.vertexNormals[3].copy(g)}if(f.vertexColors.length===4){e=f.vertexColors[0].clone();e.lerpSelf(f.vertexColors[1],0.5);g=f.vertexColors[2].clone();g.lerpSelf(f.vertexColors[3],0.5);v.vertexColors[1].copy(e);v.vertexColors[2].copy(g);t.vertexColors[0].copy(e);t.vertexColors[3].copy(g)}f=0}else{q=j.clone();q.lerpSelf(n,0.5);j=m.clone();j.lerpSelf(l,0.5);v.a=e;v.b=g;v.c=r;v.d=u;t.a=u;t.b=r;t.c=h;t.d=i;if(f.vertexNormals.length===4){e=f.vertexNormals[1].clone();
-e.lerpSelf(f.vertexNormals[2],0.5);g=f.vertexNormals[3].clone();g.lerpSelf(f.vertexNormals[0],0.5);v.vertexNormals[2].copy(e);v.vertexNormals[3].copy(g);t.vertexNormals[0].copy(g);t.vertexNormals[1].copy(e)}if(f.vertexColors.length===4){e=f.vertexColors[1].clone();e.lerpSelf(f.vertexColors[2],0.5);g=f.vertexColors[3].clone();g.lerpSelf(f.vertexColors[0],0.5);v.vertexColors[2].copy(e);v.vertexColors[3].copy(g);t.vertexColors[0].copy(g);t.vertexColors[1].copy(e)}f=1}A.push(v,t);a.vertices.push(q,j);
-e=0;for(g=a.faceVertexUvs.length;e<g;e++)if(a.faceVertexUvs[e].length){l=a.faceVertexUvs[e][c];t=l[0];h=l[1];v=l[2];l=l[3];if(f===0){j=t.clone();j.lerpSelf(h,0.5);n=v.clone();n.lerpSelf(l,0.5);t=[t.clone(),j.clone(),n.clone(),l.clone()];h=[j.clone(),h.clone(),v.clone(),n.clone()]}else{j=h.clone();j.lerpSelf(v,0.5);n=l.clone();n.lerpSelf(t,0.5);t=[t.clone(),h.clone(),j.clone(),n.clone()];h=[n.clone(),j.clone(),v.clone(),l.clone()]}y[e].push(t,h)}}else{A.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)y[e].push(a.faceVertexUvs[e][c])}}}a.faces=
-A;a.faceVertexUvs=y}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+e.a;h=e.b;i=e.c;g=a.vertices[g];h=a.vertices[h];i=a.vertices[i];b.push(g.clone());b.push(h.clone());b.push(i.clone());e.a=f;e.b=f+1;e.c=f+2}}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,f,e,g,h,i,l,j,o,m,p,q,n,t,s,u,v,r,A=[],x=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)x[c]=[];c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){e=f.a;g=f.b;h=f.c;l=a.vertices[e];j=a.vertices[g];o=a.vertices[h];p=l.distanceTo(j);q=j.distanceTo(o);m=l.distanceTo(o);if(p>
+b||q>b||m>b){i=a.vertices.length;v=f.clone();r=f.clone();if(p>=q&&p>=m){l=l.clone();l.lerpSelf(j,0.5);v.a=e;v.b=i;v.c=h;r.a=i;r.b=g;r.c=h;if(f.vertexNormals.length===3){e=f.vertexNormals[0].clone();e.lerpSelf(f.vertexNormals[1],0.5);v.vertexNormals[1].copy(e);r.vertexNormals[0].copy(e)}if(f.vertexColors.length===3){e=f.vertexColors[0].clone();e.lerpSelf(f.vertexColors[1],0.5);v.vertexColors[1].copy(e);r.vertexColors[0].copy(e)}f=0}else if(q>=p&&q>=m){l=j.clone();l.lerpSelf(o,0.5);v.a=e;v.b=g;v.c=
+i;r.a=i;r.b=h;r.c=e;if(f.vertexNormals.length===3){e=f.vertexNormals[1].clone();e.lerpSelf(f.vertexNormals[2],0.5);v.vertexNormals[2].copy(e);r.vertexNormals[0].copy(e);r.vertexNormals[1].copy(f.vertexNormals[2]);r.vertexNormals[2].copy(f.vertexNormals[0])}if(f.vertexColors.length===3){e=f.vertexColors[1].clone();e.lerpSelf(f.vertexColors[2],0.5);v.vertexColors[2].copy(e);r.vertexColors[0].copy(e);r.vertexColors[1].copy(f.vertexColors[2]);r.vertexColors[2].copy(f.vertexColors[0])}f=1}else{l=l.clone();
+l.lerpSelf(o,0.5);v.a=e;v.b=g;v.c=i;r.a=i;r.b=g;r.c=h;if(f.vertexNormals.length===3){e=f.vertexNormals[0].clone();e.lerpSelf(f.vertexNormals[2],0.5);v.vertexNormals[2].copy(e);r.vertexNormals[0].copy(e)}if(f.vertexColors.length===3){e=f.vertexColors[0].clone();e.lerpSelf(f.vertexColors[2],0.5);v.vertexColors[2].copy(e);r.vertexColors[0].copy(e)}f=2}A.push(v,r);a.vertices.push(l);e=0;for(g=a.faceVertexUvs.length;e<g;e++)if(a.faceVertexUvs[e].length){l=a.faceVertexUvs[e][c];r=l[0];h=l[1];v=l[2];if(f===
+0){j=r.clone();j.lerpSelf(h,0.5);l=[r.clone(),j.clone(),v.clone()];h=[j.clone(),h.clone(),v.clone()]}else if(f===1){j=h.clone();j.lerpSelf(v,0.5);l=[r.clone(),h.clone(),j.clone()];h=[j.clone(),v.clone(),r.clone()]}else{j=r.clone();j.lerpSelf(v,0.5);l=[r.clone(),h.clone(),j.clone()];h=[j.clone(),h.clone(),v.clone()]}x[e].push(l,h)}}else{A.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)x[e].push(a.faceVertexUvs[e][c])}}else{e=f.a;g=f.b;h=f.c;i=f.d;l=a.vertices[e];j=a.vertices[g];o=a.vertices[h];m=
+a.vertices[i];p=l.distanceTo(j);q=j.distanceTo(o);n=o.distanceTo(m);t=l.distanceTo(m);if(p>b||q>b||n>b||t>b){s=a.vertices.length;u=a.vertices.length+1;v=f.clone();r=f.clone();if(p>=q&&p>=n&&p>=t||n>=q&&n>=p&&n>=t){p=l.clone();p.lerpSelf(j,0.5);j=o.clone();j.lerpSelf(m,0.5);v.a=e;v.b=s;v.c=u;v.d=i;r.a=s;r.b=g;r.c=h;r.d=u;if(f.vertexNormals.length===4){e=f.vertexNormals[0].clone();e.lerpSelf(f.vertexNormals[1],0.5);g=f.vertexNormals[2].clone();g.lerpSelf(f.vertexNormals[3],0.5);v.vertexNormals[1].copy(e);
+v.vertexNormals[2].copy(g);r.vertexNormals[0].copy(e);r.vertexNormals[3].copy(g)}if(f.vertexColors.length===4){e=f.vertexColors[0].clone();e.lerpSelf(f.vertexColors[1],0.5);g=f.vertexColors[2].clone();g.lerpSelf(f.vertexColors[3],0.5);v.vertexColors[1].copy(e);v.vertexColors[2].copy(g);r.vertexColors[0].copy(e);r.vertexColors[3].copy(g)}f=0}else{p=j.clone();p.lerpSelf(o,0.5);j=m.clone();j.lerpSelf(l,0.5);v.a=e;v.b=g;v.c=s;v.d=u;r.a=u;r.b=s;r.c=h;r.d=i;if(f.vertexNormals.length===4){e=f.vertexNormals[1].clone();
+e.lerpSelf(f.vertexNormals[2],0.5);g=f.vertexNormals[3].clone();g.lerpSelf(f.vertexNormals[0],0.5);v.vertexNormals[2].copy(e);v.vertexNormals[3].copy(g);r.vertexNormals[0].copy(g);r.vertexNormals[1].copy(e)}if(f.vertexColors.length===4){e=f.vertexColors[1].clone();e.lerpSelf(f.vertexColors[2],0.5);g=f.vertexColors[3].clone();g.lerpSelf(f.vertexColors[0],0.5);v.vertexColors[2].copy(e);v.vertexColors[3].copy(g);r.vertexColors[0].copy(g);r.vertexColors[1].copy(e)}f=1}A.push(v,r);a.vertices.push(p,j);
+e=0;for(g=a.faceVertexUvs.length;e<g;e++)if(a.faceVertexUvs[e].length){l=a.faceVertexUvs[e][c];r=l[0];h=l[1];v=l[2];l=l[3];if(f===0){j=r.clone();j.lerpSelf(h,0.5);o=v.clone();o.lerpSelf(l,0.5);r=[r.clone(),j.clone(),o.clone(),l.clone()];h=[j.clone(),h.clone(),v.clone(),o.clone()]}else{j=h.clone();j.lerpSelf(v,0.5);o=l.clone();o.lerpSelf(r,0.5);r=[r.clone(),h.clone(),j.clone(),o.clone()];h=[o.clone(),j.clone(),v.clone(),l.clone()]}x[e].push(r,h)}}else{A.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)x[e].push(a.faceVertexUvs[e][c])}}}a.faces=
+A;a.faceVertexUvs=x}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var f=new Image,e=new THREE.Texture(f,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){e.image=a.content;e.needsUpdate=true;c&&c(e)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a,f);return e},loadTextureCube:function(a,b,c){var d,f=[],e=new THREE.Texture(f,b);e.flipY=false;b=f.loadCount=0;for(d=a.length;b<d;++b){f[b]=new Image;f[b].onload=function(){f.loadCount=
 f.loadCount+1;if(f.loadCount===6){e.needsUpdate=true;c&&c()}};f[b].crossOrigin=this.crossOrigin;f[b].src=a[b]}return e},loadCompressedTexture:function(a,b,c,d){var f=new THREE.CompressedTexture;f.mapping=b;var e=new XMLHttpRequest;e.onload=function(){var a=THREE.ImageUtils.parseDDS(e.response,true);f.format=a.format;f.mipmaps=a.mipmaps;f.image.width=a.width;f.image.height=a.height;f.generateMipmaps=false;f.needsUpdate=true;c&&c(f)};e.onerror=d;e.open("GET",a,true);e.responseType="arraybuffer";e.send(null);
 return f},parseDDS:function(a,b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},f=c("DXT1"),e=c("DXT3"),g=c("DXT5"),h=new Int32Array(a,0,31);if(h[0]!==542327876){console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header");return d}if(!h[20]&4){console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code");return d}var i=h[21];switch(i){case f:f=
 8;d.format=THREE.RGB_S3TC_DXT1_Format;break;case e:f=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case g:f=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&255,i>>8&255,i>>16&255,i>>24&255));return d}d.mipmapCount=1;if(h[2]&131072&&b!==false)d.mipmapCount=Math.max(1,h[7]);d.width=h[4];d.height=h[3];h=h[1]+4;e=d.width;g=d.height;for(i=0;i<d.mipmapCount;i++){var l=Math.max(4,e)/4*Math.max(4,g)/4*f,j={data:new Uint8Array(a,
-h,l),width:e,height:g};d.mipmaps.push(j);h=h+l;e=e*0.5;g=g*0.5}return d},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,f=a.height,e=document.createElement("canvas");e.width=d;e.height=f;var g=e.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,f).data,i=g.createImageData(d,f),l=i.data,j=0;j<d;j++)for(var n=0;n<f;n++){var m=n-1<0?0:n-1,q=n+1>f-1?f-1:n+1,o=j-1<0?0:j-1,p=j+1>d-1?d-1:j+1,s=[],
-r=[0,0,h[(n*d+j)*4]/255*b];s.push([-1,0,h[(n*d+o)*4]/255*b]);s.push([-1,-1,h[(m*d+o)*4]/255*b]);s.push([0,-1,h[(m*d+j)*4]/255*b]);s.push([1,-1,h[(m*d+p)*4]/255*b]);s.push([1,0,h[(n*d+p)*4]/255*b]);s.push([1,1,h[(q*d+p)*4]/255*b]);s.push([0,1,h[(q*d+j)*4]/255*b]);s.push([-1,1,h[(q*d+o)*4]/255*b]);m=[];o=s.length;for(q=0;q<o;q++){var p=s[q],u=s[(q+1)%o],p=[p[0]-r[0],p[1]-r[1],p[2]-r[2]],u=[u[0]-r[0],u[1]-r[1],u[2]-r[2]];m.push(c([p[1]*u[2]-p[2]*u[1],p[2]*u[0]-p[0]*u[2],p[0]*u[1]-p[1]*u[0]]))}s=[0,0,
-0];for(q=0;q<m.length;q++){s[0]=s[0]+m[q][0];s[1]=s[1]+m[q][1];s[2]=s[2]+m[q][2]}s[0]=s[0]/m.length;s[1]=s[1]/m.length;s[2]=s[2]/m.length;r=(n*d+j)*4;l[r]=(s[0]+1)/2*255|0;l[r+1]=(s[1]+1)/2*255|0;l[r+2]=s[2]*255|0;l[r+3]=255}g.putImageData(i,0,0);return e},generateDataTexture:function(a,b,c){for(var d=a*b,f=new Uint8Array(3*d),e=Math.floor(c.r*255),g=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++){f[h*3]=e;f[h*3+1]=g;f[h*3+2]=c}a=new THREE.DataTexture(f,a,b,THREE.RGBFormat);a.needsUpdate=true;
+h,l),width:e,height:g};d.mipmaps.push(j);h=h+l;e=e*0.5;g=g*0.5}return d},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,f=a.height,e=document.createElement("canvas");e.width=d;e.height=f;var g=e.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,f).data,i=g.createImageData(d,f),l=i.data,j=0;j<d;j++)for(var o=0;o<f;o++){var m=o-1<0?0:o-1,p=o+1>f-1?f-1:o+1,q=j-1<0?0:j-1,n=j+1>d-1?d-1:j+1,t=[],
+s=[0,0,h[(o*d+j)*4]/255*b];t.push([-1,0,h[(o*d+q)*4]/255*b]);t.push([-1,-1,h[(m*d+q)*4]/255*b]);t.push([0,-1,h[(m*d+j)*4]/255*b]);t.push([1,-1,h[(m*d+n)*4]/255*b]);t.push([1,0,h[(o*d+n)*4]/255*b]);t.push([1,1,h[(p*d+n)*4]/255*b]);t.push([0,1,h[(p*d+j)*4]/255*b]);t.push([-1,1,h[(p*d+q)*4]/255*b]);m=[];q=t.length;for(p=0;p<q;p++){var n=t[p],u=t[(p+1)%q],n=[n[0]-s[0],n[1]-s[1],n[2]-s[2]],u=[u[0]-s[0],u[1]-s[1],u[2]-s[2]];m.push(c([n[1]*u[2]-n[2]*u[1],n[2]*u[0]-n[0]*u[2],n[0]*u[1]-n[1]*u[0]]))}t=[0,0,
+0];for(p=0;p<m.length;p++){t[0]=t[0]+m[p][0];t[1]=t[1]+m[p][1];t[2]=t[2]+m[p][2]}t[0]=t[0]/m.length;t[1]=t[1]/m.length;t[2]=t[2]/m.length;s=(o*d+j)*4;l[s]=(t[0]+1)/2*255|0;l[s+1]=(t[1]+1)/2*255|0;l[s+2]=t[2]*255|0;l[s+3]=255}g.putImageData(i,0,0);return e},generateDataTexture:function(a,b,c){for(var d=a*b,f=new Uint8Array(3*d),e=Math.floor(c.r*255),g=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++){f[h*3]=e;f[h*3+1]=g;f[h*3+2]=c}a=new THREE.DataTexture(f,a,b,THREE.RGBFormat);a.needsUpdate=true;
 return a}};
 THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,f=a.children.length;for(d=0;d<f;d++){c=a.children[d];b(c);THREE.SceneUtils.traverseHierarchy(c,b)}},createMultiMaterialObject:function(a,b){var c,d=b.length,f=new THREE.Object3D;for(c=0;c<d;c++){var e=new THREE.Mesh(a,b[c]);f.add(e)}return f},cloneObject:function(a){var b;if(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}else if(a instanceof THREE.SkinnedMesh)b=new THREE.SkinnedMesh(a.geometry,a.material);else if(a instanceof THREE.Mesh)b=new THREE.Mesh(a.geometry,a.material);else if(a instanceof THREE.Line)b=new THREE.Line(a.geometry,a.material,a.type);else if(a instanceof THREE.Ribbon)b=new THREE.Ribbon(a.geometry,a.material);
@@ -528,12 +529,12 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,
 THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,"#ifdef USE_SKINNING\nvNormal = normalMatrix * skinnedNormal.xyz;\nvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );\nvTangent = normalMatrix * skinnedTangent.xyz;\n#else\nvNormal = normalMatrix * normal;\nvTangent = normalMatrix * tangent.xyz;\n#endif\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvUv = uv * uRepeat + uOffset;\nvec3 displacedPosition;\n#ifdef VERTEX_TEXTURES\nif ( enableDisplacement ) {\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\ndisplacedPosition = position + normalize( normal ) * df;\n} else {\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned  = boneMatX * skinVertex * skinWeight.x;\nskinned \t  += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition  = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n}\n#else\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned  = boneMatX * skinVertex * skinWeight.x;\nskinned \t  += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition  = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n#endif\nvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );\nvec4 mPosition = modelMatrix * vec4( displacedPosition, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\nvWorldPosition = mPosition.xyz;\nvViewPosition = -mvPosition.xyz;\n#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * mPosition;\n}\n#endif\n}"].join("\n")},
 cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = modelMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}});
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
-0,f=String(a).split(""),e=f.length,g=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(f[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,f){var e=[],g,h,i,l,j,n,m,q,o,p,s,r=b.glyphs[a]||b.glyphs["?"];if(r){if(r.o){b=r._cachedOutline||(r._cachedOutline=r.o.split(" "));l=b.length;for(a=0;a<l;){i=b[a++];switch(i){case "m":i=b[a++]*c+d;j=b[a++]*c;f.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;f.lineTo(i,j);break;case "q":i=b[a++]*
-c+d;j=b[a++]*c;q=b[a++]*c+d;o=b[a++]*c;f.quadraticCurveTo(q,o,i,j);if(g=e[e.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var u=g/h;THREE.Shape.Utils.b2(u,n,q,i);THREE.Shape.Utils.b2(u,m,o,j)}}break;case "b":i=b[a++]*c+d;j=b[a++]*c;q=b[a++]*c+d;o=b[a++]*-c;p=b[a++]*c+d;s=b[a++]*-c;f.bezierCurveTo(i,j,q,o,p,s);if(g=e[e.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){u=g/h;THREE.Shape.Utils.b3(u,n,q,p,i);THREE.Shape.Utils.b3(u,m,o,s,j)}}}}}return{offset:r.ha*c,path:f}}}};
+0,f=String(a).split(""),e=f.length,g=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(f[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,f){var e=[],g,h,i,l,j,o,m,p,q,n,t,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;){i=b[a++];switch(i){case "m":i=b[a++]*c+d;j=b[a++]*c;f.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;f.lineTo(i,j);break;case "q":i=b[a++]*
+c+d;j=b[a++]*c;p=b[a++]*c+d;q=b[a++]*c;f.quadraticCurveTo(p,q,i,j);if(g=e[e.length-1]){o=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var u=g/h;THREE.Shape.Utils.b2(u,o,p,i);THREE.Shape.Utils.b2(u,m,q,j)}}break;case "b":i=b[a++]*c+d;j=b[a++]*c;p=b[a++]*c+d;q=b[a++]*-c;n=b[a++]*c+d;t=b[a++]*-c;f.bezierCurveTo(i,j,p,q,n,t);if(g=e[e.length-1]){o=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){u=g/h;THREE.Shape.Utils.b3(u,o,p,n,i);THREE.Shape.Utils.b3(u,m,q,t,j)}}}}}return{offset:s.ha*c,path:f}}}};
 THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",f=b.weight!==void 0?b.weight:"normal",e=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=f;THREE.FontUtils.style=e;c=THREE.FontUtils.drawText(a).paths;d=[];f=0;for(e=c.length;f<e;f++)Array.prototype.push.apply(d,c[f].toShapes());return d};
-(function(a){var b=function(a){for(var b=a.length,f=0,e=b-1,g=0;g<b;e=g++)f=f+(a[e].x*a[g].y-a[g].x*a[e].y);return f*0.5};a.Triangulate=function(a,d){var f=a.length;if(f<3)return null;var e=[],g=[],h=[],i,l,j;if(b(a)>0)for(l=0;l<f;l++)g[l]=l;else for(l=0;l<f;l++)g[l]=f-1-l;var n=2*f;for(l=f-1;f>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");break}i=l;f<=i&&(i=0);l=i+1;f<=l&&(l=0);j=l+1;f<=j&&(j=0);var m;a:{m=a;var q=i,o=l,p=j,s=f,r=g,u=void 0,v=void 0,t=void 0,A=void 0,y=void 0,
-B=void 0,G=void 0,x=void 0,I=void 0,v=m[r[q]].x,t=m[r[q]].y,A=m[r[o]].x,y=m[r[o]].y,B=m[r[p]].x,G=m[r[p]].y;if(1E-10>(A-v)*(G-t)-(y-t)*(B-v))m=false;else{for(u=0;u<s;u++)if(!(u==q||u==o||u==p)){var x=m[r[u]].x,I=m[r[u]].y,F=void 0,L=void 0,E=void 0,P=void 0,H=void 0,D=void 0,S=void 0,R=void 0,J=void 0,N=void 0,Y=void 0,K=void 0,F=E=H=void 0,F=B-A,L=G-y,E=v-B,P=t-G,H=A-v,D=y-t,S=x-v,R=I-t,J=x-A,N=I-y,Y=x-B,K=I-G,F=F*N-L*J,H=H*R-D*S,E=E*K-P*Y;if(F>=0&&E>=0&&H>=0){m=false;break a}}m=true}}if(m){e.push([a[g[i]],
-a[g[l]],a[g[j]]]);h.push([g[i],g[l],g[j]]);i=l;for(j=l+1;j<f;i++,j++)g[i]=g[j];f--;n=2*f}}return d?h:e};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};
+(function(a){var b=function(a){for(var b=a.length,f=0,e=b-1,g=0;g<b;e=g++)f=f+(a[e].x*a[g].y-a[g].x*a[e].y);return f*0.5};a.Triangulate=function(a,d){var f=a.length;if(f<3)return null;var e=[],g=[],h=[],i,l,j;if(b(a)>0)for(l=0;l<f;l++)g[l]=l;else for(l=0;l<f;l++)g[l]=f-1-l;var o=2*f;for(l=f-1;f>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");break}i=l;f<=i&&(i=0);l=i+1;f<=l&&(l=0);j=l+1;f<=j&&(j=0);var m;a:{m=a;var p=i,q=l,n=j,t=f,s=g,u=void 0,v=void 0,r=void 0,A=void 0,x=void 0,
+B=void 0,C=void 0,z=void 0,F=void 0,v=m[s[p]].x,r=m[s[p]].y,A=m[s[q]].x,x=m[s[q]].y,B=m[s[n]].x,C=m[s[n]].y;if(1E-10>(A-v)*(C-r)-(x-r)*(B-v))m=false;else{for(u=0;u<t;u++)if(!(u==p||u==q||u==n)){var z=m[s[u]].x,F=m[s[u]].y,G=void 0,M=void 0,E=void 0,N=void 0,I=void 0,K=void 0,Q=void 0,H=void 0,L=void 0,aa=void 0,Z=void 0,J=void 0,G=E=I=void 0,G=B-A,M=C-x,E=v-B,N=r-C,I=A-v,K=x-r,Q=z-v,H=F-r,L=z-A,aa=F-x,Z=z-B,J=F-C,G=G*aa-M*L,I=I*H-K*Q,E=E*J-N*Z;if(G>=0&&E>=0&&I>=0){m=false;break a}}m=true}}if(m){e.push([a[g[i]],
+a[g[l]],a[g[j]]]);h.push([g[i],g[l],g[j]]);i=l;for(j=l+1;j<f;i++,j++)g[i]=g[j];f--;o=2*f}}return d?h:e};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};
 THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};
 THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=false;var b=[],c,d=this.getPoint(0),f,e=0;b.push(0);for(f=1;f<=a;f++){c=this.getPoint(f/a);e=e+c.distanceTo(d);b.push(e);d=c}return this.cacheArcLengths=b};THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=true;this.getLengths()};
 THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,f=c.length,e;e=b?b:a*c[f-1];for(var g=0,h=f-1,i;g<=h;){d=Math.floor(g+(h-g)/2);i=c[d]-e;if(i<0)g=d+1;else if(i>0)h=d-1;else{h=d;break}}d=h;if(c[d]==e)return d/(f-1);g=c[d];return c=(d+(e-g)/(c[d+1]-g))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
@@ -554,7 +555,7 @@ THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=a==void 0?[]
 d[c[1]].z,d[c[2]].z,d[c[3]].z,f);return b});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=false};THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype);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){b=c[a]-b;a=this.curves[a];b=1-b/a.getLength();return 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=b+this.curves[c].getLength();a.push(b)}return this.cacheLengths=a};
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,f,e,g;b=c=Number.NEGATIVE_INFINITY;f=e=Number.POSITIVE_INFINITY;var h,i,l,j,n=a[0]instanceof THREE.Vector3;j=n?new THREE.Vector3:new THREE.Vector2;i=0;for(l=a.length;i<l;i++){h=a[i];if(h.x>b)b=h.x;else if(h.x<f)f=h.x;if(h.y>c)c=h.y;else if(h.y<e)e=h.y;if(n)if(h.z>d)d=h.z;else if(h.z<g)g=h.z;j.addSelf(h)}a={minX:f,minY:e,maxX:b,maxY:c,centroid:j.divideScalar(l)};if(n){a.maxZ=d;a.minZ=g}return a};
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,f,e,g;b=c=Number.NEGATIVE_INFINITY;f=e=Number.POSITIVE_INFINITY;var h,i,l,j,o=a[0]instanceof THREE.Vector3;j=o?new THREE.Vector3:new THREE.Vector2;i=0;for(l=a.length;i<l;i++){h=a[i];if(h.x>b)b=h.x;else if(h.x<f)f=h.x;if(h.y>c)c=h.y;else if(h.y<e)e=h.y;if(o)if(h.z>d)d=h.z;else if(h.z<g)g=h.z;j.addSelf(h)}a={minX:f,minY:e,maxX:b,maxY:c,centroid:j.divideScalar(l)};if(o){a.maxZ=d;a.minZ=g}return a};
 THREE.CurvePath.prototype.createPointsGeometry=function(a){a=this.getPoints(a,true);return this.createGeometry(a)};THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){a=this.getSpacedPoints(a,true);return this.createGeometry(a)};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vector3(a[c].x,a[c].y,a[c].z||0));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
 THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,f;if(!b)b=this.bends;d=0;for(f=b.length;d<f;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,f;if(!b)b=this.bends;d=0;for(f=b.length;d<f;d++)c=this.getWrapPoints(c,b[d]);return c};
 THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,f,e,g,h,i;d=0;for(f=a.length;d<f;d++){e=a[d];g=e.x;h=e.y;i=g/c.maxX;i=b.getUtoTmapping(i,g);g=b.getPoint(i);h=b.getNormalVector(i).multiplyScalar(h);e.x=g.x+h.x;e.y=g.y+h.y}return a};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
@@ -567,17 +568,17 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,f,e){var g=Array.prototype.s
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,d,f,e){var g=this.actions[this.actions.length-1].args;this.absarc(a+g[g.length-2],b+g[g.length-1],c,d,f,e)};
 THREE.Path.prototype.absarc=function(a,b,c,d,f,e){this.absellipse(a,b,c,c,d,f,e)};THREE.Path.prototype.ellipse=function(a,b,c,d,f,e,g){var h=this.actions[this.actions.length-1].args;this.absellipse(a+h[h.length-2],b+h[h.length-1],c,d,f,e,g)};THREE.Path.prototype.absellipse=function(a,b,c,d,f,e,g){var h=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(a,b,c,d,f,e,g);this.curves.push(i);i=i.getPoint(g?1:0);h.push(i.x);h.push(i.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:h})};
 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){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,f,e,g,h,i,l,j,n,m,q,o,p;d=0;for(f=this.actions.length;d<f;d++){e=this.actions[d];g=e.action;e=e.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];i=e[3];n=e[0];m=e[1];if(c.length>0){g=c[c.length-1];
-q=g.x;o=g.y}else{g=this.actions[d-1].args;q=g[g.length-2];o=g[g.length-1]}for(e=1;e<=a;e++){p=e/a;g=THREE.Shape.Utils.b2(p,q,n,h);p=THREE.Shape.Utils.b2(p,o,m,i);c.push(new THREE.Vector2(g,p))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];n=e[0];m=e[1];l=e[2];j=e[3];if(c.length>0){g=c[c.length-1];q=g.x;o=g.y}else{g=this.actions[d-1].args;q=g[g.length-2];o=g[g.length-1]}for(e=1;e<=a;e++){p=e/a;g=THREE.Shape.Utils.b3(p,q,n,l,h);p=THREE.Shape.Utils.b3(p,o,m,j,i);c.push(new THREE.Vector2(g,
-p))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;p=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*e[0].length;p=p.concat(e[0]);p=new THREE.SplineCurve(p);for(e=1;e<=g;e++)c.push(p.getPointAt(e/g));break;case THREE.PathActions.ARC:h=e[0];i=e[1];m=e[2];l=e[3];g=e[4];n=!!e[5];q=g-l;o=a*2;for(e=1;e<=o;e++){p=e/o;n||(p=1-p);p=l+p*q;g=h+m*Math.cos(p);p=i+m*Math.sin(p);c.push(new THREE.Vector2(g,p))}break;case THREE.PathActions.ELLIPSE:h=e[0];i=e[1];m=e[2];j=e[3];l=e[4];g=e[5];
-n=!!e[6];q=g-l;o=a*2;for(e=1;e<=o;e++){p=e/o;n||(p=1-p);p=l+p*q;g=h+m*Math.cos(p);p=i+j*Math.sin(p);c.push(new THREE.Vector2(g,p))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1E-10&&Math.abs(d.y-c[0].y)<1E-10&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,f,e,g,h,i,l,j,o,m,p,q,n;d=0;for(f=this.actions.length;d<f;d++){e=this.actions[d];g=e.action;e=e.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];i=e[3];o=e[0];m=e[1];if(c.length>0){g=c[c.length-1];
+p=g.x;q=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];q=g[g.length-1]}for(e=1;e<=a;e++){n=e/a;g=THREE.Shape.Utils.b2(n,p,o,h);n=THREE.Shape.Utils.b2(n,q,m,i);c.push(new THREE.Vector2(g,n))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];o=e[0];m=e[1];l=e[2];j=e[3];if(c.length>0){g=c[c.length-1];p=g.x;q=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];q=g[g.length-1]}for(e=1;e<=a;e++){n=e/a;g=THREE.Shape.Utils.b3(n,p,o,l,h);n=THREE.Shape.Utils.b3(n,q,m,j,i);c.push(new THREE.Vector2(g,
+n))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;n=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*e[0].length;n=n.concat(e[0]);n=new THREE.SplineCurve(n);for(e=1;e<=g;e++)c.push(n.getPointAt(e/g));break;case THREE.PathActions.ARC:h=e[0];i=e[1];m=e[2];l=e[3];g=e[4];o=!!e[5];p=g-l;q=a*2;for(e=1;e<=q;e++){n=e/q;o||(n=1-n);n=l+n*p;g=h+m*Math.cos(n);n=i+m*Math.sin(n);c.push(new THREE.Vector2(g,n))}break;case THREE.PathActions.ELLIPSE:h=e[0];i=e[1];m=e[2];j=e[3];l=e[4];g=e[5];
+o=!!e[6];p=g-l;q=a*2;for(e=1;e<=q;e++){n=e/q;o||(n=1-n);n=l+n*p;g=h+m*Math.cos(n);n=i+j*Math.sin(n);c.push(new THREE.Vector2(g,n))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1E-10&&Math.abs(d.y-c[0].y)<1E-10&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
 THREE.Path.prototype.toShapes=function(){var a,b,c,d,f=[],e=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++){c=this.actions[a];d=c.args;c=c.action;if(c==THREE.PathActions.MOVE_TO&&e.actions.length!=0){f.push(e);e=new THREE.Path}e[c].apply(e,d)}e.actions.length!=0&&f.push(e);if(f.length==0)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(f[0].getPoints());if(f.length==1){e=f[0];g=new THREE.Shape;g.actions=e.actions;g.curves=e.curves;d.push(g);return d}if(a){g=new THREE.Shape;a=0;for(b=f.length;a<
 b;a++){e=f[a];if(THREE.Shape.Utils.isClockWise(e.getPoints())){g.actions=e.actions;g.curves=e.curves;d.push(g);g=new THREE.Shape}else g.holes.push(e)}}else{a=0;for(b=f.length;a<b;a++){e=f[a];if(THREE.Shape.Utils.isClockWise(e.getPoints())){g&&d.push(g);g=new THREE.Shape;g.actions=e.actions;g.curves=e.curves}else g.holes.push(e)}d.push(g)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);
 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.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),f,e,g,h,i,l,j,n,m,q,o=[];for(i=0;i<b.length;i++){l=b[i];Array.prototype.push.apply(d,l);e=Number.POSITIVE_INFINITY;for(f=0;f<l.length;f++){m=l[f];q=[];for(n=0;n<c.length;n++){j=c[n];j=m.distanceToSquared(j);q.push(j);if(j<e){e=j;g=f;h=n}}}f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:l.length-1;var p=[l[g],c[h],c[f]];n=THREE.FontUtils.Triangulate.area(p);var s=[l[g],l[e],c[h]];m=THREE.FontUtils.Triangulate.area(s);q=h;j=g;h=h+1;g=g+
--1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+l.length);g=g%l.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:l.length-1;p=[l[g],c[h],c[f]];p=THREE.FontUtils.Triangulate.area(p);s=[l[g],l[e],c[h]];s=THREE.FontUtils.Triangulate.area(s);if(n+m>p+s){h=q;g=j;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+l.length);g=g%l.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:l.length-1}n=c.slice(0,h);m=c.slice(h);q=l.slice(g);j=l.slice(0,g);e=[l[g],l[e],c[h]];o.push([l[g],c[h],c[f]]);o.push(e);c=n.concat(q).concat(j).concat(m)}return{shape:c,
-isolatedPts:o,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),e,g,h,i,l={};e=0;for(g=d.length;e<g;e++){i=d[e].x+":"+d[e].y;l[i]!==void 0&&console.log("Duplicate point",i);l[i]=e}e=0;for(g=c.length;e<g;e++){h=c[e];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=l[i];i!==void 0&&(h[d]=i)}}e=0;for(g=f.length;e<g;e++){h=f[e];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=l[i];i!==void 0&&(h[d]=i)}}return c.concat(f)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),f,e,g,h,i,l,j,o,m,p,q=[];for(i=0;i<b.length;i++){l=b[i];Array.prototype.push.apply(d,l);e=Number.POSITIVE_INFINITY;for(f=0;f<l.length;f++){m=l[f];p=[];for(o=0;o<c.length;o++){j=c[o];j=m.distanceToSquared(j);p.push(j);if(j<e){e=j;g=f;h=o}}}f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:l.length-1;var n=[l[g],c[h],c[f]];o=THREE.FontUtils.Triangulate.area(n);var t=[l[g],l[e],c[h]];m=THREE.FontUtils.Triangulate.area(t);p=h;j=g;h=h+1;g=g+
+-1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+l.length);g=g%l.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:l.length-1;n=[l[g],c[h],c[f]];n=THREE.FontUtils.Triangulate.area(n);t=[l[g],l[e],c[h]];t=THREE.FontUtils.Triangulate.area(t);if(o+m>n+t){h=p;g=j;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+l.length);g=g%l.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:l.length-1}o=c.slice(0,h);m=c.slice(h);p=l.slice(g);j=l.slice(0,g);e=[l[g],l[e],c[h]];q.push([l[g],c[h],c[f]]);q.push(e);c=o.concat(p).concat(j).concat(m)}return{shape:c,
+isolatedPts:q,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),e,g,h,i,l={};e=0;for(g=d.length;e<g;e++){i=d[e].x+":"+d[e].y;l[i]!==void 0&&console.log("Duplicate point",i);l[i]=e}e=0;for(g=c.length;e<g;e++){h=c[e];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=l[i];i!==void 0&&(h[d]=i)}}e=0;for(g=f.length;e<g;e++){h=f[e];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=l[i];i!==void 0&&(h[d]=i)}}return c.concat(f)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 this.b3p3(a,f)}};
 THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==true){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(a.hierarchy[c].keys[d].time<0)a.hierarchy[c].keys[d].time=
@@ -588,9 +589,9 @@ a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hie
 THREE.Animation.prototype.play=function(a,b){if(this.isPlaying===false){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,f;for(c=0;c<d;c++){f=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=true;f.matrixAutoUpdate=true;if(f.animationCache===void 0){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
 f instanceof THREE.Bone?f.skinMatrix:f.matrix}var e=f.animationCache.prevKey;f=f.animationCache.nextKey;e.pos=this.data.hierarchy[c].keys[0];e.rot=this.data.hierarchy[c].keys[0];e.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused===true?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this)};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying!==false){var b=["pos","rot","scl"],c,d,f,e,g,h,i,l,j;j=this.currentTime=this.currentTime+a*this.timeScale;l=this.currentTime=this.currentTime%this.data.length;parseInt(Math.min(l*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,m=this.hierarchy.length;n<m;n++){a=this.hierarchy[n];i=a.animationCache;for(var q=0;q<3;q++){c=b[q];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=j){if(l<j)if(this.loop){g=this.data.hierarchy[n].keys[0];
-for(h=this.getNextKeyWith(c,n,1);h.time<l;){g=h;h=this.getNextKeyWith(c,n,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,n,h.index+1)}while(h.time<l)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(l-g.time)/(h.time-g.time);f=g[c];e=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=f[0]+
-(e[0]-f[0])*d;c.y=f[1]+(e[1]-f[1])*d;c.z=f[2]+(e[2]-f[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=this.getPrevKeyWith("pos",n,g.index-1).pos;this.points[1]=f;this.points[2]=e;this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos;d=d*0.33+0.33;f=this.interpolateCatmullRom(this.points,d);c.x=f[0];c.y=f[1];c.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying!==false){var b=["pos","rot","scl"],c,d,f,e,g,h,i,l,j;j=this.currentTime=this.currentTime+a*this.timeScale;l=this.currentTime=this.currentTime%this.data.length;parseInt(Math.min(l*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,m=this.hierarchy.length;o<m;o++){a=this.hierarchy[o];i=a.animationCache;for(var p=0;p<3;p++){c=b[p];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=j){if(l<j)if(this.loop){g=this.data.hierarchy[o].keys[0];
+for(h=this.getNextKeyWith(c,o,1);h.time<l;){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<l)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(l-g.time)/(h.time-g.time);f=g[c];e=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=f[0]+
+(e[0]-f[0])*d;c.y=f[1]+(e[1]-f[1])*d;c.z=f[2]+(e[2]-f[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=this.getPrevKeyWith("pos",o,g.index-1).pos;this.points[1]=f;this.points[2]=e;this.points[3]=this.getNextKeyWith("pos",o,h.index+1).pos;d=d*0.33+0.33;f=this.interpolateCatmullRom(this.points,d);c.x=f[0];c.y=f[1];c.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=
 this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(c==="rot")THREE.Quaternion.slerp(f,e,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=f[0]+(e[0]-f[0])*d;c.y=f[1]+(e[1]-f[1])*d;c.z=f[2]+(e[2]-f[2])*d}}}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],f,e,g,h,i,l;f=(a.length-1)*b;e=Math.floor(f);f=f-e;c[0]=e===0?e:e-1;c[1]=e;c[2]=e>a.length-2?e:e+1;c[3]=e>a.length-3?e:e+2;e=a[c[0]];h=a[c[1]];i=a[c[2]];l=a[c[3]];c=f*f;g=f*c;d[0]=this.interpolate(e[0],h[0],i[0],l[0],f,c,g);d[1]=this.interpolate(e[1],h[1],i[1],l[1],f,c,g);d[2]=this.interpolate(e[2],h[2],i[2],l[2],f,c,g);return d};
 THREE.Animation.prototype.interpolate=function(a,b,c,d,f,e,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*e+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
@@ -601,8 +602,8 @@ THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.is
 f.skinMatrix:f.matrix}f=this.data.hierarchy[c].keys;if(f.length){e.animationCache.prevKey=f[0];e.animationCache.nextKey=f[1];this.startTime=Math.min(f[0].time,this.startTime);this.endTime=Math.max(f[f.length-1].time,this.endTime)}}this.update(0)}this.isPaused=false;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=false;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(c.animationCache!==void 0){var d=c.animationCache.originalMatrix;if(b instanceof THREE.Bone){d.copy(b.skinMatrix);b.skinMatrix=d}else{d.copy(b.matrix);b.matrix=d}delete c.animationCache}}};
 THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,f,e=this.data.JIT.hierarchy,g,h,i;h=this.currentTime=this.currentTime+a*this.timeScale;g=this.currentTime=this.currentTime%this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;f=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,l=this.hierarchy.length;a<l;a++){var j=this.data.hierarchy[a].keys,e=this.data.hierarchy[a].sids;d=j.length-1;f=
-this.hierarchy[a];if(j.length){for(j=0;j<e.length;j++){g=e[j];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();f.matrixWorldNeedsUpdate=true}}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 j=b.keys,n=b.animationCache;if(this.JITCompile&&e[a][f]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=e[a][f];d.matrixWorldNeedsUpdate=false}else{d.matrix=e[a][f];d.matrixWorldNeedsUpdate=
-true}else if(j.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=j[0];for(c=j[1];c.time<g;){b=c;c=j[b.index+1]}}else if(!i)for(var m=j.length-1;c.time<g&&c.index!==m;){b=c;c=j[b.index+1]}n.prevKey=b;n.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&e[0][f]===void 0){this.hierarchy[0].updateMatrixWorld(true);
+this.hierarchy[a];if(j.length){for(j=0;j<e.length;j++){g=e[j];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();f.matrixWorldNeedsUpdate=true}}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 j=b.keys,o=b.animationCache;if(this.JITCompile&&e[a][f]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=e[a][f];d.matrixWorldNeedsUpdate=false}else{d.matrix=e[a][f];d.matrixWorldNeedsUpdate=
+true}else if(j.length){if(this.JITCompile&&o)d instanceof THREE.Bone?d.skinMatrix=o.originalMatrix:d.matrix=o.originalMatrix;b=o.prevKey;c=o.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=j[0];for(c=j[1];c.time<g;){b=c;c=j[b.index+1]}}else if(!i)for(var m=j.length-1;c.time<g&&c.index!==m;){b=c;c=j[b.index+1]}o.prevKey=b;o.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&e[0][f]===void 0){this.hierarchy[0].updateMatrixWorld(true);
 for(a=0;a<this.hierarchy.length;a++)e[a][f]=this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=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=c>=0?c:c+b.length;c>=0;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
 THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,-1,0);f.lookAt(new THREE.Vector3(-1,0,0));this.add(f);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,0,1);e.lookAt(new THREE.Vector3(0,1,0));this.add(e);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
@@ -623,14 +624,14 @@ this.object.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.object
 this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon=this.lon+this.mouseX*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*a*b;this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,
 0,Math.PI,this.verticalMin,this.verticalMax);b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(b)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),false);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),false);this.domElement.addEventListener("mouseup",
 c(this,this.onMouseUp),false);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),false);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),false);this.handleResize()};
-THREE.PathControls=function(a,b){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),s=g.length,r=0;f=s-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<s-1;f++){r=d*h.chunks[f]/h.total;b.keys[f]={time:r,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
+THREE.PathControls=function(a,b){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),t=g.length,s=0;f=t-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<t-1;f++){s=d*h.chunks[f]/h.total;b.keys[f]={time:s,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
 return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}function e(a,b){var c,d,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++){d=c/(a.points.length*b);d=a.getPoint(d);f.vertices[c]=new THREE.Vector3(d.x,d.y,d.z)}return f}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;
 this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=true;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;var g=Math.PI*2,h=Math.PI/180;this.viewHalfY=this.viewHalfX=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleResize=function(){if(this.domElement===
 document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=this.domElement.offsetHeight/2}};this.update=function(a){var b;if(this.lookHorizontal)this.lon=this.lon+this.mouseX*this.lookSpeed*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*this.lookSpeed*a;this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%g;this.phi=
 a>=0?a:a+g;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};
 this.onMouseMove=function(a){if(this.domElement===document){this.mouseX=a.pageX-this.viewHalfX;this.mouseY=a.pageY-this.viewHalfY}else{this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX;this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY}};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),
 b=new THREE.MeshLambertMaterial({color:65280}),c=new THREE.CubeGeometry(10,10,20),g=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(g,b);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else{this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.target);this.animationParent.add(this.object)}if(this.createDebugPath){var a=
-this.debugPath,b=this.spline,g=e(b,10),c=e(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),g=new THREE.Line(g,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));g.scale.set(1,1,1);a.add(g);c.scale.set(1,1,1);a.add(c);for(var g=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),q=0;q<b.points.length;q++){c=new THREE.Mesh(g,h);c.position.copy(b.points[q]);a.add(c)}}this.domElement.addEventListener("mousemove",d(this,
+this.debugPath,b=this.spline,g=e(b,10),c=e(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),g=new THREE.Line(g,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));g.scale.set(1,1,1);a.add(g);c.scale.set(1,1,1);a.add(c);for(var g=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),p=0;p<b.points.length;p++){c=new THREE.Mesh(g,h);c.position.copy(b.points[p]);a.add(c)}}this.domElement.addEventListener("mousemove",d(this,
 this.onMouseMove),false)};this.handleResize()};THREE.PathControlsIdCounter=0;
 THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=false;this.object.useQuaternion=true;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=
 new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=
@@ -641,56 +642,56 @@ false;break;case 2:this.moveBackward=false}this.updateRotationVector()};this.upd
 this.object.matrixWorldNeedsUpdate=true};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),false);this.domElement.addEventListener("mousedown",c(this,this.mousedown),false);this.domElement.addEventListener("mouseup",
 c(this,this.mouseup),false);this.domElement.addEventListener("keydown",c(this,this.keydown),false);this.domElement.addEventListener("keyup",c(this,this.keyup),false);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,f=new THREE.Vector3,e=new THREE.Matrix4,g=false,h=1,i=0,l=0,j=0,n=0,m=0,q=0,o=0;this.handleResize=function(){q=window.innerWidth/2;o=window.innerHeight/2};this.update=
-function(a){if(this.mouseLook){var b=a*this.lookSpeed;this.rotateHorizontally(b*n);this.rotateVertically(b*m)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*l);this.object.translateY(b*j);if(g)this.roll=this.roll+this.rollSpeed*a*h;if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}f.copy(this.forward);
+THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=false;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,f=new THREE.Vector3,e=new THREE.Matrix4,g=false,h=1,i=0,l=0,j=0,o=0,m=0,p=0,q=0;this.handleResize=function(){p=window.innerWidth/2;q=window.innerHeight/2};this.update=
+function(a){if(this.mouseLook){var b=a*this.lookSpeed;this.rotateHorizontally(b*o);this.rotateVertically(b*m)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*l);this.object.translateY(b*j);if(g)this.roll=this.roll+this.rollSpeed*a*h;if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}f.copy(this.forward);
 d.set(0,1,0);c.cross(d,f).normalize();d.cross(f,c).normalize();this.object.matrix.elements[0]=c.x;this.object.matrix.elements[4]=d.x;this.object.matrix.elements[8]=f.x;this.object.matrix.elements[1]=c.y;this.object.matrix.elements[5]=d.y;this.object.matrix.elements[9]=f.y;this.object.matrix.elements[2]=c.z;this.object.matrix.elements[6]=d.z;this.object.matrix.elements[10]=f.z;e.identity();e.elements[0]=Math.cos(this.roll);e.elements[4]=-Math.sin(this.roll);e.elements[1]=Math.sin(this.roll);e.elements[5]=
 Math.cos(this.roll);this.object.matrix.multiplySelf(e);this.object.matrixWorldNeedsUpdate=true;this.object.matrix.elements[12]=this.object.position.x;this.object.matrix.elements[13]=this.object.position.y;this.object.matrix.elements[14]=this.object.position.z};this.translateX=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[0]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[1]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[2]*
 a};this.translateY=function(a){this.object.position.x=this.object.position.x+this.object.matrix.elements[4]*a;this.object.position.y=this.object.position.y+this.object.matrix.elements[5]*a;this.object.position.z=this.object.position.z+this.object.matrix.elements[6]*a};this.translateZ=function(a){this.object.position.x=this.object.position.x-this.object.matrix.elements[8]*a;this.object.position.y=this.object.position.y-this.object.matrix.elements[9]*a;this.object.position.z=this.object.position.z-
 this.object.matrix.elements[10]*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.elements[0],this.object.matrix.elements[1],this.object.matrix.elements[2]);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.elements[4],this.object.matrix.elements[5],this.object.matrix.elements[6]);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},
-false);this.domElement.addEventListener("mousemove",function(a){n=(a.clientX-q)/window.innerWidth;m=(a.clientY-o)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},false);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:i=
+false);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-p)/window.innerWidth;m=(a.clientY-q)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},false);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},false);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=true;h=1;break;case 69:g=true;h=-1;break;case 82:j=1;break;case 70:j=-1}},false);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=false;break;case 69:g=false;break;case 82:j=0;break;case 70:j=0}},false);this.handleResize()};
 THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=b!==void 0?b:document;this.enabled=true;this.screen={width:0,height:0,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=false;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3;var d=
-new THREE.Vector3,f=false,e=-1,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector2,j=new THREE.Vector2,n=new THREE.Vector2,m=new THREE.Vector2,q={type:"change"};this.handleResize=function(){this.screen.width=window.innerWidth;this.screen.height=window.innerHeight;this.screen.offsetLeft=0;this.screen.offsetTop=0;this.radius=(this.screen.width+this.screen.height)/4};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,
+new THREE.Vector3,f=false,e=-1,g=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector2,j=new THREE.Vector2,o=new THREE.Vector2,m=new THREE.Vector2,p={type:"change"};this.handleResize=function(){this.screen.width=window.innerWidth;this.screen.height=window.innerHeight;this.screen.offsetLeft=0;this.screen.offsetTop=0;this.radius=(this.screen.width+this.screen.height)/4};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,
 b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*0.5-c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);g.copy(c.object.position).subSelf(c.target);e=c.object.up.clone().setLength(d.y);e.addSelf(c.object.up.clone().crossSelf(g).setLength(d.x));e.addSelf(g.setLength(d.z));return e};
 this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion,a=a*c.rotateSpeed;d.setFromAxisAngle(b,-a);d.multiplyVector3(g);d.multiplyVector3(c.object.up);d.multiplyVector3(i);if(c.staticMoving)h=i;else{d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1));d.multiplyVector3(h)}}};this.zoomCamera=function(){var a=1+(j.y-l.y)*c.zoomSpeed;if(a!==1&&a>0){g.multiplyScalar(a);c.staticMoving?l=j:l.y=l.y+(j.y-l.y)*
-this.dynamicDampingFactor}};this.panCamera=function(){var a=m.clone().subSelf(n);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?n=m:n.addSelf(a.sub(m,n).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan){c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance);
-g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))}};this.update=function(){g.copy(c.object.position).subSelf(c.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);if(d.distanceToSquared(c.object.position)>0){c.dispatchEvent(q);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);
-this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(f){h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY);l=j=c.getMouseOnScreen(a.clientX,a.clientY);n=m=c.getMouseOnScreen(a.clientX,a.clientY);f=false}e!==-1&&(e===0&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):e===1&&!c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):e===2&&!c.noPan&&(m=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();
-a.stopPropagation();if(e===-1){e=a.button;e===0&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):e===1&&!c.noZoom?l=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(n=m=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();e=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&e===-1){a.keyCode===c.keys[0]&&!c.noRotate?e=0:a.keyCode===c.keys[1]&&!c.noZoom?
+this.dynamicDampingFactor}};this.panCamera=function(){var a=m.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(g.length()*c.panSpeed);var b=g.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=m:o.addSelf(a.sub(m,o).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan){c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance);
+g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLength(c.minDistance))}};this.update=function(){g.copy(c.object.position).subSelf(c.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();c.noPan||c.panCamera();c.object.position.add(c.target,g);c.checkDistances();c.object.lookAt(c.target);if(d.distanceToSquared(c.object.position)>0){c.dispatchEvent(p);d.copy(c.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);
+this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(f){h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY);l=j=c.getMouseOnScreen(a.clientX,a.clientY);o=m=c.getMouseOnScreen(a.clientX,a.clientY);f=false}e!==-1&&(e===0&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):e===1&&!c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):e===2&&!c.noPan&&(m=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();
+a.stopPropagation();if(e===-1){e=a.button;e===0&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):e===1&&!c.noZoom?l=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=m=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();e=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&e===-1){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);e!==-1&&(f=true)}},false);window.addEventListener("keyup",function(){c.enabled&&e!==-1&&(e=-1)},false);this.handleResize()};
-THREE.OrbitControls=function(a,b){function c(){return 2*Math.PI/60/60*e.autoRotateSpeed}function d(a){a.preventDefault();if(u===r.ROTATE){i.set(a.clientX,a.clientY);l.sub(i,h);e.rotateLeft(2*Math.PI*l.x/g*e.userRotateSpeed);e.rotateUp(2*Math.PI*l.y/g*e.userRotateSpeed);h.copy(i)}else if(u===r.ZOOM){n.set(a.clientX,a.clientY);m.sub(n,j);m.y>0?e.zoomIn():e.zoomOut();j.copy(n)}}function f(){if(e.userRotate){document.removeEventListener("mousemove",d,false);document.removeEventListener("mouseup",f,false);
-u=r.NONE}}THREE.EventTarget.call(this);this.object=a;this.domElement=b!==void 0?b:document;this.center=new THREE.Vector3;this.userZoom=true;this.userZoomSpeed=1;this.userRotate=true;this.userRotateSpeed=1;this.autoRotate=false;this.autoRotateSpeed=2;var e=this,g=1800,h=new THREE.Vector2,i=new THREE.Vector2,l=new THREE.Vector2,j=new THREE.Vector2,n=new THREE.Vector2,m=new THREE.Vector2,q=0,o=0,p=1,s=new THREE.Vector3,r={NONE:-1,ROTATE:0,ZOOM:1},u=r.NONE,v={type:"change"};this.rotateLeft=function(a){a===
-void 0&&(a=c());o=o-a};this.rotateRight=function(a){a===void 0&&(a=c());o=o+a};this.rotateUp=function(a){a===void 0&&(a=c());q=q-a};this.rotateDown=function(a){a===void 0&&(a=c());q=q+a};this.zoomIn=function(a){a===void 0&&(a=Math.pow(0.95,e.userZoomSpeed));p=p/a};this.zoomOut=function(a){a===void 0&&(a=Math.pow(0.95,e.userZoomSpeed));p=p*a};this.update=function(){var a=this.object.position,b=a.clone().subSelf(this.center),d=Math.atan2(b.x,b.z),e=Math.atan2(Math.sqrt(b.x*b.x+b.z*b.z),b.y);this.autoRotate&&
-this.rotateLeft(c());var d=d+o,e=e+q,e=Math.max(1E-6,Math.min(Math.PI-1E-6,e)),f=b.length();b.x=f*Math.sin(e)*Math.sin(d);b.y=f*Math.cos(e);b.z=f*Math.sin(e)*Math.cos(d);b.multiplyScalar(p);a.copy(this.center).addSelf(b);this.object.lookAt(this.center);q=o=0;p=1;if(s.distanceTo(this.object.position)>0){this.dispatchEvent(v);s.copy(this.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousedown",function(a){if(e.userRotate){a.preventDefault();
-if(a.button===0||a.button===2){u=r.ROTATE;h.set(a.clientX,a.clientY)}else if(a.button===1){u=r.ZOOM;j.set(a.clientX,a.clientY)}document.addEventListener("mousemove",d,false);document.addEventListener("mouseup",f,false)}},false);this.domElement.addEventListener("mousewheel",function(a){e.userZoom&&(a.wheelDelta>0?e.zoomOut():e.zoomIn())},false)};
+THREE.OrbitControls=function(a,b){function c(){return 2*Math.PI/60/60*e.autoRotateSpeed}function d(a){a.preventDefault();if(u===s.ROTATE){i.set(a.clientX,a.clientY);l.sub(i,h);e.rotateLeft(2*Math.PI*l.x/g*e.userRotateSpeed);e.rotateUp(2*Math.PI*l.y/g*e.userRotateSpeed);h.copy(i)}else if(u===s.ZOOM){o.set(a.clientX,a.clientY);m.sub(o,j);m.y>0?e.zoomIn():e.zoomOut();j.copy(o)}}function f(){if(e.userRotate){document.removeEventListener("mousemove",d,false);document.removeEventListener("mouseup",f,false);
+u=s.NONE}}THREE.EventTarget.call(this);this.object=a;this.domElement=b!==void 0?b:document;this.center=new THREE.Vector3;this.userZoom=true;this.userZoomSpeed=1;this.userRotate=true;this.userRotateSpeed=1;this.autoRotate=false;this.autoRotateSpeed=2;var e=this,g=1800,h=new THREE.Vector2,i=new THREE.Vector2,l=new THREE.Vector2,j=new THREE.Vector2,o=new THREE.Vector2,m=new THREE.Vector2,p=0,q=0,n=1,t=new THREE.Vector3,s={NONE:-1,ROTATE:0,ZOOM:1},u=s.NONE,v={type:"change"};this.rotateLeft=function(a){a===
+void 0&&(a=c());q=q-a};this.rotateRight=function(a){a===void 0&&(a=c());q=q+a};this.rotateUp=function(a){a===void 0&&(a=c());p=p-a};this.rotateDown=function(a){a===void 0&&(a=c());p=p+a};this.zoomIn=function(a){a===void 0&&(a=Math.pow(0.95,e.userZoomSpeed));n=n/a};this.zoomOut=function(a){a===void 0&&(a=Math.pow(0.95,e.userZoomSpeed));n=n*a};this.update=function(){var a=this.object.position,b=a.clone().subSelf(this.center),d=Math.atan2(b.x,b.z),e=Math.atan2(Math.sqrt(b.x*b.x+b.z*b.z),b.y);this.autoRotate&&
+this.rotateLeft(c());var d=d+q,e=e+p,e=Math.max(1E-6,Math.min(Math.PI-1E-6,e)),f=b.length();b.x=f*Math.sin(e)*Math.sin(d);b.y=f*Math.cos(e);b.z=f*Math.sin(e)*Math.cos(d);b.multiplyScalar(n);a.copy(this.center).addSelf(b);this.object.lookAt(this.center);p=q=0;n=1;if(t.distanceTo(this.object.position)>0){this.dispatchEvent(v);t.copy(this.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousedown",function(a){if(e.userRotate){a.preventDefault();
+if(a.button===0||a.button===2){u=s.ROTATE;h.set(a.clientX,a.clientY)}else if(a.button===1){u=s.ZOOM;j.set(a.clientX,a.clientY)}document.addEventListener("mousemove",d,false);document.addEventListener("mouseup",f,false)}},false);this.domElement.addEventListener("mousewheel",function(a){e.userZoom&&(a.wheelDelta>0?e.zoomOut():e.zoomIn())},false)};
 THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=c!==void 0?c:0,d=d!==void 0?d:Math.PI*2,b=b!==void 0?Math.max(3,b):8,f,e=[];f=new THREE.Vector3;var g=new THREE.UV(0.5,0.5);this.vertices.push(f);e.push(g);for(f=0;f<=b;f++){var h=new THREE.Vector3;h.x=a*Math.cos(c+f/b*d);h.y=a*Math.sin(c+f/b*d);this.vertices.push(h);e.push(new THREE.UV((h.x/a+1)/2,-(h.y/a+1)/2+1))}c=new THREE.Vector3(0,0,-1);for(f=1;f<=b;f++){this.faces.push(new THREE.Face3(f,f+1,0,[c,c,c]));this.faceVertexUvs[0].push([e[f],
 e[f+1],g])}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.CubeGeometry=function(a,b,c,d,f,e,g,h){function i(a,b,c,g,h,i,j,m){var n,o=d||1,p=f||1,q=h/2,r=i/2,s=l.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){n="y";p=e||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";o=e||1}var u=o+1,v=p+1,N=h/o,Y=i/p,K=new THREE.Vector3;K[n]=j>0?1:-1;for(h=0;h<v;h++)for(i=0;i<u;i++){var fa=new THREE.Vector3;fa[a]=(i*N-q)*c;fa[b]=(h*Y-r)*g;fa[n]=j;l.vertices.push(fa)}for(h=0;h<p;h++)for(i=0;i<o;i++){a=new THREE.Face4(i+
-u*h+s,i+u*(h+1)+s,i+1+u*(h+1)+s,i+1+u*h+s);a.normal.copy(K);a.vertexNormals.push(K.clone(),K.clone(),K.clone(),K.clone());a.materialIndex=m;l.faces.push(a);l.faceVertexUvs[0].push([new THREE.UV(i/o,1-h/p),new THREE.UV(i/o,1-(h+1)/p),new THREE.UV((i+1)/o,1-(h+1)/p),new THREE.UV((i+1)/o,1-h/p)])}}THREE.Geometry.call(this);var l=this,j=a/2,n=b/2,m=c/2,q,o,p,s,r,u;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(q=0;q<6;q++)this.materials.push(g)}q=0;s=1;o=2;r=3;p=4;u=
-5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var v in h)this.sides[v]!==void 0&&(this.sides[v]=h[v]);this.sides.px&&i("z","y",-1,-1,c,b,j,q);this.sides.nx&&i("z","y",1,-1,c,b,-j,s);this.sides.py&&i("x","z",1,1,a,c,n,o);this.sides.ny&&i("x","z",1,-1,a,c,-n,r);this.sides.pz&&i("x","y",1,-1,a,b,m,p);this.sides.nz&&i("x","y",-1,-1,a,b,-m,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.CylinderGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,f=f||1,h,i,l=[],j=[];for(i=0;i<=f;i++){var n=[],m=[],q=i/f,o=q*(b-a)+a;for(h=0;h<=d;h++){var p=h/d,s=new THREE.Vector3;s.x=o*Math.sin(p*Math.PI*2);s.y=-q*c+g;s.z=o*Math.cos(p*Math.PI*2);this.vertices.push(s);n.push(this.vertices.length-1);m.push(new THREE.UV(p,1-q))}l.push(n);j.push(m)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){n=this.vertices[l[0][h]].clone();m=
-this.vertices[l[0][h+1]].clone()}else{n=this.vertices[l[1][h]].clone();m=this.vertices[l[1][h+1]].clone()}n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(i=0;i<f;i++){var q=l[i][h],o=l[i+1][h],p=l[i+1][h+1],s=l[i][h+1],r=n.clone(),u=n.clone(),v=m.clone(),t=m.clone(),A=j[i][h].clone(),y=j[i+1][h].clone(),B=j[i+1][h+1].clone(),G=j[i][h+1].clone();this.faces.push(new THREE.Face4(q,o,p,s,[r,u,v,t]));this.faceVertexUvs[0].push([A,y,B,G])}}if(!e&&a>
-0){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++){q=l[0][h];o=l[0][h+1];p=this.vertices.length-1;r=new THREE.Vector3(0,1,0);u=new THREE.Vector3(0,1,0);v=new THREE.Vector3(0,1,0);A=j[0][h].clone();y=j[0][h+1].clone();B=new THREE.UV(y.u,0);this.faces.push(new THREE.Face3(q,o,p,[r,u,v]));this.faceVertexUvs[0].push([A,y,B])}}if(!e&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){q=l[i][h+1];o=l[i][h];p=this.vertices.length-1;r=new THREE.Vector3(0,-1,0);u=new THREE.Vector3(0,
--1,0);v=new THREE.Vector3(0,-1,0);A=j[i][h+1].clone();y=j[i][h].clone();B=new THREE.UV(y.u,1);this.faces.push(new THREE.Face3(q,o,p,[r,u,v]));this.faceVertexUvs[0].push([A,y,B])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.CubeGeometry=function(a,b,c,d,f,e,g,h){function i(a,b,c,g,h,i,j,m){var o,n=d||1,p=f||1,q=h/2,s=i/2,t=l.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")o="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){o="y";p=e||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){o="x";n=e||1}var u=n+1,v=p+1,aa=h/n,Z=i/p,J=new THREE.Vector3;J[o]=j>0?1:-1;for(h=0;h<v;h++)for(i=0;i<u;i++){var ca=new THREE.Vector3;ca[a]=(i*aa-q)*c;ca[b]=(h*Z-s)*g;ca[o]=j;l.vertices.push(ca)}for(h=0;h<p;h++)for(i=0;i<n;i++){a=new THREE.Face4(i+
+u*h+t,i+u*(h+1)+t,i+1+u*(h+1)+t,i+1+u*h+t);a.normal.copy(J);a.vertexNormals.push(J.clone(),J.clone(),J.clone(),J.clone());a.materialIndex=m;l.faces.push(a);l.faceVertexUvs[0].push([new THREE.UV(i/n,1-h/p),new THREE.UV(i/n,1-(h+1)/p),new THREE.UV((i+1)/n,1-(h+1)/p),new THREE.UV((i+1)/n,1-h/p)])}}THREE.Geometry.call(this);var l=this,j=a/2,o=b/2,m=c/2,p,q,n,t,s,u;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(g)}p=0;t=1;q=2;s=3;n=4;u=
+5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var v in h)this.sides[v]!==void 0&&(this.sides[v]=h[v]);this.sides.px&&i("z","y",-1,-1,c,b,j,p);this.sides.nx&&i("z","y",1,-1,c,b,-j,t);this.sides.py&&i("x","z",1,1,a,c,o,q);this.sides.ny&&i("x","z",1,-1,a,c,-o,s);this.sides.pz&&i("x","y",1,-1,a,b,m,n);this.sides.nz&&i("x","y",-1,-1,a,b,-m,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.CylinderGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,f=f||1,h,i,l=[],j=[];for(i=0;i<=f;i++){var o=[],m=[],p=i/f,q=p*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,t=new THREE.Vector3;t.x=q*Math.sin(n*Math.PI*2);t.y=-p*c+g;t.z=q*Math.cos(n*Math.PI*2);this.vertices.push(t);o.push(this.vertices.length-1);m.push(new THREE.UV(n,1-p))}l.push(o);j.push(m)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){o=this.vertices[l[0][h]].clone();m=
+this.vertices[l[0][h+1]].clone()}else{o=this.vertices[l[1][h]].clone();m=this.vertices[l[1][h+1]].clone()}o.setY(Math.sqrt(o.x*o.x+o.z*o.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(i=0;i<f;i++){var p=l[i][h],q=l[i+1][h],n=l[i+1][h+1],t=l[i][h+1],s=o.clone(),u=o.clone(),v=m.clone(),r=m.clone(),A=j[i][h].clone(),x=j[i+1][h].clone(),B=j[i+1][h+1].clone(),C=j[i][h+1].clone();this.faces.push(new THREE.Face4(p,q,n,t,[s,u,v,r]));this.faceVertexUvs[0].push([A,x,B,C])}}if(!e&&a>
+0){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++){p=l[0][h];q=l[0][h+1];n=this.vertices.length-1;s=new THREE.Vector3(0,1,0);u=new THREE.Vector3(0,1,0);v=new THREE.Vector3(0,1,0);A=j[0][h].clone();x=j[0][h+1].clone();B=new THREE.UV(x.u,0);this.faces.push(new THREE.Face3(p,q,n,[s,u,v]));this.faceVertexUvs[0].push([A,x,B])}}if(!e&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){p=l[i][h+1];q=l[i][h];n=this.vertices.length-1;s=new THREE.Vector3(0,-1,0);u=new THREE.Vector3(0,
+-1,0);v=new THREE.Vector3(0,-1,0);A=j[i][h+1].clone();x=j[i][h].clone();B=new THREE.UV(x.u,1);this.faces.push(new THREE.Face3(p,q,n,[s,u,v]));this.faceVertexUvs[0].push([A,x,B])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);a=a instanceof Array?a:[a];this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
-h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){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=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function f(c,d){var e,f;for(K=c.length;--K>=0;){e=K;f=K-1;f<0&&(f=
-c.length-1);for(var g=0,h=m+j*2,g=0;g<h;g++){var i=J*g,l=J*(g+1),n=d+e+i,i=d+f+i,o=d+f+l,l=d+e+l,p=c,q=g,s=h,t=e,v=f,n=n+F,i=i+F,o=o+F,l=l+F;I.faces.push(new THREE.Face4(n,i,o,l,null,null,r));n=u.generateSideWallUV(I,a,p,b,n,i,o,l,q,s,t,v);I.faceVertexUvs[0].push(n)}}}function e(a,b,c){I.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+F;d=d+F;e=e+F;I.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?u.generateBottomUV(I,a,b,c,d,e):u.generateTopUV(I,a,b,c,d,e);I.faceVertexUvs[0].push(c)}
-var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,l=b.bevelSize!==void 0?b.bevelSize:i-2,j=b.bevelSegments!==void 0?b.bevelSegments:3,n=b.bevelEnabled!==void 0?b.bevelEnabled:true,m=b.steps!==void 0?b.steps:1,q=b.extrudePath,o,p=false,s=b.material,r=b.extrudeMaterial,u=b.UVGenerator!==void 0?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,v,t,A,y;if(q){o=q.getSpacedPoints(m);p=true;n=false;v=b.frames!==void 0?b.frames:new THREE.TubeGeometry.FrenetFrames(q,m,
-false);t=new THREE.Vector3;A=new THREE.Vector3;y=new THREE.Vector3}if(!n)l=i=j=0;var B,G,x,I=this,F=this.vertices.length,q=a.extractPoints(),L=q.shape,q=q.holes,E=!THREE.Shape.Utils.isClockWise(L);if(E){L=L.reverse();G=0;for(x=q.length;G<x;G++){B=q[G];THREE.Shape.Utils.isClockWise(B)&&(q[G]=B.reverse())}E=false}var P=THREE.Shape.Utils.triangulateShape(L,q),E=L;G=0;for(x=q.length;G<x;G++){B=q[G];L=L.concat(B)}var H,D,S,R,J=L.length,N=P.length,Y=[],K=0,fa=E.length;H=fa-1;for(D=K+1;K<fa;K++,H++,D++){H===
-fa&&(H=0);D===fa&&(D=0);Y[K]=d(E[K],E[H],E[D])}var O=[],ra,va=Y.concat();G=0;for(x=q.length;G<x;G++){B=q[G];ra=[];K=0;fa=B.length;H=fa-1;for(D=K+1;K<fa;K++,H++,D++){H===fa&&(H=0);D===fa&&(D=0);ra[K]=d(B[K],B[H],B[D])}O.push(ra);va=va.concat(ra)}for(H=0;H<j;H++){B=H/j;S=i*(1-B);D=l*Math.sin(B*Math.PI/2);K=0;for(fa=E.length;K<fa;K++){R=c(E[K],Y[K],D);e(R.x,R.y,-S)}G=0;for(x=q.length;G<x;G++){B=q[G];ra=O[G];K=0;for(fa=B.length;K<fa;K++){R=c(B[K],ra[K],D);e(R.x,R.y,-S)}}}D=l;for(K=0;K<J;K++){R=n?c(L[K],
-va[K],D):L[K];if(p){A.copy(v.normals[0]).multiplyScalar(R.x);t.copy(v.binormals[0]).multiplyScalar(R.y);y.copy(o[0]).addSelf(A).addSelf(t);e(y.x,y.y,y.z)}else e(R.x,R.y,0)}for(B=1;B<=m;B++)for(K=0;K<J;K++){R=n?c(L[K],va[K],D):L[K];if(p){A.copy(v.normals[B]).multiplyScalar(R.x);t.copy(v.binormals[B]).multiplyScalar(R.y);y.copy(o[B]).addSelf(A).addSelf(t);e(y.x,y.y,y.z)}else e(R.x,R.y,h/m*B)}for(H=j-1;H>=0;H--){B=H/j;S=i*(1-B);D=l*Math.sin(B*Math.PI/2);K=0;for(fa=E.length;K<fa;K++){R=c(E[K],Y[K],D);
-e(R.x,R.y,h+S)}G=0;for(x=q.length;G<x;G++){B=q[G];ra=O[G];K=0;for(fa=B.length;K<fa;K++){R=c(B[K],ra[K],D);p?e(R.x,R.y+o[m-1].y,o[m-1].x+S):e(R.x,R.y,h+S)}}}if(n){i=J*0;for(K=0;K<N;K++){h=P[K];g(h[2]+i,h[1]+i,h[0]+i,true)}i=J*(m+j*2);for(K=0;K<N;K++){h=P[K];g(h[0]+i,h[1]+i,h[2]+i,false)}}else{for(K=0;K<N;K++){h=P[K];g(h[2],h[1],h[0],true)}for(K=0;K<N;K++){h=P[K];g(h[0]+J*m,h[1]+J*m,h[2]+J*m,false)}}h=0;f(E,h);h=h+E.length;G=0;for(x=q.length;G<x;G++){B=q[G];f(B,h);h=h+B.length}};
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){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=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function f(c,d){var e,f;for(J=c.length;--J>=0;){e=J;f=J-1;f<0&&(f=
+c.length-1);for(var g=0,h=m+j*2,g=0;g<h;g++){var i=L*g,l=L*(g+1),o=d+e+i,i=d+f+i,n=d+f+l,l=d+e+l,p=c,q=g,t=h,r=e,v=f,o=o+G,i=i+G,n=n+G,l=l+G;F.faces.push(new THREE.Face4(o,i,n,l,null,null,s));o=u.generateSideWallUV(F,a,p,b,o,i,n,l,q,t,r,v);F.faceVertexUvs[0].push(o)}}}function e(a,b,c){F.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+G;d=d+G;e=e+G;F.faces.push(new THREE.Face3(c,d,e,null,null,t));c=f?u.generateBottomUV(F,a,b,c,d,e):u.generateTopUV(F,a,b,c,d,e);F.faceVertexUvs[0].push(c)}
+var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,l=b.bevelSize!==void 0?b.bevelSize:i-2,j=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:true,m=b.steps!==void 0?b.steps:1,p=b.extrudePath,q,n=false,t=b.material,s=b.extrudeMaterial,u=b.UVGenerator!==void 0?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,v,r,A,x;if(p){q=p.getSpacedPoints(m);n=true;o=false;v=b.frames!==void 0?b.frames:new THREE.TubeGeometry.FrenetFrames(p,m,
+false);r=new THREE.Vector3;A=new THREE.Vector3;x=new THREE.Vector3}if(!o)l=i=j=0;var B,C,z,F=this,G=this.vertices.length,p=a.extractPoints(),M=p.shape,p=p.holes,E=!THREE.Shape.Utils.isClockWise(M);if(E){M=M.reverse();C=0;for(z=p.length;C<z;C++){B=p[C];THREE.Shape.Utils.isClockWise(B)&&(p[C]=B.reverse())}E=false}var N=THREE.Shape.Utils.triangulateShape(M,p),E=M;C=0;for(z=p.length;C<z;C++){B=p[C];M=M.concat(B)}var I,K,Q,H,L=M.length,aa=N.length,Z=[],J=0,ca=E.length;I=ca-1;for(K=J+1;J<ca;J++,I++,K++){I===
+ca&&(I=0);K===ca&&(K=0);Z[J]=d(E[J],E[I],E[K])}var O=[],ra,va=Z.concat();C=0;for(z=p.length;C<z;C++){B=p[C];ra=[];J=0;ca=B.length;I=ca-1;for(K=J+1;J<ca;J++,I++,K++){I===ca&&(I=0);K===ca&&(K=0);ra[J]=d(B[J],B[I],B[K])}O.push(ra);va=va.concat(ra)}for(I=0;I<j;I++){B=I/j;Q=i*(1-B);K=l*Math.sin(B*Math.PI/2);J=0;for(ca=E.length;J<ca;J++){H=c(E[J],Z[J],K);e(H.x,H.y,-Q)}C=0;for(z=p.length;C<z;C++){B=p[C];ra=O[C];J=0;for(ca=B.length;J<ca;J++){H=c(B[J],ra[J],K);e(H.x,H.y,-Q)}}}K=l;for(J=0;J<L;J++){H=o?c(M[J],
+va[J],K):M[J];if(n){A.copy(v.normals[0]).multiplyScalar(H.x);r.copy(v.binormals[0]).multiplyScalar(H.y);x.copy(q[0]).addSelf(A).addSelf(r);e(x.x,x.y,x.z)}else e(H.x,H.y,0)}for(B=1;B<=m;B++)for(J=0;J<L;J++){H=o?c(M[J],va[J],K):M[J];if(n){A.copy(v.normals[B]).multiplyScalar(H.x);r.copy(v.binormals[B]).multiplyScalar(H.y);x.copy(q[B]).addSelf(A).addSelf(r);e(x.x,x.y,x.z)}else e(H.x,H.y,h/m*B)}for(I=j-1;I>=0;I--){B=I/j;Q=i*(1-B);K=l*Math.sin(B*Math.PI/2);J=0;for(ca=E.length;J<ca;J++){H=c(E[J],Z[J],K);
+e(H.x,H.y,h+Q)}C=0;for(z=p.length;C<z;C++){B=p[C];ra=O[C];J=0;for(ca=B.length;J<ca;J++){H=c(B[J],ra[J],K);n?e(H.x,H.y+q[m-1].y,q[m-1].x+Q):e(H.x,H.y,h+Q)}}}if(o){i=L*0;for(J=0;J<aa;J++){h=N[J];g(h[2]+i,h[1]+i,h[0]+i,true)}i=L*(m+j*2);for(J=0;J<aa;J++){h=N[J];g(h[0]+i,h[1]+i,h[2]+i,false)}}else{for(J=0;J<aa;J++){h=N[J];g(h[2],h[1],h[0],true)}for(J=0;J<aa;J++){h=N[J];g(h[0]+L*m,h[1]+L*m,h[2]+L*m,false)}}h=0;f(E,h);h=h+E.length;C=0;for(z=p.length;C<z;C++){B=p[C];f(B,h);h=h+B.length}};
 THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,f,e){b=a.vertices[f].x;f=a.vertices[f].y;c=a.vertices[e].x;e=a.vertices[e].y;return[new THREE.UV(a.vertices[d].x,a.vertices[d].y),new THREE.UV(b,f),new THREE.UV(c,e)]},generateBottomUV:function(a,b,c,d,f,e){return this.generateTopUV(a,b,c,d,f,e)},generateSideWallUV:function(a,b,c,d,f,e,g,h){var b=a.vertices[f].x,c=a.vertices[f].y,f=a.vertices[f].z,d=a.vertices[e].x,i=a.vertices[e].y,e=a.vertices[e].z,l=a.vertices[g].x,j=a.vertices[g].y,
-g=a.vertices[g].z,n=a.vertices[h].x,m=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-i)<0.01?[new THREE.UV(b,1-f),new THREE.UV(d,1-e),new THREE.UV(l,1-g),new THREE.UV(n,1-a)]:[new THREE.UV(c,1-f),new THREE.UV(i,1-e),new THREE.UV(j,1-g),new THREE.UV(m,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;
+g=a.vertices[g].z,o=a.vertices[h].x,m=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-i)<0.01?[new THREE.UV(b,1-f),new THREE.UV(d,1-e),new THREE.UV(l,1-g),new THREE.UV(o,1-a)]:[new THREE.UV(c,1-f),new THREE.UV(i,1-e),new THREE.UV(j,1-g),new THREE.UV(m,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);for(var b=b||12,c=c||2*Math.PI,d=[],f=(new THREE.Matrix4).makeRotationZ(c/b),e=0;e<a.length;e++){d[e]=a[e].clone();this.vertices.push(d[e])}for(var g=b+1,c=0;c<g;c++)for(e=0;e<d.length;e++){d[e]=f.multiplyVector3(d[e].clone());this.vertices.push(d[e])}for(c=0;c<b;c++){d=0;for(f=a.length;d<f-1;d++){this.faces.push(new THREE.Face4(c*f+d,(c+1)%g*f+d,(c+1)%g*f+(d+1)%f,c*f+(d+1)%f));this.faceVertexUvs[0].push([new THREE.UV(1-c/b,d/f),new THREE.UV(1-
 (c+1)/b,d/f),new THREE.UV(1-(c+1)/b,(d+1)/f),new THREE.UV(1-c/b,(d+1)/f)])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var f=a/2,e=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,l=b/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*i-f,-(a*l-e),0));for(a=0;a<d;a++)for(b=0;b<c;b++){f=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);f.normal.copy(j);f.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.clone());this.faces.push(f);this.faceVertexUvs[0].push([new THREE.UV(b/c,1-a/d),new THREE.UV(b/c,1-(a+1)/d),new THREE.UV((b+
 1)/c,1-(a+1)/d),new THREE.UV((b+1)/c,1-a/d)])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.SphereGeometry=function(a,b,c,d,f,e,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,f=f!==void 0?f:Math.PI*2,e=e!==void 0?e:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,l=[],j=[];for(i=0;i<=c;i++){var n=[],m=[];for(h=0;h<=b;h++){var q=h/b,o=i/c,p=new THREE.Vector3;p.x=-a*Math.cos(d+q*f)*Math.sin(e+o*g);p.y=a*Math.cos(e+o*g);p.z=a*Math.sin(d+q*f)*Math.sin(e+o*g);this.vertices.push(p);n.push(this.vertices.length-1);m.push(new THREE.UV(q,
-1-o))}l.push(n);j.push(m)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=l[i][h+1],f=l[i][h],e=l[i+1][h],g=l[i+1][h+1],n=this.vertices[d].clone().normalize(),m=this.vertices[f].clone().normalize(),q=this.vertices[e].clone().normalize(),o=this.vertices[g].clone().normalize(),p=j[i][h+1].clone(),s=j[i][h].clone(),r=j[i+1][h].clone(),u=j[i+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,e,g,[n,q,o]));this.faceVertexUvs[0].push([p,r,u])}else if(Math.abs(this.vertices[e].y)==
-a){this.faces.push(new THREE.Face3(d,f,e,[n,m,q]));this.faceVertexUvs[0].push([p,s,r])}else{this.faces.push(new THREE.Face4(d,f,e,g,[n,m,q,o]));this.faceVertexUvs[0].push([p,s,r,u])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.SphereGeometry=function(a,b,c,d,f,e,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,f=f!==void 0?f:Math.PI*2,e=e!==void 0?e:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,l=[],j=[];for(i=0;i<=c;i++){var o=[],m=[];for(h=0;h<=b;h++){var p=h/b,q=i/c,n=new THREE.Vector3;n.x=-a*Math.cos(d+p*f)*Math.sin(e+q*g);n.y=a*Math.cos(e+q*g);n.z=a*Math.sin(d+p*f)*Math.sin(e+q*g);this.vertices.push(n);o.push(this.vertices.length-1);m.push(new THREE.UV(p,
+1-q))}l.push(o);j.push(m)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=l[i][h+1],f=l[i][h],e=l[i+1][h],g=l[i+1][h+1],o=this.vertices[d].clone().normalize(),m=this.vertices[f].clone().normalize(),p=this.vertices[e].clone().normalize(),q=this.vertices[g].clone().normalize(),n=j[i][h+1].clone(),t=j[i][h].clone(),s=j[i+1][h].clone(),u=j[i+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,e,g,[o,p,q]));this.faceVertexUvs[0].push([n,s,u])}else if(Math.abs(this.vertices[e].y)==
+a){this.faces.push(new THREE.Face3(d,f,e,[o,m,p]));this.faceVertexUvs[0].push([n,t,s])}else{this.faces.push(new THREE.Face4(d,f,e,g,[o,m,p,q]));this.faceVertexUvs[0].push([n,t,s,u])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.TextGeometry=function(a,b){var c=THREE.FontUtils.generateShapes(a,b);b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=false;THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);
 THREE.TorusGeometry=function(a,b,c,d,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var e=d/this.segmentsT*this.arc,g=c/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(e);f.y=this.radius*Math.sin(e);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(e);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(e);h.z=
 this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.UV(d/this.segmentsT,c/this.segmentsR));b.push(h.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var f=(this.segmentsT+1)*c+d-1,e=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(f,e,g,h,[b[f],b[e],b[g],b[h]]);i.normal.addSelf(b[f]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);this.faceVertexUvs[0].push([a[f].clone(),
@@ -699,20 +700,20 @@ THREE.TorusKnotGeometry=function(a,b,c,d,f,e,g){function h(a,b,c,d,e,f){var g=Ma
 Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,e=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(i,e);d.add(i,e);f.cross(c,d);d.cross(f,c);f.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);e.x=e.x+(i*d.x+g*f.x);e.y=e.y+(i*d.y+g*f.y);e.z=e.z+(i*d.z+g*f.z);this.grid[a][b]=this.vertices.push(new THREE.Vector3(e.x,e.y,e.z))-1}}for(a=0;a<
 this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var f=(a+1)%this.segmentsR,e=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][e],e=this.grid[a][e],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,f,e));this.faceVertexUvs[0].push([g,i,l,j])}this.computeCentroids();this.computeFaceNormals();
 this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.TubeGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=f||false;if(e)this.debug=new THREE.Object3D;this.grid=[];var g,h,e=this.segments+1,i,l,j,n=new THREE.Vector3,m,q,o,b=new THREE.TubeGeometry.FrenetFrames(a,b,f);m=b.tangents;q=b.normals;o=b.binormals;this.tangents=m;this.normals=q;this.binormals=o;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);j=a.getPointAt(d);d=m[b];g=q[b];h=o[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
-j,c,255));this.debug.add(new THREE.ArrowHelper(g,j,c,16711680));this.debug.add(new THREE.ArrowHelper(h,j,c,65280))}for(d=0;d<this.segmentsRadius;d++){i=d/this.segmentsRadius*2*Math.PI;l=-this.radius*Math.cos(i);i=this.radius*Math.sin(i);n.copy(j);n.x=n.x+(l*g.x+i*h.x);n.y=n.y+(l*g.y+i*h.y);n.z=n.z+(l*g.z+i*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(n.x,n.y,n.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){e=f?(b+1)%this.segments:b+1;n=(d+1)%this.segmentsRadius;
-a=this.grid[b][d];c=this.grid[e][d];e=this.grid[e][n];n=this.grid[b][n];m=new THREE.UV(b/this.segments,d/this.segmentsRadius);q=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);o=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,e,n));this.faceVertexUvs[0].push([m,q,o,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var f=[],e=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,l,j,n;this.tangents=f;this.normals=e;this.binormals=g;for(l=0;l<b;l++){j=l/(b-1);f[l]=a.getTangentAt(j);f[l].normalize()}e[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;l=Math.abs(f[0].x);j=Math.abs(f[0].y);n=Math.abs(f[0].z);if(l<=a){a=l;d.set(1,0,0)}if(j<=a){a=j;d.set(0,1,0)}n<=a&&d.set(0,0,1);h.cross(f[0],d).normalize();
+THREE.TubeGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.segmentsRadius=d||8;this.closed=f||false;if(e)this.debug=new THREE.Object3D;this.grid=[];var g,h,e=this.segments+1,i,l,j,o=new THREE.Vector3,m,p,q,b=new THREE.TubeGeometry.FrenetFrames(a,b,f);m=b.tangents;p=b.normals;q=b.binormals;this.tangents=m;this.normals=p;this.binormals=q;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);j=a.getPointAt(d);d=m[b];g=p[b];h=q[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
+j,c,255));this.debug.add(new THREE.ArrowHelper(g,j,c,16711680));this.debug.add(new THREE.ArrowHelper(h,j,c,65280))}for(d=0;d<this.segmentsRadius;d++){i=d/this.segmentsRadius*2*Math.PI;l=-this.radius*Math.cos(i);i=this.radius*Math.sin(i);o.copy(j);o.x=o.x+(l*g.x+i*h.x);o.y=o.y+(l*g.y+i*h.y);o.z=o.z+(l*g.z+i*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(o.x,o.y,o.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.segmentsRadius;d++){e=f?(b+1)%this.segments:b+1;o=(d+1)%this.segmentsRadius;
+a=this.grid[b][d];c=this.grid[e][d];e=this.grid[e][o];o=this.grid[b][o];m=new THREE.UV(b/this.segments,d/this.segmentsRadius);p=new THREE.UV((b+1)/this.segments,d/this.segmentsRadius);q=new THREE.UV((b+1)/this.segments,(d+1)/this.segmentsRadius);g=new THREE.UV(b/this.segments,(d+1)/this.segmentsRadius);this.faces.push(new THREE.Face4(a,c,e,o));this.faceVertexUvs[0].push([m,p,q,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var f=[],e=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,l,j,o;this.tangents=f;this.normals=e;this.binormals=g;for(l=0;l<b;l++){j=l/(b-1);f[l]=a.getTangentAt(j);f[l].normalize()}e[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;l=Math.abs(f[0].x);j=Math.abs(f[0].y);o=Math.abs(f[0].z);if(l<=a){a=l;d.set(1,0,0)}if(j<=a){a=j;d.set(0,1,0)}o<=a&&d.set(0,0,1);h.cross(f[0],d).normalize();
 e[0].cross(f[0],h);g[0].cross(f[0],e[0]);for(l=1;l<b;l++){e[l]=e[l-1].clone();g[l]=g[l-1].clone();h.cross(f[l-1],f[l]);if(h.length()>1E-4){h.normalize();d=Math.acos(f[l-1].dot(f[l]));i.makeRotationAxis(h,d).multiplyVector3(e[l])}g[l].cross(f[l],e[l])}if(c){d=Math.acos(e[0].dot(e[b-1]));d=d/(b-1);f[0].dot(h.cross(e[0],e[b-1]))>0&&(d=-d);for(l=1;l<b;l++){i.makeRotationAxis(f[l],d*l).multiplyVector3(e[l]);g[l].cross(f[l],e[l])}}};
 THREE.PolyhedronGeometry=function(a,b,c,d){function f(a){var b=a.normalize().clone();b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,1-a);return b}function e(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.addSelf(a).addSelf(b).addSelf(c).divideScalar(3);d.normal=d.centroid.clone().normalize();i.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);
-i.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{d=d-1;e(a,g(a,b),g(a,c),d);e(g(a,b),b,g(b,c),d);e(g(a,c),g(b,c),c,d);e(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){n[a.index]||(n[a.index]=[]);n[b.index]||(n[b.index]=[]);var c=n[a.index][b.index];c===void 0&&(n[a.index][b.index]=n[b.index][a.index]=c=f((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);
-for(var c=c||1,d=d||0,i=this,l=0,j=a.length;l<j;l++)f(new THREE.Vector3(a[l][0],a[l][1],a[l][2]));for(var n=[],a=this.vertices,l=0,j=b.length;l<j;l++)e(a[b[l][0]],a[b[l][1]],a[b[l][2]],d);this.mergeVertices();l=0;for(j=this.vertices.length;l<j;l++)this.vertices[l].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
+i.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{d=d-1;e(a,g(a,b),g(a,c),d);e(g(a,b),b,g(b,c),d);e(g(a,c),g(b,c),c,d);e(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){o[a.index]||(o[a.index]=[]);o[b.index]||(o[b.index]=[]);var c=o[a.index][b.index];c===void 0&&(o[a.index][b.index]=o[b.index][a.index]=c=f((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);
+for(var c=c||1,d=d||0,i=this,l=0,j=a.length;l<j;l++)f(new THREE.Vector3(a[l][0],a[l][1],a[l][2]));for(var o=[],a=this.vertices,l=0,j=b.length;l<j;l++)e(a[b[l][0]],a[b[l][1]],a[b[l][2]],d);this.mergeVertices();l=0;for(j=this.vertices.length;l<j;l++)this.vertices[l].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var f=this.vertices,e=this.faces,g=this.faceVertexUvs[0],d=d===void 0?false:d,h,i,l,j,n=b+1;for(h=0;h<=c;h++){j=h/c;for(i=0;i<=b;i++){l=i/b;l=a(l,j);f.push(l)}}var m,q,o,p;for(h=0;h<c;h++)for(i=0;i<b;i++){a=h*n+i;f=h*n+i+1;j=(h+1)*n+i;l=(h+1)*n+i+1;m=new THREE.UV(i/b,h/c);q=new THREE.UV((i+1)/b,h/c);o=new THREE.UV(i/b,(h+1)/c);p=new THREE.UV((i+1)/b,(h+1)/c);if(d){e.push(new THREE.Face3(a,f,j));e.push(new THREE.Face3(f,l,j));g.push([m,
-q,o]);g.push([q,p,o])}else{e.push(new THREE.Face4(a,f,l,j));g.push([m,q,p,o])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);
-THREE.ConvexGeometry=function(a){function b(a){var b=a.length();return new THREE.UV(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var c=[[0,1,2],[0,2,1]],d=3;d<a.length;d++){var f=d,e=a[f].clone(),g=e.length();e.x=e.x+g*(Math.random()-0.5)*2E-6;e.y=e.y+g*(Math.random()-0.5)*2E-6;e.z=e.z+g*(Math.random()-0.5)*2E-6;for(var g=[],h=0;h<c.length;){var i=c[h],l=e,j=a[i[0]],n;n=j;var m=a[i[1]],q=a[i[2]],o=new THREE.Vector3,p=new THREE.Vector3;o.sub(q,m);p.sub(n,m);o.crossSelf(p);o.isZero()||o.normalize();n=
-o;j=n.dot(j);if(n.dot(l)>=j){for(l=0;l<3;l++){j=[i[l],i[(l+1)%3]];n=true;for(m=0;m<g.length;m++)if(g[m][0]===j[1]&&g[m][1]===j[0]){g[m]=g[g.length-1];g.pop();n=false;break}n&&g.push(j)}c[h]=c[c.length-1];c.pop()}else h++}for(m=0;m<g.length;m++)c.push([g[m][0],g[m][1],f])}f=0;e=Array(a.length);for(d=0;d<c.length;d++){g=c[d];for(h=0;h<3;h++){if(e[g[h]]===void 0){e[g[h]]=f++;this.vertices.push(a[g[h]])}g[h]=e[g[h]]}}for(d=0;d<c.length;d++)this.faces.push(new THREE.Face3(c[d][0],c[d][1],c[d][2]));for(d=
+THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var f=this.vertices,e=this.faces,g=this.faceVertexUvs[0],d=d===void 0?false:d,h,i,l,j,o=b+1;for(h=0;h<=c;h++){j=h/c;for(i=0;i<=b;i++){l=i/b;l=a(l,j);f.push(l)}}var m,p,q,n;for(h=0;h<c;h++)for(i=0;i<b;i++){a=h*o+i;f=h*o+i+1;j=(h+1)*o+i;l=(h+1)*o+i+1;m=new THREE.UV(i/b,h/c);p=new THREE.UV((i+1)/b,h/c);q=new THREE.UV(i/b,(h+1)/c);n=new THREE.UV((i+1)/b,(h+1)/c);if(d){e.push(new THREE.Face3(a,f,j));e.push(new THREE.Face3(f,l,j));g.push([m,
+p,q]);g.push([p,n,q])}else{e.push(new THREE.Face4(a,f,l,j));g.push([m,p,n,q])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.ConvexGeometry=function(a){function b(a){var b=a.length();return new THREE.UV(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var c=[[0,1,2],[0,2,1]],d=3;d<a.length;d++){var f=d,e=a[f].clone(),g=e.length();e.x=e.x+g*(Math.random()-0.5)*2E-6;e.y=e.y+g*(Math.random()-0.5)*2E-6;e.z=e.z+g*(Math.random()-0.5)*2E-6;for(var g=[],h=0;h<c.length;){var i=c[h],l=e,j=a[i[0]],o;o=j;var m=a[i[1]],p=a[i[2]],q=new THREE.Vector3,n=new THREE.Vector3;q.sub(p,m);n.sub(o,m);q.crossSelf(n);q.isZero()||q.normalize();o=
+q;j=o.dot(j);if(o.dot(l)>=j){for(l=0;l<3;l++){j=[i[l],i[(l+1)%3]];o=true;for(m=0;m<g.length;m++)if(g[m][0]===j[1]&&g[m][1]===j[0]){g[m]=g[g.length-1];g.pop();o=false;break}o&&g.push(j)}c[h]=c[c.length-1];c.pop()}else h++}for(m=0;m<g.length;m++)c.push([g[m][0],g[m][1],f])}f=0;e=Array(a.length);for(d=0;d<c.length;d++){g=c[d];for(h=0;h<3;h++){if(e[g[h]]===void 0){e[g[h]]=f++;this.vertices.push(a[g[h]])}g[h]=e[g[h]]}}for(d=0;d<c.length;d++)this.faces.push(new THREE.Face3(c[d][0],c[d][1],c[d][2]));for(d=
 0;d<this.faces.length;d++){g=this.faces[d];this.faceVertexUvs[0].push([b(this.vertices[g.a]),b(this.vertices[g.b]),b(this.vertices[g.c])])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ConvexGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.AxisHelper=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vector3);a.vertices.push(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.AxisHelper.prototype=Object.create(THREE.Object3D.prototype);
@@ -725,15 +726,15 @@ THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d
 THREE.CameraHelper.prototype.update=function(){function a(a,d,f,e){THREE.CameraHelper.__v.set(d,f,e);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(a!==void 0){d=0;for(f=a.length;d<f;d++)b.geometry.vertices[a[d]].copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",-1,-1,1);
 a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.geometry.verticesNeedUpdate=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
 THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=false;this.supportUVs=true;this.debug=false};THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){j.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,f,g,h,m){var n=new THREE.Face4(a,c,d,f,null,g.color,g.materialIndex);if(j.useOldVertexColors){n.vertexColors=[];for(var o,p,q,r=0;r<4;r++){q=h[r];o=new THREE.Color;o.setRGB(0,0,0);for(var s=0;s<q.length;s++){p=g.vertexColors[q[s]-1];o.r=o.r+p.r;o.g=o.g+p.g;o.b=o.b+p.b}o.r=o.r/q.length;o.g=o.g/q.length;o.b=o.b/
-q.length;n.vertexColors[r]=o}}i.push(n);if(j.supportUVs){g=[e(a,""),e(c,m),e(d,m),e(f,m)];g[0]?g[1]?g[2]?g[3]?l.push(g):b("d :( ",f+":"+m):b("c :( ",d+":"+m):b("b :( ",c+":"+m):b("a :( ",a+":"+m)}}function f(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function e(a,d){var e=a+":"+d,f=s[e];if(!f){a>=r&&a<r+m.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in s?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,s[e]):s[e]=d}var h=
-[],i=[],l=[],j=this,n=a.vertices,m=a.faces,h=n.concat(),q=[],o={},p={},s={},r=n.length,u,v,t,A,y,B=a.faceVertexUvs[0];b("originalFaces, uvs, originalVerticesLength",m.length,B.length,r);if(j.supportUVs){u=0;for(v=B.length;u<v;u++){t=0;for(A=B[u].length;t<A;t++){y=m[u]["abcd".charAt(t)];g(y,u,B[u][t])}}}if(B.length==0)j.supportUVs=false;u=0;for(var G in s)u++;if(!u){j.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",s,"vs",B.length);var x;u=0;for(v=m.length;u<v;u++){y=m[u];
-q.push(y.centroid);h.push(y.centroid);if(j.supportUVs){x=new THREE.UV;if(y instanceof THREE.Face3){x.u=e(y.a,u).u+e(y.b,u).u+e(y.c,u).u;x.v=e(y.a,u).v+e(y.b,u).v+e(y.c,u).v;x.u=x.u/3;x.v=x.v/3}else if(y instanceof THREE.Face4){x.u=e(y.a,u).u+e(y.b,u).u+e(y.c,u).u+e(y.d,u).u;x.v=e(y.a,u).v+e(y.b,u).v+e(y.c,u).v+e(y.d,u).v;x.u=x.u/4;x.v=x.v/4}g(r+u,"",x)}}b("-- added UVs for new Faces",s);G=function(a,b){I[a]===void 0&&(I[a]=[]);I[a].push(b)};var I={},B=0;for(v=a.faces.length;B<v;B++){y=a.faces[B];
-if(y instanceof THREE.Face3){x=f(y.a,y.b);G(x,B);x=f(y.b,y.c);G(x,B);x=f(y.c,y.a);G(x,B)}else if(y instanceof THREE.Face4){x=f(y.a,y.b);G(x,B);x=f(y.b,y.c);G(x,B);x=f(y.c,y.d);G(x,B);x=f(y.d,y.a);G(x,B)}}v=I;var F=0,L,E;G={};B={};for(u in v){x=v[u];L=u.split("_");E=L[0];L=L[1];t=E;y=[E,L];G[t]===void 0&&(G[t]=[]);G[t].push(y);t=L;y=[E,L];G[t]===void 0&&(G[t]=[]);G[t].push(y);t=0;for(A=x.length;t<A;t++){y=x[t];var P=E,H=y,D=u;B[P]===void 0&&(B[P]={});B[P][H]=D;P=L;H=u;B[P]===void 0&&(B[P]={});B[P][y]=
-H}x.length<2&&(p[u]=true)}b("vertexEdgeMap",G,"vertexFaceMap",B);for(u in v){x=v[u];y=x[0];A=x[1];L=u.split("_");E=L[0];L=L[1];x=new THREE.Vector3;if(p[u]){x.addSelf(n[E]);x.addSelf(n[L]);x.multiplyScalar(0.5)}else{x.addSelf(q[y]);x.addSelf(q[A]);x.addSelf(n[E]);x.addSelf(n[L]);x.multiplyScalar(0.25)}o[u]=r+m.length+F;h.push(x);F++;if(j.supportUVs){x=new THREE.UV;x.u=e(E,y).u+e(L,y).u;x.v=e(E,y).v+e(L,y).v;x.u=x.u/2;x.v=x.v/2;g(o[u],y,x);if(!p[u]){x=new THREE.UV;x.u=e(E,A).u+e(L,A).u;x.v=e(E,A).v+
-e(L,A).v;x.u=x.u/2;x.v=x.v/2;g(o[u],A,x)}}}b("-- Step 2 done");var S,R;L=["123","12","2","23"];A=["123","23","3","31"];var P=["123","31","1","12"],H=["1234","12","2","23"],D=["1234","23","3","34"],J=["1234","34","4","41"],N=["1234","41","1","12"];u=0;for(v=q.length;u<v;u++){y=m[u];x=r+u;if(y instanceof THREE.Face3){F=f(y.a,y.b);E=f(y.b,y.c);S=f(y.c,y.a);d(x,o[F],y.b,o[E],y,L,u);d(x,o[E],y.c,o[S],y,A,u);d(x,o[S],y.a,o[F],y,P,u)}else if(y instanceof THREE.Face4){F=f(y.a,y.b);E=f(y.b,y.c);S=f(y.c,y.d);
-R=f(y.d,y.a);d(x,o[F],y.b,o[E],y,H,u);d(x,o[E],y.c,o[S],y,D,u);d(x,o[S],y.d,o[R],y,J,u);d(x,o[R],y.a,o[F],y,N,u)}else b("face should be a face!",y)}o=new THREE.Vector3;y=new THREE.Vector3;u=0;for(v=n.length;u<v;u++)if(G[u]!==void 0){o.set(0,0,0);y.set(0,0,0);E=new THREE.Vector3(0,0,0);x=0;for(t in B[u]){o.addSelf(q[t]);x++}L=0;F=G[u].length;for(t=0;t<F;t++)p[f(G[u][t][0],G[u][t][1])]&&L++;if(L!=2){o.divideScalar(x);for(t=0;t<F;t++){x=G[u][t];x=n[x[0]].clone().addSelf(n[x[1]]).divideScalar(2);y.addSelf(x)}y.divideScalar(F);
-E.addSelf(n[u]);E.multiplyScalar(F-3);E.addSelf(o);E.addSelf(y.multiplyScalar(2));E.divideScalar(F);h[u]=E}}a.vertices=h;a.faces=i;a.faceVertexUvs[0]=l;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);
+THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){j.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,f,g,h,m){var o=new THREE.Face4(a,c,d,f,null,g.color,g.materialIndex);if(j.useOldVertexColors){o.vertexColors=[];for(var n,p,q,r=0;r<4;r++){q=h[r];n=new THREE.Color;n.setRGB(0,0,0);for(var s=0;s<q.length;s++){p=g.vertexColors[q[s]-1];n.r=n.r+p.r;n.g=n.g+p.g;n.b=n.b+p.b}n.r=n.r/q.length;n.g=n.g/q.length;n.b=n.b/
+q.length;o.vertexColors[r]=n}}i.push(o);if(j.supportUVs){g=[e(a,""),e(c,m),e(d,m),e(f,m)];g[0]?g[1]?g[2]?g[3]?l.push(g):b("d :( ",f+":"+m):b("c :( ",d+":"+m):b("b :( ",c+":"+m):b("a :( ",a+":"+m)}}function f(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function e(a,d){var e=a+":"+d,f=t[e];if(!f){a>=s&&a<s+m.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in t?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,t[e]):t[e]=d}var h=
+[],i=[],l=[],j=this,o=a.vertices,m=a.faces,h=o.concat(),p=[],q={},n={},t={},s=o.length,u,v,r,A,x,B=a.faceVertexUvs[0];b("originalFaces, uvs, originalVerticesLength",m.length,B.length,s);if(j.supportUVs){u=0;for(v=B.length;u<v;u++){r=0;for(A=B[u].length;r<A;r++){x=m[u]["abcd".charAt(r)];g(x,u,B[u][r])}}}if(B.length==0)j.supportUVs=false;u=0;for(var C in t)u++;if(!u){j.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",t,"vs",B.length);var z;u=0;for(v=m.length;u<v;u++){x=m[u];
+p.push(x.centroid);h.push(x.centroid);if(j.supportUVs){z=new THREE.UV;if(x instanceof THREE.Face3){z.u=e(x.a,u).u+e(x.b,u).u+e(x.c,u).u;z.v=e(x.a,u).v+e(x.b,u).v+e(x.c,u).v;z.u=z.u/3;z.v=z.v/3}else if(x instanceof THREE.Face4){z.u=e(x.a,u).u+e(x.b,u).u+e(x.c,u).u+e(x.d,u).u;z.v=e(x.a,u).v+e(x.b,u).v+e(x.c,u).v+e(x.d,u).v;z.u=z.u/4;z.v=z.v/4}g(s+u,"",z)}}b("-- added UVs for new Faces",t);C=function(a,b){F[a]===void 0&&(F[a]=[]);F[a].push(b)};var F={},B=0;for(v=a.faces.length;B<v;B++){x=a.faces[B];
+if(x instanceof THREE.Face3){z=f(x.a,x.b);C(z,B);z=f(x.b,x.c);C(z,B);z=f(x.c,x.a);C(z,B)}else if(x instanceof THREE.Face4){z=f(x.a,x.b);C(z,B);z=f(x.b,x.c);C(z,B);z=f(x.c,x.d);C(z,B);z=f(x.d,x.a);C(z,B)}}v=F;var G=0,M,E;C={};B={};for(u in v){z=v[u];M=u.split("_");E=M[0];M=M[1];r=E;x=[E,M];C[r]===void 0&&(C[r]=[]);C[r].push(x);r=M;x=[E,M];C[r]===void 0&&(C[r]=[]);C[r].push(x);r=0;for(A=z.length;r<A;r++){x=z[r];var N=E,I=x,K=u;B[N]===void 0&&(B[N]={});B[N][I]=K;N=M;I=u;B[N]===void 0&&(B[N]={});B[N][x]=
+I}z.length<2&&(n[u]=true)}b("vertexEdgeMap",C,"vertexFaceMap",B);for(u in v){z=v[u];x=z[0];A=z[1];M=u.split("_");E=M[0];M=M[1];z=new THREE.Vector3;if(n[u]){z.addSelf(o[E]);z.addSelf(o[M]);z.multiplyScalar(0.5)}else{z.addSelf(p[x]);z.addSelf(p[A]);z.addSelf(o[E]);z.addSelf(o[M]);z.multiplyScalar(0.25)}q[u]=s+m.length+G;h.push(z);G++;if(j.supportUVs){z=new THREE.UV;z.u=e(E,x).u+e(M,x).u;z.v=e(E,x).v+e(M,x).v;z.u=z.u/2;z.v=z.v/2;g(q[u],x,z);if(!n[u]){z=new THREE.UV;z.u=e(E,A).u+e(M,A).u;z.v=e(E,A).v+
+e(M,A).v;z.u=z.u/2;z.v=z.v/2;g(q[u],A,z)}}}b("-- Step 2 done");var Q,H;M=["123","12","2","23"];A=["123","23","3","31"];var N=["123","31","1","12"],I=["1234","12","2","23"],K=["1234","23","3","34"],L=["1234","34","4","41"],aa=["1234","41","1","12"];u=0;for(v=p.length;u<v;u++){x=m[u];z=s+u;if(x instanceof THREE.Face3){G=f(x.a,x.b);E=f(x.b,x.c);Q=f(x.c,x.a);d(z,q[G],x.b,q[E],x,M,u);d(z,q[E],x.c,q[Q],x,A,u);d(z,q[Q],x.a,q[G],x,N,u)}else if(x instanceof THREE.Face4){G=f(x.a,x.b);E=f(x.b,x.c);Q=f(x.c,x.d);
+H=f(x.d,x.a);d(z,q[G],x.b,q[E],x,I,u);d(z,q[E],x.c,q[Q],x,K,u);d(z,q[Q],x.d,q[H],x,L,u);d(z,q[H],x.a,q[G],x,aa,u)}else b("face should be a face!",x)}q=new THREE.Vector3;x=new THREE.Vector3;u=0;for(v=o.length;u<v;u++)if(C[u]!==void 0){q.set(0,0,0);x.set(0,0,0);E=new THREE.Vector3(0,0,0);z=0;for(r in B[u]){q.addSelf(p[r]);z++}M=0;G=C[u].length;for(r=0;r<G;r++)n[f(C[u][r][0],C[u][r][1])]&&M++;if(M!=2){q.divideScalar(z);for(r=0;r<G;r++){z=C[u][r];z=o[z[0]].clone().addSelf(o[z[1]]).divideScalar(2);x.addSelf(z)}x.divideScalar(G);
+E.addSelf(o[u]);E.multiplyScalar(G-3);E.addSelf(q);E.addSelf(x.multiplyScalar(2));E.divideScalar(G);h[u]=E}}a.vertices=h;a.faces=i;a.faceVertexUvs[0]=l;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);
 THREE.LensFlare=function(a,b,c,d,f){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,f)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
 THREE.LensFlare.prototype.add=function(a,b,c,d,f,e){b===void 0&&(b=-1);c===void 0&&(c=0);e===void 0&&(e=1);f===void 0&&(f=new THREE.Color(16777215));if(d===void 0)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:e,color:f,blending:d})};
 THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,f=-this.positionScreen.y*2;for(a=0;a<b;a++){c=this.lensFlares[a];c.x=this.positionScreen.x+d*c.distance;c.y=this.positionScreen.y+f*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};
@@ -745,38 +746,38 @@ THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.ani
 THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];if(b){b.time=0;b.active=true}else console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=false};
 THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var f=d.duration/d.length;d.time=d.time+d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||d.time<0){d.direction=d.direction*-1;if(d.time>d.duration){d.time=d.duration;d.directionBackwards=true}if(d.time<0){d.time=0;d.directionBackwards=false}}}else{d.time=d.time%d.duration;if(d.time<0)d.time=d.time+d.duration}var e=d.startFrame+THREE.Math.clamp(Math.floor(d.time/
 f),0,d.length-1),g=d.weight;if(e!==d.currentFrame){this.morphTargetInfluences[d.lastFrame]=0;this.morphTargetInfluences[d.currentFrame]=1*g;this.morphTargetInfluences[e]=0;d.lastFrame=d.currentFrame;d.currentFrame=e}f=d.time%f/f;d.directionBackwards&&(f=1-f);this.morphTargetInfluences[d.currentFrame]=f*g;this.morphTargetInfluences[d.lastFrame]=(1-f)*g}}};
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,f,e,g,h,i,l,j,n,m,q;this.init=function(o){b=o.context;c=o;d=new Float32Array(16);f=new Uint16Array(6);o=0;d[o++]=-1;d[o++]=-1;d[o++]=0;d[o++]=0;d[o++]=1;d[o++]=-1;d[o++]=1;d[o++]=
-0;d[o++]=1;d[o++]=1;d[o++]=1;d[o++]=1;d[o++]=-1;d[o++]=1;d[o++]=0;d[o++]=1;o=0;f[o++]=0;f[o++]=1;f[o++]=2;f[o++]=0;f[o++]=2;f[o++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,f,e,g,h,i,l,j,o,m,p;this.init=function(q){b=q.context;c=q;d=new Float32Array(16);f=new Uint16Array(6);q=0;d[q++]=-1;d[q++]=-1;d[q++]=0;d[q++]=0;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=
+0;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=0;d[q++]=1;q=0;f[q++]=0;f[q++]=1;f[q++]=2;f[q++]=0;f[q++]=2;f[q++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
 b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){l=false;j=a(THREE.ShaderFlares.lensFlare)}else{l=true;j=a(THREE.ShaderFlares.lensFlareVertexTexture)}n={};m={};n.vertex=b.getAttribLocation(j,"position");n.uv=b.getAttribLocation(j,"uv");m.renderType=b.getUniformLocation(j,"renderType");m.map=b.getUniformLocation(j,"map");m.occlusionMap=b.getUniformLocation(j,"occlusionMap");m.opacity=b.getUniformLocation(j,"opacity");m.color=b.getUniformLocation(j,
-"color");m.scale=b.getUniformLocation(j,"scale");m.rotation=b.getUniformLocation(j,"rotation");m.screenPosition=b.getUniformLocation(j,"screenPosition");q=false};this.render=function(a,d,f,r){var a=a.__webglFlares,u=a.length;if(u){var v=new THREE.Vector3,t=r/f,A=f*0.5,y=r*0.5,B=16/r,G=new THREE.Vector2(B*t,B),x=new THREE.Vector3(1,1,0),I=new THREE.Vector2(1,1),F=m,B=n;b.useProgram(j);if(!q){b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);q=true}b.uniform1i(F.occlusionMap,0);b.uniform1i(F.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(B.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(B.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var L,E,P,H,D;for(L=0;L<u;L++){B=16/r;G.set(B*t,B);H=a[L];v.set(H.matrixWorld.elements[12],H.matrixWorld.elements[13],H.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(v);d.projectionMatrix.multiplyVector3(v);x.copy(v);I.x=x.x*A+A;I.y=x.y*y+y;if(l||I.x>0&&I.x<f&&I.y>0&&
-I.y<r){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,I.x-8,I.y-8,16,16,0);b.uniform1i(F.renderType,0);b.uniform2f(F.scale,G.x,G.y);b.uniform3f(F.screenPosition,x.x,x.y,x.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,I.x-8,I.y-8,16,16,0);b.uniform1i(F.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);H.positionScreen.copy(x);H.customUpdateCallback?H.customUpdateCallback(H):H.updateLensFlares();b.uniform1i(F.renderType,2);b.enable(b.BLEND);E=0;for(P=H.lensFlares.length;E<P;E++){D=H.lensFlares[E];if(D.opacity>0.001&&D.scale>0.001){x.x=D.x;x.y=D.y;x.z=D.z;B=D.size*D.scale/r;G.x=B*t;G.y=B;b.uniform3f(F.screenPosition,x.x,x.y,x.z);b.uniform2f(F.scale,G.x,G.y);b.uniform1f(F.rotation,D.rotation);b.uniform1f(F.opacity,D.opacity);
-b.uniform3f(F.color,D.color.r,D.color.g,D.color.b);c.setBlending(D.blending,D.blendEquation,D.blendSrc,D.blendDst);c.setTexture(D.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){l=false;j=a(THREE.ShaderFlares.lensFlare)}else{l=true;j=a(THREE.ShaderFlares.lensFlareVertexTexture)}o={};m={};o.vertex=b.getAttribLocation(j,"position");o.uv=b.getAttribLocation(j,"uv");m.renderType=b.getUniformLocation(j,"renderType");m.map=b.getUniformLocation(j,"map");m.occlusionMap=b.getUniformLocation(j,"occlusionMap");m.opacity=b.getUniformLocation(j,"opacity");m.color=b.getUniformLocation(j,
+"color");m.scale=b.getUniformLocation(j,"scale");m.rotation=b.getUniformLocation(j,"rotation");m.screenPosition=b.getUniformLocation(j,"screenPosition");p=false};this.render=function(a,d,f,s){var a=a.__webglFlares,u=a.length;if(u){var v=new THREE.Vector3,r=s/f,A=f*0.5,x=s*0.5,B=16/s,C=new THREE.Vector2(B*r,B),z=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),G=m,B=o;b.useProgram(j);if(!p){b.enableVertexAttribArray(o.vertex);b.enableVertexAttribArray(o.uv);p=true}b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map,
+1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(B.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(B.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var M,E,N,I,K;for(M=0;M<u;M++){B=16/s;C.set(B*r,B);I=a[M];v.set(I.matrixWorld.elements[12],I.matrixWorld.elements[13],I.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(v);d.projectionMatrix.multiplyVector3(v);z.copy(v);F.x=z.x*A+A;F.y=z.y*x+x;if(l||F.x>0&&F.x<f&&F.y>0&&
+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(G.renderType,0);b.uniform2f(G.scale,C.x,C.y);b.uniform3f(G.screenPosition,z.x,z.y,z.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,F.x-8,F.y-8,16,16,0);b.uniform1i(G.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);I.positionScreen.copy(z);I.customUpdateCallback?I.customUpdateCallback(I):I.updateLensFlares();b.uniform1i(G.renderType,2);b.enable(b.BLEND);E=0;for(N=I.lensFlares.length;E<N;E++){K=I.lensFlares[E];if(K.opacity>0.001&&K.scale>0.001){z.x=K.x;z.y=K.y;z.z=K.z;B=K.size*K.scale/s;C.x=B*r;C.y=B;b.uniform3f(G.screenPosition,z.x,z.y,z.z);b.uniform2f(G.scale,C.x,C.y);b.uniform1f(G.rotation,K.rotation);b.uniform1f(G.opacity,K.opacity);
+b.uniform3f(G.color,K.color.r,K.color.g,K.color.b);c.setBlending(K.blending,K.blendEquation,K.blendSrc,K.blendDst);c.setTexture(K.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,f,e,g=new THREE.Frustum,h=new THREE.Matrix4,i=new THREE.Vector3,l=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:true});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
-vertexShader:g.vertexShader,uniforms:h,skinning:true});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:true,skinning:true});c._shadowPass=true;d._shadowPass=true;f._shadowPass=true;e._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(j,n){var m,q,o,p,s,r,u,v,t,A=[];p=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFrontFaces?
-a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);m=0;for(q=j.__lights.length;m<q;m++){o=j.__lights[m];if(o.castShadow)if(o instanceof THREE.DirectionalLight&&o.shadowCascade)for(s=0;s<o.shadowCascadeCount;s++){var y;if(o.shadowCascadeArray[s])y=o.shadowCascadeArray[s];else{t=o;u=s;y=new THREE.DirectionalLight;y.isVirtual=true;y.onlyShadow=true;y.castShadow=true;y.shadowCameraNear=t.shadowCameraNear;y.shadowCameraFar=t.shadowCameraFar;y.shadowCameraLeft=t.shadowCameraLeft;y.shadowCameraRight=
-t.shadowCameraRight;y.shadowCameraBottom=t.shadowCameraBottom;y.shadowCameraTop=t.shadowCameraTop;y.shadowCameraVisible=t.shadowCameraVisible;y.shadowDarkness=t.shadowDarkness;y.shadowBias=t.shadowCascadeBias[u];y.shadowMapWidth=t.shadowCascadeWidth[u];y.shadowMapHeight=t.shadowCascadeHeight[u];y.pointsWorld=[];y.pointsFrustum=[];v=y.pointsWorld;r=y.pointsFrustum;for(var B=0;B<8;B++){v[B]=new THREE.Vector3;r[B]=new THREE.Vector3}v=t.shadowCascadeNearZ[u];t=t.shadowCascadeFarZ[u];r[0].set(-1,-1,v);
-r[1].set(1,-1,v);r[2].set(-1,1,v);r[3].set(1,1,v);r[4].set(-1,-1,t);r[5].set(1,-1,t);r[6].set(-1,1,t);r[7].set(1,1,t);y.originalCamera=n;r=new THREE.Gyroscope;r.position=o.shadowCascadeOffset;r.add(y);r.add(y.target);n.add(r);o.shadowCascadeArray[s]=y;console.log("Created virtualLight",y)}u=o;v=s;t=u.shadowCascadeArray[v];t.position.copy(u.position);t.target.position.copy(u.target.position);t.lookAt(t.target);t.shadowCameraVisible=u.shadowCameraVisible;t.shadowDarkness=u.shadowDarkness;t.shadowBias=
-u.shadowCascadeBias[v];r=u.shadowCascadeNearZ[v];u=u.shadowCascadeFarZ[v];t=t.pointsFrustum;t[0].z=r;t[1].z=r;t[2].z=r;t[3].z=r;t[4].z=u;t[5].z=u;t[6].z=u;t[7].z=u;A[p]=y;p++}else{A[p]=o;p++}}m=0;for(q=A.length;m<q;m++){o=A[m];if(!o.shadowMap){o.shadowMap=new THREE.WebGLRenderTarget(o.shadowMapWidth,o.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});o.shadowMapSize=new THREE.Vector2(o.shadowMapWidth,o.shadowMapHeight);o.shadowMatrix=new THREE.Matrix4}if(!o.shadowCamera){if(o instanceof
-THREE.SpotLight)o.shadowCamera=new THREE.PerspectiveCamera(o.shadowCameraFov,o.shadowMapWidth/o.shadowMapHeight,o.shadowCameraNear,o.shadowCameraFar);else if(o instanceof THREE.DirectionalLight)o.shadowCamera=new THREE.OrthographicCamera(o.shadowCameraLeft,o.shadowCameraRight,o.shadowCameraTop,o.shadowCameraBottom,o.shadowCameraNear,o.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}j.add(o.shadowCamera);b.autoUpdateScene&&j.updateMatrixWorld()}if(o.shadowCameraVisible&&
-!o.cameraHelper){o.cameraHelper=new THREE.CameraHelper(o.shadowCamera);o.shadowCamera.add(o.cameraHelper)}if(o.isVirtual&&y.originalCamera==n){s=n;p=o.shadowCamera;r=o.pointsFrustum;t=o.pointsWorld;i.set(Infinity,Infinity,Infinity);l.set(-Infinity,-Infinity,-Infinity);for(u=0;u<8;u++){v=t[u];v.copy(r[u]);THREE.ShadowMapPlugin.__projector.unprojectVector(v,s);p.matrixWorldInverse.multiplyVector3(v);if(v.x<i.x)i.x=v.x;if(v.x>l.x)l.x=v.x;if(v.y<i.y)i.y=v.y;if(v.y>l.y)l.y=v.y;if(v.z<i.z)i.z=v.z;if(v.z>
-l.z)l.z=v.z}p.left=i.x;p.right=l.x;p.top=l.y;p.bottom=i.y;p.updateProjectionMatrix()}p=o.shadowMap;r=o.shadowMatrix;s=o.shadowCamera;s.position.copy(o.matrixWorld.getPosition());s.lookAt(o.target.matrixWorld.getPosition());s.updateMatrixWorld();s.matrixWorldInverse.getInverse(s.matrixWorld);if(o.cameraHelper)o.cameraHelper.visible=o.shadowCameraVisible;o.shadowCameraVisible&&o.cameraHelper.update();r.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);r.multiplySelf(s.projectionMatrix);r.multiplySelf(s.matrixWorldInverse);
-if(!s._viewMatrixArray)s._viewMatrixArray=new Float32Array(16);if(!s._projectionMatrixArray)s._projectionMatrixArray=new Float32Array(16);s.matrixWorldInverse.flattenToArray(s._viewMatrixArray);s.projectionMatrix.flattenToArray(s._projectionMatrixArray);h.multiply(s.projectionMatrix,s.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(p);b.clear();t=j.__webglObjects;o=0;for(p=t.length;o<p;o++){u=t[o];r=u.object;u.render=false;if(r.visible&&r.castShadow&&(!(r instanceof THREE.Mesh)||!r.frustumCulled||
-g.contains(r))){r._modelViewMatrix.multiply(s.matrixWorldInverse,r.matrixWorld);u.render=true}}o=0;for(p=t.length;o<p;o++){u=t[o];if(u.render){r=u.object;u=u.buffer;v=r.customDepthMaterial?r.customDepthMaterial:r instanceof THREE.SkinnedMesh?r.geometry.morphTargets.length?e:f:r.geometry.morphTargets.length?d:c;u instanceof THREE.BufferGeometry?b.renderBufferDirect(s,j.__lights,null,v,u,r):b.renderBuffer(s,j.__lights,null,v,u,r)}}t=j.__webglObjectsImmediate;o=0;for(p=t.length;o<p;o++){u=t[o];r=u.object;
-if(r.visible&&r.castShadow){r._modelViewMatrix.multiply(s.matrixWorldInverse,r.matrixWorld);b.renderImmediateObject(s,j.__lights,null,c,r)}}}m=b.getClearColor();q=b.getClearAlpha();a.clearColor(m.r,m.g,m.b,q);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
+vertexShader:g.vertexShader,uniforms:h,skinning:true});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:true,skinning:true});c._shadowPass=true;d._shadowPass=true;f._shadowPass=true;e._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(j,o){var m,p,q,n,t,s,u,v,r,A=[];n=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFrontFaces?
+a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);m=0;for(p=j.__lights.length;m<p;m++){q=j.__lights[m];if(q.castShadow)if(q instanceof THREE.DirectionalLight&&q.shadowCascade)for(t=0;t<q.shadowCascadeCount;t++){var x;if(q.shadowCascadeArray[t])x=q.shadowCascadeArray[t];else{r=q;u=t;x=new THREE.DirectionalLight;x.isVirtual=true;x.onlyShadow=true;x.castShadow=true;x.shadowCameraNear=r.shadowCameraNear;x.shadowCameraFar=r.shadowCameraFar;x.shadowCameraLeft=r.shadowCameraLeft;x.shadowCameraRight=
+r.shadowCameraRight;x.shadowCameraBottom=r.shadowCameraBottom;x.shadowCameraTop=r.shadowCameraTop;x.shadowCameraVisible=r.shadowCameraVisible;x.shadowDarkness=r.shadowDarkness;x.shadowBias=r.shadowCascadeBias[u];x.shadowMapWidth=r.shadowCascadeWidth[u];x.shadowMapHeight=r.shadowCascadeHeight[u];x.pointsWorld=[];x.pointsFrustum=[];v=x.pointsWorld;s=x.pointsFrustum;for(var B=0;B<8;B++){v[B]=new THREE.Vector3;s[B]=new THREE.Vector3}v=r.shadowCascadeNearZ[u];r=r.shadowCascadeFarZ[u];s[0].set(-1,-1,v);
+s[1].set(1,-1,v);s[2].set(-1,1,v);s[3].set(1,1,v);s[4].set(-1,-1,r);s[5].set(1,-1,r);s[6].set(-1,1,r);s[7].set(1,1,r);x.originalCamera=o;s=new THREE.Gyroscope;s.position=q.shadowCascadeOffset;s.add(x);s.add(x.target);o.add(s);q.shadowCascadeArray[t]=x;console.log("Created virtualLight",x)}u=q;v=t;r=u.shadowCascadeArray[v];r.position.copy(u.position);r.target.position.copy(u.target.position);r.lookAt(r.target);r.shadowCameraVisible=u.shadowCameraVisible;r.shadowDarkness=u.shadowDarkness;r.shadowBias=
+u.shadowCascadeBias[v];s=u.shadowCascadeNearZ[v];u=u.shadowCascadeFarZ[v];r=r.pointsFrustum;r[0].z=s;r[1].z=s;r[2].z=s;r[3].z=s;r[4].z=u;r[5].z=u;r[6].z=u;r[7].z=u;A[n]=x;n++}else{A[n]=q;n++}}m=0;for(p=A.length;m<p;m++){q=A[m];if(!q.shadowMap){q.shadowMap=new THREE.WebGLRenderTarget(q.shadowMapWidth,q.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});q.shadowMapSize=new THREE.Vector2(q.shadowMapWidth,q.shadowMapHeight);q.shadowMatrix=new THREE.Matrix4}if(!q.shadowCamera){if(q instanceof
+THREE.SpotLight)q.shadowCamera=new THREE.PerspectiveCamera(q.shadowCameraFov,q.shadowMapWidth/q.shadowMapHeight,q.shadowCameraNear,q.shadowCameraFar);else if(q instanceof THREE.DirectionalLight)q.shadowCamera=new THREE.OrthographicCamera(q.shadowCameraLeft,q.shadowCameraRight,q.shadowCameraTop,q.shadowCameraBottom,q.shadowCameraNear,q.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}j.add(q.shadowCamera);b.autoUpdateScene&&j.updateMatrixWorld()}if(q.shadowCameraVisible&&
+!q.cameraHelper){q.cameraHelper=new THREE.CameraHelper(q.shadowCamera);q.shadowCamera.add(q.cameraHelper)}if(q.isVirtual&&x.originalCamera==o){t=o;n=q.shadowCamera;s=q.pointsFrustum;r=q.pointsWorld;i.set(Infinity,Infinity,Infinity);l.set(-Infinity,-Infinity,-Infinity);for(u=0;u<8;u++){v=r[u];v.copy(s[u]);THREE.ShadowMapPlugin.__projector.unprojectVector(v,t);n.matrixWorldInverse.multiplyVector3(v);if(v.x<i.x)i.x=v.x;if(v.x>l.x)l.x=v.x;if(v.y<i.y)i.y=v.y;if(v.y>l.y)l.y=v.y;if(v.z<i.z)i.z=v.z;if(v.z>
+l.z)l.z=v.z}n.left=i.x;n.right=l.x;n.top=l.y;n.bottom=i.y;n.updateProjectionMatrix()}n=q.shadowMap;s=q.shadowMatrix;t=q.shadowCamera;t.position.copy(q.matrixWorld.getPosition());t.lookAt(q.target.matrixWorld.getPosition());t.updateMatrixWorld();t.matrixWorldInverse.getInverse(t.matrixWorld);if(q.cameraHelper)q.cameraHelper.visible=q.shadowCameraVisible;q.shadowCameraVisible&&q.cameraHelper.update();s.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);s.multiplySelf(t.projectionMatrix);s.multiplySelf(t.matrixWorldInverse);
+if(!t._viewMatrixArray)t._viewMatrixArray=new Float32Array(16);if(!t._projectionMatrixArray)t._projectionMatrixArray=new Float32Array(16);t.matrixWorldInverse.flattenToArray(t._viewMatrixArray);t.projectionMatrix.flattenToArray(t._projectionMatrixArray);h.multiply(t.projectionMatrix,t.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(n);b.clear();r=j.__webglObjects;q=0;for(n=r.length;q<n;q++){u=r[q];s=u.object;u.render=false;if(s.visible&&s.castShadow&&(!(s instanceof THREE.Mesh)||!s.frustumCulled||
+g.contains(s))){s._modelViewMatrix.multiply(t.matrixWorldInverse,s.matrixWorld);u.render=true}}q=0;for(n=r.length;q<n;q++){u=r[q];if(u.render){s=u.object;u=u.buffer;v=s.customDepthMaterial?s.customDepthMaterial:s instanceof THREE.SkinnedMesh?s.geometry.morphTargets.length?e:f:s.geometry.morphTargets.length?d:c;u instanceof THREE.BufferGeometry?b.renderBufferDirect(t,j.__lights,null,v,u,s):b.renderBuffer(t,j.__lights,null,v,u,s)}}r=j.__webglObjectsImmediate;q=0;for(n=r.length;q<n;q++){u=r[q];s=u.object;
+if(s.visible&&s.castShadow){s._modelViewMatrix.multiply(t.matrixWorldInverse,s.matrixWorld);b.renderImmediateObject(t,j.__lights,null,c,s)}}}m=b.getClearColor();p=b.getClearAlpha();a.clearColor(m.r,m.g,m.b,p);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
 THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,f,e,g,h,i,l,j;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);f=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=0;d[a++]=1;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++]=0;d[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),q=b.createShader(b.FRAGMENT_SHADER),o=b.createShader(b.VERTEX_SHADER);b.shaderSource(q,a.fragmentShader);b.shaderSource(o,a.vertexShader);b.compileShader(q);b.compileShader(o);b.attachShader(m,q);b.attachShader(m,o);b.linkProgram(m);h=m;i={};l={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");l.uvOffset=b.getUniformLocation(h,"uvOffset");l.uvScale=b.getUniformLocation(h,
+g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(p);b.compileShader(q);b.attachShader(m,p);b.attachShader(m,q);b.linkProgram(m);h=m;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");j=false};this.render=function(d,f,q,o){var d=d.__webglSprites,p=d.length;if(p){var s=i,r=l,u=o/q,q=q*0.5,v=o*0.5,t=true;b.useProgram(h);if(!j){b.enableVertexAttribArray(s.position);b.enableVertexAttribArray(s.uv);j=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(s.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(s.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
-g);b.uniformMatrix4fv(r.projectionMatrix,false,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(r.map,0);for(var A,y=[],s=0;s<p;s++){A=d[s];if(A.visible&&A.opacity!==0)if(A.useScreenCoordinates)A.z=-A.position.z;else{A._modelViewMatrix.multiply(f.matrixWorldInverse,A.matrixWorld);A.z=-A._modelViewMatrix.elements[14]}}d.sort(a);for(s=0;s<p;s++){A=d[s];if(A.visible&&A.opacity!==0&&A.map&&A.map.image&&A.map.image.width){if(A.useScreenCoordinates){b.uniform1i(r.useScreenCoordinates,1);
-b.uniform3f(r.screenPosition,(A.position.x-q)/q,(v-A.position.y)/v,Math.max(0,Math.min(1,A.position.z)))}else{b.uniform1i(r.useScreenCoordinates,0);b.uniform1i(r.affectedByDistance,A.affectedByDistance?1:0);b.uniformMatrix4fv(r.modelViewMatrix,false,A._modelViewMatrix.elements)}f=A.map.image.width/(A.scaleByViewport?o:1);y[0]=f*u*A.scale.x;y[1]=f*A.scale.y;b.uniform2f(r.uvScale,A.uvScale.x,A.uvScale.y);b.uniform2f(r.uvOffset,A.uvOffset.x,A.uvOffset.y);b.uniform2f(r.alignment,A.alignment.x,A.alignment.y);
-b.uniform1f(r.opacity,A.opacity);b.uniform3f(r.color,A.color.r,A.color.g,A.color.b);b.uniform1f(r.rotation,A.rotation);b.uniform2fv(r.scale,y);if(A.mergeWith3D&&!t){b.enable(b.DEPTH_TEST);t=true}else if(!A.mergeWith3D&&t){b.disable(b.DEPTH_TEST);t=false}c.setBlending(A.blending,A.blendEquation,A.blendSrc,A.blendDst);c.setTexture(A.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
+l.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");j=false};this.render=function(d,f,p,q){var d=d.__webglSprites,n=d.length;if(n){var t=i,s=l,u=q/p,p=p*0.5,v=q*0.5,r=true;b.useProgram(h);if(!j){b.enableVertexAttribArray(t.position);b.enableVertexAttribArray(t.uv);j=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(t.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(t.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+g);b.uniformMatrix4fv(s.projectionMatrix,false,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var A,x=[],t=0;t<n;t++){A=d[t];if(A.visible&&A.opacity!==0)if(A.useScreenCoordinates)A.z=-A.position.z;else{A._modelViewMatrix.multiply(f.matrixWorldInverse,A.matrixWorld);A.z=-A._modelViewMatrix.elements[14]}}d.sort(a);for(t=0;t<n;t++){A=d[t];if(A.visible&&A.opacity!==0&&A.map&&A.map.image&&A.map.image.width){if(A.useScreenCoordinates){b.uniform1i(s.useScreenCoordinates,1);
+b.uniform3f(s.screenPosition,(A.position.x-p)/p,(v-A.position.y)/v,Math.max(0,Math.min(1,A.position.z)))}else{b.uniform1i(s.useScreenCoordinates,0);b.uniform1i(s.affectedByDistance,A.affectedByDistance?1:0);b.uniformMatrix4fv(s.modelViewMatrix,false,A._modelViewMatrix.elements)}f=A.map.image.width/(A.scaleByViewport?q:1);x[0]=f*u*A.scale.x;x[1]=f*A.scale.y;b.uniform2f(s.uvScale,A.uvScale.x,A.uvScale.y);b.uniform2f(s.uvOffset,A.uvOffset.x,A.uvOffset.y);b.uniform2f(s.alignment,A.alignment.x,A.alignment.y);
+b.uniform1f(s.opacity,A.opacity);b.uniform3f(s.color,A.color.r,A.color.g,A.color.b);b.uniform1f(s.rotation,A.rotation);b.uniform2fv(s.scale,x);if(A.mergeWith3D&&!r){b.enable(b.DEPTH_TEST);r=true}else if(!A.mergeWith3D&&r){b.disable(b.DEPTH_TEST);r=false}c.setBlending(A.blending,A.blendEquation,A.blendSrc,A.blendDst);c.setTexture(A.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
 THREE.DepthPassPlugin=function(){this.enabled=false;this.renderTarget=null;var a,b,c,d,f=new THREE.Frustum,e=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
-function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,l,j,n,m,q;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);e.multiply(h.projectionMatrix,
-h.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(this.renderTarget);b.clear();q=g.__webglObjects;i=0;for(l=q.length;i<l;i++){j=q[i];m=j.object;j.render=false;if(m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||f.contains(m))){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);j.render=true}}i=0;for(l=q.length;i<l;i++){j=q[i];if(j.render){m=j.object;j=j.buffer;m.material&&b.setMaterialFaces(m.material);n=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?
-d:c;j instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,n,j,m):b.renderBuffer(h,g.__lights,null,n,j,m)}}q=g.__webglObjectsImmediate;i=0;for(l=q.length;i<l;i++){j=q[i];m=j.object;if(m.visible&&m.castShadow){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,m)}}i=b.getClearColor();l=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,l);a.enable(a.BLEND)}};
+function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,l,j,o,m,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);e.multiply(h.projectionMatrix,
+h.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(this.renderTarget);b.clear();p=g.__webglObjects;i=0;for(l=p.length;i<l;i++){j=p[i];m=j.object;j.render=false;if(m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||f.contains(m))){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);j.render=true}}i=0;for(l=p.length;i<l;i++){j=p[i];if(j.render){m=j.object;j=j.buffer;m.material&&b.setMaterialFaces(m.material);o=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?
+d:c;j instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,o,j,m):b.renderBuffer(h,g.__lights,null,o,j,m)}}p=g.__webglObjectsImmediate;i=0;for(l=p.length;i<l;i++){j=p[i];m=j.object;if(m.visible&&m.castShadow){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,m)}}i=b.getClearColor();l=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,l);a.enable(a.BLEND)}};
 THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
 lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
 THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",

+ 2 - 0
examples/webgl_loader_scene.html

@@ -323,6 +323,8 @@
 
 				var loader = new THREE.SceneLoader();
 
+				loader.addGeometryHandler( "ctm_mesh", THREE.CTMLoader );
+
 				loader.callbackSync = callbackSync;
 				loader.callbackProgress = callbackProgress;
 

+ 26 - 17
src/loaders/SceneLoader.js

@@ -11,11 +11,16 @@ THREE.SceneLoader = function () {
 	this.callbackSync = function () {};
 	this.callbackProgress = function () {};
 
+	this.geometryHandlerMap = {};
+
+	this.addGeometryHandler( "ascii_mesh", THREE.JSONLoader );
+	this.addGeometryHandler( "bin_mesh", THREE.BinaryLoader );
+
 };
 
 THREE.SceneLoader.prototype.constructor = THREE.SceneLoader;
 
-THREE.SceneLoader.prototype.load = function( url, callbackFinished ) {
+THREE.SceneLoader.prototype.load = function ( url, callbackFinished ) {
 
 	var scope = this;
 
@@ -47,6 +52,12 @@ THREE.SceneLoader.prototype.load = function( url, callbackFinished ) {
 
 };
 
+THREE.SceneLoader.prototype.addGeometryHandler = function ( typeID, loaderClass ) {
+
+	this.geometryHandlerMap[ typeID ] = { "loaderClass": loaderClass };
+
+};
+
 THREE.SceneLoader.prototype.parse = function ( json, callbackFinished, url ) {
 
 	var scope = this;
@@ -64,11 +75,14 @@ THREE.SceneLoader.prototype.parse = function ( json, callbackFinished, url ) {
 
 	var data = json;
 
-	var binLoader = new THREE.BinaryLoader();
-	var jsonLoader = new THREE.JSONLoader();
-	var ctmLoader = new THREE.CTMLoader();
+	// async geometry loaders
 
-	var useWorker, useBuffers;
+	for ( var typeID in this.geometryHandlerMap ) {
+
+		var loaderClass = this.geometryHandlerMap[ typeID ][ "loaderClass" ];
+		this.geometryHandlerMap[ typeID ][ "loaderObject" ] = new loaderClass();
+
+	}
 
 	counter_models = 0;
 	counter_textures = 0;
@@ -497,7 +511,7 @@ THREE.SceneLoader.prototype.parse = function ( json, callbackFinished, url ) {
 
 		g = data.geometries[ dg ];
 
-		if ( g.type === "bin_mesh" || g.type === "ascii_mesh" || g.type === "ctm_mesh" ) {
+		if ( g.type in this.geometryHandlerMap ) {
 
 			counter_models += 1;
 
@@ -543,19 +557,13 @@ THREE.SceneLoader.prototype.parse = function ( json, callbackFinished, url ) {
 			geometry = new THREE.IcosahedronGeometry( g.radius, g.subdivisions );
 			result.geometries[ dg ] = geometry;
 
-		} else if ( g.type === "ctm_mesh" ) {
-
-			useWorker = data.useWorker !== undefined ? data.useWorker : true;
-			useBuffers = data.useBuffers !== undefined ? data.useBuffers : true;
-			ctmLoader.load( get_url( g.url, data.urlBaseType ), create_callback( dg ), useWorker, useBuffers );
-
-		} else if ( g.type === "bin_mesh" ) {
-
-			binLoader.load( get_url( g.url, data.urlBaseType ), create_callback( dg ) );
+		} else if ( g.type in this.geometryHandlerMap ) {
 
-		} else if ( g.type === "ascii_mesh" ) {
+			//useWorker = data.useWorker !== undefined ? data.useWorker : true;
+			//useBuffers = data.useBuffers !== undefined ? data.useBuffers : true;
 
-			jsonLoader.load( get_url( g.url, data.urlBaseType ), create_callback( dg ) );
+			var loader = this.geometryHandlerMap[ g.type ][ "loaderObject" ];
+			loader.load( get_url( g.url, data.urlBaseType ), create_callback( dg ) );
 
 		} else if ( g.type === "embedded_mesh" ) {
 
@@ -568,6 +576,7 @@ THREE.SceneLoader.prototype.parse = function ( json, callbackFinished, url ) {
 
 			if ( modelJson ) {
 
+				var jsonLoader = this.geometryHandlerMap[ "ascii_mesh" ][ "loaderObject" ];
 				jsonLoader.createModel( modelJson, create_callback_embed( dg ), texture_path );
 
 			}