natiny.material.set_matrix

Lua
natiny.material.set_matrix(material, name, values)

Sets a mat4 constant by name. values is a table of 16 numbers in column-major order, the order GLSL uses.

Parameters

Name Type Description
material number Material handle
name string Member name inside one of the shader's uniform blocks
values table 16 numbers, column-major

Example

Lua
natiny.material.set_matrix(material, "mtx_custom", {
    1, 0, 0, 0,
    0, 1, 0, 0,
    0, 0, 1, 0,
    0, 0, 0, 1,
})

Notes

  • values must contain 16 numbers in column-major order and the named member must be a mat4.
  • The same name is updated in every compatible block and stage. Unknown names and non-mat4 members are reported and left unchanged.