Browse Source

Updated builds.

Mr.doob 5 years ago
parent
commit
52c39e457a
3 changed files with 622 additions and 421 deletions
  1. 116 17
      build/three.js
  2. 390 387
      build/three.min.js
  3. 116 17
      build/three.module.js

+ 116 - 17
build/three.js

@@ -14446,6 +14446,8 @@
 
 	function WebGLAttributes( gl, capabilities ) {
 
+		var isWebGL2 = capabilities.isWebGL2;
+
 		var buffers = new WeakMap();
 
 		function createBuffer( attribute, bufferType ) {
@@ -14520,7 +14522,7 @@
 
 			} else {
 
-				if ( capabilities.isWebGL2 ) {
+				if ( isWebGL2 ) {
 
 					gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
 						array, updateRange.offset, updateRange.count );
@@ -23032,15 +23034,43 @@
 
 			if ( controller === undefined ) {
 
-				controller = new Group();
-				controller.matrixAutoUpdate = false;
-				controller.visible = false;
+				controller = {};
+				controllers[ id ] = controller;
+
+			}
+
+			if ( controller.targetRay === undefined ) {
+
+				controller.targetRay = new Group();
+				controller.targetRay.matrixAutoUpdate = false;
+				controller.targetRay.visible = false;
+
+			}
+
+			return controller.targetRay;
+
+		};
+
+		this.getControllerGrip = function ( id ) {
+
+			var controller = controllers[ id ];
+
+			if ( controller === undefined ) {
 
+				controller = {};
 				controllers[ id ] = controller;
 
 			}
 
-			return controller;
+			if ( controller.grip === undefined ) {
+
+				controller.grip = new Group();
+				controller.grip.matrixAutoUpdate = false;
+				controller.grip.visible = false;
+
+			}
+
+			return controller.grip;
 
 		};
 
@@ -23052,7 +23082,17 @@
 
 			if ( controller ) {
 
-				controller.dispatchEvent( { type: event.type } );
+				if ( controller.targetRay ) {
+
+					controller.targetRay.dispatchEvent( { type: event.type } );
+
+				}
+
+				if ( controller.grip ) {
+
+					controller.grip.dispatchEvent( { type: event.type } );
+
+				}
 
 			}
 
@@ -23062,8 +23102,19 @@
 
 			inputSourcesMap.forEach( function ( controller, inputSource ) {
 
-				controller.dispatchEvent( { type: 'disconnected', data: inputSource } );
-				controller.visible = false;
+				if ( controller.targetRay ) {
+
+					controller.targetRay.dispatchEvent( { type: 'disconnected', data: inputSource } );
+					controller.targetRay.visible = false;
+
+				}
+
+				if ( controller.grip ) {
+
+					controller.grip.dispatchEvent( { type: 'disconnected', data: inputSource } );
+					controller.grip.visible = false;
+
+				}
 
 			} );
 
@@ -23177,7 +23228,18 @@
 
 				if ( controller ) {
 
-					controller.dispatchEvent( { type: 'disconnected', data: inputSource } );
+					if ( controller.targetRay ) {
+
+						controller.targetRay.dispatchEvent( { type: 'disconnected', data: inputSource } );
+
+					}
+
+					if ( controller.grip ) {
+
+						controller.grip.dispatchEvent( { type: 'disconnected', data: inputSource } );
+
+					}
+
 					inputSourcesMap.delete( inputSource );
 
 				}
@@ -23193,7 +23255,17 @@
 
 				if ( controller ) {
 
-					controller.dispatchEvent( { type: 'connected', data: inputSource } );
+					if ( controller.targetRay ) {
+
+						controller.targetRay.dispatchEvent( { type: 'connected', data: inputSource } );
+
+					}
+
+					if ( controller.grip ) {
+
+						controller.grip.dispatchEvent( { type: 'connected', data: inputSource } );
+
+					}
 
 				}
 
@@ -23372,23 +23444,50 @@
 
 				var inputSource = inputSources[ i ];
 
+				var inputPose = null;
+				var gripPose = null;
+
 				if ( inputSource ) {
 
-					var inputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );
+					if ( controller.targetRay ) {
 
-					if ( inputPose !== null ) {
+						inputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );
 
-						controller.matrix.fromArray( inputPose.transform.matrix );
-						controller.matrix.decompose( controller.position, controller.rotation, controller.scale );
-						controller.visible = true;
+						if ( inputPose !== null ) {
 
-						continue;
+							controller.targetRay.matrix.fromArray( inputPose.transform.matrix );
+							controller.targetRay.matrix.decompose( controller.targetRay.position, controller.targetRay.rotation, controller.targetRay.scale );
+
+						}
 
 					}
 
+					if ( controller.grip && inputSource.gripSpace ) {
+
+						gripPose = frame.getPose( inputSource.gripSpace, referenceSpace );
+
+						if ( gripPose !== null ) {
+
+							controller.grip.matrix.fromArray( gripPose.transform.matrix );
+							controller.grip.matrix.decompose( controller.grip.position, controller.grip.rotation, controller.grip.scale );
+
+						}
+
+					}
+
+				}
+
+				if ( controller.targetRay ) {
+
+					controller.targetRay.visible = inputPose !== null;
+
 				}
 
-				controller.visible = false;
+				if ( controller.grip ) {
+
+					controller.grip.visible = gripPose !== null;
+
+				}
 
 			}
 

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


+ 116 - 17
build/three.module.js

