Browse Source

Updated build

Benjamin MICHEL 5 years ago
parent
commit
fe8eb44856
2 changed files with 269 additions and 62 deletions
  1. 135 31
      build/three.js
  2. 134 31
      build/three.module.js

+ 135 - 31
build/three.js

@@ -14150,7 +14150,7 @@
 
 
 	var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}";
 	var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}";
 
 
-	var lightmap_fragment = "#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif";
+	var lightmap_fragment = "#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 )\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif";
 
 
 	var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif";
 	var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif";
 
 
@@ -15311,8 +15311,8 @@
 			// Ignore background in AR
 			// Ignore background in AR
 			// TODO: Reconsider this.
 			// TODO: Reconsider this.
 
 
-			var vr = renderer.vr;
-			var session = vr.getSession && vr.getSession();
+			var xr = renderer.xr;
+			var session = xr.getSession && xr.getSession();
 
 
 			if ( session && session.environmentBlendMode === 'additive' ) {
 			if ( session && session.environmentBlendMode === 'additive' ) {
 
 
@@ -18019,12 +18019,13 @@
 
 
 				parameters.dithering ? '#define DITHERING' : '',
 				parameters.dithering ? '#define DITHERING' : '',
 
 
-				( parameters.outputEncoding || parameters.mapEncoding || parameters.matcapEncoding || parameters.envMapEncoding || parameters.emissiveMapEncoding ) ?
+				( parameters.outputEncoding || parameters.mapEncoding || parameters.matcapEncoding || parameters.envMapEncoding || parameters.emissiveMapEncoding || parameters.lightMapEncoding ) ?
 					ShaderChunk[ 'encodings_pars_fragment' ] : '', // this code is required here because it is used by the various encoding/decoding function defined below
 					ShaderChunk[ 'encodings_pars_fragment' ] : '', // this code is required here because it is used by the various encoding/decoding function defined below
 				parameters.mapEncoding ? getTexelDecodingFunction( 'mapTexelToLinear', parameters.mapEncoding ) : '',
 				parameters.mapEncoding ? getTexelDecodingFunction( 'mapTexelToLinear', parameters.mapEncoding ) : '',
 				parameters.matcapEncoding ? getTexelDecodingFunction( 'matcapTexelToLinear', parameters.matcapEncoding ) : '',
 				parameters.matcapEncoding ? getTexelDecodingFunction( 'matcapTexelToLinear', parameters.matcapEncoding ) : '',
 				parameters.envMapEncoding ? getTexelDecodingFunction( 'envMapTexelToLinear', parameters.envMapEncoding ) : '',
 				parameters.envMapEncoding ? getTexelDecodingFunction( 'envMapTexelToLinear', parameters.envMapEncoding ) : '',
 				parameters.emissiveMapEncoding ? getTexelDecodingFunction( 'emissiveMapTexelToLinear', parameters.emissiveMapEncoding ) : '',
 				parameters.emissiveMapEncoding ? getTexelDecodingFunction( 'emissiveMapTexelToLinear', parameters.emissiveMapEncoding ) : '',
+				parameters.lightMapEncoding ? getTexelDecodingFunction( 'lightMapTexelToLinear', parameters.lightMapEncoding ) : '',
 				parameters.outputEncoding ? getTexelEncodingFunction( 'linearToOutputTexel', parameters.outputEncoding ) : '',
 				parameters.outputEncoding ? getTexelEncodingFunction( 'linearToOutputTexel', parameters.outputEncoding ) : '',
 
 
 				parameters.depthPacking ? '#define DEPTH_PACKING ' + material.depthPacking : '',
 				parameters.depthPacking ? '#define DEPTH_PACKING ' + material.depthPacking : '',
@@ -18326,7 +18327,7 @@
 		var parameterNames = [
 		var parameterNames = [
 			"precision", "isWebGL2", "supportsVertexTextures", "outputEncoding", "instancing", "numMultiviewViews",
 			"precision", "isWebGL2", "supportsVertexTextures", "outputEncoding", "instancing", "numMultiviewViews",
 			"map", "mapEncoding", "matcap", "matcapEncoding", "envMap", "envMapMode", "envMapEncoding", "envMapCubeUV",
 			"map", "mapEncoding", "matcap", "matcapEncoding", "envMap", "envMapMode", "envMapEncoding", "envMapCubeUV",
-			"lightMap", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "objectSpaceNormalMap", "tangentSpaceNormalMap", "clearcoatNormalMap", "displacementMap", "specularMap",
+			"lightMap", "lightMapEncoding", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "objectSpaceNormalMap", "tangentSpaceNormalMap", "clearcoatNormalMap", "displacementMap", "specularMap",
 			"roughnessMap", "metalnessMap", "gradientMap",
 			"roughnessMap", "metalnessMap", "gradientMap",
 			"alphaMap", "combine", "vertexColors", "vertexTangents", "vertexUvs", "uvsVertexOnly", "fog", "useFog", "fogExp2",
 			"alphaMap", "combine", "vertexColors", "vertexTangents", "vertexUvs", "uvsVertexOnly", "fog", "useFog", "fogExp2",
 			"flatShading", "sizeAttenuation", "logarithmicDepthBuffer", "skinning",
 			"flatShading", "sizeAttenuation", "logarithmicDepthBuffer", "skinning",
@@ -18452,6 +18453,7 @@
 				envMapEncoding: getTextureEncodingFromMap( material.envMap, renderer.gammaInput ),
 				envMapEncoding: getTextureEncodingFromMap( material.envMap, renderer.gammaInput ),
 				envMapCubeUV: ( !! material.envMap ) && ( ( material.envMap.mapping === CubeUVReflectionMapping ) || ( material.envMap.mapping === CubeUVRefractionMapping ) ),
 				envMapCubeUV: ( !! material.envMap ) && ( ( material.envMap.mapping === CubeUVReflectionMapping ) || ( material.envMap.mapping === CubeUVRefractionMapping ) ),
 				lightMap: !! material.lightMap,
 				lightMap: !! material.lightMap,
+				lightMapEncoding: getTextureEncodingFromMap( material.lightMap, renderer.gammaInput ),
 				aoMap: !! material.aoMap,
 				aoMap: !! material.aoMap,
 				emissiveMap: !! material.emissiveMap,
 				emissiveMap: !! material.emissiveMap,
 				emissiveMapEncoding: getTextureEncodingFromMap( material.emissiveMap, renderer.gammaInput ),
 				emissiveMapEncoding: getTextureEncodingFromMap( material.emissiveMap, renderer.gammaInput ),
@@ -23838,11 +23840,11 @@
 
 
 		initGLContext();
 		initGLContext();
 
 
-		// vr
+		// xr
 
 
-		var vr = ( typeof navigator !== 'undefined' && 'xr' in navigator ) ? new WebXRManager( _this, _gl ) : new WebVRManager( _this );
+		var xr = ( typeof navigator !== 'undefined' && 'xr' in navigator ) ? new WebXRManager( _this, _gl ) : new WebVRManager( _this );
 
 
-		this.vr = vr;
+		this.xr = xr;
 
 
 		// Multiview
 		// Multiview
 
 
@@ -23914,7 +23916,7 @@
 
 
 		this.setSize = function ( width, height, updateStyle ) {
 		this.setSize = function ( width, height, updateStyle ) {
 
 
-			if ( vr.isPresenting() ) {
+			if ( xr.isPresenting() ) {
 
 
 				console.warn( 'THREE.WebGLRenderer: Can\'t change size while VR device is presenting.' );
 				console.warn( 'THREE.WebGLRenderer: Can\'t change size while VR device is presenting.' );
 				return;
 				return;
@@ -24104,7 +24106,7 @@
 			properties.dispose();
 			properties.dispose();
 			objects.dispose();
 			objects.dispose();
 
 
-			vr.dispose();
+			xr.dispose();
 
 
 			animation.stop();
 			animation.stop();
 
 
@@ -24620,7 +24622,7 @@
 
 
 		function onAnimationFrame( time ) {
 		function onAnimationFrame( time ) {
 
 
-			if ( vr.isPresenting() ) { return; }
+			if ( xr.isPresenting() ) { return; }
 			if ( onAnimationFrameCallback ) { onAnimationFrameCallback( time ); }
 			if ( onAnimationFrameCallback ) { onAnimationFrameCallback( time ); }
 
 
 		}
 		}
@@ -24633,7 +24635,7 @@
 		this.setAnimationLoop = function ( callback ) {
 		this.setAnimationLoop = function ( callback ) {
 
 
 			onAnimationFrameCallback = callback;
 			onAnimationFrameCallback = callback;
-			vr.setAnimationLoop( callback );
+			xr.setAnimationLoop( callback );
 
 
 			animation.start();
 			animation.start();
 
 
@@ -24684,9 +24686,9 @@
 
 
 			if ( camera.parent === null ) { camera.updateMatrixWorld(); }
 			if ( camera.parent === null ) { camera.updateMatrixWorld(); }
 
 
-			if ( vr.enabled && vr.isPresenting() ) {
+			if ( xr.enabled && xr.isPresenting() ) {
 
 
-				camera = vr.getCamera( camera );
+				camera = xr.getCamera( camera );
 
 
 			}
 			}
 
 
@@ -24736,7 +24738,7 @@
 
 
 			}
 			}
 
 
-			if ( vr.enabled && multiview.isAvailable() ) {
+			if ( xr.enabled && multiview.isAvailable() ) {
 
 
 				multiview.attachCamera( camera );
 				multiview.attachCamera( camera );
 
 
@@ -24796,7 +24798,7 @@
 
 
 			state.setPolygonOffset( false );
 			state.setPolygonOffset( false );
 
 
-			if ( vr.enabled ) {
+			if ( xr.enabled ) {
 
 
 				if ( multiview.isAvailable() ) {
 				if ( multiview.isAvailable() ) {
 
 
@@ -24804,7 +24806,7 @@
 
 
 				}
 				}
 
 
-				vr.submitFrame();
+				xr.submitFrame();
 
 
 			}
 			}
 
 
@@ -24955,7 +24957,7 @@
 
 
 					_currentArrayCamera = camera;
 					_currentArrayCamera = camera;
 
 
-					if ( vr.enabled && multiview.isAvailable() ) {
+					if ( xr.enabled && multiview.isAvailable() ) {
 
 
 						renderObject( object, scene, camera, geometry, material, group );
 						renderObject( object, scene, camera, geometry, material, group );
 
 
@@ -46352,6 +46354,99 @@
 
 
 	};
 	};
 
 
+	/**
+	 * @author WestLangley / http://github.com/WestLangley
+	 */
+
+	var _v1$6 = new Vector3();
+	var _v2$4 = new Vector3();
+
+	function VertexTangentsHelper( object, size, hex, linewidth ) {
+
+		this.object = object;
+
+		this.size = ( size !== undefined ) ? size : 1;
+
+		var color = ( hex !== undefined ) ? hex : 0x00ffff;
+
+		var width = ( linewidth !== undefined ) ? linewidth : 1;
+
+		//
+
+		var objGeometry = this.object.geometry;
+
+		if ( ! ( objGeometry && objGeometry.isBufferGeometry ) ) {
+
+			console.error( 'THREE.VertexTangentsHelper: geometry not an instance of THREE.BufferGeometry.', objGeometry );
+			return;
+
+		}
+
+		var nTangents = objGeometry.attributes.tangent.count;
+
+		//
+
+		var geometry = new BufferGeometry();
+
+		var positions = new Float32BufferAttribute( nTangents * 2 * 3, 3 );
+
+		geometry.setAttribute( 'position', positions );
+
+		LineSegments.call( this, geometry, new LineBasicMaterial( { color: color, linewidth: width } ) );
+
+		//
+
+		this.matrixAutoUpdate = false;
+
+		this.update();
+
+	}
+
+	VertexTangentsHelper.prototype = Object.create( LineSegments.prototype );
+	VertexTangentsHelper.prototype.constructor = VertexTangentsHelper;
+
+	VertexTangentsHelper.prototype.update = function () {
+
+		this.object.updateMatrixWorld( true );
+
+		var matrixWorld = this.object.matrixWorld;
+
+		var position = this.geometry.attributes.position;
+
+		//
+
+		var objGeometry = this.object.geometry;
+
+		var objPos = objGeometry.attributes.position;
+
+		var objTan = objGeometry.attributes.tangent;
+
+		var idx = 0;
+
+		// for simplicity, ignore index and drawcalls, and render every tangent
+
+		for ( var j = 0, jl = objPos.count; j < jl; j ++ ) {
+
+			_v1$6.set( objPos.getX( j ), objPos.getY( j ), objPos.getZ( j ) ).applyMatrix4( matrixWorld );
+
+			_v2$4.set( objTan.getX( j ), objTan.getY( j ), objTan.getZ( j ) );
+
+			_v2$4.transformDirection( matrixWorld ).multiplyScalar( this.size ).add( _v1$6 );
+
+			position.setXYZ( idx, _v1$6.x, _v1$6.y, _v1$6.z );
+
+			idx = idx + 1;
+
+			position.setXYZ( idx, _v2$4.x, _v2$4.y, _v2$4.z );
+
+			idx = idx + 1;
+
+		}
+
+		position.needsUpdate = true;
+
+	};
+
 	/**
 	/**
 	 * @author alteredq / http://alteredqualia.com/
 	 * @author alteredq / http://alteredqualia.com/
 	 * @author mrdoob / http://mrdoob.com/
 	 * @author mrdoob / http://mrdoob.com/
@@ -47194,8 +47289,8 @@
 	 * @author WestLangley / http://github.com/WestLangley
 	 * @author WestLangley / http://github.com/WestLangley
 	 */
 	 */
 
 
-	var _v1$6 = new Vector3();
-	var _v2$4 = new Vector3();
+	var _v1$7 = new Vector3();
+	var _v2$5 = new Vector3();
 	var _normalMatrix$2 = new Matrix3();
 	var _normalMatrix$2 = new Matrix3();
 
 
 	function FaceNormalsHelper( object, size, hex, linewidth ) {
 	function FaceNormalsHelper( object, size, hex, linewidth ) {
@@ -47272,19 +47367,19 @@
 
 
 			var normal = face.normal;
 			var normal = face.normal;
 
 
-			_v1$6.copy( vertices[ face.a ] )
+			_v1$7.copy( vertices[ face.a ] )
 				.add( vertices[ face.b ] )
 				.add( vertices[ face.b ] )
 				.add( vertices[ face.c ] )
 				.add( vertices[ face.c ] )
 				.divideScalar( 3 )
 				.divideScalar( 3 )
 				.applyMatrix4( matrixWorld );
 				.applyMatrix4( matrixWorld );
 
 
-			_v2$4.copy( normal ).applyMatrix3( _normalMatrix$2 ).normalize().multiplyScalar( this.size ).add( _v1$6 );
+			_v2$5.copy( normal ).applyMatrix3( _normalMatrix$2 ).normalize().multiplyScalar( this.size ).add( _v1$7 );
 
 
-			position.setXYZ( idx, _v1$6.x, _v1$6.y, _v1$6.z );
+			position.setXYZ( idx, _v1$7.x, _v1$7.y, _v1$7.z );
 
 
 			idx = idx + 1;
 			idx = idx + 1;
 
 
-			position.setXYZ( idx, _v2$4.x, _v2$4.y, _v2$4.z );
+			position.setXYZ( idx, _v2$5.x, _v2$5.y, _v2$5.z );
 
 
 			idx = idx + 1;
 			idx = idx + 1;
 
 
@@ -47300,8 +47395,8 @@
 	 * @author WestLangley / http://github.com/WestLangley
 	 * @author WestLangley / http://github.com/WestLangley
 	 */
 	 */
 
 
-	var _v1$7 = new Vector3();
-	var _v2$5 = new Vector3();
+	var _v1$8 = new Vector3();
+	var _v2$6 = new Vector3();
 	var _v3$1 = new Vector3();
 	var _v3$1 = new Vector3();
 
 
 	function DirectionalLightHelper( light, size, color ) {
 	function DirectionalLightHelper( light, size, color ) {
@@ -47356,11 +47451,11 @@
 
 
 	DirectionalLightHelper.prototype.update = function () {
 	DirectionalLightHelper.prototype.update = function () {
 
 
-		_v1$7.setFromMatrixPosition( this.light.matrixWorld );
-		_v2$5.setFromMatrixPosition( this.light.target.matrixWorld );
-		_v3$1.subVectors( _v2$5, _v1$7 );
+		_v1$8.setFromMatrixPosition( this.light.matrixWorld );
+		_v2$6.setFromMatrixPosition( this.light.target.matrixWorld );
+		_v3$1.subVectors( _v2$6, _v1$8 );
 
 
-		this.lightPlane.lookAt( _v2$5 );
+		this.lightPlane.lookAt( _v2$6 );
 
 
 		if ( this.color !== undefined ) {
 		if ( this.color !== undefined ) {
 
 
@@ -47374,7 +47469,7 @@
 
 
 		}
 		}
 
 
-		this.targetLine.lookAt( _v2$5 );
+		this.targetLine.lookAt( _v2$6 );
 		this.targetLine.scale.z = _v3$1.length();
 		this.targetLine.scale.z = _v3$1.length();
 
 
 	};
 	};
@@ -49533,6 +49628,14 @@
 				console.warn( 'THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.' );
 				console.warn( 'THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.' );
 				return this.getContext();
 				return this.getContext();
 
 
+			}
+		},
+		vr: {
+			get: function () {
+
+				console.warn( 'THREE.WebGLRenderer: .vr has been removed. Use .xr instead.' );
+				return this.xr;
+
 			}
 			}
 		}
 		}
 
 
@@ -50379,6 +50482,7 @@
 	exports.Vertex = Vertex;
 	exports.Vertex = Vertex;
 	exports.VertexColors = VertexColors;
 	exports.VertexColors = VertexColors;
 	exports.VertexNormalsHelper = VertexNormalsHelper;
 	exports.VertexNormalsHelper = VertexNormalsHelper;
+	exports.VertexTangentsHelper = VertexTangentsHelper;
 	exports.VideoTexture = VideoTexture;
 	exports.VideoTexture = VideoTexture;
 	exports.WebGLMultisampleRenderTarget = WebGLMultisampleRenderTarget;
 	exports.WebGLMultisampleRenderTarget = WebGLMultisampleRenderTarget;
 	exports.WebGLRenderTarget = WebGLRenderTarget;
 	exports.WebGLRenderTarget = WebGLRenderTarget;

File diff suppressed because it is too large
+ 134 - 31
build/three.module.js


Some files were not shown because too many files changed in this diff