self:set_param_color

Client

Sets a color uniform parameter on the shader by name


Syntax

local status = self:set_param_color(
    name,
    color
)

Parameters

TypeNameDescription
stringnameName of the uniform parameter as declared in the GLSL source
colorcolorColor value to assign as {r, g, b, a}

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Set a color uniform on a shader
local entity = core.shader.create("assets/shaders/tint.glsl", core.shader.shader_mode.CANVAS_ITEM)

entity:set_param_color("tint_color", {1.0, 0.2, 0.2, 1.0})
Set an emissive color on a spatial shader
local entity = core.shader.create("assets/shaders/emissive.glsl", core.shader.shader_mode.SPATIAL)

entity:set_param_color("emission_color", {0.0, 0.5, 1.0, 1.0})

On this page