Przeglądaj źródła

Merge pull request #10114 from TristanVALCKE/src_warning_fix

Sources warning fix
Mr.doob 8 lat temu
rodzic
commit
b8d16daed2

+ 4 - 4
src/animation/AnimationAction.js

@@ -74,7 +74,7 @@ function AnimationAction( mixer, clip, localRoot ) {
 	this.zeroSlopeAtStart 	= true;		// for smooth interpolation w/o separate
 	this.zeroSlopeAtStart 	= true;		// for smooth interpolation w/o separate
 	this.zeroSlopeAtEnd		= true;		// clips for start, loop and end
 	this.zeroSlopeAtEnd		= true;		// clips for start, loop and end
 
 
-};
+}
 
 
 AnimationAction.prototype = {
 AnimationAction.prototype = {
 
 
@@ -273,7 +273,7 @@ AnimationAction.prototype = {
 
 
 		if ( interpolant === null ) {
 		if ( interpolant === null ) {
 
 
-			interpolant = mixer._lendControlInterpolant(),
+			interpolant = mixer._lendControlInterpolant();
 			this._timeScaleInterpolant = interpolant;
 			this._timeScaleInterpolant = interpolant;
 
 
 		}
 		}
@@ -473,7 +473,7 @@ AnimationAction.prototype = {
 			if ( loopCount === -1 ) {
 			if ( loopCount === -1 ) {
 				// just started
 				// just started
 
 
-				this.loopCount = 0;
+				this._loopCount = 0;
 				this._setEndings( true, true, false );
 				this._setEndings( true, true, false );
 
 
 			}
 			}
@@ -636,7 +636,7 @@ AnimationAction.prototype = {
 
 
 		if ( interpolant === null ) {
 		if ( interpolant === null ) {
 
 
-			interpolant = mixer._lendControlInterpolant(),
+			interpolant = mixer._lendControlInterpolant();
 			this._weightInterpolant = interpolant;
 			this._weightInterpolant = interpolant;
 
 
 		}
 		}

+ 3 - 6
src/animation/AnimationClip.js

@@ -45,8 +45,7 @@ AnimationClip.prototype = {
 
 
 			var track = this.tracks[ i ];
 			var track = this.tracks[ i ];
 
 
-			duration = Math.max(
-					duration, track.times[ track.times.length - 1 ] );
+			duration = Math.max( duration, track.times[ track.times.length - 1 ] );
 
 
 		}
 		}
 
 
@@ -310,8 +309,7 @@ Object.assign( AnimationClip, {
 					var times = [];
 					var times = [];
 					var values = [];
 					var values = [];
 
 
-					for ( var m = 0;
-							m !== animationKeys[k].morphTargets.length; ++ m ) {
+					for ( var m = 0; m !== animationKeys[k].morphTargets.length; ++ m ) {
 
 
 						var animationKey = animationKeys[k];
 						var animationKey = animationKeys[k];
 
 
@@ -320,8 +318,7 @@ Object.assign( AnimationClip, {
 
 
 					}
 					}
 
 
-					tracks.push( new NumberKeyframeTrack(
-							'.morphTargetInfluence[' + morphTargetName + ']', times, values ) );
+					tracks.push( new NumberKeyframeTrack('.morphTargetInfluence[' + morphTargetName + ']', times, values ) );
 
 
 				}
 				}
 
 

+ 3 - 2
src/animation/AnimationObjectGroup.js

@@ -92,7 +92,8 @@ AnimationObjectGroup.prototype = {
 
 
 			var object = arguments[ i ],
 			var object = arguments[ i ],
 				uuid = object.uuid,
 				uuid = object.uuid,
-				index = indicesByUUID[ uuid ];
+				index = indicesByUUID[ uuid ],
+				knownObject = undefined;
 
 
 			if ( index === undefined ) {
 			if ( index === undefined ) {
 
 
@@ -114,7 +115,7 @@ AnimationObjectGroup.prototype = {
 
 
 			} else if ( index < nCachedObjects ) {
 			} else if ( index < nCachedObjects ) {
 
 
-				var knownObject = objects[ index ];
+				knownObject = objects[ index ];
 
 
 				// move existing object to the ACTIVE region
 				// move existing object to the ACTIVE region
 
 

+ 5 - 2
src/animation/KeyframeTrackPrototype.js

@@ -171,7 +171,10 @@ KeyframeTrackPrototype = {
 		if( from !== 0 || to !== nKeys ) {
 		if( from !== 0 || to !== nKeys ) {
 
 
 			// empty tracks are forbidden, so keep at least one keyframe
 			// empty tracks are forbidden, so keep at least one keyframe
-			if ( from >= to ) to = Math.max( to , 1 ), from = to - 1;
+			if ( from >= to ){
+				to = Math.max( to , 1 );
+				from = to - 1;
+			}
 
 
 			var stride = this.getValueSize();
 			var stride = this.getValueSize();
 			this.times = AnimationUtils.arraySlice( times, from, to );
 			this.times = AnimationUtils.arraySlice( times, from, to );
@@ -359,6 +362,6 @@ KeyframeTrackPrototype = {
 
 
 	}
 	}
 
 
-}
+};
 
 
 export { KeyframeTrackPrototype };
 export { KeyframeTrackPrototype };

+ 8 - 4
src/animation/PropertyMixer.js

@@ -20,14 +20,18 @@ function PropertyMixer( binding, typeName, valueSize ) {
 
 
 	switch ( typeName ) {
 	switch ( typeName ) {
 
 
-		case 'quaternion':			mixFunction = this._slerp;		break;
+		case 'quaternion':
+			mixFunction = this._slerp;
+			break;
 
 
 		case 'string':
 		case 'string':
 		case 'bool':
 		case 'bool':
+			bufferType = Array;
+			mixFunction = this._select;
+			break;
 
 
-			bufferType = Array,		mixFunction = this._select;		break;
-
-		default:					mixFunction = this._lerp;
+		default:
+			mixFunction = this._lerp;
 
 
 	}
 	}
 
 

+ 1 - 1
src/animation/tracks/NumberKeyframeTrack.js

@@ -21,7 +21,7 @@ NumberKeyframeTrack.prototype =
 
 
 	constructor: NumberKeyframeTrack,
 	constructor: NumberKeyframeTrack,
 
 
-	ValueTypeName: 'number',
+	ValueTypeName: 'number'
 
 
 	// ValueBufferType is inherited
 	// ValueBufferType is inherited
 
 

+ 1 - 1
src/core/DirectGeometry.js

@@ -41,7 +41,7 @@ Object.assign( DirectGeometry.prototype, {
 
 
 		var group;
 		var group;
 		var groups = [];
 		var groups = [];
-		var materialIndex;
+		var materialIndex = undefined;
 
 
 		var faces = geometry.faces;
 		var faces = geometry.faces;
 
 

+ 1 - 7
src/core/EventDispatcher.js

@@ -32,13 +32,7 @@ Object.assign( EventDispatcher.prototype, {
 
 
 		var listeners = this._listeners;
 		var listeners = this._listeners;
 
 
-		if ( listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1 ) {
-
-			return true;
-
-		}
-
-		return false;
+		return ( listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1 );
 
 
 	},
 	},
 
 

+ 1 - 1
src/lights/AmbientLight.js

@@ -18,7 +18,7 @@ AmbientLight.prototype = Object.assign( Object.create( Light.prototype ), {
 
 
 	constructor: AmbientLight,
 	constructor: AmbientLight,
 
 
-	isAmbientLight: true,
+	isAmbientLight: true
 
 
 } );
 } );
 
 

+ 3 - 24
src/math/Box2.js

@@ -129,27 +129,13 @@ Box2.prototype = {
 
 
 	containsPoint: function ( point ) {
 	containsPoint: function ( point ) {
 
 
-		if ( point.x < this.min.x || point.x > this.max.x ||
-		     point.y < this.min.y || point.y > this.max.y ) {
-
-			return false;
-
-		}
-
-		return true;
+		return !(point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y);
 
 
 	},
 	},
 
 
 	containsBox: function ( box ) {
 	containsBox: function ( box ) {
 
 
-		if ( ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) &&
-		     ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) ) {
-
-			return true;
-
-		}
-
-		return false;
+		return ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) && ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y );
 
 
 	},
 	},
 
 
@@ -171,14 +157,7 @@ Box2.prototype = {
 
 
 		// using 6 splitting planes to rule out intersections.
 		// using 6 splitting planes to rule out intersections.
 
 
-		if ( box.max.x < this.min.x || box.min.x > this.max.x ||
-		     box.max.y < this.min.y || box.min.y > this.max.y ) {
-
-			return false;
-
-		}
-
-		return true;
+		return !(box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y);
 
 
 	},
 	},
 
 

+ 3 - 27
src/math/Box3.js

@@ -275,29 +275,13 @@ Box3.prototype = {
 
 
 	containsPoint: function ( point ) {
 	containsPoint: function ( point ) {
 
 
-		if ( point.x < this.min.x || point.x > this.max.x ||
-				 point.y < this.min.y || point.y > this.max.y ||
-				 point.z < this.min.z || point.z > this.max.z ) {
-
-			return false;
-
-		}
-
-		return true;
+		return ( point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y || point.z < this.min.z || point.z > this.max.z ) === false;
 
 
 	},
 	},
 
 
 	containsBox: function ( box ) {
 	containsBox: function ( box ) {
 
 
-		if ( ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) &&
-			 ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) &&
-			 ( this.min.z <= box.min.z ) && ( box.max.z <= this.max.z ) ) {
-
-			return true;
-
-		}
-
-		return false;
+		return ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) && ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) && ( this.min.z <= box.min.z ) && ( box.max.z <= this.max.z );
 
 
 	},
 	},
 
 
@@ -320,15 +304,7 @@ Box3.prototype = {
 
 
 		// using 6 splitting planes to rule out intersections.
 		// using 6 splitting planes to rule out intersections.
 
 
-		if ( box.max.x < this.min.x || box.min.x > this.max.x ||
-				 box.max.y < this.min.y || box.min.y > this.max.y ||
-				 box.max.z < this.min.z || box.min.z > this.max.z ) {
-
-			return false;
-
-		}
-
-		return true;
+		return !(box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y || box.max.z < this.min.z || box.min.z > this.max.z);
 
 
 	},
 	},
 
 

+ 1 - 1
src/math/Vector3.js

@@ -720,7 +720,7 @@ Vector3.prototype = {
 		if ( typeof m === 'number' ) {
 		if ( typeof m === 'number' ) {
 
 
 			console.warn( 'THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).' );
 			console.warn( 'THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).' );
-			var temp = m
+			var temp = m;
 			m = index;
 			m = index;
 			index = temp;
 			index = temp;
 
 

+ 1 - 1
src/renderers/shaders/ShaderLib.js

@@ -87,7 +87,7 @@ var ShaderLib = {
 				emissive : { value: new Color( 0x000000 ) },
 				emissive : { value: new Color( 0x000000 ) },
 				roughness: { value: 0.5 },
 				roughness: { value: 0.5 },
 				metalness: { value: 0 },
 				metalness: { value: 0 },
-				envMapIntensity : { value: 1 }, // temporary
+				envMapIntensity : { value: 1 } // temporary
 			}
 			}
 		),
 		),
 
 

+ 1 - 1
src/renderers/webgl/WebGLProgram.js

@@ -87,7 +87,7 @@ function generateExtensions( extensions, parameters, rendererExtensions ) {
 		( extensions.derivatives || parameters.envMapCubeUV || parameters.bumpMap || parameters.normalMap || parameters.flatShading ) ? '#extension GL_OES_standard_derivatives : enable' : '',
 		( extensions.derivatives || parameters.envMapCubeUV || parameters.bumpMap || parameters.normalMap || parameters.flatShading ) ? '#extension GL_OES_standard_derivatives : enable' : '',
 		( extensions.fragDepth || parameters.logarithmicDepthBuffer ) && rendererExtensions.get( 'EXT_frag_depth' ) ? '#extension GL_EXT_frag_depth : enable' : '',
 		( extensions.fragDepth || parameters.logarithmicDepthBuffer ) && rendererExtensions.get( 'EXT_frag_depth' ) ? '#extension GL_EXT_frag_depth : enable' : '',
 		( extensions.drawBuffers ) && rendererExtensions.get( 'WEBGL_draw_buffers' ) ? '#extension GL_EXT_draw_buffers : require' : '',
 		( extensions.drawBuffers ) && rendererExtensions.get( 'WEBGL_draw_buffers' ) ? '#extension GL_EXT_draw_buffers : require' : '',
-		( extensions.shaderTextureLOD || parameters.envMap ) && rendererExtensions.get( 'EXT_shader_texture_lod' ) ? '#extension GL_EXT_shader_texture_lod : enable' : '',
+		( extensions.shaderTextureLOD || parameters.envMap ) && rendererExtensions.get( 'EXT_shader_texture_lod' ) ? '#extension GL_EXT_shader_texture_lod : enable' : ''
 	];
 	];
 
 
 	return chunks.filter( filterEmptyLine ).join( '\n' );
 	return chunks.filter( filterEmptyLine ).join( '\n' );

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

@@ -67,11 +67,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, paramT
 
 
 	function textureNeedsPowerOfTwo( texture ) {
 	function textureNeedsPowerOfTwo( texture ) {
 
 
-		if ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) return true;
-		if ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) return true;
-
-		return false;
-
+		return (texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) || ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter );
+		
 	}
 	}
 
 
 	// Fallback filters for non-power-of-2 textures
 	// Fallback filters for non-power-of-2 textures

