Skip to content

Commit

Permalink
Merge pull request #657 from dongho-shin/dev/fix-attribute
Browse files Browse the repository at this point in the history
fix mergeGeometries exception color attribute
  • Loading branch information
gkjohnson committed Jun 29, 2024
2 parents c474dd7 + 50151a1 commit f2082e7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/core/utils/mergeGeometries.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,20 @@ export function mergeGeometries( geometries, options = {}, targetGeometry = new
const attr = geometry.getAttribute( key );
if ( ! skip ) {

copyAttributeContents( attr, targetAttribute, offset );
if ( key === 'color' && targetAttribute.itemSize !== attr.itemSize ) {

//make sure the color attribute is aligned with itemSize 3 to 4
for ( let index = offset; index < attr.count; ++ index ) {

attr.setXYZW( index, targetAttribute.getX( index ), targetAttribute.getY( index ), targetAttribute.getZ( index ), 1.0 );

}

} else {

copyAttributeContents( attr, targetAttribute, offset );

}

}

Expand Down

0 comments on commit f2082e7

Please sign in to comment.