merge method
BufferGeometry
merge(
- BufferGeometry geometry, [
- int? offset
])
inherited
Implementation
BufferGeometry merge(BufferGeometry geometry, [int? offset]) {
if (offset == null) {
offset = 0;
console.warning('BufferGeometry.merge(): Overwriting original geometry, starting at offset=0.\nUse BufferGeometryUtils.mergeBufferGeometries() for lossless merge.');
}
final attributes = this.attributes;
for (String key in attributes.keys) {
if (geometry.attributes[key] != null) {
final attribute1 = attributes[key];
final attributeArray1 = attribute1.array;
final attribute2 = geometry.attributes[key];
final attributeArray2 = attribute2.array;
final attributeOffset = attribute2.itemSize * offset;
final length = math.min<int>(attributeArray2.length, attributeArray1.length - attributeOffset);
for (int i = 0, j = attributeOffset; i < length; i++, j++) {
attributeArray1[j] = attributeArray2[i];
}
}
}
return this;
}