+ 1 - 1
test/unit/cameras/OrthographicCamera.js

@@ -6,7 +6,7 @@ module( "OrthographicCamera" );
 
 
 test( "updateProjectionMatrix", function() {
 test( "updateProjectionMatrix", function() {
 	var left = -1, right = 1, top = 1, bottom = -1, near = 1, far = 3;
 	var left = -1, right = 1, top = 1, bottom = -1, near = 1, far = 3;
-	cam = new THREE.OrthographicCamera(left, right, top, bottom, near, far);
+	var cam = new THREE.OrthographicCamera(left, right, top, bottom, near, far);
 
 
 	// updateProjectionMatrix is called in contructor
 	// updateProjectionMatrix is called in contructor
 	var pMatrix = cam.projectionMatrix.elements;
 	var pMatrix = cam.projectionMatrix.elements;

+ 1 - 2
test/unit/extras/curves/ClosedSplineCurve3.js

@@ -21,7 +21,6 @@ function vectorsAreEqual( check, that ) {
 		}
 		}
 	}
 	}
 
 
-	return;
 }
 }
 
 
 test( "basic check", function() {
 test( "basic check", function() {
@@ -54,4 +53,4 @@ test( "basic check", function() {
 	var desc = error ? ' ' + error : '';
 	var desc = error ? ' ' + error : '';
 	ok( !error, 'Lists of Vectors3 should be equal.' + desc );
 	ok( !error, 'Lists of Vectors3 should be equal.' + desc );
 
 
-});
+});

+ 1 - 1
test/unit/extras/helpers/BoxHelper.tests.js

@@ -3,7 +3,7 @@
 	'use strict';
 	'use strict';
 
 
 	var parameters = {
 	var parameters = {
-		diameter: 10,
+		diameter: 10
 	};
 	};
 
 
 	var geometries;
 	var geometries;

+ 1 - 1
test/unit/geometries/BoxGeometry.tests.js

@@ -8,7 +8,7 @@
 		depth: 30,
 		depth: 30,
 		widthSegments: 2,
 		widthSegments: 2,
 		heightSegments: 3,
 		heightSegments: 3,
-		depthSegments: 4,
+		depthSegments: 4
 	};
 	};
 
 
 	var geometries;
 	var geometries;

