setInstances method

void setInstances(
  1. List<Matrix4> worlds
)

Replaces the instances with one at each of worlds (world from local), and their bounds with what primitive's bounds become there.

Implementation

void setInstances(List<Matrix4> worlds) {
  final need = worlds.length * kBatchInstanceFloats;
  if (_data.length < need) _data = Float32List(need);
  bounds.setEmpty();
  for (var i = 0; i < worlds.length; i++) {
    writeInstance(_data, i * kBatchInstanceFloats, worlds[i]);
    primitive.bounds.transformInto(worlds[i], _one);
    bounds.addBox(_one);
  }
  _count = worlds.length;
  _revision++;
}