Browse Source

Updated builds.

Mr.doob 9 years ago
parent
commit
98c9270104
2 changed files with 261 additions and 220 deletions
  1. 111 71
      build/three.js
  2. 150 149
      build/three.min.js

+ 111 - 71
build/three.js

@@ -12291,12 +12291,7 @@ THREE.AnimationClip = function ( name, duration, tracks ) {
 	// this means it should figure out its duration by scanning the tracks
 	// this means it should figure out its duration by scanning the tracks
 	if ( this.duration < 0 ) {
 	if ( this.duration < 0 ) {
 
 
-		for ( var i = 0; i < this.tracks.length; i ++ ) {
-
-			var track = this.tracks[i];
-			this.duration = Math.max( track.times[ track.times.length - 1 ] );
-
-		}
+		this.resetDuration();
 
 
 	}
 	}
 
 
@@ -12311,6 +12306,24 @@ THREE.AnimationClip.prototype = {
 
 
 	constructor: THREE.AnimationClip,
 	constructor: THREE.AnimationClip,
 
 
+	resetDuration: function() {
+
+		var tracks = this.tracks,
+			duration = 0;
+
+		for ( var i = 0, n = tracks.length; i !== n; ++ i ) {
+
+			var track = this.tracks[ i ];
+
+			duration = Math.max(
+					duration, track.times[ track.times.length - 1 ] );
+
+		}
+
+		this.duration = duration;
+
+	},
+
 	trim: function() {
 	trim: function() {
 
 
 		for ( var i = 0; i < this.tracks.length; i ++ ) {
 		for ( var i = 0; i < this.tracks.length; i ++ ) {
@@ -15298,6 +15311,12 @@ THREE.PropertyBinding.prototype = {
 
 
 			this.resolvedProperty = nodeProperty;
 			this.resolvedProperty = nodeProperty;
 
 
+		} else if ( Array.isArray( nodeProperty ) ) {
+
+			bindingType = this.BindingType.EntireArray;
+
+			this.resolvedProperty = nodeProperty;
+
 		} else {
 		} else {
 
 
 			this.propertyName = propertyName;
 			this.propertyName = propertyName;
@@ -15335,8 +15354,9 @@ Object.assign( THREE.PropertyBinding.prototype, { // prototype, continued
 
 
 	BindingType: {
 	BindingType: {
 		Direct: 0,
 		Direct: 0,
-		ArrayElement: 1,
-		HasFromToArray: 2
+		EntireArray: 1,
+		ArrayElement: 2,
+		HasFromToArray: 3
 	},
 	},
 
 
 	Versioning: {
 	Versioning: {
@@ -15353,6 +15373,18 @@ Object.assign( THREE.PropertyBinding.prototype, { // prototype, continued
 
 
 		},
 		},
 
 
+		function getValue_array( buffer, offset ) {
+
+			var source = this.node[ this.propertyName ];
+
+			for ( var i = 0, n = source.length; i !== n; ++ i ) {
+
+				buffer[ offset ++ ] = source[ i ];
+
+			}
+
+		},
+
 		function getValue_arrayElement( buffer, offset ) {
 		function getValue_arrayElement( buffer, offset ) {
 
 
 			buffer[ offset ] = this.resolvedProperty[ this.propertyIndex ];
 			buffer[ offset ] = this.resolvedProperty[ this.propertyIndex ];
@@ -15392,6 +15424,50 @@ Object.assign( THREE.PropertyBinding.prototype, { // prototype, continued
 
 
 			}
 			}
 
 
+		], [
+
+			// EntireArray
+
+			function setValue_array( buffer, offset ) {
+
+				var dest = this.resolvedProperty;
+
+				for ( var i = 0, n = dest.length; i !== n; ++ i ) {
+
+					dest[ i ] = buffer[ offset ++ ];
+
+				}
+
+			},
+
+			function setValue_array_setNeedsUpdate( buffer, offset ) {
+
+				var dest = this.resolvedProperty;
+
+				for ( var i = 0, n = dest.length; i !== n; ++ i ) {
+
+					dest[ i ] = buffer[ offset ++ ];
+
+				}
+
+				this.targetObject.needsUpdate = true;
+
+			},
+
+			function setValue_array_setMatrixWorldNeedsUpdate( buffer, offset ) {
+
+				var dest = this.resolvedProperty;
+
+				for ( var i = 0, n = dest.length; i !== n; ++ i ) {
+
+					dest[ i ] = buffer[ offset ++ ];
+
+				}
+
+				this.targetObject.matrixWorldNeedsUpdate = true;
+
+			}
+
 		], [
 		], [
 
 
 			// ArrayElement
 			// ArrayElement
@@ -24507,6 +24583,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	_lights = {
 	_lights = {
 
 
+		hash: '',
+
 		ambient: [ 0, 0, 0 ],
 		ambient: [ 0, 0, 0 ],
 		directional: [],
 		directional: [],
 		point: [],
 		point: [],
@@ -24602,7 +24680,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	var state = new THREE.WebGLState( _gl, extensions, paramThreeToGL );
 	var state = new THREE.WebGLState( _gl, extensions, paramThreeToGL );
 	var properties = new THREE.WebGLProperties();
 	var properties = new THREE.WebGLProperties();
-	var materialsCache = new THREE.WebGLMaterials();
 	var objects = new THREE.WebGLObjects( _gl, properties, this.info );
 	var objects = new THREE.WebGLObjects( _gl, properties, this.info );
 	var programCache = new THREE.WebGLPrograms( this, capabilities );
 	var programCache = new THREE.WebGLPrograms( this, capabilities );
 
 
@@ -24994,7 +25071,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	function releaseMaterialProgramReference( material ) {
 	function releaseMaterialProgramReference( material ) {
 
 
-		var programInfo = materialsCache.get( material ).program;
+		var programInfo = properties.get( material ).program;
 
 
 		material.program = undefined;
 		material.program = undefined;
 
 
@@ -25776,7 +25853,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	function initMaterial( material, lights, fog, object ) {
 	function initMaterial( material, lights, fog, object ) {
 
 
-		var materialProperties = materialsCache.get( material );
+		var materialProperties = properties.get( material );
 
 
 		var parameters = programCache.getParameters( material, lights, fog, object );
 		var parameters = programCache.getParameters( material, lights, fog, object );
 		var code = programCache.getProgramCode( material, parameters );
 		var code = programCache.getProgramCode( material, parameters );
@@ -25895,6 +25972,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 				material instanceof THREE.MeshPhysicalMaterial ||
 				material instanceof THREE.MeshPhysicalMaterial ||
 				material.lights ) {
 				material.lights ) {
 
 
+			// store the light setup it was created for
+
+			materialProperties.lightsHash = _lights.hash;
+
 			// wire up the material to this renderer's lighting state
 			// wire up the material to this renderer's lighting state
 
 
 			uniforms.ambientLightColor.value = _lights.ambient;
 			uniforms.ambientLightColor.value = _lights.ambient;
@@ -25940,9 +26021,22 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		_usedTextureUnits = 0;
 		_usedTextureUnits = 0;
 
 
-		var materialProperties = materialsCache.get( material );
+		var materialProperties = properties.get( material );
+
+		if ( materialProperties.program === undefined ) {
+
+			material.needsUpdate = true;
+
+		}
+
+		if ( materialProperties.lightsHash !== undefined &&
+			materialProperties.lightsHash !== _lights.hash ) {
 
 
-		if ( material.needsUpdate || ! materialProperties.program ) {
+			material.needsUpdate = true;
+
+		}
+
+		if ( material.needsUpdate ) {
 
 
 			initMaterial( material, lights, fog, object );
 			initMaterial( material, lights, fog, object );
 			material.needsUpdate = false;
 			material.needsUpdate = false;
@@ -26153,7 +26247,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 			} else if ( material instanceof THREE.MeshPhysicalMaterial ) {
 			} else if ( material instanceof THREE.MeshPhysicalMaterial ) {
 
 
-				refreshUniformsStandard( m_uniforms, material );
+				refreshUniformsPhysical( m_uniforms, material );
 
 
 			} else if ( material instanceof THREE.MeshDepthMaterial ) {
 			} else if ( material instanceof THREE.MeshDepthMaterial ) {
 
 
@@ -26372,7 +26466,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	}
 	}
 
 
-	function refreshUniformsStandard ( uniforms, material ) {
+	function refreshUniformsPhysical ( uniforms, material ) {
 
 
 		uniforms.roughness.value = material.roughness;
 		uniforms.roughness.value = material.roughness;
 		//uniforms.reflectivity.value = material.reflectivity; // part of uniforms common
 		//uniforms.reflectivity.value = material.reflectivity; // part of uniforms common
@@ -26963,11 +27057,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		viewMatrix = camera.matrixWorldInverse,
 		viewMatrix = camera.matrixWorldInverse,
 
 
-		directionalCurrent = _lights.directional.length,
-		pointCurrent = _lights.point.length,
-		spotCurrent = _lights.spot.length,
-		hemiCurrent = _lights.hemi.length,
-
 		directionalLength = 0,
 		directionalLength = 0,
 		pointLength = 0,
 		pointLength = 0,
 		spotLength = 0,
 		spotLength = 0,
@@ -27090,22 +27179,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 		_lights.ambient[ 1 ] = g;
 		_lights.ambient[ 1 ] = g;
 		_lights.ambient[ 2 ] = b;
 		_lights.ambient[ 2 ] = b;
 
 
-		// Reset materials if light setup changes
-
-		if ( directionalCurrent !== directionalLength ||
-				pointCurrent !== pointLength ||
-				spotCurrent !== spotLength ||
-				hemiCurrent !== hemiLength ) {
-
-			materialsCache.clear();
-
-		}
-
 		_lights.directional.length = directionalLength;
 		_lights.directional.length = directionalLength;
 		_lights.point.length = pointLength;
 		_lights.point.length = pointLength;
 		_lights.spot.length = spotLength;
 		_lights.spot.length = spotLength;
 		_lights.hemi.length = hemiLength;
 		_lights.hemi.length = hemiLength;
 
 
+		_lights.hash = directionalLength + ',' + pointLength + ',' + spotLength + ',' + hemiLength;
+
 	}
 	}
 
 
 	// GL state setting
 	// GL state setting
@@ -28399,46 +28479,6 @@ THREE.WebGLGeometries = function ( gl, properties, info ) {
 
 
 };
 };
 
 
-// File:src/renderers/webgl/WebGLMaterials.js
-
-/**
- * @author mrdoob / http://mrdoob.com/
- */
-
-THREE.WebGLMaterials = function () {
-
-	var properties = {};
-
-	this.get = function ( material ) {
-
-		var uuid = material.uuid;
-		var map = properties[ uuid ];
-
-		if ( map === undefined ) {
-
-			map = {};
-			properties[ uuid ] = map;
-
-		}
-
-		return map;
-
-	};
-
-	this.delete = function ( object ) {
-
-		delete properties[ object.uuid ];
-
-	};
-
-	this.clear = function () {
-
-		properties = {};
-
-	};
-
-};
-
 // File:src/renderers/webgl/WebGLObjects.js
 // File:src/renderers/webgl/WebGLObjects.js
 
 
 /**
 /**

+ 150 - 149
build/three.min.js

@@ -107,8 +107,8 @@ 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
 d;b[1]=l+k*d;b[5]=a-m*d;b[9]=-c*g;b[2]=m-a*d;b[6]=k+l*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,l=g*e,k=d*h,m=d*e,b[0]=a+m*c,b[4]=k*c-l,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=l*c-k,b[6]=m+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,l=g*e,k=d*h,m=d*e,b[0]=a-m*c,b[4]=-f*e,b[8]=k+l*c,b[1]=l+k*c,b[5]=f*h,b[9]=m-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,l=f*e,k=c*h,m=c*e,b[0]=g*h,b[4]=k*d-l,b[8]=a*d+m,b[1]=g*e,b[5]=m*d+a,b[9]=l*d-k,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,l=f*d,k=c*g,m=
 d;b[1]=l+k*d;b[5]=a-m*d;b[9]=-c*g;b[2]=m-a*d;b[6]=k+l*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,l=g*e,k=d*h,m=d*e,b[0]=a+m*c,b[4]=k*c-l,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=l*c-k,b[6]=m+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,l=g*e,k=d*h,m=d*e,b[0]=a-m*c,b[4]=-f*e,b[8]=k+l*c,b[1]=l+k*c,b[5]=f*h,b[9]=m-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,l=f*e,k=c*h,m=c*e,b[0]=g*h,b[4]=k*d-l,b[8]=a*d+m,b[1]=g*e,b[5]=m*d+a,b[9]=l*d-k,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,l=f*d,k=c*g,m=
 c*d,b[0]=g*h,b[4]=m-a*e,b[8]=k*e+l,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=l*e+k,b[10]=a-m*e):"XZY"===a.order&&(a=f*g,l=f*d,k=c*g,m=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+m,b[5]=f*h,b[9]=l*e-k,b[2]=k*e-l,b[6]=c*h,b[10]=m*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},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,l=e+e;a=c*g;var k=c*h,c=c*l,m=d*h,d=d*l,e=e*l,g=f*g,h=f*h,f=f*l;b[0]=1-(m+e);b[4]=k-f;b[8]=c+h;b[1]=k+f;b[5]=1-(a+
 c*d,b[0]=g*h,b[4]=m-a*e,b[8]=k*e+l,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=l*e+k,b[10]=a-m*e):"XZY"===a.order&&(a=f*g,l=f*d,k=c*g,m=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+m,b[5]=f*h,b[9]=l*e-k,b[2]=k*e-l,b[6]=c*h,b[10]=m*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},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,l=e+e;a=c*g;var k=c*h,c=c*l,m=d*h,d=d*l,e=e*l,g=f*g,h=f*h,f=f*l;b[0]=1-(m+e);b[4]=k-f;b[8]=c+h;b[1]=k+f;b[5]=1-(a+
 e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+m);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,b,c;return function(d,e,f){void 0===a&&(a=new THREE.Vector3);void 0===b&&(b=new THREE.Vector3);void 0===c&&(c=new THREE.Vector3);var g=this.elements;c.subVectors(d,e).normalize();0===c.lengthSq()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.lengthSq()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=
 e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+m);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,b,c;return function(d,e,f){void 0===a&&(a=new THREE.Vector3);void 0===b&&(b=new THREE.Vector3);void 0===c&&(c=new THREE.Vector3);var g=this.elements;c.subVectors(d,e).normalize();0===c.lengthSq()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.lengthSq()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=
-c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .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],g=c[4],h=c[8],l=c[12],k=c[1],m=c[5],p=c[9],n=c[13],q=c[2],r=c[6],t=c[10],v=c[14],u=c[3],w=c[7],G=c[11],c=c[15],x=d[0],B=d[4],z=d[8],A=d[12],y=d[1],J=d[5],D=
-d[9],F=d[13],Q=d[2],M=d[6],N=d[10],H=d[14],I=d[3],E=d[7],O=d[11],d=d[15];e[0]=f*x+g*y+h*Q+l*I;e[4]=f*B+g*J+h*M+l*E;e[8]=f*z+g*D+h*N+l*O;e[12]=f*A+g*F+h*H+l*d;e[1]=k*x+m*y+p*Q+n*I;e[5]=k*B+m*J+p*M+n*E;e[9]=k*z+m*D+p*N+n*O;e[13]=k*A+m*F+p*H+n*d;e[2]=q*x+r*y+t*Q+v*I;e[6]=q*B+r*J+t*M+v*E;e[10]=q*z+r*D+t*N+v*O;e[14]=q*A+r*F+t*H+v*d;e[3]=u*x+w*y+G*Q+c*I;e[7]=u*B+w*J+G*M+c*E;e[11]=u*z+w*D+G*N+c*O;e[15]=u*A+w*F+G*H+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,
+c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .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],g=c[4],h=c[8],l=c[12],k=c[1],m=c[5],p=c[9],n=c[13],q=c[2],r=c[6],t=c[10],v=c[14],u=c[3],w=c[7],F=c[11],c=c[15],x=d[0],A=d[4],z=d[8],B=d[12],y=d[1],H=d[5],D=
+d[9],E=d[13],Q=d[2],M=d[6],N=d[10],G=d[14],J=d[3],K=d[7],O=d[11],d=d[15];e[0]=f*x+g*y+h*Q+l*J;e[4]=f*A+g*H+h*M+l*K;e[8]=f*z+g*D+h*N+l*O;e[12]=f*B+g*E+h*G+l*d;e[1]=k*x+m*y+p*Q+n*J;e[5]=k*A+m*H+p*M+n*K;e[9]=k*z+m*D+p*N+n*O;e[13]=k*B+m*E+p*G+n*d;e[2]=q*x+r*y+t*Q+v*J;e[6]=q*A+r*H+t*M+v*K;e[10]=q*z+r*D+t*N+v*O;e[14]=q*B+r*E+t*G+v*d;e[3]=u*x+w*y+F*Q+c*J;e[7]=u*A+w*H+F*M+c*K;e[11]=u*z+w*D+F*N+c*O;e[15]=u*B+w*E+F*G+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},applyToVector3Array:function(){var a;return function(b,c,d){void 0===a&&(a=new THREE.Vector3);void 0===c&&(c=0);void 0===
 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},applyToVector3Array:function(){var a;return function(b,c,d){void 0===a&&(a=new THREE.Vector3);void 0===c&&(c=0);void 0===
 d&&(d=b.length);for(var e=0;e<d;e+=3,c+=3)a.fromArray(b,c),a.applyMatrix4(this),a.toArray(b,c);return b}}(),applyToBuffer:function(){var a;return function(b,c,d){void 0===a&&(a=new THREE.Vector3);void 0===c&&(c=0);void 0===d&&(d=b.length/b.itemSize);for(var e=0;e<d;e++,c++)a.x=b.getX(c),a.y=b.getY(c),a.z=b.getZ(c),a.applyMatrix4(this),b.setXYZ(a.x,a.y,a.z);return b}}(),determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],l=a[13],k=a[2],m=a[6],p=a[10],n=a[14];
 d&&(d=b.length);for(var e=0;e<d;e+=3,c+=3)a.fromArray(b,c),a.applyMatrix4(this),a.toArray(b,c);return b}}(),applyToBuffer:function(){var a;return function(b,c,d){void 0===a&&(a=new THREE.Vector3);void 0===c&&(c=0);void 0===d&&(d=b.length/b.itemSize);for(var e=0;e<d;e++,c++)a.x=b.getX(c),a.y=b.getY(c),a.z=b.getZ(c),a.applyMatrix4(this),b.setXYZ(a.x,a.y,a.z);return b}}(),determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],l=a[13],k=a[2],m=a[6],p=a[10],n=a[14];
 return a[3]*(+e*h*m-d*l*m-e*g*p+c*l*p+d*g*n-c*h*n)+a[7]*(+b*h*n-b*l*p+e*f*p-d*f*n+d*l*k-e*h*k)+a[11]*(+b*l*m-b*g*n-e*f*m+c*f*n+e*g*k-c*l*k)+a[15]*(-d*g*k-b*h*m+b*g*p+d*f*m-c*f*p+c*h*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},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]=
 return a[3]*(+e*h*m-d*l*m-e*g*p+c*l*p+d*g*n-c*h*n)+a[7]*(+b*h*n-b*l*p+e*f*p-d*f*n+d*l*k-e*h*k)+a[11]*(+b*l*m-b*g*n-e*f*m+c*f*n+e*g*k-c*l*k)+a[15]*(-d*g*k-b*h*m+b*g*p+d*f*m-c*f*p+c*h*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},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]=
@@ -223,14 +223,14 @@ this.merge(a.geometry,a.matrix))},mergeVertices:function(){var a={},b=[],c=[],d,
 1),c=0,g=this.faceVertexUvs.length;c<g;c++)this.faceVertexUvs[c].splice(e,1);f=this.vertices.length-b.length;this.vertices=b;return f},sortFacesByMaterialIndex:function(){for(var a=this.faces,b=a.length,c=0;c<b;c++)a[c]._id=c;a.sort(function(a,b){return a.materialIndex-b.materialIndex});var d=this.faceVertexUvs[0],e=this.faceVertexUvs[1],f,g;d&&d.length===b&&(f=[]);e&&e.length===b&&(g=[]);for(c=0;c<b;c++){var h=a[c]._id;f&&f.push(d[h]);g&&g.push(e[h])}f&&(this.faceVertexUvs[0]=f);g&&(this.faceVertexUvs[1]=
 1),c=0,g=this.faceVertexUvs.length;c<g;c++)this.faceVertexUvs[c].splice(e,1);f=this.vertices.length-b.length;this.vertices=b;return f},sortFacesByMaterialIndex:function(){for(var a=this.faces,b=a.length,c=0;c<b;c++)a[c]._id=c;a.sort(function(a,b){return a.materialIndex-b.materialIndex});var d=this.faceVertexUvs[0],e=this.faceVertexUvs[1],f,g;d&&d.length===b&&(f=[]);e&&e.length===b&&(g=[]);for(c=0;c<b;c++){var h=a[c]._id;f&&f.push(d[h]);g&&g.push(e[h])}f&&(this.faceVertexUvs[0]=f);g&&(this.faceVertexUvs[1]=
 g)},toJSON:function(){function a(a,b,c){return c?a|1<<b:a&~(1<<b)}function b(a){var b=a.x.toString()+a.y.toString()+a.z.toString();if(void 0!==k[b])return k[b];k[b]=l.length/3;l.push(a.x,a.y,a.z);return k[b]}function c(a){var b=a.r.toString()+a.g.toString()+a.b.toString();if(void 0!==p[b])return p[b];p[b]=m.length;m.push(a.getHex());return p[b]}function d(a){var b=a.x.toString()+a.y.toString();if(void 0!==q[b])return q[b];q[b]=n.length/2;n.push(a.x,a.y);return q[b]}var e={metadata:{version:4.4,type:"Geometry",
 g)},toJSON:function(){function a(a,b,c){return c?a|1<<b:a&~(1<<b)}function b(a){var b=a.x.toString()+a.y.toString()+a.z.toString();if(void 0!==k[b])return k[b];k[b]=l.length/3;l.push(a.x,a.y,a.z);return k[b]}function c(a){var b=a.r.toString()+a.g.toString()+a.b.toString();if(void 0!==p[b])return p[b];p[b]=m.length;m.push(a.getHex());return p[b]}function d(a){var b=a.x.toString()+a.y.toString();if(void 0!==q[b])return q[b];q[b]=n.length/2;n.push(a.x,a.y);return q[b]}var e={metadata:{version:4.4,type:"Geometry",
 generator:"Geometry.toJSON"}};e.uuid=this.uuid;e.type=this.type;""!==this.name&&(e.name=this.name);if(void 0!==this.parameters){var f=this.parameters,g;for(g in f)void 0!==f[g]&&(e[g]=f[g]);return e}f=[];for(g=0;g<this.vertices.length;g++){var h=this.vertices[g];f.push(h.x,h.y,h.z)}var h=[],l=[],k={},m=[],p={},n=[],q={};for(g=0;g<this.faces.length;g++){var r=this.faces[g],t=void 0!==this.faceVertexUvs[0][g],v=0<r.normal.length(),u=0<r.vertexNormals.length,w=1!==r.color.r||1!==r.color.g||1!==r.color.b,
 generator:"Geometry.toJSON"}};e.uuid=this.uuid;e.type=this.type;""!==this.name&&(e.name=this.name);if(void 0!==this.parameters){var f=this.parameters,g;for(g in f)void 0!==f[g]&&(e[g]=f[g]);return e}f=[];for(g=0;g<this.vertices.length;g++){var h=this.vertices[g];f.push(h.x,h.y,h.z)}var h=[],l=[],k={},m=[],p={},n=[],q={};for(g=0;g<this.faces.length;g++){var r=this.faces[g],t=void 0!==this.faceVertexUvs[0][g],v=0<r.normal.length(),u=0<r.vertexNormals.length,w=1!==r.color.r||1!==r.color.g||1!==r.color.b,
-G=0<r.vertexColors.length,x=0,x=a(x,0,0),x=a(x,1,!0),x=a(x,2,!1),x=a(x,3,t),x=a(x,4,v),x=a(x,5,u),x=a(x,6,w),x=a(x,7,G);h.push(x);h.push(r.a,r.b,r.c);h.push(r.materialIndex);t&&(t=this.faceVertexUvs[0][g],h.push(d(t[0]),d(t[1]),d(t[2])));v&&h.push(b(r.normal));u&&(v=r.vertexNormals,h.push(b(v[0]),b(v[1]),b(v[2])));w&&h.push(c(r.color));G&&(r=r.vertexColors,h.push(c(r[0]),c(r[1]),c(r[2])))}e.data={};e.data.vertices=f;e.data.normals=l;0<m.length&&(e.data.colors=m);0<n.length&&(e.data.uvs=[n]);e.data.faces=
+F=0<r.vertexColors.length,x=0,x=a(x,0,0),x=a(x,1,!0),x=a(x,2,!1),x=a(x,3,t),x=a(x,4,v),x=a(x,5,u),x=a(x,6,w),x=a(x,7,F);h.push(x);h.push(r.a,r.b,r.c);h.push(r.materialIndex);t&&(t=this.faceVertexUvs[0][g],h.push(d(t[0]),d(t[1]),d(t[2])));v&&h.push(b(r.normal));u&&(v=r.vertexNormals,h.push(b(v[0]),b(v[1]),b(v[2])));w&&h.push(c(r.color));F&&(r=r.vertexColors,h.push(c(r[0]),c(r[1]),c(r[2])))}e.data={};e.data.vertices=f;e.data.normals=l;0<m.length&&(e.data.colors=m);0<n.length&&(e.data.uvs=[n]);e.data.faces=
 h;return e},clone:function(){var a=this.parameters;if(void 0!==a){var b=[],c;for(c in a)b.push(a[c]);a=Object.create(this.constructor.prototype);this.constructor.apply(a,b);return a}return(new this.constructor).copy(this)},copy:function(a){this.vertices=[];this.faces=[];this.faceVertexUvs=[[]];for(var b=a.vertices,c=0,d=b.length;c<d;c++)this.vertices.push(b[c].clone());b=a.faces;c=0;for(d=b.length;c<d;c++)this.faces.push(b[c].clone());c=0;for(d=a.faceVertexUvs.length;c<d;c++){b=a.faceVertexUvs[c];
 h;return e},clone:function(){var a=this.parameters;if(void 0!==a){var b=[],c;for(c in a)b.push(a[c]);a=Object.create(this.constructor.prototype);this.constructor.apply(a,b);return a}return(new this.constructor).copy(this)},copy:function(a){this.vertices=[];this.faces=[];this.faceVertexUvs=[[]];for(var b=a.vertices,c=0,d=b.length;c<d;c++)this.vertices.push(b[c].clone());b=a.faces;c=0;for(d=b.length;c<d;c++)this.faces.push(b[c].clone());c=0;for(d=a.faceVertexUvs.length;c<d;c++){b=a.faceVertexUvs[c];
 void 0===this.faceVertexUvs[c]&&(this.faceVertexUvs[c]=[]);for(var e=0,f=b.length;e<f;e++){for(var g=b[e],h=[],l=0,k=g.length;l<k;l++)h.push(g[l].clone());this.faceVertexUvs[c].push(h)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;
 void 0===this.faceVertexUvs[c]&&(this.faceVertexUvs[c]=[]);for(var e=0,f=b.length;e<f;e++){for(var g=b[e],h=[],l=0,k=g.length;l<k;l++)h.push(g[l].clone());this.faceVertexUvs[c].push(h)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;
 THREE.DirectGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="DirectGeometry";this.indices=[];this.vertices=[];this.normals=[];this.colors=[];this.uvs=[];this.uvs2=[];this.groups=[];this.morphTargets={};this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1};
 THREE.DirectGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="DirectGeometry";this.indices=[];this.vertices=[];this.normals=[];this.colors=[];this.uvs=[];this.uvs2=[];this.groups=[];this.morphTargets={};this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1};
 THREE.DirectGeometry.prototype={constructor:THREE.DirectGeometry,computeBoundingBox:THREE.Geometry.prototype.computeBoundingBox,computeBoundingSphere:THREE.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(a){var b,c=[],
 THREE.DirectGeometry.prototype={constructor:THREE.DirectGeometry,computeBoundingBox:THREE.Geometry.prototype.computeBoundingBox,computeBoundingSphere:THREE.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(a){var b,c=[],
 d;a=a.faces;for(var e=0;e<a.length;e++){var f=a[e];f.materialIndex!==d&&(d=f.materialIndex,void 0!==b&&(b.count=3*e-b.start,c.push(b)),b={start:3*e,materialIndex:d})}void 0!==b&&(b.count=3*e-b.start,c.push(b));this.groups=c},fromGeometry:function(a){var b=a.faces,c=a.vertices,d=a.faceVertexUvs,e=d[0]&&0<d[0].length,f=d[1]&&0<d[1].length,g=a.morphTargets,h=g.length;if(0<h){for(var l=[],k=0;k<h;k++)l[k]=[];this.morphTargets.position=l}var m=a.morphNormals,p=m.length;if(0<p){for(var n=[],k=0;k<p;k++)n[k]=
 d;a=a.faces;for(var e=0;e<a.length;e++){var f=a[e];f.materialIndex!==d&&(d=f.materialIndex,void 0!==b&&(b.count=3*e-b.start,c.push(b)),b={start:3*e,materialIndex:d})}void 0!==b&&(b.count=3*e-b.start,c.push(b));this.groups=c},fromGeometry:function(a){var b=a.faces,c=a.vertices,d=a.faceVertexUvs,e=d[0]&&0<d[0].length,f=d[1]&&0<d[1].length,g=a.morphTargets,h=g.length;if(0<h){for(var l=[],k=0;k<h;k++)l[k]=[];this.morphTargets.position=l}var m=a.morphNormals,p=m.length;if(0<p){for(var n=[],k=0;k<p;k++)n[k]=
 [];this.morphTargets.normal=n}for(var q=a.skinIndices,r=a.skinWeights,t=q.length===c.length,v=r.length===c.length,k=0;k<b.length;k++){var u=b[k];this.vertices.push(c[u.a],c[u.b],c[u.c]);var w=u.vertexNormals;3===w.length?this.normals.push(w[0],w[1],w[2]):(w=u.normal,this.normals.push(w,w,w));w=u.vertexColors;3===w.length?this.colors.push(w[0],w[1],w[2]):(w=u.color,this.colors.push(w,w,w));!0===e&&(w=d[0][k],void 0!==w?this.uvs.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",
 [];this.morphTargets.normal=n}for(var q=a.skinIndices,r=a.skinWeights,t=q.length===c.length,v=r.length===c.length,k=0;k<b.length;k++){var u=b[k];this.vertices.push(c[u.a],c[u.b],c[u.c]);var w=u.vertexNormals;3===w.length?this.normals.push(w[0],w[1],w[2]):(w=u.normal,this.normals.push(w,w,w));w=u.vertexColors;3===w.length?this.colors.push(w[0],w[1],w[2]):(w=u.color,this.colors.push(w,w,w));!0===e&&(w=d[0][k],void 0!==w?this.uvs.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",
-k),this.uvs.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2)));!0===f&&(w=d[1][k],void 0!==w?this.uvs2.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",k),this.uvs2.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2)));for(w=0;w<h;w++){var G=g[w].vertices;l[w].push(G[u.a],G[u.b],G[u.c])}for(w=0;w<p;w++)G=m[w].vertexNormals[k],n[w].push(G.a,G.b,G.c);t&&this.skinIndices.push(q[u.a],q[u.b],q[u.c]);v&&this.skinWeights.push(r[u.a],r[u.b],
+k),this.uvs.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2)));!0===f&&(w=d[1][k],void 0!==w?this.uvs2.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",k),this.uvs2.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2)));for(w=0;w<h;w++){var F=g[w].vertices;l[w].push(F[u.a],F[u.b],F[u.c])}for(w=0;w<p;w++)F=m[w].vertexNormals[k],n[w].push(F.a,F.b,F.c);t&&this.skinIndices.push(q[u.a],q[u.b],q[u.c]);v&&this.skinWeights.push(r[u.a],r[u.b],
 r[u.c])}this.computeGroups(a);this.verticesNeedUpdate=a.verticesNeedUpdate;this.normalsNeedUpdate=a.normalsNeedUpdate;this.colorsNeedUpdate=a.colorsNeedUpdate;this.uvsNeedUpdate=a.uvsNeedUpdate;this.groupsNeedUpdate=a.groupsNeedUpdate;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.DirectGeometry.prototype);
 r[u.c])}this.computeGroups(a);this.verticesNeedUpdate=a.verticesNeedUpdate;this.normalsNeedUpdate=a.normalsNeedUpdate;this.colorsNeedUpdate=a.colorsNeedUpdate;this.uvsNeedUpdate=a.uvsNeedUpdate;this.groupsNeedUpdate=a.groupsNeedUpdate;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.DirectGeometry.prototype);
 THREE.BufferGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity}};
 THREE.BufferGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity}};
 THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addIndex:function(a){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().");this.setIndex(a)},getIndex:function(){return this.index},setIndex:function(a){this.index=a},addAttribute:function(a,b,c){!1===b instanceof THREE.BufferAttribute&&!1===b instanceof THREE.InterleavedBufferAttribute?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(a,new THREE.BufferAttribute(b,
 THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addIndex:function(a){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().");this.setIndex(a)},getIndex:function(){return this.index},setIndex:function(a){this.index=a},addAttribute:function(a,b,c){!1===b instanceof THREE.BufferAttribute&&!1===b instanceof THREE.InterleavedBufferAttribute?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(a,new THREE.BufferAttribute(b,
@@ -256,8 +256,8 @@ if(void 0!==this.parameters){var b=this.parameters,c;for(c in b)void 0!==b[c]&&(
 c&&(a.data.boundingSphere={center:c.center.toArray(),radius:c.radius});return a},clone:function(){var a=this.parameters;if(void 0!==a){var b=[],c;for(c in a)b.push(a[c]);a=Object.create(this.constructor.prototype);this.constructor.apply(a,b);return a}return(new this.constructor).copy(this)},copy:function(a){var b=a.index;null!==b&&this.setIndex(b.clone());var b=a.attributes,c;for(c in b)this.addAttribute(c,b[c].clone());a=a.groups;c=0;for(b=a.length;c<b;c++){var d=a[c];this.addGroup(d.start,d.count)}return this},
 c&&(a.data.boundingSphere={center:c.center.toArray(),radius:c.radius});return a},clone:function(){var a=this.parameters;if(void 0!==a){var b=[],c;for(c in a)b.push(a[c]);a=Object.create(this.constructor.prototype);this.constructor.apply(a,b);return a}return(new this.constructor).copy(this)},copy:function(a){var b=a.index;null!==b&&this.setIndex(b.clone());var b=a.attributes,c;for(c in b)this.addAttribute(c,b[c].clone());a=a.groups;c=0;for(b=a.length;c<b;c++){var d=a[c];this.addGroup(d.start,d.count)}return this},
 dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);THREE.BufferGeometry.MaxIndex=65535;THREE.InstancedBufferGeometry=function(){THREE.BufferGeometry.call(this);this.type="InstancedBufferGeometry";this.maxInstancedCount=void 0};THREE.InstancedBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.InstancedBufferGeometry.prototype.constructor=THREE.InstancedBufferGeometry;
 dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);THREE.BufferGeometry.MaxIndex=65535;THREE.InstancedBufferGeometry=function(){THREE.BufferGeometry.call(this);this.type="InstancedBufferGeometry";this.maxInstancedCount=void 0};THREE.InstancedBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.InstancedBufferGeometry.prototype.constructor=THREE.InstancedBufferGeometry;
 THREE.InstancedBufferGeometry.prototype.addGroup=function(a,b,c){this.groups.push({start:a,count:b,instances:c})};THREE.InstancedBufferGeometry.prototype.copy=function(a){var b=a.index;null!==b&&this.setIndex(b.clone());var b=a.attributes,c;for(c in b)this.addAttribute(c,b[c].clone());a=a.groups;c=0;for(b=a.length;c<b;c++){var d=a[c];this.addGroup(d.start,d.count,d.instances)}return this};THREE.EventDispatcher.prototype.apply(THREE.InstancedBufferGeometry.prototype);
 THREE.InstancedBufferGeometry.prototype.addGroup=function(a,b,c){this.groups.push({start:a,count:b,instances:c})};THREE.InstancedBufferGeometry.prototype.copy=function(a){var b=a.index;null!==b&&this.setIndex(b.clone());var b=a.attributes,c;for(c in b)this.addAttribute(c,b[c].clone());a=a.groups;c=0;for(b=a.length;c<b;c++){var d=a[c];this.addGroup(d.start,d.count,d.instances)}return this};THREE.EventDispatcher.prototype.apply(THREE.InstancedBufferGeometry.prototype);
-THREE.AnimationClip=function(a,b,c){this.name=a||THREE.Math.generateUUID();this.tracks=c;this.duration=void 0!==b?b:-1;if(0>this.duration)for(a=0;a<this.tracks.length;a++)b=this.tracks[a],this.duration=Math.max(b.times[b.times.length-1]);this.trim();this.optimize()};
-THREE.AnimationClip.prototype={constructor:THREE.AnimationClip,trim:function(){for(var a=0;a<this.tracks.length;a++)this.tracks[a].trim(0,this.duration);return this},optimize:function(){for(var a=0;a<this.tracks.length;a++)this.tracks[a].optimize();return this}};
+THREE.AnimationClip=function(a,b,c){this.name=a||THREE.Math.generateUUID();this.tracks=c;this.duration=void 0!==b?b:-1;0>this.duration&&this.resetDuration();this.trim();this.optimize()};
+THREE.AnimationClip.prototype={constructor:THREE.AnimationClip,resetDuration:function(){for(var a=0,b=0,c=this.tracks.length;b!==c;++b)var d=this.tracks[b],a=Math.max(a,d.times[d.times.length-1]);this.duration=a},trim:function(){for(var a=0;a<this.tracks.length;a++)this.tracks[a].trim(0,this.duration);return this},optimize:function(){for(var a=0;a<this.tracks.length;a++)this.tracks[a].optimize();return this}};
 Object.assign(THREE.AnimationClip,{parse:function(a){for(var b=[],c=a.tracks,d=1/(a.fps||1),e=0,f=c.length;e!==f;++e)b.push(THREE.KeyframeTrack.parse(c[e]).scale(d));return new THREE.AnimationClip(a.name,a.duration,b)},toJSON:function(a){var b=[],c=a.tracks;a={name:a.name,duration:a.duration,tracks:b};for(var d=0,e=c.length;d!==e;++d)b.push(THREE.KeyframeTrack.toJSON(c[d]));return a},CreateFromMorphTargetSequence:function(a,b,c){for(var d=b.length,e=[],f=0;f<d;f++){var g=[],h=[];g.push((f+d-1)%d,
 Object.assign(THREE.AnimationClip,{parse:function(a){for(var b=[],c=a.tracks,d=1/(a.fps||1),e=0,f=c.length;e!==f;++e)b.push(THREE.KeyframeTrack.parse(c[e]).scale(d));return new THREE.AnimationClip(a.name,a.duration,b)},toJSON:function(a){var b=[],c=a.tracks;a={name:a.name,duration:a.duration,tracks:b};for(var d=0,e=c.length;d!==e;++d)b.push(THREE.KeyframeTrack.toJSON(c[d]));return a},CreateFromMorphTargetSequence:function(a,b,c){for(var d=b.length,e=[],f=0;f<d;f++){var g=[],h=[];g.push((f+d-1)%d,
 f,(f+1)%d);h.push(0,1,0);var l=THREE.AnimationUtils.getKeyframeOrder(g),g=THREE.AnimationUtils.sortedArray(g,1,l),h=THREE.AnimationUtils.sortedArray(h,1,l);0===g[0]&&(g.push(d),h.push(h[0]));e.push((new THREE.NumberKeyframeTrack(".morphTargetInfluences["+b[f].name+"]",g,h)).scale(1/c))}return new THREE.AnimationClip(a,-1,e)},findByName:function(a,b){for(var c=0;c<a.length;c++)if(a[c].name===b)return a[c];return null},CreateClipsFromMorphTargetSequences:function(a,b){for(var c={},d=/^([\w-]*?)([\d]+)$/,
 f,(f+1)%d);h.push(0,1,0);var l=THREE.AnimationUtils.getKeyframeOrder(g),g=THREE.AnimationUtils.sortedArray(g,1,l),h=THREE.AnimationUtils.sortedArray(h,1,l);0===g[0]&&(g.push(d),h.push(h[0]));e.push((new THREE.NumberKeyframeTrack(".morphTargetInfluences["+b[f].name+"]",g,h)).scale(1/c))}return new THREE.AnimationClip(a,-1,e)},findByName:function(a,b){for(var c=0;c<a.length;c++)if(a[c].name===b)return a[c];return null},CreateClipsFromMorphTargetSequences:function(a,b){for(var c={},d=/^([\w-]*?)([\d]+)$/,
 e=0,f=a.length;e<f;e++){var g=a[e],h=g.name.match(d);if(h&&1<h.length){var l=h[1];(h=c[l])||(c[l]=h=[]);h.push(g)}}d=[];for(l in c)d.push(THREE.AnimationClip.CreateFromMorphTargetSequence(l,c[l],b));return d},parseAnimation:function(a,b,c){if(!a)return console.error("  no animation in JSONLoader data"),null;c=function(a,b,c,d,e){if(0!==c.length){var f=[],g=[];THREE.AnimationUtils.flattenJSON(c,f,g,d);0!==f.length&&e.push(new a(b,f,g))}};var d=[],e=a.name||"default",f=a.length||-1,g=a.fps||30;a=a.hierarchy||
 e=0,f=a.length;e<f;e++){var g=a[e],h=g.name.match(d);if(h&&1<h.length){var l=h[1];(h=c[l])||(c[l]=h=[]);h.push(g)}}d=[];for(l in c)d.push(THREE.AnimationClip.CreateFromMorphTargetSequence(l,c[l],b));return d},parseAnimation:function(a,b,c){if(!a)return console.error("  no animation in JSONLoader data"),null;c=function(a,b,c,d,e){if(0!==c.length){var f=[],g=[];THREE.AnimationUtils.flattenJSON(c,f,g,d);0!==f.length&&e.push(new a(b,f,g))}};var d=[],e=a.name||"default",f=a.length||-1,g=a.fps||30;a=a.hierarchy||
@@ -309,11 +309,12 @@ case "color":return THREE.ColorKeyframeTrack;case "quaternion":return THREE.Quat
 THREE.PropertyBinding.prototype={constructor:THREE.PropertyBinding,getValue:function(a,b){this.bind();this.getValue(a,b)},setValue:function(a,b){this.bind();this.setValue(a,b)},bind:function(){var a=this.node,b=this.parsedPath,c=b.objectName,d=b.propertyName,e=b.propertyIndex;a||(this.node=a=THREE.PropertyBinding.findNode(this.rootNode,b.nodeName)||this.rootNode);this.getValue=this._getValue_unavailable;this.setValue=this._setValue_unavailable;if(a){if(c){var f=b.objectIndex;switch(c){case "materials":if(!a.material){console.error("  can not bind to material as node does not have a material",
 THREE.PropertyBinding.prototype={constructor:THREE.PropertyBinding,getValue:function(a,b){this.bind();this.getValue(a,b)},setValue:function(a,b){this.bind();this.setValue(a,b)},bind:function(){var a=this.node,b=this.parsedPath,c=b.objectName,d=b.propertyName,e=b.propertyIndex;a||(this.node=a=THREE.PropertyBinding.findNode(this.rootNode,b.nodeName)||this.rootNode);this.getValue=this._getValue_unavailable;this.setValue=this._setValue_unavailable;if(a){if(c){var f=b.objectIndex;switch(c){case "materials":if(!a.material){console.error("  can not bind to material as node does not have a material",
 this);return}if(!a.material.materials){console.error("  can not bind to material.materials as node.material does not have a materials array",this);return}a=a.material.materials;break;case "bones":if(!a.skeleton){console.error("  can not bind to bones as node does not have a skeleton",this);return}a=a.skeleton.bones;for(c=0;c<a.length;c++)if(a[c].name===f){f=c;break}break;default:if(void 0===a[c]){console.error("  can not bind to objectName of node, undefined",this);return}a=a[c]}if(void 0!==f){if(void 0===
 this);return}if(!a.material.materials){console.error("  can not bind to material.materials as node.material does not have a materials array",this);return}a=a.material.materials;break;case "bones":if(!a.skeleton){console.error("  can not bind to bones as node does not have a skeleton",this);return}a=a.skeleton.bones;for(c=0;c<a.length;c++)if(a[c].name===f){f=c;break}break;default:if(void 0===a[c]){console.error("  can not bind to objectName of node, undefined",this);return}a=a[c]}if(void 0!==f){if(void 0===
 a[f]){console.error("  trying to bind to objectIndex of objectName, but is undefined:",this,a);return}a=a[f]}}if(f=a[d]){b=this.Versioning.None;void 0!==a.needsUpdate?(b=this.Versioning.NeedsUpdate,this.targetObject=a):void 0!==a.matrixWorldNeedsUpdate&&(b=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=a);c=this.BindingType.Direct;if(void 0!==e){if("morphTargetInfluences"===d){if(!a.geometry){console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry",
 a[f]){console.error("  trying to bind to objectIndex of objectName, but is undefined:",this,a);return}a=a[f]}}if(f=a[d]){b=this.Versioning.None;void 0!==a.needsUpdate?(b=this.Versioning.NeedsUpdate,this.targetObject=a):void 0!==a.matrixWorldNeedsUpdate&&(b=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=a);c=this.BindingType.Direct;if(void 0!==e){if("morphTargetInfluences"===d){if(!a.geometry){console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry",
-this);return}if(!a.geometry.morphTargets){console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);return}for(c=0;c<this.node.geometry.morphTargets.length;c++)if(a.geometry.morphTargets[c].name===e){e=c;break}}c=this.BindingType.ArrayElement;this.resolvedProperty=f;this.propertyIndex=e}else void 0!==f.fromArray&&void 0!==f.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=f):this.propertyName=d;this.getValue=this.GetterByBindingType[c];
-this.setValue=this.SetterByBindingTypeAndVersioning[c][b]}else console.error("  trying to update property for track: "+b.nodeName+"."+d+" but it wasn't found.",a)}else console.error("  trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null;this.getValue=this._getValue_unbound;this.setValue=this._setValue_unbound}};
-Object.assign(THREE.PropertyBinding.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:THREE.PropertyBinding.prototype.getValue,_setValue_unbound:THREE.PropertyBinding.prototype.setValue,BindingType:{Direct:0,ArrayElement:1,HasFromToArray:2},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(a,b){a[b]=this.node[this.propertyName]},function(a,b){a[b]=this.resolvedProperty[this.propertyIndex]},function(a,b){this.resolvedProperty.toArray(a,
-b)}],SetterByBindingTypeAndVersioning:[[function(a,b){this.node[this.propertyName]=a[b]},function(a,b){this.node[this.propertyName]=a[b];this.targetObject.needsUpdate=!0},function(a,b){this.node[this.propertyName]=a[b];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,b){this.resolvedProperty[this.propertyIndex]=a[b]},function(a,b){this.resolvedProperty[this.propertyIndex]=a[b];this.targetObject.needsUpdate=!0},function(a,b){this.resolvedProperty[this.propertyIndex]=a[b];this.targetObject.matrixWorldNeedsUpdate=
-!0}],[function(a,b){this.resolvedProperty.fromArray(a,b)},function(a,b){this.resolvedProperty.fromArray(a,b);this.targetObject.needsUpdate=!0},function(a,b){this.resolvedProperty.fromArray(a,b);this.targetObject.matrixWorldNeedsUpdate=!0}]]});THREE.PropertyBinding.Composite=function(a,b,c){c=c||THREE.PropertyBinding.parseTrackName(b);this._targetGroup=a;this._bindings=a.subscribe_(b,c)};
+this);return}if(!a.geometry.morphTargets){console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);return}for(c=0;c<this.node.geometry.morphTargets.length;c++)if(a.geometry.morphTargets[c].name===e){e=c;break}}c=this.BindingType.ArrayElement;this.resolvedProperty=f;this.propertyIndex=e}else void 0!==f.fromArray&&void 0!==f.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=f):Array.isArray(f)?(c=this.BindingType.EntireArray,this.resolvedProperty=
+f):this.propertyName=d;this.getValue=this.GetterByBindingType[c];this.setValue=this.SetterByBindingTypeAndVersioning[c][b]}else console.error("  trying to update property for track: "+b.nodeName+"."+d+" but it wasn't found.",a)}else console.error("  trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null;this.getValue=this._getValue_unbound;this.setValue=this._setValue_unbound}};
+Object.assign(THREE.PropertyBinding.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:THREE.PropertyBinding.prototype.getValue,_setValue_unbound:THREE.PropertyBinding.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(a,b){a[b]=this.node[this.propertyName]},function(a,b){for(var c=this.node[this.propertyName],d=0,e=c.length;d!==
+e;++d)a[b++]=c[d]},function(a,b){a[b]=this.resolvedProperty[this.propertyIndex]},function(a,b){this.resolvedProperty.toArray(a,b)}],SetterByBindingTypeAndVersioning:[[function(a,b){this.node[this.propertyName]=a[b]},function(a,b){this.node[this.propertyName]=a[b];this.targetObject.needsUpdate=!0},function(a,b){this.node[this.propertyName]=a[b];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,b){for(var c=this.resolvedProperty,d=0,e=c.length;d!==e;++d)c[d]=a[b++]},function(a,b){for(var c=
+this.resolvedProperty,d=0,e=c.length;d!==e;++d)c[d]=a[b++];this.targetObject.needsUpdate=!0},function(a,b){for(var c=this.resolvedProperty,d=0,e=c.length;d!==e;++d)c[d]=a[b++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,b){this.resolvedProperty[this.propertyIndex]=a[b]},function(a,b){this.resolvedProperty[this.propertyIndex]=a[b];this.targetObject.needsUpdate=!0},function(a,b){this.resolvedProperty[this.propertyIndex]=a[b];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,b){this.resolvedProperty.fromArray(a,
+b)},function(a,b){this.resolvedProperty.fromArray(a,b);this.targetObject.needsUpdate=!0},function(a,b){this.resolvedProperty.fromArray(a,b);this.targetObject.matrixWorldNeedsUpdate=!0}]]});THREE.PropertyBinding.Composite=function(a,b,c){c=c||THREE.PropertyBinding.parseTrackName(b);this._targetGroup=a;this._bindings=a.subscribe_(b,c)};
 THREE.PropertyBinding.Composite.prototype={constructor:THREE.PropertyBinding.Composite,getValue:function(a,b){this.bind();var c=this._bindings[this._targetGroup.nCachedObjects_];void 0!==c&&c.getValue(a,b)},setValue:function(a,b){for(var c=this._bindings,d=this._targetGroup.nCachedObjects_,e=c.length;d!==e;++d)c[d].setValue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,
 THREE.PropertyBinding.Composite.prototype={constructor:THREE.PropertyBinding.Composite,getValue:function(a,b){this.bind();var c=this._bindings[this._targetGroup.nCachedObjects_];void 0!==c&&c.getValue(a,b)},setValue:function(a,b){for(var c=this._bindings,d=this._targetGroup.nCachedObjects_,e=c.length;d!==e;++d)c[d].setValue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,
 c=a.length;b!==c;++b)a[b].unbind()}};THREE.PropertyBinding.create=function(a,b,c){return a instanceof THREE.AnimationObjectGroup?new THREE.PropertyBinding.Composite(a,b,c):new THREE.PropertyBinding(a,b,c)};
 c=a.length;b!==c;++b)a[b].unbind()}};THREE.PropertyBinding.create=function(a,b,c){return a instanceof THREE.AnimationObjectGroup?new THREE.PropertyBinding.Composite(a,b,c):new THREE.PropertyBinding(a,b,c)};
 THREE.PropertyBinding.parseTrackName=function(a){var b=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_. ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,c=b.exec(a);if(!c)throw Error("cannot parse trackName at all: "+a);c.index===b.lastIndex&&b.lastIndex++;b={nodeName:c[3],objectName:c[5],objectIndex:c[7],propertyName:c[9],propertyIndex:c[11]};if(null===b.propertyName||0===b.propertyName.length)throw Error("can not parse propertyName from trackName: "+a);return b};
 THREE.PropertyBinding.parseTrackName=function(a){var b=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_. ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,c=b.exec(a);if(!c)throw Error("cannot parse trackName at all: "+a);c.index===b.lastIndex&&b.lastIndex++;b={nodeName:c[3],objectName:c[5],objectIndex:c[7],propertyName:c[9],propertyIndex:c[11]};if(null===b.propertyName||0===b.propertyName.length)throw Error("can not parse propertyName from trackName: "+a);return b};
@@ -372,10 +373,10 @@ THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d
 d(b);e.manager.itemError(a)},!1);void 0!==this.crossOrigin&&(g.crossOrigin=this.crossOrigin);e.manager.itemStart(a);g.src=a;return g},setCrossOrigin:function(a){this.crossOrigin=a},setPath:function(a){this.path=a}};THREE.JSONLoader=function(a){"boolean"===typeof a&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),a=void 0);this.manager=void 0!==a?a:THREE.DefaultLoadingManager;this.withCredentials=!1};
 d(b);e.manager.itemError(a)},!1);void 0!==this.crossOrigin&&(g.crossOrigin=this.crossOrigin);e.manager.itemStart(a);g.src=a;return g},setCrossOrigin:function(a){this.crossOrigin=a},setPath:function(a){this.path=a}};THREE.JSONLoader=function(a){"boolean"===typeof a&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),a=void 0);this.manager=void 0!==a?a:THREE.DefaultLoadingManager;this.withCredentials=!1};
 THREE.JSONLoader.prototype={constructor:THREE.JSONLoader,get statusDomElement(){void 0===this._statusDomElement&&(this._statusDomElement=document.createElement("div"));console.warn("THREE.JSONLoader: .statusDomElement has been removed.");return this._statusDomElement},load:function(a,b,c,d){var e=this,f=this.texturePath&&"string"===typeof this.texturePath?this.texturePath:THREE.Loader.prototype.extractUrlBase(a);c=new THREE.XHRLoader(this.manager);c.setCrossOrigin(this.crossOrigin);c.setWithCredentials(this.withCredentials);
 THREE.JSONLoader.prototype={constructor:THREE.JSONLoader,get statusDomElement(){void 0===this._statusDomElement&&(this._statusDomElement=document.createElement("div"));console.warn("THREE.JSONLoader: .statusDomElement has been removed.");return this._statusDomElement},load:function(a,b,c,d){var e=this,f=this.texturePath&&"string"===typeof this.texturePath?this.texturePath:THREE.Loader.prototype.extractUrlBase(a);c=new THREE.XHRLoader(this.manager);c.setCrossOrigin(this.crossOrigin);c.setWithCredentials(this.withCredentials);
 c.load(a,function(c){c=JSON.parse(c);var d=c.metadata;if(void 0!==d&&(d=d.type,void 0!==d)){if("object"===d.toLowerCase()){console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.ObjectLoader instead.");return}if("scene"===d.toLowerCase()){console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.SceneLoader instead.");return}}c=e.parse(c,f);b(c.geometry,c.materials)})},setCrossOrigin:function(a){this.crossOrigin=a},setTexturePath:function(a){this.texturePath=a},parse:function(a,
 c.load(a,function(c){c=JSON.parse(c);var d=c.metadata;if(void 0!==d&&(d=d.type,void 0!==d)){if("object"===d.toLowerCase()){console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.ObjectLoader instead.");return}if("scene"===d.toLowerCase()){console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.SceneLoader instead.");return}}c=e.parse(c,f);b(c.geometry,c.materials)})},setCrossOrigin:function(a){this.crossOrigin=a},setTexturePath:function(a){this.texturePath=a},parse:function(a,
-b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,h,l,k,m,p,n,q,r,t,v,u,w=a.faces;m=a.vertices;var G=a.normals,x=a.colors,B=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&B++;for(d=0;d<B;d++)c.faceVertexUvs[d]=[]}l=0;for(k=m.length;l<k;)d=new THREE.Vector3,d.x=m[l++]*b,d.y=m[l++]*b,d.z=m[l++]*b,c.vertices.push(d);l=0;for(k=w.length;l<k;)if(b=w[l++],q=b&1,h=b&2,d=b&8,p=b&16,r=b&32,m=b&64,b&=128,q){q=new THREE.Face3;q.a=w[l];q.b=w[l+1];q.c=w[l+3];t=new THREE.Face3;
-t.a=w[l+1];t.b=w[l+2];t.c=w[l+3];l+=4;h&&(h=w[l++],q.materialIndex=h,t.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<B;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],g=0;4>g;g++)n=w[l++],u=v[2*n],n=v[2*n+1],u=new THREE.Vector2(u,n),2!==g&&c.faceVertexUvs[d][h].push(u),0!==g&&c.faceVertexUvs[d][h+1].push(u);p&&(p=3*w[l++],q.normal.set(G[p++],G[p++],G[p]),t.normal.copy(q.normal));if(r)for(d=0;4>d;d++)p=3*w[l++],r=new THREE.Vector3(G[p++],G[p++],G[p]),2!==d&&q.vertexNormals.push(r),
-0!==d&&t.vertexNormals.push(r);m&&(m=w[l++],m=x[m],q.color.setHex(m),t.color.setHex(m));if(b)for(d=0;4>d;d++)m=w[l++],m=x[m],2!==d&&q.vertexColors.push(new THREE.Color(m)),0!==d&&t.vertexColors.push(new THREE.Color(m));c.faces.push(q);c.faces.push(t)}else{q=new THREE.Face3;q.a=w[l++];q.b=w[l++];q.c=w[l++];h&&(h=w[l++],q.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<B;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;g++)n=w[l++],u=v[2*n],n=v[2*n+1],u=new THREE.Vector2(u,n),c.faceVertexUvs[d][h].push(u);
-p&&(p=3*w[l++],q.normal.set(G[p++],G[p++],G[p]));if(r)for(d=0;3>d;d++)p=3*w[l++],r=new THREE.Vector3(G[p++],G[p++],G[p]),q.vertexNormals.push(r);m&&(m=w[l++],q.color.setHex(x[m]));if(b)for(d=0;3>d;d++)m=w[l++],q.vertexColors.push(new THREE.Color(x[m]));c.faces.push(q)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;d<g;d+=b)c.skinWeights.push(new THREE.Vector4(a.skinWeights[d],1<b?a.skinWeights[d+1]:0,2<b?a.skinWeights[d+
+b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,h,l,k,m,p,n,q,r,t,v,u,w=a.faces;m=a.vertices;var F=a.normals,x=a.colors,A=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&A++;for(d=0;d<A;d++)c.faceVertexUvs[d]=[]}l=0;for(k=m.length;l<k;)d=new THREE.Vector3,d.x=m[l++]*b,d.y=m[l++]*b,d.z=m[l++]*b,c.vertices.push(d);l=0;for(k=w.length;l<k;)if(b=w[l++],q=b&1,h=b&2,d=b&8,p=b&16,r=b&32,m=b&64,b&=128,q){q=new THREE.Face3;q.a=w[l];q.b=w[l+1];q.c=w[l+3];t=new THREE.Face3;
+t.a=w[l+1];t.b=w[l+2];t.c=w[l+3];l+=4;h&&(h=w[l++],q.materialIndex=h,t.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<A;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],g=0;4>g;g++)n=w[l++],u=v[2*n],n=v[2*n+1],u=new THREE.Vector2(u,n),2!==g&&c.faceVertexUvs[d][h].push(u),0!==g&&c.faceVertexUvs[d][h+1].push(u);p&&(p=3*w[l++],q.normal.set(F[p++],F[p++],F[p]),t.normal.copy(q.normal));if(r)for(d=0;4>d;d++)p=3*w[l++],r=new THREE.Vector3(F[p++],F[p++],F[p]),2!==d&&q.vertexNormals.push(r),
+0!==d&&t.vertexNormals.push(r);m&&(m=w[l++],m=x[m],q.color.setHex(m),t.color.setHex(m));if(b)for(d=0;4>d;d++)m=w[l++],m=x[m],2!==d&&q.vertexColors.push(new THREE.Color(m)),0!==d&&t.vertexColors.push(new THREE.Color(m));c.faces.push(q);c.faces.push(t)}else{q=new THREE.Face3;q.a=w[l++];q.b=w[l++];q.c=w[l++];h&&(h=w[l++],q.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<A;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;g++)n=w[l++],u=v[2*n],n=v[2*n+1],u=new THREE.Vector2(u,n),c.faceVertexUvs[d][h].push(u);
+p&&(p=3*w[l++],q.normal.set(F[p++],F[p++],F[p]));if(r)for(d=0;3>d;d++)p=3*w[l++],r=new THREE.Vector3(F[p++],F[p++],F[p]),q.vertexNormals.push(r);m&&(m=w[l++],q.color.setHex(x[m]));if(b)for(d=0;3>d;d++)m=w[l++],q.vertexColors.push(new THREE.Color(x[m]));c.faces.push(q)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;d<g;d+=b)c.skinWeights.push(new THREE.Vector4(a.skinWeights[d],1<b?a.skinWeights[d+1]:0,2<b?a.skinWeights[d+
 2]:0,3<b?a.skinWeights[d+3]:0));if(a.skinIndices)for(d=0,g=a.skinIndices.length;d<g;d+=b)c.skinIndices.push(new THREE.Vector4(a.skinIndices[d],1<b?a.skinIndices[d+1]:0,2<b?a.skinIndices[d+2]:0,3<b?a.skinIndices[d+3]:0));c.bones=a.bones;c.bones&&0<c.bones.length&&(c.skinWeights.length!==c.skinIndices.length||c.skinIndices.length!==c.vertices.length)&&console.warn("When skinning, number of vertices ("+c.vertices.length+"), skinIndices ("+c.skinIndices.length+"), and skinWeights ("+c.skinWeights.length+
 2]:0,3<b?a.skinWeights[d+3]:0));if(a.skinIndices)for(d=0,g=a.skinIndices.length;d<g;d+=b)c.skinIndices.push(new THREE.Vector4(a.skinIndices[d],1<b?a.skinIndices[d+1]:0,2<b?a.skinIndices[d+2]:0,3<b?a.skinIndices[d+3]:0));c.bones=a.bones;c.bones&&0<c.bones.length&&(c.skinWeights.length!==c.skinIndices.length||c.skinIndices.length!==c.vertices.length)&&console.warn("When skinning, number of vertices ("+c.vertices.length+"), skinIndices ("+c.skinIndices.length+"), and skinWeights ("+c.skinWeights.length+
 ") should match.")})();(function(b){if(void 0!==a.morphTargets)for(var d=0,g=a.morphTargets.length;d<g;d++){c.morphTargets[d]={};c.morphTargets[d].name=a.morphTargets[d].name;c.morphTargets[d].vertices=[];for(var h=c.morphTargets[d].vertices,l=a.morphTargets[d].vertices,k=0,m=l.length;k<m;k+=3){var p=new THREE.Vector3;p.x=l[k]*b;p.y=l[k+1]*b;p.z=l[k+2]*b;h.push(p)}}if(void 0!==a.morphColors&&0<a.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'),
 ") should match.")})();(function(b){if(void 0!==a.morphTargets)for(var d=0,g=a.morphTargets.length;d<g;d++){c.morphTargets[d]={};c.morphTargets[d].name=a.morphTargets[d].name;c.morphTargets[d].vertices=[];for(var h=c.morphTargets[d].vertices,l=a.morphTargets[d].vertices,k=0,m=l.length;k<m;k+=3){var p=new THREE.Vector3;p.x=l[k]*b;p.y=l[k+1]*b;p.z=l[k+2]*b;h.push(p)}}if(void 0!==a.morphColors&&0<a.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'),
 b=c.faces,h=a.morphColors[0].colors,d=0,g=b.length;d<g;d++)b[d].color.fromArray(h,3*d)})(d);(function(){var b=[],d=[];void 0!==a.animation&&d.push(a.animation);void 0!==a.animations&&(a.animations.length?d=d.concat(a.animations):d.push(a.animations));for(var g=0;g<d.length;g++){var h=THREE.AnimationClip.parseAnimation(d[g],c.bones);h&&b.push(h)}c.morphTargets&&(d=THREE.AnimationClip.CreateClipsFromMorphTargetSequences(c.morphTargets,10),b=b.concat(d));0<b.length&&(c.animations=b)})();c.computeFaceNormals();
 b=c.faces,h=a.morphColors[0].colors,d=0,g=b.length;d<g;d++)b[d].color.fromArray(h,3*d)})(d);(function(){var b=[],d=[];void 0!==a.animation&&d.push(a.animation);void 0!==a.animations&&(a.animations.length?d=d.concat(a.animations):d.push(a.animations));for(var g=0;g<d.length;g++){var h=THREE.AnimationClip.parseAnimation(d[g],c.bones);h&&b.push(h)}c.morphTargets&&(d=THREE.AnimationClip.CreateClipsFromMorphTargetSequences(c.morphTargets,10),b=b.concat(d));0<b.length&&(c.animations=b)})();c.computeFaceNormals();
@@ -479,10 +480,10 @@ THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.mor
 THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(void 0!==this.morphTargetDictionary[a])return this.morphTargetDictionary[a];console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(void 0!==this.morphTargetDictionary[a])return this.morphTargetDictionary[a];console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 THREE.Mesh.prototype.raycast=function(){function a(a,b,c,d,e,f,g){THREE.Triangle.barycoordFromPoint(a,b,c,d,t);e.multiplyScalar(t.x);f.multiplyScalar(t.y);g.multiplyScalar(t.z);e.add(f).add(g);return e.clone()}function b(a,b,c,d,e,f,g){var h=a.material;if(null===(h.side===THREE.BackSide?c.intersectTriangle(f,e,d,!0,g):c.intersectTriangle(d,e,f,h.side!==THREE.DoubleSide,g)))return null;u.copy(g);u.applyMatrix4(a.matrixWorld);c=b.ray.origin.distanceTo(u);return c<b.near||c>b.far?null:{distance:c,point:u.clone(),
 THREE.Mesh.prototype.raycast=function(){function a(a,b,c,d,e,f,g){THREE.Triangle.barycoordFromPoint(a,b,c,d,t);e.multiplyScalar(t.x);f.multiplyScalar(t.y);g.multiplyScalar(t.z);e.add(f).add(g);return e.clone()}function b(a,b,c,d,e,f,g){var h=a.material;if(null===(h.side===THREE.BackSide?c.intersectTriangle(f,e,d,!0,g):c.intersectTriangle(d,e,f,h.side!==THREE.DoubleSide,g)))return null;u.copy(g);u.applyMatrix4(a.matrixWorld);c=b.ray.origin.distanceTo(u);return c<b.near||c>b.far?null:{distance:c,point:u.clone(),
 object:a}}function c(c,d,e,f,k,m,p,u){g.fromArray(f,3*m);h.fromArray(f,3*p);l.fromArray(f,3*u);if(c=b(c,d,e,g,h,l,v))k&&(n.fromArray(k,2*m),q.fromArray(k,2*p),r.fromArray(k,2*u),c.uv=a(v,g,h,l,n,q,r)),c.face=new THREE.Face3(m,p,u,THREE.Triangle.normal(g,h,l)),c.faceIndex=m;return c}var d=new THREE.Matrix4,e=new THREE.Ray,f=new THREE.Sphere,g=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3,p=new THREE.Vector3,n=new THREE.Vector2,q=new THREE.Vector2,
 object:a}}function c(c,d,e,f,k,m,p,u){g.fromArray(f,3*m);h.fromArray(f,3*p);l.fromArray(f,3*u);if(c=b(c,d,e,g,h,l,v))k&&(n.fromArray(k,2*m),q.fromArray(k,2*p),r.fromArray(k,2*u),c.uv=a(v,g,h,l,n,q,r)),c.face=new THREE.Face3(m,p,u,THREE.Triangle.normal(g,h,l)),c.faceIndex=m;return c}var d=new THREE.Matrix4,e=new THREE.Ray,f=new THREE.Sphere,g=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3,p=new THREE.Vector3,n=new THREE.Vector2,q=new THREE.Vector2,
-r=new THREE.Vector2,t=new THREE.Vector3,v=new THREE.Vector3,u=new THREE.Vector3;return function(u,t){var x=this.geometry,B=this.material;if(void 0!==B){null===x.boundingSphere&&x.computeBoundingSphere();var z=this.matrixWorld;f.copy(x.boundingSphere);f.applyMatrix4(z);if(!1!==u.ray.intersectsSphere(f)&&(d.getInverse(z),e.copy(u.ray).applyMatrix4(d),null===x.boundingBox||!1!==e.intersectsBox(x.boundingBox))){var A,y;if(x instanceof THREE.BufferGeometry){var J,D,B=x.index,z=x.attributes,x=z.position.array;
-void 0!==z.uv&&(A=z.uv.array);if(null!==B)for(var z=B.array,F=0,Q=z.length;F<Q;F+=3){if(B=z[F],J=z[F+1],D=z[F+2],y=c(this,u,e,x,A,B,J,D))y.faceIndex=Math.floor(F/3),t.push(y)}else for(F=0,Q=x.length;F<Q;F+=9)if(B=F/3,J=B+1,D=B+2,y=c(this,u,e,x,A,B,J,D))y.index=B,t.push(y)}else if(x instanceof THREE.Geometry){var M,N,z=B instanceof THREE.MeshFaceMaterial,F=!0===z?B.materials:null,Q=x.vertices;J=x.faces;D=x.faceVertexUvs[0];0<D.length&&(A=D);for(var H=0,I=J.length;H<I;H++){var E=J[H];y=!0===z?F[E.materialIndex]:
-B;if(void 0!==y){D=Q[E.a];M=Q[E.b];N=Q[E.c];if(!0===y.morphTargets){y=x.morphTargets;var O=this.morphTargetInfluences;g.set(0,0,0);h.set(0,0,0);l.set(0,0,0);for(var R=0,P=y.length;R<P;R++){var L=O[R];if(0!==L){var C=y[R].vertices;g.addScaledVector(k.subVectors(C[E.a],D),L);h.addScaledVector(m.subVectors(C[E.b],M),L);l.addScaledVector(p.subVectors(C[E.c],N),L)}}g.add(D);h.add(M);l.add(N);D=g;M=h;N=l}if(y=b(this,u,e,D,M,N,v))A&&(O=A[H],n.copy(O[0]),q.copy(O[1]),r.copy(O[2]),y.uv=a(v,D,M,N,n,q,r)),y.face=
-E,y.faceIndex=H,t.push(y)}}}}}}}();THREE.Mesh.prototype.clone=function(){return(new this.constructor(this.geometry,this.material)).copy(this)};THREE.Bone=function(a){THREE.Object3D.call(this);this.type="Bone";this.skin=a};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.copy=function(a){THREE.Object3D.prototype.copy.call(this,a);this.skin=a.skin;return this};
+r=new THREE.Vector2,t=new THREE.Vector3,v=new THREE.Vector3,u=new THREE.Vector3;return function(u,t){var x=this.geometry,A=this.material;if(void 0!==A){null===x.boundingSphere&&x.computeBoundingSphere();var z=this.matrixWorld;f.copy(x.boundingSphere);f.applyMatrix4(z);if(!1!==u.ray.intersectsSphere(f)&&(d.getInverse(z),e.copy(u.ray).applyMatrix4(d),null===x.boundingBox||!1!==e.intersectsBox(x.boundingBox))){var B,y;if(x instanceof THREE.BufferGeometry){var H,D,A=x.index,z=x.attributes,x=z.position.array;
+void 0!==z.uv&&(B=z.uv.array);if(null!==A)for(var z=A.array,E=0,Q=z.length;E<Q;E+=3){if(A=z[E],H=z[E+1],D=z[E+2],y=c(this,u,e,x,B,A,H,D))y.faceIndex=Math.floor(E/3),t.push(y)}else for(E=0,Q=x.length;E<Q;E+=9)if(A=E/3,H=A+1,D=A+2,y=c(this,u,e,x,B,A,H,D))y.index=A,t.push(y)}else if(x instanceof THREE.Geometry){var M,N,z=A instanceof THREE.MeshFaceMaterial,E=!0===z?A.materials:null,Q=x.vertices;H=x.faces;D=x.faceVertexUvs[0];0<D.length&&(B=D);for(var G=0,J=H.length;G<J;G++){var K=H[G];y=!0===z?E[K.materialIndex]:
+A;if(void 0!==y){D=Q[K.a];M=Q[K.b];N=Q[K.c];if(!0===y.morphTargets){y=x.morphTargets;var O=this.morphTargetInfluences;g.set(0,0,0);h.set(0,0,0);l.set(0,0,0);for(var R=0,P=y.length;R<P;R++){var L=O[R];if(0!==L){var C=y[R].vertices;g.addScaledVector(k.subVectors(C[K.a],D),L);h.addScaledVector(m.subVectors(C[K.b],M),L);l.addScaledVector(p.subVectors(C[K.c],N),L)}}g.add(D);h.add(M);l.add(N);D=g;M=h;N=l}if(y=b(this,u,e,D,M,N,v))B&&(O=B[G],n.copy(O[0]),q.copy(O[1]),r.copy(O[2]),y.uv=a(v,D,M,N,n,q,r)),y.face=
+K,y.faceIndex=G,t.push(y)}}}}}}}();THREE.Mesh.prototype.clone=function(){return(new this.constructor(this.geometry,this.material)).copy(this)};THREE.Bone=function(a){THREE.Object3D.call(this);this.type="Bone";this.skin=a};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.copy=function(a){THREE.Object3D.prototype.copy.call(this,a);this.skin=a.skin;return this};
 THREE.Skeleton=function(a,b,c){this.useVertexTexture=void 0!==c?c:!0;this.identityMatrix=new THREE.Matrix4;a=a||[];this.bones=a.slice(0);this.useVertexTexture?(a=Math.sqrt(4*this.bones.length),a=THREE.Math.nextPowerOfTwo(Math.ceil(a)),this.boneTextureHeight=this.boneTextureWidth=a=Math.max(a,4),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType)):
 THREE.Skeleton=function(a,b,c){this.useVertexTexture=void 0!==c?c:!0;this.identityMatrix=new THREE.Matrix4;a=a||[];this.bones=a.slice(0);this.useVertexTexture?(a=Math.sqrt(4*this.bones.length),a=THREE.Math.nextPowerOfTwo(Math.ceil(a)),this.boneTextureHeight=this.boneTextureWidth=a=Math.max(a,4),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType)):
 this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===b)this.calculateInverses();else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else for(console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],b=0,a=this.bones.length;b<a;b++)this.boneInverses.push(new THREE.Matrix4)};
 this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===b)this.calculateInverses();else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else for(console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],b=0,a=this.bones.length;b<a;b++)this.boneInverses.push(new THREE.Matrix4)};
 THREE.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var a=0,b=this.bones.length;a<b;a++){var c=new THREE.Matrix4;this.bones[a]&&c.getInverse(this.bones[a].matrixWorld);this.boneInverses.push(c)}};
 THREE.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var a=0,b=this.bones.length;a<b;a++){var c=new THREE.Matrix4;this.bones[a]&&c.getInverse(this.bones[a].matrixWorld);this.boneInverses.push(c)}};
@@ -582,83 +583,83 @@ THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sa
 "vec4 pack_depth( const in float depth ) {\n\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bit_mask;\n\treturn res;\n}\nvoid main() {",THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n\t#else\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n\t#endif\n}"].join("\n")},
 "vec4 pack_depth( const in float depth ) {\n\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bit_mask;\n\treturn res;\n}\nvoid main() {",THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n\t#else\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n\t#endif\n}"].join("\n")},
 distanceRGBA:{uniforms:{lightPos:{type:"v3",value:new THREE.Vector3(0,0,0)}},vertexShader:["varying vec4 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.begin_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.project_vertex,THREE.ShaderChunk.worldpos_vertex,"vWorldPosition = worldPosition;\n}"].join("\n"),fragmentShader:["uniform vec3 lightPos;\nvarying vec4 vWorldPosition;",
 distanceRGBA:{uniforms:{lightPos:{type:"v3",value:new THREE.Vector3(0,0,0)}},vertexShader:["varying vec4 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.begin_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.project_vertex,THREE.ShaderChunk.worldpos_vertex,"vWorldPosition = worldPosition;\n}"].join("\n"),fragmentShader:["uniform vec3 lightPos;\nvarying vec4 vWorldPosition;",
 THREE.ShaderChunk.common,"vec4 pack1K ( float depth ) {\n   depth /= 1000.0;\n   const vec4 bitSh = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bitMsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = fract( depth * bitSh );\n\tres -= res.xxyz * bitMsk;\n\treturn res; \n}\nfloat unpack1K ( vec4 color ) {\n\tconst vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\treturn dot( color, bitSh ) * 1000.0;\n}\nvoid main () {\n\tgl_FragColor = pack1K( length( vWorldPosition.xyz - lightPos.xyz ) );\n}"].join("\n")}};
 THREE.ShaderChunk.common,"vec4 pack1K ( float depth ) {\n   depth /= 1000.0;\n   const vec4 bitSh = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bitMsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = fract( depth * bitSh );\n\tres -= res.xxyz * bitMsk;\n\treturn res; \n}\nfloat unpack1K ( vec4 color ) {\n\tconst vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\treturn dot( color, bitSh ) * 1000.0;\n}\nvoid main () {\n\tgl_FragColor = pack1K( length( vWorldPosition.xyz - lightPos.xyz ) );\n}"].join("\n")}};
-THREE.WebGLRenderer=function(a){function b(a,b,c,d){!0===P&&(a*=d,b*=d,c*=d);s.clearColor(a,b,c,d)}function c(){K.init();s.viewport(fa,ga,ha,ia);b(C.r,C.g,C.b,X)}function d(){ja=va=null;ka="";qa=-1;la=!0;K.reset()}function e(a){a.preventDefault();d();c();T.clear()}function f(a){a=a.target;a.removeEventListener("dispose",f);a:{var b=T.get(a);if(a.image&&b.__image__webglTextureCube)s.deleteTexture(b.__image__webglTextureCube);else{if(void 0===b.__webglInit)break a;s.deleteTexture(b.__webglTexture)}T.delete(a)}da.textures--}
-function g(a){a=a.target;a.removeEventListener("dispose",g);var b=T.get(a),c=T.get(a.texture);if(a&&void 0!==c.__webglTexture){s.deleteTexture(c.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(c=0;6>c;c++)s.deleteFramebuffer(b.__webglFramebuffer[c]),s.deleteRenderbuffer(b.__webglRenderbuffer[c]);else s.deleteFramebuffer(b.__webglFramebuffer),s.deleteRenderbuffer(b.__webglRenderbuffer);T.delete(a.texture);T.delete(a)}da.textures--}function h(a){a=a.target;a.removeEventListener("dispose",
-h);l(a);T.delete(a)}function l(a){var b=ra.get(a).program;a.program=void 0;void 0!==b&&ma.releaseProgram(b)}function k(a,b){return b[0]-a[0]}function m(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function p(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function n(a,b,c,d,e){var f;
-c.transparent?(d=aa,f=++na):(d=Y,f=++ea);f=d[f];void 0!==f?(f.id=a.id,f.object=a,f.geometry=b,f.material=c,f.z=W.z,f.group=e):(f={id:a.id,object:a,geometry:b,material:c,z:W.z,group:e},d.push(f))}function q(a,b){if(!1!==a.visible){if(a.layers.test(b.layers))if(a instanceof THREE.Light)U.push(a);else if(a instanceof THREE.Sprite)!1!==a.frustumCulled&&!0!==wa.intersectsObject(a)||$.push(a);else if(a instanceof THREE.LensFlare)xa.push(a);else if(a instanceof THREE.ImmediateRenderObject)!0===Z.sortObjects&&
-(W.setFromMatrixPosition(a.matrixWorld),W.applyProjection(sa)),n(a,null,a.material,W.z,null);else if(a instanceof THREE.Mesh||a instanceof THREE.Line||a instanceof THREE.Points)if(a instanceof THREE.SkinnedMesh&&a.skeleton.update(),!1===a.frustumCulled||!0===wa.intersectsObject(a)){var c=a.material;if(!0===c.visible){!0===Z.sortObjects&&(W.setFromMatrixPosition(a.matrixWorld),W.applyProjection(sa));var d=oa.update(a);if(c instanceof THREE.MeshFaceMaterial)for(var e=d.groups,f=c.materials,c=0,g=e.length;c<
-g;c++){var h=e[c],l=f[h.materialIndex];!0===l.visible&&n(a,d,l,W.z,h)}else n(a,d,c,W.z,null)}}d=a.children;c=0;for(g=d.length;c<g;c++)q(d[c],b)}}function r(a,b,c,d,e){for(var f=0,g=a.length;f<g;f++){var h=a[f],l=h.object,k=h.geometry,n=void 0===e?h.material:e,h=h.group;l.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,l.matrixWorld);l.normalMatrix.getNormalMatrix(l.modelViewMatrix);if(l instanceof THREE.ImmediateRenderObject){t(n);var m=v(b,c,d,n,l);ka="";l.render(function(a){Z.renderBufferImmediate(a,
-m,n)})}else Z.renderBufferDirect(b,c,d,k,n,l,h)}}function t(a){a.side!==THREE.DoubleSide?K.enable(s.CULL_FACE):K.disable(s.CULL_FACE);K.setFlipSided(a.side===THREE.BackSide);!0===a.transparent?K.setBlending(a.blending,a.blendEquation,a.blendSrc,a.blendDst,a.blendEquationAlpha,a.blendSrcAlpha,a.blendDstAlpha):K.setBlending(THREE.NoBlending);K.setDepthFunc(a.depthFunc);K.setDepthTest(a.depthTest);K.setDepthWrite(a.depthWrite);K.setColorWrite(a.colorWrite);K.setPolygonOffset(a.polygonOffset,a.polygonOffsetFactor,
-a.polygonOffsetUnits)}function v(a,b,c,d,e){ta=0;var f=ra.get(d);if(d.needsUpdate||!f.program){a:{var g=ra.get(d),k=ma.getParameters(d,b,c,e),n=ma.getProgramCode(d,k),m=g.program,q=!0;if(void 0===m)d.addEventListener("dispose",h);else if(m.code!==n)l(d);else if(void 0!==k.shaderID)break a;else q=!1;q&&(k.shaderID?(m=THREE.ShaderLib[k.shaderID],g.__webglShader={name:d.type,uniforms:THREE.UniformsUtils.clone(m.uniforms),vertexShader:m.vertexShader,fragmentShader:m.fragmentShader}):g.__webglShader={name:d.type,
-uniforms:d.uniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader},d.__webglShader=g.__webglShader,m=ma.acquireProgram(d,k,n),g.program=m,d.program=m);k=m.getAttributes();if(d.morphTargets)for(n=d.numSupportedMorphTargets=0;n<Z.maxMorphTargets;n++)0<=k["morphTarget"+n]&&d.numSupportedMorphTargets++;if(d.morphNormals)for(n=d.numSupportedMorphNormals=0;n<Z.maxMorphNormals;n++)0<=k["morphNormal"+n]&&d.numSupportedMorphNormals++;g.uniformsList=[];var k=g.__webglShader.uniforms,n=g.program.getUniforms(),
-p;for(p in k)(m=n[p])&&g.uniformsList.push([g.__webglShader.uniforms[p],m]);if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhysicalMaterial||d.lights)k.ambientLightColor.value=V.ambient,k.directionalLights.value=V.directional,k.pointLights.value=V.point,k.spotLights.value=V.spot,k.hemisphereLights.value=V.hemi}d.needsUpdate=!1}m=n=q=!1;g=f.program;p=g.getUniforms();k=f.__webglShader.uniforms;g.id!==va&&(s.useProgram(g.program),va=g.id,m=n=q=
-!0);d.id!==qa&&(qa=d.id,n=!0);if(q||a!==ja)s.uniformMatrix4fv(p.projectionMatrix,!1,a.projectionMatrix.elements),ba.logarithmicDepthBuffer&&s.uniform1f(p.logDepthBufFC,2/(Math.log(a.far+1)/Math.LN2)),a!==ja&&(ja=a,la=n=!0),(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshPhysicalMaterial||d.envMap)&&void 0!==p.cameraPosition&&(W.setFromMatrixPosition(a.matrixWorld),s.uniform3f(p.cameraPosition,W.x,W.y,W.z)),(d instanceof THREE.MeshPhongMaterial||d instanceof
-THREE.MeshLambertMaterial||d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshPhysicalMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&void 0!==p.viewMatrix&&s.uniformMatrix4fv(p.viewMatrix,!1,a.matrixWorldInverse.elements);d.skinning&&(e.bindMatrix&&void 0!==p.bindMatrix&&s.uniformMatrix4fv(p.bindMatrix,!1,e.bindMatrix.elements),e.bindMatrixInverse&&void 0!==p.bindMatrixInverse&&s.uniformMatrix4fv(p.bindMatrixInverse,!1,e.bindMatrixInverse.elements),ba.floatVertexTextures&&e.skeleton&&
-e.skeleton.useVertexTexture?(void 0!==p.boneTexture&&(q=u(),s.uniform1i(p.boneTexture,q),Z.setTexture(e.skeleton.boneTexture,q)),void 0!==p.boneTextureWidth&&s.uniform1i(p.boneTextureWidth,e.skeleton.boneTextureWidth),void 0!==p.boneTextureHeight&&s.uniform1i(p.boneTextureHeight,e.skeleton.boneTextureHeight)):e.skeleton&&e.skeleton.boneMatrices&&void 0!==p.boneGlobalMatrices&&s.uniformMatrix4fv(p.boneGlobalMatrices,!1,e.skeleton.boneMatrices));if(n){c&&d.fog&&(k.fogColor.value=c.color,c instanceof
-THREE.Fog?(k.fogNear.value=c.near,k.fogFar.value=c.far):c instanceof THREE.FogExp2&&(k.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhysicalMaterial||d.lights)la&&(la=!1,m=!0),c=m,k.ambientLightColor.needsUpdate=c,k.directionalLights.needsUpdate=c,k.pointLights.needsUpdate=c,k.spotLights.needsUpdate=c,k.hemisphereLights.needsUpdate=c;if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||
-d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshPhysicalMaterial){k.opacity.value=d.opacity;k.diffuse.value=d.color;d.emissive&&(k.emissive.value=d.emissive);k.map.value=d.map;k.specularMap.value=d.specularMap;k.alphaMap.value=d.alphaMap;d.aoMap&&(k.aoMap.value=d.aoMap,k.aoMapIntensity.value=d.aoMapIntensity);var r;d.map?r=d.map:d.specularMap?r=d.specularMap:d.displacementMap?r=d.displacementMap:d.normalMap?r=d.normalMap:d.bumpMap?r=d.bumpMap:d.alphaMap?r=d.alphaMap:d.emissiveMap&&(r=
-d.emissiveMap);void 0!==r&&(r instanceof THREE.WebGLRenderTarget&&(r=r.texture),c=r.offset,r=r.repeat,k.offsetRepeat.value.set(c.x,c.y,r.x,r.y));k.envMap.value=d.envMap;k.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;k.reflectivity.value=d.reflectivity;k.refractionRatio.value=d.refractionRatio}d instanceof THREE.LineBasicMaterial?(k.diffuse.value=d.color,k.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(k.diffuse.value=d.color,k.opacity.value=d.opacity,k.dashSize.value=
-d.dashSize,k.totalSize.value=d.dashSize+d.gapSize,k.scale.value=d.scale):d instanceof THREE.PointsMaterial?(k.psColor.value=d.color,k.opacity.value=d.opacity,k.size.value=d.size*H,k.scale.value=F.height/2,k.map.value=d.map,null!==d.map&&(a=d.map.offset,r=d.map.repeat,k.offsetRepeat.value.set(a.x,a.y,r.x,r.y))):d instanceof THREE.MeshPhongMaterial?(k.specular.value=d.specular,k.shininess.value=Math.max(d.shininess,1E-4),d.lightMap&&(k.lightMap.value=d.lightMap,k.lightMapIntensity.value=d.lightMapIntensity),
-d.emissiveMap&&(k.emissiveMap.value=d.emissiveMap),d.bumpMap&&(k.bumpMap.value=d.bumpMap,k.bumpScale.value=d.bumpScale),d.normalMap&&(k.normalMap.value=d.normalMap,k.normalScale.value.copy(d.normalScale)),d.displacementMap&&(k.displacementMap.value=d.displacementMap,k.displacementScale.value=d.displacementScale,k.displacementBias.value=d.displacementBias)):d instanceof THREE.MeshPhysicalMaterial?(k.roughness.value=d.roughness,k.metalness.value=d.metalness,d.roughnessMap&&(k.roughnessMap.value=d.roughnessMap),
-d.reflectivityMap&&(k.reflectivityMap.value=d.reflectivityMap),d.metalnessMap&&(k.metalnessMap.value=d.metalnessMap),d.lightMap&&(k.lightMap.value=d.lightMap,k.lightMapIntensity.value=d.lightMapIntensity),d.emissiveMap&&(k.emissiveMap.value=d.emissiveMap),d.bumpMap&&(k.bumpMap.value=d.bumpMap,k.bumpScale.value=d.bumpScale),d.normalMap&&(k.normalMap.value=d.normalMap,k.normalScale.value.copy(d.normalScale)),d.displacementMap&&(k.displacementMap.value=d.displacementMap,k.displacementScale.value=d.displacementScale,
-k.displacementBias.value=d.displacementBias),d.envMap&&(k.envMapIntensity.value=d.envMapIntensity)):d instanceof THREE.MeshDepthMaterial?(k.mNear.value=a.near,k.mFar.value=a.far,k.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(k.opacity.value=d.opacity);if(ya.enabled&&e.receiveShadow&&!d._shadowPass&&k.shadowMatrix)for(a=d=0,r=b.length;a<r;a++)c=b[a],!0===c.castShadow&&(c instanceof THREE.PointLight||c instanceof THREE.SpotLight||c instanceof THREE.DirectionalLight)&&(n=c.shadow,
-c instanceof THREE.PointLight?(W.setFromMatrixPosition(c.matrixWorld).negate(),n.matrix.identity().setPosition(W),k.shadowDarkness.value[d]=-n.darkness):k.shadowDarkness.value[d]=n.darkness,k.shadowMatrix.value[d]=n.matrix,k.shadowMap.value[d]=n.map,k.shadowMapSize.value[d]=n.mapSize,k.shadowBias.value[d]=n.bias,d++);b=f.uniformsList;f=0;for(d=b.length;f<d;f++)if(a=b[f][0],!1!==a.needsUpdate)switch(c=a.type,k=a.value,r=b[f][1],c){case "1i":s.uniform1i(r,k);break;case "1f":s.uniform1f(r,k);break;case "2f":s.uniform2f(r,
-k[0],k[1]);break;case "3f":s.uniform3f(r,k[0],k[1],k[2]);break;case "4f":s.uniform4f(r,k[0],k[1],k[2],k[3]);break;case "1iv":s.uniform1iv(r,k);break;case "3iv":s.uniform3iv(r,k);break;case "1fv":s.uniform1fv(r,k);break;case "2fv":s.uniform2fv(r,k);break;case "3fv":s.uniform3fv(r,k);break;case "4fv":s.uniform4fv(r,k);break;case "Matrix3fv":s.uniformMatrix3fv(r,!1,k);break;case "Matrix4fv":s.uniformMatrix4fv(r,!1,k);break;case "i":s.uniform1i(r,k);break;case "f":s.uniform1f(r,k);break;case "v2":s.uniform2f(r,
-k.x,k.y);break;case "v3":s.uniform3f(r,k.x,k.y,k.z);break;case "v4":s.uniform4f(r,k.x,k.y,k.z,k.w);break;case "c":s.uniform3f(r,k.r,k.g,k.b);break;case "s":for(var t in a.properties)switch(n=a.properties[t],m=r[t],q=k[t],n.type){case "f":s.uniform1f(m,q);break;case "v2":s.uniform2f(m,q.x,q.y);break;case "v3":s.uniform3f(m,q.x,q.y,q.z);break;case "v4":s.uniform4f(m,q.x,q.y,q.z,q.w);break;case "c":s.uniform3f(m,q.r,q.g,q.b)}break;case "sa":for(c=0;c<k.length;c++)for(t in a.properties)switch(n=a.properties[t],
-m=r[c][t],q=k[c][t],n.type){case "f":s.uniform1f(m,q);break;case "v2":s.uniform2f(m,q.x,q.y);break;case "v3":s.uniform3f(m,q.x,q.y,q.z);break;case "v4":s.uniform4f(m,q.x,q.y,q.z,q.w);break;case "c":s.uniform3f(m,q.r,q.g,q.b)}break;case "iv1":s.uniform1iv(r,k);break;case "iv":s.uniform3iv(r,k);break;case "fv1":s.uniform1fv(r,k);break;case "fv":s.uniform3fv(r,k);break;case "v2v":void 0===a._array&&(a._array=new Float32Array(2*k.length));m=c=0;for(n=k.length;c<n;c++,m+=2)a._array[m+0]=k[c].x,a._array[m+
-1]=k[c].y;s.uniform2fv(r,a._array);break;case "v3v":void 0===a._array&&(a._array=new Float32Array(3*k.length));m=c=0;for(n=k.length;c<n;c++,m+=3)a._array[m+0]=k[c].x,a._array[m+1]=k[c].y,a._array[m+2]=k[c].z;s.uniform3fv(r,a._array);break;case "v4v":void 0===a._array&&(a._array=new Float32Array(4*k.length));m=c=0;for(n=k.length;c<n;c++,m+=4)a._array[m+0]=k[c].x,a._array[m+1]=k[c].y,a._array[m+2]=k[c].z,a._array[m+3]=k[c].w;s.uniform4fv(r,a._array);break;case "m3":s.uniformMatrix3fv(r,!1,k.elements);
-break;case "m3v":void 0===a._array&&(a._array=new Float32Array(9*k.length));c=0;for(n=k.length;c<n;c++)k[c].flattenToArrayOffset(a._array,9*c);s.uniformMatrix3fv(r,!1,a._array);break;case "m4":s.uniformMatrix4fv(r,!1,k.elements);break;case "m4v":void 0===a._array&&(a._array=new Float32Array(16*k.length));c=0;for(n=k.length;c<n;c++)k[c].flattenToArrayOffset(a._array,16*c);s.uniformMatrix4fv(r,!1,a._array);break;case "t":m=u();s.uniform1i(r,m);if(!k)continue;k instanceof THREE.CubeTexture||Array.isArray(k.image)&&
-6===k.image.length?B(k,m):k instanceof THREE.WebGLRenderTargetCube?z(k.texture,m):k instanceof THREE.WebGLRenderTarget?Z.setTexture(k.texture,m):Z.setTexture(k,m);break;case "tv":void 0===a._array&&(a._array=[]);c=0;for(n=a.value.length;c<n;c++)a._array[c]=u();s.uniform1iv(r,a._array);c=0;for(n=a.value.length;c<n;c++)k=a.value[c],m=a._array[c],k&&(k instanceof THREE.CubeTexture||k.image instanceof Array&&6===k.image.length?B(k,m):k instanceof THREE.WebGLRenderTarget?Z.setTexture(k.texture,m):k instanceof
-THREE.WebGLRenderTargetCube?z(k.texture,m):Z.setTexture(k,m));break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+c)}}s.uniformMatrix4fv(p.modelViewMatrix,!1,e.modelViewMatrix.elements);p.normalMatrix&&s.uniformMatrix3fv(p.normalMatrix,!1,e.normalMatrix.elements);void 0!==p.modelMatrix&&s.uniformMatrix4fv(p.modelMatrix,!1,e.matrixWorld.elements);return g}function u(){var a=ta;a>=ba.maxTextures&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+
-ba.maxTextures);ta+=1;return a}function w(a,b,c){c?(s.texParameteri(a,s.TEXTURE_WRAP_S,D(b.wrapS)),s.texParameteri(a,s.TEXTURE_WRAP_T,D(b.wrapT)),s.texParameteri(a,s.TEXTURE_MAG_FILTER,D(b.magFilter)),s.texParameteri(a,s.TEXTURE_MIN_FILTER,D(b.minFilter))):(s.texParameteri(a,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(a,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),b.wrapS===THREE.ClampToEdgeWrapping&&b.wrapT===THREE.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",
-b),s.texParameteri(a,s.TEXTURE_MAG_FILTER,J(b.magFilter)),s.texParameteri(a,s.TEXTURE_MIN_FILTER,J(b.minFilter)),b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",b));!(c=S.get("EXT_texture_filter_anisotropic"))||b.type===THREE.FloatType&&null===S.get("OES_texture_float_linear")||b.type===THREE.HalfFloatType&&null===S.get("OES_texture_half_float_linear")||
-!(1<b.anisotropy||T.get(b).__currentAnisotropy)||(s.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Z.getMaxAnisotropy())),T.get(b).__currentAnisotropy=b.anisotropy)}function G(a,b){if(a.width>b||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElement("canvas");d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+
-"). Resized to "+d.width+"x"+d.height,a);return d}return a}function x(a){return THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height)}function B(a,b){var c=T.get(a);if(6===a.image.length)if(0<a.version&&c.__version!==a.version){c.__image__webglTextureCube||(a.addEventListener("dispose",f),c.__image__webglTextureCube=s.createTexture(),da.textures++);K.activeTexture(s.TEXTURE0+b);K.bindTexture(s.TEXTURE_CUBE_MAP,c.__image__webglTextureCube);s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,a.flipY);
-for(var d=a instanceof THREE.CompressedTexture,e=a.image[0]instanceof THREE.DataTexture,g=[],h=0;6>h;h++)g[h]=!Z.autoScaleCubemaps||d||e?e?a.image[h].image:a.image[h]:G(a.image[h],ba.maxCubemapSize);var k=x(g[0]),l=D(a.format),m=D(a.type);w(s.TEXTURE_CUBE_MAP,a,k);for(h=0;6>h;h++)if(d)for(var n,q=g[h].mipmaps,p=0,r=q.length;p<r;p++)n=q[p],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<K.getCompressedTextureFormats().indexOf(l)?K.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,p,l,
-n.width,n.height,0,n.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):K.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,p,l,n.width,n.height,0,l,m,n.data);else e?K.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,l,g[h].width,g[h].height,0,l,m,g[h].data):K.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,l,l,m,g[h]);a.generateMipmaps&&k&&s.generateMipmap(s.TEXTURE_CUBE_MAP);c.__version=a.version;if(a.onUpdate)a.onUpdate(a)}else K.activeTexture(s.TEXTURE0+
-b),K.bindTexture(s.TEXTURE_CUBE_MAP,c.__image__webglTextureCube)}function z(a,b){K.activeTexture(s.TEXTURE0+b);K.bindTexture(s.TEXTURE_CUBE_MAP,T.get(a).__webglTexture)}function A(a,b,c){s.bindFramebuffer(s.FRAMEBUFFER,a);s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,c,T.get(b.texture).__webglTexture,0)}function y(a,b){s.bindRenderbuffer(s.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_COMPONENT16,b.width,b.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,
-s.DEPTH_ATTACHMENT,s.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,b.width,b.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,a)):s.renderbufferStorage(s.RENDERBUFFER,s.RGBA4,b.width,b.height)}function J(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?s.NEAREST:s.LINEAR}function D(a){var b;if(a===THREE.RepeatWrapping)return s.REPEAT;if(a===THREE.ClampToEdgeWrapping)return s.CLAMP_TO_EDGE;
-if(a===THREE.MirroredRepeatWrapping)return s.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return s.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return s.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return s.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return s.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return s.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return s.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return s.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return s.UNSIGNED_SHORT_4_4_4_4;
-if(a===THREE.UnsignedShort5551Type)return s.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return s.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return s.BYTE;if(a===THREE.ShortType)return s.SHORT;if(a===THREE.UnsignedShortType)return s.UNSIGNED_SHORT;if(a===THREE.IntType)return s.INT;if(a===THREE.UnsignedIntType)return s.UNSIGNED_INT;if(a===THREE.FloatType)return s.FLOAT;b=S.get("OES_texture_half_float");if(null!==b&&a===THREE.HalfFloatType)return b.HALF_FLOAT_OES;if(a===THREE.AlphaFormat)return s.ALPHA;
-if(a===THREE.RGBFormat)return s.RGB;if(a===THREE.RGBAFormat)return s.RGBA;if(a===THREE.LuminanceFormat)return s.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return s.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return s.FUNC_ADD;if(a===THREE.SubtractEquation)return s.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return s.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return s.ZERO;if(a===THREE.OneFactor)return s.ONE;if(a===THREE.SrcColorFactor)return s.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return s.ONE_MINUS_SRC_COLOR;
-if(a===THREE.SrcAlphaFactor)return s.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return s.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return s.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return s.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return s.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return s.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return s.SRC_ALPHA_SATURATE;b=S.get("WEBGL_compressed_texture_s3tc");if(null!==b){if(a===THREE.RGB_S3TC_DXT1_Format)return b.COMPRESSED_RGB_S3TC_DXT1_EXT;
-if(a===THREE.RGBA_S3TC_DXT1_Format)return b.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return b.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return b.COMPRESSED_RGBA_S3TC_DXT5_EXT}b=S.get("WEBGL_compressed_texture_pvrtc");if(null!==b){if(a===THREE.RGB_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===THREE.RGB_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===THREE.RGBA_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
-if(a===THREE.RGBA_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}b=S.get("EXT_blend_minmax");if(null!==b){if(a===THREE.MinEquation)return b.MIN_EXT;if(a===THREE.MaxEquation)return b.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var F=void 0!==a.canvas?a.canvas:document.createElement("canvas"),Q=void 0!==a.context?a.context:null,M=F.width,N=F.height,H=1,I=void 0!==a.alpha?a.alpha:!1,E=void 0!==a.depth?a.depth:!0,O=void 0!==a.stencil?a.stencil:!0,R=void 0!==
-a.antialias?a.antialias:!1,P=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,L=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,C=new THREE.Color(0),X=0,U=[],Y=[],ea=-1,aa=[],na=-1,pa=new Float32Array(8),$=[],xa=[];this.domElement=F;this.context=null;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.gammaFactor=2;this.gammaOutput=this.gammaInput=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;var Z=this,
-va=null,ua=null,qa=-1,ka="",ja=null,ta=0,fa=0,ga=0,ha=F.width,ia=F.height,za=0,Aa=0,wa=new THREE.Frustum,sa=new THREE.Matrix4,W=new THREE.Vector3,V={ambient:[0,0,0],directional:[],point:[],spot:[],hemi:[]},la=!0,da={geometries:0,textures:0},ca={calls:0,vertices:0,faces:0,points:0};this.info={render:ca,memory:da,programs:null};var s;try{I={alpha:I,depth:E,stencil:O,antialias:R,premultipliedAlpha:P,preserveDrawingBuffer:L};s=Q||F.getContext("webgl",I)||F.getContext("experimental-webgl",I);if(null===
-s){if(null!==F.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";}F.addEventListener("webglcontextlost",e,!1)}catch(Ba){console.error("THREE.WebGLRenderer: "+Ba)}var S=new THREE.WebGLExtensions(s);S.get("OES_texture_float");S.get("OES_texture_float_linear");S.get("OES_texture_half_float");S.get("OES_texture_half_float_linear");S.get("OES_standard_derivatives");S.get("ANGLE_instanced_arrays");S.get("OES_element_index_uint")&&
-(THREE.BufferGeometry.MaxIndex=4294967296);var ba=new THREE.WebGLCapabilities(s,S,a),K=new THREE.WebGLState(s,S,D),T=new THREE.WebGLProperties,ra=new THREE.WebGLMaterials,oa=new THREE.WebGLObjects(s,T,this.info),ma=new THREE.WebGLPrograms(this,ba);this.info.programs=ma.programs;var Ca=new THREE.WebGLBufferRenderer(s,S,ca),Da=new THREE.WebGLIndexedBufferRenderer(s,S,ca);c();this.context=s;this.capabilities=ba;this.extensions=S;this.state=K;var ya=new THREE.WebGLShadowMap(this,U,oa);this.shadowMap=
-ya;var Ea=new THREE.SpritePlugin(this,$),Fa=new THREE.LensFlarePlugin(this,xa);this.getContext=function(){return s};this.getContextAttributes=function(){return s.getContextAttributes()};this.forceContextLoss=function(){S.get("WEBGL_lose_context").loseContext()};this.getMaxAnisotropy=function(){var a;return function(){if(void 0!==a)return a;var b=S.get("EXT_texture_filter_anisotropic");return a=null!==b?s.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}();this.getPrecision=function(){return ba.precision};
-this.getPixelRatio=function(){return H};this.setPixelRatio=function(a){void 0!==a&&(H=a)};this.getSize=function(){return{width:M,height:N}};this.setSize=function(a,b,c){M=a;N=b;F.width=a*H;F.height=b*H;!1!==c&&(F.style.width=a+"px",F.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){fa=a*H;ga=b*H;ha=c*H;ia=d*H;s.viewport(fa,ga,ha,ia)};this.getViewport=function(a){a.x=fa/H;a.y=ga/H;a.z=ha/H;a.w=ia/H};this.setScissor=function(a,b,c,d){s.scissor(a*H,b*H,c*H,d*H)};this.enableScissorTest=
-function(a){K.setScissorTest(a)};this.getClearColor=function(){return C};this.setClearColor=function(a,c){C.set(a);X=void 0!==c?c:1;b(C.r,C.g,C.b,X)};this.getClearAlpha=function(){return X};this.setClearAlpha=function(a){X=a;b(C.r,C.g,C.b,X)};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=s.COLOR_BUFFER_BIT;if(void 0===b||b)d|=s.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=s.STENCIL_BUFFER_BIT;s.clear(d)};this.clearColor=function(){s.clear(s.COLOR_BUFFER_BIT)};this.clearDepth=function(){s.clear(s.DEPTH_BUFFER_BIT)};
-this.clearStencil=function(){s.clear(s.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.resetGLState=d;this.dispose=function(){F.removeEventListener("webglcontextlost",e,!1)};this.renderBufferImmediate=function(a,b,c){K.initAttributes();var d=T.get(a);a.hasPositions&&!d.position&&(d.position=s.createBuffer());a.hasNormals&&!d.normal&&(d.normal=s.createBuffer());a.hasUvs&&!d.uv&&(d.uv=s.createBuffer());a.hasColors&&!d.color&&(d.color=s.createBuffer());
-b=b.getAttributes();a.hasPositions&&(s.bindBuffer(s.ARRAY_BUFFER,d.position),s.bufferData(s.ARRAY_BUFFER,a.positionArray,s.DYNAMIC_DRAW),K.enableAttribute(b.position),s.vertexAttribPointer(b.position,3,s.FLOAT,!1,0,0));if(a.hasNormals){s.bindBuffer(s.ARRAY_BUFFER,d.normal);if("MeshPhongMaterial"!==c.type&&"MeshPhysicalMaterial"!==c.type&&c.shading===THREE.FlatShading)for(var e=0,f=3*a.count;e<f;e+=9){var g=a.normalArray,h=(g[e+0]+g[e+3]+g[e+6])/3,k=(g[e+1]+g[e+4]+g[e+7])/3,l=(g[e+2]+g[e+5]+g[e+8])/
-3;g[e+0]=h;g[e+1]=k;g[e+2]=l;g[e+3]=h;g[e+4]=k;g[e+5]=l;g[e+6]=h;g[e+7]=k;g[e+8]=l}s.bufferData(s.ARRAY_BUFFER,a.normalArray,s.DYNAMIC_DRAW);K.enableAttribute(b.normal);s.vertexAttribPointer(b.normal,3,s.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(s.bindBuffer(s.ARRAY_BUFFER,d.uv),s.bufferData(s.ARRAY_BUFFER,a.uvArray,s.DYNAMIC_DRAW),K.enableAttribute(b.uv),s.vertexAttribPointer(b.uv,2,s.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(s.bindBuffer(s.ARRAY_BUFFER,d.color),s.bufferData(s.ARRAY_BUFFER,
-a.colorArray,s.DYNAMIC_DRAW),K.enableAttribute(b.color),s.vertexAttribPointer(b.color,3,s.FLOAT,!1,0,0));K.disableUnusedAttributes();s.drawArrays(s.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f,g){t(e);var h=v(a,b,c,e,f),l=!1;a=d.id+"_"+h.id+"_"+e.wireframe;a!==ka&&(ka=a,l=!0);b=f.morphTargetInfluences;if(void 0!==b){a=[];c=0;for(l=b.length;c<l;c++){var m=b[c];a.push([m,c])}a.sort(k);8<a.length&&(a.length=8);var n=d.morphAttributes;c=0;for(l=a.length;c<l;c++)m=a[c],
-pa[c]=m[0],0!==m[0]?(b=m[1],!0===e.morphTargets&&n.position&&d.addAttribute("morphTarget"+c,n.position[b]),!0===e.morphNormals&&n.normal&&d.addAttribute("morphNormal"+c,n.normal[b])):(!0===e.morphTargets&&d.removeAttribute("morphTarget"+c),!0===e.morphNormals&&d.removeAttribute("morphNormal"+c));a=h.getUniforms();null!==a.morphTargetInfluences&&s.uniform1fv(a.morphTargetInfluences,pa);l=!0}b=d.index;c=d.attributes.position;!0===e.wireframe&&(b=oa.getWireframeAttribute(d));null!==b?(a=Da,a.setIndex(b)):
-a=Ca;if(l){a:{var l=void 0,q;if(d instanceof THREE.InstancedBufferGeometry&&(q=S.get("ANGLE_instanced_arrays"),null===q)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}void 0===l&&(l=0);K.initAttributes();var m=d.attributes,h=h.getAttributes(),n=e.defaultAttributeValues,p;for(p in h){var r=h[p];if(0<=r){var u=m[p];if(void 0!==u){var w=u.itemSize,x=oa.getAttributeBuffer(u);if(u instanceof
-THREE.InterleavedBufferAttribute){var D=u.data,G=D.stride,u=u.offset;D instanceof THREE.InstancedInterleavedBuffer?(K.enableAttributeAndDivisor(r,D.meshPerAttribute,q),void 0===d.maxInstancedCount&&(d.maxInstancedCount=D.meshPerAttribute*D.count)):K.enableAttribute(r);s.bindBuffer(s.ARRAY_BUFFER,x);s.vertexAttribPointer(r,w,s.FLOAT,!1,G*D.array.BYTES_PER_ELEMENT,(l*G+u)*D.array.BYTES_PER_ELEMENT)}else u instanceof THREE.InstancedBufferAttribute?(K.enableAttributeAndDivisor(r,u.meshPerAttribute,q),
-void 0===d.maxInstancedCount&&(d.maxInstancedCount=u.meshPerAttribute*u.count)):K.enableAttribute(r),s.bindBuffer(s.ARRAY_BUFFER,x),s.vertexAttribPointer(r,w,s.FLOAT,!1,0,l*w*4)}else if(void 0!==n&&(w=n[p],void 0!==w))switch(w.length){case 2:s.vertexAttrib2fv(r,w);break;case 3:s.vertexAttrib3fv(r,w);break;case 4:s.vertexAttrib4fv(r,w);break;default:s.vertexAttrib1fv(r,w)}}}K.disableUnusedAttributes()}null!==b&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,oa.getAttributeBuffer(b))}q=Infinity;null!==b?q=b.count:
-void 0!==c&&(q=c.count);p=d.drawRange.start;b=d.drawRange.count;c=null!==g?g.start:0;l=null!==g?g.count:Infinity;g=Math.max(0,p,c);q=Math.min(0+q,p+b,c+l)-1;q=Math.max(0,q-g+1);f instanceof THREE.Mesh?(!0===e.wireframe?(K.setLineWidth(e.wireframeLinewidth*H),a.setMode(s.LINES)):a.setMode(s.TRIANGLES),d instanceof THREE.InstancedBufferGeometry&&0<d.maxInstancedCount?a.renderInstances(d):a.render(g,q)):f instanceof THREE.Line?(d=e.linewidth,void 0===d&&(d=1),K.setLineWidth(d*H),f instanceof THREE.LineSegments?
-a.setMode(s.LINES):a.setMode(s.LINE_STRIP),a.render(g,q)):f instanceof THREE.Points&&(a.setMode(s.POINTS),a.render(g,q))};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=a.fog;ka="";qa=-1;ja=null;la=!0;!0===a.autoUpdate&&a.updateMatrixWorld();null===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);sa.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);
-wa.setFromMatrix(sa);U.length=0;na=ea=-1;$.length=0;xa.length=0;q(a,b);Y.length=ea+1;aa.length=na+1;!0===Z.sortObjects&&(Y.sort(m),aa.sort(p));var f=U,g,h,k,l=0,n=0,u=0,t,w,v,D=b.matrixWorldInverse,G=V.directional.length,F=V.point.length,A=V.spot.length,z=V.hemi.length,B=0,H=0,y=0,I=0;g=0;for(h=f.length;g<h;g++)if(k=f[g],t=k.color,w=k.intensity,v=k.distance,k instanceof THREE.AmbientLight)l+=t.r,n+=t.g,u+=t.b;else if(k instanceof THREE.DirectionalLight){k.__webglUniforms||(k.__webglUniforms={direction:new THREE.Vector3,
-color:new THREE.Color});var E=k.__webglUniforms;E.direction.setFromMatrixPosition(k.matrixWorld);W.setFromMatrixPosition(k.target.matrixWorld);E.direction.sub(W);E.direction.transformDirection(D);E.color.copy(k.color).multiplyScalar(k.intensity);V.directional[B++]=E}else k instanceof THREE.PointLight?(k.__webglUniforms||(k.__webglUniforms={position:new THREE.Vector3,color:new THREE.Color,distance:0,decay:0}),E=k.__webglUniforms,E.position.setFromMatrixPosition(k.matrixWorld),E.position.applyMatrix4(D),
-E.color.copy(k.color).multiplyScalar(k.intensity),E.distance=k.distance,E.decay=0===k.distance?0:k.decay,V.point[H++]=E):k instanceof THREE.SpotLight?(k.__webglUniforms||(k.__webglUniforms={position:new THREE.Vector3,direction:new THREE.Vector3,color:new THREE.Color,distance:0,decay:0,angleCos:0}),E=k.__webglUniforms,E.position.setFromMatrixPosition(k.matrixWorld),E.position.applyMatrix4(D),E.color.copy(t).multiplyScalar(w),E.distance=v,E.direction.setFromMatrixPosition(k.matrixWorld),W.setFromMatrixPosition(k.target.matrixWorld),
-E.direction.sub(W),E.direction.transformDirection(D),E.angleCos=Math.cos(k.angle),E.exponent=k.exponent,E.decay=0===k.distance?0:k.decay,V.spot[y++]=E):k instanceof THREE.HemisphereLight&&(k.__webglUniforms||(k.__webglUniforms={direction:new THREE.Vector3,skyColor:new THREE.Color,groundColor:new THREE.Color}),E=k.__webglUniforms,E.direction.setFromMatrixPosition(k.matrixWorld),E.direction.transformDirection(D),E.direction.normalize(),E.skyColor.copy(k.color).multiplyScalar(w),E.groundColor.copy(k.groundColor).multiplyScalar(w),
-V.hemi[I++]=E);V.ambient[0]=l;V.ambient[1]=n;V.ambient[2]=u;G===B&&F===H&&A===y&&z===I||ra.clear();V.directional.length=B;V.point.length=H;V.spot.length=y;V.hemi.length=I;ya.render(a,b);ca.calls=0;ca.vertices=0;ca.faces=0;ca.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);a.overrideMaterial?(d=a.overrideMaterial,r(Y,b,U,e,d),r(aa,b,U,e,d)):(K.setBlending(THREE.NoBlending),r(Y,b,U,e),r(aa,b,U,e));Ea.render(a,b);Fa.render(a,
-b,za,Aa);c&&(a=c.texture,a.generateMipmaps&&x(c)&&a.minFilter!==THREE.NearestFilter&&a.minFilter!==THREE.LinearFilter&&(a=c instanceof THREE.WebGLRenderTargetCube?s.TEXTURE_CUBE_MAP:s.TEXTURE_2D,c=T.get(c.texture).__webglTexture,K.bindTexture(a,c),s.generateMipmap(a),K.bindTexture(a,null)));K.setDepthTest(!0);K.setDepthWrite(!0);K.setColorWrite(!0)}};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?K.disable(s.CULL_FACE):(b===THREE.FrontFaceDirectionCW?s.frontFace(s.CW):s.frontFace(s.CCW),
-a===THREE.CullFaceBack?s.cullFace(s.BACK):a===THREE.CullFaceFront?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK),K.enable(s.CULL_FACE))};this.setTexture=function(a,b){var c=T.get(a);if(0<a.version&&c.__version!==a.version){var d=a.image;if(void 0===d)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",a);else if(!1===d.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",a);else{void 0===c.__webglInit&&(c.__webglInit=!0,
-a.addEventListener("dispose",f),c.__webglTexture=s.createTexture(),da.textures++);K.activeTexture(s.TEXTURE0+b);K.bindTexture(s.TEXTURE_2D,c.__webglTexture);s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,a.flipY);s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);s.pixelStorei(s.UNPACK_ALIGNMENT,a.unpackAlignment);a.image=G(a.image,ba.maxTextureSize);if((a.wrapS!==THREE.ClampToEdgeWrapping||a.wrapT!==THREE.ClampToEdgeWrapping||a.minFilter!==THREE.NearestFilter&&a.minFilter!==THREE.LinearFilter)&&
-!1===x(a.image)){d=a.image;if(d instanceof HTMLImageElement||d instanceof HTMLCanvasElement){var e=document.createElement("canvas");e.width=THREE.Math.nearestPowerOfTwo(d.width);e.height=THREE.Math.nearestPowerOfTwo(d.height);e.getContext("2d").drawImage(d,0,0,e.width,e.height);console.warn("THREE.WebGLRenderer: image is not power of two ("+d.width+"x"+d.height+"). Resized to "+e.width+"x"+e.height,d);d=e}a.image=d}var g=a.image,d=x(g),e=D(a.format),h=D(a.type);w(s.TEXTURE_2D,a,d);var k=a.mipmaps;
-if(a instanceof THREE.DataTexture)if(0<k.length&&d){for(var l=0,n=k.length;l<n;l++)g=k[l],K.texImage2D(s.TEXTURE_2D,l,e,g.width,g.height,0,e,h,g.data);a.generateMipmaps=!1}else K.texImage2D(s.TEXTURE_2D,0,e,g.width,g.height,0,e,h,g.data);else if(a instanceof THREE.CompressedTexture)for(l=0,n=k.length;l<n;l++)g=k[l],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<K.getCompressedTextureFormats().indexOf(e)?K.compressedTexImage2D(s.TEXTURE_2D,l,e,g.width,g.height,0,g.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):
-K.texImage2D(s.TEXTURE_2D,l,e,g.width,g.height,0,e,h,g.data);else if(0<k.length&&d){l=0;for(n=k.length;l<n;l++)g=k[l],K.texImage2D(s.TEXTURE_2D,l,e,e,h,g);a.generateMipmaps=!1}else K.texImage2D(s.TEXTURE_2D,0,e,e,h,a.image);a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_2D);c.__version=a.version;if(a.onUpdate)a.onUpdate(a)}}else K.activeTexture(s.TEXTURE0+b),K.bindTexture(s.TEXTURE_2D,c.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&void 0===
-T.get(a).__webglFramebuffer){var c=T.get(a),d=T.get(a.texture);void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",g);d.__webglTexture=s.createTexture();da.textures++;var e=x(a),f=D(a.texture.format),h=D(a.texture.type);if(b){c.__webglFramebuffer=[];c.__webglRenderbuffer=[];K.bindTexture(s.TEXTURE_CUBE_MAP,d.__webglTexture);w(s.TEXTURE_CUBE_MAP,a.texture,e);for(d=0;6>d;d++)c.__webglFramebuffer[d]=s.createFramebuffer(),c.__webglRenderbuffer[d]=
-s.createRenderbuffer(),K.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,f,a.width,a.height,0,f,h,null),A(c.__webglFramebuffer[d],a,s.TEXTURE_CUBE_MAP_POSITIVE_X+d),y(c.__webglRenderbuffer[d],a);a.texture.generateMipmaps&&e&&s.generateMipmap(s.TEXTURE_CUBE_MAP)}else c.__webglFramebuffer=s.createFramebuffer(),c.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:s.createRenderbuffer(),K.bindTexture(s.TEXTURE_2D,d.__webglTexture),w(s.TEXTURE_2D,a.texture,e),K.texImage2D(s.TEXTURE_2D,
-0,f,a.width,a.height,0,f,h,null),A(c.__webglFramebuffer,a,s.TEXTURE_2D),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):y(c.__webglRenderbuffer,a),a.texture.generateMipmaps&&e&&s.generateMipmap(s.TEXTURE_2D);b?K.bindTexture(s.TEXTURE_CUBE_MAP,null):K.bindTexture(s.TEXTURE_2D,
-null);s.bindRenderbuffer(s.RENDERBUFFER,null);s.bindFramebuffer(s.FRAMEBUFFER,null)}a?(c=T.get(a),d=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,c=a.width,e=a.height,h=f=0):(d=null,c=ha,e=ia,f=fa,h=ga);d!==ua&&(s.bindFramebuffer(s.FRAMEBUFFER,d),s.viewport(f,h,c,e),ua=d);b&&(d=T.get(a.texture),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,d.__webglTexture,0));za=c;Aa=e};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!1===
-a instanceof THREE.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var g=T.get(a).__webglFramebuffer;if(g){var h=!1;g!==ua&&(s.bindFramebuffer(s.FRAMEBUFFER,g),h=!0);try{var k=a.texture;k.format!==THREE.RGBAFormat&&D(k.format)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):k.type===THREE.UnsignedByteType||
-D(k.type)===s.getParameter(s.IMPLEMENTATION_COLOR_READ_TYPE)||k.type===THREE.FloatType&&S.get("WEBGL_color_buffer_float")||k.type===THREE.HalfFloatType&&S.get("EXT_color_buffer_half_float")?s.checkFramebufferStatus(s.FRAMEBUFFER)===s.FRAMEBUFFER_COMPLETE?s.readPixels(b,c,d,e,D(k.format),D(k.type),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{h&&
-s.bindFramebuffer(s.FRAMEBUFFER,ua)}}}}};
+THREE.WebGLRenderer=function(a){function b(a,b,c,d){!0===P&&(a*=d,b*=d,c*=d);s.clearColor(a,b,c,d)}function c(){I.init();s.viewport(fa,ga,ha,ia);b(C.r,C.g,C.b,X)}function d(){ja=ua=null;ka="";qa=-1;la=!0;I.reset()}function e(a){a.preventDefault();d();c();S.clear()}function f(a){a=a.target;a.removeEventListener("dispose",f);a:{var b=S.get(a);if(a.image&&b.__image__webglTextureCube)s.deleteTexture(b.__image__webglTextureCube);else{if(void 0===b.__webglInit)break a;s.deleteTexture(b.__webglTexture)}S.delete(a)}da.textures--}
+function g(a){a=a.target;a.removeEventListener("dispose",g);var b=S.get(a),c=S.get(a.texture);if(a&&void 0!==c.__webglTexture){s.deleteTexture(c.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(c=0;6>c;c++)s.deleteFramebuffer(b.__webglFramebuffer[c]),s.deleteRenderbuffer(b.__webglRenderbuffer[c]);else s.deleteFramebuffer(b.__webglFramebuffer),s.deleteRenderbuffer(b.__webglRenderbuffer);S.delete(a.texture);S.delete(a)}da.textures--}function h(a){a=a.target;a.removeEventListener("dispose",
+h);l(a);S.delete(a)}function l(a){var b=S.get(a).program;a.program=void 0;void 0!==b&&ma.releaseProgram(b)}function k(a,b){return b[0]-a[0]}function m(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function p(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function n(a,b,c,d,e){var f;c.transparent?
+(d=aa,f=++na):(d=Y,f=++ea);f=d[f];void 0!==f?(f.id=a.id,f.object=a,f.geometry=b,f.material=c,f.z=V.z,f.group=e):(f={id:a.id,object:a,geometry:b,material:c,z:V.z,group:e},d.push(f))}function q(a,b){if(!1!==a.visible){if(a.layers.test(b.layers))if(a instanceof THREE.Light)U.push(a);else if(a instanceof THREE.Sprite)!1!==a.frustumCulled&&!0!==va.intersectsObject(a)||$.push(a);else if(a instanceof THREE.LensFlare)wa.push(a);else if(a instanceof THREE.ImmediateRenderObject)!0===Z.sortObjects&&(V.setFromMatrixPosition(a.matrixWorld),
+V.applyProjection(ra)),n(a,null,a.material,V.z,null);else if(a instanceof THREE.Mesh||a instanceof THREE.Line||a instanceof THREE.Points)if(a instanceof THREE.SkinnedMesh&&a.skeleton.update(),!1===a.frustumCulled||!0===va.intersectsObject(a)){var c=a.material;if(!0===c.visible){!0===Z.sortObjects&&(V.setFromMatrixPosition(a.matrixWorld),V.applyProjection(ra));var d=oa.update(a);if(c instanceof THREE.MeshFaceMaterial)for(var e=d.groups,f=c.materials,c=0,g=e.length;c<g;c++){var h=e[c],l=f[h.materialIndex];
+!0===l.visible&&n(a,d,l,V.z,h)}else n(a,d,c,V.z,null)}}d=a.children;c=0;for(g=d.length;c<g;c++)q(d[c],b)}}function r(a,b,c,d,e){for(var f=0,g=a.length;f<g;f++){var h=a[f],l=h.object,k=h.geometry,n=void 0===e?h.material:e,h=h.group;l.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,l.matrixWorld);l.normalMatrix.getNormalMatrix(l.modelViewMatrix);if(l instanceof THREE.ImmediateRenderObject){t(n);var m=v(b,c,d,n,l);ka="";l.render(function(a){Z.renderBufferImmediate(a,m,n)})}else Z.renderBufferDirect(b,
+c,d,k,n,l,h)}}function t(a){a.side!==THREE.DoubleSide?I.enable(s.CULL_FACE):I.disable(s.CULL_FACE);I.setFlipSided(a.side===THREE.BackSide);!0===a.transparent?I.setBlending(a.blending,a.blendEquation,a.blendSrc,a.blendDst,a.blendEquationAlpha,a.blendSrcAlpha,a.blendDstAlpha):I.setBlending(THREE.NoBlending);I.setDepthFunc(a.depthFunc);I.setDepthTest(a.depthTest);I.setDepthWrite(a.depthWrite);I.setColorWrite(a.colorWrite);I.setPolygonOffset(a.polygonOffset,a.polygonOffsetFactor,a.polygonOffsetUnits)}
+function v(a,b,c,d,e){sa=0;var f=S.get(d);void 0===f.program&&(d.needsUpdate=!0);void 0!==f.lightsHash&&f.lightsHash!==W.hash&&(d.needsUpdate=!0);if(d.needsUpdate){a:{var g=S.get(d),k=ma.getParameters(d,b,c,e),n=ma.getProgramCode(d,k),m=g.program,q=!0;if(void 0===m)d.addEventListener("dispose",h);else if(m.code!==n)l(d);else if(void 0!==k.shaderID)break a;else q=!1;q&&(k.shaderID?(m=THREE.ShaderLib[k.shaderID],g.__webglShader={name:d.type,uniforms:THREE.UniformsUtils.clone(m.uniforms),vertexShader:m.vertexShader,
+fragmentShader:m.fragmentShader}):g.__webglShader={name:d.type,uniforms:d.uniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader},d.__webglShader=g.__webglShader,m=ma.acquireProgram(d,k,n),g.program=m,d.program=m);k=m.getAttributes();if(d.morphTargets)for(n=d.numSupportedMorphTargets=0;n<Z.maxMorphTargets;n++)0<=k["morphTarget"+n]&&d.numSupportedMorphTargets++;if(d.morphNormals)for(n=d.numSupportedMorphNormals=0;n<Z.maxMorphNormals;n++)0<=k["morphNormal"+n]&&d.numSupportedMorphNormals++;
+g.uniformsList=[];var k=g.__webglShader.uniforms,n=g.program.getUniforms(),p;for(p in k)(m=n[p])&&g.uniformsList.push([g.__webglShader.uniforms[p],m]);if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhysicalMaterial||d.lights)g.lightsHash=W.hash,k.ambientLightColor.value=W.ambient,k.directionalLights.value=W.directional,k.pointLights.value=W.point,k.spotLights.value=W.spot,k.hemisphereLights.value=W.hemi}d.needsUpdate=!1}m=n=q=!1;g=f.program;
+p=g.getUniforms();k=f.__webglShader.uniforms;g.id!==ua&&(s.useProgram(g.program),ua=g.id,m=n=q=!0);d.id!==qa&&(qa=d.id,n=!0);if(q||a!==ja)s.uniformMatrix4fv(p.projectionMatrix,!1,a.projectionMatrix.elements),ba.logarithmicDepthBuffer&&s.uniform1f(p.logDepthBufFC,2/(Math.log(a.far+1)/Math.LN2)),a!==ja&&(ja=a,la=n=!0),(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshPhysicalMaterial||d.envMap)&&void 0!==p.cameraPosition&&(V.setFromMatrixPosition(a.matrixWorld),
+s.uniform3f(p.cameraPosition,V.x,V.y,V.z)),(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshPhysicalMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&void 0!==p.viewMatrix&&s.uniformMatrix4fv(p.viewMatrix,!1,a.matrixWorldInverse.elements);d.skinning&&(e.bindMatrix&&void 0!==p.bindMatrix&&s.uniformMatrix4fv(p.bindMatrix,!1,e.bindMatrix.elements),e.bindMatrixInverse&&void 0!==p.bindMatrixInverse&&s.uniformMatrix4fv(p.bindMatrixInverse,
+!1,e.bindMatrixInverse.elements),ba.floatVertexTextures&&e.skeleton&&e.skeleton.useVertexTexture?(void 0!==p.boneTexture&&(q=u(),s.uniform1i(p.boneTexture,q),Z.setTexture(e.skeleton.boneTexture,q)),void 0!==p.boneTextureWidth&&s.uniform1i(p.boneTextureWidth,e.skeleton.boneTextureWidth),void 0!==p.boneTextureHeight&&s.uniform1i(p.boneTextureHeight,e.skeleton.boneTextureHeight)):e.skeleton&&e.skeleton.boneMatrices&&void 0!==p.boneGlobalMatrices&&s.uniformMatrix4fv(p.boneGlobalMatrices,!1,e.skeleton.boneMatrices));
+if(n){c&&d.fog&&(k.fogColor.value=c.color,c instanceof THREE.Fog?(k.fogNear.value=c.near,k.fogFar.value=c.far):c instanceof THREE.FogExp2&&(k.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhysicalMaterial||d.lights)la&&(la=!1,m=!0),c=m,k.ambientLightColor.needsUpdate=c,k.directionalLights.needsUpdate=c,k.pointLights.needsUpdate=c,k.spotLights.needsUpdate=c,k.hemisphereLights.needsUpdate=c;if(d instanceof THREE.MeshBasicMaterial||
+d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshPhysicalMaterial){k.opacity.value=d.opacity;k.diffuse.value=d.color;d.emissive&&(k.emissive.value=d.emissive);k.map.value=d.map;k.specularMap.value=d.specularMap;k.alphaMap.value=d.alphaMap;d.aoMap&&(k.aoMap.value=d.aoMap,k.aoMapIntensity.value=d.aoMapIntensity);var r;d.map?r=d.map:d.specularMap?r=d.specularMap:d.displacementMap?r=d.displacementMap:d.normalMap?r=d.normalMap:d.bumpMap?r=d.bumpMap:d.alphaMap?
+r=d.alphaMap:d.emissiveMap&&(r=d.emissiveMap);void 0!==r&&(r instanceof THREE.WebGLRenderTarget&&(r=r.texture),c=r.offset,r=r.repeat,k.offsetRepeat.value.set(c.x,c.y,r.x,r.y));k.envMap.value=d.envMap;k.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;k.reflectivity.value=d.reflectivity;k.refractionRatio.value=d.refractionRatio}d instanceof THREE.LineBasicMaterial?(k.diffuse.value=d.color,k.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(k.diffuse.value=d.color,
+k.opacity.value=d.opacity,k.dashSize.value=d.dashSize,k.totalSize.value=d.dashSize+d.gapSize,k.scale.value=d.scale):d instanceof THREE.PointsMaterial?(k.psColor.value=d.color,k.opacity.value=d.opacity,k.size.value=d.size*G,k.scale.value=E.height/2,k.map.value=d.map,null!==d.map&&(a=d.map.offset,r=d.map.repeat,k.offsetRepeat.value.set(a.x,a.y,r.x,r.y))):d instanceof THREE.MeshPhongMaterial?(k.specular.value=d.specular,k.shininess.value=Math.max(d.shininess,1E-4),d.lightMap&&(k.lightMap.value=d.lightMap,
+k.lightMapIntensity.value=d.lightMapIntensity),d.emissiveMap&&(k.emissiveMap.value=d.emissiveMap),d.bumpMap&&(k.bumpMap.value=d.bumpMap,k.bumpScale.value=d.bumpScale),d.normalMap&&(k.normalMap.value=d.normalMap,k.normalScale.value.copy(d.normalScale)),d.displacementMap&&(k.displacementMap.value=d.displacementMap,k.displacementScale.value=d.displacementScale,k.displacementBias.value=d.displacementBias)):d instanceof THREE.MeshPhysicalMaterial?(k.roughness.value=d.roughness,k.metalness.value=d.metalness,
+d.roughnessMap&&(k.roughnessMap.value=d.roughnessMap),d.reflectivityMap&&(k.reflectivityMap.value=d.reflectivityMap),d.metalnessMap&&(k.metalnessMap.value=d.metalnessMap),d.lightMap&&(k.lightMap.value=d.lightMap,k.lightMapIntensity.value=d.lightMapIntensity),d.emissiveMap&&(k.emissiveMap.value=d.emissiveMap),d.bumpMap&&(k.bumpMap.value=d.bumpMap,k.bumpScale.value=d.bumpScale),d.normalMap&&(k.normalMap.value=d.normalMap,k.normalScale.value.copy(d.normalScale)),d.displacementMap&&(k.displacementMap.value=
+d.displacementMap,k.displacementScale.value=d.displacementScale,k.displacementBias.value=d.displacementBias),d.envMap&&(k.envMapIntensity.value=d.envMapIntensity)):d instanceof THREE.MeshDepthMaterial?(k.mNear.value=a.near,k.mFar.value=a.far,k.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(k.opacity.value=d.opacity);if(xa.enabled&&e.receiveShadow&&!d._shadowPass&&k.shadowMatrix)for(a=d=0,r=b.length;a<r;a++)c=b[a],!0===c.castShadow&&(c instanceof THREE.PointLight||c instanceof THREE.SpotLight||
+c instanceof THREE.DirectionalLight)&&(n=c.shadow,c instanceof THREE.PointLight?(V.setFromMatrixPosition(c.matrixWorld).negate(),n.matrix.identity().setPosition(V),k.shadowDarkness.value[d]=-n.darkness):k.shadowDarkness.value[d]=n.darkness,k.shadowMatrix.value[d]=n.matrix,k.shadowMap.value[d]=n.map,k.shadowMapSize.value[d]=n.mapSize,k.shadowBias.value[d]=n.bias,d++);b=f.uniformsList;f=0;for(d=b.length;f<d;f++)if(a=b[f][0],!1!==a.needsUpdate)switch(c=a.type,k=a.value,r=b[f][1],c){case "1i":s.uniform1i(r,
+k);break;case "1f":s.uniform1f(r,k);break;case "2f":s.uniform2f(r,k[0],k[1]);break;case "3f":s.uniform3f(r,k[0],k[1],k[2]);break;case "4f":s.uniform4f(r,k[0],k[1],k[2],k[3]);break;case "1iv":s.uniform1iv(r,k);break;case "3iv":s.uniform3iv(r,k);break;case "1fv":s.uniform1fv(r,k);break;case "2fv":s.uniform2fv(r,k);break;case "3fv":s.uniform3fv(r,k);break;case "4fv":s.uniform4fv(r,k);break;case "Matrix3fv":s.uniformMatrix3fv(r,!1,k);break;case "Matrix4fv":s.uniformMatrix4fv(r,!1,k);break;case "i":s.uniform1i(r,
+k);break;case "f":s.uniform1f(r,k);break;case "v2":s.uniform2f(r,k.x,k.y);break;case "v3":s.uniform3f(r,k.x,k.y,k.z);break;case "v4":s.uniform4f(r,k.x,k.y,k.z,k.w);break;case "c":s.uniform3f(r,k.r,k.g,k.b);break;case "s":for(var t in a.properties)switch(n=a.properties[t],m=r[t],q=k[t],n.type){case "f":s.uniform1f(m,q);break;case "v2":s.uniform2f(m,q.x,q.y);break;case "v3":s.uniform3f(m,q.x,q.y,q.z);break;case "v4":s.uniform4f(m,q.x,q.y,q.z,q.w);break;case "c":s.uniform3f(m,q.r,q.g,q.b)}break;case "sa":for(c=
+0;c<k.length;c++)for(t in a.properties)switch(n=a.properties[t],m=r[c][t],q=k[c][t],n.type){case "f":s.uniform1f(m,q);break;case "v2":s.uniform2f(m,q.x,q.y);break;case "v3":s.uniform3f(m,q.x,q.y,q.z);break;case "v4":s.uniform4f(m,q.x,q.y,q.z,q.w);break;case "c":s.uniform3f(m,q.r,q.g,q.b)}break;case "iv1":s.uniform1iv(r,k);break;case "iv":s.uniform3iv(r,k);break;case "fv1":s.uniform1fv(r,k);break;case "fv":s.uniform3fv(r,k);break;case "v2v":void 0===a._array&&(a._array=new Float32Array(2*k.length));
+m=c=0;for(n=k.length;c<n;c++,m+=2)a._array[m+0]=k[c].x,a._array[m+1]=k[c].y;s.uniform2fv(r,a._array);break;case "v3v":void 0===a._array&&(a._array=new Float32Array(3*k.length));m=c=0;for(n=k.length;c<n;c++,m+=3)a._array[m+0]=k[c].x,a._array[m+1]=k[c].y,a._array[m+2]=k[c].z;s.uniform3fv(r,a._array);break;case "v4v":void 0===a._array&&(a._array=new Float32Array(4*k.length));m=c=0;for(n=k.length;c<n;c++,m+=4)a._array[m+0]=k[c].x,a._array[m+1]=k[c].y,a._array[m+2]=k[c].z,a._array[m+3]=k[c].w;s.uniform4fv(r,
+a._array);break;case "m3":s.uniformMatrix3fv(r,!1,k.elements);break;case "m3v":void 0===a._array&&(a._array=new Float32Array(9*k.length));c=0;for(n=k.length;c<n;c++)k[c].flattenToArrayOffset(a._array,9*c);s.uniformMatrix3fv(r,!1,a._array);break;case "m4":s.uniformMatrix4fv(r,!1,k.elements);break;case "m4v":void 0===a._array&&(a._array=new Float32Array(16*k.length));c=0;for(n=k.length;c<n;c++)k[c].flattenToArrayOffset(a._array,16*c);s.uniformMatrix4fv(r,!1,a._array);break;case "t":m=u();s.uniform1i(r,
+m);if(!k)continue;k instanceof THREE.CubeTexture||Array.isArray(k.image)&&6===k.image.length?A(k,m):k instanceof THREE.WebGLRenderTargetCube?z(k.texture,m):k instanceof THREE.WebGLRenderTarget?Z.setTexture(k.texture,m):Z.setTexture(k,m);break;case "tv":void 0===a._array&&(a._array=[]);c=0;for(n=a.value.length;c<n;c++)a._array[c]=u();s.uniform1iv(r,a._array);c=0;for(n=a.value.length;c<n;c++)k=a.value[c],m=a._array[c],k&&(k instanceof THREE.CubeTexture||k.image instanceof Array&&6===k.image.length?
+A(k,m):k instanceof THREE.WebGLRenderTarget?Z.setTexture(k.texture,m):k instanceof THREE.WebGLRenderTargetCube?z(k.texture,m):Z.setTexture(k,m));break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+c)}}s.uniformMatrix4fv(p.modelViewMatrix,!1,e.modelViewMatrix.elements);p.normalMatrix&&s.uniformMatrix3fv(p.normalMatrix,!1,e.normalMatrix.elements);void 0!==p.modelMatrix&&s.uniformMatrix4fv(p.modelMatrix,!1,e.matrixWorld.elements);return g}function u(){var a=sa;a>=ba.maxTextures&&
+console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+ba.maxTextures);sa+=1;return a}function w(a,b,c){c?(s.texParameteri(a,s.TEXTURE_WRAP_S,D(b.wrapS)),s.texParameteri(a,s.TEXTURE_WRAP_T,D(b.wrapT)),s.texParameteri(a,s.TEXTURE_MAG_FILTER,D(b.magFilter)),s.texParameteri(a,s.TEXTURE_MIN_FILTER,D(b.minFilter))):(s.texParameteri(a,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(a,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),b.wrapS===THREE.ClampToEdgeWrapping&&b.wrapT===
+THREE.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",b),s.texParameteri(a,s.TEXTURE_MAG_FILTER,H(b.magFilter)),s.texParameteri(a,s.TEXTURE_MIN_FILTER,H(b.minFilter)),b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",b));!(c=
+T.get("EXT_texture_filter_anisotropic"))||b.type===THREE.FloatType&&null===T.get("OES_texture_float_linear")||b.type===THREE.HalfFloatType&&null===T.get("OES_texture_half_float_linear")||!(1<b.anisotropy||S.get(b).__currentAnisotropy)||(s.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Z.getMaxAnisotropy())),S.get(b).__currentAnisotropy=b.anisotropy)}function F(a,b){if(a.width>b||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElement("canvas");d.width=Math.floor(a.width*
+c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height,a);return d}return a}function x(a){return THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height)}function A(a,b){var c=S.get(a);if(6===a.image.length)if(0<a.version&&c.__version!==a.version){c.__image__webglTextureCube||(a.addEventListener("dispose",f),c.__image__webglTextureCube=
+s.createTexture(),da.textures++);I.activeTexture(s.TEXTURE0+b);I.bindTexture(s.TEXTURE_CUBE_MAP,c.__image__webglTextureCube);s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,a.flipY);for(var d=a instanceof THREE.CompressedTexture,e=a.image[0]instanceof THREE.DataTexture,g=[],h=0;6>h;h++)g[h]=!Z.autoScaleCubemaps||d||e?e?a.image[h].image:a.image[h]:F(a.image[h],ba.maxCubemapSize);var k=x(g[0]),l=D(a.format),m=D(a.type);w(s.TEXTURE_CUBE_MAP,a,k);for(h=0;6>h;h++)if(d)for(var n,q=g[h].mipmaps,p=0,r=q.length;p<r;p++)n=
+q[p],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<I.getCompressedTextureFormats().indexOf(l)?I.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,p,l,n.width,n.height,0,n.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):I.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,p,l,n.width,n.height,0,l,m,n.data);else e?I.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,l,g[h].width,g[h].height,0,l,m,g[h].data):I.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+
+h,0,l,l,m,g[h]);a.generateMipmaps&&k&&s.generateMipmap(s.TEXTURE_CUBE_MAP);c.__version=a.version;if(a.onUpdate)a.onUpdate(a)}else I.activeTexture(s.TEXTURE0+b),I.bindTexture(s.TEXTURE_CUBE_MAP,c.__image__webglTextureCube)}function z(a,b){I.activeTexture(s.TEXTURE0+b);I.bindTexture(s.TEXTURE_CUBE_MAP,S.get(a).__webglTexture)}function B(a,b,c){s.bindFramebuffer(s.FRAMEBUFFER,a);s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,c,S.get(b.texture).__webglTexture,0)}function y(a,b){s.bindRenderbuffer(s.RENDERBUFFER,
+a);b.depthBuffer&&!b.stencilBuffer?(s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_COMPONENT16,b.width,b.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,b.width,b.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,a)):s.renderbufferStorage(s.RENDERBUFFER,s.RGBA4,b.width,b.height)}function H(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||
+a===THREE.NearestMipMapLinearFilter?s.NEAREST:s.LINEAR}function D(a){var b;if(a===THREE.RepeatWrapping)return s.REPEAT;if(a===THREE.ClampToEdgeWrapping)return s.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return s.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return s.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return s.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return s.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return s.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return s.LINEAR_MIPMAP_NEAREST;
+if(a===THREE.LinearMipMapLinearFilter)return s.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return s.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return s.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return s.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return s.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return s.BYTE;if(a===THREE.ShortType)return s.SHORT;if(a===THREE.UnsignedShortType)return s.UNSIGNED_SHORT;if(a===THREE.IntType)return s.INT;if(a===THREE.UnsignedIntType)return s.UNSIGNED_INT;
+if(a===THREE.FloatType)return s.FLOAT;b=T.get("OES_texture_half_float");if(null!==b&&a===THREE.HalfFloatType)return b.HALF_FLOAT_OES;if(a===THREE.AlphaFormat)return s.ALPHA;if(a===THREE.RGBFormat)return s.RGB;if(a===THREE.RGBAFormat)return s.RGBA;if(a===THREE.LuminanceFormat)return s.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return s.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return s.FUNC_ADD;if(a===THREE.SubtractEquation)return s.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return s.FUNC_REVERSE_SUBTRACT;
+if(a===THREE.ZeroFactor)return s.ZERO;if(a===THREE.OneFactor)return s.ONE;if(a===THREE.SrcColorFactor)return s.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return s.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return s.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return s.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return s.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return s.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return s.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return s.ONE_MINUS_DST_COLOR;
+if(a===THREE.SrcAlphaSaturateFactor)return s.SRC_ALPHA_SATURATE;b=T.get("WEBGL_compressed_texture_s3tc");if(null!==b){if(a===THREE.RGB_S3TC_DXT1_Format)return b.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return b.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return b.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return b.COMPRESSED_RGBA_S3TC_DXT5_EXT}b=T.get("WEBGL_compressed_texture_pvrtc");if(null!==b){if(a===THREE.RGB_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
+if(a===THREE.RGB_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===THREE.RGBA_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===THREE.RGBA_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}b=T.get("EXT_blend_minmax");if(null!==b){if(a===THREE.MinEquation)return b.MIN_EXT;if(a===THREE.MaxEquation)return b.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var E=void 0!==a.canvas?a.canvas:document.createElement("canvas"),Q=void 0!==
+a.context?a.context:null,M=E.width,N=E.height,G=1,J=void 0!==a.alpha?a.alpha:!1,K=void 0!==a.depth?a.depth:!0,O=void 0!==a.stencil?a.stencil:!0,R=void 0!==a.antialias?a.antialias:!1,P=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,L=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,C=new THREE.Color(0),X=0,U=[],Y=[],ea=-1,aa=[],na=-1,pa=new Float32Array(8),$=[],wa=[];this.domElement=E;this.context=null;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=
+this.autoClear=!0;this.gammaFactor=2;this.gammaOutput=this.gammaInput=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;var Z=this,ua=null,ta=null,qa=-1,ka="",ja=null,sa=0,fa=0,ga=0,ha=E.width,ia=E.height,ya=0,za=0,va=new THREE.Frustum,ra=new THREE.Matrix4,V=new THREE.Vector3,W={hash:"",ambient:[0,0,0],directional:[],point:[],spot:[],hemi:[]},la=!0,da={geometries:0,textures:0},ca={calls:0,vertices:0,faces:0,points:0};this.info={render:ca,memory:da,programs:null};var s;try{J=
+{alpha:J,depth:K,stencil:O,antialias:R,premultipliedAlpha:P,preserveDrawingBuffer:L};s=Q||E.getContext("webgl",J)||E.getContext("experimental-webgl",J);if(null===s){if(null!==E.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";}E.addEventListener("webglcontextlost",e,!1)}catch(Aa){console.error("THREE.WebGLRenderer: "+Aa)}var T=new THREE.WebGLExtensions(s);T.get("OES_texture_float");T.get("OES_texture_float_linear");T.get("OES_texture_half_float");
+T.get("OES_texture_half_float_linear");T.get("OES_standard_derivatives");T.get("ANGLE_instanced_arrays");T.get("OES_element_index_uint")&&(THREE.BufferGeometry.MaxIndex=4294967296);var ba=new THREE.WebGLCapabilities(s,T,a),I=new THREE.WebGLState(s,T,D),S=new THREE.WebGLProperties,oa=new THREE.WebGLObjects(s,S,this.info),ma=new THREE.WebGLPrograms(this,ba);this.info.programs=ma.programs;var Ba=new THREE.WebGLBufferRenderer(s,T,ca),Ca=new THREE.WebGLIndexedBufferRenderer(s,T,ca);c();this.context=s;
+this.capabilities=ba;this.extensions=T;this.state=I;var xa=new THREE.WebGLShadowMap(this,U,oa);this.shadowMap=xa;var Da=new THREE.SpritePlugin(this,$),Ea=new THREE.LensFlarePlugin(this,wa);this.getContext=function(){return s};this.getContextAttributes=function(){return s.getContextAttributes()};this.forceContextLoss=function(){T.get("WEBGL_lose_context").loseContext()};this.getMaxAnisotropy=function(){var a;return function(){if(void 0!==a)return a;var b=T.get("EXT_texture_filter_anisotropic");return a=
+null!==b?s.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}();this.getPrecision=function(){return ba.precision};this.getPixelRatio=function(){return G};this.setPixelRatio=function(a){void 0!==a&&(G=a)};this.getSize=function(){return{width:M,height:N}};this.setSize=function(a,b,c){M=a;N=b;E.width=a*G;E.height=b*G;!1!==c&&(E.style.width=a+"px",E.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){fa=a*G;ga=b*G;ha=c*G;ia=d*G;s.viewport(fa,ga,ha,ia)};this.getViewport=
+function(a){a.x=fa/G;a.y=ga/G;a.z=ha/G;a.w=ia/G};this.setScissor=function(a,b,c,d){s.scissor(a*G,b*G,c*G,d*G)};this.enableScissorTest=function(a){I.setScissorTest(a)};this.getClearColor=function(){return C};this.setClearColor=function(a,c){C.set(a);X=void 0!==c?c:1;b(C.r,C.g,C.b,X)};this.getClearAlpha=function(){return X};this.setClearAlpha=function(a){X=a;b(C.r,C.g,C.b,X)};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=s.COLOR_BUFFER_BIT;if(void 0===b||b)d|=s.DEPTH_BUFFER_BIT;if(void 0===
+c||c)d|=s.STENCIL_BUFFER_BIT;s.clear(d)};this.clearColor=function(){s.clear(s.COLOR_BUFFER_BIT)};this.clearDepth=function(){s.clear(s.DEPTH_BUFFER_BIT)};this.clearStencil=function(){s.clear(s.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.resetGLState=d;this.dispose=function(){E.removeEventListener("webglcontextlost",e,!1)};this.renderBufferImmediate=function(a,b,c){I.initAttributes();var d=S.get(a);a.hasPositions&&!d.position&&(d.position=
+s.createBuffer());a.hasNormals&&!d.normal&&(d.normal=s.createBuffer());a.hasUvs&&!d.uv&&(d.uv=s.createBuffer());a.hasColors&&!d.color&&(d.color=s.createBuffer());b=b.getAttributes();a.hasPositions&&(s.bindBuffer(s.ARRAY_BUFFER,d.position),s.bufferData(s.ARRAY_BUFFER,a.positionArray,s.DYNAMIC_DRAW),I.enableAttribute(b.position),s.vertexAttribPointer(b.position,3,s.FLOAT,!1,0,0));if(a.hasNormals){s.bindBuffer(s.ARRAY_BUFFER,d.normal);if("MeshPhongMaterial"!==c.type&&"MeshPhysicalMaterial"!==c.type&&
+c.shading===THREE.FlatShading)for(var e=0,f=3*a.count;e<f;e+=9){var g=a.normalArray,h=(g[e+0]+g[e+3]+g[e+6])/3,k=(g[e+1]+g[e+4]+g[e+7])/3,l=(g[e+2]+g[e+5]+g[e+8])/3;g[e+0]=h;g[e+1]=k;g[e+2]=l;g[e+3]=h;g[e+4]=k;g[e+5]=l;g[e+6]=h;g[e+7]=k;g[e+8]=l}s.bufferData(s.ARRAY_BUFFER,a.normalArray,s.DYNAMIC_DRAW);I.enableAttribute(b.normal);s.vertexAttribPointer(b.normal,3,s.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(s.bindBuffer(s.ARRAY_BUFFER,d.uv),s.bufferData(s.ARRAY_BUFFER,a.uvArray,s.DYNAMIC_DRAW),I.enableAttribute(b.uv),
+s.vertexAttribPointer(b.uv,2,s.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(s.bindBuffer(s.ARRAY_BUFFER,d.color),s.bufferData(s.ARRAY_BUFFER,a.colorArray,s.DYNAMIC_DRAW),I.enableAttribute(b.color),s.vertexAttribPointer(b.color,3,s.FLOAT,!1,0,0));I.disableUnusedAttributes();s.drawArrays(s.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f,g){t(e);var h=v(a,b,c,e,f),l=!1;a=d.id+"_"+h.id+"_"+e.wireframe;a!==ka&&(ka=a,l=!0);b=f.morphTargetInfluences;if(void 0!==
+b){a=[];c=0;for(l=b.length;c<l;c++){var m=b[c];a.push([m,c])}a.sort(k);8<a.length&&(a.length=8);var n=d.morphAttributes;c=0;for(l=a.length;c<l;c++)m=a[c],pa[c]=m[0],0!==m[0]?(b=m[1],!0===e.morphTargets&&n.position&&d.addAttribute("morphTarget"+c,n.position[b]),!0===e.morphNormals&&n.normal&&d.addAttribute("morphNormal"+c,n.normal[b])):(!0===e.morphTargets&&d.removeAttribute("morphTarget"+c),!0===e.morphNormals&&d.removeAttribute("morphNormal"+c));a=h.getUniforms();null!==a.morphTargetInfluences&&
+s.uniform1fv(a.morphTargetInfluences,pa);l=!0}b=d.index;c=d.attributes.position;!0===e.wireframe&&(b=oa.getWireframeAttribute(d));null!==b?(a=Ca,a.setIndex(b)):a=Ba;if(l){a:{var l=void 0,q;if(d instanceof THREE.InstancedBufferGeometry&&(q=T.get("ANGLE_instanced_arrays"),null===q)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}void 0===l&&(l=0);I.initAttributes();var m=d.attributes,
+h=h.getAttributes(),n=e.defaultAttributeValues,p;for(p in h){var r=h[p];if(0<=r){var u=m[p];if(void 0!==u){var w=u.itemSize,x=oa.getAttributeBuffer(u);if(u instanceof THREE.InterleavedBufferAttribute){var D=u.data,F=D.stride,u=u.offset;D instanceof THREE.InstancedInterleavedBuffer?(I.enableAttributeAndDivisor(r,D.meshPerAttribute,q),void 0===d.maxInstancedCount&&(d.maxInstancedCount=D.meshPerAttribute*D.count)):I.enableAttribute(r);s.bindBuffer(s.ARRAY_BUFFER,x);s.vertexAttribPointer(r,w,s.FLOAT,
+!1,F*D.array.BYTES_PER_ELEMENT,(l*F+u)*D.array.BYTES_PER_ELEMENT)}else u instanceof THREE.InstancedBufferAttribute?(I.enableAttributeAndDivisor(r,u.meshPerAttribute,q),void 0===d.maxInstancedCount&&(d.maxInstancedCount=u.meshPerAttribute*u.count)):I.enableAttribute(r),s.bindBuffer(s.ARRAY_BUFFER,x),s.vertexAttribPointer(r,w,s.FLOAT,!1,0,l*w*4)}else if(void 0!==n&&(w=n[p],void 0!==w))switch(w.length){case 2:s.vertexAttrib2fv(r,w);break;case 3:s.vertexAttrib3fv(r,w);break;case 4:s.vertexAttrib4fv(r,
+w);break;default:s.vertexAttrib1fv(r,w)}}}I.disableUnusedAttributes()}null!==b&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,oa.getAttributeBuffer(b))}q=Infinity;null!==b?q=b.count:void 0!==c&&(q=c.count);p=d.drawRange.start;b=d.drawRange.count;c=null!==g?g.start:0;l=null!==g?g.count:Infinity;g=Math.max(0,p,c);q=Math.min(0+q,p+b,c+l)-1;q=Math.max(0,q-g+1);f instanceof THREE.Mesh?(!0===e.wireframe?(I.setLineWidth(e.wireframeLinewidth*G),a.setMode(s.LINES)):a.setMode(s.TRIANGLES),d instanceof THREE.InstancedBufferGeometry&&
+0<d.maxInstancedCount?a.renderInstances(d):a.render(g,q)):f instanceof THREE.Line?(d=e.linewidth,void 0===d&&(d=1),I.setLineWidth(d*G),f instanceof THREE.LineSegments?a.setMode(s.LINES):a.setMode(s.LINE_STRIP),a.render(g,q)):f instanceof THREE.Points&&(a.setMode(s.POINTS),a.render(g,q))};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=a.fog;ka="";qa=-1;ja=null;la=!0;!0===a.autoUpdate&&
+a.updateMatrixWorld();null===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);ra.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);va.setFromMatrix(ra);U.length=0;na=ea=-1;$.length=0;wa.length=0;q(a,b);Y.length=ea+1;aa.length=na+1;!0===Z.sortObjects&&(Y.sort(m),aa.sort(p));var f=U,g,h,k,l=0,n=0,u=0,t,w,v,D=b.matrixWorldInverse,F=0,E=0,B=0,z=0;g=0;for(h=f.length;g<h;g++)if(k=f[g],t=k.color,w=k.intensity,v=k.distance,k instanceof THREE.AmbientLight)l+=t.r,n+=t.g,
+u+=t.b;else if(k instanceof THREE.DirectionalLight){k.__webglUniforms||(k.__webglUniforms={direction:new THREE.Vector3,color:new THREE.Color});var A=k.__webglUniforms;A.direction.setFromMatrixPosition(k.matrixWorld);V.setFromMatrixPosition(k.target.matrixWorld);A.direction.sub(V);A.direction.transformDirection(D);A.color.copy(k.color).multiplyScalar(k.intensity);W.directional[F++]=A}else k instanceof THREE.PointLight?(k.__webglUniforms||(k.__webglUniforms={position:new THREE.Vector3,color:new THREE.Color,
+distance:0,decay:0}),A=k.__webglUniforms,A.position.setFromMatrixPosition(k.matrixWorld),A.position.applyMatrix4(D),A.color.copy(k.color).multiplyScalar(k.intensity),A.distance=k.distance,A.decay=0===k.distance?0:k.decay,W.point[E++]=A):k instanceof THREE.SpotLight?(k.__webglUniforms||(k.__webglUniforms={position:new THREE.Vector3,direction:new THREE.Vector3,color:new THREE.Color,distance:0,decay:0,angleCos:0}),A=k.__webglUniforms,A.position.setFromMatrixPosition(k.matrixWorld),A.position.applyMatrix4(D),
+A.color.copy(t).multiplyScalar(w),A.distance=v,A.direction.setFromMatrixPosition(k.matrixWorld),V.setFromMatrixPosition(k.target.matrixWorld),A.direction.sub(V),A.direction.transformDirection(D),A.angleCos=Math.cos(k.angle),A.exponent=k.exponent,A.decay=0===k.distance?0:k.decay,W.spot[B++]=A):k instanceof THREE.HemisphereLight&&(k.__webglUniforms||(k.__webglUniforms={direction:new THREE.Vector3,skyColor:new THREE.Color,groundColor:new THREE.Color}),A=k.__webglUniforms,A.direction.setFromMatrixPosition(k.matrixWorld),
+A.direction.transformDirection(D),A.direction.normalize(),A.skyColor.copy(k.color).multiplyScalar(w),A.groundColor.copy(k.groundColor).multiplyScalar(w),W.hemi[z++]=A);W.ambient[0]=l;W.ambient[1]=n;W.ambient[2]=u;W.directional.length=F;W.point.length=E;W.spot.length=B;W.hemi.length=z;W.hash=F+","+E+","+B+","+z;xa.render(a,b);ca.calls=0;ca.vertices=0;ca.faces=0;ca.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);a.overrideMaterial?
+(d=a.overrideMaterial,r(Y,b,U,e,d),r(aa,b,U,e,d)):(I.setBlending(THREE.NoBlending),r(Y,b,U,e),r(aa,b,U,e));Da.render(a,b);Ea.render(a,b,ya,za);c&&(a=c.texture,a.generateMipmaps&&x(c)&&a.minFilter!==THREE.NearestFilter&&a.minFilter!==THREE.LinearFilter&&(a=c instanceof THREE.WebGLRenderTargetCube?s.TEXTURE_CUBE_MAP:s.TEXTURE_2D,c=S.get(c.texture).__webglTexture,I.bindTexture(a,c),s.generateMipmap(a),I.bindTexture(a,null)));I.setDepthTest(!0);I.setDepthWrite(!0);I.setColorWrite(!0)}};this.setFaceCulling=
+function(a,b){a===THREE.CullFaceNone?I.disable(s.CULL_FACE):(b===THREE.FrontFaceDirectionCW?s.frontFace(s.CW):s.frontFace(s.CCW),a===THREE.CullFaceBack?s.cullFace(s.BACK):a===THREE.CullFaceFront?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK),I.enable(s.CULL_FACE))};this.setTexture=function(a,b){var c=S.get(a);if(0<a.version&&c.__version!==a.version){var d=a.image;if(void 0===d)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",a);else if(!1===d.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",
+a);else{void 0===c.__webglInit&&(c.__webglInit=!0,a.addEventListener("dispose",f),c.__webglTexture=s.createTexture(),da.textures++);I.activeTexture(s.TEXTURE0+b);I.bindTexture(s.TEXTURE_2D,c.__webglTexture);s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,a.flipY);s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);s.pixelStorei(s.UNPACK_ALIGNMENT,a.unpackAlignment);a.image=F(a.image,ba.maxTextureSize);if((a.wrapS!==THREE.ClampToEdgeWrapping||a.wrapT!==THREE.ClampToEdgeWrapping||a.minFilter!==THREE.NearestFilter&&
+a.minFilter!==THREE.LinearFilter)&&!1===x(a.image)){d=a.image;if(d instanceof HTMLImageElement||d instanceof HTMLCanvasElement){var e=document.createElement("canvas");e.width=THREE.Math.nearestPowerOfTwo(d.width);e.height=THREE.Math.nearestPowerOfTwo(d.height);e.getContext("2d").drawImage(d,0,0,e.width,e.height);console.warn("THREE.WebGLRenderer: image is not power of two ("+d.width+"x"+d.height+"). Resized to "+e.width+"x"+e.height,d);d=e}a.image=d}var g=a.image,d=x(g),e=D(a.format),h=D(a.type);
+w(s.TEXTURE_2D,a,d);var k=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<k.length&&d){for(var l=0,n=k.length;l<n;l++)g=k[l],I.texImage2D(s.TEXTURE_2D,l,e,g.width,g.height,0,e,h,g.data);a.generateMipmaps=!1}else I.texImage2D(s.TEXTURE_2D,0,e,g.width,g.height,0,e,h,g.data);else if(a instanceof THREE.CompressedTexture)for(l=0,n=k.length;l<n;l++)g=k[l],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<I.getCompressedTextureFormats().indexOf(e)?I.compressedTexImage2D(s.TEXTURE_2D,l,e,g.width,
+g.height,0,g.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):I.texImage2D(s.TEXTURE_2D,l,e,g.width,g.height,0,e,h,g.data);else if(0<k.length&&d){l=0;for(n=k.length;l<n;l++)g=k[l],I.texImage2D(s.TEXTURE_2D,l,e,e,h,g);a.generateMipmaps=!1}else I.texImage2D(s.TEXTURE_2D,0,e,e,h,a.image);a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_2D);c.__version=a.version;if(a.onUpdate)a.onUpdate(a)}}else I.activeTexture(s.TEXTURE0+b),I.bindTexture(s.TEXTURE_2D,
+c.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&void 0===S.get(a).__webglFramebuffer){var c=S.get(a),d=S.get(a.texture);void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",g);d.__webglTexture=s.createTexture();da.textures++;var e=x(a),f=D(a.texture.format),h=D(a.texture.type);if(b){c.__webglFramebuffer=[];c.__webglRenderbuffer=[];I.bindTexture(s.TEXTURE_CUBE_MAP,d.__webglTexture);
+w(s.TEXTURE_CUBE_MAP,a.texture,e);for(d=0;6>d;d++)c.__webglFramebuffer[d]=s.createFramebuffer(),c.__webglRenderbuffer[d]=s.createRenderbuffer(),I.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,f,a.width,a.height,0,f,h,null),B(c.__webglFramebuffer[d],a,s.TEXTURE_CUBE_MAP_POSITIVE_X+d),y(c.__webglRenderbuffer[d],a);a.texture.generateMipmaps&&e&&s.generateMipmap(s.TEXTURE_CUBE_MAP)}else c.__webglFramebuffer=s.createFramebuffer(),c.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:
+s.createRenderbuffer(),I.bindTexture(s.TEXTURE_2D,d.__webglTexture),w(s.TEXTURE_2D,a.texture,e),I.texImage2D(s.TEXTURE_2D,0,f,a.width,a.height,0,f,h,null),B(c.__webglFramebuffer,a,s.TEXTURE_2D),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):y(c.__webglRenderbuffer,
+a),a.texture.generateMipmaps&&e&&s.generateMipmap(s.TEXTURE_2D);b?I.bindTexture(s.TEXTURE_CUBE_MAP,null):I.bindTexture(s.TEXTURE_2D,null);s.bindRenderbuffer(s.RENDERBUFFER,null);s.bindFramebuffer(s.FRAMEBUFFER,null)}a?(c=S.get(a),d=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,c=a.width,e=a.height,h=f=0):(d=null,c=ha,e=ia,f=fa,h=ga);d!==ta&&(s.bindFramebuffer(s.FRAMEBUFFER,d),s.viewport(f,h,c,e),ta=d);b&&(d=S.get(a.texture),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,
+s.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,d.__webglTexture,0));ya=c;za=e};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!1===a instanceof THREE.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var g=S.get(a).__webglFramebuffer;if(g){var h=!1;g!==ta&&(s.bindFramebuffer(s.FRAMEBUFFER,g),h=!0);try{var k=a.texture;k.format!==THREE.RGBAFormat&&D(k.format)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):
+k.type===THREE.UnsignedByteType||D(k.type)===s.getParameter(s.IMPLEMENTATION_COLOR_READ_TYPE)||k.type===THREE.FloatType&&T.get("WEBGL_color_buffer_float")||k.type===THREE.HalfFloatType&&T.get("EXT_color_buffer_half_float")?s.checkFramebufferStatus(s.FRAMEBUFFER)===s.FRAMEBUFFER_COMPLETE?s.readPixels(b,c,d,e,D(k.format),D(k.type),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{h&&
+s.bindFramebuffer(s.FRAMEBUFFER,ta)}}}}};
 THREE.WebGLRenderTarget=function(a,b,c){this.uuid=THREE.Math.generateUUID();this.width=a;this.height=b;c=c||{};void 0===c.minFilter&&(c.minFilter=THREE.LinearFilter);this.texture=new THREE.Texture(void 0,void 0,c.wrapS,c.wrapT,c.magFilter,c.minFilter,c.format,c.type,c.anisotropy);this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.shareDepthFrom=void 0!==c.shareDepthFrom?c.shareDepthFrom:null};
 THREE.WebGLRenderTarget=function(a,b,c){this.uuid=THREE.Math.generateUUID();this.width=a;this.height=b;c=c||{};void 0===c.minFilter&&(c.minFilter=THREE.LinearFilter);this.texture=new THREE.Texture(void 0,void 0,c.wrapS,c.wrapT,c.magFilter,c.minFilter,c.format,c.type,c.anisotropy);this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.shareDepthFrom=void 0!==c.shareDepthFrom?c.shareDepthFrom:null};
 THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.dispose()},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.texture=a.texture.clone();this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.shareDepthFrom=a.shareDepthFrom;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);
 THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.dispose()},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.texture=a.texture.clone();this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.shareDepthFrom=a.shareDepthFrom;return this},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.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube;
 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.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube;
@@ -672,26 +673,26 @@ THREE.WebGLCapabilities=function(a,b,c){function d(b){if("highp"===b){if(0<a.get
 this.logarithmicDepthBuffer=void 0!==c.logarithmicDepthBuffer?c.logarithmicDepthBuffer:!1;this.maxTextures=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS);this.maxVertexTextures=a.getParameter(a.MAX_VERTEX_TEXTURE_IMAGE_UNITS);this.maxTextureSize=a.getParameter(a.MAX_TEXTURE_SIZE);this.maxCubemapSize=a.getParameter(a.MAX_CUBE_MAP_TEXTURE_SIZE);this.maxAttributes=a.getParameter(a.MAX_VERTEX_ATTRIBS);this.maxVertexUniforms=a.getParameter(a.MAX_VERTEX_UNIFORM_VECTORS);this.maxVaryings=a.getParameter(a.MAX_VARYING_VECTORS);
 this.logarithmicDepthBuffer=void 0!==c.logarithmicDepthBuffer?c.logarithmicDepthBuffer:!1;this.maxTextures=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS);this.maxVertexTextures=a.getParameter(a.MAX_VERTEX_TEXTURE_IMAGE_UNITS);this.maxTextureSize=a.getParameter(a.MAX_TEXTURE_SIZE);this.maxCubemapSize=a.getParameter(a.MAX_CUBE_MAP_TEXTURE_SIZE);this.maxAttributes=a.getParameter(a.MAX_VERTEX_ATTRIBS);this.maxVertexUniforms=a.getParameter(a.MAX_VERTEX_UNIFORM_VECTORS);this.maxVaryings=a.getParameter(a.MAX_VARYING_VECTORS);
 this.maxFragmentUniforms=a.getParameter(a.MAX_FRAGMENT_UNIFORM_VECTORS);this.vertexTextures=0<this.maxVertexTextures;this.floatFragmentTextures=!!b.get("OES_texture_float");this.floatVertexTextures=this.vertexTextures&&this.floatFragmentTextures;c=d(this.precision);c!==this.precision&&(console.warn("THREE.WebGLRenderer:",this.precision,"not supported, using",c,"instead."),this.precision=c);this.logarithmicDepthBuffer&&(this.logarithmicDepthBuffer=!!b.get("EXT_frag_depth"))};
 this.maxFragmentUniforms=a.getParameter(a.MAX_FRAGMENT_UNIFORM_VECTORS);this.vertexTextures=0<this.maxVertexTextures;this.floatFragmentTextures=!!b.get("OES_texture_float");this.floatVertexTextures=this.vertexTextures&&this.floatFragmentTextures;c=d(this.precision);c!==this.precision&&(console.warn("THREE.WebGLRenderer:",this.precision,"not supported, using",c,"instead."),this.precision=c);this.logarithmicDepthBuffer&&(this.logarithmicDepthBuffer=!!b.get("EXT_frag_depth"))};
 THREE.WebGLGeometries=function(a,b,c){function d(a){a=a.target;var h=f[a.id];null!==h.index&&e(h.index);var h=h.attributes,l;for(l in h)e(h[l]);a.removeEventListener("dispose",d);delete f[a.id];l=b.get(a);l.wireframe&&e(l.wireframe);c.memory.geometries--}function e(c){var d;d=c instanceof THREE.InterleavedBufferAttribute?b.get(c.data).__webglBuffer:b.get(c).__webglBuffer;void 0!==d&&(a.deleteBuffer(d),c instanceof THREE.InterleavedBufferAttribute?b.delete(c.data):b.delete(c))}var f={};this.get=function(a){var b=
 THREE.WebGLGeometries=function(a,b,c){function d(a){a=a.target;var h=f[a.id];null!==h.index&&e(h.index);var h=h.attributes,l;for(l in h)e(h[l]);a.removeEventListener("dispose",d);delete f[a.id];l=b.get(a);l.wireframe&&e(l.wireframe);c.memory.geometries--}function e(c){var d;d=c instanceof THREE.InterleavedBufferAttribute?b.get(c.data).__webglBuffer:b.get(c).__webglBuffer;void 0!==d&&(a.deleteBuffer(d),c instanceof THREE.InterleavedBufferAttribute?b.delete(c.data):b.delete(c))}var f={};this.get=function(a){var b=
-a.geometry;if(void 0!==f[b.id])return f[b.id];b.addEventListener("dispose",d);var e;b instanceof THREE.BufferGeometry?e=b:b instanceof THREE.Geometry&&(void 0===b._bufferGeometry&&(b._bufferGeometry=(new THREE.BufferGeometry).setFromObject(a)),e=b._bufferGeometry);f[b.id]=e;c.memory.geometries++;return e}};THREE.WebGLMaterials=function(){var a={};this.get=function(b){b=b.uuid;var c=a[b];void 0===c&&(c={},a[b]=c);return c};this.delete=function(b){delete a[b.uuid]};this.clear=function(){a={}}};
+a.geometry;if(void 0!==f[b.id])return f[b.id];b.addEventListener("dispose",d);var e;b instanceof THREE.BufferGeometry?e=b:b instanceof THREE.Geometry&&(void 0===b._bufferGeometry&&(b._bufferGeometry=(new THREE.BufferGeometry).setFromObject(a)),e=b._bufferGeometry);f[b.id]=e;c.memory.geometries++;return e}};
 THREE.WebGLObjects=function(a,b,c){function d(c,d){var e=c instanceof THREE.InterleavedBufferAttribute?c.data:c,f=b.get(e);void 0===f.__webglBuffer?(f.__webglBuffer=a.createBuffer(),a.bindBuffer(d,f.__webglBuffer),a.bufferData(d,e.array,e.dynamic?a.DYNAMIC_DRAW:a.STATIC_DRAW),f.version=e.version):f.version!==e.version&&(a.bindBuffer(d,f.__webglBuffer),!1===e.dynamic||-1===e.updateRange.count?a.bufferSubData(d,0,e.array):0===e.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):
 THREE.WebGLObjects=function(a,b,c){function d(c,d){var e=c instanceof THREE.InterleavedBufferAttribute?c.data:c,f=b.get(e);void 0===f.__webglBuffer?(f.__webglBuffer=a.createBuffer(),a.bindBuffer(d,f.__webglBuffer),a.bufferData(d,e.array,e.dynamic?a.DYNAMIC_DRAW:a.STATIC_DRAW),f.version=e.version):f.version!==e.version&&(a.bindBuffer(d,f.__webglBuffer),!1===e.dynamic||-1===e.updateRange.count?a.bufferSubData(d,0,e.array):0===e.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):
 (a.bufferSubData(d,e.updateRange.offset*e.array.BYTES_PER_ELEMENT,e.array.subarray(e.updateRange.offset,e.updateRange.offset+e.updateRange.count)),e.updateRange.count=0),f.version=e.version)}function e(a,b,c){if(b>c){var d=b;b=c;c=d}d=a[b];return void 0===d?(a[b]=[c],!0):-1===d.indexOf(c)?(d.push(c),!0):!1}var f=new THREE.WebGLGeometries(a,b,c);this.getAttributeBuffer=function(a){return a instanceof THREE.InterleavedBufferAttribute?b.get(a.data).__webglBuffer:b.get(a).__webglBuffer};this.getWireframeAttribute=
 (a.bufferSubData(d,e.updateRange.offset*e.array.BYTES_PER_ELEMENT,e.array.subarray(e.updateRange.offset,e.updateRange.offset+e.updateRange.count)),e.updateRange.count=0),f.version=e.version)}function e(a,b,c){if(b>c){var d=b;b=c;c=d}d=a[b];return void 0===d?(a[b]=[c],!0):-1===d.indexOf(c)?(d.push(c),!0):!1}var f=new THREE.WebGLGeometries(a,b,c);this.getAttributeBuffer=function(a){return a instanceof THREE.InterleavedBufferAttribute?b.get(a.data).__webglBuffer:b.get(a).__webglBuffer};this.getWireframeAttribute=
 function(c){var f=b.get(c);if(void 0!==f.wireframe)return f.wireframe;var l=[],k=c.index,m=c.attributes;c=m.position;if(null!==k)for(var m={},k=k.array,p=0,n=k.length;p<n;p+=3){var q=k[p+0],r=k[p+1],t=k[p+2];e(m,q,r)&&l.push(q,r);e(m,r,t)&&l.push(r,t);e(m,t,q)&&l.push(t,q)}else for(k=m.position.array,p=0,n=k.length/3-1;p<n;p+=3)q=p+0,r=p+1,t=p+2,l.push(q,r,r,t,t,q);l=new THREE.BufferAttribute(new (65535<c.count?Uint32Array:Uint16Array)(l),1);d(l,a.ELEMENT_ARRAY_BUFFER);return f.wireframe=l};this.update=
 function(c){var f=b.get(c);if(void 0!==f.wireframe)return f.wireframe;var l=[],k=c.index,m=c.attributes;c=m.position;if(null!==k)for(var m={},k=k.array,p=0,n=k.length;p<n;p+=3){var q=k[p+0],r=k[p+1],t=k[p+2];e(m,q,r)&&l.push(q,r);e(m,r,t)&&l.push(r,t);e(m,t,q)&&l.push(t,q)}else for(k=m.position.array,p=0,n=k.length/3-1;p<n;p+=3)q=p+0,r=p+1,t=p+2,l.push(q,r,r,t,t,q);l=new THREE.BufferAttribute(new (65535<c.count?Uint32Array:Uint16Array)(l),1);d(l,a.ELEMENT_ARRAY_BUFFER);return f.wireframe=l};this.update=
 function(b){var c=f.get(b);b.geometry instanceof THREE.Geometry&&c.updateFromObject(b);b=c.index;var e=c.attributes;null!==b&&d(b,a.ELEMENT_ARRAY_BUFFER);for(var k in e)d(e[k],a.ARRAY_BUFFER);b=c.morphAttributes;for(k in b)for(var e=b[k],m=0,p=e.length;m<p;m++)d(e[m],a.ARRAY_BUFFER);return c}};
 function(b){var c=f.get(b);b.geometry instanceof THREE.Geometry&&c.updateFromObject(b);b=c.index;var e=c.attributes;null!==b&&d(b,a.ELEMENT_ARRAY_BUFFER);for(var k in e)d(e[k],a.ARRAY_BUFFER);b=c.morphAttributes;for(k in b)for(var e=b[k],m=0,p=e.length;m<p;m++)d(e[m],a.ARRAY_BUFFER);return c}};
 THREE.WebGLProgram=function(){function a(a,b,d){a=a||{};return[a.derivatives||b.bumpMap||b.normalMap||b.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(a.fragDepth||b.logarithmicDepthBuffer)&&d.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",a.drawBuffers&&d.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(a.shaderTextureLOD||b.envMap)&&d.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(c).join("\n")}
 THREE.WebGLProgram=function(){function a(a,b,d){a=a||{};return[a.derivatives||b.bumpMap||b.normalMap||b.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(a.fragDepth||b.logarithmicDepthBuffer)&&d.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",a.drawBuffers&&d.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(a.shaderTextureLOD||b.envMap)&&d.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(c).join("\n")}
 function b(a){var b=[],c;for(c in a){var d=a[c];!1!==d&&b.push("#define "+c+" "+d)}return b.join("\n")}function c(a){return""!==a}var d=0,e=/^([\w\d_]+)\.([\w\d_]+)$/,f=/^([\w\d_]+)\[(\d+)\]\.([\w\d_]+)$/,g=/^([\w\d_]+)\[0\]$/;return function(h,l,k,m){var p=h.context,n=k.extensions,q=k.defines,r=k.__webglShader.vertexShader,t=k.__webglShader.fragmentShader,v="SHADOWMAP_TYPE_BASIC";m.shadowMapType===THREE.PCFShadowMap?v="SHADOWMAP_TYPE_PCF":m.shadowMapType===THREE.PCFSoftShadowMap&&(v="SHADOWMAP_TYPE_PCF_SOFT");
 function b(a){var b=[],c;for(c in a){var d=a[c];!1!==d&&b.push("#define "+c+" "+d)}return b.join("\n")}function c(a){return""!==a}var d=0,e=/^([\w\d_]+)\.([\w\d_]+)$/,f=/^([\w\d_]+)\[(\d+)\]\.([\w\d_]+)$/,g=/^([\w\d_]+)\[0\]$/;return function(h,l,k,m){var p=h.context,n=k.extensions,q=k.defines,r=k.__webglShader.vertexShader,t=k.__webglShader.fragmentShader,v="SHADOWMAP_TYPE_BASIC";m.shadowMapType===THREE.PCFShadowMap?v="SHADOWMAP_TYPE_PCF":m.shadowMapType===THREE.PCFSoftShadowMap&&(v="SHADOWMAP_TYPE_PCF_SOFT");
-var u="ENVMAP_TYPE_CUBE",w="ENVMAP_MODE_REFLECTION",G="ENVMAP_BLENDING_MULTIPLY";if(m.envMap){switch(k.envMap.mapping){case THREE.CubeReflectionMapping:case THREE.CubeRefractionMapping:u="ENVMAP_TYPE_CUBE";break;case THREE.EquirectangularReflectionMapping:case THREE.EquirectangularRefractionMapping:u="ENVMAP_TYPE_EQUIREC";break;case THREE.SphericalReflectionMapping:u="ENVMAP_TYPE_SPHERE"}switch(k.envMap.mapping){case THREE.CubeRefractionMapping:case THREE.EquirectangularRefractionMapping:w="ENVMAP_MODE_REFRACTION"}switch(k.combine){case THREE.MultiplyOperation:G=
-"ENVMAP_BLENDING_MULTIPLY";break;case THREE.MixOperation:G="ENVMAP_BLENDING_MIX";break;case THREE.AddOperation:G="ENVMAP_BLENDING_ADD"}}var x=0<h.gammaFactor?h.gammaFactor:1,n=a(n,m,h.extensions),B=b(q),z=p.createProgram();k instanceof THREE.RawShaderMaterial?h=q="":(q=["precision "+m.precision+" float;","precision "+m.precision+" int;","#define SHADER_NAME "+k.__webglShader.name,B,m.supportsVertexTextures?"#define VERTEX_TEXTURES":"",h.gammaInput?"#define GAMMA_INPUT":"",h.gammaOutput?"#define GAMMA_OUTPUT":
+var u="ENVMAP_TYPE_CUBE",w="ENVMAP_MODE_REFLECTION",F="ENVMAP_BLENDING_MULTIPLY";if(m.envMap){switch(k.envMap.mapping){case THREE.CubeReflectionMapping:case THREE.CubeRefractionMapping:u="ENVMAP_TYPE_CUBE";break;case THREE.EquirectangularReflectionMapping:case THREE.EquirectangularRefractionMapping:u="ENVMAP_TYPE_EQUIREC";break;case THREE.SphericalReflectionMapping:u="ENVMAP_TYPE_SPHERE"}switch(k.envMap.mapping){case THREE.CubeRefractionMapping:case THREE.EquirectangularRefractionMapping:w="ENVMAP_MODE_REFRACTION"}switch(k.combine){case THREE.MultiplyOperation:F=
+"ENVMAP_BLENDING_MULTIPLY";break;case THREE.MixOperation:F="ENVMAP_BLENDING_MIX";break;case THREE.AddOperation:F="ENVMAP_BLENDING_ADD"}}var x=0<h.gammaFactor?h.gammaFactor:1,n=a(n,m,h.extensions),A=b(q),z=p.createProgram();k instanceof THREE.RawShaderMaterial?h=q="":(q=["precision "+m.precision+" float;","precision "+m.precision+" int;","#define SHADER_NAME "+k.__webglShader.name,A,m.supportsVertexTextures?"#define VERTEX_TEXTURES":"",h.gammaInput?"#define GAMMA_INPUT":"",h.gammaOutput?"#define GAMMA_OUTPUT":
 "","#define GAMMA_FACTOR "+x,"#define MAX_DIR_LIGHTS "+m.maxDirLights,"#define MAX_POINT_LIGHTS "+m.maxPointLights,"#define MAX_SPOT_LIGHTS "+m.maxSpotLights,"#define MAX_HEMI_LIGHTS "+m.maxHemiLights,"#define MAX_SHADOWS "+m.maxShadows,"#define MAX_BONES "+m.maxBones,m.map?"#define USE_MAP":"",m.envMap?"#define USE_ENVMAP":"",m.envMap?"#define "+w:"",m.lightMap?"#define USE_LIGHTMAP":"",m.aoMap?"#define USE_AOMAP":"",m.emissiveMap?"#define USE_EMISSIVEMAP":"",m.bumpMap?"#define USE_BUMPMAP":"",m.normalMap?
 "","#define GAMMA_FACTOR "+x,"#define MAX_DIR_LIGHTS "+m.maxDirLights,"#define MAX_POINT_LIGHTS "+m.maxPointLights,"#define MAX_SPOT_LIGHTS "+m.maxSpotLights,"#define MAX_HEMI_LIGHTS "+m.maxHemiLights,"#define MAX_SHADOWS "+m.maxShadows,"#define MAX_BONES "+m.maxBones,m.map?"#define USE_MAP":"",m.envMap?"#define USE_ENVMAP":"",m.envMap?"#define "+w:"",m.lightMap?"#define USE_LIGHTMAP":"",m.aoMap?"#define USE_AOMAP":"",m.emissiveMap?"#define USE_EMISSIVEMAP":"",m.bumpMap?"#define USE_BUMPMAP":"",m.normalMap?
 "#define USE_NORMALMAP":"",m.displacementMap&&m.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",m.specularMap?"#define USE_SPECULARMAP":"",m.roughnessMap?"#define USE_ROUGHNESSMAP":"",m.reflectivityMap?"#define USE_REFLECTIVITYMAP":"",m.metalnessMap?"#define USE_METALNESSMAP":"",m.alphaMap?"#define USE_ALPHAMAP":"",m.vertexColors?"#define USE_COLOR":"",m.flatShading?"#define FLAT_SHADED":"",m.skinning?"#define USE_SKINNING":"",m.useVertexTexture?"#define BONE_TEXTURE":"",m.morphTargets?"#define USE_MORPHTARGETS":
 "#define USE_NORMALMAP":"",m.displacementMap&&m.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",m.specularMap?"#define USE_SPECULARMAP":"",m.roughnessMap?"#define USE_ROUGHNESSMAP":"",m.reflectivityMap?"#define USE_REFLECTIVITYMAP":"",m.metalnessMap?"#define USE_METALNESSMAP":"",m.alphaMap?"#define USE_ALPHAMAP":"",m.vertexColors?"#define USE_COLOR":"",m.flatShading?"#define FLAT_SHADED":"",m.skinning?"#define USE_SKINNING":"",m.useVertexTexture?"#define BONE_TEXTURE":"",m.morphTargets?"#define USE_MORPHTARGETS":
 "",m.morphNormals&&!1===m.flatShading?"#define USE_MORPHNORMALS":"",m.doubleSided?"#define DOUBLE_SIDED":"",m.flipSided?"#define FLIP_SIDED":"",m.shadowMapEnabled?"#define USE_SHADOWMAP":"",m.shadowMapEnabled?"#define "+v:"",m.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",0<m.pointLightShadows?"#define POINT_LIGHT_SHADOWS":"",m.sizeAttenuation?"#define USE_SIZEATTENUATION":"",m.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",m.logarithmicDepthBuffer&&h.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":
 "",m.morphNormals&&!1===m.flatShading?"#define USE_MORPHNORMALS":"",m.doubleSided?"#define DOUBLE_SIDED":"",m.flipSided?"#define FLIP_SIDED":"",m.shadowMapEnabled?"#define USE_SHADOWMAP":"",m.shadowMapEnabled?"#define "+v:"",m.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",0<m.pointLightShadows?"#define POINT_LIGHT_SHADOWS":"",m.sizeAttenuation?"#define USE_SIZEATTENUATION":"",m.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",m.logarithmicDepthBuffer&&h.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":
 "","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;",
 "","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;",
 "\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(c).join("\n"),h=[n,"precision "+m.precision+" float;","precision "+m.precision+" int;","#define SHADER_NAME "+k.__webglShader.name,
 "\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(c).join("\n"),h=[n,"precision "+m.precision+" float;","precision "+m.precision+" int;","#define SHADER_NAME "+k.__webglShader.name,
-B,"#define MAX_DIR_LIGHTS "+m.maxDirLights,"#define MAX_POINT_LIGHTS "+m.maxPointLights,"#define MAX_SPOT_LIGHTS "+m.maxSpotLights,"#define MAX_HEMI_LIGHTS "+m.maxHemiLights,"#define MAX_SHADOWS "+m.maxShadows,m.alphaTest?"#define ALPHATEST "+m.alphaTest:"",h.gammaInput?"#define GAMMA_INPUT":"",h.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+x,m.useFog&&m.fog?"#define USE_FOG":"",m.useFog&&m.fogExp?"#define FOG_EXP2":"",m.map?"#define USE_MAP":"",m.envMap?"#define USE_ENVMAP":"",m.envMap?
-"#define "+u:"",m.envMap?"#define "+w:"",m.envMap?"#define "+G:"",m.lightMap?"#define USE_LIGHTMAP":"",m.aoMap?"#define USE_AOMAP":"",m.emissiveMap?"#define USE_EMISSIVEMAP":"",m.bumpMap?"#define USE_BUMPMAP":"",m.normalMap?"#define USE_NORMALMAP":"",m.specularMap?"#define USE_SPECULARMAP":"",m.roughnessMap?"#define USE_ROUGHNESSMAP":"",m.reflectivityMap?"#define USE_REFLECTIVITYMAP":"",m.metalnessMap?"#define USE_METALNESSMAP":"",m.alphaMap?"#define USE_ALPHAMAP":"",m.vertexColors?"#define USE_COLOR":
+A,"#define MAX_DIR_LIGHTS "+m.maxDirLights,"#define MAX_POINT_LIGHTS "+m.maxPointLights,"#define MAX_SPOT_LIGHTS "+m.maxSpotLights,"#define MAX_HEMI_LIGHTS "+m.maxHemiLights,"#define MAX_SHADOWS "+m.maxShadows,m.alphaTest?"#define ALPHATEST "+m.alphaTest:"",h.gammaInput?"#define GAMMA_INPUT":"",h.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+x,m.useFog&&m.fog?"#define USE_FOG":"",m.useFog&&m.fogExp?"#define FOG_EXP2":"",m.map?"#define USE_MAP":"",m.envMap?"#define USE_ENVMAP":"",m.envMap?
+"#define "+u:"",m.envMap?"#define "+w:"",m.envMap?"#define "+F:"",m.lightMap?"#define USE_LIGHTMAP":"",m.aoMap?"#define USE_AOMAP":"",m.emissiveMap?"#define USE_EMISSIVEMAP":"",m.bumpMap?"#define USE_BUMPMAP":"",m.normalMap?"#define USE_NORMALMAP":"",m.specularMap?"#define USE_SPECULARMAP":"",m.roughnessMap?"#define USE_ROUGHNESSMAP":"",m.reflectivityMap?"#define USE_REFLECTIVITYMAP":"",m.metalnessMap?"#define USE_METALNESSMAP":"",m.alphaMap?"#define USE_ALPHAMAP":"",m.vertexColors?"#define USE_COLOR":
 "",m.flatShading?"#define FLAT_SHADED":"",m.metal?"#define METAL":"",m.doubleSided?"#define DOUBLE_SIDED":"",m.flipSided?"#define FLIP_SIDED":"",m.shadowMapEnabled?"#define USE_SHADOWMAP":"",m.shadowMapEnabled?"#define "+v:"",m.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",0<m.pointLightShadows?"#define POINT_LIGHT_SHADOWS":"",m.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",m.logarithmicDepthBuffer&&h.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",m.envMap&&h.extensions.get("EXT_shader_texture_lod")?
 "",m.flatShading?"#define FLAT_SHADED":"",m.metal?"#define METAL":"",m.doubleSided?"#define DOUBLE_SIDED":"",m.flipSided?"#define FLIP_SIDED":"",m.shadowMapEnabled?"#define USE_SHADOWMAP":"",m.shadowMapEnabled?"#define "+v:"",m.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",0<m.pointLightShadows?"#define POINT_LIGHT_SHADOWS":"",m.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",m.logarithmicDepthBuffer&&h.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",m.envMap&&h.extensions.get("EXT_shader_texture_lod")?
-"#define TEXTURE_CUBE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","\n"].filter(c).join("\n"));t=h+t;r=THREE.WebGLShader(p,p.VERTEX_SHADER,q+r);t=THREE.WebGLShader(p,p.FRAGMENT_SHADER,t);p.attachShader(z,r);p.attachShader(z,t);void 0!==k.index0AttributeName?p.bindAttribLocation(z,0,k.index0AttributeName):!0===m.morphTargets&&p.bindAttribLocation(z,0,"position");p.linkProgram(z);m=p.getProgramInfoLog(z);v=p.getShaderInfoLog(r);u=p.getShaderInfoLog(t);G=w=!0;if(!1===p.getProgramParameter(z,
-p.LINK_STATUS))w=!1,console.error("THREE.WebGLProgram: shader error: ",p.getError(),"gl.VALIDATE_STATUS",p.getProgramParameter(z,p.VALIDATE_STATUS),"gl.getProgramInfoLog",m,v,u);else if(""!==m)console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",m);else if(""===v||""===u)G=!1;G&&(this.diagnostics={runnable:w,material:k,programLog:m,vertexShader:{log:v,prefix:q},fragmentShader:{log:u,prefix:h}});p.deleteShader(r);p.deleteShader(t);var A;this.getUniforms=function(){if(void 0===A){for(var a={},
-b=p.getProgramParameter(z,p.ACTIVE_UNIFORMS),c=0;c<b;c++){var d=p.getActiveUniform(z,c).name,h=p.getUniformLocation(z,d),k=e.exec(d);if(k){var d=k[1],k=k[2],l=a[d];l||(l=a[d]={});l[k]=h}else if(k=f.exec(d)){var l=k[1],d=k[2],k=k[3],n=a[l];n||(n=a[l]=[]);(l=n[d])||(l=n[d]={});l[k]=h}else(k=g.exec(d))?(l=k[1],a[l]=h):a[d]=h}A=a}return A};var y;this.getAttributes=function(){if(void 0===y){for(var a={},b=p.getProgramParameter(z,p.ACTIVE_ATTRIBUTES),c=0;c<b;c++){var d=p.getActiveAttrib(z,c).name;a[d]=
+"#define TEXTURE_CUBE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","\n"].filter(c).join("\n"));t=h+t;r=THREE.WebGLShader(p,p.VERTEX_SHADER,q+r);t=THREE.WebGLShader(p,p.FRAGMENT_SHADER,t);p.attachShader(z,r);p.attachShader(z,t);void 0!==k.index0AttributeName?p.bindAttribLocation(z,0,k.index0AttributeName):!0===m.morphTargets&&p.bindAttribLocation(z,0,"position");p.linkProgram(z);m=p.getProgramInfoLog(z);v=p.getShaderInfoLog(r);u=p.getShaderInfoLog(t);F=w=!0;if(!1===p.getProgramParameter(z,
+p.LINK_STATUS))w=!1,console.error("THREE.WebGLProgram: shader error: ",p.getError(),"gl.VALIDATE_STATUS",p.getProgramParameter(z,p.VALIDATE_STATUS),"gl.getProgramInfoLog",m,v,u);else if(""!==m)console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",m);else if(""===v||""===u)F=!1;F&&(this.diagnostics={runnable:w,material:k,programLog:m,vertexShader:{log:v,prefix:q},fragmentShader:{log:u,prefix:h}});p.deleteShader(r);p.deleteShader(t);var B;this.getUniforms=function(){if(void 0===B){for(var a={},
+b=p.getProgramParameter(z,p.ACTIVE_UNIFORMS),c=0;c<b;c++){var d=p.getActiveUniform(z,c).name,h=p.getUniformLocation(z,d),k=e.exec(d);if(k){var d=k[1],k=k[2],l=a[d];l||(l=a[d]={});l[k]=h}else if(k=f.exec(d)){var l=k[1],d=k[2],k=k[3],n=a[l];n||(n=a[l]=[]);(l=n[d])||(l=n[d]={});l[k]=h}else(k=g.exec(d))?(l=k[1],a[l]=h):a[d]=h}B=a}return B};var y;this.getAttributes=function(){if(void 0===y){for(var a={},b=p.getProgramParameter(z,p.ACTIVE_ATTRIBUTES),c=0;c<b;c++){var d=p.getActiveAttrib(z,c).name;a[d]=
 p.getAttribLocation(z,d)}y=a}return y};this.destroy=function(){p.deleteProgram(z);this.program=void 0};Object.defineProperties(this,{uniforms:{get:function(){console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms().");return this.getUniforms()}},attributes:{get:function(){console.warn("THREE.WebGLProgram: .attributes is now .getAttributes().");return this.getAttributes()}}});this.id=d++;this.code=l;this.usedTimes=1;this.program=z;this.vertexShader=r;this.fragmentShader=t;return this}}();
 p.getAttribLocation(z,d)}y=a}return y};this.destroy=function(){p.deleteProgram(z);this.program=void 0};Object.defineProperties(this,{uniforms:{get:function(){console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms().");return this.getUniforms()}},attributes:{get:function(){console.warn("THREE.WebGLProgram: .attributes is now .getAttributes().");return this.getAttributes()}}});this.id=d++;this.code=l;this.usedTimes=1;this.program=z;this.vertexShader=r;this.fragmentShader=t;return this}}();
 THREE.WebGLPrograms=function(a,b){var c=[],d={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},e="precision supportsVertexTextures map envMap envMapMode lightMap aoMap emissiveMap bumpMap normalMap displacementMap specularMap roughnessMap reflectivityMap metalnessMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals maxDirLights maxPointLights maxSpotLights maxHemiLights maxShadows shadowMapEnabled pointLightShadows shadowMapType shadowMapDebug alphaTest metal doubleSided flipSided".split(" ");
 THREE.WebGLPrograms=function(a,b){var c=[],d={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},e="precision supportsVertexTextures map envMap envMapMode lightMap aoMap emissiveMap bumpMap normalMap displacementMap specularMap roughnessMap reflectivityMap metalnessMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals maxDirLights maxPointLights maxSpotLights maxHemiLights maxShadows shadowMapEnabled pointLightShadows shadowMapType shadowMapDebug alphaTest metal doubleSided flipSided".split(" ");
 this.getParameters=function(c,e,h,l){var k,m,p,n,q,r=d[c.type];k=q=n=p=m=0;for(var t=e.length;k<t;k++){var v=e[k];v instanceof THREE.DirectionalLight&&m++;v instanceof THREE.PointLight&&p++;v instanceof THREE.SpotLight&&n++;v instanceof THREE.HemisphereLight&&q++}for(var v=k=t=0,u=e.length;v<u;v++){var w=e[v];!1!==w.castShadow&&((w instanceof THREE.SpotLight||w instanceof THREE.DirectionalLight)&&t++,w instanceof THREE.PointLight&&(t++,k++))}e=t;b.floatVertexTextures&&l&&l.skeleton&&l.skeleton.useVertexTexture?
 this.getParameters=function(c,e,h,l){var k,m,p,n,q,r=d[c.type];k=q=n=p=m=0;for(var t=e.length;k<t;k++){var v=e[k];v instanceof THREE.DirectionalLight&&m++;v instanceof THREE.PointLight&&p++;v instanceof THREE.SpotLight&&n++;v instanceof THREE.HemisphereLight&&q++}for(var v=k=t=0,u=e.length;v<u;v++){var w=e[v];!1!==w.castShadow&&((w instanceof THREE.SpotLight||w instanceof THREE.DirectionalLight)&&t++,w instanceof THREE.PointLight&&(t++,k++))}e=t;b.floatVertexTextures&&l&&l.skeleton&&l.skeleton.useVertexTexture?
@@ -703,38 +704,38 @@ m=c.length;k<m;k++){var p=c[k];if(p.code===e){l=p;++l.usedTimes;break}}void 0===
 THREE.WebGLShader=function(){function a(a){a=a.split("\n");for(var c=0;c<a.length;c++)a[c]=c+1+": "+a[c];return a.join("\n")}return function(b,c,d){var e=b.createShader(c);b.shaderSource(e,d);b.compileShader(e);!1===b.getShaderParameter(e,b.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile.");""!==b.getShaderInfoLog(e)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",c===b.VERTEX_SHADER?"vertex":"fragment",b.getShaderInfoLog(e),a(d));return e}}();
 THREE.WebGLShader=function(){function a(a){a=a.split("\n");for(var c=0;c<a.length;c++)a[c]=c+1+": "+a[c];return a.join("\n")}return function(b,c,d){var e=b.createShader(c);b.shaderSource(e,d);b.compileShader(e);!1===b.getShaderParameter(e,b.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile.");""!==b.getShaderInfoLog(e)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",c===b.VERTEX_SHADER?"vertex":"fragment",b.getShaderInfoLog(e),a(d));return e}}();
 THREE.WebGLShadowMap=function(a,b,c){function d(a,b,c,d){var e=a.geometry,f=null,f=n,g=a.customDepthMaterial;c&&(f=q,g=a.customDistanceMaterial);g?f=g:(a=a instanceof THREE.SkinnedMesh&&b.skinning,g=0,void 0!==e.morphTargets&&0<e.morphTargets.length&&b.morphTargets&&(g|=1),a&&(g|=2),f=f[g]);f.visible=b.visible;f.wireframe=b.wireframe;f.wireframeLinewidth=b.wireframeLinewidth;c&&void 0!==f.uniforms.lightPos&&f.uniforms.lightPos.value.copy(d);return f}function e(a,b,c){if(!1!==a.visible){a.layers.test(b.layers)&&
 THREE.WebGLShadowMap=function(a,b,c){function d(a,b,c,d){var e=a.geometry,f=null,f=n,g=a.customDepthMaterial;c&&(f=q,g=a.customDistanceMaterial);g?f=g:(a=a instanceof THREE.SkinnedMesh&&b.skinning,g=0,void 0!==e.morphTargets&&0<e.morphTargets.length&&b.morphTargets&&(g|=1),a&&(g|=2),f=f[g]);f.visible=b.visible;f.wireframe=b.wireframe;f.wireframeLinewidth=b.wireframeLinewidth;c&&void 0!==f.uniforms.lightPos&&f.uniforms.lightPos.value.copy(d);return f}function e(a,b,c){if(!1!==a.visible){a.layers.test(b.layers)&&
 (a instanceof THREE.Mesh||a instanceof THREE.Line||a instanceof THREE.Points)&&a.castShadow&&(!1===a.frustumCulled||!0===h.intersectsObject(a))&&!0===a.material.visible&&(a.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,a.matrixWorld),p.push(a));a=a.children;for(var d=0,f=a.length;d<f;d++)e(a[d],b,c)}}var f=a.context,g=a.state,h=new THREE.Frustum,l=new THREE.Matrix4;new THREE.Vector3;new THREE.Vector3;for(var k=new THREE.Vector3,m=new THREE.Vector3,p=[],n=Array(4),q=Array(4),r=[new THREE.Vector3(1,
 (a instanceof THREE.Mesh||a instanceof THREE.Line||a instanceof THREE.Points)&&a.castShadow&&(!1===a.frustumCulled||!0===h.intersectsObject(a))&&!0===a.material.visible&&(a.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,a.matrixWorld),p.push(a));a=a.children;for(var d=0,f=a.length;d<f;d++)e(a[d],b,c)}}var f=a.context,g=a.state,h=new THREE.Frustum,l=new THREE.Matrix4;new THREE.Vector3;new THREE.Vector3;for(var k=new THREE.Vector3,m=new THREE.Vector3,p=[],n=Array(4),q=Array(4),r=[new THREE.Vector3(1,
-0,0),new THREE.Vector3(-1,0,0),new THREE.Vector3(0,0,1),new THREE.Vector3(0,0,-1),new THREE.Vector3(0,1,0),new THREE.Vector3(0,-1,0)],t=[new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,0,1),new THREE.Vector3(0,0,-1)],v=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],u=new THREE.Vector4,w=THREE.ShaderLib.depthRGBA,G=THREE.UniformsUtils.clone(w.uniforms),x=THREE.ShaderLib.distanceRGBA,
-B=THREE.UniformsUtils.clone(x.uniforms),z=0;4!==z;++z){var A=0!==(z&1),y=0!==(z&2),J=new THREE.ShaderMaterial({uniforms:G,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,morphTargets:A,skinning:y});J._shadowPass=!0;n[z]=J;A=new THREE.ShaderMaterial({uniforms:B,vertexShader:x.vertexShader,fragmentShader:x.fragmentShader,morphTargets:A,skinning:y});A._shadowPass=!0;q[z]=A}var D=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=THREE.PCFShadowMap;this.cullFace=THREE.CullFaceFront;
-this.render=function(n,q){var w,x;if(!1!==D.enabled&&(!1!==D.autoUpdate||!1!==D.needsUpdate)){f.clearColor(1,1,1,1);g.disable(f.BLEND);g.enable(f.CULL_FACE);f.frontFace(f.CCW);f.cullFace(D.cullFace===THREE.CullFaceFront?f.FRONT:f.BACK);g.setDepthTest(!0);a.getViewport(u);for(var G=0,A=b.length;G<A;G++){var z=b[G];if(!0===z.castShadow){var B=z.shadow,y=B.camera,J=B.mapSize;if(z instanceof THREE.PointLight){w=6;x=!0;var L=J.x/4,C=J.y/2;v[0].set(2*L,C,L,C);v[1].set(0,C,L,C);v[2].set(3*L,C,L,C);v[3].set(L,
-C,L,C);v[4].set(3*L,0,L,C);v[5].set(L,0,L,C)}else w=1,x=!1;null===B.map&&(L=THREE.LinearFilter,D.type===THREE.PCFSoftShadowMap&&(L=THREE.NearestFilter),B.map=new THREE.WebGLRenderTarget(J.x,J.y,{minFilter:L,magFilter:L,format:THREE.RGBAFormat}),B.matrix=new THREE.Matrix4,z instanceof THREE.SpotLight&&(y.aspect=J.x/J.y),y.updateProjectionMatrix());J=B.map;B=B.matrix;m.setFromMatrixPosition(z.matrixWorld);y.position.copy(m);a.setRenderTarget(J);a.clear();for(J=0;J<w;J++)for(x?(k.copy(y.position),k.add(r[J]),
-y.up.copy(t[J]),y.lookAt(k),L=v[J],a.setViewport(L.x,L.y,L.z,L.w)):(k.setFromMatrixPosition(z.target.matrixWorld),y.lookAt(k)),y.updateMatrixWorld(),y.matrixWorldInverse.getInverse(y.matrixWorld),B.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),B.multiply(y.projectionMatrix),B.multiply(y.matrixWorldInverse),l.multiplyMatrices(y.projectionMatrix,y.matrixWorldInverse),h.setFromMatrix(l),p.length=0,e(n,q,y),L=0,C=p.length;L<C;L++){var X=p[L],U=c.update(X),Y=X.material;if(Y instanceof THREE.MeshFaceMaterial)for(var ea=
+0,0),new THREE.Vector3(-1,0,0),new THREE.Vector3(0,0,1),new THREE.Vector3(0,0,-1),new THREE.Vector3(0,1,0),new THREE.Vector3(0,-1,0)],t=[new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0),new THREE.Vector3(0,0,1),new THREE.Vector3(0,0,-1)],v=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],u=new THREE.Vector4,w=THREE.ShaderLib.depthRGBA,F=THREE.UniformsUtils.clone(w.uniforms),x=THREE.ShaderLib.distanceRGBA,
+A=THREE.UniformsUtils.clone(x.uniforms),z=0;4!==z;++z){var B=0!==(z&1),y=0!==(z&2),H=new THREE.ShaderMaterial({uniforms:F,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,morphTargets:B,skinning:y});H._shadowPass=!0;n[z]=H;B=new THREE.ShaderMaterial({uniforms:A,vertexShader:x.vertexShader,fragmentShader:x.fragmentShader,morphTargets:B,skinning:y});B._shadowPass=!0;q[z]=B}var D=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=THREE.PCFShadowMap;this.cullFace=THREE.CullFaceFront;
+this.render=function(n,q){var w,x;if(!1!==D.enabled&&(!1!==D.autoUpdate||!1!==D.needsUpdate)){f.clearColor(1,1,1,1);g.disable(f.BLEND);g.enable(f.CULL_FACE);f.frontFace(f.CCW);f.cullFace(D.cullFace===THREE.CullFaceFront?f.FRONT:f.BACK);g.setDepthTest(!0);a.getViewport(u);for(var F=0,A=b.length;F<A;F++){var B=b[F];if(!0===B.castShadow){var z=B.shadow,y=z.camera,H=z.mapSize;if(B instanceof THREE.PointLight){w=6;x=!0;var L=H.x/4,C=H.y/2;v[0].set(2*L,C,L,C);v[1].set(0,C,L,C);v[2].set(3*L,C,L,C);v[3].set(L,
+C,L,C);v[4].set(3*L,0,L,C);v[5].set(L,0,L,C)}else w=1,x=!1;null===z.map&&(L=THREE.LinearFilter,D.type===THREE.PCFSoftShadowMap&&(L=THREE.NearestFilter),z.map=new THREE.WebGLRenderTarget(H.x,H.y,{minFilter:L,magFilter:L,format:THREE.RGBAFormat}),z.matrix=new THREE.Matrix4,B instanceof THREE.SpotLight&&(y.aspect=H.x/H.y),y.updateProjectionMatrix());H=z.map;z=z.matrix;m.setFromMatrixPosition(B.matrixWorld);y.position.copy(m);a.setRenderTarget(H);a.clear();for(H=0;H<w;H++)for(x?(k.copy(y.position),k.add(r[H]),
+y.up.copy(t[H]),y.lookAt(k),L=v[H],a.setViewport(L.x,L.y,L.z,L.w)):(k.setFromMatrixPosition(B.target.matrixWorld),y.lookAt(k)),y.updateMatrixWorld(),y.matrixWorldInverse.getInverse(y.matrixWorld),z.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),z.multiply(y.projectionMatrix),z.multiply(y.matrixWorldInverse),l.multiplyMatrices(y.projectionMatrix,y.matrixWorldInverse),h.setFromMatrix(l),p.length=0,e(n,q,y),L=0,C=p.length;L<C;L++){var X=p[L],U=c.update(X),Y=X.material;if(Y instanceof THREE.MeshFaceMaterial)for(var ea=
 U.groups,Y=Y.materials,aa=0,na=ea.length;aa<na;aa++){var pa=ea[aa],$=Y[pa.materialIndex];!0===$.visible&&($=d(X,$,x,m),a.renderBufferDirect(y,b,null,U,$,X,pa))}else $=d(X,Y,x,m),a.renderBufferDirect(y,b,null,U,$,X,null)}a.resetGLState()}}a.setViewport(u.x,u.y,u.z,u.w);w=a.getClearColor();x=a.getClearAlpha();a.setClearColor(w,x);g.enable(f.BLEND);D.cullFace===THREE.CullFaceFront&&f.cullFace(f.BACK);a.resetGLState();D.needsUpdate=!1}}};
 U.groups,Y=Y.materials,aa=0,na=ea.length;aa<na;aa++){var pa=ea[aa],$=Y[pa.materialIndex];!0===$.visible&&($=d(X,$,x,m),a.renderBufferDirect(y,b,null,U,$,X,pa))}else $=d(X,Y,x,m),a.renderBufferDirect(y,b,null,U,$,X,null)}a.resetGLState()}}a.setViewport(u.x,u.y,u.z,u.w);w=a.getClearColor();x=a.getClearAlpha();a.setClearColor(w,x);g.enable(f.BLEND);D.cullFace===THREE.CullFaceFront&&f.cullFace(f.BACK);a.resetGLState();D.needsUpdate=!1}}};
-THREE.WebGLState=function(a,b,c){var d=this,e=new Uint8Array(16),f=new Uint8Array(16),g=new Uint8Array(16),h={},l=null,k=null,m=null,p=null,n=null,q=null,r=null,t=null,v=null,u=null,w=null,G=null,x=null,B=null,z=null,A=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),y=void 0,J={};this.init=function(){a.clearColor(0,0,0,1);a.clearDepth(1);a.clearStencil(0);this.enable(a.DEPTH_TEST);a.depthFunc(a.LEQUAL);a.frontFace(a.CCW);a.cullFace(a.BACK);this.enable(a.CULL_FACE);this.enable(a.BLEND);a.blendEquation(a.FUNC_ADD);
+THREE.WebGLState=function(a,b,c){var d=this,e=new Uint8Array(16),f=new Uint8Array(16),g=new Uint8Array(16),h={},l=null,k=null,m=null,p=null,n=null,q=null,r=null,t=null,v=null,u=null,w=null,F=null,x=null,A=null,z=null,B=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),y=void 0,H={};this.init=function(){a.clearColor(0,0,0,1);a.clearDepth(1);a.clearStencil(0);this.enable(a.DEPTH_TEST);a.depthFunc(a.LEQUAL);a.frontFace(a.CCW);a.cullFace(a.BACK);this.enable(a.CULL_FACE);this.enable(a.BLEND);a.blendEquation(a.FUNC_ADD);
 a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA)};this.initAttributes=function(){for(var a=0,b=e.length;a<b;a++)e[a]=0};this.enableAttribute=function(c){e[c]=1;0===f[c]&&(a.enableVertexAttribArray(c),f[c]=1);0!==g[c]&&(b.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(c,0),g[c]=0)};this.enableAttributeAndDivisor=function(b,c,d){e[b]=1;0===f[b]&&(a.enableVertexAttribArray(b),f[b]=1);g[b]!==c&&(d.vertexAttribDivisorANGLE(b,c),g[b]=c)};this.disableUnusedAttributes=function(){for(var b=0,c=f.length;b<
 a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA)};this.initAttributes=function(){for(var a=0,b=e.length;a<b;a++)e[a]=0};this.enableAttribute=function(c){e[c]=1;0===f[c]&&(a.enableVertexAttribArray(c),f[c]=1);0!==g[c]&&(b.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(c,0),g[c]=0)};this.enableAttributeAndDivisor=function(b,c,d){e[b]=1;0===f[b]&&(a.enableVertexAttribArray(b),f[b]=1);g[b]!==c&&(d.vertexAttribDivisorANGLE(b,c),g[b]=c)};this.disableUnusedAttributes=function(){for(var b=0,c=f.length;b<
 c;b++)f[b]!==e[b]&&(a.disableVertexAttribArray(b),f[b]=0)};this.enable=function(b){!0!==h[b]&&(a.enable(b),h[b]=!0)};this.disable=function(b){!1!==h[b]&&(a.disable(b),h[b]=!1)};this.getCompressedTextureFormats=function(){if(null===l&&(l=[],b.get("WEBGL_compressed_texture_pvrtc")||b.get("WEBGL_compressed_texture_s3tc")))for(var c=a.getParameter(a.COMPRESSED_TEXTURE_FORMATS),d=0;d<c.length;d++)l.push(c[d]);return l};this.setBlending=function(b,d,e,f,g,h,l){b!==k&&(b===THREE.NoBlending?this.disable(a.BLEND):
 c;b++)f[b]!==e[b]&&(a.disableVertexAttribArray(b),f[b]=0)};this.enable=function(b){!0!==h[b]&&(a.enable(b),h[b]=!0)};this.disable=function(b){!1!==h[b]&&(a.disable(b),h[b]=!1)};this.getCompressedTextureFormats=function(){if(null===l&&(l=[],b.get("WEBGL_compressed_texture_pvrtc")||b.get("WEBGL_compressed_texture_s3tc")))for(var c=a.getParameter(a.COMPRESSED_TEXTURE_FORMATS),d=0;d<c.length;d++)l.push(c[d]);return l};this.setBlending=function(b,d,e,f,g,h,l){b!==k&&(b===THREE.NoBlending?this.disable(a.BLEND):
 b===THREE.AdditiveBlending?(this.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.SRC_ALPHA,a.ONE)):b===THREE.SubtractiveBlending?(this.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.ONE_MINUS_SRC_COLOR)):b===THREE.MultiplyBlending?(this.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.SRC_COLOR)):b===THREE.CustomBlending?this.enable(a.BLEND):(this.enable(a.BLEND),a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,
 b===THREE.AdditiveBlending?(this.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.SRC_ALPHA,a.ONE)):b===THREE.SubtractiveBlending?(this.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.ONE_MINUS_SRC_COLOR)):b===THREE.MultiplyBlending?(this.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.SRC_COLOR)):b===THREE.CustomBlending?this.enable(a.BLEND):(this.enable(a.BLEND),a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,
 a.ONE,a.ONE_MINUS_SRC_ALPHA)),k=b);if(b===THREE.CustomBlending){g=g||d;h=h||e;l=l||f;if(d!==m||g!==q)a.blendEquationSeparate(c(d),c(g)),m=d,q=g;if(e!==p||f!==n||h!==r||l!==t)a.blendFuncSeparate(c(e),c(f),c(h),c(l)),p=e,n=f,r=h,t=l}else t=r=q=n=p=m=null};this.setDepthFunc=function(b){if(v!==b){if(b)switch(b){case THREE.NeverDepth:a.depthFunc(a.NEVER);break;case THREE.AlwaysDepth:a.depthFunc(a.ALWAYS);break;case THREE.LessDepth:a.depthFunc(a.LESS);break;case THREE.LessEqualDepth:a.depthFunc(a.LEQUAL);
 a.ONE,a.ONE_MINUS_SRC_ALPHA)),k=b);if(b===THREE.CustomBlending){g=g||d;h=h||e;l=l||f;if(d!==m||g!==q)a.blendEquationSeparate(c(d),c(g)),m=d,q=g;if(e!==p||f!==n||h!==r||l!==t)a.blendFuncSeparate(c(e),c(f),c(h),c(l)),p=e,n=f,r=h,t=l}else t=r=q=n=p=m=null};this.setDepthFunc=function(b){if(v!==b){if(b)switch(b){case THREE.NeverDepth:a.depthFunc(a.NEVER);break;case THREE.AlwaysDepth:a.depthFunc(a.ALWAYS);break;case THREE.LessDepth:a.depthFunc(a.LESS);break;case THREE.LessEqualDepth:a.depthFunc(a.LEQUAL);
 break;case THREE.EqualDepth:a.depthFunc(a.EQUAL);break;case THREE.GreaterEqualDepth:a.depthFunc(a.GEQUAL);break;case THREE.GreaterDepth:a.depthFunc(a.GREATER);break;case THREE.NotEqualDepth:a.depthFunc(a.NOTEQUAL);break;default:a.depthFunc(a.LEQUAL)}else a.depthFunc(a.LEQUAL);v=b}};this.setDepthTest=function(b){b?this.enable(a.DEPTH_TEST):this.disable(a.DEPTH_TEST)};this.setDepthWrite=function(b){u!==b&&(a.depthMask(b),u=b)};this.setColorWrite=function(b){w!==b&&(a.colorMask(b,b,b,b),w=b)};this.setFlipSided=
 break;case THREE.EqualDepth:a.depthFunc(a.EQUAL);break;case THREE.GreaterEqualDepth:a.depthFunc(a.GEQUAL);break;case THREE.GreaterDepth:a.depthFunc(a.GREATER);break;case THREE.NotEqualDepth:a.depthFunc(a.NOTEQUAL);break;default:a.depthFunc(a.LEQUAL)}else a.depthFunc(a.LEQUAL);v=b}};this.setDepthTest=function(b){b?this.enable(a.DEPTH_TEST):this.disable(a.DEPTH_TEST)};this.setDepthWrite=function(b){u!==b&&(a.depthMask(b),u=b)};this.setColorWrite=function(b){w!==b&&(a.colorMask(b,b,b,b),w=b)};this.setFlipSided=
-function(b){G!==b&&(b?a.frontFace(a.CW):a.frontFace(a.CCW),G=b)};this.setLineWidth=function(b){b!==x&&(a.lineWidth(b),x=b)};this.setPolygonOffset=function(b,c,d){b?this.enable(a.POLYGON_OFFSET_FILL):this.disable(a.POLYGON_OFFSET_FILL);!b||B===c&&z===d||(a.polygonOffset(c,d),B=c,z=d)};this.setScissorTest=function(b){b?this.enable(a.SCISSOR_TEST):this.disable(a.SCISSOR_TEST)};this.activeTexture=function(b){void 0===b&&(b=a.TEXTURE0+A-1);y!==b&&(a.activeTexture(b),y=b)};this.bindTexture=function(b,c){void 0===
-y&&d.activeTexture();var e=J[y];void 0===e&&(e={type:void 0,texture:void 0},J[y]=e);if(e.type!==b||e.texture!==c)a.bindTexture(b,c),e.type=b,e.texture=c};this.compressedTexImage2D=function(){try{a.compressedTexImage2D.apply(a,arguments)}catch(b){console.error(b)}};this.texImage2D=function(){try{a.texImage2D.apply(a,arguments)}catch(b){console.error(b)}};this.reset=function(){for(var b=0;b<f.length;b++)1===f[b]&&(a.disableVertexAttribArray(b),f[b]=0);h={};G=w=u=k=l=null}};
-THREE.LensFlarePlugin=function(a,b){var c,d,e,f,g,h,l,k,m,p,n=a.context,q=a.state,r,t,v,u,w,G;this.render=function(x,B,z,A){if(0!==b.length){x=new THREE.Vector3;var y=A/z,J=.5*z,D=.5*A,F=16/A,Q=new THREE.Vector2(F*y,F),M=new THREE.Vector3(1,1,0),N=new THREE.Vector2(1,1);if(void 0===v){var F=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),H=new Uint16Array([0,1,2,0,2,3]);r=n.createBuffer();t=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,r);n.bufferData(n.ARRAY_BUFFER,F,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,
-t);n.bufferData(n.ELEMENT_ARRAY_BUFFER,H,n.STATIC_DRAW);w=n.createTexture();G=n.createTexture();q.bindTexture(n.TEXTURE_2D,w);n.texImage2D(n.TEXTURE_2D,0,n.RGB,16,16,0,n.RGB,n.UNSIGNED_BYTE,null);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST);q.bindTexture(n.TEXTURE_2D,G);n.texImage2D(n.TEXTURE_2D,0,
-n.RGBA,16,16,0,n.RGBA,n.UNSIGNED_BYTE,null);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST);var F=(u=0<n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS))?{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}",
+function(b){F!==b&&(b?a.frontFace(a.CW):a.frontFace(a.CCW),F=b)};this.setLineWidth=function(b){b!==x&&(a.lineWidth(b),x=b)};this.setPolygonOffset=function(b,c,d){b?this.enable(a.POLYGON_OFFSET_FILL):this.disable(a.POLYGON_OFFSET_FILL);!b||A===c&&z===d||(a.polygonOffset(c,d),A=c,z=d)};this.setScissorTest=function(b){b?this.enable(a.SCISSOR_TEST):this.disable(a.SCISSOR_TEST)};this.activeTexture=function(b){void 0===b&&(b=a.TEXTURE0+B-1);y!==b&&(a.activeTexture(b),y=b)};this.bindTexture=function(b,c){void 0===
+y&&d.activeTexture();var e=H[y];void 0===e&&(e={type:void 0,texture:void 0},H[y]=e);if(e.type!==b||e.texture!==c)a.bindTexture(b,c),e.type=b,e.texture=c};this.compressedTexImage2D=function(){try{a.compressedTexImage2D.apply(a,arguments)}catch(b){console.error(b)}};this.texImage2D=function(){try{a.texImage2D.apply(a,arguments)}catch(b){console.error(b)}};this.reset=function(){for(var b=0;b<f.length;b++)1===f[b]&&(a.disableVertexAttribArray(b),f[b]=0);h={};F=w=u=k=l=null}};
+THREE.LensFlarePlugin=function(a,b){var c,d,e,f,g,h,l,k,m,p,n=a.context,q=a.state,r,t,v,u,w,F;this.render=function(x,A,z,B){if(0!==b.length){x=new THREE.Vector3;var y=B/z,H=.5*z,D=.5*B,E=16/B,Q=new THREE.Vector2(E*y,E),M=new THREE.Vector3(1,1,0),N=new THREE.Vector2(1,1);if(void 0===v){var E=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),G=new Uint16Array([0,1,2,0,2,3]);r=n.createBuffer();t=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,r);n.bufferData(n.ARRAY_BUFFER,E,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,
+t);n.bufferData(n.ELEMENT_ARRAY_BUFFER,G,n.STATIC_DRAW);w=n.createTexture();F=n.createTexture();q.bindTexture(n.TEXTURE_2D,w);n.texImage2D(n.TEXTURE_2D,0,n.RGB,16,16,0,n.RGB,n.UNSIGNED_BYTE,null);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST);q.bindTexture(n.TEXTURE_2D,F);n.texImage2D(n.TEXTURE_2D,0,
+n.RGBA,16,16,0,n.RGBA,n.UNSIGNED_BYTE,null);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST);var E=(u=0<n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS))?{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}"}:{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:"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}"}:{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}"},
 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}"},
-H=n.createProgram(),I=n.createShader(n.FRAGMENT_SHADER),E=n.createShader(n.VERTEX_SHADER),O="precision "+a.getPrecision()+" float;\n";n.shaderSource(I,O+F.fragmentShader);n.shaderSource(E,O+F.vertexShader);n.compileShader(I);n.compileShader(E);n.attachShader(H,I);n.attachShader(H,E);n.linkProgram(H);v=H;m=n.getAttribLocation(v,"position");p=n.getAttribLocation(v,"uv");c=n.getUniformLocation(v,"renderType");d=n.getUniformLocation(v,"map");e=n.getUniformLocation(v,"occlusionMap");f=n.getUniformLocation(v,
-"opacity");g=n.getUniformLocation(v,"color");h=n.getUniformLocation(v,"scale");l=n.getUniformLocation(v,"rotation");k=n.getUniformLocation(v,"screenPosition")}n.useProgram(v);q.initAttributes();q.enableAttribute(m);q.enableAttribute(p);q.disableUnusedAttributes();n.uniform1i(e,0);n.uniform1i(d,1);n.bindBuffer(n.ARRAY_BUFFER,r);n.vertexAttribPointer(m,2,n.FLOAT,!1,16,0);n.vertexAttribPointer(p,2,n.FLOAT,!1,16,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t);q.disable(n.CULL_FACE);n.depthMask(!1);H=0;for(I=
-b.length;H<I;H++)if(F=16/A,Q.set(F*y,F),E=b[H],x.set(E.matrixWorld.elements[12],E.matrixWorld.elements[13],E.matrixWorld.elements[14]),x.applyMatrix4(B.matrixWorldInverse),x.applyProjection(B.projectionMatrix),M.copy(x),N.x=M.x*J+J,N.y=M.y*D+D,u||0<N.x&&N.x<z&&0<N.y&&N.y<A){q.activeTexture(n.TEXTURE0);q.bindTexture(n.TEXTURE_2D,null);q.activeTexture(n.TEXTURE1);q.bindTexture(n.TEXTURE_2D,w);n.copyTexImage2D(n.TEXTURE_2D,0,n.RGB,N.x-8,N.y-8,16,16,0);n.uniform1i(c,0);n.uniform2f(h,Q.x,Q.y);n.uniform3f(k,
-M.x,M.y,M.z);q.disable(n.BLEND);q.enable(n.DEPTH_TEST);n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0);q.activeTexture(n.TEXTURE0);q.bindTexture(n.TEXTURE_2D,G);n.copyTexImage2D(n.TEXTURE_2D,0,n.RGBA,N.x-8,N.y-8,16,16,0);n.uniform1i(c,1);q.disable(n.DEPTH_TEST);q.activeTexture(n.TEXTURE1);q.bindTexture(n.TEXTURE_2D,w);n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0);E.positionScreen.copy(M);E.customUpdateCallback?E.customUpdateCallback(E):E.updateLensFlares();n.uniform1i(c,2);q.enable(n.BLEND);for(var O=
-0,R=E.lensFlares.length;O<R;O++){var P=E.lensFlares[O];.001<P.opacity&&.001<P.scale&&(M.x=P.x,M.y=P.y,M.z=P.z,F=P.size*P.scale/A,Q.x=F*y,Q.y=F,n.uniform3f(k,M.x,M.y,M.z),n.uniform2f(h,Q.x,Q.y),n.uniform1f(l,P.rotation),n.uniform1f(f,P.opacity),n.uniform3f(g,P.color.r,P.color.g,P.color.b),q.setBlending(P.blending,P.blendEquation,P.blendSrc,P.blendDst),a.setTexture(P.texture,1),n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0))}}q.enable(n.CULL_FACE);q.enable(n.DEPTH_TEST);n.depthMask(!0);a.resetGLState()}}};
-THREE.SpritePlugin=function(a,b){var c,d,e,f,g,h,l,k,m,p,n,q,r,t,v,u,w;function G(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var x=a.context,B=a.state,z,A,y,J,D=new THREE.Vector3,F=new THREE.Quaternion,Q=new THREE.Vector3;this.render=function(M,N){if(0!==b.length){if(void 0===y){var H=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),I=new Uint16Array([0,1,2,0,2,3]);z=x.createBuffer();A=x.createBuffer();x.bindBuffer(x.ARRAY_BUFFER,z);x.bufferData(x.ARRAY_BUFFER,H,x.STATIC_DRAW);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,
-A);x.bufferData(x.ELEMENT_ARRAY_BUFFER,I,x.STATIC_DRAW);var H=x.createProgram(),I=x.createShader(x.VERTEX_SHADER),E=x.createShader(x.FRAGMENT_SHADER);x.shaderSource(I,["precision "+a.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n"));
-x.shaderSource(E,["precision "+a.getPrecision()+" float;","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;\nfogFactor = 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}"].join("\n"));
-x.compileShader(I);x.compileShader(E);x.attachShader(H,I);x.attachShader(H,E);x.linkProgram(H);y=H;u=x.getAttribLocation(y,"position");w=x.getAttribLocation(y,"uv");c=x.getUniformLocation(y,"uvOffset");d=x.getUniformLocation(y,"uvScale");e=x.getUniformLocation(y,"rotation");f=x.getUniformLocation(y,"scale");g=x.getUniformLocation(y,"color");h=x.getUniformLocation(y,"map");l=x.getUniformLocation(y,"opacity");k=x.getUniformLocation(y,"modelViewMatrix");m=x.getUniformLocation(y,"projectionMatrix");p=
-x.getUniformLocation(y,"fogType");n=x.getUniformLocation(y,"fogDensity");q=x.getUniformLocation(y,"fogNear");r=x.getUniformLocation(y,"fogFar");t=x.getUniformLocation(y,"fogColor");v=x.getUniformLocation(y,"alphaTest");H=document.createElement("canvas");H.width=8;H.height=8;I=H.getContext("2d");I.fillStyle="white";I.fillRect(0,0,8,8);J=new THREE.Texture(H);J.needsUpdate=!0}x.useProgram(y);B.initAttributes();B.enableAttribute(u);B.enableAttribute(w);B.disableUnusedAttributes();B.disable(x.CULL_FACE);
-B.enable(x.BLEND);x.bindBuffer(x.ARRAY_BUFFER,z);x.vertexAttribPointer(u,2,x.FLOAT,!1,16,0);x.vertexAttribPointer(w,2,x.FLOAT,!1,16,8);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,A);x.uniformMatrix4fv(m,!1,N.projectionMatrix.elements);B.activeTexture(x.TEXTURE0);x.uniform1i(h,0);I=H=0;(E=M.fog)?(x.uniform3f(t,E.color.r,E.color.g,E.color.b),E instanceof THREE.Fog?(x.uniform1f(q,E.near),x.uniform1f(r,E.far),x.uniform1i(p,1),I=H=1):E instanceof THREE.FogExp2&&(x.uniform1f(n,E.density),x.uniform1i(p,2),I=H=2)):
-(x.uniform1i(p,0),I=H=0);for(var E=0,O=b.length;E<O;E++){var R=b[E];R.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,R.matrixWorld);R.z=-R.modelViewMatrix.elements[14]}b.sort(G);for(var P=[],E=0,O=b.length;E<O;E++){var R=b[E],L=R.material;x.uniform1f(v,L.alphaTest);x.uniformMatrix4fv(k,!1,R.modelViewMatrix.elements);R.matrixWorld.decompose(D,F,Q);P[0]=Q.x;P[1]=Q.y;R=0;M.fog&&L.fog&&(R=I);H!==R&&(x.uniform1i(p,R),H=R);null!==L.map?(x.uniform2f(c,L.map.offset.x,L.map.offset.y),x.uniform2f(d,
-L.map.repeat.x,L.map.repeat.y)):(x.uniform2f(c,0,0),x.uniform2f(d,1,1));x.uniform1f(l,L.opacity);x.uniform3f(g,L.color.r,L.color.g,L.color.b);x.uniform1f(e,L.rotation);x.uniform2fv(f,P);B.setBlending(L.blending,L.blendEquation,L.blendSrc,L.blendDst);B.setDepthTest(L.depthTest);B.setDepthWrite(L.depthWrite);L.map&&L.map.image&&L.map.image.width?a.setTexture(L.map,0):a.setTexture(J,0);x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0)}B.enable(x.CULL_FACE);a.resetGLState()}}};
+G=n.createProgram(),J=n.createShader(n.FRAGMENT_SHADER),K=n.createShader(n.VERTEX_SHADER),O="precision "+a.getPrecision()+" float;\n";n.shaderSource(J,O+E.fragmentShader);n.shaderSource(K,O+E.vertexShader);n.compileShader(J);n.compileShader(K);n.attachShader(G,J);n.attachShader(G,K);n.linkProgram(G);v=G;m=n.getAttribLocation(v,"position");p=n.getAttribLocation(v,"uv");c=n.getUniformLocation(v,"renderType");d=n.getUniformLocation(v,"map");e=n.getUniformLocation(v,"occlusionMap");f=n.getUniformLocation(v,
+"opacity");g=n.getUniformLocation(v,"color");h=n.getUniformLocation(v,"scale");l=n.getUniformLocation(v,"rotation");k=n.getUniformLocation(v,"screenPosition")}n.useProgram(v);q.initAttributes();q.enableAttribute(m);q.enableAttribute(p);q.disableUnusedAttributes();n.uniform1i(e,0);n.uniform1i(d,1);n.bindBuffer(n.ARRAY_BUFFER,r);n.vertexAttribPointer(m,2,n.FLOAT,!1,16,0);n.vertexAttribPointer(p,2,n.FLOAT,!1,16,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t);q.disable(n.CULL_FACE);n.depthMask(!1);G=0;for(J=
+b.length;G<J;G++)if(E=16/B,Q.set(E*y,E),K=b[G],x.set(K.matrixWorld.elements[12],K.matrixWorld.elements[13],K.matrixWorld.elements[14]),x.applyMatrix4(A.matrixWorldInverse),x.applyProjection(A.projectionMatrix),M.copy(x),N.x=M.x*H+H,N.y=M.y*D+D,u||0<N.x&&N.x<z&&0<N.y&&N.y<B){q.activeTexture(n.TEXTURE0);q.bindTexture(n.TEXTURE_2D,null);q.activeTexture(n.TEXTURE1);q.bindTexture(n.TEXTURE_2D,w);n.copyTexImage2D(n.TEXTURE_2D,0,n.RGB,N.x-8,N.y-8,16,16,0);n.uniform1i(c,0);n.uniform2f(h,Q.x,Q.y);n.uniform3f(k,
+M.x,M.y,M.z);q.disable(n.BLEND);q.enable(n.DEPTH_TEST);n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0);q.activeTexture(n.TEXTURE0);q.bindTexture(n.TEXTURE_2D,F);n.copyTexImage2D(n.TEXTURE_2D,0,n.RGBA,N.x-8,N.y-8,16,16,0);n.uniform1i(c,1);q.disable(n.DEPTH_TEST);q.activeTexture(n.TEXTURE1);q.bindTexture(n.TEXTURE_2D,w);n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0);K.positionScreen.copy(M);K.customUpdateCallback?K.customUpdateCallback(K):K.updateLensFlares();n.uniform1i(c,2);q.enable(n.BLEND);for(var O=
+0,R=K.lensFlares.length;O<R;O++){var P=K.lensFlares[O];.001<P.opacity&&.001<P.scale&&(M.x=P.x,M.y=P.y,M.z=P.z,E=P.size*P.scale/B,Q.x=E*y,Q.y=E,n.uniform3f(k,M.x,M.y,M.z),n.uniform2f(h,Q.x,Q.y),n.uniform1f(l,P.rotation),n.uniform1f(f,P.opacity),n.uniform3f(g,P.color.r,P.color.g,P.color.b),q.setBlending(P.blending,P.blendEquation,P.blendSrc,P.blendDst),a.setTexture(P.texture,1),n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0))}}q.enable(n.CULL_FACE);q.enable(n.DEPTH_TEST);n.depthMask(!0);a.resetGLState()}}};
+THREE.SpritePlugin=function(a,b){var c,d,e,f,g,h,l,k,m,p,n,q,r,t,v,u,w;function F(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var x=a.context,A=a.state,z,B,y,H,D=new THREE.Vector3,E=new THREE.Quaternion,Q=new THREE.Vector3;this.render=function(M,N){if(0!==b.length){if(void 0===y){var G=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),J=new Uint16Array([0,1,2,0,2,3]);z=x.createBuffer();B=x.createBuffer();x.bindBuffer(x.ARRAY_BUFFER,z);x.bufferData(x.ARRAY_BUFFER,G,x.STATIC_DRAW);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,
+B);x.bufferData(x.ELEMENT_ARRAY_BUFFER,J,x.STATIC_DRAW);var G=x.createProgram(),J=x.createShader(x.VERTEX_SHADER),K=x.createShader(x.FRAGMENT_SHADER);x.shaderSource(J,["precision "+a.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n"));
+x.shaderSource(K,["precision "+a.getPrecision()+" float;","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;\nfogFactor = 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}"].join("\n"));
+x.compileShader(J);x.compileShader(K);x.attachShader(G,J);x.attachShader(G,K);x.linkProgram(G);y=G;u=x.getAttribLocation(y,"position");w=x.getAttribLocation(y,"uv");c=x.getUniformLocation(y,"uvOffset");d=x.getUniformLocation(y,"uvScale");e=x.getUniformLocation(y,"rotation");f=x.getUniformLocation(y,"scale");g=x.getUniformLocation(y,"color");h=x.getUniformLocation(y,"map");l=x.getUniformLocation(y,"opacity");k=x.getUniformLocation(y,"modelViewMatrix");m=x.getUniformLocation(y,"projectionMatrix");p=
+x.getUniformLocation(y,"fogType");n=x.getUniformLocation(y,"fogDensity");q=x.getUniformLocation(y,"fogNear");r=x.getUniformLocation(y,"fogFar");t=x.getUniformLocation(y,"fogColor");v=x.getUniformLocation(y,"alphaTest");G=document.createElement("canvas");G.width=8;G.height=8;J=G.getContext("2d");J.fillStyle="white";J.fillRect(0,0,8,8);H=new THREE.Texture(G);H.needsUpdate=!0}x.useProgram(y);A.initAttributes();A.enableAttribute(u);A.enableAttribute(w);A.disableUnusedAttributes();A.disable(x.CULL_FACE);
+A.enable(x.BLEND);x.bindBuffer(x.ARRAY_BUFFER,z);x.vertexAttribPointer(u,2,x.FLOAT,!1,16,0);x.vertexAttribPointer(w,2,x.FLOAT,!1,16,8);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,B);x.uniformMatrix4fv(m,!1,N.projectionMatrix.elements);A.activeTexture(x.TEXTURE0);x.uniform1i(h,0);J=G=0;(K=M.fog)?(x.uniform3f(t,K.color.r,K.color.g,K.color.b),K instanceof THREE.Fog?(x.uniform1f(q,K.near),x.uniform1f(r,K.far),x.uniform1i(p,1),J=G=1):K instanceof THREE.FogExp2&&(x.uniform1f(n,K.density),x.uniform1i(p,2),J=G=2)):
+(x.uniform1i(p,0),J=G=0);for(var K=0,O=b.length;K<O;K++){var R=b[K];R.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,R.matrixWorld);R.z=-R.modelViewMatrix.elements[14]}b.sort(F);for(var P=[],K=0,O=b.length;K<O;K++){var R=b[K],L=R.material;x.uniform1f(v,L.alphaTest);x.uniformMatrix4fv(k,!1,R.modelViewMatrix.elements);R.matrixWorld.decompose(D,E,Q);P[0]=Q.x;P[1]=Q.y;R=0;M.fog&&L.fog&&(R=J);G!==R&&(x.uniform1i(p,R),G=R);null!==L.map?(x.uniform2f(c,L.map.offset.x,L.map.offset.y),x.uniform2f(d,
+L.map.repeat.x,L.map.repeat.y)):(x.uniform2f(c,0,0),x.uniform2f(d,1,1));x.uniform1f(l,L.opacity);x.uniform3f(g,L.color.r,L.color.g,L.color.b);x.uniform1f(e,L.rotation);x.uniform2fv(f,P);A.setBlending(L.blending,L.blendEquation,L.blendSrc,L.blendDst);A.setDepthTest(L.depthTest);A.setDepthWrite(L.depthWrite);L.map&&L.map.image&&L.map.image.width?a.setTexture(L.map,0):a.setTexture(H,0);x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0)}A.enable(x.CULL_FACE);a.resetGLState()}}};
 Object.defineProperties(THREE.Box2.prototype,{isIntersectionBox:{value:function(a){console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(a)}}});
 Object.defineProperties(THREE.Box2.prototype,{isIntersectionBox:{value:function(a){console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(a)}}});
 Object.defineProperties(THREE.Box3.prototype,{isIntersectionBox:{value:function(a){console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(a)}},isIntersectionSphere:{value:function(a){console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().");return this.intersectsSphere(a)}}});
 Object.defineProperties(THREE.Box3.prototype,{isIntersectionBox:{value:function(a){console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(a)}},isIntersectionSphere:{value:function(a){console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().");return this.intersectsSphere(a)}}});
 Object.defineProperties(THREE.Matrix3.prototype,{multiplyVector3:{value:function(a){console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)}},multiplyVector3Array:{value:function(a){console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)}}});
 Object.defineProperties(THREE.Matrix3.prototype,{multiplyVector3:{value:function(a){console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)}},multiplyVector3Array:{value:function(a){console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)}}});
@@ -773,13 +774,13 @@ THREE.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been mov
 THREE.CurveUtils={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d-c)},tangentCubicBezier:function(a,b,c,d,e){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*e},tangentSpline:function(a,b,c,d,e){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,d,e){a=.5*(c-a);d=.5*(d-b);var f=e*e;return(2*b-2*c+a+d)*e*f+(-3*b+3*c-2*a-d)*f+a*e+b}};
 THREE.CurveUtils={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d-c)},tangentCubicBezier:function(a,b,c,d,e){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*e},tangentSpline:function(a,b,c,d,e){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,d,e){a=.5*(c-a);d=.5*(d-b);var f=e*e;return(2*b-2*c+a+d)*e*f+(-3*b+3*c-2*a-d)*f+a*e+b}};
 THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Group,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.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Group,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.ShapeUtils={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;e<b;d=e++)c+=a[d].x*a[e].y-a[e].x*a[d].y;return.5*c},triangulate:function(){return function(a,b){var c=a.length;if(3>c)return null;var d=[],e=[],f=[],g,h,l;if(0<THREE.ShapeUtils.area(a))for(h=0;h<c;h++)e[h]=h;else for(h=0;h<c;h++)e[h]=c-1-h;var k=2*c;for(h=c-1;2<c;){if(0>=k--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}g=h;c<=g&&(g=0);h=g+1;c<=h&&(h=0);l=h+1;c<=l&&(l=0);var m;a:{var p=
 THREE.ShapeUtils={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;e<b;d=e++)c+=a[d].x*a[e].y-a[e].x*a[d].y;return.5*c},triangulate:function(){return function(a,b){var c=a.length;if(3>c)return null;var d=[],e=[],f=[],g,h,l;if(0<THREE.ShapeUtils.area(a))for(h=0;h<c;h++)e[h]=h;else for(h=0;h<c;h++)e[h]=c-1-h;var k=2*c;for(h=c-1;2<c;){if(0>=k--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}g=h;c<=g&&(g=0);h=g+1;c<=h&&(h=0);l=h+1;c<=l&&(l=0);var m;a:{var p=
-m=void 0,n=void 0,q=void 0,r=void 0,t=void 0,v=void 0,u=void 0,w=void 0,p=a[e[g]].x,n=a[e[g]].y,q=a[e[h]].x,r=a[e[h]].y,t=a[e[l]].x,v=a[e[l]].y;if(Number.EPSILON>(q-p)*(v-n)-(r-n)*(t-p))m=!1;else{var G=void 0,x=void 0,B=void 0,z=void 0,A=void 0,y=void 0,J=void 0,D=void 0,F=void 0,Q=void 0,F=D=J=w=u=void 0,G=t-q,x=v-r,B=p-t,z=n-v,A=q-p,y=r-n;for(m=0;m<c;m++)if(u=a[e[m]].x,w=a[e[m]].y,!(u===p&&w===n||u===q&&w===r||u===t&&w===v)&&(J=u-p,D=w-n,F=u-q,Q=w-r,u-=t,w-=v,F=G*Q-x*F,J=A*D-y*J,D=B*w-z*u,F>=-Number.EPSILON&&
-D>=-Number.EPSILON&&J>=-Number.EPSILON)){m=!1;break a}m=!0}}if(m){d.push([a[e[g]],a[e[h]],a[e[l]]]);f.push([e[g],e[h],e[l]]);g=h;for(l=h+1;l<c;g++,l++)e[g]=e[l];c--;k=2*c}}return b?f:d}}(),triangulateShape:function(a,b){function c(a,b,c){return a.x!==b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function d(a,b,d,e,f){var g=b.x-a.x,h=b.y-a.y,k=e.x-d.x,l=e.y-d.y,m=a.x-d.x,p=a.y-d.y,A=h*k-g*l,y=h*m-g*p;if(Math.abs(A)>Number.EPSILON){if(0<A){if(0>y||y>
-A)return[];k=l*m-k*p;if(0>k||k>A)return[]}else{if(0<y||y<A)return[];k=l*m-k*p;if(0<k||k<A)return[]}if(0===k)return!f||0!==y&&y!==A?[a]:[];if(k===A)return!f||0!==y&&y!==A?[b]:[];if(0===y)return[d];if(y===A)return[e];f=k/A;return[{x:a.x+f*g,y:a.y+f*h}]}if(0!==y||l*m!==k*p)return[];h=0===g&&0===h;k=0===k&&0===l;if(h&&k)return a.x!==d.x||a.y!==d.y?[]:[a];if(h)return c(d,e,a)?[a]:[];if(k)return c(a,b,d)?[d]:[];0!==g?(a.x<b.x?(g=a,k=a.x,h=b,a=b.x):(g=b,k=b.x,h=a,a=a.x),d.x<e.x?(b=d,A=d.x,l=e,d=e.x):(b=
-e,A=e.x,l=d,d=d.x)):(a.y<b.y?(g=a,k=a.y,h=b,a=b.y):(g=b,k=b.y,h=a,a=a.y),d.y<e.y?(b=d,A=d.y,l=e,d=e.y):(b=e,A=e.y,l=d,d=d.y));return k<=A?a<A?[]:a===A?f?[]:[b]:a<=d?[b,h]:[b,l]:k>d?[]:k===d?f?[]:[g]:a<=d?[g,h]:[g,l]}function e(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return Math.abs(a)>Number.EPSILON?(b=g*c-d*b,0<a?0<=e&&0<=b:0<=e||0<=b):0<e}var f,g,h,l,k,m={};h=a.concat();f=0;for(g=b.length;f<g;f++)Array.prototype.push.apply(h,b[f]);f=0;for(g=
+m=void 0,n=void 0,q=void 0,r=void 0,t=void 0,v=void 0,u=void 0,w=void 0,p=a[e[g]].x,n=a[e[g]].y,q=a[e[h]].x,r=a[e[h]].y,t=a[e[l]].x,v=a[e[l]].y;if(Number.EPSILON>(q-p)*(v-n)-(r-n)*(t-p))m=!1;else{var F=void 0,x=void 0,A=void 0,z=void 0,B=void 0,y=void 0,H=void 0,D=void 0,E=void 0,Q=void 0,E=D=H=w=u=void 0,F=t-q,x=v-r,A=p-t,z=n-v,B=q-p,y=r-n;for(m=0;m<c;m++)if(u=a[e[m]].x,w=a[e[m]].y,!(u===p&&w===n||u===q&&w===r||u===t&&w===v)&&(H=u-p,D=w-n,E=u-q,Q=w-r,u-=t,w-=v,E=F*Q-x*E,H=B*D-y*H,D=A*w-z*u,E>=-Number.EPSILON&&
+D>=-Number.EPSILON&&H>=-Number.EPSILON)){m=!1;break a}m=!0}}if(m){d.push([a[e[g]],a[e[h]],a[e[l]]]);f.push([e[g],e[h],e[l]]);g=h;for(l=h+1;l<c;g++,l++)e[g]=e[l];c--;k=2*c}}return b?f:d}}(),triangulateShape:function(a,b){function c(a,b,c){return a.x!==b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function d(a,b,d,e,f){var g=b.x-a.x,h=b.y-a.y,k=e.x-d.x,l=e.y-d.y,m=a.x-d.x,p=a.y-d.y,B=h*k-g*l,y=h*m-g*p;if(Math.abs(B)>Number.EPSILON){if(0<B){if(0>y||y>
+B)return[];k=l*m-k*p;if(0>k||k>B)return[]}else{if(0<y||y<B)return[];k=l*m-k*p;if(0<k||k<B)return[]}if(0===k)return!f||0!==y&&y!==B?[a]:[];if(k===B)return!f||0!==y&&y!==B?[b]:[];if(0===y)return[d];if(y===B)return[e];f=k/B;return[{x:a.x+f*g,y:a.y+f*h}]}if(0!==y||l*m!==k*p)return[];h=0===g&&0===h;k=0===k&&0===l;if(h&&k)return a.x!==d.x||a.y!==d.y?[]:[a];if(h)return c(d,e,a)?[a]:[];if(k)return c(a,b,d)?[d]:[];0!==g?(a.x<b.x?(g=a,k=a.x,h=b,a=b.x):(g=b,k=b.x,h=a,a=a.x),d.x<e.x?(b=d,B=d.x,l=e,d=e.x):(b=
+e,B=e.x,l=d,d=d.x)):(a.y<b.y?(g=a,k=a.y,h=b,a=b.y):(g=b,k=b.y,h=a,a=a.y),d.y<e.y?(b=d,B=d.y,l=e,d=e.y):(b=e,B=e.y,l=d,d=d.y));return k<=B?a<B?[]:a===B?f?[]:[b]:a<=d?[b,h]:[b,l]:k>d?[]:k===d?f?[]:[g]:a<=d?[g,h]:[g,l]}function e(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return Math.abs(a)>Number.EPSILON?(b=g*c-d*b,0<a?0<=e&&0<=b:0<=e||0<=b):0<e}var f,g,h,l,k,m={};h=a.concat();f=0;for(g=b.length;f<g;f++)Array.prototype.push.apply(h,b[f]);f=0;for(g=
 h.length;f<g;f++)k=h[f].x+":"+h[f].y,void 0!==m[k]&&console.warn("THREE.Shape: Duplicate point",k),m[k]=f;f=function(a,b){function c(a,b){var d=h.length-1,f=a-1;0>f&&(f=d);var g=a+1;g>d&&(g=0);d=e(h[a],h[f],h[g],k[b]);if(!d)return!1;d=k.length-1;f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;c<h.length;c++)if(e=c+1,e%=h.length,e=d(a,b,h[c],h[e],!0),0<e.length)return!0;return!1}function g(a,c){var e,f,h,k;for(e=0;e<l.length;e++)for(f=b[l[e]],
 h.length;f<g;f++)k=h[f].x+":"+h[f].y,void 0!==m[k]&&console.warn("THREE.Shape: Duplicate point",k),m[k]=f;f=function(a,b){function c(a,b){var d=h.length-1,f=a-1;0>f&&(f=d);var g=a+1;g>d&&(g=0);d=e(h[a],h[f],h[g],k[b]);if(!d)return!1;d=k.length-1;f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;c<h.length;c++)if(e=c+1,e%=h.length,e=d(a,b,h[c],h[e],!0),0<e.length)return!0;return!1}function g(a,c){var e,f,h,k;for(e=0;e<l.length;e++)for(f=b[l[e]],
-h=0;h<f.length;h++)if(k=h+1,k%=f.length,k=d(a,c,f[h],f[k],!0),0<k.length)return!0;return!1}var h=a.concat(),k,l=[],m,p,z,A,y,J=[],D,F,Q,M=0;for(m=b.length;M<m;M++)l.push(M);D=0;for(var N=2*l.length;0<l.length;){N--;if(0>N){console.log("Infinite Loop! Holes left:"+l.length+", Probably Hole outside Shape!");break}for(p=D;p<h.length;p++){z=h[p];m=-1;for(M=0;M<l.length;M++)if(A=l[M],y=z.x+":"+z.y+":"+A,void 0===J[y]){k=b[A];for(F=0;F<k.length;F++)if(A=k[F],c(p,F)&&!f(z,A)&&!g(z,A)){m=F;l.splice(M,1);
-D=h.slice(0,p+1);A=h.slice(p);F=k.slice(m);Q=k.slice(0,m+1);h=D.concat(F).concat(Q).concat(A);D=p;break}if(0<=m)break;J[y]=!0}if(0<=m)break}}return h}(a,b);var p=THREE.ShapeUtils.triangulate(f,!1);f=0;for(g=p.length;f<g;f++)for(l=p[f],h=0;3>h;h++)k=l[h].x+":"+l[h].y,k=m[k],void 0!==k&&(l[h]=k);return p.concat()},isClockWise:function(a){return 0>THREE.ShapeUtils.area(a)},b2:function(){return function(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}}(),b3:function(){return function(a,b,c,d,e){var f=
+h=0;h<f.length;h++)if(k=h+1,k%=f.length,k=d(a,c,f[h],f[k],!0),0<k.length)return!0;return!1}var h=a.concat(),k,l=[],m,p,z,B,y,H=[],D,E,Q,M=0;for(m=b.length;M<m;M++)l.push(M);D=0;for(var N=2*l.length;0<l.length;){N--;if(0>N){console.log("Infinite Loop! Holes left:"+l.length+", Probably Hole outside Shape!");break}for(p=D;p<h.length;p++){z=h[p];m=-1;for(M=0;M<l.length;M++)if(B=l[M],y=z.x+":"+z.y+":"+B,void 0===H[y]){k=b[B];for(E=0;E<k.length;E++)if(B=k[E],c(p,E)&&!f(z,B)&&!g(z,B)){m=E;l.splice(M,1);
+D=h.slice(0,p+1);B=h.slice(p);E=k.slice(m);Q=k.slice(0,m+1);h=D.concat(E).concat(Q).concat(B);D=p;break}if(0<=m)break;H[y]=!0}if(0<=m)break}}return h}(a,b);var p=THREE.ShapeUtils.triangulate(f,!1);f=0;for(g=p.length;f<g;f++)for(l=p[f],h=0;3>h;h++)k=l[h].x+":"+l[h].y,k=m[k],void 0!==k&&(l[h]=k);return p.concat()},isClockWise:function(a){return 0>THREE.ShapeUtils.area(a)},b2:function(){return function(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}}(),b3:function(){return function(a,b,c,d,e){var f=
 1-a,g=1-a;return f*f*f*b+3*g*g*a*c+3*(1-a)*a*a*d+a*a*a*e}}()};THREE.Curve=function(){};
 1-a,g=1-a;return f*f*f*b+3*g*g*a*c+3*(1-a)*a*a*d+a*a*a*e}}()};THREE.Curve=function(){};
 THREE.Curve.prototype={constructor:THREE.Curve,getPoint:function(a){console.warn("THREE.Curve: Warning, getPoint() not implemented!");return null},getPointAt:function(a){a=this.getUtoTmapping(a);return this.getPoint(a)},getPoints:function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c},getSpacedPoints:function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c},getLength:function(){var a=this.getLengths();return a[a.length-1]},getLengths:function(a){a||
 THREE.Curve.prototype={constructor:THREE.Curve,getPoint:function(a){console.warn("THREE.Curve: Warning, getPoint() not implemented!");return null},getPointAt:function(a){a=this.getUtoTmapping(a);return this.getPoint(a)},getPoints:function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c},getSpacedPoints:function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c},getLength:function(){var a=this.getLengths();return a[a.length-1]},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},updateArcLengths:function(){this.needsUpdate=!0;this.getLengths()},getUtoTmapping:function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-
 (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},updateArcLengths:function(){this.needsUpdate=!0;this.getLengths()},getUtoTmapping:function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-
@@ -796,7 +797,7 @@ THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)
 THREE.Path.prototype.getSpacedPoints=function(a,b){a||(a=40);for(var c=[],d=0;d<a;d++)c.push(this.getPoint(d/a));return c};
 THREE.Path.prototype.getSpacedPoints=function(a,b){a||(a=40);for(var c=[],d=0;d<a;d++)c.push(this.getPoint(d/a));return c};
 THREE.Path.prototype.getPoints=function(a,b){a=a||12;for(var c=THREE.ShapeUtils.b2,d=THREE.ShapeUtils.b3,e=[],f,g,h,l,k,m,p,n,q,r,t=0,v=this.actions.length;t<v;t++){q=this.actions[t];var u=q.args;switch(q.action){case "moveTo":e.push(new THREE.Vector2(u[0],u[1]));break;case "lineTo":e.push(new THREE.Vector2(u[0],u[1]));break;case "quadraticCurveTo":f=u[2];g=u[3];k=u[0];m=u[1];0<e.length?(q=e[e.length-1],p=q.x,n=q.y):(q=this.actions[t-1].args,p=q[q.length-2],n=q[q.length-1]);for(u=1;u<=a;u++)r=u/a,
 THREE.Path.prototype.getPoints=function(a,b){a=a||12;for(var c=THREE.ShapeUtils.b2,d=THREE.ShapeUtils.b3,e=[],f,g,h,l,k,m,p,n,q,r,t=0,v=this.actions.length;t<v;t++){q=this.actions[t];var u=q.args;switch(q.action){case "moveTo":e.push(new THREE.Vector2(u[0],u[1]));break;case "lineTo":e.push(new THREE.Vector2(u[0],u[1]));break;case "quadraticCurveTo":f=u[2];g=u[3];k=u[0];m=u[1];0<e.length?(q=e[e.length-1],p=q.x,n=q.y):(q=this.actions[t-1].args,p=q[q.length-2],n=q[q.length-1]);for(u=1;u<=a;u++)r=u/a,
 q=c(r,p,k,f),r=c(r,n,m,g),e.push(new THREE.Vector2(q,r));break;case "bezierCurveTo":f=u[4];g=u[5];k=u[0];m=u[1];h=u[2];l=u[3];0<e.length?(q=e[e.length-1],p=q.x,n=q.y):(q=this.actions[t-1].args,p=q[q.length-2],n=q[q.length-1]);for(u=1;u<=a;u++)r=u/a,q=d(r,p,k,h,f),r=d(r,n,m,l,g),e.push(new THREE.Vector2(q,r));break;case "splineThru":q=this.actions[t-1].args;r=[new THREE.Vector2(q[q.length-2],q[q.length-1])];q=a*u[0].length;r=r.concat(u[0]);r=new THREE.SplineCurve(r);for(u=1;u<=q;u++)e.push(r.getPointAt(u/
 q=c(r,p,k,f),r=c(r,n,m,g),e.push(new THREE.Vector2(q,r));break;case "bezierCurveTo":f=u[4];g=u[5];k=u[0];m=u[1];h=u[2];l=u[3];0<e.length?(q=e[e.length-1],p=q.x,n=q.y):(q=this.actions[t-1].args,p=q[q.length-2],n=q[q.length-1]);for(u=1;u<=a;u++)r=u/a,q=d(r,p,k,h,f),r=d(r,n,m,l,g),e.push(new THREE.Vector2(q,r));break;case "splineThru":q=this.actions[t-1].args;r=[new THREE.Vector2(q[q.length-2],q[q.length-1])];q=a*u[0].length;r=r.concat(u[0]);r=new THREE.SplineCurve(r);for(u=1;u<=q;u++)e.push(r.getPointAt(u/
-q));break;case "arc":f=u[0];g=u[1];m=u[2];h=u[3];q=u[4];k=!!u[5];p=q-h;n=2*a;for(u=1;u<=n;u++)r=u/n,k||(r=1-r),r=h+r*p,q=f+m*Math.cos(r),r=g+m*Math.sin(r),e.push(new THREE.Vector2(q,r));break;case "ellipse":f=u[0];g=u[1];m=u[2];l=u[3];h=u[4];q=u[5];k=!!u[6];var w=u[7];p=q-h;n=2*a;var G,x;0!==w&&(G=Math.cos(w),x=Math.sin(w));for(u=1;u<=n;u++){r=u/n;k||(r=1-r);r=h+r*p;q=f+m*Math.cos(r);r=g+l*Math.sin(r);if(0!==w){var B=q;q=(B-f)*G-(r-g)*x+f;r=(B-f)*x+(r-g)*G+g}e.push(new THREE.Vector2(q,r))}}}c=e[e.length-
+q));break;case "arc":f=u[0];g=u[1];m=u[2];h=u[3];q=u[4];k=!!u[5];p=q-h;n=2*a;for(u=1;u<=n;u++)r=u/n,k||(r=1-r),r=h+r*p,q=f+m*Math.cos(r),r=g+m*Math.sin(r),e.push(new THREE.Vector2(q,r));break;case "ellipse":f=u[0];g=u[1];m=u[2];l=u[3];h=u[4];q=u[5];k=!!u[6];var w=u[7];p=q-h;n=2*a;var F,x;0!==w&&(F=Math.cos(w),x=Math.sin(w));for(u=1;u<=n;u++){r=u/n;k||(r=1-r);r=h+r*p;q=f+m*Math.cos(r);r=g+l*Math.sin(r);if(0!==w){var A=q;q=(A-f)*F-(r-g)*x+f;r=(A-f)*x+(r-g)*F+g}e.push(new THREE.Vector2(q,r))}}}c=e[e.length-
 1];Math.abs(c.x-e[0].x)<Number.EPSILON&&Math.abs(c.y-e[0].y)<Number.EPSILON&&e.splice(e.length-1,1);b&&e.push(e[0]);return e};
 1];Math.abs(c.x-e[0].x)<Number.EPSILON&&Math.abs(c.y-e[0].y)<Number.EPSILON&&e.splice(e.length-1,1);b&&e.push(e[0]);return e};
 THREE.Path.prototype.toShapes=function(a,b){function c(a){for(var b=[],c=0,d=a.length;c<d;c++){var e=a[c],f=new THREE.Shape;f.actions=e.actions;f.curves=e.curves;b.push(f)}return b}function d(a,b){for(var c=b.length,d=!1,e=c-1,f=0;f<c;e=f++){var g=b[e],h=b[f],k=h.x-g.x,l=h.y-g.y;if(Math.abs(l)>Number.EPSILON){if(0>l&&(g=b[f],k=-k,h=b[e],l=-l),!(a.y<g.y||a.y>h.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=l*(a.x-g.x)-k*(a.y-g.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||
 THREE.Path.prototype.toShapes=function(a,b){function c(a){for(var b=[],c=0,d=a.length;c<d;c++){var e=a[c],f=new THREE.Shape;f.actions=e.actions;f.curves=e.curves;b.push(f)}return b}function d(a,b){for(var c=b.length,d=!1,e=c-1,f=0;f<c;e=f++){var g=b[e],h=b[f],k=h.x-g.x,l=h.y-g.y;if(Math.abs(l)>Number.EPSILON){if(0>l&&(g=b[f],k=-k,h=b[e],l=-l),!(a.y<g.y||a.y>h.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=l*(a.x-g.x)-k*(a.y-g.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||
 g.x<=a.x&&a.x<=h.x))return!0}return d}var e=THREE.ShapeUtils.isClockWise,f=function(a){for(var b=[],c=new THREE.Path,d=0,e=a.length;d<e;d++){var f=a[d],g=f.args,f=f.action;"moveTo"===f&&0!==c.actions.length&&(b.push(c),c=new THREE.Path);c[f].apply(c,g)}0!==c.actions.length&&b.push(c);return b}(this.actions);if(0===f.length)return[];if(!0===b)return c(f);var g,h,l,k=[];if(1===f.length)return h=f[0],l=new THREE.Shape,l.actions=h.actions,l.curves=h.curves,k.push(l),k;var m=!e(f[0].getPoints()),m=a?!m:
 g.x<=a.x&&a.x<=h.x))return!0}return d}var e=THREE.ShapeUtils.isClockWise,f=function(a){for(var b=[],c=new THREE.Path,d=0,e=a.length;d<e;d++){var f=a[d],g=f.args,f=f.action;"moveTo"===f&&0!==c.actions.length&&(b.push(c),c=new THREE.Path);c[f].apply(c,g)}0!==c.actions.length&&b.push(c);return b}(this.actions);if(0===f.length)return[];if(!0===b)return c(f);var g,h,l,k=[];if(1===f.length)return h=f[0],l=new THREE.Shape,l.actions=h.actions,l.curves=h.curves,k.push(l),k;var m=!e(f[0].getPoints()),m=a?!m:
@@ -818,28 +819,28 @@ THREE.CatmullRomCurve3=function(){function a(){}var b=new THREE.Vector3,c=new a,
 b*a};return THREE.Curve.create(function(a){this.points=a||[]},function(a){var g=this.points,h,l;l=g.length;2>l&&console.log("duh, you need at least 2 points");a*=l-1;h=Math.floor(a);a-=h;0===a&&h===l-1&&(h=l-2,a=1);var k,m,p;0===h?(b.subVectors(g[0],g[1]).add(g[0]),k=b):k=g[h-1];m=g[h];p=g[h+1];h+2<l?g=g[h+2]:(b.subVectors(g[l-1],g[l-2]).add(g[l-2]),g=b);if(void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var n="chordal"===this.type?.5:.25;l=Math.pow(k.distanceToSquared(m),n);
 b*a};return THREE.Curve.create(function(a){this.points=a||[]},function(a){var g=this.points,h,l;l=g.length;2>l&&console.log("duh, you need at least 2 points");a*=l-1;h=Math.floor(a);a-=h;0===a&&h===l-1&&(h=l-2,a=1);var k,m,p;0===h?(b.subVectors(g[0],g[1]).add(g[0]),k=b):k=g[h-1];m=g[h];p=g[h+1];h+2<l?g=g[h+2]:(b.subVectors(g[l-1],g[l-2]).add(g[l-2]),g=b);if(void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var n="chordal"===this.type?.5:.25;l=Math.pow(k.distanceToSquared(m),n);
 h=Math.pow(m.distanceToSquared(p),n);n=Math.pow(p.distanceToSquared(g),n);1E-4>h&&(h=1);1E-4>l&&(l=h);1E-4>n&&(n=h);c.initNonuniformCatmullRom(k.x,m.x,p.x,g.x,l,h,n);d.initNonuniformCatmullRom(k.y,m.y,p.y,g.y,l,h,n);e.initNonuniformCatmullRom(k.z,m.z,p.z,g.z,l,h,n)}else"catmullrom"===this.type&&(l=void 0!==this.tension?this.tension:.5,c.initCatmullRom(k.x,m.x,p.x,g.x,l),d.initCatmullRom(k.y,m.y,p.y,g.y,l),e.initCatmullRom(k.z,m.z,p.z,g.z,l));return new THREE.Vector3(c.calc(a),d.calc(a),e.calc(a))})}();
 h=Math.pow(m.distanceToSquared(p),n);n=Math.pow(p.distanceToSquared(g),n);1E-4>h&&(h=1);1E-4>l&&(l=h);1E-4>n&&(n=h);c.initNonuniformCatmullRom(k.x,m.x,p.x,g.x,l,h,n);d.initNonuniformCatmullRom(k.y,m.y,p.y,g.y,l,h,n);e.initNonuniformCatmullRom(k.z,m.z,p.z,g.z,l,h,n)}else"catmullrom"===this.type&&(l=void 0!==this.tension?this.tension:.5,c.initCatmullRom(k.x,m.x,p.x,g.x,l),d.initCatmullRom(k.y,m.y,p.y,g.y,l),e.initCatmullRom(k.z,m.z,p.z,g.z,l));return new THREE.Vector3(c.calc(a),d.calc(a),e.calc(a))})}();
 THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=this.points;a*=b.length-0;var c=Math.floor(a);a-=c;var c=c+(0<c?0:(Math.floor(Math.abs(c)/b.length)+1)*b.length),d=b[(c-1)%b.length],e=b[c%b.length],f=b[(c+1)%b.length],b=b[(c+2)%b.length],c=THREE.CurveUtils.interpolate;return new THREE.Vector3(c(d.x,e.x,f.x,b.x,a),c(d.y,e.y,f.y,b.y,a),c(d.z,e.z,f.z,b.z,a))});
 THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=this.points;a*=b.length-0;var c=Math.floor(a);a-=c;var c=c+(0<c?0:(Math.floor(Math.abs(c)/b.length)+1)*b.length),d=b[(c-1)%b.length],e=b[c%b.length],f=b[(c+1)%b.length],b=b[(c+2)%b.length],c=THREE.CurveUtils.interpolate;return new THREE.Vector3(c(d.x,e.x,f.x,b.x,a),c(d.y,e.y,f.y,b.y,a),c(d.z,e.z,f.z,b.z,a))});
-THREE.BoxGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,t){var v,u=h.widthSegments,w=h.heightSegments,G=e/2,x=f/2,B=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)v="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)v="y",w=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)v="x",u=h.depthSegments;var z=u+1,A=w+1,y=e/u,J=f/w,D=new THREE.Vector3;D[v]=0<g?1:-1;for(e=0;e<A;e++)for(f=0;f<z;f++){var F=new THREE.Vector3;F[a]=(f*y-G)*c;F[b]=(e*J-x)*d;F[v]=g;h.vertices.push(F)}for(e=
-0;e<w;e++)for(f=0;f<u;f++)x=f+z*e,a=f+z*(e+1),b=f+1+z*(e+1),c=f+1+z*e,d=new THREE.Vector2(f/u,1-e/w),g=new THREE.Vector2(f/u,1-(e+1)/w),v=new THREE.Vector2((f+1)/u,1-(e+1)/w),G=new THREE.Vector2((f+1)/u,1-e/w),x=new THREE.Face3(x+B,a+B,c+B),x.normal.copy(D),x.vertexNormals.push(D.clone(),D.clone(),D.clone()),x.materialIndex=t,h.faces.push(x),h.faceVertexUvs[0].push([d,g,G]),x=new THREE.Face3(a+B,b+B,c+B),x.normal.copy(D),x.vertexNormals.push(D.clone(),D.clone(),D.clone()),x.materialIndex=t,h.faces.push(x),
-h.faceVertexUvs[0].push([g.clone(),v,G.clone()])}THREE.Geometry.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;var h=this;d=a/2;e=b/2;f=c/2;g("z","y",-1,-1,c,b,d,0);g("z","y",1,-1,c,b,-d,1);g("x","z",1,1,a,c,e,2);g("x","z",1,-1,a,c,-e,3);g("x","y",1,-1,a,b,f,4);g("x","y",-1,-1,a,b,-f,5);this.mergeVertices()};THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype);
+THREE.BoxGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,t){var v,u=h.widthSegments,w=h.heightSegments,F=e/2,x=f/2,A=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)v="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)v="y",w=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)v="x",u=h.depthSegments;var z=u+1,B=w+1,y=e/u,H=f/w,D=new THREE.Vector3;D[v]=0<g?1:-1;for(e=0;e<B;e++)for(f=0;f<z;f++){var E=new THREE.Vector3;E[a]=(f*y-F)*c;E[b]=(e*H-x)*d;E[v]=g;h.vertices.push(E)}for(e=
+0;e<w;e++)for(f=0;f<u;f++)x=f+z*e,a=f+z*(e+1),b=f+1+z*(e+1),c=f+1+z*e,d=new THREE.Vector2(f/u,1-e/w),g=new THREE.Vector2(f/u,1-(e+1)/w),v=new THREE.Vector2((f+1)/u,1-(e+1)/w),F=new THREE.Vector2((f+1)/u,1-e/w),x=new THREE.Face3(x+A,a+A,c+A),x.normal.copy(D),x.vertexNormals.push(D.clone(),D.clone(),D.clone()),x.materialIndex=t,h.faces.push(x),h.faceVertexUvs[0].push([d,g,F]),x=new THREE.Face3(a+A,b+A,c+A),x.normal.copy(D),x.vertexNormals.push(D.clone(),D.clone(),D.clone()),x.materialIndex=t,h.faces.push(x),
+h.faceVertexUvs[0].push([g.clone(),v,F.clone()])}THREE.Geometry.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;var h=this;d=a/2;e=b/2;f=c/2;g("z","y",-1,-1,c,b,d,0);g("z","y",1,-1,c,b,-d,1);g("x","z",1,1,a,c,e,2);g("x","z",1,-1,a,c,-e,3);g("x","y",1,-1,a,b,f,4);g("x","y",-1,-1,a,b,-f,5);this.mergeVertices()};THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.BoxGeometry.prototype.constructor=THREE.BoxGeometry;THREE.CubeGeometry=THREE.BoxGeometry;THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.type="CircleGeometry";this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d};this.fromBufferGeometry(new THREE.CircleBufferGeometry(a,b,c,d))};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CircleGeometry.prototype.constructor=THREE.CircleGeometry;
 THREE.BoxGeometry.prototype.constructor=THREE.BoxGeometry;THREE.CubeGeometry=THREE.BoxGeometry;THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.type="CircleGeometry";this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d};this.fromBufferGeometry(new THREE.CircleBufferGeometry(a,b,c,d))};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CircleGeometry.prototype.constructor=THREE.CircleGeometry;
 THREE.CircleBufferGeometry=function(a,b,c,d){THREE.BufferGeometry.call(this);this.type="CircleBufferGeometry";this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d};a=a||50;b=void 0!==b?Math.max(3,b):8;c=void 0!==c?c:0;d=void 0!==d?d:2*Math.PI;var e=b+2,f=new Float32Array(3*e),g=new Float32Array(3*e),e=new Float32Array(2*e);g[2]=1;e[0]=.5;e[1]=.5;for(var h=0,l=3,k=2;h<=b;h++,l+=3,k+=2){var m=c+h/b*d;f[l]=a*Math.cos(m);f[l+1]=a*Math.sin(m);g[l+2]=1;e[k]=(f[l]/a+1)/2;e[k+1]=(f[l+1]/a+1)/2}c=
 THREE.CircleBufferGeometry=function(a,b,c,d){THREE.BufferGeometry.call(this);this.type="CircleBufferGeometry";this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d};a=a||50;b=void 0!==b?Math.max(3,b):8;c=void 0!==c?c:0;d=void 0!==d?d:2*Math.PI;var e=b+2,f=new Float32Array(3*e),g=new Float32Array(3*e),e=new Float32Array(2*e);g[2]=1;e[0]=.5;e[1]=.5;for(var h=0,l=3,k=2;h<=b;h++,l+=3,k+=2){var m=c+h/b*d;f[l]=a*Math.cos(m);f[l+1]=a*Math.sin(m);g[l+2]=1;e[k]=(f[l]/a+1)/2;e[k+1]=(f[l+1]/a+1)/2}c=
 [];for(l=1;l<=b;l++)c.push(l,l+1,0);this.setIndex(new THREE.BufferAttribute(new Uint16Array(c),1));this.addAttribute("position",new THREE.BufferAttribute(f,3));this.addAttribute("normal",new THREE.BufferAttribute(g,3));this.addAttribute("uv",new THREE.BufferAttribute(e,2));this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.CircleBufferGeometry.prototype.constructor=THREE.CircleBufferGeometry;
 [];for(l=1;l<=b;l++)c.push(l,l+1,0);this.setIndex(new THREE.BufferAttribute(new Uint16Array(c),1));this.addAttribute("position",new THREE.BufferAttribute(f,3));this.addAttribute("normal",new THREE.BufferAttribute(g,3));this.addAttribute("uv",new THREE.BufferAttribute(e,2));this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.CircleBufferGeometry.prototype.constructor=THREE.CircleBufferGeometry;
 THREE.CylinderGeometry=function(a,b,c,d,e,f,g,h){THREE.Geometry.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};a=void 0!==a?a:20;b=void 0!==b?b:20;c=void 0!==c?c:100;d=d||8;e=e||1;f=void 0!==f?f:!1;g=void 0!==g?g:0;h=void 0!==h?h:2*Math.PI;var l=c/2,k,m,p=[],n=[];for(m=0;m<=e;m++){var q=[],r=[],t=m/e,v=t*(b-a)+a;for(k=0;k<=d;k++){var u=k/d,w=new THREE.Vector3;w.x=v*Math.sin(u*h+
 THREE.CylinderGeometry=function(a,b,c,d,e,f,g,h){THREE.Geometry.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};a=void 0!==a?a:20;b=void 0!==b?b:20;c=void 0!==c?c:100;d=d||8;e=e||1;f=void 0!==f?f:!1;g=void 0!==g?g:0;h=void 0!==h?h:2*Math.PI;var l=c/2,k,m,p=[],n=[];for(m=0;m<=e;m++){var q=[],r=[],t=m/e,v=t*(b-a)+a;for(k=0;k<=d;k++){var u=k/d,w=new THREE.Vector3;w.x=v*Math.sin(u*h+
 g);w.y=-t*c+l;w.z=v*Math.cos(u*h+g);this.vertices.push(w);q.push(this.vertices.length-1);r.push(new THREE.Vector2(u,1-t))}p.push(q);n.push(r)}c=(b-a)/c;for(k=0;k<d;k++)for(0!==a?(g=this.vertices[p[0][k]].clone(),h=this.vertices[p[0][k+1]].clone()):(g=this.vertices[p[1][k]].clone(),h=this.vertices[p[1][k+1]].clone()),g.setY(Math.sqrt(g.x*g.x+g.z*g.z)*c).normalize(),h.setY(Math.sqrt(h.x*h.x+h.z*h.z)*c).normalize(),m=0;m<e;m++){var q=p[m][k],r=p[m+1][k],t=p[m+1][k+1],v=p[m][k+1],u=g.clone(),w=g.clone(),
 g);w.y=-t*c+l;w.z=v*Math.cos(u*h+g);this.vertices.push(w);q.push(this.vertices.length-1);r.push(new THREE.Vector2(u,1-t))}p.push(q);n.push(r)}c=(b-a)/c;for(k=0;k<d;k++)for(0!==a?(g=this.vertices[p[0][k]].clone(),h=this.vertices[p[0][k+1]].clone()):(g=this.vertices[p[1][k]].clone(),h=this.vertices[p[1][k+1]].clone()),g.setY(Math.sqrt(g.x*g.x+g.z*g.z)*c).normalize(),h.setY(Math.sqrt(h.x*h.x+h.z*h.z)*c).normalize(),m=0;m<e;m++){var q=p[m][k],r=p[m+1][k],t=p[m+1][k+1],v=p[m][k+1],u=g.clone(),w=g.clone(),
-G=h.clone(),x=h.clone(),B=n[m][k].clone(),z=n[m+1][k].clone(),A=n[m+1][k+1].clone(),y=n[m][k+1].clone();this.faces.push(new THREE.Face3(q,r,v,[u,w,x]));this.faceVertexUvs[0].push([B,z,y]);this.faces.push(new THREE.Face3(r,t,v,[w.clone(),G,x.clone()]));this.faceVertexUvs[0].push([z.clone(),A,y.clone()])}if(!1===f&&0<a)for(this.vertices.push(new THREE.Vector3(0,l,0)),k=0;k<d;k++)q=p[0][k],r=p[0][k+1],t=this.vertices.length-1,u=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),G=new THREE.Vector3(0,
-1,0),B=n[0][k].clone(),z=n[0][k+1].clone(),A=new THREE.Vector2(z.x,0),this.faces.push(new THREE.Face3(q,r,t,[u,w,G],void 0,1)),this.faceVertexUvs[0].push([B,z,A]);if(!1===f&&0<b)for(this.vertices.push(new THREE.Vector3(0,-l,0)),k=0;k<d;k++)q=p[e][k+1],r=p[e][k],t=this.vertices.length-1,u=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),G=new THREE.Vector3(0,-1,0),B=n[e][k+1].clone(),z=n[e][k].clone(),A=new THREE.Vector2(z.x,1),this.faces.push(new THREE.Face3(q,r,t,[u,w,G],void 0,2)),this.faceVertexUvs[0].push([B,
-z,A]);this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+F=h.clone(),x=h.clone(),A=n[m][k].clone(),z=n[m+1][k].clone(),B=n[m+1][k+1].clone(),y=n[m][k+1].clone();this.faces.push(new THREE.Face3(q,r,v,[u,w,x]));this.faceVertexUvs[0].push([A,z,y]);this.faces.push(new THREE.Face3(r,t,v,[w.clone(),F,x.clone()]));this.faceVertexUvs[0].push([z.clone(),B,y.clone()])}if(!1===f&&0<a)for(this.vertices.push(new THREE.Vector3(0,l,0)),k=0;k<d;k++)q=p[0][k],r=p[0][k+1],t=this.vertices.length-1,u=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),F=new THREE.Vector3(0,
+1,0),A=n[0][k].clone(),z=n[0][k+1].clone(),B=new THREE.Vector2(z.x,0),this.faces.push(new THREE.Face3(q,r,t,[u,w,F],void 0,1)),this.faceVertexUvs[0].push([A,z,B]);if(!1===f&&0<b)for(this.vertices.push(new THREE.Vector3(0,-l,0)),k=0;k<d;k++)q=p[e][k+1],r=p[e][k],t=this.vertices.length-1,u=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),F=new THREE.Vector3(0,-1,0),A=n[e][k+1].clone(),z=n[e][k].clone(),B=new THREE.Vector2(z.x,1),this.faces.push(new THREE.Face3(q,r,t,[u,w,F],void 0,2)),this.faceVertexUvs[0].push([A,
+z,B]);this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.EdgesGeometry=function(a,b){function c(a,b){return a-b}THREE.BufferGeometry.call(this);var d=Math.cos(THREE.Math.degToRad(void 0!==b?b:1)),e=[0,0],f={},g=["a","b","c"],h;a instanceof THREE.BufferGeometry?(h=new THREE.Geometry,h.fromBufferGeometry(a)):h=a.clone();h.mergeVertices();h.computeFaceNormals();var l=h.vertices;h=h.faces;for(var k=0,m=h.length;k<m;k++)for(var p=h[k],n=0;3>n;n++){e[0]=p[g[n]];e[1]=p[g[(n+1)%3]];e.sort(c);var q=e.toString();void 0===f[q]?f[q]={vert1:e[0],vert2:e[1],face1:k,
 THREE.EdgesGeometry=function(a,b){function c(a,b){return a-b}THREE.BufferGeometry.call(this);var d=Math.cos(THREE.Math.degToRad(void 0!==b?b:1)),e=[0,0],f={},g=["a","b","c"],h;a instanceof THREE.BufferGeometry?(h=new THREE.Geometry,h.fromBufferGeometry(a)):h=a.clone();h.mergeVertices();h.computeFaceNormals();var l=h.vertices;h=h.faces;for(var k=0,m=h.length;k<m;k++)for(var p=h[k],n=0;3>n;n++){e[0]=p[g[n]];e[1]=p[g[(n+1)%3]];e.sort(c);var q=e.toString();void 0===f[q]?f[q]={vert1:e[0],vert2:e[1],face1:k,
 face2:void 0}:f[q].face2=k}e=[];for(q in f)if(g=f[q],void 0===g.face2||h[g.face1].normal.dot(h[g.face2].normal)<=d)k=l[g.vert1],e.push(k.x),e.push(k.y),e.push(k.z),k=l[g.vert2],e.push(k.x),e.push(k.y),e.push(k.z);this.addAttribute("position",new THREE.BufferAttribute(new Float32Array(e),3))};THREE.EdgesGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.EdgesGeometry.prototype.constructor=THREE.EdgesGeometry;
 face2:void 0}:f[q].face2=k}e=[];for(q in f)if(g=f[q],void 0===g.face2||h[g.face1].normal.dot(h[g.face2].normal)<=d)k=l[g.vert1],e.push(k.x),e.push(k.y),e.push(k.z),k=l[g.vert2],e.push(k.x),e.push(k.y),e.push(k.z);this.addAttribute("position",new THREE.BufferAttribute(new Float32Array(e),3))};THREE.EdgesGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.EdgesGeometry.prototype.constructor=THREE.EdgesGeometry;
 THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),this.type="ExtrudeGeometry",a=Array.isArray(a)?a:[a],this.addShapeList(a,b),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
 THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),this.type="ExtrudeGeometry",a=Array.isArray(a)?a:[a],this.addShapeList(a,b),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;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.error("THREE.ExtrudeGeometry: vec does not exist");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=1,d=a.x-b.x,e=a.y-b.y,f=c.x-a.x,g=c.y-a.y,h=d*d+e*e;if(Math.abs(d*g-e*f)>Number.EPSILON){var k=Math.sqrt(h),l=Math.sqrt(f*f+g*g),h=b.x-e/k;b=b.y+d/k;f=((c.x-g/l-h)*g-(c.y+f/l-b)*f)/(d*g-e*f);c=h+d*f-a.x;a=b+e*f-a.y;d=c*c+a*a;if(2>=d)return new THREE.Vector2(c,a);d=Math.sqrt(d/2)}else a=!1,d>Number.EPSILON?
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.error("THREE.ExtrudeGeometry: vec does not exist");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=1,d=a.x-b.x,e=a.y-b.y,f=c.x-a.x,g=c.y-a.y,h=d*d+e*e;if(Math.abs(d*g-e*f)>Number.EPSILON){var k=Math.sqrt(h),l=Math.sqrt(f*f+g*g),h=b.x-e/k;b=b.y+d/k;f=((c.x-g/l-h)*g-(c.y+f/l-b)*f)/(d*g-e*f);c=h+d*f-a.x;a=b+e*f-a.y;d=c*c+a*a;if(2>=d)return new THREE.Vector2(c,a);d=Math.sqrt(d/2)}else a=!1,d>Number.EPSILON?
-f>Number.EPSILON&&(a=!0):d<-Number.EPSILON?f<-Number.EPSILON&&(a=!0):Math.sign(e)===Math.sign(g)&&(a=!0),a?(c=-e,a=d,d=Math.sqrt(h)):(c=d,a=e,d=Math.sqrt(h/2));return new THREE.Vector2(c/d,a/d)}function e(a,b){var c,d;for(C=a.length;0<=--C;){c=C;d=C-1;0>d&&(d=a.length-1);for(var e=0,f=q+2*m,e=0;e<f;e++){var g=R*e,h=R*(e+1),k=b+c+g,g=b+d+g,l=b+d+h,h=b+c+h,k=k+D,g=g+D,l=l+D,h=h+D;J.faces.push(new THREE.Face3(k,g,h,null,null,1));J.faces.push(new THREE.Face3(g,l,h,null,null,1));k=u.generateSideWallUV(J,
-k,g,l,h);J.faceVertexUvs[0].push([k[0],k[1],k[3]]);J.faceVertexUvs[0].push([k[1],k[2],k[3]])}}}function f(a,b,c){J.vertices.push(new THREE.Vector3(a,b,c))}function g(a,b,c){a+=D;b+=D;c+=D;J.faces.push(new THREE.Face3(a,b,c,null,null,0));a=u.generateTopUV(J,a,b,c);J.faceVertexUvs[0].push(a)}var h=void 0!==b.amount?b.amount:100,l=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:l-2,m=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,
-n=void 0!==b.curveSegments?b.curveSegments:12,q=void 0!==b.steps?b.steps:1,r=b.extrudePath,t,v=!1,u=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,G,x,B;r&&(t=r.getSpacedPoints(q),v=!0,p=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,q,!1),G=new THREE.Vector3,x=new THREE.Vector3,B=new THREE.Vector3);p||(k=l=m=0);var z,A,y,J=this,D=this.vertices.length,r=a.extractPoints(n),n=r.shape,F=r.holes;if(r=!THREE.ShapeUtils.isClockWise(n)){n=n.reverse();
-A=0;for(y=F.length;A<y;A++)z=F[A],THREE.ShapeUtils.isClockWise(z)&&(F[A]=z.reverse());r=!1}var Q=THREE.ShapeUtils.triangulateShape(n,F),M=n;A=0;for(y=F.length;A<y;A++)z=F[A],n=n.concat(z);var N,H,I,E,O,R=n.length,P,L=Q.length,r=[],C=0;I=M.length;N=I-1;for(H=C+1;C<I;C++,N++,H++)N===I&&(N=0),H===I&&(H=0),r[C]=d(M[C],M[N],M[H]);var X=[],U,Y=r.concat();A=0;for(y=F.length;A<y;A++){z=F[A];U=[];C=0;I=z.length;N=I-1;for(H=C+1;C<I;C++,N++,H++)N===I&&(N=0),H===I&&(H=0),U[C]=d(z[C],z[N],z[H]);X.push(U);Y=Y.concat(U)}for(N=
-0;N<m;N++){I=N/m;E=l*(1-I);H=k*Math.sin(I*Math.PI/2);C=0;for(I=M.length;C<I;C++)O=c(M[C],r[C],H),f(O.x,O.y,-E);A=0;for(y=F.length;A<y;A++)for(z=F[A],U=X[A],C=0,I=z.length;C<I;C++)O=c(z[C],U[C],H),f(O.x,O.y,-E)}H=k;for(C=0;C<R;C++)O=p?c(n[C],Y[C],H):n[C],v?(x.copy(w.normals[0]).multiplyScalar(O.x),G.copy(w.binormals[0]).multiplyScalar(O.y),B.copy(t[0]).add(x).add(G),f(B.x,B.y,B.z)):f(O.x,O.y,0);for(I=1;I<=q;I++)for(C=0;C<R;C++)O=p?c(n[C],Y[C],H):n[C],v?(x.copy(w.normals[I]).multiplyScalar(O.x),G.copy(w.binormals[I]).multiplyScalar(O.y),
-B.copy(t[I]).add(x).add(G),f(B.x,B.y,B.z)):f(O.x,O.y,h/q*I);for(N=m-1;0<=N;N--){I=N/m;E=l*(1-I);H=k*Math.sin(I*Math.PI/2);C=0;for(I=M.length;C<I;C++)O=c(M[C],r[C],H),f(O.x,O.y,h+E);A=0;for(y=F.length;A<y;A++)for(z=F[A],U=X[A],C=0,I=z.length;C<I;C++)O=c(z[C],U[C],H),v?f(O.x,O.y+t[q-1].y,t[q-1].x+E):f(O.x,O.y,h+E)}(function(){if(p){var a;a=0*R;for(C=0;C<L;C++)P=Q[C],g(P[2]+a,P[1]+a,P[0]+a);a=q+2*m;a*=R;for(C=0;C<L;C++)P=Q[C],g(P[0]+a,P[1]+a,P[2]+a)}else{for(C=0;C<L;C++)P=Q[C],g(P[2],P[1],P[0]);for(C=
-0;C<L;C++)P=Q[C],g(P[0]+R*q,P[1]+R*q,P[2]+R*q)}})();(function(){var a=0;e(M,a);a+=M.length;A=0;for(y=F.length;A<y;A++)z=F[A],e(z,a),a+=z.length})()};
+f>Number.EPSILON&&(a=!0):d<-Number.EPSILON?f<-Number.EPSILON&&(a=!0):Math.sign(e)===Math.sign(g)&&(a=!0),a?(c=-e,a=d,d=Math.sqrt(h)):(c=d,a=e,d=Math.sqrt(h/2));return new THREE.Vector2(c/d,a/d)}function e(a,b){var c,d;for(C=a.length;0<=--C;){c=C;d=C-1;0>d&&(d=a.length-1);for(var e=0,f=q+2*m,e=0;e<f;e++){var g=R*e,h=R*(e+1),k=b+c+g,g=b+d+g,l=b+d+h,h=b+c+h,k=k+D,g=g+D,l=l+D,h=h+D;H.faces.push(new THREE.Face3(k,g,h,null,null,1));H.faces.push(new THREE.Face3(g,l,h,null,null,1));k=u.generateSideWallUV(H,
+k,g,l,h);H.faceVertexUvs[0].push([k[0],k[1],k[3]]);H.faceVertexUvs[0].push([k[1],k[2],k[3]])}}}function f(a,b,c){H.vertices.push(new THREE.Vector3(a,b,c))}function g(a,b,c){a+=D;b+=D;c+=D;H.faces.push(new THREE.Face3(a,b,c,null,null,0));a=u.generateTopUV(H,a,b,c);H.faceVertexUvs[0].push(a)}var h=void 0!==b.amount?b.amount:100,l=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:l-2,m=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,
+n=void 0!==b.curveSegments?b.curveSegments:12,q=void 0!==b.steps?b.steps:1,r=b.extrudePath,t,v=!1,u=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,F,x,A;r&&(t=r.getSpacedPoints(q),v=!0,p=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,q,!1),F=new THREE.Vector3,x=new THREE.Vector3,A=new THREE.Vector3);p||(k=l=m=0);var z,B,y,H=this,D=this.vertices.length,r=a.extractPoints(n),n=r.shape,E=r.holes;if(r=!THREE.ShapeUtils.isClockWise(n)){n=n.reverse();
+B=0;for(y=E.length;B<y;B++)z=E[B],THREE.ShapeUtils.isClockWise(z)&&(E[B]=z.reverse());r=!1}var Q=THREE.ShapeUtils.triangulateShape(n,E),M=n;B=0;for(y=E.length;B<y;B++)z=E[B],n=n.concat(z);var N,G,J,K,O,R=n.length,P,L=Q.length,r=[],C=0;J=M.length;N=J-1;for(G=C+1;C<J;C++,N++,G++)N===J&&(N=0),G===J&&(G=0),r[C]=d(M[C],M[N],M[G]);var X=[],U,Y=r.concat();B=0;for(y=E.length;B<y;B++){z=E[B];U=[];C=0;J=z.length;N=J-1;for(G=C+1;C<J;C++,N++,G++)N===J&&(N=0),G===J&&(G=0),U[C]=d(z[C],z[N],z[G]);X.push(U);Y=Y.concat(U)}for(N=
+0;N<m;N++){J=N/m;K=l*(1-J);G=k*Math.sin(J*Math.PI/2);C=0;for(J=M.length;C<J;C++)O=c(M[C],r[C],G),f(O.x,O.y,-K);B=0;for(y=E.length;B<y;B++)for(z=E[B],U=X[B],C=0,J=z.length;C<J;C++)O=c(z[C],U[C],G),f(O.x,O.y,-K)}G=k;for(C=0;C<R;C++)O=p?c(n[C],Y[C],G):n[C],v?(x.copy(w.normals[0]).multiplyScalar(O.x),F.copy(w.binormals[0]).multiplyScalar(O.y),A.copy(t[0]).add(x).add(F),f(A.x,A.y,A.z)):f(O.x,O.y,0);for(J=1;J<=q;J++)for(C=0;C<R;C++)O=p?c(n[C],Y[C],G):n[C],v?(x.copy(w.normals[J]).multiplyScalar(O.x),F.copy(w.binormals[J]).multiplyScalar(O.y),
+A.copy(t[J]).add(x).add(F),f(A.x,A.y,A.z)):f(O.x,O.y,h/q*J);for(N=m-1;0<=N;N--){J=N/m;K=l*(1-J);G=k*Math.sin(J*Math.PI/2);C=0;for(J=M.length;C<J;C++)O=c(M[C],r[C],G),f(O.x,O.y,h+K);B=0;for(y=E.length;B<y;B++)for(z=E[B],U=X[B],C=0,J=z.length;C<J;C++)O=c(z[C],U[C],G),v?f(O.x,O.y+t[q-1].y,t[q-1].x+K):f(O.x,O.y,h+K)}(function(){if(p){var a;a=0*R;for(C=0;C<L;C++)P=Q[C],g(P[2]+a,P[1]+a,P[0]+a);a=q+2*m;a*=R;for(C=0;C<L;C++)P=Q[C],g(P[0]+a,P[1]+a,P[2]+a)}else{for(C=0;C<L;C++)P=Q[C],g(P[2],P[1],P[0]);for(C=
+0;C<L;C++)P=Q[C],g(P[0]+R*q,P[1]+R*q,P[2]+R*q)}})();(function(){var a=0;e(M,a);a+=M.length;B=0;for(y=E.length;B<y;B++)z=E[B],e(z,a),a+=z.length})()};
 THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d){a=a.vertices;b=a[b];c=a[c];d=a[d];return[new THREE.Vector2(b.x,b.y),new THREE.Vector2(c.x,c.y),new THREE.Vector2(d.x,d.y)]},generateSideWallUV:function(a,b,c,d,e){a=a.vertices;b=a[b];c=a[c];d=a[d];e=a[e];return.01>Math.abs(b.y-c.y)?[new THREE.Vector2(b.x,1-b.z),new THREE.Vector2(c.x,1-c.z),new THREE.Vector2(d.x,1-d.z),new THREE.Vector2(e.x,1-e.z)]:[new THREE.Vector2(b.y,1-b.z),new THREE.Vector2(c.y,1-c.z),new THREE.Vector2(d.y,
 THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d){a=a.vertices;b=a[b];c=a[c];d=a[d];return[new THREE.Vector2(b.x,b.y),new THREE.Vector2(c.x,c.y),new THREE.Vector2(d.x,d.y)]},generateSideWallUV:function(a,b,c,d,e){a=a.vertices;b=a[b];c=a[c];d=a[d];e=a[e];return.01>Math.abs(b.y-c.y)?[new THREE.Vector2(b.x,1-b.z),new THREE.Vector2(c.x,1-c.z),new THREE.Vector2(d.x,1-d.z),new THREE.Vector2(e.x,1-e.z)]:[new THREE.Vector2(b.y,1-b.z),new THREE.Vector2(c.y,1-c.z),new THREE.Vector2(d.y,
 1-d.z),new THREE.Vector2(e.y,1-e.z)]}};THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);this.type="ShapeGeometry";!1===Array.isArray(a)&&(a=[a]);this.addShapeList(a,b);this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.constructor=THREE.ShapeGeometry;THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
 1-d.z),new THREE.Vector2(e.y,1-e.z)]}};THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);this.type="ShapeGeometry";!1===Array.isArray(a)&&(a=[a]);this.addShapeList(a,b);this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.constructor=THREE.ShapeGeometry;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,g,h=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var l=e.shape,k=e.holes;if(!THREE.ShapeUtils.isClockWise(l))for(l=l.reverse(),e=0,f=k.length;e<f;e++)g=k[e],THREE.ShapeUtils.isClockWise(g)&&(k[e]=g.reverse());var m=THREE.ShapeUtils.triangulateShape(l,k);e=0;for(f=k.length;e<f;e++)g=k[e],l=l.concat(g);
 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,g,h=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var l=e.shape,k=e.holes;if(!THREE.ShapeUtils.isClockWise(l))for(l=l.reverse(),e=0,f=k.length;e<f;e++)g=k[e],THREE.ShapeUtils.isClockWise(g)&&(k[e]=g.reverse());var m=THREE.ShapeUtils.triangulateShape(l,k);e=0;for(f=k.length;e<f;e++)g=k[e],l=l.concat(g);
@@ -854,7 +855,7 @@ THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.type="Ri
 THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry.prototype.constructor=THREE.RingGeometry;THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);this.type="SphereGeometry";this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:f,thetaLength:g};this.fromBufferGeometry(new THREE.SphereBufferGeometry(a,b,c,d,e,f,g))};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry.prototype.constructor=THREE.RingGeometry;THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);this.type="SphereGeometry";this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:f,thetaLength:g};this.fromBufferGeometry(new THREE.SphereBufferGeometry(a,b,c,d,e,f,g))};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.SphereBufferGeometry=function(a,b,c,d,e,f,g){THREE.BufferGeometry.call(this);this.type="SphereBufferGeometry";this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:f,thetaLength:g};a=a||50;b=Math.max(3,Math.floor(b)||8);c=Math.max(2,Math.floor(c)||6);d=void 0!==d?d:0;e=void 0!==e?e:2*Math.PI;f=void 0!==f?f:0;g=void 0!==g?g:Math.PI;for(var h=f+g,l=(b+1)*(c+1),k=new THREE.BufferAttribute(new Float32Array(3*l),3),m=new THREE.BufferAttribute(new Float32Array(3*
 THREE.SphereBufferGeometry=function(a,b,c,d,e,f,g){THREE.BufferGeometry.call(this);this.type="SphereBufferGeometry";this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:f,thetaLength:g};a=a||50;b=Math.max(3,Math.floor(b)||8);c=Math.max(2,Math.floor(c)||6);d=void 0!==d?d:0;e=void 0!==e?e:2*Math.PI;f=void 0!==f?f:0;g=void 0!==g?g:Math.PI;for(var h=f+g,l=(b+1)*(c+1),k=new THREE.BufferAttribute(new Float32Array(3*l),3),m=new THREE.BufferAttribute(new Float32Array(3*
-l),3),l=new THREE.BufferAttribute(new Float32Array(2*l),2),p=0,n=[],q=new THREE.Vector3,r=0;r<=c;r++){for(var t=[],v=r/c,u=0;u<=b;u++){var w=u/b,G=-a*Math.cos(d+w*e)*Math.sin(f+v*g),x=a*Math.cos(f+v*g),B=a*Math.sin(d+w*e)*Math.sin(f+v*g);q.set(G,x,B).normalize();k.setXYZ(p,G,x,B);m.setXYZ(p,q.x,q.y,q.z);l.setXY(p,w,1-v);t.push(p);p++}n.push(t)}d=[];for(r=0;r<c;r++)for(u=0;u<b;u++)e=n[r][u+1],g=n[r][u],p=n[r+1][u],q=n[r+1][u+1],(0!==r||0<f)&&d.push(e,g,q),(r!==c-1||h<Math.PI)&&d.push(g,p,q);this.setIndex(new (65535<
+l),3),l=new THREE.BufferAttribute(new Float32Array(2*l),2),p=0,n=[],q=new THREE.Vector3,r=0;r<=c;r++){for(var t=[],v=r/c,u=0;u<=b;u++){var w=u/b,F=-a*Math.cos(d+w*e)*Math.sin(f+v*g),x=a*Math.cos(f+v*g),A=a*Math.sin(d+w*e)*Math.sin(f+v*g);q.set(F,x,A).normalize();k.setXYZ(p,F,x,A);m.setXYZ(p,q.x,q.y,q.z);l.setXY(p,w,1-v);t.push(p);p++}n.push(t)}d=[];for(r=0;r<c;r++)for(u=0;u<b;u++)e=n[r][u+1],g=n[r][u],p=n[r+1][u],q=n[r+1][u+1],(0!==r||0<f)&&d.push(e,g,q),(r!==c-1||h<Math.PI)&&d.push(g,p,q);this.setIndex(new (65535<
 k.count?THREE.Uint32Attribute:THREE.Uint16Attribute)(d,1));this.addAttribute("position",k);this.addAttribute("normal",m);this.addAttribute("uv",l);this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.SphereBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.SphereBufferGeometry.prototype.constructor=THREE.SphereBufferGeometry;
 k.count?THREE.Uint32Attribute:THREE.Uint16Attribute)(d,1));this.addAttribute("position",k);this.addAttribute("normal",m);this.addAttribute("uv",l);this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.SphereBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.SphereBufferGeometry.prototype.constructor=THREE.SphereBufferGeometry;
 THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.type="TorusGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:e};a=a||100;b=b||40;c=c||8;d=d||6;e=e||2*Math.PI;for(var f=new THREE.Vector3,g=[],h=[],l=0;l<=c;l++)for(var k=0;k<=d;k++){var m=k/d*e,p=l/c*Math.PI*2;f.x=a*Math.cos(m);f.y=a*Math.sin(m);var n=new THREE.Vector3;n.x=(a+b*Math.cos(p))*Math.cos(m);n.y=(a+b*Math.cos(p))*Math.sin(m);n.z=b*Math.sin(p);this.vertices.push(n);g.push(new THREE.Vector2(k/
 THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.type="TorusGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:e};a=a||100;b=b||40;c=c||8;d=d||6;e=e||2*Math.PI;for(var f=new THREE.Vector3,g=[],h=[],l=0;l<=c;l++)for(var k=0;k<=d;k++){var m=k/d*e,p=l/c*Math.PI*2;f.x=a*Math.cos(m);f.y=a*Math.sin(m);var n=new THREE.Vector3;n.x=(a+b*Math.cos(p))*Math.cos(m);n.y=(a+b*Math.cos(p))*Math.sin(m);n.z=b*Math.sin(p);this.vertices.push(n);g.push(new THREE.Vector2(k/
 d,l/c));h.push(n.clone().sub(f).normalize())}for(l=1;l<=c;l++)for(k=1;k<=d;k++)a=(d+1)*l+k-1,b=(d+1)*(l-1)+k-1,e=(d+1)*(l-1)+k,f=(d+1)*l+k,m=new THREE.Face3(a,b,f,[h[a].clone(),h[b].clone(),h[f].clone()]),this.faces.push(m),this.faceVertexUvs[0].push([g[a].clone(),g[b].clone(),g[f].clone()]),m=new THREE.Face3(b,e,f,[h[b].clone(),h[e].clone(),h[f].clone()]),this.faces.push(m),this.faceVertexUvs[0].push([g[b].clone(),g[e].clone(),g[f].clone()]);this.computeFaceNormals()};
 d,l/c));h.push(n.clone().sub(f).normalize())}for(l=1;l<=c;l++)for(k=1;k<=d;k++)a=(d+1)*l+k-1,b=(d+1)*(l-1)+k-1,e=(d+1)*(l-1)+k,f=(d+1)*l+k,m=new THREE.Face3(a,b,f,[h[a].clone(),h[b].clone(),h[f].clone()]),this.faces.push(m),this.faceVertexUvs[0].push([g[a].clone(),g[b].clone(),g[f].clone()]),m=new THREE.Face3(b,e,f,[h[b].clone(),h[e].clone(),h[f].clone()]),this.faces.push(m),this.faceVertexUvs[0].push([g[b].clone(),g[e].clone(),g[f].clone()]);this.computeFaceNormals()};