Gawain: more ways to set uniform color

This commit is contained in:
Mike Erwin
2016-10-06 09:37:04 -04:00
parent 1731e94d0c
commit e86bd78745
2 changed files with 13 additions and 1 deletions

View File

@@ -650,6 +650,16 @@ void immVertex2iv(unsigned attrib_id, const int data[2])
immEndVertex();
}
void immUniformColor3fv(const float rgb[3])
{
immUniform4f("color", rgb[0], rgb[1], rgb[2], 1.0f);
}
void immUniformColor4fv(const float rgba[4])
{
immUniform4f("color", rgba[0], rgba[1], rgba[2], rgba[3]);
}
void immUniformColor3ub(unsigned char r, unsigned char g, unsigned char b)
{
const float scale = 1.0f / 255.0f;

View File

@@ -70,7 +70,9 @@ void immUniform1f(const char* name, float x);
void immUniform4f(const char* name, float x, float y, float z, float w);
// these set "uniform vec4 color"
// TODO: treat as sRGB?
void immUniformColor3fv(const float rgb[3]);
void immUniformColor4fv(const float rgba[4]);
// TODO: v-- treat as sRGB? --v
void immUniformColor3ub(unsigned char r, unsigned char g, unsigned char b);
void immUniformColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
void immUniformColor3ubv(const unsigned char data[3]);