Skip to content

Commit 50151a1

Browse files
committed
fix mergeGeometries
1 parent c474dd7 commit 50151a1

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/core/utils/mergeGeometries.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,20 @@ export function mergeGeometries( geometries, options = {}, targetGeometry = new
205205
const attr = geometry.getAttribute( key );
206206
if ( ! skip ) {
207207

208-
copyAttributeContents( attr, targetAttribute, offset );
208+
if ( key === 'color' && targetAttribute.itemSize !== attr.itemSize ) {
209+
210+
//make sure the color attribute is aligned with itemSize 3 to 4
211+
for ( let index = offset; index < attr.count; ++ index ) {
212+
213+
attr.setXYZW( index, targetAttribute.getX( index ), targetAttribute.getY( index ), targetAttribute.getZ( index ), 1.0 );
214+
215+
}
216+
217+
} else {
218+
219+
copyAttributeContents( attr, targetAttribute, offset );
220+
221+
}
209222

210223
}
211224

0 commit comments

Comments
 (0)