+ 7 - 11
test/unit/math/Frustum.js

@@ -7,14 +7,10 @@ module( "Frustum" );
 var unit3 = new THREE.Vector3( 1, 0, 0 );
 var unit3 = new THREE.Vector3( 1, 0, 0 );
 
 
 var planeEquals = function ( a, b, tolerance ) {
 var planeEquals = function ( a, b, tolerance ) {
+
 	tolerance = tolerance || 0.0001;
 	tolerance = tolerance || 0.0001;
-	if( a.normal.distanceTo( b.normal ) > tolerance ) {
-		return false;
-	}
-	if( Math.abs( a.constant - b.constant ) > tolerance ) {
-		return false;
-	}
-	return true;
+	return !( a.normal.distanceTo( b.normal ) > tolerance ) && !( Math.abs( a.constant - b.constant ) > tolerance );
+
 };
 };
 
 
 test( "constructor", function() {
 test( "constructor", function() {
@@ -68,7 +64,7 @@ test( "copy", function() {
 });
 });
 
 
 test( "setFromMatrix/makeOrthographic/containsPoint", function() {
 test( "setFromMatrix/makeOrthographic/containsPoint", function() {
-	var m = new THREE.Matrix4().makeOrthographic( -1, 1, -1, 1, 1, 100 )
+	var m = new THREE.Matrix4().makeOrthographic( -1, 1, -1, 1, 1, 100 );
 	var a = new THREE.Frustum().setFromMatrix( m );
 	var a = new THREE.Frustum().setFromMatrix( m );
 
 
 	ok( ! a.containsPoint( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
 	ok( ! a.containsPoint( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
@@ -88,7 +84,7 @@ test( "setFromMatrix/makeOrthographic/containsPoint", function() {
 });
 });
 
 
 test( "setFromMatrix/makeFrustum/containsPoint", function() {
 test( "setFromMatrix/makeFrustum/containsPoint", function() {
-	var m = new THREE.Matrix4().makeFrustum( -1, 1, -1, 1, 1, 100 )
+	var m = new THREE.Matrix4().makeFrustum( -1, 1, -1, 1, 1, 100 );
 	var a = new THREE.Frustum().setFromMatrix( m );
 	var a = new THREE.Frustum().setFromMatrix( m );
 
 
 	ok( ! a.containsPoint( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
 	ok( ! a.containsPoint( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
@@ -107,7 +103,7 @@ test( "setFromMatrix/makeFrustum/containsPoint", function() {
 });
 });
 
 
 test( "setFromMatrix/makeFrustum/intersectsSphere", function() {
 test( "setFromMatrix/makeFrustum/intersectsSphere", function() {
-	var m = new THREE.Matrix4().makeFrustum( -1, 1, -1, 1, 1, 100 )
+	var m = new THREE.Matrix4().makeFrustum( -1, 1, -1, 1, 1, 100 );
 	var a = new THREE.Frustum().setFromMatrix( m );
 	var a = new THREE.Frustum().setFromMatrix( m );
 
 
 	ok( ! a.intersectsSphere( new THREE.Sphere( new THREE.Vector3( 0, 0, 0 ), 0 ) ), "Passed!" );
 	ok( ! a.intersectsSphere( new THREE.Sphere( new THREE.Vector3( 0, 0, 0 ), 0 ) ), "Passed!" );
@@ -153,4 +149,4 @@ test( "clone", function() {
 	// ensure it is a true copy by modifying source
 	// ensure it is a true copy by modifying source
 	a.planes[0].copy( p1 );
 	a.planes[0].copy( p1 );
 	ok( b.planes[0].equals( p0 ), "Passed!" );
 	ok( b.planes[0].equals( p0 ), "Passed!" );
-});
+});

+ 1 - 1
test/unit/math/Matrix4.js

@@ -217,7 +217,7 @@ test( "makeBasis/extractBasis", function() {
 	var identity = new THREE.Matrix4();
 	var identity = new THREE.Matrix4();
 	ok( matrixEquals4( a, identity ), "Passed!" );
 	ok( matrixEquals4( a, identity ), "Passed!" );
 
 
-	var testBases = [ [ new THREE.Vector3( 0, 1, 0 ), new THREE.Vector3( -1, 0, 0 ), new THREE.Vector3( 0, 0, 1 ) ] ]
+	var testBases = [ [ new THREE.Vector3( 0, 1, 0 ), new THREE.Vector3( -1, 0, 0 ), new THREE.Vector3( 0, 0, 1 ) ] ];
 	for( var i = 0; i < testBases.length; i ++ ) {
 	for( var i = 0; i < testBases.length; i ++ ) {
 		var testBasis = testBases[i];
 		var testBasis = testBases[i];
 		var b = new THREE.Matrix4().makeBasis( testBasis[0], testBasis[1], testBasis[2] );
 		var b = new THREE.Matrix4().makeBasis( testBasis[0], testBasis[1], testBasis[2] );

+ 2 - 2
test/unit/math/Quaternion.js

@@ -240,7 +240,7 @@ function doSlerpObject( aArr, bArr, t ) {
 
 
 	};
 	};
 
 
-};
+}
 
 
 function doSlerpArray( a, b, t ) {
 function doSlerpArray( a, b, t ) {
 
 
@@ -285,7 +285,7 @@ function slerpTestSkeleton( doSlerp, maxError ) {
 		0.6753410084407496,
 		0.6753410084407496,
 		0.4087830051091744,
 		0.4087830051091744,
 		0.32856700410659473,
 		0.32856700410659473,
-		0.5185120064806223,
+		0.5185120064806223
 	];
 	];
 
 
 	b = [
 	b = [

+ 1 - 1
test/unit/math/Sphere.js

@@ -92,7 +92,7 @@ test( "getBoundingBox", function() {
 
 
 	ok( a.getBoundingBox().equals( new THREE.Box3( zero3, two3 ) ), "Passed!" );
 	ok( a.getBoundingBox().equals( new THREE.Box3( zero3, two3 ) ), "Passed!" );
 
 
-	a.set( zero3, 0 )
+	a.set( zero3, 0 );
 	ok( a.getBoundingBox().equals( new THREE.Box3( zero3, zero3 ) ), "Passed!" );
 	ok( a.getBoundingBox().equals( new THREE.Box3( zero3, zero3 ) ), "Passed!" );
 });
 });