瀏覽代碼

More clean up. (#23410)

Michael Herzog 3 年之前
父節點
當前提交
61393d8d6c

+ 1 - 5
editor/js/libs/app.js

@@ -133,11 +133,7 @@ var APP = {
 
 			}
 
-			if ( renderer ) {
-
-				renderer.setSize( width, height );
-
-			}
+			renderer.setSize( width, height );
 
 		};
 

+ 1 - 1
examples/jsm/exporters/PLYExporter.js

@@ -290,7 +290,7 @@ class PLYExporter {
 							output.setFloat32( vOffset, uvs.getY( i ), options.littleEndian );
 							vOffset += 4;
 
-						} else if ( includeUVs !== false ) {
+						} else {
 
 							output.setFloat32( vOffset, 0, options.littleEndian );
 							vOffset += 4;

+ 3 - 10
examples/jsm/loaders/3MFLoader.js

@@ -99,13 +99,11 @@ class ThreeMFLoader extends Loader {
 			const modelPartNames = [];
 			const printTicketPartNames = [];
 			const texturesPartNames = [];
-			const otherPartNames = [];
 
 			let modelRels;
 			const modelParts = {};
 			const printTicketParts = {};
 			const texturesParts = {};
-			const otherParts = {};
 
 			try {
 
@@ -144,10 +142,6 @@ class ThreeMFLoader extends Loader {
 
 					texturesPartNames.push( file );
 
-				} else if ( file.match( /^3D\/Other\/.*/ ) ) {
-
-					otherPartNames.push( file );
-
 				}
 
 			}
@@ -225,8 +219,7 @@ class ThreeMFLoader extends Loader {
 				modelRels: modelRels,
 				model: modelParts,
 				printTicket: printTicketParts,
-				texture: texturesParts,
-				other: otherParts
+				texture: texturesParts
 			};
 
 		}
@@ -1004,7 +997,7 @@ class ThreeMFLoader extends Loader {
 
 		}
 
-		function buildVertexColorMesh( colorgroup, triangleProperties, meshData, objects, modelData, objectData ) {
+		function buildVertexColorMesh( colorgroup, triangleProperties, meshData, objects, objectData ) {
 
 			// geometry
 
@@ -1117,7 +1110,7 @@ class ThreeMFLoader extends Loader {
 
 					case 'vertexColors':
 						const colorgroup = modelData.resources.colorgroup[ resourceId ];
-						meshes.push( buildVertexColorMesh( colorgroup, triangleProperties, meshData, objects, modelData, objectData ) );
+						meshes.push( buildVertexColorMesh( colorgroup, triangleProperties, meshData, objects, objectData ) );
 						break;
 
 					case 'default':

+ 0 - 1
examples/jsm/loaders/GCodeLoader.js

@@ -189,7 +189,6 @@ class GCodeLoader extends Loader {
 				line.y = args.y !== undefined ? args.y : line.y;
 				line.z = args.z !== undefined ? args.z : line.z;
 				line.e = args.e !== undefined ? args.e : line.e;
-				state = line;
 
 			} else {
 

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

@@ -168,13 +168,13 @@ class RGBELoader extends DataTextureLoader {
 
 					if ( match = line.match( gamma_re ) ) {
 
-						header.gamma = parseFloat( match[ 1 ], 10 );
+						header.gamma = parseFloat( match[ 1 ] );
 
 					}
 
 					if ( match = line.match( exposure_re ) ) {
 
-						header.exposure = parseFloat( match[ 1 ], 10 );
+						header.exposure = parseFloat( match[ 1 ] );
 
 					}
 

+ 1 - 1
examples/jsm/loaders/RGBMLoader.js

@@ -285,7 +285,7 @@ UPNG.toRGBA8.decodeImage = function ( data, w, h, out ) {
 			var off = y * bpl, to = y * w;
 			if ( depth == 1 ) for ( var x = 0; x < w; x ++ ) {
 
-				var gr = 255 * ( ( data[ off + ( x >>> 3 ) ] >>> ( 7 - ( ( x & 7 ) ) ) ) & 1 ), al = ( gr == tr * 255 ) ? 0 : 255; bf32[ to + x ] = ( al << 24 ) | ( gr << 16 ) | ( gr << 8 ) | gr;
+				var gr = 255 * ( ( data[ off + ( x >>> 3 ) ] >>> ( 7 - ( x & 7 ) ) ) & 1 ), al = ( gr == tr * 255 ) ? 0 : 255; bf32[ to + x ] = ( al << 24 ) | ( gr << 16 ) | ( gr << 8 ) | gr;
 
 			}
 			else if ( depth == 2 ) for ( var x = 0; x < w; x ++ ) {

+ 2 - 1
examples/jsm/math/Lut.js

@@ -106,7 +106,8 @@ class Lut {
 		alpha = ( alpha - this.minV ) / ( this.maxV - this.minV );
 
 		let colorPosition = Math.round( alpha * this.n );
-		colorPosition == this.n ? colorPosition -= 1 : colorPosition;
+
+		if ( colorPosition === this.n ) colorPosition -= 1;
 
 		return this.lut[ colorPosition ];
 

+ 1 - 1
examples/jsm/nodes/materials/NodeMaterial.js

@@ -150,7 +150,7 @@ class NodeMaterial extends ShaderMaterial {
 
 		}
 
-		if ( meta && ! meta.materials ) meta.materials = {};
+		if ( ! meta.materials ) meta.materials = {};
 
 		if ( ! meta.materials[ this.uuid ] ) {
 

+ 1 - 1
examples/jsm/nodes/postprocessing/NodePass.js

@@ -63,7 +63,7 @@ class NodePass extends ShaderPass {
 
 		}
 
-		if ( meta && ! meta.passes ) meta.passes = {};
+		if ( ! meta.passes ) meta.passes = {};
 
 		if ( ! meta.passes[ this.uuid ] ) {
 

+ 4 - 4
examples/jsm/postprocessing/TAARenderPass.js

@@ -28,7 +28,7 @@ class TAARenderPass extends SSAARenderPass {
 
 	render( renderer, writeBuffer, readBuffer, deltaTime ) {
 
-		if ( ! this.accumulate ) {
+		if ( this.accumulate === false ) {
 
 			super.render( renderer, writeBuffer, readBuffer, deltaTime );
 
@@ -39,21 +39,21 @@ class TAARenderPass extends SSAARenderPass {
 
 		const jitterOffsets = _JitterVectors[ 5 ];
 
-		if ( ! this.sampleRenderTarget ) {
+		if ( this.sampleRenderTarget === undefined ) {
 
 			this.sampleRenderTarget = new WebGLRenderTarget( readBuffer.width, readBuffer.height, this.params );
 			this.sampleRenderTarget.texture.name = 'TAARenderPass.sample';
 
 		}
 
-		if ( ! this.holdRenderTarget ) {
+		if ( this.holdRenderTarget === undefined ) {
 
 			this.holdRenderTarget = new WebGLRenderTarget( readBuffer.width, readBuffer.height, this.params );
 			this.holdRenderTarget.texture.name = 'TAARenderPass.hold';
 
 		}
 
-		if ( this.accumulate && this.accumulateIndex === - 1 ) {
+		if ( this.accumulateIndex === - 1 ) {
 
 			super.render( renderer, this.holdRenderTarget, readBuffer, deltaTime );
 

+ 6 - 6
examples/jsm/utils/LDrawUtils.js

@@ -162,27 +162,27 @@ class LDrawUtils {
 		const mergedObject = new Group();
 
 		const meshMaterialsIds = Object.keys( meshGeometries );
-		for ( const i in meshMaterialsIds ) {
+		for ( const meshMaterialsId of meshMaterialsIds ) {
 
-			const meshGeometry = meshGeometries[ meshMaterialsIds[ i ] ];
+			const meshGeometry = meshGeometries[ meshMaterialsId ];
 			const mergedGeometry = mergeBufferGeometries( meshGeometry.arr );
 			mergedObject.add( new Mesh( mergedGeometry, meshGeometry.mat ) );
 
 		}
 
 		const linesMaterialsIds = Object.keys( linesGeometries );
-		for ( const i in linesMaterialsIds ) {
+		for ( const linesMaterialsId of linesMaterialsIds ) {
 
-			const lineGeometry = linesGeometries[ linesMaterialsIds[ i ] ];
+			const lineGeometry = linesGeometries[ linesMaterialsId ];
 			const mergedGeometry = mergeBufferGeometries( lineGeometry.arr );
 			mergedObject.add( new LineSegments( mergedGeometry, lineGeometry.mat ) );
 
 		}
 
 		const condLinesMaterialsIds = Object.keys( condLinesGeometries );
-		for ( const i in condLinesMaterialsIds ) {
+		for ( const condLinesMaterialsId of condLinesMaterialsIds ) {
 
-			const condLineGeometry = condLinesGeometries[ condLinesMaterialsIds[ i ] ];
+			const condLineGeometry = condLinesGeometries[ condLinesMaterialsId ];
 			const mergedGeometry = mergeBufferGeometries( condLineGeometry.arr );
 			const condLines = new LineSegments( mergedGeometry, condLineGeometry.mat );
 			condLines.isConditionalLine = true;

+ 1 - 1
examples/jsm/utils/SkeletonUtils.js

@@ -87,7 +87,7 @@ function retarget( target, source, options = {} ) {
 			bone = bones[ i ];
 			name = options.names[ bone.name ] || bone.name;
 
-			if ( options.offsets && options.offsets[ name ] ) {
+			if ( options.offsets[ name ] ) {
 
 				bone.matrix.multiply( options.offsets[ name ] );
 

+ 1 - 1
src/animation/AnimationClip.js

@@ -278,7 +278,7 @@ class AnimationClip {
 
 				}
 
-				duration = morphTargetNames.length * ( fps || 1.0 );
+				duration = morphTargetNames.length * fps;
 
 			} else {
 

+ 2 - 2
src/renderers/webgl/WebGLTextures.js

@@ -1692,7 +1692,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 	function safeSetTexture2D( texture, slot ) {
 
-		if ( texture && texture.isWebGLRenderTarget ) {
+		if ( texture.isWebGLRenderTarget ) {
 
 			if ( warnedTexture2D === false ) {
 
@@ -1711,7 +1711,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 	function safeSetTextureCube( texture, slot ) {
 
-		if ( texture && texture.isWebGLCubeRenderTarget ) {
+		if ( texture.isWebGLCubeRenderTarget ) {
 
 			if ( warnedTextureCube === false ) {