Browse Source

Merge remote-tracking branch 'doob_three/dev' into dev-update-marine-character

Michael Guerrero 9 years ago
parent
commit
9f273f7b18

+ 223 - 300
build/three.js

@@ -16273,6 +16273,7 @@ THREE.VectorKeyframeTrack.prototype =
 
 /**
  * @author mrdoob / http://mrdoob.com/
+ * @author Reece Aaron Lecrivain / http://reecenotes.com/
  */
 
 THREE.Audio = function ( listener ) {
@@ -16311,10 +16312,16 @@ THREE.Audio.prototype.getOutput = function () {
 
 THREE.Audio.prototype.load = function ( file ) {
 
-	var buffer = new THREE.AudioBuffer( this.context );
-	buffer.load( file );
+	console.warn( 'THREE.Audio: .load has been deprecated. Please use THREE.AudioLoader.' );
 
-	this.setBuffer( buffer );
+	var scope = this;
+
+	var audioLoader = new THREE.AudioLoader();
+	audioLoader.load( file, function ( buffer ) {
+
+		scope.setBuffer( buffer );
+
+	} );
 
 	return this;
 
@@ -16335,13 +16342,9 @@ THREE.Audio.prototype.setBuffer = function ( audioBuffer ) {
 
 	var scope = this;
 
-	audioBuffer.onReady( function( buffer ) {
-
-		scope.source.buffer = buffer;
-		scope.sourceType = 'buffer';
-		if ( scope.autoplay ) scope.play();
-
-	} );
+	scope.source.buffer = audioBuffer;
+	scope.sourceType = 'buffer';
+	if ( scope.autoplay ) scope.play();
 
 	return this;
 
@@ -16486,7 +16489,7 @@ THREE.Audio.prototype.getPlaybackRate = function () {
 
 };
 
-THREE.Audio.prototype.onEnded = function() {
+THREE.Audio.prototype.onEnded = function () {
 
 	this.isPlaying = false;
 
@@ -16561,64 +16564,33 @@ THREE.AudioAnalyser.prototype = {
 
 };
 
-// File:src/audio/AudioBuffer.js
+// File:src/audio/AudioContext.js
 
 /**
  * @author mrdoob / http://mrdoob.com/
  */
 
-THREE.AudioBuffer = function ( context ) {
+Object.defineProperty( THREE, 'AudioContext', {
 
-	this.context = context;
-	this.ready = false;
-	this.readyCallbacks = [];
-
-};
+	get: ( function () {
 
-THREE.AudioBuffer.prototype.load = function ( file ) {
+		var context;
 
-	var scope = this;
-
-	var request = new XMLHttpRequest();
-	request.open( 'GET', file, true );
-	request.responseType = 'arraybuffer';
-	request.onload = function ( e ) {
-
-		scope.context.decodeAudioData( this.response, function ( buffer ) {
-
-			scope.buffer = buffer;
-			scope.ready = true;
+		return function () {
 
-			for ( var i = 0; i < scope.readyCallbacks.length; i ++ ) {
+			if ( context === undefined ) {
 
-				scope.readyCallbacks[ i ]( scope.buffer );
+				context = new ( window.AudioContext || window.webkitAudioContext )();
 
 			}
 
-			scope.readyCallbacks = [];
-
-		} );
-
-	};
-	request.send();
+			return context;
 
-	return this;
-
-};
-
-THREE.AudioBuffer.prototype.onReady = function ( callback ) {
-
-	if ( this.ready ) {
-
-		callback( this.buffer );
-
-	} else {
-
-		this.readyCallbacks.push( callback );
+		};
 
-	}
+	} )()
 
-};
+} );
 
 // File:src/audio/PositionalAudio.js
 
@@ -16720,7 +16692,7 @@ THREE.AudioListener = function () {
 
 	this.type = 'AudioListener';
 
-	this.context = new ( window.AudioContext || window.webkitAudioContext )();
+	this.context = THREE.AudioContext;
 
 	this.gain = this.context.createGain();
 	this.gain.connect( this.context.destination );
@@ -17608,6 +17580,42 @@ THREE.SpotLight.prototype.copy = function ( source ) {
 
 };
 
+// File:src/loaders/AudioLoader.js
+
+/**
+ * @author Reece Aaron Lecrivain / http://reecenotes.com/
+ */
+
+THREE.AudioLoader = function ( manager ) {
+
+	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+
+};
+
+THREE.AudioLoader.prototype = {
+
+	constructor: THREE.AudioLoader,
+
+	load: function ( url, onLoad, onProgress, onError ) {
+
+		var loader = new THREE.XHRLoader( this.manager );
+		loader.setResponseType( 'arraybuffer' );
+		loader.load( url, function ( buffer ) {
+
+			var context = THREE.AudioContext;
+
+			context.decodeAudioData( buffer, function ( audioBuffer ) {
+
+				onLoad( audioBuffer );
+
+			} );
+
+		}, onProgress, onError );
+
+	}
+
+};
+
 // File:src/loaders/Cache.js
 
 /**
@@ -24179,14 +24187,14 @@ THREE.ShaderLib = {
 
 		uniforms: THREE.UniformsUtils.merge( [
 
-			THREE.UniformsLib[ "common" ],
-			THREE.UniformsLib[ "aomap" ],
-			THREE.UniformsLib[ "fog" ]
+			THREE.UniformsLib[ 'common' ],
+			THREE.UniformsLib[ 'aomap' ],
+			THREE.UniformsLib[ 'fog' ]
 
 		] ),
 
-		vertexShader: THREE.ShaderChunk['meshbasic_vert'],
-		fragmentShader: THREE.ShaderChunk['meshbasic_frag']
+		vertexShader: THREE.ShaderChunk[ 'meshbasic_vert' ],
+		fragmentShader: THREE.ShaderChunk[ 'meshbasic_frag' ]
 
 	},
 
@@ -24194,12 +24202,12 @@ THREE.ShaderLib = {
 
 		uniforms: THREE.UniformsUtils.merge( [
 
-			THREE.UniformsLib[ "common" ],
-			THREE.UniformsLib[ "aomap" ],
-			THREE.UniformsLib[ "lightmap" ],
-			THREE.UniformsLib[ "emissivemap" ],
-			THREE.UniformsLib[ "fog" ],
-			THREE.UniformsLib[ "lights" ],
+			THREE.UniformsLib[ 'common' ],
+			THREE.UniformsLib[ 'aomap' ],
+			THREE.UniformsLib[ 'lightmap' ],
+			THREE.UniformsLib[ 'emissivemap' ],
+			THREE.UniformsLib[ 'fog' ],
+			THREE.UniformsLib[ 'lights' ],
 
 			{
 				"emissive" : { type: "c", value: new THREE.Color( 0x000000 ) }
@@ -24207,8 +24215,8 @@ THREE.ShaderLib = {
 
 		] ),
 
-		vertexShader: THREE.ShaderChunk['meshlambert_vert'],
-		fragmentShader: THREE.ShaderChunk['meshlambert_frag']
+		vertexShader: THREE.ShaderChunk[ 'meshlambert_vert' ],
+		fragmentShader: THREE.ShaderChunk[ 'meshlambert_frag' ]
 
 	},
 
@@ -24216,15 +24224,15 @@ THREE.ShaderLib = {
 
 		uniforms: THREE.UniformsUtils.merge( [
 
-			THREE.UniformsLib[ "common" ],
-			THREE.UniformsLib[ "aomap" ],
-			THREE.UniformsLib[ "lightmap" ],
-			THREE.UniformsLib[ "emissivemap" ],
-			THREE.UniformsLib[ "bumpmap" ],
-			THREE.UniformsLib[ "normalmap" ],
-			THREE.UniformsLib[ "displacementmap" ],
-			THREE.UniformsLib[ "fog" ],
-			THREE.UniformsLib[ "lights" ],
+			THREE.UniformsLib[ 'common' ],
+			THREE.UniformsLib[ 'aomap' ],
+			THREE.UniformsLib[ 'lightmap' ],
+			THREE.UniformsLib[ 'emissivemap' ],
+			THREE.UniformsLib[ 'bumpmap' ],
+			THREE.UniformsLib[ 'normalmap' ],
+			THREE.UniformsLib[ 'displacementmap' ],
+			THREE.UniformsLib[ 'fog' ],
+			THREE.UniformsLib[ 'lights' ],
 
 			{
 				"emissive" : { type: "c", value: new THREE.Color( 0x000000 ) },
@@ -24234,8 +24242,8 @@ THREE.ShaderLib = {
 
 		] ),
 
-		vertexShader: THREE.ShaderChunk['meshphong_vert'],
-		fragmentShader: THREE.ShaderChunk['meshphong_frag']
+		vertexShader: THREE.ShaderChunk[ 'meshphong_vert' ],
+		fragmentShader: THREE.ShaderChunk[ 'meshphong_frag' ]
 
 	},
 
@@ -24243,17 +24251,17 @@ THREE.ShaderLib = {
 
 		uniforms: THREE.UniformsUtils.merge( [
 
-			THREE.UniformsLib[ "common" ],
-			THREE.UniformsLib[ "aomap" ],
-			THREE.UniformsLib[ "lightmap" ],
-			THREE.UniformsLib[ "emissivemap" ],
-			THREE.UniformsLib[ "bumpmap" ],
-			THREE.UniformsLib[ "normalmap" ],
-			THREE.UniformsLib[ "displacementmap" ],
-			THREE.UniformsLib[ "roughnessmap" ],
-			THREE.UniformsLib[ "metalnessmap" ],
-			THREE.UniformsLib[ "fog" ],
-			THREE.UniformsLib[ "lights" ],
+			THREE.UniformsLib[ 'common' ],
+			THREE.UniformsLib[ 'aomap' ],
+			THREE.UniformsLib[ 'lightmap' ],
+			THREE.UniformsLib[ 'emissivemap' ],
+			THREE.UniformsLib[ 'bumpmap' ],
+			THREE.UniformsLib[ 'normalmap' ],
+			THREE.UniformsLib[ 'displacementmap' ],
+			THREE.UniformsLib[ 'roughnessmap' ],
+			THREE.UniformsLib[ 'metalnessmap' ],
+			THREE.UniformsLib[ 'fog' ],
+			THREE.UniformsLib[ 'lights' ],
 
 			{
 				"emissive" : { type: "c", value: new THREE.Color( 0x000000 ) },
@@ -24264,8 +24272,8 @@ THREE.ShaderLib = {
 
 		] ),
 
-		vertexShader: THREE.ShaderChunk['meshstandard_vert'],
-		fragmentShader: THREE.ShaderChunk['meshstandard_frag']
+		vertexShader: THREE.ShaderChunk[ 'meshstandard_vert' ],
+		fragmentShader: THREE.ShaderChunk[ 'meshstandard_frag' ]
 
 	},
 
@@ -24273,13 +24281,13 @@ THREE.ShaderLib = {
 
 		uniforms: THREE.UniformsUtils.merge( [
 
-			THREE.UniformsLib[ "points" ],
-			THREE.UniformsLib[ "fog" ]
+			THREE.UniformsLib[ 'points' ],
+			THREE.UniformsLib[ 'fog' ]
 
 		] ),
 
-		vertexShader: THREE.ShaderChunk['points_vert'],
-		fragmentShader: THREE.ShaderChunk['points_frag']
+		vertexShader: THREE.ShaderChunk[ 'points_vert' ],
+		fragmentShader: THREE.ShaderChunk[ 'points_frag' ]
 
 	},
 
@@ -24287,8 +24295,8 @@ THREE.ShaderLib = {
 
 		uniforms: THREE.UniformsUtils.merge( [
 
-			THREE.UniformsLib[ "common" ],
-			THREE.UniformsLib[ "fog" ],
+			THREE.UniformsLib[ 'common' ],
+			THREE.UniformsLib[ 'fog' ],
 
 			{
 				"scale"    : { type: "1f", value: 1 },
@@ -24298,8 +24306,8 @@ THREE.ShaderLib = {
 
 		] ),
 
-		vertexShader: THREE.ShaderChunk['linedashed_vert'],
-		fragmentShader: THREE.ShaderChunk['linedashed_frag']
+		vertexShader: THREE.ShaderChunk[ 'linedashed_vert' ],
+		fragmentShader: THREE.ShaderChunk[ 'linedashed_frag' ]
 
 	},
 
@@ -24313,8 +24321,8 @@ THREE.ShaderLib = {
 
 		},
 
-		vertexShader: THREE.ShaderChunk['depth_vert'],
-		fragmentShader: THREE.ShaderChunk['depth_frag']
+		vertexShader: THREE.ShaderChunk[ 'depth_vert' ],
+		fragmentShader: THREE.ShaderChunk[ 'depth_frag' ]
 
 	},
 
@@ -24326,8 +24334,8 @@ THREE.ShaderLib = {
 
 		},
 
-		vertexShader: THREE.ShaderChunk['normal_vert'],
-		fragmentShader: THREE.ShaderChunk['normal_frag']
+		vertexShader: THREE.ShaderChunk[ 'normal_vert' ],
+		fragmentShader: THREE.ShaderChunk[ 'normal_frag' ]
 
 	},
 
@@ -24342,8 +24350,8 @@ THREE.ShaderLib = {
 			"tFlip": { type: "1f", value: - 1 }
 		},
 
-		vertexShader: THREE.ShaderChunk['cube_vert'],
-		fragmentShader: THREE.ShaderChunk['cube_frag']
+		vertexShader: THREE.ShaderChunk[ 'cube_vert' ],
+		fragmentShader: THREE.ShaderChunk[ 'cube_frag' ]
 
 	},
 
@@ -24358,8 +24366,8 @@ THREE.ShaderLib = {
 			"tFlip": { type: "1f", value: - 1 }
 		},
 
-		vertexShader: THREE.ShaderChunk['equirect_vert'],
-		fragmentShader: THREE.ShaderChunk['equirect_frag']
+		vertexShader: THREE.ShaderChunk[ 'equirect_vert' ],
+		fragmentShader: THREE.ShaderChunk[ 'equirect_frag' ]
 
 	},
 
@@ -24379,8 +24387,8 @@ THREE.ShaderLib = {
 
 		uniforms: {},
 
-		vertexShader: THREE.ShaderChunk['depthRGBA_vert'],
-		fragmentShader: THREE.ShaderChunk['depthRGBA_frag']
+		vertexShader: THREE.ShaderChunk[ 'depthRGBA_vert' ],
+		fragmentShader: THREE.ShaderChunk[ 'depthRGBA_frag' ]
 
 	},
 
@@ -24389,12 +24397,12 @@ THREE.ShaderLib = {
 
 		uniforms: {
 
-			"lightPos": { type: "v3", value: new THREE.Vector3( 0, 0, 0 ) }
+			"lightPos": { type: "v3", value: new THREE.Vector3() }
 
 		},
 
-		vertexShader: THREE.ShaderChunk['distanceRGBA_vert'],
-		fragmentShader: THREE.ShaderChunk['distanceRGBA_frag']
+		vertexShader: THREE.ShaderChunk[ 'distanceRGBA_vert' ],
+		fragmentShader: THREE.ShaderChunk[ 'distanceRGBA_frag' ]
 
 	}
 
@@ -25419,8 +25427,19 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 						}
 
+						var type = _gl.FLOAT;
+						var normalized = false;
+						var array = geometryAttribute.array;
+
+						if ( array instanceof Uint8Array ) {
+
+							type = _gl.UNSIGNED_BYTE;
+							normalized = true;
+
+						}
+
 						_gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );
-						_gl.vertexAttribPointer( programAttribute, size, _gl.FLOAT, false, 0, startIndex * size * 4 ); // 4 bytes per Float32
+						_gl.vertexAttribPointer( programAttribute, size, type, normalized, 0, startIndex * size * array.BYTES_PER_ELEMENT );
 
 					}
 
@@ -26692,14 +26711,34 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		} else if ( type === 'i' ) {
 
-			console.warn( 'THREE.WebGLRenderer: Uniform "i" is now "1i".' );
+			// console.warn( 'THREE.WebGLRenderer: Uniform "i" is now "1i".' );
 			_gl.uniform1i( location, value );
 
 		} else if ( type === 'f' ) {
 
-			console.warn( 'THREE.WebGLRenderer: Uniform "f" is now "1f".' );
+			// console.warn( 'THREE.WebGLRenderer: Uniform "f" is now "1f".' );
 			_gl.uniform1f( location, value );
 
+		} else if ( type === 'iv1' ) {
+
+			// console.warn( 'THREE.WebGLRenderer: Uniform "iv1" is now "1iv".' );
+			_gl.uniform1iv( location, value );
+
+		} else if ( type === 'iv' ) {
+
+			// console.warn( 'THREE.WebGLRenderer: Uniform "iv" is now "3iv".' );
+			_gl.uniform3iv( location, value );
+
+		} else if ( type === 'fv1' ) {
+
+			// console.warn( 'THREE.WebGLRenderer: Uniform "fv1" is now "1fv".' );
+			_gl.uniform1fv( location, value );
+
+		} else if ( type === 'fv' ) {
+
+			// console.warn( 'THREE.WebGLRenderer: Uniform "fv" is now "3fv".' );
+			_gl.uniform3fv( location, value );
+
 		} else if ( type === 'v2' ) {
 
 			// single THREE.Vector2
@@ -26756,26 +26795,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			}
 
-		} else if ( type === 'iv1' ) {
-
-			console.warn( 'THREE.WebGLRenderer: Uniform "iv1" is now "1iv".' );
-			_gl.uniform1iv( location, value );
-
-		} else if ( type === 'iv' ) {
-
-			console.warn( 'THREE.WebGLRenderer: Uniform "iv" is now "3iv".' );
-			_gl.uniform3iv( location, value );
-
-		} else if ( type === 'fv1' ) {
-
-			console.warn( 'THREE.WebGLRenderer: Uniform "fv1" is now "1fv".' );
-			_gl.uniform1fv( location, value );
-
-		} else if ( type === 'fv' ) {
-
-			console.warn( 'THREE.WebGLRenderer: Uniform "fv" is now "3fv".' );
-			_gl.uniform3fv( location, value );
-
 		} else if ( type === 'v2v' ) {
 
 			// array of THREE.Vector2
@@ -31056,8 +31075,7 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
 	var state = renderer.state;
 
 	var vertexBuffer, elementBuffer;
-	var program, attributes, uniforms;
-	var hasVertexTexture;
+	var shader, program, attributes, uniforms;
 
 	var tempTexture, occlusionTexture;
 
@@ -31105,193 +31123,99 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
 		gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST );
 		gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST );
 
-		hasVertexTexture = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS ) > 0;
-
-		var shader;
-
-		if ( hasVertexTexture ) {
-
-			shader = {
-
-				vertexShader: [
-
-					"uniform lowp int renderType;",
-
-					"uniform vec3 screenPosition;",
-					"uniform vec2 scale;",
-					"uniform float rotation;",
-
-					"uniform sampler2D occlusionMap;",
-
-					"attribute vec2 position;",
-					"attribute vec2 uv;",
-
-					"varying vec2 vUV;",
-					"varying float vVisibility;",
-
-					"void main() {",
+		shader = {
 
-						"vUV = uv;",
+			vertexShader: [
 
-						"vec2 pos = position;",
+				"uniform lowp int renderType;",
 
-						"if ( renderType == 2 ) {",
+				"uniform vec3 screenPosition;",
+				"uniform vec2 scale;",
+				"uniform float rotation;",
 
-							"vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );",
-							"visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );",
-							"visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );",
-							"visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );",
-							"visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );",
-							"visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );",
-							"visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );",
-							"visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );",
-							"visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );",
+				"uniform sampler2D occlusionMap;",
 
-							"vVisibility =        visibility.r / 9.0;",
-							"vVisibility *= 1.0 - visibility.g / 9.0;",
-							"vVisibility *=       visibility.b / 9.0;",
-							"vVisibility *= 1.0 - visibility.a / 9.0;",
+				"attribute vec2 position;",
+				"attribute vec2 uv;",
 
-							"pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;",
-							"pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;",
+				"varying vec2 vUV;",
+				"varying float vVisibility;",
 
-						"}",
+				"void main() {",
 
-						"gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );",
+					"vUV = uv;",
 
-					"}"
+					"vec2 pos = position;",
 
-				].join( "\n" ),
+					"if ( renderType == 2 ) {",
 
-				fragmentShader: [
+						"vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );",
+						"visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );",
+						"visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );",
+						"visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );",
+						"visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );",
+						"visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );",
+						"visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );",
+						"visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );",
+						"visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );",
 
-					"uniform lowp int renderType;",
+						"vVisibility =        visibility.r / 9.0;",
+						"vVisibility *= 1.0 - visibility.g / 9.0;",
+						"vVisibility *=       visibility.b / 9.0;",
+						"vVisibility *= 1.0 - visibility.a / 9.0;",
 
-					"uniform sampler2D map;",
-					"uniform float opacity;",
-					"uniform vec3 color;",
+						"pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;",
+						"pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;",
 
-					"varying vec2 vUV;",
-					"varying float vVisibility;",
+					"}",
 
-					"void main() {",
+					"gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );",
 
-						// pink square
+				"}"
 
-						"if ( renderType == 0 ) {",
+			].join( "\n" ),
 
-							"gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );",
+			fragmentShader: [
 
-						// restore
+				"uniform lowp int renderType;",
 
-						"} else if ( renderType == 1 ) {",
+				"uniform sampler2D map;",
+				"uniform float opacity;",
+				"uniform vec3 color;",
 
-							"gl_FragColor = texture2D( map, vUV );",
+				"varying vec2 vUV;",
+				"varying float vVisibility;",
 
-						// flare
+				"void main() {",
 
-						"} else {",
+					// pink square
 
-							"vec4 texture = texture2D( map, vUV );",
-							"texture.a *= opacity * vVisibility;",
-							"gl_FragColor = texture;",
-							"gl_FragColor.rgb *= color;",
+					"if ( renderType == 0 ) {",
 
-						"}",
+						"gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );",
 
-					"}"
+					// restore
 
-				].join( "\n" )
+					"} else if ( renderType == 1 ) {",
 
-			};
-
-		} else {
-
-			shader = {
-
-				vertexShader: [
-
-					"uniform lowp int renderType;",
-
-					"uniform vec3 screenPosition;",
-					"uniform vec2 scale;",
-					"uniform float rotation;",
-
-					"attribute vec2 position;",
-					"attribute vec2 uv;",
-
-					"varying vec2 vUV;",
-
-					"void main() {",
-
-						"vUV = uv;",
-
-						"vec2 pos = position;",
-
-						"if ( renderType == 2 ) {",
-
-							"pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;",
-							"pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;",
-
-						"}",
-
-						"gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );",
-
-					"}"
-
-				].join( "\n" ),
+						"gl_FragColor = texture2D( map, vUV );",
 
-				fragmentShader: [
+					// flare
 
-					"precision mediump float;",
+					"} else {",
 
-					"uniform lowp int renderType;",
+						"vec4 texture = texture2D( map, vUV );",
+						"texture.a *= opacity * vVisibility;",
+						"gl_FragColor = texture;",
+						"gl_FragColor.rgb *= color;",
 
-					"uniform sampler2D map;",
-					"uniform sampler2D occlusionMap;",
-					"uniform float opacity;",
-					"uniform vec3 color;",
+					"}",
 
-					"varying vec2 vUV;",
+				"}"
 
-					"void main() {",
+			].join( "\n" )
 
-						// pink square
-
-						"if ( renderType == 0 ) {",
-
-							"gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );",
-
-						// restore
-
-						"} else if ( renderType == 1 ) {",
-
-							"gl_FragColor = texture2D( map, vUV );",
-
-						// flare
-
-						"} else {",
-
-							"float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;",
-							"visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;",
-							"visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;",
-							"visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;",
-							"visibility = ( 1.0 - visibility / 4.0 );",
-
-							"vec4 texture = texture2D( map, vUV );",
-							"texture.a *= opacity * visibility;",
-							"gl_FragColor = texture;",
-							"gl_FragColor.rgb *= color;",
-
-						"}",
-
-					"}"
-
-				].join( "\n" )
-
-			};
-
-		}
+		};
 
 		program = createProgram( shader );
 
@@ -31335,7 +31259,10 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
 		var screenPosition = new THREE.Vector3( 1, 1, 0 ),
 			screenPositionPixels = new THREE.Vector2( 1, 1 );
 
-		var areaToCopy = new THREE.Vector2();
+		var validArea = new THREE.Box2();
+
+		validArea.min.set( 0, 0 );
+		validArea.max.set( viewport.z - 16, viewport.w - 16 );
 
 		if ( program === undefined ) {
 
@@ -31383,18 +31310,14 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
 
 			screenPosition.copy( tempPosition );
 
-			screenPositionPixels.x = screenPosition.x * halfViewportWidth + halfViewportWidth;
-			screenPositionPixels.y = screenPosition.y * halfViewportHeight + halfViewportHeight;
+			// horizontal and vertical coordinate of the lower left corner of the pixels to copy
 
-			areaToCopy.x = viewport.x + screenPositionPixels.x - 8; // horizontal coordinate of the lower left corner of the pixels to copy
-			areaToCopy.y = viewport.y + screenPositionPixels.y - 8; // vertical coordinate of the lower left corner of the pixels to copy
+			screenPositionPixels.x = viewport.x + ( screenPosition.x * halfViewportWidth ) + halfViewportWidth - 8;
+			screenPositionPixels.y = viewport.y + ( screenPosition.y * halfViewportHeight ) + halfViewportHeight - 8;
 
 			// screen cull
 
-			if ( areaToCopy.x > 0 &&
-				areaToCopy.x < ( viewport.z - 16 ) &&
-				areaToCopy.y > 0 &&
-				areaToCopy.y < ( viewport.w - 16 ) ) {
+			if ( validArea.containsPoint( screenPositionPixels ) === true ) {
 
 				// save current RGB to temp texture
 
@@ -31402,7 +31325,7 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
 				state.bindTexture( gl.TEXTURE_2D, null );
 				state.activeTexture( gl.TEXTURE1 );
 				state.bindTexture( gl.TEXTURE_2D, tempTexture );
-				gl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGB, areaToCopy.x, areaToCopy.y, 16, 16, 0 );
+				gl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGB, screenPositionPixels.x, screenPositionPixels.y, 16, 16, 0 );
 
 
 				// render pink quad
@@ -31421,7 +31344,7 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
 
 				state.activeTexture( gl.TEXTURE0 );
 				state.bindTexture( gl.TEXTURE_2D, occlusionTexture );
-				gl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGBA, areaToCopy.x, areaToCopy.y, 16, 16, 0 );
+				gl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGBA, screenPositionPixels.x, screenPositionPixels.y, 16, 16, 0 );
 
 
 				// restore graphics

+ 154 - 156
build/three.min.js

@@ -99,20 +99,20 @@ multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b
 c=c[8],m=c*k-l*p,q=l*n-c*h,u=p*h-k*n,v=e*m+f*q+g*u;if(0===v){if(b)throw Error("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0");console.warn("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0");return this.identity()}d[0]=m;d[1]=g*p-c*f;d[2]=l*f-g*k;d[3]=q;d[4]=c*e-g*n;d[5]=g*h-l*e;d[6]=u;d[7]=f*n-p*e;d[8]=k*e-f*h;return this.multiplyScalar(1/v)},transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},
 flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a},getNormalMatrix:function(a){return this.setFromMatrix4(a).getInverse(this).transpose()},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},fromArray:function(a){this.elements.set(a);return this},toArray:function(){var a=this.elements;
 return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8]]}};THREE.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,k,l,n,p,m,q,u,v){var s=this.elements;s[0]=a;s[4]=b;s[8]=c;s[12]=d;s[1]=e;s[5]=f;s[9]=g;s[13]=h;s[2]=k;s[6]=l;s[10]=n;s[14]=p;s[3]=m;s[7]=q;s[11]=u;s[15]=v;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new THREE.Matrix4).fromArray(this.elements)},copy:function(a){this.elements.set(a.elements);return this},copyPosition:function(a){var b=this.elements;a=a.elements;
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,k,l,n,p,m,q,u,v){var t=this.elements;t[0]=a;t[4]=b;t[8]=c;t[12]=d;t[1]=e;t[5]=f;t[9]=g;t[13]=h;t[2]=k;t[6]=l;t[10]=n;t[14]=p;t[3]=m;t[7]=q;t[11]=u;t[15]=v;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new THREE.Matrix4).fromArray(this.elements)},copy:function(a){this.elements.set(a.elements);return this},copyPosition:function(a){var b=this.elements;a=a.elements;
 b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a,b,c){a.setFromMatrixColumn(this,0);b.setFromMatrixColumn(this,1);c.setFromMatrixColumn(this,2);return this},makeBasis:function(a,b,c){this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1);return this},extractRotation:function(){var a;return function(b){void 0===a&&(a=new THREE.Vector3);var c=this.elements,d=b.elements,e=1/a.setFromMatrixColumn(b,0).length(),f=1/a.setFromMatrixColumn(b,1).length();b=1/a.setFromMatrixColumn(b,
 2).length();c[0]=d[0]*e;c[1]=d[1]*e;c[2]=d[2]*e;c[4]=d[4]*f;c[5]=d[5]*f;c[6]=d[6]*f;c[8]=d[8]*b;c[9]=d[9]*b;c[10]=d[10]*b;return this}}(),makeRotationFromEuler:function(a){!1===a instanceof THREE.Euler&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);if("XYZ"===a.order){a=f*h;var k=f*e,l=c*h,n=c*e;b[0]=g*h;b[4]=
 -g*e;b[8]=d;b[1]=k+l*d;b[5]=a-n*d;b[9]=-c*g;b[2]=n-a*d;b[6]=l+k*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,k=g*e,l=d*h,n=d*e,b[0]=a+n*c,b[4]=l*c-k,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=k*c-l,b[6]=n+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,k=g*e,l=d*h,n=d*e,b[0]=a-n*c,b[4]=-f*e,b[8]=l+k*c,b[1]=k+l*c,b[5]=f*h,b[9]=n-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,k=f*e,l=c*h,n=c*e,b[0]=g*h,b[4]=l*d-k,b[8]=a*d+n,b[1]=g*e,b[5]=n*d+a,b[9]=k*d-l,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,k=f*
 d,l=c*g,n=c*d,b[0]=g*h,b[4]=n-a*e,b[8]=l*e+k,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=k*e+l,b[10]=a-n*e):"XZY"===a.order&&(a=f*g,k=f*d,l=c*g,n=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+n,b[5]=f*h,b[9]=k*e-l,b[2]=l*e-k,b[6]=c*h,b[10]=n*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,k=e+e;a=c*g;var l=c*h,c=c*k,n=d*h,d=d*k,e=e*k,g=f*g,h=f*h,f=f*k;b[0]=1-(n+e);b[4]=l-f;b[8]=c+h;b[1]=l+
 f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+n);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],k=c[12],l=c[1],n=c[5],p=c[9],m=c[13],q=c[2],u=c[6],v=c[10],s=c[14],t=c[3],w=c[7],C=c[11],c=c[15],x=d[0],B=d[4],A=d[8],z=d[12],y=
-d[1],F=d[5],E=d[9],H=d[13],K=d[2],G=d[6],O=d[10],I=d[14],M=d[3],N=d[7],P=d[11],d=d[15];e[0]=f*x+g*y+h*K+k*M;e[4]=f*B+g*F+h*G+k*N;e[8]=f*A+g*E+h*O+k*P;e[12]=f*z+g*H+h*I+k*d;e[1]=l*x+n*y+p*K+m*M;e[5]=l*B+n*F+p*G+m*N;e[9]=l*A+n*E+p*O+m*P;e[13]=l*z+n*H+p*I+m*d;e[2]=q*x+u*y+v*K+s*M;e[6]=q*B+u*F+v*G+s*N;e[10]=q*A+u*E+v*O+s*P;e[14]=q*z+u*H+v*I+s*d;e[3]=t*x+w*y+C*K+c*M;e[7]=t*B+w*F+C*G+c*N;e[11]=t*A+w*E+C*O+c*P;e[15]=t*z+w*H+C*I+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,
+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],k=c[12],l=c[1],n=c[5],p=c[9],m=c[13],q=c[2],u=c[6],v=c[10],t=c[14],s=c[3],w=c[7],C=c[11],c=c[15],x=d[0],B=d[4],A=d[8],z=d[12],y=
+d[1],F=d[5],E=d[9],H=d[13],K=d[2],G=d[6],P=d[10],I=d[14],M=d[3],N=d[7],O=d[11],d=d[15];e[0]=f*x+g*y+h*K+k*M;e[4]=f*B+g*F+h*G+k*N;e[8]=f*A+g*E+h*P+k*O;e[12]=f*z+g*H+h*I+k*d;e[1]=l*x+n*y+p*K+m*M;e[5]=l*B+n*F+p*G+m*N;e[9]=l*A+n*E+p*P+m*O;e[13]=l*z+n*H+p*I+m*d;e[2]=q*x+u*y+v*K+t*M;e[6]=q*B+u*F+v*G+t*N;e[10]=q*A+u*E+v*P+t*O;e[14]=q*z+u*H+v*I+t*d;e[3]=s*x+w*y+C*K+c*M;e[7]=s*B+w*F+C*G+c*N;e[11]=s*A+w*E+C*P+c*O;e[15]=s*z+w*H+C*I+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===
 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],k=a[13],l=a[2],n=a[6],p=a[10],m=a[14];
 return a[3]*(+e*h*n-d*k*n-e*g*p+c*k*p+d*g*m-c*h*m)+a[7]*(+b*h*m-b*k*p+e*f*p-d*f*m+d*k*l-e*h*l)+a[11]*(+b*k*n-b*g*m-e*f*n+c*f*m+e*g*l-c*k*l)+a[15]*(-d*g*l-b*h*n+b*g*p+d*f*n-c*f*p+c*h*l)},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]=
 c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a;return function(){void 0===a&&(a=new THREE.Vector3);console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");return a.setFromMatrixColumn(this,3)}}(),setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,
-b){var c=this.elements,d=a.elements,e=d[0],f=d[1],g=d[2],h=d[3],k=d[4],l=d[5],n=d[6],p=d[7],m=d[8],q=d[9],u=d[10],v=d[11],s=d[12],t=d[13],w=d[14],d=d[15],C=q*w*p-t*u*p+t*n*v-l*w*v-q*n*d+l*u*d,x=s*u*p-m*w*p-s*n*v+k*w*v+m*n*d-k*u*d,B=m*t*p-s*q*p+s*l*v-k*t*v-m*l*d+k*q*d,A=s*q*n-m*t*n-s*l*u+k*t*u+m*l*w-k*q*w,z=e*C+f*x+g*B+h*A;if(0===z){if(b)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");
-return this.identity()}c[0]=C;c[1]=t*u*h-q*w*h-t*g*v+f*w*v+q*g*d-f*u*d;c[2]=l*w*h-t*n*h+t*g*p-f*w*p-l*g*d+f*n*d;c[3]=q*n*h-l*u*h-q*g*p+f*u*p+l*g*v-f*n*v;c[4]=x;c[5]=m*w*h-s*u*h+s*g*v-e*w*v-m*g*d+e*u*d;c[6]=s*n*h-k*w*h-s*g*p+e*w*p+k*g*d-e*n*d;c[7]=k*u*h-m*n*h+m*g*p-e*u*p-k*g*v+e*n*v;c[8]=B;c[9]=s*q*h-m*t*h-s*f*v+e*t*v+m*f*d-e*q*d;c[10]=k*t*h-s*l*h+s*f*p-e*t*p-k*f*d+e*l*d;c[11]=m*l*h-k*q*h-m*f*p+e*q*p+k*f*v-e*l*v;c[12]=A;c[13]=m*t*g-s*q*g+s*f*u-e*t*u-m*f*w+e*q*w;c[14]=s*l*g-k*t*g-s*f*n+e*t*n+k*f*w-
+b){var c=this.elements,d=a.elements,e=d[0],f=d[1],g=d[2],h=d[3],k=d[4],l=d[5],n=d[6],p=d[7],m=d[8],q=d[9],u=d[10],v=d[11],t=d[12],s=d[13],w=d[14],d=d[15],C=q*w*p-s*u*p+s*n*v-l*w*v-q*n*d+l*u*d,x=t*u*p-m*w*p-t*n*v+k*w*v+m*n*d-k*u*d,B=m*s*p-t*q*p+t*l*v-k*s*v-m*l*d+k*q*d,A=t*q*n-m*s*n-t*l*u+k*s*u+m*l*w-k*q*w,z=e*C+f*x+g*B+h*A;if(0===z){if(b)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");
+return this.identity()}c[0]=C;c[1]=s*u*h-q*w*h-s*g*v+f*w*v+q*g*d-f*u*d;c[2]=l*w*h-s*n*h+s*g*p-f*w*p-l*g*d+f*n*d;c[3]=q*n*h-l*u*h-q*g*p+f*u*p+l*g*v-f*n*v;c[4]=x;c[5]=m*w*h-t*u*h+t*g*v-e*w*v-m*g*d+e*u*d;c[6]=t*n*h-k*w*h-t*g*p+e*w*p+k*g*d-e*n*d;c[7]=k*u*h-m*n*h+m*g*p-e*u*p-k*g*v+e*n*v;c[8]=B;c[9]=t*q*h-m*s*h-t*f*v+e*s*v+m*f*d-e*q*d;c[10]=k*s*h-t*l*h+t*f*p-e*s*p-k*f*d+e*l*d;c[11]=m*l*h-k*q*h-m*f*p+e*q*p+k*f*v-e*l*v;c[12]=A;c[13]=m*s*g-t*q*g+t*f*u-e*s*u-m*f*w+e*q*w;c[14]=t*l*g-k*s*g-t*f*n+e*s*n+k*f*w-
 e*l*w;c[15]=k*q*g-m*l*g+m*f*n-e*q*n-k*f*u+e*l*u;return this.multiplyScalar(1/z)},scale:function(a){var b=this.elements,c=a.x,d=a.y;a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10]))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},
 makeRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,k=e*f,l=e*g;this.set(k*f+c,k*g-d*h,k*h+d*g,0,k*g+d*h,l*g+c,l*h-d*f,0,k*h-
 d*g,l*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},compose:function(a,b,c){this.makeRotationFromQuaternion(b);this.scale(c);this.setPosition(a);return this},decompose:function(){var a,b;return function(c,d,e){void 0===a&&(a=new THREE.Vector3);void 0===b&&(b=new THREE.Matrix4);var f=this.elements,g=a.set(f[0],f[1],f[2]).length(),h=a.set(f[4],f[5],f[6]).length(),k=a.set(f[8],f[9],f[10]).length();0>this.determinant()&&(g=-g);c.x=
@@ -132,8 +132,8 @@ THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.c
 empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},intersectsBox:function(a){return a.intersectsSphere(this)},intersectsPlane:function(a){return Math.abs(this.center.dot(a.normal)-a.constant)<=this.radius},clampPoint:function(a,b){var c=
 this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&
 a.radius===this.radius}};THREE.Frustum=function(a,b,c,d,e,f){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==f?f:new THREE.Plane]};
-THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],k=c[6],l=c[7],n=c[8],p=c[9],m=c[10],q=c[11],u=c[12],v=c[13],s=c[14],
-c=c[15];b[0].setComponents(f-a,l-g,q-n,c-u).normalize();b[1].setComponents(f+a,l+g,q+n,c+u).normalize();b[2].setComponents(f+d,l+h,q+p,c+v).normalize();b[3].setComponents(f-d,l-h,q-p,c-v).normalize();b[4].setComponents(f-e,l-k,q-m,c-s).normalize();b[5].setComponents(f+e,l+k,q+m,c+s).normalize();return this},intersectsObject:function(){var a=new THREE.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);
+THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],k=c[6],l=c[7],n=c[8],p=c[9],m=c[10],q=c[11],u=c[12],v=c[13],t=c[14],
+c=c[15];b[0].setComponents(f-a,l-g,q-n,c-u).normalize();b[1].setComponents(f+a,l+g,q+n,c+u).normalize();b[2].setComponents(f+d,l+h,q+p,c+v).normalize();b[3].setComponents(f-d,l-h,q-p,c-v).normalize();b[4].setComponents(f-e,l-k,q-m,c-t).normalize();b[5].setComponents(f+e,l+k,q+m,c+t).normalize();return this},intersectsObject:function(){var a=new THREE.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);
 return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},intersectsBox:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){for(var d=this.planes,e=0;6>e;e++){var f=d[e];a.x=0<f.normal.x?c.min.x:c.max.x;b.x=0<f.normal.x?c.max.x:c.min.x;a.y=0<f.normal.y?c.min.y:c.max.y;b.y=0<f.normal.y?c.max.y:c.min.y;a.z=0<f.normal.z?c.min.z:c.max.z;b.z=0<f.normal.z?c.max.z:c.min.z;
 var g=f.distanceToPoint(a),f=f.distanceToPoint(b);if(0>g&&0>f)return!1}return!0}}(),containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0}};THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0};
 THREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,
@@ -209,7 +209,7 @@ THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){for
 this.verticesNeedUpdate=!0;return this},rotateX:function(){var a;return function(b){void 0===a&&(a=new THREE.Matrix4);a.makeRotationX(b);this.applyMatrix(a);return this}}(),rotateY:function(){var a;return function(b){void 0===a&&(a=new THREE.Matrix4);a.makeRotationY(b);this.applyMatrix(a);return this}}(),rotateZ:function(){var a;return function(b){void 0===a&&(a=new THREE.Matrix4);a.makeRotationZ(b);this.applyMatrix(a);return this}}(),translate:function(){var a;return function(b,c,d){void 0===a&&
 (a=new THREE.Matrix4);a.makeTranslation(b,c,d);this.applyMatrix(a);return this}}(),scale:function(){var a;return function(b,c,d){void 0===a&&(a=new THREE.Matrix4);a.makeScale(b,c,d);this.applyMatrix(a);return this}}(),lookAt:function(){var a;return function(b){void 0===a&&(a=new THREE.Object3D);a.lookAt(b);a.updateMatrix();this.applyMatrix(a.matrix)}}(),fromBufferGeometry:function(a){function b(a,b,d,e){var f=void 0!==g?[n[a].clone(),n[b].clone(),n[d].clone()]:[],q=void 0!==h?[c.colors[a].clone(),
 c.colors[b].clone(),c.colors[d].clone()]:[];e=new THREE.Face3(a,b,d,f,q,e);c.faces.push(e);void 0!==k&&c.faceVertexUvs[0].push([p[a].clone(),p[b].clone(),p[d].clone()]);void 0!==l&&c.faceVertexUvs[1].push([m[a].clone(),m[b].clone(),m[d].clone()])}var c=this,d=null!==a.index?a.index.array:void 0,e=a.attributes,f=e.position.array,g=void 0!==e.normal?e.normal.array:void 0,h=void 0!==e.color?e.color.array:void 0,k=void 0!==e.uv?e.uv.array:void 0,l=void 0!==e.uv2?e.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=
-[]);for(var n=[],p=[],m=[],q=e=0;e<f.length;e+=3,q+=2)c.vertices.push(new THREE.Vector3(f[e],f[e+1],f[e+2])),void 0!==g&&n.push(new THREE.Vector3(g[e],g[e+1],g[e+2])),void 0!==h&&c.colors.push(new THREE.Color(h[e],h[e+1],h[e+2])),void 0!==k&&p.push(new THREE.Vector2(k[q],k[q+1])),void 0!==l&&m.push(new THREE.Vector2(l[q],l[q+1]));if(void 0!==d)if(f=a.groups,0<f.length)for(e=0;e<f.length;e++)for(var u=f[e],v=u.start,s=u.count,q=v,v=v+s;q<v;q+=3)b(d[q],d[q+1],d[q+2],u.materialIndex);else for(e=0;e<
+[]);for(var n=[],p=[],m=[],q=e=0;e<f.length;e+=3,q+=2)c.vertices.push(new THREE.Vector3(f[e],f[e+1],f[e+2])),void 0!==g&&n.push(new THREE.Vector3(g[e],g[e+1],g[e+2])),void 0!==h&&c.colors.push(new THREE.Color(h[e],h[e+1],h[e+2])),void 0!==k&&p.push(new THREE.Vector2(k[q],k[q+1])),void 0!==l&&m.push(new THREE.Vector2(l[q],l[q+1]));if(void 0!==d)if(f=a.groups,0<f.length)for(e=0;e<f.length;e++)for(var u=f[e],v=u.start,t=u.count,q=v,v=v+t;q<v;q+=3)b(d[q],d[q+1],d[q+2],u.materialIndex);else for(e=0;e<
 d.length;e+=3)b(d[e],d[e+1],d[e+2]);else for(e=0;e<f.length/3;e+=3)b(e,e+1,e+2);this.computeFaceNormals();null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());return this},center:function(){this.computeBoundingBox();var a=this.boundingBox.center().negate();this.translate(a.x,a.y,a.z);return a},normalize:function(){this.computeBoundingSphere();var a=this.boundingSphere.center,b=this.boundingSphere.radius,b=0===b?1:1/
 b,c=new THREE.Matrix4;c.set(b,0,0,-b*a.x,0,b,0,-b*a.y,0,0,b,-b*a.z,0,0,0,1);this.applyMatrix(c);return this},computeFaceNormals:function(){for(var a=new THREE.Vector3,b=new THREE.Vector3,c=0,d=this.faces.length;c<d;c++){var e=this.faces[c],f=this.vertices[e.a],g=this.vertices[e.b];a.subVectors(this.vertices[e.c],g);b.subVectors(f,g);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){void 0===a&&(a=!0);var b,c,d;d=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<
 c;b++)d[b]=new THREE.Vector3;if(a){var e,f,g,h=new THREE.Vector3,k=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],e=this.vertices[c.a],f=this.vertices[c.b],g=this.vertices[c.c],h.subVectors(g,f),k.subVectors(e,f),h.cross(k),d[c.a].add(h),d[c.b].add(h),d[c.c].add(h)}else for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d[c.a].add(c.normal),d[c.b].add(c.normal),d[c.c].add(c.normal);b=0;for(c=this.vertices.length;b<c;b++)d[b].normalize();a=0;for(b=this.faces.length;a<b;a++)c=
@@ -222,16 +222,16 @@ f;b++)q=u[b].clone(),void 0!==d&&q.applyMatrix3(d).normalize(),m.vertexNormals.p
 this.merge(a.geometry,a.matrix))},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(g=this.faces.length;f<g;f++)for(e=this.faces[f],e.a=c[e.a],e.b=c[e.b],e.c=c[e.c],e=[e.a,e.b,e.c],d=0;3>d;d++)if(e[d]===e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=a[f],this.faces.splice(e,
 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!==l[b])return l[b];l[b]=k.length/3;k.push(a.x,a.y,a.z);return l[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]=n.length;n.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]=m.length/2;m.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=[],k=[],l={},n=[],p={},m=[],q={};for(g=0;g<this.faces.length;g++){var u=this.faces[g],v=void 0!==this.faceVertexUvs[0][g],s=0<u.normal.length(),t=0<u.vertexNormals.length,w=1!==u.color.r||1!==u.color.g||1!==u.color.b,
-C=0<u.vertexColors.length,x=0,x=a(x,0,0),x=a(x,1,!0),x=a(x,2,!1),x=a(x,3,v),x=a(x,4,s),x=a(x,5,t),x=a(x,6,w),x=a(x,7,C);h.push(x);h.push(u.a,u.b,u.c);h.push(u.materialIndex);v&&(v=this.faceVertexUvs[0][g],h.push(d(v[0]),d(v[1]),d(v[2])));s&&h.push(b(u.normal));t&&(s=u.vertexNormals,h.push(b(s[0]),b(s[1]),b(s[2])));w&&h.push(c(u.color));C&&(u=u.vertexColors,h.push(c(u[0]),c(u[1]),c(u[2])))}e.data={};e.data.vertices=f;e.data.normals=k;0<n.length&&(e.data.colors=n);0<m.length&&(e.data.uvs=[m]);e.data.faces=
+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=[],k=[],l={},n=[],p={},m=[],q={};for(g=0;g<this.faces.length;g++){var u=this.faces[g],v=void 0!==this.faceVertexUvs[0][g],t=0<u.normal.length(),s=0<u.vertexNormals.length,w=1!==u.color.r||1!==u.color.g||1!==u.color.b,
+C=0<u.vertexColors.length,x=0,x=a(x,0,0),x=a(x,1,!0),x=a(x,2,!1),x=a(x,3,v),x=a(x,4,t),x=a(x,5,s),x=a(x,6,w),x=a(x,7,C);h.push(x);h.push(u.a,u.b,u.c);h.push(u.materialIndex);v&&(v=this.faceVertexUvs[0][g],h.push(d(v[0]),d(v[1]),d(v[2])));t&&h.push(b(u.normal));s&&(t=u.vertexNormals,h.push(b(t[0]),b(t[1]),b(t[2])));w&&h.push(c(u.color));C&&(u=u.vertexColors,h.push(c(u[0]),c(u[1]),c(u[2])))}e.data={};e.data.vertices=f;e.data.normals=k;0<n.length&&(e.data.colors=n);0<m.length&&(e.data.uvs=[m]);e.data.faces=
 h;return e},clone:function(){return(new THREE.Geometry).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=[],k=0,l=g.length;k<l;k++)h.push(g[k].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.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,k;if(0<h){k=[];for(var l=0;l<h;l++)k[l]=[];this.morphTargets.position=k}var n=a.morphNormals,p=n.length,m;if(0<p){m=[];for(l=0;l<p;l++)m[l]=
-[];this.morphTargets.normal=m}for(var q=a.skinIndices,u=a.skinWeights,v=q.length===c.length,s=u.length===c.length,l=0;l<b.length;l++){var t=b[l];this.vertices.push(c[t.a],c[t.b],c[t.c]);var w=t.vertexNormals;3===w.length?this.normals.push(w[0],w[1],w[2]):(w=t.normal,this.normals.push(w,w,w));w=t.vertexColors;3===w.length?this.colors.push(w[0],w[1],w[2]):(w=t.color,this.colors.push(w,w,w));!0===e&&(w=d[0][l],void 0!==w?this.uvs.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",
-l),this.uvs.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2)));!0===f&&(w=d[1][l],void 0!==w?this.uvs2.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2)));for(w=0;w<h;w++){var C=g[w].vertices;k[w].push(C[t.a],C[t.b],C[t.c])}for(w=0;w<p;w++)C=n[w].vertexNormals[l],m[w].push(C.a,C.b,C.c);v&&this.skinIndices.push(q[t.a],q[t.b],q[t.c]);s&&this.skinWeights.push(u[t.a],u[t.b],
-u[t.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);
+[];this.morphTargets.normal=m}for(var q=a.skinIndices,u=a.skinWeights,v=q.length===c.length,t=u.length===c.length,l=0;l<b.length;l++){var s=b[l];this.vertices.push(c[s.a],c[s.b],c[s.c]);var w=s.vertexNormals;3===w.length?this.normals.push(w[0],w[1],w[2]):(w=s.normal,this.normals.push(w,w,w));w=s.vertexColors;3===w.length?this.colors.push(w[0],w[1],w[2]):(w=s.color,this.colors.push(w,w,w));!0===e&&(w=d[0][l],void 0!==w?this.uvs.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",
+l),this.uvs.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2)));!0===f&&(w=d[1][l],void 0!==w?this.uvs2.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2)));for(w=0;w<h;w++){var C=g[w].vertices;k[w].push(C[s.a],C[s.b],C[s.c])}for(w=0;w<p;w++)C=n[w].vertexNormals[l],m[w].push(C.a,C.b,C.c);v&&this.skinIndices.push(q[s.a],q[s.b],q[s.c]);t&&this.skinWeights.push(u[s.a],u[s.b],
+u[s.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.prototype={constructor:THREE.BufferGeometry,getIndex:function(){return this.index},setIndex:function(a){this.index=a},addAttribute:function(a,b,c){if(!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,c));else if("index"===a)console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),
 this.setIndex(b);else return this.attributes[a]=b,this},getAttribute:function(a){return this.attributes[a]},removeAttribute:function(a){delete this.attributes[a];return this},addGroup:function(a,b,c){this.groups.push({start:a,count:b,materialIndex:void 0!==c?c:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(a,b){this.drawRange.start=a;this.drawRange.count=b},applyMatrix:function(a){var b=this.attributes.position;void 0!==b&&(a.applyToVector3Array(b.array),b.needsUpdate=!0);b=this.attributes.normal;
@@ -247,7 +247,7 @@ this.setIndex((new THREE.BufferAttribute(b,1)).copyIndicesArray(a.indices)));thi
 4),this.addAttribute("skinWeight",c.copyVector4sArray(a.skinWeights)));null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());return this},computeBoundingBox:function(){new THREE.Vector3;return function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var a=this.attributes.position.array;a&&this.boundingBox.setFromArray(a);if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,
 0,0);(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}}(),computeBoundingSphere:function(){var a=new THREE.Box3,b=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var c=this.attributes.position.array;if(c){var d=this.boundingSphere.center;a.setFromArray(c);
 a.center(d);for(var e=0,f=0,g=c.length;f<g;f+=3)b.fromArray(c,f),e=Math.max(e,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(e);isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var a=this.index,b=this.attributes,c=this.groups;if(b.position){var d=b.position.array;if(void 0===b.normal)this.addAttribute("normal",
-new THREE.BufferAttribute(new Float32Array(d.length),3));else for(var e=b.normal.array,f=0,g=e.length;f<g;f++)e[f]=0;var e=b.normal.array,h,k,l,n=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,q=new THREE.Vector3,u=new THREE.Vector3;if(a){a=a.array;0===c.length&&this.addGroup(0,a.length);for(var v=0,s=c.length;v<s;++v)for(f=c[v],g=f.start,h=f.count,f=g,g+=h;f<g;f+=3)h=3*a[f+0],k=3*a[f+1],l=3*a[f+2],n.fromArray(d,h),p.fromArray(d,k),m.fromArray(d,l),q.subVectors(m,p),u.subVectors(n,p),q.cross(u),
+new THREE.BufferAttribute(new Float32Array(d.length),3));else for(var e=b.normal.array,f=0,g=e.length;f<g;f++)e[f]=0;var e=b.normal.array,h,k,l,n=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,q=new THREE.Vector3,u=new THREE.Vector3;if(a){a=a.array;0===c.length&&this.addGroup(0,a.length);for(var v=0,t=c.length;v<t;++v)for(f=c[v],g=f.start,h=f.count,f=g,g+=h;f<g;f+=3)h=3*a[f+0],k=3*a[f+1],l=3*a[f+2],n.fromArray(d,h),p.fromArray(d,k),m.fromArray(d,l),q.subVectors(m,p),u.subVectors(n,p),q.cross(u),
 e[h]+=q.x,e[h+1]+=q.y,e[h+2]+=q.z,e[k]+=q.x,e[k+1]+=q.y,e[k+2]+=q.z,e[l]+=q.x,e[l+1]+=q.y,e[l+2]+=q.z}else for(f=0,g=d.length;f<g;f+=9)n.fromArray(d,f),p.fromArray(d,f+3),m.fromArray(d,f+6),q.subVectors(m,p),u.subVectors(n,p),q.cross(u),e[f]=q.x,e[f+1]=q.y,e[f+2]=q.z,e[f+3]=q.x,e[f+4]=q.y,e[f+5]=q.z,e[f+6]=q.x,e[f+7]=q.y,e[f+8]=q.z;this.normalizeNormals();b.normal.needsUpdate=!0}},merge:function(a,b){if(!1===a instanceof THREE.BufferGeometry)console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",
 a);else{void 0===b&&(b=0);var c=this.attributes,d;for(d in c)if(void 0!==a.attributes[d])for(var e=c[d].array,f=a.attributes[d],g=f.array,h=0,f=f.itemSize*b;h<g.length;h++,f++)e[f]=g[h];return this}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),
 this;var a=new THREE.BufferGeometry,b=this.index.array,c=this.attributes,d;for(d in c){for(var e=c[d],f=e.array,e=e.itemSize,g=new f.constructor(b.length*e),h=0,k=0,l=0,n=b.length;l<n;l++)for(var h=b[l]*e,p=0;p<e;p++)g[k++]=f[h++];a.addAttribute(d,new THREE.BufferAttribute(g,e))}return a},toJSON:function(){var a={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};a.uuid=this.uuid;a.type=this.type;""!==this.name&&(a.name=this.name);if(void 0!==this.parameters){var b=this.parameters,
@@ -288,8 +288,8 @@ e=d[b],f=this._bindings;void 0===e&&(e={},d[b]=e);e[c]=a;a._cacheIndex=f.length;
 this._bindings,c=a._cacheIndex,d=--this._nActiveBindings,e=b[d];a._cacheIndex=d;b[d]=a;e._cacheIndex=c;b[c]=e},_lendControlInterpolant:function(){var a=this._controlInterpolants,b=this._nActiveControlInterpolants++,c=a[b];void 0===c&&(c=new THREE.LinearInterpolant(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),c.__cacheIndex=b,a[b]=c);return c},_takeBackControlInterpolant:function(a){var b=this._controlInterpolants,c=a.__cacheIndex,d=--this._nActiveControlInterpolants,
 e=b[d];a.__cacheIndex=d;b[d]=a;e.__cacheIndex=c;b[c]=e},_controlInterpolantsResultBuffer:new Float32Array(1)});
 THREE.AnimationObjectGroup=function(a){this.uuid=THREE.Math.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var b={};this._indicesByUUID=b;for(var c=0,d=arguments.length;c!==d;++c)b[arguments[c].uuid]=c;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}};
-THREE.AnimationObjectGroup.prototype={constructor:THREE.AnimationObjectGroup,add:function(a){for(var b=this._objects,c=b.length,d=this.nCachedObjects_,e=this._indicesByUUID,f=this._paths,g=this._parsedPaths,h=this._bindings,k=h.length,l=0,n=arguments.length;l!==n;++l){var p=arguments[l],m=p.uuid,q=e[m];if(void 0===q){q=c++;e[m]=q;b.push(p);for(var m=0,u=k;m!==u;++m)h[m].push(new THREE.PropertyBinding(p,f[m],g[m]))}else if(q<d){var v=b[q],s=--d,u=b[s];e[u.uuid]=q;b[q]=u;e[m]=s;b[s]=p;m=0;for(u=k;m!==
-u;++m){var t=h[m],w=t[q];t[q]=t[s];void 0===w&&(w=new THREE.PropertyBinding(p,f[m],g[m]));t[s]=w}}else b[q]!==v&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=d},remove:function(a){for(var b=this._objects,c=this.nCachedObjects_,d=this._indicesByUUID,e=this._bindings,f=e.length,g=0,h=arguments.length;g!==h;++g){var k=arguments[g],l=k.uuid,n=d[l];if(void 0!==n&&n>=c){var p=c++,m=b[p];d[m.uuid]=
+THREE.AnimationObjectGroup.prototype={constructor:THREE.AnimationObjectGroup,add:function(a){for(var b=this._objects,c=b.length,d=this.nCachedObjects_,e=this._indicesByUUID,f=this._paths,g=this._parsedPaths,h=this._bindings,k=h.length,l=0,n=arguments.length;l!==n;++l){var p=arguments[l],m=p.uuid,q=e[m];if(void 0===q){q=c++;e[m]=q;b.push(p);for(var m=0,u=k;m!==u;++m)h[m].push(new THREE.PropertyBinding(p,f[m],g[m]))}else if(q<d){var v=b[q],t=--d,u=b[t];e[u.uuid]=q;b[q]=u;e[m]=t;b[t]=p;m=0;for(u=k;m!==
+u;++m){var s=h[m],w=s[q];s[q]=s[t];void 0===w&&(w=new THREE.PropertyBinding(p,f[m],g[m]));s[t]=w}}else b[q]!==v&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=d},remove:function(a){for(var b=this._objects,c=this.nCachedObjects_,d=this._indicesByUUID,e=this._bindings,f=e.length,g=0,h=arguments.length;g!==h;++g){var k=arguments[g],l=k.uuid,n=d[l];if(void 0!==n&&n>=c){var p=c++,m=b[p];d[m.uuid]=
 n;b[n]=m;d[l]=p;b[p]=k;k=0;for(l=f;k!==l;++k){var m=e[k],q=m[n];m[n]=m[p];m[p]=q}}}this.nCachedObjects_=c},uncache:function(a){for(var b=this._objects,c=b.length,d=this.nCachedObjects_,e=this._indicesByUUID,f=this._bindings,g=f.length,h=0,k=arguments.length;h!==k;++h){var l=arguments[h].uuid,n=e[l];if(void 0!==n)if(delete e[l],n<d){var l=--d,p=b[l],m=--c,q=b[m];e[p.uuid]=n;b[n]=p;e[q.uuid]=l;b[l]=q;b.pop();p=0;for(q=g;p!==q;++p){var u=f[p],v=u[m];u[n]=u[l];u[l]=v;u.pop()}}else for(m=--c,q=b[m],e[q.uuid]=
 n,b[n]=q,b.pop(),p=0,q=g;p!==q;++p)u=f[p],u[n]=u[m],u.pop()}this.nCachedObjects_=d},subscribe_:function(a,b){var c=this._bindingsIndicesByPath,d=c[a],e=this._bindings;if(void 0!==d)return e[d];var f=this._paths,g=this._parsedPaths,h=this._objects,k=this.nCachedObjects_,l=Array(h.length),d=e.length;c[a]=d;f.push(a);g.push(b);e.push(l);c=k;for(d=h.length;c!==d;++c)l[c]=new THREE.PropertyBinding(h[c],a,b);return l},unsubscribe_:function(a){var b=this._bindingsIndicesByPath,c=b[a];if(void 0!==c){var d=
 this._paths,e=this._parsedPaths,f=this._bindings,g=f.length-1,h=f[g];b[a[g]]=c;f[c]=h;f.pop();e[c]=e[g];e.pop();d[c]=d[g];d.pop()}}};
@@ -327,18 +327,18 @@ THREE.QuaternionKeyframeTrack.prototype=Object.assign(Object.create(THREE.Keyfra
 THREE.StringKeyframeTrack.prototype=Object.assign(Object.create(THREE.KeyframeTrack.prototype),{constructor:THREE.StringKeyframeTrack,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:THREE.IntepolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});THREE.VectorKeyframeTrack=function(a,b,c,d){THREE.KeyframeTrack.call(this,a,b,c,d)};
 THREE.VectorKeyframeTrack.prototype=Object.assign(Object.create(THREE.KeyframeTrack.prototype),{constructor:THREE.VectorKeyframeTrack,ValueTypeName:"vector"});
 THREE.Audio=function(a){THREE.Object3D.call(this);this.type="Audio";this.context=a.context;this.source=this.context.createBufferSource();this.source.onended=this.onEnded.bind(this);this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.startTime=0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filter=null};THREE.Audio.prototype=Object.create(THREE.Object3D.prototype);THREE.Audio.prototype.constructor=THREE.Audio;
-THREE.Audio.prototype.getOutput=function(){return this.gain};THREE.Audio.prototype.load=function(a){var b=new THREE.AudioBuffer(this.context);b.load(a);this.setBuffer(b);return this};THREE.Audio.prototype.setNodeSource=function(a){this.hasPlaybackControl=!1;this.sourceType="audioNode";this.source=a;this.connect();return this};THREE.Audio.prototype.setBuffer=function(a){var b=this;a.onReady(function(a){b.source.buffer=a;b.sourceType="buffer";b.autoplay&&b.play()});return this};
+THREE.Audio.prototype.getOutput=function(){return this.gain};THREE.Audio.prototype.load=function(a){console.warn("THREE.Audio: .load has been deprecated. Please use THREE.AudioLoader.");var b=this;(new THREE.AudioLoader).load(a,function(a){b.setBuffer(a)});return this};THREE.Audio.prototype.setNodeSource=function(a){this.hasPlaybackControl=!1;this.sourceType="audioNode";this.source=a;this.connect();return this};
+THREE.Audio.prototype.setBuffer=function(a){this.source.buffer=a;this.sourceType="buffer";this.autoplay&&this.play();return this};
 THREE.Audio.prototype.play=function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");else if(!1===this.hasPlaybackControl)console.warn("THREE.Audio: this Audio has no playback control.");else{var a=this.context.createBufferSource();a.buffer=this.source.buffer;a.loop=this.source.loop;a.onended=this.source.onended;a.start(0,this.startTime);a.playbackRate.value=this.playbackRate;this.isPlaying=!0;this.source=a;this.connect()}};
 THREE.Audio.prototype.pause=function(){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=this.context.currentTime)};THREE.Audio.prototype.stop=function(){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=0)};THREE.Audio.prototype.connect=function(){null!==this.filter?(this.source.connect(this.filter),this.filter.connect(this.getOutput())):this.source.connect(this.getOutput())};
 THREE.Audio.prototype.disconnect=function(){null!==this.filter?(this.source.disconnect(this.filter),this.filter.disconnect(this.getOutput())):this.source.disconnect(this.getOutput())};THREE.Audio.prototype.getFilter=function(){return this.filter};THREE.Audio.prototype.setFilter=function(a){void 0===a&&(a=null);!0===this.isPlaying?(this.disconnect(),this.filter=a,this.connect()):this.filter=a};
 THREE.Audio.prototype.setPlaybackRate=function(a){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=a,!0===this.isPlaying&&(this.source.playbackRate.value=this.playbackRate))};THREE.Audio.prototype.getPlaybackRate=function(){return this.playbackRate};THREE.Audio.prototype.onEnded=function(){this.isPlaying=!1};
 THREE.Audio.prototype.setLoop=function(a){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):this.source.loop=a};THREE.Audio.prototype.getLoop=function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.source.loop};THREE.Audio.prototype.setVolume=function(a){this.gain.gain.value=a};THREE.Audio.prototype.getVolume=function(){return this.gain.gain.value};
-THREE.AudioAnalyser=function(a,b){this.analyser=a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)};THREE.AudioAnalyser.prototype={constructor:THREE.AudioAnalyser,getData:function(){this.analyser.getByteFrequencyData(this.data);return this.data}};THREE.AudioBuffer=function(a){this.context=a;this.ready=!1;this.readyCallbacks=[]};
-THREE.AudioBuffer.prototype.load=function(a){var b=this,c=new XMLHttpRequest;c.open("GET",a,!0);c.responseType="arraybuffer";c.onload=function(a){b.context.decodeAudioData(this.response,function(a){b.buffer=a;b.ready=!0;for(a=0;a<b.readyCallbacks.length;a++)b.readyCallbacks[a](b.buffer);b.readyCallbacks=[]})};c.send();return this};THREE.AudioBuffer.prototype.onReady=function(a){this.ready?a(this.buffer):this.readyCallbacks.push(a)};
-THREE.PositionalAudio=function(a){THREE.Audio.call(this,a);this.panner=this.context.createPanner();this.panner.connect(this.gain)};THREE.PositionalAudio.prototype=Object.create(THREE.Audio.prototype);THREE.PositionalAudio.prototype.constructor=THREE.PositionalAudio;THREE.PositionalAudio.prototype.getOutput=function(){return this.panner};THREE.PositionalAudio.prototype.setRefDistance=function(a){this.panner.refDistance=a};THREE.PositionalAudio.prototype.getRefDistance=function(){return this.panner.refDistance};
-THREE.PositionalAudio.prototype.setRolloffFactor=function(a){this.panner.rolloffFactor=a};THREE.PositionalAudio.prototype.getRolloffFactor=function(){return this.panner.rolloffFactor};THREE.PositionalAudio.prototype.setDistanceModel=function(a){this.panner.distanceModel=a};THREE.PositionalAudio.prototype.getDistanceModel=function(){return this.panner.distanceModel};THREE.PositionalAudio.prototype.setMaxDistance=function(a){this.panner.maxDistance=a};
-THREE.PositionalAudio.prototype.getMaxDistance=function(){return this.panner.maxDistance};THREE.PositionalAudio.prototype.updateMatrixWorld=function(){var a=new THREE.Vector3;return function(b){THREE.Object3D.prototype.updateMatrixWorld.call(this,b);a.setFromMatrixPosition(this.matrixWorld);this.panner.setPosition(a.x,a.y,a.z)}}();
-THREE.AudioListener=function(){THREE.Object3D.call(this);this.type="AudioListener";this.context=new (window.AudioContext||window.webkitAudioContext);this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null};THREE.AudioListener.prototype=Object.create(THREE.Object3D.prototype);THREE.AudioListener.prototype.constructor=THREE.AudioListener;THREE.AudioListener.prototype.getInput=function(){return this.gain};
+THREE.AudioAnalyser=function(a,b){this.analyser=a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)};THREE.AudioAnalyser.prototype={constructor:THREE.AudioAnalyser,getData:function(){this.analyser.getByteFrequencyData(this.data);return this.data}};
+Object.defineProperty(THREE,"AudioContext",{get:function(){var a;return function(){void 0===a&&(a=new (window.AudioContext||window.webkitAudioContext));return a}}()});THREE.PositionalAudio=function(a){THREE.Audio.call(this,a);this.panner=this.context.createPanner();this.panner.connect(this.gain)};THREE.PositionalAudio.prototype=Object.create(THREE.Audio.prototype);THREE.PositionalAudio.prototype.constructor=THREE.PositionalAudio;THREE.PositionalAudio.prototype.getOutput=function(){return this.panner};
+THREE.PositionalAudio.prototype.setRefDistance=function(a){this.panner.refDistance=a};THREE.PositionalAudio.prototype.getRefDistance=function(){return this.panner.refDistance};THREE.PositionalAudio.prototype.setRolloffFactor=function(a){this.panner.rolloffFactor=a};THREE.PositionalAudio.prototype.getRolloffFactor=function(){return this.panner.rolloffFactor};THREE.PositionalAudio.prototype.setDistanceModel=function(a){this.panner.distanceModel=a};THREE.PositionalAudio.prototype.getDistanceModel=function(){return this.panner.distanceModel};
+THREE.PositionalAudio.prototype.setMaxDistance=function(a){this.panner.maxDistance=a};THREE.PositionalAudio.prototype.getMaxDistance=function(){return this.panner.maxDistance};THREE.PositionalAudio.prototype.updateMatrixWorld=function(){var a=new THREE.Vector3;return function(b){THREE.Object3D.prototype.updateMatrixWorld.call(this,b);a.setFromMatrixPosition(this.matrixWorld);this.panner.setPosition(a.x,a.y,a.z)}}();
+THREE.AudioListener=function(){THREE.Object3D.call(this);this.type="AudioListener";this.context=THREE.AudioContext;this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null};THREE.AudioListener.prototype=Object.create(THREE.Object3D.prototype);THREE.AudioListener.prototype.constructor=THREE.AudioListener;THREE.AudioListener.prototype.getInput=function(){return this.gain};
 THREE.AudioListener.prototype.removeFilter=function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)};THREE.AudioListener.prototype.setFilter=function(a){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination);this.filter=a;this.gain.connect(this.filter);this.filter.connect(this.context.destination)};
 THREE.AudioListener.prototype.getFilter=function(){return this.filter};THREE.AudioListener.prototype.setMasterVolume=function(a){this.gain.gain.value=a};THREE.AudioListener.prototype.getMasterVolume=function(){return this.gain.gain.value};
 THREE.AudioListener.prototype.updateMatrixWorld=function(){var a=new THREE.Vector3,b=new THREE.Quaternion,c=new THREE.Vector3,d=new THREE.Vector3;return function(e){THREE.Object3D.prototype.updateMatrixWorld.call(this,e);e=this.context.listener;var f=this.up;this.matrixWorld.decompose(a,b,c);d.set(0,0,-1).applyQuaternion(b);e.setPosition(a.x,a.y,a.z);e.setOrientation(d.x,d.y,d.z,f.x,f.y,f.z)}}();
@@ -366,8 +366,9 @@ THREE.DirectionalLight.prototype.copy=function(a){THREE.Light.prototype.copy.cal
 THREE.HemisphereLight.prototype.copy=function(a){THREE.Light.prototype.copy.call(this,a);this.groundColor.copy(a.groundColor);return this};THREE.PointLight=function(a,b,c,d){THREE.Light.call(this,a,b);this.type="PointLight";this.distance=void 0!==c?c:0;this.decay=void 0!==d?d:1;this.shadow=new THREE.LightShadow(new THREE.PerspectiveCamera(90,1,.5,500))};THREE.PointLight.prototype=Object.create(THREE.Light.prototype);THREE.PointLight.prototype.constructor=THREE.PointLight;
 Object.defineProperty(THREE.PointLight.prototype,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(a){this.intensity=a/(4*Math.PI)}});THREE.PointLight.prototype.copy=function(a){THREE.Light.prototype.copy.call(this,a);this.distance=a.distance;this.decay=a.decay;this.shadow=a.shadow.clone();return this};
 THREE.SpotLight=function(a,b,c,d,e,f){THREE.Light.call(this,a,b);this.type="SpotLight";this.position.set(0,1,0);this.updateMatrix();this.target=new THREE.Object3D;this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/3;this.penumbra=void 0!==e?e:0;this.decay=void 0!==f?f:1;this.shadow=new THREE.LightShadow(new THREE.PerspectiveCamera(50,1,.5,500))};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight.prototype.constructor=THREE.SpotLight;
-Object.defineProperty(THREE.SpotLight.prototype,"power",{get:function(){return this.intensity*Math.PI},set:function(a){this.intensity=a/Math.PI}});THREE.SpotLight.prototype.copy=function(a){THREE.Light.prototype.copy.call(this,a);this.distance=a.distance;this.angle=a.angle;this.penumbra=a.penumbra;this.decay=a.decay;this.target=a.target.clone();this.shadow=a.shadow.clone();return this};
-THREE.Cache={enabled:!1,files:{},add:function(a,b){!1!==this.enabled&&(this.files[a]=b)},get:function(a){if(!1!==this.enabled)return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}};THREE.Loader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
+Object.defineProperty(THREE.SpotLight.prototype,"power",{get:function(){return this.intensity*Math.PI},set:function(a){this.intensity=a/Math.PI}});THREE.SpotLight.prototype.copy=function(a){THREE.Light.prototype.copy.call(this,a);this.distance=a.distance;this.angle=a.angle;this.penumbra=a.penumbra;this.decay=a.decay;this.target=a.target.clone();this.shadow=a.shadow.clone();return this};THREE.AudioLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
+THREE.AudioLoader.prototype={constructor:THREE.AudioLoader,load:function(a,b,c,d){var e=new THREE.XHRLoader(this.manager);e.setResponseType("arraybuffer");e.load(a,function(a){THREE.AudioContext.decodeAudioData(a,function(a){b(a)})},c,d)}};THREE.Cache={enabled:!1,files:{},add:function(a,b){!1!==this.enabled&&(this.files[a]=b)},get:function(a){if(!1!==this.enabled)return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}};
+THREE.Loader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:void 0,extractUrlBase:function(a){a=a.split("/");if(1===a.length)return"./";a.pop();return a.join("/")+"/"},initMaterials:function(a,b,c){for(var d=[],e=0;e<a.length;++e)d[e]=this.createMaterial(a[e],b,c);return d},createMaterial:function(){var a,b,c;return function(d,e,f){function g(a,c,d,g,k){a=e+a;var l=THREE.Loader.Handlers.get(a);null!==l?a=l.load(a):(b.setCrossOrigin(f),a=b.load(a));void 0!==c&&(a.repeat.fromArray(c),1!==c[0]&&(a.wrapS=
 THREE.RepeatWrapping),1!==c[1]&&(a.wrapT=THREE.RepeatWrapping));void 0!==d&&a.offset.fromArray(d);void 0!==g&&("repeat"===g[0]&&(a.wrapS=THREE.RepeatWrapping),"mirror"===g[0]&&(a.wrapS=THREE.MirroredRepeatWrapping),"repeat"===g[1]&&(a.wrapT=THREE.RepeatWrapping),"mirror"===g[1]&&(a.wrapT=THREE.MirroredRepeatWrapping));void 0!==k&&(a.anisotropy=k);c=THREE.Math.generateUUID();h[c]=a;return c}void 0===a&&(a=new THREE.Color);void 0===b&&(b=new THREE.TextureLoader);void 0===c&&(c=new THREE.MaterialLoader);
 var h={},k={uuid:THREE.Math.generateUUID(),type:"MeshLambertMaterial"},l;for(l in d){var n=d[l];switch(l){case "DbgColor":case "DbgIndex":case "opticalDensity":case "illumination":break;case "DbgName":k.name=n;break;case "blending":k.blending=THREE[n];break;case "colorAmbient":case "mapAmbient":console.warn("THREE.Loader.createMaterial:",l,"is no longer supported.");break;case "colorDiffuse":k.color=a.fromArray(n).getHex();break;case "colorSpecular":k.specular=a.fromArray(n).getHex();break;case "colorEmissive":k.emissive=
@@ -384,9 +385,9 @@ 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};
 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),g=new THREE.XHRLoader(this.manager);g.setWithCredentials(this.withCredentials);g.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)},c,d)},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,k,l,n,p,m,q,u,v,s,t,w=a.faces;n=a.vertices;var C=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]=[]}k=0;for(l=n.length;k<l;)d=new THREE.Vector3,d.x=n[k++]*b,d.y=n[k++]*b,d.z=n[k++]*b,c.vertices.push(d);k=0;for(l=w.length;k<l;)if(b=w[k++],q=b&1,h=b&2,d=b&8,p=b&16,u=b&32,n=b&64,b&=128,q){q=new THREE.Face3;q.a=w[k];q.b=w[k+1];q.c=w[k+3];v=new THREE.Face3;v.a=w[k+1];v.b=w[k+2];v.c=w[k+3];k+=
-4;h&&(h=w[k++],q.materialIndex=h,v.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<B;d++)for(s=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],g=0;4>g;g++)m=w[k++],t=s[2*m],m=s[2*m+1],t=new THREE.Vector2(t,m),2!==g&&c.faceVertexUvs[d][h].push(t),0!==g&&c.faceVertexUvs[d][h+1].push(t);p&&(p=3*w[k++],q.normal.set(C[p++],C[p++],C[p]),v.normal.copy(q.normal));if(u)for(d=0;4>d;d++)p=3*w[k++],u=new THREE.Vector3(C[p++],C[p++],C[p]),2!==d&&q.vertexNormals.push(u),0!==d&&v.vertexNormals.push(u);
-n&&(n=w[k++],n=x[n],q.color.setHex(n),v.color.setHex(n));if(b)for(d=0;4>d;d++)n=w[k++],n=x[n],2!==d&&q.vertexColors.push(new THREE.Color(n)),0!==d&&v.vertexColors.push(new THREE.Color(n));c.faces.push(q);c.faces.push(v)}else{q=new THREE.Face3;q.a=w[k++];q.b=w[k++];q.c=w[k++];h&&(h=w[k++],q.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<B;d++)for(s=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;g++)m=w[k++],t=s[2*m],m=s[2*m+1],t=new THREE.Vector2(t,m),c.faceVertexUvs[d][h].push(t);p&&(p=3*w[k++],q.normal.set(C[p++],
+a.scale:1;(function(b){var d,g,h,k,l,n,p,m,q,u,v,t,s,w=a.faces;n=a.vertices;var C=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]=[]}k=0;for(l=n.length;k<l;)d=new THREE.Vector3,d.x=n[k++]*b,d.y=n[k++]*b,d.z=n[k++]*b,c.vertices.push(d);k=0;for(l=w.length;k<l;)if(b=w[k++],q=b&1,h=b&2,d=b&8,p=b&16,u=b&32,n=b&64,b&=128,q){q=new THREE.Face3;q.a=w[k];q.b=w[k+1];q.c=w[k+3];v=new THREE.Face3;v.a=w[k+1];v.b=w[k+2];v.c=w[k+3];k+=
+4;h&&(h=w[k++],q.materialIndex=h,v.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<B;d++)for(t=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],g=0;4>g;g++)m=w[k++],s=t[2*m],m=t[2*m+1],s=new THREE.Vector2(s,m),2!==g&&c.faceVertexUvs[d][h].push(s),0!==g&&c.faceVertexUvs[d][h+1].push(s);p&&(p=3*w[k++],q.normal.set(C[p++],C[p++],C[p]),v.normal.copy(q.normal));if(u)for(d=0;4>d;d++)p=3*w[k++],u=new THREE.Vector3(C[p++],C[p++],C[p]),2!==d&&q.vertexNormals.push(u),0!==d&&v.vertexNormals.push(u);
+n&&(n=w[k++],n=x[n],q.color.setHex(n),v.color.setHex(n));if(b)for(d=0;4>d;d++)n=w[k++],n=x[n],2!==d&&q.vertexColors.push(new THREE.Color(n)),0!==d&&v.vertexColors.push(new THREE.Color(n));c.faces.push(q);c.faces.push(v)}else{q=new THREE.Face3;q.a=w[k++];q.b=w[k++];q.c=w[k++];h&&(h=w[k++],q.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<B;d++)for(t=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;g++)m=w[k++],s=t[2*m],m=t[2*m+1],s=new THREE.Vector2(s,m),c.faceVertexUvs[d][h].push(s);p&&(p=3*w[k++],q.normal.set(C[p++],
 C[p++],C[p]));if(u)for(d=0;3>d;d++)p=3*w[k++],u=new THREE.Vector3(C[p++],C[p++],C[p]),q.vertexNormals.push(u);n&&(n=w[k++],q.color.setHex(x[n]));if(b)for(d=0;3>d;d++)n=w[k++],q.vertexColors.push(new THREE.Color(x[n]));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+") 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,k=a.morphTargets[d].vertices,l=0,n=k.length;l<n;l+=3){var p=new THREE.Vector3;p.x=k[l]*b;p.y=k[l+1]*b;p.z=k[l+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,
@@ -492,11 +493,11 @@ THREE.Line.prototype.clone=function(){return(new this.constructor(this.geometry,
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.MeshBasicMaterial({color:16777215*Math.random()});this.drawMode=THREE.TrianglesDrawMode;this.updateMorphTargets()};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype);THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.setDrawMode=function(a){this.drawMode=a};
 THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var a=0,b=this.geometry.morphTargets.length;a<b;a++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[a].name]=a}};
 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,v);e.multiplyScalar(v.x);f.multiplyScalar(v.y);g.multiplyScalar(v.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;t.copy(g);t.applyMatrix4(a.matrixWorld);c=b.ray.origin.distanceTo(t);return c<b.near||c>b.far?null:{distance:c,point:t.clone(),
-object:a}}function c(c,d,e,f,l,n,p,t){g.fromArray(f,3*n);h.fromArray(f,3*p);k.fromArray(f,3*t);if(c=b(c,d,e,g,h,k,s))l&&(m.fromArray(l,2*n),q.fromArray(l,2*p),u.fromArray(l,2*t),c.uv=a(s,g,h,k,m,q,u)),c.face=new THREE.Face3(n,p,t,THREE.Triangle.normal(g,h,k)),c.faceIndex=n;return c}var d=new THREE.Matrix4,e=new THREE.Ray,f=new THREE.Sphere,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector2,q=new THREE.Vector2,
-u=new THREE.Vector2,v=new THREE.Vector3,s=new THREE.Vector3,t=new THREE.Vector3;return function(t,v){var x=this.geometry,B=this.material,A=this.matrixWorld;if(void 0!==B&&(null===x.boundingSphere&&x.computeBoundingSphere(),f.copy(x.boundingSphere),f.applyMatrix4(A),!1!==t.ray.intersectsSphere(f)&&(d.getInverse(A),e.copy(t.ray).applyMatrix4(d),null===x.boundingBox||!1!==e.intersectsBox(x.boundingBox)))){var z,y;if(x instanceof THREE.BufferGeometry){var F,E,B=x.index,A=x.attributes,x=A.position.array;
-void 0!==A.uv&&(z=A.uv.array);if(null!==B)for(var A=B.array,H=0,K=A.length;H<K;H+=3){if(B=A[H],F=A[H+1],E=A[H+2],y=c(this,t,e,x,z,B,F,E))y.faceIndex=Math.floor(H/3),v.push(y)}else for(H=0,K=x.length;H<K;H+=9)if(B=H/3,F=B+1,E=B+2,y=c(this,t,e,x,z,B,F,E))y.index=B,v.push(y)}else if(x instanceof THREE.Geometry){var G,O,A=B instanceof THREE.MultiMaterial,H=!0===A?B.materials:null,K=x.vertices;F=x.faces;E=x.faceVertexUvs[0];0<E.length&&(z=E);for(var I=0,M=F.length;I<M;I++){var N=F[I];y=!0===A?H[N.materialIndex]:
-B;if(void 0!==y){E=K[N.a];G=K[N.b];O=K[N.c];if(!0===y.morphTargets){y=x.morphTargets;var P=this.morphTargetInfluences;g.set(0,0,0);h.set(0,0,0);k.set(0,0,0);for(var R=0,Q=y.length;R<Q;R++){var L=P[R];if(0!==L){var D=y[R].vertices;g.addScaledVector(l.subVectors(D[N.a],E),L);h.addScaledVector(n.subVectors(D[N.b],G),L);k.addScaledVector(p.subVectors(D[N.c],O),L)}}g.add(E);h.add(G);k.add(O);E=g;G=h;O=k}if(y=b(this,t,e,E,G,O,s))z&&(P=z[I],m.copy(P[0]),q.copy(P[1]),u.copy(P[2]),y.uv=a(s,E,G,O,m,q,u)),y.face=
+THREE.Mesh.prototype.raycast=function(){function a(a,b,c,d,e,f,g){THREE.Triangle.barycoordFromPoint(a,b,c,d,v);e.multiplyScalar(v.x);f.multiplyScalar(v.y);g.multiplyScalar(v.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;s.copy(g);s.applyMatrix4(a.matrixWorld);c=b.ray.origin.distanceTo(s);return c<b.near||c>b.far?null:{distance:c,point:s.clone(),
+object:a}}function c(c,d,e,f,l,n,p,s){g.fromArray(f,3*n);h.fromArray(f,3*p);k.fromArray(f,3*s);if(c=b(c,d,e,g,h,k,t))l&&(m.fromArray(l,2*n),q.fromArray(l,2*p),u.fromArray(l,2*s),c.uv=a(t,g,h,k,m,q,u)),c.face=new THREE.Face3(n,p,s,THREE.Triangle.normal(g,h,k)),c.faceIndex=n;return c}var d=new THREE.Matrix4,e=new THREE.Ray,f=new THREE.Sphere,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector2,q=new THREE.Vector2,
+u=new THREE.Vector2,v=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector3;return function(s,v){var x=this.geometry,B=this.material,A=this.matrixWorld;if(void 0!==B&&(null===x.boundingSphere&&x.computeBoundingSphere(),f.copy(x.boundingSphere),f.applyMatrix4(A),!1!==s.ray.intersectsSphere(f)&&(d.getInverse(A),e.copy(s.ray).applyMatrix4(d),null===x.boundingBox||!1!==e.intersectsBox(x.boundingBox)))){var z,y;if(x instanceof THREE.BufferGeometry){var F,E,B=x.index,A=x.attributes,x=A.position.array;
+void 0!==A.uv&&(z=A.uv.array);if(null!==B)for(var A=B.array,H=0,K=A.length;H<K;H+=3){if(B=A[H],F=A[H+1],E=A[H+2],y=c(this,s,e,x,z,B,F,E))y.faceIndex=Math.floor(H/3),v.push(y)}else for(H=0,K=x.length;H<K;H+=9)if(B=H/3,F=B+1,E=B+2,y=c(this,s,e,x,z,B,F,E))y.index=B,v.push(y)}else if(x instanceof THREE.Geometry){var G,P,A=B instanceof THREE.MultiMaterial,H=!0===A?B.materials:null,K=x.vertices;F=x.faces;E=x.faceVertexUvs[0];0<E.length&&(z=E);for(var I=0,M=F.length;I<M;I++){var N=F[I];y=!0===A?H[N.materialIndex]:
+B;if(void 0!==y){E=K[N.a];G=K[N.b];P=K[N.c];if(!0===y.morphTargets){y=x.morphTargets;var O=this.morphTargetInfluences;g.set(0,0,0);h.set(0,0,0);k.set(0,0,0);for(var R=0,Q=y.length;R<Q;R++){var L=O[R];if(0!==L){var D=y[R].vertices;g.addScaledVector(l.subVectors(D[N.a],E),L);h.addScaledVector(n.subVectors(D[N.b],G),L);k.addScaledVector(p.subVectors(D[N.c],P),L)}}g.add(E);h.add(G);k.add(P);E=g;G=h;P=k}if(y=b(this,s,e,E,G,P,t))z&&(O=z[I],m.copy(O[0]),q.copy(O[1]),u.copy(O[2]),y.uv=a(t,E,G,P,m,q,u)),y.face=
 N,y.faceIndex=I,v.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)):
 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)};
@@ -585,21 +586,21 @@ fragmentShader:THREE.ShaderChunk.meshlambert_frag},phong:{uniforms:THREE.Uniform
 fragmentShader:THREE.ShaderChunk.meshphong_frag},standard:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.aomap,THREE.UniformsLib.lightmap,THREE.UniformsLib.emissivemap,THREE.UniformsLib.bumpmap,THREE.UniformsLib.normalmap,THREE.UniformsLib.displacementmap,THREE.UniformsLib.roughnessmap,THREE.UniformsLib.metalnessmap,THREE.UniformsLib.fog,THREE.UniformsLib.lights,{emissive:{type:"c",value:new THREE.Color(0)},roughness:{type:"1f",value:.5},metalness:{type:"1f",value:0},
 envMapIntensity:{type:"1f",value:1}}]),vertexShader:THREE.ShaderChunk.meshstandard_vert,fragmentShader:THREE.ShaderChunk.meshstandard_frag},points:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.points,THREE.UniformsLib.fog]),vertexShader:THREE.ShaderChunk.points_vert,fragmentShader:THREE.ShaderChunk.points_frag},dashed:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,{scale:{type:"1f",value:1},dashSize:{type:"1f",value:1},totalSize:{type:"1f",value:2}}]),
 vertexShader:THREE.ShaderChunk.linedashed_vert,fragmentShader:THREE.ShaderChunk.linedashed_frag},depth:{uniforms:{mNear:{type:"1f",value:1},mFar:{type:"1f",value:2E3},opacity:{type:"1f",value:1}},vertexShader:THREE.ShaderChunk.depth_vert,fragmentShader:THREE.ShaderChunk.depth_frag},normal:{uniforms:{opacity:{type:"1f",value:1}},vertexShader:THREE.ShaderChunk.normal_vert,fragmentShader:THREE.ShaderChunk.normal_frag},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"1f",value:-1}},vertexShader:THREE.ShaderChunk.cube_vert,
-fragmentShader:THREE.ShaderChunk.cube_frag},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"1f",value:-1}},vertexShader:THREE.ShaderChunk.equirect_vert,fragmentShader:THREE.ShaderChunk.equirect_frag},depthRGBA:{uniforms:{},vertexShader:THREE.ShaderChunk.depthRGBA_vert,fragmentShader:THREE.ShaderChunk.depthRGBA_frag},distanceRGBA:{uniforms:{lightPos:{type:"v3",value:new THREE.Vector3(0,0,0)}},vertexShader:THREE.ShaderChunk.distanceRGBA_vert,fragmentShader:THREE.ShaderChunk.distanceRGBA_frag}};
+fragmentShader:THREE.ShaderChunk.cube_frag},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"1f",value:-1}},vertexShader:THREE.ShaderChunk.equirect_vert,fragmentShader:THREE.ShaderChunk.equirect_frag},depthRGBA:{uniforms:{},vertexShader:THREE.ShaderChunk.depthRGBA_vert,fragmentShader:THREE.ShaderChunk.depthRGBA_frag},distanceRGBA:{uniforms:{lightPos:{type:"v3",value:new THREE.Vector3}},vertexShader:THREE.ShaderChunk.distanceRGBA_vert,fragmentShader:THREE.ShaderChunk.distanceRGBA_frag}};
 THREE.WebGLRenderer=function(a){function b(a,b,c,d){!0===R&&(a*=d,b*=d,c*=d);J.clearColor(a,b,c,d)}function c(){J.init();J.scissor(pa.copy(ya).multiplyScalar(aa));J.viewport(ia.copy(ja).multiplyScalar(aa));b(ba.r,ba.g,ba.b,ga)}function d(){ka=ca=null;la="";qa=-1;J.reset()}function e(a){a.preventDefault();d();c();U.clear()}function f(a){a=a.target;a.removeEventListener("dispose",f);a:{var b=U.get(a);if(a.image&&b.__image__webglTextureCube)r.deleteTexture(b.__image__webglTextureCube);else{if(void 0===
 b.__webglInit)break a;r.deleteTexture(b.__webglTexture)}U.delete(a)}ha.textures--}function g(a){a=a.target;a.removeEventListener("dispose",g);var b=U.get(a),c=U.get(a.texture);if(a&&void 0!==c.__webglTexture){r.deleteTexture(c.__webglTexture);if(a instanceof THREE.WebGLRenderTargetCube)for(c=0;6>c;c++)r.deleteFramebuffer(b.__webglFramebuffer[c]),r.deleteRenderbuffer(b.__webglDepthbuffer[c]);else r.deleteFramebuffer(b.__webglFramebuffer),r.deleteRenderbuffer(b.__webglDepthbuffer);U.delete(a.texture);
 U.delete(a)}ha.textures--}function h(a){a=a.target;a.removeEventListener("dispose",h);k(a);U.delete(a)}function k(a){var b=U.get(a).program;a.program=void 0;void 0!==b&&ma.releaseProgram(b)}function l(a,b){return Math.abs(b[0])-Math.abs(a[0])}function n(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 m(a,b,c,d,e){var f;c.transparent?(d=T,f=++Z):(d=D,f=++W);f=d[f];void 0!==f?(f.id=a.id,f.object=a,f.geometry=b,f.material=c,f.z=X.z,f.group=e):(f={id:a.id,object:a,geometry:b,material:c,z:X.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)L.push(a);else if(a instanceof THREE.Sprite)!1!==a.frustumCulled&&!0!==za.intersectsObject(a)||ea.push(a);else if(a instanceof
 THREE.LensFlare)na.push(a);else if(a instanceof THREE.ImmediateRenderObject)!0===Y.sortObjects&&(X.setFromMatrixPosition(a.matrixWorld),X.applyProjection(ra)),m(a,null,a.material,X.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===za.intersectsObject(a)){var c=a.material;if(!0===c.visible){!0===Y.sortObjects&&(X.setFromMatrixPosition(a.matrixWorld),X.applyProjection(ra));var d=
 oa.update(a);if(c instanceof THREE.MultiMaterial)for(var e=d.groups,f=c.materials,c=0,g=e.length;c<g;c++){var h=e[c],k=f[h.materialIndex];!0===k.visible&&m(a,d,k,X.z,h)}else m(a,d,c,X.z,null)}}d=a.children;c=0;for(g=d.length;c<g;c++)q(d[c],b)}}function u(a,b,c,d){for(var e=0,f=a.length;e<f;e++){var g=a[e],h=g.object,k=g.geometry,l=void 0===d?g.material:d,g=g.group;h.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,h.matrixWorld);h.normalMatrix.getNormalMatrix(h.modelViewMatrix);if(h instanceof
-THREE.ImmediateRenderObject){v(l);var m=s(b,c,l,h);la="";h.render(function(a){Y.renderBufferImmediate(a,m,l)})}else Y.renderBufferDirect(b,c,k,l,h,g)}}function v(a){a.side!==THREE.DoubleSide?J.enable(r.CULL_FACE):J.disable(r.CULL_FACE);J.setFlipSided(a.side===THREE.BackSide);!0===a.transparent?J.setBlending(a.blending,a.blendEquation,a.blendSrc,a.blendDst,a.blendEquationAlpha,a.blendSrcAlpha,a.blendDstAlpha,a.premultipliedAlpha):J.setBlending(THREE.NoBlending);J.setDepthFunc(a.depthFunc);J.setDepthTest(a.depthTest);
-J.setDepthWrite(a.depthWrite);J.setColorWrite(a.colorWrite);J.setPolygonOffset(a.polygonOffset,a.polygonOffsetFactor,a.polygonOffsetUnits)}function s(a,b,c,d){sa=0;var e=U.get(c);void 0===e.program&&(c.needsUpdate=!0);void 0!==e.lightsHash&&e.lightsHash!==S.hash&&(c.needsUpdate=!0);if(c.needsUpdate){a:{var f=U.get(c),g=ma.getParameters(c,S,b,d),l=ma.getProgramCode(c,g),m=f.program,n=!0;if(void 0===m)c.addEventListener("dispose",h);else if(m.code!==l)k(c);else if(void 0!==g.shaderID)break a;else n=
+THREE.ImmediateRenderObject){v(l);var m=t(b,c,l,h);la="";h.render(function(a){Y.renderBufferImmediate(a,m,l)})}else Y.renderBufferDirect(b,c,k,l,h,g)}}function v(a){a.side!==THREE.DoubleSide?J.enable(r.CULL_FACE):J.disable(r.CULL_FACE);J.setFlipSided(a.side===THREE.BackSide);!0===a.transparent?J.setBlending(a.blending,a.blendEquation,a.blendSrc,a.blendDst,a.blendEquationAlpha,a.blendSrcAlpha,a.blendDstAlpha,a.premultipliedAlpha):J.setBlending(THREE.NoBlending);J.setDepthFunc(a.depthFunc);J.setDepthTest(a.depthTest);
+J.setDepthWrite(a.depthWrite);J.setColorWrite(a.colorWrite);J.setPolygonOffset(a.polygonOffset,a.polygonOffsetFactor,a.polygonOffsetUnits)}function t(a,b,c,d){sa=0;var e=U.get(c);void 0===e.program&&(c.needsUpdate=!0);void 0!==e.lightsHash&&e.lightsHash!==S.hash&&(c.needsUpdate=!0);if(c.needsUpdate){a:{var f=U.get(c),g=ma.getParameters(c,S,b,d),l=ma.getProgramCode(c,g),m=f.program,n=!0;if(void 0===m)c.addEventListener("dispose",h);else if(m.code!==l)k(c);else if(void 0!==g.shaderID)break a;else n=
 !1;n&&(g.shaderID?(m=THREE.ShaderLib[g.shaderID],f.__webglShader={name:c.type,uniforms:THREE.UniformsUtils.clone(m.uniforms),vertexShader:m.vertexShader,fragmentShader:m.fragmentShader}):f.__webglShader={name:c.type,uniforms:c.uniforms,vertexShader:c.vertexShader,fragmentShader:c.fragmentShader},c.__webglShader=f.__webglShader,m=ma.acquireProgram(c,g,l),f.program=m,c.program=m);g=m.getAttributes();if(c.morphTargets)for(l=c.numSupportedMorphTargets=0;l<Y.maxMorphTargets;l++)0<=g["morphTarget"+l]&&
 c.numSupportedMorphTargets++;if(c.morphNormals)for(l=c.numSupportedMorphNormals=0;l<Y.maxMorphNormals;l++)0<=g["morphNormal"+l]&&c.numSupportedMorphNormals++;f.uniformsList=[];var g=f.__webglShader.uniforms,l=f.program.getUniforms(),p;for(p in g)(m=l[p])&&f.uniformsList.push([f.__webglShader.uniforms[p],m]);if(c instanceof THREE.MeshPhongMaterial||c instanceof THREE.MeshLambertMaterial||c instanceof THREE.MeshStandardMaterial||c.lights)f.lightsHash=S.hash,g.ambientLightColor.value=S.ambient,g.directionalLights.value=
 S.directional,g.spotLights.value=S.spot,g.pointLights.value=S.point,g.hemisphereLights.value=S.hemi,g.directionalShadowMap.value=S.directionalShadowMap,g.directionalShadowMatrix.value=S.directionalShadowMatrix,g.spotShadowMap.value=S.spotShadowMap,g.spotShadowMatrix.value=S.spotShadowMatrix,g.pointShadowMap.value=S.pointShadowMap,g.pointShadowMatrix.value=S.pointShadowMatrix;f.hasDynamicUniforms=!1;p=0;for(g=f.uniformsList.length;p<g;p++)if(!0===f.uniformsList[p][0].dynamic){f.hasDynamicUniforms=
 !0;break}}c.needsUpdate=!1}m=l=n=!1;f=e.program;p=f.getUniforms();g=e.__webglShader.uniforms;f.id!==ca&&(r.useProgram(f.program),ca=f.id,m=l=n=!0);c.id!==qa&&(qa=c.id,l=!0);if(n||a!==ka)r.uniformMatrix4fv(p.projectionMatrix,!1,a.projectionMatrix.elements),da.logarithmicDepthBuffer&&r.uniform1f(p.logDepthBufFC,2/(Math.log(a.far+1)/Math.LN2)),a!==ka&&(ka=a,m=l=!0),(c instanceof THREE.ShaderMaterial||c instanceof THREE.MeshPhongMaterial||c instanceof THREE.MeshStandardMaterial||c.envMap)&&void 0!==p.cameraPosition&&
 (X.setFromMatrixPosition(a.matrixWorld),r.uniform3f(p.cameraPosition,X.x,X.y,X.z)),(c instanceof THREE.MeshPhongMaterial||c instanceof THREE.MeshLambertMaterial||c instanceof THREE.MeshBasicMaterial||c instanceof THREE.MeshStandardMaterial||c instanceof THREE.ShaderMaterial||c.skinning)&&void 0!==p.viewMatrix&&r.uniformMatrix4fv(p.viewMatrix,!1,a.matrixWorldInverse.elements),void 0!==p.toneMappingExposure&&r.uniform1f(p.toneMappingExposure,Y.toneMappingExposure),void 0!==p.toneMappingWhitePoint&&
-r.uniform1f(p.toneMappingWhitePoint,Y.toneMappingWhitePoint);c.skinning&&(d.bindMatrix&&void 0!==p.bindMatrix&&r.uniformMatrix4fv(p.bindMatrix,!1,d.bindMatrix.elements),d.bindMatrixInverse&&void 0!==p.bindMatrixInverse&&r.uniformMatrix4fv(p.bindMatrixInverse,!1,d.bindMatrixInverse.elements),da.floatVertexTextures&&d.skeleton&&d.skeleton.useVertexTexture?(void 0!==p.boneTexture&&(n=t(),r.uniform1i(p.boneTexture,n),Y.setTexture(d.skeleton.boneTexture,n)),void 0!==p.boneTextureWidth&&r.uniform1i(p.boneTextureWidth,
+r.uniform1f(p.toneMappingWhitePoint,Y.toneMappingWhitePoint);c.skinning&&(d.bindMatrix&&void 0!==p.bindMatrix&&r.uniformMatrix4fv(p.bindMatrix,!1,d.bindMatrix.elements),d.bindMatrixInverse&&void 0!==p.bindMatrixInverse&&r.uniformMatrix4fv(p.bindMatrixInverse,!1,d.bindMatrixInverse.elements),da.floatVertexTextures&&d.skeleton&&d.skeleton.useVertexTexture?(void 0!==p.boneTexture&&(n=s(),r.uniform1i(p.boneTexture,n),Y.setTexture(d.skeleton.boneTexture,n)),void 0!==p.boneTextureWidth&&r.uniform1i(p.boneTextureWidth,
 d.skeleton.boneTextureWidth),void 0!==p.boneTextureHeight&&r.uniform1i(p.boneTextureHeight,d.skeleton.boneTextureHeight)):d.skeleton&&d.skeleton.boneMatrices&&void 0!==p.boneGlobalMatrices&&r.uniformMatrix4fv(p.boneGlobalMatrices,!1,d.skeleton.boneMatrices));if(l){if(c instanceof THREE.MeshPhongMaterial||c instanceof THREE.MeshLambertMaterial||c instanceof THREE.MeshStandardMaterial||c.lights)l=m,g.ambientLightColor.needsUpdate=l,g.directionalLights.needsUpdate=l,g.pointLights.needsUpdate=l,g.spotLights.needsUpdate=
 l,g.hemisphereLights.needsUpdate=l;b&&c.fog&&(g.fogColor.value=b.color,b instanceof THREE.Fog?(g.fogNear.value=b.near,g.fogFar.value=b.far):b instanceof THREE.FogExp2&&(g.fogDensity.value=b.density));if(c instanceof THREE.MeshBasicMaterial||c instanceof THREE.MeshLambertMaterial||c instanceof THREE.MeshPhongMaterial||c instanceof THREE.MeshStandardMaterial){g.opacity.value=c.opacity;g.diffuse.value=c.color;c.emissive&&g.emissive.value.copy(c.emissive).multiplyScalar(c.emissiveIntensity);g.map.value=
 c.map;g.specularMap.value=c.specularMap;g.alphaMap.value=c.alphaMap;c.aoMap&&(g.aoMap.value=c.aoMap,g.aoMapIntensity.value=c.aoMapIntensity);var q;c.map?q=c.map:c.specularMap?q=c.specularMap:c.displacementMap?q=c.displacementMap:c.normalMap?q=c.normalMap:c.bumpMap?q=c.bumpMap:c.roughnessMap?q=c.roughnessMap:c.metalnessMap?q=c.metalnessMap:c.alphaMap?q=c.alphaMap:c.emissiveMap&&(q=c.emissiveMap);void 0!==q&&(q instanceof THREE.WebGLRenderTarget&&(q=q.texture),b=q.offset,q=q.repeat,g.offsetRepeat.value.set(b.x,
@@ -608,54 +609,53 @@ c.color,g.opacity.value=c.opacity,g.size.value=c.size*aa,g.scale.value=G.clientH
 c.lightMap,g.lightMapIntensity.value=c.lightMapIntensity),c.emissiveMap&&(g.emissiveMap.value=c.emissiveMap),c.bumpMap&&(g.bumpMap.value=c.bumpMap,g.bumpScale.value=c.bumpScale),c.normalMap&&(g.normalMap.value=c.normalMap,g.normalScale.value.copy(c.normalScale)),c.displacementMap&&(g.displacementMap.value=c.displacementMap,g.displacementScale.value=c.displacementScale,g.displacementBias.value=c.displacementBias)):c instanceof THREE.MeshStandardMaterial?(g.roughness.value=c.roughness,g.metalness.value=
 c.metalness,c.roughnessMap&&(g.roughnessMap.value=c.roughnessMap),c.metalnessMap&&(g.metalnessMap.value=c.metalnessMap),c.lightMap&&(g.lightMap.value=c.lightMap,g.lightMapIntensity.value=c.lightMapIntensity),c.emissiveMap&&(g.emissiveMap.value=c.emissiveMap),c.bumpMap&&(g.bumpMap.value=c.bumpMap,g.bumpScale.value=c.bumpScale),c.normalMap&&(g.normalMap.value=c.normalMap,g.normalScale.value.copy(c.normalScale)),c.displacementMap&&(g.displacementMap.value=c.displacementMap,g.displacementScale.value=
 c.displacementScale,g.displacementBias.value=c.displacementBias),c.envMap&&(g.envMapIntensity.value=c.envMapIntensity)):c instanceof THREE.MeshDepthMaterial?(g.mNear.value=a.near,g.mFar.value=a.far,g.opacity.value=c.opacity):c instanceof THREE.MeshNormalMaterial&&(g.opacity.value=c.opacity);C(e.uniformsList)}r.uniformMatrix4fv(p.modelViewMatrix,!1,d.modelViewMatrix.elements);p.normalMatrix&&r.uniformMatrix3fv(p.normalMatrix,!1,d.normalMatrix.elements);void 0!==p.modelMatrix&&r.uniformMatrix4fv(p.modelMatrix,
-!1,d.matrixWorld.elements);if(!0===e.hasDynamicUniforms){e=e.uniformsList;c=[];q=0;for(b=e.length;q<b;q++)p=e[q][0],g=p.onUpdateCallback,void 0!==g&&(g.bind(p)(d,a),c.push(e[q]));C(c)}return f}function t(){var a=sa;a>=da.maxTextures&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+da.maxTextures);sa+=1;return a}function w(a,b,c,d){var e;if("1i"===b)r.uniform1i(c,d);else if("1f"===b)r.uniform1f(c,d);else if("2f"===b)r.uniform2f(c,d[0],d[1]);else if("3f"===
-b)r.uniform3f(c,d[0],d[1],d[2]);else if("4f"===b)r.uniform4f(c,d[0],d[1],d[2],d[3]);else if("1iv"===b)r.uniform1iv(c,d);else if("3iv"===b)r.uniform3iv(c,d);else if("1fv"===b)r.uniform1fv(c,d);else if("2fv"===b)r.uniform2fv(c,d);else if("3fv"===b)r.uniform3fv(c,d);else if("4fv"===b)r.uniform4fv(c,d);else if("Matrix2fv"===b)r.uniformMatrix2fv(c,!1,d);else if("Matrix3fv"===b)r.uniformMatrix3fv(c,!1,d);else if("Matrix4fv"===b)r.uniformMatrix4fv(c,!1,d);else if("i"===b)console.warn('THREE.WebGLRenderer: Uniform "i" is now "1i".'),
-r.uniform1i(c,d);else if("f"===b)console.warn('THREE.WebGLRenderer: Uniform "f" is now "1f".'),r.uniform1f(c,d);else if("v2"===b)r.uniform2f(c,d.x,d.y);else if("v3"===b)r.uniform3f(c,d.x,d.y,d.z);else if("v4"===b)r.uniform4f(c,d.x,d.y,d.z,d.w);else if("c"===b)r.uniform3f(c,d.r,d.g,d.b);else if("s"===b){a=a.properties;for(var g in a){e=a[g];var f=c[g],h=d[g];w(e,e.type,f,h)}}else if("sa"===b){a=a.properties;b=0;for(var k=d.length;b<k;b++)for(g in a)e=a[g],f=c[b][g],h=d[b][g],w(e,e.type,f,h)}else if("iv1"===
-b)console.warn('THREE.WebGLRenderer: Uniform "iv1" is now "1iv".'),r.uniform1iv(c,d);else if("iv"===b)console.warn('THREE.WebGLRenderer: Uniform "iv" is now "3iv".'),r.uniform3iv(c,d);else if("fv1"===b)console.warn('THREE.WebGLRenderer: Uniform "fv1" is now "1fv".'),r.uniform1fv(c,d);else if("fv"===b)console.warn('THREE.WebGLRenderer: Uniform "fv" is now "3fv".'),r.uniform3fv(c,d);else if("v2v"===b){void 0===a._array&&(a._array=new Float32Array(2*d.length));e=b=0;for(g=d.length;b<g;b++,e+=2)a._array[e+
-0]=d[b].x,a._array[e+1]=d[b].y;r.uniform2fv(c,a._array)}else if("v3v"===b){void 0===a._array&&(a._array=new Float32Array(3*d.length));e=b=0;for(g=d.length;b<g;b++,e+=3)a._array[e+0]=d[b].x,a._array[e+1]=d[b].y,a._array[e+2]=d[b].z;r.uniform3fv(c,a._array)}else if("v4v"===b){void 0===a._array&&(a._array=new Float32Array(4*d.length));e=b=0;for(g=d.length;b<g;b++,e+=4)a._array[e+0]=d[b].x,a._array[e+1]=d[b].y,a._array[e+2]=d[b].z,a._array[e+3]=d[b].w;r.uniform4fv(c,a._array)}else if("m2"===b)r.uniformMatrix2fv(c,
-!1,d.elements);else if("m3"===b)r.uniformMatrix3fv(c,!1,d.elements);else if("m3v"===b){void 0===a._array&&(a._array=new Float32Array(9*d.length));b=0;for(g=d.length;b<g;b++)d[b].flattenToArrayOffset(a._array,9*b);r.uniformMatrix3fv(c,!1,a._array)}else if("m4"===b)r.uniformMatrix4fv(c,!1,d.elements);else if("m4v"===b){void 0===a._array&&(a._array=new Float32Array(16*d.length));b=0;for(g=d.length;b<g;b++)d[b].flattenToArrayOffset(a._array,16*b);r.uniformMatrix4fv(c,!1,a._array)}else if("t"===b)e=t(),
-r.uniform1i(c,e),d&&(d instanceof THREE.CubeTexture||Array.isArray(d.image)&&6===d.image.length?z(d,e):d instanceof THREE.WebGLRenderTargetCube?y(d.texture,e):d instanceof THREE.WebGLRenderTarget?Y.setTexture(d.texture,e):Y.setTexture(d,e));else if("tv"===b){void 0===a._array&&(a._array=[]);b=0;for(g=a.value.length;b<g;b++)a._array[b]=t();r.uniform1iv(c,a._array);b=0;for(g=a.value.length;b<g;b++)d=a.value[b],e=a._array[b],d&&(d instanceof THREE.CubeTexture||d.image instanceof Array&&6===d.image.length?
-z(d,e):d instanceof THREE.WebGLRenderTarget?Y.setTexture(d.texture,e):d instanceof THREE.WebGLRenderTargetCube?y(d.texture,e):Y.setTexture(d,e))}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+b)}function C(a){for(var b=0,c=a.length;b<c;b++){var d=a[b][0];!1!==d.needsUpdate&&w(d,d.type,a[b][1],d.value)}}function x(a,b,c){c?(r.texParameteri(a,r.TEXTURE_WRAP_S,K(b.wrapS)),r.texParameteri(a,r.TEXTURE_WRAP_T,K(b.wrapT)),r.texParameteri(a,r.TEXTURE_MAG_FILTER,K(b.magFilter)),r.texParameteri(a,
-r.TEXTURE_MIN_FILTER,K(b.minFilter))):(r.texParameteri(a,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(a,r.TEXTURE_WRAP_T,r.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),r.texParameteri(a,r.TEXTURE_MAG_FILTER,H(b.magFilter)),r.texParameteri(a,r.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=V.get("EXT_texture_filter_anisotropic"))||b.type===THREE.FloatType&&null===V.get("OES_texture_float_linear")||b.type===THREE.HalfFloatType&&null===V.get("OES_texture_half_float_linear")||!(1<b.anisotropy||U.get(b).__currentAnisotropy)||(r.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Y.getMaxAnisotropy())),
-U.get(b).__currentAnisotropy=b.anisotropy)}function B(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 A(a){return THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height)}
-function z(a,b){var c=U.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=r.createTexture(),ha.textures++);J.activeTexture(r.TEXTURE0+b);J.bindTexture(r.TEXTURE_CUBE_MAP,c.__image__webglTextureCube);r.pixelStorei(r.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]=!Y.autoScaleCubemaps||d||e?e?a.image[h].image:
-a.image[h]:B(a.image[h],da.maxCubemapSize);var k=A(g[0]),l=K(a.format),m=K(a.type);x(r.TEXTURE_CUBE_MAP,a,k);for(h=0;6>h;h++)if(d)for(var p,n=g[h].mipmaps,q=0,t=n.length;q<t;q++)p=n[q],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<J.getCompressedTextureFormats().indexOf(l)?J.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+h,q,l,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):J.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+
-h,q,l,p.width,p.height,0,l,m,p.data);else e?J.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,l,g[h].width,g[h].height,0,l,m,g[h].data):J.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,l,l,m,g[h]);a.generateMipmaps&&k&&r.generateMipmap(r.TEXTURE_CUBE_MAP);c.__version=a.version;if(a.onUpdate)a.onUpdate(a)}else J.activeTexture(r.TEXTURE0+b),J.bindTexture(r.TEXTURE_CUBE_MAP,c.__image__webglTextureCube)}function y(a,b){J.activeTexture(r.TEXTURE0+b);J.bindTexture(r.TEXTURE_CUBE_MAP,U.get(a).__webglTexture)}
-function F(a,b,c,d){var e=K(b.texture.format),g=K(b.texture.type);J.texImage2D(d,0,e,b.width,b.height,0,e,g,null);r.bindFramebuffer(r.FRAMEBUFFER,a);r.framebufferTexture2D(r.FRAMEBUFFER,c,d,U.get(b.texture).__webglTexture,0);r.bindFramebuffer(r.FRAMEBUFFER,null)}function E(a,b){r.bindRenderbuffer(r.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_COMPONENT16,b.width,b.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,a)):
-b.depthBuffer&&b.stencilBuffer?(r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,b.width,b.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,a)):r.renderbufferStorage(r.RENDERBUFFER,r.RGBA4,b.width,b.height);r.bindRenderbuffer(r.RENDERBUFFER,null)}function H(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?r.NEAREST:r.LINEAR}function K(a){var b;if(a===THREE.RepeatWrapping)return r.REPEAT;if(a===
-THREE.ClampToEdgeWrapping)return r.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return r.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return r.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return r.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return r.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return r.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return r.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return r.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return r.UNSIGNED_BYTE;
-if(a===THREE.UnsignedShort4444Type)return r.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return r.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return r.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return r.BYTE;if(a===THREE.ShortType)return r.SHORT;if(a===THREE.UnsignedShortType)return r.UNSIGNED_SHORT;if(a===THREE.IntType)return r.INT;if(a===THREE.UnsignedIntType)return r.UNSIGNED_INT;if(a===THREE.FloatType)return r.FLOAT;b=V.get("OES_texture_half_float");if(null!==b&&a===
-THREE.HalfFloatType)return b.HALF_FLOAT_OES;if(a===THREE.AlphaFormat)return r.ALPHA;if(a===THREE.RGBFormat)return r.RGB;if(a===THREE.RGBAFormat)return r.RGBA;if(a===THREE.LuminanceFormat)return r.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return r.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return r.FUNC_ADD;if(a===THREE.SubtractEquation)return r.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return r.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return r.ZERO;if(a===THREE.OneFactor)return r.ONE;
-if(a===THREE.SrcColorFactor)return r.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return r.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return r.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return r.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return r.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return r.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return r.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return r.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return r.SRC_ALPHA_SATURATE;
-b=V.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=V.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=V.get("WEBGL_compressed_texture_etc1");if(null!==b&&a===THREE.RGB_ETC1_Format)return b.COMPRESSED_RGB_ETC1_WEBGL;b=V.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 G=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
-O=void 0!==a.context?a.context:null,I=void 0!==a.alpha?a.alpha:!1,M=void 0!==a.depth?a.depth:!0,N=void 0!==a.stencil?a.stencil:!0,P=void 0!==a.antialias?a.antialias:!1,R=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,Q=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,L=[],D=[],W=-1,T=[],Z=-1,$=new Float32Array(8),ea=[],na=[];this.domElement=G;this.context=null;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.gammaFactor=2;this.physicallyCorrectLights=
-this.gammaOutput=this.gammaInput=!1;this.toneMapping=THREE.LinearToneMapping;this.toneMappingWhitePoint=this.toneMappingExposure=1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;var Y=this,ca=null,ta=null,ua=null,qa=-1,la="",ka=null,pa=new THREE.Vector4,Aa=null,ia=new THREE.Vector4,sa=0,ba=new THREE.Color(0),ga=0,va=G.width,wa=G.height,aa=1,ya=new THREE.Vector4(0,0,va,wa),Ba=!1,ja=new THREE.Vector4(0,0,va,wa),za=new THREE.Frustum,ra=new THREE.Matrix4,X=new THREE.Vector3,S=
-{hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},ha={geometries:0,textures:0},fa={calls:0,vertices:0,faces:0,points:0};this.info={render:fa,memory:ha,programs:null};var r;try{I={alpha:I,depth:M,stencil:N,antialias:P,premultipliedAlpha:R,preserveDrawingBuffer:Q};r=O||G.getContext("webgl",I)||G.getContext("experimental-webgl",I);if(null===r){if(null!==
-G.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";}void 0===r.getShaderPrecisionFormat&&(r.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});G.addEventListener("webglcontextlost",e,!1)}catch(Da){console.error("THREE.WebGLRenderer: "+Da)}var V=new THREE.WebGLExtensions(r);V.get("OES_texture_float");V.get("OES_texture_float_linear");V.get("OES_texture_half_float");V.get("OES_texture_half_float_linear");
-V.get("OES_standard_derivatives");V.get("ANGLE_instanced_arrays");V.get("OES_element_index_uint")&&(THREE.BufferGeometry.MaxIndex=4294967296);var da=new THREE.WebGLCapabilities(r,V,a),J=new THREE.WebGLState(r,V,K),U=new THREE.WebGLProperties,oa=new THREE.WebGLObjects(r,U,this.info),ma=new THREE.WebGLPrograms(this,da),xa=new THREE.WebGLLights;this.info.programs=ma.programs;var Ea=new THREE.WebGLBufferRenderer(r,V,fa),Fa=new THREE.WebGLIndexedBufferRenderer(r,V,fa);c();this.context=r;this.capabilities=
-da;this.extensions=V;this.properties=U;this.state=J;var Ca=new THREE.WebGLShadowMap(this,S,oa);this.shadowMap=Ca;var Ga=new THREE.SpritePlugin(this,ea),Ha=new THREE.LensFlarePlugin(this,na);this.getContext=function(){return r};this.getContextAttributes=function(){return r.getContextAttributes()};this.forceContextLoss=function(){V.get("WEBGL_lose_context").loseContext()};this.getMaxAnisotropy=function(){var a;return function(){if(void 0!==a)return a;var b=V.get("EXT_texture_filter_anisotropic");return a=
-null!==b?r.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}();this.getPrecision=function(){return da.precision};this.getPixelRatio=function(){return aa};this.setPixelRatio=function(a){void 0!==a&&(aa=a,this.setSize(ja.z,ja.w,!1))};this.getSize=function(){return{width:va,height:wa}};this.setSize=function(a,b,c){va=a;wa=b;G.width=a*aa;G.height=b*aa;!1!==c&&(G.style.width=a+"px",G.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){J.viewport(ja.set(a,b,c,d))};this.setScissor=
-function(a,b,c,d){J.scissor(ya.set(a,b,c,d))};this.setScissorTest=function(a){J.setScissorTest(Ba=a)};this.getClearColor=function(){return ba};this.setClearColor=function(a,c){ba.set(a);ga=void 0!==c?c:1;b(ba.r,ba.g,ba.b,ga)};this.getClearAlpha=function(){return ga};this.setClearAlpha=function(a){ga=a;b(ba.r,ba.g,ba.b,ga)};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=r.COLOR_BUFFER_BIT;if(void 0===b||b)d|=r.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=r.STENCIL_BUFFER_BIT;r.clear(d)};this.clearColor=
-function(){this.clear(!0,!1,!1)};this.clearDepth=function(){this.clear(!1,!0,!1)};this.clearStencil=function(){this.clear(!1,!1,!0)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.resetGLState=d;this.dispose=function(){G.removeEventListener("webglcontextlost",e,!1)};this.renderBufferImmediate=function(a,b,c){J.initAttributes();var d=U.get(a);a.hasPositions&&!d.position&&(d.position=r.createBuffer());a.hasNormals&&!d.normal&&(d.normal=r.createBuffer());a.hasUvs&&
-!d.uv&&(d.uv=r.createBuffer());a.hasColors&&!d.color&&(d.color=r.createBuffer());b=b.getAttributes();a.hasPositions&&(r.bindBuffer(r.ARRAY_BUFFER,d.position),r.bufferData(r.ARRAY_BUFFER,a.positionArray,r.DYNAMIC_DRAW),J.enableAttribute(b.position),r.vertexAttribPointer(b.position,3,r.FLOAT,!1,0,0));if(a.hasNormals){r.bindBuffer(r.ARRAY_BUFFER,d.normal);if("MeshPhongMaterial"!==c.type&&"MeshStandardMaterial"!==c.type&&c.shading===THREE.FlatShading)for(var e=0,g=3*a.count;e<g;e+=9){var f=a.normalArray,
-h=(f[e+0]+f[e+3]+f[e+6])/3,k=(f[e+1]+f[e+4]+f[e+7])/3,l=(f[e+2]+f[e+5]+f[e+8])/3;f[e+0]=h;f[e+1]=k;f[e+2]=l;f[e+3]=h;f[e+4]=k;f[e+5]=l;f[e+6]=h;f[e+7]=k;f[e+8]=l}r.bufferData(r.ARRAY_BUFFER,a.normalArray,r.DYNAMIC_DRAW);J.enableAttribute(b.normal);r.vertexAttribPointer(b.normal,3,r.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(r.bindBuffer(r.ARRAY_BUFFER,d.uv),r.bufferData(r.ARRAY_BUFFER,a.uvArray,r.DYNAMIC_DRAW),J.enableAttribute(b.uv),r.vertexAttribPointer(b.uv,2,r.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==
-THREE.NoColors&&(r.bindBuffer(r.ARRAY_BUFFER,d.color),r.bufferData(r.ARRAY_BUFFER,a.colorArray,r.DYNAMIC_DRAW),J.enableAttribute(b.color),r.vertexAttribPointer(b.color,3,r.FLOAT,!1,0,0));J.disableUnusedAttributes();r.drawArrays(r.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,g){v(d);var f=s(a,b,d,e),h=!1;a=c.id+"_"+f.id+"_"+d.wireframe;a!==la&&(la=a,h=!0);b=e.morphTargetInfluences;if(void 0!==b){a=[];for(var k=0,h=b.length;k<h;k++){var m=b[k];a.push([m,k])}a.sort(l);8<
-a.length&&(a.length=8);for(var p=c.morphAttributes,k=0,h=a.length;k<h;k++)m=a[k],$[k]=m[0],0!==m[0]?(b=m[1],!0===d.morphTargets&&p.position&&c.addAttribute("morphTarget"+k,p.position[b]),!0===d.morphNormals&&p.normal&&c.addAttribute("morphNormal"+k,p.normal[b])):(!0===d.morphTargets&&c.removeAttribute("morphTarget"+k),!0===d.morphNormals&&c.removeAttribute("morphNormal"+k));a=f.getUniforms();null!==a.morphTargetInfluences&&r.uniform1fv(a.morphTargetInfluences,$);h=!0}b=c.index;k=c.attributes.position;
-!0===d.wireframe&&(b=oa.getWireframeAttribute(c));null!==b?(a=Fa,a.setIndex(b)):a=Ea;if(h){a:{var h=void 0,n;if(c instanceof THREE.InstancedBufferGeometry&&(n=V.get("ANGLE_instanced_arrays"),null===n)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}void 0===h&&(h=0);J.initAttributes();var m=c.attributes,f=f.getAttributes(),p=d.defaultAttributeValues,q;for(q in f){var t=f[q];if(0<=
-t){var u=m[q];if(void 0!==u){var w=u.itemSize,x=oa.getAttributeBuffer(u);if(u instanceof THREE.InterleavedBufferAttribute){var C=u.data,A=C.stride,u=u.offset;C instanceof THREE.InstancedInterleavedBuffer?(J.enableAttributeAndDivisor(t,C.meshPerAttribute,n),void 0===c.maxInstancedCount&&(c.maxInstancedCount=C.meshPerAttribute*C.count)):J.enableAttribute(t);r.bindBuffer(r.ARRAY_BUFFER,x);r.vertexAttribPointer(t,w,r.FLOAT,!1,A*C.array.BYTES_PER_ELEMENT,(h*A+u)*C.array.BYTES_PER_ELEMENT)}else u instanceof
-THREE.InstancedBufferAttribute?(J.enableAttributeAndDivisor(t,u.meshPerAttribute,n),void 0===c.maxInstancedCount&&(c.maxInstancedCount=u.meshPerAttribute*u.count)):J.enableAttribute(t),r.bindBuffer(r.ARRAY_BUFFER,x),r.vertexAttribPointer(t,w,r.FLOAT,!1,0,h*w*4)}else if(void 0!==p&&(w=p[q],void 0!==w))switch(w.length){case 2:r.vertexAttrib2fv(t,w);break;case 3:r.vertexAttrib3fv(t,w);break;case 4:r.vertexAttrib4fv(t,w);break;default:r.vertexAttrib1fv(t,w)}}}J.disableUnusedAttributes()}null!==b&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,
-oa.getAttributeBuffer(b))}n=Infinity;null!==b?n=b.count:void 0!==k&&(n=k.count);q=c.drawRange.start;b=c.drawRange.count;k=null!==g?g.start:0;h=null!==g?g.count:Infinity;g=Math.max(0,q,k);n=Math.min(0+n,q+b,k+h)-1;n=Math.max(0,n-g+1);if(e instanceof THREE.Mesh)if(!0===d.wireframe)J.setLineWidth(d.wireframeLinewidth*(null===ta?aa:1)),a.setMode(r.LINES);else switch(e.drawMode){case THREE.TrianglesDrawMode:a.setMode(r.TRIANGLES);break;case THREE.TriangleStripDrawMode:a.setMode(r.TRIANGLE_STRIP);break;
-case THREE.TriangleFanDrawMode:a.setMode(r.TRIANGLE_FAN)}else e instanceof THREE.Line?(d=d.linewidth,void 0===d&&(d=1),J.setLineWidth(d*(null===ta?aa:1)),e instanceof THREE.LineSegments?a.setMode(r.LINES):a.setMode(r.LINE_STRIP)):e instanceof THREE.Points&&a.setMode(r.POINTS);c instanceof THREE.InstancedBufferGeometry?0<c.maxInstancedCount&&a.renderInstances(c,g,n):a.render(g,n)};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;la="";qa=-1;ka=null;!0===a.autoUpdate&&a.updateMatrixWorld();null===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);ra.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);za.setFromMatrix(ra);L.length=0;Z=W=-1;ea.length=0;na.length=0;q(a,b);D.length=W+1;T.length=Z+1;!0===Y.sortObjects&&(D.sort(n),T.sort(p));for(var g=L,f=0,h=0,k=g.length;h<k;h++){var l=g[h];l.castShadow&&(S.shadows[f++]=l)}S.shadows.length=f;Ca.render(a,b);for(var g=L,m=l=0,t=
-0,s,v,w,x=b.matrixWorldInverse,C=0,$=0,z=0,B=0,f=0,h=g.length;f<h;f++)if(k=g[f],s=k.color,v=k.intensity,w=k.distance,k instanceof THREE.AmbientLight)l+=s.r*v,m+=s.g*v,t+=s.b*v;else if(k instanceof THREE.DirectionalLight){var y=xa.get(k);y.color.copy(k.color).multiplyScalar(k.intensity);y.direction.setFromMatrixPosition(k.matrixWorld);X.setFromMatrixPosition(k.target.matrixWorld);y.direction.sub(X);y.direction.transformDirection(x);if(y.shadow=k.castShadow)y.shadowBias=k.shadow.bias,y.shadowRadius=
-k.shadow.radius,y.shadowMapSize=k.shadow.mapSize;S.directionalShadowMap[C]=k.shadow.map;S.directionalShadowMatrix[C]=k.shadow.matrix;S.directional[C++]=y}else if(k instanceof THREE.SpotLight){y=xa.get(k);y.position.setFromMatrixPosition(k.matrixWorld);y.position.applyMatrix4(x);y.color.copy(s).multiplyScalar(v);y.distance=w;y.direction.setFromMatrixPosition(k.matrixWorld);X.setFromMatrixPosition(k.target.matrixWorld);y.direction.sub(X);y.direction.transformDirection(x);y.coneCos=Math.cos(k.angle);
-y.penumbraCos=Math.cos(k.angle*(1-k.penumbra));y.decay=0===k.distance?0:k.decay;if(y.shadow=k.castShadow)y.shadowBias=k.shadow.bias,y.shadowRadius=k.shadow.radius,y.shadowMapSize=k.shadow.mapSize;S.spotShadowMap[z]=k.shadow.map;S.spotShadowMatrix[z]=k.shadow.matrix;S.spot[z++]=y}else if(k instanceof THREE.PointLight){y=xa.get(k);y.position.setFromMatrixPosition(k.matrixWorld);y.position.applyMatrix4(x);y.color.copy(k.color).multiplyScalar(k.intensity);y.distance=k.distance;y.decay=0===k.distance?
-0:k.decay;if(y.shadow=k.castShadow)y.shadowBias=k.shadow.bias,y.shadowRadius=k.shadow.radius,y.shadowMapSize=k.shadow.mapSize;S.pointShadowMap[$]=k.shadow.map;void 0===S.pointShadowMatrix[$]&&(S.pointShadowMatrix[$]=new THREE.Matrix4);X.setFromMatrixPosition(k.matrixWorld).negate();S.pointShadowMatrix[$].identity().setPosition(X);S.point[$++]=y}else k instanceof THREE.HemisphereLight&&(y=xa.get(k),y.direction.setFromMatrixPosition(k.matrixWorld),y.direction.transformDirection(x),y.direction.normalize(),
-y.skyColor.copy(k.color).multiplyScalar(v),y.groundColor.copy(k.groundColor).multiplyScalar(v),S.hemi[B++]=y);S.ambient[0]=l;S.ambient[1]=m;S.ambient[2]=t;S.directional.length=C;S.spot.length=z;S.point.length=$;S.hemi.length=B;S.hash=C+","+$+","+z+","+B+","+S.shadows.length;fa.calls=0;fa.vertices=0;fa.faces=0;fa.points=0;void 0===c&&(c=null);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);a.overrideMaterial?(d=a.overrideMaterial,
-u(D,b,e,d),u(T,b,e,d)):(J.setBlending(THREE.NoBlending),u(D,b,e),u(T,b,e));Ga.render(a,b);Ha.render(a,b,ia);c&&(a=c.texture,a.generateMipmaps&&A(c)&&a.minFilter!==THREE.NearestFilter&&a.minFilter!==THREE.LinearFilter&&(a=c instanceof THREE.WebGLRenderTargetCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,c=U.get(c.texture).__webglTexture,J.bindTexture(a,c),r.generateMipmap(a),J.bindTexture(a,null)));J.setDepthTest(!0);J.setDepthWrite(!0);J.setColorWrite(!0)}};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?
-J.disable(r.CULL_FACE):(b===THREE.FrontFaceDirectionCW?r.frontFace(r.CW):r.frontFace(r.CCW),a===THREE.CullFaceBack?r.cullFace(r.BACK):a===THREE.CullFaceFront?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK),J.enable(r.CULL_FACE))};this.setTexture=function(a,b){var c=U.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",
+!1,d.matrixWorld.elements);if(!0===e.hasDynamicUniforms){e=e.uniformsList;c=[];q=0;for(b=e.length;q<b;q++)p=e[q][0],g=p.onUpdateCallback,void 0!==g&&(g.bind(p)(d,a),c.push(e[q]));C(c)}return f}function s(){var a=sa;a>=da.maxTextures&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+da.maxTextures);sa+=1;return a}function w(a,b,c,d){var e;if("1i"===b)r.uniform1i(c,d);else if("1f"===b)r.uniform1f(c,d);else if("2f"===b)r.uniform2f(c,d[0],d[1]);else if("3f"===
+b)r.uniform3f(c,d[0],d[1],d[2]);else if("4f"===b)r.uniform4f(c,d[0],d[1],d[2],d[3]);else if("1iv"===b)r.uniform1iv(c,d);else if("3iv"===b)r.uniform3iv(c,d);else if("1fv"===b)r.uniform1fv(c,d);else if("2fv"===b)r.uniform2fv(c,d);else if("3fv"===b)r.uniform3fv(c,d);else if("4fv"===b)r.uniform4fv(c,d);else if("Matrix2fv"===b)r.uniformMatrix2fv(c,!1,d);else if("Matrix3fv"===b)r.uniformMatrix3fv(c,!1,d);else if("Matrix4fv"===b)r.uniformMatrix4fv(c,!1,d);else if("i"===b)r.uniform1i(c,d);else if("f"===b)r.uniform1f(c,
+d);else if("iv1"===b)r.uniform1iv(c,d);else if("iv"===b)r.uniform3iv(c,d);else if("fv1"===b)r.uniform1fv(c,d);else if("fv"===b)r.uniform3fv(c,d);else if("v2"===b)r.uniform2f(c,d.x,d.y);else if("v3"===b)r.uniform3f(c,d.x,d.y,d.z);else if("v4"===b)r.uniform4f(c,d.x,d.y,d.z,d.w);else if("c"===b)r.uniform3f(c,d.r,d.g,d.b);else if("s"===b){a=a.properties;for(var g in a){e=a[g];var f=c[g],h=d[g];w(e,e.type,f,h)}}else if("sa"===b){a=a.properties;b=0;for(var k=d.length;b<k;b++)for(g in a)e=a[g],f=c[b][g],
+h=d[b][g],w(e,e.type,f,h)}else if("v2v"===b){void 0===a._array&&(a._array=new Float32Array(2*d.length));e=b=0;for(g=d.length;b<g;b++,e+=2)a._array[e+0]=d[b].x,a._array[e+1]=d[b].y;r.uniform2fv(c,a._array)}else if("v3v"===b){void 0===a._array&&(a._array=new Float32Array(3*d.length));e=b=0;for(g=d.length;b<g;b++,e+=3)a._array[e+0]=d[b].x,a._array[e+1]=d[b].y,a._array[e+2]=d[b].z;r.uniform3fv(c,a._array)}else if("v4v"===b){void 0===a._array&&(a._array=new Float32Array(4*d.length));e=b=0;for(g=d.length;b<
+g;b++,e+=4)a._array[e+0]=d[b].x,a._array[e+1]=d[b].y,a._array[e+2]=d[b].z,a._array[e+3]=d[b].w;r.uniform4fv(c,a._array)}else if("m2"===b)r.uniformMatrix2fv(c,!1,d.elements);else if("m3"===b)r.uniformMatrix3fv(c,!1,d.elements);else if("m3v"===b){void 0===a._array&&(a._array=new Float32Array(9*d.length));b=0;for(g=d.length;b<g;b++)d[b].flattenToArrayOffset(a._array,9*b);r.uniformMatrix3fv(c,!1,a._array)}else if("m4"===b)r.uniformMatrix4fv(c,!1,d.elements);else if("m4v"===b){void 0===a._array&&(a._array=
+new Float32Array(16*d.length));b=0;for(g=d.length;b<g;b++)d[b].flattenToArrayOffset(a._array,16*b);r.uniformMatrix4fv(c,!1,a._array)}else if("t"===b)e=s(),r.uniform1i(c,e),d&&(d instanceof THREE.CubeTexture||Array.isArray(d.image)&&6===d.image.length?z(d,e):d instanceof THREE.WebGLRenderTargetCube?y(d.texture,e):d instanceof THREE.WebGLRenderTarget?Y.setTexture(d.texture,e):Y.setTexture(d,e));else if("tv"===b){void 0===a._array&&(a._array=[]);b=0;for(g=a.value.length;b<g;b++)a._array[b]=s();r.uniform1iv(c,
+a._array);b=0;for(g=a.value.length;b<g;b++)d=a.value[b],e=a._array[b],d&&(d instanceof THREE.CubeTexture||d.image instanceof Array&&6===d.image.length?z(d,e):d instanceof THREE.WebGLRenderTarget?Y.setTexture(d.texture,e):d instanceof THREE.WebGLRenderTargetCube?y(d.texture,e):Y.setTexture(d,e))}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+b)}function C(a){for(var b=0,c=a.length;b<c;b++){var d=a[b][0];!1!==d.needsUpdate&&w(d,d.type,a[b][1],d.value)}}function x(a,b,c){c?(r.texParameteri(a,
+r.TEXTURE_WRAP_S,K(b.wrapS)),r.texParameteri(a,r.TEXTURE_WRAP_T,K(b.wrapT)),r.texParameteri(a,r.TEXTURE_MAG_FILTER,K(b.magFilter)),r.texParameteri(a,r.TEXTURE_MIN_FILTER,K(b.minFilter))):(r.texParameteri(a,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(a,r.TEXTURE_WRAP_T,r.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),r.texParameteri(a,r.TEXTURE_MAG_FILTER,H(b.magFilter)),r.texParameteri(a,r.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=V.get("EXT_texture_filter_anisotropic"))||b.type===THREE.FloatType&&null===V.get("OES_texture_float_linear")||b.type===THREE.HalfFloatType&&null===V.get("OES_texture_half_float_linear")||
+!(1<b.anisotropy||U.get(b).__currentAnisotropy)||(r.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Y.getMaxAnisotropy())),U.get(b).__currentAnisotropy=b.anisotropy)}function B(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 A(a){return THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height)}function z(a,b){var c=U.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=r.createTexture(),ha.textures++);J.activeTexture(r.TEXTURE0+b);J.bindTexture(r.TEXTURE_CUBE_MAP,c.__image__webglTextureCube);r.pixelStorei(r.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]=!Y.autoScaleCubemaps||d||e?e?a.image[h].image:a.image[h]:B(a.image[h],da.maxCubemapSize);var k=A(g[0]),l=K(a.format),m=K(a.type);x(r.TEXTURE_CUBE_MAP,a,k);for(h=0;6>h;h++)if(d)for(var p,n=g[h].mipmaps,q=0,s=n.length;q<s;q++)p=n[q],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<J.getCompressedTextureFormats().indexOf(l)?J.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+h,q,l,
+p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):J.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+h,q,l,p.width,p.height,0,l,m,p.data);else e?J.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,l,g[h].width,g[h].height,0,l,m,g[h].data):J.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,l,l,m,g[h]);a.generateMipmaps&&k&&r.generateMipmap(r.TEXTURE_CUBE_MAP);c.__version=a.version;if(a.onUpdate)a.onUpdate(a)}else J.activeTexture(r.TEXTURE0+
+b),J.bindTexture(r.TEXTURE_CUBE_MAP,c.__image__webglTextureCube)}function y(a,b){J.activeTexture(r.TEXTURE0+b);J.bindTexture(r.TEXTURE_CUBE_MAP,U.get(a).__webglTexture)}function F(a,b,c,d){var e=K(b.texture.format),g=K(b.texture.type);J.texImage2D(d,0,e,b.width,b.height,0,e,g,null);r.bindFramebuffer(r.FRAMEBUFFER,a);r.framebufferTexture2D(r.FRAMEBUFFER,c,d,U.get(b.texture).__webglTexture,0);r.bindFramebuffer(r.FRAMEBUFFER,null)}function E(a,b){r.bindRenderbuffer(r.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?
+(r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_COMPONENT16,b.width,b.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,b.width,b.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,a)):r.renderbufferStorage(r.RENDERBUFFER,r.RGBA4,b.width,b.height);r.bindRenderbuffer(r.RENDERBUFFER,null)}function H(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||
+a===THREE.NearestMipMapLinearFilter?r.NEAREST:r.LINEAR}function K(a){var b;if(a===THREE.RepeatWrapping)return r.REPEAT;if(a===THREE.ClampToEdgeWrapping)return r.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return r.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return r.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return r.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return r.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return r.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return r.LINEAR_MIPMAP_NEAREST;
+if(a===THREE.LinearMipMapLinearFilter)return r.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return r.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return r.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return r.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return r.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return r.BYTE;if(a===THREE.ShortType)return r.SHORT;if(a===THREE.UnsignedShortType)return r.UNSIGNED_SHORT;if(a===THREE.IntType)return r.INT;if(a===THREE.UnsignedIntType)return r.UNSIGNED_INT;
+if(a===THREE.FloatType)return r.FLOAT;b=V.get("OES_texture_half_float");if(null!==b&&a===THREE.HalfFloatType)return b.HALF_FLOAT_OES;if(a===THREE.AlphaFormat)return r.ALPHA;if(a===THREE.RGBFormat)return r.RGB;if(a===THREE.RGBAFormat)return r.RGBA;if(a===THREE.LuminanceFormat)return r.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return r.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return r.FUNC_ADD;if(a===THREE.SubtractEquation)return r.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return r.FUNC_REVERSE_SUBTRACT;
+if(a===THREE.ZeroFactor)return r.ZERO;if(a===THREE.OneFactor)return r.ONE;if(a===THREE.SrcColorFactor)return r.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return r.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return r.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return r.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return r.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return r.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return r.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return r.ONE_MINUS_DST_COLOR;
+if(a===THREE.SrcAlphaSaturateFactor)return r.SRC_ALPHA_SATURATE;b=V.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=V.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=V.get("WEBGL_compressed_texture_etc1");if(null!==b&&a===THREE.RGB_ETC1_Format)return b.COMPRESSED_RGB_ETC1_WEBGL;b=V.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 G=void 0!==a.canvas?a.canvas:document.createElement("canvas"),P=void 0!==a.context?a.context:null,I=void 0!==a.alpha?a.alpha:!1,M=void 0!==a.depth?a.depth:!0,N=void 0!==a.stencil?a.stencil:!0,O=void 0!==a.antialias?a.antialias:!1,R=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,Q=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,L=[],D=[],W=-1,T=[],Z=-1,$=new Float32Array(8),ea=[],na=[];this.domElement=G;this.context=null;this.sortObjects=this.autoClearStencil=
+this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.gammaFactor=2;this.physicallyCorrectLights=this.gammaOutput=this.gammaInput=!1;this.toneMapping=THREE.LinearToneMapping;this.toneMappingWhitePoint=this.toneMappingExposure=1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;var Y=this,ca=null,ta=null,ua=null,qa=-1,la="",ka=null,pa=new THREE.Vector4,Aa=null,ia=new THREE.Vector4,sa=0,ba=new THREE.Color(0),ga=0,va=G.width,wa=G.height,aa=1,ya=new THREE.Vector4(0,0,va,
+wa),Ba=!1,ja=new THREE.Vector4(0,0,va,wa),za=new THREE.Frustum,ra=new THREE.Matrix4,X=new THREE.Vector3,S={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},ha={geometries:0,textures:0},fa={calls:0,vertices:0,faces:0,points:0};this.info={render:fa,memory:ha,programs:null};var r;try{I={alpha:I,depth:M,stencil:N,antialias:O,premultipliedAlpha:R,preserveDrawingBuffer:Q};
+r=P||G.getContext("webgl",I)||G.getContext("experimental-webgl",I);if(null===r){if(null!==G.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";}void 0===r.getShaderPrecisionFormat&&(r.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});G.addEventListener("webglcontextlost",e,!1)}catch(Da){console.error("THREE.WebGLRenderer: "+Da)}var V=new THREE.WebGLExtensions(r);V.get("OES_texture_float");V.get("OES_texture_float_linear");
+V.get("OES_texture_half_float");V.get("OES_texture_half_float_linear");V.get("OES_standard_derivatives");V.get("ANGLE_instanced_arrays");V.get("OES_element_index_uint")&&(THREE.BufferGeometry.MaxIndex=4294967296);var da=new THREE.WebGLCapabilities(r,V,a),J=new THREE.WebGLState(r,V,K),U=new THREE.WebGLProperties,oa=new THREE.WebGLObjects(r,U,this.info),ma=new THREE.WebGLPrograms(this,da),xa=new THREE.WebGLLights;this.info.programs=ma.programs;var Ea=new THREE.WebGLBufferRenderer(r,V,fa),Fa=new THREE.WebGLIndexedBufferRenderer(r,
+V,fa);c();this.context=r;this.capabilities=da;this.extensions=V;this.properties=U;this.state=J;var Ca=new THREE.WebGLShadowMap(this,S,oa);this.shadowMap=Ca;var Ga=new THREE.SpritePlugin(this,ea),Ha=new THREE.LensFlarePlugin(this,na);this.getContext=function(){return r};this.getContextAttributes=function(){return r.getContextAttributes()};this.forceContextLoss=function(){V.get("WEBGL_lose_context").loseContext()};this.getMaxAnisotropy=function(){var a;return function(){if(void 0!==a)return a;var b=
+V.get("EXT_texture_filter_anisotropic");return a=null!==b?r.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}();this.getPrecision=function(){return da.precision};this.getPixelRatio=function(){return aa};this.setPixelRatio=function(a){void 0!==a&&(aa=a,this.setSize(ja.z,ja.w,!1))};this.getSize=function(){return{width:va,height:wa}};this.setSize=function(a,b,c){va=a;wa=b;G.width=a*aa;G.height=b*aa;!1!==c&&(G.style.width=a+"px",G.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,
+b,c,d){J.viewport(ja.set(a,b,c,d))};this.setScissor=function(a,b,c,d){J.scissor(ya.set(a,b,c,d))};this.setScissorTest=function(a){J.setScissorTest(Ba=a)};this.getClearColor=function(){return ba};this.setClearColor=function(a,c){ba.set(a);ga=void 0!==c?c:1;b(ba.r,ba.g,ba.b,ga)};this.getClearAlpha=function(){return ga};this.setClearAlpha=function(a){ga=a;b(ba.r,ba.g,ba.b,ga)};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=r.COLOR_BUFFER_BIT;if(void 0===b||b)d|=r.DEPTH_BUFFER_BIT;if(void 0===
+c||c)d|=r.STENCIL_BUFFER_BIT;r.clear(d)};this.clearColor=function(){this.clear(!0,!1,!1)};this.clearDepth=function(){this.clear(!1,!0,!1)};this.clearStencil=function(){this.clear(!1,!1,!0)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.resetGLState=d;this.dispose=function(){G.removeEventListener("webglcontextlost",e,!1)};this.renderBufferImmediate=function(a,b,c){J.initAttributes();var d=U.get(a);a.hasPositions&&!d.position&&(d.position=r.createBuffer());a.hasNormals&&
+!d.normal&&(d.normal=r.createBuffer());a.hasUvs&&!d.uv&&(d.uv=r.createBuffer());a.hasColors&&!d.color&&(d.color=r.createBuffer());b=b.getAttributes();a.hasPositions&&(r.bindBuffer(r.ARRAY_BUFFER,d.position),r.bufferData(r.ARRAY_BUFFER,a.positionArray,r.DYNAMIC_DRAW),J.enableAttribute(b.position),r.vertexAttribPointer(b.position,3,r.FLOAT,!1,0,0));if(a.hasNormals){r.bindBuffer(r.ARRAY_BUFFER,d.normal);if("MeshPhongMaterial"!==c.type&&"MeshStandardMaterial"!==c.type&&c.shading===THREE.FlatShading)for(var e=
+0,g=3*a.count;e<g;e+=9){var f=a.normalArray,h=(f[e+0]+f[e+3]+f[e+6])/3,k=(f[e+1]+f[e+4]+f[e+7])/3,l=(f[e+2]+f[e+5]+f[e+8])/3;f[e+0]=h;f[e+1]=k;f[e+2]=l;f[e+3]=h;f[e+4]=k;f[e+5]=l;f[e+6]=h;f[e+7]=k;f[e+8]=l}r.bufferData(r.ARRAY_BUFFER,a.normalArray,r.DYNAMIC_DRAW);J.enableAttribute(b.normal);r.vertexAttribPointer(b.normal,3,r.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(r.bindBuffer(r.ARRAY_BUFFER,d.uv),r.bufferData(r.ARRAY_BUFFER,a.uvArray,r.DYNAMIC_DRAW),J.enableAttribute(b.uv),r.vertexAttribPointer(b.uv,2,r.FLOAT,
+!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(r.bindBuffer(r.ARRAY_BUFFER,d.color),r.bufferData(r.ARRAY_BUFFER,a.colorArray,r.DYNAMIC_DRAW),J.enableAttribute(b.color),r.vertexAttribPointer(b.color,3,r.FLOAT,!1,0,0));J.disableUnusedAttributes();r.drawArrays(r.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,g){v(d);var f=t(a,b,d,e),h=!1;a=c.id+"_"+f.id+"_"+d.wireframe;a!==la&&(la=a,h=!0);b=e.morphTargetInfluences;if(void 0!==b){a=[];for(var k=0,h=b.length;k<h;k++){var m=
+b[k];a.push([m,k])}a.sort(l);8<a.length&&(a.length=8);for(var p=c.morphAttributes,k=0,h=a.length;k<h;k++)m=a[k],$[k]=m[0],0!==m[0]?(b=m[1],!0===d.morphTargets&&p.position&&c.addAttribute("morphTarget"+k,p.position[b]),!0===d.morphNormals&&p.normal&&c.addAttribute("morphNormal"+k,p.normal[b])):(!0===d.morphTargets&&c.removeAttribute("morphTarget"+k),!0===d.morphNormals&&c.removeAttribute("morphNormal"+k));a=f.getUniforms();null!==a.morphTargetInfluences&&r.uniform1fv(a.morphTargetInfluences,$);h=!0}b=
+c.index;k=c.attributes.position;!0===d.wireframe&&(b=oa.getWireframeAttribute(c));null!==b?(a=Fa,a.setIndex(b)):a=Ea;if(h){a:{var h=void 0,n;if(c instanceof THREE.InstancedBufferGeometry&&(n=V.get("ANGLE_instanced_arrays"),null===n)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}void 0===h&&(h=0);J.initAttributes();var m=c.attributes,f=f.getAttributes(),p=d.defaultAttributeValues,
+q;for(q in f){var s=f[q];if(0<=s){var u=m[q];if(void 0!==u){var w=u.itemSize,x=oa.getAttributeBuffer(u);if(u instanceof THREE.InterleavedBufferAttribute){var C=u.data,A=C.stride,u=u.offset;C instanceof THREE.InstancedInterleavedBuffer?(J.enableAttributeAndDivisor(s,C.meshPerAttribute,n),void 0===c.maxInstancedCount&&(c.maxInstancedCount=C.meshPerAttribute*C.count)):J.enableAttribute(s);r.bindBuffer(r.ARRAY_BUFFER,x);r.vertexAttribPointer(s,w,r.FLOAT,!1,A*C.array.BYTES_PER_ELEMENT,(h*A+u)*C.array.BYTES_PER_ELEMENT)}else u instanceof
+THREE.InstancedBufferAttribute?(J.enableAttributeAndDivisor(s,u.meshPerAttribute,n),void 0===c.maxInstancedCount&&(c.maxInstancedCount=u.meshPerAttribute*u.count)):J.enableAttribute(s),C=r.FLOAT,A=!1,u=u.array,u instanceof Uint8Array&&(C=r.UNSIGNED_BYTE,A=!0),r.bindBuffer(r.ARRAY_BUFFER,x),r.vertexAttribPointer(s,w,C,A,0,h*w*u.BYTES_PER_ELEMENT)}else if(void 0!==p&&(w=p[q],void 0!==w))switch(w.length){case 2:r.vertexAttrib2fv(s,w);break;case 3:r.vertexAttrib3fv(s,w);break;case 4:r.vertexAttrib4fv(s,
+w);break;default:r.vertexAttrib1fv(s,w)}}}J.disableUnusedAttributes()}null!==b&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,oa.getAttributeBuffer(b))}n=Infinity;null!==b?n=b.count:void 0!==k&&(n=k.count);q=c.drawRange.start;b=c.drawRange.count;k=null!==g?g.start:0;h=null!==g?g.count:Infinity;g=Math.max(0,q,k);n=Math.min(0+n,q+b,k+h)-1;n=Math.max(0,n-g+1);if(e instanceof THREE.Mesh)if(!0===d.wireframe)J.setLineWidth(d.wireframeLinewidth*(null===ta?aa:1)),a.setMode(r.LINES);else switch(e.drawMode){case THREE.TrianglesDrawMode:a.setMode(r.TRIANGLES);
+break;case THREE.TriangleStripDrawMode:a.setMode(r.TRIANGLE_STRIP);break;case THREE.TriangleFanDrawMode:a.setMode(r.TRIANGLE_FAN)}else e instanceof THREE.Line?(d=d.linewidth,void 0===d&&(d=1),J.setLineWidth(d*(null===ta?aa:1)),e instanceof THREE.LineSegments?a.setMode(r.LINES):a.setMode(r.LINE_STRIP)):e instanceof THREE.Points&&a.setMode(r.POINTS);c instanceof THREE.InstancedBufferGeometry?0<c.maxInstancedCount&&a.renderInstances(c,g,n):a.render(g,n)};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;la="";qa=-1;ka=null;!0===a.autoUpdate&&a.updateMatrixWorld();null===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);ra.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);za.setFromMatrix(ra);L.length=0;Z=W=-1;ea.length=0;na.length=0;q(a,b);D.length=W+1;T.length=Z+1;!0===Y.sortObjects&&(D.sort(n),T.sort(p));for(var g=L,f=0,h=0,k=g.length;h<k;h++){var l=
+g[h];l.castShadow&&(S.shadows[f++]=l)}S.shadows.length=f;Ca.render(a,b);for(var g=L,m=l=0,s=0,t,v,w,x=b.matrixWorldInverse,C=0,$=0,z=0,B=0,f=0,h=g.length;f<h;f++)if(k=g[f],t=k.color,v=k.intensity,w=k.distance,k instanceof THREE.AmbientLight)l+=t.r*v,m+=t.g*v,s+=t.b*v;else if(k instanceof THREE.DirectionalLight){var y=xa.get(k);y.color.copy(k.color).multiplyScalar(k.intensity);y.direction.setFromMatrixPosition(k.matrixWorld);X.setFromMatrixPosition(k.target.matrixWorld);y.direction.sub(X);y.direction.transformDirection(x);
+if(y.shadow=k.castShadow)y.shadowBias=k.shadow.bias,y.shadowRadius=k.shadow.radius,y.shadowMapSize=k.shadow.mapSize;S.directionalShadowMap[C]=k.shadow.map;S.directionalShadowMatrix[C]=k.shadow.matrix;S.directional[C++]=y}else if(k instanceof THREE.SpotLight){y=xa.get(k);y.position.setFromMatrixPosition(k.matrixWorld);y.position.applyMatrix4(x);y.color.copy(t).multiplyScalar(v);y.distance=w;y.direction.setFromMatrixPosition(k.matrixWorld);X.setFromMatrixPosition(k.target.matrixWorld);y.direction.sub(X);
+y.direction.transformDirection(x);y.coneCos=Math.cos(k.angle);y.penumbraCos=Math.cos(k.angle*(1-k.penumbra));y.decay=0===k.distance?0:k.decay;if(y.shadow=k.castShadow)y.shadowBias=k.shadow.bias,y.shadowRadius=k.shadow.radius,y.shadowMapSize=k.shadow.mapSize;S.spotShadowMap[z]=k.shadow.map;S.spotShadowMatrix[z]=k.shadow.matrix;S.spot[z++]=y}else if(k instanceof THREE.PointLight){y=xa.get(k);y.position.setFromMatrixPosition(k.matrixWorld);y.position.applyMatrix4(x);y.color.copy(k.color).multiplyScalar(k.intensity);
+y.distance=k.distance;y.decay=0===k.distance?0:k.decay;if(y.shadow=k.castShadow)y.shadowBias=k.shadow.bias,y.shadowRadius=k.shadow.radius,y.shadowMapSize=k.shadow.mapSize;S.pointShadowMap[$]=k.shadow.map;void 0===S.pointShadowMatrix[$]&&(S.pointShadowMatrix[$]=new THREE.Matrix4);X.setFromMatrixPosition(k.matrixWorld).negate();S.pointShadowMatrix[$].identity().setPosition(X);S.point[$++]=y}else k instanceof THREE.HemisphereLight&&(y=xa.get(k),y.direction.setFromMatrixPosition(k.matrixWorld),y.direction.transformDirection(x),
+y.direction.normalize(),y.skyColor.copy(k.color).multiplyScalar(v),y.groundColor.copy(k.groundColor).multiplyScalar(v),S.hemi[B++]=y);S.ambient[0]=l;S.ambient[1]=m;S.ambient[2]=s;S.directional.length=C;S.spot.length=z;S.point.length=$;S.hemi.length=B;S.hash=C+","+$+","+z+","+B+","+S.shadows.length;fa.calls=0;fa.vertices=0;fa.faces=0;fa.points=0;void 0===c&&(c=null);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);a.overrideMaterial?
+(d=a.overrideMaterial,u(D,b,e,d),u(T,b,e,d)):(J.setBlending(THREE.NoBlending),u(D,b,e),u(T,b,e));Ga.render(a,b);Ha.render(a,b,ia);c&&(a=c.texture,a.generateMipmaps&&A(c)&&a.minFilter!==THREE.NearestFilter&&a.minFilter!==THREE.LinearFilter&&(a=c instanceof THREE.WebGLRenderTargetCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,c=U.get(c.texture).__webglTexture,J.bindTexture(a,c),r.generateMipmap(a),J.bindTexture(a,null)));J.setDepthTest(!0);J.setDepthWrite(!0);J.setColorWrite(!0)}};this.setFaceCulling=function(a,
+b){a===THREE.CullFaceNone?J.disable(r.CULL_FACE):(b===THREE.FrontFaceDirectionCW?r.frontFace(r.CW):r.frontFace(r.CCW),a===THREE.CullFaceBack?r.cullFace(r.BACK):a===THREE.CullFaceFront?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK),J.enable(r.CULL_FACE))};this.setTexture=function(a,b){var c=U.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=r.createTexture(),ha.textures++);J.activeTexture(r.TEXTURE0+b);J.bindTexture(r.TEXTURE_2D,c.__webglTexture);r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,a.flipY);r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);r.pixelStorei(r.UNPACK_ALIGNMENT,a.unpackAlignment);var e=B(a.image,da.maxTextureSize);if((a.wrapS!==THREE.ClampToEdgeWrapping||a.wrapT!==THREE.ClampToEdgeWrapping||a.minFilter!==THREE.NearestFilter&&
 a.minFilter!==THREE.LinearFilter)&&!1===A(e))if(d=e,d instanceof HTMLImageElement||d instanceof HTMLCanvasElement){var g=document.createElement("canvas");g.width=THREE.Math.nearestPowerOfTwo(d.width);g.height=THREE.Math.nearestPowerOfTwo(d.height);g.getContext("2d").drawImage(d,0,0,g.width,g.height);console.warn("THREE.WebGLRenderer: image is not power of two ("+d.width+"x"+d.height+"). Resized to "+g.width+"x"+g.height,d);e=g}else e=d;var d=A(e),g=K(a.format),h=K(a.type);x(r.TEXTURE_2D,a,d);var k=
 a.mipmaps;if(a instanceof THREE.DataTexture)if(0<k.length&&d){for(var l=0,m=k.length;l<m;l++)e=k[l],J.texImage2D(r.TEXTURE_2D,l,g,e.width,e.height,0,g,h,e.data);a.generateMipmaps=!1}else J.texImage2D(r.TEXTURE_2D,0,g,e.width,e.height,0,g,h,e.data);else if(a instanceof THREE.CompressedTexture)for(l=0,m=k.length;l<m;l++)e=k[l],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<J.getCompressedTextureFormats().indexOf(g)?J.compressedTexImage2D(r.TEXTURE_2D,l,g,e.width,e.height,0,e.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):
@@ -690,21 +690,21 @@ THREE.WebGLProgram=function(){function a(a){switch(a){case THREE.LinearEncoding:
 a);}}function b(b,c){var d=a(c);return"vec4 "+b+"( vec4 value ) { return "+d[0]+"ToLinear"+d[1]+"; }"}function c(b,c){var d=a(c);return"vec4 "+b+"( vec4 value ) { return LinearTo"+d[0]+d[1]+"; }"}function d(a,b){var c;switch(b){case THREE.LinearToneMapping:c="Linear";break;case THREE.ReinhardToneMapping:c="Reinhard";break;case THREE.Uncharted2ToneMapping:c="Uncharted2";break;case THREE.CineonToneMapping:c="OptimizedCineon";break;default:throw Error("unsupported toneMapping: "+b);}return"vec3 "+a+
 "( vec3 color ) { return "+c+"ToneMapping( color ); }"}function e(a,b,c){a=a||{};return[a.derivatives||b.envMapCubeUV||b.bumpMap||b.normalMap||b.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(a.fragDepth||b.logarithmicDepthBuffer)&&c.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",a.drawBuffers&&c.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(a.shaderTextureLOD||b.envMap)&&c.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":
 ""].filter(g).join("\n")}function f(a){var b=[],c;for(c in a){var d=a[c];!1!==d&&b.push("#define "+c+" "+d)}return b.join("\n")}function g(a){return""!==a}function h(a,b){return a.replace(/NUM_DIR_LIGHTS/g,b.numDirLights).replace(/NUM_SPOT_LIGHTS/g,b.numSpotLights).replace(/NUM_POINT_LIGHTS/g,b.numPointLights).replace(/NUM_HEMI_LIGHTS/g,b.numHemiLights)}function k(a){return a.replace(/#include +<([\w\d.]+)>/g,function(a,b){var c=THREE.ShaderChunk[b];if(void 0===c)throw Error("Can not resolve #include <"+
-b+">");return k(c)})}function l(a){return a.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(a,b,c,d){a="";for(b=parseInt(b);b<parseInt(c);b++)a+=d.replace(/\[ i \]/g,"[ "+b+" ]");return a})}var n=0,p=/^([\w\d_]+)\.([\w\d_]+)$/,m=/^([\w\d_]+)\[(\d+)\]\.([\w\d_]+)$/,q=/^([\w\d_]+)\[0\]$/;return function(a,v,s,t){var w=a.context,C=s.extensions,x=s.defines,B=s.__webglShader.vertexShader,A=s.__webglShader.fragmentShader,z="SHADOWMAP_TYPE_BASIC";t.shadowMapType===
-THREE.PCFShadowMap?z="SHADOWMAP_TYPE_PCF":t.shadowMapType===THREE.PCFSoftShadowMap&&(z="SHADOWMAP_TYPE_PCF_SOFT");var y="ENVMAP_TYPE_CUBE",F="ENVMAP_MODE_REFLECTION",E="ENVMAP_BLENDING_MULTIPLY";if(t.envMap){switch(s.envMap.mapping){case THREE.CubeReflectionMapping:case THREE.CubeRefractionMapping:y="ENVMAP_TYPE_CUBE";break;case THREE.CubeUVReflectionMapping:case THREE.CubeUVRefractionMapping:y="ENVMAP_TYPE_CUBE_UV";break;case THREE.EquirectangularReflectionMapping:case THREE.EquirectangularRefractionMapping:y=
-"ENVMAP_TYPE_EQUIREC";break;case THREE.SphericalReflectionMapping:y="ENVMAP_TYPE_SPHERE"}switch(s.envMap.mapping){case THREE.CubeRefractionMapping:case THREE.EquirectangularRefractionMapping:F="ENVMAP_MODE_REFRACTION"}switch(s.combine){case THREE.MultiplyOperation:E="ENVMAP_BLENDING_MULTIPLY";break;case THREE.MixOperation:E="ENVMAP_BLENDING_MIX";break;case THREE.AddOperation:E="ENVMAP_BLENDING_ADD"}}var H=0<a.gammaFactor?a.gammaFactor:1,C=e(C,t,a.extensions),K=f(x),G=w.createProgram();s instanceof
-THREE.RawShaderMaterial?a=x="":(x=["precision "+t.precision+" float;","precision "+t.precision+" int;","#define SHADER_NAME "+s.__webglShader.name,K,t.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+H,"#define MAX_BONES "+t.maxBones,t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+F:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?
-"#define USE_NORMALMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.vertexColors?"#define USE_COLOR":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.useVertexTexture?"#define BONE_TEXTURE":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&!1===t.flatShading?
-"#define USE_MORPHNORMALS":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+z:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&a.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;",
+b+">");return k(c)})}function l(a){return a.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(a,b,c,d){a="";for(b=parseInt(b);b<parseInt(c);b++)a+=d.replace(/\[ i \]/g,"[ "+b+" ]");return a})}var n=0,p=/^([\w\d_]+)\.([\w\d_]+)$/,m=/^([\w\d_]+)\[(\d+)\]\.([\w\d_]+)$/,q=/^([\w\d_]+)\[0\]$/;return function(a,v,t,s){var w=a.context,C=t.extensions,x=t.defines,B=t.__webglShader.vertexShader,A=t.__webglShader.fragmentShader,z="SHADOWMAP_TYPE_BASIC";s.shadowMapType===
+THREE.PCFShadowMap?z="SHADOWMAP_TYPE_PCF":s.shadowMapType===THREE.PCFSoftShadowMap&&(z="SHADOWMAP_TYPE_PCF_SOFT");var y="ENVMAP_TYPE_CUBE",F="ENVMAP_MODE_REFLECTION",E="ENVMAP_BLENDING_MULTIPLY";if(s.envMap){switch(t.envMap.mapping){case THREE.CubeReflectionMapping:case THREE.CubeRefractionMapping:y="ENVMAP_TYPE_CUBE";break;case THREE.CubeUVReflectionMapping:case THREE.CubeUVRefractionMapping:y="ENVMAP_TYPE_CUBE_UV";break;case THREE.EquirectangularReflectionMapping:case THREE.EquirectangularRefractionMapping:y=
+"ENVMAP_TYPE_EQUIREC";break;case THREE.SphericalReflectionMapping:y="ENVMAP_TYPE_SPHERE"}switch(t.envMap.mapping){case THREE.CubeRefractionMapping:case THREE.EquirectangularRefractionMapping:F="ENVMAP_MODE_REFRACTION"}switch(t.combine){case THREE.MultiplyOperation:E="ENVMAP_BLENDING_MULTIPLY";break;case THREE.MixOperation:E="ENVMAP_BLENDING_MIX";break;case THREE.AddOperation:E="ENVMAP_BLENDING_ADD"}}var H=0<a.gammaFactor?a.gammaFactor:1,C=e(C,s,a.extensions),K=f(x),G=w.createProgram();t instanceof
+THREE.RawShaderMaterial?a=x="":(x=["precision "+s.precision+" float;","precision "+s.precision+" int;","#define SHADER_NAME "+t.__webglShader.name,K,s.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+H,"#define MAX_BONES "+s.maxBones,s.map?"#define USE_MAP":"",s.envMap?"#define USE_ENVMAP":"",s.envMap?"#define "+F:"",s.lightMap?"#define USE_LIGHTMAP":"",s.aoMap?"#define USE_AOMAP":"",s.emissiveMap?"#define USE_EMISSIVEMAP":"",s.bumpMap?"#define USE_BUMPMAP":"",s.normalMap?
+"#define USE_NORMALMAP":"",s.displacementMap&&s.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",s.specularMap?"#define USE_SPECULARMAP":"",s.roughnessMap?"#define USE_ROUGHNESSMAP":"",s.metalnessMap?"#define USE_METALNESSMAP":"",s.alphaMap?"#define USE_ALPHAMAP":"",s.vertexColors?"#define USE_COLOR":"",s.flatShading?"#define FLAT_SHADED":"",s.skinning?"#define USE_SKINNING":"",s.useVertexTexture?"#define BONE_TEXTURE":"",s.morphTargets?"#define USE_MORPHTARGETS":"",s.morphNormals&&!1===s.flatShading?
+"#define USE_MORPHNORMALS":"",s.doubleSided?"#define DOUBLE_SIDED":"",s.flipSided?"#define FLIP_SIDED":"",s.shadowMapEnabled?"#define USE_SHADOWMAP":"",s.shadowMapEnabled?"#define "+z:"",s.sizeAttenuation?"#define USE_SIZEATTENUATION":"",s.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",s.logarithmicDepthBuffer&&a.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;","\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(g).join("\n"),a=[C,"precision "+t.precision+" float;","precision "+t.precision+" int;","#define SHADER_NAME "+s.__webglShader.name,K,t.alphaTest?"#define ALPHATEST "+t.alphaTest:"","#define GAMMA_FACTOR "+H,t.useFog&&t.fog?"#define USE_FOG":
-"",t.useFog&&t.fogExp?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+y:"",t.envMap?"#define "+F:"",t.envMap?"#define "+E:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?
-"#define USE_ALPHAMAP":"",t.vertexColors?"#define USE_COLOR":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+z:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&a.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":
-"",t.envMap&&a.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",t.toneMapping!==THREE.NoToneMapping?"#define TONE_MAPPING":"",t.toneMapping!==THREE.NoToneMapping?THREE.ShaderChunk.tonemapping_pars_fragment:"",t.toneMapping!==THREE.NoToneMapping?d("toneMapping",t.toneMapping):"",t.outputEncoding||t.mapEncoding||t.envMapEncoding||t.emissiveMapEncoding?THREE.ShaderChunk.encodings_pars_fragment:"",t.mapEncoding?b("mapTexelToLinear",
-t.mapEncoding):"",t.envMapEncoding?b("envMapTexelToLinear",t.envMapEncoding):"",t.emissiveMapEncoding?b("emissiveMapTexelToLinear",t.emissiveMapEncoding):"",t.outputEncoding?c("linearToOutputTexel",t.outputEncoding):"","\n"].filter(g).join("\n"));B=k(B,t);B=h(B,t);A=k(A,t);A=h(A,t);!1===s instanceof THREE.ShaderMaterial&&(B=l(B),A=l(A));A=a+A;B=THREE.WebGLShader(w,w.VERTEX_SHADER,x+B);A=THREE.WebGLShader(w,w.FRAGMENT_SHADER,A);w.attachShader(G,B);w.attachShader(G,A);void 0!==s.index0AttributeName?
-w.bindAttribLocation(G,0,s.index0AttributeName):!0===t.morphTargets&&w.bindAttribLocation(G,0,"position");w.linkProgram(G);t=w.getProgramInfoLog(G);z=w.getShaderInfoLog(B);y=w.getShaderInfoLog(A);E=F=!0;if(!1===w.getProgramParameter(G,w.LINK_STATUS))F=!1,console.error("THREE.WebGLProgram: shader error: ",w.getError(),"gl.VALIDATE_STATUS",w.getProgramParameter(G,w.VALIDATE_STATUS),"gl.getProgramInfoLog",t,z,y);else if(""!==t)console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t);else if(""===
-z||""===y)E=!1;E&&(this.diagnostics={runnable:F,material:s,programLog:t,vertexShader:{log:z,prefix:x},fragmentShader:{log:y,prefix:a}});w.deleteShader(B);w.deleteShader(A);var O;this.getUniforms=function(){if(void 0===O){for(var a={},b=w.getProgramParameter(G,w.ACTIVE_UNIFORMS),c=0;c<b;c++){var d=w.getActiveUniform(G,c).name,e=w.getUniformLocation(G,d),g=p.exec(d);if(g){var d=g[1],g=g[2],f=a[d];f||(f=a[d]={});f[g]=e}else if(g=m.exec(d)){var f=g[1],d=g[2],g=g[3],h=a[f];h||(h=a[f]=[]);(f=h[d])||(f=
-h[d]={});f[g]=e}else(g=q.exec(d))?(f=g[1],a[f]=e):a[d]=e}O=a}return O};var I;this.getAttributes=function(){if(void 0===I){for(var a={},b=w.getProgramParameter(G,w.ACTIVE_ATTRIBUTES),c=0;c<b;c++){var d=w.getActiveAttrib(G,c).name;a[d]=w.getAttribLocation(G,d)}I=a}return I};this.destroy=function(){w.deleteProgram(G);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().");
+"\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(g).join("\n"),a=[C,"precision "+s.precision+" float;","precision "+s.precision+" int;","#define SHADER_NAME "+t.__webglShader.name,K,s.alphaTest?"#define ALPHATEST "+s.alphaTest:"","#define GAMMA_FACTOR "+H,s.useFog&&s.fog?"#define USE_FOG":
+"",s.useFog&&s.fogExp?"#define FOG_EXP2":"",s.map?"#define USE_MAP":"",s.envMap?"#define USE_ENVMAP":"",s.envMap?"#define "+y:"",s.envMap?"#define "+F:"",s.envMap?"#define "+E:"",s.lightMap?"#define USE_LIGHTMAP":"",s.aoMap?"#define USE_AOMAP":"",s.emissiveMap?"#define USE_EMISSIVEMAP":"",s.bumpMap?"#define USE_BUMPMAP":"",s.normalMap?"#define USE_NORMALMAP":"",s.specularMap?"#define USE_SPECULARMAP":"",s.roughnessMap?"#define USE_ROUGHNESSMAP":"",s.metalnessMap?"#define USE_METALNESSMAP":"",s.alphaMap?
+"#define USE_ALPHAMAP":"",s.vertexColors?"#define USE_COLOR":"",s.flatShading?"#define FLAT_SHADED":"",s.doubleSided?"#define DOUBLE_SIDED":"",s.flipSided?"#define FLIP_SIDED":"",s.shadowMapEnabled?"#define USE_SHADOWMAP":"",s.shadowMapEnabled?"#define "+z:"",s.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",s.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",s.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",s.logarithmicDepthBuffer&&a.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":
+"",s.envMap&&a.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",s.toneMapping!==THREE.NoToneMapping?"#define TONE_MAPPING":"",s.toneMapping!==THREE.NoToneMapping?THREE.ShaderChunk.tonemapping_pars_fragment:"",s.toneMapping!==THREE.NoToneMapping?d("toneMapping",s.toneMapping):"",s.outputEncoding||s.mapEncoding||s.envMapEncoding||s.emissiveMapEncoding?THREE.ShaderChunk.encodings_pars_fragment:"",s.mapEncoding?b("mapTexelToLinear",
+s.mapEncoding):"",s.envMapEncoding?b("envMapTexelToLinear",s.envMapEncoding):"",s.emissiveMapEncoding?b("emissiveMapTexelToLinear",s.emissiveMapEncoding):"",s.outputEncoding?c("linearToOutputTexel",s.outputEncoding):"","\n"].filter(g).join("\n"));B=k(B,s);B=h(B,s);A=k(A,s);A=h(A,s);!1===t instanceof THREE.ShaderMaterial&&(B=l(B),A=l(A));A=a+A;B=THREE.WebGLShader(w,w.VERTEX_SHADER,x+B);A=THREE.WebGLShader(w,w.FRAGMENT_SHADER,A);w.attachShader(G,B);w.attachShader(G,A);void 0!==t.index0AttributeName?
+w.bindAttribLocation(G,0,t.index0AttributeName):!0===s.morphTargets&&w.bindAttribLocation(G,0,"position");w.linkProgram(G);s=w.getProgramInfoLog(G);z=w.getShaderInfoLog(B);y=w.getShaderInfoLog(A);E=F=!0;if(!1===w.getProgramParameter(G,w.LINK_STATUS))F=!1,console.error("THREE.WebGLProgram: shader error: ",w.getError(),"gl.VALIDATE_STATUS",w.getProgramParameter(G,w.VALIDATE_STATUS),"gl.getProgramInfoLog",s,z,y);else if(""!==s)console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",s);else if(""===
+z||""===y)E=!1;E&&(this.diagnostics={runnable:F,material:t,programLog:s,vertexShader:{log:z,prefix:x},fragmentShader:{log:y,prefix:a}});w.deleteShader(B);w.deleteShader(A);var P;this.getUniforms=function(){if(void 0===P){for(var a={},b=w.getProgramParameter(G,w.ACTIVE_UNIFORMS),c=0;c<b;c++){var d=w.getActiveUniform(G,c).name,e=w.getUniformLocation(G,d),g=p.exec(d);if(g){var d=g[1],g=g[2],f=a[d];f||(f=a[d]={});f[g]=e}else if(g=m.exec(d)){var f=g[1],d=g[2],g=g[3],h=a[f];h||(h=a[f]=[]);(f=h[d])||(f=
+h[d]={});f[g]=e}else(g=q.exec(d))?(f=g[1],a[f]=e):a[d]=e}P=a}return P};var I;this.getAttributes=function(){if(void 0===I){for(var a={},b=w.getProgramParameter(G,w.ACTIVE_ATTRIBUTES),c=0;c<b;c++){var d=w.getActiveAttrib(G,c).name;a[d]=w.getAttribLocation(G,d)}I=a}return I};this.destroy=function(){w.deleteProgram(G);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=n++;this.code=v;this.usedTimes=1;this.program=G;this.vertexShader=B;this.fragmentShader=A;return this}}();
 THREE.WebGLPrograms=function(a,b){function c(a,b){var c;a?a instanceof THREE.Texture?c=a.encoding:a instanceof THREE.WebGLRenderTarget&&(c=a.texture.encoding):c=THREE.LinearEncoding;c===THREE.LinearEncoding&&b&&(c=THREE.GammaEncoding);return c}var d=[],e={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshStandardMaterial:"standard",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},
 f="precision supportsVertexTextures map mapEncoding envMap envMapMode envMapEncoding lightMap aoMap emissiveMap emissiveMapEncoding bumpMap normalMap displacementMap specularMap roughnessMap metalnessMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals premultipliedAlpha numDirLights numPointLights numSpotLights numHemiLights shadowMapEnabled shadowMapType toneMapping physicallyCorrectLights alphaTest doubleSided flipSided".split(" ");
@@ -716,42 +716,40 @@ premultipliedAlpha:d.premultipliedAlpha,alphaTest:d.alphaTest,doubleSided:d.side
 break}}void 0===f&&(f=new THREE.WebGLProgram(a,e,b,c),d.push(f));return f};this.releaseProgram=function(a){if(0===--a.usedTimes){var b=d.indexOf(a);d[b]=d[d.length-1];d.pop();a.destroy()}};this.programs=d};THREE.WebGLProperties=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={}}};
 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=u,g=a.customDepthMaterial;c&&(f=v,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),q.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,k=new THREE.Matrix4,l=b.shadows,n=new THREE.Vector2,p=new THREE.Vector3,m=new THREE.Vector3,q=[],u=Array(4),v=Array(4),s=[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)],w=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4];b=THREE.ShaderLib.depthRGBA;for(var C=THREE.UniformsUtils.clone(b.uniforms),x=THREE.ShaderLib.distanceRGBA,
+(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),q.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,k=new THREE.Matrix4,l=b.shadows,n=new THREE.Vector2,p=new THREE.Vector3,m=new THREE.Vector3,q=[],u=Array(4),v=Array(4),t=[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)],s=[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)],w=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4];b=THREE.ShaderLib.depthRGBA;for(var C=THREE.UniformsUtils.clone(b.uniforms),x=THREE.ShaderLib.distanceRGBA,
 B=THREE.UniformsUtils.clone(x.uniforms),A=0;4!==A;++A){var z=0!==(A&1),y=0!==(A&2),F=new THREE.ShaderMaterial({uniforms:C,vertexShader:b.vertexShader,fragmentShader:b.fragmentShader,morphTargets:z,skinning:y});u[A]=F;z=new THREE.ShaderMaterial({defines:{USE_SHADOWMAP:""},uniforms:B,vertexShader:x.vertexShader,fragmentShader:x.fragmentShader,morphTargets:z,skinning:y});v[A]=z}var E=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=THREE.PCFShadowMap;this.cullFace=THREE.CullFaceFront;
 this.render=function(b,u){if(!1!==E.enabled&&(!1!==E.autoUpdate||!1!==E.needsUpdate)&&0!==l.length){g.clearColor(1,1,1,1);g.disable(f.BLEND);g.enable(f.CULL_FACE);f.frontFace(f.CCW);f.cullFace(E.cullFace===THREE.CullFaceFront?f.FRONT:f.BACK);g.setDepthTest(!0);g.setScissorTest(!1);for(var v,x,C=0,y=l.length;C<y;C++){var A=l[C],z=A.shadow,B=z.camera;n.copy(z.mapSize);if(A instanceof THREE.PointLight){v=6;x=!0;var F=n.x,L=n.y;w[0].set(2*F,L,F,L);w[1].set(0,L,F,L);w[2].set(3*F,L,F,L);w[3].set(F,L,F,
-L);w[4].set(3*F,0,F,L);w[5].set(F,0,F,L);n.x*=4;n.y*=2}else v=1,x=!1;null===z.map&&(z.map=new THREE.WebGLRenderTarget(n.x,n.y,{minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat}),A instanceof THREE.SpotLight&&(B.aspect=n.x/n.y),B.updateProjectionMatrix());F=z.map;z=z.matrix;m.setFromMatrixPosition(A.matrixWorld);B.position.copy(m);a.setRenderTarget(F);a.clear();for(F=0;F<v;F++){x?(p.copy(B.position),p.add(s[F]),B.up.copy(t[F]),B.lookAt(p),g.viewport(w[F])):(p.setFromMatrixPosition(A.target.matrixWorld),
+L);w[4].set(3*F,0,F,L);w[5].set(F,0,F,L);n.x*=4;n.y*=2}else v=1,x=!1;null===z.map&&(z.map=new THREE.WebGLRenderTarget(n.x,n.y,{minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat}),A instanceof THREE.SpotLight&&(B.aspect=n.x/n.y),B.updateProjectionMatrix());F=z.map;z=z.matrix;m.setFromMatrixPosition(A.matrixWorld);B.position.copy(m);a.setRenderTarget(F);a.clear();for(F=0;F<v;F++){x?(p.copy(B.position),p.add(t[F]),B.up.copy(s[F]),B.lookAt(p),g.viewport(w[F])):(p.setFromMatrixPosition(A.target.matrixWorld),
 B.lookAt(p));B.updateMatrixWorld();B.matrixWorldInverse.getInverse(B.matrixWorld);z.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);z.multiply(B.projectionMatrix);z.multiply(B.matrixWorldInverse);k.multiplyMatrices(B.projectionMatrix,B.matrixWorldInverse);h.setFromMatrix(k);q.length=0;e(b,u,B);for(var L=0,D=q.length;L<D;L++){var W=q[L],T=c.update(W),Z=W.material;if(Z instanceof THREE.MultiMaterial)for(var $=T.groups,Z=Z.materials,ea=0,na=$.length;ea<na;ea++){var Y=$[ea],ca=Z[Y.materialIndex];!0===ca.visible&&
 (ca=d(W,ca,x,m),a.renderBufferDirect(B,null,T,ca,W,Y))}else ca=d(W,Z,x,m),a.renderBufferDirect(B,null,T,ca,W,null)}}}v=a.getClearColor();x=a.getClearAlpha();a.setClearColor(v,x);g.enable(f.BLEND);E.cullFace===THREE.CullFaceFront&&f.cullFace(f.BACK);E.needsUpdate=!1}}};
-THREE.WebGLState=function(a,b,c){var d=this,e=new THREE.Vector4,f=new Uint8Array(16),g=new Uint8Array(16),h=new Uint8Array(16),k={},l=null,n=null,p=null,m=null,q=null,u=null,v=null,s=null,t=!1,w=null,C=null,x=null,B=null,A=null,z=null,y=null,F=null,E=null,H=null,K=null,G=null,O=null,I=null,M=null,N=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),P=void 0,R={},Q=new THREE.Vector4,L=null,D=null,W=new THREE.Vector4,T=new THREE.Vector4,Z=a.createTexture();a.bindTexture(a.TEXTURE_2D,Z);a.texParameteri(a.TEXTURE_2D,
+THREE.WebGLState=function(a,b,c){var d=this,e=new THREE.Vector4,f=new Uint8Array(16),g=new Uint8Array(16),h=new Uint8Array(16),k={},l=null,n=null,p=null,m=null,q=null,u=null,v=null,t=null,s=!1,w=null,C=null,x=null,B=null,A=null,z=null,y=null,F=null,E=null,H=null,K=null,G=null,P=null,I=null,M=null,N=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),O=void 0,R={},Q=new THREE.Vector4,L=null,D=null,W=new THREE.Vector4,T=new THREE.Vector4,Z=a.createTexture();a.bindTexture(a.TEXTURE_2D,Z);a.texParameteri(a.TEXTURE_2D,
 a.TEXTURE_MIN_FILTER,a.LINEAR);a.texImage2D(a.TEXTURE_2D,0,a.RGB,1,1,0,a.RGB,a.UNSIGNED_BYTE,new Uint8Array(3));this.init=function(){this.clearColor(0,0,0,1);this.clearDepth(1);this.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=f.length;a<b;a++)f[a]=0};this.enableAttribute=function(c){f[c]=
 1;0===g[c]&&(a.enableVertexAttribArray(c),g[c]=1);0!==h[c]&&(b.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(c,0),h[c]=0)};this.enableAttributeAndDivisor=function(b,c,d){f[b]=1;0===g[b]&&(a.enableVertexAttribArray(b),g[b]=1);h[b]!==c&&(d.vertexAttribDivisorANGLE(b,c),h[b]=c)};this.disableUnusedAttributes=function(){for(var b=0,c=g.length;b<c;b++)g[b]!==f[b]&&(a.disableVertexAttribArray(b),g[b]=0)};this.enable=function(b){!0!==k[b]&&(a.enable(b),k[b]=!0)};this.disable=function(b){!1!==k[b]&&
-(a.disable(b),k[b]=!1)};this.getCompressedTextureFormats=function(){if(null===l&&(l=[],b.get("WEBGL_compressed_texture_pvrtc")||b.get("WEBGL_compressed_texture_s3tc")||b.get("WEBGL_compressed_texture_etc1")))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,k,l){b===THREE.NoBlending?this.disable(a.BLEND):this.enable(a.BLEND);if(b!==n||l!==t)b===THREE.AdditiveBlending?l?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),
+(a.disable(b),k[b]=!1)};this.getCompressedTextureFormats=function(){if(null===l&&(l=[],b.get("WEBGL_compressed_texture_pvrtc")||b.get("WEBGL_compressed_texture_s3tc")||b.get("WEBGL_compressed_texture_etc1")))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,k,l){b===THREE.NoBlending?this.disable(a.BLEND):this.enable(a.BLEND);if(b!==n||l!==s)b===THREE.AdditiveBlending?l?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),
 a.blendFuncSeparate(a.ONE,a.ONE,a.ONE,a.ONE)):(a.blendEquation(a.FUNC_ADD),a.blendFunc(a.SRC_ALPHA,a.ONE)):b===THREE.SubtractiveBlending?l?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ZERO,a.ZERO,a.ONE_MINUS_SRC_COLOR,a.ONE_MINUS_SRC_ALPHA)):(a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.ONE_MINUS_SRC_COLOR)):b===THREE.MultiplyBlending?l?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ZERO,a.ZERO,a.SRC_COLOR,a.SRC_ALPHA)):(a.blendEquation(a.FUNC_ADD),
-a.blendFunc(a.ZERO,a.SRC_COLOR)):l?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ONE,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)):(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)),n=b,t=l;if(b===THREE.CustomBlending){g=g||d;h=h||e;k=k||f;if(d!==p||g!==u)a.blendEquationSeparate(c(d),c(g)),p=d,u=g;if(e!==m||f!==q||h!==v||k!==s)a.blendFuncSeparate(c(e),c(f),c(h),c(k)),m=e,q=f,v=h,s=k}else s=
+a.blendFunc(a.ZERO,a.SRC_COLOR)):l?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ONE,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)):(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)),n=b,s=l;if(b===THREE.CustomBlending){g=g||d;h=h||e;k=k||f;if(d!==p||g!==u)a.blendEquationSeparate(c(d),c(g)),p=d,u=g;if(e!==m||f!==q||h!==v||k!==t)a.blendFuncSeparate(c(e),c(f),c(h),c(k)),m=e,q=f,v=h,t=k}else t=
 v=u=q=m=p=null};this.setDepthFunc=function(b){if(w!==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);
 w=b}};this.setDepthTest=function(b){b?this.enable(a.DEPTH_TEST):this.disable(a.DEPTH_TEST)};this.setDepthWrite=function(b){C!==b&&(a.depthMask(b),C=b)};this.setColorWrite=function(b){x!==b&&(a.colorMask(b,b,b,b),x=b)};this.setStencilFunc=function(b,c,d){if(A!==b||z!==c||y!==d)a.stencilFunc(b,c,d),A=b,z=c,y=d};this.setStencilOp=function(b,c,d){if(F!==b||E!==c||H!==d)a.stencilOp(b,c,d),F=b,E=c,H=d};this.setStencilTest=function(b){b?this.enable(a.STENCIL_TEST):this.disable(a.STENCIL_TEST)};this.setStencilWrite=
-function(b){B!==b&&(a.stencilMask(b),B=b)};this.setFlipSided=function(b){K!==b&&(b?a.frontFace(a.CW):a.frontFace(a.CCW),K=b)};this.setLineWidth=function(b){b!==G&&(a.lineWidth(b),G=b)};this.setPolygonOffset=function(b,c,d){b?this.enable(a.POLYGON_OFFSET_FILL):this.disable(a.POLYGON_OFFSET_FILL);!b||O===c&&I===d||(a.polygonOffset(c,d),O=c,I=d)};this.getScissorTest=function(){return M};this.setScissorTest=function(b){(M=b)?this.enable(a.SCISSOR_TEST):this.disable(a.SCISSOR_TEST)};this.activeTexture=
-function(b){void 0===b&&(b=a.TEXTURE0+N-1);P!==b&&(a.activeTexture(b),P=b)};this.bindTexture=function(b,c){void 0===P&&d.activeTexture();var e=R[P];void 0===e&&(e={type:void 0,texture:void 0},R[P]=e);if(e.type!==b||e.texture!==c)a.bindTexture(b,c||Z),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.clearColor=function(b,
-c,d,f){e.set(b,c,d,f);!1===Q.equals(e)&&(a.clearColor(b,c,d,f),Q.copy(e))};this.clearDepth=function(b){L!==b&&(a.clearDepth(b),L=b)};this.clearStencil=function(b){D!==b&&(a.clearStencil(b),D=b)};this.scissor=function(b){!1===W.equals(b)&&(a.scissor(b.x,b.y,b.z,b.w),W.copy(b))};this.viewport=function(b){!1===T.equals(b)&&(a.viewport(b.x,b.y,b.z,b.w),T.copy(b))};this.reset=function(){for(var b=0;b<g.length;b++)1===g[b]&&(a.disableVertexAttribArray(b),g[b]=0);k={};l=null;P=void 0;R={};K=B=C=x=n=null}};
-THREE.LensFlarePlugin=function(a,b){var c,d,e,f,g,h,k,l,n,p,m=a.context,q=a.state,u,v,s,t,w,C;this.render=function(x,B,A){if(0!==b.length){x=new THREE.Vector3;var z=A.w/A.z,y=.5*A.z,F=.5*A.w,E=16/A.w,H=new THREE.Vector2(E*z,E),K=new THREE.Vector3(1,1,0),G=new THREE.Vector2(1,1),O=new THREE.Vector2;if(void 0===s){var E=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),I=new Uint16Array([0,1,2,0,2,3]);u=m.createBuffer();v=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,u);m.bufferData(m.ARRAY_BUFFER,
-E,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,v);m.bufferData(m.ELEMENT_ARRAY_BUFFER,I,m.STATIC_DRAW);w=m.createTexture();C=m.createTexture();q.bindTexture(m.TEXTURE_2D,w);m.texImage2D(m.TEXTURE_2D,0,m.RGB,16,16,0,m.RGB,m.UNSIGNED_BYTE,null);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST);q.bindTexture(m.TEXTURE_2D,
-C);m.texImage2D(m.TEXTURE_2D,0,m.RGBA,16,16,0,m.RGBA,m.UNSIGNED_BYTE,null);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST);var E=(t=0<m.getParameter(m.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:"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}"},
-I=m.createProgram(),M=m.createShader(m.FRAGMENT_SHADER),N=m.createShader(m.VERTEX_SHADER),P="precision "+a.getPrecision()+" float;\n";m.shaderSource(M,P+E.fragmentShader);m.shaderSource(N,P+E.vertexShader);m.compileShader(M);m.compileShader(N);m.attachShader(I,M);m.attachShader(I,N);m.linkProgram(I);s=I;n=m.getAttribLocation(s,"position");p=m.getAttribLocation(s,"uv");c=m.getUniformLocation(s,"renderType");d=m.getUniformLocation(s,"map");e=m.getUniformLocation(s,"occlusionMap");f=m.getUniformLocation(s,
-"opacity");g=m.getUniformLocation(s,"color");h=m.getUniformLocation(s,"scale");k=m.getUniformLocation(s,"rotation");l=m.getUniformLocation(s,"screenPosition")}m.useProgram(s);q.initAttributes();q.enableAttribute(n);q.enableAttribute(p);q.disableUnusedAttributes();m.uniform1i(e,0);m.uniform1i(d,1);m.bindBuffer(m.ARRAY_BUFFER,u);m.vertexAttribPointer(n,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(p,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,v);q.disable(m.CULL_FACE);q.setDepthWrite(!1);I=0;
-for(M=b.length;I<M;I++)if(E=16/A.w,H.set(E*z,E),N=b[I],x.set(N.matrixWorld.elements[12],N.matrixWorld.elements[13],N.matrixWorld.elements[14]),x.applyMatrix4(B.matrixWorldInverse),x.applyProjection(B.projectionMatrix),K.copy(x),G.x=K.x*y+y,G.y=K.y*F+F,O.x=A.x+G.x-8,O.y=A.y+G.y-8,0<O.x&&O.x<A.z-16&&0<O.y&&O.y<A.w-16){q.activeTexture(m.TEXTURE0);q.bindTexture(m.TEXTURE_2D,null);q.activeTexture(m.TEXTURE1);q.bindTexture(m.TEXTURE_2D,w);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGB,O.x,O.y,16,16,0);m.uniform1i(c,
-0);m.uniform2f(h,H.x,H.y);m.uniform3f(l,K.x,K.y,K.z);q.disable(m.BLEND);q.enable(m.DEPTH_TEST);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0);q.activeTexture(m.TEXTURE0);q.bindTexture(m.TEXTURE_2D,C);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGBA,O.x,O.y,16,16,0);m.uniform1i(c,1);q.disable(m.DEPTH_TEST);q.activeTexture(m.TEXTURE1);q.bindTexture(m.TEXTURE_2D,w);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0);N.positionScreen.copy(K);N.customUpdateCallback?N.customUpdateCallback(N):N.updateLensFlares();
-m.uniform1i(c,2);q.enable(m.BLEND);for(var P=0,R=N.lensFlares.length;P<R;P++){var Q=N.lensFlares[P];.001<Q.opacity&&.001<Q.scale&&(K.x=Q.x,K.y=Q.y,K.z=Q.z,E=Q.size*Q.scale/A.w,H.x=E*z,H.y=E,m.uniform3f(l,K.x,K.y,K.z),m.uniform2f(h,H.x,H.y),m.uniform1f(k,Q.rotation),m.uniform1f(f,Q.opacity),m.uniform3f(g,Q.color.r,Q.color.g,Q.color.b),q.setBlending(Q.blending,Q.blendEquation,Q.blendSrc,Q.blendDst),a.setTexture(Q.texture,1),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0))}}q.enable(m.CULL_FACE);q.enable(m.DEPTH_TEST);
-q.setDepthWrite(!0);a.resetGLState()}}};
-THREE.SpritePlugin=function(a,b){var c,d,e,f,g,h,k,l,n,p,m,q,u,v,s,t,w;function C(a,b){return a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:b.id-a.id}var x=a.context,B=a.state,A,z,y,F,E=new THREE.Vector3,H=new THREE.Quaternion,K=new THREE.Vector3;this.render=function(G,O){if(0!==b.length){if(void 0===y){var I=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),M=new Uint16Array([0,1,2,0,2,3]);A=x.createBuffer();z=x.createBuffer();x.bindBuffer(x.ARRAY_BUFFER,
+function(b){B!==b&&(a.stencilMask(b),B=b)};this.setFlipSided=function(b){K!==b&&(b?a.frontFace(a.CW):a.frontFace(a.CCW),K=b)};this.setLineWidth=function(b){b!==G&&(a.lineWidth(b),G=b)};this.setPolygonOffset=function(b,c,d){b?this.enable(a.POLYGON_OFFSET_FILL):this.disable(a.POLYGON_OFFSET_FILL);!b||P===c&&I===d||(a.polygonOffset(c,d),P=c,I=d)};this.getScissorTest=function(){return M};this.setScissorTest=function(b){(M=b)?this.enable(a.SCISSOR_TEST):this.disable(a.SCISSOR_TEST)};this.activeTexture=
+function(b){void 0===b&&(b=a.TEXTURE0+N-1);O!==b&&(a.activeTexture(b),O=b)};this.bindTexture=function(b,c){void 0===O&&d.activeTexture();var e=R[O];void 0===e&&(e={type:void 0,texture:void 0},R[O]=e);if(e.type!==b||e.texture!==c)a.bindTexture(b,c||Z),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.clearColor=function(b,
+c,d,f){e.set(b,c,d,f);!1===Q.equals(e)&&(a.clearColor(b,c,d,f),Q.copy(e))};this.clearDepth=function(b){L!==b&&(a.clearDepth(b),L=b)};this.clearStencil=function(b){D!==b&&(a.clearStencil(b),D=b)};this.scissor=function(b){!1===W.equals(b)&&(a.scissor(b.x,b.y,b.z,b.w),W.copy(b))};this.viewport=function(b){!1===T.equals(b)&&(a.viewport(b.x,b.y,b.z,b.w),T.copy(b))};this.reset=function(){for(var b=0;b<g.length;b++)1===g[b]&&(a.disableVertexAttribArray(b),g[b]=0);k={};l=null;O=void 0;R={};K=B=C=x=n=null}};
+THREE.LensFlarePlugin=function(a,b){var c,d,e,f,g,h,k,l,n,p,m=a.context,q=a.state,u,v,t,s,w,C;this.render=function(x,B,A){if(0!==b.length){x=new THREE.Vector3;var z=A.w/A.z,y=.5*A.z,F=.5*A.w,E=16/A.w,H=new THREE.Vector2(E*z,E),K=new THREE.Vector3(1,1,0),G=new THREE.Vector2(1,1),P=new THREE.Box2;P.min.set(0,0);P.max.set(A.z-16,A.w-16);if(void 0===s){var E=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),I=new Uint16Array([0,1,2,0,2,3]);u=m.createBuffer();v=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,
+u);m.bufferData(m.ARRAY_BUFFER,E,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,v);m.bufferData(m.ELEMENT_ARRAY_BUFFER,I,m.STATIC_DRAW);w=m.createTexture();C=m.createTexture();q.bindTexture(m.TEXTURE_2D,w);m.texImage2D(m.TEXTURE_2D,0,m.RGB,16,16,0,m.RGB,m.UNSIGNED_BYTE,null);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,
+m.NEAREST);q.bindTexture(m.TEXTURE_2D,C);m.texImage2D(m.TEXTURE_2D,0,m.RGBA,16,16,0,m.RGBA,m.UNSIGNED_BYTE,null);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST);var E=t={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}"},I=m.createProgram(),M=m.createShader(m.FRAGMENT_SHADER),
+N=m.createShader(m.VERTEX_SHADER),O="precision "+a.getPrecision()+" float;\n";m.shaderSource(M,O+E.fragmentShader);m.shaderSource(N,O+E.vertexShader);m.compileShader(M);m.compileShader(N);m.attachShader(I,M);m.attachShader(I,N);m.linkProgram(I);s=I;n=m.getAttribLocation(s,"position");p=m.getAttribLocation(s,"uv");c=m.getUniformLocation(s,"renderType");d=m.getUniformLocation(s,"map");e=m.getUniformLocation(s,"occlusionMap");f=m.getUniformLocation(s,"opacity");g=m.getUniformLocation(s,"color");h=m.getUniformLocation(s,
+"scale");k=m.getUniformLocation(s,"rotation");l=m.getUniformLocation(s,"screenPosition")}m.useProgram(s);q.initAttributes();q.enableAttribute(n);q.enableAttribute(p);q.disableUnusedAttributes();m.uniform1i(e,0);m.uniform1i(d,1);m.bindBuffer(m.ARRAY_BUFFER,u);m.vertexAttribPointer(n,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(p,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,v);q.disable(m.CULL_FACE);q.setDepthWrite(!1);I=0;for(M=b.length;I<M;I++)if(E=16/A.w,H.set(E*z,E),N=b[I],x.set(N.matrixWorld.elements[12],
+N.matrixWorld.elements[13],N.matrixWorld.elements[14]),x.applyMatrix4(B.matrixWorldInverse),x.applyProjection(B.projectionMatrix),K.copy(x),G.x=A.x+K.x*y+y-8,G.y=A.y+K.y*F+F-8,!0===P.containsPoint(G)){q.activeTexture(m.TEXTURE0);q.bindTexture(m.TEXTURE_2D,null);q.activeTexture(m.TEXTURE1);q.bindTexture(m.TEXTURE_2D,w);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGB,G.x,G.y,16,16,0);m.uniform1i(c,0);m.uniform2f(h,H.x,H.y);m.uniform3f(l,K.x,K.y,K.z);q.disable(m.BLEND);q.enable(m.DEPTH_TEST);m.drawElements(m.TRIANGLES,
+6,m.UNSIGNED_SHORT,0);q.activeTexture(m.TEXTURE0);q.bindTexture(m.TEXTURE_2D,C);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGBA,G.x,G.y,16,16,0);m.uniform1i(c,1);q.disable(m.DEPTH_TEST);q.activeTexture(m.TEXTURE1);q.bindTexture(m.TEXTURE_2D,w);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0);N.positionScreen.copy(K);N.customUpdateCallback?N.customUpdateCallback(N):N.updateLensFlares();m.uniform1i(c,2);q.enable(m.BLEND);for(var O=0,R=N.lensFlares.length;O<R;O++){var Q=N.lensFlares[O];.001<Q.opacity&&.001<Q.scale&&
+(K.x=Q.x,K.y=Q.y,K.z=Q.z,E=Q.size*Q.scale/A.w,H.x=E*z,H.y=E,m.uniform3f(l,K.x,K.y,K.z),m.uniform2f(h,H.x,H.y),m.uniform1f(k,Q.rotation),m.uniform1f(f,Q.opacity),m.uniform3f(g,Q.color.r,Q.color.g,Q.color.b),q.setBlending(Q.blending,Q.blendEquation,Q.blendSrc,Q.blendDst),a.setTexture(Q.texture,1),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0))}}q.enable(m.CULL_FACE);q.enable(m.DEPTH_TEST);q.setDepthWrite(!0);a.resetGLState()}}};
+THREE.SpritePlugin=function(a,b){var c,d,e,f,g,h,k,l,n,p,m,q,u,v,t,s,w;function C(a,b){return a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:b.id-a.id}var x=a.context,B=a.state,A,z,y,F,E=new THREE.Vector3,H=new THREE.Quaternion,K=new THREE.Vector3;this.render=function(G,P){if(0!==b.length){if(void 0===y){var I=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),M=new Uint16Array([0,1,2,0,2,3]);A=x.createBuffer();z=x.createBuffer();x.bindBuffer(x.ARRAY_BUFFER,
 A);x.bufferData(x.ARRAY_BUFFER,I,x.STATIC_DRAW);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,z);x.bufferData(x.ELEMENT_ARRAY_BUFFER,M,x.STATIC_DRAW);var I=x.createProgram(),M=x.createShader(x.VERTEX_SHADER),N=x.createShader(x.FRAGMENT_SHADER);x.shaderSource(M,["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(N,["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(M);x.compileShader(N);x.attachShader(I,M);x.attachShader(I,N);x.linkProgram(I);y=I;t=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");k=x.getUniformLocation(y,"opacity");l=x.getUniformLocation(y,"modelViewMatrix");n=x.getUniformLocation(y,"projectionMatrix");p=
-x.getUniformLocation(y,"fogType");m=x.getUniformLocation(y,"fogDensity");q=x.getUniformLocation(y,"fogNear");u=x.getUniformLocation(y,"fogFar");v=x.getUniformLocation(y,"fogColor");s=x.getUniformLocation(y,"alphaTest");I=document.createElement("canvas");I.width=8;I.height=8;M=I.getContext("2d");M.fillStyle="white";M.fillRect(0,0,8,8);F=new THREE.Texture(I);F.needsUpdate=!0}x.useProgram(y);B.initAttributes();B.enableAttribute(t);B.enableAttribute(w);B.disableUnusedAttributes();B.disable(x.CULL_FACE);
-B.enable(x.BLEND);x.bindBuffer(x.ARRAY_BUFFER,A);x.vertexAttribPointer(t,2,x.FLOAT,!1,16,0);x.vertexAttribPointer(w,2,x.FLOAT,!1,16,8);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,z);x.uniformMatrix4fv(n,!1,O.projectionMatrix.elements);B.activeTexture(x.TEXTURE0);x.uniform1i(h,0);M=I=0;(N=G.fog)?(x.uniform3f(v,N.color.r,N.color.g,N.color.b),N instanceof THREE.Fog?(x.uniform1f(q,N.near),x.uniform1f(u,N.far),x.uniform1i(p,1),M=I=1):N instanceof THREE.FogExp2&&(x.uniform1f(m,N.density),x.uniform1i(p,2),M=I=2)):
-(x.uniform1i(p,0),M=I=0);for(var N=0,P=b.length;N<P;N++){var R=b[N];R.modelViewMatrix.multiplyMatrices(O.matrixWorldInverse,R.matrixWorld);R.z=-R.modelViewMatrix.elements[14]}b.sort(C);for(var Q=[],N=0,P=b.length;N<P;N++){var R=b[N],L=R.material;x.uniform1f(s,L.alphaTest);x.uniformMatrix4fv(l,!1,R.modelViewMatrix.elements);R.matrixWorld.decompose(E,H,K);Q[0]=K.x;Q[1]=K.y;R=0;G.fog&&L.fog&&(R=M);I!==R&&(x.uniform1i(p,R),I=R);null!==L.map?(x.uniform2f(c,L.map.offset.x,L.map.offset.y),x.uniform2f(d,
+x.compileShader(M);x.compileShader(N);x.attachShader(I,M);x.attachShader(I,N);x.linkProgram(I);y=I;s=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");k=x.getUniformLocation(y,"opacity");l=x.getUniformLocation(y,"modelViewMatrix");n=x.getUniformLocation(y,"projectionMatrix");p=
+x.getUniformLocation(y,"fogType");m=x.getUniformLocation(y,"fogDensity");q=x.getUniformLocation(y,"fogNear");u=x.getUniformLocation(y,"fogFar");v=x.getUniformLocation(y,"fogColor");t=x.getUniformLocation(y,"alphaTest");I=document.createElement("canvas");I.width=8;I.height=8;M=I.getContext("2d");M.fillStyle="white";M.fillRect(0,0,8,8);F=new THREE.Texture(I);F.needsUpdate=!0}x.useProgram(y);B.initAttributes();B.enableAttribute(s);B.enableAttribute(w);B.disableUnusedAttributes();B.disable(x.CULL_FACE);
+B.enable(x.BLEND);x.bindBuffer(x.ARRAY_BUFFER,A);x.vertexAttribPointer(s,2,x.FLOAT,!1,16,0);x.vertexAttribPointer(w,2,x.FLOAT,!1,16,8);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,z);x.uniformMatrix4fv(n,!1,P.projectionMatrix.elements);B.activeTexture(x.TEXTURE0);x.uniform1i(h,0);M=I=0;(N=G.fog)?(x.uniform3f(v,N.color.r,N.color.g,N.color.b),N instanceof THREE.Fog?(x.uniform1f(q,N.near),x.uniform1f(u,N.far),x.uniform1i(p,1),M=I=1):N instanceof THREE.FogExp2&&(x.uniform1f(m,N.density),x.uniform1i(p,2),M=I=2)):
+(x.uniform1i(p,0),M=I=0);for(var N=0,O=b.length;N<O;N++){var R=b[N];R.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,R.matrixWorld);R.z=-R.modelViewMatrix.elements[14]}b.sort(C);for(var Q=[],N=0,O=b.length;N<O;N++){var R=b[N],L=R.material;x.uniform1f(t,L.alphaTest);x.uniformMatrix4fv(l,!1,R.modelViewMatrix.elements);R.matrixWorld.decompose(E,H,K);Q[0]=K.x;Q[1]=K.y;R=0;G.fog&&L.fog&&(R=M);I!==R&&(x.uniform1i(p,R),I=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(k,L.opacity);x.uniform3f(g,L.color.r,L.color.g,L.color.b);x.uniform1f(e,L.rotation);x.uniform2fv(f,Q);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(F,0);x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0)}B.enable(x.CULL_FACE);a.resetGLState()}}};
 Object.defineProperties(THREE.Box2.prototype,{empty:{value:function(){console.warn("THREE.Box2: .empty() has been renamed to .isEmpty().");return this.isEmpty()}},isIntersectionBox:{value:function(a){console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(a)}}});
 Object.defineProperties(THREE.Box3.prototype,{empty:{value:function(){console.warn("THREE.Box3: .empty() has been renamed to .isEmpty().");return this.isEmpty()}},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)}}});
@@ -796,12 +794,12 @@ 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.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,k;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 l=2*c;for(h=c-1;2<c;){if(0>=l--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}g=h;c<=g&&(g=0);h=g+1;c<=h&&(h=0);k=h+1;c<=k&&(k=0);var n;a:{var p=
-n=void 0,m=void 0,q=void 0,u=void 0,v=void 0,s=void 0,t=void 0,w=void 0,p=a[e[g]].x,m=a[e[g]].y,q=a[e[h]].x,u=a[e[h]].y,v=a[e[k]].x,s=a[e[k]].y;if(Number.EPSILON>(q-p)*(s-m)-(u-m)*(v-p))n=!1;else{var C=void 0,x=void 0,B=void 0,A=void 0,z=void 0,y=void 0,F=void 0,E=void 0,H=void 0,K=void 0,H=E=F=w=t=void 0,C=v-q,x=s-u,B=p-v,A=m-s,z=q-p,y=u-m;for(n=0;n<c;n++)if(t=a[e[n]].x,w=a[e[n]].y,!(t===p&&w===m||t===q&&w===u||t===v&&w===s)&&(F=t-p,E=w-m,H=t-q,K=w-u,t-=v,w-=s,H=C*K-x*H,F=z*E-y*F,E=B*w-A*t,H>=-Number.EPSILON&&
+n=void 0,m=void 0,q=void 0,u=void 0,v=void 0,t=void 0,s=void 0,w=void 0,p=a[e[g]].x,m=a[e[g]].y,q=a[e[h]].x,u=a[e[h]].y,v=a[e[k]].x,t=a[e[k]].y;if(Number.EPSILON>(q-p)*(t-m)-(u-m)*(v-p))n=!1;else{var C=void 0,x=void 0,B=void 0,A=void 0,z=void 0,y=void 0,F=void 0,E=void 0,H=void 0,K=void 0,H=E=F=w=s=void 0,C=v-q,x=t-u,B=p-v,A=m-t,z=q-p,y=u-m;for(n=0;n<c;n++)if(s=a[e[n]].x,w=a[e[n]].y,!(s===p&&w===m||s===q&&w===u||s===v&&w===t)&&(F=s-p,E=w-m,H=s-q,K=w-u,s-=v,w-=t,H=C*K-x*H,F=z*E-y*F,E=B*w-A*s,H>=-Number.EPSILON&&
 E>=-Number.EPSILON&&F>=-Number.EPSILON)){n=!1;break a}n=!0}}if(n){d.push([a[e[g]],a[e[h]],a[e[k]]]);f.push([e[g],e[h],e[k]]);g=h;for(k=h+1;k<c;g++,k++)e[g]=e[k];c--;l=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,p=a.x-d.x,n=a.y-d.y,z=h*k-g*l,y=h*p-g*n;if(Math.abs(z)>Number.EPSILON){if(0<z){if(0>y||y>
 z)return[];k=l*p-k*n;if(0>k||k>z)return[]}else{if(0<y||y<z)return[];k=l*p-k*n;if(0<k||k<z)return[]}if(0===k)return!f||0!==y&&y!==z?[a]:[];if(k===z)return!f||0!==y&&y!==z?[b]:[];if(0===y)return[d];if(y===z)return[e];f=k/z;return[{x:a.x+f*g,y:a.y+f*h}]}if(0!==y||l*p!==k*n)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,z=d.x,l=e,d=e.x):(b=
 e,z=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,z=d.y,l=e,d=e.y):(b=e,z=e.y,l=d,d=d.y));return k<=z?a<z?[]:a===z?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,k,l,n={};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++)l=h[f].x+":"+h[f].y,void 0!==n[l]&&console.warn("THREE.Shape: Duplicate point",l),n[l]=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=[],p,n,A,z,y,F=[],E,H,K,G=0;for(p=b.length;G<p;G++)l.push(G);E=0;for(var O=2*l.length;0<l.length;){O--;if(0>O){console.log("Infinite Loop! Holes left:"+l.length+", Probably Hole outside Shape!");break}for(n=E;n<h.length;n++){A=h[n];p=-1;for(G=0;G<l.length;G++)if(z=l[G],y=A.x+":"+A.y+":"+z,void 0===F[y]){k=b[z];for(H=0;H<k.length;H++)if(z=k[H],c(n,H)&&!f(A,z)&&!g(A,z)){p=H;l.splice(G,1);
+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=[],p,n,A,z,y,F=[],E,H,K,G=0;for(p=b.length;G<p;G++)l.push(G);E=0;for(var P=2*l.length;0<l.length;){P--;if(0>P){console.log("Infinite Loop! Holes left:"+l.length+", Probably Hole outside Shape!");break}for(n=E;n<h.length;n++){A=h[n];p=-1;for(G=0;G<l.length;G++)if(z=l[G],y=A.x+":"+A.y+":"+z,void 0===F[y]){k=b[z];for(H=0;H<k.length;H++)if(z=k[H],c(n,H)&&!f(A,z)&&!g(A,z)){p=H;l.splice(G,1);
 E=h.slice(0,n+1);z=h.slice(n);H=k.slice(p);K=k.slice(0,p+1);h=E.concat(H).concat(K).concat(z);E=n;break}if(0<=p)break;F[y]=!0}if(0<=p)break}}return h}(a,b);var p=THREE.ShapeUtils.triangulate(f,!1);f=0;for(g=p.length;f<g;f++)for(k=p[f],h=0;3>h;h++)l=k[h].x+":"+k[h].y,l=n[l],void 0!==l&&(k[h]=l);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(){};
 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||
@@ -811,8 +809,8 @@ THREE.Curve.create=function(a,b){a.prototype=Object.create(THREE.Curve.prototype
 THREE.CurvePath.prototype.closePath=function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),d=0;d<c.length;){if(c[d]>=b)return a=this.curves[d],b=1-(c[d]-b)/a.getLength(),a.getPointAt(b);d++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
 THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var a=[],b=0,c=0,d=this.curves.length;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};THREE.CurvePath.prototype.createPointsGeometry=function(a){a=this.getPoints(a);return this.createGeometry(a)};THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){a=this.getSpacedPoints(a);return this.createGeometry(a)};
 THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0,d=a.length;c<d;c++){var e=a[c];b.vertices.push(new THREE.Vector3(e.x,e.y,e.z||0))}return b};THREE.Font=function(a){this.data=a};
-THREE.Font.prototype={constructor:THREE.Font,generateShapes:function(a,b,c){void 0===b&&(b=100);void 0===c&&(c=4);var d=this.data;a=String(a).split("");var e=b/d.resolution,f=0;b=[];for(var g=0;g<a.length;g++){var h;h=e;var k=f,l=d.glyphs[a[g]]||d.glyphs["?"];if(l){var n=new THREE.Path,p=[],m=THREE.ShapeUtils.b2,q=THREE.ShapeUtils.b3,u=void 0,v=void 0,s=v=u=void 0,t=void 0,w=void 0,C=void 0,x=void 0,B=void 0,t=void 0;if(l.o)for(var A=l._cachedOutline||(l._cachedOutline=l.o.split(" ")),z=0,y=A.length;z<
-y;)switch(A[z++]){case "m":u=A[z++]*h+k;v=A[z++]*h;n.moveTo(u,v);break;case "l":u=A[z++]*h+k;v=A[z++]*h;n.lineTo(u,v);break;case "q":u=A[z++]*h+k;v=A[z++]*h;w=A[z++]*h+k;C=A[z++]*h;n.quadraticCurveTo(w,C,u,v);if(t=p[p.length-1])for(var s=t.x,t=t.y,F=1;F<=c;F++){var E=F/c;m(E,s,w,u);m(E,t,C,v)}break;case "b":if(u=A[z++]*h+k,v=A[z++]*h,w=A[z++]*h+k,C=A[z++]*h,x=A[z++]*h+k,B=A[z++]*h,n.bezierCurveTo(w,C,x,B,u,v),t=p[p.length-1])for(s=t.x,t=t.y,F=1;F<=c;F++)E=F/c,q(E,s,w,x,u),q(E,t,C,B,v)}h={offset:l.ha*
+THREE.Font.prototype={constructor:THREE.Font,generateShapes:function(a,b,c){void 0===b&&(b=100);void 0===c&&(c=4);var d=this.data;a=String(a).split("");var e=b/d.resolution,f=0;b=[];for(var g=0;g<a.length;g++){var h;h=e;var k=f,l=d.glyphs[a[g]]||d.glyphs["?"];if(l){var n=new THREE.Path,p=[],m=THREE.ShapeUtils.b2,q=THREE.ShapeUtils.b3,u=void 0,v=void 0,t=v=u=void 0,s=void 0,w=void 0,C=void 0,x=void 0,B=void 0,s=void 0;if(l.o)for(var A=l._cachedOutline||(l._cachedOutline=l.o.split(" ")),z=0,y=A.length;z<
+y;)switch(A[z++]){case "m":u=A[z++]*h+k;v=A[z++]*h;n.moveTo(u,v);break;case "l":u=A[z++]*h+k;v=A[z++]*h;n.lineTo(u,v);break;case "q":u=A[z++]*h+k;v=A[z++]*h;w=A[z++]*h+k;C=A[z++]*h;n.quadraticCurveTo(w,C,u,v);if(s=p[p.length-1])for(var t=s.x,s=s.y,F=1;F<=c;F++){var E=F/c;m(E,t,w,u);m(E,s,C,v)}break;case "b":if(u=A[z++]*h+k,v=A[z++]*h,w=A[z++]*h+k,C=A[z++]*h,x=A[z++]*h+k,B=A[z++]*h,n.bezierCurveTo(w,C,x,B,u,v),s=p[p.length-1])for(t=s.x,s=s.y,F=1;F<=c;F++)E=F/c,q(E,t,w,x,u),q(E,s,C,B,v)}h={offset:l.ha*
 h,path:n}}else h=void 0;f+=h.offset;b.push(h.path)}c=[];d=0;for(a=b.length;d<a;d++)Array.prototype.push.apply(c,b[d].toShapes());return c}};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=Object.create(THREE.CurvePath.prototype);THREE.Path.prototype.constructor=THREE.Path;THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)};
 THREE.Path.prototype.moveTo=function(a,b){this.actions.push({action:"moveTo",args:[a,b]})};THREE.Path.prototype.lineTo=function(a,b){var c=this.actions[this.actions.length-1].args,c=new THREE.LineCurve(new THREE.Vector2(c[c.length-2],c[c.length-1]),new THREE.Vector2(a,b));this.curves.push(c);this.actions.push({action:"lineTo",args:[a,b]})};
 THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=this.actions[this.actions.length-1].args,e=new THREE.QuadraticBezierCurve(new THREE.Vector2(e[e.length-2],e[e.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d));this.curves.push(e);this.actions.push({action:"quadraticCurveTo",args:[a,b,c,d]})};
@@ -820,13 +818,13 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=this.actions[this
 THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:"splineThru",args:b})};THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=this.actions[this.actions.length-1].args;this.absarc(a+g[g.length-2],b+g[g.length-1],c,d,e,f)};
 THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,g,h){var k=this.actions[this.actions.length-1].args;this.absellipse(a+k[k.length-2],b+k[k.length-1],c,d,e,f,g,h)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,g,h){var k=[a,b,c,d,e,f,g,h||0];a=new THREE.EllipseCurve(a,b,c,d,e,f,g,h);this.curves.push(a);a=a.getPoint(1);k.push(a.x);k.push(a.y);this.actions.push({action:"ellipse",args:k})};
 THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));this.autoClose&&b.push(b[0]);return b};
-THREE.Path.prototype.getPoints=function(a){a=a||12;for(var b=THREE.ShapeUtils.b2,c=THREE.ShapeUtils.b3,d=[],e,f,g,h,k,l,n,p,m,q,u=0,v=this.actions.length;u<v;u++){m=this.actions[u];var s=m.args;switch(m.action){case "moveTo":d.push(new THREE.Vector2(s[0],s[1]));break;case "lineTo":d.push(new THREE.Vector2(s[0],s[1]));break;case "quadraticCurveTo":e=s[2];f=s[3];k=s[0];l=s[1];0<d.length?(m=d[d.length-1],n=m.x,p=m.y):(m=this.actions[u-1].args,n=m[m.length-2],p=m[m.length-1]);for(s=1;s<=a;s++)q=s/a,m=
-b(q,n,k,e),q=b(q,p,l,f),d.push(new THREE.Vector2(m,q));break;case "bezierCurveTo":e=s[4];f=s[5];k=s[0];l=s[1];g=s[2];h=s[3];0<d.length?(m=d[d.length-1],n=m.x,p=m.y):(m=this.actions[u-1].args,n=m[m.length-2],p=m[m.length-1]);for(s=1;s<=a;s++)q=s/a,m=c(q,n,k,g,e),q=c(q,p,l,h,f),d.push(new THREE.Vector2(m,q));break;case "splineThru":m=this.actions[u-1].args;q=[new THREE.Vector2(m[m.length-2],m[m.length-1])];m=a*s[0].length;q=q.concat(s[0]);q=new THREE.SplineCurve(q);for(s=1;s<=m;s++)d.push(q.getPointAt(s/
-m));break;case "arc":e=s[0];f=s[1];l=s[2];g=s[3];m=s[4];k=!!s[5];n=m-g;p=2*a;for(s=1;s<=p;s++)q=s/p,k||(q=1-q),q=g+q*n,m=e+l*Math.cos(q),q=f+l*Math.sin(q),d.push(new THREE.Vector2(m,q));break;case "ellipse":e=s[0];f=s[1];l=s[2];h=s[3];g=s[4];m=s[5];k=!!s[6];var t=s[7];n=m-g;p=2*a;var w,C;0!==t&&(w=Math.cos(t),C=Math.sin(t));for(s=1;s<=p;s++){q=s/p;k||(q=1-q);q=g+q*n;m=e+l*Math.cos(q);q=f+h*Math.sin(q);if(0!==t){var x=m;m=(x-e)*w-(q-f)*C+e;q=(x-e)*C+(q-f)*w+f}d.push(new THREE.Vector2(m,q))}}}a=d[d.length-
+THREE.Path.prototype.getPoints=function(a){a=a||12;for(var b=THREE.ShapeUtils.b2,c=THREE.ShapeUtils.b3,d=[],e,f,g,h,k,l,n,p,m,q,u=0,v=this.actions.length;u<v;u++){m=this.actions[u];var t=m.args;switch(m.action){case "moveTo":d.push(new THREE.Vector2(t[0],t[1]));break;case "lineTo":d.push(new THREE.Vector2(t[0],t[1]));break;case "quadraticCurveTo":e=t[2];f=t[3];k=t[0];l=t[1];0<d.length?(m=d[d.length-1],n=m.x,p=m.y):(m=this.actions[u-1].args,n=m[m.length-2],p=m[m.length-1]);for(t=1;t<=a;t++)q=t/a,m=
+b(q,n,k,e),q=b(q,p,l,f),d.push(new THREE.Vector2(m,q));break;case "bezierCurveTo":e=t[4];f=t[5];k=t[0];l=t[1];g=t[2];h=t[3];0<d.length?(m=d[d.length-1],n=m.x,p=m.y):(m=this.actions[u-1].args,n=m[m.length-2],p=m[m.length-1]);for(t=1;t<=a;t++)q=t/a,m=c(q,n,k,g,e),q=c(q,p,l,h,f),d.push(new THREE.Vector2(m,q));break;case "splineThru":m=this.actions[u-1].args;q=[new THREE.Vector2(m[m.length-2],m[m.length-1])];m=a*t[0].length;q=q.concat(t[0]);q=new THREE.SplineCurve(q);for(t=1;t<=m;t++)d.push(q.getPointAt(t/
+m));break;case "arc":e=t[0];f=t[1];l=t[2];g=t[3];m=t[4];k=!!t[5];n=m-g;p=2*a;for(t=1;t<=p;t++)q=t/p,k||(q=1-q),q=g+q*n,m=e+l*Math.cos(q),q=f+l*Math.sin(q),d.push(new THREE.Vector2(m,q));break;case "ellipse":e=t[0];f=t[1];l=t[2];h=t[3];g=t[4];m=t[5];k=!!t[6];var s=t[7];n=m-g;p=2*a;var w,C;0!==s&&(w=Math.cos(s),C=Math.sin(s));for(t=1;t<=p;t++){q=t/p;k||(q=1-q);q=g+q*n;m=e+l*Math.cos(q);q=f+h*Math.sin(q);if(0!==s){var x=m;m=(x-e)*w-(q-f)*C+e;q=(x-e)*C+(q-f)*w+f}d.push(new THREE.Vector2(m,q))}}}a=d[d.length-
 1];Math.abs(a.x-d[0].x)<Number.EPSILON&&Math.abs(a.y-d[0].y)<Number.EPSILON&&d.splice(d.length-1,1);this.autoClose&&d.push(d[0]);return d};
 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,k,l=[];if(1===f.length)return h=f[0],k=new THREE.Shape,k.actions=h.actions,k.curves=h.curves,l.push(k),l;var n=!e(f[0].getPoints()),n=a?!n:
-n;k=[];var p=[],m=[],q=0,u;p[q]=void 0;m[q]=[];for(var v=0,s=f.length;v<s;v++)h=f[v],u=h.getPoints(),g=e(u),(g=a?!g:g)?(!n&&p[q]&&q++,p[q]={s:new THREE.Shape,p:u},p[q].s.actions=h.actions,p[q].s.curves=h.curves,n&&q++,m[q]=[]):m[q].push({h:h,p:u[0]});if(!p[0])return c(f);if(1<p.length){v=!1;h=[];e=0;for(f=p.length;e<f;e++)k[e]=[];e=0;for(f=p.length;e<f;e++)for(g=m[e],n=0;n<g.length;n++){q=g[n];u=!0;for(s=0;s<p.length;s++)d(q.p,p[s].p)&&(e!==s&&h.push({froms:e,tos:s,hole:n}),u?(u=!1,k[s].push(q)):
+n;k=[];var p=[],m=[],q=0,u;p[q]=void 0;m[q]=[];for(var v=0,t=f.length;v<t;v++)h=f[v],u=h.getPoints(),g=e(u),(g=a?!g:g)?(!n&&p[q]&&q++,p[q]={s:new THREE.Shape,p:u},p[q].s.actions=h.actions,p[q].s.curves=h.curves,n&&q++,m[q]=[]):m[q].push({h:h,p:u[0]});if(!p[0])return c(f);if(1<p.length){v=!1;h=[];e=0;for(f=p.length;e<f;e++)k[e]=[];e=0;for(f=p.length;e<f;e++)for(g=m[e],n=0;n<g.length;n++){q=g[n];u=!0;for(t=0;t<p.length;t++)d(q.p,p[t].p)&&(e!==t&&h.push({froms:e,tos:t,hole:n}),u?(u=!1,k[t].push(q)):
 v=!0);u&&k[e].push(q)}0<h.length&&(v||(m=k))}v=0;for(e=p.length;v<e;v++)for(k=p[v].s,l.push(k),h=m[v],f=0,g=h.length;f<g;f++)k.holes.push(h[f].h);return l};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);THREE.Shape.prototype.constructor=THREE.Shape;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){for(var b=[],c=0,d=this.holes.length;c<d;c++)b[c]=this.holes[c].getPoints(a);return b};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.extractAllPoints(a)};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.constructor=THREE.LineCurve;
 THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(a){return this.v2.clone().sub(this.v1).normalize()};THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
@@ -845,28 +843,28 @@ b*a};return THREE.Curve.create(function(a){this.points=a||[];this.closed=!1},fun
 this.type||"centripetal"===this.type||"chordal"===this.type){var m="chordal"===this.type?.5:.25;k=Math.pow(l.distanceToSquared(n),m);h=Math.pow(n.distanceToSquared(p),m);m=Math.pow(p.distanceToSquared(g),m);1E-4>h&&(h=1);1E-4>k&&(k=h);1E-4>m&&(m=h);c.initNonuniformCatmullRom(l.x,n.x,p.x,g.x,k,h,m);d.initNonuniformCatmullRom(l.y,n.y,p.y,g.y,k,h,m);e.initNonuniformCatmullRom(l.z,n.z,p.z,g.z,k,h,m)}else"catmullrom"===this.type&&(k=void 0!==this.tension?this.tension:.5,c.initCatmullRom(l.x,n.x,p.x,g.x,
 k),d.initCatmullRom(l.y,n.y,p.y,g.y,k),e.initCatmullRom(l.z,n.z,p.z,g.z,k));return new THREE.Vector3(c.calc(a),d.calc(a),e.calc(a))})}();THREE.ClosedSplineCurve3=function(a){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3.");THREE.CatmullRomCurve3.call(this,a);this.type="catmullrom";this.closed=!0};THREE.ClosedSplineCurve3.prototype=Object.create(THREE.CatmullRomCurve3.prototype);
 THREE.BoxGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.fromBufferGeometry(new THREE.BoxBufferGeometry(a,b,c,d,e,f));this.mergeVertices()};THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.BoxGeometry.prototype.constructor=THREE.BoxGeometry;THREE.CubeGeometry=THREE.BoxGeometry;
-THREE.BoxBufferGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,k,l,K,G){var O=f/l,I=g/K,M=f/2,N=g/2,P=k/2;g=l+1;for(var R=K+1,Q=f=0,L=new THREE.Vector3,D=0;D<R;D++)for(var W=D*I-N,T=0;T<g;T++)L[a]=(T*O-M)*d,L[b]=W*e,L[c]=P,p[u]=L.x,p[u+1]=L.y,p[u+2]=L.z,L[a]=0,L[b]=0,L[c]=0<k?1:-1,m[u]=L.x,m[u+1]=L.y,m[u+2]=L.z,q[v]=T/l,q[v+1]=1-D/K,u+=3,v+=2,f+=1;for(D=0;D<K;D++)for(T=0;T<l;T++)a=t+T+g*(D+1),b=t+(T+1)+g*(D+1),c=t+(T+1)+g*D,n[s]=t+T+g*D,n[s+1]=a,n[s+2]=c,n[s+3]=a,n[s+4]=b,n[s+5]=c,s+=6,Q+=
-6;h.addGroup(w,Q,G);w+=Q;t+=f}THREE.BufferGeometry.call(this);this.type="BoxBufferGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};var h=this;d=Math.floor(d)||1;e=Math.floor(e)||1;f=Math.floor(f)||1;var k=function(a,b,c){a=0+a*b*2+a*c*2;a+=c*b*2;return 4*a}(d,e,f),l=k/4*6,n=new (65535<l?Uint32Array:Uint16Array)(l),p=new Float32Array(3*k),m=new Float32Array(3*k),q=new Float32Array(2*k),u=0,v=0,s=0,t=0,w=0;g("z","y","x",-1,-1,c,b,a,f,e,0);g("z","y",
+THREE.BoxBufferGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,k,l,K,G){var P=f/l,I=g/K,M=f/2,N=g/2,O=k/2;g=l+1;for(var R=K+1,Q=f=0,L=new THREE.Vector3,D=0;D<R;D++)for(var W=D*I-N,T=0;T<g;T++)L[a]=(T*P-M)*d,L[b]=W*e,L[c]=O,p[u]=L.x,p[u+1]=L.y,p[u+2]=L.z,L[a]=0,L[b]=0,L[c]=0<k?1:-1,m[u]=L.x,m[u+1]=L.y,m[u+2]=L.z,q[v]=T/l,q[v+1]=1-D/K,u+=3,v+=2,f+=1;for(D=0;D<K;D++)for(T=0;T<l;T++)a=s+T+g*(D+1),b=s+(T+1)+g*(D+1),c=s+(T+1)+g*D,n[t]=s+T+g*D,n[t+1]=a,n[t+2]=c,n[t+3]=a,n[t+4]=b,n[t+5]=c,t+=6,Q+=
+6;h.addGroup(w,Q,G);w+=Q;s+=f}THREE.BufferGeometry.call(this);this.type="BoxBufferGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};var h=this;d=Math.floor(d)||1;e=Math.floor(e)||1;f=Math.floor(f)||1;var k=function(a,b,c){a=0+a*b*2+a*c*2;a+=c*b*2;return 4*a}(d,e,f),l=k/4*6,n=new (65535<l?Uint32Array:Uint16Array)(l),p=new Float32Array(3*k),m=new Float32Array(3*k),q=new Float32Array(2*k),u=0,v=0,t=0,s=0,w=0;g("z","y","x",-1,-1,c,b,a,f,e,0);g("z","y",
 "x",1,-1,c,b,-a,f,e,1);g("x","z","y",1,1,a,c,b,d,f,2);g("x","z","y",1,-1,a,c,-b,d,f,3);g("x","y","z",1,-1,a,b,c,d,e,4);g("x","y","z",-1,-1,a,b,-c,d,e,5);this.setIndex(new THREE.BufferAttribute(n,1));this.addAttribute("position",new THREE.BufferAttribute(p,3));this.addAttribute("normal",new THREE.BufferAttribute(m,3));this.addAttribute("uv",new THREE.BufferAttribute(q,2))};THREE.BoxBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);
 THREE.BoxBufferGeometry.prototype.constructor=THREE.BoxBufferGeometry;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,k=3,l=2;h<=b;h++,k+=3,l+=2){var n=c+h/b*d;f[k]=a*Math.cos(n);f[k+1]=a*Math.sin(n);g[k+2]=1;e[l]=(f[k]/a+1)/2;e[l+1]=(f[k+1]/a+1)/2}c=
 [];for(k=1;k<=b;k++)c.push(k,k+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.CylinderBufferGeometry=function(a,b,c,d,e,f,g,h){function k(c){var e,f,k;k=new THREE.Vector2;var l=new THREE.Vector3,n=!0===c?a:b,t=!0===c?1:-1;f=v;for(e=1;e<=d;e++)m.setXYZ(v,0,w*t,0),q.setXYZ(v,0,t,0),!0===c?(k.x=e/d,k.y=0):(k.x=(e-1)/d,k.y=1),u.setXY(v,k.x,k.y),v++;k=v;for(e=0;e<=d;e++){var E=e/d;l.x=n*Math.sin(E*h+g);l.y=w*t;l.z=n*Math.cos(E*h+g);m.setXYZ(v,l.x,l.y,l.z);q.setXYZ(v,0,t,0);u.setXY(v,E,!0===c?1:0);v++}for(e=0;e<d;e++)l=f+e,n=k+e,!0===c?(p.setX(s,n),s++,p.setX(s,n+1)):(p.setX(s,
-n+1),s++,p.setX(s,n)),s++,p.setX(s,l),s++}THREE.BufferGeometry.call(this);this.type="CylinderBufferGeometry";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=Math.floor(d)||8;e=Math.floor(e)||1;f=void 0!==f?f:!1;g=void 0!==g?g:0;h=void 0!==h?h:2*Math.PI;var l=function(){var a=(d+1)*(e+1);!1===f&&(a+=2*(d+1)+2*d);return a}(),n=function(){var a=d*e*6;!1===f&&(a+=6*d);
-return a}(),p=new THREE.BufferAttribute(new (65535<n?Uint32Array:Uint16Array)(n),1),m=new THREE.BufferAttribute(new Float32Array(3*l),3),q=new THREE.BufferAttribute(new Float32Array(3*l),3),u=new THREE.BufferAttribute(new Float32Array(2*l),2),v=0,s=0,t=[],w=c/2;(function(){var f,k,l=new THREE.Vector3,n=new THREE.Vector3,z=(b-a)/c;for(k=0;k<=e;k++){var y=[],F=k/e,E=F*(b-a)+a;for(f=0;f<=d;f++){var H=f/d;n.x=E*Math.sin(H*h+g);n.y=-F*c+w;n.z=E*Math.cos(H*h+g);m.setXYZ(v,n.x,n.y,n.z);l.copy(n);if(0===
-a&&0===k||0===b&&k===e)l.x=Math.sin(H*h+g),l.z=Math.cos(H*h+g);l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*z).normalize();q.setXYZ(v,l.x,l.y,l.z);u.setXY(v,H,1-F);y.push(v);v++}t.push(y)}for(f=0;f<d;f++)for(k=0;k<e;k++)l=t[k+1][f],n=t[k+1][f+1],z=t[k][f+1],p.setX(s,t[k][f]),s++,p.setX(s,l),s++,p.setX(s,z),s++,p.setX(s,l),s++,p.setX(s,n),s++,p.setX(s,z),s++})();!1===f&&(0<a&&k(!0),0<b&&k(!1));this.setIndex(p);this.addAttribute("position",m);this.addAttribute("normal",q);this.addAttribute("uv",u)};
+THREE.CylinderBufferGeometry=function(a,b,c,d,e,f,g,h){function k(c){var e,f,k;k=new THREE.Vector2;var l=new THREE.Vector3,n=!0===c?a:b,s=!0===c?1:-1;f=v;for(e=1;e<=d;e++)m.setXYZ(v,0,w*s,0),q.setXYZ(v,0,s,0),!0===c?(k.x=e/d,k.y=0):(k.x=(e-1)/d,k.y=1),u.setXY(v,k.x,k.y),v++;k=v;for(e=0;e<=d;e++){var E=e/d;l.x=n*Math.sin(E*h+g);l.y=w*s;l.z=n*Math.cos(E*h+g);m.setXYZ(v,l.x,l.y,l.z);q.setXYZ(v,0,s,0);u.setXY(v,E,!0===c?1:0);v++}for(e=0;e<d;e++)l=f+e,n=k+e,!0===c?(p.setX(t,n),t++,p.setX(t,n+1)):(p.setX(t,
+n+1),t++,p.setX(t,n)),t++,p.setX(t,l),t++}THREE.BufferGeometry.call(this);this.type="CylinderBufferGeometry";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=Math.floor(d)||8;e=Math.floor(e)||1;f=void 0!==f?f:!1;g=void 0!==g?g:0;h=void 0!==h?h:2*Math.PI;var l=function(){var a=(d+1)*(e+1);!1===f&&(a+=2*(d+1)+2*d);return a}(),n=function(){var a=d*e*6;!1===f&&(a+=6*d);
+return a}(),p=new THREE.BufferAttribute(new (65535<n?Uint32Array:Uint16Array)(n),1),m=new THREE.BufferAttribute(new Float32Array(3*l),3),q=new THREE.BufferAttribute(new Float32Array(3*l),3),u=new THREE.BufferAttribute(new Float32Array(2*l),2),v=0,t=0,s=[],w=c/2;(function(){var f,k,l=new THREE.Vector3,n=new THREE.Vector3,z=(b-a)/c;for(k=0;k<=e;k++){var y=[],F=k/e,E=F*(b-a)+a;for(f=0;f<=d;f++){var H=f/d;n.x=E*Math.sin(H*h+g);n.y=-F*c+w;n.z=E*Math.cos(H*h+g);m.setXYZ(v,n.x,n.y,n.z);l.copy(n);if(0===
+a&&0===k||0===b&&k===e)l.x=Math.sin(H*h+g),l.z=Math.cos(H*h+g);l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*z).normalize();q.setXYZ(v,l.x,l.y,l.z);u.setXY(v,H,1-F);y.push(v);v++}s.push(y)}for(f=0;f<d;f++)for(k=0;k<e;k++)l=s[k+1][f],n=s[k+1][f+1],z=s[k][f+1],p.setX(t,s[k][f]),t++,p.setX(t,l),t++,p.setX(t,z),t++,p.setX(t,l),t++,p.setX(t,n),t++,p.setX(t,z),t++})();!1===f&&(0<a&&k(!0),0<b&&k(!1));this.setIndex(p);this.addAttribute("position",m);this.addAttribute("normal",q);this.addAttribute("uv",u)};
 THREE.CylinderBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.CylinderBufferGeometry.prototype.constructor=THREE.CylinderBufferGeometry;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};this.fromBufferGeometry(new THREE.CylinderBufferGeometry(a,b,c,d,e,f,g,h));this.mergeVertices()};
 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 k=h.vertices;h=h.faces;for(var l=0,n=h.length;l<n;l++)for(var p=h[l],m=0;3>m;m++){e[0]=p[g[m]];e[1]=p[g[(m+1)%3]];e.sort(c);var q=e.toString();void 0===f[q]?f[q]={vert1:e[0],vert2:e[1],face1:l,
 face2:void 0}:f[q].face2=l}e=[];for(q in f)if(g=f[q],void 0===g.face2||h[g.face1].normal.dot(h[g.face2].normal)<=d)l=k[g.vert1],e.push(l.x),e.push(l.y),e.push(l.z),l=k[g.vert2],e.push(l.x),e.push(l.y),e.push(l.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.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(D=a.length;0<=--D;){c=D;d=D-1;0>d&&(d=a.length-1);for(var e=0,f=q+2*n,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+E,g=g+E,l=l+E,h=h+E;F.faces.push(new THREE.Face3(k,g,h,null,null,1));F.faces.push(new THREE.Face3(g,l,h,null,null,1));k=t.generateSideWallUV(F,
-k,g,l,h);F.faceVertexUvs[0].push([k[0],k[1],k[3]]);F.faceVertexUvs[0].push([k[1],k[2],k[3]])}}}function f(a,b,c){F.vertices.push(new THREE.Vector3(a,b,c))}function g(a,b,c){a+=E;b+=E;c+=E;F.faces.push(new THREE.Face3(a,b,c,null,null,0));a=t.generateTopUV(F,a,b,c);F.faceVertexUvs[0].push(a)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,l=void 0!==b.bevelSize?b.bevelSize:k-2,n=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,
-m=void 0!==b.curveSegments?b.curveSegments:12,q=void 0!==b.steps?b.steps:1,u=b.extrudePath,v,s=!1,t=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,C,x,B;u&&(v=u.getSpacedPoints(q),s=!0,p=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(u,q,!1),C=new THREE.Vector3,x=new THREE.Vector3,B=new THREE.Vector3);p||(l=k=n=0);var A,z,y,F=this,E=this.vertices.length,u=a.extractPoints(m),m=u.shape,H=u.holes;if(u=!THREE.ShapeUtils.isClockWise(m)){m=m.reverse();
-z=0;for(y=H.length;z<y;z++)A=H[z],THREE.ShapeUtils.isClockWise(A)&&(H[z]=A.reverse());u=!1}var K=THREE.ShapeUtils.triangulateShape(m,H),G=m;z=0;for(y=H.length;z<y;z++)A=H[z],m=m.concat(A);var O,I,M,N,P,R=m.length,Q,L=K.length,u=[],D=0;M=G.length;O=M-1;for(I=D+1;D<M;D++,O++,I++)O===M&&(O=0),I===M&&(I=0),u[D]=d(G[D],G[O],G[I]);var W=[],T,Z=u.concat();z=0;for(y=H.length;z<y;z++){A=H[z];T=[];D=0;M=A.length;O=M-1;for(I=D+1;D<M;D++,O++,I++)O===M&&(O=0),I===M&&(I=0),T[D]=d(A[D],A[O],A[I]);W.push(T);Z=Z.concat(T)}for(O=
-0;O<n;O++){M=O/n;N=k*(1-M);I=l*Math.sin(M*Math.PI/2);D=0;for(M=G.length;D<M;D++)P=c(G[D],u[D],I),f(P.x,P.y,-N);z=0;for(y=H.length;z<y;z++)for(A=H[z],T=W[z],D=0,M=A.length;D<M;D++)P=c(A[D],T[D],I),f(P.x,P.y,-N)}I=l;for(D=0;D<R;D++)P=p?c(m[D],Z[D],I):m[D],s?(x.copy(w.normals[0]).multiplyScalar(P.x),C.copy(w.binormals[0]).multiplyScalar(P.y),B.copy(v[0]).add(x).add(C),f(B.x,B.y,B.z)):f(P.x,P.y,0);for(M=1;M<=q;M++)for(D=0;D<R;D++)P=p?c(m[D],Z[D],I):m[D],s?(x.copy(w.normals[M]).multiplyScalar(P.x),C.copy(w.binormals[M]).multiplyScalar(P.y),
-B.copy(v[M]).add(x).add(C),f(B.x,B.y,B.z)):f(P.x,P.y,h/q*M);for(O=n-1;0<=O;O--){M=O/n;N=k*(1-M);I=l*Math.sin(M*Math.PI/2);D=0;for(M=G.length;D<M;D++)P=c(G[D],u[D],I),f(P.x,P.y,h+N);z=0;for(y=H.length;z<y;z++)for(A=H[z],T=W[z],D=0,M=A.length;D<M;D++)P=c(A[D],T[D],I),s?f(P.x,P.y+v[q-1].y,v[q-1].x+N):f(P.x,P.y,h+N)}(function(){if(p){var a;a=0*R;for(D=0;D<L;D++)Q=K[D],g(Q[2]+a,Q[1]+a,Q[0]+a);a=q+2*n;a*=R;for(D=0;D<L;D++)Q=K[D],g(Q[0]+a,Q[1]+a,Q[2]+a)}else{for(D=0;D<L;D++)Q=K[D],g(Q[2],Q[1],Q[0]);for(D=
+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(D=a.length;0<=--D;){c=D;d=D-1;0>d&&(d=a.length-1);for(var e=0,f=q+2*n,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+E,g=g+E,l=l+E,h=h+E;F.faces.push(new THREE.Face3(k,g,h,null,null,1));F.faces.push(new THREE.Face3(g,l,h,null,null,1));k=s.generateSideWallUV(F,
+k,g,l,h);F.faceVertexUvs[0].push([k[0],k[1],k[3]]);F.faceVertexUvs[0].push([k[1],k[2],k[3]])}}}function f(a,b,c){F.vertices.push(new THREE.Vector3(a,b,c))}function g(a,b,c){a+=E;b+=E;c+=E;F.faces.push(new THREE.Face3(a,b,c,null,null,0));a=s.generateTopUV(F,a,b,c);F.faceVertexUvs[0].push(a)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,l=void 0!==b.bevelSize?b.bevelSize:k-2,n=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,
+m=void 0!==b.curveSegments?b.curveSegments:12,q=void 0!==b.steps?b.steps:1,u=b.extrudePath,v,t=!1,s=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,C,x,B;u&&(v=u.getSpacedPoints(q),t=!0,p=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(u,q,!1),C=new THREE.Vector3,x=new THREE.Vector3,B=new THREE.Vector3);p||(l=k=n=0);var A,z,y,F=this,E=this.vertices.length,u=a.extractPoints(m),m=u.shape,H=u.holes;if(u=!THREE.ShapeUtils.isClockWise(m)){m=m.reverse();
+z=0;for(y=H.length;z<y;z++)A=H[z],THREE.ShapeUtils.isClockWise(A)&&(H[z]=A.reverse());u=!1}var K=THREE.ShapeUtils.triangulateShape(m,H),G=m;z=0;for(y=H.length;z<y;z++)A=H[z],m=m.concat(A);var P,I,M,N,O,R=m.length,Q,L=K.length,u=[],D=0;M=G.length;P=M-1;for(I=D+1;D<M;D++,P++,I++)P===M&&(P=0),I===M&&(I=0),u[D]=d(G[D],G[P],G[I]);var W=[],T,Z=u.concat();z=0;for(y=H.length;z<y;z++){A=H[z];T=[];D=0;M=A.length;P=M-1;for(I=D+1;D<M;D++,P++,I++)P===M&&(P=0),I===M&&(I=0),T[D]=d(A[D],A[P],A[I]);W.push(T);Z=Z.concat(T)}for(P=
+0;P<n;P++){M=P/n;N=k*(1-M);I=l*Math.sin(M*Math.PI/2);D=0;for(M=G.length;D<M;D++)O=c(G[D],u[D],I),f(O.x,O.y,-N);z=0;for(y=H.length;z<y;z++)for(A=H[z],T=W[z],D=0,M=A.length;D<M;D++)O=c(A[D],T[D],I),f(O.x,O.y,-N)}I=l;for(D=0;D<R;D++)O=p?c(m[D],Z[D],I):m[D],t?(x.copy(w.normals[0]).multiplyScalar(O.x),C.copy(w.binormals[0]).multiplyScalar(O.y),B.copy(v[0]).add(x).add(C),f(B.x,B.y,B.z)):f(O.x,O.y,0);for(M=1;M<=q;M++)for(D=0;D<R;D++)O=p?c(m[D],Z[D],I):m[D],t?(x.copy(w.normals[M]).multiplyScalar(O.x),C.copy(w.binormals[M]).multiplyScalar(O.y),
+B.copy(v[M]).add(x).add(C),f(B.x,B.y,B.z)):f(O.x,O.y,h/q*M);for(P=n-1;0<=P;P--){M=P/n;N=k*(1-M);I=l*Math.sin(M*Math.PI/2);D=0;for(M=G.length;D<M;D++)O=c(G[D],u[D],I),f(O.x,O.y,h+N);z=0;for(y=H.length;z<y;z++)for(A=H[z],T=W[z],D=0,M=A.length;D<M;D++)O=c(A[D],T[D],I),t?f(O.x,O.y+v[q-1].y,v[q-1].x+N):f(O.x,O.y,h+N)}(function(){if(p){var a;a=0*R;for(D=0;D<L;D++)Q=K[D],g(Q[2]+a,Q[1]+a,Q[0]+a);a=q+2*n;a*=R;for(D=0;D<L;D++)Q=K[D],g(Q[0]+a,Q[1]+a,Q[2]+a)}else{for(D=0;D<L;D++)Q=K[D],g(Q[2],Q[1],Q[0]);for(D=
 0;D<L;D++)Q=K[D],g(Q[0]+R*q,Q[1]+R*q,Q[2]+R*q)}})();(function(){var a=0;e(G,a);a+=G.length;z=0;for(y=H.length;z<y;z++)A=H[z],e(A,a),a+=A.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,
 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};
@@ -880,33 +878,33 @@ THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.type="Plane
 THREE.PlaneBufferGeometry=function(a,b,c,d){THREE.BufferGeometry.call(this);this.type="PlaneBufferGeometry";this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};var e=a/2,f=b/2;c=Math.floor(c)||1;d=Math.floor(d)||1;var g=c+1,h=d+1,k=a/c,l=b/d;b=new Float32Array(g*h*3);a=new Float32Array(g*h*3);for(var n=new Float32Array(g*h*2),p=0,m=0,q=0;q<h;q++)for(var u=q*l-f,v=0;v<g;v++)b[p]=v*k-e,b[p+1]=-u,a[p+2]=1,n[m]=v/c,n[m+1]=1-q/d,p+=3,m+=2;p=0;e=new (65535<b.length/3?Uint32Array:Uint16Array)(c*
 d*6);for(q=0;q<d;q++)for(v=0;v<c;v++)f=v+g*(q+1),h=v+1+g*(q+1),k=v+1+g*q,e[p]=v+g*q,e[p+1]=f,e[p+2]=k,e[p+3]=f,e[p+4]=h,e[p+5]=k,p+=6;this.setIndex(new THREE.BufferAttribute(e,1));this.addAttribute("position",new THREE.BufferAttribute(b,3));this.addAttribute("normal",new THREE.BufferAttribute(a,3));this.addAttribute("uv",new THREE.BufferAttribute(n,2))};THREE.PlaneBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.PlaneBufferGeometry.prototype.constructor=THREE.PlaneBufferGeometry;
 THREE.RingBufferGeometry=function(a,b,c,d,e,f){THREE.BufferGeometry.call(this);this.type="RingBufferGeometry";this.parameters={innerRadius:a,outerRadius:b,thetaSegments:c,phiSegments:d,thetaStart:e,thetaLength:f};a=a||20;b=b||50;e=void 0!==e?e:0;f=void 0!==f?f:2*Math.PI;c=void 0!==c?Math.max(3,c):8;d=void 0!==d?Math.max(1,d):1;var g=(c+1)*(d+1),h=c*d*6,h=new THREE.BufferAttribute(new (65535<h?Uint32Array:Uint16Array)(h),1),k=new THREE.BufferAttribute(new Float32Array(3*g),3),l=new THREE.BufferAttribute(new Float32Array(3*
-g),3),g=new THREE.BufferAttribute(new Float32Array(2*g),2),n=0,p=0,m,q=a,u=(b-a)/d,v=new THREE.Vector3,s=new THREE.Vector2,t;for(a=0;a<=d;a++){for(t=0;t<=c;t++)m=e+t/c*f,v.x=q*Math.cos(m),v.y=q*Math.sin(m),k.setXYZ(n,v.x,v.y,v.z),l.setXYZ(n,0,0,1),s.x=(v.x/b+1)/2,s.y=(v.y/b+1)/2,g.setXY(n,s.x,s.y),n++;q+=u}for(a=0;a<d;a++)for(b=a*(c+1),t=0;t<c;t++)e=m=t+b,f=m+c+1,n=m+c+2,m+=1,h.setX(p,e),p++,h.setX(p,f),p++,h.setX(p,n),p++,h.setX(p,e),p++,h.setX(p,n),p++,h.setX(p,m),p++;this.setIndex(h);this.addAttribute("position",
+g),3),g=new THREE.BufferAttribute(new Float32Array(2*g),2),n=0,p=0,m,q=a,u=(b-a)/d,v=new THREE.Vector3,t=new THREE.Vector2,s;for(a=0;a<=d;a++){for(s=0;s<=c;s++)m=e+s/c*f,v.x=q*Math.cos(m),v.y=q*Math.sin(m),k.setXYZ(n,v.x,v.y,v.z),l.setXYZ(n,0,0,1),t.x=(v.x/b+1)/2,t.y=(v.y/b+1)/2,g.setXY(n,t.x,t.y),n++;q+=u}for(a=0;a<d;a++)for(b=a*(c+1),s=0;s<c;s++)e=m=s+b,f=m+c+1,n=m+c+2,m+=1,h.setX(p,e),p++,h.setX(p,f),p++,h.setX(p,n),p++,h.setX(p,e),p++,h.setX(p,n),p++,h.setX(p,m),p++;this.setIndex(h);this.addAttribute("position",
 k);this.addAttribute("normal",l);this.addAttribute("uv",g)};THREE.RingBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.RingBufferGeometry.prototype.constructor=THREE.RingBufferGeometry;THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.type="RingGeometry";this.parameters={innerRadius:a,outerRadius:b,thetaSegments:c,phiSegments:d,thetaStart:e,thetaLength:f};this.fromBufferGeometry(new THREE.RingBufferGeometry(a,b,c,d,e,f))};
 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.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,k=(b+1)*(c+1),l=new THREE.BufferAttribute(new Float32Array(3*k),3),n=new THREE.BufferAttribute(new Float32Array(3*
-k),3),k=new THREE.BufferAttribute(new Float32Array(2*k),2),p=0,m=[],q=new THREE.Vector3,u=0;u<=c;u++){for(var v=[],s=u/c,t=0;t<=b;t++){var w=t/b,C=-a*Math.cos(d+w*e)*Math.sin(f+s*g),x=a*Math.cos(f+s*g),B=a*Math.sin(d+w*e)*Math.sin(f+s*g);q.set(C,x,B).normalize();l.setXYZ(p,C,x,B);n.setXYZ(p,q.x,q.y,q.z);k.setXY(p,w,1-s);v.push(p);p++}m.push(v)}d=[];for(u=0;u<c;u++)for(t=0;t<b;t++)e=m[u][t+1],g=m[u][t],p=m[u+1][t],q=m[u+1][t+1],(0!==u||0<f)&&d.push(e,g,q),(u!==c-1||h<Math.PI)&&d.push(g,p,q);this.setIndex(new (65535<
+k),3),k=new THREE.BufferAttribute(new Float32Array(2*k),2),p=0,m=[],q=new THREE.Vector3,u=0;u<=c;u++){for(var v=[],t=u/c,s=0;s<=b;s++){var w=s/b,C=-a*Math.cos(d+w*e)*Math.sin(f+t*g),x=a*Math.cos(f+t*g),B=a*Math.sin(d+w*e)*Math.sin(f+t*g);q.set(C,x,B).normalize();l.setXYZ(p,C,x,B);n.setXYZ(p,q.x,q.y,q.z);k.setXY(p,w,1-t);v.push(p);p++}m.push(v)}d=[];for(u=0;u<c;u++)for(s=0;s<b;s++)e=m[u][s+1],g=m[u][s],p=m[u+1][s],q=m[u+1][s+1],(0!==u||0<f)&&d.push(e,g,q),(u!==c-1||h<Math.PI)&&d.push(g,p,q);this.setIndex(new (65535<
 l.count?THREE.Uint32Attribute:THREE.Uint16Attribute)(d,1));this.addAttribute("position",l);this.addAttribute("normal",n);this.addAttribute("uv",k);this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.SphereBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.SphereBufferGeometry.prototype.constructor=THREE.SphereBufferGeometry;
 THREE.TextGeometry=function(a,b){b=b||{};var c=b.font;if(!1===c instanceof THREE.Font)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new THREE.Geometry;c=c.generateShapes(a,b.size,b.curveSegments);b.amount=void 0!==b.height?b.height:50;void 0===b.bevelThickness&&(b.bevelThickness=10);void 0===b.bevelSize&&(b.bevelSize=8);void 0===b.bevelEnabled&&(b.bevelEnabled=!1);THREE.ExtrudeGeometry.call(this,c,b);this.type="TextGeometry"};
 THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
-THREE.TorusBufferGeometry=function(a,b,c,d,e){THREE.BufferGeometry.call(this);this.type="TorusBufferGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:e};a=a||100;b=b||40;c=Math.floor(c)||8;d=Math.floor(d)||6;e=e||2*Math.PI;var f=(c+1)*(d+1),g=c*d*6,g=new (65535<g?Uint32Array:Uint16Array)(g),h=new Float32Array(3*f),k=new Float32Array(3*f),f=new Float32Array(2*f),l=0,n=0,p=0,m=new THREE.Vector3,q=new THREE.Vector3,u=new THREE.Vector3,v,s;for(v=0;v<=c;v++)for(s=0;s<=d;s++){var t=
-s/d*e,w=v/c*Math.PI*2;q.x=(a+b*Math.cos(w))*Math.cos(t);q.y=(a+b*Math.cos(w))*Math.sin(t);q.z=b*Math.sin(w);h[l]=q.x;h[l+1]=q.y;h[l+2]=q.z;m.x=a*Math.cos(t);m.y=a*Math.sin(t);u.subVectors(q,m).normalize();k[l]=u.x;k[l+1]=u.y;k[l+2]=u.z;f[n]=s/d;f[n+1]=v/c;l+=3;n+=2}for(v=1;v<=c;v++)for(s=1;s<=d;s++)a=(d+1)*(v-1)+s-1,b=(d+1)*(v-1)+s,e=(d+1)*v+s,g[p]=(d+1)*v+s-1,g[p+1]=a,g[p+2]=e,g[p+3]=a,g[p+4]=b,g[p+5]=e,p+=6;this.setIndex(new THREE.BufferAttribute(g,1));this.addAttribute("position",new THREE.BufferAttribute(h,
+THREE.TorusBufferGeometry=function(a,b,c,d,e){THREE.BufferGeometry.call(this);this.type="TorusBufferGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:e};a=a||100;b=b||40;c=Math.floor(c)||8;d=Math.floor(d)||6;e=e||2*Math.PI;var f=(c+1)*(d+1),g=c*d*6,g=new (65535<g?Uint32Array:Uint16Array)(g),h=new Float32Array(3*f),k=new Float32Array(3*f),f=new Float32Array(2*f),l=0,n=0,p=0,m=new THREE.Vector3,q=new THREE.Vector3,u=new THREE.Vector3,v,t;for(v=0;v<=c;v++)for(t=0;t<=d;t++){var s=
+t/d*e,w=v/c*Math.PI*2;q.x=(a+b*Math.cos(w))*Math.cos(s);q.y=(a+b*Math.cos(w))*Math.sin(s);q.z=b*Math.sin(w);h[l]=q.x;h[l+1]=q.y;h[l+2]=q.z;m.x=a*Math.cos(s);m.y=a*Math.sin(s);u.subVectors(q,m).normalize();k[l]=u.x;k[l+1]=u.y;k[l+2]=u.z;f[n]=t/d;f[n+1]=v/c;l+=3;n+=2}for(v=1;v<=c;v++)for(t=1;t<=d;t++)a=(d+1)*(v-1)+t-1,b=(d+1)*(v-1)+t,e=(d+1)*v+t,g[p]=(d+1)*v+t-1,g[p+1]=a,g[p+2]=e,g[p+3]=a,g[p+4]=b,g[p+5]=e,p+=6;this.setIndex(new THREE.BufferAttribute(g,1));this.addAttribute("position",new THREE.BufferAttribute(h,
 3));this.addAttribute("normal",new THREE.BufferAttribute(k,3));this.addAttribute("uv",new THREE.BufferAttribute(f,2))};THREE.TorusBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.TorusBufferGeometry.prototype.constructor=THREE.TorusBufferGeometry;
 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};this.fromBufferGeometry(new THREE.TorusBufferGeometry(a,b,c,d,e))};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotBufferGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e){var f=Math.cos(a),g=Math.sin(a);a*=c/b;b=Math.cos(a);e.x=d*(2+b)*.5*f;e.y=d*(2+b)*g*.5;e.z=d*Math.sin(a)*.5}THREE.BufferGeometry.call(this);this.type="TorusKnotBufferGeometry";this.parameters={radius:a,tube:b,tubularSegments:c,radialSegments:d,p:e,q:f};a=a||100;b=b||40;c=Math.floor(c)||64;d=Math.floor(d)||8;e=e||2;f=f||3;var h=(d+1)*(c+1),k=d*c*6,k=new THREE.BufferAttribute(new (65535<k?Uint32Array:Uint16Array)(k),1),l=new THREE.BufferAttribute(new Float32Array(3*
-h),3),n=new THREE.BufferAttribute(new Float32Array(3*h),3),h=new THREE.BufferAttribute(new Float32Array(2*h),2),p,m,q=0,u=0,v=new THREE.Vector3,s=new THREE.Vector3,t=new THREE.Vector2,w=new THREE.Vector3,C=new THREE.Vector3,x=new THREE.Vector3,B=new THREE.Vector3,A=new THREE.Vector3;for(p=0;p<=c;++p)for(m=p/c*e*Math.PI*2,g(m,e,f,a,w),g(m+.01,e,f,a,C),B.subVectors(C,w),A.addVectors(C,w),x.crossVectors(B,A),A.crossVectors(x,B),x.normalize(),A.normalize(),m=0;m<=d;++m){var z=m/d*Math.PI*2,y=-b*Math.cos(z),
-z=b*Math.sin(z);v.x=w.x+(y*A.x+z*x.x);v.y=w.y+(y*A.y+z*x.y);v.z=w.z+(y*A.z+z*x.z);l.setXYZ(q,v.x,v.y,v.z);s.subVectors(v,w).normalize();n.setXYZ(q,s.x,s.y,s.z);t.x=p/c;t.y=m/d;h.setXY(q,t.x,t.y);q++}for(m=1;m<=c;m++)for(p=1;p<=d;p++)a=(d+1)*m+(p-1),b=(d+1)*m+p,e=(d+1)*(m-1)+p,k.setX(u,(d+1)*(m-1)+(p-1)),u++,k.setX(u,a),u++,k.setX(u,e),u++,k.setX(u,a),u++,k.setX(u,b),u++,k.setX(u,e),u++;this.setIndex(k);this.addAttribute("position",l);this.addAttribute("normal",n);this.addAttribute("uv",h)};
+h),3),n=new THREE.BufferAttribute(new Float32Array(3*h),3),h=new THREE.BufferAttribute(new Float32Array(2*h),2),p,m,q=0,u=0,v=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector2,w=new THREE.Vector3,C=new THREE.Vector3,x=new THREE.Vector3,B=new THREE.Vector3,A=new THREE.Vector3;for(p=0;p<=c;++p)for(m=p/c*e*Math.PI*2,g(m,e,f,a,w),g(m+.01,e,f,a,C),B.subVectors(C,w),A.addVectors(C,w),x.crossVectors(B,A),A.crossVectors(x,B),x.normalize(),A.normalize(),m=0;m<=d;++m){var z=m/d*Math.PI*2,y=-b*Math.cos(z),
+z=b*Math.sin(z);v.x=w.x+(y*A.x+z*x.x);v.y=w.y+(y*A.y+z*x.y);v.z=w.z+(y*A.z+z*x.z);l.setXYZ(q,v.x,v.y,v.z);t.subVectors(v,w).normalize();n.setXYZ(q,t.x,t.y,t.z);s.x=p/c;s.y=m/d;h.setXY(q,s.x,s.y);q++}for(m=1;m<=c;m++)for(p=1;p<=d;p++)a=(d+1)*m+(p-1),b=(d+1)*m+p,e=(d+1)*(m-1)+p,k.setX(u,(d+1)*(m-1)+(p-1)),u++,k.setX(u,a),u++,k.setX(u,e),u++,k.setX(u,a),u++,k.setX(u,b),u++,k.setX(u,e),u++;this.setIndex(k);this.addAttribute("position",l);this.addAttribute("normal",n);this.addAttribute("uv",h)};
 THREE.TorusKnotBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.TorusKnotBufferGeometry.prototype.constructor=THREE.TorusKnotBufferGeometry;
 THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);this.type="TorusKnotGeometry";this.parameters={radius:a,tube:b,tubularSegments:c,radialSegments:d,p:e,q:f};void 0!==g&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead.");this.fromBufferGeometry(new THREE.TorusKnotBufferGeometry(a,b,c,d,e,f));this.mergeVertices()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);
 THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
-THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.type="TubeGeometry";this.parameters={path:a,segments:b,radius:c,radialSegments:d,closed:e,taper:f};b=b||64;c=c||1;d=d||8;e=e||!1;f=f||THREE.TubeGeometry.NoTaper;var g=[],h,k,l=b+1,n,p,m,q,u,v=new THREE.Vector3,s,t,w;s=new THREE.TubeGeometry.FrenetFrames(a,b,e);t=s.normals;w=s.binormals;this.tangents=s.tangents;this.normals=t;this.binormals=w;for(s=0;s<l;s++)for(g[s]=[],n=s/(l-1),u=a.getPointAt(n),h=t[s],k=w[s],m=c*f(n),n=0;n<
-d;n++)p=n/d*2*Math.PI,q=-m*Math.cos(p),p=m*Math.sin(p),v.copy(u),v.x+=q*h.x+p*k.x,v.y+=q*h.y+p*k.y,v.z+=q*h.z+p*k.z,g[s][n]=this.vertices.push(new THREE.Vector3(v.x,v.y,v.z))-1;for(s=0;s<b;s++)for(n=0;n<d;n++)f=e?(s+1)%b:s+1,l=(n+1)%d,a=g[s][n],c=g[f][n],f=g[f][l],l=g[s][l],v=new THREE.Vector2(s/b,n/d),t=new THREE.Vector2((s+1)/b,n/d),w=new THREE.Vector2((s+1)/b,(n+1)/d),h=new THREE.Vector2(s/b,(n+1)/d),this.faces.push(new THREE.Face3(a,c,l)),this.faceVertexUvs[0].push([v,t,h]),this.faces.push(new THREE.Face3(c,
-f,l)),this.faceVertexUvs[0].push([t.clone(),w,h.clone()]);this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;THREE.TubeGeometry.NoTaper=function(a){return 1};THREE.TubeGeometry.SinusoidalTaper=function(a){return Math.sin(Math.PI*a)};
+THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.type="TubeGeometry";this.parameters={path:a,segments:b,radius:c,radialSegments:d,closed:e,taper:f};b=b||64;c=c||1;d=d||8;e=e||!1;f=f||THREE.TubeGeometry.NoTaper;var g=[],h,k,l=b+1,n,p,m,q,u,v=new THREE.Vector3,t,s,w;t=new THREE.TubeGeometry.FrenetFrames(a,b,e);s=t.normals;w=t.binormals;this.tangents=t.tangents;this.normals=s;this.binormals=w;for(t=0;t<l;t++)for(g[t]=[],n=t/(l-1),u=a.getPointAt(n),h=s[t],k=w[t],m=c*f(n),n=0;n<
+d;n++)p=n/d*2*Math.PI,q=-m*Math.cos(p),p=m*Math.sin(p),v.copy(u),v.x+=q*h.x+p*k.x,v.y+=q*h.y+p*k.y,v.z+=q*h.z+p*k.z,g[t][n]=this.vertices.push(new THREE.Vector3(v.x,v.y,v.z))-1;for(t=0;t<b;t++)for(n=0;n<d;n++)f=e?(t+1)%b:t+1,l=(n+1)%d,a=g[t][n],c=g[f][n],f=g[f][l],l=g[t][l],v=new THREE.Vector2(t/b,n/d),s=new THREE.Vector2((t+1)/b,n/d),w=new THREE.Vector2((t+1)/b,(n+1)/d),h=new THREE.Vector2(t/b,(n+1)/d),this.faces.push(new THREE.Face3(a,c,l)),this.faceVertexUvs[0].push([v,s,h]),this.faces.push(new THREE.Face3(c,
+f,l)),this.faceVertexUvs[0].push([s.clone(),w,h.clone()]);this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;THREE.TubeGeometry.NoTaper=function(a){return 1};THREE.TubeGeometry.SinusoidalTaper=function(a){return Math.sin(Math.PI*a)};
 THREE.TubeGeometry.FrenetFrames=function(a,b,c){var d=new THREE.Vector3,e=[],f=[],g=[],h=new THREE.Vector3,k=new THREE.Matrix4;b+=1;var l,n,p;this.tangents=e;this.normals=f;this.binormals=g;for(l=0;l<b;l++)n=l/(b-1),e[l]=a.getTangentAt(n),e[l].normalize();f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;l=Math.abs(e[0].x);n=Math.abs(e[0].y);p=Math.abs(e[0].z);l<=a&&(a=l,d.set(1,0,0));n<=a&&(a=n,d.set(0,1,0));p<=a&&d.set(0,0,1);h.crossVectors(e[0],d).normalize();f[0].crossVectors(e[0],
 h);g[0].crossVectors(e[0],f[0]);for(l=1;l<b;l++)f[l]=f[l-1].clone(),g[l]=g[l-1].clone(),h.crossVectors(e[l-1],e[l]),h.length()>Number.EPSILON&&(h.normalize(),d=Math.acos(THREE.Math.clamp(e[l-1].dot(e[l]),-1,1)),f[l].applyMatrix4(k.makeRotationAxis(h,d))),g[l].crossVectors(e[l],f[l]);if(c)for(d=Math.acos(THREE.Math.clamp(f[0].dot(f[b-1]),-1,1)),d/=b-1,0<e[0].dot(h.crossVectors(f[0],f[b-1]))&&(d=-d),l=1;l<b;l++)f[l].applyMatrix4(k.makeRotationAxis(e[l],d*l)),g[l].crossVectors(e[l],f[l])};
-THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=k.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+.5;a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+.5;b.uv=new THREE.Vector2(c,1-a);return b}function f(a,b,c,d){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()],void 0,d);k.faces.push(d);s.copy(a).add(b).add(c).divideScalar(3);d=Math.atan2(s.z,-s.x);k.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}function g(a,
-b){for(var c=Math.pow(2,b),d=e(k.vertices[a.a]),g=e(k.vertices[a.b]),h=e(k.vertices[a.c]),l=[],m=a.materialIndex,n=0;n<=c;n++){l[n]=[];for(var p=e(d.clone().lerp(h,n/c)),q=e(g.clone().lerp(h,n/c)),s=c-n,u=0;u<=s;u++)l[n][u]=0===u&&n===c?p:e(p.clone().lerp(q,u/s))}for(n=0;n<c;n++)for(u=0;u<2*(c-n)-1;u++)d=Math.floor(u/2),0===u%2?f(l[n][d+1],l[n+1][d],l[n][d],m):f(l[n][d+1],l[n+1][d+1],l[n+1][d],m)}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/
-2/Math.PI+.5,a.y));return a.clone()}THREE.Geometry.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c=c||1;d=d||0;for(var k=this,l=0,n=a.length;l<n;l+=3)e(new THREE.Vector3(a[l],a[l+1],a[l+2]));a=this.vertices;for(var p=[],m=l=0,n=b.length;l<n;l+=3,m++){var q=a[b[l]],u=a[b[l+1]],v=a[b[l+2]];p[m]=new THREE.Face3(q.index,u.index,v.index,[q.clone(),u.clone(),v.clone()],void 0,m)}for(var s=new THREE.Vector3,l=0,n=p.length;l<n;l++)g(p[l],d);l=0;for(n=this.faceVertexUvs[0].length;l<
+THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=k.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+.5;a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+.5;b.uv=new THREE.Vector2(c,1-a);return b}function f(a,b,c,d){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()],void 0,d);k.faces.push(d);t.copy(a).add(b).add(c).divideScalar(3);d=Math.atan2(t.z,-t.x);k.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}function g(a,
+b){for(var c=Math.pow(2,b),d=e(k.vertices[a.a]),g=e(k.vertices[a.b]),h=e(k.vertices[a.c]),l=[],m=a.materialIndex,n=0;n<=c;n++){l[n]=[];for(var p=e(d.clone().lerp(h,n/c)),q=e(g.clone().lerp(h,n/c)),u=c-n,t=0;t<=u;t++)l[n][t]=0===t&&n===c?p:e(p.clone().lerp(q,t/u))}for(n=0;n<c;n++)for(t=0;t<2*(c-n)-1;t++)d=Math.floor(t/2),0===t%2?f(l[n][d+1],l[n+1][d],l[n][d],m):f(l[n][d+1],l[n+1][d+1],l[n+1][d],m)}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/
+2/Math.PI+.5,a.y));return a.clone()}THREE.Geometry.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c=c||1;d=d||0;for(var k=this,l=0,n=a.length;l<n;l+=3)e(new THREE.Vector3(a[l],a[l+1],a[l+2]));a=this.vertices;for(var p=[],m=l=0,n=b.length;l<n;l+=3,m++){var q=a[b[l]],u=a[b[l+1]],v=a[b[l+2]];p[m]=new THREE.Face3(q.index,u.index,v.index,[q.clone(),u.clone(),v.clone()],void 0,m)}for(var t=new THREE.Vector3,l=0,n=p.length;l<n;l++)g(p[l],d);l=0;for(n=this.faceVertexUvs[0].length;l<
 n;l++)b=this.faceVertexUvs[0][l],d=b[0].x,a=b[1].x,p=b[2].x,m=Math.max(d,a,p),q=Math.min(d,a,p),.9<m&&.1>q&&(.2>d&&(b[0].x+=1),.2>a&&(b[1].x+=1),.2>p&&(b[2].x+=1));l=0;for(n=this.vertices.length;l<n;l++)this.vertices[l].multiplyScalar(c);this.mergeVertices();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;
 THREE.DodecahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2,d=1/c;THREE.PolyhedronGeometry.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,
 12,14,1,14,5,1,5,9],a,b);this.type="DodecahedronGeometry";this.parameters={radius:a,detail:b}};THREE.DodecahedronGeometry.prototype=Object.create(THREE.PolyhedronGeometry.prototype);THREE.DodecahedronGeometry.prototype.constructor=THREE.DodecahedronGeometry;

+ 90 - 0
docs/api/loaders/AudioLoader.html

@@ -0,0 +1,90 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		<h1>[name]</h1>
+
+		<div class="desc">Class for loading an [page:String AudioBuffer].</div>
+
+
+		<h2>Constructor</h2>
+
+		<h3>[name]( [page:String context], [page:LoadingManager manager] )</h3>
+		<div>
+		[page:String context] — The [page:String AudioContext] for the loader to use. Default is [page:String window.AudioContext].<br />
+		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
+		</div>
+		<div>
+		Creates a new [name].
+		</div>
+
+
+		<h2>Methods</h2>
+
+		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
+		<div>
+		[page:String url] — required<br />
+		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded text response.<br />
+		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
+		[page:Function onError] — Will be called when load errors.<br />
+		</div>
+		<div>
+		Begin loading from url and pass the loaded [page:String AudioBuffer] to onLoad.
+		</div>
+
+
+
+		<h2>Example</h2>
+
+		<code>
+		// instantiate a listener
+		var audioListener = new THREE.AudioListener();
+
+		// add the listener to the camera
+		camera.add( audioListener );
+
+		// instantiate audio object
+		var oceanAmbientSound = new THREE.Audio( audioListener );
+
+		// add the audio object to the scene
+		scene.add( oceanAmbientSound );
+
+		// instantiate a loader
+		var loader = new THREE.AudioLoader();
+
+		// load a resource
+		loader.load(
+			// resource URL
+			'audio/ambient_ocean.ogg',
+			// Function when resource is loaded
+			function ( audioBuffer ) {
+				// set the audio object buffer to the loaded object
+				oceanAmbientSound.setBuffer( audioBuffer );
+
+				// play the audio
+				oceanAmbientSound.play();
+			},
+			// Function called when download progresses
+			function ( xhr ) {
+				console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
+			},
+			// Function called when download errors
+			function ( xhr ) {
+				console.log( 'An error happened' );
+			}
+		);
+		</code>
+
+
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 1 - 0
docs/list.js

@@ -45,6 +45,7 @@ var list = {
 
 
 		"Loaders": [
+			[ "AudioLoader", "api/loaders/AudioLoader" ],
 			[ "BabylonLoader", "api/loaders/BabylonLoader" ],
 			[ "BufferGeometryLoader", "api/loaders/BufferGeometryLoader" ],
 			[ "Cache", "api/loaders/Cache" ],

+ 1 - 1
examples/files.js

@@ -8,7 +8,6 @@ var files = {
 		"webgl_camera_logarithmicdepthbuffer",
 		"webgl_decals",
 		"webgl_effects_anaglyph",
-		"webgl_effects_cardboard",
 		"webgl_effects_parallaxbarrier",
 		"webgl_effects_peppersghost",
 		"webgl_effects_stereo",
@@ -239,6 +238,7 @@ var files = {
 		"webvr_cubes",
 		"webvr_panorama",
 		"webvr_rollercoaster",
+		"webvr_shadow",
 		"webvr_video"
 	],
 	"css3d": [

+ 2 - 2
examples/index.html

@@ -333,9 +333,9 @@
 
 		function selectFile( file ) {
 
-			if ( selected !== null ) links[ selected ].className = 'link';
+			if ( selected !== null ) links[ selected ].classList.remove( 'selected' );
 
-			links[ file ].className = 'link selected';
+			links[ file ].classList.add( 'selected' );
 
 			window.location.hash = file;
 			viewer.focus();

+ 10 - 3
examples/js/controls/VRControls.js

@@ -91,7 +91,7 @@ THREE.VRControls = function ( object, onError ) {
 
 	};
 
-	this.resetSensor = function () {
+	this.resetPose = function () {
 
 		if ( vrInput ) {
 
@@ -115,10 +115,17 @@ THREE.VRControls = function ( object, onError ) {
 
 	};
 
+	this.resetSensor = function () {
+
+		console.warn( 'THREE.VRControls: .resetSensor() is now .resetPose().' );
+		this.resetPose();
+
+	};
+
 	this.zeroSensor = function () {
 
-		console.warn( 'THREE.VRControls: .zeroSensor() is now .resetSensor().' );
-		this.resetSensor();
+		console.warn( 'THREE.VRControls: .zeroSensor() is now .resetPose().' );
+		this.resetPose();
 
 	};
 

+ 0 - 104
examples/js/effects/CardboardEffect.js

@@ -1,104 +0,0 @@
-/**
- * @author mrdoob / http://mrdoob.com/
- */
-
-THREE.CardboardEffect = function ( renderer ) {
-
-	var _camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
-
-	var _scene = new THREE.Scene();
-
-	var _stereo = new THREE.StereoCamera();
-	_stereo.aspect = 0.5;
-
-	var _params = { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat };
-
-	var _renderTarget = new THREE.WebGLRenderTarget( 512, 512, _params );
-	_renderTarget.scissorTest = true;
-
-	// Distortion Mesh ported from:
-	// https://github.com/borismus/webvr-boilerplate/blob/master/src/distortion/barrel-distortion-fragment.js
-
-	var distortion = new THREE.Vector2( 0.441, 0.156 );
-
-	var geometry = new THREE.PlaneBufferGeometry( 1, 1, 10, 20 ).removeAttribute( 'normal' ).toNonIndexed();
-
-	var positions = geometry.attributes.position.array;
-	var uvs = geometry.attributes.uv.array;
-
-	// duplicate
-
-	var positions2 = new Float32Array( positions.length * 2 );
-	positions2.set( positions );
-	positions2.set( positions, positions.length );
-
-	var uvs2 = new Float32Array( uvs.length * 2 );
-	uvs2.set( uvs );
-	uvs2.set( uvs, uvs.length );
-
-	var vector = new THREE.Vector2();
-	var length = positions.length / 3;
-
-	for ( var i = 0, l = positions2.length / 3; i < l; i ++ ) {
-
-		vector.x = positions2[ i * 3 + 0 ];
-		vector.y = positions2[ i * 3 + 1 ];
-
-		var dot = vector.dot( vector );
-		var scalar = 1.5 + ( distortion.x + distortion.y * dot ) * dot;
-
-		var offset = i < length ? 0 : 1;
-
-		positions2[ i * 3 + 0 ] = ( vector.x / scalar ) * 1.5 - 0.5 + offset;
-		positions2[ i * 3 + 1 ] = ( vector.y / scalar ) * 3.0;
-
-		uvs2[ i * 2 ] = ( uvs2[ i * 2 ] + offset ) * 0.5;
-
-	}
-
-	geometry.attributes.position.array = positions2;
-	geometry.attributes.uv.array = uvs2;
-
-	//
-
-	// var material = new THREE.MeshBasicMaterial( { wireframe: true } );
-	var material = new THREE.MeshBasicMaterial( { map: _renderTarget } );
-	var mesh = new THREE.Mesh( geometry, material );
-	_scene.add( mesh );
-
-	//
-
-	this.setSize = function ( width, height ) {
-
-		renderer.setSize( width, height );
-
-		var pixelRatio = renderer.getPixelRatio();
-
-		_renderTarget.setSize( width * pixelRatio, height * pixelRatio );
-
-	};
-
-	this.render = function ( scene, camera ) {
-
-		scene.updateMatrixWorld();
-
-		if ( camera.parent === null ) camera.updateMatrixWorld();
-
-		_stereo.update( camera );
-
-		var width = _renderTarget.width / 2;
-		var height = _renderTarget.height;
-
-		_renderTarget.scissor.set( 0, 0, width, height );
-		_renderTarget.viewport.set( 0, 0, width, height );
-		renderer.render( scene, _stereo.cameraL, _renderTarget );
-
-		_renderTarget.scissor.set( width, 0, width, height );
-		_renderTarget.viewport.set( width, 0, width, height );
-		renderer.render( scene, _stereo.cameraR, _renderTarget );
-
-		renderer.render( _scene, _camera );
-
-	};
-
-};

+ 12 - 12
examples/js/loaders/TGALoader.js

@@ -390,36 +390,36 @@ THREE.TGALoader.prototype._parser = function ( buffer ) {
 				x_start = 0;
 				x_step = 1;
 				x_end = width;
-				y_start = 0;
-				y_step = 1;
-				y_end = height;
+				y_start = height - 1;
+				y_step = -1;
+				y_end = -1;
 				break;
 
 			case TGA_ORIGIN_BL:
 				x_start = 0;
 				x_step = 1;
 				x_end = width;
-				y_start = height - 1;
-				y_step = - 1;
-				y_end = - 1;
+				y_start = 0;
+				y_step = 1;
+				y_end = height;
 				break;
 
 			case TGA_ORIGIN_UR:
 				x_start = width - 1;
 				x_step = - 1;
 				x_end = - 1;
-				y_start = 0;
-				y_step = 1;
-				y_end = height;
+				y_start = height - 1;
+				y_step = -1;
+				y_end = -1;
 				break;
 
 			case TGA_ORIGIN_BR:
 				x_start = width - 1;
 				x_step = - 1;
 				x_end = - 1;
-				y_start = height - 1;
-				y_step = - 1;
-				y_end = - 1;
+				y_start = 0;
+				y_step = 1;
+				y_end = height;
 				break;
 
 		}

+ 18 - 11
examples/misc_sound.html

@@ -78,7 +78,6 @@
 				var listener = new THREE.AudioListener();
 				camera.add( listener );
 
-
 				scene = new THREE.Scene();
 				scene.fog = new THREE.FogExp2( 0x000000, 0.0025 );
 
@@ -94,14 +93,18 @@
 
 				// sound spheres
 
+				var audioLoader = new THREE.AudioLoader();
+
 				var mesh1 = new THREE.Mesh( sphere, material_sphere1 );
 				mesh1.position.set( -250, 30, 0 );
 				scene.add( mesh1 );
 
 				var sound1 = new THREE.PositionalAudio( listener );
-				sound1.load( 'sounds/358232_j_s_song.ogg' );
-				sound1.setRefDistance( 20 );
-				sound1.autoplay = true;
+				audioLoader.load( 'sounds/358232_j_s_song.ogg', function( buffer ) {
+					sound1.setBuffer( buffer );
+					sound1.setRefDistance( 20 );
+					sound1.play();
+				});
 				mesh1.add( sound1 );
 
 				//
@@ -111,9 +114,11 @@
 				scene.add( mesh2 );
 
 				var sound2 = new THREE.PositionalAudio( listener );
-				sound2.load( 'sounds/376737_Skullbeatz___Bad_Cat_Maste.ogg' );
-				sound2.setRefDistance( 20 );
-				sound2.autoplay = true;
+				audioLoader.load( 'sounds/376737_Skullbeatz___Bad_Cat_Maste.ogg', function( buffer ) {
+					sound2.setBuffer( buffer );
+					sound2.setRefDistance( 20 );
+					sound2.play();
+				});
 				mesh2.add( sound2 );
 
 				//
@@ -142,10 +147,12 @@
 				// global ambient audio
 
 				var sound4 = new THREE.Audio( listener );
-				sound4.load( 'sounds/Project_Utopia.ogg' );
-				sound4.autoplay = true;
-				sound4.setLoop(true);
-				sound4.setVolume(0.5);
+				audioLoader.load( 'sounds/Project_Utopia.ogg', function( buffer ) {
+					sound4.setBuffer( buffer );
+					sound4.setLoop(true);
+					sound4.setVolume(0.5);
+					sound4.play();
+				});
 
 				// ground
 

+ 7 - 10
examples/webgl_animation_skinning_morph.html

@@ -121,18 +121,17 @@
 
 				light.castShadow = true;
 
-				light.shadowMapWidth = 1024;
-				light.shadowMapHeight = 1024;
+				light.shadow.mapSize.width = 1024;
+				light.shadow.mapSize.heigth = 1024;
 
 				var d = 390;
 
-				light.shadowCameraLeft = -d;
-				light.shadowCameraRight = d;
-				light.shadowCameraTop = d * 1.5;
-				light.shadowCameraBottom = -d;
+				light.shadow.camera.left = -d;
+				light.shadow.camera.right = d;
+				light.shadow.camera.top = d * 1.5;
+				light.shadow.camera.bottom = -d;
 
-				light.shadowCameraFar = 3500;
-				//light.shadowCameraVisible = true;
+				light.shadow.camera.far = 3500;
 
 				// RENDERER
 
@@ -160,8 +159,6 @@
 				var loader = new THREE.JSONLoader();
 				loader.load( "models/skinned/knight.js", function ( geometry, materials ) {
 
-					console.log( 'materials', materials );
-
 					createScene( geometry, materials, 0, FLOOR, -300, 60 )
 
 					// GUI

+ 5 - 5
examples/webgl_buffergeometry_rawshader.html

@@ -124,14 +124,14 @@
 
 				geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
 
-				var colors = new Float32Array( triangles * 3 * 4 );
+				var colors = new Uint8Array( triangles * 3 * 4 );
 
 				for ( var i = 0, l = triangles * 3 * 4; i < l; i += 4 ) {
 
-					colors[ i     ] = Math.random();
-					colors[ i + 1 ] = Math.random();
-					colors[ i + 2 ] = Math.random();
-					colors[ i + 3 ] = Math.random();
+					colors[ i     ] = Math.random() * 255;
+					colors[ i + 1 ] = Math.random() * 255;
+					colors[ i + 2 ] = Math.random() * 255;
+					colors[ i + 3 ] = Math.random() * 255;
 
 				}
 

+ 6 - 6
examples/webgl_geometry_spline_editor.html

@@ -70,12 +70,12 @@
 				var light = new THREE.SpotLight( 0xffffff, 1.5 );
 				light.position.set( 0, 1500, 200 );
 				light.castShadow = true;
-				light.shadowCameraNear = 200;
-				light.shadowCameraFar = 2000;
-				light.shadowCameraFov = 70;
-				light.shadowBias = -0.000222;
-				light.shadowMapWidth = 1024;
-				light.shadowMapHeight = 1024;
+				light.shadow.camera.near = 200;
+				light.shadow.camera.far = 2000;
+				light.shadow.camera.fov = 70;
+				light.shadow.bias = -0.000222;
+				light.shadow.mapSize.width = 1024;
+				light.shadow.mapSize.height = 1024;
 				scene.add( light );
 				spotlight = light;
 

+ 6 - 6
examples/webgl_interactive_draggablecubes.html

@@ -60,14 +60,14 @@
 				light.position.set( 0, 500, 2000 );
 				light.castShadow = true;
 
-				light.shadowCameraNear = 200;
-				light.shadowCameraFar = camera.far;
-				light.shadowCameraFov = 50;
+				light.shadow.camera.near = 200;
+				light.shadow.camera.far = camera.far;
+				light.shadow.camera.fov = 50;
 
-				light.shadowBias = -0.00022;
+				light.shadow.bias = -0.00022;
 
-				light.shadowMapWidth = 2048;
-				light.shadowMapHeight = 2048;
+				light.shadow.mapSize.width = 2048;
+				light.shadow.mapSize.height = 2048;
 
 				scene.add( light );
 

+ 1 - 1
examples/webgl_interactive_raycasting_points.html

@@ -160,7 +160,7 @@
 				}
 
 				geometry.setIndex( new THREE.BufferAttribute( indices, 1 ) );
-				geometry.addDrawCall( 0, indices.length );
+				geometry.addGroup( 0, indices.length );
 
 				var material = new THREE.PointsMaterial( { size: pointSize, vertexColors: THREE.VertexColors } );
 				var pointcloud = new THREE.Points( geometry, material );

+ 11 - 8
examples/webgl_loader_md2_control.html

@@ -105,14 +105,17 @@
 				light.position.set( 200, 450, 500 );
 
 				light.castShadow = true;
-				light.shadowMapWidth = 1024;
-				light.shadowMapHeight = 512;
-				light.shadowCameraNear = 100;
-				light.shadowCameraFar = 1200;
-				light.shadowCameraTop = 350;
-				light.shadowCameraBottom = -350;
-				light.shadowCameraRight = 1000;
-				light.shadowCameraLeft = -1000;
+
+				light.shadow.mapSize.width = 1024;
+				light.shadow.mapSize.height = 512;
+
+				light.shadow.camera.near = 100;
+				light.shadow.camera.far = 1200;
+
+				light.shadow.camera.left = -1000;
+				light.shadow.camera.right = 1000;
+				light.shadow.camera.top = 350;
+				light.shadow.camera.bottom = -350;
 
 				scene.add( light );
 				// scene.add( new THREE.CameraHelper( light.shadow.camera ) );

+ 9 - 10
examples/webgl_loader_ply.html

@@ -150,21 +150,20 @@
 				scene.add( directionalLight );
 
 				directionalLight.castShadow = true;
-				// directionalLight.shadowCameraVisible = true;
 
 				var d = 1;
-				directionalLight.shadowCameraLeft = -d;
-				directionalLight.shadowCameraRight = d;
-				directionalLight.shadowCameraTop = d;
-				directionalLight.shadowCameraBottom = -d;
+				directionalLight.shadow.camera.left = -d;
+				directionalLight.shadow.camera.right = d;
+				directionalLight.shadow.camera.top = d;
+				directionalLight.shadow.camera.bottom = -d;
 
-				directionalLight.shadowCameraNear = 1;
-				directionalLight.shadowCameraFar = 4;
+				directionalLight.shadow.camera.near = 1;
+				directionalLight.shadow.camera.far = 4;
 
-				directionalLight.shadowMapWidth = 1024;
-				directionalLight.shadowMapHeight = 1024;
+				directionalLight.shadow.mapSize.width = 1024;
+				directionalLight.shadow.mapSize.height = 1024;
 
-				directionalLight.shadowBias = -0.005;
+				directionalLight.shadow.bias = -0.005;
 
 			}
 

+ 9 - 10
examples/webgl_loader_stl.html

@@ -204,21 +204,20 @@
 				scene.add( directionalLight );
 
 				directionalLight.castShadow = true;
-				// directionalLight.shadowCameraVisible = true;
 
 				var d = 1;
-				directionalLight.shadowCameraLeft = -d;
-				directionalLight.shadowCameraRight = d;
-				directionalLight.shadowCameraTop = d;
-				directionalLight.shadowCameraBottom = -d;
+				directionalLight.shadow.camera.left = -d;
+				directionalLight.shadow.camera.right = d;
+				directionalLight.shadow.camera.top = d;
+				directionalLight.shadow.camera.bottom = -d;
 
-				directionalLight.shadowCameraNear = 1;
-				directionalLight.shadowCameraFar = 4;
+				directionalLight.shadow.camera.near = 1;
+				directionalLight.shadow.camera.far = 4;
 
-				directionalLight.shadowMapWidth = 1024;
-				directionalLight.shadowMapHeight = 1024;
+				directionalLight.shadow.mapSize.width = 1024;
+				directionalLight.shadow.mapSize.height = 1024;
 
-				directionalLight.shadowBias = -0.005;
+				directionalLight.shadow.bias = -0.005;
 
 			}
 

+ 8 - 9
examples/webgl_loader_utf8.html

@@ -96,20 +96,19 @@
 				scene.add( directionalLight );
 
 				directionalLight.castShadow = true;
-				// directionalLight.shadowCameraVisible = true;
 
-				directionalLight.shadowMapWidth = 2048;
-				directionalLight.shadowMaHeight = 2048;
+				directionalLight.shadow.mapSize.width = 2048;
+				directionalLight.shadow.mapSize.height = 2048;
 
 				var d = 150;
 
-				directionalLight.shadowCameraLeft = -d * 1.2;
-				directionalLight.shadowCameraRight = d * 1.2;
-				directionalLight.shadowCameraTop = d;
-				directionalLight.shadowCameraBottom = -d;
+				directionalLight.shadow.camera.left = -d * 1.2;
+				directionalLight.shadow.camera.right = d * 1.2;
+				directionalLight.shadow.camera.top = d;
+				directionalLight.shadow.camera.bottom = -d;
 
-				directionalLight.shadowCameraNear = 200;
-				directionalLight.shadowCameraFar = 500;
+				directionalLight.shadow.camera.near = 200;
+				directionalLight.shadow.camera.far = 500;
 
 
 				// RENDERER

+ 6 - 7
examples/webgl_materials_bumpmap.html

@@ -101,17 +101,16 @@
 				scene.add( spotLight );
 
 				spotLight.castShadow = true;
-				// spotLight.shadowCameraVisible = true;
 
-				spotLight.shadowMapWidth = 2048;
-				spotLight.shadowMapHeight = 2048;
+				spotLight.shadow.mapSize.width = 2048;
+				spotLight.shadow.mapSize.height = 2048;
 
-				spotLight.shadowCameraNear = 200;
-				spotLight.shadowCameraFar = 1500;
+				spotLight.shadow.camera.near = 200;
+				spotLight.shadow.camera.far = 1500;
 
-				spotLight.shadowCameraFov = 40;
+				spotLight.shadow.camera.fov = 40;
 
-				spotLight.shadowBias = -0.005;
+				spotLight.shadow.bias = -0.005;
 
 				//
 

+ 9 - 10
examples/webgl_materials_bumpmap_skin.html

@@ -111,20 +111,19 @@
 				directionalLight.position.set( 500, 0, 500 );
 
 				directionalLight.castShadow = true;
-				//directionalLight.shadowCameraVisible = true;
 
-				directionalLight.shadowMapWidth = 2048;
-				directionalLight.shadowMapHeight = 2048;
+				directionalLight.shadow.mapSize.width = 2048;
+				directionalLight.shadow.mapSize.height = 2048;
 
-				directionalLight.shadowCameraNear = 200;
-				directionalLight.shadowCameraFar = 1500;
+				directionalLight.shadow.camera.near = 200;
+				directionalLight.shadow.camera.far = 1500;
 
-				directionalLight.shadowCameraLeft = -500;
-				directionalLight.shadowCameraRight = 500;
-				directionalLight.shadowCameraTop = 500;
-				directionalLight.shadowCameraBottom = -500;
+				directionalLight.shadow.camera.left = -500;
+				directionalLight.shadow.camera.right = 500;
+				directionalLight.shadow.camera.top = 500;
+				directionalLight.shadow.camera.bottom = -500;
 
-				directionalLight.shadowBias = -0.005;
+				directionalLight.shadow.bias = -0.005;
 
 				scene.add( directionalLight );
 

+ 6 - 11
examples/webgl_materials_cubemap_dynamic.html

@@ -169,21 +169,16 @@
 				spotLight.target.position.set( 0, 0, 0 );
 				spotLight.castShadow = true;
 
-				spotLight.shadowCameraNear = 100;
-				spotLight.shadowCameraFar = camera.far;
-				spotLight.shadowCameraFov = 50;
+				spotLight.shadow.camera.near = 100;
+				spotLight.shadow.camera.far = camera.far;
+				spotLight.shadow.camera.fov = 50;
 
-				spotLight.shadowBias = -0.00125;
-				spotLight.shadowMapWidth = SHADOW_MAP_WIDTH;
-				spotLight.shadowMapHeight = SHADOW_MAP_HEIGHT;
+				spotLight.shadow.bias = -0.00125;
+				spotLight.shadow.mapSize.width = SHADOW_MAP_WIDTH;
+				spotLight.shadow.mapSize.height = SHADOW_MAP_HEIGHT;
 
 				scene.add( spotLight );
 
-				directionalLight2 = new THREE.PointLight( 0xff9900, 0.25 );
-				directionalLight2.position.set( 0.5, -1, 0.5 );
-				//directionalLight2.position.normalize();
-				//scene.add( directionalLight2 );
-
 				// RENDERER
 
 				renderer = new THREE.WebGLRenderer( { antialias: false } );

+ 0 - 2
examples/webgl_materials_texture_tga.html

@@ -77,7 +77,6 @@
 
 				// add box 1 - grey8 texture
 				var texture1 = loader.load( 'textures/crate_grey8.tga' );
-				texture1.flipY = true;
 
 				var material1 = new THREE.MeshPhongMaterial( { color: 0xffffff, map: texture1 } );
 
@@ -89,7 +88,6 @@
 
 				// add box 2 - tga texture
 				var texture2 = loader.load( 'textures/crate_color8.tga' );
-				texture2.flipY = true;
 
 				var material2 = new THREE.MeshPhongMaterial( { color: 0xffffff, map: texture2 } );
 

+ 6 - 9
examples/webgl_shadowmap.html

@@ -111,16 +111,13 @@
 
 				light.castShadow = true;
 
-				light.shadowCameraNear = 1200;
-				light.shadowCameraFar = 2500;
-				light.shadowCameraFov = 50;
+				light.shadow.camera.near = 1200;
+				light.shadow.camera.far = 2500;
+				light.shadow.camera.fov = 50;
+				light.shadow.bias = 0.0001;
 
-				//light.shadowCameraVisible = true;
-
-				light.shadowBias = 0.0001;
-
-				light.shadowMapWidth = SHADOW_MAP_WIDTH;
-				light.shadowMapHeight = SHADOW_MAP_HEIGHT;
+				light.shadow.mapSize.width = SHADOW_MAP_WIDTH;
+				light.shadow.mapSize.height = SHADOW_MAP_HEIGHT;
 
 				scene.add( light );
 

+ 6 - 8
examples/webgl_shadowmap_performance.html

@@ -106,16 +106,14 @@
 
 				light.castShadow = true;
 
-				light.shadowCameraNear = 700;
-				light.shadowCameraFar = camera.far;
-				light.shadowCameraFov = 50;
+				light.shadow.camera.near = 700;
+				light.shadow.camera.far = camera.far;
+				light.shadow.camera.fov = 50;
 
-				//light.shadowCameraVisible = true;
+				light.shadow.bias = 0.0001;
 
-				light.shadowBias = 0.0001;
-
-				light.shadowMapWidth = SHADOW_MAP_WIDTH;
-				light.shadowMapHeight = SHADOW_MAP_HEIGHT;
+				light.shadow.mapSize.width = SHADOW_MAP_WIDTH;
+				light.shadow.mapSize.height = SHADOW_MAP_HEIGHT;
 
 				scene.add( light );
 

+ 12 - 12
examples/webgl_shadowmap_viewer.html

@@ -76,10 +76,10 @@
 				spotLight.penumbra = 0.3;
 				spotLight.position.set( 10, 10, 5 );
 				spotLight.castShadow = true;
-				spotLight.shadowCameraNear = 8;
-				spotLight.shadowCameraFar = 30;
-				spotLight.shadowMapWidth = 1024;
-				spotLight.shadowMapHeight = 1024;
+				spotLight.shadow.camera.near = 8;
+				spotLight.shadow.camera.far = 30;
+				spotLight.shadow.mapSize.width = 1024;
+				spotLight.shadow.mapSize.height = 1024;
 				scene.add( spotLight );
 
 				scene.add( new THREE.CameraHelper( spotLight.shadow.camera ) );
@@ -88,14 +88,14 @@
 				dirLight.name = 'Dir. Light';
 				dirLight.position.set( 0, 10, 0 );
 				dirLight.castShadow = true;
-				dirLight.shadowCameraNear = 1;
-				dirLight.shadowCameraFar = 10;
-				dirLight.shadowCameraRight = 15;
-				dirLight.shadowCameraLeft = - 15;
-				dirLight.shadowCameraTop	= 15;
-				dirLight.shadowCameraBottom = - 15;
-				dirLight.shadowMapWidth = 1024;
-				dirLight.shadowMapHeight = 1024;
+				dirLight.shadow.camera.near = 1;
+				dirLight.shadow.camera.far = 10;
+				dirLight.shadow.camera.right = 15;
+				dirLight.shadow.camera.left = - 15;
+				dirLight.shadow.camera.top	= 15;
+				dirLight.shadow.camera.bottom = - 15;
+				dirLight.shadow.mapSize.width = 1024;
+				dirLight.shadow.mapSize.height = 1024;
 				scene.add( dirLight );
 
 				scene.add( new THREE.CameraHelper( dirLight.shadow.camera ) );

+ 29 - 33
examples/webgl_effects_cardboard.html → examples/webvr_shadow.html

@@ -14,11 +14,22 @@
 	<body>
 
 		<script src="../build/three.min.js"></script>
-		<script src="js/effects/CardboardEffect.js"></script>
+
+		<script src="js/WebVR.js"></script>
+		<script src="js/controls/VRControls.js"></script>
+		<script src="js/effects/VREffect.js"></script>
 		<script>
 
+			if ( WEBVR.isLatestAvailable() === false ) {
+
+				document.body.appendChild( WEBVR.getMessage() );
+
+			}
+
+			//
+
 			var camera, scene, renderer;
-			var effect;
+			var effect, controls;
 
 			init();
 			animate();
@@ -27,10 +38,13 @@
 
 				scene = new THREE.Scene();
 
+				var dummy = new THREE.Camera();
+				dummy.position.set( 2, 1, 2 );
+				dummy.lookAt( scene.position );
+				scene.add( dummy );
+
 				camera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 0.1, 10 );
-				camera.position.set( 3, 2, 3 );
-				camera.focalLength = camera.position.distanceTo( scene.position );
-				camera.lookAt( scene.position );
+				dummy.add( camera );
 
 				var geometry = new THREE.TorusKnotGeometry( 0.4, 0.15, 150, 20 );;
 				var material = new THREE.MeshStandardMaterial( { roughness: 0.01, metalness: 0.2 } );
@@ -62,39 +76,23 @@
 
 				//
 
-				renderer = new THREE.WebGLRenderer( { antialias: false } );
+				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setClearColor( 0x101010 );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				renderer.shadowMap.enabled = true;
 				document.body.appendChild( renderer.domElement );
 
-				renderer.domElement.addEventListener( 'click', function () {
-
-					if ( this.requestFullscreen ) {
-
-						this.requestFullscreen();
-
-					} else if ( this.msRequestFullscreen ) {
-
-						this.msRequestFullscreen();
-
-					} else if ( this.mozRequestFullScreen ) {
-
-						this.mozRequestFullScreen();
-
-					} else if ( this.webkitRequestFullscreen ) {
-
-						this.webkitRequestFullscreen();
+				//
 
-					}
+				controls = new THREE.VRControls( camera );
+				effect = new THREE.VREffect( renderer );
 
-				} );
+				if ( WEBVR.isAvailable() === true ) {
 
-				//
+					document.body.appendChild( WEBVR.getButton( effect ) );
 
-				effect = new THREE.CardboardEffect( renderer );
-				effect.setSize( window.innerWidth, window.innerHeight );
+				}
 
 				//
 
@@ -121,14 +119,12 @@
 			function render() {
 
 				var time = performance.now() * 0.0002;
-				camera.position.x = Math.cos( time ) * 4;
-				camera.position.z = Math.sin( time ) * 4;
-				camera.lookAt( new THREE.Vector3() );
-
-				var mesh = scene.children[ 0 ];
+				var mesh = scene.children[ 1 ];
 				mesh.rotation.x = time * 2;
 				mesh.rotation.y = time * 5;
 
+				controls.update();
+
 				effect.render( scene, camera );
 
 			}

+ 14 - 11
src/audio/Audio.js

@@ -1,5 +1,6 @@
 /**
  * @author mrdoob / http://mrdoob.com/
+ * @author Reece Aaron Lecrivain / http://reecenotes.com/
  */
 
 THREE.Audio = function ( listener ) {
@@ -38,10 +39,16 @@ THREE.Audio.prototype.getOutput = function () {
 
 THREE.Audio.prototype.load = function ( file ) {
 
-	var buffer = new THREE.AudioBuffer( this.context );
-	buffer.load( file );
+	console.warn( 'THREE.Audio: .load has been deprecated. Please use THREE.AudioLoader.' );
 
-	this.setBuffer( buffer );
+	var scope = this;
+
+	var audioLoader = new THREE.AudioLoader();
+	audioLoader.load( file, function ( buffer ) {
+
+		scope.setBuffer( buffer );
+
+	} );
 
 	return this;
 
@@ -62,13 +69,9 @@ THREE.Audio.prototype.setBuffer = function ( audioBuffer ) {
 
 	var scope = this;
 
-	audioBuffer.onReady( function( buffer ) {
-
-		scope.source.buffer = buffer;
-		scope.sourceType = 'buffer';
-		if ( scope.autoplay ) scope.play();
-
-	} );
+	scope.source.buffer = audioBuffer;
+	scope.sourceType = 'buffer';
+	if ( scope.autoplay ) scope.play();
 
 	return this;
 
@@ -213,7 +216,7 @@ THREE.Audio.prototype.getPlaybackRate = function () {
 
 };
 
-THREE.Audio.prototype.onEnded = function() {
+THREE.Audio.prototype.onEnded = function () {
 
 	this.isPlaying = false;
 

+ 0 - 56
src/audio/AudioBuffer.js

@@ -1,56 +0,0 @@
-/**
- * @author mrdoob / http://mrdoob.com/
- */
-
-THREE.AudioBuffer = function ( context ) {
-
-	this.context = context;
-	this.ready = false;
-	this.readyCallbacks = [];
-
-};
-
-THREE.AudioBuffer.prototype.load = function ( file ) {
-
-	var scope = this;
-
-	var request = new XMLHttpRequest();
-	request.open( 'GET', file, true );
-	request.responseType = 'arraybuffer';
-	request.onload = function ( e ) {
-
-		scope.context.decodeAudioData( this.response, function ( buffer ) {
-
-			scope.buffer = buffer;
-			scope.ready = true;
-
-			for ( var i = 0; i < scope.readyCallbacks.length; i ++ ) {
-
-				scope.readyCallbacks[ i ]( scope.buffer );
-
-			}
-
-			scope.readyCallbacks = [];
-
-		} );
-
-	};
-	request.send();
-
-	return this;
-
-};
-
-THREE.AudioBuffer.prototype.onReady = function ( callback ) {
-
-	if ( this.ready ) {
-
-		callback( this.buffer );
-
-	} else {
-
-		this.readyCallbacks.push( callback );
-
-	}
-
-};

+ 25 - 0
src/audio/AudioContext.js

@@ -0,0 +1,25 @@
+/**
+ * @author mrdoob / http://mrdoob.com/
+ */
+
+Object.defineProperty( THREE, 'AudioContext', {
+
+	get: ( function () {
+
+		var context;
+
+		return function () {
+
+			if ( context === undefined ) {
+
+				context = new ( window.AudioContext || window.webkitAudioContext )();
+
+			}
+
+			return context;
+
+		};
+
+	} )()
+
+} );

+ 1 - 1
src/audio/AudioListener.js

@@ -8,7 +8,7 @@ THREE.AudioListener = function () {
 
 	this.type = 'AudioListener';
 
-	this.context = new ( window.AudioContext || window.webkitAudioContext )();
+	this.context = THREE.AudioContext;
 
 	this.gain = this.context.createGain();
 	this.gain.connect( this.context.destination );

+ 33 - 0
src/loaders/AudioLoader.js

@@ -0,0 +1,33 @@
+/**
+ * @author Reece Aaron Lecrivain / http://reecenotes.com/
+ */
+
+THREE.AudioLoader = function ( manager ) {
+
+	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+
+};
+
+THREE.AudioLoader.prototype = {
+
+	constructor: THREE.AudioLoader,
+
+	load: function ( url, onLoad, onProgress, onError ) {
+
+		var loader = new THREE.XHRLoader( this.manager );
+		loader.setResponseType( 'arraybuffer' );
+		loader.load( url, function ( buffer ) {
+
+			var context = THREE.AudioContext;
+
+			context.decodeAudioData( buffer, function ( audioBuffer ) {
+
+				onLoad( audioBuffer );
+
+			} );
+
+		}, onProgress, onError );
+
+	}
+
+};

+ 12 - 1
src/renderers/WebGLRenderer.js

@@ -1015,8 +1015,19 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 						}
 
+						var type = _gl.FLOAT;
+						var normalized = false;
+						var array = geometryAttribute.array;
+
+						if ( array instanceof Uint8Array ) {
+
+							type = _gl.UNSIGNED_BYTE;
+							normalized = true;
+
+						}
+
 						_gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );
-						_gl.vertexAttribPointer( programAttribute, size, _gl.FLOAT, false, 0, startIndex * size * 4 ); // 4 bytes per Float32
+						_gl.vertexAttribPointer( programAttribute, size, type, normalized, 0, startIndex * size * array.BYTES_PER_ELEMENT );
 
 					}
 

+ 2 - 1
utils/build/includes/common.json

@@ -54,7 +54,7 @@
 	"src/animation/tracks/VectorKeyframeTrack.js",
 	"src/audio/Audio.js",
 	"src/audio/AudioAnalyser.js",
-	"src/audio/AudioBuffer.js",
+	"src/audio/AudioContext.js",
 	"src/audio/PositionalAudio.js",
 	"src/audio/AudioListener.js",
 	"src/cameras/Camera.js",
@@ -69,6 +69,7 @@
 	"src/lights/HemisphereLight.js",
 	"src/lights/PointLight.js",
 	"src/lights/SpotLight.js",
+	"src/loaders/AudioLoader.js",
 	"src/loaders/Cache.js",
 	"src/loaders/Loader.js",
 	"src/loaders/XHRLoader.js",