浏览代码

Updated builds.

Mr.doob 12 年之前
父节点
当前提交
c6e7b97de3
共有 2 个文件被更改,包括 253 次插入293 次删除
  1. 16 56
      build/three.js
  2. 237 237
      build/three.min.js

+ 16 - 56
build/three.js

@@ -8243,7 +8243,6 @@ THREE.Geometry = function () {
 
 	this.faces = [];
 
-	this.faceUvs = [[]];
 	this.faceVertexUvs = [[]];
 
 	this.morphTargets = [];
@@ -10580,7 +10579,7 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
 		type,
 		isQuad,
 		hasMaterial,
-		hasFaceUv, hasFaceVertexUv,
+		hasFaceVertexUv,
 		hasFaceNormal, hasFaceVertexNormal,
 		hasFaceColor, hasFaceVertexColor,
 
@@ -10607,7 +10606,6 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
 
 			for ( i = 0; i < nUvLayers; i++ ) {
 
-				geometry.faceUvs[ i ] = [];
 				geometry.faceVertexUvs[ i ] = [];
 
 			}
@@ -10639,14 +10637,13 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
 
 			isQuad              = isBitSet( type, 0 );
 			hasMaterial         = isBitSet( type, 1 );
-			hasFaceUv           = isBitSet( type, 2 );
 			hasFaceVertexUv     = isBitSet( type, 3 );
 			hasFaceNormal       = isBitSet( type, 4 );
 			hasFaceVertexNormal = isBitSet( type, 5 );
 			hasFaceColor	    = isBitSet( type, 6 );
 			hasFaceVertexColor  = isBitSet( type, 7 );
 
-			//console.log("type", type, "bits", isQuad, hasMaterial, hasFaceUv, hasFaceVertexUv, hasFaceNormal, hasFaceVertexNormal, hasFaceColor, hasFaceVertexColor);
+			// console.log("type", type, "bits", isQuad, hasMaterial, hasFaceVertexUv, hasFaceNormal, hasFaceVertexNormal, hasFaceColor, hasFaceVertexColor);
 
 			if ( isQuad ) {
 
@@ -10682,23 +10679,6 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
 
 			fi = geometry.faces.length;
 
-			if ( hasFaceUv ) {
-
-				for ( i = 0; i < nUvLayers; i++ ) {
-
-					uvLayer = json.uvs[ i ];
-
-					uvIndex = faces[ offset ++ ];
-
-					u = uvLayer[ uvIndex * 2 ];
-					v = uvLayer[ uvIndex * 2 + 1 ];
-
-					geometry.faceUvs[ i ][ fi ] = new THREE.Vector2( u, v );
-
-				}
-
-			}
-
 			if ( hasFaceVertexUv ) {
 
 				for ( i = 0; i < nUvLayers; i++ ) {
@@ -10728,13 +10708,11 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
 
 				normalIndex = faces[ offset ++ ] * 3;
 
-				normal = new THREE.Vector3();
-
-				normal.x = normals[ normalIndex ++ ];
-				normal.y = normals[ normalIndex ++ ];
-				normal.z = normals[ normalIndex ];
-
-				face.normal = normal;
+				face.normal.set(
+					normals[ normalIndex ++ ],
+					normals[ normalIndex ++ ],
+					normals[ normalIndex ]
+				);
 
 			}
 
@@ -10744,11 +10722,11 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
 
 					normalIndex = faces[ offset ++ ] * 3;
 
-					normal = new THREE.Vector3();
-
-					normal.x = normals[ normalIndex ++ ];
-					normal.y = normals[ normalIndex ++ ];
-					normal.z = normals[ normalIndex ];
+					normal = new THREE.Vector3(
+						normals[ normalIndex ++ ],
+						normals[ normalIndex ++ ],
+						normals[ normalIndex ]
+					);
 
 					face.vertexNormals.push( normal );
 
@@ -10760,9 +10738,7 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
 			if ( hasFaceColor ) {
 
 				colorIndex = faces[ offset ++ ];
-
-				color = new THREE.Color( colors[ colorIndex ] );
-				face.color = color;
+				face.color.setHex( colors[ colorIndex ] );
 
 			}
 
@@ -10772,9 +10748,7 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
 				for ( i = 0; i < nVertices; i++ ) {
 
 					colorIndex = faces[ offset ++ ];
-
-					color = new THREE.Color( colors[ colorIndex ] );
-					face.vertexColors.push( color );
+					face.vertexColors.push( new THREE.Color( colors[ colorIndex ] ) );
 
 				}
 
@@ -20117,13 +20091,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		if ( uvType ) {
 
-			if ( geometry.faceUvs.length > 0 || geometry.faceVertexUvs.length > 0 ) {
+			if ( geometry.faceVertexUvs.length > 0 ) {
 
 				geometryGroup.__uvArray = new Float32Array( nvertices * 2 );
 
 			}
 
-			if ( geometry.faceUvs.length > 1 || geometry.faceVertexUvs.length > 1 ) {
+			if ( geometry.faceVertexUvs.length > 1 ) {
 
 				geometryGroup.__uv2Array = new Float32Array( nvertices * 2 );
 
@@ -26452,15 +26426,8 @@ THREE.GeometryUtils = {
 		var i, il, j, jl;
 
 		var faces = [];
-		var faceUvs = [];
 		var faceVertexUvs = [];
 
-		for ( i = 0, il = geometry.faceUvs.length; i < il; i ++ ) {
-
-			faceUvs[ i ] = [];
-
-		}
-
 		for ( i = 0, il = geometry.faceVertexUvs.length; i < il; i ++ ) {
 
 			faceVertexUvs[ i ] = [];
@@ -26473,12 +26440,6 @@ THREE.GeometryUtils = {
 
 			faces.push( face );
 
-			for ( j = 0, jl = geometry.faceUvs.length; j < jl; j ++ ) {
-
-				faceUvs[ j ].push( geometry.faceUvs[ j ][ i ] );
-
-			}
-
 			for ( j = 0, jl = geometry.faceVertexUvs.length; j < jl; j ++ ) {
 
 				faceVertexUvs[ j ].push( geometry.faceVertexUvs[ j ][ i ] );
@@ -26488,7 +26449,6 @@ THREE.GeometryUtils = {
 		}
 
 		geometry.faces = faces;
-		geometry.faceUvs = faceUvs;
 		geometry.faceVertexUvs = faceVertexUvs;
 
 		geometry.computeCentroids();

+ 237 - 237
build/three.min.js

@@ -82,22 +82,22 @@ this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,f,h,g,i){var k=this.elements;k[0]=a;k[3]=b;k[6]=c;k[1]=d;k[4]=e;k[7]=f;k[2]=h;k[5]=g;k[8]=i;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix3's .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)},
 multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix3(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],h=a[5],g=a[6],i=a[7],a=a[8];return b*f*a-b*h*i-c*e*a+c*h*g+d*e*i-d*f*g},getInverse:function(a,
 b){var c=a.elements,d=this.elements;d[0]=c[10]*c[5]-c[6]*c[9];d[1]=-c[10]*c[1]+c[2]*c[9];d[2]=c[6]*c[1]-c[2]*c[5];d[3]=-c[10]*c[4]+c[6]*c[8];d[4]=c[10]*c[0]-c[2]*c[8];d[5]=-c[6]*c[0]+c[2]*c[4];d[6]=c[9]*c[4]-c[5]*c[8];d[7]=-c[9]*c[0]+c[1]*c[8];d[8]=c[5]*c[0]-c[1]*c[4];c=c[0]*d[0]+c[1]*d[3]+c[2]*d[6];if(0===c){if(b)throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/
-c);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},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;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},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}};THREE.Matrix4=function(a,b,c,d,e,f,h,g,i,k,l,m,n,t,s,p){var q=this.elements=new Float32Array(16);q[0]=void 0!==a?a:1;q[4]=b||0;q[8]=c||0;q[12]=d||0;q[1]=e||0;q[5]=void 0!==f?f:1;q[9]=h||0;q[13]=g||0;q[2]=i||0;q[6]=k||0;q[10]=void 0!==l?l:1;q[14]=m||0;q[3]=n||0;q[7]=t||0;q[11]=s||0;q[15]=void 0!==p?p:1};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,h,g,i,k,l,m,n,t,s,p){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=h;q[13]=g;q[2]=i;q[6]=k;q[10]=l;q[14]=m;q[3]=n;q[7]=t;q[11]=s;q[15]=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.elements.set(a.elements);return this},extractPosition:function(a){console.warn("DEPRECATED: Matrix4's .extractPosition() has been renamed to .copyPosition().");
+c);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},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;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},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}};THREE.Matrix4=function(a,b,c,d,e,f,h,g,i,k,l,m,n,t,r,p){var q=this.elements=new Float32Array(16);q[0]=void 0!==a?a:1;q[4]=b||0;q[8]=c||0;q[12]=d||0;q[1]=e||0;q[5]=void 0!==f?f:1;q[9]=h||0;q[13]=g||0;q[2]=i||0;q[6]=k||0;q[10]=void 0!==l?l:1;q[14]=m||0;q[3]=n||0;q[7]=t||0;q[11]=r||0;q[15]=void 0!==p?p:1};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,h,g,i,k,l,m,n,t,r,p){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=h;q[13]=g;q[2]=i;q[6]=k;q[10]=l;q[14]=m;q[3]=n;q[7]=t;q[11]=r;q[15]=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.elements.set(a.elements);return this},extractPosition:function(a){console.warn("DEPRECATED: Matrix4's .extractPosition() has been renamed to .copyPosition().");
 return this.copyPosition(a)},copyPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(){var a=new THREE.Vector3;return function(b){var c=this.elements,b=b.elements,d=1/a.set(b[0],b[1],b[2]).length(),e=1/a.set(b[4],b[5],b[6]).length(),f=1/a.set(b[8],b[9],b[10]).length();c[0]=b[0]*d;c[1]=b[1]*d;c[2]=b[2]*d;c[4]=b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[8]=b[8]*f;c[9]=b[9]*f;c[10]=b[10]*f;return this}}(),makeRotationFromEuler:function(a){void 0===
 typeof a.order&&console.error("ERROR: Matrix's .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.  Please update your code.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),h=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e);if(void 0===a.order||"XYZ"===a.order){var a=f*g,i=f*e,k=c*g,l=c*e;b[0]=h*g;b[4]=-h*e;b[8]=d;b[1]=i+k*d;b[5]=a-l*d;b[9]=-c*h;b[2]=l-a*d;b[6]=k+i*d;b[10]=f*h}else"YXZ"===a.order?(a=h*g,i=h*e,k=d*g,l=d*e,b[0]=a+l*c,b[4]=
 k*c-i,b[8]=f*d,b[1]=f*e,b[5]=f*g,b[9]=-c,b[2]=i*c-k,b[6]=l+a*c,b[10]=f*h):"ZXY"===a.order?(a=h*g,i=h*e,k=d*g,l=d*e,b[0]=a-l*c,b[4]=-f*e,b[8]=k+i*c,b[1]=i+k*c,b[5]=f*g,b[9]=l-a*c,b[2]=-f*d,b[6]=c,b[10]=f*h):"ZYX"===a.order?(a=f*g,i=f*e,k=c*g,l=c*e,b[0]=h*g,b[4]=k*d-i,b[8]=a*d+l,b[1]=h*e,b[5]=l*d+a,b[9]=i*d-k,b[2]=-d,b[6]=c*h,b[10]=f*h):"YZX"===a.order?(a=f*h,i=f*d,k=c*h,l=c*d,b[0]=h*g,b[4]=l-a*e,b[8]=k*e+i,b[1]=e,b[5]=f*g,b[9]=-c*g,b[2]=-d*g,b[6]=i*e+k,b[10]=a-l*e):"XZY"===a.order&&(a=f*h,i=f*d,k=
 c*h,l=c*d,b[0]=h*g,b[4]=-e,b[8]=d*g,b[1]=a*e+l,b[5]=f*g,b[9]=i*e-k,b[2]=k*e-i,b[6]=c*g,b[10]=l*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},setRotationFromQuaternion:function(a){console.warn("DEPRECATED: Matrix4's .setRotationFromQuaternion() has been deprecated in favor of makeRotationFromQuaternion.  Please update your code.");return this.makeRotationFromQuaternion(a)},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,h=c+c,g=d+d,i=e+e,
 a=c*h,k=c*g,c=c*i,l=d*g,d=d*i,e=e*i,h=f*h,g=f*g,f=f*i;b[0]=1-(l+e);b[4]=k-f;b[8]=c+g;b[1]=k+f;b[5]=1-(a+e);b[9]=d-h;b[2]=c-g;b[6]=d+h;b[10]=1-(a+l);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var h=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,
-a);h[0]=a.x;h[4]=b.x;h[8]=c.x;h[1]=a.y;h[5]=b.y;h[9]=c.y;h[2]=a.z;h[6]=b.z;h[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],h=c[4],g=c[8],i=c[12],k=c[1],l=c[5],m=c[9],n=c[13],t=c[2],s=c[6],p=c[10],q=c[14],r=c[3],u=c[7],
-w=c[11],c=c[15],E=d[0],C=d[4],F=d[8],z=d[12],D=d[1],y=d[5],O=d[9],x=d[13],B=d[2],I=d[6],v=d[10],A=d[14],G=d[3],R=d[7],J=d[11],d=d[15];e[0]=f*E+h*D+g*B+i*G;e[4]=f*C+h*y+g*I+i*R;e[8]=f*F+h*O+g*v+i*J;e[12]=f*z+h*x+g*A+i*d;e[1]=k*E+l*D+m*B+n*G;e[5]=k*C+l*y+m*I+n*R;e[9]=k*F+l*O+m*v+n*J;e[13]=k*z+l*x+m*A+n*d;e[2]=t*E+s*D+p*B+q*G;e[6]=t*C+s*y+p*I+q*R;e[10]=t*F+s*O+p*v+q*J;e[14]=t*z+s*x+p*A+q*d;e[3]=r*E+u*D+w*B+c*G;e[7]=r*C+u*y+w*I+c*R;e[11]=r*F+u*O+w*v+c*J;e[15]=r*z+u*x+w*A+c*d;return this},multiplyToArray:function(a,
+a);h[0]=a.x;h[4]=b.x;h[8]=c.x;h[1]=a.y;h[5]=b.y;h[9]=c.y;h[2]=a.z;h[6]=b.z;h[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],h=c[4],g=c[8],i=c[12],k=c[1],l=c[5],m=c[9],n=c[13],t=c[2],r=c[6],p=c[10],q=c[14],s=c[3],u=c[7],
+w=c[11],c=c[15],E=d[0],C=d[4],F=d[8],z=d[12],D=d[1],y=d[5],O=d[9],x=d[13],B=d[2],I=d[6],v=d[10],A=d[14],G=d[3],R=d[7],J=d[11],d=d[15];e[0]=f*E+h*D+g*B+i*G;e[4]=f*C+h*y+g*I+i*R;e[8]=f*F+h*O+g*v+i*J;e[12]=f*z+h*x+g*A+i*d;e[1]=k*E+l*D+m*B+n*G;e[5]=k*C+l*y+m*I+n*R;e[9]=k*F+l*O+m*v+n*J;e[13]=k*z+l*x+m*A+n*d;e[2]=t*E+r*D+p*B+q*G;e[6]=t*C+r*y+p*I+q*R;e[10]=t*F+r*O+p*v+q*J;e[14]=t*z+r*x+p*A+q*d;e[3]=s*E+u*D+w*B+c*G;e[7]=s*C+u*y+w*I+c*R;e[11]=s*F+u*O+w*v+c*J;e[15]=s*z+u*x+w*A+c*d;return this},multiplyToArray:function(a,
 b,c){var d=this.elements;this.multiplyMatrices(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){console.warn("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");
 return a.applyProjection(this)},multiplyVector4:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyProjection(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){console.warn("DEPRECATED: Matrix4's .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");
 a.transformDirection(this)},crossVector:function(a){console.warn("DEPRECATED: Matrix4's .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],h=a[5],g=a[9],i=a[13],k=a[2],l=a[6],m=a[10],n=a[14];return a[3]*(+e*g*l-d*i*l-e*h*m+c*i*m+d*h*n-c*g*n)+a[7]*(+b*g*n-b*i*m+e*f*m-d*f*n+d*i*k-e*g*k)+a[11]*(+b*i*l-b*h*n-e*f*l+c*f*n+e*h*k-c*i*k)+a[15]*(-d*h*k-b*g*l+b*h*m+d*f*l-c*f*
 m+c*g*k)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;
 a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=new THREE.Vector3;return function(){console.warn("DEPRECATED: Matrix4's .getPosition() has been removed. Use Vector3.getPositionFromMatrix( matrix ) instead.");var b=this.elements;return a.set(b[12],b[13],b[14])}}(),setPosition:function(a){var b=this.elements;
-b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],h=d[8],g=d[12],i=d[1],k=d[5],l=d[9],m=d[13],n=d[2],t=d[6],s=d[10],p=d[14],q=d[3],r=d[7],u=d[11],d=d[15];c[0]=l*p*r-m*s*r+m*t*u-k*p*u-l*t*d+k*s*d;c[4]=g*s*r-h*p*r-g*t*u+f*p*u+h*t*d-f*s*d;c[8]=h*m*r-g*l*r+g*k*u-f*m*u-h*k*d+f*l*d;c[12]=g*l*t-h*m*t-g*k*s+f*m*s+h*k*p-f*l*p;c[1]=m*s*q-l*p*q-m*n*u+i*p*u+l*n*d-i*s*d;c[5]=h*p*q-g*s*q+g*n*u-e*p*u-h*n*d+e*s*d;c[9]=g*l*q-h*m*q-g*i*u+e*m*u+h*i*d-
-e*l*d;c[13]=h*m*n-g*l*n+g*i*s-e*m*s-h*i*p+e*l*p;c[2]=k*p*q-m*t*q+m*n*r-i*p*r-k*n*d+i*t*d;c[6]=g*t*q-f*p*q-g*n*r+e*p*r+f*n*d-e*t*d;c[10]=f*m*q-g*k*q+g*i*r-e*m*r-f*i*d+e*k*d;c[14]=g*k*n-f*m*n-g*i*t+e*m*t+f*i*p-e*k*p;c[3]=l*t*q-k*s*q-l*n*r+i*s*r+k*n*u-i*t*u;c[7]=f*s*q-h*t*q+h*n*r-e*s*r-f*n*u+e*t*u;c[11]=h*k*q-f*l*q-h*i*r+e*l*r+f*i*u-e*k*u;c[15]=f*l*n-h*k*n+h*i*t-e*l*t-f*i*s+e*k*s;c=e*c[0]+i*c[4]+n*c[8]+q*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");
+b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],h=d[8],g=d[12],i=d[1],k=d[5],l=d[9],m=d[13],n=d[2],t=d[6],r=d[10],p=d[14],q=d[3],s=d[7],u=d[11],d=d[15];c[0]=l*p*s-m*r*s+m*t*u-k*p*u-l*t*d+k*r*d;c[4]=g*r*s-h*p*s-g*t*u+f*p*u+h*t*d-f*r*d;c[8]=h*m*s-g*l*s+g*k*u-f*m*u-h*k*d+f*l*d;c[12]=g*l*t-h*m*t-g*k*r+f*m*r+h*k*p-f*l*p;c[1]=m*r*q-l*p*q-m*n*u+i*p*u+l*n*d-i*r*d;c[5]=h*p*q-g*r*q+g*n*u-e*p*u-h*n*d+e*r*d;c[9]=g*l*q-h*m*q-g*i*u+e*m*u+h*i*d-
+e*l*d;c[13]=h*m*n-g*l*n+g*i*r-e*m*r-h*i*p+e*l*p;c[2]=k*p*q-m*t*q+m*n*s-i*p*s-k*n*d+i*t*d;c[6]=g*t*q-f*p*q-g*n*s+e*p*s+f*n*d-e*t*d;c[10]=f*m*q-g*k*q+g*i*s-e*m*s-f*i*d+e*k*d;c[14]=g*k*n-f*m*n-g*i*t+e*m*t+f*i*p-e*k*p;c[3]=l*t*q-k*r*q-l*n*s+i*r*s+k*n*u-i*t*u;c[7]=f*r*q-h*t*q+h*n*s-e*r*s-f*n*u+e*t*u;c[11]=h*k*q-f*l*q-h*i*s+e*l*s+f*i*u-e*k*u;c[15]=f*l*n-h*k*n+h*i*t-e*l*t-f*i*r+e*k*r;c=e*c[0]+i*c[4]+n*c[8]+q*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");
 this.identity();return this}this.multiplyScalar(1/c);return this},translate:function(){console.warn("DEPRECATED: Matrix4's .translate() has been removed.")},rotateX:function(){console.warn("DEPRECATED: Matrix4's .rotateX() has been removed.")},rotateY:function(){console.warn("DEPRECATED: Matrix4's .rotateY() has been removed.")},rotateZ:function(){console.warn("DEPRECATED: Matrix4's .rotateZ() has been removed.")},rotateByAxis:function(){console.warn("DEPRECATED: Matrix4's .rotateByAxis() has been removed.")},
 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,h=a.y,g=a.z,i=e*f,k=e*h;this.set(i*f+c,i*h-d*g,i*g+d*h,0,i*h+d*g,k*h+c,k*g-d*f,0,i*g-d*h,k*g+d*f,e*g*g+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,
@@ -113,8 +113,8 @@ g=this.origin.clone().sub(e),a=-this.direction.dot(f),b=g.dot(this.direction),i=
 THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(a){for(var b,c=0,d=0,e=a.length;d<e;d++)b=a[d].lengthSq(),c=Math.max(c,b);this.center.set(0,0,0);this.radius=Math.sqrt(c);return this},copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-
 this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);
 this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}};THREE.Frustum=function(a,b,c,d,e,f){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==f?f:new THREE.Plane]};
-THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var h=this.planes;h[0].copy(a);h[1].copy(b);h[2].copy(c);h[3].copy(d);h[4].copy(e);h[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],h=c[4],g=c[5],i=c[6],k=c[7],l=c[8],m=c[9],n=c[10],t=c[11],s=c[12],p=c[13],q=c[14],c=c[15];b[0].setComponents(f-a,k-h,t-l,c-s).normalize();b[1].setComponents(f+
-a,k+h,t+l,c+s).normalize();b[2].setComponents(f+d,k+g,t+m,c+p).normalize();b[3].setComponents(f-d,k-g,t-m,c-p).normalize();b[4].setComponents(f-e,k-i,t-n,c-q).normalize();b[5].setComponents(f+e,k+i,t+n,c+q).normalize();return this},intersectsObject:function(){var a=new THREE.Vector3;return function(b){var c=b.geometry,b=b.matrixWorld;null===c.boundingSphere&&c.computeBoundingSphere();c=-c.boundingSphere.radius*b.getMaxScaleOnAxis();a.getPositionFromMatrix(b);for(var b=this.planes,d=0;6>d;d++)if(b[d].distanceToPoint(a)<
+THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var h=this.planes;h[0].copy(a);h[1].copy(b);h[2].copy(c);h[3].copy(d);h[4].copy(e);h[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],h=c[4],g=c[5],i=c[6],k=c[7],l=c[8],m=c[9],n=c[10],t=c[11],r=c[12],p=c[13],q=c[14],c=c[15];b[0].setComponents(f-a,k-h,t-l,c-r).normalize();b[1].setComponents(f+
+a,k+h,t+l,c+r).normalize();b[2].setComponents(f+d,k+g,t+m,c+p).normalize();b[3].setComponents(f-d,k-g,t-m,c-p).normalize();b[4].setComponents(f-e,k-i,t-n,c-q).normalize();b[5].setComponents(f+e,k+i,t+n,c+q).normalize();return this},intersectsObject:function(){var a=new THREE.Vector3;return function(b){var c=b.geometry,b=b.matrixWorld;null===c.boundingSphere&&c.computeBoundingSphere();c=-c.boundingSphere.radius*b.getMaxScaleOnAxis();a.getPositionFromMatrix(b);for(var b=this.planes,d=0;6>d;d++)if(b[d].distanceToPoint(a)<
 c)return!1;return!0}}(),intersectsSphere:function(a){for(var b=this.planes,c=a.center,a=-a.radius,d=0;6>d;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},intersectsBox:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){for(var d=this.planes,e=0;6>e;e++){var f=d[e];a.x=0<f.normal.x?c.min.x:c.max.x;b.x=0<f.normal.x?c.max.x:c.min.x;a.y=0<f.normal.y?c.min.y:c.max.y;b.y=0<f.normal.y?c.max.y:c.min.y;a.z=0<f.normal.z?c.min.z:c.max.z;b.z=0<f.normal.z?c.max.z:c.min.z;var h=f.distanceToPoint(a),
 f=f.distanceToPoint(b);if(0>h&&0>f)return!1}return!0}}(),containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}};THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0};
 THREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,
@@ -137,11 +137,11 @@ THREE.Clock.prototype={constructor:THREE.Clock,start:function(){this.oldTime=thi
 a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}};THREE.EventDispatcher=function(){};
 THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(a){a.addEventListener=THREE.EventDispatcher.prototype.addEventListener;a.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener;a.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener;a.dispatchEvent=THREE.EventDispatcher.prototype.dispatchEvent},addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&&
 c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners,d=c[a].indexOf(b);-1!==d&&c[a].splice(d,1)}},dispatchEvent:function(a){if(void 0!==this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;for(var c=0,d=b.length;c<d;c++)b[c].call(this,a)}}}};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray;new a.Plane;new a.Vector3;var d=new a.Vector3,e=new a.Matrix4,f=function(a,b){return a.distance-b.distance},h=function(f,g,l){if(f instanceof a.Particle){d.getPositionFromMatrix(f.matrixWorld);var m=g.ray.distanceToPoint(d);if(m>f.scale.x)return l;l.push({distance:m,point:f.position,face:null,object:f})}else if(f instanceof a.LOD)d.getPositionFromMatrix(f.matrixWorld),
-m=g.ray.origin.distanceTo(d),h(f.getObjectForDistance(m),g,l);else if(f instanceof a.Mesh){var n=f.geometry;d.getPositionFromMatrix(f.matrixWorld);null===n.boundingSphere&&n.computeBoundingSphere();b.set(d,n.boundingSphere.radius*f.matrixWorld.getMaxScaleOnAxis());if(!1===g.ray.isIntersectionSphere(b))return l;var t=n.vertices;if(n instanceof a.BufferGeometry){var s=f.material;if(void 0===s||!1===n.dynamic)return l;var p,q,r=g.precision;e.getInverse(f.matrixWorld);c.copy(g.ray).applyMatrix4(e);var u,
-t=!1;n.attributes.index&&(t=!0);u=new a.Vector3;for(var w=new a.Vector3,E=new a.Vector3,C=n.offsets,F=n.attributes.index.array,z=n.attributes.position.array,D=n.offsets.length,y=0;y<D;++y)for(var m=C[y].start,O=C[y].index,n=m,x=m+C[y].count;n<x;n+=3)if(t?(m=O+F[n],p=O+F[n+1],q=O+F[n+2]):(m=O,p=O+1,q=O+2),u.set(z[3*m],z[3*m+1],z[3*m+2]),w.set(z[3*p],z[3*p+1],z[3*p+2]),E.set(z[3*q],z[3*q+1],z[3*q+2]),p=a.Triangle.intersectionRay(c,u,w,E,s.side!==a.DoubleSide))p.applyMatrix4(f.matrixWorld),m=g.ray.origin.distanceTo(p),
-m<r||m<g.near||m>g.far||l.push({distance:m,point:p,face:null,faceIndex:null,object:f})}else if(n instanceof a.Geometry){w=f.material instanceof a.MeshFaceMaterial;E=!0===w?f.material.materials:null;r=g.precision;e.getInverse(f.matrixWorld);c.copy(g.ray).applyMatrix4(e);C=0;for(u=n.faces.length;C<u;C++)if(F=n.faces[C],s=!0===w?E[F.materialIndex]:f.material,void 0!==s&&(m=t[F.a],p=t[F.b],q=t[F.c],p=a.Triangle.intersectionRay(c,m,p,q,s.side!==a.DoubleSide)))p.applyMatrix4(f.matrixWorld),m=g.ray.origin.distanceTo(p),
-m<r||m<g.near||m>g.far||l.push({distance:m,point:p,face:F,faceIndex:C,object:f})}}else if(f instanceof a.Line){r=g.linePrecision;s=r*r;n=f.geometry;null===n.boundingSphere&&n.computeBoundingSphere();d.getPositionFromMatrix(f.matrixWorld);b.set(d,n.boundingSphere.radius*f.matrixWorld.getMaxScaleOnAxis());if(!1===g.ray.isIntersectionSphere(b))return l;e.getInverse(f.matrixWorld);c.copy(g.ray).applyMatrix4(e);t=n.vertices;r=t.length;p=new a.Vector3;q=new a.Vector3;u=f.type===a.LineStrip?1:2;for(n=0;n<
-r-1;n+=u)c.distanceSqToSegment(t[n],t[n+1],q,p)<=s&&(m=c.origin.distanceTo(q),g.near<=m&&m<=g.far&&l.push({distance:m,point:p.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}},g=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)h(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.linePrecision=1;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b)};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&g(a,this,c);h(a,
+m=g.ray.origin.distanceTo(d),h(f.getObjectForDistance(m),g,l);else if(f instanceof a.Mesh){var n=f.geometry;d.getPositionFromMatrix(f.matrixWorld);null===n.boundingSphere&&n.computeBoundingSphere();b.set(d,n.boundingSphere.radius*f.matrixWorld.getMaxScaleOnAxis());if(!1===g.ray.isIntersectionSphere(b))return l;var t=n.vertices;if(n instanceof a.BufferGeometry){var r=f.material;if(void 0===r||!1===n.dynamic)return l;var p,q,s=g.precision;e.getInverse(f.matrixWorld);c.copy(g.ray).applyMatrix4(e);var u,
+t=!1;n.attributes.index&&(t=!0);u=new a.Vector3;for(var w=new a.Vector3,E=new a.Vector3,C=n.offsets,F=n.attributes.index.array,z=n.attributes.position.array,D=n.offsets.length,y=0;y<D;++y)for(var m=C[y].start,O=C[y].index,n=m,x=m+C[y].count;n<x;n+=3)if(t?(m=O+F[n],p=O+F[n+1],q=O+F[n+2]):(m=O,p=O+1,q=O+2),u.set(z[3*m],z[3*m+1],z[3*m+2]),w.set(z[3*p],z[3*p+1],z[3*p+2]),E.set(z[3*q],z[3*q+1],z[3*q+2]),p=a.Triangle.intersectionRay(c,u,w,E,r.side!==a.DoubleSide))p.applyMatrix4(f.matrixWorld),m=g.ray.origin.distanceTo(p),
+m<s||m<g.near||m>g.far||l.push({distance:m,point:p,face:null,faceIndex:null,object:f})}else if(n instanceof a.Geometry){w=f.material instanceof a.MeshFaceMaterial;E=!0===w?f.material.materials:null;s=g.precision;e.getInverse(f.matrixWorld);c.copy(g.ray).applyMatrix4(e);C=0;for(u=n.faces.length;C<u;C++)if(F=n.faces[C],r=!0===w?E[F.materialIndex]:f.material,void 0!==r&&(m=t[F.a],p=t[F.b],q=t[F.c],p=a.Triangle.intersectionRay(c,m,p,q,r.side!==a.DoubleSide)))p.applyMatrix4(f.matrixWorld),m=g.ray.origin.distanceTo(p),
+m<s||m<g.near||m>g.far||l.push({distance:m,point:p,face:F,faceIndex:C,object:f})}}else if(f instanceof a.Line){s=g.linePrecision;r=s*s;n=f.geometry;null===n.boundingSphere&&n.computeBoundingSphere();d.getPositionFromMatrix(f.matrixWorld);b.set(d,n.boundingSphere.radius*f.matrixWorld.getMaxScaleOnAxis());if(!1===g.ray.isIntersectionSphere(b))return l;e.getInverse(f.matrixWorld);c.copy(g.ray).applyMatrix4(e);t=n.vertices;s=t.length;p=new a.Vector3;q=new a.Vector3;u=f.type===a.LineStrip?1:2;for(n=0;n<
+s-1;n+=u)c.distanceSqToSegment(t[n],t[n+1],q,p)<=r&&(m=c.origin.distanceTo(q),g.near<=m&&m<=g.far&&l.push({distance:m,point:p.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}},g=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)h(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.linePrecision=1;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b)};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&g(a,this,c);h(a,
 this,c);c.sort(f);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)h(a[d],this,c),!0===b&&g(a[d],this,c);c.sort(f);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Euler;this.quaternion=new THREE.Quaternion;this.scale=new THREE.Vector3(1,1,1);this.rotation._quaternion=this.quaternion;this.quaternion._euler=this.rotation;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;
 this.visible=this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.userData={}};
 THREE.Object3D.prototype={constructor:THREE.Object3D,get eulerOrder(){console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order.");return this.rotation.order},set eulerOrder(a){console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order.");this.rotation.order=a},get useQuaternion(){console.warn("DEPRECATED: Object3D's .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(a){console.warn("DEPRECATED: Object3D's .useQuaternion has been removed. The library now uses quaternions by default.")},
@@ -155,41 +155,41 @@ e))return e}},getChildByName:function(a,b){console.warn("DEPRECATED: Object3D's
 this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},clone:function(a,b){void 0===a&&(a=new THREE.Object3D);void 0===b&&(b=!0);a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.quaternion.copy(this.quaternion);
 a.scale.copy(this.scale);a.renderDepth=this.renderDepth;a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix);a.matrixWorld.copy(this.matrixWorld);a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;a.userData=JSON.parse(JSON.stringify(this.userData));if(!0===b)for(var c=0;c<this.children.length;c++)a.add(this.children[c].clone());
 return a}};THREE.EventDispatcher.prototype.apply(THREE.Object3D.prototype);THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(i===l){var a=new THREE.RenderableVertex;k.push(a);l++;i++;return a}return k[i++]}function b(a,b){return a.z!==b.z?b.z-a.z:a.id!==b.id?a.id-b.id:0}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,h=-a.z+a.w,g=-b.z+b.w;if(0<=e&&0<=f&&0<=h&&0<=g)return!0;if(0>e&&0>f||0>h&&0>g)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>h?c=Math.max(c,h/(h-g)):0>g&&(d=Math.min(d,h/(h-g)));if(d<c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var d,e,f=[],h=
-0,g,i,k=[],l=0,m,n,t=[],s=0,p,q,r=[],u=0,w,E,C=[],F=0,z={objects:[],sprites:[],lights:[],elements:[]},D=new THREE.Vector3,y=new THREE.Vector4,O=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),x=new THREE.Box3,B=Array(3),I=new THREE.Matrix4,v=new THREE.Matrix4,A,G=new THREE.Matrix4,R=new THREE.Matrix3,J=new THREE.Matrix3,ba=new THREE.Vector3,qa=new THREE.Frustum,ra=new THREE.Vector4,N=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);
+0,g,i,k=[],l=0,m,n,t=[],r=0,p,q,s=[],u=0,w,E,C=[],F=0,z={objects:[],sprites:[],lights:[],elements:[]},D=new THREE.Vector3,y=new THREE.Vector4,O=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),x=new THREE.Box3,B=Array(3),I=new THREE.Matrix4,v=new THREE.Matrix4,A,G=new THREE.Matrix4,R=new THREE.Matrix3,J=new THREE.Matrix3,ba=new THREE.Vector3,qa=new THREE.Frustum,ra=new THREE.Vector4,N=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);
 v.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(v)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);v.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(v)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,c)};var M=function(a){if(e===h){var b=new THREE.RenderableObject;
 f.push(b);h++;e++;d=b}else d=f[e++];d.id=a.id;d.object=a;null!==a.renderDepth?d.z=a.renderDepth:(D.getPositionFromMatrix(a.matrixWorld),D.applyProjection(v),d.z=D.z);return d},Q=function(a){if(!1!==a.visible){a instanceof THREE.Light?z.lights.push(a):a instanceof THREE.Mesh||a instanceof THREE.Line?(!1===a.frustumCulled||!0===qa.intersectsObject(a))&&z.objects.push(M(a)):(a instanceof THREE.Sprite||a instanceof THREE.Particle)&&z.sprites.push(M(a));for(var b=0,c=a.children.length;b<c;b++)Q(a.children[b])}};
 this.projectScene=function(d,f,h,l){var ea=!1,D,M,fa,V,aa,P,T,ma,va,ja,Pa,Ja;E=q=n=0;z.elements.length=0;!0===d.autoUpdate&&d.updateMatrixWorld();void 0===f.parent&&f.updateMatrixWorld();I.copy(f.matrixWorldInverse.getInverse(f.matrixWorld));v.multiplyMatrices(f.projectionMatrix,I);J.getNormalMatrix(I);qa.setFromMatrix(v);e=0;z.objects.length=0;z.sprites.length=0;z.lights.length=0;Q(d);!0===h&&z.objects.sort(b);d=0;for(h=z.objects.length;d<h;d++)if(T=z.objects[d].object,A=T.matrixWorld,i=0,T instanceof
 THREE.Mesh){ma=T.geometry;fa=ma.vertices;va=ma.faces;ma=ma.faceVertexUvs;R.getNormalMatrix(A);Pa=T.material instanceof THREE.MeshFaceMaterial;Ja=!0===Pa?T.material:null;D=0;for(M=fa.length;D<M;D++){g=a();g.positionWorld.copy(fa[D]).applyMatrix4(A);g.positionScreen.copy(g.positionWorld).applyMatrix4(v);var ga=1/g.positionScreen.w;g.positionScreen.x*=ga;g.positionScreen.y*=ga;g.positionScreen.z*=ga;g.visible=!(-1>g.positionScreen.x||1<g.positionScreen.x||-1>g.positionScreen.y||1<g.positionScreen.y||
 -1>g.positionScreen.z||1<g.positionScreen.z)}fa=0;for(D=va.length;fa<D;fa++)if(M=va[fa],ga=!0===Pa?Ja.materials[M.materialIndex]:T.material,void 0!==ga&&(P=ga.side,V=k[M.a],aa=k[M.b],ja=k[M.c],B[0]=V.positionScreen,B[1]=aa.positionScreen,B[2]=ja.positionScreen,!0===V.visible||!0===aa.visible||!0===ja.visible||O.isIntersectionBox(x.setFromPoints(B))))if(ea=0>(ja.positionScreen.x-V.positionScreen.x)*(aa.positionScreen.y-V.positionScreen.y)-(ja.positionScreen.y-V.positionScreen.y)*(aa.positionScreen.x-
-V.positionScreen.x),P===THREE.DoubleSide||ea===(P===THREE.FrontSide)){if(n===s){var Ha=new THREE.RenderableFace3;t.push(Ha);s++;n++;m=Ha}else m=t[n++];m.id=T.id;m.v1.copy(V);m.v2.copy(aa);m.v3.copy(ja);m.normalModel.copy(M.normal);!1===ea&&(P===THREE.BackSide||P===THREE.DoubleSide)&&m.normalModel.negate();m.normalModel.applyMatrix3(R).normalize();m.normalModelView.copy(m.normalModel).applyMatrix3(J);m.centroidModel.copy(M.centroid).applyMatrix4(A);ja=M.vertexNormals;V=0;for(aa=Math.min(ja.length,
+V.positionScreen.x),P===THREE.DoubleSide||ea===(P===THREE.FrontSide)){if(n===r){var Ha=new THREE.RenderableFace3;t.push(Ha);r++;n++;m=Ha}else m=t[n++];m.id=T.id;m.v1.copy(V);m.v2.copy(aa);m.v3.copy(ja);m.normalModel.copy(M.normal);!1===ea&&(P===THREE.BackSide||P===THREE.DoubleSide)&&m.normalModel.negate();m.normalModel.applyMatrix3(R).normalize();m.normalModelView.copy(m.normalModel).applyMatrix3(J);m.centroidModel.copy(M.centroid).applyMatrix4(A);ja=M.vertexNormals;V=0;for(aa=Math.min(ja.length,
 3);V<aa;V++)Ha=m.vertexNormalsModel[V],Ha.copy(ja[V]),!1===ea&&(P===THREE.BackSide||P===THREE.DoubleSide)&&Ha.negate(),Ha.applyMatrix3(R).normalize(),m.vertexNormalsModelView[V].copy(Ha).applyMatrix3(J);m.vertexNormalsLength=ja.length;ea=0;for(V=Math.min(ma.length,3);ea<V;ea++)if(ja=ma[ea][fa],void 0!==ja){aa=0;for(P=ja.length;aa<P;aa++)m.uvs[ea][aa]=ja[aa]}m.color=M.color;m.material=ga;ba.copy(m.centroidModel).applyProjection(v);m.z=ba.z;z.elements.push(m)}}else if(T instanceof THREE.Line){G.multiplyMatrices(v,
-A);fa=T.geometry.vertices;V=a();V.positionScreen.copy(fa[0]).applyMatrix4(G);va=T.type===THREE.LinePieces?2:1;D=1;for(M=fa.length;D<M;D++)V=a(),V.positionScreen.copy(fa[D]).applyMatrix4(G),0<(D+1)%va||(aa=k[i-2],ra.copy(V.positionScreen),N.copy(aa.positionScreen),!0===c(ra,N)&&(ra.multiplyScalar(1/ra.w),N.multiplyScalar(1/N.w),q===u?(ma=new THREE.RenderableLine,r.push(ma),u++,q++,p=ma):p=r[q++],p.id=T.id,p.v1.positionScreen.copy(ra),p.v2.positionScreen.copy(N),p.z=Math.max(ra.z,N.z),p.material=T.material,
+A);fa=T.geometry.vertices;V=a();V.positionScreen.copy(fa[0]).applyMatrix4(G);va=T.type===THREE.LinePieces?2:1;D=1;for(M=fa.length;D<M;D++)V=a(),V.positionScreen.copy(fa[D]).applyMatrix4(G),0<(D+1)%va||(aa=k[i-2],ra.copy(V.positionScreen),N.copy(aa.positionScreen),!0===c(ra,N)&&(ra.multiplyScalar(1/ra.w),N.multiplyScalar(1/N.w),q===u?(ma=new THREE.RenderableLine,s.push(ma),u++,q++,p=ma):p=s[q++],p.id=T.id,p.v1.positionScreen.copy(ra),p.v2.positionScreen.copy(N),p.z=Math.max(ra.z,N.z),p.material=T.material,
 T.material.vertexColors===THREE.VertexColors&&(p.vertexColors[0].copy(T.geometry.colors[D]),p.vertexColors[1].copy(T.geometry.colors[D-1])),z.elements.push(p)))}d=0;for(h=z.sprites.length;d<h;d++)T=z.sprites[d].object,A=T.matrixWorld,T instanceof THREE.Particle&&(y.set(A.elements[12],A.elements[13],A.elements[14],1),y.applyMatrix4(v),ga=1/y.w,y.z*=ga,0<y.z&&1>y.z&&(E===F?(va=new THREE.RenderableParticle,C.push(va),F++,E++,w=va):w=C[E++],w.id=T.id,w.x=y.x*ga,w.y=y.y*ga,w.z=y.z,w.object=T,w.rotation=
 T.rotation.z,w.scale.x=T.scale.x*Math.abs(w.x-(y.x+f.projectionMatrix.elements[0])/(y.w+f.projectionMatrix.elements[12])),w.scale.y=T.scale.y*Math.abs(w.y-(y.y+f.projectionMatrix.elements[5])/(y.w+f.projectionMatrix.elements[13])),w.material=T.material,z.elements.push(w)));!0===l&&z.elements.sort(b);return z}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
 THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
-return a}};THREE.Face4=function(a,b,c,d,e,f,h){return new THREE.Face3(a,b,c,e,f,h)};THREE.Geometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.vertices=[];this.colors=[];this.normals=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.dynamic=!0;this.buffersNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=
-this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesNeedUpdate=!1};
+return a}};THREE.Face4=function(a,b,c,d,e,f,h){return new THREE.Face3(a,b,c,e,f,h)};THREE.Geometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.vertices=[];this.colors=[];this.normals=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.dynamic=!0;this.buffersNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=this.normalsNeedUpdate=
+this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesNeedUpdate=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){for(var b=(new THREE.Matrix3).getNormalMatrix(a),c=0,d=this.vertices.length;c<d;c++)this.vertices[c].applyMatrix4(a);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];e.normal.applyMatrix3(b).normalize();for(var f=0,h=e.vertexNormals.length;f<h;f++)e.vertexNormals[f].applyMatrix3(b).normalize();e.centroid.applyMatrix4(a)}this.boundingBox instanceof THREE.Box3&&this.computeBoundingBox();this.boundingSphere instanceof
 THREE.Sphere&&this.computeBoundingSphere()},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c.centroid.set(0,0,0),c.centroid.add(this.vertices[c.a]),c.centroid.add(this.vertices[c.b]),c.centroid.add(this.vertices[c.c]),c.centroid.divideScalar(3)},computeFaceNormals:function(){for(var a=new THREE.Vector3,b=new THREE.Vector3,c=0,d=this.faces.length;c<d;c++){var e=this.faces[c],f=this.vertices[e.a],h=this.vertices[e.b];a.subVectors(this.vertices[e.c],h);b.subVectors(f,
 h);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){var b,c,d,e;if(void 0===this.__tmpVertices){e=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}if(a){var f,h,g=new THREE.Vector3,i=new THREE.Vector3;new THREE.Vector3;
 new THREE.Vector3;new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],a=this.vertices[d.a],f=this.vertices[d.b],h=this.vertices[d.c],g.subVectors(h,f),i.subVectors(a,f),g.cross(i),e[d.a].add(g),e[d.b].add(g),e[d.c].add(g)}else{b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],e[d.a].add(d.normal),e[d.b].add(d.normal),e[d.c].add(d.normal)}b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),
 d.vertexNormals[2].copy(e[d.c])},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=[];e=this.morphNormals[a].faceNormals;var h=this.morphNormals[a].vertexNormals,g,i;c=0;for(d=this.faces.length;c<d;c++)g=new THREE.Vector3,i={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},e.push(g),h.push(i)}h=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],g=h.faceNormals[c],i=h.vertexNormals[c],g.copy(e.normal),i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2])}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,h,g,i,k,l,m,n,t,s,p,q,r=[],u=[];c=new THREE.Vector3;var w=new THREE.Vector3,E=new THREE.Vector3,C=new THREE.Vector3,F=new THREE.Vector3;
-a=0;for(b=this.vertices.length;a<b;a++)r[a]=new THREE.Vector3,u[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],f=this.faceVertexUvs[0][a],d=e.a,q=e.b,e=e.c,h=this.vertices[d],g=this.vertices[q],i=this.vertices[e],k=f[0],l=f[1],m=f[2],f=g.x-h.x,n=i.x-h.x,t=g.y-h.y,s=i.y-h.y,g=g.z-h.z,h=i.z-h.z,i=l.x-k.x,p=m.x-k.x,l=l.y-k.y,k=m.y-k.y,m=1/(i*k-p*l),c.set((k*f-l*n)*m,(k*t-l*s)*m,(k*g-l*h)*m),w.set((i*n-p*f)*m,(i*s-p*t)*m,(i*h-p*g)*m),r[d].add(c),r[q].add(c),r[e].add(c),u[d].add(w),
-u[q].add(w),u[e].add(w);w=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];for(c=0;c<Math.min(e.vertexNormals.length,3);c++)F.copy(e.vertexNormals[c]),d=e[w[c]],q=r[d],E.copy(q),E.sub(F.multiplyScalar(F.dot(q))).normalize(),C.crossVectors(e.vertexNormals[c],q),d=C.dot(u[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(E.x,E.y,E.z,d)}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]=
+c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],g=h.faceNormals[c],i=h.vertexNormals[c],g.copy(e.normal),i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2])}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,h,g,i,k,l,m,n,t,r,p,q,s=[],u=[];c=new THREE.Vector3;var w=new THREE.Vector3,E=new THREE.Vector3,C=new THREE.Vector3,F=new THREE.Vector3;
+a=0;for(b=this.vertices.length;a<b;a++)s[a]=new THREE.Vector3,u[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],f=this.faceVertexUvs[0][a],d=e.a,q=e.b,e=e.c,h=this.vertices[d],g=this.vertices[q],i=this.vertices[e],k=f[0],l=f[1],m=f[2],f=g.x-h.x,n=i.x-h.x,t=g.y-h.y,r=i.y-h.y,g=g.z-h.z,h=i.z-h.z,i=l.x-k.x,p=m.x-k.x,l=l.y-k.y,k=m.y-k.y,m=1/(i*k-p*l),c.set((k*f-l*n)*m,(k*t-l*r)*m,(k*g-l*h)*m),w.set((i*n-p*f)*m,(i*r-p*t)*m,(i*h-p*g)*m),s[d].add(c),s[q].add(c),s[e].add(c),u[d].add(w),
+u[q].add(w),u[e].add(w);w=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];for(c=0;c<Math.min(e.vertexNormals.length,3);c++)F.copy(e.vertexNormals[c]),d=e[w[c]],q=s[d],E.copy(q),E.sub(F.multiplyScalar(F.dot(q))).normalize(),C.crossVectors(e.vertexNormals[c],q),d=C.dot(u[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(E.x,E.y,E.z,d)}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(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);this.boundingSphere.setFromPoints(this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,h;this.__tmpVertices=void 0;f=0;for(h=this.vertices.length;f<h;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*
 e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(h=this.faces.length;f<h;f++){e=this.faces[f];e.a=c[e.a];e.b=c[e.b];e.c=c[e.c];e=[e.a,e.b,e.c];for(d=0;3>d;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}}for(f=a.length-1;0<=f;f--){this.faces.splice(f,1);c=0;for(h=this.faceVertexUvs.length;c<h;c++)this.faceVertexUvs[c].splice(f,1)}f=this.vertices.length-b.length;this.vertices=b;return f},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<
 d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],h=0,g=e.length;h<g;h++)f.push(new THREE.Vector2(e[h].x,e[h].y));a.faceVertexUvs[0].push(f)}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;THREE.BufferGeometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.attributes={};this.dynamic=!0;this.offsets=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.morphTargets=[]};
 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&&((new THREE.Matrix3).getNormalMatrix(a).multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var a=
 this.attributes.position.array;if(a){var b=this.boundingBox,c,d,e;3<=a.length&&(b.min.x=b.max.x=a[0],b.min.y=b.max.y=a[1],b.min.z=b.max.z=a[2]);for(var f=3,h=a.length;f<h;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(){null===this.boundingSphere&&(this.boundingSphere=
 new THREE.Sphere);var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,h=a.length;f<h;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){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)};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=0}var e=
-this.attributes.position.array,f=this.attributes.normal.array,h,g,i,k,l,m,n=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3;if(this.attributes.index){var r=this.attributes.index.array,u=this.offsets;c=0;for(d=u.length;c<d;++c){b=u[c].start;h=u[c].count;var w=u[c].index;a=b;for(b+=h;a<b;a+=3)h=w+r[a],g=w+r[a+1],i=w+r[a+2],k=e[3*h],l=e[3*h+1],m=e[3*h+2],n.set(k,l,m),k=e[3*g],l=e[3*g+1],m=e[3*g+2],t.set(k,l,m),k=e[3*i],l=e[3*i+1],m=e[3*i+2],s.set(k,l,
-m),p.subVectors(s,t),q.subVectors(n,t),p.cross(q),f[3*h]+=p.x,f[3*h+1]+=p.y,f[3*h+2]+=p.z,f[3*g]+=p.x,f[3*g+1]+=p.y,f[3*g+2]+=p.z,f[3*i]+=p.x,f[3*i+1]+=p.y,f[3*i+2]+=p.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],l=e[a+1],m=e[a+2],n.set(k,l,m),k=e[a+3],l=e[a+4],m=e[a+5],t.set(k,l,m),k=e[a+6],l=e[a+7],m=e[a+8],s.set(k,l,m),p.subVectors(s,t),q.subVectors(n,t),p.cross(q),f[a]=p.x,f[a+1]=p.y,f[a+2]=p.z,f[a+3]=p.x,f[a+4]=p.y,f[a+5]=p.z,f[a+6]=p.x,f[a+7]=p.y,f[a+8]=p.z}this.normalizeNormals();this.normalsNeedUpdate=
+this.attributes.position.array,f=this.attributes.normal.array,h,g,i,k,l,m,n=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3;if(this.attributes.index){var s=this.attributes.index.array,u=this.offsets;c=0;for(d=u.length;c<d;++c){b=u[c].start;h=u[c].count;var w=u[c].index;a=b;for(b+=h;a<b;a+=3)h=w+s[a],g=w+s[a+1],i=w+s[a+2],k=e[3*h],l=e[3*h+1],m=e[3*h+2],n.set(k,l,m),k=e[3*g],l=e[3*g+1],m=e[3*g+2],t.set(k,l,m),k=e[3*i],l=e[3*i+1],m=e[3*i+2],r.set(k,l,
+m),p.subVectors(r,t),q.subVectors(n,t),p.cross(q),f[3*h]+=p.x,f[3*h+1]+=p.y,f[3*h+2]+=p.z,f[3*g]+=p.x,f[3*g+1]+=p.y,f[3*g+2]+=p.z,f[3*i]+=p.x,f[3*i+1]+=p.y,f[3*i+2]+=p.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],l=e[a+1],m=e[a+2],n.set(k,l,m),k=e[a+3],l=e[a+4],m=e[a+5],t.set(k,l,m),k=e[a+6],l=e[a+7],m=e[a+8],r.set(k,l,m),p.subVectors(r,t),q.subVectors(n,t),p.cross(q),f[a]=p.x,f[a+1]=p.y,f[a+2]=p.z,f[a+3]=p.x,f[a+4]=p.y,f[a+5]=p.z,f[a+6]=p.x,f[a+7]=p.y,f[a+8]=p.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){qa.x=d[3*a];qa.y=d[3*a+1];qa.z=d[3*a+2];ra.copy(qa);M=g[a];J.copy(M);J.sub(qa.multiplyScalar(qa.dot(M))).normalize();ba.crossVectors(ra,M);Q=ba.dot(i[a]);N=0>Q?-1:1;h[4*a]=J.x;h[4*a+1]=J.y;h[4*a+2]=J.z;h[4*a+3]=N}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;void 0===this.attributes.tangent&&(this.attributes.tangent={itemSize:4,array:new Float32Array(4*f)});for(var h=this.attributes.tangent.array,g=[],i=[],k=0;k<f;k++)g[k]=new THREE.Vector3,
-i[k]=new THREE.Vector3;var l,m,n,t,s,p,q,r,u,w,E,C,F,z,D,f=new THREE.Vector3,k=new THREE.Vector3,y,O,x,B,I,v,A,G=this.offsets;x=0;for(B=G.length;x<B;++x){O=G[x].start;I=G[x].count;var R=G[x].index;y=O;for(O+=I;y<O;y+=3)I=R+b[y],v=R+b[y+1],A=R+b[y+2],l=c[3*I],m=c[3*I+1],n=c[3*I+2],t=c[3*v],s=c[3*v+1],p=c[3*v+2],q=c[3*A],r=c[3*A+1],u=c[3*A+2],w=e[2*I],E=e[2*I+1],C=e[2*v],F=e[2*v+1],z=e[2*A],D=e[2*A+1],t-=l,l=q-l,s-=m,m=r-m,p-=n,n=u-n,C-=w,w=z-w,F-=E,E=D-E,D=1/(C*E-w*F),f.set((E*t-F*l)*D,(E*s-F*m)*D,
-(E*p-F*n)*D),k.set((C*l-w*t)*D,(C*m-w*s)*D,(C*n-w*p)*D),g[I].add(f),g[v].add(f),g[A].add(f),i[I].add(k),i[v].add(k),i[A].add(k)}var J=new THREE.Vector3,ba=new THREE.Vector3,qa=new THREE.Vector3,ra=new THREE.Vector3,N,M,Q;x=0;for(B=G.length;x<B;++x){O=G[x].start;I=G[x].count;R=G[x].index;y=O;for(O+=I;y<O;y+=3)I=R+b[y],v=R+b[y+1],A=R+b[y+2],a(I),a(v),a(A)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
+i[k]=new THREE.Vector3;var l,m,n,t,r,p,q,s,u,w,E,C,F,z,D,f=new THREE.Vector3,k=new THREE.Vector3,y,O,x,B,I,v,A,G=this.offsets;x=0;for(B=G.length;x<B;++x){O=G[x].start;I=G[x].count;var R=G[x].index;y=O;for(O+=I;y<O;y+=3)I=R+b[y],v=R+b[y+1],A=R+b[y+2],l=c[3*I],m=c[3*I+1],n=c[3*I+2],t=c[3*v],r=c[3*v+1],p=c[3*v+2],q=c[3*A],s=c[3*A+1],u=c[3*A+2],w=e[2*I],E=e[2*I+1],C=e[2*v],F=e[2*v+1],z=e[2*A],D=e[2*A+1],t-=l,l=q-l,r-=m,m=s-m,p-=n,n=u-n,C-=w,w=z-w,F-=E,E=D-E,D=1/(C*E-w*F),f.set((E*t-F*l)*D,(E*r-F*m)*D,
+(E*p-F*n)*D),k.set((C*l-w*t)*D,(C*m-w*r)*D,(C*n-w*p)*D),g[I].add(f),g[v].add(f),g[A].add(f),i[I].add(k),i[v].add(k),i[A].add(k)}var J=new THREE.Vector3,ba=new THREE.Vector3,qa=new THREE.Vector3,ra=new THREE.Vector3,N,M,Q;x=0;for(B=G.length;x<B;++x){O=G[x].start;I=G[x].count;R=G[x].index;y=O;for(O+=I;y<O;y+=3)I=R+b[y],v=R+b[y+1],A=R+b[y+2],a(I),a(v),a(A)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(THREE.Math.degToRad(0.5*this.fov))*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=Object.create(THREE.Object3D.prototype);THREE.Light.prototype.clone=function(a){void 0===a&&(a=new THREE.Light);THREE.Object3D.prototype.clone.call(this,a);a.color.copy(this.color);return a};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype);THREE.AmbientLight.prototype.clone=function(){var a=new THREE.AmbientLight;THREE.Light.prototype.clone.call(this,a);return a};THREE.AreaLight=function(a,b){THREE.Light.call(this,a);this.normal=new THREE.Vector3(0,-1,0);this.right=new THREE.Vector3(1,0,0);this.intensity=void 0!==b?b:1;this.height=this.width=1;this.constantAttenuation=1.5;this.linearAttenuation=0.5;this.quadraticAttenuation=0.1};THREE.AreaLight.prototype=Object.create(THREE.Light.prototype);THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position.set(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=!1;this.shadowCascadeOffset=new THREE.Vector3(0,
 0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype);
@@ -197,8 +197,8 @@ THREE.DirectionalLight.prototype.clone=function(){var a=new THREE.DirectionalLig
 this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight.prototype.clone=function(){var a=new THREE.SpotLight;THREE.Light.prototype.clone.call(this,a);a.target=this.target.clone();a.intensity=this.intensity;a.distance=this.distance;a.angle=this.angle;a.exponent=this.exponent;a.castShadow=this.castShadow;a.onlyShadow=this.onlyShadow;return a};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},needsTangents:function(a){for(var b=0,c=a.length;b<c;b++)if(a[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,g,i,k,q){var r=/\.dds$/i.test(f),u=b+"/"+f;if(r){var w=THREE.ImageUtils.loadCompressedTexture(u);a[e]=w}else w=document.createElement("canvas"),a[e]=new THREE.Texture(w);a[e].sourceFile=f;g&&(a[e].repeat.set(g[0],g[1]),1!==g[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==g[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);k&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==
-f[k[0]]&&(a[e].wrapS=f[k[0]]),void 0!==f[k[1]]&&(a[e].wrapT=f[k[1]]));q&&(a[e].anisotropy=q);if(!r){var E=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);E.image.width=a;E.image.height=b;E.image.getContext("2d").drawImage(this,0,0,a,b)}else E.image=this;E.needsUpdate=!0};a.crossOrigin=h.crossOrigin;a.src=u}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,g="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,
+a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,g,i,k,q){var s=/\.dds$/i.test(f),u=b+"/"+f;if(s){var w=THREE.ImageUtils.loadCompressedTexture(u);a[e]=w}else w=document.createElement("canvas"),a[e]=new THREE.Texture(w);a[e].sourceFile=f;g&&(a[e].repeat.set(g[0],g[1]),1!==g[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==g[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);k&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==
+f[k[0]]&&(a[e].wrapS=f[k[0]]),void 0!==f[k[1]]&&(a[e].wrapT=f[k[1]]));q&&(a[e].anisotropy=q);if(!s){var E=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);E.image.width=a;E.image.height=b;E.image.getContext("2d").drawImage(this,0,0,a,b)}else E.image=this;E.needsUpdate=!0};a.crossOrigin=h.crossOrigin;a.src=u}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,g="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,
 lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var k=a.shading.toLowerCase();"phong"===k?g="MeshPhongMaterial":"basic"===k&&(g="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",a.mapSpecular,a.mapSpecularRepeat,
@@ -208,11 +208,11 @@ THREE.XHRLoader.prototype={constructor:THREE.XHRLoader,load:function(a,b,c,d){va
 THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d){var e=this,f=document.createElement("img");void 0!==b&&f.addEventListener("load",function(){e.manager.itemEnd(a);b(this)},!1);void 0!==c&&f.addEventListener("progress",function(a){c(a)},!1);void 0!==d&&f.addEventListener("error",function(a){d(a)},!1);void 0!==this.crossOrigin&&(f.crossOrigin=this.crossOrigin);f.src=a;e.manager.itemStart(a)},setCrossOrigin:function(a){this.crossOrigin=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,h=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var g=JSON.parse(f.responseText),g=a.parse(g,d);c(g.geometry,g.materials)}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===h&&
 (h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)};
-THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1,e,f,h,g,i,k,l,m,n,t,s,p,q,r,u,w=a.faces;t=a.vertices;var E=a.normals,C=a.colors,F=0;if(void 0!==a.uvs){for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&F++;for(e=0;e<F;e++)c.faceUvs[e]=[],c.faceVertexUvs[e]=[]}g=0;for(i=t.length;g<i;)k=new THREE.Vector3,k.x=t[g++]*d,k.y=t[g++]*d,k.z=t[g++]*d,c.vertices.push(k);g=0;for(i=w.length;g<i;){t=w[g++];k=t&1;h=t&2;e=t&4;f=t&8;m=t&16;l=t&32;s=t&64;t&=128;k?(p=
-new THREE.Face4,p.a=w[g++],p.b=w[g++],p.c=w[g++],p.d=w[g++],k=4):(p=new THREE.Face3,p.a=w[g++],p.b=w[g++],p.c=w[g++],k=3);h&&(h=w[g++],p.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<F;e++)q=a.uvs[e],n=w[g++],u=q[2*n],n=q[2*n+1],c.faceUvs[e][h]=new THREE.Vector2(u,n);if(f)for(e=0;e<F;e++){q=a.uvs[e];r=[];for(f=0;f<k;f++)n=w[g++],u=q[2*n],n=q[2*n+1],r[f]=new THREE.Vector2(u,n);c.faceVertexUvs[e][h]=r}m&&(m=3*w[g++],f=new THREE.Vector3,f.x=E[m++],f.y=E[m++],f.z=E[m],p.normal=f);if(l)for(e=0;e<k;e++)m=
-3*w[g++],f=new THREE.Vector3,f.x=E[m++],f.y=E[m++],f.z=E[m],p.vertexNormals.push(f);s&&(l=w[g++],l=new THREE.Color(C[l]),p.color=l);if(t)for(e=0;e<k;e++)l=w[g++],l=new THREE.Color(C[l]),p.vertexColors.push(l);c.faces.push(p)}if(a.skinWeights){g=0;for(i=a.skinWeights.length;g<i;g+=2)w=a.skinWeights[g],E=a.skinWeights[g+1],c.skinWeights.push(new THREE.Vector4(w,E,0,0))}if(a.skinIndices){g=0;for(i=a.skinIndices.length;g<i;g+=2)w=a.skinIndices[g],E=a.skinIndices[g+1],c.skinIndices.push(new THREE.Vector4(w,
-E,0,0))}c.bones=a.bones;c.animation=a.animation;if(void 0!==a.morphTargets){g=0;for(i=a.morphTargets.length;g<i;g++){c.morphTargets[g]={};c.morphTargets[g].name=a.morphTargets[g].name;c.morphTargets[g].vertices=[];C=c.morphTargets[g].vertices;F=a.morphTargets[g].vertices;w=0;for(E=F.length;w<E;w+=3)t=new THREE.Vector3,t.x=F[w]*d,t.y=F[w+1]*d,t.z=F[w+2]*d,C.push(t)}}if(void 0!==a.morphColors){g=0;for(i=a.morphColors.length;g<i;g++){c.morphColors[g]={};c.morphColors[g].name=a.morphColors[g].name;c.morphColors[g].colors=
-[];E=c.morphColors[g].colors;C=a.morphColors[g].colors;d=0;for(w=C.length;d<w;d+=3)F=new THREE.Color(16755200),F.setRGB(C[d],C[d+1],C[d+2]),E.push(F)}}c.computeCentroids();c.computeFaceNormals();c.computeBoundingSphere();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingManager=function(a,b,c){var d=this,e=0,f=0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(){f++};this.itemEnd=function(a){e++;if(void 0!==d.onProgress)d.onProgress(a,e,f);if(e===f&&void 0!==d.onLoad)d.onLoad()}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.BufferGeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
+THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1,e,f,h,g,i,k,l,m,n,t,r,p,q,s,u,w=a.faces;l=a.vertices;var E=a.normals,C=a.colors,F=0;if(void 0!==a.uvs){for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&F++;for(e=0;e<F;e++)c.faceVertexUvs[e]=[]}g=0;for(i=l.length;g<i;)t=new THREE.Vector3,t.x=l[g++]*d,t.y=l[g++]*d,t.z=l[g++]*d,c.vertices.push(t);g=0;for(i=w.length;g<i;){t=w[g++];k=t&1;h=t&2;e=t&8;m=t&16;r=t&32;l=t&64;t&=128;k?(p=new THREE.Face4,p.a=w[g++],
+p.b=w[g++],p.c=w[g++],p.d=w[g++],k=4):(p=new THREE.Face3,p.a=w[g++],p.b=w[g++],p.c=w[g++],k=3);h&&(h=w[g++],p.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<F;e++){q=a.uvs[e];s=[];for(f=0;f<k;f++)n=w[g++],u=q[2*n],n=q[2*n+1],s[f]=new THREE.Vector2(u,n);c.faceVertexUvs[e][h]=s}m&&(m=3*w[g++],p.normal.set(E[m++],E[m++],E[m]));if(r)for(e=0;e<k;e++)m=3*w[g++],r=new THREE.Vector3(E[m++],E[m++],E[m]),p.vertexNormals.push(r);l&&(l=w[g++],p.color.setHex(C[l]));if(t)for(e=0;e<k;e++)l=w[g++],p.vertexColors.push(new THREE.Color(C[l]));
+c.faces.push(p)}if(a.skinWeights){g=0;for(i=a.skinWeights.length;g<i;g+=2)w=a.skinWeights[g],E=a.skinWeights[g+1],c.skinWeights.push(new THREE.Vector4(w,E,0,0))}if(a.skinIndices){g=0;for(i=a.skinIndices.length;g<i;g+=2)w=a.skinIndices[g],E=a.skinIndices[g+1],c.skinIndices.push(new THREE.Vector4(w,E,0,0))}c.bones=a.bones;c.animation=a.animation;if(void 0!==a.morphTargets){g=0;for(i=a.morphTargets.length;g<i;g++){c.morphTargets[g]={};c.morphTargets[g].name=a.morphTargets[g].name;c.morphTargets[g].vertices=
+[];C=c.morphTargets[g].vertices;F=a.morphTargets[g].vertices;w=0;for(E=F.length;w<E;w+=3)l=new THREE.Vector3,l.x=F[w]*d,l.y=F[w+1]*d,l.z=F[w+2]*d,C.push(l)}}if(void 0!==a.morphColors){g=0;for(i=a.morphColors.length;g<i;g++){c.morphColors[g]={};c.morphColors[g].name=a.morphColors[g].name;c.morphColors[g].colors=[];E=c.morphColors[g].colors;C=a.morphColors[g].colors;d=0;for(w=C.length;d<w;d+=3)F=new THREE.Color(16755200),F.setRGB(C[d],C[d+1],C[d+2]),E.push(F)}}c.computeCentroids();c.computeFaceNormals();
+c.computeBoundingSphere();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingManager=function(a,b,c){var d=this,e=0,f=0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(){f++};this.itemEnd=function(a){e++;if(void 0!==d.onProgress)d.onProgress(a,e,f);if(e===f&&void 0!==d.onLoad)d.onLoad()}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.BufferGeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
 THREE.BufferGeometryLoader.prototype={constructor:THREE.BufferGeometryLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE.BufferGeometry,c=a.attributes,d=a.offsets,a=a.boundingSphere,e;for(e in c){var f=c[e];b.attributes[e]={itemSize:f.itemSize,array:new self[f.type](f.array)}}void 0!==d&&(b.offsets=JSON.parse(JSON.stringify(d)));
 void 0!==a&&(b.boundingSphere=new THREE.Sphere(void 0,a.radius));return b}};THREE.GeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(){}};THREE.MaterialLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
 THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE[a.type];void 0!==a.color&&b.color.setHex(a.color);void 0!==a.ambient&&b.ambient.setHex(a.ambient);void 0!==a.emissive&&b.emissive.setHex(a.emissive);void 0!==a.specular&&b.specular.setHex(a.specular);void 0!==a.shininess&&
@@ -225,26 +225,26 @@ b.right,b.top,b.bottom,b.near,b.far);break;case "AmbientLight":e=new THREE.Ambie
 e&&console.error("THREE.ObjectLoader: Undefined geometry "+b.geometry);void 0===f&&console.error("THREE.ObjectLoader: Undefined material "+b.material);e=new THREE.Mesh(e,f);break;default:e=new THREE.Object3D}e.uuid=b.uuid;void 0!==b.name&&(e.name=b.name);void 0!==b.matrix?(a.fromArray(b.matrix),a.decompose(e.position,e.quaternion,e.scale)):(void 0!==b.position&&e.position.fromArray(b.position),void 0!==b.rotation&&e.rotation.fromArray(b.rotation),void 0!==b.scale&&e.scale.fromArray(b.scale));void 0!==
 b.visible&&(e.visible=b.visible);void 0!==b.userData&&(e.userData=b.userData);if(void 0!==b.children)for(var h in b.children)e.add(this.parseObject(b.children[h],c,d));return e}}()};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlers={};this.hierarchyHandlers={};this.addGeometryHandler("ascii",THREE.JSONLoader)};
 THREE.SceneLoader.prototype={constructor:THREE.SceneLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader(c.manager);d.setCrossOrigin(this.crossOrigin);d.load(a,function(d){c.parse(JSON.parse(d),b,a)})},setCrossOrigin:function(a){this.crossOrigin=a},addGeometryHandler:function(a,b){this.geometryHandlers[a]={loaderClass:b}},addHierarchyHandler:function(a,b){this.hierarchyHandlers[a]={loaderClass:b}},parse:function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:n+"/"+a}function e(){f(y.scene,
-x.objects)}function f(a,b){var c,e,h,i,k,l,n;for(n in b){var q=y.objects[n],r=b[n];if(void 0===q){if(r.type&&r.type in m.hierarchyHandlers){if(void 0===r.loading){e={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};h={};for(var C in r)C in e||(h[C]=r[C]);s=y.materials[r.material];r.loading=!0;e=m.hierarchyHandlers[r.type].loaderObject;e.options?e.load(d(r.url,x.urlBaseType),g(n,a,s,r)):e.load(d(r.url,x.urlBaseType),g(n,
-a,s,r),h)}}else if(void 0!==r.geometry){if(t=y.geometries[r.geometry]){q=!1;s=y.materials[r.material];q=s instanceof THREE.ShaderMaterial;h=r.position;i=r.rotation;k=r.scale;c=r.matrix;l=r.quaternion;r.material||(s=new THREE.MeshFaceMaterial(y.face_materials[r.geometry]));s instanceof THREE.MeshFaceMaterial&&0===s.materials.length&&(s=new THREE.MeshFaceMaterial(y.face_materials[r.geometry]));if(s instanceof THREE.MeshFaceMaterial)for(e=0;e<s.materials.length;e++)q=q||s.materials[e]instanceof THREE.ShaderMaterial;
-q&&t.computeTangents();r.skin?q=new THREE.SkinnedMesh(t,s):r.morph?(q=new THREE.MorphAnimMesh(t,s),void 0!==r.duration&&(q.duration=r.duration),void 0!==r.time&&(q.time=r.time),void 0!==r.mirroredLoop&&(q.mirroredLoop=r.mirroredLoop),s.morphNormals&&t.computeMorphNormals()):q=new THREE.Mesh(t,s);q.name=n;c?(q.matrixAutoUpdate=!1,q.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(q.position.fromArray(h),l?q.quaternion.fromArray(l):q.rotation.fromArray(i),
-q.scale.fromArray(k));q.visible=r.visible;q.castShadow=r.castShadow;q.receiveShadow=r.receiveShadow;a.add(q);y.objects[n]=q}}else"DirectionalLight"===r.type||"PointLight"===r.type||"AmbientLight"===r.type?(w=void 0!==r.color?r.color:16777215,E=void 0!==r.intensity?r.intensity:1,"DirectionalLight"===r.type?(h=r.direction,u=new THREE.DirectionalLight(w,E),u.position.fromArray(h),r.target&&(O.push({object:u,targetName:r.target}),u.target=null)):"PointLight"===r.type?(h=r.position,e=r.distance,u=new THREE.PointLight(w,
-E,e),u.position.fromArray(h)):"AmbientLight"===r.type&&(u=new THREE.AmbientLight(w)),a.add(u),u.name=n,y.lights[n]=u,y.objects[n]=u):"PerspectiveCamera"===r.type||"OrthographicCamera"===r.type?(h=r.position,i=r.rotation,l=r.quaternion,"PerspectiveCamera"===r.type?p=new THREE.PerspectiveCamera(r.fov,r.aspect,r.near,r.far):"OrthographicCamera"===r.type&&(p=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),p.name=n,p.position.fromArray(h),void 0!==l?p.quaternion.fromArray(l):
-void 0!==i&&p.rotation.fromArray(i),a.add(p),y.cameras[n]=p,y.objects[n]=p):(h=r.position,i=r.rotation,k=r.scale,l=r.quaternion,q=new THREE.Object3D,q.name=n,q.position.fromArray(h),l?q.quaternion.fromArray(l):q.rotation.fromArray(i),q.scale.fromArray(k),q.visible=void 0!==r.visible?r.visible:!1,a.add(q),y.objects[n]=q,y.empties[n]=q);if(q){if(void 0!==r.userData)for(var D in r.userData)q.userData[D]=r.userData[D];if(void 0!==r.groups)for(e=0;e<r.groups.length;e++)h=r.groups[e],void 0===y.groups[h]&&
-(y.groups[h]=[]),y.groups[h].push(n)}}void 0!==q&&void 0!==r.children&&f(q,r.children)}}function h(a){return function(b,c){b.name=a;y.geometries[a]=b;y.face_materials[a]=c;e();C-=1;m.onLoadComplete();k()}}function g(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,h=d.rotation,g=d.quaternion,i=d.scale;f.position.fromArray(d.position);g?f.quaternion.fromArray(g):f.rotation.fromArray(h);f.scale.fromArray(i);c&&f.traverse(function(a){a.material=c});var l=void 0!==d.visible?d.visible:
+x.objects)}function f(a,b){var c,e,h,i,k,l,n;for(n in b){var q=y.objects[n],s=b[n];if(void 0===q){if(s.type&&s.type in m.hierarchyHandlers){if(void 0===s.loading){e={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};h={};for(var C in s)C in e||(h[C]=s[C]);r=y.materials[s.material];s.loading=!0;e=m.hierarchyHandlers[s.type].loaderObject;e.options?e.load(d(s.url,x.urlBaseType),g(n,a,r,s)):e.load(d(s.url,x.urlBaseType),g(n,
+a,r,s),h)}}else if(void 0!==s.geometry){if(t=y.geometries[s.geometry]){q=!1;r=y.materials[s.material];q=r instanceof THREE.ShaderMaterial;h=s.position;i=s.rotation;k=s.scale;c=s.matrix;l=s.quaternion;s.material||(r=new THREE.MeshFaceMaterial(y.face_materials[s.geometry]));r instanceof THREE.MeshFaceMaterial&&0===r.materials.length&&(r=new THREE.MeshFaceMaterial(y.face_materials[s.geometry]));if(r instanceof THREE.MeshFaceMaterial)for(e=0;e<r.materials.length;e++)q=q||r.materials[e]instanceof THREE.ShaderMaterial;
+q&&t.computeTangents();s.skin?q=new THREE.SkinnedMesh(t,r):s.morph?(q=new THREE.MorphAnimMesh(t,r),void 0!==s.duration&&(q.duration=s.duration),void 0!==s.time&&(q.time=s.time),void 0!==s.mirroredLoop&&(q.mirroredLoop=s.mirroredLoop),r.morphNormals&&t.computeMorphNormals()):q=new THREE.Mesh(t,r);q.name=n;c?(q.matrixAutoUpdate=!1,q.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(q.position.fromArray(h),l?q.quaternion.fromArray(l):q.rotation.fromArray(i),
+q.scale.fromArray(k));q.visible=s.visible;q.castShadow=s.castShadow;q.receiveShadow=s.receiveShadow;a.add(q);y.objects[n]=q}}else"DirectionalLight"===s.type||"PointLight"===s.type||"AmbientLight"===s.type?(w=void 0!==s.color?s.color:16777215,E=void 0!==s.intensity?s.intensity:1,"DirectionalLight"===s.type?(h=s.direction,u=new THREE.DirectionalLight(w,E),u.position.fromArray(h),s.target&&(O.push({object:u,targetName:s.target}),u.target=null)):"PointLight"===s.type?(h=s.position,e=s.distance,u=new THREE.PointLight(w,
+E,e),u.position.fromArray(h)):"AmbientLight"===s.type&&(u=new THREE.AmbientLight(w)),a.add(u),u.name=n,y.lights[n]=u,y.objects[n]=u):"PerspectiveCamera"===s.type||"OrthographicCamera"===s.type?(h=s.position,i=s.rotation,l=s.quaternion,"PerspectiveCamera"===s.type?p=new THREE.PerspectiveCamera(s.fov,s.aspect,s.near,s.far):"OrthographicCamera"===s.type&&(p=new THREE.OrthographicCamera(s.left,s.right,s.top,s.bottom,s.near,s.far)),p.name=n,p.position.fromArray(h),void 0!==l?p.quaternion.fromArray(l):
+void 0!==i&&p.rotation.fromArray(i),a.add(p),y.cameras[n]=p,y.objects[n]=p):(h=s.position,i=s.rotation,k=s.scale,l=s.quaternion,q=new THREE.Object3D,q.name=n,q.position.fromArray(h),l?q.quaternion.fromArray(l):q.rotation.fromArray(i),q.scale.fromArray(k),q.visible=void 0!==s.visible?s.visible:!1,a.add(q),y.objects[n]=q,y.empties[n]=q);if(q){if(void 0!==s.userData)for(var D in s.userData)q.userData[D]=s.userData[D];if(void 0!==s.groups)for(e=0;e<s.groups.length;e++)h=s.groups[e],void 0===y.groups[h]&&
+(y.groups[h]=[]),y.groups[h].push(n)}}void 0!==q&&void 0!==s.children&&f(q,s.children)}}function h(a){return function(b,c){b.name=a;y.geometries[a]=b;y.face_materials[a]=c;e();C-=1;m.onLoadComplete();k()}}function g(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,h=d.rotation,g=d.quaternion,i=d.scale;f.position.fromArray(d.position);g?f.quaternion.fromArray(g):f.rotation.fromArray(h);f.scale.fromArray(i);c&&f.traverse(function(a){a.material=c});var l=void 0!==d.visible?d.visible:
 !0;f.traverse(function(a){a.visible=l});b.add(f);f.name=a;y.objects[a]=f;e();C-=1;m.onLoadComplete();k()}}function i(a){return function(b,c){b.name=a;y.geometries[a]=b;y.face_materials[a]=c}}function k(){m.callbackProgress({totalModels:z,totalTextures:D,loadedModels:z-C,loadedTextures:D-F},y);m.onLoadProgress();if(0===C&&0===F){for(var a=0;a<O.length;a++){var c=O[a],d=y.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,y.scene.add(c.object.target));c.object.target.userData.targetInverse=
-c.object}b(y)}}function l(a,b){b(a);if(void 0!==a.children)for(var c in a.children)l(a.children[c],b)}var m=this,n=THREE.Loader.prototype.extractUrlBase(c),t,s,p,q,r,u,w,E,C,F,z,D,y,O=[],x=a,B;for(B in this.geometryHandlers)a=this.geometryHandlers[B].loaderClass,this.geometryHandlers[B].loaderObject=new a;for(B in this.hierarchyHandlers)a=this.hierarchyHandlers[B].loaderClass,this.hierarchyHandlers[B].loaderObject=new a;F=C=0;y={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},
+c.object}b(y)}}function l(a,b){b(a);if(void 0!==a.children)for(var c in a.children)l(a.children[c],b)}var m=this,n=THREE.Loader.prototype.extractUrlBase(c),t,r,p,q,s,u,w,E,C,F,z,D,y,O=[],x=a,B;for(B in this.geometryHandlers)a=this.geometryHandlers[B].loaderClass,this.geometryHandlers[B].loaderObject=new a;for(B in this.hierarchyHandlers)a=this.hierarchyHandlers[B].loaderClass,this.hierarchyHandlers[B].loaderObject=new a;F=C=0;y={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},
 objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(x.transform&&(B=x.transform.position,a=x.transform.rotation,c=x.transform.scale,B&&y.scene.position.fromArray(B),a&&y.scene.rotation.fromArray(a),c&&y.scene.scale.fromArray(c),B||a||c))y.scene.updateMatrix(),y.scene.updateMatrixWorld();B=function(a){return function(){F-=a;k();m.onLoadComplete()}};for(var I in x.fogs)a=x.fogs[I],"linear"===a.type?q=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(q=new THREE.FogExp2(0,a.density)),a=a.color,
 q.color.setRGB(a[0],a[1],a[2]),y.fogs[I]=q;for(var v in x.geometries)q=x.geometries[v],q.type in this.geometryHandlers&&(C+=1,m.onLoadStart());for(var A in x.objects)l(x.objects[A],function(a){a.type&&a.type in m.hierarchyHandlers&&(C+=1,m.onLoadStart())});z=C;for(v in x.geometries)if(q=x.geometries[v],"cube"===q.type)t=new THREE.CubeGeometry(q.width,q.height,q.depth,q.widthSegments,q.heightSegments,q.depthSegments),t.name=v,y.geometries[v]=t;else if("plane"===q.type)t=new THREE.PlaneGeometry(q.width,
 q.height,q.widthSegments,q.heightSegments),t.name=v,y.geometries[v]=t;else if("sphere"===q.type)t=new THREE.SphereGeometry(q.radius,q.widthSegments,q.heightSegments),t.name=v,y.geometries[v]=t;else if("cylinder"===q.type)t=new THREE.CylinderGeometry(q.topRad,q.botRad,q.height,q.radSegs,q.heightSegs),t.name=v,y.geometries[v]=t;else if("torus"===q.type)t=new THREE.TorusGeometry(q.radius,q.tube,q.segmentsR,q.segmentsT),t.name=v,y.geometries[v]=t;else if("icosahedron"===q.type)t=new THREE.IcosahedronGeometry(q.radius,
-q.subdivisions),t.name=v,y.geometries[v]=t;else if(q.type in this.geometryHandlers){A={};for(r in q)"type"!==r&&"url"!==r&&(A[r]=q[r]);this.geometryHandlers[q.type].loaderObject.load(d(q.url,x.urlBaseType),h(v),A)}else"embedded"===q.type&&(A=x.embeds[q.id],A.metadata=x.metadata,A&&(A=this.geometryHandlers.ascii.loaderObject.parse(A,""),i(v)(A.geometry,A.materials)));for(var G in x.textures)if(v=x.textures[G],v.url instanceof Array){F+=v.url.length;for(r=0;r<v.url.length;r++)m.onLoadStart()}else F+=
-1,m.onLoadStart();D=F;for(G in x.textures){v=x.textures[G];void 0!==v.mapping&&void 0!==THREE[v.mapping]&&(v.mapping=new THREE[v.mapping]);if(v.url instanceof Array){A=v.url.length;q=[];for(r=0;r<A;r++)q[r]=d(v.url[r],x.urlBaseType);r=(r=/\.dds$/i.test(q[0]))?THREE.ImageUtils.loadCompressedTextureCube(q,v.mapping,B(A)):THREE.ImageUtils.loadTextureCube(q,v.mapping,B(A))}else r=/\.dds$/i.test(v.url),A=d(v.url,x.urlBaseType),q=B(1),r=r?THREE.ImageUtils.loadCompressedTexture(A,v.mapping,q):THREE.ImageUtils.loadTexture(A,
-v.mapping,q),void 0!==THREE[v.minFilter]&&(r.minFilter=THREE[v.minFilter]),void 0!==THREE[v.magFilter]&&(r.magFilter=THREE[v.magFilter]),v.anisotropy&&(r.anisotropy=v.anisotropy),v.repeat&&(r.repeat.set(v.repeat[0],v.repeat[1]),1!==v.repeat[0]&&(r.wrapS=THREE.RepeatWrapping),1!==v.repeat[1]&&(r.wrapT=THREE.RepeatWrapping)),v.offset&&r.offset.set(v.offset[0],v.offset[1]),v.wrap&&(A={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==A[v.wrap[0]]&&(r.wrapS=A[v.wrap[0]]),void 0!==
-A[v.wrap[1]]&&(r.wrapT=A[v.wrap[1]]));y.textures[G]=r}var R,J;for(R in x.materials){G=x.materials[R];for(J in G.parameters)"envMap"===J||"map"===J||"lightMap"===J||"bumpMap"===J?G.parameters[J]=y.textures[G.parameters[J]]:"shading"===J?G.parameters[J]="flat"===G.parameters[J]?THREE.FlatShading:THREE.SmoothShading:"side"===J?G.parameters[J]="double"==G.parameters[J]?THREE.DoubleSide:"back"==G.parameters[J]?THREE.BackSide:THREE.FrontSide:"blending"===J?G.parameters[J]=G.parameters[J]in THREE?THREE[G.parameters[J]]:
+q.subdivisions),t.name=v,y.geometries[v]=t;else if(q.type in this.geometryHandlers){A={};for(s in q)"type"!==s&&"url"!==s&&(A[s]=q[s]);this.geometryHandlers[q.type].loaderObject.load(d(q.url,x.urlBaseType),h(v),A)}else"embedded"===q.type&&(A=x.embeds[q.id],A.metadata=x.metadata,A&&(A=this.geometryHandlers.ascii.loaderObject.parse(A,""),i(v)(A.geometry,A.materials)));for(var G in x.textures)if(v=x.textures[G],v.url instanceof Array){F+=v.url.length;for(s=0;s<v.url.length;s++)m.onLoadStart()}else F+=
+1,m.onLoadStart();D=F;for(G in x.textures){v=x.textures[G];void 0!==v.mapping&&void 0!==THREE[v.mapping]&&(v.mapping=new THREE[v.mapping]);if(v.url instanceof Array){A=v.url.length;q=[];for(s=0;s<A;s++)q[s]=d(v.url[s],x.urlBaseType);s=(s=/\.dds$/i.test(q[0]))?THREE.ImageUtils.loadCompressedTextureCube(q,v.mapping,B(A)):THREE.ImageUtils.loadTextureCube(q,v.mapping,B(A))}else s=/\.dds$/i.test(v.url),A=d(v.url,x.urlBaseType),q=B(1),s=s?THREE.ImageUtils.loadCompressedTexture(A,v.mapping,q):THREE.ImageUtils.loadTexture(A,
+v.mapping,q),void 0!==THREE[v.minFilter]&&(s.minFilter=THREE[v.minFilter]),void 0!==THREE[v.magFilter]&&(s.magFilter=THREE[v.magFilter]),v.anisotropy&&(s.anisotropy=v.anisotropy),v.repeat&&(s.repeat.set(v.repeat[0],v.repeat[1]),1!==v.repeat[0]&&(s.wrapS=THREE.RepeatWrapping),1!==v.repeat[1]&&(s.wrapT=THREE.RepeatWrapping)),v.offset&&s.offset.set(v.offset[0],v.offset[1]),v.wrap&&(A={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==A[v.wrap[0]]&&(s.wrapS=A[v.wrap[0]]),void 0!==
+A[v.wrap[1]]&&(s.wrapT=A[v.wrap[1]]));y.textures[G]=s}var R,J;for(R in x.materials){G=x.materials[R];for(J in G.parameters)"envMap"===J||"map"===J||"lightMap"===J||"bumpMap"===J?G.parameters[J]=y.textures[G.parameters[J]]:"shading"===J?G.parameters[J]="flat"===G.parameters[J]?THREE.FlatShading:THREE.SmoothShading:"side"===J?G.parameters[J]="double"==G.parameters[J]?THREE.DoubleSide:"back"==G.parameters[J]?THREE.BackSide:THREE.FrontSide:"blending"===J?G.parameters[J]=G.parameters[J]in THREE?THREE[G.parameters[J]]:
 THREE.NormalBlending:"combine"===J?G.parameters[J]=G.parameters[J]in THREE?THREE[G.parameters[J]]:THREE.MultiplyOperation:"vertexColors"===J?"face"==G.parameters[J]?G.parameters[J]=THREE.FaceColors:G.parameters[J]&&(G.parameters[J]=THREE.VertexColors):"wrapRGB"===J&&(B=G.parameters[J],G.parameters[J]=new THREE.Vector3(B[0],B[1],B[2]));void 0!==G.parameters.opacity&&1>G.parameters.opacity&&(G.parameters.transparent=!0);G.parameters.normalMap?(B=THREE.ShaderLib.normalmap,v=THREE.UniformsUtils.clone(B.uniforms),
-r=G.parameters.color,A=G.parameters.specular,q=G.parameters.ambient,I=G.parameters.shininess,v.tNormal.value=y.textures[G.parameters.normalMap],G.parameters.normalScale&&v.uNormalScale.value.set(G.parameters.normalScale[0],G.parameters.normalScale[1]),G.parameters.map&&(v.tDiffuse.value=G.parameters.map,v.enableDiffuse.value=!0),G.parameters.envMap&&(v.tCube.value=G.parameters.envMap,v.enableReflection.value=!0,v.uReflectivity.value=G.parameters.reflectivity),G.parameters.lightMap&&(v.tAO.value=G.parameters.lightMap,
-v.enableAO.value=!0),G.parameters.specularMap&&(v.tSpecular.value=y.textures[G.parameters.specularMap],v.enableSpecular.value=!0),G.parameters.displacementMap&&(v.tDisplacement.value=y.textures[G.parameters.displacementMap],v.enableDisplacement.value=!0,v.uDisplacementBias.value=G.parameters.displacementBias,v.uDisplacementScale.value=G.parameters.displacementScale),v.uDiffuseColor.value.setHex(r),v.uSpecularColor.value.setHex(A),v.uAmbientColor.value.setHex(q),v.uShininess.value=I,G.parameters.opacity&&
-(v.uOpacity.value=G.parameters.opacity),s=new THREE.ShaderMaterial({fragmentShader:B.fragmentShader,vertexShader:B.vertexShader,uniforms:v,lights:!0,fog:!0})):s=new THREE[G.type](G.parameters);s.name=R;y.materials[R]=s}for(R in x.materials)if(G=x.materials[R],G.parameters.materials){J=[];for(r=0;r<G.parameters.materials.length;r++)J.push(y.materials[G.parameters.materials[r]]);y.materials[R].materials=J}e();y.cameras&&x.defaults.camera&&(y.currentCamera=y.cameras[x.defaults.camera]);y.fogs&&x.defaults.fog&&
+s=G.parameters.color,A=G.parameters.specular,q=G.parameters.ambient,I=G.parameters.shininess,v.tNormal.value=y.textures[G.parameters.normalMap],G.parameters.normalScale&&v.uNormalScale.value.set(G.parameters.normalScale[0],G.parameters.normalScale[1]),G.parameters.map&&(v.tDiffuse.value=G.parameters.map,v.enableDiffuse.value=!0),G.parameters.envMap&&(v.tCube.value=G.parameters.envMap,v.enableReflection.value=!0,v.uReflectivity.value=G.parameters.reflectivity),G.parameters.lightMap&&(v.tAO.value=G.parameters.lightMap,
+v.enableAO.value=!0),G.parameters.specularMap&&(v.tSpecular.value=y.textures[G.parameters.specularMap],v.enableSpecular.value=!0),G.parameters.displacementMap&&(v.tDisplacement.value=y.textures[G.parameters.displacementMap],v.enableDisplacement.value=!0,v.uDisplacementBias.value=G.parameters.displacementBias,v.uDisplacementScale.value=G.parameters.displacementScale),v.uDiffuseColor.value.setHex(s),v.uSpecularColor.value.setHex(A),v.uAmbientColor.value.setHex(q),v.uShininess.value=I,G.parameters.opacity&&
+(v.uOpacity.value=G.parameters.opacity),r=new THREE.ShaderMaterial({fragmentShader:B.fragmentShader,vertexShader:B.vertexShader,uniforms:v,lights:!0,fog:!0})):r=new THREE[G.type](G.parameters);r.name=R;y.materials[R]=r}for(R in x.materials)if(G=x.materials[R],G.parameters.materials){J=[];for(s=0;s<G.parameters.materials.length;s++)J.push(y.materials[G.parameters.materials[s]]);y.materials[R].materials=J}e();y.cameras&&x.defaults.camera&&(y.currentCamera=y.cameras[x.defaults.camera]);y.fogs&&x.defaults.fog&&
 (y.scene.fog=y.fogs[x.defaults.fog]);m.callbackSync(y);k()}};THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b){var c=new THREE.ImageLoader(this.manager);c.setCrossOrigin(this.crossOrigin);c.load(a,function(a){a=new THREE.Texture(a);a.needsUpdate=!0;void 0!==b&&b(a)})},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.Material=function(){this.id=THREE.MaterialIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.needsUpdate=this.visible=!0};
 THREE.Material.prototype={constructor:THREE.Material,setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]="overdraw"==b?Number(c):c}}},clone:function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;
 a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;a.visible=this.visible;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Material.prototype);
@@ -288,23 +288,23 @@ THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.ma
 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.Scene.prototype.clone=function(a){void 0===a&&(a=new THREE.Scene);THREE.Object3D.prototype.clone.call(this,a);null!==this.fog&&(a.fog=this.fog.clone());null!==this.overrideMaterial&&(a.overrideMaterial=this.overrideMaterial.clone());a.autoUpdate=this.autoUpdate;a.matrixAutoUpdate=this.matrixAutoUpdate;return a};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,b,c){for(var d=0,e=E.length;d<e;d++){var f=E[d];Pa.copy(f.color);if(f instanceof THREE.DirectionalLight){var h=wa.getPositionFromMatrix(f.matrixWorld).normalize(),g=b.dot(h);0>=g||(g*=f.intensity,c.add(Pa.multiplyScalar(g)))}else f instanceof THREE.PointLight&&(h=wa.getPositionFromMatrix(f.matrixWorld),g=b.dot(wa.subVectors(h,a).normalize()),0>=g||(g*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=g&&(g*=f.intensity,c.add(Pa.multiplyScalar(g)))))}}
-function c(a,b,c,d){l(b);m(c);n(d);t(a.getStyle());x.stroke();ta.expandByScalar(2*b)}function d(a){s(a.getStyle());x.fill()}function e(a,b,c,e,f,h,g,j,i,k,m,l,n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0==n.image.width)){if(!0===n.needsUpdate){var p=n.wrapS==THREE.RepeatWrapping,q=n.wrapT==THREE.RepeatWrapping;Ja[n.id]=x.createPattern(n.image,!0===p&&!0===q?"repeat":!0===p&&!1===q?"repeat-x":!1===p&&!0===q?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===Ja[n.id]?s("rgba(0,0,0,1)"):
-s(Ja[n.id]);var p=n.offset.x/n.repeat.x,q=n.offset.y/n.repeat.y,t=n.image.width*n.repeat.x,r=n.image.height*n.repeat.y,g=(g+p)*t,j=(1-j+q)*r,c=c-a,e=e-b,f=f-a,h=h-b,i=(i+p)*t-g,k=(1-k+q)*r-j,m=(m+p)*t-g,l=(1-l+q)*r-j,p=i*l-m*k;0===p?(void 0===ga[n.id]&&(b=document.createElement("canvas"),b.width=n.image.width,b.height=n.image.height,b=b.getContext("2d"),b.drawImage(n.image,0,0),ga[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data),b=ga[n.id],g=4*(Math.floor(g)+Math.floor(j)*n.image.width),
+function c(a,b,c,d){l(b);m(c);n(d);t(a.getStyle());x.stroke();ta.expandByScalar(2*b)}function d(a){r(a.getStyle());x.fill()}function e(a,b,c,e,f,h,g,j,i,k,m,l,n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0==n.image.width)){if(!0===n.needsUpdate){var p=n.wrapS==THREE.RepeatWrapping,q=n.wrapT==THREE.RepeatWrapping;Ja[n.id]=x.createPattern(n.image,!0===p&&!0===q?"repeat":!0===p&&!1===q?"repeat-x":!1===p&&!0===q?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===Ja[n.id]?r("rgba(0,0,0,1)"):
+r(Ja[n.id]);var p=n.offset.x/n.repeat.x,q=n.offset.y/n.repeat.y,t=n.image.width*n.repeat.x,s=n.image.height*n.repeat.y,g=(g+p)*t,j=(1-j+q)*s,c=c-a,e=e-b,f=f-a,h=h-b,i=(i+p)*t-g,k=(1-k+q)*s-j,m=(m+p)*t-g,l=(1-l+q)*s-j,p=i*l-m*k;0===p?(void 0===ga[n.id]&&(b=document.createElement("canvas"),b.width=n.image.width,b.height=n.image.height,b=b.getContext("2d"),b.drawImage(n.image,0,0),ga[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data),b=ga[n.id],g=4*(Math.floor(g)+Math.floor(j)*n.image.width),
 V.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),d(V)):(p=1/p,n=(l*c-k*f)*p,k=(l*e-k*h)*p,c=(i*f-m*c)*p,e=(i*h-m*e)*p,a=a-n*g-c*j,g=b-k*g-e*j,x.save(),x.transform(n,k,c,e,a,g),x.fill(),x.restore())}}function f(a,b,c,d,e,f,h,g,j,i,k,m,l){var n,p;n=l.width-1;p=l.height-1;h*=n;g*=p;c-=a;d-=b;e-=a;f-=b;j=j*n-h;i=i*p-g;k=k*n-h;m=m*p-g;p=1/(j*m-k*i);n=(m*c-i*e)*p;i=(m*d-i*f)*p;c=(j*e-k*c)*p;d=(j*f-k*d)*p;a=a-n*h-c*g;b=b-i*h-d*g;x.save();x.transform(n,i,c,d,a,b);x.clip();x.drawImage(l,0,0);x.restore()}function h(a,
 b,c,d){xa[0]=255*a.r|0;xa[1]=255*a.g|0;xa[2]=255*a.b|0;xa[4]=255*b.r|0;xa[5]=255*b.g|0;xa[6]=255*b.b|0;xa[8]=255*c.r|0;xa[9]=255*c.g|0;xa[10]=255*c.b|0;xa[12]=255*d.r|0;xa[13]=255*d.g|0;xa[14]=255*d.b|0;j.putImageData(Wa,0,0);Ia.drawImage(Ra,0,0);return ya}function g(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=d*d+e*e;0!==f&&(c/=Math.sqrt(f),d*=c,e*=c,b.x+=d,b.y+=e,a.x-=d,a.y-=e)}function i(a){v!==a&&(v=x.globalAlpha=a)}function k(a){A!==a&&(a===THREE.NormalBlending?x.globalCompositeOperation="source-over":
-a===THREE.AdditiveBlending?x.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(x.globalCompositeOperation="darker"),A=a)}function l(a){J!==a&&(J=x.lineWidth=a)}function m(a){ba!==a&&(ba=x.lineCap=a)}function n(a){qa!==a&&(qa=x.lineJoin=a)}function t(a){G!==a&&(G=x.strokeStyle=a)}function s(a){R!==a&&(R=x.fillStyle=a)}function p(a,b){if(ra!==a||N!==b)x.setLineDash([a,b]),ra=a,N=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var q=THREE.Math.smoothstep,a=a||{},r=this,u,w,E,C=
+a===THREE.AdditiveBlending?x.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(x.globalCompositeOperation="darker"),A=a)}function l(a){J!==a&&(J=x.lineWidth=a)}function m(a){ba!==a&&(ba=x.lineCap=a)}function n(a){qa!==a&&(qa=x.lineJoin=a)}function t(a){G!==a&&(G=x.strokeStyle=a)}function r(a){R!==a&&(R=x.fillStyle=a)}function p(a,b){if(ra!==a||N!==b)x.setLineDash([a,b]),ra=a,N=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var q=THREE.Math.smoothstep,a=a||{},s=this,u,w,E,C=
 new THREE.Projector,F=void 0!==a.canvas?a.canvas:document.createElement("canvas"),z,D,y,O,x=F.getContext("2d"),B=new THREE.Color(0),I=0,v=1,A=0,G=null,R=null,J=null,ba=null,qa=null,ra=null,N=0,M,Q,K,da;new THREE.RenderableVertex;new THREE.RenderableVertex;var za,Fa,ea,Ea,Z,fa,V=new THREE.Color,aa=new THREE.Color,P=new THREE.Color,T=new THREE.Color,ma=new THREE.Color,va=new THREE.Color,ja=new THREE.Color,Pa=new THREE.Color,Ja={},ga={},Ha,Xa,Sa,Aa,hb,ib,tb,ub,vb,jb,Ka=new THREE.Box2,na=new THREE.Box2,
 ta=new THREE.Box2,kb=new THREE.Color,ua=new THREE.Color,ha=new THREE.Color,wa=new THREE.Vector3,Ra,j,Wa,xa,ya,Ia,Ta=16;Ra=document.createElement("canvas");Ra.width=Ra.height=2;j=Ra.getContext("2d");j.fillStyle="rgba(0,0,0,1)";j.fillRect(0,0,2,2);Wa=j.getImageData(0,0,2,2);xa=Wa.data;ya=document.createElement("canvas");ya.width=ya.height=Ta;Ia=ya.getContext("2d");Ia.translate(-Ta/2,-Ta/2);Ia.scale(Ta,Ta);Ta--;void 0===x.setLineDash&&(x.setLineDash=void 0!==x.mozDash?function(a){x.mozDash=null!==a[0]?
 a:null}:function(){});this.domElement=F;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b,c){z=a*this.devicePixelRatio;D=b*this.devicePixelRatio;y=Math.floor(z/2);O=Math.floor(D/2);F.width=z;F.height=D;1!==this.devicePixelRatio&&!1!==
 c&&(F.style.width=a+"px",F.style.height=b+"px");Ka.set(new THREE.Vector2(-y,-O),new THREE.Vector2(y,O));na.set(new THREE.Vector2(-y,-O),new THREE.Vector2(y,O));v=1;A=0;qa=ba=J=R=G=null};this.setClearColor=function(a,b){B.set(a);I=void 0!==b?b:1;na.set(new THREE.Vector2(-y,-O),new THREE.Vector2(y,O))};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getMaxAnisotropy=function(){return 0};
-this.clear=function(){x.setTransform(1,0,0,-1,y,O);!1===na.empty()&&(na.intersect(Ka),na.expandByScalar(2),1>I&&x.clearRect(na.min.x|0,na.min.y|0,na.max.x-na.min.x|0,na.max.y-na.min.y|0),0<I&&(k(THREE.NormalBlending),i(1),s("rgba("+Math.floor(255*B.r)+","+Math.floor(255*B.g)+","+Math.floor(255*B.b)+","+I+")"),x.fillRect(na.min.x|0,na.min.y|0,na.max.x-na.min.x|0,na.max.y-na.min.y|0)),na.makeEmpty())};this.render=function(a,j){if(!1===j instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
-else{!0===this.autoClear&&this.clear();x.setTransform(1,0,0,-1,y,O);r.info.render.vertices=0;r.info.render.faces=0;u=C.projectScene(a,j,this.sortObjects,this.sortElements);w=u.elements;E=u.lights;M=j;kb.setRGB(0,0,0);ua.setRGB(0,0,0);ha.setRGB(0,0,0);for(var D=0,G=E.length;D<G;D++){var z=E[D],F=z.color;z instanceof THREE.AmbientLight?kb.add(F):z instanceof THREE.DirectionalLight?ua.add(F):z instanceof THREE.PointLight&&ha.add(F)}D=0;for(G=w.length;D<G;D++){var v=w[D],A=v.material;if(!(void 0===A||
-!1===A.visible)){ta.makeEmpty();if(v instanceof THREE.RenderableParticle){Q=v;Q.x*=y;Q.y*=O;var z=Q,F=v,J=A;i(J.opacity);k(J.blending);var N=A=v=void 0,B=void 0,I=void 0,R=void 0,ba=void 0;J instanceof THREE.ParticleBasicMaterial?null===J.map?(N=F.object.scale.x,B=F.object.scale.y,N*=F.scale.x*y,B*=F.scale.y*O,ta.min.set(z.x-N,z.y-B),ta.max.set(z.x+N,z.y+B),!1===Ka.isIntersectionBox(ta)?ta.makeEmpty():(s(J.color.getStyle()),x.save(),x.translate(z.x,z.y),x.rotate(-F.rotation),x.scale(N,B),x.fillRect(-1,
+this.clear=function(){x.setTransform(1,0,0,-1,y,O);!1===na.empty()&&(na.intersect(Ka),na.expandByScalar(2),1>I&&x.clearRect(na.min.x|0,na.min.y|0,na.max.x-na.min.x|0,na.max.y-na.min.y|0),0<I&&(k(THREE.NormalBlending),i(1),r("rgba("+Math.floor(255*B.r)+","+Math.floor(255*B.g)+","+Math.floor(255*B.b)+","+I+")"),x.fillRect(na.min.x|0,na.min.y|0,na.max.x-na.min.x|0,na.max.y-na.min.y|0)),na.makeEmpty())};this.render=function(a,j){if(!1===j instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
+else{!0===this.autoClear&&this.clear();x.setTransform(1,0,0,-1,y,O);s.info.render.vertices=0;s.info.render.faces=0;u=C.projectScene(a,j,this.sortObjects,this.sortElements);w=u.elements;E=u.lights;M=j;kb.setRGB(0,0,0);ua.setRGB(0,0,0);ha.setRGB(0,0,0);for(var D=0,G=E.length;D<G;D++){var z=E[D],F=z.color;z instanceof THREE.AmbientLight?kb.add(F):z instanceof THREE.DirectionalLight?ua.add(F):z instanceof THREE.PointLight&&ha.add(F)}D=0;for(G=w.length;D<G;D++){var v=w[D],A=v.material;if(!(void 0===A||
+!1===A.visible)){ta.makeEmpty();if(v instanceof THREE.RenderableParticle){Q=v;Q.x*=y;Q.y*=O;var z=Q,F=v,J=A;i(J.opacity);k(J.blending);var N=A=v=void 0,B=void 0,I=void 0,R=void 0,ba=void 0;J instanceof THREE.ParticleBasicMaterial?null===J.map?(N=F.object.scale.x,B=F.object.scale.y,N*=F.scale.x*y,B*=F.scale.y*O,ta.min.set(z.x-N,z.y-B),ta.max.set(z.x+N,z.y+B),!1===Ka.isIntersectionBox(ta)?ta.makeEmpty():(r(J.color.getStyle()),x.save(),x.translate(z.x,z.y),x.rotate(-F.rotation),x.scale(N,B),x.fillRect(-1,
 -1,2,2),x.restore())):(I=J.map.image,R=I.width>>1,ba=I.height>>1,N=F.scale.x*y,B=F.scale.y*O,v=N*R,A=B*ba,ta.min.set(z.x-v,z.y-A),ta.max.set(z.x+v,z.y+A),!1===Ka.isIntersectionBox(ta)?ta.makeEmpty():(x.save(),x.translate(z.x,z.y),x.rotate(-F.rotation),x.scale(N,-B),x.translate(-R,-ba),x.drawImage(I,0,0),x.restore())):J instanceof THREE.ParticleCanvasMaterial&&(v=F.scale.x*y,A=F.scale.y*O,ta.min.set(z.x-v,z.y-A),ta.max.set(z.x+v,z.y+A),!1===Ka.isIntersectionBox(ta)?ta.makeEmpty():(t(J.color.getStyle()),
-s(J.color.getStyle()),x.save(),x.translate(z.x,z.y),x.rotate(-F.rotation),x.scale(v,A),J.program(x),x.restore()))}else if(v instanceof THREE.RenderableLine){if(Q=v.v1,K=v.v2,Q.positionScreen.x*=y,Q.positionScreen.y*=O,K.positionScreen.x*=y,K.positionScreen.y*=O,ta.setFromPoints([Q.positionScreen,K.positionScreen]),!0===Ka.isIntersectionBox(ta))if(z=Q,F=K,J=v,v=A,i(v.opacity),k(v.blending),x.beginPath(),x.moveTo(z.positionScreen.x,z.positionScreen.y),x.lineTo(F.positionScreen.x,F.positionScreen.y),
+r(J.color.getStyle()),x.save(),x.translate(z.x,z.y),x.rotate(-F.rotation),x.scale(v,A),J.program(x),x.restore()))}else if(v instanceof THREE.RenderableLine){if(Q=v.v1,K=v.v2,Q.positionScreen.x*=y,Q.positionScreen.y*=O,K.positionScreen.x*=y,K.positionScreen.y*=O,ta.setFromPoints([Q.positionScreen,K.positionScreen]),!0===Ka.isIntersectionBox(ta))if(z=Q,F=K,J=v,v=A,i(v.opacity),k(v.blending),x.beginPath(),x.moveTo(z.positionScreen.x,z.positionScreen.y),x.lineTo(F.positionScreen.x,F.positionScreen.y),
 v instanceof THREE.LineBasicMaterial){l(v.linewidth);m(v.linecap);n(v.linejoin);if(v.vertexColors!==THREE.VertexColors)t(v.color.getStyle());else if(A=J.vertexColors[0].getStyle(),J=J.vertexColors[1].getStyle(),A===J)t(A);else{try{var ga=x.createLinearGradient(z.positionScreen.x,z.positionScreen.y,F.positionScreen.x,F.positionScreen.y);ga.addColorStop(0,A);ga.addColorStop(1,J)}catch(qa){ga=A}t(ga)}x.stroke();ta.expandByScalar(2*v.linewidth)}else v instanceof THREE.LineDashedMaterial&&(l(v.linewidth),
 m(v.linecap),n(v.linejoin),t(v.color.getStyle()),p(v.dashSize,v.gapSize),x.stroke(),ta.expandByScalar(2*v.linewidth),p(null,null))}else if(v instanceof THREE.RenderableFace3){Q=v.v1;K=v.v2;da=v.v3;if(-1>Q.positionScreen.z||1<Q.positionScreen.z)continue;if(-1>K.positionScreen.z||1<K.positionScreen.z)continue;if(-1>da.positionScreen.z||1<da.positionScreen.z)continue;Q.positionScreen.x*=y;Q.positionScreen.y*=O;K.positionScreen.x*=y;K.positionScreen.y*=O;da.positionScreen.x*=y;da.positionScreen.y*=O;
-0<A.overdraw&&(g(Q.positionScreen,K.positionScreen,A.overdraw),g(K.positionScreen,da.positionScreen,A.overdraw),g(da.positionScreen,Q.positionScreen,A.overdraw));ta.setFromPoints([Q.positionScreen,K.positionScreen,da.positionScreen]);if(!0===Ka.isIntersectionBox(ta)){z=Q;F=K;J=da;r.info.render.vertices+=3;r.info.render.faces++;i(A.opacity);k(A.blending);za=z.positionScreen.x;Fa=z.positionScreen.y;ea=F.positionScreen.x;Ea=F.positionScreen.y;Z=J.positionScreen.x;fa=J.positionScreen.y;var N=za,B=Fa,
+0<A.overdraw&&(g(Q.positionScreen,K.positionScreen,A.overdraw),g(K.positionScreen,da.positionScreen,A.overdraw),g(da.positionScreen,Q.positionScreen,A.overdraw));ta.setFromPoints([Q.positionScreen,K.positionScreen,da.positionScreen]);if(!0===Ka.isIntersectionBox(ta)){z=Q;F=K;J=da;s.info.render.vertices+=3;s.info.render.faces++;i(A.opacity);k(A.blending);za=z.positionScreen.x;Fa=z.positionScreen.y;ea=F.positionScreen.x;Ea=F.positionScreen.y;Z=J.positionScreen.x;fa=J.positionScreen.y;var N=za,B=Fa,
 I=ea,R=Ea,ba=Z,ra=fa;x.beginPath();x.moveTo(N,B);x.lineTo(I,R);x.lineTo(ba,ra);x.closePath();(A instanceof THREE.MeshLambertMaterial||A instanceof THREE.MeshPhongMaterial)&&null===A.map?(va.copy(A.color),ja.copy(A.emissive),A.vertexColors===THREE.FaceColors&&va.multiply(v.color),!1===A.wireframe&&A.shading==THREE.SmoothShading&&3==v.vertexNormalsLength?(aa.copy(kb),P.copy(kb),T.copy(kb),b(v.v1.positionWorld,v.vertexNormalsModel[0],aa),b(v.v2.positionWorld,v.vertexNormalsModel[1],P),b(v.v3.positionWorld,
 v.vertexNormalsModel[2],T),aa.multiply(va).add(ja),P.multiply(va).add(ja),T.multiply(va).add(ja),ma.addColors(P,T).multiplyScalar(0.5),Sa=h(aa,P,T,ma),f(za,Fa,ea,Ea,Z,fa,0,0,1,0,0,1,Sa)):(V.copy(kb),b(v.centroidModel,v.normalModel,V),V.multiply(va).add(ja),!0===A.wireframe?c(V,A.wireframeLinewidth,A.wireframeLinecap,A.wireframeLinejoin):d(V))):A instanceof THREE.MeshBasicMaterial||A instanceof THREE.MeshLambertMaterial||A instanceof THREE.MeshPhongMaterial?null!==A.map?A.map.mapping instanceof THREE.UVMapping&&
 (Aa=v.uvs[0],e(za,Fa,ea,Ea,Z,fa,Aa[0].x,Aa[0].y,Aa[1].x,Aa[1].y,Aa[2].x,Aa[2].y,A.map)):null!==A.envMap?A.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(wa.copy(v.vertexNormalsModelView[0]),hb=0.5*wa.x+0.5,ib=0.5*wa.y+0.5,wa.copy(v.vertexNormalsModelView[1]),tb=0.5*wa.x+0.5,ub=0.5*wa.y+0.5,wa.copy(v.vertexNormalsModelView[2]),vb=0.5*wa.x+0.5,jb=0.5*wa.y+0.5,e(za,Fa,ea,Ea,Z,fa,hb,ib,tb,ub,vb,jb,A.envMap)):(V.copy(A.color),A.vertexColors===THREE.FaceColors&&V.multiply(v.color),!0===A.wireframe?
@@ -361,133 +361,133 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,
 THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,"#ifdef USE_SKINNING\nvNormal = normalize( normalMatrix * skinnedNormal.xyz );\nvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );\nvTangent = normalize( normalMatrix * skinnedTangent.xyz );\n#else\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\n#endif\nvBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );\nvUv = uv * uRepeat + uOffset;\nvec3 displacedPosition;\n#ifdef VERTEX_TEXTURES\nif ( enableDisplacement ) {\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\ndisplacedPosition = position + normalize( normal ) * df;\n} else {\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned  = boneMatX * skinVertex * skinWeight.x;\nskinned \t  += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition  = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n}\n#else\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned  = boneMatX * skinVertex * skinWeight.x;\nskinned \t  += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition  = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n#endif\nvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );\nvec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\nvWorldPosition = worldPosition.xyz;\nvViewPosition = -mvPosition.xyz;\n#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif\n}"].join("\n")},
 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}"},
 depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var h=1;"v2"===f.type?h=2:"v3"===f.type?h=3:"v4"===f.type?h=4:"c"===f.type&&(h=3);f.size=h;f.array=new Float32Array(c*h);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
-function c(a,b){var c=b.geometry,h=a.faces3,g=3*h.length,i=1*h.length,k=3*h.length,h=d(b,a),m=f(h),l=e(h),n=h.vertexColors?h.vertexColors:!1;a.__vertexArray=new Float32Array(3*g);l&&(a.__normalArray=new Float32Array(3*g));c.hasTangents&&(a.__tangentArray=new Float32Array(4*g));n&&(a.__colorArray=new Float32Array(3*g));if(m){if(0<c.faceUvs.length||0<c.faceVertexUvs.length)a.__uvArray=new Float32Array(2*g);if(1<c.faceUvs.length||1<c.faceVertexUvs.length)a.__uv2Array=new Float32Array(2*g)}b.geometry.skinWeights.length&&
-b.geometry.skinIndices.length&&(a.__skinIndexArray=new Float32Array(4*g),a.__skinWeightArray=new Float32Array(4*g));a.__faceArray=new Uint16Array(3*i);a.__lineArray=new Uint16Array(2*k);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(m=a.numMorphTargets;c<m;c++)a.__morphTargetsArrays.push(new Float32Array(3*g))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(m=a.numMorphNormals;c<m;c++)a.__morphNormalsArrays.push(new Float32Array(3*g))}a.__webglFaceCount=3*i;a.__webglLineCount=2*k;
-if(h.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var p in h.attributes){var i=h.attributes[p],k={},q;for(q in i)k[q]=i[q];if(!k.__webglInitialized||k.createUniqueBuffers)k.__webglInitialized=!0,c=1,"v2"===k.type?c=2:"v3"===k.type?c=3:"v4"===k.type?c=4:"c"===k.type&&(c=3),k.size=c,k.array=new Float32Array(g*c),k.buffer=j.createBuffer(),k.buffer.belongsToAttribute=p,i.needsUpdate=!0,k.__original=i;a.__webglCustomAttributesList.push(k)}}a.__inittedArrays=
-!0}function d(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function e(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function h(a){Ka[a]||(j.enableVertexAttribArray(a),Ka[a]=!0)}
-function g(){for(var a in Ka)Ka[a]&&(j.disableVertexAttribArray(a),Ka[a]=!1)}function i(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function k(a,b){return b[0]-a[0]}function l(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)fa=Fa=null,Ea=Z=T=P=ga=Ja=ma=-1,wa=!0,a[d].render(b,c,vb,jb),fa=Fa=null,Ea=Z=T=P=ga=Ja=ma=-1,wa=!0}function m(a,b,c,d,e,f,h,g){var j,i,k,m;b?(i=a.length-1,m=b=-1):(i=0,b=a.length,m=1);for(var l=i;l!==b;l+=m)if(j=a[l],j.render){i=j.object;k=j.buffer;if(g)j=g;else{j=j[c];if(!j)continue;
-h&&K.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);K.setDepthTest(j.depthTest);K.setDepthWrite(j.depthWrite);y(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}K.setMaterialFaces(j);k instanceof THREE.BufferGeometry?K.renderBufferDirect(d,e,f,j,k,i):K.renderBuffer(d,e,f,j,k,i)}}function n(a,b,c,d,e,f,h){for(var g,j,i=0,k=a.length;i<k;i++)if(g=a[i],j=g.object,j.visible){if(h)g=h;else{g=g[b];if(!g)continue;f&&K.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);
-K.setDepthTest(g.depthTest);K.setDepthWrite(g.depthWrite);y(g.polygonOffset,g.polygonOffsetFactor,g.polygonOffsetUnits)}K.renderImmediateObject(c,d,e,g,j)}}function t(a,d){var e,f,h,g;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",Jb)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var i,k;for(i in f.attributes)k=
-"index"===i?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,g=f.attributes[i],void 0===g.numItems&&(g.numItems=g.array.length),g.buffer=j.createBuffer(),j.bindBuffer(k,g.buffer),j.bufferData(k,g.array,j.STATIC_DRAW)}else if(a instanceof THREE.Mesh){h=a.material;if(void 0===f.geometryGroups){i=f;var m,l,n;k={};var p=i.morphTargets.length,q=i.morphNormals.length,t=h instanceof THREE.MeshFaceMaterial;i.geometryGroups={};h=0;for(m=i.faces.length;h<m;h++)l=i.faces[h],l=t?l.materialIndex:0,void 0===k[l]&&(k[l]={hash:l,
-counter:0}),n=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[n]&&(i.geometryGroups[n]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:p,numMorphNormals:q}),65535<i.geometryGroups[n].vertices+3&&(k[l].counter+=1,n=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[n]&&(i.geometryGroups[n]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:p,numMorphNormals:q})),i.geometryGroups[n].faces3.push(h),i.geometryGroups[n].vertices+=3;i.geometryGroupsList=[];for(g in i.geometryGroups)i.geometryGroups[g].id=
-V++,i.geometryGroupsList.push(i.geometryGroups[g])}for(e in f.geometryGroups)if(g=f.geometryGroups[e],!g.__webglVertexBuffer){i=g;i.__webglVertexBuffer=j.createBuffer();i.__webglNormalBuffer=j.createBuffer();i.__webglTangentBuffer=j.createBuffer();i.__webglColorBuffer=j.createBuffer();i.__webglUVBuffer=j.createBuffer();i.__webglUV2Buffer=j.createBuffer();i.__webglSkinIndicesBuffer=j.createBuffer();i.__webglSkinWeightsBuffer=j.createBuffer();i.__webglFaceBuffer=j.createBuffer();i.__webglLineBuffer=
-j.createBuffer();p=k=void 0;if(i.numMorphTargets){i.__webglMorphTargetsBuffers=[];k=0;for(p=i.numMorphTargets;k<p;k++)i.__webglMorphTargetsBuffers.push(j.createBuffer())}if(i.numMorphNormals){i.__webglMorphNormalsBuffers=[];k=0;for(p=i.numMorphNormals;k<p;k++)i.__webglMorphNormalsBuffers.push(j.createBuffer())}K.info.memory.geometries++;c(g,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=
-!0}}else a instanceof THREE.Ribbon?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),g.__webglNormalBuffer=j.createBuffer(),K.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__normalArray=new Float32Array(3*i),g.__webglVertexCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.normalsNeedUpdate=!0):a instanceof THREE.Line?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=
-j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),g.__webglLineDistanceBuffer=j.createBuffer(),K.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__lineDistanceArray=new Float32Array(1*i),g.__webglLineCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),
-K.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__sortArray=[],g.__webglParticleCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)s(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=f.geometryGroups[e],s(d.__webglObjects,g,a)}else a instanceof THREE.Ribbon||a instanceof
-THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,s(d.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?d.__webglObjectsImmediate.push({id:null,object:a,opaque:null,transparent:null,z:0}):a instanceof THREE.Sprite?d.__webglSprites.push(a):a instanceof THREE.LensFlare&&d.__webglFlares.push(a);a.__webglActive=!0}}function s(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function p(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 r(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Ribbon||a instanceof THREE.Line?u(b.__webglObjects,a):a instanceof THREE.Sprite?w(b.__webglSprites,a):a instanceof THREE.LensFlare?w(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&u(b.__webglObjectsImmediate,a);delete a.__webglActive}function u(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 E(a,b,c,d,e){aa=0;d.needsUpdate&&(d.program&&Ob(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!==Fa&&(j.useProgram(g),Fa=g,f=!0);d.id!==Ea&&(Ea=d.id,f=!0);if(f||a!==fa)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==
-fa&&(fa=a);if(d.skinning)if(Eb&&e.useVertexTexture){if(null!==h.boneTexture){var k=C();j.uniform1i(h.boneTexture,k);K.setTexture(e.boneTexture,k)}}else null!==h.boneGlobalMatrices&&j.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(wa){for(var m,
-l=k=0,n=0,p,q,t,r=Ra,s=r.directional.colors,u=r.directional.positions,w=r.point.colors,v=r.point.positions,y=r.point.distances,E=r.spot.colors,x=r.spot.positions,D=r.spot.distances,J=r.spot.directions,N=r.spot.anglesCos,O=r.spot.exponents,I=r.hemi.skyColors,V=r.hemi.groundColors,R=r.hemi.positions,M=0,T=0,ea=0,za=0,P=0,wc=0,X=0,W=0,Q=m=0,c=t=Q=0,f=b.length;c<f;c++)m=b[c],m.onlyShadow||(p=m.color,q=m.intensity,t=m.distance,m instanceof THREE.AmbientLight?m.visible&&(K.gammaInput?(k+=p.r*p.r,l+=p.g*
-p.g,n+=p.b*p.b):(k+=p.r,l+=p.g,n+=p.b)):m instanceof THREE.DirectionalLight?(P+=1,m.visible&&(ha.getPositionFromMatrix(m.matrixWorld),ua.getPositionFromMatrix(m.target.matrixWorld),ha.sub(ua),ha.normalize(),0===ha.x&&0===ha.y&&0===ha.z||(m=3*M,u[m]=ha.x,u[m+1]=ha.y,u[m+2]=ha.z,K.gammaInput?F(s,m,p,q*q):z(s,m,p,q),M+=1))):m instanceof THREE.PointLight?(wc+=1,m.visible&&(Q=3*T,K.gammaInput?F(w,Q,p,q*q):z(w,Q,p,q),ua.getPositionFromMatrix(m.matrixWorld),v[Q]=ua.x,v[Q+1]=ua.y,v[Q+2]=ua.z,y[T]=t,T+=1)):
-m instanceof THREE.SpotLight?(X+=1,m.visible&&(Q=3*ea,K.gammaInput?F(E,Q,p,q*q):z(E,Q,p,q),ua.getPositionFromMatrix(m.matrixWorld),x[Q]=ua.x,x[Q+1]=ua.y,x[Q+2]=ua.z,D[ea]=t,ha.copy(ua),ua.getPositionFromMatrix(m.target.matrixWorld),ha.sub(ua),ha.normalize(),J[Q]=ha.x,J[Q+1]=ha.y,J[Q+2]=ha.z,N[ea]=Math.cos(m.angle),O[ea]=m.exponent,ea+=1)):m instanceof THREE.HemisphereLight&&(W+=1,m.visible&&(ha.getPositionFromMatrix(m.matrixWorld),ha.normalize(),0===ha.x&&0===ha.y&&0===ha.z||(t=3*za,R[t]=ha.x,R[t+
-1]=ha.y,R[t+2]=ha.z,p=m.color,m=m.groundColor,K.gammaInput?(q*=q,F(I,t,p,q),F(V,t,m,q)):(z(I,t,p,q),z(V,t,m,q)),za+=1))));c=3*M;for(f=Math.max(s.length,3*P);c<f;c++)s[c]=0;c=3*T;for(f=Math.max(w.length,3*wc);c<f;c++)w[c]=0;c=3*ea;for(f=Math.max(E.length,3*X);c<f;c++)E[c]=0;c=3*za;for(f=Math.max(I.length,3*W);c<f;c++)I[c]=0;c=3*za;for(f=Math.max(V.length,3*W);c<f;c++)V[c]=0;r.directional.length=M;r.point.length=T;r.spot.length=ea;r.hemi.length=za;r.ambient[0]=k;r.ambient[1]=l;r.ambient[2]=n;wa=!1}c=
-Ra;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=d.specularMap;d.bumpMap&&(i.bumpMap.value=
-d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var Z;d.map?Z=d.map:d.specularMap?Z=d.specularMap:d.normalMap?Z=d.normalMap:d.bumpMap&&(Z=d.bumpMap);void 0!==Z&&(c=Z.offset,Z=Z.repeat,i.offsetRepeat.value.set(c.x,c.y,Z.x,Z.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;
-i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity,i.dashSize.value=d.dashSize,i.totalSize.value=d.dashSize+d.gapSize,i.scale.value=d.scale):d instanceof THREE.ParticleBasicMaterial?(i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=G.height/2,i.map.value=
-d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,K.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(K.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):
-(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(i.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=Z=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[Z]=k.shadowMap,i.shadowMapSize.value[Z]=
-k.shadowMapSize,i.shadowMatrix.value[Z]=k.shadowMatrix,i.shadowDarkness.value[Z]=k.shadowDarkness,i.shadowBias.value[Z]=k.shadowBias,Z++}b=d.uniformsList;i=0;for(Z=b.length;i<Z;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],l=c.type,k=c.value,"i"===l)j.uniform1i(f,k);else if("f"===l)j.uniform1f(f,k);else if("v2"===l)j.uniform2f(f,k.x,k.y);else if("v3"===l)j.uniform3f(f,k.x,k.y,k.z);else if("v4"===l)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===l)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===l)j.uniform1iv(f,
-k);else if("iv"===l)j.uniform3iv(f,k);else if("fv1"===l)j.uniform1fv(f,k);else if("fv"===l)j.uniform3fv(f,k);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*k.length));l=0;for(n=k.length;l<n;l++)r=2*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y;j.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*k.length));l=0;for(n=k.length;l<n;l++)r=3*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z;j.uniform3fv(f,c._array)}else if("v4v"===l){void 0===
-c._array&&(c._array=new Float32Array(4*k.length));l=0;for(n=k.length;l<n;l++)r=4*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z,c._array[r+3]=k[l].w;j.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=new Float32Array(16*k.length));l=0;for(n=k.length;l<n;l++)k[l].flattenToArrayOffset(c._array,16*l);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===
-l){if(r=k,k=C(),j.uniform1i(f,k),r)if(r.image instanceof Array&&6===r.image.length){if(c=r,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",Kb),c.image.__webglTextureCube=j.createTexture(),K.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(l=0;6>l;l++)K.autoScaleCubemaps&&!f?(n=k,r=l,s=c.image[l],
-w=qc,s.width<=w&&s.height<=w||(v=Math.max(s.width,s.height),u=Math.floor(s.width*w/v),w=Math.floor(s.height*w/v),v=document.createElement("canvas"),v.width=u,v.height=w,v.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,u,w),s=v),n[r]=s):k[l]=c.image[l];l=k[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);r=A(c.format);s=A(c.type);B(j.TEXTURE_CUBE_MAP,c,n);for(l=0;6>l;l++)if(f){w=k[l].mipmaps;v=0;for(y=w.length;v<y;v++)u=w[v],j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,v,r,
-u.width,u.height,0,u.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,r,r,s,k[l]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else r instanceof THREE.WebGLRenderTargetCube?(c=r,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):K.setTexture(r,k)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=
-c.value.length;l<n;l++)c._array[l]=C();j.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)r=c.value[l],k=c._array[l],r&&K.setTexture(r,k)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+l);if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)ua.getPositionFromMatrix(a.matrixWorld),j.uniform3f(h.cameraPosition,ua.x,ua.y,ua.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||
-d.skinning)&&null!==h.viewMatrix&&j.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&j.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&j.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function C(){var a=aa;a>=Wb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Wb);aa+=1;return a}function F(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 z(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function D(a){a!==Aa&&(j.lineWidth(a),Aa=a)}function y(a,b,c){Ha!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Ha=a);if(a&&(Xa!==b||Sa!==c))j.polygonOffset(b,c),Xa=b,Sa=c}function O(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function x(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));
-j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(O(b)),null):c}function B(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,A(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,A(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,A(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,A(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,
-j.TEXTURE_MAG_FILTER,v(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,v(b.minFilter)));if(ya&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,ya.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Xb)),b.__oldAnisotropy=b.anisotropy}function I(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,
-a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function v(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function A(a){if(a===THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;
-if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return j.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return j.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return j.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return j.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return j.UNSIGNED_SHORT_4_4_4_4;
-if(a===THREE.UnsignedShort5551Type)return j.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return j.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return j.BYTE;if(a===THREE.ShortType)return j.SHORT;if(a===THREE.UnsignedShortType)return j.UNSIGNED_SHORT;if(a===THREE.IntType)return j.INT;if(a===THREE.UnsignedIntType)return j.UNSIGNED_INT;if(a===THREE.FloatType)return j.FLOAT;if(a===THREE.AlphaFormat)return j.ALPHA;if(a===THREE.RGBFormat)return j.RGB;if(a===THREE.RGBAFormat)return j.RGBA;if(a===
-THREE.LuminanceFormat)return j.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return j.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return j.FUNC_ADD;if(a===THREE.SubtractEquation)return j.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return j.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return j.ZERO;if(a===THREE.OneFactor)return j.ONE;if(a===THREE.SrcColorFactor)return j.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return j.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return j.SRC_ALPHA;if(a===
-THREE.OneMinusSrcAlphaFactor)return j.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return j.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return j.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return j.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return j.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(void 0!==Ia){if(a===THREE.RGB_S3TC_DXT1_Format)return Ia.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Ia.COMPRESSED_RGBA_S3TC_DXT1_EXT;
-if(a===THREE.RGBA_S3TC_DXT3_Format)return Ia.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Ia.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},G=void 0!==a.canvas?a.canvas:document.createElement("canvas"),R=void 0!==a.precision?a.precision:"highp",J=void 0!==a.alpha?a.alpha:!0,ba=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,qa=void 0!==a.antialias?a.antialias:!1,ra=void 0!==a.stencil?a.stencil:!0,N=void 0!==a.preserveDrawingBuffer?
-a.preserveDrawingBuffer:!1,M=new THREE.Color(0),Q=0;void 0!==a.clearColor&&(console.warn("DEPRECATED: clearColor in WebGLRenderer constructor parameters is being removed. Use .setClearColor() instead."),M.setHex(a.clearColor));void 0!==a.clearAlpha&&(console.warn("DEPRECATED: clearAlpha in WebGLRenderer constructor parameters is being removed. Use .setClearColor() instead."),Q=a.clearAlpha);this.domElement=G;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==
-window.devicePixelRatio?window.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=
-[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var K=this,da=[],za=0,Fa=null,ea=null,Ea=-1,Z=null,fa=null,V=0,aa=0,P=-1,T=-1,ma=-1,va=-1,ja=-1,Pa=-1,Ja=-1,ga=-1,Ha=null,Xa=null,Sa=null,Aa=null,hb=0,ib=0,tb=0,ub=0,vb=0,jb=0,Ka={},na=new THREE.Frustum,ta=new THREE.Matrix4,kb=new THREE.Matrix4,ua=new THREE.Vector3,ha=new THREE.Vector3,wa=!0,Ra={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,
-colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},j,Wa,xa,ya,Ia;try{if(!(j=G.getContext("experimental-webgl",{alpha:J,premultipliedAlpha:ba,antialias:qa,stencil:ra,preserveDrawingBuffer:N})))throw"Error creating WebGL context.";}catch(Ta){console.error(Ta)}Wa=j.getExtension("OES_texture_float");j.getExtension("OES_texture_float_linear");xa=j.getExtension("OES_standard_derivatives");
-ya=j.getExtension("EXT_texture_filter_anisotropic")||j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Ia=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Wa||console.log("THREE.WebGLRenderer: Float textures not supported.");xa||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");ya||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");
-Ia||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===j.getShaderPrecisionFormat&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(M.r,M.g,M.b,Q);this.context=j;var Wb=
-j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),pc=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var qc=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Xb=ya?j.getParameter(ya.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,Ib=0<pc,Eb=Ib&&Wa;Ia&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var rc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),sc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);var tc=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,
-j.HIGH_FLOAT),uc=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_INT);var vc=0<rc.precision&&0<tc.precision,
-Yb=0<sc.precision&&0<uc.precision;"highp"===R&&!vc&&(Yb?(R="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(R="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===R&&!Yb&&(R="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return Ib};this.supportsFloatTextures=function(){return Wa};this.supportsStandardDerivatives=function(){return xa};
-this.supportsCompressedTextureS3TC=function(){return Ia};this.getMaxAnisotropy=function(){return Xb};this.getPrecision=function(){return R};this.setSize=function(a,b,c){G.width=a*this.devicePixelRatio;G.height=b*this.devicePixelRatio;1!==this.devicePixelRatio&&!1!==c&&(G.style.width=a+"px",G.style.height=b+"px");this.setViewport(0,0,G.width,G.height)};this.setViewport=function(a,b,c,d){hb=void 0!==a?a:0;ib=void 0!==b?b:0;tb=void 0!==c?c:G.width;ub=void 0!==d?d:G.height;j.viewport(hb,ib,tb,ub)};this.setScissor=
-function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColor=function(a,b){M.set(a);Q=void 0!==b?b:1;j.clearColor(M.r,M.g,M.b,Q)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return M};this.getClearAlpha=function(){return Q};this.clear=function(a,b,c){var d=0;if(void 0===a||
-a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){Fa=null;Ea=Z=ga=Ja=ma=-1;wa=!0;T=P=-1;this.shadowMapPlugin.update(a,b)};var Jb=function(a){a=a.target;a.removeEventListener("dispose",
-Jb);a.__webglInit=void 0;if(a instanceof THREE.BufferGeometry){var b=a.attributes,c;for(c in b)void 0!==b[c].buffer&&j.deleteBuffer(b[c].buffer)}else{if(void 0!==a.geometryGroups)for(b in a.geometryGroups){c=a.geometryGroups[b];if(void 0!==c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(void 0!==c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d])}Nb(c)}Nb(a)}K.info.memory.geometries--},
-Kb=function(a){a=a.target;a.removeEventListener("dispose",Kb);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));K.info.memory.textures--},Lb=function(a){a=a.target;a.removeEventListener("dispose",Lb);if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);
-else j.deleteFramebuffer(a.__webglFramebuffer),j.deleteRenderbuffer(a.__webglRenderbuffer);K.info.memory.textures--},Mb=function(a){a=a.target;a.removeEventListener("dispose",Mb);Ob(a)},Nb=function(a){void 0!==a.__webglVertexBuffer&&j.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&j.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&j.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&j.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&
-j.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&j.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&j.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&j.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&j.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&j.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&j.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)j.deleteBuffer(a.__webglCustomAttributesList[b].buffer)},
-Ob=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=da.length;a<c;a++)if(d=da[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=da.length;a<c;a++)d=da[a],d.program!==b&&e.push(d);da=e;j.deleteProgram(b);K.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=j.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=j.createBuffer());
-a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=j.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=j.createBuffer());a.hasPositions&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,i,
-k,l,m,n,p,q=3*a.count;for(p=0;p<q;p+=9)n=a.normalArray,d=n[p],e=n[p+1],f=n[p+2],g=n[p+3],i=n[p+4],l=n[p+5],h=n[p+6],k=n[p+7],m=n[p+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+l+m)/3,n[p]=d,n[p+1]=e,n[p+2]=f,n[p+3]=d,n[p+4]=e,n[p+5]=f,n[p+6]=d,n[p+7]=e,n[p+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglUvBuffer),j.bufferData(j.ARRAY_BUFFER,
-a.uvArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.uv),j.vertexAttribPointer(b.attributes.uv,2,j.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,a.colorArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.color),j.vertexAttribPointer(b.attributes.color,3,j.FLOAT,!1,0,0));j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var i,
-k,l,m;i=E(a,b,c,d,f);b=i.attributes;a=e.attributes;c=!1;i=16777215*e.id+2*i.id+(d.wireframe?1:0);i!==Z&&(Z=i,c=!0);c&&g();if(f instanceof THREE.Mesh)if(d=a.index){e=e.offsets;1<e.length&&(c=!0);for(var f=0,n=e.length;f<n;f++){var p=e[f].index;if(c){for(k in a)"index"!==k&&(l=b[k],i=a[k],m=i.itemSize,0<=l&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,4*p*m)));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,d.buffer)}j.drawElements(j.TRIANGLES,e[f].count,j.UNSIGNED_SHORT,2*
-e[f].start);K.info.render.calls++;K.info.render.vertices+=e[f].count;K.info.render.faces+=e[f].count/3}}else{if(c)for(k in a)"index"!==k&&(l=b[k],i=a[k],m=i.itemSize,0<=l&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,0)));a=e.attributes.position;j.drawArrays(j.TRIANGLES,0,a.numItems/3);K.info.render.calls++;K.info.render.vertices+=a.numItems/3;K.info.render.faces+=a.numItems/3/3}else if(f instanceof THREE.ParticleSystem){if(c){for(k in a)l=b[k],i=a[k],m=i.itemSize,
-0<=l&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,0));a=a.position;j.drawArrays(j.POINTS,0,a.numItems/3);K.info.render.calls++;K.info.render.points+=a.numItems/3}}else if(f instanceof THREE.Line&&c){for(k in a)l=b[k],i=a[k],m=i.itemSize,0<=l&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,0));k=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES;D(d.linewidth);a=a.position;j.drawArrays(k,0,a.numItems/3);K.info.render.calls++;K.info.render.points+=
-a.numItems}}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var i,l,c=E(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Z&&(Z=c,b=!0);b&&g();if(!d.morphTargets&&0<=a.position)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),h(a.position),j.vertexAttribPointer(a.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),
-h(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),h(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var m=0;l=f.morphTargetForcedOrder;for(i=f.morphTargetInfluences;m<d.numSupportedMorphTargets&&m<l.length;)0<=c["morphTarget"+m]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l[m]]),h(c["morphTarget"+m]),j.vertexAttribPointer(c["morphTarget"+m],3,j.FLOAT,
-!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l[m]]),h(c["morphNormal"+m]),j.vertexAttribPointer(c["morphNormal"+m],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[m]=i[l[m]],m++}else{l=[];i=f.morphTargetInfluences;var n,p=i.length;for(n=0;n<p;n++)m=i[n],0<m&&l.push([m,n]);l.length>d.numSupportedMorphTargets?(l.sort(k),l.length=d.numSupportedMorphTargets):l.length>d.numSupportedMorphNormals?l.sort(k):0===l.length&&l.push([0,0]);for(m=0;m<
-d.numSupportedMorphTargets;)l[m]?(n=l[m][1],0<=c["morphTarget"+m]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]),h(c["morphTarget"+m]),j.vertexAttribPointer(c["morphTarget"+m],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n]),h(c["morphNormal"+m]),j.vertexAttribPointer(c["morphNormal"+m],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[m]=i[n]):f.__webglMorphTargetInfluences[m]=0,m++}null!==d.program.uniforms.morphTargetInfluences&&
-j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){i=0;for(l=e.__webglCustomAttributesList.length;i<l;i++)c=e.__webglCustomAttributesList[i],0<=a[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),h(a[c.buffer.belongsToAttribute]),j.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}0<=a.color&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),h(a.color),j.vertexAttribPointer(a.color,
-3,j.FLOAT,!1,0,0));0<=a.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),h(a.normal),j.vertexAttribPointer(a.normal,3,j.FLOAT,!1,0,0));0<=a.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),h(a.tangent),j.vertexAttribPointer(a.tangent,4,j.FLOAT,!1,0,0));0<=a.uv&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),h(a.uv),j.vertexAttribPointer(a.uv,2,j.FLOAT,!1,0,0));0<=a.uv2&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),h(a.uv2),j.vertexAttribPointer(a.uv2,2,j.FLOAT,!1,0,0));
-d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),h(a.skinIndex),j.vertexAttribPointer(a.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),h(a.skinWeight),j.vertexAttribPointer(a.skinWeight,4,j.FLOAT,!1,0,0));0<=a.lineDistance&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),h(a.lineDistance),j.vertexAttribPointer(a.lineDistance,1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(D(d.wireframeLinewidth),
-b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.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?j.LINE_STRIP:j.LINES,D(d.linewidth),j.drawArrays(f,0,e.__webglLineCount),K.info.render.calls++):
-f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),K.info.render.calls++,K.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.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,k=a.__lights,p=a.fog;Ea=-1;wa=!0;!0===a.autoUpdate&&a.updateMatrixWorld();
-void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);ta.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);na.setFromMatrix(ta);this.autoUpdateObjects&&this.initWebGLObjects(a);l(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.id=d,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||na.intersectsObject(g))){var q=g;q._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,q.matrixWorld);q._normalMatrix.getNormalMatrix(q._modelViewMatrix);var q=f,t=q.buffer,r=void 0,s=r=void 0,s=q.object.material;if(s instanceof THREE.MeshFaceMaterial)r=t.materialIndex,r=s.materials[r],r.transparent?(q.transparent=r,q.opaque=null):(q.opaque=r,q.transparent=null);else if(r=
-s)r.transparent?(q.transparent=r,q.opaque=null):(q.opaque=r,q.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(ua.getPositionFromMatrix(g.matrixWorld),ua.applyProjection(ta),f.z=ua.z))}this.sortObjects&&h.sort(i);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(g._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,g.matrixWorld),g._normalMatrix.getNormalMatrix(g._modelViewMatrix),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),y(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),m(a.__webglObjects,!1,"",b,k,p,!0,d),n(a.__webglObjectsImmediate,"",b,k,p,!1,d)):(d=null,this.setBlending(THREE.NoBlending),m(a.__webglObjects,!0,"opaque",b,k,p,!1,d),n(a.__webglObjectsImmediate,"opaque",
-b,k,p,!1,d),m(a.__webglObjects,!1,"transparent",b,k,p,!0,d),n(a.__webglObjectsImmediate,"transparent",b,k,p,!0,d));l(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,
-null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=E(a,b,c,d,e);Z=-1;K.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,na):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;)t(a.__objectsAdded[0],a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)r(a.__objectsRemoved[0],
-a),a.__objectsRemoved.splice(0,1);for(var b=0,g=a.__webglObjects.length;b<g;b++){var h=a.__webglObjects[b].object;void 0===h.__webglInit&&(void 0!==h.__webglActive&&r(h,a),t(h,a));var i=h,l=i.geometry,m=void 0,n=void 0,s=void 0;if(l instanceof THREE.BufferGeometry){var u=j.DYNAMIC_DRAW,w=!l.dynamic,v=l.attributes,z=void 0,y=void 0;for(z in v)y=v[z],y.needsUpdate&&("index"===z?(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,y.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,y.array,u)):(j.bindBuffer(j.ARRAY_BUFFER,
-y.buffer),j.bufferData(j.ARRAY_BUFFER,y.array,u)),y.needsUpdate=!1),w&&!y.dynamic&&(y.array=null)}else if(i instanceof THREE.Mesh){for(var E=0,A=l.geometryGroupsList.length;E<A;E++)if(m=l.geometryGroupsList[E],s=d(i,m),l.buffersNeedUpdate&&c(m,i),n=s.attributes&&p(s),l.verticesNeedUpdate||l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||n){var x=m,F=i,C=j.DYNAMIC_DRAW,D=!l.dynamic,G=s;if(x.__inittedArrays){var J=e(G),K=
-G.vertexColors?G.vertexColors:!1,N=f(G),O=J===THREE.SmoothShading,B=void 0,I=void 0,V=void 0,M=void 0,R=void 0,Q=void 0,T=void 0,ea=void 0,za=void 0,Z=void 0,aa=void 0,P=void 0,X=void 0,W=void 0,Fa=void 0,fa=void 0,Ea=void 0,ba=void 0,da=void 0,ja=void 0,ga=void 0,ha=void 0,ma=void 0,na=void 0,qa=void 0,ra=void 0,va=void 0,wa=void 0,xa=void 0,Ga=void 0,Ha=void 0,Ja=void 0,Ia=void 0,Pa=void 0,Ua=void 0,Ka=void 0,ya=void 0,Aa=void 0,Sa=void 0,Wa=void 0,fb=0,gb=0,Ra=0,Ta=0,Xa=0,lb=0,Va=0,yb=0,cb=0,sa=
-0,Ba=0,L=0,Qa=void 0,mb=x.__vertexArray,hb=x.__uvArray,ib=x.__uv2Array,Ab=x.__normalArray,Ya=x.__tangentArray,nb=x.__colorArray,Za=x.__skinIndexArray,$a=x.__skinWeightArray,tb=x.__morphTargetsArrays,ub=x.__morphNormalsArrays,vb=x.__webglCustomAttributesList,H=void 0,jb=x.__faceArray,Bb=x.__lineArray,La=F.geometry,Ib=La.elementsNeedUpdate,Eb=La.uvsNeedUpdate,Kb=La.normalsNeedUpdate,Wb=La.tangentsNeedUpdate,Xb=La.colorsNeedUpdate,Yb=La.morphTargetsNeedUpdate,xc=La.vertices,$=x.faces3,ob=La.faces,Jb=
-La.faceVertexUvs[0],Lb=La.faceVertexUvs[1],yc=La.skinIndices,Zb=La.skinWeights,$b=La.morphTargets,Mb=La.morphNormals;if(La.verticesNeedUpdate){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],P=xc[M.a],X=xc[M.b],W=xc[M.c],mb[gb]=P.x,mb[gb+1]=P.y,mb[gb+2]=P.z,mb[gb+3]=X.x,mb[gb+4]=X.y,mb[gb+5]=X.z,mb[gb+6]=W.x,mb[gb+7]=W.y,mb[gb+8]=W.z,gb+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,mb,C)}if(Yb){Ua=0;for(Ka=$b.length;Ua<Ka;Ua++){B=Ba=0;for(I=$.length;B<I;B++)Sa=$[B],M=ob[Sa],
-P=$b[Ua].vertices[M.a],X=$b[Ua].vertices[M.b],W=$b[Ua].vertices[M.c],ya=tb[Ua],ya[Ba]=P.x,ya[Ba+1]=P.y,ya[Ba+2]=P.z,ya[Ba+3]=X.x,ya[Ba+4]=X.y,ya[Ba+5]=X.z,ya[Ba+6]=W.x,ya[Ba+7]=W.y,ya[Ba+8]=W.z,G.morphNormals&&(O?(Wa=Mb[Ua].vertexNormals[Sa],ba=Wa.a,da=Wa.b,ja=Wa.c):ja=da=ba=Mb[Ua].faceNormals[Sa],Aa=ub[Ua],Aa[Ba]=ba.x,Aa[Ba+1]=ba.y,Aa[Ba+2]=ba.z,Aa[Ba+3]=da.x,Aa[Ba+4]=da.y,Aa[Ba+5]=da.z,Aa[Ba+6]=ja.x,Aa[Ba+7]=ja.y,Aa[Ba+8]=ja.z),Ba+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphTargetsBuffers[Ua]);
-j.bufferData(j.ARRAY_BUFFER,tb[Ua],C);G.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphNormalsBuffers[Ua]),j.bufferData(j.ARRAY_BUFFER,ub[Ua],C))}}if(Zb.length){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],na=Zb[M.a],qa=Zb[M.b],ra=Zb[M.c],$a[sa]=na.x,$a[sa+1]=na.y,$a[sa+2]=na.z,$a[sa+3]=na.w,$a[sa+4]=qa.x,$a[sa+5]=qa.y,$a[sa+6]=qa.z,$a[sa+7]=qa.w,$a[sa+8]=ra.x,$a[sa+9]=ra.y,$a[sa+10]=ra.z,$a[sa+11]=ra.w,va=yc[M.a],wa=yc[M.b],xa=yc[M.c],Za[sa]=va.x,Za[sa+1]=va.y,Za[sa+2]=va.z,Za[sa+3]=va.w,Za[sa+
-4]=wa.x,Za[sa+5]=wa.y,Za[sa+6]=wa.z,Za[sa+7]=wa.w,Za[sa+8]=xa.x,Za[sa+9]=xa.y,Za[sa+10]=xa.z,Za[sa+11]=xa.w,sa+=12;0<sa&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Za,C),j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,$a,C))}if(Xb&&K){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],T=M.vertexColors,ea=M.color,3===T.length&&K===THREE.VertexColors?(ga=T[0],ha=T[1],ma=T[2]):ma=ha=ga=ea,nb[cb]=ga.r,nb[cb+1]=ga.g,nb[cb+2]=ga.b,nb[cb+3]=
-ha.r,nb[cb+4]=ha.g,nb[cb+5]=ha.b,nb[cb+6]=ma.r,nb[cb+7]=ma.g,nb[cb+8]=ma.b,cb+=9;0<cb&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,nb,C))}if(Wb&&La.hasTangents){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],za=M.vertexTangents,Fa=za[0],fa=za[1],Ea=za[2],Ya[Va]=Fa.x,Ya[Va+1]=Fa.y,Ya[Va+2]=Fa.z,Ya[Va+3]=Fa.w,Ya[Va+4]=fa.x,Ya[Va+5]=fa.y,Ya[Va+6]=fa.z,Ya[Va+7]=fa.w,Ya[Va+8]=Ea.x,Ya[Va+9]=Ea.y,Ya[Va+10]=Ea.z,Ya[Va+11]=Ea.w,Va+=12;j.bindBuffer(j.ARRAY_BUFFER,x.__webglTangentBuffer);
-j.bufferData(j.ARRAY_BUFFER,Ya,C)}if(Kb&&J){B=0;for(I=$.length;B<I;B++)if(M=ob[$[B]],R=M.vertexNormals,Q=M.normal,3===R.length&&O)for(Ga=0;3>Ga;Ga++)Ja=R[Ga],Ab[lb]=Ja.x,Ab[lb+1]=Ja.y,Ab[lb+2]=Ja.z,lb+=3;else for(Ga=0;3>Ga;Ga++)Ab[lb]=Q.x,Ab[lb+1]=Q.y,Ab[lb+2]=Q.z,lb+=3;j.bindBuffer(j.ARRAY_BUFFER,x.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Ab,C)}if(Eb&&Jb&&N){B=0;for(I=$.length;B<I;B++)if(V=$[B],Z=Jb[V],void 0!==Z)for(Ga=0;3>Ga;Ga++)Ia=Z[Ga],hb[Ra]=Ia.x,hb[Ra+1]=Ia.y,Ra+=2;0<Ra&&(j.bindBuffer(j.ARRAY_BUFFER,
-x.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,hb,C))}if(Eb&&Lb&&N){B=0;for(I=$.length;B<I;B++)if(V=$[B],aa=Lb[V],void 0!==aa)for(Ga=0;3>Ga;Ga++)Pa=aa[Ga],ib[Ta]=Pa.x,ib[Ta+1]=Pa.y,Ta+=2;0<Ta&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,ib,C))}if(Ib){B=0;for(I=$.length;B<I;B++)jb[Xa]=fb,jb[Xa+1]=fb+1,jb[Xa+2]=fb+2,Xa+=3,Bb[yb]=fb,Bb[yb+1]=fb+1,Bb[yb+2]=fb,Bb[yb+3]=fb+2,Bb[yb+4]=fb+1,Bb[yb+5]=fb+2,yb+=6,fb+=3;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);
-j.bufferData(j.ELEMENT_ARRAY_BUFFER,jb,C);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Bb,C)}if(vb){Ga=0;for(Ha=vb.length;Ga<Ha;Ga++)if(H=vb[Ga],H.__original.needsUpdate){L=0;if(1===H.size)if(void 0===H.boundTo||"vertices"===H.boundTo){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],H.array[L]=H.value[M.a],H.array[L+1]=H.value[M.b],H.array[L+2]=H.value[M.c],L+=3}else{if("faces"===H.boundTo){B=0;for(I=$.length;B<I;B++)Qa=H.value[$[B]],H.array[L]=Qa,H.array[L+1]=
-Qa,H.array[L+2]=Qa,L+=3}}else if(2===H.size)if(void 0===H.boundTo||"vertices"===H.boundTo){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],P=H.value[M.a],X=H.value[M.b],W=H.value[M.c],H.array[L]=P.x,H.array[L+1]=P.y,H.array[L+2]=X.x,H.array[L+3]=X.y,H.array[L+4]=W.x,H.array[L+5]=W.y,L+=6}else{if("faces"===H.boundTo){B=0;for(I=$.length;B<I;B++)W=X=P=Qa=H.value[$[B]],H.array[L]=P.x,H.array[L+1]=P.y,H.array[L+2]=X.x,H.array[L+3]=X.y,H.array[L+4]=W.x,H.array[L+5]=W.y,L+=6}}else if(3===H.size){var pa;pa="c"===H.type?
-["r","g","b"]:["x","y","z"];if(void 0===H.boundTo||"vertices"===H.boundTo){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],P=H.value[M.a],X=H.value[M.b],W=H.value[M.c],H.array[L]=P[pa[0]],H.array[L+1]=P[pa[1]],H.array[L+2]=P[pa[2]],H.array[L+3]=X[pa[0]],H.array[L+4]=X[pa[1]],H.array[L+5]=X[pa[2]],H.array[L+6]=W[pa[0]],H.array[L+7]=W[pa[1]],H.array[L+8]=W[pa[2]],L+=9}else if("faces"===H.boundTo){B=0;for(I=$.length;B<I;B++)W=X=P=Qa=H.value[$[B]],H.array[L]=P[pa[0]],H.array[L+1]=P[pa[1]],H.array[L+2]=P[pa[2]],
-H.array[L+3]=X[pa[0]],H.array[L+4]=X[pa[1]],H.array[L+5]=X[pa[2]],H.array[L+6]=W[pa[0]],H.array[L+7]=W[pa[1]],H.array[L+8]=W[pa[2]],L+=9}else if("faceVertices"===H.boundTo){B=0;for(I=$.length;B<I;B++)Qa=H.value[$[B]],P=Qa[0],X=Qa[1],W=Qa[2],H.array[L]=P[pa[0]],H.array[L+1]=P[pa[1]],H.array[L+2]=P[pa[2]],H.array[L+3]=X[pa[0]],H.array[L+4]=X[pa[1]],H.array[L+5]=X[pa[2]],H.array[L+6]=W[pa[0]],H.array[L+7]=W[pa[1]],H.array[L+8]=W[pa[2]],L+=9}}else if(4===H.size)if(void 0===H.boundTo||"vertices"===H.boundTo){B=
-0;for(I=$.length;B<I;B++)M=ob[$[B]],P=H.value[M.a],X=H.value[M.b],W=H.value[M.c],H.array[L]=P.x,H.array[L+1]=P.y,H.array[L+2]=P.z,H.array[L+3]=P.w,H.array[L+4]=X.x,H.array[L+5]=X.y,H.array[L+6]=X.z,H.array[L+7]=X.w,H.array[L+8]=W.x,H.array[L+9]=W.y,H.array[L+10]=W.z,H.array[L+11]=W.w,L+=12}else if("faces"===H.boundTo){B=0;for(I=$.length;B<I;B++)W=X=P=Qa=H.value[$[B]],H.array[L]=P.x,H.array[L+1]=P.y,H.array[L+2]=P.z,H.array[L+3]=P.w,H.array[L+4]=X.x,H.array[L+5]=X.y,H.array[L+6]=X.z,H.array[L+7]=X.w,
-H.array[L+8]=W.x,H.array[L+9]=W.y,H.array[L+10]=W.z,H.array[L+11]=W.w,L+=12}else if("faceVertices"===H.boundTo){B=0;for(I=$.length;B<I;B++)Qa=H.value[$[B]],P=Qa[0],X=Qa[1],W=Qa[2],H.array[L]=P.x,H.array[L+1]=P.y,H.array[L+2]=P.z,H.array[L+3]=P.w,H.array[L+4]=X.x,H.array[L+5]=X.y,H.array[L+6]=X.z,H.array[L+7]=X.w,H.array[L+8]=W.x,H.array[L+9]=W.y,H.array[L+10]=W.z,H.array[L+11]=W.w,L+=12}j.bindBuffer(j.ARRAY_BUFFER,H.buffer);j.bufferData(j.ARRAY_BUFFER,H.array,C)}}D&&(delete x.__inittedArrays,delete x.__colorArray,
-delete x.__normalArray,delete x.__tangentArray,delete x.__uvArray,delete x.__uv2Array,delete x.__faceArray,delete x.__vertexArray,delete x.__lineArray,delete x.__skinIndexArray,delete x.__skinWeightArray)}}l.verticesNeedUpdate=!1;l.morphTargetsNeedUpdate=!1;l.elementsNeedUpdate=!1;l.uvsNeedUpdate=!1;l.normalsNeedUpdate=!1;l.colorsNeedUpdate=!1;l.tangentsNeedUpdate=!1;l.buffersNeedUpdate=!1;s.attributes&&q(s)}else if(i instanceof THREE.Ribbon){s=d(i,l);n=s.attributes&&p(s);if(l.verticesNeedUpdate||
-l.colorsNeedUpdate||l.normalsNeedUpdate||n){var ab=l,ac=j.DYNAMIC_DRAW,Pb=void 0,Qb=void 0,Rb=void 0,bc=void 0,ca=void 0,cc=void 0,dc=void 0,ec=void 0,Nb=void 0,Ca=void 0,Fb=void 0,ka=void 0,Ma=void 0,Ob=ab.vertices,Ec=ab.colors,Fc=ab.normals,pc=Ob.length,qc=Ec.length,rc=Fc.length,fc=ab.__vertexArray,gc=ab.__colorArray,hc=ab.__normalArray,sc=ab.colorsNeedUpdate,tc=ab.normalsNeedUpdate,zc=ab.__webglCustomAttributesList;if(ab.verticesNeedUpdate){for(Pb=0;Pb<pc;Pb++)bc=Ob[Pb],ca=3*Pb,fc[ca]=bc.x,fc[ca+
-1]=bc.y,fc[ca+2]=bc.z;j.bindBuffer(j.ARRAY_BUFFER,ab.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,fc,ac)}if(sc){for(Qb=0;Qb<qc;Qb++)cc=Ec[Qb],ca=3*Qb,gc[ca]=cc.r,gc[ca+1]=cc.g,gc[ca+2]=cc.b;j.bindBuffer(j.ARRAY_BUFFER,ab.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,gc,ac)}if(tc){for(Rb=0;Rb<rc;Rb++)dc=Fc[Rb],ca=3*Rb,hc[ca]=dc.x,hc[ca+1]=dc.y,hc[ca+2]=dc.z;j.bindBuffer(j.ARRAY_BUFFER,ab.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,hc,ac)}if(zc){ec=0;for(Nb=zc.length;ec<Nb;ec++)if(ka=zc[ec],
-ka.needsUpdate&&(void 0===ka.boundTo||"vertices"===ka.boundTo)){ca=0;Fb=ka.value.length;if(1===ka.size)for(Ca=0;Ca<Fb;Ca++)ka.array[Ca]=ka.value[Ca];else if(2===ka.size)for(Ca=0;Ca<Fb;Ca++)Ma=ka.value[Ca],ka.array[ca]=Ma.x,ka.array[ca+1]=Ma.y,ca+=2;else if(3===ka.size)if("c"===ka.type)for(Ca=0;Ca<Fb;Ca++)Ma=ka.value[Ca],ka.array[ca]=Ma.r,ka.array[ca+1]=Ma.g,ka.array[ca+2]=Ma.b,ca+=3;else for(Ca=0;Ca<Fb;Ca++)Ma=ka.value[Ca],ka.array[ca]=Ma.x,ka.array[ca+1]=Ma.y,ka.array[ca+2]=Ma.z,ca+=3;else if(4===
-ka.size)for(Ca=0;Ca<Fb;Ca++)Ma=ka.value[Ca],ka.array[ca]=Ma.x,ka.array[ca+1]=Ma.y,ka.array[ca+2]=Ma.z,ka.array[ca+3]=Ma.w,ca+=4;j.bindBuffer(j.ARRAY_BUFFER,ka.buffer);j.bufferData(j.ARRAY_BUFFER,ka.array,ac)}}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.normalsNeedUpdate=!1;s.attributes&&q(s)}else if(i instanceof THREE.Line){s=d(i,l);n=s.attributes&&p(s);if(l.verticesNeedUpdate||l.colorsNeedUpdate||l.lineDistancesNeedUpdate||n){var bb=l,ic=j.DYNAMIC_DRAW,Sb=void 0,Tb=void 0,Ub=void 0,jc=void 0,
-oa=void 0,kc=void 0,Gc=bb.vertices,Hc=bb.colors,Ic=bb.lineDistances,uc=Gc.length,vc=Hc.length,Oc=Ic.length,lc=bb.__vertexArray,mc=bb.__colorArray,Jc=bb.__lineDistanceArray,Pc=bb.colorsNeedUpdate,Qc=bb.lineDistancesNeedUpdate,Ac=bb.__webglCustomAttributesList,nc=void 0,Kc=void 0,Da=void 0,Gb=void 0,Na=void 0,la=void 0;if(bb.verticesNeedUpdate){for(Sb=0;Sb<uc;Sb++)jc=Gc[Sb],oa=3*Sb,lc[oa]=jc.x,lc[oa+1]=jc.y,lc[oa+2]=jc.z;j.bindBuffer(j.ARRAY_BUFFER,bb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,
-lc,ic)}if(Pc){for(Tb=0;Tb<vc;Tb++)kc=Hc[Tb],oa=3*Tb,mc[oa]=kc.r,mc[oa+1]=kc.g,mc[oa+2]=kc.b;j.bindBuffer(j.ARRAY_BUFFER,bb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,mc,ic)}if(Qc){for(Ub=0;Ub<Oc;Ub++)Jc[Ub]=Ic[Ub];j.bindBuffer(j.ARRAY_BUFFER,bb.__webglLineDistanceBuffer);j.bufferData(j.ARRAY_BUFFER,Jc,ic)}if(Ac){nc=0;for(Kc=Ac.length;nc<Kc;nc++)if(la=Ac[nc],la.needsUpdate&&(void 0===la.boundTo||"vertices"===la.boundTo)){oa=0;Gb=la.value.length;if(1===la.size)for(Da=0;Da<Gb;Da++)la.array[Da]=
-la.value[Da];else if(2===la.size)for(Da=0;Da<Gb;Da++)Na=la.value[Da],la.array[oa]=Na.x,la.array[oa+1]=Na.y,oa+=2;else if(3===la.size)if("c"===la.type)for(Da=0;Da<Gb;Da++)Na=la.value[Da],la.array[oa]=Na.r,la.array[oa+1]=Na.g,la.array[oa+2]=Na.b,oa+=3;else for(Da=0;Da<Gb;Da++)Na=la.value[Da],la.array[oa]=Na.x,la.array[oa+1]=Na.y,la.array[oa+2]=Na.z,oa+=3;else if(4===la.size)for(Da=0;Da<Gb;Da++)Na=la.value[Da],la.array[oa]=Na.x,la.array[oa+1]=Na.y,la.array[oa+2]=Na.z,la.array[oa+3]=Na.w,oa+=4;j.bindBuffer(j.ARRAY_BUFFER,
-la.buffer);j.bufferData(j.ARRAY_BUFFER,la.array,ic)}}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.lineDistancesNeedUpdate=!1;s.attributes&&q(s)}else if(i instanceof THREE.ParticleSystem){s=d(i,l);n=s.attributes&&p(s);if(l.verticesNeedUpdate||l.colorsNeedUpdate||i.sortParticles||n){var pb=l,Bc=j.DYNAMIC_DRAW,Vb=i,Oa=void 0,qb=void 0,rb=void 0,U=void 0,sb=void 0,zb=void 0,oc=pb.vertices,Cc=oc.length,Dc=pb.colors,Lc=Dc.length,Cb=pb.__vertexArray,Db=pb.__colorArray,wb=pb.__sortArray,Mc=pb.verticesNeedUpdate,
-Nc=pb.colorsNeedUpdate,xb=pb.__webglCustomAttributesList,db=void 0,Hb=void 0,Y=void 0,eb=void 0,ia=void 0,S=void 0;if(Vb.sortParticles){kb.copy(ta);kb.multiply(Vb.matrixWorld);for(Oa=0;Oa<Cc;Oa++)rb=oc[Oa],ua.copy(rb),ua.applyProjection(kb),wb[Oa]=[ua.z,Oa];wb.sort(k);for(Oa=0;Oa<Cc;Oa++)rb=oc[wb[Oa][1]],U=3*Oa,Cb[U]=rb.x,Cb[U+1]=rb.y,Cb[U+2]=rb.z;for(qb=0;qb<Lc;qb++)U=3*qb,zb=Dc[wb[qb][1]],Db[U]=zb.r,Db[U+1]=zb.g,Db[U+2]=zb.b;if(xb){db=0;for(Hb=xb.length;db<Hb;db++)if(S=xb[db],void 0===S.boundTo||
-"vertices"===S.boundTo)if(U=0,eb=S.value.length,1===S.size)for(Y=0;Y<eb;Y++)sb=wb[Y][1],S.array[Y]=S.value[sb];else if(2===S.size)for(Y=0;Y<eb;Y++)sb=wb[Y][1],ia=S.value[sb],S.array[U]=ia.x,S.array[U+1]=ia.y,U+=2;else if(3===S.size)if("c"===S.type)for(Y=0;Y<eb;Y++)sb=wb[Y][1],ia=S.value[sb],S.array[U]=ia.r,S.array[U+1]=ia.g,S.array[U+2]=ia.b,U+=3;else for(Y=0;Y<eb;Y++)sb=wb[Y][1],ia=S.value[sb],S.array[U]=ia.x,S.array[U+1]=ia.y,S.array[U+2]=ia.z,U+=3;else if(4===S.size)for(Y=0;Y<eb;Y++)sb=wb[Y][1],
-ia=S.value[sb],S.array[U]=ia.x,S.array[U+1]=ia.y,S.array[U+2]=ia.z,S.array[U+3]=ia.w,U+=4}}else{if(Mc)for(Oa=0;Oa<Cc;Oa++)rb=oc[Oa],U=3*Oa,Cb[U]=rb.x,Cb[U+1]=rb.y,Cb[U+2]=rb.z;if(Nc)for(qb=0;qb<Lc;qb++)zb=Dc[qb],U=3*qb,Db[U]=zb.r,Db[U+1]=zb.g,Db[U+2]=zb.b;if(xb){db=0;for(Hb=xb.length;db<Hb;db++)if(S=xb[db],S.needsUpdate&&(void 0===S.boundTo||"vertices"===S.boundTo))if(eb=S.value.length,U=0,1===S.size)for(Y=0;Y<eb;Y++)S.array[Y]=S.value[Y];else if(2===S.size)for(Y=0;Y<eb;Y++)ia=S.value[Y],S.array[U]=
-ia.x,S.array[U+1]=ia.y,U+=2;else if(3===S.size)if("c"===S.type)for(Y=0;Y<eb;Y++)ia=S.value[Y],S.array[U]=ia.r,S.array[U+1]=ia.g,S.array[U+2]=ia.b,U+=3;else for(Y=0;Y<eb;Y++)ia=S.value[Y],S.array[U]=ia.x,S.array[U+1]=ia.y,S.array[U+2]=ia.z,U+=3;else if(4===S.size)for(Y=0;Y<eb;Y++)ia=S.value[Y],S.array[U]=ia.x,S.array[U+1]=ia.y,S.array[U+2]=ia.z,S.array[U+3]=ia.w,U+=4}}if(Mc||Vb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,pb.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,Cb,Bc);if(Nc||Vb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,
-pb.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Db,Bc);if(xb){db=0;for(Hb=xb.length;db<Hb;db++)if(S=xb[db],S.needsUpdate||Vb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,S.buffer),j.bufferData(j.ARRAY_BUFFER,S.array,Bc)}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;s.attributes&&q(s)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",Mb);var i,k,l,m,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?
-n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof THREE.LineBasicMaterial?n="basic":a instanceof THREE.LineDashedMaterial?n="dashed":a instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q=e=0,r=0;f=p=0;for(var t=b.length;f<t;f++)g=b[f],g.onlyShadow||(g instanceof THREE.DirectionalLight&&
-e++,g instanceof THREE.PointLight&&q++,g instanceof THREE.SpotLight&&r++,g instanceof THREE.HemisphereLight&&p++);f=q;g=r;h=p;r=p=0;for(q=b.length;r<q;r++)t=b[r],t.castShadow&&(t instanceof THREE.SpotLight&&p++,t instanceof THREE.DirectionalLight&&!t.shadowCascade&&p++);m=p;Eb&&d&&d.useVertexTexture?l=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+
-d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),l=b);a:{var r=a.fragmentShader,q=a.vertexShader,p=a.uniforms,b=a.attributes,t=a.defines,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:l,useVertexTexture:Eb&&d&&d.useVertexTexture,boneTextureWidth:d&&
-d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,
-doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},s,u,w,d=[];n?d.push(n):(d.push(r),d.push(q));for(u in t)d.push(u),d.push(t[u]);for(s in c)d.push(s),d.push(c[s]);n=d.join();s=0;for(u=da.length;s<u;s++)if(d=da[s],d.code===n){d.usedTimes++;k=d.program;break a}s="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?s="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(s="SHADOWMAP_TYPE_PCF_SOFT");u=[];for(w in t)d=t[w],!1!==d&&(d="#define "+w+" "+d,u.push(d));
-d=u.join("\n");w=j.createProgram();u=["precision "+R+" float;","precision "+R+" int;",d,Ib?"#define VERTEX_TEXTURES":"",K.gammaInput?"#define GAMMA_INPUT":"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,
-c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?
-"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+s:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-s=["precision "+R+" float;","precision "+R+" int;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",d,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",K.gammaInput?"#define GAMMA_INPUT":"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
+function c(a,b){var c=b.geometry,h=a.faces3,g=3*h.length,i=1*h.length,k=3*h.length,h=d(b,a),m=f(h),l=e(h),n=h.vertexColors?h.vertexColors:!1;a.__vertexArray=new Float32Array(3*g);l&&(a.__normalArray=new Float32Array(3*g));c.hasTangents&&(a.__tangentArray=new Float32Array(4*g));n&&(a.__colorArray=new Float32Array(3*g));m&&(0<c.faceVertexUvs.length&&(a.__uvArray=new Float32Array(2*g)),1<c.faceVertexUvs.length&&(a.__uv2Array=new Float32Array(2*g)));b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&
+(a.__skinIndexArray=new Float32Array(4*g),a.__skinWeightArray=new Float32Array(4*g));a.__faceArray=new Uint16Array(3*i);a.__lineArray=new Uint16Array(2*k);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(m=a.numMorphTargets;c<m;c++)a.__morphTargetsArrays.push(new Float32Array(3*g))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(m=a.numMorphNormals;c<m;c++)a.__morphNormalsArrays.push(new Float32Array(3*g))}a.__webglFaceCount=3*i;a.__webglLineCount=2*k;if(h.attributes){void 0===a.__webglCustomAttributesList&&
+(a.__webglCustomAttributesList=[]);for(var p in h.attributes){var i=h.attributes[p],k={},q;for(q in i)k[q]=i[q];if(!k.__webglInitialized||k.createUniqueBuffers)k.__webglInitialized=!0,c=1,"v2"===k.type?c=2:"v3"===k.type?c=3:"v4"===k.type?c=4:"c"===k.type&&(c=3),k.size=c,k.array=new Float32Array(g*c),k.buffer=j.createBuffer(),k.buffer.belongsToAttribute=p,i.needsUpdate=!0,k.__original=i;a.__webglCustomAttributesList.push(k)}}a.__inittedArrays=!0}function d(a,b){return a.material instanceof THREE.MeshFaceMaterial?
+a.material.materials[b.materialIndex]:a.material}function e(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function h(a){Ka[a]||(j.enableVertexAttribArray(a),Ka[a]=!0)}function g(){for(var a in Ka)Ka[a]&&(j.disableVertexAttribArray(a),Ka[a]=
+!1)}function i(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function k(a,b){return b[0]-a[0]}function l(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)fa=Fa=null,Ea=Z=T=P=ga=Ja=ma=-1,wa=!0,a[d].render(b,c,vb,jb),fa=Fa=null,Ea=Z=T=P=ga=Ja=ma=-1,wa=!0}function m(a,b,c,d,e,f,h,g){var j,i,k,m;b?(i=a.length-1,m=b=-1):(i=0,b=a.length,m=1);for(var l=i;l!==b;l+=m)if(j=a[l],j.render){i=j.object;k=j.buffer;if(g)j=g;else{j=j[c];if(!j)continue;h&&K.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);
+K.setDepthTest(j.depthTest);K.setDepthWrite(j.depthWrite);y(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}K.setMaterialFaces(j);k instanceof THREE.BufferGeometry?K.renderBufferDirect(d,e,f,j,k,i):K.renderBuffer(d,e,f,j,k,i)}}function n(a,b,c,d,e,f,h){for(var g,j,i=0,k=a.length;i<k;i++)if(g=a[i],j=g.object,j.visible){if(h)g=h;else{g=g[b];if(!g)continue;f&&K.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);K.setDepthTest(g.depthTest);K.setDepthWrite(g.depthWrite);y(g.polygonOffset,
+g.polygonOffsetFactor,g.polygonOffsetUnits)}K.renderImmediateObject(c,d,e,g,j)}}function t(a,d){var e,f,h,g;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",Jb)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var i,k;for(i in f.attributes)k="index"===i?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,g=f.attributes[i],
+void 0===g.numItems&&(g.numItems=g.array.length),g.buffer=j.createBuffer(),j.bindBuffer(k,g.buffer),j.bufferData(k,g.array,j.STATIC_DRAW)}else if(a instanceof THREE.Mesh){h=a.material;if(void 0===f.geometryGroups){i=f;var m,l,n;k={};var p=i.morphTargets.length,q=i.morphNormals.length,t=h instanceof THREE.MeshFaceMaterial;i.geometryGroups={};h=0;for(m=i.faces.length;h<m;h++)l=i.faces[h],l=t?l.materialIndex:0,void 0===k[l]&&(k[l]={hash:l,counter:0}),n=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[n]&&
+(i.geometryGroups[n]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:p,numMorphNormals:q}),65535<i.geometryGroups[n].vertices+3&&(k[l].counter+=1,n=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[n]&&(i.geometryGroups[n]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:p,numMorphNormals:q})),i.geometryGroups[n].faces3.push(h),i.geometryGroups[n].vertices+=3;i.geometryGroupsList=[];for(g in i.geometryGroups)i.geometryGroups[g].id=V++,i.geometryGroupsList.push(i.geometryGroups[g])}for(e in f.geometryGroups)if(g=
+f.geometryGroups[e],!g.__webglVertexBuffer){i=g;i.__webglVertexBuffer=j.createBuffer();i.__webglNormalBuffer=j.createBuffer();i.__webglTangentBuffer=j.createBuffer();i.__webglColorBuffer=j.createBuffer();i.__webglUVBuffer=j.createBuffer();i.__webglUV2Buffer=j.createBuffer();i.__webglSkinIndicesBuffer=j.createBuffer();i.__webglSkinWeightsBuffer=j.createBuffer();i.__webglFaceBuffer=j.createBuffer();i.__webglLineBuffer=j.createBuffer();p=k=void 0;if(i.numMorphTargets){i.__webglMorphTargetsBuffers=[];
+k=0;for(p=i.numMorphTargets;k<p;k++)i.__webglMorphTargetsBuffers.push(j.createBuffer())}if(i.numMorphNormals){i.__webglMorphNormalsBuffers=[];k=0;for(p=i.numMorphNormals;k<p;k++)i.__webglMorphNormalsBuffers.push(j.createBuffer())}K.info.memory.geometries++;c(g,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=!0}}else a instanceof THREE.Ribbon?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=
+j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),g.__webglNormalBuffer=j.createBuffer(),K.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__normalArray=new Float32Array(3*i),g.__webglVertexCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.normalsNeedUpdate=!0):a instanceof THREE.Line?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),g.__webglLineDistanceBuffer=
+j.createBuffer(),K.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__lineDistanceArray=new Float32Array(1*i),g.__webglLineCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),K.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*
+i),g.__colorArray=new Float32Array(3*i),g.__sortArray=[],g.__webglParticleCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)r(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=f.geometryGroups[e],r(d.__webglObjects,g,a)}else a instanceof THREE.Ribbon||a instanceof THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,r(d.__webglObjects,f,a)):
+a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?d.__webglObjectsImmediate.push({id:null,object:a,opaque:null,transparent:null,z:0}):a instanceof THREE.Sprite?d.__webglSprites.push(a):a instanceof THREE.LensFlare&&d.__webglFlares.push(a);a.__webglActive=!0}}function r(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function p(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 s(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Ribbon||a instanceof THREE.Line?u(b.__webglObjects,a):a instanceof THREE.Sprite?w(b.__webglSprites,a):a instanceof THREE.LensFlare?w(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&u(b.__webglObjectsImmediate,a);delete a.__webglActive}function u(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 E(a,b,c,d,e){aa=0;d.needsUpdate&&(d.program&&Ob(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!==Fa&&(j.useProgram(g),Fa=g,f=!0);d.id!==Ea&&(Ea=d.id,f=!0);if(f||a!==fa)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==fa&&(fa=a);if(d.skinning)if(Eb&&e.useVertexTexture){if(null!==h.boneTexture){var k=
+C();j.uniform1i(h.boneTexture,k);K.setTexture(e.boneTexture,k)}}else null!==h.boneGlobalMatrices&&j.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(wa){for(var m,l=k=0,n=0,p,q,t,s=Ra,r=s.directional.colors,u=s.directional.positions,
+w=s.point.colors,v=s.point.positions,y=s.point.distances,E=s.spot.colors,x=s.spot.positions,D=s.spot.distances,J=s.spot.directions,N=s.spot.anglesCos,O=s.spot.exponents,I=s.hemi.skyColors,V=s.hemi.groundColors,R=s.hemi.positions,M=0,T=0,ea=0,za=0,P=0,wc=0,X=0,W=0,Q=m=0,c=t=Q=0,f=b.length;c<f;c++)m=b[c],m.onlyShadow||(p=m.color,q=m.intensity,t=m.distance,m instanceof THREE.AmbientLight?m.visible&&(K.gammaInput?(k+=p.r*p.r,l+=p.g*p.g,n+=p.b*p.b):(k+=p.r,l+=p.g,n+=p.b)):m instanceof THREE.DirectionalLight?
+(P+=1,m.visible&&(ha.getPositionFromMatrix(m.matrixWorld),ua.getPositionFromMatrix(m.target.matrixWorld),ha.sub(ua),ha.normalize(),0===ha.x&&0===ha.y&&0===ha.z||(m=3*M,u[m]=ha.x,u[m+1]=ha.y,u[m+2]=ha.z,K.gammaInput?F(r,m,p,q*q):z(r,m,p,q),M+=1))):m instanceof THREE.PointLight?(wc+=1,m.visible&&(Q=3*T,K.gammaInput?F(w,Q,p,q*q):z(w,Q,p,q),ua.getPositionFromMatrix(m.matrixWorld),v[Q]=ua.x,v[Q+1]=ua.y,v[Q+2]=ua.z,y[T]=t,T+=1)):m instanceof THREE.SpotLight?(X+=1,m.visible&&(Q=3*ea,K.gammaInput?F(E,Q,p,
+q*q):z(E,Q,p,q),ua.getPositionFromMatrix(m.matrixWorld),x[Q]=ua.x,x[Q+1]=ua.y,x[Q+2]=ua.z,D[ea]=t,ha.copy(ua),ua.getPositionFromMatrix(m.target.matrixWorld),ha.sub(ua),ha.normalize(),J[Q]=ha.x,J[Q+1]=ha.y,J[Q+2]=ha.z,N[ea]=Math.cos(m.angle),O[ea]=m.exponent,ea+=1)):m instanceof THREE.HemisphereLight&&(W+=1,m.visible&&(ha.getPositionFromMatrix(m.matrixWorld),ha.normalize(),0===ha.x&&0===ha.y&&0===ha.z||(t=3*za,R[t]=ha.x,R[t+1]=ha.y,R[t+2]=ha.z,p=m.color,m=m.groundColor,K.gammaInput?(q*=q,F(I,t,p,q),
+F(V,t,m,q)):(z(I,t,p,q),z(V,t,m,q)),za+=1))));c=3*M;for(f=Math.max(r.length,3*P);c<f;c++)r[c]=0;c=3*T;for(f=Math.max(w.length,3*wc);c<f;c++)w[c]=0;c=3*ea;for(f=Math.max(E.length,3*X);c<f;c++)E[c]=0;c=3*za;for(f=Math.max(I.length,3*W);c<f;c++)I[c]=0;c=3*za;for(f=Math.max(V.length,3*W);c<f;c++)V[c]=0;s.directional.length=M;s.point.length=T;s.spot.length=ea;s.hemi.length=za;s.ambient[0]=k;s.ambient[1]=l;s.ambient[2]=n;wa=!1}c=Ra;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=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));
+var Z;d.map?Z=d.map:d.specularMap?Z=d.specularMap:d.normalMap?Z=d.normalMap:d.bumpMap&&(Z=d.bumpMap);void 0!==Z&&(c=Z.offset,Z=Z.repeat,i.offsetRepeat.value.set(c.x,c.y,Z.x,Z.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?
+(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity,i.dashSize.value=d.dashSize,i.totalSize.value=d.dashSize+d.gapSize,i.scale.value=d.scale):d instanceof THREE.ParticleBasicMaterial?(i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=G.height/2,i.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,K.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),
+i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(K.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?
+(i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(i.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=Z=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[Z]=k.shadowMap,i.shadowMapSize.value[Z]=k.shadowMapSize,i.shadowMatrix.value[Z]=k.shadowMatrix,i.shadowDarkness.value[Z]=k.shadowDarkness,i.shadowBias.value[Z]=
+k.shadowBias,Z++}b=d.uniformsList;i=0;for(Z=b.length;i<Z;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],l=c.type,k=c.value,"i"===l)j.uniform1i(f,k);else if("f"===l)j.uniform1f(f,k);else if("v2"===l)j.uniform2f(f,k.x,k.y);else if("v3"===l)j.uniform3f(f,k.x,k.y,k.z);else if("v4"===l)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===l)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===l)j.uniform1iv(f,k);else if("iv"===l)j.uniform3iv(f,k);else if("fv1"===l)j.uniform1fv(f,k);else if("fv"===l)j.uniform3fv(f,k);else if("v2v"===
+l){void 0===c._array&&(c._array=new Float32Array(2*k.length));l=0;for(n=k.length;l<n;l++)s=2*l,c._array[s]=k[l].x,c._array[s+1]=k[l].y;j.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*k.length));l=0;for(n=k.length;l<n;l++)s=3*l,c._array[s]=k[l].x,c._array[s+1]=k[l].y,c._array[s+2]=k[l].z;j.uniform3fv(f,c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*k.length));l=0;for(n=k.length;l<n;l++)s=4*l,c._array[s]=k[l].x,c._array[s+1]=
+k[l].y,c._array[s+2]=k[l].z,c._array[s+3]=k[l].w;j.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=new Float32Array(16*k.length));l=0;for(n=k.length;l<n;l++)k[l].flattenToArrayOffset(c._array,16*l);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(s=k,k=C(),j.uniform1i(f,k),s)if(s.image instanceof Array&&6===s.image.length){if(c=s,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||
+(c.addEventListener("dispose",Kb),c.image.__webglTextureCube=j.createTexture(),K.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(l=0;6>l;l++)K.autoScaleCubemaps&&!f?(n=k,s=l,r=c.image[l],w=qc,r.width<=w&&r.height<=w||(v=Math.max(r.width,r.height),u=Math.floor(r.width*w/v),w=Math.floor(r.height*w/v),v=document.createElement("canvas"),v.width=
+u,v.height=w,v.getContext("2d").drawImage(r,0,0,r.width,r.height,0,0,u,w),r=v),n[s]=r):k[l]=c.image[l];l=k[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);s=A(c.format);r=A(c.type);B(j.TEXTURE_CUBE_MAP,c,n);for(l=0;6>l;l++)if(f){w=k[l].mipmaps;v=0;for(y=w.length;v<y;v++)u=w[v],j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,v,s,u.width,u.height,0,u.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,s,s,r,k[l]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=
+!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else s instanceof THREE.WebGLRenderTargetCube?(c=s,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):K.setTexture(s,k)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=c.value.length;l<n;l++)c._array[l]=C();j.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)s=c.value[l],k=c._array[l],s&&K.setTexture(s,k)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+
+l);if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)ua.getPositionFromMatrix(a.matrixWorld),j.uniform3f(h.cameraPosition,ua.x,ua.y,ua.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&j.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&j.uniformMatrix3fv(h.normalMatrix,
+!1,e._normalMatrix.elements);null!==h.modelMatrix&&j.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function C(){var a=aa;a>=Wb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Wb);aa+=1;return a}function F(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 z(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function D(a){a!==Aa&&(j.lineWidth(a),Aa=a)}function y(a,b,c){Ha!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),
+Ha=a);if(a&&(Xa!==b||Sa!==c))j.polygonOffset(b,c),Xa=b,Sa=c}function O(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function x(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(O(b)),null):c}function B(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,A(b.wrapS)),
+j.texParameteri(a,j.TEXTURE_WRAP_T,A(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,A(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,A(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,v(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,v(b.minFilter)));if(ya&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,ya.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,
+Xb)),b.__oldAnisotropy=b.anisotropy}function I(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,
+j.RGBA4,b.width,b.height)}function v(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function A(a){if(a===THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;
+if(a===THREE.LinearFilter)return j.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return j.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return j.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return j.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return j.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return j.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return j.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return j.BYTE;if(a===THREE.ShortType)return j.SHORT;
+if(a===THREE.UnsignedShortType)return j.UNSIGNED_SHORT;if(a===THREE.IntType)return j.INT;if(a===THREE.UnsignedIntType)return j.UNSIGNED_INT;if(a===THREE.FloatType)return j.FLOAT;if(a===THREE.AlphaFormat)return j.ALPHA;if(a===THREE.RGBFormat)return j.RGB;if(a===THREE.RGBAFormat)return j.RGBA;if(a===THREE.LuminanceFormat)return j.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return j.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return j.FUNC_ADD;if(a===THREE.SubtractEquation)return j.FUNC_SUBTRACT;if(a===
+THREE.ReverseSubtractEquation)return j.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return j.ZERO;if(a===THREE.OneFactor)return j.ONE;if(a===THREE.SrcColorFactor)return j.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return j.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return j.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return j.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return j.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return j.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return j.DST_COLOR;
+if(a===THREE.OneMinusDstColorFactor)return j.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(void 0!==Ia){if(a===THREE.RGB_S3TC_DXT1_Format)return Ia.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Ia.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Ia.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Ia.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);
+var a=a||{},G=void 0!==a.canvas?a.canvas:document.createElement("canvas"),R=void 0!==a.precision?a.precision:"highp",J=void 0!==a.alpha?a.alpha:!0,ba=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,qa=void 0!==a.antialias?a.antialias:!1,ra=void 0!==a.stencil?a.stencil:!0,N=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,M=new THREE.Color(0),Q=0;void 0!==a.clearColor&&(console.warn("DEPRECATED: clearColor in WebGLRenderer constructor parameters is being removed. Use .setClearColor() instead."),
+M.setHex(a.clearColor));void 0!==a.clearAlpha&&(console.warn("DEPRECATED: clearAlpha in WebGLRenderer constructor parameters is being removed. Use .setClearColor() instead."),Q=a.clearAlpha);this.domElement=G;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=
+this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var K=this,da=[],za=0,Fa=null,ea=null,Ea=-1,Z=null,fa=null,V=0,aa=0,P=-1,T=-1,ma=-1,va=
+-1,ja=-1,Pa=-1,Ja=-1,ga=-1,Ha=null,Xa=null,Sa=null,Aa=null,hb=0,ib=0,tb=0,ub=0,vb=0,jb=0,Ka={},na=new THREE.Frustum,ta=new THREE.Matrix4,kb=new THREE.Matrix4,ua=new THREE.Vector3,ha=new THREE.Vector3,wa=!0,Ra={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},j,Wa,xa,ya,Ia;try{if(!(j=
+G.getContext("experimental-webgl",{alpha:J,premultipliedAlpha:ba,antialias:qa,stencil:ra,preserveDrawingBuffer:N})))throw"Error creating WebGL context.";}catch(Ta){console.error(Ta)}Wa=j.getExtension("OES_texture_float");j.getExtension("OES_texture_float_linear");xa=j.getExtension("OES_standard_derivatives");ya=j.getExtension("EXT_texture_filter_anisotropic")||j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Ia=j.getExtension("WEBGL_compressed_texture_s3tc")||
+j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Wa||console.log("THREE.WebGLRenderer: Float textures not supported.");xa||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");ya||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");Ia||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===j.getShaderPrecisionFormat&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,
+rangeMax:1,precision:1}});j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(M.r,M.g,M.b,Q);this.context=j;var Wb=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),pc=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var qc=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),
+Xb=ya?j.getParameter(ya.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,Ib=0<pc,Eb=Ib&&Wa;Ia&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var rc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),sc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);var tc=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_FLOAT),uc=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,
+j.HIGH_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_INT);var vc=0<rc.precision&&0<tc.precision,Yb=0<sc.precision&&0<uc.precision;"highp"===R&&!vc&&(Yb?(R="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(R="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));
+"mediump"===R&&!Yb&&(R="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return Ib};this.supportsFloatTextures=function(){return Wa};this.supportsStandardDerivatives=function(){return xa};this.supportsCompressedTextureS3TC=function(){return Ia};this.getMaxAnisotropy=function(){return Xb};this.getPrecision=function(){return R};this.setSize=function(a,b,c){G.width=a*this.devicePixelRatio;G.height=b*this.devicePixelRatio;
+1!==this.devicePixelRatio&&!1!==c&&(G.style.width=a+"px",G.style.height=b+"px");this.setViewport(0,0,G.width,G.height)};this.setViewport=function(a,b,c,d){hb=void 0!==a?a:0;ib=void 0!==b?b:0;tb=void 0!==c?c:G.width;ub=void 0!==d?d:G.height;j.viewport(hb,ib,tb,ub)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColor=function(a,b){M.set(a);Q=void 0!==b?b:1;j.clearColor(M.r,M.g,M.b,Q)};this.setClearColorHex=
+function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return M};this.getClearAlpha=function(){return Q};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);
+this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){Fa=null;Ea=Z=ga=Ja=ma=-1;wa=!0;T=P=-1;this.shadowMapPlugin.update(a,b)};var Jb=function(a){a=a.target;a.removeEventListener("dispose",Jb);a.__webglInit=void 0;if(a instanceof THREE.BufferGeometry){var b=a.attributes,c;for(c in b)void 0!==b[c].buffer&&j.deleteBuffer(b[c].buffer)}else{if(void 0!==a.geometryGroups)for(b in a.geometryGroups){c=a.geometryGroups[b];
+if(void 0!==c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(void 0!==c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d])}Nb(c)}Nb(a)}K.info.memory.geometries--},Kb=function(a){a=a.target;a.removeEventListener("dispose",Kb);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));K.info.memory.textures--},
+Lb=function(a){a=a.target;a.removeEventListener("dispose",Lb);if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);else j.deleteFramebuffer(a.__webglFramebuffer),j.deleteRenderbuffer(a.__webglRenderbuffer);K.info.memory.textures--},Mb=function(a){a=a.target;a.removeEventListener("dispose",Mb);Ob(a)},Nb=function(a){void 0!==a.__webglVertexBuffer&&
+j.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&j.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&j.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&j.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&j.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&j.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&j.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&j.deleteBuffer(a.__webglSkinWeightsBuffer);
+void 0!==a.__webglFaceBuffer&&j.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&j.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&j.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)j.deleteBuffer(a.__webglCustomAttributesList[b].buffer)},Ob=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=da.length;a<c;a++)if(d=da[a],d.program===b){d.usedTimes--;0===
+d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=da.length;a<c;a++)d=da[a],d.program!==b&&e.push(d);da=e;j.deleteProgram(b);K.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=j.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=j.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=j.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=j.createBuffer());
+a.hasPositions&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,i,k,l,m,n,p,q=3*a.count;for(p=0;p<q;p+=9)n=a.normalArray,d=n[p],e=n[p+1],f=n[p+2],g=n[p+3],i=n[p+4],l=n[p+5],h=n[p+6],k=n[p+7],m=n[p+8],d=(d+g+h)/
+3,e=(e+i+k)/3,f=(f+l+m)/3,n[p]=d,n[p+1]=e,n[p+2]=f,n[p+3]=d,n[p+4]=e,n[p+5]=f,n[p+6]=d,n[p+7]=e,n[p+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglUvBuffer),j.bufferData(j.ARRAY_BUFFER,a.uvArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.uv),j.vertexAttribPointer(b.attributes.uv,2,j.FLOAT,!1,0,0));a.hasColors&&
+c.vertexColors!==THREE.NoColors&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,a.colorArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.color),j.vertexAttribPointer(b.attributes.color,3,j.FLOAT,!1,0,0));j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var i,k,l,m;i=E(a,b,c,d,f);b=i.attributes;a=e.attributes;c=!1;i=16777215*e.id+2*i.id+(d.wireframe?1:0);i!==Z&&(Z=i,c=!0);c&&g();if(f instanceof
+THREE.Mesh)if(d=a.index){e=e.offsets;1<e.length&&(c=!0);for(var f=0,n=e.length;f<n;f++){var p=e[f].index;if(c){for(k in a)"index"!==k&&(l=b[k],i=a[k],m=i.itemSize,0<=l&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,4*p*m)));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,d.buffer)}j.drawElements(j.TRIANGLES,e[f].count,j.UNSIGNED_SHORT,2*e[f].start);K.info.render.calls++;K.info.render.vertices+=e[f].count;K.info.render.faces+=e[f].count/3}}else{if(c)for(k in a)"index"!==k&&
+(l=b[k],i=a[k],m=i.itemSize,0<=l&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,0)));a=e.attributes.position;j.drawArrays(j.TRIANGLES,0,a.numItems/3);K.info.render.calls++;K.info.render.vertices+=a.numItems/3;K.info.render.faces+=a.numItems/3/3}else if(f instanceof THREE.ParticleSystem){if(c){for(k in a)l=b[k],i=a[k],m=i.itemSize,0<=l&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,0));a=a.position;j.drawArrays(j.POINTS,0,a.numItems/
+3);K.info.render.calls++;K.info.render.points+=a.numItems/3}}else if(f instanceof THREE.Line&&c){for(k in a)l=b[k],i=a[k],m=i.itemSize,0<=l&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,0));k=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES;D(d.linewidth);a=a.position;j.drawArrays(k,0,a.numItems/3);K.info.render.calls++;K.info.render.points+=a.numItems}}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var i,l,c=E(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*
+e.id+2*c.id+(d.wireframe?1:0);c!==Z&&(Z=c,b=!0);b&&g();if(!d.morphTargets&&0<=a.position)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),h(a.position),j.vertexAttribPointer(a.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),h(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),
+h(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var m=0;l=f.morphTargetForcedOrder;for(i=f.morphTargetInfluences;m<d.numSupportedMorphTargets&&m<l.length;)0<=c["morphTarget"+m]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l[m]]),h(c["morphTarget"+m]),j.vertexAttribPointer(c["morphTarget"+m],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l[m]]),h(c["morphNormal"+
+m]),j.vertexAttribPointer(c["morphNormal"+m],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[m]=i[l[m]],m++}else{l=[];i=f.morphTargetInfluences;var n,p=i.length;for(n=0;n<p;n++)m=i[n],0<m&&l.push([m,n]);l.length>d.numSupportedMorphTargets?(l.sort(k),l.length=d.numSupportedMorphTargets):l.length>d.numSupportedMorphNormals?l.sort(k):0===l.length&&l.push([0,0]);for(m=0;m<d.numSupportedMorphTargets;)l[m]?(n=l[m][1],0<=c["morphTarget"+m]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]),
+h(c["morphTarget"+m]),j.vertexAttribPointer(c["morphTarget"+m],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n]),h(c["morphNormal"+m]),j.vertexAttribPointer(c["morphNormal"+m],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[m]=i[n]):f.__webglMorphTargetInfluences[m]=0,m++}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){i=
+0;for(l=e.__webglCustomAttributesList.length;i<l;i++)c=e.__webglCustomAttributesList[i],0<=a[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),h(a[c.buffer.belongsToAttribute]),j.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}0<=a.color&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),h(a.color),j.vertexAttribPointer(a.color,3,j.FLOAT,!1,0,0));0<=a.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),h(a.normal),j.vertexAttribPointer(a.normal,
+3,j.FLOAT,!1,0,0));0<=a.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),h(a.tangent),j.vertexAttribPointer(a.tangent,4,j.FLOAT,!1,0,0));0<=a.uv&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),h(a.uv),j.vertexAttribPointer(a.uv,2,j.FLOAT,!1,0,0));0<=a.uv2&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),h(a.uv2),j.vertexAttribPointer(a.uv2,2,j.FLOAT,!1,0,0));d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),h(a.skinIndex),j.vertexAttribPointer(a.skinIndex,
+4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),h(a.skinWeight),j.vertexAttribPointer(a.skinWeight,4,j.FLOAT,!1,0,0));0<=a.lineDistance&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),h(a.lineDistance),j.vertexAttribPointer(a.lineDistance,1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(D(d.wireframeLinewidth),b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
+e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.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?j.LINE_STRIP:j.LINES,D(d.linewidth),j.drawArrays(f,0,e.__webglLineCount),K.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),K.info.render.calls++,K.info.render.points+=e.__webglParticleCount):f instanceof
+THREE.Ribbon&&(j.drawArrays(j.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,k=a.__lights,p=a.fog;Ea=-1;wa=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);ta.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);na.setFromMatrix(ta);
+this.autoUpdateObjects&&this.initWebGLObjects(a);l(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.id=d,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||na.intersectsObject(g))){var q=g;
+q._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,q.matrixWorld);q._normalMatrix.getNormalMatrix(q._modelViewMatrix);var q=f,s=q.buffer,t=void 0,r=t=void 0,r=q.object.material;if(r instanceof THREE.MeshFaceMaterial)t=s.materialIndex,t=r.materials[t],t.transparent?(q.transparent=t,q.opaque=null):(q.opaque=t,q.transparent=null);else if(t=r)t.transparent?(q.transparent=t,q.opaque=null):(q.opaque=t,q.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(ua.getPositionFromMatrix(g.matrixWorld),
+ua.applyProjection(ta),f.z=ua.z))}this.sortObjects&&h.sort(i);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(g._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,g.matrixWorld),g._normalMatrix.getNormalMatrix(g._modelViewMatrix),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),y(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),m(a.__webglObjects,!1,"",b,k,p,!0,d),n(a.__webglObjectsImmediate,"",b,k,p,!1,d)):(d=null,this.setBlending(THREE.NoBlending),m(a.__webglObjects,!0,"opaque",b,k,p,!1,d),n(a.__webglObjectsImmediate,"opaque",b,k,p,!1,d),m(a.__webglObjects,!1,"transparent",b,k,p,!0,d),n(a.__webglObjectsImmediate,"transparent",b,k,p,!0,d));l(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&
+c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=E(a,b,c,d,e);Z=-1;K.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,
+j,na):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;)t(a.__objectsAdded[0],a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)s(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=0,g=a.__webglObjects.length;b<g;b++){var h=a.__webglObjects[b].object;void 0===h.__webglInit&&(void 0!==h.__webglActive&&
+s(h,a),t(h,a));var i=h,l=i.geometry,m=void 0,n=void 0,r=void 0;if(l instanceof THREE.BufferGeometry){var u=j.DYNAMIC_DRAW,w=!l.dynamic,v=l.attributes,z=void 0,y=void 0;for(z in v)y=v[z],y.needsUpdate&&("index"===z?(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,y.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,y.array,u)):(j.bindBuffer(j.ARRAY_BUFFER,y.buffer),j.bufferData(j.ARRAY_BUFFER,y.array,u)),y.needsUpdate=!1),w&&!y.dynamic&&(y.array=null)}else if(i instanceof THREE.Mesh){for(var E=0,A=l.geometryGroupsList.length;E<
+A;E++)if(m=l.geometryGroupsList[E],r=d(i,m),l.buffersNeedUpdate&&c(m,i),n=r.attributes&&p(r),l.verticesNeedUpdate||l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||n){var x=m,F=i,C=j.DYNAMIC_DRAW,D=!l.dynamic,G=r;if(x.__inittedArrays){var J=e(G),K=G.vertexColors?G.vertexColors:!1,N=f(G),O=J===THREE.SmoothShading,B=void 0,I=void 0,V=void 0,M=void 0,R=void 0,Q=void 0,T=void 0,ea=void 0,za=void 0,Z=void 0,aa=void 0,P=void 0,
+X=void 0,W=void 0,Fa=void 0,fa=void 0,Ea=void 0,ba=void 0,da=void 0,ja=void 0,ga=void 0,ha=void 0,ma=void 0,na=void 0,qa=void 0,ra=void 0,va=void 0,wa=void 0,xa=void 0,Ga=void 0,Ha=void 0,Ja=void 0,Ia=void 0,Pa=void 0,Ua=void 0,Ka=void 0,ya=void 0,Aa=void 0,Sa=void 0,Wa=void 0,fb=0,gb=0,Ra=0,Ta=0,Xa=0,lb=0,Va=0,yb=0,cb=0,sa=0,Ba=0,L=0,Qa=void 0,mb=x.__vertexArray,hb=x.__uvArray,ib=x.__uv2Array,Ab=x.__normalArray,Ya=x.__tangentArray,nb=x.__colorArray,Za=x.__skinIndexArray,$a=x.__skinWeightArray,tb=
+x.__morphTargetsArrays,ub=x.__morphNormalsArrays,vb=x.__webglCustomAttributesList,H=void 0,jb=x.__faceArray,Bb=x.__lineArray,La=F.geometry,Ib=La.elementsNeedUpdate,Eb=La.uvsNeedUpdate,Kb=La.normalsNeedUpdate,Wb=La.tangentsNeedUpdate,Xb=La.colorsNeedUpdate,Yb=La.morphTargetsNeedUpdate,xc=La.vertices,$=x.faces3,ob=La.faces,Jb=La.faceVertexUvs[0],Lb=La.faceVertexUvs[1],yc=La.skinIndices,Zb=La.skinWeights,$b=La.morphTargets,Mb=La.morphNormals;if(La.verticesNeedUpdate){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],
+P=xc[M.a],X=xc[M.b],W=xc[M.c],mb[gb]=P.x,mb[gb+1]=P.y,mb[gb+2]=P.z,mb[gb+3]=X.x,mb[gb+4]=X.y,mb[gb+5]=X.z,mb[gb+6]=W.x,mb[gb+7]=W.y,mb[gb+8]=W.z,gb+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,mb,C)}if(Yb){Ua=0;for(Ka=$b.length;Ua<Ka;Ua++){B=Ba=0;for(I=$.length;B<I;B++)Sa=$[B],M=ob[Sa],P=$b[Ua].vertices[M.a],X=$b[Ua].vertices[M.b],W=$b[Ua].vertices[M.c],ya=tb[Ua],ya[Ba]=P.x,ya[Ba+1]=P.y,ya[Ba+2]=P.z,ya[Ba+3]=X.x,ya[Ba+4]=X.y,ya[Ba+5]=X.z,ya[Ba+6]=W.x,ya[Ba+7]=
+W.y,ya[Ba+8]=W.z,G.morphNormals&&(O?(Wa=Mb[Ua].vertexNormals[Sa],ba=Wa.a,da=Wa.b,ja=Wa.c):ja=da=ba=Mb[Ua].faceNormals[Sa],Aa=ub[Ua],Aa[Ba]=ba.x,Aa[Ba+1]=ba.y,Aa[Ba+2]=ba.z,Aa[Ba+3]=da.x,Aa[Ba+4]=da.y,Aa[Ba+5]=da.z,Aa[Ba+6]=ja.x,Aa[Ba+7]=ja.y,Aa[Ba+8]=ja.z),Ba+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphTargetsBuffers[Ua]);j.bufferData(j.ARRAY_BUFFER,tb[Ua],C);G.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphNormalsBuffers[Ua]),j.bufferData(j.ARRAY_BUFFER,ub[Ua],C))}}if(Zb.length){B=0;for(I=
+$.length;B<I;B++)M=ob[$[B]],na=Zb[M.a],qa=Zb[M.b],ra=Zb[M.c],$a[sa]=na.x,$a[sa+1]=na.y,$a[sa+2]=na.z,$a[sa+3]=na.w,$a[sa+4]=qa.x,$a[sa+5]=qa.y,$a[sa+6]=qa.z,$a[sa+7]=qa.w,$a[sa+8]=ra.x,$a[sa+9]=ra.y,$a[sa+10]=ra.z,$a[sa+11]=ra.w,va=yc[M.a],wa=yc[M.b],xa=yc[M.c],Za[sa]=va.x,Za[sa+1]=va.y,Za[sa+2]=va.z,Za[sa+3]=va.w,Za[sa+4]=wa.x,Za[sa+5]=wa.y,Za[sa+6]=wa.z,Za[sa+7]=wa.w,Za[sa+8]=xa.x,Za[sa+9]=xa.y,Za[sa+10]=xa.z,Za[sa+11]=xa.w,sa+=12;0<sa&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,
+Za,C),j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,$a,C))}if(Xb&&K){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],T=M.vertexColors,ea=M.color,3===T.length&&K===THREE.VertexColors?(ga=T[0],ha=T[1],ma=T[2]):ma=ha=ga=ea,nb[cb]=ga.r,nb[cb+1]=ga.g,nb[cb+2]=ga.b,nb[cb+3]=ha.r,nb[cb+4]=ha.g,nb[cb+5]=ha.b,nb[cb+6]=ma.r,nb[cb+7]=ma.g,nb[cb+8]=ma.b,cb+=9;0<cb&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,nb,C))}if(Wb&&La.hasTangents){B=0;for(I=
+$.length;B<I;B++)M=ob[$[B]],za=M.vertexTangents,Fa=za[0],fa=za[1],Ea=za[2],Ya[Va]=Fa.x,Ya[Va+1]=Fa.y,Ya[Va+2]=Fa.z,Ya[Va+3]=Fa.w,Ya[Va+4]=fa.x,Ya[Va+5]=fa.y,Ya[Va+6]=fa.z,Ya[Va+7]=fa.w,Ya[Va+8]=Ea.x,Ya[Va+9]=Ea.y,Ya[Va+10]=Ea.z,Ya[Va+11]=Ea.w,Va+=12;j.bindBuffer(j.ARRAY_BUFFER,x.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Ya,C)}if(Kb&&J){B=0;for(I=$.length;B<I;B++)if(M=ob[$[B]],R=M.vertexNormals,Q=M.normal,3===R.length&&O)for(Ga=0;3>Ga;Ga++)Ja=R[Ga],Ab[lb]=Ja.x,Ab[lb+1]=Ja.y,Ab[lb+2]=Ja.z,lb+=
+3;else for(Ga=0;3>Ga;Ga++)Ab[lb]=Q.x,Ab[lb+1]=Q.y,Ab[lb+2]=Q.z,lb+=3;j.bindBuffer(j.ARRAY_BUFFER,x.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Ab,C)}if(Eb&&Jb&&N){B=0;for(I=$.length;B<I;B++)if(V=$[B],Z=Jb[V],void 0!==Z)for(Ga=0;3>Ga;Ga++)Ia=Z[Ga],hb[Ra]=Ia.x,hb[Ra+1]=Ia.y,Ra+=2;0<Ra&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,hb,C))}if(Eb&&Lb&&N){B=0;for(I=$.length;B<I;B++)if(V=$[B],aa=Lb[V],void 0!==aa)for(Ga=0;3>Ga;Ga++)Pa=aa[Ga],ib[Ta]=Pa.x,ib[Ta+1]=Pa.y,Ta+=
+2;0<Ta&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,ib,C))}if(Ib){B=0;for(I=$.length;B<I;B++)jb[Xa]=fb,jb[Xa+1]=fb+1,jb[Xa+2]=fb+2,Xa+=3,Bb[yb]=fb,Bb[yb+1]=fb+1,Bb[yb+2]=fb,Bb[yb+3]=fb+2,Bb[yb+4]=fb+1,Bb[yb+5]=fb+2,yb+=6,fb+=3;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,jb,C);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Bb,C)}if(vb){Ga=0;for(Ha=vb.length;Ga<Ha;Ga++)if(H=
+vb[Ga],H.__original.needsUpdate){L=0;if(1===H.size)if(void 0===H.boundTo||"vertices"===H.boundTo){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],H.array[L]=H.value[M.a],H.array[L+1]=H.value[M.b],H.array[L+2]=H.value[M.c],L+=3}else{if("faces"===H.boundTo){B=0;for(I=$.length;B<I;B++)Qa=H.value[$[B]],H.array[L]=Qa,H.array[L+1]=Qa,H.array[L+2]=Qa,L+=3}}else if(2===H.size)if(void 0===H.boundTo||"vertices"===H.boundTo){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],P=H.value[M.a],X=H.value[M.b],W=H.value[M.c],H.array[L]=
+P.x,H.array[L+1]=P.y,H.array[L+2]=X.x,H.array[L+3]=X.y,H.array[L+4]=W.x,H.array[L+5]=W.y,L+=6}else{if("faces"===H.boundTo){B=0;for(I=$.length;B<I;B++)W=X=P=Qa=H.value[$[B]],H.array[L]=P.x,H.array[L+1]=P.y,H.array[L+2]=X.x,H.array[L+3]=X.y,H.array[L+4]=W.x,H.array[L+5]=W.y,L+=6}}else if(3===H.size){var pa;pa="c"===H.type?["r","g","b"]:["x","y","z"];if(void 0===H.boundTo||"vertices"===H.boundTo){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],P=H.value[M.a],X=H.value[M.b],W=H.value[M.c],H.array[L]=P[pa[0]],H.array[L+
+1]=P[pa[1]],H.array[L+2]=P[pa[2]],H.array[L+3]=X[pa[0]],H.array[L+4]=X[pa[1]],H.array[L+5]=X[pa[2]],H.array[L+6]=W[pa[0]],H.array[L+7]=W[pa[1]],H.array[L+8]=W[pa[2]],L+=9}else if("faces"===H.boundTo){B=0;for(I=$.length;B<I;B++)W=X=P=Qa=H.value[$[B]],H.array[L]=P[pa[0]],H.array[L+1]=P[pa[1]],H.array[L+2]=P[pa[2]],H.array[L+3]=X[pa[0]],H.array[L+4]=X[pa[1]],H.array[L+5]=X[pa[2]],H.array[L+6]=W[pa[0]],H.array[L+7]=W[pa[1]],H.array[L+8]=W[pa[2]],L+=9}else if("faceVertices"===H.boundTo){B=0;for(I=$.length;B<
+I;B++)Qa=H.value[$[B]],P=Qa[0],X=Qa[1],W=Qa[2],H.array[L]=P[pa[0]],H.array[L+1]=P[pa[1]],H.array[L+2]=P[pa[2]],H.array[L+3]=X[pa[0]],H.array[L+4]=X[pa[1]],H.array[L+5]=X[pa[2]],H.array[L+6]=W[pa[0]],H.array[L+7]=W[pa[1]],H.array[L+8]=W[pa[2]],L+=9}}else if(4===H.size)if(void 0===H.boundTo||"vertices"===H.boundTo){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],P=H.value[M.a],X=H.value[M.b],W=H.value[M.c],H.array[L]=P.x,H.array[L+1]=P.y,H.array[L+2]=P.z,H.array[L+3]=P.w,H.array[L+4]=X.x,H.array[L+5]=X.y,H.array[L+
+6]=X.z,H.array[L+7]=X.w,H.array[L+8]=W.x,H.array[L+9]=W.y,H.array[L+10]=W.z,H.array[L+11]=W.w,L+=12}else if("faces"===H.boundTo){B=0;for(I=$.length;B<I;B++)W=X=P=Qa=H.value[$[B]],H.array[L]=P.x,H.array[L+1]=P.y,H.array[L+2]=P.z,H.array[L+3]=P.w,H.array[L+4]=X.x,H.array[L+5]=X.y,H.array[L+6]=X.z,H.array[L+7]=X.w,H.array[L+8]=W.x,H.array[L+9]=W.y,H.array[L+10]=W.z,H.array[L+11]=W.w,L+=12}else if("faceVertices"===H.boundTo){B=0;for(I=$.length;B<I;B++)Qa=H.value[$[B]],P=Qa[0],X=Qa[1],W=Qa[2],H.array[L]=
+P.x,H.array[L+1]=P.y,H.array[L+2]=P.z,H.array[L+3]=P.w,H.array[L+4]=X.x,H.array[L+5]=X.y,H.array[L+6]=X.z,H.array[L+7]=X.w,H.array[L+8]=W.x,H.array[L+9]=W.y,H.array[L+10]=W.z,H.array[L+11]=W.w,L+=12}j.bindBuffer(j.ARRAY_BUFFER,H.buffer);j.bufferData(j.ARRAY_BUFFER,H.array,C)}}D&&(delete x.__inittedArrays,delete x.__colorArray,delete x.__normalArray,delete x.__tangentArray,delete x.__uvArray,delete x.__uv2Array,delete x.__faceArray,delete x.__vertexArray,delete x.__lineArray,delete x.__skinIndexArray,
+delete x.__skinWeightArray)}}l.verticesNeedUpdate=!1;l.morphTargetsNeedUpdate=!1;l.elementsNeedUpdate=!1;l.uvsNeedUpdate=!1;l.normalsNeedUpdate=!1;l.colorsNeedUpdate=!1;l.tangentsNeedUpdate=!1;l.buffersNeedUpdate=!1;r.attributes&&q(r)}else if(i instanceof THREE.Ribbon){r=d(i,l);n=r.attributes&&p(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||l.normalsNeedUpdate||n){var ab=l,ac=j.DYNAMIC_DRAW,Pb=void 0,Qb=void 0,Rb=void 0,bc=void 0,ca=void 0,cc=void 0,dc=void 0,ec=void 0,Nb=void 0,Ca=void 0,Fb=void 0,
+ka=void 0,Ma=void 0,Ob=ab.vertices,Ec=ab.colors,Fc=ab.normals,pc=Ob.length,qc=Ec.length,rc=Fc.length,fc=ab.__vertexArray,gc=ab.__colorArray,hc=ab.__normalArray,sc=ab.colorsNeedUpdate,tc=ab.normalsNeedUpdate,zc=ab.__webglCustomAttributesList;if(ab.verticesNeedUpdate){for(Pb=0;Pb<pc;Pb++)bc=Ob[Pb],ca=3*Pb,fc[ca]=bc.x,fc[ca+1]=bc.y,fc[ca+2]=bc.z;j.bindBuffer(j.ARRAY_BUFFER,ab.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,fc,ac)}if(sc){for(Qb=0;Qb<qc;Qb++)cc=Ec[Qb],ca=3*Qb,gc[ca]=cc.r,gc[ca+1]=cc.g,
+gc[ca+2]=cc.b;j.bindBuffer(j.ARRAY_BUFFER,ab.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,gc,ac)}if(tc){for(Rb=0;Rb<rc;Rb++)dc=Fc[Rb],ca=3*Rb,hc[ca]=dc.x,hc[ca+1]=dc.y,hc[ca+2]=dc.z;j.bindBuffer(j.ARRAY_BUFFER,ab.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,hc,ac)}if(zc){ec=0;for(Nb=zc.length;ec<Nb;ec++)if(ka=zc[ec],ka.needsUpdate&&(void 0===ka.boundTo||"vertices"===ka.boundTo)){ca=0;Fb=ka.value.length;if(1===ka.size)for(Ca=0;Ca<Fb;Ca++)ka.array[Ca]=ka.value[Ca];else if(2===ka.size)for(Ca=
+0;Ca<Fb;Ca++)Ma=ka.value[Ca],ka.array[ca]=Ma.x,ka.array[ca+1]=Ma.y,ca+=2;else if(3===ka.size)if("c"===ka.type)for(Ca=0;Ca<Fb;Ca++)Ma=ka.value[Ca],ka.array[ca]=Ma.r,ka.array[ca+1]=Ma.g,ka.array[ca+2]=Ma.b,ca+=3;else for(Ca=0;Ca<Fb;Ca++)Ma=ka.value[Ca],ka.array[ca]=Ma.x,ka.array[ca+1]=Ma.y,ka.array[ca+2]=Ma.z,ca+=3;else if(4===ka.size)for(Ca=0;Ca<Fb;Ca++)Ma=ka.value[Ca],ka.array[ca]=Ma.x,ka.array[ca+1]=Ma.y,ka.array[ca+2]=Ma.z,ka.array[ca+3]=Ma.w,ca+=4;j.bindBuffer(j.ARRAY_BUFFER,ka.buffer);j.bufferData(j.ARRAY_BUFFER,
+ka.array,ac)}}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.normalsNeedUpdate=!1;r.attributes&&q(r)}else if(i instanceof THREE.Line){r=d(i,l);n=r.attributes&&p(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||l.lineDistancesNeedUpdate||n){var bb=l,ic=j.DYNAMIC_DRAW,Sb=void 0,Tb=void 0,Ub=void 0,jc=void 0,oa=void 0,kc=void 0,Gc=bb.vertices,Hc=bb.colors,Ic=bb.lineDistances,uc=Gc.length,vc=Hc.length,Oc=Ic.length,lc=bb.__vertexArray,mc=bb.__colorArray,Jc=bb.__lineDistanceArray,Pc=bb.colorsNeedUpdate,
+Qc=bb.lineDistancesNeedUpdate,Ac=bb.__webglCustomAttributesList,nc=void 0,Kc=void 0,Da=void 0,Gb=void 0,Na=void 0,la=void 0;if(bb.verticesNeedUpdate){for(Sb=0;Sb<uc;Sb++)jc=Gc[Sb],oa=3*Sb,lc[oa]=jc.x,lc[oa+1]=jc.y,lc[oa+2]=jc.z;j.bindBuffer(j.ARRAY_BUFFER,bb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,lc,ic)}if(Pc){for(Tb=0;Tb<vc;Tb++)kc=Hc[Tb],oa=3*Tb,mc[oa]=kc.r,mc[oa+1]=kc.g,mc[oa+2]=kc.b;j.bindBuffer(j.ARRAY_BUFFER,bb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,mc,ic)}if(Qc){for(Ub=0;Ub<
+Oc;Ub++)Jc[Ub]=Ic[Ub];j.bindBuffer(j.ARRAY_BUFFER,bb.__webglLineDistanceBuffer);j.bufferData(j.ARRAY_BUFFER,Jc,ic)}if(Ac){nc=0;for(Kc=Ac.length;nc<Kc;nc++)if(la=Ac[nc],la.needsUpdate&&(void 0===la.boundTo||"vertices"===la.boundTo)){oa=0;Gb=la.value.length;if(1===la.size)for(Da=0;Da<Gb;Da++)la.array[Da]=la.value[Da];else if(2===la.size)for(Da=0;Da<Gb;Da++)Na=la.value[Da],la.array[oa]=Na.x,la.array[oa+1]=Na.y,oa+=2;else if(3===la.size)if("c"===la.type)for(Da=0;Da<Gb;Da++)Na=la.value[Da],la.array[oa]=
+Na.r,la.array[oa+1]=Na.g,la.array[oa+2]=Na.b,oa+=3;else for(Da=0;Da<Gb;Da++)Na=la.value[Da],la.array[oa]=Na.x,la.array[oa+1]=Na.y,la.array[oa+2]=Na.z,oa+=3;else if(4===la.size)for(Da=0;Da<Gb;Da++)Na=la.value[Da],la.array[oa]=Na.x,la.array[oa+1]=Na.y,la.array[oa+2]=Na.z,la.array[oa+3]=Na.w,oa+=4;j.bindBuffer(j.ARRAY_BUFFER,la.buffer);j.bufferData(j.ARRAY_BUFFER,la.array,ic)}}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.lineDistancesNeedUpdate=!1;r.attributes&&q(r)}else if(i instanceof THREE.ParticleSystem){r=
+d(i,l);n=r.attributes&&p(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||i.sortParticles||n){var pb=l,Bc=j.DYNAMIC_DRAW,Vb=i,Oa=void 0,qb=void 0,rb=void 0,U=void 0,sb=void 0,zb=void 0,oc=pb.vertices,Cc=oc.length,Dc=pb.colors,Lc=Dc.length,Cb=pb.__vertexArray,Db=pb.__colorArray,wb=pb.__sortArray,Mc=pb.verticesNeedUpdate,Nc=pb.colorsNeedUpdate,xb=pb.__webglCustomAttributesList,db=void 0,Hb=void 0,Y=void 0,eb=void 0,ia=void 0,S=void 0;if(Vb.sortParticles){kb.copy(ta);kb.multiply(Vb.matrixWorld);for(Oa=
+0;Oa<Cc;Oa++)rb=oc[Oa],ua.copy(rb),ua.applyProjection(kb),wb[Oa]=[ua.z,Oa];wb.sort(k);for(Oa=0;Oa<Cc;Oa++)rb=oc[wb[Oa][1]],U=3*Oa,Cb[U]=rb.x,Cb[U+1]=rb.y,Cb[U+2]=rb.z;for(qb=0;qb<Lc;qb++)U=3*qb,zb=Dc[wb[qb][1]],Db[U]=zb.r,Db[U+1]=zb.g,Db[U+2]=zb.b;if(xb){db=0;for(Hb=xb.length;db<Hb;db++)if(S=xb[db],void 0===S.boundTo||"vertices"===S.boundTo)if(U=0,eb=S.value.length,1===S.size)for(Y=0;Y<eb;Y++)sb=wb[Y][1],S.array[Y]=S.value[sb];else if(2===S.size)for(Y=0;Y<eb;Y++)sb=wb[Y][1],ia=S.value[sb],S.array[U]=
+ia.x,S.array[U+1]=ia.y,U+=2;else if(3===S.size)if("c"===S.type)for(Y=0;Y<eb;Y++)sb=wb[Y][1],ia=S.value[sb],S.array[U]=ia.r,S.array[U+1]=ia.g,S.array[U+2]=ia.b,U+=3;else for(Y=0;Y<eb;Y++)sb=wb[Y][1],ia=S.value[sb],S.array[U]=ia.x,S.array[U+1]=ia.y,S.array[U+2]=ia.z,U+=3;else if(4===S.size)for(Y=0;Y<eb;Y++)sb=wb[Y][1],ia=S.value[sb],S.array[U]=ia.x,S.array[U+1]=ia.y,S.array[U+2]=ia.z,S.array[U+3]=ia.w,U+=4}}else{if(Mc)for(Oa=0;Oa<Cc;Oa++)rb=oc[Oa],U=3*Oa,Cb[U]=rb.x,Cb[U+1]=rb.y,Cb[U+2]=rb.z;if(Nc)for(qb=
+0;qb<Lc;qb++)zb=Dc[qb],U=3*qb,Db[U]=zb.r,Db[U+1]=zb.g,Db[U+2]=zb.b;if(xb){db=0;for(Hb=xb.length;db<Hb;db++)if(S=xb[db],S.needsUpdate&&(void 0===S.boundTo||"vertices"===S.boundTo))if(eb=S.value.length,U=0,1===S.size)for(Y=0;Y<eb;Y++)S.array[Y]=S.value[Y];else if(2===S.size)for(Y=0;Y<eb;Y++)ia=S.value[Y],S.array[U]=ia.x,S.array[U+1]=ia.y,U+=2;else if(3===S.size)if("c"===S.type)for(Y=0;Y<eb;Y++)ia=S.value[Y],S.array[U]=ia.r,S.array[U+1]=ia.g,S.array[U+2]=ia.b,U+=3;else for(Y=0;Y<eb;Y++)ia=S.value[Y],
+S.array[U]=ia.x,S.array[U+1]=ia.y,S.array[U+2]=ia.z,U+=3;else if(4===S.size)for(Y=0;Y<eb;Y++)ia=S.value[Y],S.array[U]=ia.x,S.array[U+1]=ia.y,S.array[U+2]=ia.z,S.array[U+3]=ia.w,U+=4}}if(Mc||Vb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,pb.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,Cb,Bc);if(Nc||Vb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,pb.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Db,Bc);if(xb){db=0;for(Hb=xb.length;db<Hb;db++)if(S=xb[db],S.needsUpdate||Vb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,
+S.buffer),j.bufferData(j.ARRAY_BUFFER,S.array,Bc)}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;r.attributes&&q(r)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",Mb);var i,k,l,m,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof THREE.LineBasicMaterial?n="basic":
+a instanceof THREE.LineDashedMaterial?n="dashed":a instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q=e=0,t=0;f=p=0;for(var s=b.length;f<s;f++)g=b[f],g.onlyShadow||(g instanceof THREE.DirectionalLight&&e++,g instanceof THREE.PointLight&&q++,g instanceof THREE.SpotLight&&t++,g instanceof THREE.HemisphereLight&&p++);f=q;g=t;h=p;t=p=0;for(q=b.length;t<
+q;t++)s=b[t],s.castShadow&&(s instanceof THREE.SpotLight&&p++,s instanceof THREE.DirectionalLight&&!s.shadowCascade&&p++);m=p;Eb&&d&&d.useVertexTexture?l=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),l=b);a:{var t=a.fragmentShader,q=a.vertexShader,p=a.uniforms,
+b=a.attributes,s=a.defines,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:l,useVertexTexture:Eb&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,
+maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},r,u,w,d=[];n?d.push(n):(d.push(t),d.push(q));for(u in s)d.push(u),d.push(s[u]);
+for(r in c)d.push(r),d.push(c[r]);n=d.join();r=0;for(u=da.length;r<u;r++)if(d=da[r],d.code===n){d.usedTimes++;k=d.program;break a}r="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?r="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(r="SHADOWMAP_TYPE_PCF_SOFT");u=[];for(w in s)d=s[w],!1!==d&&(d="#define "+w+" "+d,u.push(d));d=u.join("\n");w=j.createProgram();u=["precision "+R+" float;","precision "+R+" int;",d,Ib?"#define VERTEX_TEXTURES":"",K.gammaInput?"#define GAMMA_INPUT":
+"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":
+"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?
+"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+r:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+r=["precision "+R+" float;","precision "+R+" int;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",d,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",K.gammaInput?"#define GAMMA_INPUT":"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
 "",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":
-"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+s:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=x("vertex",u+q);s=x("fragment",s+r);j.attachShader(w,u);j.attachShader(w,s);j.linkProgram(w);j.getProgramParameter(w,j.LINK_STATUS)||(console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(w,j.VALIDATE_STATUS)+", gl error ["+
-j.getError()+"]"),console.error("Program Info Log: "+j.getProgramInfoLog(w)));j.deleteShader(s);j.deleteShader(u);w.uniforms={};w.attributes={};var v;s="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?s.push("boneTexture"):s.push("boneGlobalMatrices");for(v in p)s.push(v);v=s;s=0;for(u=v.length;s<u;s++)p=v[s],w.uniforms[p]=j.getUniformLocation(w,p);s="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");
-for(v=0;v<c.maxMorphTargets;v++)s.push("morphTarget"+v);for(v=0;v<c.maxMorphNormals;v++)s.push("morphNormal"+v);for(k in b)s.push(k);k=s;v=0;for(b=k.length;v<b;v++)s=k[v],w.attributes[s]=j.getAttribLocation(w,s);w.id=za++;da.push({program:w,code:n,usedTimes:1});K.info.memory.programs=da.length;k=w}a.program=k;v=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)w=b+k,0<=v[w]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=
+"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+r:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=x("vertex",u+q);r=x("fragment",r+t);j.attachShader(w,u);j.attachShader(w,r);j.linkProgram(w);j.getProgramParameter(w,j.LINK_STATUS)||(console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(w,j.VALIDATE_STATUS)+", gl error ["+
+j.getError()+"]"),console.error("Program Info Log: "+j.getProgramInfoLog(w)));j.deleteShader(r);j.deleteShader(u);w.uniforms={};w.attributes={};var v;r="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?r.push("boneTexture"):r.push("boneGlobalMatrices");for(v in p)r.push(v);v=r;r=0;for(u=v.length;r<u;r++)p=v[r],w.uniforms[p]=j.getUniformLocation(w,p);r="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");
+for(v=0;v<c.maxMorphTargets;v++)r.push("morphTarget"+v);for(v=0;v<c.maxMorphNormals;v++)r.push("morphNormal"+v);for(k in b)r.push(k);k=r;v=0;for(b=k.length;v<b;v++)r=k[v],w.attributes[r]=j.getAttribLocation(w,r);w.id=za++;da.push({program:w,code:n,usedTimes:1});K.info.memory.programs=da.length;k=w}a.program=k;v=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)w=b+k,0<=v[w]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=
 0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)w=b+k,0<=v[w]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?j.disable(j.CULL_FACE):(b===THREE.FrontFaceDirectionCW?j.frontFace(j.CW):j.frontFace(j.CCW),a===THREE.CullFaceBack?j.cullFace(j.BACK):a===THREE.CullFaceFront?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE))};this.setMaterialFaces=function(a){var b=
 a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;P!==b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),P=b);T!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),T=a)};this.setDepthTest=function(a){Ja!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),Ja=a)};this.setDepthWrite=function(a){ga!==a&&(j.depthMask(a),ga=a)};this.setBlending=function(a,b,c,d){a!==ma&&(a===THREE.NoBlending?j.disable(j.BLEND):a===THREE.AdditiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.SRC_ALPHA,
 j.ONE)):a===THREE.SubtractiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.SRC_COLOR)):a===THREE.CustomBlending?j.enable(j.BLEND):(j.enable(j.BLEND),j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)),ma=a);if(a===THREE.CustomBlending){if(b!==va&&(j.blendEquation(A(b)),va=b),
@@ -501,26 +501,26 @@ b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bind
 THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=null};
 THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,clone:function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;a.shareDepthFrom=this.shareDepthFrom;
 return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};THREE.RenderableFace3=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.material=this.color=null;this.uvs=[[]];this.z=
-0};THREE.RenderableObject=function(){this.id=0;this.object=null;this.z=0};THREE.RenderableParticle=function(){this.id=0;this.object=null;this.z=this.y=this.x=0;this.rotation=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.vertexColors=[new THREE.Color,new THREE.Color];this.material=null;this.z=0};THREE.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,h=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,i=h.vertices,k=a.faces,l=h.faces,a=a.faceVertexUvs[0],h=h.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));for(var b=0,m=i.length;b<m;b++){var n=i[b].clone();d&&n.applyMatrix4(d);g.push(n)}b=0;for(m=l.length;b<m;b++){var n=l[b],t,s,p=n.vertexNormals,q=n.vertexColors;t=new THREE.Face3(n.a+
-f,n.b+f,n.c+f);t.normal.copy(n.normal);e&&t.normal.applyMatrix3(e).normalize();g=0;for(i=p.length;g<i;g++)s=p[g].clone(),e&&s.applyMatrix3(e).normalize(),t.vertexNormals.push(s);t.color.copy(n.color);g=0;for(i=q.length;g<i;g++)s=q[g],t.vertexColors.push(s.clone());t.materialIndex=n.materialIndex+c;t.centroid.copy(n.centroid);d&&t.centroid.applyMatrix4(d);k.push(t)}b=0;for(m=h.length;b<m;b++){c=h[b];d=[];g=0;for(i=c.length;g<i;g++)d.push(new THREE.Vector2(c[g].x,c[g].y));a.push(d)}},removeMaterials:function(a,
+0};THREE.RenderableObject=function(){this.id=0;this.object=null;this.z=0};THREE.RenderableParticle=function(){this.id=0;this.object=null;this.z=this.y=this.x=0;this.rotation=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.vertexColors=[new THREE.Color,new THREE.Color];this.material=null;this.z=0};THREE.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,h=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,i=h.vertices,k=a.faces,l=h.faces,a=a.faceVertexUvs[0],h=h.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));for(var b=0,m=i.length;b<m;b++){var n=i[b].clone();d&&n.applyMatrix4(d);g.push(n)}b=0;for(m=l.length;b<m;b++){var n=l[b],t,r,p=n.vertexNormals,q=n.vertexColors;t=new THREE.Face3(n.a+
+f,n.b+f,n.c+f);t.normal.copy(n.normal);e&&t.normal.applyMatrix3(e).normalize();g=0;for(i=p.length;g<i;g++)r=p[g].clone(),e&&r.applyMatrix3(e).normalize(),t.vertexNormals.push(r);t.color.copy(n.color);g=0;for(i=q.length;g<i;g++)r=q[g],t.vertexColors.push(r.clone());t.materialIndex=n.materialIndex+c;t.centroid.copy(n.centroid);d&&t.centroid.applyMatrix4(d);k.push(t)}b=0;for(m=h.length;b<m;b++){c=h[b];d=[];g=0;for(i=c.length;g<i;g++)d.push(new THREE.Vector2(c[g].x,c[g].y));a.push(d)}},removeMaterials:function(a,
 b){for(var c={},d=0,e=b.length;d<e;d++)c[b[d]]=!0;for(var f,h=[],d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f.materialIndex in c||h.push(f);a.faces=h},randomPointInTriangle:function(){var a=new THREE.Vector3;return function(b,c,d){var e=new THREE.Vector3,f=THREE.Math.random16(),h=THREE.Math.random16();1<f+h&&(f=1-f,h=1-h);var g=1-f-h;e.copy(b);e.multiplyScalar(f);a.copy(c);a.multiplyScalar(h);e.add(a);a.copy(d);a.multiplyScalar(g);e.add(a);return e}}(),randomPointInFace:function(a,b){return THREE.GeometryUtils.randomPointInTriangle(b.vertices[a.a],
 b.vertices[a.b],b.vertices[a.c])},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,h=a.vertices,g=f.length,i=0,k=[],l,m,n;for(e=0;e<g;e++)d=f[e],l=h[d.a],m=h[d.b],n=h[d.c],d._area=THREE.GeometryUtils.triangleArea(l,m,n),i+=d._area,k[e]=i;d=[];for(e=0;e<b;e++)h=THREE.Math.random16()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(f[h],a,!0);return d},triangleArea:function(){var a=
-new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){a.subVectors(d,c);b.subVectors(e,c);a.cross(b);return 0.5*a.length()}}(),center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.addVectors(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},triangulateQuads:function(a){var b,c,d,e,f=[],h=[],g=[];b=0;for(c=a.faceUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)g[b]=
-[];b=0;for(c=a.faces.length;b<c;b++){f.push(a.faces[b]);d=0;for(e=a.faceUvs.length;d<e;d++)h[d].push(a.faceUvs[d][b]);d=0;for(e=a.faceVertexUvs.length;d<e;d++)g[d].push(a.faceVertexUvs[d][b])}a.faces=f;a.faceUvs=h;a.faceVertexUvs=g;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},setMaterialIndex:function(a,b,c,d){a=a.faces;d=d||a.length-1;for(c=c||0;c<=d;c++)a[c].materialIndex=b}};THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b),b=new THREE.ImageLoader;b.crossOrigin=this.crossOrigin;b.load(a,function(a){e.image=a;e.needsUpdate=!0;c&&c(e)});e.sourceFile=a;return e},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=
+new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){a.subVectors(d,c);b.subVectors(e,c);a.cross(b);return 0.5*a.length()}}(),center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.addVectors(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},triangulateQuads:function(a){var b,c,d,e,f=[],h=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){f.push(a.faces[b]);
+d=0;for(e=a.faceVertexUvs.length;d<e;d++)h[d].push(a.faceVertexUvs[d][b])}a.faces=f;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},setMaterialIndex:function(a,b,c,d){a=a.faces;d=d||a.length-1;for(c=c||0;c<=d;c++)a[c].materialIndex=b}};THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,e=new THREE.Texture(d,b),b=new THREE.ImageLoader;b.crossOrigin=this.crossOrigin;b.load(a,function(a){e.image=a;e.needsUpdate=!0;c&&c(e)});e.sourceFile=a;return e},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,h=a.length;b<h;++b){var g=new Image;e[b]=g;g.onload=function(){e.loadCount+=1;6===e.loadCount&&(f.needsUpdate=!0,c&&c(f))};g.onerror=d;g.crossOrigin=this.crossOrigin;g.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;b=function(a,b){return function(){var d=THREE.ImageUtils.parseDDS(a.response,!0);b.format=d.format;b.mipmaps=d.mipmaps;b.width=d.width;b.height=d.height;e.loadCount+=1;6===e.loadCount&&(f.format=d.format,f.needsUpdate=!0,c&&c(f))}};if(a instanceof Array)for(var h=0,g=a.length;h<g;++h){var i={};e[h]=i;var k=new XMLHttpRequest;k.onload=b(k,i);k.onerror=d;i=a[h];k.open("GET",
 i,!0);k.responseType="arraybuffer";k.send(null)}else k=new XMLHttpRequest,k.onload=function(){var a=THREE.ImageUtils.parseDDS(k.response,!0);if(a.isCubemap){for(var b=a.mipmaps.length/a.mipmapCount,d=0;d<b;d++){e[d]={mipmaps:[]};for(var g=0;g<a.mipmapCount;g++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+g]),e[d].format=a.format,e[d].width=a.width,e[d].height=a.height}f.format=a.format;f.needsUpdate=!0;c&&c(f)}},k.onerror=d,k.open("GET",a,!0),k.responseType="arraybuffer",k.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"),h=c("DXT5"),g=new Int32Array(a,0,31);if(542327876!==g[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),d;if(!g[20]&4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),d;var i=g[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 h: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;g[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,g[7]));d.isCubemap=g[28]&512?!0:!1;d.width=g[4];d.height=g[3];for(var g=g[1]+4,f=d.width,h=d.height,i=d.isCubemap?6:1,k=0;k<i;k++){for(var l=0;l<d.mipmapCount;l++){var m=Math.max(4,f)/
 4*Math.max(4,h)/4*e,n={data:new Uint8Array(a,g,m),width:f,height:h};d.mipmaps.push(n);g+=m;f=Math.max(0.5*f,1);h=Math.max(0.5*h,1)}f=d.width;h=d.height}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 h=f.getContext("2d");h.drawImage(a,0,0);for(var g=h.getImageData(0,0,d,e).data,i=h.createImageData(d,e),k=i.data,l=0;l<d;l++)for(var m=
-0;m<e;m++){var n=0>m-1?0:m-1,t=m+1>e-1?e-1:m+1,s=0>l-1?0:l-1,p=l+1>d-1?d-1:l+1,q=[],r=[0,0,g[4*(m*d+l)]/255*b];q.push([-1,0,g[4*(m*d+s)]/255*b]);q.push([-1,-1,g[4*(n*d+s)]/255*b]);q.push([0,-1,g[4*(n*d+l)]/255*b]);q.push([1,-1,g[4*(n*d+p)]/255*b]);q.push([1,0,g[4*(m*d+p)]/255*b]);q.push([1,1,g[4*(t*d+p)]/255*b]);q.push([0,1,g[4*(t*d+l)]/255*b]);q.push([-1,1,g[4*(t*d+s)]/255*b]);n=[];s=q.length;for(t=0;t<s;t++){var p=q[t],u=q[(t+1)%s],p=[p[0]-r[0],p[1]-r[1],p[2]-r[2]],u=[u[0]-r[0],u[1]-r[1],u[2]-r[2]];
-n.push(c([p[1]*u[2]-p[2]*u[1],p[2]*u[0]-p[0]*u[2],p[0]*u[1]-p[1]*u[0]]))}q=[0,0,0];for(t=0;t<n.length;t++)q[0]+=n[t][0],q[1]+=n[t][1],q[2]+=n[t][2];q[0]/=n.length;q[1]/=n.length;q[2]/=n.length;r=4*(m*d+l);k[r]=255*((q[0]+1)/2)|0;k[r+1]=255*((q[1]+1)/2)|0;k[r+2]=255*q[2]|0;k[r+3]=255}h.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),h=Math.floor(255*c.g),c=Math.floor(255*c.b),g=0;g<d;g++)e[3*g]=f,e[3*g+1]=h,e[3*g+2]=c;a=new THREE.DataTexture(e,
+0;m<e;m++){var n=0>m-1?0:m-1,t=m+1>e-1?e-1:m+1,r=0>l-1?0:l-1,p=l+1>d-1?d-1:l+1,q=[],s=[0,0,g[4*(m*d+l)]/255*b];q.push([-1,0,g[4*(m*d+r)]/255*b]);q.push([-1,-1,g[4*(n*d+r)]/255*b]);q.push([0,-1,g[4*(n*d+l)]/255*b]);q.push([1,-1,g[4*(n*d+p)]/255*b]);q.push([1,0,g[4*(m*d+p)]/255*b]);q.push([1,1,g[4*(t*d+p)]/255*b]);q.push([0,1,g[4*(t*d+l)]/255*b]);q.push([-1,1,g[4*(t*d+r)]/255*b]);n=[];r=q.length;for(t=0;t<r;t++){var p=q[t],u=q[(t+1)%r],p=[p[0]-s[0],p[1]-s[1],p[2]-s[2]],u=[u[0]-s[0],u[1]-s[1],u[2]-s[2]];
+n.push(c([p[1]*u[2]-p[2]*u[1],p[2]*u[0]-p[0]*u[2],p[0]*u[1]-p[1]*u[0]]))}q=[0,0,0];for(t=0;t<n.length;t++)q[0]+=n[t][0],q[1]+=n[t][1],q[2]+=n[t][2];q[0]/=n.length;q[1]/=n.length;q[2]/=n.length;s=4*(m*d+l);k[s]=255*((q[0]+1)/2)|0;k[s+1]=255*((q[1]+1)/2)|0;k[s+2]=255*q[2]|0;k[s+3]=255}h.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),h=Math.floor(255*c.g),c=Math.floor(255*c.b),g=0;g<d;g++)e[3*g]=f,e[3*g+1]=h,e[3*g+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.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,h=[],a=0;a<f;a++){var g=new THREE.Path,g=this.extractGlyphPoints(e[a],b,c,d,g),d=d+g.offset;h.push(g.path)}return{paths:h,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],h,g,i,k,l,m,n,t,s,p,q,r=b.glyphs[a]||b.glyphs["?"];if(r){if(r.o){b=r._cachedOutline||(r._cachedOutline=r.o.split(" "));k=b.length;for(a=0;a<k;)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;t=b[a++]*c+d;s=b[a++]*c;e.quadraticCurveTo(t,s,i,l);if(h=f[f.length-1]){m=h.x;n=h.y;h=1;for(g=this.divisions;h<=g;h++){var u=h/g;THREE.Shape.Utils.b2(u,m,t,i);THREE.Shape.Utils.b2(u,n,s,l)}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,t=b[a++]*c+d,s=b[a++]*-c,p=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,l,t,s,p,q),h=f[f.length-1]){m=h.x;n=h.y;h=1;for(g=this.divisions;h<=g;h++)u=h/g,THREE.Shape.Utils.b3(u,m,t,p,i),THREE.Shape.Utils.b3(u,n,s,q,l)}}}return{offset:r.ha*c,path:e}}}};
+0,e=String(a).split(""),f=e.length,h=[],a=0;a<f;a++){var g=new THREE.Path,g=this.extractGlyphPoints(e[a],b,c,d,g),d=d+g.offset;h.push(g.path)}return{paths:h,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],h,g,i,k,l,m,n,t,r,p,q,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));k=b.length;for(a=0;a<k;)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;t=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(t,r,i,l);if(h=f[f.length-1]){m=h.x;n=h.y;h=1;for(g=this.divisions;h<=g;h++){var u=h/g;THREE.Shape.Utils.b2(u,m,t,i);THREE.Shape.Utils.b2(u,n,r,l)}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,t=b[a++]*c+d,r=b[a++]*-c,p=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,l,t,r,p,q),h=f[f.length-1]){m=h.x;n=h.y;h=1;for(g=this.divisions;h<=g;h++)u=h/g,THREE.Shape.Utils.b3(u,m,t,p,i),THREE.Shape.Utils.b3(u,n,r,q,l)}}}return{offset:s.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,h=0;h<b;f=h++)e+=a[f].x*a[h].y-a[h].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],h=[],g=[],i,k,l;if(0<b(a))for(k=0;k<e;k++)h[k]=k;else for(k=0;k<e;k++)h[k]=e-1-k;var m=2*e;for(k=e-1;2<e;){if(0>=m--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var n;a:{var t=n=void 0,s=void 0,p=void 0,q=void 0,r=void 0,u=void 0,w=void 0,E=
-void 0,t=a[h[i]].x,s=a[h[i]].y,p=a[h[k]].x,q=a[h[k]].y,r=a[h[l]].x,u=a[h[l]].y;if(1E-10>(p-t)*(u-s)-(q-s)*(r-t))n=!1;else{var C=void 0,F=void 0,z=void 0,D=void 0,y=void 0,O=void 0,x=void 0,B=void 0,I=void 0,v=void 0,I=B=x=E=w=void 0,C=r-p,F=u-q,z=t-r,D=s-u,y=p-t,O=q-s;for(n=0;n<e;n++)if(!(n===i||n===k||n===l))if(w=a[h[n]].x,E=a[h[n]].y,x=w-t,B=E-s,I=w-p,v=E-q,w-=r,E-=u,I=C*v-F*I,x=y*B-O*x,B=z*E-D*w,0<=I&&0<=B&&0<=x){n=!1;break a}n=!0}}if(n){f.push([a[h[i]],a[h[k]],a[h[l]]]);g.push([h[i],h[k],h[l]]);
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,h=0;h<b;f=h++)e+=a[f].x*a[h].y-a[h].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],h=[],g=[],i,k,l;if(0<b(a))for(k=0;k<e;k++)h[k]=k;else for(k=0;k<e;k++)h[k]=e-1-k;var m=2*e;for(k=e-1;2<e;){if(0>=m--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var n;a:{var t=n=void 0,r=void 0,p=void 0,q=void 0,s=void 0,u=void 0,w=void 0,E=
+void 0,t=a[h[i]].x,r=a[h[i]].y,p=a[h[k]].x,q=a[h[k]].y,s=a[h[l]].x,u=a[h[l]].y;if(1E-10>(p-t)*(u-r)-(q-r)*(s-t))n=!1;else{var C=void 0,F=void 0,z=void 0,D=void 0,y=void 0,O=void 0,x=void 0,B=void 0,I=void 0,v=void 0,I=B=x=E=w=void 0,C=s-p,F=u-q,z=t-s,D=r-u,y=p-t,O=q-r;for(n=0;n<e;n++)if(!(n===i||n===k||n===l))if(w=a[h[n]].x,E=a[h[n]].y,x=w-t,B=E-r,I=w-p,v=E-q,w-=s,E-=u,I=C*v-F*I,x=y*B-O*x,B=z*E-D*w,0<=I&&0<=B&&0<=x){n=!1;break a}n=!0}}if(n){f.push([a[h[i]],a[h[k]],a[h[l]]]);g.push([h[i],h[k],h[l]]);
 i=k;for(l=k+1;l<e;i++,l++)h[i]=h[l];e--;m=2*e}}return d?g:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js;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()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var h=0,g=e-1,i;h<=g;)if(d=Math.floor(h+(g-h)/2),i=c[d]-f,0>i)h=d+1;else if(0<i)g=d-1;else{g=d;break}d=g;if(c[d]==f)return d/(e-1);h=c[d];return c=(d+(f-h)/(c[d+1]-h))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4,a=a+1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()};
@@ -541,17 +541,17 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var h=Array.prototype.s
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,d,e,f){var h=this.actions[this.actions.length-1].args;this.absarc(a+h[h.length-2],b+h[h.length-1],c,d,e,f)};
 THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,h){var g=this.actions[this.actions.length-1].args;this.absellipse(a+g[g.length-2],b+g[g.length-1],c,d,e,f,h)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,h){var g=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(a,b,c,d,e,f,h);this.curves.push(i);i=i.getPoint(h?1:0);g.push(i.x);g.push(i.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:g})};
 THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
-THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);var a=a||12,c=[],d,e,f,h,g,i,k,l,m,n,t,s,p;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],h=f.action,f=f.args,h){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:g=f[2];i=f[3];m=f[0];n=f[1];0<c.length?(h=c[c.length-1],t=h.x,
-s=h.y):(h=this.actions[d-1].args,t=h[h.length-2],s=h[h.length-1]);for(f=1;f<=a;f++)p=f/a,h=THREE.Shape.Utils.b2(p,t,m,g),p=THREE.Shape.Utils.b2(p,s,n,i),c.push(new THREE.Vector2(h,p));break;case THREE.PathActions.BEZIER_CURVE_TO:g=f[4];i=f[5];m=f[0];n=f[1];k=f[2];l=f[3];0<c.length?(h=c[c.length-1],t=h.x,s=h.y):(h=this.actions[d-1].args,t=h[h.length-2],s=h[h.length-1]);for(f=1;f<=a;f++)p=f/a,h=THREE.Shape.Utils.b3(p,t,m,k,g),p=THREE.Shape.Utils.b3(p,s,n,l,i),c.push(new THREE.Vector2(h,p));break;case THREE.PathActions.CSPLINE_THRU:h=
-this.actions[d-1].args;p=[new THREE.Vector2(h[h.length-2],h[h.length-1])];h=a*f[0].length;p=p.concat(f[0]);p=new THREE.SplineCurve(p);for(f=1;f<=h;f++)c.push(p.getPointAt(f/h));break;case THREE.PathActions.ARC:g=f[0];i=f[1];n=f[2];k=f[3];h=f[4];m=!!f[5];t=h-k;s=2*a;for(f=1;f<=s;f++)p=f/s,m||(p=1-p),p=k+p*t,h=g+n*Math.cos(p),p=i+n*Math.sin(p),c.push(new THREE.Vector2(h,p));break;case THREE.PathActions.ELLIPSE:g=f[0];i=f[1];n=f[2];l=f[3];k=f[4];h=f[5];m=!!f[6];t=h-k;s=2*a;for(f=1;f<=s;f++)p=f/s,m||
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);var a=a||12,c=[],d,e,f,h,g,i,k,l,m,n,t,r,p;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],h=f.action,f=f.args,h){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:g=f[2];i=f[3];m=f[0];n=f[1];0<c.length?(h=c[c.length-1],t=h.x,
+r=h.y):(h=this.actions[d-1].args,t=h[h.length-2],r=h[h.length-1]);for(f=1;f<=a;f++)p=f/a,h=THREE.Shape.Utils.b2(p,t,m,g),p=THREE.Shape.Utils.b2(p,r,n,i),c.push(new THREE.Vector2(h,p));break;case THREE.PathActions.BEZIER_CURVE_TO:g=f[4];i=f[5];m=f[0];n=f[1];k=f[2];l=f[3];0<c.length?(h=c[c.length-1],t=h.x,r=h.y):(h=this.actions[d-1].args,t=h[h.length-2],r=h[h.length-1]);for(f=1;f<=a;f++)p=f/a,h=THREE.Shape.Utils.b3(p,t,m,k,g),p=THREE.Shape.Utils.b3(p,r,n,l,i),c.push(new THREE.Vector2(h,p));break;case THREE.PathActions.CSPLINE_THRU:h=
+this.actions[d-1].args;p=[new THREE.Vector2(h[h.length-2],h[h.length-1])];h=a*f[0].length;p=p.concat(f[0]);p=new THREE.SplineCurve(p);for(f=1;f<=h;f++)c.push(p.getPointAt(f/h));break;case THREE.PathActions.ARC:g=f[0];i=f[1];n=f[2];k=f[3];h=f[4];m=!!f[5];t=h-k;r=2*a;for(f=1;f<=r;f++)p=f/r,m||(p=1-p),p=k+p*t,h=g+n*Math.cos(p),p=i+n*Math.sin(p),c.push(new THREE.Vector2(h,p));break;case THREE.PathActions.ELLIPSE:g=f[0];i=f[1];n=f[2];l=f[3];k=f[4];h=f[5];m=!!f[6];t=h-k;r=2*a;for(f=1;f<=r;f++)p=f/r,m||
 (p=1-p),p=k+p*t,h=g+n*Math.cos(p),p=i+l*Math.sin(p),c.push(new THREE.Vector2(h,p))}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
 THREE.Path.prototype.toShapes=function(a){var b,c,d,e,f=[],h=new THREE.Path;b=0;for(c=this.actions.length;b<c;b++)d=this.actions[b],e=d.args,d=d.action,d==THREE.PathActions.MOVE_TO&&0!=h.actions.length&&(f.push(h),h=new THREE.Path),h[d].apply(h,e);0!=h.actions.length&&f.push(h);if(0==f.length)return[];var g;e=[];if(1==f.length)return d=f[0],g=new THREE.Shape,g.actions=d.actions,g.curves=d.curves,e.push(g),e;b=!THREE.Shape.Utils.isClockWise(f[0].getPoints());if(a?!b:b){g=new THREE.Shape;b=0;for(c=
 f.length;b<c;b++)d=f[b],h=THREE.Shape.Utils.isClockWise(d.getPoints()),(h=a?!h:h)?(g.actions=d.actions,g.curves=d.curves,e.push(g),g=new THREE.Shape):g.holes.push(d)}else{g=void 0;b=0;for(c=f.length;b<c;b++)d=f[b],h=THREE.Shape.Utils.isClockWise(d.getPoints()),(h=a?!h:h)?(g&&e.push(g),g=new THREE.Shape,g.actions=d.actions,g.curves=d.curves):g.holes.push(d);e.push(g)}return e};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};
 THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,h,g,i,k,l,m,n,t,s=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){n=k[e];t=[];for(m=0;m<c.length;m++)l=c[m],l=n.distanceToSquared(l),t.push(l),l<f&&(f=l,h=e,g=m)}e=0<=g-1?g-1:c.length-1;f=0<=h-1?h-1:k.length-1;var p=[k[h],c[g],c[e]];m=THREE.FontUtils.Triangulate.area(p);var q=[k[h],k[f],c[g]];n=THREE.FontUtils.Triangulate.area(q);t=g;l=h;g+=1;h+=-1;0>
-g&&(g+=c.length);g%=c.length;0>h&&(h+=k.length);h%=k.length;e=0<=g-1?g-1:c.length-1;f=0<=h-1?h-1:k.length-1;p=[k[h],c[g],c[e]];p=THREE.FontUtils.Triangulate.area(p);q=[k[h],k[f],c[g]];q=THREE.FontUtils.Triangulate.area(q);m+n>p+q&&(g=t,h=l,0>g&&(g+=c.length),g%=c.length,0>h&&(h+=k.length),h%=k.length,e=0<=g-1?g-1:c.length-1,f=0<=h-1?h-1:k.length-1);m=c.slice(0,g);n=c.slice(g);t=k.slice(h);l=k.slice(0,h);f=[k[h],k[f],c[g]];s.push([k[h],c[g],c[e]]);s.push(f);c=m.concat(t).concat(l).concat(n)}return{shape:c,
-isolatedPts:s,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,h,g,i,k={};f=0;for(h=d.length;f<h;f++)i=d[f].x+":"+d[f].y,void 0!==k[i]&&console.log("Duplicate point",i),k[i]=f;f=0;for(h=c.length;f<h;f++){g=c[f];for(d=0;3>d;d++)i=g[d].x+":"+g[d].y,i=k[i],void 0!==i&&(g[d]=i)}f=0;for(h=e.length;f<h;f++){g=e[f];for(d=0;3>d;d++)i=g[d].x+":"+g[d].y,i=k[i],void 0!==i&&(g[d]=i)}return c.concat(e)},
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,h,g,i,k,l,m,n,t,r=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){n=k[e];t=[];for(m=0;m<c.length;m++)l=c[m],l=n.distanceToSquared(l),t.push(l),l<f&&(f=l,h=e,g=m)}e=0<=g-1?g-1:c.length-1;f=0<=h-1?h-1:k.length-1;var p=[k[h],c[g],c[e]];m=THREE.FontUtils.Triangulate.area(p);var q=[k[h],k[f],c[g]];n=THREE.FontUtils.Triangulate.area(q);t=g;l=h;g+=1;h+=-1;0>
+g&&(g+=c.length);g%=c.length;0>h&&(h+=k.length);h%=k.length;e=0<=g-1?g-1:c.length-1;f=0<=h-1?h-1:k.length-1;p=[k[h],c[g],c[e]];p=THREE.FontUtils.Triangulate.area(p);q=[k[h],k[f],c[g]];q=THREE.FontUtils.Triangulate.area(q);m+n>p+q&&(g=t,h=l,0>g&&(g+=c.length),g%=c.length,0>h&&(h+=k.length),h%=k.length,e=0<=g-1?g-1:c.length-1,f=0<=h-1?h-1:k.length-1);m=c.slice(0,g);n=c.slice(g);t=k.slice(h);l=k.slice(0,h);f=[k[h],k[f],c[g]];r.push([k[h],c[g],c[e]]);r.push(f);c=m.concat(t).concat(l).concat(n)}return{shape:c,
+isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,h,g,i,k={};f=0;for(h=d.length;f<h;f++)i=d[f].x+":"+d[f].y,void 0!==k[i]&&console.log("Duplicate point",i),k[i]=f;f=0;for(h=c.length;f<h;f++){g=c[f];for(d=0;3>d;d++)i=g[d].x+":"+g[d].y,i=k[i],void 0!==i&&(g[d]=i)}f=0;for(h=e.length;f<h;f++){g=e[f];for(d=0;3>d;d++)i=g[d].x+":"+g[d].y,i=k[i],void 0!==i&&(g[d]=i)}return c.concat(e)},
 isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
 this.b3p3(a,e)}};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()};THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(b,a)};
 THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);b=new THREE.Vector2(b,a);b.normalize();return b};THREE.CubicBezierCurve=function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d};THREE.CubicBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(b,a)};
@@ -587,31 +587,31 @@ THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;thi
 THREE.CombinedCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);var c=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};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 h=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(h);for(e=0;e<=b;e++){var g=new THREE.Vector3,i=c+e/b*d;g.x=a*Math.cos(i);g.y=a*Math.sin(i);this.vertices.push(g);f.push(new THREE.Vector2((g.x/a+1)/2,(g.y/a+1)/2))}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],h]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function h(a,b,c,d,e,f,h,p){var q,r=g.widthSegments,u=g.heightSegments,w=e/2,E=f/2,C=g.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)q="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)q="y",u=g.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)q="x",r=g.depthSegments;var F=r+1,z=u+1,D=e/r,y=f/u,O=new THREE.Vector3;O[q]=0<h?1:-1;for(e=0;e<z;e++)for(f=0;f<F;f++){var x=new THREE.Vector3;x[a]=(f*D-w)*c;x[b]=(e*y-E)*d;x[q]=h;g.vertices.push(x)}for(e=
-0;e<u;e++)for(f=0;f<r;f++)E=f+F*e,a=f+F*(e+1),b=f+1+F*(e+1),c=f+1+F*e,d=new THREE.Vector2(f/r,1-e/u),h=new THREE.Vector2(f/r,1-(e+1)/u),q=new THREE.Vector2((f+1)/r,1-(e+1)/u),w=new THREE.Vector2((f+1)/r,1-e/u),E=new THREE.Face3(E+C,a+C,c+C),E.normal.copy(O),E.vertexNormals.push(O.clone(),O.clone(),O.clone()),E.materialIndex=p,g.faces.push(E),g.faceVertexUvs[0].push([d,h,w]),E=new THREE.Face3(a+C,b+C,c+C),E.normal.copy(O),E.vertexNormals.push(O.clone(),O.clone(),O.clone()),E.materialIndex=p,g.faces.push(E),
+f[e+1],h]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function h(a,b,c,d,e,f,h,p){var q,s=g.widthSegments,u=g.heightSegments,w=e/2,E=f/2,C=g.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)q="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)q="y",u=g.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)q="x",s=g.depthSegments;var F=s+1,z=u+1,D=e/s,y=f/u,O=new THREE.Vector3;O[q]=0<h?1:-1;for(e=0;e<z;e++)for(f=0;f<F;f++){var x=new THREE.Vector3;x[a]=(f*D-w)*c;x[b]=(e*y-E)*d;x[q]=h;g.vertices.push(x)}for(e=
+0;e<u;e++)for(f=0;f<s;f++)E=f+F*e,a=f+F*(e+1),b=f+1+F*(e+1),c=f+1+F*e,d=new THREE.Vector2(f/s,1-e/u),h=new THREE.Vector2(f/s,1-(e+1)/u),q=new THREE.Vector2((f+1)/s,1-(e+1)/u),w=new THREE.Vector2((f+1)/s,1-e/u),E=new THREE.Face3(E+C,a+C,c+C),E.normal.copy(O),E.vertexNormals.push(O.clone(),O.clone(),O.clone()),E.materialIndex=p,g.faces.push(E),g.faceVertexUvs[0].push([d,h,w]),E=new THREE.Face3(a+C,b+C,c+C),E.normal.copy(O),E.vertexNormals.push(O.clone(),O.clone(),O.clone()),E.materialIndex=p,g.faces.push(E),
 g.faceVertexUvs[0].push([h,q,w])}THREE.Geometry.call(this);var g=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;h("z","y",-1,-1,this.depth,this.height,a,0);h("z","y",1,-1,this.depth,this.height,-a,1);h("x","z",1,1,this.width,this.depth,b,2);h("x","z",1,-1,this.width,this.depth,-b,3);h("x","y",1,-1,this.width,this.height,c,4);h("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);this.radiusTop=a=void 0!==a?a:20;this.radiusBottom=b=void 0!==b?b:20;this.height=c=void 0!==c?c:100;this.radialSegments=d=d||8;this.heightSegments=e=e||1;this.openEnded=f=void 0!==f?f:!1;var h=c/2,g,i,k=[],l=[];for(i=0;i<=e;i++){var m=[],n=[],t=i/e,s=t*(b-a)+a;for(g=0;g<=d;g++){var p=g/d,q=new THREE.Vector3;q.x=s*Math.sin(2*p*Math.PI);q.y=-t*c+h;q.z=s*Math.cos(2*p*Math.PI);this.vertices.push(q);m.push(this.vertices.length-1);n.push(new THREE.Vector2(p,
-1-t))}k.push(m);l.push(n)}c=(b-a)/c;for(g=0;g<d;g++){0!==a?(m=this.vertices[k[0][g]].clone(),n=this.vertices[k[0][g+1]].clone()):(m=this.vertices[k[1][g]].clone(),n=this.vertices[k[1][g+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 t=k[i][g],s=k[i+1][g],p=k[i+1][g+1],q=k[i][g+1],r=m.clone(),u=m.clone(),w=n.clone(),E=n.clone(),C=l[i][g].clone(),F=l[i+1][g].clone(),z=l[i+1][g+1].clone(),D=l[i][g+1].clone();this.faces.push(new THREE.Face3(t,
-s,q,[r,u,E]));this.faceVertexUvs[0].push([C,F,D]);this.faces.push(new THREE.Face3(s,p,q,[u,w,E]));this.faceVertexUvs[0].push([F,z,D])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,h,0));for(g=0;g<d;g++)t=k[0][g],s=k[0][g+1],p=this.vertices.length-1,r=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),C=l[0][g].clone(),F=l[0][g+1].clone(),z=new THREE.Vector2(F.u,0),this.faces.push(new THREE.Face3(t,s,p,[r,u,w])),this.faceVertexUvs[0].push([C,F,z])}if(!1===f&&0<
-b){this.vertices.push(new THREE.Vector3(0,-h,0));for(g=0;g<d;g++)t=k[i][g+1],s=k[i][g],p=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),C=l[i][g+1].clone(),F=l[i][g].clone(),z=new THREE.Vector2(F.u,1),this.faces.push(new THREE.Face3(t,s,p,[r,u,w])),this.faceVertexUvs[0].push([C,F,z])}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)};
+this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.radiusTop=a=void 0!==a?a:20;this.radiusBottom=b=void 0!==b?b:20;this.height=c=void 0!==c?c:100;this.radialSegments=d=d||8;this.heightSegments=e=e||1;this.openEnded=f=void 0!==f?f:!1;var h=c/2,g,i,k=[],l=[];for(i=0;i<=e;i++){var m=[],n=[],t=i/e,r=t*(b-a)+a;for(g=0;g<=d;g++){var p=g/d,q=new THREE.Vector3;q.x=r*Math.sin(2*p*Math.PI);q.y=-t*c+h;q.z=r*Math.cos(2*p*Math.PI);this.vertices.push(q);m.push(this.vertices.length-1);n.push(new THREE.Vector2(p,
+1-t))}k.push(m);l.push(n)}c=(b-a)/c;for(g=0;g<d;g++){0!==a?(m=this.vertices[k[0][g]].clone(),n=this.vertices[k[0][g+1]].clone()):(m=this.vertices[k[1][g]].clone(),n=this.vertices[k[1][g+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 t=k[i][g],r=k[i+1][g],p=k[i+1][g+1],q=k[i][g+1],s=m.clone(),u=m.clone(),w=n.clone(),E=n.clone(),C=l[i][g].clone(),F=l[i+1][g].clone(),z=l[i+1][g+1].clone(),D=l[i][g+1].clone();this.faces.push(new THREE.Face3(t,
+r,q,[s,u,E]));this.faceVertexUvs[0].push([C,F,D]);this.faces.push(new THREE.Face3(r,p,q,[u,w,E]));this.faceVertexUvs[0].push([F,z,D])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,h,0));for(g=0;g<d;g++)t=k[0][g],r=k[0][g+1],p=this.vertices.length-1,s=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),C=l[0][g].clone(),F=l[0][g+1].clone(),z=new THREE.Vector2(F.u,0),this.faces.push(new THREE.Face3(t,r,p,[s,u,w])),this.faceVertexUvs[0].push([C,F,z])}if(!1===f&&0<
+b){this.vertices.push(new THREE.Vector3(0,-h,0));for(g=0;g<d;g++)t=k[i][g+1],r=k[i][g],p=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),C=l[i][g+1].clone(),F=l[i][g].clone(),z=new THREE.Vector2(F.u,1),this.faces.push(new THREE.Face3(t,r,p,[s,u,w])),this.faceVertexUvs[0].push([C,F,z])}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).add(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).add(f);i.copy(a).add(g);if(h.equals(i))return g.clone();
 h.copy(b).add(f);i.copy(c).add(g);f=d.dot(g);g=i.sub(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).add(h).sub(a).clone()}function e(c,d){var e,f;for(N=c.length;0<=--N;){e=N;f=N-1;0>f&&(f=c.length-1);for(var g=0,h=t+2*l,
-g=0;g<h;g++){var i=ba*g,k=ba*(g+1),m=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,s=e,v=f,m=m+B,i=i+B,n=n+B,k=k+B;x.faces.push(new THREE.Face4(m,i,n,k,null,null,u));m=w.generateSideWallUV(x,a,p,b,m,i,n,k,q,r,s,v);x.faceVertexUvs[0].push(m)}}}function f(a,b,c){x.vertices.push(new THREE.Vector3(a,b,c))}function h(c,d,e,f){c+=B;d+=B;e+=B;x.faces.push(new THREE.Face3(c,d,e,null,null,r));c=f?w.generateBottomUV(x,a,b,c,d,e):w.generateTopUV(x,a,b,c,d,e);x.faceVertexUvs[0].push(c)}var g=void 0!==b.amount?b.amount:
-100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=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.curveSegments?b.curveSegments:12,t=void 0!==b.steps?b.steps:1,s=b.extrudePath,p,q=!1,r=b.material,u=b.extrudeMaterial,w=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,E,C,F,z;s&&(p=s.getSpacedPoints(t),q=!0,m=!1,E=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(s,t,
-!1),C=new THREE.Vector3,F=new THREE.Vector3,z=new THREE.Vector3);m||(k=i=l=0);var D,y,O,x=this,B=this.vertices.length,n=a.extractPoints(n),I=n.shape,n=n.holes;if(s=!THREE.Shape.Utils.isClockWise(I)){I=I.reverse();y=0;for(O=n.length;y<O;y++)D=n[y],THREE.Shape.Utils.isClockWise(D)&&(n[y]=D.reverse());s=!1}var v=THREE.Shape.Utils.triangulateShape(I,n),s=I;y=0;for(O=n.length;y<O;y++)D=n[y],I=I.concat(D);var A,G,R,J,ba=I.length,qa=v.length,ra=[],N=0,M=s.length;A=M-1;for(G=N+1;N<M;N++,A++,G++)A===M&&(A=
-0),G===M&&(G=0),ra[N]=d(s[N],s[A],s[G]);var Q=[],K,da=ra.concat();y=0;for(O=n.length;y<O;y++){D=n[y];K=[];N=0;M=D.length;A=M-1;for(G=N+1;N<M;N++,A++,G++)A===M&&(A=0),G===M&&(G=0),K[N]=d(D[N],D[A],D[G]);Q.push(K);da=da.concat(K)}for(A=0;A<l;A++){D=A/l;R=i*(1-D);G=k*Math.sin(D*Math.PI/2);N=0;for(M=s.length;N<M;N++)J=c(s[N],ra[N],G),f(J.x,J.y,-R);y=0;for(O=n.length;y<O;y++){D=n[y];K=Q[y];N=0;for(M=D.length;N<M;N++)J=c(D[N],K[N],G),f(J.x,J.y,-R)}}G=k;for(N=0;N<ba;N++)J=m?c(I[N],da[N],G):I[N],q?(F.copy(E.normals[0]).multiplyScalar(J.x),
-C.copy(E.binormals[0]).multiplyScalar(J.y),z.copy(p[0]).add(F).add(C),f(z.x,z.y,z.z)):f(J.x,J.y,0);for(D=1;D<=t;D++)for(N=0;N<ba;N++)J=m?c(I[N],da[N],G):I[N],q?(F.copy(E.normals[D]).multiplyScalar(J.x),C.copy(E.binormals[D]).multiplyScalar(J.y),z.copy(p[D]).add(F).add(C),f(z.x,z.y,z.z)):f(J.x,J.y,g/t*D);for(A=l-1;0<=A;A--){D=A/l;R=i*(1-D);G=k*Math.sin(D*Math.PI/2);N=0;for(M=s.length;N<M;N++)J=c(s[N],ra[N],G),f(J.x,J.y,g+R);y=0;for(O=n.length;y<O;y++){D=n[y];K=Q[y];N=0;for(M=D.length;N<M;N++)J=c(D[N],
-K[N],G),q?f(J.x,J.y+p[t-1].y,p[t-1].x+R):f(J.x,J.y,g+R)}}if(m){i=0*ba;for(N=0;N<qa;N++)g=v[N],h(g[2]+i,g[1]+i,g[0]+i,!0);i=ba*(t+2*l);for(N=0;N<qa;N++)g=v[N],h(g[0]+i,g[1]+i,g[2]+i,!1)}else{for(N=0;N<qa;N++)g=v[N],h(g[2],g[1],g[0],!0);for(N=0;N<qa;N++)g=v[N],h(g[0]+ba*t,g[1]+ba*t,g[2]+ba*t,!1)}g=0;e(s,g);g+=s.length;y=0;for(O=n.length;y<O;y++)D=n[y],e(D,g),g+=D.length};
+g=0;g<h;g++){var i=ba*g,k=ba*(g+1),m=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,s=e,v=f,m=m+B,i=i+B,n=n+B,k=k+B;x.faces.push(new THREE.Face4(m,i,n,k,null,null,u));m=w.generateSideWallUV(x,a,p,b,m,i,n,k,q,r,s,v);x.faceVertexUvs[0].push(m)}}}function f(a,b,c){x.vertices.push(new THREE.Vector3(a,b,c))}function h(c,d,e,f){c+=B;d+=B;e+=B;x.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?w.generateBottomUV(x,a,b,c,d,e):w.generateTopUV(x,a,b,c,d,e);x.faceVertexUvs[0].push(c)}var g=void 0!==b.amount?b.amount:
+100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=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.curveSegments?b.curveSegments:12,t=void 0!==b.steps?b.steps:1,r=b.extrudePath,p,q=!1,s=b.material,u=b.extrudeMaterial,w=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,E,C,F,z;r&&(p=r.getSpacedPoints(t),q=!0,m=!1,E=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,t,
+!1),C=new THREE.Vector3,F=new THREE.Vector3,z=new THREE.Vector3);m||(k=i=l=0);var D,y,O,x=this,B=this.vertices.length,n=a.extractPoints(n),I=n.shape,n=n.holes;if(r=!THREE.Shape.Utils.isClockWise(I)){I=I.reverse();y=0;for(O=n.length;y<O;y++)D=n[y],THREE.Shape.Utils.isClockWise(D)&&(n[y]=D.reverse());r=!1}var v=THREE.Shape.Utils.triangulateShape(I,n),r=I;y=0;for(O=n.length;y<O;y++)D=n[y],I=I.concat(D);var A,G,R,J,ba=I.length,qa=v.length,ra=[],N=0,M=r.length;A=M-1;for(G=N+1;N<M;N++,A++,G++)A===M&&(A=
+0),G===M&&(G=0),ra[N]=d(r[N],r[A],r[G]);var Q=[],K,da=ra.concat();y=0;for(O=n.length;y<O;y++){D=n[y];K=[];N=0;M=D.length;A=M-1;for(G=N+1;N<M;N++,A++,G++)A===M&&(A=0),G===M&&(G=0),K[N]=d(D[N],D[A],D[G]);Q.push(K);da=da.concat(K)}for(A=0;A<l;A++){D=A/l;R=i*(1-D);G=k*Math.sin(D*Math.PI/2);N=0;for(M=r.length;N<M;N++)J=c(r[N],ra[N],G),f(J.x,J.y,-R);y=0;for(O=n.length;y<O;y++){D=n[y];K=Q[y];N=0;for(M=D.length;N<M;N++)J=c(D[N],K[N],G),f(J.x,J.y,-R)}}G=k;for(N=0;N<ba;N++)J=m?c(I[N],da[N],G):I[N],q?(F.copy(E.normals[0]).multiplyScalar(J.x),
+C.copy(E.binormals[0]).multiplyScalar(J.y),z.copy(p[0]).add(F).add(C),f(z.x,z.y,z.z)):f(J.x,J.y,0);for(D=1;D<=t;D++)for(N=0;N<ba;N++)J=m?c(I[N],da[N],G):I[N],q?(F.copy(E.normals[D]).multiplyScalar(J.x),C.copy(E.binormals[D]).multiplyScalar(J.y),z.copy(p[D]).add(F).add(C),f(z.x,z.y,z.z)):f(J.x,J.y,g/t*D);for(A=l-1;0<=A;A--){D=A/l;R=i*(1-D);G=k*Math.sin(D*Math.PI/2);N=0;for(M=r.length;N<M;N++)J=c(r[N],ra[N],G),f(J.x,J.y,g+R);y=0;for(O=n.length;y<O;y++){D=n[y];K=Q[y];N=0;for(M=D.length;N<M;N++)J=c(D[N],
+K[N],G),q?f(J.x,J.y+p[t-1].y,p[t-1].x+R):f(J.x,J.y,g+R)}}if(m){i=0*ba;for(N=0;N<qa;N++)g=v[N],h(g[2]+i,g[1]+i,g[0]+i,!0);i=ba*(t+2*l);for(N=0;N<qa;N++)g=v[N],h(g[0]+i,g[1]+i,g[2]+i,!1)}else{for(N=0;N<qa;N++)g=v[N],h(g[2],g[1],g[0],!0);for(N=0;N<qa;N++)g=v[N],h(g[0]+ba*t,g[1]+ba*t,g[2]+ba*t,!1)}g=0;e(r,g);g+=r.length;y=0;for(O=n.length;y<O;y++)D=n[y],e(D,g),g+=D.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.Vector2(a.vertices[d].x,a.vertices[d].y),new THREE.Vector2(b,e),new THREE.Vector2(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,h,g){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,k=a.vertices[h].x,
 l=a.vertices[h].y,h=a.vertices[h].z,m=a.vertices[g].x,n=a.vertices[g].y,a=a.vertices[g].z;return 0.01>Math.abs(c-i)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(k,1-h),new THREE.Vector2(m,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(l,1-h),new THREE.Vector2(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;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);!1===a instanceof Array&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
 THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,h,g=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var i=e.shape,k=e.holes;if(!THREE.Shape.Utils.isClockWise(i)){i=i.reverse();e=0;for(f=k.length;e<f;e++)h=k[e],THREE.Shape.Utils.isClockWise(h)&&(k[e]=h.reverse())}var l=THREE.Shape.Utils.triangulateShape(i,k);e=0;for(f=k.length;e<f;e++)h=k[e],
-i=i.concat(h);k=i.length;f=l.length;for(e=0;e<k;e++)h=i[e],this.vertices.push(new THREE.Vector3(h.x,h.y,0));for(e=0;e<f;e++)k=l[e],i=k[0]+g,h=k[1]+g,k=k[2]+g,this.faces.push(new THREE.Face3(i,h,k,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,i,h,k))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var b=b||12,c=c||0,d=d||2*Math.PI,e=1/(a.length-1),f=1/b,h=0,g=b;h<=g;h++)for(var i=c+h*f*d,k=Math.cos(i),l=Math.sin(i),i=0,m=a.length;i<m;i++){var n=a[i],t=new THREE.Vector3;t.x=k*n.x-l*n.y;t.y=l*n.x+k*n.y;t.z=n.z;this.vertices.push(t)}c=a.length;h=0;for(g=b;h<g;h++){i=0;for(m=a.length-1;i<m;i++){var b=l=i+c*h,d=l+c,k=l+1+c,l=l+1,n=h*f,t=i*e,s=n+f,p=t+e;this.faces.push(new THREE.Face3(b,d,l));this.faceVertexUvs[0].push([new THREE.Vector2(n,
-t),new THREE.Vector2(s,t),new THREE.Vector2(n,p)]);this.faces.push(new THREE.Face3(d,k,l));this.faceVertexUvs[0].push([new THREE.Vector2(s,t),new THREE.Vector2(s,p),new THREE.Vector2(n,p)])}}this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.width=a;this.height=b;this.widthSegments=c||1;this.heightSegments=d||1;for(var e=a/2,f=b/2,c=this.widthSegments,d=this.heightSegments,h=c+1,g=d+1,i=this.width/c,k=this.height/d,l=new THREE.Vector3(0,0,1),a=0;a<g;a++)for(b=0;b<h;b++)this.vertices.push(new THREE.Vector3(b*i-e,-(a*k-f),0));for(a=0;a<d;a++)for(b=0;b<c;b++){var m=b+h*a,e=b+h*(a+1),f=b+1+h*(a+1),g=b+1+h*a,i=new THREE.Vector2(b/c,1-a/d),k=new THREE.Vector2(b/c,1-(a+1)/
+i=i.concat(h);k=i.length;f=l.length;for(e=0;e<k;e++)h=i[e],this.vertices.push(new THREE.Vector3(h.x,h.y,0));for(e=0;e<f;e++)k=l[e],i=k[0]+g,h=k[1]+g,k=k[2]+g,this.faces.push(new THREE.Face3(i,h,k,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,i,h,k))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var b=b||12,c=c||0,d=d||2*Math.PI,e=1/(a.length-1),f=1/b,h=0,g=b;h<=g;h++)for(var i=c+h*f*d,k=Math.cos(i),l=Math.sin(i),i=0,m=a.length;i<m;i++){var n=a[i],t=new THREE.Vector3;t.x=k*n.x-l*n.y;t.y=l*n.x+k*n.y;t.z=n.z;this.vertices.push(t)}c=a.length;h=0;for(g=b;h<g;h++){i=0;for(m=a.length-1;i<m;i++){var b=l=i+c*h,d=l+c,k=l+1+c,l=l+1,n=h*f,t=i*e,r=n+f,p=t+e;this.faces.push(new THREE.Face3(b,d,l));this.faceVertexUvs[0].push([new THREE.Vector2(n,
+t),new THREE.Vector2(r,t),new THREE.Vector2(n,p)]);this.faces.push(new THREE.Face3(d,k,l));this.faceVertexUvs[0].push([new THREE.Vector2(r,t),new THREE.Vector2(r,p),new THREE.Vector2(n,p)])}}this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.width=a;this.height=b;this.widthSegments=c||1;this.heightSegments=d||1;for(var e=a/2,f=b/2,c=this.widthSegments,d=this.heightSegments,h=c+1,g=d+1,i=this.width/c,k=this.height/d,l=new THREE.Vector3(0,0,1),a=0;a<g;a++)for(b=0;b<h;b++)this.vertices.push(new THREE.Vector3(b*i-e,-(a*k-f),0));for(a=0;a<d;a++)for(b=0;b<c;b++){var m=b+h*a,e=b+h*(a+1),f=b+1+h*(a+1),g=b+1+h*a,i=new THREE.Vector2(b/c,1-a/d),k=new THREE.Vector2(b/c,1-(a+1)/
 d),n=new THREE.Vector2((b+1)/c,1-(a+1)/d),t=new THREE.Vector2((b+1)/c,1-a/d),m=new THREE.Face3(m,e,g);m.normal.copy(l);m.vertexNormals.push(l.clone(),l.clone(),l.clone());this.faces.push(m);this.faceVertexUvs[0].push([i,k,t]);m=new THREE.Face3(e,f,g);m.normal.copy(l);m.vertexNormals.push(l.clone(),l.clone(),l.clone());this.faces.push(m);this.faceVertexUvs[0].push([k,n,t])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);for(var a=a||0,b=b||50,e=void 0!==e?e:0,f=void 0!==f?f:2*Math.PI,c=void 0!==c?Math.max(3,c):8,d=void 0!==d?Math.max(3,d):8,h=[],g=a,i=(b-a)/d,a=0;a<=d;a++){for(b=0;b<=c;b++){var k=new THREE.Vector3,l=e+b/c*f;k.x=g*Math.cos(l);k.y=g*Math.sin(l);this.vertices.push(k);h.push(new THREE.Vector2((k.x/g+1)/2,-(k.y/g+1)/2+1))}g+=i}e=new THREE.Vector3(0,0,1);for(a=0;a<d;a++){f=a*c;for(b=0;b<=c;b++){var l=b+f,i=l+a,k=l+c+a,m=l+c+1+a;this.faces.push(new THREE.Face3(i,
-k,m,[e,e,e]));this.faceVertexUvs[0].push([h[i],h[k],h[m]]);i=l+a;k=l+c+1+a;m=l+1+a;this.faces.push(new THREE.Face3(i,k,m,[e,e,e]));this.faceVertexUvs[0].push([h[i],h[k],h[m]])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,g)};THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,h){THREE.Geometry.call(this);this.radius=a=a||50;this.widthSegments=b=Math.max(3,Math.floor(b)||8);this.heightSegments=c=Math.max(2,Math.floor(c)||6);this.phiStart=d=void 0!==d?d:0;this.phiLength=e=void 0!==e?e:2*Math.PI;this.thetaStart=f=void 0!==f?f:0;this.thetaLength=h=void 0!==h?h:Math.PI;var g,i,k=[],l=[];for(i=0;i<=c;i++){var m=[],n=[];for(g=0;g<=b;g++){var t=g/b,s=i/c,p=new THREE.Vector3;p.x=-a*Math.cos(d+t*e)*Math.sin(f+s*h);p.y=a*Math.cos(f+s*h);
-p.z=a*Math.sin(d+t*e)*Math.sin(f+s*h);this.vertices.push(p);m.push(this.vertices.length-1);n.push(new THREE.Vector2(t,1-s))}k.push(m);l.push(n)}for(i=0;i<this.heightSegments;i++)for(g=0;g<this.widthSegments;g++){var b=k[i][g+1],c=k[i][g],d=k[i+1][g],e=k[i+1][g+1],f=this.vertices[b].clone().normalize(),h=this.vertices[c].clone().normalize(),m=this.vertices[d].clone().normalize(),n=this.vertices[e].clone().normalize(),t=l[i][g+1].clone(),s=l[i][g].clone(),p=l[i+1][g].clone(),q=l[i+1][g+1].clone();Math.abs(this.vertices[b].y)===
-this.radius?(this.faces.push(new THREE.Face3(b,d,e,[f,m,n])),this.faceVertexUvs[0].push([t,p,q])):Math.abs(this.vertices[d].y)===this.radius?(this.faces.push(new THREE.Face3(b,c,d,[f,h,m])),this.faceVertexUvs[0].push([t,s,p])):(this.faces.push(new THREE.Face3(b,c,e,[f,h,n])),this.faceVertexUvs[0].push([t,s,q]),this.faces.push(new THREE.Face3(c,d,e,[h,m,n])),this.faceVertexUvs[0].push([s,p,q]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,
+k,m,[e,e,e]));this.faceVertexUvs[0].push([h[i],h[k],h[m]]);i=l+a;k=l+c+1+a;m=l+1+a;this.faces.push(new THREE.Face3(i,k,m,[e,e,e]));this.faceVertexUvs[0].push([h[i],h[k],h[m]])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,g)};THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,h){THREE.Geometry.call(this);this.radius=a=a||50;this.widthSegments=b=Math.max(3,Math.floor(b)||8);this.heightSegments=c=Math.max(2,Math.floor(c)||6);this.phiStart=d=void 0!==d?d:0;this.phiLength=e=void 0!==e?e:2*Math.PI;this.thetaStart=f=void 0!==f?f:0;this.thetaLength=h=void 0!==h?h:Math.PI;var g,i,k=[],l=[];for(i=0;i<=c;i++){var m=[],n=[];for(g=0;g<=b;g++){var t=g/b,r=i/c,p=new THREE.Vector3;p.x=-a*Math.cos(d+t*e)*Math.sin(f+r*h);p.y=a*Math.cos(f+r*h);
+p.z=a*Math.sin(d+t*e)*Math.sin(f+r*h);this.vertices.push(p);m.push(this.vertices.length-1);n.push(new THREE.Vector2(t,1-r))}k.push(m);l.push(n)}for(i=0;i<this.heightSegments;i++)for(g=0;g<this.widthSegments;g++){var b=k[i][g+1],c=k[i][g],d=k[i+1][g],e=k[i+1][g+1],f=this.vertices[b].clone().normalize(),h=this.vertices[c].clone().normalize(),m=this.vertices[d].clone().normalize(),n=this.vertices[e].clone().normalize(),t=l[i][g+1].clone(),r=l[i][g].clone(),p=l[i+1][g].clone(),q=l[i+1][g+1].clone();Math.abs(this.vertices[b].y)===
+this.radius?(this.faces.push(new THREE.Face3(b,d,e,[f,m,n])),this.faceVertexUvs[0].push([t,p,q])):Math.abs(this.vertices[d].y)===this.radius?(this.faces.push(new THREE.Face3(b,c,d,[f,h,m])),this.faceVertexUvs[0].push([t,r,p])):(this.faces.push(new THREE.Face3(b,c,e,[f,h,n])),this.faceVertexUvs[0].push([t,r,q]),this.faces.push(new THREE.Face3(c,d,e,[h,m,n])),this.faceVertexUvs[0].push([r,p,q]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,
 a)};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TextGeometry=function(a,b){var b=b||{},c=THREE.FontUtils.generateShapes(a,b);b.amount=void 0!==b.height?b.height:50;void 0===b.bevelThickness&&(b.bevelThickness=10);void 0===b.bevelSize&&(b.bevelSize=8);void 0===b.bevelEnabled&&(b.bevelEnabled=!1);THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||8;this.tubularSegments=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.radialSegments;c++)for(d=0;d<=this.tubularSegments;d++){var f=d/this.tubularSegments*this.arc,h=2*c/this.radialSegments*Math.PI;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var g=new THREE.Vector3;g.x=(this.radius+this.tube*Math.cos(h))*Math.cos(f);g.y=(this.radius+this.tube*
 Math.cos(h))*Math.sin(f);g.z=this.tube*Math.sin(h);this.vertices.push(g);a.push(new THREE.Vector2(d/this.tubularSegments,c/this.radialSegments));b.push(g.clone().sub(e).normalize())}for(c=1;c<=this.radialSegments;c++)for(d=1;d<=this.tubularSegments;d++){var e=(this.tubularSegments+1)*c+d-1,f=(this.tubularSegments+1)*(c-1)+d-1,h=(this.tubularSegments+1)*(c-1)+d,g=(this.tubularSegments+1)*c+d,i=new THREE.Face3(e,f,g,[b[e],b[f],b[g]]);i.normal.add(b[e]);i.normal.add(b[f]);i.normal.add(b[g]);i.normal.normalize();
 this.faces.push(i);this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone()]);i=new THREE.Face3(f,h,g,[b[f],b[h],b[g]]);i.normal.add(b[f]);i.normal.add(b[h]);i.normal.add(b[g]);i.normal.normalize();this.faces.push(i);this.faceVertexUvs[0].push([a[f].clone(),a[h].clone(),a[g].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry=function(a,b,c,d,e,f,h){function g(a,b,c,d,e){var f=Math.cos(a),g=Math.sin(a),a=b/c*a,b=Math.cos(a),f=0.5*(d*(2+b))*f,g=0.5*d*(2+b)*g,d=0.5*e*d*Math.sin(a);return new THREE.Vector3(f,g,d)}THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||64;this.tubularSegments=d||8;this.p=e||2;this.q=f||3;this.heightScale=h||1;this.grid=Array(this.radialSegments);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.radialSegments;++a){this.grid[a]=
@@ -624,9 +624,9 @@ THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THRE
 d).normalize();f[0].crossVectors(e[0],g);h[0].crossVectors(e[0],f[0]);for(k=1;k<b;k++)f[k]=f[k-1].clone(),h[k]=h[k-1].clone(),g.crossVectors(e[k-1],e[k]),1E-4<g.length()&&(g.normalize(),d=Math.acos(THREE.Math.clamp(e[k-1].dot(e[k]),-1,1)),f[k].applyMatrix4(i.makeRotationAxis(g,d))),h[k].crossVectors(e[k],f[k]);if(c){d=Math.acos(THREE.Math.clamp(f[0].dot(f[b-1]),-1,1));d/=b-1;0<e[0].dot(g.crossVectors(f[0],f[b-1]))&&(d=-d);for(k=1;k<b;k++)f[k].applyMatrix4(i.makeRotationAxis(e[k],d*k)),h[k].crossVectors(e[k],
 f[k])}};THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=g.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.Vector2(c,1-a);return b}function f(a,b,c){var d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.add(a).add(b).add(c).divideScalar(3);g.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);g.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),
 h(c.uv,c,d)])}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+0.5,a.y));return a.clone()}THREE.Geometry.call(this);for(var c=c||1,d=d||0,g=this,i=0,k=a.length;i<k;i++)e(new THREE.Vector3(a[i][0],a[i][1],a[i][2]));for(var l=this.vertices,a=[],i=0,k=b.length;i<k;i++){var m=l[b[i][0]],n=l[b[i][1]],t=l[b[i][2]];a[i]=new THREE.Face3(m.index,n.index,t.index,[m.clone(),n.clone(),t.clone()])}i=0;for(k=a.length;i<k;i++){n=a[i];l=d;b=Math.pow(2,
-l);Math.pow(4,l);for(var l=e(g.vertices[n.a]),m=e(g.vertices[n.b]),s=e(g.vertices[n.c]),n=[],t=0;t<=b;t++){n[t]=[];for(var p=e(l.clone().lerp(s,t/b)),q=e(m.clone().lerp(s,t/b)),r=b-t,u=0;u<=r;u++)n[t][u]=0==u&&t==b?p:e(p.clone().lerp(q,u/r))}for(t=0;t<b;t++)for(u=0;u<2*(b-t)-1;u++)l=Math.floor(u/2),0==u%2?f(n[t][l+1],n[t+1][l],n[t][l]):f(n[t][l+1],n[t+1][l+1],n[t+1][l])}i=0;for(k=this.faceVertexUvs[0].length;i<k;i++)d=this.faceVertexUvs[0][i],a=d[0].x,b=d[1].x,l=d[2].x,m=Math.max(a,Math.max(b,l)),
-n=Math.min(a,Math.min(b,l)),0.9<m&&0.1>n&&(0.2>a&&(d[0].x+=1),0.2>b&&(d[1].x+=1),0.2>l&&(d[2].x+=1));i=0;for(k=this.vertices.length;i<k;i++)this.vertices[i].multiplyScalar(c);this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.IcosahedronGeometry=function(a,b){this.radius=a;this.detail=b;var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry=function(a,b,c){THREE.Geometry.call(this);var d=this.vertices,e=this.faces,f=this.faceVertexUvs[0],h,g,i,k,l=b+1;for(h=0;h<=c;h++){k=h/c;for(g=0;g<=b;g++)i=g/b,i=a(i,k),d.push(i)}var m,n,t,s;for(h=0;h<c;h++)for(g=0;g<b;g++)a=h*l+g,d=h*l+g+1,k=(h+1)*l+g+1,i=(h+1)*l+g,m=new THREE.Vector2(g/b,h/c),n=new THREE.Vector2((g+1)/b,h/c),t=new THREE.Vector2((g+1)/b,(h+1)/c),s=new THREE.Vector2(g/b,(h+1)/c),e.push(new THREE.Face3(a,d,i)),f.push([m,n,s]),e.push(new THREE.Face3(d,k,i)),
-f.push([n,t,s]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){var a=a||1,b=new THREE.Geometry;b.vertices.push(new THREE.Vector3,new THREE.Vector3(a,0,0),new THREE.Vector3,new THREE.Vector3(0,a,0),new THREE.Vector3,new THREE.Vector3(0,0,a));b.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));a=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,b,a,THREE.LinePieces)};
+l);Math.pow(4,l);for(var l=e(g.vertices[n.a]),m=e(g.vertices[n.b]),r=e(g.vertices[n.c]),n=[],t=0;t<=b;t++){n[t]=[];for(var p=e(l.clone().lerp(r,t/b)),q=e(m.clone().lerp(r,t/b)),s=b-t,u=0;u<=s;u++)n[t][u]=0==u&&t==b?p:e(p.clone().lerp(q,u/s))}for(t=0;t<b;t++)for(u=0;u<2*(b-t)-1;u++)l=Math.floor(u/2),0==u%2?f(n[t][l+1],n[t+1][l],n[t][l]):f(n[t][l+1],n[t+1][l+1],n[t+1][l])}i=0;for(k=this.faceVertexUvs[0].length;i<k;i++)d=this.faceVertexUvs[0][i],a=d[0].x,b=d[1].x,l=d[2].x,m=Math.max(a,Math.max(b,l)),
+n=Math.min(a,Math.min(b,l)),0.9<m&&0.1>n&&(0.2>a&&(d[0].x+=1),0.2>b&&(d[1].x+=1),0.2>l&&(d[2].x+=1));i=0;for(k=this.vertices.length;i<k;i++)this.vertices[i].multiplyScalar(c);this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.IcosahedronGeometry=function(a,b){this.radius=a;this.detail=b;var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry=function(a,b,c){THREE.Geometry.call(this);var d=this.vertices,e=this.faces,f=this.faceVertexUvs[0],h,g,i,k,l=b+1;for(h=0;h<=c;h++){k=h/c;for(g=0;g<=b;g++)i=g/b,i=a(i,k),d.push(i)}var m,n,t,r;for(h=0;h<c;h++)for(g=0;g<b;g++)a=h*l+g,d=h*l+g+1,k=(h+1)*l+g+1,i=(h+1)*l+g,m=new THREE.Vector2(g/b,h/c),n=new THREE.Vector2((g+1)/b,h/c),t=new THREE.Vector2((g+1)/b,(h+1)/c),r=new THREE.Vector2(g/b,(h+1)/c),e.push(new THREE.Face3(a,d,i)),f.push([m,n,r]),e.push(new THREE.Face3(d,k,i)),
+f.push([n,t,r]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){var a=a||1,b=new THREE.Geometry;b.vertices.push(new THREE.Vector3,new THREE.Vector3(a,0,0),new THREE.Vector3,new THREE.Vector3(0,a,0),new THREE.Vector3,new THREE.Vector3(0,0,a));b.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));a=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,b,a,THREE.LinePieces)};
 THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype);THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);void 0===d&&(d=16776960);void 0===c&&(c=1);this.position=b;b=new THREE.Geometry;b.vertices.push(new THREE.Vector3(0,0,0));b.vertices.push(new THREE.Vector3(0,1,0));this.line=new THREE.Line(b,new THREE.LineBasicMaterial({color:d}));this.line.matrixAutoUpdate=!1;this.add(this.line);b=new THREE.CylinderGeometry(0,0.05,0.25,5,1);b.applyMatrix((new THREE.Matrix4).makeTranslation(0,0.875,0));this.cone=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:d}));
 this.cone.matrixAutoUpdate=!1;this.add(this.cone);this.setDirection(a);this.setLength(c)};THREE.ArrowHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.ArrowHelper.prototype.setDirection=function(){var a=new THREE.Vector3,b;return function(c){0.99999<c.y?this.quaternion.set(0,0,0,1):-0.99999>c.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}();THREE.ArrowHelper.prototype.setLength=function(a){this.scale.set(a,a,a)};
 THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.setHex(a);this.cone.material.color.setHex(a)};THREE.BoxHelper=function(a){var b=[new THREE.Vector3(1,1,1),new THREE.Vector3(-1,1,1),new THREE.Vector3(-1,-1,1),new THREE.Vector3(1,-1,1),new THREE.Vector3(1,1,-1),new THREE.Vector3(-1,1,-1),new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,-1,-1)];this.vertices=b;var c=new THREE.Geometry;c.vertices.push(b[0],b[1],b[1],b[2],b[2],b[3],b[3],b[0],b[4],b[5],b[5],b[6],b[6],b[7],b[7],b[4],b[0],b[4],b[1],b[5],b[2],b[6],b[3],b[7]);THREE.Line.call(this,c,new THREE.LineBasicMaterial({color:16776960}),THREE.LinePieces);
@@ -656,8 +656,8 @@ THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=thi
 THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};
 THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};
 THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),h=d.weight;
-f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*h,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*h;this.morphTargetInfluences[d.lastFrame]=(1-e)*h}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,h,g,i,k,l,m,n,t;this.init=function(s){b=s.context;c=s;d=s.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);s=0;e[s++]=-1;e[s++]=-1;
-e[s++]=0;e[s++]=0;e[s++]=1;e[s++]=-1;e[s++]=1;e[s++]=0;e[s++]=1;e[s++]=1;e[s++]=1;e[s++]=1;e[s++]=-1;e[s++]=1;e[s++]=0;e[s++]=1;s=0;f[s++]=0;f[s++]=1;f[s++]=2;f[s++]=0;f[s++]=2;f[s++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
+f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*h,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*h;this.morphTargetInfluences[d.lastFrame]=(1-e)*h}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,h,g,i,k,l,m,n,t;this.init=function(r){b=r.context;c=r;d=r.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);r=0;e[r++]=-1;e[r++]=-1;
+e[r++]=0;e[r++]=0;e[r++]=1;e[r++]=-1;e[r++]=1;e[r++]=0;e[r++]=1;e[r++]=1;e[r++]=1;e[r++]=1;e[r++]=-1;e[r++]=1;e[r++]=0;e[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
 0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,k);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
 b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(l=!1,m=a(THREE.ShaderFlares.lensFlare,d)):(l=!0,m=a(THREE.ShaderFlares.lensFlareVertexTexture,d));n={};t={};n.vertex=b.getAttribLocation(m,"position");n.uv=b.getAttribLocation(m,"uv");t.renderType=b.getUniformLocation(m,"renderType");t.map=b.getUniformLocation(m,"map");t.occlusionMap=b.getUniformLocation(m,"occlusionMap");t.opacity=
 b.getUniformLocation(m,"opacity");t.color=b.getUniformLocation(m,"color");t.scale=b.getUniformLocation(m,"scale");t.rotation=b.getUniformLocation(m,"rotation");t.screenPosition=b.getUniformLocation(m,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,u=a.length;if(u){var w=new THREE.Vector3,E=f/e,C=0.5*e,F=0.5*f,z=16/f,D=new THREE.Vector2(z*E,z),y=new THREE.Vector3(1,1,0),O=new THREE.Vector2(1,1),x=t,z=n;b.useProgram(m);b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);
@@ -665,29 +665,29 @@ b.uniform1i(x.occlusionMap,0);b.uniform1i(x.map,1);b.bindBuffer(b.ARRAY_BUFFER,h
 O.y=y.y*F+F,l||0<O.x&&O.x<e&&0<O.y&&O.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,O.x-8,O.y-8,16,16,0);b.uniform1i(x.renderType,0);b.uniform2f(x.scale,D.x,D.y);b.uniform3f(x.screenPosition,y.x,y.y,y.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,O.x-8,O.y-8,16,16,0);b.uniform1i(x.renderType,1);b.disable(b.DEPTH_TEST);
 b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);A.positionScreen.copy(y);A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares();b.uniform1i(x.renderType,2);b.enable(b.BLEND);I=0;for(v=A.lensFlares.length;I<v;I++)G=A.lensFlares[I],0.001<G.opacity&&0.001<G.scale&&(y.x=G.x,y.y=G.y,y.z=G.z,z=G.size*G.scale/f,D.x=z*E,D.y=z,b.uniform3f(x.screenPosition,y.x,y.y,y.z),b.uniform2f(x.scale,D.x,D.y),b.uniform1f(x.rotation,G.rotation),b.uniform1f(x.opacity,
 G.opacity),b.uniform3f(x.color,G.color.r,G.color.g,G.color.b),c.setBlending(G.blending,G.blendEquation,G.blendSrc,G.blendDst),c.setTexture(G.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,h=new THREE.Frustum,g=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!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(m,n){var t,s,p,q,r,u,w,E,C,F=[];q=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
-a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);t=0;for(s=m.__lights.length;t<s;t++)if(p=m.__lights[t],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(r=0;r<p.shadowCascadeCount;r++){var z;if(p.shadowCascadeArray[r])z=p.shadowCascadeArray[r];else{C=p;w=r;z=new THREE.DirectionalLight;z.isVirtual=!0;z.onlyShadow=!0;z.castShadow=!0;z.shadowCameraNear=C.shadowCameraNear;z.shadowCameraFar=C.shadowCameraFar;z.shadowCameraLeft=C.shadowCameraLeft;z.shadowCameraRight=C.shadowCameraRight;
+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(m,n){var t,r,p,q,s,u,w,E,C,F=[];q=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
+a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);t=0;for(r=m.__lights.length;t<r;t++)if(p=m.__lights[t],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(s=0;s<p.shadowCascadeCount;s++){var z;if(p.shadowCascadeArray[s])z=p.shadowCascadeArray[s];else{C=p;w=s;z=new THREE.DirectionalLight;z.isVirtual=!0;z.onlyShadow=!0;z.castShadow=!0;z.shadowCameraNear=C.shadowCameraNear;z.shadowCameraFar=C.shadowCameraFar;z.shadowCameraLeft=C.shadowCameraLeft;z.shadowCameraRight=C.shadowCameraRight;
 z.shadowCameraBottom=C.shadowCameraBottom;z.shadowCameraTop=C.shadowCameraTop;z.shadowCameraVisible=C.shadowCameraVisible;z.shadowDarkness=C.shadowDarkness;z.shadowBias=C.shadowCascadeBias[w];z.shadowMapWidth=C.shadowCascadeWidth[w];z.shadowMapHeight=C.shadowCascadeHeight[w];z.pointsWorld=[];z.pointsFrustum=[];E=z.pointsWorld;u=z.pointsFrustum;for(var D=0;8>D;D++)E[D]=new THREE.Vector3,u[D]=new THREE.Vector3;E=C.shadowCascadeNearZ[w];C=C.shadowCascadeFarZ[w];u[0].set(-1,-1,E);u[1].set(1,-1,E);u[2].set(-1,
-1,E);u[3].set(1,1,E);u[4].set(-1,-1,C);u[5].set(1,-1,C);u[6].set(-1,1,C);u[7].set(1,1,C);z.originalCamera=n;u=new THREE.Gyroscope;u.position=p.shadowCascadeOffset;u.add(z);u.add(z.target);n.add(u);p.shadowCascadeArray[r]=z;console.log("Created virtualLight",z)}w=p;E=r;C=w.shadowCascadeArray[E];C.position.copy(w.position);C.target.position.copy(w.target.position);C.lookAt(C.target);C.shadowCameraVisible=w.shadowCameraVisible;C.shadowDarkness=w.shadowDarkness;C.shadowBias=w.shadowCascadeBias[E];u=w.shadowCascadeNearZ[E];
-w=w.shadowCascadeFarZ[E];C=C.pointsFrustum;C[0].z=u;C[1].z=u;C[2].z=u;C[3].z=u;C[4].z=w;C[5].z=w;C[6].z=w;C[7].z=w;F[q]=z;q++}else F[q]=p,q++;t=0;for(s=F.length;t<s;t++){p=F[t];p.shadowMap||(r=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(r=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:r,magFilter:r,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);
+1,E);u[3].set(1,1,E);u[4].set(-1,-1,C);u[5].set(1,-1,C);u[6].set(-1,1,C);u[7].set(1,1,C);z.originalCamera=n;u=new THREE.Gyroscope;u.position=p.shadowCascadeOffset;u.add(z);u.add(z.target);n.add(u);p.shadowCascadeArray[s]=z;console.log("Created virtualLight",z)}w=p;E=s;C=w.shadowCascadeArray[E];C.position.copy(w.position);C.target.position.copy(w.target.position);C.lookAt(C.target);C.shadowCameraVisible=w.shadowCameraVisible;C.shadowDarkness=w.shadowDarkness;C.shadowBias=w.shadowCascadeBias[E];u=w.shadowCascadeNearZ[E];
+w=w.shadowCascadeFarZ[E];C=C.pointsFrustum;C[0].z=u;C[1].z=u;C[2].z=u;C[3].z=u;C[4].z=w;C[5].z=w;C[6].z=w;C[7].z=w;F[q]=z;q++}else F[q]=p,q++;t=0;for(r=F.length;t<r;t++){p=F[t];p.shadowMap||(s=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(s=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:s,magFilter:s,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);
 if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}m.add(p.shadowCamera);!0===m.autoUpdate&&m.updateMatrixWorld()}p.shadowCameraVisible&&
-!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&z.originalCamera==n){r=n;q=p.shadowCamera;u=p.pointsFrustum;C=p.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(w=0;8>w;w++)E=C[w],E.copy(u[w]),THREE.ShadowMapPlugin.__projector.unprojectVector(E,r),E.applyMatrix4(q.matrixWorldInverse),E.x<i.x&&(i.x=E.x),E.x>k.x&&(k.x=E.x),E.y<i.y&&(i.y=E.y),E.y>k.y&&(k.y=E.y),E.z<i.z&&(i.z=E.z),E.z>k.z&&
-(k.z=E.z);q.left=i.x;q.right=k.x;q.top=k.y;q.bottom=i.y;q.updateProjectionMatrix()}q=p.shadowMap;u=p.shadowMatrix;r=p.shadowCamera;r.position.getPositionFromMatrix(p.matrixWorld);l.getPositionFromMatrix(p.target.matrixWorld);r.lookAt(l);r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);p.cameraHelper&&(p.cameraHelper.visible=p.shadowCameraVisible);p.shadowCameraVisible&&p.cameraHelper.update();u.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);u.multiply(r.projectionMatrix);u.multiply(r.matrixWorldInverse);
-g.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(q);b.clear();C=m.__webglObjects;p=0;for(q=C.length;p<q;p++)if(w=C[p],u=w.object,w.render=!1,u.visible&&u.castShadow&&(!(u instanceof THREE.Mesh||u instanceof THREE.ParticleSystem)||!u.frustumCulled||h.intersectsObject(u)))u._modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,u.matrixWorld),w.render=!0;p=0;for(q=C.length;p<q;p++)w=C[p],w.render&&(u=w.object,w=w.buffer,D=u.material instanceof THREE.MeshFaceMaterial?
-u.material.materials[0]:u.material,E=0<u.geometry.morphTargets.length&&D.morphTargets,D=u instanceof THREE.SkinnedMesh&&D.skinning,E=u.customDepthMaterial?u.customDepthMaterial:D?E?f:e:E?d:c,w instanceof THREE.BufferGeometry?b.renderBufferDirect(r,m.__lights,null,E,w,u):b.renderBuffer(r,m.__lights,null,E,w,u));C=m.__webglObjectsImmediate;p=0;for(q=C.length;p<q;p++)w=C[p],u=w.object,u.visible&&u.castShadow&&(u._modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,u.matrixWorld),b.renderImmediateObject(r,
-m.__lights,null,c,u))}t=b.getClearColor();s=b.getClearAlpha();a.clearColor(t.r,t.g,t.b,s);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&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,h,g,i,k,l;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-1;e[a++]=-1;e[a++]=0;e[a++]=0;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,
-e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),t=b.createShader(b.FRAGMENT_SHADER),s=b.createShader(b.VERTEX_SHADER),p="precision "+d+" float;\n";b.shaderSource(t,p+a.fragmentShader);b.shaderSource(s,p+a.vertexShader);b.compileShader(t);b.compileShader(s);b.attachShader(n,t);b.attachShader(n,s);b.linkProgram(n);i=n;k={};l={};k.position=b.getAttribLocation(i,"position");k.uv=b.getAttribLocation(i,
+!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&z.originalCamera==n){s=n;q=p.shadowCamera;u=p.pointsFrustum;C=p.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(w=0;8>w;w++)E=C[w],E.copy(u[w]),THREE.ShadowMapPlugin.__projector.unprojectVector(E,s),E.applyMatrix4(q.matrixWorldInverse),E.x<i.x&&(i.x=E.x),E.x>k.x&&(k.x=E.x),E.y<i.y&&(i.y=E.y),E.y>k.y&&(k.y=E.y),E.z<i.z&&(i.z=E.z),E.z>k.z&&
+(k.z=E.z);q.left=i.x;q.right=k.x;q.top=k.y;q.bottom=i.y;q.updateProjectionMatrix()}q=p.shadowMap;u=p.shadowMatrix;s=p.shadowCamera;s.position.getPositionFromMatrix(p.matrixWorld);l.getPositionFromMatrix(p.target.matrixWorld);s.lookAt(l);s.updateMatrixWorld();s.matrixWorldInverse.getInverse(s.matrixWorld);p.cameraHelper&&(p.cameraHelper.visible=p.shadowCameraVisible);p.shadowCameraVisible&&p.cameraHelper.update();u.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);u.multiply(s.projectionMatrix);u.multiply(s.matrixWorldInverse);
+g.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(q);b.clear();C=m.__webglObjects;p=0;for(q=C.length;p<q;p++)if(w=C[p],u=w.object,w.render=!1,u.visible&&u.castShadow&&(!(u instanceof THREE.Mesh||u instanceof THREE.ParticleSystem)||!u.frustumCulled||h.intersectsObject(u)))u._modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,u.matrixWorld),w.render=!0;p=0;for(q=C.length;p<q;p++)w=C[p],w.render&&(u=w.object,w=w.buffer,D=u.material instanceof THREE.MeshFaceMaterial?
+u.material.materials[0]:u.material,E=0<u.geometry.morphTargets.length&&D.morphTargets,D=u instanceof THREE.SkinnedMesh&&D.skinning,E=u.customDepthMaterial?u.customDepthMaterial:D?E?f:e:E?d:c,w instanceof THREE.BufferGeometry?b.renderBufferDirect(s,m.__lights,null,E,w,u):b.renderBuffer(s,m.__lights,null,E,w,u));C=m.__webglObjectsImmediate;p=0;for(q=C.length;p<q;p++)w=C[p],u=w.object,u.visible&&u.castShadow&&(u._modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,u.matrixWorld),b.renderImmediateObject(s,
+m.__lights,null,c,u))}t=b.getClearColor();r=b.getClearAlpha();a.clearColor(t.r,t.g,t.b,r);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&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,h,g,i,k,l;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-1;e[a++]=-1;e[a++]=0;e[a++]=0;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,
+e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),t=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER),p="precision "+d+" float;\n";b.shaderSource(t,p+a.fragmentShader);b.shaderSource(r,p+a.vertexShader);b.compileShader(t);b.compileShader(r);b.attachShader(n,t);b.attachShader(n,r);b.linkProgram(n);i=n;k={};l={};k.position=b.getAttribLocation(i,"position");k.uv=b.getAttribLocation(i,
 "uv");l.uvOffset=b.getUniformLocation(i,"uvOffset");l.uvScale=b.getUniformLocation(i,"uvScale");l.rotation=b.getUniformLocation(i,"rotation");l.scale=b.getUniformLocation(i,"scale");l.alignment=b.getUniformLocation(i,"alignment");l.color=b.getUniformLocation(i,"color");l.map=b.getUniformLocation(i,"map");l.opacity=b.getUniformLocation(i,"opacity");l.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");l.sizeAttenuation=b.getUniformLocation(i,"sizeAttenuation");l.screenPosition=b.getUniformLocation(i,
-"screenPosition");l.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");l.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");l.fogType=b.getUniformLocation(i,"fogType");l.fogDensity=b.getUniformLocation(i,"fogDensity");l.fogNear=b.getUniformLocation(i,"fogNear");l.fogFar=b.getUniformLocation(i,"fogFar");l.fogColor=b.getUniformLocation(i,"fogColor");l.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,s){var p=d.__webglSprites,q=p.length;if(q){var r=k,u=l,w=s/
-f,f=0.5*f,E=0.5*s;b.useProgram(i);b.enableVertexAttribArray(r.position);b.enableVertexAttribArray(r.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(u.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);var C=r=0,F=d.fog;F?(b.uniform3f(u.fogColor,F.color.r,F.color.g,F.color.b),
-F instanceof THREE.Fog?(b.uniform1f(u.fogNear,F.near),b.uniform1f(u.fogFar,F.far),b.uniform1i(u.fogType,1),C=r=1):F instanceof THREE.FogExp2&&(b.uniform1f(u.fogDensity,F.density),b.uniform1i(u.fogType,2),C=r=2)):(b.uniform1i(u.fogType,0),C=r=0);for(var z,D,y=[],F=0;F<q;F++)z=p[F],D=z.material,z.visible&&0!==D.opacity&&(D.useScreenCoordinates?z.z=-z.position.z:(z._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,z.matrixWorld),z.z=-z._modelViewMatrix.elements[14]));p.sort(a);for(F=0;F<q;F++)z=
+"screenPosition");l.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");l.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");l.fogType=b.getUniformLocation(i,"fogType");l.fogDensity=b.getUniformLocation(i,"fogDensity");l.fogNear=b.getUniformLocation(i,"fogNear");l.fogFar=b.getUniformLocation(i,"fogFar");l.fogColor=b.getUniformLocation(i,"fogColor");l.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,r){var p=d.__webglSprites,q=p.length;if(q){var s=k,u=l,w=r/
+f,f=0.5*f,E=0.5*r;b.useProgram(i);b.enableVertexAttribArray(s.position);b.enableVertexAttribArray(s.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(s.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(s.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(u.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);var C=s=0,F=d.fog;F?(b.uniform3f(u.fogColor,F.color.r,F.color.g,F.color.b),
+F instanceof THREE.Fog?(b.uniform1f(u.fogNear,F.near),b.uniform1f(u.fogFar,F.far),b.uniform1i(u.fogType,1),C=s=1):F instanceof THREE.FogExp2&&(b.uniform1f(u.fogDensity,F.density),b.uniform1i(u.fogType,2),C=s=2)):(b.uniform1i(u.fogType,0),C=s=0);for(var z,D,y=[],F=0;F<q;F++)z=p[F],D=z.material,z.visible&&0!==D.opacity&&(D.useScreenCoordinates?z.z=-z.position.z:(z._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,z.matrixWorld),z.z=-z._modelViewMatrix.elements[14]));p.sort(a);for(F=0;F<q;F++)z=
 p[F],D=z.material,z.visible&&0!==D.opacity&&(D.map&&D.map.image&&D.map.image.width)&&(b.uniform1f(u.alphaTest,D.alphaTest),!0===D.useScreenCoordinates?(b.uniform1i(u.useScreenCoordinates,1),b.uniform3f(u.screenPosition,(z.position.x*c.devicePixelRatio-f)/f,(E-z.position.y*c.devicePixelRatio)/E,Math.max(0,Math.min(1,z.position.z))),y[0]=c.devicePixelRatio,y[1]=c.devicePixelRatio):(b.uniform1i(u.useScreenCoordinates,0),b.uniform1i(u.sizeAttenuation,D.sizeAttenuation?1:0),b.uniformMatrix4fv(u.modelViewMatrix,
-!1,z._modelViewMatrix.elements),y[0]=1,y[1]=1),e=d.fog&&D.fog?C:0,r!==e&&(b.uniform1i(u.fogType,e),r=e),e=1/(D.scaleByViewport?s:1),y[0]*=e*w*z.scale.x,y[1]*=e*z.scale.y,b.uniform2f(u.uvScale,D.uvScale.x,D.uvScale.y),b.uniform2f(u.uvOffset,D.uvOffset.x,D.uvOffset.y),b.uniform2f(u.alignment,D.alignment.x,D.alignment.y),b.uniform1f(u.opacity,D.opacity),b.uniform3f(u.color,D.color.r,D.color.g,D.color.b),b.uniform1f(u.rotation,z.rotation),b.uniform2fv(u.scale,y),c.setBlending(D.blending,D.blendEquation,
+!1,z._modelViewMatrix.elements),y[0]=1,y[1]=1),e=d.fog&&D.fog?C:0,s!==e&&(b.uniform1i(u.fogType,e),s=e),e=1/(D.scaleByViewport?r:1),y[0]*=e*w*z.scale.x,y[1]*=e*z.scale.y,b.uniform2f(u.uvScale,D.uvScale.x,D.uvScale.y),b.uniform2f(u.uvOffset,D.uvOffset.x,D.uvOffset.y),b.uniform2f(u.alignment,D.alignment.x,D.alignment.y),b.uniform1f(u.opacity,D.opacity),b.uniform3f(u.color,D.color.r,D.color.g,D.color.b),b.uniform1f(u.rotation,z.rotation),b.uniform2fv(u.scale,y),c.setBlending(D.blending,D.blendEquation,
 D.blendSrc,D.blendDst),c.setDepthTest(D.depthTest),c.setDepthWrite(D.depthWrite),c.setTexture(D.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,h=new THREE.Frustum,g=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,k){var l,m,n,t,s,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);!0===i.autoUpdate&&i.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);g.multiplyMatrices(k.projectionMatrix,
-k.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(this.renderTarget);b.clear();p=i.__webglObjects;l=0;for(m=p.length;l<m;l++)if(n=p[l],s=n.object,n.render=!1,s.visible&&(!(s instanceof THREE.Mesh||s instanceof THREE.ParticleSystem)||!s.frustumCulled||h.intersectsObject(s)))s._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,s.matrixWorld),n.render=!0;var q;l=0;for(m=p.length;l<m;l++)if(n=p[l],n.render&&(s=n.object,n=n.buffer,!(s instanceof THREE.ParticleSystem)||s.customDepthMaterial))(q=
-s.material instanceof THREE.MeshFaceMaterial?s.material.materials[0]:s.material)&&b.setMaterialFaces(s.material),t=0<s.geometry.morphTargets.length&&q.morphTargets,q=s instanceof THREE.SkinnedMesh&&q.skinning,t=s.customDepthMaterial?s.customDepthMaterial:q?t?f:e:t?d:c,n instanceof THREE.BufferGeometry?b.renderBufferDirect(k,i.__lights,null,t,n,s):b.renderBuffer(k,i.__lights,null,t,n,s);p=i.__webglObjectsImmediate;l=0;for(m=p.length;l<m;l++)n=p[l],s=n.object,s.visible&&(s._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,
-s.matrixWorld),b.renderImmediateObject(k,i.__lights,null,c,s));l=b.getClearColor();m=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,m);a.enable(a.BLEND)}};THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility =        visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *=       visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
+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,k){var l,m,n,t,r,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);!0===i.autoUpdate&&i.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);g.multiplyMatrices(k.projectionMatrix,
+k.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(this.renderTarget);b.clear();p=i.__webglObjects;l=0;for(m=p.length;l<m;l++)if(n=p[l],r=n.object,n.render=!1,r.visible&&(!(r instanceof THREE.Mesh||r instanceof THREE.ParticleSystem)||!r.frustumCulled||h.intersectsObject(r)))r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,r.matrixWorld),n.render=!0;var q;l=0;for(m=p.length;l<m;l++)if(n=p[l],n.render&&(r=n.object,n=n.buffer,!(r instanceof THREE.ParticleSystem)||r.customDepthMaterial))(q=
+r.material instanceof THREE.MeshFaceMaterial?r.material.materials[0]:r.material)&&b.setMaterialFaces(r.material),t=0<r.geometry.morphTargets.length&&q.morphTargets,q=r instanceof THREE.SkinnedMesh&&q.skinning,t=r.customDepthMaterial?r.customDepthMaterial:q?t?f:e:t?d:c,n instanceof THREE.BufferGeometry?b.renderBufferDirect(k,i.__lights,null,t,n,r):b.renderBuffer(k,i.__lights,null,t,n,r);p=i.__webglObjectsImmediate;l=0;for(m=p.length;l<m;l++)n=p[l],r=n.object,r.visible&&(r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,
+r.matrixWorld),b.renderImmediateObject(k,i.__lights,null,c,r));l=b.getClearColor();m=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,m);a.enable(a.BLEND)}};THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility =        visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *=       visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
 fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},lensFlare:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
 fragmentShader:"precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int sizeAttenuation;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( sizeAttenuation == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
 fragmentShader:"uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"}};