瀏覽代碼

Updated examples builds.

Mr.doob 3 年之前
父節點
當前提交
3a325c72db

+ 16 - 20
examples/js/controls/ArcballControls.js

@@ -50,7 +50,7 @@
  */
 
 
-	class ArcballControls extends THREE.Object3D {
+	class ArcballControls extends THREE.EventDispatcher {
 
 		constructor( _camera, domElement, scene = null ) {
 
@@ -464,11 +464,11 @@
 
 									}
 
-									this.applyTransformMatrix( this.applyScale( size, scalePoint ) );
+									this.applyTransformMatrix( this.scale( size, scalePoint ) );
 
 								} else {
 
-									this.applyTransformMatrix( this.applyScale( size, this._gizmos.position ) );
+									this.applyTransformMatrix( this.scale( size, this._gizmos.position ) );
 
 								}
 
@@ -541,7 +541,7 @@
 									const newDistance = y / Math.tan( THREE.MathUtils.DEG2RAD * ( newFov / 2 ) );
 									size = x / newDistance;
 									this.setFov( newFov );
-									this.applyTransformMatrix( this.applyScale( size, this._gizmos.position, false ) );
+									this.applyTransformMatrix( this.scale( size, this._gizmos.position, false ) );
 
 								}
 
@@ -859,7 +859,7 @@
 
 									}
 
-									this.applyTransformMatrix( this.applyScale( size, this._gizmos.position ) );
+									this.applyTransformMatrix( this.scale( size, this._gizmos.position ) );
 
 								}
 
@@ -928,7 +928,7 @@
 									this._v3_2.setFromMatrixPosition( this._gizmoMatrixState );
 
 									this.setFov( newFov );
-									this.applyTransformMatrix( this.applyScale( size, this._v3_2, false ) ); //adjusting distance
+									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 );
 
@@ -1216,7 +1216,7 @@
 
 					}
 
-					this.applyTransformMatrix( this.applyScale( amount, scalePoint ) );
+					this.applyTransformMatrix( this.scale( amount, scalePoint ) );
 					this.dispatchEvent( _changeEvent );
 
 				}
@@ -1320,7 +1320,7 @@
 					this._v3_2.setFromMatrixPosition( this._gizmoMatrixState );
 
 					this.setFov( newFov );
-					this.applyTransformMatrix( this.applyScale( size, this._v3_2, false ) ); //adjusting distance
+					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 );
 
@@ -1635,7 +1635,7 @@
 
 				if ( this.enableZoom ) {
 
-					this.applyTransformMatrix( this.applyScale( size, this._gizmos.position ) );
+					this.applyTransformMatrix( this.scale( size, this._gizmos.position ) );
 
 				}
 
@@ -2160,7 +2160,7 @@
 
 			};
 
