VecVec4i.generate constructor

VecVec4i.generate(
  1. int length,
  2. Vec4i generator(
    1. int i
    ), {
  3. bool dispose = true,
})

Implementation

factory VecVec4i.generate(int length, Vec4i Function(int i) generator, {bool dispose = true}) {
  final pp = calloc<cvg.VecVec4i>()..ref.length = length;
  pp.ref.ptr = calloc<cvg.Vec4i>(length);
  for (var i = 0; i < length; i++) {
    final v = generator(i);
    pp.ref.ptr[i] = v.ref;
    if (dispose) v.dispose();
  }
  return VecVec4i.fromPointer(pp);
}