Skip to content

Commit

Permalink
Core: Remove remaining DeepScan issues. (#23440)
Browse files Browse the repository at this point in the history
* Core: Remove remaining DeepScan issues.

* BufferGeometry: Fix computeTangents().
  • Loading branch information
Mugen87 authored Feb 7, 2022
1 parent e162ded commit f66f975
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/animation/PropertyBinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class PropertyBinding {

const matches = _trackRe.exec( trackName );

if ( ! matches ) {
if ( matches === null ) {

throw new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );

Expand Down Expand Up @@ -195,7 +195,7 @@ class PropertyBinding {

static findNode( root, nodeName ) {

if ( ! nodeName || nodeName === '' || nodeName === '.' || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) {
if ( nodeName === undefined || nodeName === '' || nodeName === '.' || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) {

return root;

Expand Down
4 changes: 2 additions & 2 deletions src/core/BufferGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,13 +492,13 @@ class BufferGeometry extends EventDispatcher {

const nVertices = positions.length / 3;

if ( attributes.tangent === undefined ) {
if ( this.hasAttribute( 'tangent' ) === false ) {

this.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );

}

const tangents = attributes.tangent.array;
const tangents = this.getAttribute( 'tangent' ).array;

const tan1 = [], tan2 = [];

Expand Down
2 changes: 1 addition & 1 deletion src/extras/PMREMGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class PMREMGenerator {

} else { // Equirectangular

this._setSize( texture.image.width / 4 ?? 256 );
this._setSize( texture.image.width / 4 );

}

Expand Down
11 changes: 5 additions & 6 deletions src/extras/core/ShapePath.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class ShapePath {
if ( newShapes.length > 1 ) {

let ambiguous = false;
const toChange = [];
let toChange = 0;

for ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {

Expand All @@ -231,7 +231,8 @@ class ShapePath {

if ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {

if ( sIdx !== s2Idx ) toChange.push( { froms: sIdx, tos: s2Idx, hole: hIdx } );
if ( sIdx !== s2Idx ) toChange ++;

if ( hole_unassigned ) {

hole_unassigned = false;
Expand All @@ -256,12 +257,10 @@ class ShapePath {
}

}
// console.log("ambiguous: ", ambiguous);

if ( toChange.length > 0 ) {
if ( toChange > 0 && ambiguous === false ) {

// console.log("to change: ", toChange);
if ( ! ambiguous ) newShapeHoles = betterShapeHoles;
newShapeHoles = betterShapeHoles;

}

Expand Down
12 changes: 6 additions & 6 deletions src/renderers/webgl/WebGLAttributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@ function WebGLAttributes( gl, capabilities ) {

attribute.onUploadCallback();

let type = gl.FLOAT;
let type;

if ( array instanceof Float32Array ) {

type = gl.FLOAT;

} else if ( array instanceof Float64Array ) {

console.warn( 'THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.' );

} else if ( array instanceof Uint16Array ) {

if ( attribute.isFloat16BufferAttribute ) {
Expand All @@ -36,7 +32,7 @@ function WebGLAttributes( gl, capabilities ) {

} else {

console.warn( 'THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.' );
throw new Error( 'THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.' );

}

Expand Down Expand Up @@ -70,6 +66,10 @@ function WebGLAttributes( gl, capabilities ) {

type = gl.UNSIGNED_BYTE;

} else {

throw new Error( 'THREE.WebGLAttributes: Unsupported buffer data format: ' + array );

}

return {
Expand Down

0 comments on commit f66f975

Please sign in to comment.