Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BufferGeometryUtils: show error if number of attributes is inconsistent. #19208

Merged
merged 1 commit into from
Apr 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions examples/js/utils/BufferGeometryUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ THREE.BufferGeometryUtils = {
for ( var i = 0; i < geometries.length; ++ i ) {

var geometry = geometries[ i ];
var attributesCount = 0;

// ensure that all geometries are indexed, or none

Expand All @@ -219,6 +220,17 @@ THREE.BufferGeometryUtils = {

attributes[ name ].push( geometry.attributes[ name ] );

attributesCount ++;

}

// ensure geometries have the same number of attributes

if ( attributesCount !== attributesUsed.size ) {

console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. Make sure all geometries have the same number of attributes.' );
return null;

}

// gather morph attributes, exit early if they're different
Expand Down
12 changes: 12 additions & 0 deletions examples/jsm/utils/BufferGeometryUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ var BufferGeometryUtils = {
for ( var i = 0; i < geometries.length; ++ i ) {

var geometry = geometries[ i ];
var attributesCount = 0;

// ensure that all geometries are indexed, or none

Expand All @@ -230,6 +231,17 @@ var BufferGeometryUtils = {

attributes[ name ].push( geometry.attributes[ name ] );

attributesCount ++;

}

// ensure geometries have the same number of attributes

if ( attributesCount !== attributesUsed.size ) {

console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. Make sure all geometries have the same number of attributes.' );
return null;

}

// gather morph attributes, exit early if they're different
Expand Down