setValueM2 method

dynamic setValueM2(
  1. dynamic gl,
  2. dynamic v, [
  3. WebGLTextures? textures
])

Implementation

setValueM2(gl, v, [WebGLTextures? textures]) {
  var cache = this.cache;
  var elements = v.elements;

  if (elements == null) {
    if (arraysEqual(cache, v)) return;

    gl.uniformMatrix2fv(addr, false, v);

    copyArray(cache, v);
  } else {
    if (arraysEqual(cache, elements)) return;

    mat2array.set(List<double>.from(elements.map((e) => e.toDouble())), 0);

    gl.uniformMatrix2fv(addr, false, mat2array);

    copyArray(cache, elements);
  }
}