natiny.material.set_constant
natiny.material.set_constant(material, name, x [, y [, z [, w]]])
Sets a scalar or vector constant by its shader member name.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
material |
number |
Material handle | |
name |
string |
Member name inside one of the shader's uniform blocks | |
x |
number |
First component | |
y |
number |
0 |
Second component |
z |
number |
0 |
Third component |
w |
number |
0 |
Fourth component |
Example
natiny.material.set_constant(material, "tint", 1, 0.5, 0.5, 1)
Notes
- Only as many components as the member holds are written. The same name is updated in every block and shader stage where it appears.
- Engine-owned constants are overwritten on every draw. Change their ownership with natiny.material.set_vertex_constant before setting them as user values.
- For a
mat4use natiny.material.set_matrix. - An unknown name is reported and ignored.