-			this.applyScale = ( size, point, scaleGizmos = true ) => {
+			this.scale = ( size, point, scaleGizmos = true ) => {
 
 				const scalePoint = point.clone();
 				let sizeInverse = 1 / size;
@@ -2585,7 +2585,7 @@
 					if ( this.camera.zoom > this.maxZoom || this.camera.zoom < this.minZoom ) {
 
 						const newZoom = THREE.MathUtils.clamp( this.camera.zoom, this.minZoom, this.maxZoom );
-						this.applyTransformMatrix( this.applyScale( newZoom / this.camera.zoom, this._gizmos.position, true ) );
+						this.applyTransformMatrix( this.scale( newZoom / this.camera.zoom, this._gizmos.position, true ) );
 
 					}
 
@@ -2597,7 +2597,7 @@
 					if ( distance > this.maxDistance + EPS || distance < this.minDistance - EPS ) {
 
 						const newDistance = THREE.MathUtils.clamp( distance, this.minDistance, this.maxDistance );
-						this.applyTransformMatrix( this.applyScale( newDistance / distance, this._gizmos.position ) );
+						this.applyTransformMatrix( this.scale( newDistance / distance, this._gizmos.position ) );
 						this.updateMatrixState();
 
 					} //check fov
@@ -2932,21 +2932,19 @@
 			this.dispatchEvent( _changeEvent );
 
 		}
-
-		
 		/**
    * Set gizmos radius factor and redraws gizmos
    * @param {Float} value Value of radius factor
    */
+
+
 		setTbRadius( value ) {
 
 			this.radiusFactor = value;
 			this._tbRadius = this.calculateTbRadius( this.camera );
-
-			const curve = new EllipseCurve( 0, 0, this._tbRadius, this._tbRadius );
+			const curve = new THREE.EllipseCurve( 0, 0, this._tbRadius, this._tbRadius );
 			const points = curve.getPoints( this._curvePts );
-			const curveGeometry = new BufferGeometry().setFromPoints( points );
-
+			const curveGeometry = new THREE.BufferGeometry().setFromPoints( points );
 
 			for ( const gizmo in this._gizmos.children ) {
 
@@ -2957,8 +2955,6 @@
 			this.dispatchEvent( _changeEvent );
 
 		}
-
-
 		/**
    * Creates the rotation gizmos matching trackball center and radius
    * @param {Vector3} tbCenter The trackball center

+ 2 - 1
examples/js/controls/TrackballControls.js

@@ -117,7 +117,8 @@
 				const vector = new THREE.Vector2();
 				return function getMouseOnCircle( pageX, pageY ) {
 
-					vector.set( ( pageX - scope.screen.width * 0.5 - scope.screen.left ) / ( scope.screen.width * 0.5 ), ( scope.screen.height + 2 * ( scope.screen.top - pageY ) ) / scope.screen.width );
+					vector.set( ( pageX - scope.screen.width * 0.5 - scope.screen.left ) / ( scope.screen.width * 0.5 ), ( scope.screen.height + 2 * ( scope.screen.top - pageY ) ) / scope.screen.width // screen.width intentional
+					);
 					return vector;
 
 				};

+ 1 - 1
examples/js/loaders/FBXLoader.js

@@ -1310,7 +1310,7 @@
 
 				for ( const nodeID in BindPoseNode ) {
 
-					if ( BindPoseNode[ nodeID ].attrType === 'BindPose' ) {
+					if ( BindPoseNode[ nodeID ].attrType === 'BindPose' && BindPoseNode[ nodeID ].NbPoseNodes > 0 ) {
 
 						const poseNodes = BindPoseNode[ nodeID ].PoseNode;
 

+ 12 - 1
examples/js/loaders/GLTFLoader.js

@@ -651,8 +651,19 @@
 
 				materialParams.sheenRoughness = extension.sheenRoughnessFactor;
 
-			} // TODO sheenColorTexture and sheenRoughnessTexture
+			}
+
+			if ( extension.sheenColorTexture !== undefined ) {
+
+				pending.push( parser.assignTexture( materialParams, 'sheenColorMap', extension.sheenColorTexture ) );
+
+			}
+
+			if ( extension.sheenRoughnessTexture !== undefined ) {
 
+				pending.push( parser.assignTexture( materialParams, 'sheenRoughnessMap', extension.sheenRoughnessTexture ) );
+
+			}
 
 			return Promise.all( pending );
 

+ 2 - 1
examples/js/loaders/RGBELoader.js

@@ -220,7 +220,8 @@
 					const scanline_width = w;
 
 					if ( // run length encoding is not allowed so read flat
-						scanline_width < 8 || scanline_width > 0x7fff || 2 !== buffer[ 0 ] || 2 !== buffer[ 1 ] || buffer[ 2 ] & 0x80 ) {
+						scanline_width < 8 || scanline_width > 0x7fff || // this file is not run length encoded
+      2 !== buffer[ 0 ] || 2 !== buffer[ 1 ] || buffer[ 2 ] & 0x80 ) {
 
 						// return the flat buffer
 						return new Uint8Array( buffer );

+ 1 - 0
examples/js/utils/RoughnessMipmapper.js

@@ -77,6 +77,7 @@
 				material.roughnessMap.repeat.copy( roughnessMap.repeat );
 				material.roughnessMap.center.copy( roughnessMap.center );
 				material.roughnessMap.rotation = roughnessMap.rotation;
+				material.roughnessMap.image = roughnessMap.image;
 				material.roughnessMap.matrixAutoUpdate = roughnessMap.matrixAutoUpdate;
 				material.roughnessMap.matrix.copy( roughnessMap.matrix );