Browse Source

Merge branch 'master' of https://github.com/mrdoob/three.js into zh_doc_20191206

gogoend 5 years ago
parent
commit
495f8a6178
98 changed files with 1144 additions and 2787 deletions
  1. 1 1
      .github/ISSUE_TEMPLATE.md
  2. 69 37
      build/three.js
  3. 373 372
      build/three.min.js
  4. 69 37
      build/three.module.js
  5. 19 13
      docs/api/en/scenes/Scene.html
  6. 20 14
      docs/api/zh/scenes/Scene.html
  7. 1 1
      docs/manual/en/introduction/How-to-update-things.html
  8. 1 1
      docs/manual/zh/introduction/How-to-update-things.html
  9. 16 16
      editor/js/Sidebar.Geometry.js
  10. 30 28
      editor/js/libs/ui.three.js
  11. 1 1
      editor/sw.js
  12. 2 2
      examples/files.js
  13. 1 0
      examples/js/controls/TransformControls.js
  14. 2 6
      examples/js/exporters/GLTFExporter.js
  15. 3 3
      examples/js/lines/LineSegments2.js
  16. 1 1
      examples/js/modifiers/SubdivisionModifier.js
  17. 12 2
      examples/js/postprocessing/CubeTexturePass.js
  18. 0 686
      examples/js/shaders/SkinShader.js
  19. 1 3
      examples/jsm/animation/TimelinerController.d.ts
  20. 1 1
      examples/jsm/controls/OrbitControls.d.ts
  21. 0 2
      examples/jsm/controls/TransformControls.d.ts
  22. 2 6
      examples/jsm/exporters/GLTFExporter.js
  23. 2 2
      examples/jsm/lights/LightProbeGenerator.d.ts
  24. 3 3
      examples/jsm/lines/LineSegments2.js
  25. 2 2
      examples/jsm/loaders/GLTFLoader.d.ts
  26. 1 3
      examples/jsm/loaders/NRRDLoader.d.ts
  27. 0 1
      examples/jsm/loaders/OBJLoader.d.ts
  28. 0 1
      examples/jsm/loaders/TTFLoader.d.ts
  29. 1 1
      examples/jsm/loaders/obj2/worker/parallel/WorkerRunner.d.ts
  30. 9 9
      examples/jsm/loaders/obj2/worker/parallel/WorkerRunner.js
  31. 3 3
      examples/jsm/math/MeshSurfaceSampler.js
  32. 1 1
      examples/jsm/misc/MorphAnimMesh.d.ts
  33. 1 1
      examples/jsm/modifiers/SubdivisionModifier.js
  34. 0 1
      examples/jsm/nodes/accessors/CameraNode.d.ts
  35. 0 1
      examples/jsm/nodes/accessors/ColorsNode.d.ts
  36. 0 1
      examples/jsm/nodes/accessors/LightNode.d.ts
  37. 0 1
      examples/jsm/nodes/accessors/NormalNode.d.ts
  38. 0 1
      examples/jsm/nodes/accessors/PositionNode.d.ts
  39. 0 3
      examples/jsm/nodes/accessors/ReflectNode.d.ts
  40. 0 1
      examples/jsm/nodes/accessors/ResolutionNode.d.ts
  41. 0 1
      examples/jsm/nodes/accessors/ScreenUVNode.d.ts
  42. 0 1
      examples/jsm/nodes/accessors/UVNode.d.ts
  43. 0 1
      examples/jsm/nodes/core/FunctionCallNode.d.ts
  44. 0 1
      examples/jsm/nodes/effects/BlurNode.d.ts
  45. 0 1
      examples/jsm/nodes/effects/ColorAdjustmentNode.d.ts
  46. 0 1
      examples/jsm/nodes/effects/LuminanceNode.d.ts
  47. 0 1
      examples/jsm/nodes/inputs/ReflectorNode.d.ts
  48. 0 1
      examples/jsm/nodes/inputs/TextureNode.d.ts
  49. 0 2
      examples/jsm/nodes/materials/NodeMaterial.d.ts
  50. 0 1
      examples/jsm/nodes/math/OperatorNode.d.ts
  51. 0 1
      examples/jsm/nodes/misc/BumpMapNode.d.ts
  52. 0 1
      examples/jsm/nodes/misc/NormalMapNode.d.ts
  53. 22 22
      examples/jsm/nodes/misc/NormalMapNode.js
  54. 0 1
      examples/jsm/nodes/misc/TextureCubeUVNode.d.ts
  55. 0 1
      examples/jsm/nodes/postprocessing/NodePass.d.ts
  56. 0 1
      examples/jsm/nodes/procedural/CheckerNode.d.ts
  57. 0 1
      examples/jsm/nodes/procedural/NoiseNode.d.ts
  58. 0 1
      examples/jsm/nodes/utils/BypassNode.d.ts
  59. 0 1
      examples/jsm/nodes/utils/ColorSpaceNode.d.ts
  60. 0 1
      examples/jsm/nodes/utils/JoinNode.d.ts
  61. 0 1
      examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts
  62. 0 1
      examples/jsm/nodes/utils/SubSlot.d.ts
  63. 0 1
      examples/jsm/nodes/utils/SwitchNode.d.ts
  64. 0 1
      examples/jsm/nodes/utils/UVTransformNode.d.ts
  65. 12 2
      examples/jsm/postprocessing/CubeTexturePass.js
  66. 0 1
      examples/jsm/postprocessing/FilmPass.d.ts
  67. 0 1
      examples/jsm/renderers/WebGLDeferredRenderer.d.ts
  68. 0 4
      examples/jsm/shaders/BasicShader.d.ts
  69. 0 2
      examples/jsm/shaders/OceanShaders.d.ts
  70. 0 85
      examples/jsm/shaders/SkinShader.d.ts
  71. 0 697
      examples/jsm/shaders/SkinShader.js
  72. 1 1
      examples/jsm/utils/RoughnessMipmapper.d.ts
  73. 0 1
      examples/jsm/webxr/ARButton.js
  74. 0 1
      examples/jsm/webxr/VRButton.js
  75. BIN
      examples/textures/equirectangular/royal_esplanade_1k.hdr
  76. 5 4
      examples/webgl_loader_gltf.html
  77. 0 228
      examples/webgl_materials_bumpmap_skin.html
  78. 1 1
      examples/webgl_materials_car.html
  79. 1 1
      examples/webgl_materials_physical_transparency.html
  80. 5 5
      examples/webgl_materials_reflectivity.html
  81. 0 293
      examples/webgl_materials_skin.html
  82. 7 15
      examples/webgl_materials_variations_toon.html
  83. 7 27
      examples/webgl_postprocessing_dof2.html
  84. 2 4
      examples/webgl_tonemapping.html
  85. 101 0
      examples/webxr_ar_cones.html
  86. 157 0
      examples/webxr_ar_hittest.html
  87. 41 8
      examples/webxr_vr_ballshooter.html
  88. 48 49
      examples/webxr_vr_cubes.html
  89. 2 2
      examples/webxr_vr_panorama_depth.html
  90. 2 1
      package.json
  91. 1 1
      src/constants.js
  92. 2 0
      src/materials/MeshDepthMaterial.d.ts
  93. 2 0
      src/materials/MeshDistanceMaterial.d.ts
  94. 8 3
      src/renderers/WebGLRenderer.js
  95. 60 33
      src/renderers/webxr/WebXRManager.js
  96. 8 0
      utils/build/tsconfig-examples.lint.json
  97. 1 1
      utils/build/tsconfig.lint.json
  98. 0 1
      utils/modularize.js

+ 1 - 1
.github/ISSUE_TEMPLATE.md

@@ -17,7 +17,7 @@ Please also include a live example if possible. You can start from these templat
 ##### Three.js version
 
 - [ ] Dev
-- [ ] r111
+- [ ] r112
 - [ ] ...
 
 ##### Browser

+ 69 - 37
build/three.js

@@ -97,7 +97,7 @@
 
 	}
 
-	var REVISION = '112dev';
+	var REVISION = '112';
 	var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
 	var TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
 	var CullFaceNone = 0;
@@ -22863,13 +22863,7 @@
 		var pose = null;
 
 		var controllers = [];
-		var sortedInputSources = [];
-
-		function isPresenting() {
-
-			return session !== null && referenceSpace !== null;
-
-		}
+		var inputSourcesMap = new Map();
 
 		//
 
@@ -22889,6 +22883,8 @@
 
 		this.enabled = false;
 
