setPositions method

  1. @override
dynamic setPositions(
  1. dynamic array
)
override

Implementation

@override
setPositions(array) {
  // converts [ x1, y1, z1,  x2, y2, z2, ... ] to pairs format

  int length = array.length - 3;
  var points = Float32Array(2 * length);

  for (var i = 0; i < length; i += 3) {
    points[2 * i] = array[i];
    points[2 * i + 1] = array[i + 1];
    points[2 * i + 2] = array[i + 2];

    points[2 * i + 3] = array[i + 3];
    points[2 * i + 4] = array[i + 4];
    points[2 * i + 5] = array[i + 5];
  }

  super.setPositions(points);

  return this;
}