Browse Source

BinaryLoader return materials in callback too.

Mr.doob 12 years ago
parent
commit
b5a1321a29

+ 12 - 15
build/three.js

@@ -7336,8 +7336,6 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 		THREE.Geometry.call( this );
 
-		THREE.Loader.prototype.initMaterials( scope, materials, texturePath );
-
 		md = parseMetaData( data, currentOffset );
 
 		currentOffset += md.header_bytes;
@@ -7943,28 +7941,27 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 	function uv3 ( where, u1, v1, u2, v2, u3, v3 ) {
 
-		var uv = [];
-		uv.push( new THREE.UV( u1, v1 ) );
-		uv.push( new THREE.UV( u2, v2 ) );
-		uv.push( new THREE.UV( u3, v3 ) );
-		where.push( uv );
+		where.push( [
+			new THREE.UV( u1, v1 ),
+			new THREE.UV( u2, v2 ),
+			new THREE.UV( u3, v3 )
+		] );
 
 	};
 
 	function uv4 ( where, u1, v1, u2, v2, u3, v3, u4, v4 ) {
 
-		var uv = [];
-		uv.push( new THREE.UV( u1, v1 ) );
-		uv.push( new THREE.UV( u2, v2 ) );
-		uv.push( new THREE.UV( u3, v3 ) );
-		uv.push( new THREE.UV( u4, v4 ) );
-		where.push( uv );
-
+		where.push( [
+			new THREE.UV( u1, v1 ),
+			new THREE.UV( u2, v2 ),
+			new THREE.UV( u3, v3 ),
+			new THREE.UV( u4, v4 )
+		] );
 	};
 
 	Model.prototype = Object.create( THREE.Geometry.prototype );
 
