merge method

BufferGeometry merge(
  1. BufferGeometry geometry, [
  2. int? offset
])
inherited

Implementation

BufferGeometry merge(BufferGeometry geometry, [int? offset]) {
  // if (!(geometry && geometry.isBufferGeometry)) {
  //   print(
  //       'three.BufferGeometry.merge(): geometry not an instance of three.BufferGeometry. $geometry');
  //   return;
  // }

  if (offset == null) {
    offset = 0;

    print('three.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. '
        'Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.');
  }

  var attributes = this.attributes;

  for (var key in attributes.keys) {
    if (geometry.attributes[key] != null) {
      var attribute1 = attributes[key];
      var attributeArray1 = attribute1.array;

      var attribute2 = geometry.attributes[key];
      var attributeArray2 = attribute2.array;

      var attributeOffset = attribute2.itemSize * offset;
      var length = Math.min<int>(attributeArray2.length, attributeArray1.length - attributeOffset);

      for (var i = 0, j = attributeOffset; i < length; i++, j++) {
        attributeArray1[j] = attributeArray2[i];
      }
    }
  }

  return this;
}