setColors method

dynamic setColors(
  1. dynamic array
)

Implementation

setColors(array) {
  var colors;

  if (array is Float32Array) {
    colors = array;
  } else if (array is List) {
    colors = Float32Array.from(List<double>.from(array));
  }

  var instanceColorBuffer =
      new InstancedInterleavedBuffer(colors, 6, 1); // rgb, rgb

  this.setAttribute(
      'instanceColorStart',
      new InterleavedBufferAttribute(
          instanceColorBuffer, 3, 0, false)); // rgb
  this.setAttribute(
      'instanceColorEnd',
      new InterleavedBufferAttribute(
          instanceColorBuffer, 3, 3, false)); // rgb

  return this;
}