You are currently viewing the GMLscripts.com static mirror. Forum access and script submissions are not available through this mirror.

Invert GMLscripts.com

shader_set_uniform_color

This is a simple utility function to help set shader colors just a tiny bit more easily. It takes a standard GM:Studio Color and Alpha values as arguments.

shader_set_uniform_color(uniform,color,alpha)
Sets a vec4 shader uniform with a color and alpha value.
COPY/// shader_set_uniform_color(uniform,color,alpha)
//
//  Sets a vec4 shader uniform with a color and alpha value.
//
//      uniform     shader uniform handle, integer
//      color       standard GM color value, integer
//      alpha       alpha in [0,1] range, real
//
/// GMLscripts.com/license
{
    shader_set_uniform_f(argument0, 
                         color_get_red(argument1) / 255, 
                         color_get_green(argument1) / 255,
                         color_get_blue(argument1) / 255,
                         argument2);
    return 0;
}

Contributors: xot

GitHub: View · Commits · Blame · Raw