浏览代码

Updated examples builds.

Mr.doob 3 年之前
父节点
当前提交
e59ac40aa0

+ 14 - 12
examples/js/controls/ArcballControls.js

@@ -42,6 +42,8 @@
 	};
 
 	const _raycaster = new THREE.Raycaster();
+
+	const _offset = new THREE.Vector3();
 	/**
  *
  * @param {Camera} camera Virtual camera used in the scene
@@ -930,9 +932,9 @@
 									this.setFov( newFov );
 									this.applyTransformMatrix( this.scale( size, this._v3_2, false ) ); //adjusting distance
 
-									const direction = this._gizmos.position.clone().sub( this.camera.position ).normalize().multiplyScalar( newDistance / x );
+									_offset.copy( this._gizmos.position ).sub( this.camera.position ).normalize().multiplyScalar( newDistance / x );
 
-									this._m4_1.makeTranslation( direction.x, direction.y, direction.z );
+									this._m4_1.makeTranslation( _offset.x, _offset.y, _offset.z );
 
 								}
 
@@ -1322,9 +1324,9 @@
 					this.setFov( newFov );
 					this.applyTransformMatrix( this.scale( size, this._v3_2, false ) ); //adjusting distance
 
-					const direction = this._gizmos.position.clone().sub( this.camera.position ).normalize().multiplyScalar( newDistance / x );
+					_offset.copy( this._gizmos.position ).sub( this.camera.position ).normalize().multiplyScalar( newDistance / x );
 
-					this._m4_1.makeTranslation( direction.x, direction.y, direction.z );
+					this._m4_1.makeTranslation( _offset.x, _offset.y, _offset.z );
 
 					this.dispatchEvent( _changeEvent );
 
@@ -1614,11 +1616,10 @@
 
 			this.focus = ( point, size, amount = 1 ) => {
 
-				const focusPoint = point.clone(); //move center of camera (along with gizmos) towards point of interest
-
-				focusPoint.sub( this._gizmos.position ).multiplyScalar( amount );
+				//move center of camera (along with gizmos) towards point of interest
+				_offset.copy( point ).sub( this._gizmos.position ).multiplyScalar( amount );
 
-				this._translationMatrix.makeTranslation( focusPoint.x, focusPoint.y, focusPoint.z );
+				this._translationMatrix.makeTranslation( _offset.x, _offset.y, _offset.z );
 
 				const gizmoStateTemp = this._gizmoMatrixState.clone();
 
@@ -2234,9 +2235,9 @@
 
 					}
 
-					let direction = scalePoint.clone().sub( this._v3_1 ).normalize().multiplyScalar( amount );
+					_offset.copy( scalePoint ).sub( this._v3_1 ).normalize().multiplyScalar( amount );
 
-					this._m4_1.makeTranslation( direction.x, direction.y, direction.z );
+					this._m4_1.makeTranslation( _offset.x, _offset.y, _offset.z );
 
 					if ( scaleGizmos ) {
 
@@ -2244,13 +2245,14 @@
 						const pos = this._v3_2;
 						distance = pos.distanceTo( scalePoint );
 						amount = distance - distance * sizeInverse;
-						direction = scalePoint.clone().sub( this._v3_2 ).normalize().multiplyScalar( amount );
+
+						_offset.copy( scalePoint ).sub( this._v3_2 ).normalize().multiplyScalar( amount );
 
 						this._translationMatrix.makeTranslation( pos.x, pos.y, pos.z );
 
 						this._scaleMatrix.makeScale( sizeInverse, sizeInverse, sizeInverse );
 
-						this._m4_2.makeTranslation( direction.x, direction.y, direction.z ).multiply( this._translationMatrix );
+						this._m4_2.makeTranslation( _offset.x, _offset.y, _offset.z ).multiply( this._translationMatrix );
 
 						this._m4_2.multiply( this._scaleMatrix );
 

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

@@ -219,6 +219,7 @@
 			this.deactivate = deactivate;
 			this.dispose = dispose;
 			this.getObjects = getObjects;
+			this.getRaycaster = getRaycaster;
 
 		}
 

+ 4 - 35
examples/js/controls/OrbitControls.js

@@ -514,9 +514,6 @@
 
 			}
 
-			function handleMouseUp() { // no-op
-			}
-
 			function handleMouseWheel( event ) {
 
 				if ( event.deltaY < 0 ) {
@@ -696,9 +693,6 @@
 				if ( scope.enableZoom ) handleTouchMoveDolly( event );
 				if ( scope.enableRotate ) handleTouchMoveRotate( event );
 
-			}
-
-			function handleTouchEnd() { // no-op
 			} //
 			// event handlers - FSM: listen for events and reset state
 			//
@@ -749,19 +743,7 @@
 
 			function onPointerUp( event ) {
 
-				if ( scope.enabled === false ) return;
-
-				if ( event.pointerType === 'touch' ) {
-
-					onTouchEnd();
-
-				} else {
-
-					onMouseUp( event );
-
-				}
-
-				removePointer( event ); //
+				removePointer( event );
 
 				if ( pointers.length === 0 ) {
 
@@ -771,6 +753,9 @@
 
 				}
 
+				scope.dispatchEvent( _endEvent );
+				state = STATE.NONE;
+
 			}
 
 			function onPointerCancel( event ) {
@@ -882,14 +867,6 @@
 
 			}
 
-			function onMouseUp( event ) {
-
-				handleMouseUp( event );
-				scope.dispatchEvent( _endEvent );
-				state = STATE.NONE;
-
-			}
-
 			function onMouseWheel( event ) {
 
 				if ( scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE ) return;
@@ -1007,14 +984,6 @@
 
 			}
 
-			function onTouchEnd( event ) {
-
-				handleTouchEnd( event );
-				scope.dispatchEvent( _endEvent );
-				state = STATE.NONE;
-
-			}
-
 			function onContextMenu( event ) {
 
 				if ( scope.enabled === false ) return;

+ 24 - 11
examples/js/loaders/3DMLoader.js

@@ -231,6 +231,10 @@
 
 					}
 
+					map.wrapS = texture.wrapU === 0 ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping;
+					map.wrapT = texture.wrapV === 0 ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping;
+					map.repeat.set( texture.repeat[ 0 ], texture.repeat[ 1 ] );
+
 				}
 
 			}
@@ -778,7 +782,8 @@
 			const layers = [];
 			const views = [];
 			const namedViews = [];
-			const groups = []; //Handle objects
+			const groups = [];
+			const strings = []; //Handle objects
 
 			const objs = doc.objects();
 			const cnt = objs.count;
@@ -840,6 +845,13 @@
 							type: textureType
 						};
 						const image = doc.getEmbeddedFileAsBase64( _texture.fileName );
+						texture.wrapU = _texture.wrapU;
+						texture.wrapV = _texture.wrapV;
+						texture.wrapW = _texture.wrapW;
+
+						const uvw = _texture.uvwTransform.toFloatArray( true );
+
+						texture.repeat = [ uvw[ 0 ], uvw[ 5 ] ];
 
 						if ( image ) {
 
@@ -959,18 +971,18 @@
 			// console.log( `Dimstyle Count: ${doc.dimstyles().count()}` );
 			// Handle bitmaps
 			// console.log( `Bitmap Count: ${doc.bitmaps().count()}` );
-			// Handle strings -- this seems to be broken at the moment in rhino3dm
+			// Handle strings
 			// console.log( `Document Strings Count: ${doc.strings().count()}` );
+			// Note: doc.strings().documentUserTextCount() counts any doc.strings defined in a section
+			//console.log( `Document User Text Count: ${doc.strings().documentUserTextCount()}` );
+
+			const strings_count = doc.strings().count();
 
-			/*
-    for( var i = 0; i < doc.strings().count(); i++ ){
-    		var _string= doc.strings().get( i );
-    		console.log(_string);
-    	var string = extractProperties( _group );
-    		strings.push( string );
-    		_string.delete();
-    	}
-    */
+			for ( let i = 0; i < strings_count; i ++ ) {
+
+				strings.push( doc.strings().get( i ) );
+
+			}
 
 			doc.delete();
 			return {
@@ -980,6 +992,7 @@
 				views,
 				namedViews,
 				groups,
+				strings,
 				settings
 			};
 

文件差异内容过多而无法显示
+ 275 - 0
examples/js/loaders/LogLuvLoader.js


+ 1 - 0
utils/build/rollup.examples.config.js

@@ -180,6 +180,7 @@ const files = glob.sync( '**/*.js', { cwd: jsmFolder, ignore: [
 	// no non-module library
 	// https://unpkg.com/browse/[email protected]/
 	'loaders/IFCLoader.js',
+	'node-editor/**/*',
 
 	'renderers/webgl/**/*',
 	'renderers/webgpu/**/*',

部分文件因为文件数量过多而无法显示