src/programs.js
function setBlockUniforms(uniformBlockInfo, values) {
  const uniforms = uniformBlockInfo.uniforms;
  for (const name in values) {
    const array = uniforms[name];
    if (array) {
      const value = values[name];
      if (value.length) {
        array.set(value);
      } else {
        array[0] = value;
      }
    }
  }
}
function setBlockUniforms(uniformBlockInfo, values) {
  const uniforms = uniformBlockInfo.uniforms;
  for (const name in values) {
    const array = uniforms[name];
    if (array) {
      const value = values[name];
      if (value.length) {
        array.set(value);
      } else {
        array[0] = value;
      }
    }
  }
}
function setBlockUniforms ( uniformBlockInfo , values ) { const uniforms = uniformBlockInfo . uniforms ; for ( const name in values ) { const array = uniforms [ name ] ; if ( array ) { const value = values [ name ] ; if ( value . length ) { array . set ( value ) ; } else { array [ 0 ] = value ; } } } }
Sets values of a uniform block object

@param {module:twgl.UniformBlockInfo} uniformBlockInfo A UniformBlockInfo as returned by {@link module:twgl.createUniformBlockInfo}.
@param {Object.<string, ?>} values A uniform name to value map where the value is correct for the given
type of uniform. So for example given a block like

uniform SomeBlock {
float someFloat;
vec2 someVec2;
vec3 someVec3Array[2];
int someInt;
}

You can set the values of the uniform block with

twgl.setBlockUniforms(someBlockInfo, {
someFloat: 12.3,
someVec2: [1, 2],
someVec3Array: [1, 2, 3, 4, 5, 6],
someInt: 5,
}

Arrays can be JavaScript arrays or typed arrays

Any name that doesn't match will be ignored
@memberOf module:twgl/programs
Sets values of a uniform block object