-	callback( new Model( texturePath ) );
+	callback( new Model( texturePath ), this.initMaterials( materials, texturePath ) );
 
 };
 /**

+ 97 - 98
build/three.min.js

@@ -34,8 +34,8 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,multiplyVector3:function(a){v
 b[4]+b[6]*b[8],f=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],j=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*h;0===b&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,l=this.elements;l[0]=b*a;l[1]=b*c;l[2]=b*d;l[3]=b*e;l[4]=b*f;l[5]=b*g;l[6]=b*h;l[7]=b*i;l[8]=b*j;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.Matrix3.__v1=new THREE.Vector3;THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,j,l,m,n,p,o,s){this.elements=new Float32Array(16);this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,i||0,j||0,void 0!==l?l:1,m||0,n||0,p||0,o||0,void 0!==s?s:1)};
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,j,l,m,n,p,o,s){var t=this.elements;t[0]=a;t[4]=b;t[8]=c;t[12]=d;t[1]=e;t[5]=f;t[9]=g;t[13]=h;t[2]=i;t[6]=j;t[10]=l;t[14]=m;t[3]=n;t[7]=p;t[11]=o;t[15]=s;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,
-e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();0===g.length()&&(g.z=1);e.cross(c,g).normalize();0===e.length()&&(g.x+=1E-4,e.cross(c,g).normalize());f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],j=c[1],l=c[5],m=c[9],n=c[13],p=c[2],o=c[6],s=c[10],t=c[14],q=c[3],z=c[7],w=c[11],c=c[15],r=d[0],E=d[4],A=d[8],
-v=d[12],u=d[1],D=d[5],C=d[9],G=d[13],P=d[2],B=d[6],J=d[10],H=d[14],I=d[3],L=d[7],N=d[11],d=d[15];e[0]=f*r+g*u+h*P+i*I;e[4]=f*E+g*D+h*B+i*L;e[8]=f*A+g*C+h*J+i*N;e[12]=f*v+g*G+h*H+i*d;e[1]=j*r+l*u+m*P+n*I;e[5]=j*E+l*D+m*B+n*L;e[9]=j*A+l*C+m*J+n*N;e[13]=j*v+l*G+m*H+n*d;e[2]=p*r+o*u+s*P+t*I;e[6]=p*E+o*D+s*B+t*L;e[10]=p*A+o*C+s*J+t*N;e[14]=p*v+o*G+s*H+t*d;e[3]=q*r+z*u+w*P+c*I;e[7]=q*E+z*D+w*B+c*L;e[11]=q*A+z*C+w*J+c*N;e[15]=q*v+z*G+w*H+c*d;return this},multiplySelf:function(a){return this.multiply(this,
+e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();0===g.length()&&(g.z=1);e.cross(c,g).normalize();0===e.length()&&(g.x+=1E-4,e.cross(c,g).normalize());f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],j=c[1],l=c[5],m=c[9],n=c[13],p=c[2],o=c[6],s=c[10],t=c[14],q=c[3],A=c[7],w=c[11],c=c[15],r=d[0],E=d[4],z=d[8],
+v=d[12],u=d[1],D=d[5],C=d[9],G=d[13],P=d[2],B=d[6],J=d[10],H=d[14],I=d[3],L=d[7],N=d[11],d=d[15];e[0]=f*r+g*u+h*P+i*I;e[4]=f*E+g*D+h*B+i*L;e[8]=f*z+g*C+h*J+i*N;e[12]=f*v+g*G+h*H+i*d;e[1]=j*r+l*u+m*P+n*I;e[5]=j*E+l*D+m*B+n*L;e[9]=j*z+l*C+m*J+n*N;e[13]=j*v+l*G+m*H+n*d;e[2]=p*r+o*u+s*P+t*I;e[6]=p*E+o*D+s*B+t*L;e[10]=p*z+o*C+s*J+t*N;e[14]=p*v+o*G+s*H+t*d;e[3]=q*r+A*u+w*P+c*I;e[7]=q*E+A*D+w*B+c*L;e[11]=q*z+A*C+w*J+c*N;e[15]=q*v+A*G+w*H+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]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){var b=this.elements,
 c=a.x,d=a.y,e=a.z,f=1/(b[3]*c+b[7]*d+b[11]*e+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*e+b[12])*f;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*f;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*f;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*f;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*f;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*f;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*f;return a},multiplyVector3Array:function(a){for(var b=THREE.Matrix4.__v1,c=0,d=a.length;c<d;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,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*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=
@@ -51,7 +51,7 @@ b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector
 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(),e=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]*e;b[5]=a[5]*e;b[6]=a[6]*e;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],e=b[6],f=b[7],g=b[8],h=b[9],i=b[10],j=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*e+a*i;b[7]=l*f+a*j;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=l*i-a*e;b[11]=l*j-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],i=b[10],j=b[11],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*e-a*i;b[3]=l*f-a*j;b[8]=l*g+a*c;b[9]=l*h+a*d;b[10]=
 l*i+a*e;b[11]=l*j+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],j=b[7],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*e+a*i;b[3]=l*f+a*j;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*i-a*e;b[7]=l*j-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)return this.rotateZ(b);var d=a.x,e=a.y,f=a.z,
-g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,j=Math.cos(b),l=Math.sin(b),m=1-j,n=d*e*m,p=d*f*m,m=e*f*m,d=d*l,o=e*l,l=f*l,f=g+(1-g)*j,g=n+l,e=p-o,n=n-l,h=h+(1-h)*j,l=m+d,p=p+o,m=m-d,i=i+(1-i)*j,j=c[0],d=c[1],o=c[2],s=c[3],t=c[4],q=c[5],z=c[6],w=c[7],r=c[8],E=c[9],A=c[10],v=c[11];c[0]=f*j+g*t+e*r;c[1]=f*d+g*q+e*E;c[2]=f*o+g*z+e*A;c[3]=f*s+g*w+e*v;c[4]=n*j+h*t+l*r;c[5]=n*d+h*q+l*E;c[6]=n*o+h*z+l*A;c[7]=n*s+h*w+l*v;c[8]=p*j+m*t+i*r;c[9]=p*d+m*q+i*E;c[10]=p*o+m*z+i*A;c[11]=p*s+m*w+i*v;
+g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,j=Math.cos(b),l=Math.sin(b),m=1-j,n=d*e*m,p=d*f*m,m=e*f*m,d=d*l,o=e*l,l=f*l,f=g+(1-g)*j,g=n+l,e=p-o,n=n-l,h=h+(1-h)*j,l=m+d,p=p+o,m=m-d,i=i+(1-i)*j,j=c[0],d=c[1],o=c[2],s=c[3],t=c[4],q=c[5],A=c[6],w=c[7],r=c[8],E=c[9],z=c[10],v=c[11];c[0]=f*j+g*t+e*r;c[1]=f*d+g*q+e*E;c[2]=f*o+g*A+e*z;c[3]=f*s+g*w+e*v;c[4]=n*j+h*t+l*r;c[5]=n*d+h*q+l*E;c[6]=n*o+h*A+l*z;c[7]=n*s+h*w+l*v;c[8]=p*j+m*t+i*r;c[9]=p*d+m*q+i*E;c[10]=p*o+m*A+i*z;c[11]=p*s+m*w+i*v;
 return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;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),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,j=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*f,0,i*h-d*g,j*h+d*f,e*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,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);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),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,j=f-e;g[0]=2/
@@ -61,7 +61,7 @@ THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements
 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(),e=0;6>e;e++)if(b=c[e].x*d[12]+c[e].y*d[13]+c[e].z*d[14]+c[e].w,b<=a)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
 (function(a){a.Ray=function(b,c,d,e){this.origin=b||new a.Vector3;this.direction=c||new a.Vector3;this.near=d||0;this.far=e||Infinity};var b=new a.Vector3,c=new a.Vector3,d=new a.Vector3,e=new a.Vector3;new a.Vector3;var f=new a.Vector3,g=new a.Matrix4,h=function(a,b){return a.distance-b.distance},i=new a.Vector3,j=new a.Vector3,l=new a.Vector3,m=function(a,b,c){i.sub(c,a);var d=i.dot(b),a=j.add(a,l.copy(b).multiplyScalar(d));return c.distanceTo(a)},n=function(a,b,c,d){i.sub(d,b);j.sub(c,b);l.sub(a,
 b);var a=i.dot(i),b=i.dot(j),c=i.dot(l),e=j.dot(j),d=j.dot(l),f=1/(a*e-b*b),e=(e*c-b*d)*f,a=(a*d-b*c)*f;return 0<=e&&0<=a&&1>e+a},p=function(h,i,j){if(h instanceof a.Particle){var l=m(i.origin,i.direction,h.matrixWorld.getPosition());if(l>h.scale.x)return j;j.push({distance:l,point:h.position,face:null,object:h})}else if(h instanceof a.Mesh){var o=h.geometry.boundingSphere.radius*h.matrixWorld.getMaxScaleOnAxis(),l=m(i.origin,i.direction,h.matrixWorld.getPosition());if(l>o)return j;var o=h.geometry,
-p=o.vertices,E=h.material instanceof a.MeshFaceMaterial,A=!0===E?h.material.materials:null,l=h.material.side,v,u,D,C=i.precision;h.matrixRotationWorld.extractRotation(h.matrixWorld);b.copy(i.origin);g.getInverse(h.matrixWorld);c.copy(b);g.multiplyVector3(c);d.copy(i.direction);g.rotateAxis(d).normalize();for(var G=0,P=o.faces.length;G<P;G++){var B=o.faces[G],l=!0===E?A[B.materialIndex]:h.material;if(void 0!==l&&(l=l.side,e.sub(B.centroid,c),u=B.normal,v=d.dot(u),!(Math.abs(v)<C)&&(u=u.dot(e)/v,!(0>
+p=o.vertices,E=h.material instanceof a.MeshFaceMaterial,z=!0===E?h.material.materials:null,l=h.material.side,v,u,D,C=i.precision;h.matrixRotationWorld.extractRotation(h.matrixWorld);b.copy(i.origin);g.getInverse(h.matrixWorld);c.copy(b);g.multiplyVector3(c);d.copy(i.direction);g.rotateAxis(d).normalize();for(var G=0,P=o.faces.length;G<P;G++){var B=o.faces[G],l=!0===E?z[B.materialIndex]:h.material;if(void 0!==l&&(l=l.side,e.sub(B.centroid,c),u=B.normal,v=d.dot(u),!(Math.abs(v)<C)&&(u=u.dot(e)/v,!(0>
 u)&&(l===a.DoubleSide||(l===a.FrontSide?0>v:0<v)))))if(f.add(c,d.multiplyScalar(u)),B instanceof a.Face3)l=p[B.a],v=p[B.b],u=p[B.c],n(f,l,v,u)&&(v=h.matrixWorld.multiplyVector3(f.clone()),l=b.distanceTo(v),l<i.near||l>i.far||j.push({distance:l,point:v,face:B,faceIndex:G,object:h}));else if(B instanceof a.Face4&&(l=p[B.a],v=p[B.b],u=p[B.c],D=p[B.d],n(f,l,v,D)||n(f,v,u,D)))v=h.matrixWorld.multiplyVector3(f.clone()),l=b.distanceTo(v),l<i.near||l>i.far||j.push({distance:l,point:v,face:B,faceIndex:G,object:h})}}},
 o=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)p(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=[];!0===b&&o(a,this,c);p(a,this,c);c.sort(h);return c};a.Ray.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)p(a[d],this,c),!0===b&&o(a[d],this,c);c.sort(h);return c}})(THREE);
 THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b=0,c=0,d=0,e=0,f=0,g=0,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,l,m){h=!1;b=f;c=g;d=l;e=m;a()};this.addPoint=function(f,g){!0===h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>
@@ -79,16 +79,16 @@ this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix),this.matrixWorldN
 a.matrixWorld.copy(this.matrixWorld);a.matrixRotationWorld.copy(this.matrixRotationWorld);a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.quaternion.copy(this.quaternion);a.useQuaternion=this.useQuaternion;a.boundRadius=this.boundRadius;a.boundRadiusScale=this.boundRadiusScale;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;for(var b=0;b<this.children.length;b++)a.add(this.children[b].clone());
 return a},deallocate:function(){var a=THREE.Object3DLibrary.indexOf(this);-1!==a&&THREE.Object3DLibrary.splice(a,1)}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3D.defaultEulerOrder="XYZ";THREE.Object3DIdCount=0;THREE.Object3DLibrary=[];
 THREE.Projector=function(){function a(){if(f===h){var a=new THREE.RenderableObject;g.push(a);h++;f++;return a}return g[f++]}function b(){if(j===m){var a=new THREE.RenderableVertex;l.push(a);m++;j++;return a}return l[j++]}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<
-c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}var e,f,g=[],h=0,i,j,l=[],m=0,n,p,o=[],s=0,t,q=[],z=0,w,r,E=[],A=0,v,u,D=[],C=0,G={objects:[],sprites:[],lights:[],elements:[]},P=new THREE.Vector3,B=new THREE.Vector4,J=new THREE.Matrix4,H=new THREE.Matrix4,I=new THREE.Matrix3,L=new THREE.Frustum,N=new THREE.Vector4,S=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);J.multiply(b.projectionMatrix,b.matrixWorldInverse);J.multiplyVector3(a);return a};
+c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}var e,f,g=[],h=0,i,j,l=[],m=0,n,p,o=[],s=0,t,q=[],A=0,w,r,E=[],z=0,v,u,D=[],C=0,G={objects:[],sprites:[],lights:[],elements:[]},P=new THREE.Vector3,B=new THREE.Vector4,J=new THREE.Matrix4,H=new THREE.Matrix4,I=new THREE.Matrix3,L=new THREE.Frustum,N=new THREE.Vector4,S=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);J.multiply(b.projectionMatrix,b.matrixWorldInverse);J.multiplyVector3(a);return a};
 this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);J.multiply(b.matrixWorld,b.projectionMatrixInverse);J.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,m,Q){var Z=h.near,K=h.far,ja=!1,R,ga,fa,V,aa,ca,ia,Aa,ua,Ba,Ka,va,db,xb,Ua;u=r=t=p=0;G.elements.length=0;g.updateMatrixWorld();
 void 0===h.parent&&h.updateMatrixWorld();h.matrixWorldInverse.getInverse(h.matrixWorld);J.multiply(h.projectionMatrix,h.matrixWorldInverse);L.setFromMatrix(J);f=0;G.objects.length=0;G.sprites.length=0;G.lights.length=0;var gb=function(b){for(var c=0,d=b.children.length;c<d;c++){var f=b.children[c];if(!1!==f.visible){if(f instanceof THREE.Light)G.lights.push(f);else if(f instanceof THREE.Mesh||f instanceof THREE.Line){if(!1===f.frustumCulled||!0===L.contains(f))e=a(),e.object=f,null!==f.renderDepth?
 e.z=f.renderDepth:(P.copy(f.matrixWorld.getPosition()),J.multiplyVector3(P),e.z=P.z),G.objects.push(e)}else f instanceof THREE.Sprite||f instanceof THREE.Particle?(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(P.copy(f.matrixWorld.getPosition()),J.multiplyVector3(P),e.z=P.z),G.sprites.push(e)):(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(P.copy(f.matrixWorld.getPosition()),J.multiplyVector3(P),e.z=P.z),G.objects.push(e));gb(f)}}};gb(g);!0===m&&G.objects.sort(c);g=0;for(m=G.objects.length;g<
 m;g++)if(Aa=G.objects[g].object,ua=Aa.matrixWorld,j=0,Aa instanceof THREE.Mesh){Ba=Aa.geometry;fa=Ba.vertices;Ka=Ba.faces;Ba=Ba.faceVertexUvs;I.getInverse(ua);I.transpose();db=Aa.material instanceof THREE.MeshFaceMaterial;xb=!0===db?Aa.material:null;R=0;for(ga=fa.length;R<ga;R++)i=b(),i.positionWorld.copy(fa[R]),ua.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),J.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,
 i.visible=i.positionScreen.z>Z&&i.positionScreen.z<K;fa=0;for(R=Ka.length;fa<R;fa++)if(ga=Ka[fa],Ua=!0===db?xb.materials[ga.materialIndex]:Aa.material,void 0!==Ua){ca=Ua.side;if(ga instanceof THREE.Face3)if(V=l[ga.a],aa=l[ga.b],ia=l[ga.c],!0===V.visible&&!0===aa.visible&&!0===ia.visible)if(ja=0>(ia.positionScreen.x-V.positionScreen.x)*(aa.positionScreen.y-V.positionScreen.y)-(ia.positionScreen.y-V.positionScreen.y)*(aa.positionScreen.x-V.positionScreen.x),ca===THREE.DoubleSide||ja===(ca===THREE.FrontSide))p===
 s?(va=new THREE.RenderableFace3,o.push(va),s++,p++,n=va):n=o[p++],n.v1.copy(V),n.v2.copy(aa),n.v3.copy(ia);else continue;else continue;else if(ga instanceof THREE.Face4)if(V=l[ga.a],aa=l[ga.b],ia=l[ga.c],va=l[ga.d],!0===V.visible&&!0===aa.visible&&!0===ia.visible&&!0===va.visible)if(ja=0>(va.positionScreen.x-V.positionScreen.x)*(aa.positionScreen.y-V.positionScreen.y)-(va.positionScreen.y-V.positionScreen.y)*(aa.positionScreen.x-V.positionScreen.x)||0>(aa.positionScreen.x-ia.positionScreen.x)*(va.positionScreen.y-
-ia.positionScreen.y)-(aa.positionScreen.y-ia.positionScreen.y)*(va.positionScreen.x-ia.positionScreen.x),ca===THREE.DoubleSide||ja===(ca===THREE.FrontSide)){if(t===z){var lb=new THREE.RenderableFace4;q.push(lb);z++;t++;n=lb}else n=q[t++];n.v1.copy(V);n.v2.copy(aa);n.v3.copy(ia);n.v4.copy(va)}else continue;else continue;n.normalWorld.copy(ga.normal);!1===ja&&(ca===THREE.BackSide||ca===THREE.DoubleSide)&&n.normalWorld.negate();I.multiplyVector3(n.normalWorld).normalize();n.centroidWorld.copy(ga.centroid);
+ia.positionScreen.y)-(aa.positionScreen.y-ia.positionScreen.y)*(va.positionScreen.x-ia.positionScreen.x),ca===THREE.DoubleSide||ja===(ca===THREE.FrontSide)){if(t===A){var lb=new THREE.RenderableFace4;q.push(lb);A++;t++;n=lb}else n=q[t++];n.v1.copy(V);n.v2.copy(aa);n.v3.copy(ia);n.v4.copy(va)}else continue;else continue;n.normalWorld.copy(ga.normal);!1===ja&&(ca===THREE.BackSide||ca===THREE.DoubleSide)&&n.normalWorld.negate();I.multiplyVector3(n.normalWorld).normalize();n.centroidWorld.copy(ga.centroid);
 ua.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);J.multiplyVector3(n.centroidScreen);ia=ga.vertexNormals;V=0;for(aa=ia.length;V<aa;V++)va=n.vertexNormalsWorld[V],va.copy(ia[V]),!1===ja&&(ca===THREE.BackSide||ca===THREE.DoubleSide)&&va.negate(),I.multiplyVector3(va).normalize();n.vertexNormalsLength=ia.length;V=0;for(aa=Ba.length;V<aa;V++)if(va=Ba[V][fa],void 0!==va){ca=0;for(ia=va.length;ca<ia;ca++)n.uvs[V][ca]=va[ca]}n.color=ga.color;n.material=Ua;n.z=n.centroidScreen.z;
-G.elements.push(n)}}else if(Aa instanceof THREE.Line){H.multiply(J,ua);fa=Aa.geometry.vertices;V=b();V.positionScreen.copy(fa[0]);H.multiplyVector4(V.positionScreen);ua=Aa.type===THREE.LinePieces?2:1;R=1;for(ga=fa.length;R<ga;R++)V=b(),V.positionScreen.copy(fa[R]),H.multiplyVector4(V.positionScreen),0<(R+1)%ua||(aa=l[j-2],N.copy(V.positionScreen),S.copy(aa.positionScreen),!0===d(N,S)&&(N.multiplyScalar(1/N.w),S.multiplyScalar(1/S.w),r===A?(Ka=new THREE.RenderableLine,E.push(Ka),A++,r++,w=Ka):w=E[r++],
+G.elements.push(n)}}else if(Aa instanceof THREE.Line){H.multiply(J,ua);fa=Aa.geometry.vertices;V=b();V.positionScreen.copy(fa[0]);H.multiplyVector4(V.positionScreen);ua=Aa.type===THREE.LinePieces?2:1;R=1;for(ga=fa.length;R<ga;R++)V=b(),V.positionScreen.copy(fa[R]),H.multiplyVector4(V.positionScreen),0<(R+1)%ua||(aa=l[j-2],N.copy(V.positionScreen),S.copy(aa.positionScreen),!0===d(N,S)&&(N.multiplyScalar(1/N.w),S.multiplyScalar(1/S.w),r===z?(Ka=new THREE.RenderableLine,E.push(Ka),z++,r++,w=Ka):w=E[r++],
 w.v1.positionScreen.copy(N),w.v2.positionScreen.copy(S),w.z=Math.max(N.z,S.z),w.material=Aa.material,G.elements.push(w)))}g=0;for(m=G.sprites.length;g<m;g++)Aa=G.sprites[g].object,ua=Aa.matrixWorld,Aa instanceof THREE.Particle&&(B.set(ua.elements[12],ua.elements[13],ua.elements[14],1),J.multiplyVector4(B),B.z/=B.w,0<B.z&&1>B.z&&(u===C?(Z=new THREE.RenderableParticle,D.push(Z),C++,u++,v=Z):v=D[u++],v.object=Aa,v.x=B.x/B.w,v.y=B.y/B.w,v.z=B.z,v.rotation=Aa.rotation.z,v.scale.x=Aa.scale.x*Math.abs(v.x-
 (B.x+h.projectionMatrix.elements[0])/(B.w+h.projectionMatrix.elements[12])),v.scale.y=Aa.scale.y*Math.abs(v.y-(B.y+h.projectionMatrix.elements[5])/(B.w+h.projectionMatrix.elements[13])),v.material=Aa.material,G.elements.push(v)));!0===Q&&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=void 0!==d?d:1};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),e=Math.cos(a.z/2),f=Math.sin(a.x/2),g=Math.sin(a.y/2),h=Math.sin(a.z/2);void 0===b||"XYZ"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e-f*g*h):"YXZ"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*
@@ -114,8 +114,8 @@ d instanceof THREE.Face4&&(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d
 computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;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,j;c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,j=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(i),h.push(j)}g=this.morphNormals[a];f.vertices=
 this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=g.faceNormals[c],j=g.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2])):(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2]),j.d.copy(e.vertexNormals[3]))}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,
-e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,d,e,f,u){h=a.vertices[b];i=a.vertices[c];j=a.vertices[d];l=g[e];m=g[f];n=g[u];p=i.x-h.x;o=j.x-h.x;s=i.y-h.y;t=j.y-h.y;q=i.z-h.z;z=j.z-h.z;w=m.u-l.u;r=n.u-l.u;E=m.v-l.v;A=n.v-l.v;v=1/(w*A-r*E);G.set((A*p-E*o)*v,(A*s-E*t)*v,(A*q-E*z)*v);P.set((w*o-r*p)*v,(w*t-r*s)*v,(w*z-r*q)*v);D[b].addSelf(G);D[c].addSelf(G);D[d].addSelf(G);C[b].addSelf(P);C[c].addSelf(P);C[d].addSelf(P)}var b,c,d,e,f,g,h,i,j,l,m,n,p,o,s,t,q,z,
-w,r,E,A,v,u,D=[],C=[],G=new THREE.Vector3,P=new THREE.Vector3,B=new THREE.Vector3,J=new THREE.Vector3,H=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)D[b]=new THREE.Vector3,C[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var I=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<
+e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,d,e,f,u){h=a.vertices[b];i=a.vertices[c];j=a.vertices[d];l=g[e];m=g[f];n=g[u];p=i.x-h.x;o=j.x-h.x;s=i.y-h.y;t=j.y-h.y;q=i.z-h.z;A=j.z-h.z;w=m.u-l.u;r=n.u-l.u;E=m.v-l.v;z=n.v-l.v;v=1/(w*z-r*E);G.set((z*p-E*o)*v,(z*s-E*t)*v,(z*q-E*A)*v);P.set((w*o-r*p)*v,(w*t-r*s)*v,(w*A-r*q)*v);D[b].addSelf(G);D[c].addSelf(G);D[d].addSelf(G);C[b].addSelf(P);C[c].addSelf(P);C[d].addSelf(P)}var b,c,d,e,f,g,h,i,j,l,m,n,p,o,s,t,q,A,
+w,r,E,z,v,u,D=[],C=[],G=new THREE.Vector3,P=new THREE.Vector3,B=new THREE.Vector3,J=new THREE.Vector3,H=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)D[b]=new THREE.Vector3,C[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var I=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<
 f.vertexNormals.length;d++)H.copy(f.vertexNormals[d]),e=f[I[d]],u=D[e],B.copy(u),B.subSelf(H.multiplyScalar(H.dot(u))).normalize(),J.cross(f.vertexNormals[d],u),e=J.dot(C[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(B.x,B.y,B.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){this.boundingBox||(this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3});
 if(0<this.vertices.length){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,e=this.vertices.length;d<e;d++)(a=this.vertices[d],a.x<b.x?b.x=a.x:a.x>c.x&&(c.x=a.x),a.y<b.y?b.y=a.y:a.y>c.y&&(c.y=a.y),a.z<b.z)?b.z=a.z: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;null===this.boundingSphere&&(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,e=Math.pow(10,4),f,g,h,i;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];f=0;for(g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];
@@ -124,11 +124,11 @@ 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=
 THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;this.attributes.position&&(b=this.attributes.position.array);this.attributes.normal&&(c=this.attributes.normal.array);void 0!==b&&(a.multiplyVector3Array(b),this.verticesNeedUpdate=!0);void 0!==c&&(b=new THREE.Matrix3,b.getInverse(a).transpose(),b.multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){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,e,f=0,g=a.length;f<g;f+=3)(c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z)?b.min.z=e:e>b.max.z&&(b.max.z=e);if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){this.boundingSphere||(this.boundingSphere={radius:0});
 var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,g=a.length;f<g;f+=3)b=a[f],d=a[f+1],e=a[f+2],b=b*b+d*d+e*e,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(void 0===this.attributes.normal)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 e=this.offsets,f=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,i,j,l,m,n,p,o=new THREE.Vector3,s=new THREE.Vector3,t=new THREE.Vector3,q=new THREE.Vector3,z=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){b=e[c].start;i=e[c].count;var w=e[c].index;a=b;for(b+=i;a<b;a+=3)i=w+f[a],j=w+f[a+1],l=w+f[a+2],m=g[3*i],n=g[3*i+1],p=g[3*i+2],o.set(m,n,p),m=g[3*j],n=g[3*j+1],p=g[3*j+2],s.set(m,n,p),m=g[3*l],n=g[3*l+1],p=g[3*l+2],t.set(m,n,p),q.sub(t,s),z.sub(o,
-s),q.crossSelf(z),h[3*i]+=q.x,h[3*i+1]+=q.y,h[3*i+2]+=q.z,h[3*j]+=q.x,h[3*j+1]+=q.y,h[3*j+2]+=q.z,h[3*l]+=q.x,h[3*l+1]+=q.y,h[3*l+2]+=q.z}this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a){U.x=d[3*a];U.y=d[3*a+1];U.z=d[3*a+2];M.copy(U);Q=i[a];N.copy(Q);N.subSelf(U.multiplyScalar(U.dot(Q))).normalize();
+0}var e=this.offsets,f=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,i,j,l,m,n,p,o=new THREE.Vector3,s=new THREE.Vector3,t=new THREE.Vector3,q=new THREE.Vector3,A=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){b=e[c].start;i=e[c].count;var w=e[c].index;a=b;for(b+=i;a<b;a+=3)i=w+f[a],j=w+f[a+1],l=w+f[a+2],m=g[3*i],n=g[3*i+1],p=g[3*i+2],o.set(m,n,p),m=g[3*j],n=g[3*j+1],p=g[3*j+2],s.set(m,n,p),m=g[3*l],n=g[3*l+1],p=g[3*l+2],t.set(m,n,p),q.sub(t,s),A.sub(o,
+s),q.crossSelf(A),h[3*i]+=q.x,h[3*i+1]+=q.y,h[3*i+2]+=q.z,h[3*j]+=q.x,h[3*j+1]+=q.y,h[3*j+2]+=q.z,h[3*l]+=q.x,h[3*l+1]+=q.y,h[3*l+2]+=q.z}this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a){U.x=d[3*a];U.y=d[3*a+1];U.z=d[3*a+2];M.copy(U);Q=i[a];N.copy(Q);N.subSelf(U.multiplyScalar(U.dot(Q))).normalize();
 S.cross(M,Q);Z=S.dot(j[a]);O=0>Z?-1:1;h[4*a]=N.x;h[4*a+1]=N.y;h[4*a+2]=N.z;h[4*a+3]=O}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)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,e=this.attributes.uv.array,f=c.length/3;if(void 0===this.attributes.tangent){var g=
-4*f;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,i=[],j=[],g=0;g<f;g++)i[g]=new THREE.Vector3,j[g]=new THREE.Vector3;var l,m,n,p,o,s,t,q,z,w,r,E,A,v,u,f=new THREE.Vector3,g=new THREE.Vector3,D,C,G,P,B,J,H,I=this.offsets;G=0;for(P=I.length;G<P;++G){C=I[G].start;B=I[G].count;var L=I[G].index;D=C;for(C+=B;D<C;D+=3)B=L+b[D],J=L+b[D+1],H=L+b[D+2],l=c[3*B],m=c[3*B+1],n=c[3*B+2],p=c[3*J],o=c[3*J+1],s=c[3*J+2],t=c[3*H],q=c[3*H+1],z=c[3*
-H+2],w=e[2*B],r=e[2*B+1],E=e[2*J],A=e[2*J+1],v=e[2*H],u=e[2*H+1],p-=l,l=t-l,o-=m,m=q-m,s-=n,n=z-n,E-=w,w=v-w,A-=r,r=u-r,u=1/(E*r-w*A),f.set((r*p-A*l)*u,(r*o-A*m)*u,(r*s-A*n)*u),g.set((E*l-w*p)*u,(E*m-w*o)*u,(E*n-w*s)*u),i[B].addSelf(f),i[J].addSelf(f),i[H].addSelf(f),j[B].addSelf(g),j[J].addSelf(g),j[H].addSelf(g)}var N=new THREE.Vector3,S=new THREE.Vector3,U=new THREE.Vector3,M=new THREE.Vector3,O,Q,Z;G=0;for(P=I.length;G<P;++G){C=I[G].start;B=I[G].count;L=I[G].index;D=C;for(C+=B;D<C;D+=3)B=L+b[D],
+4*f;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,i=[],j=[],g=0;g<f;g++)i[g]=new THREE.Vector3,j[g]=new THREE.Vector3;var l,m,n,p,o,s,t,q,A,w,r,E,z,v,u,f=new THREE.Vector3,g=new THREE.Vector3,D,C,G,P,B,J,H,I=this.offsets;G=0;for(P=I.length;G<P;++G){C=I[G].start;B=I[G].count;var L=I[G].index;D=C;for(C+=B;D<C;D+=3)B=L+b[D],J=L+b[D+1],H=L+b[D+2],l=c[3*B],m=c[3*B+1],n=c[3*B+2],p=c[3*J],o=c[3*J+1],s=c[3*J+2],t=c[3*H],q=c[3*H+1],A=c[3*
+H+2],w=e[2*B],r=e[2*B+1],E=e[2*J],z=e[2*J+1],v=e[2*H],u=e[2*H+1],p-=l,l=t-l,o-=m,m=q-m,s-=n,n=A-n,E-=w,w=v-w,z-=r,r=u-r,u=1/(E*r-w*z),f.set((r*p-z*l)*u,(r*o-z*m)*u,(r*s-z*n)*u),g.set((E*l-w*p)*u,(E*m-w*o)*u,(E*n-w*s)*u),i[B].addSelf(f),i[J].addSelf(f),i[H].addSelf(f),j[B].addSelf(g),j[J].addSelf(g),j[H].addSelf(g)}var N=new THREE.Vector3,S=new THREE.Vector3,U=new THREE.Vector3,M=new THREE.Vector3,O,Q,Z;G=0;for(P=I.length;G<P;++G){C=I[G].start;B=I[G].count;L=I[G].index;D=C;for(C+=B;D<C;D+=3)B=L+b[D],
 J=L+b[D+1],H=L+b[D+2],a(B),a(J),a(H)}this.tangentsNeedUpdate=this.hasTangents=!0}},deallocate:function(){var a=THREE.GeometryLibrary.indexOf(this);-1!==a&&THREE.GeometryLibrary.splice(a,1)}};
 THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,j,l,m,n;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
 f+2;j=this.points[c[0]];l=this.points[c[1]];m=this.points[c[2]];n=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,l.x,m.x,n.x,g,h,i);d.y=b(j.y,l.y,m.y,n.y,g,h,i);d.z=b(j.z,l.z,m.z,n.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=
@@ -146,8 +146,8 @@ THREE.SpotLight=function(a,b,c,d,e){THREE.Light.call(this,a);this.position=new T
 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(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=THREE.Loader.prototype.createMaterial(a[d],b);return c},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/
-Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,h,i,j,t){var q=f.toLowerCase().endsWith(".dds"),z=b+"/"+f;if(q){var w=THREE.ImageUtils.loadCompressedTexture(z);a[e]=w}else w=document.createElement("canvas"),a[e]=new THREE.Texture(w);a[e].sourceFile=f;if(h&&(a[e].repeat.set(h[0],h[1]),1!==h[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==h[1]))a[e].wrapT=THREE.RepeatWrapping;i&&a[e].offset.set(i[0],i[1]);if(j&&(f={repeat:THREE.RepeatWrapping,
-mirror:THREE.MirroredRepeatWrapping},void 0!==f[j[0]]&&(a[e].wrapS=f[j[0]]),void 0!==f[j[1]]))a[e].wrapT=f[j[1]];t&&(a[e].anisotropy=t);if(!q){var r=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);r.image.width=a;r.image.height=b;r.image.getContext("2d").drawImage(this,0,0,a,b)}else r.image=this;r.needsUpdate=true};a.crossOrigin=g.crossOrigin;a.src=z}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var g=this,h="MeshLambertMaterial",
+Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,h,i,j,t){var q=f.toLowerCase().endsWith(".dds"),A=b+"/"+f;if(q){var w=THREE.ImageUtils.loadCompressedTexture(A);a[e]=w}else w=document.createElement("canvas"),a[e]=new THREE.Texture(w);a[e].sourceFile=f;if(h&&(a[e].repeat.set(h[0],h[1]),1!==h[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==h[1]))a[e].wrapT=THREE.RepeatWrapping;i&&a[e].offset.set(i[0],i[1]);if(j&&(f={repeat:THREE.RepeatWrapping,
+mirror:THREE.MirroredRepeatWrapping},void 0!==f[j[0]]&&(a[e].wrapS=f[j[0]]),void 0!==f[j[1]]))a[e].wrapT=f[j[1]];t&&(a[e].anisotropy=t);if(!q){var r=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);r.image.width=a;r.image.height=b;r.image.getContext("2d").drawImage(this,0,0,a,b)}else r.image=this;r.needsUpdate=true};a.crossOrigin=g.crossOrigin;a.src=A}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var g=this,h="MeshLambertMaterial",
 i={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var j=a.shading.toLowerCase();"phong"===j?h="MeshPhongMaterial":"basic"===j&&(h="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(i.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==
 a.flipSided&&(i.side=THREE.BackSide);void 0!==a.doubleSided&&(i.side=THREE.DoubleSide);void 0!==a.wireframe&&(i.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===a.vertexColors?i.vertexColors=THREE.FaceColors:a.vertexColors&&(i.vertexColors=THREE.VertexColors));a.colorDiffuse?i.color=f(a.colorDiffuse):a.DbgColor&&(i.color=a.DbgColor);a.colorSpecular&&(i.specular=f(a.colorSpecular));a.colorAmbient&&(i.ambient=f(a.colorAmbient));a.transparency&&(i.opacity=a.transparency);a.specularCoef&&(i.shininess=
 a.specularCoef);a.mapDiffuse&&b&&e(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&e(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&e(i,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&e(i,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&e(i,"specularMap",
@@ -157,36 +157,35 @@ THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c&&"string"===typeof c
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(4==g.readyState)if(200==g.status||0==g.status){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,!0);g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){if(4==f.readyState)if(200==f.status||0==f.status){var c=f.response;void 0===c&&(c=(new Uint8Array(f.responseBody)).buffer);THREE.BinaryLoader.prototype.createBinModel(c,b,d,a.materials)}else console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else 3==f.readyState?e&&(0==h&&(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):
 2==f.readyState&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",g,!0);f.responseType="arraybuffer";f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,j,l,m,n,p,o,s,t,q,z,w,r;function E(a){return a%4?4-a%4:0}function A(a,b){return(new Uint8Array(a,b,1))[0]}function v(a,b){return(new Uint32Array(a,b,1))[0]}function u(b,c){var d,e,f,g,h,i,j,l,n=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=n[3*d];f=n[3*d+1];g=n[3*d+2];h=L[2*e];e=L[2*e+1];i=L[2*f];j=L[2*f+1];f=L[2*g];l=L[2*g+1];g=J.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,j));m.push(new THREE.UV(f,
-l));g.push(m)}}function D(b,c){var d,e,f,g,h,i,j,l,n,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[4*d];f=o[4*d+1];g=o[4*d+2];h=o[4*d+3];i=L[2*e];e=L[2*e+1];j=L[2*f];n=L[2*f+1];l=L[2*g];m=L[2*g+1];g=L[2*h];f=L[2*h+1];h=J.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(j,n));p.push(new THREE.UV(l,m));p.push(new THREE.UV(g,f));h.push(p)}}function C(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*d+1],g=c[3*d+2],h=i[d],
-J.faces.push(new THREE.Face3(e,f,g,null,null,h))}function G(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],J.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function P(b,c,d,e){for(var f,g,h,i,j,l,n,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];l=d[3*e+1];n=d[3*e+2];i=m[e];var o=I[3*l],p=I[3*l+1];l=I[3*l+2];var s=I[3*n],q=
-I[3*n+1];n=I[3*n+2];J.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(I[3*j],I[3*j+1],I[3*j+2]),new THREE.Vector3(o,p,l),new THREE.Vector3(s,q,n)],null,i))}}function B(b,c,d,e){for(var f,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,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];l=d[4*e];n=d[4*e+1];m=d[4*e+2];o=d[4*e+3];j=p[e];var s=I[3*n],q=I[3*n+1];n=I[3*n+2];var r=I[3*m],t=I[3*m+1];m=I[3*m+2];var u=I[3*o],v=I[3*o+1];o=I[3*o+2];J.faces.push(new THREE.Face4(f,
-g,h,i,[new THREE.Vector3(I[3*l],I[3*l+1],I[3*l+2]),new THREE.Vector3(s,q,n),new THREE.Vector3(r,t,m),new THREE.Vector3(u,v,o)],null,j))}}var J=this,H=0,I=[],L=[],N,S,U;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(J,d,b);r=a;S=H;b=new Uint8Array(r,S,12);s="";for(z=0;12>z;z++)s+=String.fromCharCode(b[S+z]);c=A(r,S+12);A(r,S+13);A(r,S+14);A(r,S+15);e=A(r,S+16);i=A(r,S+17);j=A(r,S+18);l=A(r,S+19);m=v(r,S+20);n=v(r,S+20+4);p=v(r,S+20+8);o=v(r,S+20+12);s=v(r,S+20+16);t=v(r,S+20+20);q=
-v(r,S+20+24);z=v(r,S+20+28);b=v(r,S+20+32);w=v(r,S+20+36);r=v(r,S+20+40);H+=c;S=3*e+l;U=4*e+l;N=o*S;c=s*(S+3*i);e=t*(S+3*j);l=q*(S+3*i+3*j);S=z*U;i=b*(U+4*i);j=w*(U+4*j);U=H;var H=new Float32Array(a,H,3*m),M,O,Q,Z;for(M=0;M<m;M++)O=H[3*M],Q=H[3*M+1],Z=H[3*M+2],J.vertices.push(new THREE.Vector3(O,Q,Z));m=H=U+3*m*Float32Array.BYTES_PER_ELEMENT;if(n){H=new Int8Array(a,H,3*n);for(U=0;U<n;U++)M=H[3*U],O=H[3*U+1],Q=H[3*U+2],I.push(M/127,O/127,Q/127)}H=m+3*n*Int8Array.BYTES_PER_ELEMENT;n=H+=E(3*n);if(p){H=
-new Float32Array(a,H,2*p);for(m=0;m<p;m++)U=H[2*m],M=H[2*m+1],L.push(U,M)}p=H=n+2*p*Float32Array.BYTES_PER_ELEMENT;N=p+N+E(2*o);n=N+c+E(2*s);c=n+e+E(2*t);e=c+l+E(2*q);S=e+S+E(2*z);l=S+i+E(2*b);i=l+j+E(2*w);t&&(j=n+3*t*Uint32Array.BYTES_PER_ELEMENT,C(t,n,j+3*t*Uint32Array.BYTES_PER_ELEMENT),u(t,j));q&&(t=c+3*q*Uint32Array.BYTES_PER_ELEMENT,j=t+3*q*Uint32Array.BYTES_PER_ELEMENT,P(q,c,t,j+3*q*Uint32Array.BYTES_PER_ELEMENT),u(q,j));w&&(q=l+4*w*Uint32Array.BYTES_PER_ELEMENT,G(w,l,q+4*w*Uint32Array.BYTES_PER_ELEMENT),
-D(w,q));r&&(w=i+4*r*Uint32Array.BYTES_PER_ELEMENT,q=w+4*r*Uint32Array.BYTES_PER_ELEMENT,B(r,i,w,q+4*r*Uint32Array.BYTES_PER_ELEMENT),D(r,q));o&&C(o,p,p+3*o*Uint32Array.BYTES_PER_ELEMENT);s&&(o=N+3*s*Uint32Array.BYTES_PER_ELEMENT,P(s,N,o,o+3*s*Uint32Array.BYTES_PER_ELEMENT));z&&G(z,e,e+4*z*Uint32Array.BYTES_PER_ELEMENT);b&&(s=S+4*b*Uint32Array.BYTES_PER_ELEMENT,B(b,S,s,s+4*b*Uint32Array.BYTES_PER_ELEMENT));this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};
-e.prototype=Object.create(THREE.Geometry.prototype);b(new e(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
-THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b){var c=this;void 0===b&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},!1);b.addEventListener("error",function(){c.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);c.crossOrigin&&(b.crossOrigin=c.crossOrigin);b.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);
-THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(){var b,c,d,e,j,l,m,n,p,o,s,t,q,A,w,r;function E(a){return a%4?4-a%4:0}function z(a,b){return(new Uint8Array(a,b,1))[0]}function v(a,b){return(new Uint32Array(a,b,1))[0]}function u(b,c){var d,e,f,g,h,i,j,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++)e=l[3*d],f=l[3*d+1],g=l[3*d+2],h=L[2*e],e=L[2*e+1],i=L[2*f],j=L[2*f+1],f=L[2*g],g=L[2*g+1],J.faceVertexUvs[0].push([new THREE.UV(h,e),new THREE.UV(i,j),new THREE.UV(f,g)])}function D(b,
+c){var d,e,f,g,h,i,j,l,n,m=new Uint32Array(a,c,4*b);for(d=0;d<b;d++)e=m[4*d],f=m[4*d+1],g=m[4*d+2],h=m[4*d+3],i=L[2*e],e=L[2*e+1],j=L[2*f],l=L[2*f+1],f=L[2*g],n=L[2*g+1],g=L[2*h],h=L[2*h+1],J.faceVertexUvs[0].push([new THREE.UV(i,e),new THREE.UV(j,l),new THREE.UV(f,n),new THREE.UV(g,h)])}function C(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*d+1],g=c[3*d+2],h=i[d],J.faces.push(new THREE.Face3(e,f,g,null,null,h))}function G(b,c,d){for(var e,
+f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],J.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function P(b,c,d,e){for(var f,g,h,i,j,l,n,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];l=d[3*e+1];n=d[3*e+2];i=m[e];var o=I[3*l],p=I[3*l+1];l=I[3*l+2];var s=I[3*n],q=I[3*n+1];n=I[3*n+2];J.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(I[3*
+j],I[3*j+1],I[3*j+2]),new THREE.Vector3(o,p,l),new THREE.Vector3(s,q,n)],null,i))}}function B(b,c,d,e){for(var f,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,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];l=d[4*e];n=d[4*e+1];m=d[4*e+2];o=d[4*e+3];j=p[e];var s=I[3*n],q=I[3*n+1];n=I[3*n+2];var r=I[3*m],t=I[3*m+1];m=I[3*m+2];var u=I[3*o],v=I[3*o+1];o=I[3*o+2];J.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(I[3*l],I[3*l+1],I[3*l+2]),new THREE.Vector3(s,
+q,n),new THREE.Vector3(r,t,m),new THREE.Vector3(u,v,o)],null,j))}}var J=this,H=0,I=[],L=[],N,S,U;THREE.Geometry.call(this);r=a;S=H;A=new Uint8Array(r,S,12);o="";for(q=0;12>q;q++)o+=String.fromCharCode(A[S+q]);b=z(r,S+12);z(r,S+13);z(r,S+14);z(r,S+15);c=z(r,S+16);d=z(r,S+17);e=z(r,S+18);j=z(r,S+19);l=v(r,S+20);m=v(r,S+20+4);n=v(r,S+20+8);p=v(r,S+20+12);o=v(r,S+20+16);s=v(r,S+20+20);t=v(r,S+20+24);q=v(r,S+20+28);A=v(r,S+20+32);w=v(r,S+20+36);r=v(r,S+20+40);H+=b;S=3*c+j;U=4*c+j;N=p*S;b=o*(S+3*d);c=s*
+(S+3*e);j=t*(S+3*d+3*e);S=q*U;d=A*(U+4*d);e=w*(U+4*e);U=H;var H=new Float32Array(a,H,3*l),M,O,Q,Z;for(M=0;M<l;M++)O=H[3*M],Q=H[3*M+1],Z=H[3*M+2],J.vertices.push(new THREE.Vector3(O,Q,Z));l=H=U+3*l*Float32Array.BYTES_PER_ELEMENT;if(m){H=new Int8Array(a,H,3*m);for(U=0;U<m;U++)M=H[3*U],O=H[3*U+1],Q=H[3*U+2],I.push(M/127,O/127,Q/127)}H=l+3*m*Int8Array.BYTES_PER_ELEMENT;m=H+=E(3*m);if(n){l=new Float32Array(a,H,2*n);for(H=0;H<n;H++)U=l[2*H],M=l[2*H+1],L.push(U,M)}n=H=m+2*n*Float32Array.BYTES_PER_ELEMENT;
+N=n+N+E(2*p);m=N+b+E(2*o);b=m+c+E(2*s);c=b+j+E(2*t);S=c+S+E(2*q);j=S+d+E(2*A);d=j+e+E(2*w);s&&(e=m+3*s*Uint32Array.BYTES_PER_ELEMENT,C(s,m,e+3*s*Uint32Array.BYTES_PER_ELEMENT),u(s,e));t&&(s=b+3*t*Uint32Array.BYTES_PER_ELEMENT,e=s+3*t*Uint32Array.BYTES_PER_ELEMENT,P(t,b,s,e+3*t*Uint32Array.BYTES_PER_ELEMENT),u(t,e));w&&(t=j+4*w*Uint32Array.BYTES_PER_ELEMENT,G(w,j,t+4*w*Uint32Array.BYTES_PER_ELEMENT),D(w,t));r&&(w=d+4*r*Uint32Array.BYTES_PER_ELEMENT,t=w+4*r*Uint32Array.BYTES_PER_ELEMENT,B(r,d,w,t+4*
+r*Uint32Array.BYTES_PER_ELEMENT),D(r,t));p&&C(p,n,n+3*p*Uint32Array.BYTES_PER_ELEMENT);o&&(p=N+3*o*Uint32Array.BYTES_PER_ELEMENT,P(o,N,p,p+3*o*Uint32Array.BYTES_PER_ELEMENT));q&&G(q,c,c+4*q*Uint32Array.BYTES_PER_ELEMENT);A&&(o=S+4*A*Uint32Array.BYTES_PER_ELEMENT,B(A,S,o,o+4*A*Uint32Array.BYTES_PER_ELEMENT));this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=Object.create(THREE.Geometry.prototype);b(new e(c),this.initMaterials(d,
+c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b){var c=this;void 0===b&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},!1);b.addEventListener("error",function(){c.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);c.crossOrigin&&(b.crossOrigin=c.crossOrigin);b.src=a}};
+THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.withCredentials=this.withCredentials;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===
 f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1,f,g,h,i,j,l,m,n,p,o,s,t,q,z,w,r=a.faces;o=a.vertices;var E=a.normals,A=a.colors,v=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&v++;for(f=0;f<v;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];i=0;for(j=o.length;i<j;)l=new THREE.Vector3,l.x=o[i++]*e,l.y=o[i++]*e,l.z=o[i++]*e,d.vertices.push(l);i=0;for(j=r.length;i<j;){o=r[i++];l=o&1;h=o&2;f=o&4;g=o&8;n=o&16;m=o&32;s=o&64;o&=128;l?(t=new THREE.Face4,
-t.a=r[i++],t.b=r[i++],t.c=r[i++],t.d=r[i++],l=4):(t=new THREE.Face3,t.a=r[i++],t.b=r[i++],t.c=r[i++],l=3);h&&(h=r[i++],t.materialIndex=h);h=d.faces.length;if(f)for(f=0;f<v;f++)q=a.uvs[f],p=r[i++],w=q[2*p],p=q[2*p+1],d.faceUvs[f][h]=new THREE.UV(w,p);if(g)for(f=0;f<v;f++){q=a.uvs[f];z=[];for(g=0;g<l;g++)p=r[i++],w=q[2*p],p=q[2*p+1],z[g]=new THREE.UV(w,p);d.faceVertexUvs[f][h]=z}n&&(n=3*r[i++],g=new THREE.Vector3,g.x=E[n++],g.y=E[n++],g.z=E[n],t.normal=g);if(m)for(f=0;f<l;f++)n=3*r[i++],g=new THREE.Vector3,
-g.x=E[n++],g.y=E[n++],g.z=E[n],t.vertexNormals.push(g);s&&(m=r[i++],m=new THREE.Color(A[m]),t.color=m);if(o)for(f=0;f<l;f++)m=r[i++],m=new THREE.Color(A[m]),t.vertexColors.push(m);d.faces.push(t)}if(a.skinWeights){i=0;for(j=a.skinWeights.length;i<j;i+=2)r=a.skinWeights[i],E=a.skinWeights[i+1],d.skinWeights.push(new THREE.Vector4(r,E,0,0))}if(a.skinIndices){i=0;for(j=a.skinIndices.length;i<j;i+=2)r=a.skinIndices[i],E=a.skinIndices[i+1],d.skinIndices.push(new THREE.Vector4(r,E,0,0))}d.bones=a.bones;
-d.animation=a.animation;if(void 0!==a.morphTargets){i=0;for(j=a.morphTargets.length;i<j;i++){d.morphTargets[i]={};d.morphTargets[i].name=a.morphTargets[i].name;d.morphTargets[i].vertices=[];A=d.morphTargets[i].vertices;v=a.morphTargets[i].vertices;r=0;for(E=v.length;r<E;r+=3)o=new THREE.Vector3,o.x=v[r]*e,o.y=v[r+1]*e,o.z=v[r+2]*e,A.push(o)}}if(void 0!==a.morphColors){i=0;for(j=a.morphColors.length;i<j;i++){d.morphColors[i]={};d.morphColors[i].name=a.morphColors[i].name;d.morphColors[i].colors=[];
-E=d.morphColors[i].colors;A=a.morphColors[i].colors;e=0;for(r=A.length;e<r;e+=3)v=new THREE.Color(16755200),v.setRGB(A[e],A[e+1],A[e+2]),E.push(v)}}d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();a=this.initMaterials(a.materials,c);b(d,a)};
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1,f,g,h,i,j,l,m,n,p,o,s,t,q,A,w,r=a.faces;o=a.vertices;var E=a.normals,z=a.colors,v=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&v++;for(f=0;f<v;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];i=0;for(j=o.length;i<j;)l=new THREE.Vector3,l.x=o[i++]*e,l.y=o[i++]*e,l.z=o[i++]*e,d.vertices.push(l);i=0;for(j=r.length;i<j;){o=r[i++];l=o&1;h=o&2;f=o&4;g=o&8;n=o&16;m=o&32;s=o&64;o&=128;l?(t=new THREE.Face4,
+t.a=r[i++],t.b=r[i++],t.c=r[i++],t.d=r[i++],l=4):(t=new THREE.Face3,t.a=r[i++],t.b=r[i++],t.c=r[i++],l=3);h&&(h=r[i++],t.materialIndex=h);h=d.faces.length;if(f)for(f=0;f<v;f++)q=a.uvs[f],p=r[i++],w=q[2*p],p=q[2*p+1],d.faceUvs[f][h]=new THREE.UV(w,p);if(g)for(f=0;f<v;f++){q=a.uvs[f];A=[];for(g=0;g<l;g++)p=r[i++],w=q[2*p],p=q[2*p+1],A[g]=new THREE.UV(w,p);d.faceVertexUvs[f][h]=A}n&&(n=3*r[i++],g=new THREE.Vector3,g.x=E[n++],g.y=E[n++],g.z=E[n],t.normal=g);if(m)for(f=0;f<l;f++)n=3*r[i++],g=new THREE.Vector3,
+g.x=E[n++],g.y=E[n++],g.z=E[n],t.vertexNormals.push(g);s&&(m=r[i++],m=new THREE.Color(z[m]),t.color=m);if(o)for(f=0;f<l;f++)m=r[i++],m=new THREE.Color(z[m]),t.vertexColors.push(m);d.faces.push(t)}if(a.skinWeights){i=0;for(j=a.skinWeights.length;i<j;i+=2)r=a.skinWeights[i],E=a.skinWeights[i+1],d.skinWeights.push(new THREE.Vector4(r,E,0,0))}if(a.skinIndices){i=0;for(j=a.skinIndices.length;i<j;i+=2)r=a.skinIndices[i],E=a.skinIndices[i+1],d.skinIndices.push(new THREE.Vector4(r,E,0,0))}d.bones=a.bones;
+d.animation=a.animation;if(void 0!==a.morphTargets){i=0;for(j=a.morphTargets.length;i<j;i++){d.morphTargets[i]={};d.morphTargets[i].name=a.morphTargets[i].name;d.morphTargets[i].vertices=[];z=d.morphTargets[i].vertices;v=a.morphTargets[i].vertices;r=0;for(E=v.length;r<E;r+=3)o=new THREE.Vector3,o.x=v[r]*e,o.y=v[r+1]*e,o.z=v[r+2]*e,z.push(o)}}if(void 0!==a.morphColors){i=0;for(j=a.morphColors.length;i<j;i++){d.morphColors[i]={};d.morphColors[i].name=a.morphColors[i].name;d.morphColors[i].colors=[];
+E=d.morphColors[i].colors;z=a.morphColors[i].colors;e=0;for(r=z.length;e<r;e+=3)v=new THREE.Color(16755200),v.setRGB(z[e],z[e+1],z[e+2]),E.push(v)}}d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();a=this.initMaterials(a.materials,c);b(d,a)};
 THREE.LoadingMonitor=function(){THREE.EventTarget.call(this);var a=this,b=0,c=0,d=function(){b++;a.dispatchEvent({type:"progress",loaded:b,total:c});b===c&&a.dispatchEvent({type:"load"})};this.add=function(a){c++;a.addEventListener("load",d,!1)}};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlerMap={};this.hierarchyHandlerMap={};this.addGeometryHandler("ascii",THREE.JSONLoader);this.addGeometryHandler("binary",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(4===d.readyState)if(200===d.status||0===d.status){var e=JSON.parse(d.responseText);c.parse(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.send(null)};THREE.SceneLoader.prototype.addGeometryHandler=function(a,b){this.geometryHandlerMap[a]={loaderClass:b}};
 THREE.SceneLoader.prototype.addHierarchyHandler=function(a,b){this.hierarchyHandlerMap[a]={loaderClass:b}};
 THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:m+"/"+a}function e(){f(M.scene,Q.objects)}function f(a,b){for(var c in b)if(void 0===M.objects[c]){var e=b[c],g=null;if(e.type&&e.type in l.hierarchyHandlerMap&&void 0===e.loading){var i={},j;for(j in t)"type"!==j&&"url"!==j&&(i[j]=t[j]);C=M.materials[e.material];e.loading=!0;var n=l.hierarchyHandlerMap[e.type].loaderObject;n.addEventListener?(n.addEventListener("load",h(c,a,C,e)),n.load(d(e.url,Q.urlBaseType))):
-n.options?n.load(d(e.url,Q.urlBaseType),h(c,a,C,e)):n.load(d(e.url,Q.urlBaseType),h(c,a,C,e),i)}else if(void 0!==e.geometry){if(D=M.geometries[e.geometry])g=!1,C=M.materials[e.material],(g=C instanceof THREE.ShaderMaterial)&&D.computeTangents(),w=e.position,r=e.rotation,E=e.quaternion,A=e.scale,q=e.matrix,E=0,e.material||(C=new THREE.MeshFaceMaterial),e.skin?g=new THREE.SkinnedMesh(D,C):e.morph?(g=new THREE.MorphAnimMesh(D,C),void 0!==e.duration&&(g.duration=e.duration),void 0!==e.time&&(g.time=e.time),
-void 0!==e.mirroredLoop&&(g.mirroredLoop=e.mirroredLoop),C.morphNormals&&D.computeMorphNormals()):g=new THREE.Mesh(D,C),g.name=c,q?(g.matrixAutoUpdate=!1,g.matrix.set(q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7],q[8],q[9],q[10],q[11],q[12],q[13],q[14],q[15])):(g.position.set(w[0],w[1],w[2]),E?(g.quaternion.set(E[0],E[1],E[2],E[3]),g.useQuaternion=!0):g.rotation.set(r[0],r[1],r[2]),g.scale.set(A[0],A[1],A[2])),g.visible=e.visible,g.castShadow=e.castShadow,g.receiveShadow=e.receiveShadow,a.add(g),M.objects[c]=
-g}else"DirectionalLight"===e.type||"PointLight"===e.type||"AmbientLight"===e.type?(H=void 0!==e.color?e.color:16777215,I=void 0!==e.intensity?e.intensity:1,"DirectionalLight"===e.type?(w=e.direction,J=new THREE.DirectionalLight(H,I),J.position.set(w[0],w[1],w[2]),e.target&&(O.push({object:J,targetName:e.target}),J.target=null)):"PointLight"===e.type?(w=e.position,z=e.distance,J=new THREE.PointLight(H,I,z),J.position.set(w[0],w[1],w[2])):"AmbientLight"===e.type&&(J=new THREE.AmbientLight(H)),a.add(J),
-J.name=c,M.lights[c]=J,M.objects[c]=J):"PerspectiveCamera"===e.type||"OrthographicCamera"===e.type?("PerspectiveCamera"===e.type?G=new THREE.PerspectiveCamera(e.fov,e.aspect,e.near,e.far):"OrthographicCamera"===e.type&&(G=new THREE.OrthographicCamera(v.left,v.right,v.top,v.bottom,v.near,v.far)),w=e.position,G.position.set(w[0],w[1],w[2]),a.add(G),G.name=c,M.cameras[c]=G,M.objects[c]=G):(w=e.position,r=e.rotation,E=e.quaternion,A=e.scale,E=0,g=new THREE.Object3D,g.name=c,g.position.set(w[0],w[1],w[2]),
-E?(g.quaternion.set(E[0],E[1],E[2],E[3]),g.useQuaternion=!0):g.rotation.set(r[0],r[1],r[2]),g.scale.set(A[0],A[1],A[2]),g.visible=void 0!==e.visible?e.visible:!1,a.add(g),M.objects[c]=g,M.empties[c]=g);if(g){if(void 0!==e.properties)for(var m in e.properties)g.properties[m]=e.properties[m];void 0!==e.children&&f(g,e.children)}}}function g(a){return function(b){M.geometries[a]=b;e();L-=1;l.onLoadComplete();j()}}function h(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.position,
+n.options?n.load(d(e.url,Q.urlBaseType),h(c,a,C,e)):n.load(d(e.url,Q.urlBaseType),h(c,a,C,e),i)}else if(void 0!==e.geometry){if(D=M.geometries[e.geometry])g=!1,C=M.materials[e.material],(g=C instanceof THREE.ShaderMaterial)&&D.computeTangents(),w=e.position,r=e.rotation,E=e.quaternion,z=e.scale,q=e.matrix,E=0,e.material||(C=new THREE.MeshFaceMaterial),e.skin?g=new THREE.SkinnedMesh(D,C):e.morph?(g=new THREE.MorphAnimMesh(D,C),void 0!==e.duration&&(g.duration=e.duration),void 0!==e.time&&(g.time=e.time),
+void 0!==e.mirroredLoop&&(g.mirroredLoop=e.mirroredLoop),C.morphNormals&&D.computeMorphNormals()):g=new THREE.Mesh(D,C),g.name=c,q?(g.matrixAutoUpdate=!1,g.matrix.set(q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7],q[8],q[9],q[10],q[11],q[12],q[13],q[14],q[15])):(g.position.set(w[0],w[1],w[2]),E?(g.quaternion.set(E[0],E[1],E[2],E[3]),g.useQuaternion=!0):g.rotation.set(r[0],r[1],r[2]),g.scale.set(z[0],z[1],z[2])),g.visible=e.visible,g.castShadow=e.castShadow,g.receiveShadow=e.receiveShadow,a.add(g),M.objects[c]=
+g}else"DirectionalLight"===e.type||"PointLight"===e.type||"AmbientLight"===e.type?(H=void 0!==e.color?e.color:16777215,I=void 0!==e.intensity?e.intensity:1,"DirectionalLight"===e.type?(w=e.direction,J=new THREE.DirectionalLight(H,I),J.position.set(w[0],w[1],w[2]),e.target&&(O.push({object:J,targetName:e.target}),J.target=null)):"PointLight"===e.type?(w=e.position,A=e.distance,J=new THREE.PointLight(H,I,A),J.position.set(w[0],w[1],w[2])):"AmbientLight"===e.type&&(J=new THREE.AmbientLight(H)),a.add(J),
+J.name=c,M.lights[c]=J,M.objects[c]=J):"PerspectiveCamera"===e.type||"OrthographicCamera"===e.type?("PerspectiveCamera"===e.type?G=new THREE.PerspectiveCamera(e.fov,e.aspect,e.near,e.far):"OrthographicCamera"===e.type&&(G=new THREE.OrthographicCamera(v.left,v.right,v.top,v.bottom,v.near,v.far)),w=e.position,G.position.set(w[0],w[1],w[2]),a.add(G),G.name=c,M.cameras[c]=G,M.objects[c]=G):(w=e.position,r=e.rotation,E=e.quaternion,z=e.scale,E=0,g=new THREE.Object3D,g.name=c,g.position.set(w[0],w[1],w[2]),
+E?(g.quaternion.set(E[0],E[1],E[2],E[3]),g.useQuaternion=!0):g.rotation.set(r[0],r[1],r[2]),g.scale.set(z[0],z[1],z[2]),g.visible=void 0!==e.visible?e.visible:!1,a.add(g),M.objects[c]=g,M.empties[c]=g);if(g){if(void 0!==e.properties)for(var m in e.properties)g.properties[m]=e.properties[m];void 0!==e.children&&f(g,e.children)}}}function g(a){return function(b){M.geometries[a]=b;e();L-=1;l.onLoadComplete();j()}}function h(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.position,
 h=d.rotation,i=d.quaternion,n=d.scale;f.position.set(g[0],g[1],g[2]);i?(f.quaternion.set(i[0],i[1],i[2],i[3]),f.useQuaternion=!0):f.rotation.set(h[0],h[1],h[2]);f.scale.set(n[0],n[1],n[2]);c&&f.traverse(function(a){a.material=c});b.add(f);M.objects[a]=f;e();L-=1;l.onLoadComplete();j()}}function i(a){return function(b){M.geometries[a]=b}}function j(){l.callbackProgress({totalModels:S,totalTextures:U,loadedModels:S-L,loadedTextures:U-N},M);l.onLoadProgress();if(0===L&&0===N){for(var a=0;a<O.length;a++){var c=
-O[a],d=M.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,M.scene.add(c.object.target));c.object.target.properties.targetInverse=c.object}b(M)}}var l=this,m=THREE.Loader.prototype.extractUrlBase(c),n,p,o,s,t,q,z,w,r,E,A,v,u,D,C,G,P,B,J,H,I,L,N,S,U,M,O=[],Q=a,Z;for(Z in this.geometryHandlerMap)a=this.geometryHandlerMap[Z].loaderClass,this.geometryHandlerMap[Z].loaderObject=new a;for(Z in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[Z].loaderClass,this.hierarchyHandlerMap[Z].loaderObject=
+O[a],d=M.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,M.scene.add(c.object.target));c.object.target.properties.targetInverse=c.object}b(M)}}var l=this,m=THREE.Loader.prototype.extractUrlBase(c),n,p,o,s,t,q,A,w,r,E,z,v,u,D,C,G,P,B,J,H,I,L,N,S,U,M,O=[],Q=a,Z;for(Z in this.geometryHandlerMap)a=this.geometryHandlerMap[Z].loaderClass,this.geometryHandlerMap[Z].loaderObject=new a;for(Z in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[Z].loaderClass,this.hierarchyHandlerMap[Z].loaderObject=
 new a;N=L=0;M={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(Q.transform&&(Z=Q.transform.position,a=Q.transform.rotation,c=Q.transform.scale,Z&&M.scene.position.set(Z[0],Z[1],Z[2]),a&&M.scene.rotation.set(a[0],a[1],a[2]),c&&M.scene.scale.set(c[0],c[1],c[2]),Z||a||c))M.scene.updateMatrix(),M.scene.updateMatrixWorld();Z=function(a){return function(){N-=a;j();l.onLoadComplete()}};for(o in Q.fogs)a=Q.fogs[o],"linear"===a.type?P=new THREE.Fog(0,
 a.near,a.far):"exp2"===a.type&&(P=new THREE.FogExp2(0,a.density)),v=a.color,P.color.setRGB(v[0],v[1],v[2]),M.fogs[o]=P;for(n in Q.geometries)t=Q.geometries[n],t.type in this.geometryHandlerMap&&(L+=1,l.onLoadStart());for(var K in Q.objects)o=Q.objects[K],o.type&&o.type in this.hierarchyHandlerMap&&(L+=1,l.onLoadStart());S=L;for(n in Q.geometries)if(t=Q.geometries[n],"cube"===t.type)D=new THREE.CubeGeometry(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments),M.geometries[n]=
 D;else if("plane"===t.type)D=new THREE.PlaneGeometry(t.width,t.height,t.widthSegments,t.heightSegments),M.geometries[n]=D;else if("sphere"===t.type)D=new THREE.SphereGeometry(t.radius,t.widthSegments,t.heightSegments),M.geometries[n]=D;else if("cylinder"===t.type)D=new THREE.CylinderGeometry(t.topRad,t.botRad,t.height,t.radSegs,t.heightSegs),M.geometries[n]=D;else if("torus"===t.type)D=new THREE.TorusGeometry(t.radius,t.tube,t.segmentsR,t.segmentsT),M.geometries[n]=D;else if("icosahedron"===t.type)D=
@@ -265,27 +264,27 @@ THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);THREE.Scene=function()
 THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a),a.target&&void 0===a.target.parent&&this.add(a.target);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
 THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
 THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};
-THREE.CanvasRenderer=function(a){function b(a){z!==a&&(z=s.globalAlpha=a)}function c(a){w!==a&&(a===THREE.NormalBlending?s.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?s.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(s.globalCompositeOperation="darker"),w=a)}function d(a){r!==a&&(r=s.strokeStyle=a)}function e(a){E!==a&&(E=s.fillStyle=a)}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,i,j=new THREE.Projector,l=void 0!==a.canvas?a.canvas:
-document.createElement("canvas"),m,n,p,o,s=l.getContext("2d"),t=new THREE.Color(0),q=0,z=1,w=0,r=null,E=null,A=null,v=null,u=null,D,C,G,P,B=new THREE.RenderableVertex,J=new THREE.RenderableVertex,H,I,L,N,S,U,M,O,Q,Z,K,ja,R=new THREE.Color,ga=new THREE.Color,fa=new THREE.Color,V=new THREE.Color,aa=new THREE.Color,ca=new THREE.Color,ia=new THREE.Color,Aa={},ua={},Ba,Ka,va,db,xb,Ua,gb,lb,Ab,Bb,fb=new THREE.Rectangle,wa=new THREE.Rectangle,La=new THREE.Rectangle,mb=!1,Na=new THREE.Color,Za=new THREE.Color,
+THREE.CanvasRenderer=function(a){function b(a){A!==a&&(A=s.globalAlpha=a)}function c(a){w!==a&&(a===THREE.NormalBlending?s.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?s.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(s.globalCompositeOperation="darker"),w=a)}function d(a){r!==a&&(r=s.strokeStyle=a)}function e(a){E!==a&&(E=s.fillStyle=a)}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,i,j=new THREE.Projector,l=void 0!==a.canvas?a.canvas:
+document.createElement("canvas"),m,n,p,o,s=l.getContext("2d"),t=new THREE.Color(0),q=0,A=1,w=0,r=null,E=null,z=null,v=null,u=null,D,C,G,P,B=new THREE.RenderableVertex,J=new THREE.RenderableVertex,H,I,L,N,S,U,M,O,Q,Z,K,ja,R=new THREE.Color,ga=new THREE.Color,fa=new THREE.Color,V=new THREE.Color,aa=new THREE.Color,ca=new THREE.Color,ia=new THREE.Color,Aa={},ua={},Ba,Ka,va,db,xb,Ua,gb,lb,Ab,Bb,fb=new THREE.Rectangle,wa=new THREE.Rectangle,La=new THREE.Rectangle,mb=!1,Na=new THREE.Color,Za=new THREE.Color,
 eb=new THREE.Color,ka=new THREE.Vector3,$a,ab,nb,ta,hb,qb,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);nb=ab.getImageData(0,0,2,2);ta=nb.data;hb=document.createElement("canvas");hb.width=hb.height=a;qb=hb.getContext("2d");qb.translate(-a/2,-a/2);qb.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){m=a;n=b;p=
-Math.floor(m/2);o=Math.floor(n/2);l.width=m;l.height=n;fb.set(-p,-o,p,o);wa.set(-p,-o,p,o);z=1;w=0;u=v=A=E=r=null};this.setClearColor=function(a,b){t.copy(a);q=void 0!==b?b:1;wa.set(-p,-o,p,o)};this.setClearColorHex=function(a,b){t.setHex(a);q=void 0!==b?b:1;wa.set(-p,-o,p,o)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){s.setTransform(1,0,0,-1,p,o);!1===wa.isEmpty()&&(wa.minSelf(fb),wa.inflate(2),1>q&&s.clearRect(Math.floor(wa.getX()),Math.floor(wa.getY()),Math.floor(wa.getWidth()),
+Math.floor(m/2);o=Math.floor(n/2);l.width=m;l.height=n;fb.set(-p,-o,p,o);wa.set(-p,-o,p,o);A=1;w=0;u=v=z=E=r=null};this.setClearColor=function(a,b){t.copy(a);q=void 0!==b?b:1;wa.set(-p,-o,p,o)};this.setClearColorHex=function(a,b){t.setHex(a);q=void 0!==b?b:1;wa.set(-p,-o,p,o)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){s.setTransform(1,0,0,-1,p,o);!1===wa.isEmpty()&&(wa.minSelf(fb),wa.inflate(2),1>q&&s.clearRect(Math.floor(wa.getX()),Math.floor(wa.getY()),Math.floor(wa.getWidth()),
 Math.floor(wa.getHeight())),0<q&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*t.r)+","+Math.floor(255*t.g)+","+Math.floor(255*t.b)+","+q+")"),s.fillRect(Math.floor(wa.getX()),Math.floor(wa.getY()),Math.floor(wa.getWidth()),Math.floor(wa.getHeight()))),wa.empty())};this.render=function(a,l){function n(a,b,c){for(var d=0,e=i.length;d<e;d++){var f=i[d],g=f.color;if(f instanceof THREE.DirectionalLight){var h=f.matrixWorld.getPosition().normalize(),k=b.dot(h);0>=k||(k*=f.intensity,c.r+=g.r*k,
 c.g+=g.g*k,c.b+=g.b*k)}else f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),k=b.dot(ka.sub(h,a).normalize()),0>=k||(k*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=k&&(k*=f.intensity,c.r+=g.r*k,c.g+=g.g*k,c.b+=g.b*k)))}}function m(a,d,e,g,h,k,i,j){f.info.render.vertices+=3;f.info.render.faces++;b(j.opacity);c(j.blending);H=a.positionScreen.x;I=a.positionScreen.y;L=d.positionScreen.x;N=d.positionScreen.y;S=e.positionScreen.x;U=e.positionScreen.y;q(H,I,L,N,S,U);(j instanceof
 THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial)&&null===j.map&&null===j.map?(ca.copy(j.color),ia.copy(j.emissive),j.vertexColors===THREE.FaceColors&&(ca.r*=i.color.r,ca.g*=i.color.g,ca.b*=i.color.b),!0===mb)?!1===j.wireframe&&j.shading==THREE.SmoothShading&&3==i.vertexNormalsLength?(ga.r=fa.r=V.r=Na.r,ga.g=fa.g=V.g=Na.g,ga.b=fa.b=V.b=Na.b,n(i.v1.positionWorld,i.vertexNormalsWorld[0],ga),n(i.v2.positionWorld,i.vertexNormalsWorld[1],fa),n(i.v3.positionWorld,i.vertexNormalsWorld[2],
 V),ga.r=ga.r*ca.r+ia.r,ga.g=ga.g*ca.g+ia.g,ga.b=ga.b*ca.b+ia.b,fa.r=fa.r*ca.r+ia.r,fa.g=fa.g*ca.g+ia.g,fa.b=fa.b*ca.b+ia.b,V.r=V.r*ca.r+ia.r,V.g=V.g*ca.g+ia.g,V.b=V.b*ca.b+ia.b,aa.r=0.5*(fa.r+V.r),aa.g=0.5*(fa.g+V.g),aa.b=0.5*(fa.b+V.b),va=wc(ga,fa,V,aa),oa(H,I,L,N,S,U,0,0,1,0,0,1,va)):(R.r=Na.r,R.g=Na.g,R.b=Na.b,n(i.centroidWorld,i.normalWorld,R),R.r=R.r*ca.r+ia.r,R.g=R.g*ca.g+ia.g,R.b=R.b*ca.b+ia.b,!0===j.wireframe?t(R,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):w(R)):!0===j.wireframe?
-t(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):w(j.color):j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial?null!==j.map?j.map.mapping instanceof THREE.UVMapping&&(db=i.uvs[0],z(H,I,L,N,S,U,db[g].u,db[g].v,db[h].u,db[h].v,db[k].u,db[k].v,j.map)):null!==j.envMap?j.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(a=l.matrixWorldInverse,ka.copy(i.vertexNormalsWorld[g]),xb=0.5*(ka.x*a.elements[0]+ka.y*
-a.elements[4]+ka.z*a.elements[8])+0.5,Ua=0.5*(ka.x*a.elements[1]+ka.y*a.elements[5]+ka.z*a.elements[9])+0.5,ka.copy(i.vertexNormalsWorld[h]),gb=0.5*(ka.x*a.elements[0]+ka.y*a.elements[4]+ka.z*a.elements[8])+0.5,lb=0.5*(ka.x*a.elements[1]+ka.y*a.elements[5]+ka.z*a.elements[9])+0.5,ka.copy(i.vertexNormalsWorld[k]),Ab=0.5*(ka.x*a.elements[0]+ka.y*a.elements[4]+ka.z*a.elements[8])+0.5,Bb=0.5*(ka.x*a.elements[1]+ka.y*a.elements[5]+ka.z*a.elements[9])+0.5,z(H,I,L,N,S,U,xb,Ua,gb,lb,Ab,Bb,j.envMap)):(R.copy(j.color),
+t(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):w(j.color):j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial?null!==j.map?j.map.mapping instanceof THREE.UVMapping&&(db=i.uvs[0],A(H,I,L,N,S,U,db[g].u,db[g].v,db[h].u,db[h].v,db[k].u,db[k].v,j.map)):null!==j.envMap?j.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(a=l.matrixWorldInverse,ka.copy(i.vertexNormalsWorld[g]),xb=0.5*(ka.x*a.elements[0]+ka.y*
+a.elements[4]+ka.z*a.elements[8])+0.5,Ua=0.5*(ka.x*a.elements[1]+ka.y*a.elements[5]+ka.z*a.elements[9])+0.5,ka.copy(i.vertexNormalsWorld[h]),gb=0.5*(ka.x*a.elements[0]+ka.y*a.elements[4]+ka.z*a.elements[8])+0.5,lb=0.5*(ka.x*a.elements[1]+ka.y*a.elements[5]+ka.z*a.elements[9])+0.5,ka.copy(i.vertexNormalsWorld[k]),Ab=0.5*(ka.x*a.elements[0]+ka.y*a.elements[4]+ka.z*a.elements[8])+0.5,Bb=0.5*(ka.x*a.elements[1]+ka.y*a.elements[5]+ka.z*a.elements[9])+0.5,A(H,I,L,N,S,U,xb,Ua,gb,lb,Ab,Bb,j.envMap)):(R.copy(j.color),
 j.vertexColors===THREE.FaceColors&&(R.r*=i.color.r,R.g*=i.color.g,R.b*=i.color.b),!0===j.wireframe?t(R,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):w(R)):j instanceof THREE.MeshDepthMaterial?(Ba=l.near,Ka=l.far,ga.r=ga.g=ga.b=1-Cb(a.positionScreen.z,Ba,Ka),fa.r=fa.g=fa.b=1-Cb(d.positionScreen.z,Ba,Ka),V.r=V.g=V.b=1-Cb(e.positionScreen.z,Ba,Ka),aa.r=0.5*(fa.r+V.r),aa.g=0.5*(fa.g+V.g),aa.b=0.5*(fa.b+V.b),va=wc(ga,fa,V,aa),oa(H,I,L,N,S,U,0,0,1,0,0,1,va)):j instanceof THREE.MeshNormalMaterial&&
-(R.r=gc(i.normalWorld.x),R.g=gc(i.normalWorld.y),R.b=gc(i.normalWorld.z),!0===j.wireframe?t(R,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):w(R))}function q(a,b,c,d,e,f){s.beginPath();s.moveTo(a,b);s.lineTo(c,d);s.lineTo(e,f);s.closePath()}function r(a,b,c,d,e,f,g,h){s.beginPath();s.moveTo(a,b);s.lineTo(c,d);s.lineTo(e,f);s.lineTo(g,h);s.closePath()}function t(a,b,c,e){A!==b&&(A=s.lineWidth=b);v!==c&&(v=s.lineCap=c);u!==e&&(u=s.lineJoin=e);d(a.getContextStyle());s.stroke();La.inflate(2*
-b)}function w(a){e(a.getContextStyle());s.fill()}function z(a,b,c,d,f,g,h,i,k,j,l,n,oa){if(!(oa instanceof THREE.DataTexture||void 0===oa.image||0==oa.image.width)){if(!0===oa.needsUpdate){var m=oa.wrapS==THREE.RepeatWrapping,o=oa.wrapT==THREE.RepeatWrapping;Aa[oa.id]=s.createPattern(oa.image,!0===m&&!0===o?"repeat":!0===m&&!1===o?"repeat-x":!1===m&&!0===o?"repeat-y":"no-repeat");oa.needsUpdate=!1}void 0===Aa[oa.id]?e("rgba(0,0,0,1)"):e(Aa[oa.id]);var m=oa.offset.x/oa.repeat.x,o=oa.offset.y/oa.repeat.y,
-Cb=oa.image.width*oa.repeat.x,p=oa.image.height*oa.repeat.y,h=(h+m)*Cb,i=(1-i+o)*p,c=c-a,d=d-b,f=f-a,g=g-b,k=(k+m)*Cb-h,j=(1-j+o)*p-i,l=(l+m)*Cb-h,n=(1-n+o)*p-i,m=k*n-l*j;0===m?(void 0===ua[oa.id]&&(b=document.createElement("canvas"),b.width=oa.image.width,b.height=oa.image.height,b=b.getContext("2d"),b.drawImage(oa.image,0,0),ua[oa.id]=b.getImageData(0,0,oa.image.width,oa.image.height).data),b=ua[oa.id],h=4*(Math.floor(h)+Math.floor(i)*oa.image.width),R.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255),w(R)):
-(m=1/m,oa=(n*c-j*f)*m,j=(n*d-j*g)*m,c=(k*f-l*c)*m,d=(k*g-l*d)*m,a=a-oa*h-c*i,h=b-j*h-d*i,s.save(),s.transform(oa,j,c,d,a,h),s.fill(),s.restore())}}function oa(a,b,c,d,e,f,g,h,i,k,j,oa,l){var n,m;n=l.width-1;m=l.height-1;g*=n;h*=m;c-=a;d-=b;e-=a;f-=b;i=i*n-g;k=k*m-h;j=j*n-g;oa=oa*m-h;m=1/(i*oa-j*k);n=(oa*c-k*e)*m;k=(oa*d-k*f)*m;c=(i*e-j*c)*m;d=(i*f-j*d)*m;a=a-n*g-c*h;b=b-k*g-d*h;s.save();s.transform(n,k,c,d,a,b);s.clip();s.drawImage(l,0,0);s.restore()}function wc(a,b,c,d){ta[0]=255*a.r|0;ta[1]=255*
+(R.r=gc(i.normalWorld.x),R.g=gc(i.normalWorld.y),R.b=gc(i.normalWorld.z),!0===j.wireframe?t(R,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):w(R))}function q(a,b,c,d,e,f){s.beginPath();s.moveTo(a,b);s.lineTo(c,d);s.lineTo(e,f);s.closePath()}function r(a,b,c,d,e,f,g,h){s.beginPath();s.moveTo(a,b);s.lineTo(c,d);s.lineTo(e,f);s.lineTo(g,h);s.closePath()}function t(a,b,c,e){z!==b&&(z=s.lineWidth=b);v!==c&&(v=s.lineCap=c);u!==e&&(u=s.lineJoin=e);d(a.getContextStyle());s.stroke();La.inflate(2*
+b)}function w(a){e(a.getContextStyle());s.fill()}function A(a,b,c,d,f,g,h,k,i,j,l,n,oa){if(!(oa instanceof THREE.DataTexture||void 0===oa.image||0==oa.image.width)){if(!0===oa.needsUpdate){var m=oa.wrapS==THREE.RepeatWrapping,o=oa.wrapT==THREE.RepeatWrapping;Aa[oa.id]=s.createPattern(oa.image,!0===m&&!0===o?"repeat":!0===m&&!1===o?"repeat-x":!1===m&&!0===o?"repeat-y":"no-repeat");oa.needsUpdate=!1}void 0===Aa[oa.id]?e("rgba(0,0,0,1)"):e(Aa[oa.id]);var m=oa.offset.x/oa.repeat.x,o=oa.offset.y/oa.repeat.y,
+Cb=oa.image.width*oa.repeat.x,p=oa.image.height*oa.repeat.y,h=(h+m)*Cb,k=(1-k+o)*p,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+m)*Cb-h,j=(1-j+o)*p-k,l=(l+m)*Cb-h,n=(1-n+o)*p-k,m=i*n-l*j;0===m?(void 0===ua[oa.id]&&(b=document.createElement("canvas"),b.width=oa.image.width,b.height=oa.image.height,b=b.getContext("2d"),b.drawImage(oa.image,0,0),ua[oa.id]=b.getImageData(0,0,oa.image.width,oa.image.height).data),b=ua[oa.id],h=4*(Math.floor(h)+Math.floor(k)*oa.image.width),R.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255),w(R)):
+(m=1/m,oa=(n*c-j*f)*m,j=(n*d-j*g)*m,c=(i*f-l*c)*m,d=(i*g-l*d)*m,a=a-oa*h-c*k,h=b-j*h-d*k,s.save(),s.transform(oa,j,c,d,a,h),s.fill(),s.restore())}}function oa(a,b,c,d,e,f,g,h,k,i,j,oa,l){var n,m;n=l.width-1;m=l.height-1;g*=n;h*=m;c-=a;d-=b;e-=a;f-=b;k=k*n-g;i=i*m-h;j=j*n-g;oa=oa*m-h;m=1/(k*oa-j*i);n=(oa*c-i*e)*m;i=(oa*d-i*f)*m;c=(k*e-j*c)*m;d=(k*f-j*d)*m;a=a-n*g-c*h;b=b-i*g-d*h;s.save();s.transform(n,i,c,d,a,b);s.clip();s.drawImage(l,0,0);s.restore()}function wc(a,b,c,d){ta[0]=255*a.r|0;ta[1]=255*
 a.g|0;ta[2]=255*a.b|0;ta[4]=255*b.r|0;ta[5]=255*b.g|0;ta[6]=255*b.b|0;ta[8]=255*c.r|0;ta[9]=255*c.g|0;ta[10]=255*c.b|0;ta[12]=255*d.r|0;ta[13]=255*d.g|0;ta[14]=255*d.b|0;ab.putImageData(nb,0,0);qb.drawImage($a,0,0);return hb}function Cb(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function gc(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Xb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!==e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}if(!1===l instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
 else{var Yb,xc,ma,da;!0===this.autoClear?this.clear():s.setTransform(1,0,0,-1,p,o);f.info.render.vertices=0;f.info.render.faces=0;g=j.projectScene(a,l,this.sortObjects,this.sortElements);h=g.elements;i=g.lights;mb=0<i.length;if(!0===mb){Na.setRGB(0,0,0);Za.setRGB(0,0,0);eb.setRGB(0,0,0);Yb=0;for(xc=i.length;Yb<xc;Yb++){da=i[Yb];var na=da.color;da instanceof THREE.AmbientLight?(Na.r+=na.r,Na.g+=na.g,Na.b+=na.b):da instanceof THREE.DirectionalLight?(Za.r+=na.r,Za.g+=na.g,Za.b+=na.b):da instanceof THREE.PointLight&&
 (eb.r+=na.r,eb.g+=na.g,eb.b+=na.b)}}Yb=0;for(xc=h.length;Yb<xc;Yb++)if(ma=h[Yb],da=ma.material,!(void 0===da||!1===da.visible)){La.empty();if(ma instanceof THREE.RenderableParticle){D=ma;D.x*=p;D.y*=o;var na=D,bb=ma;b(da.opacity);c(da.blending);var E=void 0,zb=void 0,rb=void 0,sb=void 0,hc=ma=void 0,Pc=void 0;da instanceof THREE.ParticleBasicMaterial?null===da.map?(rb=bb.object.scale.x,sb=bb.object.scale.y,rb*=bb.scale.x*p,sb*=bb.scale.y*o,La.set(na.x-rb,na.y-sb,na.x+rb,na.y+sb),!1!==fb.intersects(La)&&
 (e(da.color.getContextStyle()),s.save(),s.translate(na.x,na.y),s.rotate(-bb.rotation),s.scale(rb,sb),s.fillRect(-1,-1,2,2),s.restore())):(ma=da.map.image,hc=ma.width>>1,Pc=ma.height>>1,rb=bb.scale.x*p,sb=bb.scale.y*o,E=rb*hc,zb=sb*Pc,La.set(na.x-E,na.y-zb,na.x+E,na.y+zb),!1!==fb.intersects(La)&&(s.save(),s.translate(na.x,na.y),s.rotate(-bb.rotation),s.scale(rb,-sb),s.translate(-hc,-Pc),s.drawImage(ma,0,0),s.restore())):da instanceof THREE.ParticleCanvasMaterial&&(E=bb.scale.x*p,zb=bb.scale.y*o,La.set(na.x-
 E,na.y-zb,na.x+E,na.y+zb),!1!==fb.intersects(La)&&(d(da.color.getContextStyle()),e(da.color.getContextStyle()),s.save(),s.translate(na.x,na.y),s.rotate(-bb.rotation),s.scale(E,zb),da.program(s),s.restore()))}else if(ma instanceof THREE.RenderableLine){if(D=ma.v1,C=ma.v2,D.positionScreen.x*=p,D.positionScreen.y*=o,C.positionScreen.x*=p,C.positionScreen.y*=o,La.addPoint(D.positionScreen.x,D.positionScreen.y),La.addPoint(C.positionScreen.x,C.positionScreen.y),!0===fb.intersects(La)&&(na=D,bb=C,b(da.opacity),
-c(da.blending),s.beginPath(),s.moveTo(na.positionScreen.x,na.positionScreen.y),s.lineTo(bb.positionScreen.x,bb.positionScreen.y),da instanceof THREE.LineBasicMaterial))na=da.linewidth,A!==na&&(A=s.lineWidth=na),na=da.linecap,v!==na&&(v=s.lineCap=na),na=da.linejoin,u!==na&&(u=s.lineJoin=na),d(da.color.getContextStyle()),s.stroke(),La.inflate(2*da.linewidth)}else if(ma instanceof THREE.RenderableFace3)D=ma.v1,C=ma.v2,G=ma.v3,D.positionScreen.x*=p,D.positionScreen.y*=o,C.positionScreen.x*=p,C.positionScreen.y*=
+c(da.blending),s.beginPath(),s.moveTo(na.positionScreen.x,na.positionScreen.y),s.lineTo(bb.positionScreen.x,bb.positionScreen.y),da instanceof THREE.LineBasicMaterial))na=da.linewidth,z!==na&&(z=s.lineWidth=na),na=da.linecap,v!==na&&(v=s.lineCap=na),na=da.linejoin,u!==na&&(u=s.lineJoin=na),d(da.color.getContextStyle()),s.stroke(),La.inflate(2*da.linewidth)}else if(ma instanceof THREE.RenderableFace3)D=ma.v1,C=ma.v2,G=ma.v3,D.positionScreen.x*=p,D.positionScreen.y*=o,C.positionScreen.x*=p,C.positionScreen.y*=
 o,G.positionScreen.x*=p,G.positionScreen.y*=o,!0===da.overdraw&&(Xb(D.positionScreen,C.positionScreen),Xb(C.positionScreen,G.positionScreen),Xb(G.positionScreen,D.positionScreen)),La.add3Points(D.positionScreen.x,D.positionScreen.y,C.positionScreen.x,C.positionScreen.y,G.positionScreen.x,G.positionScreen.y),!0===fb.intersects(La)&&m(D,C,G,0,1,2,ma,da,a);else if(ma instanceof THREE.RenderableFace4&&(D=ma.v1,C=ma.v2,G=ma.v3,P=ma.v4,D.positionScreen.x*=p,D.positionScreen.y*=o,C.positionScreen.x*=p,C.positionScreen.y*=
 o,G.positionScreen.x*=p,G.positionScreen.y*=o,P.positionScreen.x*=p,P.positionScreen.y*=o,B.positionScreen.copy(C.positionScreen),J.positionScreen.copy(P.positionScreen),!0===da.overdraw&&(Xb(D.positionScreen,C.positionScreen),Xb(C.positionScreen,P.positionScreen),Xb(P.positionScreen,D.positionScreen),Xb(G.positionScreen,B.positionScreen),Xb(G.positionScreen,J.positionScreen)),La.addPoint(D.positionScreen.x,D.positionScreen.y),La.addPoint(C.positionScreen.x,C.positionScreen.y),La.addPoint(G.positionScreen.x,
 G.positionScreen.y),La.addPoint(P.positionScreen.x,P.positionScreen.y),!0===fb.intersects(La)))(na=D,bb=C,E=G,zb=P,rb=B,sb=J,hc=a,f.info.render.vertices+=4,f.info.render.faces++,b(da.opacity),c(da.blending),void 0!==da.map&&null!==da.map||void 0!==da.envMap&&null!==da.envMap)?(m(na,bb,zb,0,1,3,ma,da,hc),m(rb,E,sb,1,2,3,ma,da,hc)):(H=na.positionScreen.x,I=na.positionScreen.y,L=bb.positionScreen.x,N=bb.positionScreen.y,S=E.positionScreen.x,U=E.positionScreen.y,M=zb.positionScreen.x,O=zb.positionScreen.y,
@@ -353,12 +352,12 @@ h.buffer),k.bufferData(k.ARRAY_BUFFER,h.array,b)}}function j(a,b,c){var d=a.attr
 a.uvsNeedUpdate&&void 0!==h&&(k.bindBuffer(k.ARRAY_BUFFER,h.buffer),k.bufferData(k.ARRAY_BUFFER,h.array,b));a.colorsNeedUpdate&&void 0!==i&&(k.bindBuffer(k.ARRAY_BUFFER,i.buffer),k.bufferData(k.ARRAY_BUFFER,i.array,b));a.tangentsNeedUpdate&&void 0!==d&&(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 l(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}function m(a,b){return b[1]-a[1]}function n(a,b,c){if(a.length)for(var d=
 0,e=a.length;d<e;d++)ca=ga=null,V=aa=Ba=ua=gb=Ua=Ka=-1,hb=!0,a[d].render(b,c,Za,eb),ca=ga=null,V=aa=Ba=ua=gb=Ua=Ka=-1,hb=!0}function p(a,b,c,d,e,f,g,h){var i,k,j,l;b?(k=a.length-1,l=b=-1):(k=0,b=a.length,l=1);for(var n=k;n!==b;n+=l)if(i=a[n],i.render){k=i.object;j=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&K.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);K.setDepthTest(i.depthTest);K.setDepthWrite(i.depthWrite);D(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}K.setMaterialFaces(i);
 j instanceof THREE.BufferGeometry?K.renderBufferDirect(d,e,f,i,j,k):K.renderBuffer(d,e,f,i,j,k)}}function o(a,b,c,d,e,f,g){for(var h,i,k=0,j=a.length;k<j;k++)if(h=a[k],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&K.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);K.setDepthTest(h.depthTest);K.setDepthWrite(h.depthWrite);D(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}K.renderImmediateObject(c,d,e,h,i)}}function s(a,b,c){a.push({buffer:b,object:c,opaque:null,
-transparent:null})}function t(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function q(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function z(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function w(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function r(a,b,c,d,e){Aa=0;d.needsUpdate&&(d.program&&K.deallocateMaterial(d),K.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=
+transparent:null})}function t(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function q(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function A(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function w(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function r(a,b,c,d,e){Aa=0;d.needsUpdate&&(d.program&&K.deallocateMaterial(d),K.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=
 new Float32Array(K.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==ga&&(k.useProgram(g),ga=g,f=!0);d.id!==V&&(V=d.id,f=!0);if(f||a!==ca)k.uniformMatrix4fv(h.projectionMatrix,!1,a._projectionMatrixArray),a!==ca&&(ca=a);if(d.skinning)if(fc&&e.useVertexTexture){if(null!==h.boneTexture){var j=E();k.uniform1i(h.boneTexture,j);K.setTexture(e.boneTexture,j)}}else null!==h.boneGlobalMatrices&&k.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=
-c.color,c instanceof THREE.Fog?(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(hb){for(var l=0,n=0,m=0,o,p,s,q=qb,r=q.directional.colors,t=q.directional.positions,w=q.point.colors,z=q.point.positions,A=q.point.distances,B=q.spot.colors,C=q.spot.positions,D=q.spot.distances,G=q.spot.directions,R=q.spot.anglesCos,O=q.spot.exponents,J=q.hemi.skyColors,
+c.color,c instanceof THREE.Fog?(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(hb){for(var l=0,n=0,m=0,o,p,s,q=qb,r=q.directional.colors,t=q.directional.positions,w=q.point.colors,A=q.point.positions,z=q.point.distances,B=q.spot.colors,C=q.spot.positions,D=q.spot.distances,G=q.spot.directions,R=q.spot.anglesCos,O=q.spot.exponents,J=q.hemi.skyColors,
 Q=q.hemi.groundColors,N=q.hemi.positions,M=0,fa=0,L=0,S=0,ia=0,Z=0,aa=0,ba=0,U=p=0,c=U=U=0,f=b.length;c<f;c++)j=b[c],j.onlyShadow||(o=j.color,s=j.intensity,p=j.distance,j instanceof THREE.AmbientLight?j.visible&&(K.gammaInput?(l+=o.r*o.r,n+=o.g*o.g,m+=o.b*o.b):(l+=o.r,n+=o.g,m+=o.b)):j instanceof THREE.DirectionalLight?(ia+=1,j.visible&&(p=3*M,K.gammaInput?v(r,p,o,s*s):u(r,p,o,s),ta.copy(j.matrixWorld.getPosition()),ta.subSelf(j.target.matrixWorld.getPosition()),ta.normalize(),t[p]=ta.x,t[p+1]=ta.y,
-t[p+2]=ta.z,M+=1)):j instanceof THREE.PointLight?(Z+=1,j.visible&&(U=3*fa,K.gammaInput?v(w,U,o,s*s):u(w,U,o,s),s=j.matrixWorld.getPosition(),z[U]=s.x,z[U+1]=s.y,z[U+2]=s.z,A[fa]=p,fa+=1)):j instanceof THREE.SpotLight?(aa+=1,j.visible&&(U=3*L,K.gammaInput?v(B,U,o,s*s):u(B,U,o,s),s=j.matrixWorld.getPosition(),C[U]=s.x,C[U+1]=s.y,C[U+2]=s.z,D[L]=p,ta.copy(s),ta.subSelf(j.target.matrixWorld.getPosition()),ta.normalize(),G[U]=ta.x,G[U+1]=ta.y,G[U+2]=ta.z,R[L]=Math.cos(j.angle),O[L]=j.exponent,L+=1)):j instanceof
-THREE.HemisphereLight&&(ba+=1,j.visible&&(o=j.color,p=j.groundColor,U=3*S,K.gammaInput?(s*=s,v(J,U,o,s),v(Q,U,p,s)):(u(J,U,o,s),u(Q,U,p,s)),ta.copy(j.matrixWorld.getPosition()),ta.normalize(),N[U]=ta.x,N[U+1]=ta.y,N[U+2]=ta.z,S+=1)));c=3*M;for(f=Math.max(r.length,3*ia);c<f;c++)r[c]=0;c=3*M;for(f=Math.max(t.length,3*ia);c<f;c++)t[c]=0;c=3*fa;for(f=Math.max(w.length,3*Z);c<f;c++)w[c]=0;c=3*fa;for(f=Math.max(z.length,3*Z);c<f;c++)z[c]=0;c=fa;for(f=Math.max(A.length,Z);c<f;c++)A[c]=0;c=3*L;for(f=Math.max(B.length,
+t[p+2]=ta.z,M+=1)):j instanceof THREE.PointLight?(Z+=1,j.visible&&(U=3*fa,K.gammaInput?v(w,U,o,s*s):u(w,U,o,s),s=j.matrixWorld.getPosition(),A[U]=s.x,A[U+1]=s.y,A[U+2]=s.z,z[fa]=p,fa+=1)):j instanceof THREE.SpotLight?(aa+=1,j.visible&&(U=3*L,K.gammaInput?v(B,U,o,s*s):u(B,U,o,s),s=j.matrixWorld.getPosition(),C[U]=s.x,C[U+1]=s.y,C[U+2]=s.z,D[L]=p,ta.copy(s),ta.subSelf(j.target.matrixWorld.getPosition()),ta.normalize(),G[U]=ta.x,G[U+1]=ta.y,G[U+2]=ta.z,R[L]=Math.cos(j.angle),O[L]=j.exponent,L+=1)):j instanceof
+THREE.HemisphereLight&&(ba+=1,j.visible&&(o=j.color,p=j.groundColor,U=3*S,K.gammaInput?(s*=s,v(J,U,o,s),v(Q,U,p,s)):(u(J,U,o,s),u(Q,U,p,s)),ta.copy(j.matrixWorld.getPosition()),ta.normalize(),N[U]=ta.x,N[U+1]=ta.y,N[U+2]=ta.z,S+=1)));c=3*M;for(f=Math.max(r.length,3*ia);c<f;c++)r[c]=0;c=3*M;for(f=Math.max(t.length,3*ia);c<f;c++)t[c]=0;c=3*fa;for(f=Math.max(w.length,3*Z);c<f;c++)w[c]=0;c=3*fa;for(f=Math.max(A.length,3*Z);c<f;c++)A[c]=0;c=fa;for(f=Math.max(z.length,Z);c<f;c++)z[c]=0;c=3*L;for(f=Math.max(B.length,
 3*aa);c<f;c++)B[c]=0;c=3*L;for(f=Math.max(C.length,3*aa);c<f;c++)C[c]=0;c=3*L;for(f=Math.max(G.length,3*aa);c<f;c++)G[c]=0;c=L;for(f=Math.max(R.length,aa);c<f;c++)R[c]=0;c=L;for(f=Math.max(O.length,aa);c<f;c++)O[c]=0;c=L;for(f=Math.max(D.length,aa);c<f;c++)D[c]=0;c=3*S;for(f=Math.max(J.length,3*ba);c<f;c++)J[c]=0;c=3*S;for(f=Math.max(Q.length,3*ba);c<f;c++)Q[c]=0;c=3*S;for(f=Math.max(N.length,3*ba);c<f;c++)N[c]=0;q.directional.length=M;q.point.length=fa;q.spot.length=L;q.hemi.length=S;q.ambient[0]=
 l;q.ambient[1]=n;q.ambient[2]=m;hb=!1}c=qb;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.spotLightAngleCos.value=
 c.spot.anglesCos;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;K.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=
@@ -370,10 +369,10 @@ j.shadowMap,i.shadowMapSize.value[ja]=j.shadowMapSize,i.shadowMatrix.value[ja]=j
 j.r,j.g,j.b);else if("iv1"===l)k.uniform1iv(f,j);else if("iv"===l)k.uniform3iv(f,j);else if("fv1"===l)k.uniform1fv(f,j);else if("fv"===l)k.uniform3fv(f,j);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*j.length));l=0;for(n=j.length;l<n;l++)m=2*l,c._array[m]=j[l].x,c._array[m+1]=j[l].y;k.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*j.length));l=0;for(n=j.length;l<n;l++)m=3*l,c._array[m]=j[l].x,c._array[m+1]=j[l].y,c._array[m+2]=j[l].z;
 k.uniform3fv(f,c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*j.length));l=0;for(n=j.length;l<n;l++)m=4*l,c._array[m]=j[l].x,c._array[m+1]=j[l].y,c._array[m+2]=j[l].z,c._array[m+3]=j[l].w;k.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),j.flattenToArray(c._array),k.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=new Float32Array(16*j.length));l=0;for(n=j.length;l<n;l++)j[l].flattenToArrayOffset(c._array,
 16*l);k.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(m=j,j=E(),k.uniform1i(f,j),m)if(m.image instanceof Array&&6===m.image.length){if(c=m,f=j,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.image.__webglTextureCube=k.createTexture());k.activeTexture(k.TEXTURE0+f);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;j=[];for(l=0;6>l;l++)K.autoScaleCubemaps&&!f?(n=j,m=l,q=c.image[l],
-t=Oc,q.width<=t&&q.height<=t||(w=Math.max(q.width,q.height),r=Math.floor(q.width*t/w),t=Math.floor(q.height*t/w),w=document.createElement("canvas"),w.width=r,w.height=t,w.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,r,t),q=w),n[m]=q):j[l]=c.image[l];l=j[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);m=H(c.format);q=H(c.type);P(k.TEXTURE_CUBE_MAP,c,n);for(l=0;6>l;l++)if(f){t=j[l].mipmaps;w=0;for(z=t.length;w<z;w++)r=t[w],k.compressedTexImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,w,m,
+t=Oc,q.width<=t&&q.height<=t||(w=Math.max(q.width,q.height),r=Math.floor(q.width*t/w),t=Math.floor(q.height*t/w),w=document.createElement("canvas"),w.width=r,w.height=t,w.getContext("2d").drawImage(q,0,0,q.width,q.height,0,0,r,t),q=w),n[m]=q):j[l]=c.image[l];l=j[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);m=H(c.format);q=H(c.type);P(k.TEXTURE_CUBE_MAP,c,n);for(l=0;6>l;l++)if(f){t=j[l].mipmaps;w=0;for(A=t.length;w<A;w++)r=t[w],k.compressedTexImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,w,m,
 r.width,r.height,0,r.data)}else k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,m,m,q,j[l]);c.generateMipmaps&&n&&k.generateMipmap(k.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else k.activeTexture(k.TEXTURE0+f),k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(c=m,k.activeTexture(k.TEXTURE0+j),k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture)):K.setTexture(m,j)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=
 c.value.length;l<n;l++)c._array[l]=E();k.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)m=c.value[l],j=c._array[l],m&&K.setTexture(m,j)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)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)&&null!==h.viewMatrix&&k.uniformMatrix4fv(h.viewMatrix,
-!1,a._viewMatrixArray)}k.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&k.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function E(){var a=Aa;a>=vc&&console.warn("Trying to use "+a+" texture units while this GPU supports only "+vc);Aa+=1;return a}function A(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);
+!1,a._viewMatrixArray)}k.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&k.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function E(){var a=Aa;a>=vc&&console.warn("Trying to use "+a+" texture units while this GPU supports only "+vc);Aa+=1;return a}function z(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);
 a._normalMatrix.transpose()}function v(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 u(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function D(a,b,c){lb!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),lb=a);if(a&&(Ab!==b||Bb!==c))k.polygonOffset(b,c),Ab=b,Bb=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 G(a,b){var c;"fragment"===a?c=k.createShader(k.FRAGMENT_SHADER):"vertex"===a&&(c=k.createShader(k.VERTEX_SHADER));
 k.shaderSource(c,b);k.compileShader(c);return!k.getShaderParameter(c,k.COMPILE_STATUS)?(console.error(k.getShaderInfoLog(c)),console.error(C(b)),null):c}function P(a,b,c){c?(k.texParameteri(a,k.TEXTURE_WRAP_S,H(b.wrapS)),k.texParameteri(a,k.TEXTURE_WRAP_T,H(b.wrapT)),k.texParameteri(a,k.TEXTURE_MAG_FILTER,H(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,H(b.minFilter))):(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,J(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,J(b.minFilter)));if(yb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))k.texParameterf(a,yb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,mc)),b.__oldAnisotropy=b.anisotropy}function B(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,
@@ -412,20 +411,20 @@ k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,
 0)):(a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),k.drawElements(k.TRIANGLES,e.__webglFaceCount,k.UNSIGNED_SHORT,0)),K.info.render.calls++,K.info.render.vertices+=e.__webglFaceCount,K.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES,d=d.linewidth,d!==fb&&(k.lineWidth(d),fb=d),k.drawArrays(f,0,e.__webglLineCount),K.info.render.calls++):f instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,e.__webglParticleCount),K.info.render.calls++,
 K.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount),K.info.render.calls++)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,g,h,i=a.__lights,j=a.fog;V=-1;hb=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b._viewMatrixArray||(b._viewMatrixArray=new Float32Array(16));
 b._projectionMatrixArray||(b._projectionMatrixArray=new Float32Array(16));b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);$a.multiply(b.projectionMatrix,b.matrixWorldInverse);ka.setFromMatrix($a);this.autoUpdateObjects&&this.initWebGLObjects(a);n(this.renderPluginsPre,a,b);K.info.render.calls=0;K.info.render.vertices=0;K.info.render.faces=0;K.info.render.points=0;this.setRenderTarget(c);
-(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||ka.contains(g))){A(g,b);var m=f,s=m.buffer,q=void 0,r=q=void 0,r=m.object.material;if(r instanceof THREE.MeshFaceMaterial)q=s.materialIndex,0<=q&&(q=r.materials[q],q.transparent?(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=
-null));else if(q=r)q.transparent?(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(nb.copy(g.matrixWorld.getPosition()),$a.multiplyVector3(nb),f.z=nb.z),f.id=g.id)}this.sortObjects&&h.sort(l);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(A(g,b),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,
+(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||ka.contains(g))){z(g,b);var m=f,s=m.buffer,q=void 0,r=q=void 0,r=m.object.material;if(r instanceof THREE.MeshFaceMaterial)q=s.materialIndex,0<=q&&(q=r.materials[q],q.transparent?(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=
+null));else if(q=r)q.transparent?(m.transparent=q,m.opaque=null):(m.opaque=q,m.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(nb.copy(g.matrixWorld.getPosition()),$a.multiplyVector3(nb),f.z=nb.z),f.id=g.id)}this.sortObjects&&h.sort(l);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(z(g,b),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,
 this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),D(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),p(a.__webglObjects,!1,"",b,i,j,!0,d),o(a.__webglObjectsImmediate,"",b,i,j,!1,d)):(this.setBlending(THREE.NormalBlending),p(a.__webglObjects,!0,"opaque",b,i,j,!1),o(a.__webglObjectsImmediate,"opaque",b,i,j,!1),p(a.__webglObjects,!1,"transparent",b,i,j,!0),o(a.__webglObjectsImmediate,"transparent",b,i,j,!0));
 n(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture),k.generateMipmap(k.TEXTURE_CUBE_MAP),k.bindTexture(k.TEXTURE_CUBE_MAP,null)):(k.bindTexture(k.TEXTURE_2D,c.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=
 r(a,b,c,d,e);aa=-1;K.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,k,ka):e.render(function(a){K.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;){var b=a.__objectsAdded[0],l=a,n=void 0,m=void 0,o=void 0;if(!b.__webglInit)if(b.__webglInit=!0,b._modelViewMatrix=new THREE.Matrix4,b._normalMatrix=new THREE.Matrix3,b instanceof
-THREE.Mesh)if(m=b.geometry,m instanceof THREE.Geometry){if(void 0===m.geometryGroups){var p=m,r=void 0,u=void 0,v=void 0,A=void 0,B=void 0,C=void 0,D=void 0,E={},G=p.morphTargets.length,H=p.morphNormals.length;p.geometryGroups={};r=0;for(u=p.faces.length;r<u;r++)v=p.faces[r],A=v.materialIndex,C=void 0!==A?A:-1,void 0===E[C]&&(E[C]={hash:C,counter:0}),D=E[C].hash+"_"+E[C].counter,void 0===p.geometryGroups[D]&&(p.geometryGroups[D]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:G,numMorphNormals:H}),
-B=v instanceof THREE.Face3?3:4,65535<p.geometryGroups[D].vertices+B&&(E[C].counter+=1,D=E[C].hash+"_"+E[C].counter,void 0===p.geometryGroups[D]&&(p.geometryGroups[D]={faces3:[],faces4:[],materialIndex:A,vertices:0,numMorphTargets:G,numMorphNormals:H})),v instanceof THREE.Face3?p.geometryGroups[D].faces3.push(r):p.geometryGroups[D].faces4.push(r),p.geometryGroups[D].vertices+=B;p.geometryGroupsList=[];var I=void 0;for(I in p.geometryGroups)p.geometryGroups[I].id=ia++,p.geometryGroupsList.push(p.geometryGroups[I])}for(n in m.geometryGroups)if(o=
+THREE.Mesh)if(m=b.geometry,m instanceof THREE.Geometry){if(void 0===m.geometryGroups){var p=m,r=void 0,u=void 0,v=void 0,z=void 0,B=void 0,C=void 0,D=void 0,E={},G=p.morphTargets.length,H=p.morphNormals.length;p.geometryGroups={};r=0;for(u=p.faces.length;r<u;r++)v=p.faces[r],z=v.materialIndex,C=void 0!==z?z:-1,void 0===E[C]&&(E[C]={hash:C,counter:0}),D=E[C].hash+"_"+E[C].counter,void 0===p.geometryGroups[D]&&(p.geometryGroups[D]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:G,numMorphNormals:H}),
+B=v instanceof THREE.Face3?3:4,65535<p.geometryGroups[D].vertices+B&&(E[C].counter+=1,D=E[C].hash+"_"+E[C].counter,void 0===p.geometryGroups[D]&&(p.geometryGroups[D]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:G,numMorphNormals:H})),v instanceof THREE.Face3?p.geometryGroups[D].faces3.push(r):p.geometryGroups[D].faces4.push(r),p.geometryGroups[D].vertices+=B;p.geometryGroupsList=[];var I=void 0;for(I in p.geometryGroups)p.geometryGroups[I].id=ia++,p.geometryGroupsList.push(p.geometryGroups[I])}for(n in m.geometryGroups)if(o=
 m.geometryGroups[n],!o.__webglVertexBuffer){var R=o;R.__webglVertexBuffer=k.createBuffer();R.__webglNormalBuffer=k.createBuffer();R.__webglTangentBuffer=k.createBuffer();R.__webglColorBuffer=k.createBuffer();R.__webglUVBuffer=k.createBuffer();R.__webglUV2Buffer=k.createBuffer();R.__webglSkinIndicesBuffer=k.createBuffer();R.__webglSkinWeightsBuffer=k.createBuffer();R.__webglFaceBuffer=k.createBuffer();R.__webglLineBuffer=k.createBuffer();var V=void 0,O=void 0;if(R.numMorphTargets){R.__webglMorphTargetsBuffers=
 [];V=0;for(O=R.numMorphTargets;V<O;V++)R.__webglMorphTargetsBuffers.push(k.createBuffer())}if(R.numMorphNormals){R.__webglMorphNormalsBuffers=[];V=0;for(O=R.numMorphNormals;V<O;V++)R.__webglMorphNormalsBuffers.push(k.createBuffer())}K.info.memory.geometries++;d(o,b);m.verticesNeedUpdate=!0;m.morphTargetsNeedUpdate=!0;m.elementsNeedUpdate=!0;m.uvsNeedUpdate=!0;m.normalsNeedUpdate=!0;m.tangentsNeedUpdate=!0;m.colorsNeedUpdate=!0}}else m instanceof THREE.BufferGeometry&&h(m);else if(b instanceof THREE.Ribbon){if(m=
 b.geometry,!m.__webglVertexBuffer){var J=m;J.__webglVertexBuffer=k.createBuffer();J.__webglColorBuffer=k.createBuffer();J.__webglNormalBuffer=k.createBuffer();K.info.memory.geometries++;var Q=m,P=b,L=Q.vertices.length;Q.__vertexArray=new Float32Array(3*L);Q.__colorArray=new Float32Array(3*L);Q.__normalArray=new Float32Array(3*L);Q.__webglVertexCount=L;c(Q,P);m.verticesNeedUpdate=!0;m.colorsNeedUpdate=!0;m.normalsNeedUpdate=!0}}else if(b instanceof THREE.Line){if(m=b.geometry,!m.__webglVertexBuffer){var N=
 m;N.__webglVertexBuffer=k.createBuffer();N.__webglColorBuffer=k.createBuffer();N.__webglLineDistanceBuffer=k.createBuffer();K.info.memory.geometries++;var M=m,fa=b,ga=M.vertices.length;M.__vertexArray=new Float32Array(3*ga);M.__colorArray=new Float32Array(3*ga);M.__lineDistanceArray=new Float32Array(1*ga);M.__webglLineCount=ga;c(M,fa);m.verticesNeedUpdate=!0;m.colorsNeedUpdate=!0;m.lineDistancesNeedUpdate=!0}}else if(b instanceof THREE.ParticleSystem&&(m=b.geometry,!m.__webglVertexBuffer))if(m instanceof
 THREE.Geometry){var S=m;S.__webglVertexBuffer=k.createBuffer();S.__webglColorBuffer=k.createBuffer();K.info.memory.geometries++;var Z=m,ca=b,U=Z.vertices.length;Z.__vertexArray=new Float32Array(3*U);Z.__colorArray=new Float32Array(3*U);Z.__sortArray=[];Z.__webglParticleCount=U;c(Z,ca);m.verticesNeedUpdate=!0;m.colorsNeedUpdate=!0}else m instanceof THREE.BufferGeometry&&h(m);if(!b.__webglActive){if(b instanceof THREE.Mesh)if(m=b.geometry,m instanceof THREE.BufferGeometry)s(l.__webglObjects,m,b);else for(n in m.geometryGroups)o=
 m.geometryGroups[n],s(l.__webglObjects,o,b);else b instanceof THREE.Ribbon||b instanceof THREE.Line||b instanceof THREE.ParticleSystem?(m=b.geometry,s(l.__webglObjects,m,b)):b instanceof THREE.ImmediateRenderObject||b.immediateRenderCallback?l.__webglObjectsImmediate.push({object:b,opaque:null,transparent:null}):b instanceof THREE.Sprite?l.__webglSprites.push(b):b instanceof THREE.LensFlare&&l.__webglFlares.push(b);b.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var aa=
-a.__objectsRemoved[0],ja=a;aa instanceof THREE.Mesh||aa instanceof THREE.ParticleSystem||aa instanceof THREE.Ribbon||aa instanceof THREE.Line?z(ja.__webglObjects,aa):aa instanceof THREE.Sprite?w(ja.__webglSprites,aa):aa instanceof THREE.LensFlare?w(ja.__webglFlares,aa):(aa instanceof THREE.ImmediateRenderObject||aa.immediateRenderCallback)&&z(ja.__webglObjectsImmediate,aa);aa.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var Aa=0,va=a.__webglObjects.length;Aa<va;Aa++){var ua=a.__webglObjects[Aa].object,
+a.__objectsRemoved[0],ja=a;aa instanceof THREE.Mesh||aa instanceof THREE.ParticleSystem||aa instanceof THREE.Ribbon||aa instanceof THREE.Line?A(ja.__webglObjects,aa):aa instanceof THREE.Sprite?w(ja.__webglSprites,aa):aa instanceof THREE.LensFlare?w(ja.__webglFlares,aa):(aa instanceof THREE.ImmediateRenderObject||aa.immediateRenderCallback)&&A(ja.__webglObjectsImmediate,aa);aa.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var Aa=0,va=a.__webglObjects.length;Aa<va;Aa++){var ua=a.__webglObjects[Aa].object,
 ba=ua.geometry,ta=void 0,Ba=void 0,ka=void 0;if(ua instanceof THREE.Mesh)if(ba instanceof THREE.BufferGeometry)(ba.verticesNeedUpdate||ba.elementsNeedUpdate||ba.uvsNeedUpdate||ba.normalsNeedUpdate||ba.colorsNeedUpdate||ba.tangentsNeedUpdate)&&j(ba,k.DYNAMIC_DRAW,!ba.dynamic),ba.verticesNeedUpdate=!1,ba.elementsNeedUpdate=!1,ba.uvsNeedUpdate=!1,ba.normalsNeedUpdate=!1,ba.colorsNeedUpdate=!1,ba.tangentsNeedUpdate=!1;else{for(var Ka=0,La=ba.geometryGroupsList.length;Ka<La;Ka++)if(ta=ba.geometryGroupsList[Ka],
 ka=e(ua,ta),ba.buffersNeedUpdate&&d(ta,ua),Ba=ka.attributes&&t(ka),ba.verticesNeedUpdate||ba.morphTargetsNeedUpdate||ba.elementsNeedUpdate||ba.uvsNeedUpdate||ba.normalsNeedUpdate||ba.colorsNeedUpdate||ba.tangentsNeedUpdate||Ba){var qa=ta,Na=ua,wa=k.DYNAMIC_DRAW,db=!ba.dynamic,Ua=ka;if(qa.__inittedArrays){var fb=f(Ua),hb=Ua.vertexColors?Ua.vertexColors:!1,xb=g(Ua),gb=fb===THREE.SmoothShading,F=void 0,$=void 0,Za=void 0,T=void 0,eb=void 0,$a=void 0,Db=void 0,nb=void 0,ab=void 0,lb=void 0,mb=void 0,
 W=void 0,X=void 0,Y=void 0,pa=void 0,Eb=void 0,Fb=void 0,Gb=void 0,pb=void 0,Hb=void 0,Ib=void 0,Jb=void 0,qb=void 0,Kb=void 0,Lb=void 0,Mb=void 0,yb=void 0,Nb=void 0,Ob=void 0,Pb=void 0,Ab=void 0,Qb=void 0,Rb=void 0,Sb=void 0,Bb=void 0,xa=void 0,ec=void 0,Zb=void 0,ic=void 0,jc=void 0,Ra=void 0,fc=void 0,Pa=void 0,Qa=void 0,$b=void 0,Ub=void 0,Ja=0,Oa=0,Vb=0,Wb=0,tb=0,Xa=0,Ca=0,cb=0,Ma=0,ha=0,la=0,y=0,ya=void 0,Sa=qa.__vertexArray,nc=qa.__uvArray,oc=qa.__uv2Array,ub=qa.__normalArray,Fa=qa.__tangentArray,
@@ -506,23 +505,23 @@ a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],e=0,f=d.length;e<f;e++)
 d.materialIndex;n.materialIndex=d.materialIndex;m.a=e;m.b=i;m.c=l;n.a=i;n.b=j;n.c=l;4===d.vertexColors.length&&(m.vertexColors[0]=d.vertexColors[0].clone(),m.vertexColors[1]=d.vertexColors[1].clone(),m.vertexColors[2]=d.vertexColors[3].clone(),n.vertexColors[0]=d.vertexColors[1].clone(),n.vertexColors[1]=d.vertexColors[2].clone(),n.vertexColors[2]=d.vertexColors[3].clone());f.push(m,n);d=0;for(e=a.faceVertexUvs.length;d<e;d++)a.faceVertexUvs[d].length&&(m=a.faceVertexUvs[d][b],i=m[1],j=m[2],l=m[3],
 m=[m[0].clone(),i.clone(),l.clone()],i=[i.clone(),j.clone(),l.clone()],h[d].push(m,i));d=0;for(e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d][b]);d=0;for(e=a.faceVertexUvs.length;d<e;d++)h[d].push(a.faceVertexUvs[d][b])}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=
 [],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],j=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());b.push(j.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],b.push(g.clone()),b.push(h.clone()),b.push(i.clone()),f.a=e,f.b=e+1,f.c=e+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,
-g,h,i,j,l,m,n,p,o,s,t,q,z,w,r,E=[],A=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)A[c]=[];c=0;for(d=a.faces.length;c<d;c++)if(e=a.faces[c],e instanceof THREE.Face3)if(f=e.a,g=e.b,h=e.c,j=a.vertices[f],l=a.vertices[g],m=a.vertices[h],p=j.distanceTo(l),o=l.distanceTo(m),n=j.distanceTo(m),p>b||o>b||n>b){i=a.vertices.length;w=e.clone();r=e.clone();p>=o&&p>=n?(j=j.clone(),j.lerpSelf(l,0.5),w.a=f,w.b=i,w.c=h,r.a=i,r.b=g,r.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],
+g,h,i,j,l,m,n,p,o,s,t,q,A,w,r,E=[],z=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)z[c]=[];c=0;for(d=a.faces.length;c<d;c++)if(e=a.faces[c],e instanceof THREE.Face3)if(f=e.a,g=e.b,h=e.c,j=a.vertices[f],l=a.vertices[g],m=a.vertices[h],p=j.distanceTo(l),o=l.distanceTo(m),n=j.distanceTo(m),p>b||o>b||n>b){i=a.vertices.length;w=e.clone();r=e.clone();p>=o&&p>=n?(j=j.clone(),j.lerpSelf(l,0.5),w.a=f,w.b=i,w.c=h,r.a=i,r.b=g,r.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],
 0.5),w.vertexNormals[1].copy(f),r.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),w.vertexColors[1].copy(f),r.vertexColors[0].copy(f)),e=0):o>=p&&o>=n?(j=l.clone(),j.lerpSelf(m,0.5),w.a=f,w.b=g,w.c=i,r.a=i,r.b=h,r.c=f,3===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),w.vertexNormals[2].copy(f),r.vertexNormals[0].copy(f),r.vertexNormals[1].copy(e.vertexNormals[2]),r.vertexNormals[2].copy(e.vertexNormals[0])),
 3===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),w.vertexColors[2].copy(f),r.vertexColors[0].copy(f),r.vertexColors[1].copy(e.vertexColors[2]),r.vertexColors[2].copy(e.vertexColors[0])),e=1):(j=j.clone(),j.lerpSelf(m,0.5),w.a=f,w.b=g,w.c=i,r.a=i,r.b=g,r.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[2],0.5),w.vertexNormals[2].copy(f),r.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),
 f.lerpSelf(e.vertexColors[2],0.5),w.vertexColors[2].copy(f),r.vertexColors[0].copy(f)),e=2);E.push(w,r);a.vertices.push(j);f=0;for(g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(j=a.faceVertexUvs[f][c],r=j[0],h=j[1],w=j[2],0===e?(l=r.clone(),l.lerpSelf(h,0.5),j=[r.clone(),l.clone(),w.clone()],h=[l.clone(),h.clone(),w.clone()]):1===e?(l=h.clone(),l.lerpSelf(w,0.5),j=[r.clone(),h.clone(),l.clone()],h=[l.clone(),w.clone(),r.clone()]):(l=r.clone(),l.lerpSelf(w,0.5),j=[r.clone(),h.clone(),
-l.clone()],h=[l.clone(),h.clone(),w.clone()]),A[f].push(j,h))}else{E.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)A[f].push(a.faceVertexUvs[f][c])}else if(f=e.a,g=e.b,h=e.c,i=e.d,j=a.vertices[f],l=a.vertices[g],m=a.vertices[h],n=a.vertices[i],p=j.distanceTo(l),o=l.distanceTo(m),s=m.distanceTo(n),t=j.distanceTo(n),p>b||o>b||s>b||t>b){q=a.vertices.length;z=a.vertices.length+1;w=e.clone();r=e.clone();p>=o&&p>=s&&p>=t||s>=o&&s>=p&&s>=t?(p=j.clone(),p.lerpSelf(l,0.5),l=m.clone(),l.lerpSelf(n,0.5),
-w.a=f,w.b=q,w.c=z,w.d=i,r.a=q,r.b=g,r.c=h,r.d=z,4===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),g=e.vertexNormals[2].clone(),g.lerpSelf(e.vertexNormals[3],0.5),w.vertexNormals[1].copy(f),w.vertexNormals[2].copy(g),r.vertexNormals[0].copy(f),r.vertexNormals[3].copy(g)),4===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),g=e.vertexColors[2].clone(),g.lerpSelf(e.vertexColors[3],0.5),w.vertexColors[1].copy(f),w.vertexColors[2].copy(g),
-r.vertexColors[0].copy(f),r.vertexColors[3].copy(g)),e=0):(p=l.clone(),p.lerpSelf(m,0.5),l=n.clone(),l.lerpSelf(j,0.5),w.a=f,w.b=g,w.c=q,w.d=z,r.a=z,r.b=q,r.c=h,r.d=i,4===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),g=e.vertexNormals[3].clone(),g.lerpSelf(e.vertexNormals[0],0.5),w.vertexNormals[2].copy(f),w.vertexNormals[3].copy(g),r.vertexNormals[0].copy(g),r.vertexNormals[1].copy(f)),4===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],
+l.clone()],h=[l.clone(),h.clone(),w.clone()]),z[f].push(j,h))}else{E.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)z[f].push(a.faceVertexUvs[f][c])}else if(f=e.a,g=e.b,h=e.c,i=e.d,j=a.vertices[f],l=a.vertices[g],m=a.vertices[h],n=a.vertices[i],p=j.distanceTo(l),o=l.distanceTo(m),s=m.distanceTo(n),t=j.distanceTo(n),p>b||o>b||s>b||t>b){q=a.vertices.length;A=a.vertices.length+1;w=e.clone();r=e.clone();p>=o&&p>=s&&p>=t||s>=o&&s>=p&&s>=t?(p=j.clone(),p.lerpSelf(l,0.5),l=m.clone(),l.lerpSelf(n,0.5),
+w.a=f,w.b=q,w.c=A,w.d=i,r.a=q,r.b=g,r.c=h,r.d=A,4===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),g=e.vertexNormals[2].clone(),g.lerpSelf(e.vertexNormals[3],0.5),w.vertexNormals[1].copy(f),w.vertexNormals[2].copy(g),r.vertexNormals[0].copy(f),r.vertexNormals[3].copy(g)),4===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),g=e.vertexColors[2].clone(),g.lerpSelf(e.vertexColors[3],0.5),w.vertexColors[1].copy(f),w.vertexColors[2].copy(g),
+r.vertexColors[0].copy(f),r.vertexColors[3].copy(g)),e=0):(p=l.clone(),p.lerpSelf(m,0.5),l=n.clone(),l.lerpSelf(j,0.5),w.a=f,w.b=g,w.c=q,w.d=A,r.a=A,r.b=q,r.c=h,r.d=i,4===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),g=e.vertexNormals[3].clone(),g.lerpSelf(e.vertexNormals[0],0.5),w.vertexNormals[2].copy(f),w.vertexNormals[3].copy(g),r.vertexNormals[0].copy(g),r.vertexNormals[1].copy(f)),4===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],
 0.5),g=e.vertexColors[3].clone(),g.lerpSelf(e.vertexColors[0],0.5),w.vertexColors[2].copy(f),w.vertexColors[3].copy(g),r.vertexColors[0].copy(g),r.vertexColors[1].copy(f)),e=1);E.push(w,r);a.vertices.push(p,l);f=0;for(g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(j=a.faceVertexUvs[f][c],r=j[0],h=j[1],w=j[2],j=j[3],0===e?(l=r.clone(),l.lerpSelf(h,0.5),m=w.clone(),m.lerpSelf(j,0.5),r=[r.clone(),l.clone(),m.clone(),j.clone()],h=[l.clone(),h.clone(),w.clone(),m.clone()]):(l=h.clone(),l.lerpSelf(w,
-0.5),m=j.clone(),m.lerpSelf(r,0.5),r=[r.clone(),h.clone(),l.clone(),m.clone()],h=[m.clone(),l.clone(),w.clone(),j.clone()]),A[f].push(r,h))}else{E.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)A[f].push(a.faceVertexUvs[f][c])}a.faces=E;a.faceVertexUvs=A}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+0.5),m=j.clone(),m.lerpSelf(r,0.5),r=[r.clone(),h.clone(),l.clone(),m.clone()],h=[m.clone(),l.clone(),w.clone(),j.clone()]),z[f].push(r,h))}else{E.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)z[f].push(a.faceVertexUvs[f][c])}a.faces=E;a.faceVertexUvs=z}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new Image,f=new THREE.Texture(e,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){f.image=a.content;f.needsUpdate=!0;c&&c(f)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a,e);f.sourceFile=a;return f},loadCompressedTexture:function(a,b,c,d){var e=new THREE.CompressedTexture;e.mapping=b;var f=new XMLHttpRequest;f.onload=function(){var a=THREE.ImageUtils.parseDDS(f.response,
 !0);e.format=a.format;e.mipmaps=a.mipmaps;e.image.width=a.width;e.image.height=a.height;e.generateMipmaps=!1;e.needsUpdate=!0;c&&c(e)};f.onerror=d;f.open("GET",a,!0);f.responseType="arraybuffer";f.send(null);return e},loadTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.Texture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;for(var b=0,g=a.length;b<g;++b){var h=new Image;e[b]=h;h.onload=function(){e.loadCount=e.loadCount+1;if(e.loadCount===6){f.needsUpdate=true;c&&c()}};h.onerror=
 d;h.crossOrigin=this.crossOrigin;h.src=a[b]}return f},loadCompressedTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.CompressedTexture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;f.generateMipmaps=!1;for(var b=function(a,b){return function(){var d=THREE.ImageUtils.parseDDS(a.response,true);b.format=d.format;b.mipmaps=d.mipmaps;b.width=d.width;b.height=d.height;e.loadCount=e.loadCount+1;if(e.loadCount===6){f.format=d.format;f.needsUpdate=true;c&&c()}}},g=0,h=a.length;g<h;++g){var i=
 {};e[g]=i;var j=new XMLHttpRequest;j.onload=b(j,i);j.onerror=d;j.open("GET",a[g],!0);j.responseType="arraybuffer";j.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},e=c("DXT1"),f=c("DXT3"),g=c("DXT5"),h=new Int32Array(a,0,31);if(542327876!==h[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),d;if(!h[20]&4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),
 d;var i=h[21];switch(i){case e:e=8;d.format=THREE.RGB_S3TC_DXT1_Format;break;case f:e=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case g:e=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;h[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,h[7]));d.width=h[4];d.height=h[3];h=h[1]+4;f=d.width;g=d.height;for(i=0;i<d.mipmapCount;i++){var j=Math.max(4,f)/
 4*Math.max(4,g)/4*e,l={data:new Uint8Array(a,h,j),width:f,height:g};d.mipmaps.push(l);h+=j;f=Math.max(0.5*f,1);g=Math.max(0.5*g,1)}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,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),j=i.data,l=0;l<d;l++)for(var m=0;m<e;m++){var n=
-0>m-1?0:m-1,p=m+1>e-1?e-1:m+1,o=0>l-1?0:l-1,s=l+1>d-1?d-1:l+1,t=[],q=[0,0,h[4*(m*d+l)]/255*b];t.push([-1,0,h[4*(m*d+o)]/255*b]);t.push([-1,-1,h[4*(n*d+o)]/255*b]);t.push([0,-1,h[4*(n*d+l)]/255*b]);t.push([1,-1,h[4*(n*d+s)]/255*b]);t.push([1,0,h[4*(m*d+s)]/255*b]);t.push([1,1,h[4*(p*d+s)]/255*b]);t.push([0,1,h[4*(p*d+l)]/255*b]);t.push([-1,1,h[4*(p*d+o)]/255*b]);n=[];o=t.length;for(p=0;p<o;p++){var s=t[p],z=t[(p+1)%o],s=[s[0]-q[0],s[1]-q[1],s[2]-q[2]],z=[z[0]-q[0],z[1]-q[1],z[2]-q[2]];n.push(c([s[1]*
-z[2]-s[2]*z[1],s[2]*z[0]-s[0]*z[2],s[0]*z[1]-s[1]*z[0]]))}t=[0,0,0];for(p=0;p<n.length;p++)t[0]+=n[p][0],t[1]+=n[p][1],t[2]+=n[p][2];t[0]/=n.length;t[1]/=n.length;t[2]/=n.length;q=4*(m*d+l);j[q]=255*((t[0]+1)/2)|0;j[q+1]=255*((t[1]+1)/2)|0;j[q+2]=255*t[2]|0;j[q+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,
+0>m-1?0:m-1,p=m+1>e-1?e-1:m+1,o=0>l-1?0:l-1,s=l+1>d-1?d-1:l+1,t=[],q=[0,0,h[4*(m*d+l)]/255*b];t.push([-1,0,h[4*(m*d+o)]/255*b]);t.push([-1,-1,h[4*(n*d+o)]/255*b]);t.push([0,-1,h[4*(n*d+l)]/255*b]);t.push([1,-1,h[4*(n*d+s)]/255*b]);t.push([1,0,h[4*(m*d+s)]/255*b]);t.push([1,1,h[4*(p*d+s)]/255*b]);t.push([0,1,h[4*(p*d+l)]/255*b]);t.push([-1,1,h[4*(p*d+o)]/255*b]);n=[];o=t.length;for(p=0;p<o;p++){var s=t[p],A=t[(p+1)%o],s=[s[0]-q[0],s[1]-q[1],s[2]-q[2]],A=[A[0]-q[0],A[1]-q[1],A[2]-q[2]];n.push(c([s[1]*
+A[2]-s[2]*A[1],s[2]*A[0]-s[0]*A[2],s[0]*A[1]-s[1]*A[0]]))}t=[0,0,0];for(p=0;p<n.length;p++)t[0]+=n[p][0],t[1]+=n[p][1],t[2]+=n[p][2];t[0]/=n.length;t[1]/=n.length;t[2]/=n.length;q=4*(m*d+l);j[q]=255*((t[0]+1)/2)|0;j[q+1]=255*((t[1]+1)/2)|0;j[q+2]=255*t[2]|0;j[q+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,
 a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};
 THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );\nvec3 I = worldPosition.xyz - cameraPosition;\nvReflect = reflect( I, worldNormal );\nvRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
@@ -535,10 +534,10 @@ THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"
 cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vWorldPosition;\nvoid main() {\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvWorldPosition = worldPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\nvoid main() {\ngl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.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,e=String(a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,j,l,m,n,p,o,s,t,q=b.glyphs[a]||b.glyphs["?"];if(q){if(q.o){b=q._cachedOutline||(q._cachedOutline=q.o.split(" "));j=b.length;for(a=0;a<j;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;l=b[a++]*c;e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;e.lineTo(i,l);break;case "q":i=b[a++]*
-c+d;l=b[a++]*c;p=b[a++]*c+d;o=b[a++]*c;e.quadraticCurveTo(p,o,i,l);if(g=f[f.length-1]){m=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){var z=g/h;THREE.Shape.Utils.b2(z,m,p,i);THREE.Shape.Utils.b2(z,n,o,l)}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,p=b[a++]*c+d,o=b[a++]*-c,s=b[a++]*c+d,t=b[a++]*-c,e.bezierCurveTo(i,l,p,o,s,t),g=f[f.length-1]){m=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++)z=g/h,THREE.Shape.Utils.b3(z,m,p,s,i),THREE.Shape.Utils.b3(z,n,o,t,l)}}}return{offset:q.ha*c,path:e}}}};
+c+d;l=b[a++]*c;p=b[a++]*c+d;o=b[a++]*c;e.quadraticCurveTo(p,o,i,l);if(g=f[f.length-1]){m=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){var A=g/h;THREE.Shape.Utils.b2(A,m,p,i);THREE.Shape.Utils.b2(A,n,o,l)}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,p=b[a++]*c+d,o=b[a++]*-c,s=b[a++]*c+d,t=b[a++]*-c,e.bezierCurveTo(i,l,p,o,s,t),g=f[f.length-1]){m=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++)A=g/h,THREE.Shape.Utils.b3(A,m,p,s,i),THREE.Shape.Utils.b3(A,n,o,t,l)}}}return{offset:q.ha*c,path:e}}}};
 THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,j,l;if(0<b(a))for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var m=2*e;for(j=e-1;2<e;){if(0>=m--){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);l=j+1;e<=l&&(l=0);var n;a:{n=a;var p=i,o=j,s=l,t=e,q=g,z=void 0,w=void 0,r=void 0,E=void 0,A=void 0,
-v=void 0,u=void 0,D=void 0,C=void 0,w=n[q[p]].x,r=n[q[p]].y,E=n[q[o]].x,A=n[q[o]].y,v=n[q[s]].x,u=n[q[s]].y;if(1E-10>(E-w)*(u-r)-(A-r)*(v-w))n=!1;else{for(z=0;z<t;z++)if(!(z==p||z==o||z==s)){var D=n[q[z]].x,C=n[q[z]].y,G=void 0,P=void 0,B=void 0,J=void 0,H=void 0,I=void 0,L=void 0,N=void 0,S=void 0,U=void 0,M=void 0,O=void 0,G=B=H=void 0,G=v-E,P=u-A,B=w-v,J=r-u,H=E-w,I=A-r,L=D-w,N=C-r,S=D-E,U=C-A,M=D-v,O=C-u,G=G*U-P*S,H=H*N-I*L,B=B*O-J*M;if(0<=G&&0<=B&&0<=H){n=!1;break a}}n=!0}}if(n){f.push([a[g[i]],
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,j,l;if(0<b(a))for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var m=2*e;for(j=e-1;2<e;){if(0>=m--){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);l=j+1;e<=l&&(l=0);var n;a:{n=a;var p=i,o=j,s=l,t=e,q=g,A=void 0,w=void 0,r=void 0,E=void 0,z=void 0,
+v=void 0,u=void 0,D=void 0,C=void 0,w=n[q[p]].x,r=n[q[p]].y,E=n[q[o]].x,z=n[q[o]].y,v=n[q[s]].x,u=n[q[s]].y;if(1E-10>(E-w)*(u-r)-(z-r)*(v-w))n=!1;else{for(A=0;A<t;A++)if(!(A==p||A==o||A==s)){var D=n[q[A]].x,C=n[q[A]].y,G=void 0,P=void 0,B=void 0,J=void 0,H=void 0,I=void 0,L=void 0,N=void 0,S=void 0,U=void 0,M=void 0,O=void 0,G=B=H=void 0,G=v-E,P=u-z,B=w-v,J=r-u,H=E-w,I=z-r,L=D-w,N=C-r,S=D-E,U=C-z,M=D-v,O=C-u,G=G*U-P*S,H=H*N-I*L,B=B*O-J*M;if(0<=G&&0<=B&&0<=H){n=!1;break a}}n=!0}}if(n){f.push([a[g[i]],
 a[g[j]],a[g[l]]]);h.push([g[i],g[j],g[l]]);i=j;for(l=j+1;l<e;i++,l++)g[i]=g[l];e--;m=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.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=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};
@@ -623,21 +622,21 @@ THREE.AsteriskGeometry=function(a,b){THREE.Geometry.call(this);for(var c=0.707*a
 THREE.AsteriskGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=void 0!==c?c:0,d=void 0!==d?d:2*Math.PI,b=void 0!==b?Math.max(3,b):8,e,f=[];e=new THREE.Vector3;var g=new THREE.UV(0.5,0.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3;h.x=a*Math.cos(c+e/b*d);h.y=a*Math.sin(c+e/b*d);this.vertices.push(h);f.push(new THREE.UV((h.x/a+1)/2,-(h.y/a+1)/2+1))}c=new THREE.Vector3(0,0,-1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c,c,c])),this.faceVertexUvs[0].push([f[e],
 f[e+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,e,f){function g(a,b,c,d,e,f,g,s){var t,q=h.widthSegments,z=h.heightSegments,w=e/2,r=f/2,E=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)t="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)t="y",z=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)t="x",q=h.depthSegments;var A=q+1,v=z+1,u=e/q,D=f/z,C=new THREE.Vector3;C[t]=0<g?1:-1;for(e=0;e<v;e++)for(f=0;f<A;f++){var G=new THREE.Vector3;G[a]=(f*u-w)*c;G[b]=(e*D-r)*d;G[t]=g;h.vertices.push(G)}for(e=
-0;e<z;e++)for(f=0;f<q;f++)a=new THREE.Face4(f+A*e+E,f+A*(e+1)+E,f+1+A*(e+1)+E,f+1+A*e+E),a.normal.copy(C),a.vertexNormals.push(C.clone(),C.clone(),C.clone(),C.clone()),a.materialIndex=s,h.faces.push(a),h.faceVertexUvs[0].push([new THREE.UV(f/q,1-e/z),new THREE.UV(f/q,1-(e+1)/z),new THREE.UV((f+1)/q,1-(e+1)/z),new THREE.UV((f+1)/q,1-e/z)])}THREE.Geometry.call(this);var h=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;a=this.width/
+THREE.CubeGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,s){var t,q=h.widthSegments,A=h.heightSegments,w=e/2,r=f/2,E=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)t="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)t="y",A=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)t="x",q=h.depthSegments;var z=q+1,v=A+1,u=e/q,D=f/A,C=new THREE.Vector3;C[t]=0<g?1:-1;for(e=0;e<v;e++)for(f=0;f<z;f++){var G=new THREE.Vector3;G[a]=(f*u-w)*c;G[b]=(e*D-r)*d;G[t]=g;h.vertices.push(G)}for(e=
+0;e<A;e++)for(f=0;f<q;f++)a=new THREE.Face4(f+z*e+E,f+z*(e+1)+E,f+1+z*(e+1)+E,f+1+z*e+E),a.normal.copy(C),a.vertexNormals.push(C.clone(),C.clone(),C.clone(),C.clone()),a.materialIndex=s,h.faces.push(a),h.faceVertexUvs[0].push([new THREE.UV(f/q,1-e/A),new THREE.UV(f/q,1-(e+1)/A),new THREE.UV((f+1)/q,1-(e+1)/A),new THREE.UV((f+1)/q,1-e/A)])}THREE.Geometry.call(this);var h=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;a=this.width/
 2;b=this.height/2;c=this.depth/2;g("z","y",-1,-1,this.depth,this.height,a,0);g("z","y",1,-1,this.depth,this.height,-a,1);g("x","z",1,1,this.width,this.depth,b,2);g("x","z",1,-1,this.width,this.depth,-b,3);g("x","y",1,-1,this.width,this.height,c,4);g("x","y",-1,-1,this.width,this.height,-c,5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,j=[],l=[];for(i=0;i<=e;i++){var m=[],n=[],p=i/e,o=p*(b-a)+a;for(h=0;h<=d;h++){var s=h/d,t=new THREE.Vector3;t.x=o*Math.sin(2*s*Math.PI);t.y=-p*c+g;t.z=o*Math.cos(2*s*Math.PI);this.vertices.push(t);m.push(this.vertices.length-1);n.push(new THREE.UV(s,1-p))}j.push(m);l.push(n)}c=(b-a)/c;for(h=0;h<d;h++){0!==a?(m=this.vertices[j[0][h]].clone(),n=this.vertices[j[0][h+
-1]].clone()):(m=this.vertices[j[1][h]].clone(),n=this.vertices[j[1][h+1]].clone());m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(i=0;i<e;i++){var p=j[i][h],o=j[i+1][h],s=j[i+1][h+1],t=j[i][h+1],q=m.clone(),z=m.clone(),w=n.clone(),r=n.clone(),E=l[i][h].clone(),A=l[i+1][h].clone(),v=l[i+1][h+1].clone(),u=l[i][h+1].clone();this.faces.push(new THREE.Face4(p,o,s,t,[q,z,w,r]));this.faceVertexUvs[0].push([E,A,v,u])}}if(!f&&0<a){this.vertices.push(new THREE.Vector3(0,
-g,0));for(h=0;h<d;h++)p=j[0][h],o=j[0][h+1],s=this.vertices.length-1,q=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),E=l[0][h].clone(),A=l[0][h+1].clone(),v=new THREE.UV(A.u,0),this.faces.push(new THREE.Face3(p,o,s,[q,z,w])),this.faceVertexUvs[0].push([E,A,v])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)p=j[i][h+1],o=j[i][h],s=this.vertices.length-1,q=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),E=
-l[i][h+1].clone(),A=l[i][h].clone(),v=new THREE.UV(A.u,1),this.faces.push(new THREE.Face3(p,o,s,[q,z,w])),this.faceVertexUvs[0].push([E,A,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};
+1]].clone()):(m=this.vertices[j[1][h]].clone(),n=this.vertices[j[1][h+1]].clone());m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(i=0;i<e;i++){var p=j[i][h],o=j[i+1][h],s=j[i+1][h+1],t=j[i][h+1],q=m.clone(),A=m.clone(),w=n.clone(),r=n.clone(),E=l[i][h].clone(),z=l[i+1][h].clone(),v=l[i+1][h+1].clone(),u=l[i][h+1].clone();this.faces.push(new THREE.Face4(p,o,s,t,[q,A,w,r]));this.faceVertexUvs[0].push([E,z,v,u])}}if(!f&&0<a){this.vertices.push(new THREE.Vector3(0,
+g,0));for(h=0;h<d;h++)p=j[0][h],o=j[0][h+1],s=this.vertices.length-1,q=new THREE.Vector3(0,1,0),A=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),E=l[0][h].clone(),z=l[0][h+1].clone(),v=new THREE.UV(z.u,0),this.faces.push(new THREE.Face3(p,o,s,[q,A,w])),this.faceVertexUvs[0].push([E,z,v])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)p=j[i][h+1],o=j[i][h],s=this.vertices.length-1,q=new THREE.Vector3(0,-1,0),A=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),E=
+l[i][h+1].clone(),z=l[i][h].clone(),v=new THREE.UV(z.u,1),this.faces.push(new THREE.Face3(p,o,s,[q,A,w])),this.faceVertexUvs[0].push([E,z,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};
 THREE.ExtrudeGeometry.prototype=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);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(O=c.length;0<=--O;){e=O;f=O-1;0>f&&(f=c.length-1);
-for(var g=0,h=n+2*l,g=0;g<h;g++){var i=S*g,j=S*(g+1),m=d+e+i,i=d+f+i,o=d+f+j,j=d+e+j,p=c,s=g,r=h,t=e,u=f,m=m+G,i=i+G,o=o+G,j=j+G;C.faces.push(new THREE.Face4(m,i,o,j,null,null,q));m=z.generateSideWallUV(C,a,p,b,m,i,o,j,s,r,t,u);C.faceVertexUvs[0].push(m)}}}function f(a,b,c){C.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=G;d+=G;e+=G;C.faces.push(new THREE.Face3(c,d,e,null,null,t));c=f?z.generateBottomUV(C,a,b,c,d,e):z.generateTopUV(C,a,b,c,d,e);C.faceVertexUvs[0].push(c)}var h=void 0!==
-b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:3,m=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.steps?b.steps:1,p=b.extrudePath,o,s=!1,t=b.material,q=b.extrudeMaterial,z=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,r,E,A;p&&(o=p.getSpacedPoints(n),s=!0,m=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(p,n,!1),r=new THREE.Vector3,E=new THREE.Vector3,
-A=new THREE.Vector3);m||(j=i=l=0);var v,u,D,C=this,G=this.vertices.length,p=a.extractPoints(),P=p.shape,p=p.holes,B=!THREE.Shape.Utils.isClockWise(P);if(B){P=P.reverse();u=0;for(D=p.length;u<D;u++)v=p[u],THREE.Shape.Utils.isClockWise(v)&&(p[u]=v.reverse());B=!1}var J=THREE.Shape.Utils.triangulateShape(P,p),B=P;u=0;for(D=p.length;u<D;u++)v=p[u],P=P.concat(v);var H,I,L,N,S=P.length,U=J.length,M=[],O=0,Q=B.length;H=Q-1;for(I=O+1;O<Q;O++,H++,I++)H===Q&&(H=0),I===Q&&(I=0),M[O]=d(B[O],B[H],B[I]);var Z=
+for(var g=0,h=n+2*l,g=0;g<h;g++){var i=S*g,j=S*(g+1),m=d+e+i,i=d+f+i,o=d+f+j,j=d+e+j,p=c,s=g,r=h,t=e,u=f,m=m+G,i=i+G,o=o+G,j=j+G;C.faces.push(new THREE.Face4(m,i,o,j,null,null,q));m=A.generateSideWallUV(C,a,p,b,m,i,o,j,s,r,t,u);C.faceVertexUvs[0].push(m)}}}function f(a,b,c){C.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=G;d+=G;e+=G;C.faces.push(new THREE.Face3(c,d,e,null,null,t));c=f?A.generateBottomUV(C,a,b,c,d,e):A.generateTopUV(C,a,b,c,d,e);C.faceVertexUvs[0].push(c)}var h=void 0!==
+b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:3,m=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.steps?b.steps:1,p=b.extrudePath,o,s=!1,t=b.material,q=b.extrudeMaterial,A=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,r,E,z;p&&(o=p.getSpacedPoints(n),s=!0,m=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(p,n,!1),r=new THREE.Vector3,E=new THREE.Vector3,
+z=new THREE.Vector3);m||(j=i=l=0);var v,u,D,C=this,G=this.vertices.length,p=a.extractPoints(),P=p.shape,p=p.holes,B=!THREE.Shape.Utils.isClockWise(P);if(B){P=P.reverse();u=0;for(D=p.length;u<D;u++)v=p[u],THREE.Shape.Utils.isClockWise(v)&&(p[u]=v.reverse());B=!1}var J=THREE.Shape.Utils.triangulateShape(P,p),B=P;u=0;for(D=p.length;u<D;u++)v=p[u],P=P.concat(v);var H,I,L,N,S=P.length,U=J.length,M=[],O=0,Q=B.length;H=Q-1;for(I=O+1;O<Q;O++,H++,I++)H===Q&&(H=0),I===Q&&(I=0),M[O]=d(B[O],B[H],B[I]);var Z=
 [],K,ja=M.concat();u=0;for(D=p.length;u<D;u++){v=p[u];K=[];O=0;Q=v.length;H=Q-1;for(I=O+1;O<Q;O++,H++,I++)H===Q&&(H=0),I===Q&&(I=0),K[O]=d(v[O],v[H],v[I]);Z.push(K);ja=ja.concat(K)}for(H=0;H<l;H++){v=H/l;L=i*(1-v);I=j*Math.sin(v*Math.PI/2);O=0;for(Q=B.length;O<Q;O++)N=c(B[O],M[O],I),f(N.x,N.y,-L);u=0;for(D=p.length;u<D;u++){v=p[u];K=Z[u];O=0;for(Q=v.length;O<Q;O++)N=c(v[O],K[O],I),f(N.x,N.y,-L)}}I=j;for(O=0;O<S;O++)N=m?c(P[O],ja[O],I):P[O],s?(E.copy(w.normals[0]).multiplyScalar(N.x),r.copy(w.binormals[0]).multiplyScalar(N.y),
-A.copy(o[0]).addSelf(E).addSelf(r),f(A.x,A.y,A.z)):f(N.x,N.y,0);for(v=1;v<=n;v++)for(O=0;O<S;O++)N=m?c(P[O],ja[O],I):P[O],s?(E.copy(w.normals[v]).multiplyScalar(N.x),r.copy(w.binormals[v]).multiplyScalar(N.y),A.copy(o[v]).addSelf(E).addSelf(r),f(A.x,A.y,A.z)):f(N.x,N.y,h/n*v);for(H=l-1;0<=H;H--){v=H/l;L=i*(1-v);I=j*Math.sin(v*Math.PI/2);O=0;for(Q=B.length;O<Q;O++)N=c(B[O],M[O],I),f(N.x,N.y,h+L);u=0;for(D=p.length;u<D;u++){v=p[u];K=Z[u];O=0;for(Q=v.length;O<Q;O++)N=c(v[O],K[O],I),s?f(N.x,N.y+o[n-1].y,
+z.copy(o[0]).addSelf(E).addSelf(r),f(z.x,z.y,z.z)):f(N.x,N.y,0);for(v=1;v<=n;v++)for(O=0;O<S;O++)N=m?c(P[O],ja[O],I):P[O],s?(E.copy(w.normals[v]).multiplyScalar(N.x),r.copy(w.binormals[v]).multiplyScalar(N.y),z.copy(o[v]).addSelf(E).addSelf(r),f(z.x,z.y,z.z)):f(N.x,N.y,h/n*v);for(H=l-1;0<=H;H--){v=H/l;L=i*(1-v);I=j*Math.sin(v*Math.PI/2);O=0;for(Q=B.length;O<Q;O++)N=c(B[O],M[O],I),f(N.x,N.y,h+L);u=0;for(D=p.length;u<D;u++){v=p[u];K=Z[u];O=0;for(Q=v.length;O<Q;O++)N=c(v[O],K[O],I),s?f(N.x,N.y+o[n-1].y,
 o[n-1].x+L):f(N.x,N.y,h+L)}}if(m){i=0*S;for(O=0;O<U;O++)h=J[O],g(h[2]+i,h[1]+i,h[0]+i,!0);i=S*(n+2*l);for(O=0;O<U;O++)h=J[O],g(h[0]+i,h[1]+i,h[2]+i,!1)}else{for(O=0;O<U;O++)h=J[O],g(h[2],h[1],h[0],!0);for(O=0;O<U;O++)h=J[O],g(h[0]+S*n,h[1]+S*n,h[2]+S*n,!1)}h=0;e(B,h);h+=B.length;u=0;for(D=p.length;u<D;u++)v=p[u],e(v,h),h+=v.length};
 THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,a.vertices[d].y),new THREE.UV(b,e),new THREE.UV(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,j=a.vertices[g].x,l=a.vertices[g].y,
 g=a.vertices[g].z,m=a.vertices[h].x,n=a.vertices[h].y,a=a.vertices[h].z;return 0.01>Math.abs(c-i)?[new THREE.UV(b,1-e),new THREE.UV(d,1-f),new THREE.UV(j,1-g),new THREE.UV(m,1-a)]:[new THREE.UV(c,1-e),new THREE.UV(i,1-f),new THREE.UV(l,1-g),new THREE.UV(n,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;
@@ -710,12 +709,12 @@ THREE.SubdivisionModifier=function(a){this.subdivisions=void 0===a?1:a;this.useO
 THREE.GeometryUtils.computeEdgeFaces=function(a){function b(a,b){void 0===g[a]&&(g[a]=[]);g[a].push(b)}var c,d,e,f,g={},h=THREE.GeometryUtils.orderedKey;c=0;for(d=a.faces.length;c<d;c++)e=a.faces[c],e instanceof THREE.Face3?(f=h(e.a,e.b),b(f,c),f=h(e.b,e.c),b(f,c),f=h(e.c,e.a),b(f,c)):e instanceof THREE.Face4&&(f=h(e.a,e.b),b(f,c),f=h(e.b,e.c),b(f,c),f=h(e.c,e.d),b(f,c),f=h(e.d,e.a),b(f,c));return g};
 THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){l.debug&&(console&&console.assert)&&console.assert.apply(console,arguments)}function c(){l.debug&&console.log.apply(console,arguments)}function d(){console&&console.log.apply(console,arguments)}function e(a,b,d,e,g,h,m){var n=new THREE.Face4(a,b,d,e,null,g.color,g.materialIndex);if(l.useOldVertexColors){n.vertexColors=[];for(var o,p,q,s=0;4>s;s++){q=h[s];o=new THREE.Color;o.setRGB(0,0,0);for(var r=0;r<q.length;r++)p=g.vertexColors[q[r]-
 1],o.r+=p.r,o.g+=p.g,o.b+=p.b;o.r/=q.length;o.g/=q.length;o.b/=q.length;n.vertexColors[s]=o}}i.push(n);l.supportUVs&&(g=[f(a,""),f(b,m),f(d,m),f(e,m)],g[0]?g[1]?g[2]?g[3]?j.push(g):c("d :( ",e+":"+m):c("c :( ",d+":"+m):c("b :( ",b+":"+m):c("a :( ",a+":"+m))}function f(a,b){var e=a+":"+b,f=w[e];return!f?(a>=s&&a<s+o.length?c("face pt"):c("edge pt"),d("warning, UV not found for",e),null):f}function g(a,b,c){var e=a+":"+b;e in w?d("dup vertexNo",a,"oldFaceNo",b,"value",c,"key",e,w[e]):w[e]=c}var h=[],
-i=[],j=[],l=this,m=THREE.GeometryUtils.orderedKey,n=THREE.GeometryUtils.computeEdgeFaces,p=a.vertices,o=a.faces,s=p.length,h=p.concat(),t=[],q={},z={},w={},r,E,A,v,u,D=a.faceVertexUvs[0],C;c("originalFaces, uvs, originalVerticesLength",o.length,D.length,s);if(l.supportUVs){r=0;for(E=D.length;r<E;r++){A=0;for(v=D[r].length;A<v;A++)C=o[r]["abcd".charAt(A)],g(C,r,D[r][A])}}0==D.length&&(l.supportUVs=!1);r=0;for(var G in w)r++;r||(l.supportUVs=!1,c("no uvs"));r=0;for(E=o.length;r<E;r++)u=o[r],t.push(u.centroid),
-h.push(u.centroid),l.supportUVs&&(v=new THREE.UV,u instanceof THREE.Face3?(v.u=f(u.a,r).u+f(u.b,r).u+f(u.c,r).u,v.v=f(u.a,r).v+f(u.b,r).v+f(u.c,r).v,v.u/=3,v.v/=3):u instanceof THREE.Face4&&(v.u=f(u.a,r).u+f(u.b,r).u+f(u.c,r).u+f(u.d,r).u,v.v=f(u.a,r).v+f(u.b,r).v+f(u.c,r).v+f(u.d,r).v,v.u/=4,v.v/=4),g(s+r,"",v));var n=n(a),P;E=0;var B,J;G={};D={};for(r in n){C=n[r];B=r.split("_");J=B[0];B=B[1];A=J;u=[J,B];void 0===G[A]&&(G[A]=[]);G[A].push(u);A=B;u=[J,B];void 0===G[A]&&(G[A]=[]);G[A].push(u);A=0;
-for(v=C.length;A<v;A++){u=C[A];P=J;var H=u,I=r;void 0===D[P]&&(D[P]={});D[P][H]=I;P=B;H=r;void 0===D[P]&&(D[P]={});D[P][u]=H}2>C.length&&(z[r]=!0)}for(r in n)if(C=n[r],u=C[0],P=C[1],B=r.split("_"),J=B[0],B=B[1],v=new THREE.Vector3,b(0<C.length,"an edge without faces?!"),1==C.length?(v.addSelf(p[J]),v.addSelf(p[B]),v.multiplyScalar(0.5)):(v.addSelf(t[u]),v.addSelf(t[P]),v.addSelf(p[J]),v.addSelf(p[B]),v.multiplyScalar(0.25)),q[r]=s+o.length+E,h.push(v),E++,l.supportUVs)v=new THREE.UV,v.u=f(J,u).u+
+i=[],j=[],l=this,m=THREE.GeometryUtils.orderedKey,n=THREE.GeometryUtils.computeEdgeFaces,p=a.vertices,o=a.faces,s=p.length,h=p.concat(),t=[],q={},A={},w={},r,E,z,v,u,D=a.faceVertexUvs[0],C;c("originalFaces, uvs, originalVerticesLength",o.length,D.length,s);if(l.supportUVs){r=0;for(E=D.length;r<E;r++){z=0;for(v=D[r].length;z<v;z++)C=o[r]["abcd".charAt(z)],g(C,r,D[r][z])}}0==D.length&&(l.supportUVs=!1);r=0;for(var G in w)r++;r||(l.supportUVs=!1,c("no uvs"));r=0;for(E=o.length;r<E;r++)u=o[r],t.push(u.centroid),
+h.push(u.centroid),l.supportUVs&&(v=new THREE.UV,u instanceof THREE.Face3?(v.u=f(u.a,r).u+f(u.b,r).u+f(u.c,r).u,v.v=f(u.a,r).v+f(u.b,r).v+f(u.c,r).v,v.u/=3,v.v/=3):u instanceof THREE.Face4&&(v.u=f(u.a,r).u+f(u.b,r).u+f(u.c,r).u+f(u.d,r).u,v.v=f(u.a,r).v+f(u.b,r).v+f(u.c,r).v+f(u.d,r).v,v.u/=4,v.v/=4),g(s+r,"",v));var n=n(a),P;E=0;var B,J;G={};D={};for(r in n){C=n[r];B=r.split("_");J=B[0];B=B[1];z=J;u=[J,B];void 0===G[z]&&(G[z]=[]);G[z].push(u);z=B;u=[J,B];void 0===G[z]&&(G[z]=[]);G[z].push(u);z=0;
+for(v=C.length;z<v;z++){u=C[z];P=J;var H=u,I=r;void 0===D[P]&&(D[P]={});D[P][H]=I;P=B;H=r;void 0===D[P]&&(D[P]={});D[P][u]=H}2>C.length&&(A[r]=!0)}for(r in n)if(C=n[r],u=C[0],P=C[1],B=r.split("_"),J=B[0],B=B[1],v=new THREE.Vector3,b(0<C.length,"an edge without faces?!"),1==C.length?(v.addSelf(p[J]),v.addSelf(p[B]),v.multiplyScalar(0.5)):(v.addSelf(t[u]),v.addSelf(t[P]),v.addSelf(p[J]),v.addSelf(p[B]),v.multiplyScalar(0.25)),q[r]=s+o.length+E,h.push(v),E++,l.supportUVs)v=new THREE.UV,v.u=f(J,u).u+
 f(B,u).u,v.v=f(J,u).v+f(B,u).v,v.u/=2,v.v/=2,g(q[r],u,v),2<=C.length&&(b(2==C.length,"did we plan for more than 2 edges?"),v=new THREE.UV,v.u=f(J,P).u+f(B,P).u,v.v=f(J,P).v+f(B,P).v,v.u/=2,v.v/=2,g(q[r],P,v));c("-- Step 2 done");var L,N;v=["123","12","2","23"];P=["123","23","3","31"];var H=["123","31","1","12"],I=["1234","12","2","23"],S=["1234","23","3","34"],U=["1234","34","4","41"],M=["1234","41","1","12"];r=0;for(E=t.length;r<E;r++)u=o[r],C=s+r,u instanceof THREE.Face3?(J=m(u.a,u.b),B=m(u.b,u.c),
-L=m(u.c,u.a),e(C,q[J],u.b,q[B],u,v,r),e(C,q[B],u.c,q[L],u,P,r),e(C,q[L],u.a,q[J],u,H,r)):u instanceof THREE.Face4?(J=m(u.a,u.b),B=m(u.b,u.c),L=m(u.c,u.d),N=m(u.d,u.a),e(C,q[J],u.b,q[B],u,I,r),e(C,q[B],u.c,q[L],u,S,r),e(C,q[L],u.d,q[N],u,U,r),e(C,q[N],u.a,q[J],u,M,r)):c("face should be a face!",u);q=new THREE.Vector3;u=new THREE.Vector3;r=0;for(E=p.length;r<E;r++)if(void 0!==G[r]){q.set(0,0,0);u.set(0,0,0);B=new THREE.Vector3(0,0,0);C=0;for(A in D[r])q.addSelf(t[A]),C++;P=0;J=G[r].length;v=C!=J;for(A=
-0;A<J;A++)z[m(G[r][A][0],G[r][A][1])]&&P++;q.divideScalar(C);P=0;if(v){for(A=0;A<J;A++)if(C=G[r][A],H=1==n[m(C[0],C[1])].length)C=p[C[0]].clone().addSelf(p[C[1]]).divideScalar(2),u.addSelf(C),P++;u.divideScalar(4);b(2==P,"should have only 2 boundary edges")}else{for(A=0;A<J;A++)C=G[r][A],C=p[C[0]].clone().addSelf(p[C[1]]).divideScalar(2),u.addSelf(C);u.divideScalar(J)}B.addSelf(p[r]);v?(B.divideScalar(2),B.addSelf(u)):(B.multiplyScalar(J-3),B.addSelf(q),B.addSelf(u.multiplyScalar(2)),B.divideScalar(J));
+L=m(u.c,u.a),e(C,q[J],u.b,q[B],u,v,r),e(C,q[B],u.c,q[L],u,P,r),e(C,q[L],u.a,q[J],u,H,r)):u instanceof THREE.Face4?(J=m(u.a,u.b),B=m(u.b,u.c),L=m(u.c,u.d),N=m(u.d,u.a),e(C,q[J],u.b,q[B],u,I,r),e(C,q[B],u.c,q[L],u,S,r),e(C,q[L],u.d,q[N],u,U,r),e(C,q[N],u.a,q[J],u,M,r)):c("face should be a face!",u);q=new THREE.Vector3;u=new THREE.Vector3;r=0;for(E=p.length;r<E;r++)if(void 0!==G[r]){q.set(0,0,0);u.set(0,0,0);B=new THREE.Vector3(0,0,0);C=0;for(z in D[r])q.addSelf(t[z]),C++;P=0;J=G[r].length;v=C!=J;for(z=
+0;z<J;z++)A[m(G[r][z][0],G[r][z][1])]&&P++;q.divideScalar(C);P=0;if(v){for(z=0;z<J;z++)if(C=G[r][z],H=1==n[m(C[0],C[1])].length)C=p[C[0]].clone().addSelf(p[C[1]]).divideScalar(2),u.addSelf(C),P++;u.divideScalar(4);b(2==P,"should have only 2 boundary edges")}else{for(z=0;z<J;z++)C=G[r][z],C=p[C[0]].clone().addSelf(p[C[1]]).divideScalar(2),u.addSelf(C);u.divideScalar(J)}B.addSelf(p[r]);v?(B.divideScalar(2),B.addSelf(u)):(B.multiplyScalar(J-3),B.addSelf(q),B.addSelf(u.multiplyScalar(2)),B.divideScalar(J));
 h[r]=B}a.vertices=h;a.faces=i;a.faceVertexUvs[0]=j;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,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};
 THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));void 0===d&&(d=THREE.NormalBlending);c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
 THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
@@ -731,31 +730,31 @@ THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.creat
 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;e[o++]=0;e[o++]=1;e[o++]=2;e[o++]=0;e[o++]=2;e[o++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
 b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
 b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(j=!1,l=a(THREE.ShaderFlares.lensFlare)):(j=!0,l=a(THREE.ShaderFlares.lensFlareVertexTexture));m={};n={};m.vertex=b.getAttribLocation(l,"position");m.uv=b.getAttribLocation(l,"uv");n.renderType=b.getUniformLocation(l,"renderType");n.map=b.getUniformLocation(l,"map");n.occlusionMap=b.getUniformLocation(l,"occlusionMap");n.opacity=b.getUniformLocation(l,"opacity");n.color=b.getUniformLocation(l,
-"color");n.scale=b.getUniformLocation(l,"scale");n.rotation=b.getUniformLocation(l,"rotation");n.screenPosition=b.getUniformLocation(l,"screenPosition");p=!1};this.render=function(a,d,e,q){var a=a.__webglFlares,z=a.length;if(z){var w=new THREE.Vector3,r=q/e,E=0.5*e,A=0.5*q,v=16/q,u=new THREE.Vector2(v*r,v),D=new THREE.Vector3(1,1,0),C=new THREE.Vector2(1,1),G=n,v=m;b.useProgram(l);p||(b.enableVertexAttribArray(m.vertex),b.enableVertexAttribArray(m.uv),p=!0);b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map,
-1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(v.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(v.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var P,B,J,H,I;for(P=0;P<z;P++)if(v=16/q,u.set(v*r,v),H=a[P],w.set(H.matrixWorld.elements[12],H.matrixWorld.elements[13],H.matrixWorld.elements[14]),d.matrixWorldInverse.multiplyVector3(w),d.projectionMatrix.multiplyVector3(w),D.copy(w),C.x=D.x*E+E,C.y=D.y*A+A,j||0<C.x&&C.x<e&&0<C.y&&C.y<q){b.activeTexture(b.TEXTURE1);
+"color");n.scale=b.getUniformLocation(l,"scale");n.rotation=b.getUniformLocation(l,"rotation");n.screenPosition=b.getUniformLocation(l,"screenPosition");p=!1};this.render=function(a,d,e,q){var a=a.__webglFlares,A=a.length;if(A){var w=new THREE.Vector3,r=q/e,E=0.5*e,z=0.5*q,v=16/q,u=new THREE.Vector2(v*r,v),D=new THREE.Vector3(1,1,0),C=new THREE.Vector2(1,1),G=n,v=m;b.useProgram(l);p||(b.enableVertexAttribArray(m.vertex),b.enableVertexAttribArray(m.uv),p=!0);b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map,
+1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(v.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(v.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var P,B,J,H,I;for(P=0;P<A;P++)if(v=16/q,u.set(v*r,v),H=a[P],w.set(H.matrixWorld.elements[12],H.matrixWorld.elements[13],H.matrixWorld.elements[14]),d.matrixWorldInverse.multiplyVector3(w),d.projectionMatrix.multiplyVector3(w),D.copy(w),C.x=D.x*E+E,C.y=D.y*z+z,j||0<C.x&&C.x<e&&0<C.y&&C.y<q){b.activeTexture(b.TEXTURE1);
 b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,C.x-8,C.y-8,16,16,0);b.uniform1i(G.renderType,0);b.uniform2f(G.scale,u.x,u.y);b.uniform3f(G.screenPosition,D.x,D.y,D.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,C.x-8,C.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);H.positionScreen.copy(D);H.customUpdateCallback?H.customUpdateCallback(H):H.updateLensFlares();b.uniform1i(G.renderType,2);b.enable(b.BLEND);B=0;for(J=H.lensFlares.length;B<J;B++)I=H.lensFlares[B],0.001<I.opacity&&0.001<I.scale&&(D.x=I.x,D.y=I.y,D.z=I.z,v=I.size*I.scale/q,u.x=v*r,u.y=v,b.uniform3f(G.screenPosition,D.x,D.y,D.z),b.uniform2f(G.scale,u.x,u.y),b.uniform1f(G.rotation,I.rotation),b.uniform1f(G.opacity,I.opacity),b.uniform3f(G.color,I.color.r,
 I.color.g,I.color.b),c.setBlending(I.blending,I.blendEquation,I.blendSrc,I.blendDst),c.setTexture(I.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
 THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4,i=new THREE.Vector3,j=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:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
-vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(l,m){var n,p,o,s,t,q,z,w,r,E=[];s=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(!0);n=0;for(p=l.__lights.length;n<p;n++)if(o=l.__lights[n],o.castShadow)if(o instanceof THREE.DirectionalLight&&o.shadowCascade)for(t=0;t<o.shadowCascadeCount;t++){var A;if(o.shadowCascadeArray[t])A=o.shadowCascadeArray[t];else{r=o;z=t;A=new THREE.DirectionalLight;A.isVirtual=!0;A.onlyShadow=!0;A.castShadow=!0;A.shadowCameraNear=r.shadowCameraNear;A.shadowCameraFar=r.shadowCameraFar;A.shadowCameraLeft=r.shadowCameraLeft;A.shadowCameraRight=r.shadowCameraRight;
-A.shadowCameraBottom=r.shadowCameraBottom;A.shadowCameraTop=r.shadowCameraTop;A.shadowCameraVisible=r.shadowCameraVisible;A.shadowDarkness=r.shadowDarkness;A.shadowBias=r.shadowCascadeBias[z];A.shadowMapWidth=r.shadowCascadeWidth[z];A.shadowMapHeight=r.shadowCascadeHeight[z];A.pointsWorld=[];A.pointsFrustum=[];w=A.pointsWorld;q=A.pointsFrustum;for(var v=0;8>v;v++)w[v]=new THREE.Vector3,q[v]=new THREE.Vector3;w=r.shadowCascadeNearZ[z];r=r.shadowCascadeFarZ[z];q[0].set(-1,-1,w);q[1].set(1,-1,w);q[2].set(-1,
-1,w);q[3].set(1,1,w);q[4].set(-1,-1,r);q[5].set(1,-1,r);q[6].set(-1,1,r);q[7].set(1,1,r);A.originalCamera=m;q=new THREE.Gyroscope;q.position=o.shadowCascadeOffset;q.add(A);q.add(A.target);m.add(q);o.shadowCascadeArray[t]=A;console.log("Created virtualLight",A)}z=o;w=t;r=z.shadowCascadeArray[w];r.position.copy(z.position);r.target.position.copy(z.target.position);r.lookAt(r.target);r.shadowCameraVisible=z.shadowCameraVisible;r.shadowDarkness=z.shadowDarkness;r.shadowBias=z.shadowCascadeBias[w];q=z.shadowCascadeNearZ[w];
-z=z.shadowCascadeFarZ[w];r=r.pointsFrustum;r[0].z=q;r[1].z=q;r[2].z=q;r[3].z=q;r[4].z=z;r[5].z=z;r[6].z=z;r[7].z=z;E[s]=A;s++}else E[s]=o,s++;n=0;for(p=E.length;n<p;n++){o=E[n];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=
+vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(l,m){var n,p,o,s,t,q,A,w,r,E=[];s=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(!0);n=0;for(p=l.__lights.length;n<p;n++)if(o=l.__lights[n],o.castShadow)if(o instanceof THREE.DirectionalLight&&o.shadowCascade)for(t=0;t<o.shadowCascadeCount;t++){var z;if(o.shadowCascadeArray[t])z=o.shadowCascadeArray[t];else{r=o;A=t;z=new THREE.DirectionalLight;z.isVirtual=!0;z.onlyShadow=!0;z.castShadow=!0;z.shadowCameraNear=r.shadowCameraNear;z.shadowCameraFar=r.shadowCameraFar;z.shadowCameraLeft=r.shadowCameraLeft;z.shadowCameraRight=r.shadowCameraRight;
+z.shadowCameraBottom=r.shadowCameraBottom;z.shadowCameraTop=r.shadowCameraTop;z.shadowCameraVisible=r.shadowCameraVisible;z.shadowDarkness=r.shadowDarkness;z.shadowBias=r.shadowCascadeBias[A];z.shadowMapWidth=r.shadowCascadeWidth[A];z.shadowMapHeight=r.shadowCascadeHeight[A];z.pointsWorld=[];z.pointsFrustum=[];w=z.pointsWorld;q=z.pointsFrustum;for(var v=0;8>v;v++)w[v]=new THREE.Vector3,q[v]=new THREE.Vector3;w=r.shadowCascadeNearZ[A];r=r.shadowCascadeFarZ[A];q[0].set(-1,-1,w);q[1].set(1,-1,w);q[2].set(-1,
+1,w);q[3].set(1,1,w);q[4].set(-1,-1,r);q[5].set(1,-1,r);q[6].set(-1,1,r);q[7].set(1,1,r);z.originalCamera=m;q=new THREE.Gyroscope;q.position=o.shadowCascadeOffset;q.add(z);q.add(z.target);m.add(q);o.shadowCascadeArray[t]=z;console.log("Created virtualLight",z)}A=o;w=t;r=A.shadowCascadeArray[w];r.position.copy(A.position);r.target.position.copy(A.target.position);r.lookAt(r.target);r.shadowCameraVisible=A.shadowCameraVisible;r.shadowDarkness=A.shadowDarkness;r.shadowBias=A.shadowCascadeBias[w];q=A.shadowCascadeNearZ[w];
+A=A.shadowCascadeFarZ[w];r=r.pointsFrustum;r[0].z=q;r[1].z=q;r[2].z=q;r[3].z=q;r[4].z=A;r[5].z=A;r[6].z=A;r[7].z=A;E[s]=z;s++}else E[s]=o,s++;n=0;for(p=E.length;n<p;n++){o=E[n];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}l.add(o.shadowCamera);b.autoUpdateScene&&l.updateMatrixWorld()}o.shadowCameraVisible&&!o.cameraHelper&&(o.cameraHelper=
-new THREE.CameraHelper(o.shadowCamera),o.shadowCamera.add(o.cameraHelper));if(o.isVirtual&&A.originalCamera==m){t=m;s=o.shadowCamera;q=o.pointsFrustum;r=o.pointsWorld;i.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(z=0;8>z;z++)if(w=r[z],w.copy(q[z]),THREE.ShadowMapPlugin.__projector.unprojectVector(w,t),s.matrixWorldInverse.multiplyVector3(w),w.x<i.x&&(i.x=w.x),w.x>j.x&&(j.x=w.x),w.y<i.y&&(i.y=w.y),w.y>j.y&&(j.y=w.y),w.z<i.z&&(i.z=w.z),w.z>j.z)j.z=w.z;s.left=i.x;s.right=
+new THREE.CameraHelper(o.shadowCamera),o.shadowCamera.add(o.cameraHelper));if(o.isVirtual&&z.originalCamera==m){t=m;s=o.shadowCamera;q=o.pointsFrustum;r=o.pointsWorld;i.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(A=0;8>A;A++)if(w=r[A],w.copy(q[A]),THREE.ShadowMapPlugin.__projector.unprojectVector(w,t),s.matrixWorldInverse.multiplyVector3(w),w.x<i.x&&(i.x=w.x),w.x>j.x&&(j.x=w.x),w.y<i.y&&(i.y=w.y),w.y>j.y&&(j.y=w.y),w.z<i.z&&(i.z=w.z),w.z>j.z)j.z=w.z;s.left=i.x;s.right=
 j.x;s.top=j.y;s.bottom=i.y;s.updateProjectionMatrix()}s=o.shadowMap;q=o.shadowMatrix;t=o.shadowCamera;t.position.copy(o.matrixWorld.getPosition());t.lookAt(o.target.matrixWorld.getPosition());t.updateMatrixWorld();t.matrixWorldInverse.getInverse(t.matrixWorld);o.cameraHelper&&(o.cameraHelper.visible=o.shadowCameraVisible);o.shadowCameraVisible&&o.cameraHelper.update();q.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);q.multiplySelf(t.projectionMatrix);q.multiplySelf(t.matrixWorldInverse);t._viewMatrixArray||
-(t._viewMatrixArray=new Float32Array(16));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(s);b.clear();r=l.__webglObjects;o=0;for(s=r.length;o<s;o++)if(z=r[o],q=z.object,z.render=!1,q.visible&&q.castShadow&&(!(q instanceof THREE.Mesh||q instanceof THREE.ParticleSystem)||
-!q.frustumCulled||g.contains(q)))q._modelViewMatrix.multiply(t.matrixWorldInverse,q.matrixWorld),z.render=!0;o=0;for(s=r.length;o<s;o++)z=r[o],z.render&&(q=z.object,z=z.buffer,v=q.material instanceof THREE.MeshFaceMaterial?q.material.materials[0]:q.material,w=0<q.geometry.morphTargets.length&&v.morphTargets,v=q instanceof THREE.SkinnedMesh&&v.skinning,w=q.customDepthMaterial?q.customDepthMaterial:v?w?f:e:w?d:c,z instanceof THREE.BufferGeometry?b.renderBufferDirect(t,l.__lights,null,w,z,q):b.renderBuffer(t,
-l.__lights,null,w,z,q));r=l.__webglObjectsImmediate;o=0;for(s=r.length;o<s;o++)z=r[o],q=z.object,q.visible&&q.castShadow&&(q._modelViewMatrix.multiply(t.matrixWorldInverse,q.matrixWorld),b.renderImmediateObject(t,l.__lights,null,c,q))}n=b.getClearColor();p=b.getClearAlpha();a.clearColor(n.r,n.g,n.b,p);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
+(t._viewMatrixArray=new Float32Array(16));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(s);b.clear();r=l.__webglObjects;o=0;for(s=r.length;o<s;o++)if(A=r[o],q=A.object,A.render=!1,q.visible&&q.castShadow&&(!(q instanceof THREE.Mesh||q instanceof THREE.ParticleSystem)||
+!q.frustumCulled||g.contains(q)))q._modelViewMatrix.multiply(t.matrixWorldInverse,q.matrixWorld),A.render=!0;o=0;for(s=r.length;o<s;o++)A=r[o],A.render&&(q=A.object,A=A.buffer,v=q.material instanceof THREE.MeshFaceMaterial?q.material.materials[0]:q.material,w=0<q.geometry.morphTargets.length&&v.morphTargets,v=q instanceof THREE.SkinnedMesh&&v.skinning,w=q.customDepthMaterial?q.customDepthMaterial:v?w?f:e:w?d:c,A instanceof THREE.BufferGeometry?b.renderBufferDirect(t,l.__lights,null,w,A,q):b.renderBuffer(t,
+l.__lights,null,w,A,q));r=l.__webglObjectsImmediate;o=0;for(s=r.length;o<s;o++)A=r[o],q=A.object,q.visible&&q.castShadow&&(q._modelViewMatrix.multiply(t.matrixWorldInverse,q.matrixWorld),b.renderImmediateObject(t,l.__lights,null,c,q))}n=b.getClearColor();p=b.getClearAlpha();a.clearColor(n.r,n.g,n.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 a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,g,h,i,j,l;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=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;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);
 b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),o=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(o,a.vertexShader);b.compileShader(p);b.compileShader(o);b.attachShader(n,p);b.attachShader(n,o);b.linkProgram(n);h=n;i={};j={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,
 "uvOffset");j.uvScale=b.getUniformLocation(h,"uvScale");j.rotation=b.getUniformLocation(h,"rotation");j.scale=b.getUniformLocation(h,"scale");j.alignment=b.getUniformLocation(h,"alignment");j.color=b.getUniformLocation(h,"color");j.map=b.getUniformLocation(h,"map");j.opacity=b.getUniformLocation(h,"opacity");j.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");j.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");j.screenPosition=b.getUniformLocation(h,"screenPosition");
-j.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");j.fogType=b.getUniformLocation(h,"fogType");j.fogDensity=b.getUniformLocation(h,"fogDensity");j.fogNear=b.getUniformLocation(h,"fogNear");j.fogFar=b.getUniformLocation(h,"fogFar");j.fogColor=b.getUniformLocation(h,"fogColor");l=!1};this.render=function(d,e,p,o){var s=d.__webglSprites,t=s.length;if(t){var q=i,z=j,w=o/p,p=0.5*p,r=0.5*o,E=!0;b.useProgram(h);l||(b.enableVertexAttribArray(q.position),
-b.enableVertexAttribArray(q.uv),l=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(q.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(z.projectionMatrix,!1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(z.map,0);var A=q=0,v=d.fog;v?(b.uniform3f(z.fogColor,v.color.r,v.color.g,v.color.b),v instanceof THREE.Fog?(b.uniform1f(z.fogNear,v.near),
-b.uniform1f(z.fogFar,v.far),b.uniform1i(z.fogType,1),A=q=1):v instanceof THREE.FogExp2&&(b.uniform1f(z.fogDensity,v.density),b.uniform1i(z.fogType,2),A=q=2)):(b.uniform1i(z.fogType,0),A=q=0);for(var u,D=[],v=0;v<t;v++)u=s[v],u.visible&&0!==u.opacity&&(u.useScreenCoordinates?u.z=-u.position.z:(u._modelViewMatrix.multiply(e.matrixWorldInverse,u.matrixWorld),u.z=-u._modelViewMatrix.elements[14]));s.sort(a);for(v=0;v<t;v++)if(u=s[v],u.visible&&0!==u.opacity&&u.map&&u.map.image&&u.map.image.width)u.useScreenCoordinates?
-(b.uniform1i(z.useScreenCoordinates,1),b.uniform3f(z.screenPosition,(u.position.x-p)/p,(r-u.position.y)/r,Math.max(0,Math.min(1,u.position.z)))):(b.uniform1i(z.useScreenCoordinates,0),b.uniform1i(z.affectedByDistance,u.affectedByDistance?1:0),b.uniformMatrix4fv(z.modelViewMatrix,!1,u._modelViewMatrix.elements)),e=d.fog&&u.fog?A:0,q!==e&&(b.uniform1i(z.fogType,e),q=e),e=1/(u.scaleByViewport?o:1),D[0]=e*w*u.scale.x,D[1]=e*u.scale.y,b.uniform2f(z.uvScale,u.uvScale.x,u.uvScale.y),b.uniform2f(z.uvOffset,
-u.uvOffset.x,u.uvOffset.y),b.uniform2f(z.alignment,u.alignment.x,u.alignment.y),b.uniform1f(z.opacity,u.opacity),b.uniform3f(z.color,u.color.r,u.color.g,u.color.b),b.uniform1f(z.rotation,u.rotation),b.uniform2fv(z.scale,D),u.mergeWith3D&&!E?(b.enable(b.DEPTH_TEST),E=!0):!u.mergeWith3D&&E&&(b.disable(b.DEPTH_TEST),E=!1),c.setBlending(u.blending,u.blendEquation,u.blendSrc,u.blendDst),c.setTexture(u.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);
+j.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");j.fogType=b.getUniformLocation(h,"fogType");j.fogDensity=b.getUniformLocation(h,"fogDensity");j.fogNear=b.getUniformLocation(h,"fogNear");j.fogFar=b.getUniformLocation(h,"fogFar");j.fogColor=b.getUniformLocation(h,"fogColor");l=!1};this.render=function(d,e,p,o){var s=d.__webglSprites,t=s.length;if(t){var q=i,A=j,w=o/p,p=0.5*p,r=0.5*o,E=!0;b.useProgram(h);l||(b.enableVertexAttribArray(q.position),
+b.enableVertexAttribArray(q.uv),l=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(q.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(q.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(A.projectionMatrix,!1,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(A.map,0);var z=q=0,v=d.fog;v?(b.uniform3f(A.fogColor,v.color.r,v.color.g,v.color.b),v instanceof THREE.Fog?(b.uniform1f(A.fogNear,v.near),
+b.uniform1f(A.fogFar,v.far),b.uniform1i(A.fogType,1),z=q=1):v instanceof THREE.FogExp2&&(b.uniform1f(A.fogDensity,v.density),b.uniform1i(A.fogType,2),z=q=2)):(b.uniform1i(A.fogType,0),z=q=0);for(var u,D=[],v=0;v<t;v++)u=s[v],u.visible&&0!==u.opacity&&(u.useScreenCoordinates?u.z=-u.position.z:(u._modelViewMatrix.multiply(e.matrixWorldInverse,u.matrixWorld),u.z=-u._modelViewMatrix.elements[14]));s.sort(a);for(v=0;v<t;v++)if(u=s[v],u.visible&&0!==u.opacity&&u.map&&u.map.image&&u.map.image.width)u.useScreenCoordinates?
+(b.uniform1i(A.useScreenCoordinates,1),b.uniform3f(A.screenPosition,(u.position.x-p)/p,(r-u.position.y)/r,Math.max(0,Math.min(1,u.position.z)))):(b.uniform1i(A.useScreenCoordinates,0),b.uniform1i(A.affectedByDistance,u.affectedByDistance?1:0),b.uniformMatrix4fv(A.modelViewMatrix,!1,u._modelViewMatrix.elements)),e=d.fog&&u.fog?z:0,q!==e&&(b.uniform1i(A.fogType,e),q=e),e=1/(u.scaleByViewport?o:1),D[0]=e*w*u.scale.x,D[1]=e*u.scale.y,b.uniform2f(A.uvScale,u.uvScale.x,u.uvScale.y),b.uniform2f(A.uvOffset,
+u.uvOffset.x,u.uvOffset.y),b.uniform2f(A.alignment,u.alignment.x,u.alignment.y),b.uniform1f(A.opacity,u.opacity),b.uniform3f(A.color,u.color.r,u.color.g,u.color.b),b.uniform1f(A.rotation,u.rotation),b.uniform2fv(A.scale,D),u.mergeWith3D&&!E?(b.enable(b.DEPTH_TEST),E=!0):!u.mergeWith3D&&E&&(b.disable(b.DEPTH_TEST),E=!1),c.setBlending(u.blending,u.blendEquation,u.blendSrc,u.blendDst),c.setTexture(u.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);
 b.depthMask(!0)}}};
 THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4;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:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,
 uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(i,j){var l,m,n,p,o,s;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&i.updateMatrixWorld();j._viewMatrixArray||(j._viewMatrixArray=new Float32Array(16));j._projectionMatrixArray||

+ 6 - 10
examples/webgl_geometry_extrude_uvs2.html

@@ -36,7 +36,7 @@
 		testShape = setupShape(8, 3);
 		holeShape = setupShape(8, 2);
 		testShape.holes.push(holeShape);
-		
+
 		tex = setupTexture(TestTextureData);
 		renewMesh();
 
@@ -53,7 +53,6 @@
 		render();
 	};
 
-	
 	function setupAnimation(n) {
 		new AnimationController(
 			document.getElementById('html-el'),
@@ -136,14 +135,11 @@
 	}
 
 	function setupMesh(geom, side_texture) {
-		var mesh = new THREE.Mesh(geom, new THREE.MeshFaceMaterial());
-
-		// Set multi materials
-		geom.materials = 
-			[
-				new THREE.MeshBasicMaterial( { map: side_texture } ),
-				new THREE.MeshBasicMaterial( { color: 0x447766 } )
-			];
+		var materials = [
+			new THREE.MeshBasicMaterial( { map: side_texture } ),
+			new THREE.MeshBasicMaterial( { color: 0x447766 } )
+		];
+		var mesh = new THREE.Mesh(geom, new THREE.MeshFaceMaterial(materials));
 
 		scene.add(mesh);
 		return mesh;

+ 16 - 20
examples/webgl_geometry_large_mesh.html

@@ -164,11 +164,24 @@
 				//loader = new THREE.JSONLoader( true );
 				document.body.appendChild( loader.statusDomElement );
 
-				var s = Date.now(),
-					callback = function( geometry ) { createScene( geometry, s ) };
+				var start = Date.now();
 
 				//loader.load( 'obj/lucy/Lucy100k_slim.js', callback );
-				loader.load( 'obj/lucy/Lucy100k_bin.js', callback );
+				loader.load( 'obj/lucy/Lucy100k_bin.js', function ( geometry, materials ) {
+
+					addMesh( geometry, 0.75, 900, 0, 0,  0,0,0, new THREE.MeshPhongMaterial( { ambient: 0x030303, color: 0x030303, specular: 0x990000, shininess: 30 } ) );
+					addMesh( geometry, 0.75, 300, 0, 0,  0,0,0, new THREE.MeshFaceMaterial( materials ) );
+					addMesh( geometry, 0.75, -300, 0, 0, 0,0,0, new THREE.MeshPhongMaterial( { ambient: 0x030303, color: 0x111111, specular: 0xffaa00, shininess: 10 } ) );
+					addMesh( geometry, 0.75, -900, 0, 0, 0,0,0, new THREE.MeshPhongMaterial( { ambient: 0x030303, color: 0x555555, specular: 0x666666, shininess: 10 } ) );
+
+					loader.statusDomElement.style.display = "none";
+
+					log( "geometry.vertices: " + geometry.vertices.length );
+					log( "geometry.faces: " + geometry.faces.length );
+
+					log( "model loaded and created in " + ( Date.now() - start ) + " ms" );
+
+				} );
 
 				//
 
@@ -189,23 +202,6 @@
 
 			}
 
-
-			function createScene( geometry, start ) {
-
-				addMesh( geometry, 0.75, 900, 0, 0,  0,0,0, new THREE.MeshPhongMaterial( { ambient: 0x030303, color: 0x030303, specular: 0x990000, shininess: 30 } ) );
-				addMesh( geometry, 0.75, 300, 0, 0,  0,0,0, new THREE.MeshFaceMaterial( ) );
-				addMesh( geometry, 0.75, -300, 0, 0, 0,0,0, new THREE.MeshPhongMaterial( { ambient: 0x030303, color: 0x111111, specular: 0xffaa00, shininess: 10 } ) );
-				addMesh( geometry, 0.75, -900, 0, 0, 0,0,0, new THREE.MeshPhongMaterial( { ambient: 0x030303, color: 0x555555, specular: 0x666666, shininess: 10 } ) );
-
-				loader.statusDomElement.style.display = "none";
-
-				log( "geometry.vertices: " + geometry.vertices.length );
-				log( "geometry.faces: " + geometry.faces.length );
-
-				log( "model loaded and created in " + ( Date.now() - start ) + " ms" );
-
-			}
-
 			function onDocumentMouseMove( event ) {
 
 				mouseX = ( event.clientX - windowHalfX );

+ 12 - 15
src/loaders/BinaryLoader.js

@@ -134,8 +134,6 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 		THREE.Geometry.call( this );
 
-		THREE.Loader.prototype.initMaterials( scope, materials, texturePath );
-
 		md = parseMetaData( data, currentOffset );
 
 		currentOffset += md.header_bytes;
@@ -741,27 +739,26 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 	function uv3 ( where, u1, v1, u2, v2, u3, v3 ) {
 
-		var uv = [];
-		uv.push( new THREE.UV( u1, v1 ) );
-		uv.push( new THREE.UV( u2, v2 ) );
-		uv.push( new THREE.UV( u3, v3 ) );
-		where.push( uv );
+		where.push( [
+			new THREE.UV( u1, v1 ),
+			new THREE.UV( u2, v2 ),
+			new THREE.UV( u3, v3 )
+		] );
 
 	};
 
 	function uv4 ( where, u1, v1, u2, v2, u3, v3, u4, v4 ) {
 
-		var uv = [];
-		uv.push( new THREE.UV( u1, v1 ) );
-		uv.push( new THREE.UV( u2, v2 ) );
-		uv.push( new THREE.UV( u3, v3 ) );
-		uv.push( new THREE.UV( u4, v4 ) );
-		where.push( uv );
-
+		where.push( [
+			new THREE.UV( u1, v1 ),
+			new THREE.UV( u2, v2 ),
+			new THREE.UV( u3, v3 ),
+			new THREE.UV( u4, v4 )
+		] );
 	};
 
 	Model.prototype = Object.create( THREE.Geometry.prototype );
 
-	callback( new Model( texturePath ) );
+	callback( new Model( texturePath ), this.initMaterials( materials, texturePath ) );
 
 };