@@ -14432,6 +14432,8 @@ function WebGLAnimation() {
 
 function WebGLAttributes( gl, capabilities ) {
 
+	var isWebGL2 = capabilities.isWebGL2;
+
 	var buffers = new WeakMap();
 
 	function createBuffer( attribute, bufferType ) {
@@ -14506,7 +14508,7 @@ function WebGLAttributes( gl, capabilities ) {
 
 		} else {
 
-			if ( capabilities.isWebGL2 ) {
+			if ( isWebGL2 ) {
 
 				gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
 					array, updateRange.offset, updateRange.count );
@@ -23024,15 +23026,43 @@ function WebXRManager( renderer, gl ) {
 
 		if ( controller === undefined ) {
 
-			controller = new Group();
-			controller.matrixAutoUpdate = false;
-			controller.visible = false;
+			controller = {};
+			controllers[ id ] = controller;
+
+		}
+
+		if ( controller.targetRay === undefined ) {
+
+			controller.targetRay = new Group();
+			controller.targetRay.matrixAutoUpdate = false;
+			controller.targetRay.visible = false;
+
+		}
+
+		return controller.targetRay;
+
+	};
+
+	this.getControllerGrip = function ( id ) {
+
+		var controller = controllers[ id ];
+
+		if ( controller === undefined ) {
 
+			controller = {};
 			controllers[ id ] = controller;
 
 		}
 
-		return controller;
+		if ( controller.grip === undefined ) {
+
+			controller.grip = new Group();
+			controller.grip.matrixAutoUpdate = false;
+			controller.grip.visible = false;
+
+		}
+
+		return controller.grip;
 
 	};
 
@@ -23044,7 +23074,17 @@ function WebXRManager( renderer, gl ) {
 
 		if ( controller ) {
 
-			controller.dispatchEvent( { type: event.type } );
+			if ( controller.targetRay ) {
+
+				controller.targetRay.dispatchEvent( { type: event.type } );
+
+			}
+
+			if ( controller.grip ) {
+
+				controller.grip.dispatchEvent( { type: event.type } );
+
+			}
 
 		}
 
@@ -23054,8 +23094,19 @@ function WebXRManager( renderer, gl ) {
 
 		inputSourcesMap.forEach( function ( controller, inputSource ) {
 
-			controller.dispatchEvent( { type: 'disconnected', data: inputSource } );
-			controller.visible = false;
+			if ( controller.targetRay ) {
+
+				controller.targetRay.dispatchEvent( { type: 'disconnected', data: inputSource } );
+				controller.targetRay.visible = false;
+
+			}
+
+			if ( controller.grip ) {
+
+				controller.grip.dispatchEvent( { type: 'disconnected', data: inputSource } );
+				controller.grip.visible = false;
+
+			}
 
 		} );
 
@@ -23169,7 +23220,18 @@ function WebXRManager( renderer, gl ) {
 
 			if ( controller ) {
 
-				controller.dispatchEvent( { type: 'disconnected', data: inputSource } );
+				if ( controller.targetRay ) {
+
+					controller.targetRay.dispatchEvent( { type: 'disconnected', data: inputSource } );
+
+				}
+
+				if ( controller.grip ) {
+
+					controller.grip.dispatchEvent( { type: 'disconnected', data: inputSource } );
+
+				}
+
 				inputSourcesMap.delete( inputSource );
 
 			}
@@ -23185,7 +23247,17 @@ function WebXRManager( renderer, gl ) {
 
 			if ( controller ) {
 
-				controller.dispatchEvent( { type: 'connected', data: inputSource } );
+				if ( controller.targetRay ) {
+
+					controller.targetRay.dispatchEvent( { type: 'connected', data: inputSource } );
+
+				}
+
+				if ( controller.grip ) {
+
+					controller.grip.dispatchEvent( { type: 'connected', data: inputSource } );
+
+				}
 
 			}
 
@@ -23364,23 +23436,50 @@ function WebXRManager( renderer, gl ) {
 
 			var inputSource = inputSources[ i ];
 
+			var inputPose = null;
+			var gripPose = null;
+
 			if ( inputSource ) {
 
-				var inputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );
+				if ( controller.targetRay ) {
 
-				if ( inputPose !== null ) {
+					inputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );
 
-					controller.matrix.fromArray( inputPose.transform.matrix );
-					controller.matrix.decompose( controller.position, controller.rotation, controller.scale );
-					controller.visible = true;
+					if ( inputPose !== null ) {
 
-					continue;
+						controller.targetRay.matrix.fromArray( inputPose.transform.matrix );
+						controller.targetRay.matrix.decompose( controller.targetRay.position, controller.targetRay.rotation, controller.targetRay.scale );
+
+					}
 
 				}
 
+				if ( controller.grip && inputSource.gripSpace ) {
+
+					gripPose = frame.getPose( inputSource.gripSpace, referenceSpace );
+
+					if ( gripPose !== null ) {
+
+						controller.grip.matrix.fromArray( gripPose.transform.matrix );
+						controller.grip.matrix.decompose( controller.grip.position, controller.grip.rotation, controller.grip.scale );
+
+					}
+
+				}
+
+			}
+
+			if ( controller.targetRay ) {
+
+				controller.targetRay.visible = inputPose !== null;
+
 			}
 
-			controller.visible = false;
+			if ( controller.grip ) {
+
+				controller.grip.visible = gripPose !== null;
+
+			}
 
 		}
 

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