+		this.isPresenting = false;
+
 		this.getController = function ( id ) {
 
 			var controller = controllers[ id ];
@@ -22911,13 +22907,11 @@
 
 		function onSessionEvent( event ) {
 
-			for ( var i = 0; i < controllers.length; i ++ ) {
+			var controller = inputSourcesMap.get( event.inputSource );
 
-				if ( sortedInputSources[ i ] === event.inputSource ) {
+			if ( controller ) {
 
-					controllers[ i ].dispatchEvent( { type: event.type } );
-
-				}
+				controller.dispatchEvent( { type: event.type } );
 
 			}
 
@@ -22925,12 +22919,25 @@
 
 		function onSessionEnd() {
 
+			inputSourcesMap.forEach( function ( controller, inputSource ) {
+
+				controller.dispatchEvent( { type: 'disconnected', data: inputSource } );
+				controller.visible = false;
+
+			} );
+
+			inputSourcesMap.clear();
+
+			//
+
 			renderer.setFramebuffer( null );
 			renderer.setRenderTarget( renderer.getRenderTarget() ); // Hack #15830
 			animation.stop();
 
 			scope.dispatchEvent( { type: 'sessionend' } );
 
+			scope.isPresenting = false;
+
 		}
 
 		function onRequestReferenceSpace( value ) {
@@ -22942,6 +22949,8 @@
 
 			scope.dispatchEvent( { type: 'sessionstart' } );
 
+			scope.isPresenting = true;
+
 		}
 
 		this.setFramebufferScaleFactor = function ( /* value */ ) {
@@ -22956,6 +22965,12 @@
 
 		};
 
+		this.getReferenceSpace = function () {
+
+			return referenceSpace;
+
+		};
+
 		this.getSession = function () {
 
 			return session;
@@ -22996,33 +23011,50 @@
 
 				session.addEventListener( 'inputsourceschange', updateInputSources );
 
-				updateInputSources();
-
 			}
 
 		};
 
-		function updateInputSources() {
+		function updateInputSources( event ) {
+
+			var inputSources = session.inputSources;
+
+			// Assign inputSources to available controllers
 
 			for ( var i = 0; i < controllers.length; i ++ ) {
 
-				sortedInputSources[ i ] = findInputSource( i );
+				inputSourcesMap.set( inputSources[ i ], controllers[ i ] );
 
 			}
 
-		}
+			// Notify disconnected
 
-		function findInputSource( id ) {
+			for ( var i = 0; i < event.removed.length; i ++ ) {
 
-			var inputSources = session.inputSources;
+				var inputSource = event.removed[ i ];
+				var controller = inputSourcesMap.get( inputSource );
 
-			for ( var i = 0; i < inputSources.length; i ++ ) {
+				if ( controller ) {
 
-				var inputSource = inputSources[ i ];
-				var handedness = inputSource.handedness;
+					controller.dispatchEvent( { type: 'disconnected', data: inputSource } );
+					inputSourcesMap.delete( inputSource );
 
-				if ( id === 0 && ( handedness === 'none' || handedness === 'right' ) ) { return inputSource; }
-				if ( id === 1 && ( handedness === 'left' ) ) { return inputSource; }
+				}
+
+			}
+
+			// Notify connected
+
+			for ( var i = 0; i < event.added.length; i ++ ) {
+
+				var inputSource = event.added[ i ];
+				var controller = inputSourcesMap.get( inputSource );
+
+				if ( controller ) {
+
+					controller.dispatchEvent( { type: 'connected', data: inputSource } );
+
+				}
 
 			}
 
@@ -23137,8 +23169,6 @@
 
 		};
 
-		this.isPresenting = isPresenting;
-
 		// Animation Loop
 
 		var onAnimationFrameCallback = null;
@@ -23177,11 +23207,13 @@
 
 			//
 
+			var inputSources = session.inputSources;
+
 			for ( var i = 0; i < controllers.length; i ++ ) {
 
 				var controller = controllers[ i ];
 
-				var inputSource = sortedInputSources[ i ];
+				var inputSource = inputSources[ i ];
 
 				if ( inputSource ) {
 
@@ -23191,12 +23223,7 @@
 
 						controller.matrix.fromArray( inputPose.transform.matrix );
 						controller.matrix.decompose( controller.position, controller.rotation, controller.scale );
-
-						if ( inputSource.targetRayMode === 'pointing' ) {
-
-							controller.visible = true;
-
-						}
+						controller.visible = true;
 
 						continue;
 
@@ -23567,7 +23594,7 @@
 
 		this.setSize = function ( width, height, updateStyle ) {
 
-			if ( xr.isPresenting() ) {
+			if ( xr.isPresenting ) {
 
 				console.warn( 'THREE.WebGLRenderer: Can\'t change size while VR device is presenting.' );
 				return;
@@ -24272,7 +24299,7 @@
 
 		function onAnimationFrame( time ) {
 
-			if ( xr.isPresenting() ) { return; }
+			if ( xr.isPresenting ) { return; }
 			if ( onAnimationFrameCallback ) { onAnimationFrameCallback( time ); }
 
 		}
@@ -24336,7 +24363,7 @@
 
 			if ( camera.parent === null ) { camera.updateMatrixWorld(); }
 
-			if ( xr.enabled && xr.isPresenting() ) {
+			if ( xr.enabled && xr.isPresenting ) {
 
 				camera = xr.getCamera( camera );
 
@@ -24751,6 +24778,7 @@
 				program = programCache.acquireProgram( material, materialProperties.shader, parameters, programCacheKey );
 
 				materialProperties.program = program;
+				materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;
 				materialProperties.outputEncoding = _this.outputEncoding;
 				material.program = program;
 
@@ -24878,6 +24906,10 @@
 
 					material.needsUpdate = true;
 
+				} else if ( materialProperties.environment !== environment ) {
+
+					material.needsUpdate = true;
+
 				} else if ( materialProperties.needsLights && ( materialProperties.lightsStateVersion !== lights.state.version ) ) {
 
 					material.needsUpdate = true;

File diff suppressed because it is too large
+ 373 - 372
build/three.min.js


+ 69 - 37
build/three.module.js

@@ -91,7 +91,7 @@ if ( Object.assign === undefined ) {
 
 }
 
-var REVISION = '112dev';
+var REVISION = '112';
 var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
 var TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
 var CullFaceNone = 0;
@@ -22855,13 +22855,7 @@ function WebXRManager( renderer, gl ) {
 	var pose = null;
 
 	var controllers = [];
-	var sortedInputSources = [];
-
-	function isPresenting() {
-
-		return session !== null && referenceSpace !== null;
-
-	}
+	var inputSourcesMap = new Map();
 
 	//
 
@@ -22881,6 +22875,8 @@ function WebXRManager( renderer, gl ) {
 
 	this.enabled = false;
 
+	this.isPresenting = false;
+
 	this.getController = function ( id ) {
 
 		var controller = controllers[ id ];
@@ -22903,13 +22899,11 @@ function WebXRManager( renderer, gl ) {
 
 	function onSessionEvent( event ) {
 
-		for ( var i = 0; i < controllers.length; i ++ ) {
+		var controller = inputSourcesMap.get( event.inputSource );
 
-			if ( sortedInputSources[ i ] === event.inputSource ) {
+		if ( controller ) {
 
-				controllers[ i ].dispatchEvent( { type: event.type } );
-
-			}
+			controller.dispatchEvent( { type: event.type } );
 
 		}
 
@@ -22917,12 +22911,25 @@ function WebXRManager( renderer, gl ) {
 
 	function onSessionEnd() {
 
+		inputSourcesMap.forEach( function ( controller, inputSource ) {
+
+			controller.dispatchEvent( { type: 'disconnected', data: inputSource } );
+			controller.visible = false;
+
+		} );
+
+		inputSourcesMap.clear();
+
+		//
+
 		renderer.setFramebuffer( null );
 		renderer.setRenderTarget( renderer.getRenderTarget() ); // Hack #15830
 		animation.stop();
 
 		scope.dispatchEvent( { type: 'sessionend' } );
 
+		scope.isPresenting = false;
+
 	}
 
 	function onRequestReferenceSpace( value ) {
@@ -22934,6 +22941,8 @@ function WebXRManager( renderer, gl ) {
 
 		scope.dispatchEvent( { type: 'sessionstart' } );
 
+		scope.isPresenting = true;
+
 	}
 
 	this.setFramebufferScaleFactor = function ( /* value */ ) {
@@ -22948,6 +22957,12 @@ function WebXRManager( renderer, gl ) {
 
 	};
 
+	this.getReferenceSpace = function () {
+
+		return referenceSpace;
+
+	};
+
 	this.getSession = function () {
 
 		return session;
@@ -22988,33 +23003,50 @@ function WebXRManager( renderer, gl ) {
 
 			session.addEventListener( 'inputsourceschange', updateInputSources );
 
-			updateInputSources();
-
 		}
 
 	};
 
-	function updateInputSources() {
+	function updateInputSources( event ) {
+
+		var inputSources = session.inputSources;
+
+		// Assign inputSources to available controllers
 
 		for ( var i = 0; i < controllers.length; i ++ ) {
 
-			sortedInputSources[ i ] = findInputSource( i );
+			inputSourcesMap.set( inputSources[ i ], controllers[ i ] );
 
 		}
 
-	}
+		// Notify disconnected
 
-	function findInputSource( id ) {
+		for ( var i = 0; i < event.removed.length; i ++ ) {
 
-		var inputSources = session.inputSources;
+			var inputSource = event.removed[ i ];
+			var controller = inputSourcesMap.get( inputSource );
 
-		for ( var i = 0; i < inputSources.length; i ++ ) {
+			if ( controller ) {
 
-			var inputSource = inputSources[ i ];
-			var handedness = inputSource.handedness;
+				controller.dispatchEvent( { type: 'disconnected', data: inputSource } );
+				inputSourcesMap.delete( inputSource );
 
-			if ( id === 0 && ( handedness === 'none' || handedness === 'right' ) ) return inputSource;
-			if ( id === 1 && ( handedness === 'left' ) ) return inputSource;
+			}
+
+		}
+
+		// Notify connected
+
+		for ( var i = 0; i < event.added.length; i ++ ) {
+
+			var inputSource = event.added[ i ];
+			var controller = inputSourcesMap.get( inputSource );
+
+			if ( controller ) {
+
+				controller.dispatchEvent( { type: 'connected', data: inputSource } );
+
+			}
 
 		}
 
@@ -23129,8 +23161,6 @@ function WebXRManager( renderer, gl ) {
 
 	};
 
-	this.isPresenting = isPresenting;
-
 	// Animation Loop
 
 	var onAnimationFrameCallback = null;
@@ -23169,11 +23199,13 @@ function WebXRManager( renderer, gl ) {
 
 		//
 
+		var inputSources = session.inputSources;
+
 		for ( var i = 0; i < controllers.length; i ++ ) {
 
 			var controller = controllers[ i ];
 
-			var inputSource = sortedInputSources[ i ];
+			var inputSource = inputSources[ i ];
 
 			if ( inputSource ) {
 
@@ -23183,12 +23215,7 @@ function WebXRManager( renderer, gl ) {
 
 					controller.matrix.fromArray( inputPose.transform.matrix );
 					controller.matrix.decompose( controller.position, controller.rotation, controller.scale );
-
-					if ( inputSource.targetRayMode === 'pointing' ) {
-
-						controller.visible = true;
-
-					}
+					controller.visible = true;
 
 					continue;
 
@@ -23559,7 +23586,7 @@ function WebGLRenderer( parameters ) {
 
 	this.setSize = function ( width, height, updateStyle ) {
 
-		if ( xr.isPresenting() ) {
+		if ( xr.isPresenting ) {
 
 			console.warn( 'THREE.WebGLRenderer: Can\'t change size while VR device is presenting.' );
 			return;
@@ -24264,7 +24291,7 @@ function WebGLRenderer( parameters ) {
 
 	function onAnimationFrame( time ) {
 
-		if ( xr.isPresenting() ) return;
+		if ( xr.isPresenting ) return;
 		if ( onAnimationFrameCallback ) onAnimationFrameCallback( time );
 
 	}
@@ -24328,7 +24355,7 @@ function WebGLRenderer( parameters ) {
 
 		if ( camera.parent === null ) camera.updateMatrixWorld();
 
-		if ( xr.enabled && xr.isPresenting() ) {
+		if ( xr.enabled && xr.isPresenting ) {
 
 			camera = xr.getCamera( camera );
 
@@ -24743,6 +24770,7 @@ function WebGLRenderer( parameters ) {
 			program = programCache.acquireProgram( material, materialProperties.shader, parameters, programCacheKey );
 
 			materialProperties.program = program;
+			materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;
 			materialProperties.outputEncoding = _this.outputEncoding;
 			material.program = program;
 
@@ -24870,6 +24898,10 @@ function WebGLRenderer( parameters ) {
 
 				material.needsUpdate = true;
 
+			} else if ( materialProperties.environment !== environment ) {
+
+				material.needsUpdate = true;
+
 			} else if ( materialProperties.needsLights && ( materialProperties.lightsStateVersion !== lights.state.version ) ) {
 
 				material.needsUpdate = true;

+ 19 - 13
docs/api/en/scenes/Scene.html

@@ -25,14 +25,6 @@
 
 		<h2>Properties</h2>
 
-		<h3>[property:Fog fog]</h3>
-
-		<p>A [page:Fog fog] instance defining the type of fog that affects everything rendered in the scene. Default is null.</p>
-
-		<h3>[property:Material overrideMaterial]</h3>
-
-		<p>If not null, it will force everything in the scene to be rendered with that material. Default is null.</p>
-
 		<h3>[property:boolean autoUpdate]</h3>
 		<p>
 		Default is true. If set, then the renderer checks every frame if the scene and its objects needs matrix updates.
@@ -44,19 +36,33 @@
 		If not null, sets the background used when rendering the scene, and is always rendered first. Can be set to a [page:Color] which sets the clear color, a [page:Texture] covering the canvas, or a cubemap as a [page:CubeTexture] or [page:WebGLRenderTargetCube]. Default is null.
 		</p>
 
-		<h2>Methods</h2>
-
-		<h3>[method:Object toJSON]</h3>
+		<h3>[property:Texture environment]</h3>
 		<p>
-		meta -- object containing metadata such as textures or images for the scene.<br />
-		Convert the scene to three.js [link:https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 JSON Object/Scene format].
+		If not null, this texture is set as the environment map for all physical materials in the scene.
+		However, it's not possible to overwrite an existing texture assigned to [page:MeshStandardMaterial.envmap]. Default is null.
 		</p>
 
+		<h3>[property:Fog fog]</h3>
+
+		<p>A [page:Fog fog] instance defining the type of fog that affects everything rendered in the scene. Default is null.</p>
+
+		<h3>[property:Material overrideMaterial]</h3>
+
+		<p>If not null, it will force everything in the scene to be rendered with that material. Default is null.</p>
+
+		<h2>Methods</h2>
+
 		<h3>[method:null dispose]()</h3>
 		<p>
 		Clears scene related data internally cached by [page:WebGLRenderer].
 		</p>
 
+		<h3>[method:Object toJSON]</h3>
+		<p>
+		meta -- object containing metadata such as textures or images for the scene.<br />
+		Convert the scene to three.js [link:https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 JSON Object/Scene format].
+		</p>
+
 		<h2>Source</h2>
 
 		<p>

+ 20 - 14
docs/api/zh/scenes/Scene.html

@@ -26,15 +26,6 @@
 
 		<h2>属性</h2>
 
-		<h3>[property:Fog fog]</h3>
-
-		<p>一个[page:Fog fog]实例定义了影响场景中的每个物体的雾的类型。默认值为null。
-		</p>
-
-		<h3>[property:Material overrideMaterial]</h3>
-
-		<p>如果不为空,它将强制场景中的每个物体使用这里的材质来渲染。默认值为null。</p>
-
 		<h3>[property:boolean autoUpdate]</h3>
 		<p>
 			默认值为true,若设置了这个值,则渲染器会检查每一帧是否需要更新场景及其中物体的矩阵。
@@ -47,19 +38,34 @@
 			可以设置一个用于的“clear”的[page:Color](颜色)、一个覆盖canvas的[page:Texture](纹理),或是一个[page:CubeTexture]。默认值为null。
 		</p>
 
-		<h2>方法</h2>
-
-		<h3>[method:JSON toJSON]</h3>
+		<h3>[property:Texture environment]</h3>
 		<p>
-			meta -- 包含有元数据的对象,例如场景中的的纹理或图片。
-			将scene对象转换为 three.js [link:https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 JSON Object/Scene format](three.js JSON 物体/场景格式)。
+		If not null, this texture is set as the environment map for all physical materials in the scene.
+		However, it's not possible to overwrite an existing texture assigned to [page:MeshStandardMaterial.envmap]. Default is null.
 		</p>
 
+		<h3>[property:Fog fog]</h3>
+
+		<p>一个[page:Fog fog]实例定义了影响场景中的每个物体的雾的类型。默认值为null。
+		</p>
+
+		<h3>[property:Material overrideMaterial]</h3>
+
+		<p>如果不为空,它将强制场景中的每个物体使用这里的材质来渲染。默认值为null。</p>
+
+		<h2>方法</h2>
+
 		<h3>[method:null dispose]()</h3>
 		<p>
 			清除[page:WebGLRenderer]内部所缓存的场景相关的数据。
 		</p>
 
+		<h3>[method:JSON toJSON]</h3>
+		<p>
+			meta -- 包含有元数据的对象,例如场景中的的纹理或图片。
+			将scene对象转换为 three.js [link:https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 JSON Object/Scene format](three.js JSON 物体/场景格式)。
+		</p>
+
 		<h2>源代码</h2>
 
 		<p>

+ 1 - 1
docs/manual/en/introduction/How-to-update-things.html

@@ -209,7 +209,7 @@ geometry.tangentsNeedUpdate = true;
 			<p>If the number is large (e.g. each face could be potentially different), consider a different solution, such as using attributes / textures to drive different per-face look.</p>
 
 			<h3>Examples:</h3>
-			[example:webgl_materials_cars WebGL / materials / cars]<br />
+			[example:webgl_materials_car WebGL / materials / car]<br />
 			[example:webgl_postprocessing_dof WebGL / webgl_postprocessing / dof]
 		</div>
 

+ 1 - 1
docs/manual/zh/introduction/How-to-update-things.html

@@ -194,7 +194,7 @@ geometry.tangentsNeedUpdate = true;
 			<p>如果数量很大(例如,每个面可能有所不同),请考虑不同的解决方案,例如使用属性/纹理来驱动不同的每个面部外观。</p>
 
 			<h3>例子:</h3>
-			[example:webgl_materials_cars WebGL / materials / cars]<br />
+			[example:webgl_materials_car WebGL / materials / car]<br />
 			[example:webgl_postprocessing_dof WebGL / webgl_postprocessing / dof]
 		</div>
 

+ 16 - 16
editor/js/Sidebar.Geometry.js

@@ -31,23 +31,23 @@ import { SidebarGeometryTorusKnotGeometry } from './Sidebar.Geometry.TorusKnotGe
 import { SidebarGeometryTubeGeometry } from './Sidebar.Geometry.TubeGeometry.js';
 
 var geometryUIClasses = {
-	'BoxGeometry': SidebarGeometryBoxGeometry,
-	'CircleGeometry': SidebarGeometryCircleGeometry,
-	'CylinderGeometry': SidebarGeometryCylinderGeometry,
-	'DodecahedronGeometry': SidebarGeometryDodecahedronGeometry,
-	'ExtrudeGeometry': SidebarGeometryExtrudeGeometry,
-	'IcosahedronGeometry': SidebarGeometryIcosahedronGeometry,
-	'LatheGeometry': SidebarGeometryLatheGeometry,
-	'OctahedronGeometry': SidebarGeometryOctahedronGeometry,
-	'PlaneGeometry': SidebarGeometryPlaneGeometry,
-	'RingGeometry': SidebarGeometryRingGeometry,
-	'ShapeGeometry': SidebarGeometryShapeGeometry,
-	'SphereGeometry': SidebarGeometrySphereGeometry,
+	'BoxBufferGeometry': SidebarGeometryBoxGeometry,
+	'CircleBufferGeometry': SidebarGeometryCircleGeometry,
+	'CylinderBufferGeometry': SidebarGeometryCylinderGeometry,
+	'DodecahedronBufferGeometry': SidebarGeometryDodecahedronGeometry,
+	'ExtrudeBufferGeometry': SidebarGeometryExtrudeGeometry,
+	'IcosahedronBufferGeometry': SidebarGeometryIcosahedronGeometry,
+	'LatheBufferGeometry': SidebarGeometryLatheGeometry,
+	'OctahedronBufferGeometry': SidebarGeometryOctahedronGeometry,
+	'PlaneBufferGeometry': SidebarGeometryPlaneGeometry,
+	'RingBufferGeometry': SidebarGeometryRingGeometry,
+	'ShapeBufferGeometry': SidebarGeometryShapeGeometry,
+	'SphereBufferGeometry': SidebarGeometrySphereGeometry,
 	'TeapotBufferGeometry': SidebarGeometryTeapotBufferGeometry,
-	'TetrahedronGeometry': SidebarGeometryTetrahedronGeometry,
-	'TorusGeometry': SidebarGeometryTorusGeometry,
-	'TorusKnotGeometry': SidebarGeometryTorusKnotGeometry,
-	'TubeGeometry': SidebarGeometryTubeGeometry
+	'TetrahedronBufferGeometry': SidebarGeometryTetrahedronGeometry,
+	'TorusBufferGeometry': SidebarGeometryTorusGeometry,
+	'TorusKnotBufferGeometry': SidebarGeometryTorusKnotGeometry,
+	'TubeBufferGeometry': SidebarGeometryTubeGeometry
 };
 
 var SidebarGeometry = function ( editor ) {

+ 30 - 28
editor/js/libs/ui.three.js

@@ -9,6 +9,10 @@ import { TGALoader } from '../../../examples/jsm/loaders/TGALoader.js';
 import { UIElement, UISpan, UIDiv, UIRow, UIButton, UICheckbox, UIText, UINumber } from './ui.js';
 import { MoveObjectCommand } from '../commands/MoveObjectCommand.js';
 
+/**
+ * @author mrdoob / http://mrdoob.com/
+ */
+
 var UITexture = function ( mapping ) {
 
 	UIElement.call( this );
@@ -39,7 +43,7 @@ var UITexture = function ( mapping ) {
 		input.click();
 
 	}, false );
-	canvas.addEventListener( 'drop', function ( event ) {
+	canvas.addEventListener( 'drop', function () {
 
 		event.preventDefault();
 		event.stopPropagation();
@@ -48,12 +52,6 @@ var UITexture = function ( mapping ) {
 	}, false );
 	dom.appendChild( canvas );
 
-	var name = document.createElement( 'input' );
-	name.disabled = true;
-	name.style.width = '64px';
-	name.style.border = '1px solid #ccc';
-	dom.appendChild( name );
-
 	function loadFile( file ) {
 
 		if ( file.type.match( 'image.*' ) ) {
@@ -129,7 +127,6 @@ UITexture.prototype.getValue = function () {
 UITexture.prototype.setValue = function ( texture ) {
 
 	var canvas = this.dom.children[ 0 ];
-	var name = this.dom.children[ 1 ];
 	var context = canvas.getContext( '2d' );
 
 	if ( texture !== null ) {
@@ -138,21 +135,21 @@ UITexture.prototype.setValue = function ( texture ) {
 
 		if ( image !== undefined && image.width > 0 ) {
 
-			name.value = texture.sourceFile;
+			canvas.title = texture.sourceFile;
 
 			var scale = canvas.width / image.width;
 			context.drawImage( image, 0, 0, image.width * scale, image.height * scale );
 
 		} else {
 
-			name.value = texture.sourceFile + ' (error)';
+			canvas.title = texture.sourceFile + ' (error)';
 			context.clearRect( 0, 0, canvas.width, canvas.height );
 
 		}
 
 	} else {
 
-		name.value = '';
+		canvas.title = 'empty';
 
 		if ( context !== null ) {
 
@@ -203,7 +200,6 @@ var UIOutliner = function ( editor ) {
 
 	// hack
 	this.scene = editor.scene;
-	this.editor = editor;
 
 	// Prevent native scroll behavior
 	dom.addEventListener( 'keydown', function ( event ) {
@@ -373,7 +369,7 @@ UIOutliner.prototype.setOptions = function ( options ) {
 
 		if ( newParentIsChild ) return;
 
-		scope.editor.execute( new MoveObjectCommand( scope.editor, object, newParent, nextObject ) );
+		editor.execute( new MoveObjectCommand( editor, object, newParent, nextObject ) );
 
 		var changeEvent = document.createEvent( 'HTMLEvents' );
 		changeEvent.initEvent( 'change', true, true );
@@ -423,16 +419,16 @@ UIOutliner.prototype.setValue = function ( value ) {
 
 	for ( var i = 0; i < this.options.length; i ++ ) {
 
-		var UIElement = this.options[ i ];
+		var element = this.options[ i ];
 
-		if ( UIElement.value === value ) {
+		if ( element.value === value ) {
 
-			UIElement.classList.add( 'active' );
+			element.classList.add( 'active' );
 
 			// scroll into view
 
-			var y = UIElement.offsetTop - this.dom.offsetTop;
-			var bottomY = y + UIElement.offsetHeight;
+			var y = element.offsetTop - this.dom.offsetTop;
+			var bottomY = y + element.offsetHeight;
 			var minScroll = bottomY - this.dom.offsetHeight;
 
 			if ( this.dom.scrollTop > y ) {
@@ -449,7 +445,7 @@ UIOutliner.prototype.setValue = function ( value ) {
 
 		} else {
 
-			UIElement.classList.remove( 'active' );
+			element.classList.remove( 'active' );
 
 		}
 
@@ -507,7 +503,7 @@ UIPoints.prototype.onChange = function ( callback ) {
 
 UIPoints.prototype.clear = function () {
 
-	for ( var i = 0; i < this.pointslength; ++ i ) {
+	for ( var i = 0; i < this.pointsUI.length; ++ i ) {
 
 		if ( this.pointsUI[ i ] ) {
 
@@ -549,13 +545,13 @@ UIPoints2.prototype.constructor = UIPoints2;
 
 UIPoints2.addRow = function () {
 
-	if ( this.pointslength === 0 ) {
+	if ( this.pointsUI.length === 0 ) {
 
 		this.pointsList.add( this.createPointRow( 0, 0 ) );
 
 	} else {
 
-		var point = this.pointsUI[ this.pointslength - 1 ];
+		var point = this.pointsUI[ this.pointsUI.length - 1 ];
 
 		this.pointsList.add( this.createPointRow( point.x.getValue(), point.y.getValue() ) );
 
@@ -568,14 +564,17 @@ UIPoints2.addRow = function () {
 UIPoints2.prototype.getValue = function () {
 
 	var points = [];
+	var count = 0;
 
-	for ( var i = 0; i < this.pointslength; i ++ ) {
+	for ( var i = 0; i < this.pointsUI.length; i ++ ) {
 
 		var pointUI = this.pointsUI[ i ];
 
 		if ( ! pointUI ) continue;
 
 		points.push( new THREE.Vector2( pointUI.x.getValue(), pointUI.y.getValue() ) );
+		++ count;
+		pointUI.lbl.setValue( count );
 
 	}
 
@@ -615,7 +614,7 @@ UIPoints2.prototype.createPointRow = function ( x, y ) {
 
 	} );
 
-	this.pointspush( { row: pointRow, lbl: lbl, x: txtX, y: txtY } );
+	this.pointsUI.push( { row: pointRow, lbl: lbl, x: txtX, y: txtY } );
 	++ this.lastPointIdx;
 	pointRow.add( lbl, txtX, txtY, btn );
 
@@ -636,13 +635,13 @@ UIPoints3.prototype.constructor = UIPoints3;
 
 UIPoints3.addRow = function () {
 
-	if ( this.pointslength === 0 ) {
+	if ( this.pointsUI.length === 0 ) {
 
 		this.pointsList.add( this.createPointRow( 0, 0, 0 ) );
 
 	} else {
 
-		var point = this.pointsUI[ this.pointslength - 1 ];
+		var point = this.pointsUI[ this.pointsUI.length - 1 ];
 
 		this.pointsList.add( this.createPointRow( point.x.getValue(), point.y.getValue(), point.z.getValue() ) );
 
@@ -655,14 +654,17 @@ UIPoints3.addRow = function () {
 UIPoints3.prototype.getValue = function () {
 
 	var points = [];
+	var count = 0;
 
-	for ( var i = 0; i < this.pointslength; i ++ ) {
+	for ( var i = 0; i < this.pointsUI.length; i ++ ) {
 
 		var pointUI = this.pointsUI[ i ];
 
 		if ( ! pointUI ) continue;
 
 		points.push( new THREE.Vector3( pointUI.x.getValue(), pointUI.y.getValue(), pointUI.z.getValue() ) );
+		++ count;
+		pointUI.lbl.setValue( count );
 
 	}
 
@@ -703,7 +705,7 @@ UIPoints3.prototype.createPointRow = function ( x, y, z ) {
 
 	} );
 
-	this.pointspush( { row: pointRow, lbl: lbl, x: txtX, y: txtY, z: txtZ } );
+	this.pointsUI.push( { row: pointRow, lbl: lbl, x: txtX, y: txtY, z: txtZ } );
 	++ this.lastPointIdx;
 	pointRow.add( lbl, txtX, txtY, txtZ, btn );
 

+ 1 - 1
editor/sw.js

@@ -1,4 +1,4 @@
-// r111
+// r112
 
 const assets = [
 	'./',

+ 2 - 2
examples/files.js

@@ -131,7 +131,6 @@ var files = {
 		"webgl_materials_blending",
 		"webgl_materials_blending_custom",
 		"webgl_materials_bumpmap",
-		"webgl_materials_bumpmap_skin",
 		"webgl_materials_car",
 		"webgl_materials_channels",
 		"webgl_materials_cubemap",
@@ -157,7 +156,6 @@ var files = {
 		"webgl_materials_physical_transparency",
 		"webgl_materials_reflectivity",
 		"webgl_materials_shaders_fresnel",
-		"webgl_materials_skin",
 		"webgl_materials_standard",
 		"webgl_materials_texture_anisotropy",
 		"webgl_materials_texture_canvas",
@@ -321,6 +319,8 @@ var files = {
 		"webaudio_visualizer"
 	],
 	"webxr": [
+		"webxr_ar_cones",
+		"webxr_ar_hittest",
 		"webxr_ar_paint",
 		"webxr_vr_ballshooter",
 		"webxr_vr_cubes",

+ 1 - 0
examples/js/controls/TransformControls.js

@@ -14,6 +14,7 @@ THREE.TransformControls = function ( camera, domElement ) {
 	THREE.Object3D.call( this );
 
 	this.visible = false;
+	this.domElement = domElement;
 
 	var _gizmo = new THREE.TransformControlsGizmo();
 	this.add( _gizmo );

+ 2 - 6
examples/js/exporters/GLTFExporter.js

@@ -1019,11 +1019,7 @@ THREE.GLTFExporter.prototype = {
 
 			}
 
-			if ( material.isMeshBasicMaterial ||
-				material.isLineBasicMaterial ||
-				material.isPointsMaterial ) {
-
-			} else {
+			if ( material.emissive ) {
 
 				// emissiveFactor
 				var emissive = material.emissive.clone().multiplyScalar( material.emissiveIntensity ).toArray();
@@ -1335,7 +1331,7 @@ THREE.GLTFExporter.prototype = {
 									attribute.getX( j ) - baseAttribute.getX( j ),
 									attribute.getY( j ) - baseAttribute.getY( j ),
 									attribute.getZ( j ) - baseAttribute.getZ( j )
-									);
+								);
 
 							}
 

+ 3 - 3
examples/js/lines/LineSegments2.js

@@ -155,7 +155,7 @@ THREE.LineSegments2.prototype = Object.assign( Object.create( THREE.Mesh.prototy
 
 				// check if the intersection point is within clip space
 				var zPos = THREE.Math.lerp( start.z, end.z, param );
-				var isInClipSpace = zPos >= -1 && zPos <= 1;
+				var isInClipSpace = zPos >= - 1 && zPos <= 1;
 
 				var isInside = ssOrigin3.distanceTo( closestPoint ) < lineWidth * 0.5;
 
@@ -190,8 +190,8 @@ THREE.LineSegments2.prototype = Object.assign( Object.create( THREE.Mesh.prototy
 
 			}
 
-		}
+		};
 
-	} () )
+	}() )
 
 } );

+ 1 - 1
examples/js/modifiers/SubdivisionModifier.js

@@ -169,7 +169,7 @@ THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
 		oldFaces = geometry.faces; // { a: oldVertex1, b: oldVertex2, c: oldVertex3 }
 		oldUvs = geometry.faceVertexUvs;
 
-		var hasUvs = oldUvs !== undefined && oldUvs.length > 0;
+		var hasUvs = oldUvs[ 0 ] !== undefined && oldUvs[ 0 ].length > 0;
 
 		if ( hasUvs ) {
 

+ 12 - 2
examples/js/postprocessing/CubeTexturePass.js

@@ -23,6 +23,16 @@ THREE.CubeTexturePass = function ( camera, envMap, opacity ) {
 		} )
 	);
 
+	Object.defineProperty( this.cubeMesh.material, 'envMap', {
+
+		get: function () {
+
+			return this.uniforms.envMap.value;
+
+		}
+
+	} );
+
 	this.envMap = envMap;
 	this.opacity = ( opacity !== undefined ) ? opacity : 1.0;
 
@@ -44,8 +54,8 @@ THREE.CubeTexturePass.prototype = Object.assign( Object.create( THREE.Pass.proto
 		this.cubeCamera.projectionMatrix.copy( this.camera.projectionMatrix );
 		this.cubeCamera.quaternion.setFromRotationMatrix( this.camera.matrixWorld );
 
-		this.cubeMesh.material.envMap = this.envMap;
-		this.cubeMesh.material.opacity = this.opacity;
+		this.cubeMesh.material.uniforms.envMap.value = this.envMap;
+		this.cubeMesh.material.uniforms.opacity.value = this.opacity;
 		this.cubeMesh.material.transparent = ( this.opacity < 1.0 );
 
 		renderer.setRenderTarget( this.renderToScreen ? null : readBuffer );

+ 0 - 686
examples/js/shaders/SkinShader.js

@@ -1,686 +0,0 @@
-/**
- * @author alteredq / http://alteredqualia.com/
- *
- */
-
-/* ------------------------------------------------------------------------------------------
-//	Basic skin shader
-//		- per-pixel Blinn-Phong diffuse term mixed with half-Lambert wrap-around term (per color component)
-//		- physically based specular term (Kelemen/Szirmay-Kalos specular reflectance)
-//
-//		- diffuse map
-//		- bump map
-//		- specular map
-//		- point, directional and hemisphere lights (use with "lights: true" material option)
-//		- fog (use with "fog: true" material option)
-//
-// ------------------------------------------------------------------------------------------ */
-
-THREE.SkinShaderBasic = {
-
-	uniforms: THREE.UniformsUtils.merge( [
-
-		THREE.UniformsLib[ "fog" ],
-		THREE.UniformsLib[ "lights" ],
-
-		{
-
-			"enableBump": { value: 0 },
-			"enableSpecular": { value: 0 },
-
-			"tDiffuse": { value: null },
-			"tBeckmann": { value: null },
-
-			"diffuse": { value: new THREE.Color( 0xeeeeee ) },
-			"specular": { value: new THREE.Color( 0x111111 ) },
-			"opacity": { value: 1 },
-
-			"uRoughness": { value: 0.15 },
-			"uSpecularBrightness": { value: 0.75 },
-
-			"bumpMap": { value: null },
-			"bumpScale": { value: 1 },
-
-			"specularMap": { value: null },
-
-			"offsetRepeat": { value: new THREE.Vector4( 0, 0, 1, 1 ) },
-
-			"uWrapRGB": { value: new THREE.Vector3( 0.75, 0.375, 0.1875 ) }
-
-		}
-
-	] ),
-
-	vertexShader: [
-
-		"uniform vec4 offsetRepeat;",
-
-		"varying vec3 vNormal;",
-		"varying vec2 vUv;",
-
-		"varying vec3 vViewPosition;",
-
-		THREE.ShaderChunk[ "common" ],
-		THREE.ShaderChunk[ "lights_pars_begin" ],
-		THREE.ShaderChunk[ "fog_pars_vertex" ],
-
-		"void main() {",
-
-		"	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
-		"	vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
-
-		"	vViewPosition = -mvPosition.xyz;",
-
-		"	vNormal = normalize( normalMatrix * normal );",
-
-		"	vUv = uv * offsetRepeat.zw + offsetRepeat.xy;",
-
-		"	gl_Position = projectionMatrix * mvPosition;",
-
-		THREE.ShaderChunk[ "fog_vertex" ],
-
-		"}"
-
-	].join( "\n" ),
-
-	fragmentShader: [
-
-		"#define USE_BUMPMAP",
-
-		"uniform bool enableBump;",
-		"uniform bool enableSpecular;",
-
-		"uniform vec3 diffuse;",
-		"uniform vec3 specular;",
-		"uniform float opacity;",
-
-		"uniform float uRoughness;",
-		"uniform float uSpecularBrightness;",
-
-		"uniform vec3 uWrapRGB;",
-
-		"uniform sampler2D tDiffuse;",
-		"uniform sampler2D tBeckmann;",
-
-		"uniform sampler2D specularMap;",
-
-		"varying vec3 vNormal;",
-		"varying vec2 vUv;",
-
-		"varying vec3 vViewPosition;",
-
-		THREE.ShaderChunk[ "common" ],
-		THREE.ShaderChunk[ "bsdfs" ],
-		THREE.ShaderChunk[ "packing" ],
-		THREE.ShaderChunk[ "lights_pars_begin" ],
-		THREE.ShaderChunk[ "fog_pars_fragment" ],
-		THREE.ShaderChunk[ "bumpmap_pars_fragment" ],
-
-		// Fresnel term
-
-		"float fresnelReflectance( vec3 H, vec3 V, float F0 ) {",
-
-		"	float base = 1.0 - dot( V, H );",
-		"	float exponential = pow( base, 5.0 );",
-
-		"	return exponential + F0 * ( 1.0 - exponential );",
-
-		"}",
-
-		// Kelemen/Szirmay-Kalos specular BRDF
-
-		"float KS_Skin_Specular( vec3 N,", // Bumped surface normal
-		"	vec3 L,", // Points to light
-		"	vec3 V,", // Points to eye
-		"	float m,", // Roughness
-		"	float rho_s", // Specular brightness
-		"	) {",
-
-		"	float result = 0.0;",
-		"	float ndotl = dot( N, L );",
-
-		"	if( ndotl > 0.0 ) {",
-
-		"		vec3 h = L + V;", // Unnormalized half-way vector
-		"		vec3 H = normalize( h );",
-
-		"		float ndoth = dot( N, H );",
-
-		"		float PH = pow( 2.0 * texture2D( tBeckmann, vec2( ndoth, m ) ).x, 10.0 );",
-
-		"		float F = fresnelReflectance( H, V, 0.028 );",
-		"		float frSpec = max( PH * F / dot( h, h ), 0.0 );",
-
-		"		result = ndotl * rho_s * frSpec;", // BRDF * dot(N,L) * rho_s
-
-		"	}",
-
-		"	return result;",
-
-		"}",
-
-		"void main() {",
-
-		"	vec3 outgoingLight = vec3( 0.0 );",	// outgoing light does not have an alpha, the surface does
-		"	vec4 diffuseColor = vec4( diffuse, opacity );",
-
-		"	vec4 colDiffuse = texture2D( tDiffuse, vUv );",
-		"	colDiffuse.rgb *= colDiffuse.rgb;",
-
-		"	diffuseColor = diffuseColor * colDiffuse;",
-
-		"	vec3 normal = normalize( vNormal );",
-		"	vec3 viewerDirection = normalize( vViewPosition );",
-
-		"	float specularStrength;",
-
-		"	if ( enableSpecular ) {",
-
-		"		vec4 texelSpecular = texture2D( specularMap, vUv );",
-		"		specularStrength = texelSpecular.r;",
-
-		"	} else {",
-
-		"		specularStrength = 1.0;",
-
-		"	}",
-
-		"	#ifdef USE_BUMPMAP",
-
-		"		if ( enableBump ) normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );",
-
-		"	#endif",
-
-		// point lights
-
-		"	vec3 totalSpecularLight = vec3( 0.0 );",
-		"	vec3 totalDiffuseLight = vec3( 0.0 );",
-
-		"	#if NUM_POINT_LIGHTS > 0",
-
-		"		for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {",
-
-		"			vec3 lVector = pointLights[ i ].position + vViewPosition.xyz;",
-
-		"			float attenuation = calcLightAttenuation( length( lVector ), pointLights[ i ].distance, pointLights[ i ].decay );",
-
-		"			lVector = normalize( lVector );",
-
-		"			float pointDiffuseWeightFull = max( dot( normal, lVector ), 0.0 );",
-		"			float pointDiffuseWeightHalf = max( 0.5 * dot( normal, lVector ) + 0.5, 0.0 );",
-		"			vec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), uWrapRGB );",
-
-		"			float pointSpecularWeight = KS_Skin_Specular( normal, lVector, viewerDirection, uRoughness, uSpecularBrightness );",
-
-		"			totalDiffuseLight += pointLight[ i ].color * ( pointDiffuseWeight * attenuation );",
-		"			totalSpecularLight += pointLight[ i ].color * specular * ( pointSpecularWeight * specularStrength * attenuation );",
-
-		"		}",
-
-		"	#endif",
-
-		// directional lights
-
-		"	#if NUM_DIR_LIGHTS > 0",
-
-		"		for( int i = 0; i < NUM_DIR_LIGHTS; i++ ) {",
-
-		"			vec3 dirVector = directionalLights[ i ].direction;",
-
-		"			float dirDiffuseWeightFull = max( dot( normal, dirVector ), 0.0 );",
-		"			float dirDiffuseWeightHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );",
-		"			vec3 dirDiffuseWeight = mix( vec3 ( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), uWrapRGB );",
-
-		"			float dirSpecularWeight = KS_Skin_Specular( normal, dirVector, viewerDirection, uRoughness, uSpecularBrightness );",
-
-		"			totalDiffuseLight += directionalLights[ i ].color * dirDiffuseWeight;",
-		"			totalSpecularLight += directionalLights[ i ].color * ( dirSpecularWeight * specularStrength );",
-
-		"		}",
-
-		"	#endif",
-
-		// hemisphere lights
-
-		"	#if NUM_HEMI_LIGHTS > 0",
-
-		"		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {",
-
-		"			vec3 lVector = hemisphereLightDirection[ i ];",
-
-		"			float dotProduct = dot( normal, lVector );",
-		"			float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;",
-
-		"			totalDiffuseLight += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );",
-
-		// specular (sky light)
-
-		"			float hemiSpecularWeight = 0.0;",
-		"			hemiSpecularWeight += KS_Skin_Specular( normal, lVector, viewerDirection, uRoughness, uSpecularBrightness );",
-
-		// specular (ground light)
-
-		"			vec3 lVectorGround = -lVector;",
-		"			hemiSpecularWeight += KS_Skin_Specular( normal, lVectorGround, viewerDirection, uRoughness, uSpecularBrightness );",
-
-		"			vec3 hemiSpecularColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );",
-
-		"			totalSpecularLight += hemiSpecularColor * specular * ( hemiSpecularWeight * specularStrength );",
-
-		"		}",
-
-		"	#endif",
-
-		"	outgoingLight += diffuseColor.xyz * ( totalDiffuseLight + ambientLightColor * diffuse ) + totalSpecularLight;",
-
-		"	gl_FragColor = linearToOutputTexel( vec4( outgoingLight, diffuseColor.a ) );",	// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
-
-		THREE.ShaderChunk[ "fog_fragment" ],
-
-		"}"
-
-	].join( "\n" )
-
-};
-
-/* ------------------------------------------------------------------------------------------
-//	Skin shader
-//		- Blinn-Phong diffuse term (using normal + diffuse maps)
-//		- subsurface scattering approximation by four blur layers
-//		- physically based specular term (Kelemen/Szirmay-Kalos specular reflectance)
-//
-//		- point and directional lights (use with "lights: true" material option)
-//
-//		- based on Nvidia Advanced Skin Rendering GDC 2007 presentation
-//		  and GPU Gems 3 Chapter 14. Advanced Techniques for Realistic Real-Time Skin Rendering
-//
-//			http://developer.download.nvidia.com/presentations/2007/gdc/Advanced_Skin.pdf
-//			http://http.developer.nvidia.com/GPUGems3/gpugems3_ch14.html
-// ------------------------------------------------------------------------------------------ */
-
-THREE.SkinShaderAdvanced = {
-
-	uniforms: THREE.UniformsUtils.merge( [
-
-		THREE.UniformsLib[ "fog" ],
-		THREE.UniformsLib[ "lights" ],
-
-		{
-			"passID": { value: 0 },
-
-			"tDiffuse": { value: null },
-			"tNormal": { value: null },
-
-			"tBlur1": { value: null },
-			"tBlur2": { value: null },
-			"tBlur3": { value: null },
-			"tBlur4": { value: null },
-
-			"tBeckmann": { value: null },
-
-			"uNormalScale": { value: 1.0 },
-
-			"diffuse": { value: new THREE.Color( 0xeeeeee ) },
-			"specular": { value: new THREE.Color( 0x111111 ) },
-			"opacity": { value: 1 },
-
-			"uRoughness": { value: 0.15 },
-			"uSpecularBrightness": { value: 0.75 }
-
-		}
-
-	] ),
-
-	vertexShader: [
-
-		"#ifdef VERTEX_TEXTURES",
-
-		"	uniform sampler2D tDisplacement;",
-		"	uniform float uDisplacementScale;",
-		"	uniform float uDisplacementBias;",
-
-		"#endif",
-
-		"varying vec3 vNormal;",
-		"varying vec2 vUv;",
-
-		"varying vec3 vViewPosition;",
-
-		THREE.ShaderChunk[ "common" ],
-		THREE.ShaderChunk[ "fog_pars_vertex" ],
-
-		"void main() {",
-
-		"	vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
-
-		"	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
-
-		"	vViewPosition = -mvPosition.xyz;",
-
-		"	vNormal = normalize( normalMatrix * normal );",
-
-		"	vUv = uv;",
-
-		// displacement mapping
-
-		"	#ifdef VERTEX_TEXTURES",
-
-		"		vec3 dv = texture2D( tDisplacement, uv ).xyz;",
-		"		float df = uDisplacementScale * dv.x + uDisplacementBias;",
-		"		vec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;",
-		"		gl_Position = projectionMatrix * displacedPosition;",
-
-		"		#else",
-
-		"		gl_Position = projectionMatrix * mvPosition;",
-
-		"	#endif",
-
-		THREE.ShaderChunk[ "fog_vertex" ],
-
-		"}",
-
-
-	].join( "\n" ),
-
-	vertexShaderUV: [
-
-		"varying vec3 vNormal;",
-		"varying vec2 vUv;",
-
-		"varying vec3 vViewPosition;",
-
-		THREE.ShaderChunk[ "common" ],
-
-		"void main() {",
-
-		"	vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
-
-		"	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
-
-		"	vViewPosition = -mvPosition.xyz;",
-
-		"	vNormal = normalize( normalMatrix * normal );",
-
-		"	vUv = uv;",
-
-		"	gl_Position = vec4( uv.x * 2.0 - 1.0, uv.y * 2.0 - 1.0, 0.0, 1.0 );",
-
-		"}"
-
-	].join( "\n" ),
-
-	fragmentShader: [
-
-		"uniform vec3 diffuse;",
-		"uniform vec3 specular;",
-		"uniform float opacity;",
-
-		"uniform float uRoughness;",
-		"uniform float uSpecularBrightness;",
-
-		"uniform int passID;",
-
-		"uniform sampler2D tDiffuse;",
-		"uniform sampler2D tNormal;",
-
-		"uniform sampler2D tBlur1;",
-		"uniform sampler2D tBlur2;",
-		"uniform sampler2D tBlur3;",
-		"uniform sampler2D tBlur4;",
-
-		"uniform sampler2D tBeckmann;",
-
-		"uniform float uNormalScale;",
-
-		"varying vec3 vNormal;",
-		"varying vec2 vUv;",
-
-		"varying vec3 vViewPosition;",
-
-		THREE.ShaderChunk[ "common" ],
-		THREE.ShaderChunk[ "lights_pars_begin" ],
-		THREE.ShaderChunk[ "fog_pars_fragment" ],
-
-		"float fresnelReflectance( vec3 H, vec3 V, float F0 ) {",
-
-		"	float base = 1.0 - dot( V, H );",
-		"	float exponential = pow( base, 5.0 );",
-
-		"	return exponential + F0 * ( 1.0 - exponential );",
-
-		"}",
-
-		// Kelemen/Szirmay-Kalos specular BRDF
-
-		"float KS_Skin_Specular( vec3 N,", // Bumped surface normal
-		"	vec3 L,", // Points to light
-		"	vec3 V,", // Points to eye
-		"	float m,", // Roughness
-		"	float rho_s", // Specular brightness
-		"	) {",
-
-		"	float result = 0.0;",
-		"	float ndotl = dot( N, L );",
-
-		"	if( ndotl > 0.0 ) {",
-
-		"		vec3 h = L + V;", // Unnormalized half-way vector
-		"		vec3 H = normalize( h );",
-
-		"		float ndoth = dot( N, H );",
-
-		"		float PH = pow( 2.0 * texture2D( tBeckmann, vec2( ndoth, m ) ).x, 10.0 );",
-		"		float F = fresnelReflectance( H, V, 0.028 );",
-		"		float frSpec = max( PH * F / dot( h, h ), 0.0 );",
-
-		"		result = ndotl * rho_s * frSpec;", // BRDF * dot(N,L) * rho_s
-
-		"	}",
-
-		"	return result;",
-
-		"}",
-
-		"void main() {",
-
-		"	vec3 outgoingLight = vec3( 0.0 );",	// outgoing light does not have an alpha, the surface does
-		"	vec4 diffuseColor = vec4( diffuse, opacity );",
-
-		"	vec4 mSpecular = vec4( specular, opacity );",
-
-		"	vec4 colDiffuse = texture2D( tDiffuse, vUv );",
-		"	colDiffuse *= colDiffuse;",
-
-		"	diffuseColor *= colDiffuse;",
-
-		// normal mapping
-
-		"	vec4 posAndU = vec4( -vViewPosition, vUv.x );",
-		"	vec4 posAndU_dx = dFdx( posAndU ),  posAndU_dy = dFdy( posAndU );",
-		"	vec3 tangent = posAndU_dx.w * posAndU_dx.xyz + posAndU_dy.w * posAndU_dy.xyz;",
-		"	vec3 normal = normalize( vNormal );",
-		"	vec3 binormal = normalize( cross( tangent, normal ) );",
-		"	tangent = cross( normal, binormal );",	// no normalization required
-		"	mat3 tsb = mat3( tangent, binormal, normal );",
-
-		"	vec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;",
-		"	normalTex.xy *= uNormalScale;",
-		"	normalTex = normalize( normalTex );",
-
-		"	vec3 finalNormal = tsb * normalTex;",
-		"	normal = normalize( finalNormal );",
-
-		"	vec3 viewerDirection = normalize( vViewPosition );",
-
-		// point lights
-
-		"	vec3 totalDiffuseLight = vec3( 0.0 );",
-		"	vec3 totalSpecularLight = vec3( 0.0 );",
-
-		"	#if NUM_POINT_LIGHTS > 0",
-
-		"	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {",
-
-		"		vec3 pointVector = normalize( pointLights[ i ].direction );",
-		"		float attenuation = calcLightAttenuation( length( lVector ), pointLights[ i ].distance, pointLights[ i ].decay );",
-
-		"		float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );",
-
-		"		totalDiffuseLight += pointLightColor[ i ] * ( pointDiffuseWeight * attenuation );",
-
-		"		if ( passID == 1 ) {",
-
-		"			float pointSpecularWeight = KS_Skin_Specular( normal, pointVector, viewerDirection, uRoughness, uSpecularBrightness );",
-
-		"			totalSpecularLight += pointLightColor[ i ] * mSpecular.xyz * ( pointSpecularWeight * attenuation );",
-
-		"		}",
-
-		"	}",
-
-		"	#endif",
-
-		// directional lights
-
-		"	#if NUM_DIR_LIGHTS > 0",
-
-		"		for( int i = 0; i < NUM_DIR_LIGHTS; i++ ) {",
-
-		"			vec3 dirVector = directionalLights[ i ].direction;",
-
-		"			float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );",
-
-
-		"			totalDiffuseLight += directionalLights[ i ].color * dirDiffuseWeight;",
-
-		"			if ( passID == 1 ) {",
-
-		"				float dirSpecularWeight = KS_Skin_Specular( normal, dirVector, viewerDirection, uRoughness, uSpecularBrightness );",
-
-		"				totalSpecularLight += directionalLights[ i ].color * mSpecular.xyz * dirSpecularWeight;",
-
-		"			}",
-
-		"		}",
-
-		"	#endif",
-
-		"	outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalSpecularLight );",
-
-		"	if ( passID == 0 ) {",
-
-		"		outgoingLight = sqrt( outgoingLight );",
-
-		"	} else if ( passID == 1 ) {",
-
-		//"#define VERSION1",
-
-		"	#ifdef VERSION1",
-
-		"		vec3 nonblurColor = sqrt(outgoingLight );",
-
-		"	#else",
-
-		"		vec3 nonblurColor = outgoingLight;",
-
-		"	#endif",
-
-		"	vec3 blur1Color = texture2D( tBlur1, vUv ).xyz;",
-		"	vec3 blur2Color = texture2D( tBlur2, vUv ).xyz;",
-		"	vec3 blur3Color = texture2D( tBlur3, vUv ).xyz;",
-		"	vec3 blur4Color = texture2D( tBlur4, vUv ).xyz;",
-
-
-		//"gl_FragColor = vec4( blur1Color, gl_FragColor.w );",
-
-		//"gl_FragColor = vec4( vec3( 0.22, 0.5, 0.7 ) * nonblurColor + vec3( 0.2, 0.5, 0.3 ) * blur1Color + vec3( 0.58, 0.0, 0.0 ) * blur2Color, gl_FragColor.w );",
-
-		//"gl_FragColor = vec4( vec3( 0.25, 0.6, 0.8 ) * nonblurColor + vec3( 0.15, 0.25, 0.2 ) * blur1Color + vec3( 0.15, 0.15, 0.0 ) * blur2Color + vec3( 0.45, 0.0, 0.0 ) * blur3Color, gl_FragColor.w );",
-
-		"	outgoingLight = vec3( vec3( 0.22,  0.437, 0.635 ) * nonblurColor + ",
-		"		vec3( 0.101, 0.355, 0.365 ) * blur1Color + ",
-		"		vec3( 0.119, 0.208, 0.0 )   * blur2Color + ",
-		"		vec3( 0.114, 0.0,   0.0 )   * blur3Color + ",
-		"		vec3( 0.444, 0.0,   0.0 )   * blur4Color );",
-
-		"	outgoingLight *= sqrt( colDiffuse.xyz );",
-
-		"	outgoingLight += ambientLightColor * diffuse * colDiffuse.xyz + totalSpecularLight;",
-
-		"		#ifndef VERSION1",
-
-		"			outgoingLight = sqrt( outgoingLight );",
-
-		"		#endif",
-
-		"	}",
-
-		"	gl_FragColor = vec4( outgoingLight, diffuseColor.a );",	// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
-
-		THREE.ShaderChunk[ "fog_fragment" ],
-
-		"}"
-
-	].join( "\n" )
-
-};
-
-/* ------------------------------------------------------------------------------------------
-// Beckmann distribution function
-//	- to be used in specular term of skin shader
-//	- render a screen-aligned quad to precompute a 512 x 512 texture
-//
-//		- from http://developer.nvidia.com/node/171
- ------------------------------------------------------------------------------------------ */
-
-THREE.SkinShaderBeckmann = {
-
-	uniforms: {},
-
-	vertexShader: [
-
-		"varying vec2 vUv;",
-
-		"void main() {",
-
-		"	vUv = uv;",
-		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-		"}"
-
-	].join( "\n" ),
-
-	fragmentShader: [
-
-		"varying vec2 vUv;",
-
-		"float PHBeckmann( float ndoth, float m ) {",
-
-		"	float alpha = acos( ndoth );",
-		"	float ta = tan( alpha );",
-
-		"	float val = 1.0 / ( m * m * pow( ndoth, 4.0 ) ) * exp( -( ta * ta ) / ( m * m ) );",
-		"	return val;",
-
-		"}",
-
-		"float KSTextureCompute( vec2 tex ) {",
-
-		// Scale the value to fit within [0,1]  invert upon lookup.
-
-		"	return 0.5 * pow( PHBeckmann( tex.x, tex.y ), 0.1 );",
-
-		"}",
-
-		"void main() {",
-
-		"	float x = KSTextureCompute( vUv );",
-
-		"	gl_FragColor = vec4( x, x, x, 1.0 );",
-
-		"}"
-
-	].join( "\n" )
-
-};

+ 1 - 3
examples/jsm/animation/TimelinerController.d.ts

@@ -1,7 +1,5 @@
 import {
-	AnimationClip,
-	Scene,
-	Vector3
+	Scene
 } from '../../../src/Three';
 
 export class TimelinerController {

+ 1 - 1
examples/jsm/controls/OrbitControls.d.ts

@@ -1,4 +1,4 @@
-import { Camera, MOUSE, Object3D, TOUCH, Vector3 } from '../../../src/Three';
+import { Camera, MOUSE, TOUCH, Vector3 } from '../../../src/Three';
 
 export class OrbitControls {
 

+ 0 - 2
examples/jsm/controls/TransformControls.d.ts

@@ -1,8 +1,6 @@
 import {
 	Object3D,
 	Camera,
-	Vector3,
-	Euler,
 	MOUSE
 } from '../../../src/Three';
 

+ 2 - 6
examples/jsm/exporters/GLTFExporter.js

@@ -1041,11 +1041,7 @@ GLTFExporter.prototype = {
 
 			}
 
-			if ( material.isMeshBasicMaterial ||
-				material.isLineBasicMaterial ||
-				material.isPointsMaterial ) {
-
-			} else {
+			if ( material.emissive ) {
 
 				// emissiveFactor
 				var emissive = material.emissive.clone().multiplyScalar( material.emissiveIntensity ).toArray();
@@ -1357,7 +1353,7 @@ GLTFExporter.prototype = {
 									attribute.getX( j ) - baseAttribute.getX( j ),
 									attribute.getY( j ) - baseAttribute.getY( j ),
 									attribute.getZ( j ) - baseAttribute.getZ( j )
-									);
+								);
 
 							}
 

+ 2 - 2
examples/jsm/lights/LightProbeGenerator.d.ts

@@ -7,7 +7,7 @@ import {
 
 export namespace LightProbeGenerator {
 
-	export function fromCubeTexture(cubeTexture: CubeTexture): LightProbe;
-	export function fromRenderTargetCube(renderer: WebGLRenderer, renderTargetCube: WebGLRenderTargetCube): LightProbe;
+	export function fromCubeTexture( cubeTexture: CubeTexture ): LightProbe;
+	export function fromRenderTargetCube( renderer: WebGLRenderer, renderTargetCube: WebGLRenderTargetCube ): LightProbe;
 
 }

+ 3 - 3
examples/jsm/lines/LineSegments2.js

@@ -168,7 +168,7 @@ LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), {
 
 				// check if the intersection point is within clip space
 				var zPos = _Math.lerp( start.z, end.z, param );
-				var isInClipSpace = zPos >= -1 && zPos <= 1;
+				var isInClipSpace = zPos >= - 1 && zPos <= 1;
 
 				var isInside = ssOrigin3.distanceTo( closestPoint ) < lineWidth * 0.5;
 
@@ -203,9 +203,9 @@ LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), {
 
 			}
 
-		}
+		};
 
-	} () )
+	}() )
 
 } );
 

+ 2 - 2
examples/jsm/loaders/GLTFLoader.d.ts

@@ -43,7 +43,7 @@ export class GLTFParser {
 
 	json: any;
 
-	getDependency: (type: string, index: number) => Promise<any>;
-	getDependencies: (type: string) => Promise<any[]>;
+	getDependency: ( type: string, index: number ) => Promise<any>;
+	getDependencies: ( type: string ) => Promise<any[]>;
 
 }

+ 1 - 3
examples/jsm/loaders/NRRDLoader.d.ts

@@ -1,7 +1,5 @@
 import {
-	Material,
-	LoadingManager,
-	Group
+	LoadingManager
 } from '../../../src/Three';
 
 import {

+ 0 - 1
examples/jsm/loaders/OBJLoader.d.ts

@@ -1,5 +1,4 @@
 import {
-	Material,
 	Loader,
 	LoadingManager,
 	Group

+ 0 - 1
examples/jsm/loaders/TTFLoader.d.ts

@@ -1,5 +1,4 @@
 import {
-	BufferGeometry,
 	Loader,
 	LoadingManager
 } from '../../../src/Three';

+ 1 - 1
examples/jsm/loaders/obj2/worker/parallel/WorkerRunner.d.ts

@@ -1,6 +1,6 @@
 export namespace ObjectManipulator {
 
-	export function applyProperties(objToAlter: object, params: object, forceCreation: boolean): void;
+	export function applyProperties( objToAlter: object, params: object, forceCreation: boolean ): void;
 
 }
 

+ 9 - 9
examples/jsm/loaders/obj2/worker/parallel/WorkerRunner.js

@@ -11,24 +11,24 @@ const ObjectManipulator = {
 	 * @param {Object} objToAlter The objToAlter instance
 	 * @param {Object} params The parameter object
 	 */
-	applyProperties: function (objToAlter, params, forceCreation) {
+	applyProperties: function ( objToAlter, params, forceCreation ) {
 
 		// fast-fail
-		if (objToAlter === undefined || objToAlter === null || params === undefined || params === null) return;
+		if ( objToAlter === undefined || objToAlter === null || params === undefined || params === null ) return;
 
 		let property, funcName, values;
-		for (property in params) {
+		for ( property in params ) {
 
-			funcName = 'set' + property.substring(0, 1).toLocaleUpperCase() + property.substring(1);
-			values = params[property];
+			funcName = 'set' + property.substring( 0, 1 ).toLocaleUpperCase() + property.substring( 1 );
+			values = params[ property ];
 
-			if (typeof objToAlter[funcName] === 'function') {
+			if ( typeof objToAlter[ funcName ] === 'function' ) {
 
-				objToAlter[funcName](values);
+				objToAlter[ funcName ]( values );
 
-			} else if (objToAlter.hasOwnProperty(property) || forceCreation) {
+			} else if ( objToAlter.hasOwnProperty( property ) || forceCreation ) {
 
-				objToAlter[property] = values;
+				objToAlter[ property ] = values;
 
 			}
 

+ 3 - 3
examples/jsm/math/MeshSurfaceSampler.js

@@ -20,7 +20,7 @@ var MeshSurfaceSampler = ( function () {
 
 	var _face = new Triangle();
 
-	function MeshSurfaceSampler ( mesh ) {
+	function MeshSurfaceSampler( mesh ) {
 
 		var geometry = mesh.geometry;
 
@@ -45,7 +45,7 @@ var MeshSurfaceSampler = ( function () {
 
 		this.distribution = null;
 
-	};
+	}
 
 	MeshSurfaceSampler.prototype = {
 
@@ -124,7 +124,7 @@ var MeshSurfaceSampler = ( function () {
 			var start = 0;
 			var end = dist.length - 1;
 
-			var index = -1;
+			var index = - 1;
 
 			while ( start <= end ) {
 

+ 1 - 1
examples/jsm/misc/MorphAnimMesh.d.ts

@@ -1,4 +1,4 @@
-import { AnimationAction } from '../../../src/animation/AnimationAction'
+import { AnimationAction } from '../../../src/animation/AnimationAction';
 import {
 	AnimationMixer,
 	BufferGeometry,

+ 1 - 1
examples/jsm/modifiers/SubdivisionModifier.js

@@ -176,7 +176,7 @@ SubdivisionModifier.prototype.modify = function ( geometry ) {
 		oldFaces = geometry.faces; // { a: oldVertex1, b: oldVertex2, c: oldVertex3 }
 		oldUvs = geometry.faceVertexUvs;
 
-		var hasUvs = oldUvs !== undefined && oldUvs.length > 0;
+		var hasUvs = oldUvs[ 0 ] !== undefined && oldUvs[ 0 ].length > 0;
 
 		if ( hasUvs ) {
 

+ 0 - 1
examples/jsm/nodes/accessors/CameraNode.d.ts

@@ -1,6 +1,5 @@
 import { Camera } from '../../../../src/Three';
 
-import { NodeBuilder } from '../core/NodeBuilder';
 import { NodeFrame } from '../core/NodeFrame';
 import { TempNode } from '../core/TempNode';
 import { FunctionNode } from '../core/FunctionNode';

+ 0 - 1
examples/jsm/nodes/accessors/ColorsNode.d.ts

@@ -1,4 +1,3 @@
-import { NodeBuilder } from '../core/NodeBuilder';
 import { TempNode } from '../core/TempNode';
 
 export class ColorsNode extends TempNode {

+ 0 - 1
examples/jsm/nodes/accessors/LightNode.d.ts

@@ -1,4 +1,3 @@
-import { NodeBuilder } from '../core/NodeBuilder';
 import { TempNode } from '../core/TempNode';
 
 export class LightNode extends TempNode {

+ 0 - 1
examples/jsm/nodes/accessors/NormalNode.d.ts

@@ -1,4 +1,3 @@
-import { NodeBuilder } from '../core/NodeBuilder';
 import { TempNode } from '../core/TempNode';
 
 export class NormalNode extends TempNode {

+ 0 - 1
examples/jsm/nodes/accessors/PositionNode.d.ts

@@ -1,4 +1,3 @@
-import { NodeBuilder } from '../core/NodeBuilder';
 import { TempNode } from '../core/TempNode';
 
 export class PositionNode extends TempNode {

+ 0 - 3
examples/jsm/nodes/accessors/ReflectNode.d.ts

@@ -1,6 +1,3 @@
-import { Vector2 } from '../../../../src/Three';
-
-import { NodeBuilder } from '../core/NodeBuilder';
 import { TempNode } from '../core/TempNode';
 
 export class ReflectNode extends TempNode {

+ 0 - 1
examples/jsm/nodes/accessors/ResolutionNode.d.ts

@@ -1,6 +1,5 @@
 import { Vector2 } from '../../../../src/Three';
 
-import { NodeBuilder } from '../core/NodeBuilder';
 import { NodeFrame } from '../core/NodeFrame';
 import { Vector2Node } from '../inputs/Vector2Node';
 

+ 0 - 1
examples/jsm/nodes/accessors/ScreenUVNode.d.ts

@@ -1,4 +1,3 @@
-import { NodeBuilder } from '../core/NodeBuilder';
 import { TempNode } from '../core/TempNode';
 import { ResolutionNode } from './ResolutionNode';
 

+ 0 - 1
examples/jsm/nodes/accessors/UVNode.d.ts

@@ -1,4 +1,3 @@
-import { NodeBuilder } from '../core/NodeBuilder';
 import { TempNode } from '../core/TempNode';
 
 export class UVNode extends TempNode {

+ 0 - 1
examples/jsm/nodes/core/FunctionCallNode.d.ts

@@ -1,7 +1,6 @@
 import { Node } from './Node';
 import { FunctionNode } from './FunctionNode';
 import { TempNode } from './TempNode';
-import { NodeBuilder } from './NodeBuilder';
 
 export class FunctionCallNode extends TempNode {
 

+ 0 - 1
examples/jsm/nodes/effects/BlurNode.d.ts

@@ -1,7 +1,6 @@
 import { Vector2 } from '../../../../src/Three';
 
 import { TempNode } from '../core/TempNode';
-import { NodeBuilder } from '../core/NodeBuilder';
 import { NodeFrame } from '../core/NodeFrame';
 import { UVNode } from '../accessors/UVNode';
 import { Vector2Node } from '../inputs/Vector2Node';

+ 0 - 1
examples/jsm/nodes/effects/ColorAdjustmentNode.d.ts

@@ -1,5 +1,4 @@
 import { TempNode } from '../core/TempNode';
-import { NodeBuilder } from '../core/NodeBuilder';
 import { FloatNode } from '../inputs/FloatNode';
 import { FunctionNode } from '../core/FunctionNode';
 import { Node } from '../core/Node';

+ 0 - 1
examples/jsm/nodes/effects/LuminanceNode.d.ts

@@ -1,5 +1,4 @@
 import { TempNode } from '../core/TempNode';
-import { NodeBuilder } from '../core/NodeBuilder';
 import { FunctionNode } from '../core/FunctionNode';
 import { ConstNode } from '../core/ConstNode';
 import { Node } from '../core/Node';

+ 0 - 1
examples/jsm/nodes/inputs/ReflectorNode.d.ts

@@ -1,4 +1,3 @@
-import { NodeBuilder } from '../core/NodeBuilder';
 import { TempNode } from '../core/TempNode';
 import { Matrix4Node } from './Matrix4Node';
 import { OperatorNode } from '../math/OperatorNode';

+ 0 - 1
examples/jsm/nodes/inputs/TextureNode.d.ts

@@ -1,5 +1,4 @@
 import {
-	Matrix4,
 	Texture
 } from '../../../../src/Three';
 

+ 0 - 2
examples/jsm/nodes/materials/NodeMaterial.d.ts

@@ -5,8 +5,6 @@ import {
 
 import { NodeBuilder } from '../core/NodeBuilder';
 import { NodeFrame } from '../core/NodeFrame';
-import { StandardNode } from './nodes/StandardNode';
-import { PropertyNode } from '../inputs/PropertyNode';
 import { MeshStandardNode } from './nodes/MeshStandardNode';
 import { RawNode } from './nodes/RawNode';
 

+ 0 - 1
examples/jsm/nodes/math/OperatorNode.d.ts

@@ -1,5 +1,4 @@
 import { TempNode } from '../core/TempNode';
-import { NodeBuilder } from '../core/NodeBuilder';
 import { Node } from '../core/Node';
 
 export class OperatorNode extends TempNode {

+ 0 - 1
examples/jsm/nodes/misc/BumpMapNode.d.ts

@@ -1,5 +1,4 @@
 import { TempNode } from '../core/TempNode';
-import { NodeBuilder } from '../core/NodeBuilder';
 import { FloatNode } from '../inputs/FloatNode';
 import { FunctionNode } from '../core/FunctionNode';
 import { TextureNode } from '../inputs/TextureNode';

+ 0 - 1
examples/jsm/nodes/misc/NormalMapNode.d.ts

@@ -1,5 +1,4 @@
 import { TempNode } from '../core/TempNode';
-import { NodeBuilder } from '../core/NodeBuilder';
 import { FunctionNode } from '../core/FunctionNode';
 import { TextureNode } from '../inputs/TextureNode';
 import { Vector2Node } from '../inputs/Vector2Node';

+ 22 - 22
examples/jsm/nodes/misc/NormalMapNode.js

@@ -3,7 +3,7 @@
  */
 
 import {
-	BackSide 
+	BackSide
 } from '../../../../build/three.module.js';
 
 import { TempNode } from '../core/TempNode.js';
@@ -29,41 +29,41 @@ NormalMapNode.Nodes = ( function () {
 		// Per-Pixel Tangent Space Normal Mapping
 		// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html
 
-`vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 map, vec2 vUv, vec2 normalScale ) {
+		`vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 map, vec2 vUv, vec2 normalScale ) {
 
-	// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988
+		// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988
 
-	vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
-	vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
-	vec2 st0 = dFdx( vUv.st );
-	vec2 st1 = dFdy( vUv.st );
+		vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
+		vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
+		vec2 st0 = dFdx( vUv.st );
+		vec2 st1 = dFdy( vUv.st );
 
-	float scale = sign( st1.t * st0.s - st0.t * st1.s ); // we do not care about the magnitude
+		float scale = sign( st1.t * st0.s - st0.t * st1.s ); // we do not care about the magnitude
 
-	vec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );
-	vec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );
-	vec3 N = normalize( surf_norm );
+		vec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );
+		vec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );
+		vec3 N = normalize( surf_norm );
 
-	vec3 mapN = map * 2.0 - 1.0;
+		vec3 mapN = map * 2.0 - 1.0;
 
-	mapN.xy *= normalScale;
+		mapN.xy *= normalScale;
 
-	#ifdef DOUBLE_SIDED
+		#ifdef DOUBLE_SIDED
 
-		// Workaround for Adreno GPUs gl_FrontFacing bug. See #15850 and #10331
+			// Workaround for Adreno GPUs gl_FrontFacing bug. See #15850 and #10331
 
-		if ( dot( cross( S, T ), N ) < 0.0 ) mapN.xy *= - 1.0;
+			if ( dot( cross( S, T ), N ) < 0.0 ) mapN.xy *= - 1.0;
 
-	#else
+		#else
 
-		mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );
+			mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );
 
-	#endif
+		#endif
 
-	mat3 tsn = mat3( S, T, N );
-	return normalize( tsn * mapN );
+		mat3 tsn = mat3( S, T, N );
+		return normalize( tsn * mapN );
 
-}`, null, { derivatives: true } );
+	}`, null, { derivatives: true } );
 
 	return {
 		perturbNormal2Arb: perturbNormal2Arb

+ 0 - 1
examples/jsm/nodes/misc/TextureCubeUVNode.d.ts

@@ -1,5 +1,4 @@
 import { TempNode } from '../core/TempNode';
-import { NodeBuilder } from '../core/NodeBuilder';
 import { FloatNode } from '../inputs/FloatNode';
 import { StructNode } from '../core/StructNode';
 import { FunctionNode } from '../core/FunctionNode';

+ 0 - 1
examples/jsm/nodes/postprocessing/NodePass.d.ts

@@ -1,4 +1,3 @@
-import { NodeMaterial } from '../materials/NodeMaterial';
 import { ShaderPass } from '../../postprocessing/ShaderPass';
 import { ScreenNode } from '../inputs/ScreenNode';
 

+ 0 - 1
examples/jsm/nodes/procedural/CheckerNode.d.ts

@@ -1,5 +1,4 @@
 import { TempNode } from '../core/TempNode';
-import { NodeBuilder } from '../core/NodeBuilder';
 import { FunctionNode } from '../core/FunctionNode';
 import { UVNode } from '../accessors/UVNode';
 import { UVTransformNode } from '../utils/UVTransformNode';

+ 0 - 1
examples/jsm/nodes/procedural/NoiseNode.d.ts

@@ -1,5 +1,4 @@
 import { TempNode } from '../core/TempNode';
-import { NodeBuilder } from '../core/NodeBuilder';
 import { FunctionNode } from '../core/FunctionNode';
 import { UVNode } from '../accessors/UVNode';
 import { UVTransformNode } from '../utils/UVTransformNode';

+ 0 - 1
examples/jsm/nodes/utils/BypassNode.d.ts

@@ -1,5 +1,4 @@
 import { Node } from '../core/Node';
-import { NodeBuilder } from '../core/NodeBuilder';
 
 export class BypassNode extends Node {
 

+ 0 - 1
examples/jsm/nodes/utils/ColorSpaceNode.d.ts

@@ -1,7 +1,6 @@
 import { Node } from '../core/Node';
 import { TempNode } from '../core/TempNode';
 import { FunctionNode } from '../core/FunctionNode';
-import { NodeBuilder } from '../core/NodeBuilder';
 
 export class ColorSpaceNode extends TempNode {
 

+ 0 - 1
examples/jsm/nodes/utils/JoinNode.d.ts

@@ -1,5 +1,4 @@
 import { TempNode } from '../core/TempNode';
-import { NodeBuilder } from '../core/NodeBuilder';
 
 export class JoinNode extends TempNode {
 

+ 0 - 1
examples/jsm/nodes/utils/SpecularMIPLevelNode.d.ts

@@ -1,5 +1,4 @@
 import { TempNode } from '../core/TempNode';
-import { NodeBuilder } from '../core/NodeBuilder';
 import { MaxMIPLevelNode } from '../utils/MaxMIPLevelNode';
 import { FunctionNode } from '../core/FunctionNode';
 

+ 0 - 1
examples/jsm/nodes/utils/SubSlot.d.ts

@@ -1,5 +1,4 @@
 import { TempNode } from '../core/TempNode';
-import { NodeBuilder } from '../core/NodeBuilder';
 
 export class SubSlots extends TempNode {
 

+ 0 - 1
examples/jsm/nodes/utils/SwitchNode.d.ts

@@ -1,5 +1,4 @@
 import { Node } from '../core/Node';
-import { NodeBuilder } from '../core/NodeBuilder';
 
 export class SwitchNode extends Node {
 

+ 0 - 1
examples/jsm/nodes/utils/UVTransformNode.d.ts

@@ -1,5 +1,4 @@
 import { ExpressionNode } from '../core/ExpressionNode';
-import { NodeBuilder } from '../core/NodeBuilder';
 import { Matrix3Node } from '../inputs/Matrix3Node';
 import { UVNode } from '../accessors/UVNode';
 

+ 12 - 2
examples/jsm/postprocessing/CubeTexturePass.js

@@ -34,6 +34,16 @@ var CubeTexturePass = function ( camera, envMap, opacity ) {
 		} )
 	);
 
+	Object.defineProperty( this.cubeMesh.material, 'envMap', {
+
+		get: function () {
+
+			return this.uniforms.envMap.value;
+
+		}
+
+	} );
+
 	this.envMap = envMap;
 	this.opacity = ( opacity !== undefined ) ? opacity : 1.0;
 
@@ -55,8 +65,8 @@ CubeTexturePass.prototype = Object.assign( Object.create( Pass.prototype ), {
 		this.cubeCamera.projectionMatrix.copy( this.camera.projectionMatrix );
 		this.cubeCamera.quaternion.setFromRotationMatrix( this.camera.matrixWorld );
 
-		this.cubeMesh.material.envMap = this.envMap;
-		this.cubeMesh.material.opacity = this.opacity;
+		this.cubeMesh.material.uniforms.envMap.value = this.envMap;
+		this.cubeMesh.material.uniforms.opacity.value = this.opacity;
 		this.cubeMesh.material.transparent = ( this.opacity < 1.0 );
 
 		renderer.setRenderTarget( this.renderToScreen ? null : readBuffer );

+ 0 - 1
examples/jsm/postprocessing/FilmPass.d.ts

@@ -1,5 +1,4 @@
 import {
-	Vector2,
 	ShaderMaterial
 } from '../../../src/Three';
 

+ 0 - 1
examples/jsm/renderers/WebGLDeferredRenderer.d.ts

@@ -1,7 +1,6 @@
 import {
 	Camera,
 	Scene,
-	Vector2,
 	WebGLRenderer
 } from '../../../src/Three';
 

+ 0 - 4
examples/jsm/shaders/BasicShader.d.ts

@@ -1,7 +1,3 @@
-import {
-	Uniform
-} from '../../../src/Three';
-
 export const BasicShader: {
 	uniforms: {};
 	vertexShader: string;

+ 0 - 2
examples/jsm/shaders/OceanShaders.d.ts

@@ -1,7 +1,5 @@
 import {
-	Texture,
 	Uniform,
-	Vector2,
 } from '../../../src/Three';
 
 export const OceanShaders: {

+ 0 - 85
examples/jsm/shaders/SkinShader.d.ts

@@ -1,85 +0,0 @@
-import {
-	Uniform
-} from '../../../src/Three';
-
-export const SkinShaderBasic: {
-	uniforms: {
-		ambientLightColor: Uniform;
-		bumpMap: Uniform;
-		bumpScale: Uniform;
-		diffuse: Uniform;
-		directionalLights: Uniform;
-		directionalShadowMap: Uniform;
-		directionalShadowMatrix: Uniform;
-		enableBump: Uniform;
-		enableSpecular: Uniform;
-		fogColor: Uniform;
-		fogDensity: Uniform;
-		fogFar: Uniform;
-		fogNear: Uniform;
-		hemisphereLights: Uniform;
-		lightProbe: Uniform;
-		offsetRepeat: Uniform;
-		opacity: Uniform;
-		pointLights: Uniform;
-		pointShadowMap: Uniform;
-		pointShadowMatrix: Uniform;
-		rectAreaLights: Uniform;
-		specular: Uniform;
-		specularMap: Uniform;
-		spotLights: Uniform;
-		spotShadowMap: Uniform;
-		spotShadowMatrix: Uniform;
-		tBeckmann: Uniform;
-		tDiffuse: Uniform;
-		uRoughness: Uniform;
-		uSpecularBrightness: Uniform;
-		uWrapRGB: Uniform;
-	};
-	vertexShader: string;
-	fragmentShader: string;
-};
-
-export const SkinShaderAdvanced: {
-	uniforms: {
-		ambientLightColor: Uniform;
-		diffuse: Uniform;
-		directionalLights: Uniform;
-		directionalShadowMap: Uniform;
-		directionalShadowMatrix: Uniform;
-		fogColor: Uniform;
-		fogDensity: Uniform;
-		fogFar: Uniform;
-		fogNear: Uniform;
-		hemisphereLights: Uniform;
-		lightProbe: Uniform;
-		opacity: Uniform;
-		passID: Uniform;
-		pointLights: Uniform;
-		pointShadowMap: Uniform;
-		pointShadowMatrix: Uniform;
-		rectAreaLights: Uniform;
-		specular: Uniform;
-		spotLights: Uniform;
-		spotShadowMap: Uniform;
-		spotShadowMatrix: Uniform;
-		tBeckmann: Uniform;
-		tBlur1: Uniform;
-		tBlur2: Uniform;
-		tBlur3: Uniform;
-		tBlur4: Uniform;
-		tDiffuse: Uniform;
-		tNormal: Uniform;
-		uNormalScale: Uniform;
-		uRoughness: Uniform;
-		uSpecularBrightness: Uniform;
-	};
-	vertexShader: string;
-	fragmentShader: string;
-};
-
-export const SkinShaderBeckmann: {
-	uniforms: {};
-	vertexShader: string;
-	fragmentShader: string;
-};

+ 0 - 697
examples/jsm/shaders/SkinShader.js

@@ -1,697 +0,0 @@
-/**
- * @author alteredq / http://alteredqualia.com/
- *
- */
-
-import {
-	Color,
-	ShaderChunk,
-	UniformsLib,
-	UniformsUtils,
-	Vector3,
-	Vector4
-} from "../../../build/three.module.js";
-
-/* ------------------------------------------------------------------------------------------
-//	Basic skin shader
-//		- per-pixel Blinn-Phong diffuse term mixed with half-Lambert wrap-around term (per color component)
-//		- physically based specular term (Kelemen/Szirmay-Kalos specular reflectance)
-//
-//		- diffuse map
-//		- bump map
-//		- specular map
-//		- point, directional and hemisphere lights (use with "lights: true" material option)
-//		- fog (use with "fog: true" material option)
-//
-// ------------------------------------------------------------------------------------------ */
-
-var SkinShaderBasic = {
-
-	uniforms: UniformsUtils.merge( [
-
-		UniformsLib[ "fog" ],
-		UniformsLib[ "lights" ],
-
-		{
-
-			"enableBump": { value: 0 },
-			"enableSpecular": { value: 0 },
-
-			"tDiffuse": { value: null },
-			"tBeckmann": { value: null },
-
-			"diffuse": { value: new Color( 0xeeeeee ) },
-			"specular": { value: new Color( 0x111111 ) },
-			"opacity": { value: 1 },
-
-			"uRoughness": { value: 0.15 },
-			"uSpecularBrightness": { value: 0.75 },
-
-			"bumpMap": { value: null },
-			"bumpScale": { value: 1 },
-
-			"specularMap": { value: null },
-
-			"offsetRepeat": { value: new Vector4( 0, 0, 1, 1 ) },
-
-			"uWrapRGB": { value: new Vector3( 0.75, 0.375, 0.1875 ) }
-
-		}
-
-	] ),
-
-	vertexShader: [
-
-		"uniform vec4 offsetRepeat;",
-
-		"varying vec3 vNormal;",
-		"varying vec2 vUv;",
-
-		"varying vec3 vViewPosition;",
-
-		ShaderChunk[ "common" ],
-		ShaderChunk[ "lights_pars_begin" ],
-		ShaderChunk[ "fog_pars_vertex" ],
-
-		"void main() {",
-
-		"	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
-		"	vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
-
-		"	vViewPosition = -mvPosition.xyz;",
-
-		"	vNormal = normalize( normalMatrix * normal );",
-
-		"	vUv = uv * offsetRepeat.zw + offsetRepeat.xy;",
-
-		"	gl_Position = projectionMatrix * mvPosition;",
-
-		ShaderChunk[ "fog_vertex" ],
-
-		"}"
-
-	].join( "\n" ),
-
-	fragmentShader: [
-
-		"#define USE_BUMPMAP",
-
-		"uniform bool enableBump;",
-		"uniform bool enableSpecular;",
-
-		"uniform vec3 diffuse;",
-		"uniform vec3 specular;",
-		"uniform float opacity;",
-
-		"uniform float uRoughness;",
-		"uniform float uSpecularBrightness;",
-
-		"uniform vec3 uWrapRGB;",
-
-		"uniform sampler2D tDiffuse;",
-		"uniform sampler2D tBeckmann;",
-
-		"uniform sampler2D specularMap;",
-
-		"varying vec3 vNormal;",
-		"varying vec2 vUv;",
-
-		"varying vec3 vViewPosition;",
-
-		ShaderChunk[ "common" ],
-		ShaderChunk[ "bsdfs" ],
-		ShaderChunk[ "packing" ],
-		ShaderChunk[ "lights_pars_begin" ],
-		ShaderChunk[ "fog_pars_fragment" ],
-		ShaderChunk[ "bumpmap_pars_fragment" ],
-
-		// Fresnel term
-
-		"float fresnelReflectance( vec3 H, vec3 V, float F0 ) {",
-
-		"	float base = 1.0 - dot( V, H );",
-		"	float exponential = pow( base, 5.0 );",
-
-		"	return exponential + F0 * ( 1.0 - exponential );",
-
-		"}",
-
-		// Kelemen/Szirmay-Kalos specular BRDF
-
-		"float KS_Skin_Specular( vec3 N,", // Bumped surface normal
-		"	vec3 L,", // Points to light
-		"	vec3 V,", // Points to eye
-		"	float m,", // Roughness
-		"	float rho_s", // Specular brightness
-		"	) {",
-
-		"	float result = 0.0;",
-		"	float ndotl = dot( N, L );",
-
-		"	if( ndotl > 0.0 ) {",
-
-		"		vec3 h = L + V;", // Unnormalized half-way vector
-		"		vec3 H = normalize( h );",
-
-		"		float ndoth = dot( N, H );",
-
-		"		float PH = pow( 2.0 * texture2D( tBeckmann, vec2( ndoth, m ) ).x, 10.0 );",
-
-		"		float F = fresnelReflectance( H, V, 0.028 );",
-		"		float frSpec = max( PH * F / dot( h, h ), 0.0 );",
-
-		"		result = ndotl * rho_s * frSpec;", // BRDF * dot(N,L) * rho_s
-
-		"	}",
-
-		"	return result;",
-
-		"}",
-
-		"void main() {",
-
-		"	vec3 outgoingLight = vec3( 0.0 );",	// outgoing light does not have an alpha, the surface does
-		"	vec4 diffuseColor = vec4( diffuse, opacity );",
-
-		"	vec4 colDiffuse = texture2D( tDiffuse, vUv );",
-		"	colDiffuse.rgb *= colDiffuse.rgb;",
-
-		"	diffuseColor = diffuseColor * colDiffuse;",
-
-		"	vec3 normal = normalize( vNormal );",
-		"	vec3 viewerDirection = normalize( vViewPosition );",
-
-		"	float specularStrength;",
-
-		"	if ( enableSpecular ) {",
-
-		"		vec4 texelSpecular = texture2D( specularMap, vUv );",
-		"		specularStrength = texelSpecular.r;",
-
-		"	} else {",
-
-		"		specularStrength = 1.0;",
-
-		"	}",
-
-		"	#ifdef USE_BUMPMAP",
-
-		"		if ( enableBump ) normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );",
-
-		"	#endif",
-
-		// point lights
-
-		"	vec3 totalSpecularLight = vec3( 0.0 );",
-		"	vec3 totalDiffuseLight = vec3( 0.0 );",
-
-		"	#if NUM_POINT_LIGHTS > 0",
-
-		"		for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {",
-
-		"			vec3 lVector = pointLights[ i ].position + vViewPosition.xyz;",
-
-		"			float attenuation = calcLightAttenuation( length( lVector ), pointLights[ i ].distance, pointLights[ i ].decay );",
-
-		"			lVector = normalize( lVector );",
-
-		"			float pointDiffuseWeightFull = max( dot( normal, lVector ), 0.0 );",
-		"			float pointDiffuseWeightHalf = max( 0.5 * dot( normal, lVector ) + 0.5, 0.0 );",
-		"			vec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), uWrapRGB );",
-
-		"			float pointSpecularWeight = KS_Skin_Specular( normal, lVector, viewerDirection, uRoughness, uSpecularBrightness );",
-
-		"			totalDiffuseLight += pointLight[ i ].color * ( pointDiffuseWeight * attenuation );",
-		"			totalSpecularLight += pointLight[ i ].color * specular * ( pointSpecularWeight * specularStrength * attenuation );",
-
-		"		}",
-
-		"	#endif",
-
-		// directional lights
-
-		"	#if NUM_DIR_LIGHTS > 0",
-
-		"		for( int i = 0; i < NUM_DIR_LIGHTS; i++ ) {",
-
-		"			vec3 dirVector = directionalLights[ i ].direction;",
-
-		"			float dirDiffuseWeightFull = max( dot( normal, dirVector ), 0.0 );",
-		"			float dirDiffuseWeightHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );",
-		"			vec3 dirDiffuseWeight = mix( vec3 ( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), uWrapRGB );",
-
-		"			float dirSpecularWeight = KS_Skin_Specular( normal, dirVector, viewerDirection, uRoughness, uSpecularBrightness );",
-
-		"			totalDiffuseLight += directionalLights[ i ].color * dirDiffuseWeight;",
-		"			totalSpecularLight += directionalLights[ i ].color * ( dirSpecularWeight * specularStrength );",
-
-		"		}",
-
-		"	#endif",
-
-		// hemisphere lights
-
-		"	#if NUM_HEMI_LIGHTS > 0",
-
-		"		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {",
-
-		"			vec3 lVector = hemisphereLightDirection[ i ];",
-
-		"			float dotProduct = dot( normal, lVector );",
-		"			float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;",
-
-		"			totalDiffuseLight += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );",
-
-		// specular (sky light)
-
-		"			float hemiSpecularWeight = 0.0;",
-		"			hemiSpecularWeight += KS_Skin_Specular( normal, lVector, viewerDirection, uRoughness, uSpecularBrightness );",
-
-		// specular (ground light)
-
-		"			vec3 lVectorGround = -lVector;",
-		"			hemiSpecularWeight += KS_Skin_Specular( normal, lVectorGround, viewerDirection, uRoughness, uSpecularBrightness );",
-
-		"			vec3 hemiSpecularColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );",
-
-		"			totalSpecularLight += hemiSpecularColor * specular * ( hemiSpecularWeight * specularStrength );",
-
-		"		}",
-
-		"	#endif",
-
-		"	outgoingLight += diffuseColor.xyz * ( totalDiffuseLight + ambientLightColor * diffuse ) + totalSpecularLight;",
-
-		"	gl_FragColor = linearToOutputTexel( vec4( outgoingLight, diffuseColor.a ) );",	// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
-
-		ShaderChunk[ "fog_fragment" ],
-
-		"}"
-
-	].join( "\n" )
-
-};
-
-/* ------------------------------------------------------------------------------------------
-//	Skin shader
-//		- Blinn-Phong diffuse term (using normal + diffuse maps)
-//		- subsurface scattering approximation by four blur layers
-//		- physically based specular term (Kelemen/Szirmay-Kalos specular reflectance)
-//
-//		- point and directional lights (use with "lights: true" material option)
-//
-//		- based on Nvidia Advanced Skin Rendering GDC 2007 presentation
-//		  and GPU Gems 3 Chapter 14. Advanced Techniques for Realistic Real-Time Skin Rendering
-//
-//			http://developer.download.nvidia.com/presentations/2007/gdc/Advanced_Skin.pdf
-//			http://http.developer.nvidia.com/GPUGems3/gpugems3_ch14.html
-// ------------------------------------------------------------------------------------------ */
-
-var SkinShaderAdvanced = {
-
-	uniforms: UniformsUtils.merge( [
-
-		UniformsLib[ "fog" ],
-		UniformsLib[ "lights" ],
-
-		{
-			"passID": { value: 0 },
-
-			"tDiffuse": { value: null },
-			"tNormal": { value: null },
-
-			"tBlur1": { value: null },
-			"tBlur2": { value: null },
-			"tBlur3": { value: null },
-			"tBlur4": { value: null },
-
-			"tBeckmann": { value: null },
-
-			"uNormalScale": { value: 1.0 },
-
-			"diffuse": { value: new Color( 0xeeeeee ) },
-			"specular": { value: new Color( 0x111111 ) },
-			"opacity": { value: 1 },
-
-			"uRoughness": { value: 0.15 },
-			"uSpecularBrightness": { value: 0.75 }
-
-		}
-
-	] ),
-
-	vertexShader: [
-
-		"#ifdef VERTEX_TEXTURES",
-
-		"	uniform sampler2D tDisplacement;",
-		"	uniform float uDisplacementScale;",
-		"	uniform float uDisplacementBias;",
-
-		"#endif",
-
-		"varying vec3 vNormal;",
-		"varying vec2 vUv;",
-
-		"varying vec3 vViewPosition;",
-
-		ShaderChunk[ "common" ],
-		ShaderChunk[ "fog_pars_vertex" ],
-
-		"void main() {",
-
-		"	vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
-
-		"	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
-
-		"	vViewPosition = -mvPosition.xyz;",
-
-		"	vNormal = normalize( normalMatrix * normal );",
-
-		"	vUv = uv;",
-
-		// displacement mapping
-
-		"	#ifdef VERTEX_TEXTURES",
-
-		"		vec3 dv = texture2D( tDisplacement, uv ).xyz;",
-		"		float df = uDisplacementScale * dv.x + uDisplacementBias;",
-		"		vec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;",
-		"		gl_Position = projectionMatrix * displacedPosition;",
-
-		"		#else",
-
-		"		gl_Position = projectionMatrix * mvPosition;",
-
-		"	#endif",
-
-		ShaderChunk[ "fog_vertex" ],
-
-		"}",
-
-
-	].join( "\n" ),
-
-	vertexShaderUV: [
-
-		"varying vec3 vNormal;",
-		"varying vec2 vUv;",
-
-		"varying vec3 vViewPosition;",
-
-		ShaderChunk[ "common" ],
-
-		"void main() {",
-
-		"	vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
-
-		"	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
-
-		"	vViewPosition = -mvPosition.xyz;",
-
-		"	vNormal = normalize( normalMatrix * normal );",
-
-		"	vUv = uv;",
-
-		"	gl_Position = vec4( uv.x * 2.0 - 1.0, uv.y * 2.0 - 1.0, 0.0, 1.0 );",
-
-		"}"
-
-	].join( "\n" ),
-
-	fragmentShader: [
-
-		"uniform vec3 diffuse;",
-		"uniform vec3 specular;",
-		"uniform float opacity;",
-
-		"uniform float uRoughness;",
-		"uniform float uSpecularBrightness;",
-
-		"uniform int passID;",
-
-		"uniform sampler2D tDiffuse;",
-		"uniform sampler2D tNormal;",
-
-		"uniform sampler2D tBlur1;",
-		"uniform sampler2D tBlur2;",
-		"uniform sampler2D tBlur3;",
-		"uniform sampler2D tBlur4;",
-
-		"uniform sampler2D tBeckmann;",
-
-		"uniform float uNormalScale;",
-
-		"varying vec3 vNormal;",
-		"varying vec2 vUv;",
-
-		"varying vec3 vViewPosition;",
-
-		ShaderChunk[ "common" ],
-		ShaderChunk[ "lights_pars_begin" ],
-		ShaderChunk[ "fog_pars_fragment" ],
-
-		"float fresnelReflectance( vec3 H, vec3 V, float F0 ) {",
-
-		"	float base = 1.0 - dot( V, H );",
-		"	float exponential = pow( base, 5.0 );",
-
-		"	return exponential + F0 * ( 1.0 - exponential );",
-
-		"}",
-
-		// Kelemen/Szirmay-Kalos specular BRDF
-
-		"float KS_Skin_Specular( vec3 N,", // Bumped surface normal
-		"	vec3 L,", // Points to light
-		"	vec3 V,", // Points to eye
-		"	float m,", // Roughness
-		"	float rho_s", // Specular brightness
-		"	) {",
-
-		"	float result = 0.0;",
-		"	float ndotl = dot( N, L );",
-
-		"	if( ndotl > 0.0 ) {",
-
-		"		vec3 h = L + V;", // Unnormalized half-way vector
-		"		vec3 H = normalize( h );",
-
-		"		float ndoth = dot( N, H );",
-
-		"		float PH = pow( 2.0 * texture2D( tBeckmann, vec2( ndoth, m ) ).x, 10.0 );",
-		"		float F = fresnelReflectance( H, V, 0.028 );",
-		"		float frSpec = max( PH * F / dot( h, h ), 0.0 );",
-
-		"		result = ndotl * rho_s * frSpec;", // BRDF * dot(N,L) * rho_s
-
-		"	}",
-
-		"	return result;",
-
-		"}",
-
-		"void main() {",
-
-		"	vec3 outgoingLight = vec3( 0.0 );",	// outgoing light does not have an alpha, the surface does
-		"	vec4 diffuseColor = vec4( diffuse, opacity );",
-
-		"	vec4 mSpecular = vec4( specular, opacity );",
-
-		"	vec4 colDiffuse = texture2D( tDiffuse, vUv );",
-		"	colDiffuse *= colDiffuse;",
-
-		"	diffuseColor *= colDiffuse;",
-
-		// normal mapping
-
-		"	vec4 posAndU = vec4( -vViewPosition, vUv.x );",
-		"	vec4 posAndU_dx = dFdx( posAndU ),  posAndU_dy = dFdy( posAndU );",
-		"	vec3 tangent = posAndU_dx.w * posAndU_dx.xyz + posAndU_dy.w * posAndU_dy.xyz;",
-		"	vec3 normal = normalize( vNormal );",
-		"	vec3 binormal = normalize( cross( tangent, normal ) );",
-		"	tangent = cross( normal, binormal );",	// no normalization required
-		"	mat3 tsb = mat3( tangent, binormal, normal );",
-
-		"	vec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;",
-		"	normalTex.xy *= uNormalScale;",
-		"	normalTex = normalize( normalTex );",
-
-		"	vec3 finalNormal = tsb * normalTex;",
-		"	normal = normalize( finalNormal );",
-
-		"	vec3 viewerDirection = normalize( vViewPosition );",
-
-		// point lights
-
-		"	vec3 totalDiffuseLight = vec3( 0.0 );",
-		"	vec3 totalSpecularLight = vec3( 0.0 );",
-
-		"	#if NUM_POINT_LIGHTS > 0",
-
-		"	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {",
-
-		"		vec3 pointVector = normalize( pointLights[ i ].direction );",
-		"		float attenuation = calcLightAttenuation( length( lVector ), pointLights[ i ].distance, pointLights[ i ].decay );",
-
-		"		float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );",
-
-		"		totalDiffuseLight += pointLightColor[ i ] * ( pointDiffuseWeight * attenuation );",
-
-		"		if ( passID == 1 ) {",
-
-		"			float pointSpecularWeight = KS_Skin_Specular( normal, pointVector, viewerDirection, uRoughness, uSpecularBrightness );",
-
-		"			totalSpecularLight += pointLightColor[ i ] * mSpecular.xyz * ( pointSpecularWeight * attenuation );",
-
-		"		}",
-
-		"	}",
-
-		"	#endif",
-
-		// directional lights
-
-		"	#if NUM_DIR_LIGHTS > 0",
-
-		"		for( int i = 0; i < NUM_DIR_LIGHTS; i++ ) {",
-
-		"			vec3 dirVector = directionalLights[ i ].direction;",
-
-		"			float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );",
-
-
-		"			totalDiffuseLight += directionalLights[ i ].color * dirDiffuseWeight;",
-
-		"			if ( passID == 1 ) {",
-
-		"				float dirSpecularWeight = KS_Skin_Specular( normal, dirVector, viewerDirection, uRoughness, uSpecularBrightness );",
-
-		"				totalSpecularLight += directionalLights[ i ].color * mSpecular.xyz * dirSpecularWeight;",
-
-		"			}",
-
-		"		}",
-
-		"	#endif",
-
-		"	outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalSpecularLight );",
-
-		"	if ( passID == 0 ) {",
-
-		"		outgoingLight = sqrt( outgoingLight );",
-
-		"	} else if ( passID == 1 ) {",
-
-		//"#define VERSION1",
-
-		"	#ifdef VERSION1",
-
-		"		vec3 nonblurColor = sqrt(outgoingLight );",
-
-		"	#else",
-
-		"		vec3 nonblurColor = outgoingLight;",
-
-		"	#endif",
-
-		"	vec3 blur1Color = texture2D( tBlur1, vUv ).xyz;",
-		"	vec3 blur2Color = texture2D( tBlur2, vUv ).xyz;",
-		"	vec3 blur3Color = texture2D( tBlur3, vUv ).xyz;",
-		"	vec3 blur4Color = texture2D( tBlur4, vUv ).xyz;",
-
-
-		//"gl_FragColor = vec4( blur1Color, gl_FragColor.w );",
-
-		//"gl_FragColor = vec4( vec3( 0.22, 0.5, 0.7 ) * nonblurColor + vec3( 0.2, 0.5, 0.3 ) * blur1Color + vec3( 0.58, 0.0, 0.0 ) * blur2Color, gl_FragColor.w );",
-
-		//"gl_FragColor = vec4( vec3( 0.25, 0.6, 0.8 ) * nonblurColor + vec3( 0.15, 0.25, 0.2 ) * blur1Color + vec3( 0.15, 0.15, 0.0 ) * blur2Color + vec3( 0.45, 0.0, 0.0 ) * blur3Color, gl_FragColor.w );",
-
-		"	outgoingLight = vec3( vec3( 0.22,  0.437, 0.635 ) * nonblurColor + ",
-		"		vec3( 0.101, 0.355, 0.365 ) * blur1Color + ",
-		"		vec3( 0.119, 0.208, 0.0 )   * blur2Color + ",
-		"		vec3( 0.114, 0.0,   0.0 )   * blur3Color + ",
-		"		vec3( 0.444, 0.0,   0.0 )   * blur4Color );",
-
-		"	outgoingLight *= sqrt( colDiffuse.xyz );",
-
-		"	outgoingLight += ambientLightColor * diffuse * colDiffuse.xyz + totalSpecularLight;",
-
-		"		#ifndef VERSION1",
-
-		"			outgoingLight = sqrt( outgoingLight );",
-
-		"		#endif",
-
-		"	}",
-
-		"	gl_FragColor = vec4( outgoingLight, diffuseColor.a );",	// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
-
-		ShaderChunk[ "fog_fragment" ],
-
-		"}"
-
-	].join( "\n" )
-
-};
-
-/* ------------------------------------------------------------------------------------------
-// Beckmann distribution function
-//	- to be used in specular term of skin shader
-//	- render a screen-aligned quad to precompute a 512 x 512 texture
-//
-//		- from http://developer.nvidia.com/node/171
- ------------------------------------------------------------------------------------------ */
-
-var SkinShaderBeckmann = {
-
-	uniforms: {},
-
-	vertexShader: [
-
-		"varying vec2 vUv;",
-
-		"void main() {",
-
-		"	vUv = uv;",
-		"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-		"}"
-
-	].join( "\n" ),
-
-	fragmentShader: [
-
-		"varying vec2 vUv;",
-
-		"float PHBeckmann( float ndoth, float m ) {",
-
-		"	float alpha = acos( ndoth );",
-		"	float ta = tan( alpha );",
-
-		"	float val = 1.0 / ( m * m * pow( ndoth, 4.0 ) ) * exp( -( ta * ta ) / ( m * m ) );",
-		"	return val;",
-
-		"}",
-
-		"float KSTextureCompute( vec2 tex ) {",
-
-		// Scale the value to fit within [0,1]  invert upon lookup.
-
-		"	return 0.5 * pow( PHBeckmann( tex.x, tex.y ), 0.1 );",
-
-		"}",
-
-		"void main() {",
-
-		"	float x = KSTextureCompute( vUv );",
-
-		"	gl_FragColor = vec4( x, x, x, 1.0 );",
-
-		"}"
-
-	].join( "\n" )
-
-};
-
-export { SkinShaderBasic, SkinShaderAdvanced, SkinShaderBeckmann };

+ 1 - 1
examples/jsm/utils/RoughnessMipmapper.d.ts

@@ -1,6 +1,6 @@
 import {
 	WebGLRenderer,
-    MeshStandardMaterial
+	MeshStandardMaterial
 } from '../../../src/Three';
 
 export class RoughnessMipmapper {

+ 0 - 1
examples/jsm/webxr/ARButton.js

@@ -33,7 +33,6 @@ var ARButton = {
 
 				currentSession.removeEventListener( 'end', onSessionEnded );
 
-				renderer.xr.setSession( null );
 				button.textContent = 'START AR';
 
 				currentSession = null;

+ 0 - 1
examples/jsm/webxr/VRButton.js

@@ -32,7 +32,6 @@ var VRButton = {
 
 				currentSession.removeEventListener( 'end', onSessionEnded );
 
-				renderer.xr.setSession( null );
 				button.textContent = 'ENTER VR';
 
 				currentSession = null;

BIN
examples/textures/equirectangular/royal_esplanade_1k.hdr


+ 5 - 4
examples/webgl_loader_gltf.html

@@ -12,7 +12,7 @@
 			<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> - GLTFLoader<br />
 			Battle Damaged Sci-fi Helmet by
 			<a href="https://sketchfab.com/theblueturtle_" target="_blank" rel="noopener">theblueturtle_</a><br />
-			<a href="https://hdrihaven.com/hdri/?h=pedestrian_overpass" target="_blank" rel="noopener">Pedestrian Overpass</a> by <a href="https://hdrihaven.com/" target="_blank" rel="noopener">HDRI Haven</a>
+			<a href="https://hdrihaven.com/hdri/?h=royal_esplanade" target="_blank" rel="noopener">Royal Esplanade</a> by <a href="https://hdrihaven.com/" target="_blank" rel="noopener">HDRI Haven</a>
 		</div>
 
 		<script type="module">
@@ -38,14 +38,14 @@
 				document.body.appendChild( container );
 
 				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 0.25, 20 );
-				camera.position.set( - 1.8, 0.9, 2.7 );
+				camera.position.set( - 1.8, 0.6, 2.7 );
 
 				scene = new THREE.Scene();
 
 				new RGBELoader()
 					.setDataType( THREE.UnsignedByteType )
 					.setPath( 'textures/equirectangular/' )
-					.load( 'pedestrian_overpass_1k.hdr', function ( texture ) {
+					.load( 'royal_esplanade_1k.hdr', function ( texture ) {
 
 						var envMap = pmremGenerator.fromEquirectangular( texture ).texture;
 						pmremGenerator.dispose();
@@ -81,6 +81,7 @@
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
+				renderer.toneMapping = THREE.ACESFilmicToneMapping;
 				renderer.outputEncoding = THREE.sRGBEncoding;
 				container.appendChild( renderer.domElement );
 
@@ -88,7 +89,7 @@
 				pmremGenerator.compileEquirectangularShader();
 
 				controls = new OrbitControls( camera, renderer.domElement );
-				controls.target.set( 0, - 0.2, - 0.2 );
+				controls.target.set( 0, 0, - 0.2 );
 				controls.update();
 
 				window.addEventListener( 'resize', onWindowResize, false );

+ 0 - 228
examples/webgl_materials_bumpmap_skin.html

@@ -1,228 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<title>three.js webgl - materials - bump map - skin [Lee Perry-Smith]</title>
-		<meta charset="utf-8">
-		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
-		<link type="text/css" rel="stylesheet" href="main.css">
-	</head>
-
-	<body>
-		<div id="info">
-			<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> - single-pass skin material with tangent-less bump mapping</a><br/>
-			<a href="http://graphics.cs.williams.edu/data/meshes.xml#14" target="_blank" rel="noopener">Lee Perry-Smith</a> head
-		</div>
-
-		<script type="module">
-
-			import * as THREE from '../build/three.module.js';
-
-			import Stats from './jsm/libs/stats.module.js';
-
-			import { GLTFLoader } from './jsm/loaders/GLTFLoader.js';
-			import { EffectComposer } from './jsm/postprocessing/EffectComposer.js';
-			import { ShaderPass } from './jsm/postprocessing/ShaderPass.js';
-			import { CopyShader } from './jsm/shaders/CopyShader.js';
-
-			import { SkinShaderBasic, SkinShaderBeckmann } from './jsm/shaders/SkinShader.js';
-
-			var camera, scene, renderer, stats;
-
-			var mesh;
-
-			var mouseX = 0;
-			var mouseY = 0;
-
-			var targetX = 0, targetY = 0;
-
-			var windowHalfX = window.innerWidth / 2;
-			var windowHalfY = window.innerHeight / 2;
-
-			var firstPass = true;
-
-			var composerBeckmann;
-
-			init();
-			animate();
-
-			function init() {
-
-				var container = document.createElement( 'div' );
-				document.body.appendChild( container );
-
-				//
-
-				camera = new THREE.PerspectiveCamera( 27, window.innerWidth / window.innerHeight, 1, 10000 );
-				camera.position.z = 1200;
-
-				scene = new THREE.Scene();
-				scene.background = new THREE.Color( 0x242a34 );
-
-				// LIGHTS
-
-				scene.add( new THREE.AmbientLight( 0x333344 ) );
-
-				var directionalLight = new THREE.DirectionalLight( 0xffffff, 1 );
-				directionalLight.position.set( 500, 0, 500 );
-
-				scene.add( directionalLight );
-
-				//
-
-				var loader = new GLTFLoader();
-				loader.load( "models/gltf/LeePerrySmith/LeePerrySmith.glb", function ( gltf ) {
-
-					createScene( gltf.scene.children[ 0 ].geometry, 100 );
-
-				} );
-
-				//
-
-				renderer = new THREE.WebGLRenderer( { antialias: true } );
-				renderer.setPixelRatio( window.devicePixelRatio );
-				renderer.setSize( window.innerWidth, window.innerHeight );
-				container.appendChild( renderer.domElement );
-				renderer.autoClear = false;
-				renderer.outputEncoding = THREE.sRGBEncoding;
-
-				//
-
-				stats = new Stats();
-				container.appendChild( stats.dom );
-
-
-				// BECKMANN
-
-				var effectBeckmann = new ShaderPass( SkinShaderBeckmann );
-				var effectCopy = new ShaderPass( CopyShader );
-
-				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat, stencilBuffer: false };
-				var rtwidth = 512, rtheight = 512;
-
-				composerBeckmann = new EffectComposer( renderer, new THREE.WebGLRenderTarget( rtwidth, rtheight, pars ) );
-				composerBeckmann.addPass( effectBeckmann );
-				composerBeckmann.addPass( effectCopy );
-
-				// EVENTS
-
-				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
-				window.addEventListener( 'resize', onWindowResize, false );
-
-			}
-
-			function createScene( geometry, scale ) {
-
-				var textureLoader = new THREE.TextureLoader();
-
-				var mapHeight = textureLoader.load( "models/gltf/LeePerrySmith/Infinite-Level_02_Disp_NoSmoothUV-4096.jpg" );
-
-				mapHeight.anisotropy = 4;
-				mapHeight.wrapS = mapHeight.wrapT = THREE.RepeatWrapping;
-				mapHeight.format = THREE.RGBFormat;
-
-				var mapSpecular = textureLoader.load( "models/gltf/LeePerrySmith/Map-SPEC.jpg" );
-
-				mapSpecular.anisotropy = 4;
-				mapSpecular.wrapS = mapSpecular.wrapT = THREE.RepeatWrapping;
-				mapSpecular.format = THREE.RGBFormat;
-
-				var mapColor = textureLoader.load( "models/gltf/LeePerrySmith/Map-COL.jpg" );
-
-				mapColor.anisotropy = 4;
-				mapColor.wrapS = mapColor.wrapT = THREE.RepeatWrapping;
-				mapColor.format = THREE.RGBFormat;
-
-				var shader = SkinShaderBasic;
-
-				var fragmentShader = shader.fragmentShader;
-				var vertexShader = shader.vertexShader;
-
-				var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
-
-				uniforms[ "enableBump" ].value = true;
-				uniforms[ "enableSpecular" ].value = true;
-
-				uniforms[ "tBeckmann" ].value = composerBeckmann.renderTarget1.texture;
-				uniforms[ "tDiffuse" ].value = mapColor;
-
-				uniforms[ "bumpMap" ].value = mapHeight;
-				uniforms[ "specularMap" ].value = mapSpecular;
-
-				uniforms[ "diffuse" ].value.setHex( 0xa0a0a0 );
-				uniforms[ "specular" ].value.setHex( 0xa0a0a0 );
-
-				uniforms[ "uRoughness" ].value = 0.2;
-				uniforms[ "uSpecularBrightness" ].value = 0.5;
-
-				uniforms[ "bumpScale" ].value = 8;
-
-				var material = new THREE.ShaderMaterial( { fragmentShader: fragmentShader, vertexShader: vertexShader, uniforms: uniforms, lights: true } );
-				material.extensions.derivatives = true;
-
-				mesh = new THREE.Mesh( geometry, material );
-
-				mesh.position.y = - 50;
-				mesh.scale.set( scale, scale, scale );
-
-				scene.add( mesh );
-
-			}
-
-			//
-
-			function onWindowResize() {
-
-				renderer.setSize( window.innerWidth, window.innerHeight );
-
-				camera.aspect = window.innerWidth / window.innerHeight;
-				camera.updateProjectionMatrix();
-
-			}
-
-			function onDocumentMouseMove( event ) {
-
-				mouseX = ( event.clientX - windowHalfX ) * 1;
-				mouseY = ( event.clientY - windowHalfY ) * 1;
-
-			}
-
-			//
-
-			function animate() {
-
-				requestAnimationFrame( animate );
-
-				render();
-
-				stats.update();
-
-			}
-
-			function render() {
-
-				targetX = mouseX * .001;
-				targetY = mouseY * .001;
-
-				if ( mesh ) {
-
-					mesh.rotation.y += 0.05 * ( targetX - mesh.rotation.y );
-					mesh.rotation.x += 0.05 * ( targetY - mesh.rotation.x );
-
-				}
-
-				if ( firstPass ) {
-
-					composerBeckmann.render();
-					firstPass = false;
-
-				}
-
-				renderer.clear();
-				renderer.render( scene, camera );
-
-			}
-
-		</script>
-
-	</body>
-</html>

+ 1 - 1
examples/webgl_materials_car.html

@@ -238,7 +238,7 @@
 
 				} );
 
-				bodyMatSelect.selectedIndex = 3;
+				bodyMatSelect.selectedIndex = 2;
 				rimMatSelect.selectedIndex = 5;
 				glassMatSelect.selectedIndex = 0;
 

+ 1 - 1
examples/webgl_materials_physical_transparency.html

@@ -39,7 +39,7 @@
 			var hdrEquirect = new RGBELoader()
 				.setDataType( THREE.UnsignedByteType )
 				.setPath( 'textures/equirectangular/' )
-				.load( 'pedestrian_overpass_1k.hdr', function ( texture ) {
+				.load( 'royal_esplanade_1k.hdr', function ( texture ) {
 
 					init();
 					animate();

+ 5 - 5
examples/webgl_materials_reflectivity.html

@@ -57,7 +57,7 @@
 				gemBackMaterial = new THREE.MeshPhysicalMaterial( {
 					map: null,
 					color: 0x0000ff,
-					metalness: 1.0,
+					metalness: 1,
 					roughness: 0,
 					opacity: 0.5,
 					side: THREE.BackSide,
@@ -70,12 +70,12 @@
 				gemFrontMaterial = new THREE.MeshPhysicalMaterial( {
 					map: null,
 					color: 0x0000ff,
-					metalness: 0.0,
+					metalness: 0,
 					roughness: 0,
-					opacity: 0.15,
+					opacity: 0.25,
 					side: THREE.FrontSide,
 					transparent: true,
-					envMapIntensity: 5,
+					envMapIntensity: 10,
 					premultipliedAlpha: true
 				} );
 
@@ -114,7 +114,7 @@
 				new RGBELoader()
 					.setDataType( THREE.UnsignedByteType )
 					.setPath( 'textures/equirectangular/' )
-					.load( 'pedestrian_overpass_1k.hdr', function ( hdrEquirect ) {
+					.load( 'royal_esplanade_1k.hdr', function ( hdrEquirect ) {
 
 						hdrCubeRenderTarget = pmremGenerator.fromEquirectangular( hdrEquirect );
 						pmremGenerator.dispose();

+ 0 - 293
examples/webgl_materials_skin.html

@@ -1,293 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<title>three.js webgl - materials - skin [Lee Perry-Smith]</title>
-		<meta charset="utf-8">
-		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
-		<link type="text/css" rel="stylesheet" href="main.css">
-	</head>
-	<body>
-
-		<div id="info">
-			<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> - webgl skin rendering demo.<br/>
-			<a href="http://graphics.cs.williams.edu/data/meshes.xml#14" target="_blank" rel="noopener">Lee Perry-Smith</a> head.
-		</div>
-
-		<script type="module">
-
-			import * as THREE from '../build/three.module.js';
-
-			import Stats from './jsm/libs/stats.module.js';
-
-			import { GLTFLoader } from './jsm/loaders/GLTFLoader.js';
-			import { EffectComposer } from './jsm/postprocessing/EffectComposer.js';
-			import { RenderPass } from './jsm/postprocessing/RenderPass.js';
-			import { ShaderPass } from './jsm/postprocessing/ShaderPass.js';
-			import { BloomPass } from './jsm/postprocessing/BloomPass.js';
-			import { TexturePass } from './jsm/postprocessing/TexturePass.js';
-
-			import { SkinShaderAdvanced, SkinShaderBeckmann } from './jsm/shaders/SkinShader.js';
-
-			var statsEnabled = true;
-
-			var container, stats, loader;
-
-			var camera, scene, renderer;
-
-			var mesh;
-
-			var composer, composerUV1, composerUV2, composerUV3, composerBeckmann;
-
-			var directionalLight;
-
-			var mouseX = 0, mouseY = 0;
-			var targetX = 0, targetY = 0;
-
-			var windowHalfX = window.innerWidth / 2;
-			var windowHalfY = window.innerHeight / 2;
-
-			var firstPass = true;
-
-			init();
-			animate();
-
-			function init() {
-
-				container = document.createElement( 'div' );
-				document.body.appendChild( container );
-
-				camera = new THREE.PerspectiveCamera( 35, window.innerWidth / window.innerHeight, 1, 10000 );
-				camera.position.z = 900;
-
-				scene = new THREE.Scene();
-				scene.background = new THREE.Color( 0x050505 );
-
-				// LIGHTS
-
-				directionalLight = new THREE.DirectionalLight( 0xffeedd, 1.5 );
-				directionalLight.position.set( 1, 0.5, 1 );
-				scene.add( directionalLight );
-
-				directionalLight = new THREE.DirectionalLight( 0xddddff, 0.5 );
-				directionalLight.position.set( - 1, 0.5, - 1 );
-				scene.add( directionalLight );
-
-				// MATERIALS
-
-				var diffuse = 0xbbbbbb, specular = 0x555555;
-
-				var shader = SkinShaderAdvanced;
-
-				var uniformsUV = THREE.UniformsUtils.clone( shader.uniforms );
-
-				var textureLoader = new THREE.TextureLoader();
-
-				uniformsUV[ "tNormal" ].value = textureLoader.load( "models/gltf/LeePerrySmith/Infinite-Level_02_Tangent_SmoothUV.jpg" );
-				uniformsUV[ "uNormalScale" ].value = - 1.5;
-
-				uniformsUV[ "tDiffuse" ].value = textureLoader.load( "models/gltf/LeePerrySmith/Map-COL.jpg" );
-
-				uniformsUV[ "passID" ].value = 0;
-
-				uniformsUV[ "diffuse" ].value.setHex( diffuse );
-				uniformsUV[ "specular" ].value.setHex( specular );
-
-				uniformsUV[ "uRoughness" ].value = 0.185;
-				uniformsUV[ "uSpecularBrightness" ].value = 0.7;
-
-
-				var uniforms = THREE.UniformsUtils.clone( uniformsUV );
-				uniforms[ "tDiffuse" ].value = uniformsUV[ "tDiffuse" ].value;
-				uniforms[ "tNormal" ].value = uniformsUV[ "tNormal" ].value;
-				uniforms[ "passID" ].value = 1;
-
-
-				var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms, lights: true };
-				var parametersUV = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShaderUV, uniforms: uniformsUV, lights: true };
-
-				var material = new THREE.ShaderMaterial( parameters );
-				material.extensions.derivatives = true;
-
-				var materialUV = new THREE.ShaderMaterial( parametersUV );
-				materialUV.extensions.derivatives = true;
-
-				// LOADER
-
-				loader = new GLTFLoader();
-				loader.load( "models/gltf/LeePerrySmith/LeePerrySmith.glb", function ( gltf ) {
-
-					createScene( gltf.scene.children[ 0 ].geometry, 100, material );
-
-				} );
-
-				// RENDERER
-
-				renderer = new THREE.WebGLRenderer();
-				renderer.setPixelRatio( window.devicePixelRatio );
-				renderer.setSize( window.innerWidth, window.innerHeight );
-				renderer.autoClear = false;
-
-				container.appendChild( renderer.domElement );
-
-				// STATS
-
-				if ( statsEnabled ) {
-
-					stats = new Stats();
-					container.appendChild( stats.dom );
-
-				}
-
-				// EVENTS
-
-				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
-
-				// POSTPROCESSING
-
-				var renderModelUV = new RenderPass( scene, camera, materialUV, new THREE.Color( 0x575757 ) );
-
-				var effectBloom1 = new BloomPass( 1, 15, 2, 512 );
-				var effectBloom2 = new BloomPass( 1, 25, 3, 512 );
-				var effectBloom3 = new BloomPass( 1, 25, 4, 512 );
-
-				effectBloom1.clear = true;
-				effectBloom2.clear = true;
-				effectBloom3.clear = true;
-
-				//
-
-				var pars = {
-					generateMipmaps: true,
-					minFilter: THREE.LinearMipmapLinearFilter,
-					magFilter: THREE.LinearFilter,
-					format: THREE.RGBFormat,
-					stencilBuffer: false
-				};
-
-				var rtwidth = 512;
-				var rtheight = 512;
-
-				//
-
-				composer = new EffectComposer( renderer, new THREE.WebGLRenderTarget( rtwidth, rtheight, pars ) );
-				composer.addPass( renderModelUV );
-				composer.renderToScreen = false;
-
-				var renderScene = new TexturePass( composer.renderTarget2.texture );
-
-				//
-
-				composerUV1 = new EffectComposer( renderer, new THREE.WebGLRenderTarget( rtwidth, rtheight, pars ) );
-
-				composerUV1.addPass( renderScene );
-				composerUV1.addPass( effectBloom1 );
-				composerUV1.renderToScreen = false;
-
-				composerUV2 = new EffectComposer( renderer, new THREE.WebGLRenderTarget( rtwidth, rtheight, pars ) );
-
-				composerUV2.addPass( renderScene );
-				composerUV2.addPass( effectBloom2 );
-				composerUV2.renderToScreen = false;
-
-				composerUV3 = new EffectComposer( renderer, new THREE.WebGLRenderTarget( rtwidth, rtheight, pars ) );
-
-				composerUV3.addPass( renderScene );
-				composerUV3.addPass( effectBloom3 );
-				composerUV3.renderToScreen = false;
-
-				//
-
-				var effectBeckmann = new ShaderPass( SkinShaderBeckmann );
-				composerBeckmann = new EffectComposer( renderer, new THREE.WebGLRenderTarget( rtwidth, rtheight, pars ) );
-				composerBeckmann.addPass( effectBeckmann );
-
-				//
-
-				uniforms[ "tBlur1" ].value = composer.renderTarget2.texture;
-				uniforms[ "tBlur2" ].value = composerUV1.renderTarget2.texture;
-				uniforms[ "tBlur3" ].value = composerUV2.renderTarget2.texture;
-				uniforms[ "tBlur4" ].value = composerUV3.renderTarget2.texture;
-
-				uniforms[ "tBeckmann" ].value = composerBeckmann.renderTarget1.texture;
-
-				//
-
-				window.addEventListener( 'resize', onWindowResize, false );
-
-			}
-
-			function onWindowResize() {
-
-				windowHalfX = window.innerWidth / 2;
-				windowHalfY = window.innerHeight / 2;
-
-				camera.aspect = window.innerWidth / window.innerHeight;
-				camera.updateProjectionMatrix();
-
-				renderer.setSize( window.innerWidth, window.innerHeight );
-
-			}
-
-			function createScene( geometry, scale, material ) {
-
-				mesh = new THREE.Mesh( geometry, material );
-				mesh.position.y = - 50;
-				mesh.scale.set( scale, scale, scale );
-
-				scene.add( mesh );
-
-			}
-
-			function onDocumentMouseMove( event ) {
-
-				mouseX = ( event.clientX - windowHalfX );
-				mouseY = ( event.clientY - windowHalfY );
-
-			}
-
-			//
-
-			function animate() {
-
-				requestAnimationFrame( animate );
-
-				render();
-				if ( statsEnabled ) stats.update();
-
-			}
-
-			function render() {
-
-				targetX = mouseX * .001;
-				targetY = mouseY * .001;
-
-				if ( mesh ) {
-
-					mesh.rotation.y += 0.05 * ( targetX - mesh.rotation.y );
-					mesh.rotation.x += 0.05 * ( targetY - mesh.rotation.x );
-
-				}
-
-				renderer.clear();
-
-				if ( firstPass ) {
-
-					composerBeckmann.render();
-					firstPass = false;
-
-				}
-
-				composer.render();
-
-				composerUV1.render();
-				composerUV2.render();
-				composerUV3.render();
-
-				renderer.render( scene, camera );
-
-			}
-
-		</script>
-
-	</body>
-</html>

+ 7 - 15
examples/webgl_materials_variations_toon.html

@@ -43,14 +43,8 @@
 
 				//
 
-				var reflectionCube = new THREE.CubeTextureLoader()
-					.setPath( 'textures/cube/SwedishRoyalCastle/' )
-					.load( [ 'px.jpg', 'nx.jpg', 'py.jpg', 'ny.jpg', 'pz.jpg', 'nz.jpg' ] );
-				reflectionCube.format = THREE.RGBFormat;
-				reflectionCube.encoding = THREE.sRGBEncoding;
-
 				scene = new THREE.Scene();
-				scene.background = reflectionCube;
+				scene.background = new THREE.Color( 0x444488 );
 
 				// Materials
 
@@ -132,18 +126,21 @@
 				addLabel( "-diffuse", new THREE.Vector3( 0, 0, - 300 ) );
 				addLabel( "+diffuse", new THREE.Vector3( 0, 0, 300 ) );
 
-				particleLight = new THREE.Mesh( new THREE.SphereBufferGeometry( 4, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0xffffff } ) );
+				particleLight = new THREE.Mesh(
+					new THREE.SphereBufferGeometry( 4, 8, 8 ),
+					new THREE.MeshBasicMaterial( { color: 0xffffff } )
+				);
 				scene.add( particleLight );
 
 				// Lights
 
-				scene.add( new THREE.AmbientLight( 0x222222 ) );
+				scene.add( new THREE.AmbientLight( 0x111111 ) );
 
 				var directionalLight = new THREE.DirectionalLight( 0xffffff, 1 );
 				directionalLight.position.set( 1, 1, 1 ).normalize();
 				scene.add( directionalLight );
 
-				var pointLight = new THREE.PointLight( 0xffffff, 2, 800 );
+				var pointLight = new THREE.PointLight( 0xffffff, 1, 800 );
 				particleLight.add( pointLight );
 
 				//
@@ -192,11 +189,6 @@
 
 				var timer = Date.now() * 0.00025;
 
-				//camera.position.x = Math.cos( timer ) * 800;
-				//camera.position.z = Math.sin( timer ) * 800;
-
-				camera.lookAt( scene.position );
-
 				particleLight.position.x = Math.sin( timer * 7 ) * 300;
 				particleLight.position.y = Math.cos( timer * 5 ) * 400;
 				particleLight.position.z = Math.cos( timer * 3 ) * 300;

+ 7 - 27
examples/webgl_postprocessing_dof2.html

@@ -85,22 +85,7 @@
 				var textureCube = new THREE.CubeTextureLoader().load( urls );
 				textureCube.format = THREE.RGBFormat;
 
-				var shader = THREE.ShaderLib[ 'cube' ];
-
-				var skyMaterial = new THREE.ShaderMaterial( {
-
-					fragmentShader: shader.fragmentShader,
-					vertexShader: shader.vertexShader,
-					uniforms: shader.uniforms,
-					depthWrite: false,
-					side: THREE.BackSide
-
-				} );
-
-				skyMaterial.envMap = textureCube;
-
-				var sky = new THREE.Mesh( new THREE.BoxBufferGeometry( 1000, 1000, 1000 ), skyMaterial );
-				scene.add( sky );
+				scene.background = textureCube;
 
 				// plane particles
 
@@ -444,22 +429,17 @@
 
 					var intersects = raycaster.intersectObjects( scene.children, true );
 
+					var targetDistance = ( intersects.length > 0 ) ? intersects[ 0 ].distance : 1000;
 
-					if ( intersects.length > 0 ) {
-
-						var targetDistance = intersects[ 0 ].distance;
-
-						distance += ( targetDistance - distance ) * 0.03;
+					distance += ( targetDistance - distance ) * 0.03;
 
-						var sdistance = smoothstep( camera.near, camera.far, distance );
+					var sdistance = smoothstep( camera.near, camera.far, distance );
 
-						var ldistance = linearize( 1 - sdistance );
+					var ldistance = linearize( 1 - sdistance );
 
-						postprocessing.bokeh_uniforms[ 'focalDepth' ].value = ldistance;
+					postprocessing.bokeh_uniforms[ 'focalDepth' ].value = ldistance;
 
-						effectController[ 'focalDepth' ] = ldistance;
-
-					}
+					effectController[ 'focalDepth' ] = ldistance;
 
 				}
 

+ 2 - 4
examples/webgl_tonemapping.html

@@ -31,7 +31,7 @@
 				opacity: 1.0,
 				roughness: 1.0,
 				bumpScale: 1.0,
-				exposure: 3.0,
+				exposure: 2.0,
 				whitePoint: 5.0,
 				toneMapping: "Uncharted2",
 				renderMode: "Renderer"
@@ -134,12 +134,10 @@
 				new RGBELoader()
 					.setDataType( THREE.UnsignedByteType )
 					.setPath( 'textures/equirectangular/' )
-					.load( 'pedestrian_overpass_1k.hdr', function ( hdrEquirect ) {
+					.load( 'venice_sunset_1k.hdr', function ( hdrEquirect ) {
 
 						scene.environment = pmremGenerator.fromEquirectangular( hdrEquirect ).texture;
 
-						standardMaterial.needsUpdate = true; // TODO(mrdoob) Should WebGLRenderer handle this?
-
 						hdrEquirect.dispose();
 						pmremGenerator.dispose();
 

+ 101 - 0
examples/webxr_ar_cones.html

@@ -0,0 +1,101 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<title>three.js ar - cones</title>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
+		<link type="text/css" rel="stylesheet" href="main.css">
+	</head>
+	<body>
+
+		<div id="info">
+			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> ar - cones<br/>Enable chrome://flags/#webxr-ar-module<br/>(Chrome 80+)
+		</div>
+
+		<script type="module">
+
+			import * as THREE from '../build/three.module.js';
+			import { ARButton } from './jsm/webxr/ARButton.js';
+
+			var container;
+			var camera, scene, renderer;
+			var controller;
+
+			init();
+			animate();
+
+			function init() {
+
+				container = document.createElement( 'div' );
+				document.body.appendChild( container );
+
+				scene = new THREE.Scene();
+
+				camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.01, 20 );
+
+				var light = new THREE.HemisphereLight( 0xffffff, 0xbbbbff, 1 );
+				light.position.set( 0.5, 1, 0.25 );
+				scene.add( light );
+
+				//
+
+				renderer = new THREE.WebGLRenderer( { antialias: true, alpha: true } );
+				renderer.setPixelRatio( window.devicePixelRatio );
+				renderer.setSize( window.innerWidth, window.innerHeight );
+				renderer.xr.enabled = true;
+				container.appendChild( renderer.domElement );
+
+				//
+
+				document.body.appendChild( ARButton.createButton( renderer ) );
+
+				//
+
+				var geometry = new THREE.CylinderBufferGeometry( 0, 0.05, 0.2, 32 ).rotateX( Math.PI / 2 );
+
+				function onSelect() {
+
+					var material = new THREE.MeshPhongMaterial( { color: 0xffffff * Math.random() } );
+					var mesh = new THREE.Mesh( geometry, material );
+					mesh.position.set( 0, 0, - 0.3 ).applyMatrix4( controller.matrixWorld );
+					mesh.quaternion.setFromRotationMatrix( controller.matrixWorld );
+					scene.add( mesh );
+
+				}
+
+				controller = renderer.xr.getController( 0 );
+				controller.addEventListener( 'select', onSelect );
+				scene.add( controller );
+
+				//
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function onWindowResize() {
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
+			}
+
+			//
+
+			function animate() {
+
+				renderer.setAnimationLoop( render );
+
+			}
+
+			function render() {
+
+				renderer.render( scene, camera );
+
+			}
+
+		</script>
+	</body>
+</html>

+ 157 - 0
examples/webxr_ar_hittest.html

@@ -0,0 +1,157 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<title>three.js ar - hit test</title>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
+		<link type="text/css" rel="stylesheet" href="main.css">
+	</head>
+	<body>
+
+		<div id="info">
+			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> ar - hit test<br/>Enable chrome://flags/#webxr-ar-module<br/>Enable chrome://flags/#webxr-hit-test<br/>(Chrome 80+)
+		</div>
+
+		<script type="module">
+
+			import * as THREE from '../build/three.module.js';
+			import { ARButton } from './jsm/webxr/ARButton.js';
+
+			var container;
+			var camera, scene, renderer;
+			var controller;
+
+			var matrix, ray, reticle;
+
+			init();
+			animate();
+
+			function init() {
+
+				container = document.createElement( 'div' );
+				document.body.appendChild( container );
+
+				scene = new THREE.Scene();
+
+				camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.01, 20 );
+
+				var light = new THREE.HemisphereLight( 0xffffff, 0xbbbbff, 1 );
+				light.position.set( 0.5, 1, 0.25 );
+				scene.add( light );
+
+				//
+
+				renderer = new THREE.WebGLRenderer( { antialias: true, alpha: true } );
+				renderer.setPixelRatio( window.devicePixelRatio );
+				renderer.setSize( window.innerWidth, window.innerHeight );
+				renderer.xr.enabled = true;
+				container.appendChild( renderer.domElement );
+
+				//
+
+				document.body.appendChild( ARButton.createButton( renderer ) );
+
+				//
+
+				var geometry = new THREE.CylinderBufferGeometry( 0.1, 0.1, 0.2, 32 ).translate( 0, 0.1, 0 );
+
+				function onSelect() {
+
+					if ( reticle.visible ) {
+
+						var material = new THREE.MeshPhongMaterial( { color: 0xffffff * Math.random() } );
+						var mesh = new THREE.Mesh( geometry, material );
+						mesh.position.setFromMatrixPosition( reticle.matrix );
+						mesh.scale.y = Math.random() * 2 + 1;
+						scene.add( mesh );
+
+					}
+
+				}
+
+				controller = renderer.xr.getController( 0 );
+				controller.addEventListener( 'select', onSelect );
+				scene.add( controller );
+
+				matrix = new THREE.Matrix4();
+
+				ray = new THREE.Ray();
+
+				reticle = new THREE.Mesh(
+					new THREE.RingBufferGeometry( 0.15, 0.2, 32 ).rotateX( - Math.PI / 2 ),
+					new THREE.MeshBasicMaterial()
+				);
+				reticle.matrixAutoUpdate = false;
+				reticle.visible = false;
+				scene.add( reticle );
+
+				//
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function onWindowResize() {
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
+			}
+
+			//
+
+			function animate() {
+
+				renderer.setAnimationLoop( render );
+
+			}
+
+			function render( timestamp, frame ) {
+
+				if ( frame ) {
+
+					var referenceSpace = renderer.xr.getReferenceSpace();
+					var session = renderer.xr.getSession();
+					var pose = frame.getViewerPose( referenceSpace );
+
+					if ( pose ) {
+
+						matrix.fromArray( pose.transform.matrix );
+
+						ray.origin.set( 0, 0, 0 );
+						ray.direction.set( 0, 0, - 1 );
+						ray.applyMatrix4( matrix );
+
+						var xrRay = new XRRay( ray.origin, ray.direction );
+
+						session.requestHitTest( xrRay, referenceSpace )
+							.then( function ( results ) {
+
+								if ( results.length ) {
+
+									var hitResult = results[ 0 ];
+
+									reticle.visible = true;
+									reticle.matrix.fromArray( hitResult.hitMatrix );
+
+								} else {
+
+									reticle.visible = false;
+
+								}
+
+							} );
+
+					}
+
+				}
+
+				renderer.render( scene, camera );
+
+			}
+
+		</script>
+	</body>
+</html>

+ 41 - 8
examples/webxr_vr_ballshooter.html

@@ -103,23 +103,32 @@
 				controller1 = renderer.xr.getController( 0 );
 				controller1.addEventListener( 'selectstart', onSelectStart );
 				controller1.addEventListener( 'selectend', onSelectEnd );
+				controller1.addEventListener( 'connected', function ( event ) {
+
+					this.add( buildController( event.data ) );
+
+				} );
+				controller1.addEventListener( 'disconnected', function () {
+
+					this.remove( this.children[ 0 ] );
+
+				} );
 				scene.add( controller1 );
 
 				controller2 = renderer.xr.getController( 1 );
 				controller2.addEventListener( 'selectstart', onSelectStart );
 				controller2.addEventListener( 'selectend', onSelectEnd );
-				scene.add( controller2 );
+				controller2.addEventListener( 'connected', function ( event ) {
 
-				// helpers
+					this.add( buildController( event.data ) );
 
-				var geometry = new THREE.BufferGeometry();
-				geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( [ 0, 0, 0, 0, 0, - 1 ], 3 ) );
-				geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( [ 0.5, 0.5, 0.5, 0, 0, 0 ], 3 ) );
+				} );
+				controller2.addEventListener( 'disconnected', function () {
 
-				var material = new THREE.LineBasicMaterial( { vertexColors: true, blending: THREE.AdditiveBlending } );
+					this.remove( this.children[ 0 ] );
 
-				controller1.add( new THREE.Line( geometry, material ) );
-				controller2.add( new THREE.Line( geometry, material ) );
+				} );
+				scene.add( controller2 );
 
 				//
 
@@ -127,6 +136,30 @@
 
 			}
 
+			function buildController( data ) {
+
+				switch ( data.targetRayMode ) {
+
+					case 'tracked-pointer':
+
+						var geometry = new THREE.BufferGeometry();
+						geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( [ 0, 0, 0, 0, 0, - 1 ], 3 ) );
+						geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( [ 0.5, 0.5, 0.5, 0, 0, 0 ], 3 ) );
+
+						var material = new THREE.LineBasicMaterial( { vertexColors: true, blending: THREE.AdditiveBlending } );
+
+						return new THREE.Line( geometry, material );
+
+					case 'gaze':
+
+						var geometry = new THREE.RingBufferGeometry( 0.02, 0.04, 32 ).translate( 0, 0, - 1 );
+						var material = new THREE.MeshBasicMaterial( { opacity: 0.5, transparent: true } );
+						return new THREE.Mesh( geometry, material );
+
+				}
+
+			}
+
 			function onWindowResize() {
 
 				camera.aspect = window.innerWidth / window.innerHeight;

+ 48 - 49
examples/webxr_vr_cubes.html

@@ -27,10 +27,9 @@
 			var camera, scene, raycaster, renderer;
 
 			var room;
-			var isMouseDown = false;
 
+			var controller, tempMatrix = new THREE.Matrix4();
 			var INTERSECTED;
-			var crosshair;
 
 			init();
 			animate();
@@ -47,22 +46,10 @@
 				camera.position.set( 0, 1.6, 3 );
 				scene.add( camera );
 
-				crosshair = new THREE.Mesh(
-					new THREE.RingBufferGeometry( 0.02, 0.04, 32 ),
-					new THREE.MeshBasicMaterial( {
-						color: 0xffffff,
-						opacity: 0.5,
-						transparent: true
-					} )
-				);
-				crosshair.position.z = - 2;
-				camera.add( crosshair );
-
 				room = new THREE.LineSegments(
-					new BoxLineGeometry( 6, 6, 6, 10, 10, 10 ),
+					new BoxLineGeometry( 6, 6, 6, 10, 10, 10 ).translate( 0, 3, 0 ),
 					new THREE.LineBasicMaterial( { color: 0x808080 } )
 				);
-				room.position.y = 3;
 				scene.add( room );
 
 				scene.add( new THREE.HemisphereLight( 0x606060, 0x404040 ) );
@@ -78,7 +65,7 @@
 					var object = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: Math.random() * 0xffffff } ) );
 
 					object.position.x = Math.random() * 4 - 2;
-					object.position.y = Math.random() * 4 - 2;
+					object.position.y = Math.random() * 4;
 					object.position.z = Math.random() * 4 - 2;
 
 					object.rotation.x = Math.random() * 2 * Math.PI;
@@ -106,52 +93,62 @@
 				renderer.xr.enabled = true;
 				container.appendChild( renderer.domElement );
 
-				renderer.domElement.addEventListener( 'mousedown', onMouseDown, false );
-				renderer.domElement.addEventListener( 'mouseup', onMouseUp, false );
-				renderer.domElement.addEventListener( 'touchstart', onMouseDown, false );
-				renderer.domElement.addEventListener( 'touchend', onMouseUp, false );
+				//
 
-				window.addEventListener( 'resize', onWindowResize, false );
+				function onSelectStart() {
 
-				//
+					this.userData.isSelecting = true;
 
-				window.addEventListener( 'vrdisplaypointerrestricted', onPointerRestricted, false );
-				window.addEventListener( 'vrdisplaypointerunrestricted', onPointerUnrestricted, false );
+				}
 
-				document.body.appendChild( VRButton.createButton( renderer ) );
+				function onSelectEnd() {
 
-			}
+					this.userData.isSelecting = false;
 
-			function onMouseDown() {
+				}
 
-				isMouseDown = true;
+				controller = renderer.xr.getController( 0 );
+				controller.addEventListener( 'selectstart', onSelectStart );
+				controller.addEventListener( 'selectend', onSelectEnd );
+				controller.addEventListener( 'connected', function ( event ) {
 
-			}
+					this.add( buildController( event.data ) );
 
-			function onMouseUp() {
+				} );
+				controller.addEventListener( 'disconnected', function () {
 
-				isMouseDown = false;
+					this.remove( this.children[ 0 ] );
+
+				} );
+				scene.add( controller );
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+				//
+
+				document.body.appendChild( VRButton.createButton( renderer ) );
 
 			}
 
-			function onPointerRestricted() {
+			function buildController( data ) {
 
-				var pointerLockElement = renderer.domElement;
-				if ( pointerLockElement && typeof ( pointerLockElement.requestPointerLock ) === 'function' ) {
+				switch ( data.targetRayMode ) {
 
-					pointerLockElement.requestPointerLock();
+					case 'tracked-pointer':
 
-				}
+						var geometry = new THREE.BufferGeometry();
+						geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( [ 0, 0, 0, 0, 0, - 1 ], 3 ) );
+						geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( [ 0.5, 0.5, 0.5, 0, 0, 0 ], 3 ) );
 
-			}
+						var material = new THREE.LineBasicMaterial( { vertexColors: true, blending: THREE.AdditiveBlending } );
 
-			function onPointerUnrestricted() {
+						return new THREE.Line( geometry, material );
 
-				var currentPointerLockElement = document.pointerLockElement;
-				var expectedPointerLockElement = renderer.domElement;
-				if ( currentPointerLockElement && currentPointerLockElement === expectedPointerLockElement && typeof ( document.exitPointerLock ) === 'function' ) {
+					case 'gaze':
 
-					document.exitPointerLock();
+						var geometry = new THREE.RingBufferGeometry( 0.02, 0.04, 32 ).translate( 0, 0, - 1 );
+						var material = new THREE.MeshBasicMaterial( { opacity: 0.5, transparent: true } );
+						return new THREE.Mesh( geometry, material );
 
 				}
 
@@ -178,24 +175,26 @@
 
 				var delta = clock.getDelta() * 60;
 
-				if ( isMouseDown === true ) {
+				if ( controller.userData.isSelecting === true ) {
 
 					var cube = room.children[ 0 ];
 					room.remove( cube );
 
-					cube.position.set( 0, 0, - 0.75 );
-					cube.position.applyQuaternion( camera.quaternion );
+					cube.position.copy( controller.position );
 					cube.userData.velocity.x = ( Math.random() - 0.5 ) * 0.02 * delta;
 					cube.userData.velocity.y = ( Math.random() - 0.5 ) * 0.02 * delta;
 					cube.userData.velocity.z = ( Math.random() * 0.01 - 0.05 ) * delta;
-					cube.userData.velocity.applyQuaternion( camera.quaternion );
+					cube.userData.velocity.applyQuaternion( controller.quaternion );
 					room.add( cube );
 
 				}
 
 				// find intersections
 
-				raycaster.setFromCamera( { x: 0, y: 0 }, camera );
+				tempMatrix.identity().extractRotation( controller.matrixWorld );
+
+				raycaster.ray.origin.setFromMatrixPosition( controller.matrixWorld );
+				raycaster.ray.direction.set( 0, 0, - 1 ).applyMatrix4( tempMatrix );
 
 				var intersects = raycaster.intersectObjects( room.children );
 
@@ -236,9 +235,9 @@
 
 					}
 
-					if ( cube.position.y < - 3 || cube.position.y > 3 ) {
+					if ( cube.position.y < 0 || cube.position.y > 6 ) {
 
-						cube.position.y = THREE.Math.clamp( cube.position.y, - 3, 3 );
+						cube.position.y = THREE.Math.clamp( cube.position.y, 0, 6 );
 						cube.userData.velocity.y = - cube.userData.velocity.y;
 
 					}

+ 2 - 2
examples/webxr_vr_panorama_depth.html

@@ -35,7 +35,7 @@
 				scene = new THREE.Scene();
 				scene.background = new THREE.Color( 0x101010 );
 
-				var light = new THREE.AmbientLight( 0x404040, 10 );
+				var light = new THREE.AmbientLight( 0xffffff, 1 );
 				scene.add( light );
 
 				camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 2000 );
@@ -115,7 +115,7 @@
 
 				// If we are not presenting move the camera a little so the effect is visible
 
-				if ( renderer.xr.isPresenting() === false ) {
+				if ( renderer.xr.isPresenting === false ) {
 
 					var time = clock.getElapsedTime();
 

+ 2 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "three",
-  "version": "0.111.0",
+  "version": "0.112.0",
   "description": "JavaScript 3D library",
   "main": "build/three.js",
   "module": "build/three.module.js",
@@ -53,6 +53,7 @@
     "dev-test": "concurrently --names \"ROLLUP,ROLLUPTEST,HTTP\" -c \"bgBlue.bold,bgRed.bold,bgGreen.bold\" \"rollup -c utils/build/rollup.config.js -w -m inline\" \"rollup -c test/rollup.unit.config.js -w -m inline\" \"http-server -p 8080\"",
     "start": "npm run dev",
     "lint": "eslint src --ext js --ext ts && tsc -p utils/build/tsconfig.lint.json",
+    "lint-examples": "eslint examples/jsm --ext js --ext ts --ignore-pattern libs && tsc -p utils/build/tsconfig-examples.lint.json",
     "test": "npm run build-test && qunit -r failonlyreporter test/unit/three.source.unit.js",
     "travis": "npm run lint && npm test"
   },

+ 1 - 1
src/constants.js

@@ -1,4 +1,4 @@
-export var REVISION = '112dev';
+export var REVISION = '112';
 export var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
 export var TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
 export var CullFaceNone = 0;

+ 2 - 0
src/materials/MeshDepthMaterial.d.ts

@@ -3,6 +3,7 @@ import { MaterialParameters, Material } from './Material';
 import { Texture } from './../textures/Texture';
 
 export interface MeshDepthMaterialParameters extends MaterialParameters {
+	map?: Texture | null;
 	alphaMap?: Texture | null;
 	depthPacking?: DepthPackingStrategies;
 	displacementMap?: Texture | null;
@@ -16,6 +17,7 @@ export class MeshDepthMaterial extends Material {
 
 	constructor( parameters?: MeshDepthMaterialParameters );
 
+	map: Texture | null;
 	alphaMap: Texture | null;
 	depthPacking: DepthPackingStrategies;
 	displacementMap: Texture | null;

+ 2 - 0
src/materials/MeshDistanceMaterial.d.ts

@@ -3,6 +3,7 @@ import { Vector3 } from './../math/Vector3';
 import { Texture } from './../textures/Texture';
 
 export interface MeshDistanceMaterialParameters extends MaterialParameters {
+	map?: Texture | null;
 	alphaMap?: Texture | null;
 	displacementMap?: Texture | null;
 	displacementScale?: number;
@@ -16,6 +17,7 @@ export class MeshDistanceMaterial extends Material {
 
 	constructor( parameters?: MeshDistanceMaterialParameters );
 
+	map: Texture | null;
 	alphaMap: Texture | null;
 	displacementMap: Texture | null;
 	displacementScale: number;

+ 8 - 3
src/renderers/WebGLRenderer.js

@@ -382,7 +382,7 @@ function WebGLRenderer( parameters ) {
 
 	this.setSize = function ( width, height, updateStyle ) {
 
-		if ( xr.isPresenting() ) {
+		if ( xr.isPresenting ) {
 
 			console.warn( 'THREE.WebGLRenderer: Can\'t change size while VR device is presenting.' );
 			return;
@@ -1087,7 +1087,7 @@ function WebGLRenderer( parameters ) {
 
 	function onAnimationFrame( time ) {
 
-		if ( xr.isPresenting() ) return;
+		if ( xr.isPresenting ) return;
 		if ( onAnimationFrameCallback ) onAnimationFrameCallback( time );
 
 	}
@@ -1151,7 +1151,7 @@ function WebGLRenderer( parameters ) {
 
 		if ( camera.parent === null ) camera.updateMatrixWorld();
 
-		if ( xr.enabled && xr.isPresenting() ) {
+		if ( xr.enabled && xr.isPresenting ) {
 
 			camera = xr.getCamera( camera );
 
@@ -1566,6 +1566,7 @@ function WebGLRenderer( parameters ) {
 			program = programCache.acquireProgram( material, materialProperties.shader, parameters, programCacheKey );
 
 			materialProperties.program = program;
+			materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;
 			materialProperties.outputEncoding = _this.outputEncoding;
 			material.program = program;
 
@@ -1693,6 +1694,10 @@ function WebGLRenderer( parameters ) {
 
 				material.needsUpdate = true;
 
+			} else if ( materialProperties.environment !== environment ) {
+
+				material.needsUpdate = true;
+
 			} else if ( materialProperties.needsLights && ( materialProperties.lightsStateVersion !== lights.state.version ) ) {
 
 				material.needsUpdate = true;

+ 60 - 33
src/renderers/webxr/WebXRManager.js

@@ -24,13 +24,7 @@ function WebXRManager( renderer, gl ) {
 	var pose = null;
 
 	var controllers = [];
-	var sortedInputSources = [];
-
-	function isPresenting() {
-
-		return session !== null && referenceSpace !== null;
-
-	}
+	var inputSourcesMap = new Map();
 
 	//
 
@@ -50,6 +44,8 @@ function WebXRManager( renderer, gl ) {
 
 	this.enabled = false;
 
+	this.isPresenting = false;
+
 	this.getController = function ( id ) {
 
 		var controller = controllers[ id ];
@@ -72,13 +68,11 @@ function WebXRManager( renderer, gl ) {
 
 	function onSessionEvent( event ) {
 
-		for ( var i = 0; i < controllers.length; i ++ ) {
-
-			if ( sortedInputSources[ i ] === event.inputSource ) {
+		var controller = inputSourcesMap.get( event.inputSource );
 
-				controllers[ i ].dispatchEvent( { type: event.type } );
+		if ( controller ) {
 
-			}
+			controller.dispatchEvent( { type: event.type } );
 
 		}
 
@@ -86,12 +80,25 @@ function WebXRManager( renderer, gl ) {
 
 	function onSessionEnd() {
 
+		inputSourcesMap.forEach( function ( controller, inputSource ) {
+
+			controller.dispatchEvent( { type: 'disconnected', data: inputSource } );
+			controller.visible = false;
+
+		} );
+
+		inputSourcesMap.clear();
+
+		//
+
 		renderer.setFramebuffer( null );
 		renderer.setRenderTarget( renderer.getRenderTarget() ); // Hack #15830
 		animation.stop();
 
 		scope.dispatchEvent( { type: 'sessionend' } );
 
+		scope.isPresenting = false;
+
 	}
 
 	function onRequestReferenceSpace( value ) {
@@ -103,6 +110,8 @@ function WebXRManager( renderer, gl ) {
 
 		scope.dispatchEvent( { type: 'sessionstart' } );
 
+		scope.isPresenting = true;
+
 	}
 
 	this.setFramebufferScaleFactor = function ( /* value */ ) {
@@ -117,6 +126,12 @@ function WebXRManager( renderer, gl ) {
 
 	};
 
+	this.getReferenceSpace = function () {
+
+		return referenceSpace;
+
+	};
+
 	this.getSession = function () {
 
 		return session;
@@ -157,33 +172,50 @@ function WebXRManager( renderer, gl ) {
 
 			session.addEventListener( 'inputsourceschange', updateInputSources );
 
-			updateInputSources();
-
 		}
 
 	};
 
-	function updateInputSources() {
+	function updateInputSources( event ) {
+
+		var inputSources = session.inputSources;
+
+		// Assign inputSources to available controllers
 
 		for ( var i = 0; i < controllers.length; i ++ ) {
 
-			sortedInputSources[ i ] = findInputSource( i );
+			inputSourcesMap.set( inputSources[ i ], controllers[ i ] );
 
 		}
 
-	}
+		// Notify disconnected
 
-	function findInputSource( id ) {
+		for ( var i = 0; i < event.removed.length; i ++ ) {
 
-		var inputSources = session.inputSources;
+			var inputSource = event.removed[ i ];
+			var controller = inputSourcesMap.get( inputSource );
 
-		for ( var i = 0; i < inputSources.length; i ++ ) {
+			if ( controller ) {
 
-			var inputSource = inputSources[ i ];
-			var handedness = inputSource.handedness;
+				controller.dispatchEvent( { type: 'disconnected', data: inputSource } );
+				inputSourcesMap.delete( inputSource );
+
+			}
+
+		}
+
+		// Notify connected
+
+		for ( var i = 0; i < event.added.length; i ++ ) {
 
-			if ( id === 0 && ( handedness === 'none' || handedness === 'right' ) ) return inputSource;
-			if ( id === 1 && ( handedness === 'left' ) ) return inputSource;
+			var inputSource = event.added[ i ];
+			var controller = inputSourcesMap.get( inputSource );
+
+			if ( controller ) {
+
+				controller.dispatchEvent( { type: 'connected', data: inputSource } );
+
+			}
 
 		}
 
@@ -298,8 +330,6 @@ function WebXRManager( renderer, gl ) {
 
 	};
 
-	this.isPresenting = isPresenting;
-
 	// Animation Loop
 
 	var onAnimationFrameCallback = null;
@@ -338,11 +368,13 @@ function WebXRManager( renderer, gl ) {
 
 		//
 
+		var inputSources = session.inputSources;
+
 		for ( var i = 0; i < controllers.length; i ++ ) {
 
 			var controller = controllers[ i ];
 
-			var inputSource = sortedInputSources[ i ];
+			var inputSource = inputSources[ i ];
 
 			if ( inputSource ) {
 
@@ -352,12 +384,7 @@ function WebXRManager( renderer, gl ) {
 
 					controller.matrix.fromArray( inputPose.transform.matrix );
 					controller.matrix.decompose( controller.position, controller.rotation, controller.scale );
-
-					if ( inputSource.targetRayMode === 'pointing' ) {
-
-						controller.visible = true;
-
-					}
+					controller.visible = true;
 
 					continue;
 

+ 8 - 0
utils/build/tsconfig-examples.lint.json

@@ -0,0 +1,8 @@
+{
+  "compilerOptions": {
+    "noEmit": true,
+  },
+  "include": [
+    "../../examples/jsm/**/*.ts"
+  ]
+}

+ 1 - 1
utils/build/tsconfig.lint.json

@@ -3,6 +3,6 @@
     "noEmit": true,
   },
   "include": [
-    "../../**/*.ts"
+    "../../src/**/*.ts"
   ]
 }

+ 0 - 1
utils/modularize.js

@@ -210,7 +210,6 @@ var files = [
 	{ path: 'shaders/RGBShiftShader.js', dependencies: [], ignoreList: [] },
 	{ path: 'shaders/SAOShader.js', dependencies: [], ignoreList: [] },
 	{ path: 'shaders/SepiaShader.js', dependencies: [], ignoreList: [] },
-	{ path: 'shaders/SkinShader.js', dependencies: [], ignoreList: [] },
 	{ path: 'shaders/SMAAShader.js', dependencies: [], ignoreList: [] },
 	{ path: 'shaders/SobelOperatorShader.js', dependencies: [], ignoreList: [] },
 	{ path: 'shaders/SSAOShader.js', dependencies: [], ignoreList: [] },

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