addVec2Uniform method

bool addVec2Uniform(
  1. String name,
  2. List<double> val
)
  • add VEC2

Implementation

bool addVec2Uniform(String name, List<double> val) {
  assert(
      val.length == 2,
      "Assert error: vec2 has 2 doubles."
      "You have passed a list with ${val.length}");
  ffi.Pointer<ffi.Float> valT = calloc(ffi.sizeOf<ffi.Float>() * 2);
  for (int i = 0; i < val.length; ++i) {
    valT[i] = val[i];
  }

  int ret = _addUniform(
    name.toNativeUtf8().cast<ffi.Char>(),
    UniformType.uniformVec2.index,
    valT.cast<ffi.Void>(),
  );
  calloc.free(valT);
  return ret == 0 ? false : true;
}