소스 검색

Updated builds.

Mr.doob 3 년 전
부모
커밋
90165b4e55
4개의 변경된 파일215개의 추가작업 그리고 155개의 파일을 삭제
  1. 68 50
      build/three.cjs
  2. 68 50
      build/three.js
  3. 0 0
      build/three.min.js
  4. 79 55
      build/three.module.js

+ 68 - 50
build/three.cjs

@@ -18324,7 +18324,7 @@ class WebXRManager extends EventDispatcher {
 		let initialRenderTarget = null;
 		let newRenderTarget = null;
 		const controllers = [];
-		const inputSourcesMap = new Map(); //
+		const controllerInputSources = []; //
 
 		const cameraL = new PerspectiveCamera();
 		cameraL.layers.enable(1);
@@ -18378,7 +18378,13 @@ class WebXRManager extends EventDispatcher {
 
 
 		function onSessionEvent(event) {
-			const controller = inputSourcesMap.get(event.inputSource);
+			const controllerIndex = controllerInputSources.indexOf(event.inputSource);
+
+			if (controllerIndex === -1) {
+				return;
+			}
+
+			const controller = controllers[controllerIndex];
 
 			if (controller !== undefined) {
 				controller.dispatchEvent({
@@ -18397,12 +18403,13 @@ class WebXRManager extends EventDispatcher {
 			session.removeEventListener('squeezeend', onSessionEvent);
 			session.removeEventListener('end', onSessionEnd);
 			session.removeEventListener('inputsourceschange', onInputSourcesChange);
-			inputSourcesMap.forEach(function (controller, inputSource) {
-				if (controller !== undefined) {
-					controller.disconnect(inputSource);
-				}
-			});
-			inputSourcesMap.clear();
+
+			for (let i = 0; i < controllers.length; i++) {
+				const inputSource = controllerInputSources[i];
+				if (inputSource === null) continue;
+				controllers[i].disconnect(inputSource);
+			}
+
 			_currentDepthNear = null;
 			_currentDepthFar = null; // restore framebuffer/rendering state
 
@@ -18544,31 +18551,44 @@ class WebXRManager extends EventDispatcher {
 		};
 
 		function onInputSourcesChange(event) {
-			const inputSources = session.inputSources; // Assign controllers to available inputSources
-
-			for (let i = 0; i < inputSources.length; i++) {
-				const index = inputSources[i].handedness === 'right' ? 1 : 0;
-				inputSourcesMap.set(inputSources[i], controllers[index]);
-			} // Notify disconnected
-
-
+			// Notify disconnected
 			for (let i = 0; i < event.removed.length; i++) {
 				const inputSource = event.removed[i];
-				const controller = inputSourcesMap.get(inputSource);
+				const index = controllerInputSources.indexOf(inputSource);
 
-				if (controller) {
-					controller.dispatchEvent({
+				if (index >= 0) {
+					controllerInputSources[index] = null;
+					controllers[index].dispatchEvent({
 						type: 'disconnected',
 						data: inputSource
 					});
-					inputSourcesMap.delete(inputSource);
 				}
 			} // Notify connected
 
 
 			for (let i = 0; i < event.added.length; i++) {
 				const inputSource = event.added[i];
-				const controller = inputSourcesMap.get(inputSource);
+				let controllerIndex = controllerInputSources.indexOf(inputSource);
+
+				if (controllerIndex === -1) {
+					// Assign input source a controller that currently has no input source
+					for (let i = 0; i < controllers.length; i++) {
+						if (i >= controllerInputSources.length) {
+							controllerInputSources.push(inputSource);
+							controllerIndex = i;
+							break;
+						} else if (controllerInputSources[i] === null) {
+							controllerInputSources[i] = inputSource;
+							controllerIndex = i;
+							break;
+						}
+					} // If all controllers do currently receive input we ignore new ones
+
+
+					if (controllerIndex === -1) break;
+				}
+
+				const controller = controllers[controllerIndex];
 
 				if (controller) {
 					controller.dispatchEvent({
@@ -18773,13 +18793,11 @@ class WebXRManager extends EventDispatcher {
 			} //
 
 
-			const inputSources = session.inputSources;
-
 			for (let i = 0; i < controllers.length; i++) {
-				const inputSource = inputSources[i];
-				const controller = inputSourcesMap.get(inputSource);
+				const inputSource = controllerInputSources[i];
+				const controller = controllers[i];
 
-				if (controller !== undefined) {
+				if (inputSource !== null && controller !== undefined) {
 					controller.update(inputSource, frame, customReferenceSpace || referenceSpace);
 				}
 			}
@@ -29616,31 +29634,31 @@ class MaterialLoader extends Loader {
 		return this;
 	}
 
-}
+	static createMaterialFromType(type) {
+		const materialLib = {
+			ShadowMaterial,
+			SpriteMaterial,
+			RawShaderMaterial,
+			ShaderMaterial,
+			PointsMaterial,
+			MeshPhysicalMaterial,
+			MeshStandardMaterial,
+			MeshPhongMaterial,
+			MeshToonMaterial,
+			MeshNormalMaterial,
+			MeshLambertMaterial,
+			MeshDepthMaterial,
+			MeshDistanceMaterial,
+			MeshBasicMaterial,
+			MeshMatcapMaterial,
+			LineDashedMaterial,
+			LineBasicMaterial,
+			Material
+		};
+		return new materialLib[type]();
+	}
 
-MaterialLoader.createMaterialFromType = function (type) {
-	const materialLib = {
-		ShadowMaterial,
-		SpriteMaterial,
-		RawShaderMaterial,
-		ShaderMaterial,
-		PointsMaterial,
-		MeshPhysicalMaterial,
-		MeshStandardMaterial,
-		MeshPhongMaterial,
-		MeshToonMaterial,
-		MeshNormalMaterial,
-		MeshLambertMaterial,
-		MeshDepthMaterial,
-		MeshDistanceMaterial,
-		MeshBasicMaterial,
-		MeshMatcapMaterial,
-		LineDashedMaterial,
-		LineBasicMaterial,
-		Material
-	};
-	return new materialLib[type]();
-};
+}
 
 class LoaderUtils {
 	static decodeText(array) {

+ 68 - 50
build/three.js

@@ -18326,7 +18326,7 @@
 			let initialRenderTarget = null;
 			let newRenderTarget = null;
 			const controllers = [];
-			const inputSourcesMap = new Map(); //
+			const controllerInputSources = []; //
 
 			const cameraL = new PerspectiveCamera();
 			cameraL.layers.enable(1);
@@ -18380,7 +18380,13 @@
 
 
 			function onSessionEvent(event) {
-				const controller = inputSourcesMap.get(event.inputSource);
+				const controllerIndex = controllerInputSources.indexOf(event.inputSource);
+
+				if (controllerIndex === -1) {
+					return;
+				}
+
+				const controller = controllers[controllerIndex];
 
 				if (controller !== undefined) {
 					controller.dispatchEvent({
@@ -18399,12 +18405,13 @@
 				session.removeEventListener('squeezeend', onSessionEvent);
 				session.removeEventListener('end', onSessionEnd);
 				session.removeEventListener('inputsourceschange', onInputSourcesChange);
-				inputSourcesMap.forEach(function (controller, inputSource) {
-					if (controller !== undefined) {
-						controller.disconnect(inputSource);
-					}
-				});
-				inputSourcesMap.clear();
+
+				for (let i = 0; i < controllers.length; i++) {
+					const inputSource = controllerInputSources[i];
+					if (inputSource === null) continue;
+					controllers[i].disconnect(inputSource);
+				}
+
 				_currentDepthNear = null;
 				_currentDepthFar = null; // restore framebuffer/rendering state
 
@@ -18546,31 +18553,44 @@
 			};
 
 			function onInputSourcesChange(event) {
-				const inputSources = session.inputSources; // Assign controllers to available inputSources
-
-				for (let i = 0; i < inputSources.length; i++) {
-					const index = inputSources[i].handedness === 'right' ? 1 : 0;
-					inputSourcesMap.set(inputSources[i], controllers[index]);
-				} // Notify disconnected
-
-
+				// Notify disconnected
 				for (let i = 0; i < event.removed.length; i++) {
 					const inputSource = event.removed[i];
-					const controller = inputSourcesMap.get(inputSource);
+					const index = controllerInputSources.indexOf(inputSource);
 
-					if (controller) {
-						controller.dispatchEvent({
+					if (index >= 0) {
+						controllerInputSources[index] = null;
+						controllers[index].dispatchEvent({
 							type: 'disconnected',
 							data: inputSource
 						});
-						inputSourcesMap.delete(inputSource);
 					}
 				} // Notify connected
 
 
 				for (let i = 0; i < event.added.length; i++) {
 					const inputSource = event.added[i];
-					const controller = inputSourcesMap.get(inputSource);
+					let controllerIndex = controllerInputSources.indexOf(inputSource);
+
+					if (controllerIndex === -1) {
+						// Assign input source a controller that currently has no input source
+						for (let i = 0; i < controllers.length; i++) {
+							if (i >= controllerInputSources.length) {
+								controllerInputSources.push(inputSource);
+								controllerIndex = i;
+								break;
+							} else if (controllerInputSources[i] === null) {
+								controllerInputSources[i] = inputSource;
+								controllerIndex = i;
+								break;
+							}
+						} // If all controllers do currently receive input we ignore new ones
+
+
+						if (controllerIndex === -1) break;
+					}
+
+					const controller = controllers[controllerIndex];
 
 					if (controller) {
 						controller.dispatchEvent({
@@ -18775,13 +18795,11 @@
 				} //
 
 
-				const inputSources = session.inputSources;
-
 				for (let i = 0; i < controllers.length; i++) {
-					const inputSource = inputSources[i];
-					const controller = inputSourcesMap.get(inputSource);
+					const inputSource = controllerInputSources[i];
+					const controller = controllers[i];
 
-					if (controller !== undefined) {
+					if (inputSource !== null && controller !== undefined) {
 						controller.update(inputSource, frame, customReferenceSpace || referenceSpace);
 					}
 				}
@@ -29618,31 +29636,31 @@
 			return this;
 		}
 
-	}
+		static createMaterialFromType(type) {
+			const materialLib = {
+				ShadowMaterial,
+				SpriteMaterial,
+				RawShaderMaterial,
+				ShaderMaterial,
+				PointsMaterial,
+				MeshPhysicalMaterial,
+				MeshStandardMaterial,
+				MeshPhongMaterial,
+				MeshToonMaterial,
+				MeshNormalMaterial,
+				MeshLambertMaterial,
+				MeshDepthMaterial,
+				MeshDistanceMaterial,
+				MeshBasicMaterial,
+				MeshMatcapMaterial,
+				LineDashedMaterial,
+				LineBasicMaterial,
+				Material
+			};
+			return new materialLib[type]();
+		}
 
-	MaterialLoader.createMaterialFromType = function (type) {
-		const materialLib = {
-			ShadowMaterial,
-			SpriteMaterial,
-			RawShaderMaterial,
-			ShaderMaterial,
-			PointsMaterial,
-			MeshPhysicalMaterial,
-			MeshStandardMaterial,
-			MeshPhongMaterial,
-			MeshToonMaterial,
-			MeshNormalMaterial,
-			MeshLambertMaterial,
-			MeshDepthMaterial,
-			MeshDistanceMaterial,
-			MeshBasicMaterial,
-			MeshMatcapMaterial,
-			LineDashedMaterial,
-			LineBasicMaterial,
-			Material
-		};
-		return new materialLib[type]();
-	};
+	}
 
 	class LoaderUtils {
 		static decodeText(array) {

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
build/three.min.js


+ 79 - 55
build/three.module.js

@@ -24901,7 +24901,7 @@ class WebXRManager extends EventDispatcher {
 		let newRenderTarget = null;
 
 		const controllers = [];
-		const inputSourcesMap = new Map();
+		const controllerInputSources = [];
 
 		//
 
@@ -24978,7 +24978,15 @@ class WebXRManager extends EventDispatcher {
 
 		function onSessionEvent( event ) {
 
-			const controller = inputSourcesMap.get( event.inputSource );
+			const controllerIndex = controllerInputSources.indexOf( event.inputSource );
+
+			if ( controllerIndex === - 1 ) {
+
+				return;
+
+			}
+
+			const controller = controllers[ controllerIndex ];
 
 			if ( controller !== undefined ) {
 
@@ -24999,17 +25007,15 @@ class WebXRManager extends EventDispatcher {
 			session.removeEventListener( 'end', onSessionEnd );
 			session.removeEventListener( 'inputsourceschange', onInputSourcesChange );
 
-			inputSourcesMap.forEach( function ( controller, inputSource ) {
-
-				if ( controller !== undefined ) {
+			for ( let i = 0; i < controllers.length; i ++ ) {
 
-					controller.disconnect( inputSource );
+				const inputSource = controllerInputSources[ i ];
 
-				}
+				if ( inputSource === null ) continue;
 
-			} );
+				controllers[ i ].disconnect( inputSource );
 
-			inputSourcesMap.clear();
+			}
 
 			_currentDepthNear = null;
 			_currentDepthFar = null;
@@ -25205,28 +25211,17 @@ class WebXRManager extends EventDispatcher {
 
 		function onInputSourcesChange( event ) {
 
-			const inputSources = session.inputSources;
-
-			// Assign controllers to available inputSources
-
-			for ( let i = 0; i < inputSources.length; i ++ ) {
-
-				const index = inputSources[ i ].handedness === 'right' ? 1 : 0;
-				inputSourcesMap.set( inputSources[ i ], controllers[ index ] );
-
-			}
-
 			// Notify disconnected
 
 			for ( let i = 0; i < event.removed.length; i ++ ) {
 
 				const inputSource = event.removed[ i ];
-				const controller = inputSourcesMap.get( inputSource );
+				const index = controllerInputSources.indexOf( inputSource );
 
-				if ( controller ) {
+				if ( index >= 0 ) {
 
-					controller.dispatchEvent( { type: 'disconnected', data: inputSource } );
-					inputSourcesMap.delete( inputSource );
+					controllerInputSources[ index ] = null;
+					controllers[ index ].dispatchEvent( { type: 'disconnected', data: inputSource } );
 
 				}
 
@@ -25237,7 +25232,38 @@ class WebXRManager extends EventDispatcher {
 			for ( let i = 0; i < event.added.length; i ++ ) {
 
 				const inputSource = event.added[ i ];
-				const controller = inputSourcesMap.get( inputSource );
+
+				let controllerIndex = controllerInputSources.indexOf( inputSource );
+
+				if ( controllerIndex === - 1 ) {
+
+					// Assign input source a controller that currently has no input source
+
+					for ( let i = 0; i < controllers.length; i ++ ) {
+
+						if ( i >= controllerInputSources.length ) {
+
+							controllerInputSources.push( inputSource );
+							controllerIndex = i;
+							break;
+
+						} else if ( controllerInputSources[ i ] === null ) {
+
+							controllerInputSources[ i ] = inputSource;
+							controllerIndex = i;
+							break;
+
+						}
+
+					}
+
+					// If all controllers do currently receive input we ignore new ones
+
+					if ( controllerIndex === - 1 ) break;
+
+				}
+
+				const controller = controllers[ controllerIndex ];
 
 				if ( controller ) {
 
@@ -25527,14 +25553,12 @@ class WebXRManager extends EventDispatcher {
 
 			//
 
-			const inputSources = session.inputSources;
-
 			for ( let i = 0; i < controllers.length; i ++ ) {
 
-				const inputSource = inputSources[ i ];
-				const controller = inputSourcesMap.get( inputSource );
+				const inputSource = controllerInputSources[ i ];
+				const controller = controllers[ i ];
 
-				if ( controller !== undefined ) {
+				if ( inputSource !== null && controller !== undefined ) {
 
 					controller.update( inputSource, frame, customReferenceSpace || referenceSpace );
 
@@ -41223,34 +41247,34 @@ class MaterialLoader extends Loader {
 
 	}
 
-}
-
-MaterialLoader.createMaterialFromType = function ( type ) {
+	static createMaterialFromType( type ) {
+
+		const materialLib = {
+			ShadowMaterial,
+			SpriteMaterial,
+			RawShaderMaterial,
+			ShaderMaterial,
+			PointsMaterial,
+			MeshPhysicalMaterial,
+			MeshStandardMaterial,
+			MeshPhongMaterial,
+			MeshToonMaterial,
+			MeshNormalMaterial,
+			MeshLambertMaterial,
+			MeshDepthMaterial,
+			MeshDistanceMaterial,
+			MeshBasicMaterial,
+			MeshMatcapMaterial,
+			LineDashedMaterial,
+			LineBasicMaterial,
+			Material
+		};
 
-	const materialLib = {
-		ShadowMaterial,
-		SpriteMaterial,
-		RawShaderMaterial,
-		ShaderMaterial,
-		PointsMaterial,
-		MeshPhysicalMaterial,
-		MeshStandardMaterial,
-		MeshPhongMaterial,
-		MeshToonMaterial,
-		MeshNormalMaterial,
-		MeshLambertMaterial,
-		MeshDepthMaterial,
-		MeshDistanceMaterial,
-		MeshBasicMaterial,
-		MeshMatcapMaterial,
-		LineDashedMaterial,
-		LineBasicMaterial,
-		Material
-	};
+		return new materialLib[ type ]();
 
-	return new materialLib[ type ]();
+	}
 
-};
+}
 
 class LoaderUtils {
 

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.