提交 b8d16dae 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #10114 from TristanVALCKE/src_warning_fix

Sources warning fix
......@@ -74,7 +74,7 @@ function AnimationAction( mixer, clip, localRoot ) {
this.zeroSlopeAtStart = true; // for smooth interpolation w/o separate
this.zeroSlopeAtEnd = true; // clips for start, loop and end
};
}
AnimationAction.prototype = {
......@@ -273,7 +273,7 @@ AnimationAction.prototype = {
if ( interpolant === null ) {
interpolant = mixer._lendControlInterpolant(),
interpolant = mixer._lendControlInterpolant();
this._timeScaleInterpolant = interpolant;
}
......@@ -473,7 +473,7 @@ AnimationAction.prototype = {
if ( loopCount === -1 ) {
// just started
this.loopCount = 0;
this._loopCount = 0;
this._setEndings( true, true, false );
}
......@@ -636,7 +636,7 @@ AnimationAction.prototype = {
if ( interpolant === null ) {
interpolant = mixer._lendControlInterpolant(),
interpolant = mixer._lendControlInterpolant();
this._weightInterpolant = interpolant;
}
......
......@@ -45,8 +45,7 @@ AnimationClip.prototype = {
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 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];
......@@ -320,8 +318,7 @@ Object.assign( AnimationClip, {
}
tracks.push( new NumberKeyframeTrack(
'.morphTargetInfluence[' + morphTargetName + ']', times, values ) );
tracks.push( new NumberKeyframeTrack('.morphTargetInfluence[' + morphTargetName + ']', times, values ) );
}
......
......@@ -92,7 +92,8 @@ AnimationObjectGroup.prototype = {
var object = arguments[ i ],
uuid = object.uuid,
index = indicesByUUID[ uuid ];
index = indicesByUUID[ uuid ],
knownObject = undefined;
if ( index === undefined ) {
......@@ -114,7 +115,7 @@ AnimationObjectGroup.prototype = {
} else if ( index < nCachedObjects ) {
var knownObject = objects[ index ];
knownObject = objects[ index ];
// move existing object to the ACTIVE region
......
......@@ -171,7 +171,10 @@ KeyframeTrackPrototype = {
if( from !== 0 || to !== nKeys ) {
// 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();
this.times = AnimationUtils.arraySlice( times, from, to );
......@@ -359,6 +362,6 @@ KeyframeTrackPrototype = {
}
}
};
export { KeyframeTrackPrototype };
......@@ -20,14 +20,18 @@ function PropertyMixer( binding, typeName, valueSize ) {
switch ( typeName ) {
case 'quaternion': mixFunction = this._slerp; break;
case 'quaternion':
mixFunction = this._slerp;
break;
case 'string':
case 'bool':
bufferType = Array;
mixFunction = this._select;
break;
bufferType = Array, mixFunction = this._select; break;
default: mixFunction = this._lerp;
default:
mixFunction = this._lerp;
}
......
......@@ -21,7 +21,7 @@ NumberKeyframeTrack.prototype =
constructor: NumberKeyframeTrack,
ValueTypeName: 'number',
ValueTypeName: 'number'
// ValueBufferType is inherited
......
......@@ -41,7 +41,7 @@ Object.assign( DirectGeometry.prototype, {
var group;
var groups = [];
var materialIndex;
var materialIndex = undefined;
var faces = geometry.faces;
......
......@@ -32,13 +32,7 @@ Object.assign( EventDispatcher.prototype, {
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 );
},
......
......@@ -18,7 +18,7 @@ AmbientLight.prototype = Object.assign( Object.create( Light.prototype ), {
constructor: AmbientLight,
isAmbientLight: true,
isAmbientLight: true
} );
......
......@@ -129,27 +129,13 @@ Box2.prototype = {
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 ) {
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.
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);
},
......
......@@ -275,29 +275,13 @@ Box3.prototype = {
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 ) {
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.
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);
},
......
......@@ -720,7 +720,7 @@ Vector3.prototype = {
if ( typeof m === 'number' ) {
console.warn( 'THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).' );
var temp = m
var temp = m;
m = index;
index = temp;
......
......@@ -87,7 +87,7 @@ var ShaderLib = {
emissive : { value: new Color( 0x000000 ) },
roughness: { value: 0.5 },
metalness: { value: 0 },
envMapIntensity : { value: 1 }, // temporary
envMapIntensity : { value: 1 } // temporary
}
),
......
......@@ -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.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.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' );
......
......@@ -67,11 +67,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, paramT
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
......
......@@ -6,7 +6,7 @@ module( "OrthographicCamera" );
test( "updateProjectionMatrix", function() {
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
var pMatrix = cam.projectionMatrix.elements;
......
......@@ -21,7 +21,6 @@ function vectorsAreEqual( check, that ) {
}
}
return;
}
test( "basic check", function() {
......@@ -54,4 +53,4 @@ test( "basic check", function() {
var desc = error ? ' ' + error : '';
ok( !error, 'Lists of Vectors3 should be equal.' + desc );
});
\ No newline at end of file
});
......@@ -3,7 +3,7 @@
'use strict';
var parameters = {
diameter: 10,
diameter: 10
};
var geometries;
......
......@@ -8,7 +8,7 @@
depth: 30,
widthSegments: 2,
heightSegments: 3,
depthSegments: 4,
depthSegments: 4
};
var geometries;
......
......@@ -7,14 +7,10 @@ module( "Frustum" );
var unit3 = new THREE.Vector3( 1, 0, 0 );
var planeEquals = function ( a, b, tolerance ) {
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() {
......@@ -68,7 +64,7 @@ test( "copy", 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 );
ok( ! a.containsPoint( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
......@@ -88,7 +84,7 @@ test( "setFromMatrix/makeOrthographic/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 );
ok( ! a.containsPoint( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
......@@ -107,7 +103,7 @@ test( "setFromMatrix/makeFrustum/containsPoint", 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 );
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
a.planes[0].copy( p1 );
ok( b.planes[0].equals( p0 ), "Passed!" );
});
\ No newline at end of file
});
......@@ -217,7 +217,7 @@ test( "makeBasis/extractBasis", function() {
var identity = new THREE.Matrix4();
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 ++ ) {
var testBasis = testBases[i];
var b = new THREE.Matrix4().makeBasis( testBasis[0], testBasis[1], testBasis[2] );
......
......@@ -240,7 +240,7 @@ function doSlerpObject( aArr, bArr, t ) {
};
};
}
function doSlerpArray( a, b, t ) {
......@@ -285,7 +285,7 @@ function slerpTestSkeleton( doSlerp, maxError ) {
0.6753410084407496,
0.4087830051091744,
0.32856700410659473,
0.5185120064806223,
0.5185120064806223
];
b = [
......
......@@ -92,7 +92,7 @@ test( "getBoundingBox", function() {
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!" );
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册