addMat2Uniform method

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

Implementation

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

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