Clay Engine: Added immUniform functions...

for vec3 arrays and matrix4.
This commit is contained in:
Clément Foucault
2017-02-14 14:32:14 +01:00
parent e30bc6f517
commit 1f139beee3
2 changed files with 25 additions and 0 deletions

View File

@@ -771,6 +771,18 @@ void immUniform3fv(const char* name, const float data[3])
glUniform3fv(loc, 1, data);
}
void immUniformArray3fv(const char* name, const float *data, int count)
{
int loc = glGetUniformLocation(imm.bound_program, name);
#if TRUST_NO_ONE
assert(loc != -1);
assert(count > 0);
#endif
glUniform3fv(loc, count, data);
}
void immUniform4f(const char* name, float x, float y, float z, float w)
{
int loc = glGetUniformLocation(imm.bound_program, name);
@@ -793,6 +805,17 @@ void immUniform4fv(const char* name, const float data[4])
glUniform4fv(loc, 1, data);
}
void immUniformMatrix4fv(const char* name, const float data[4][4])
{
int loc = glGetUniformLocation(imm.bound_program, name);
#if TRUST_NO_ONE
assert(loc != -1);
#endif
glUniformMatrix4fv(loc, 1, GL_FALSE, (float *)data);
}
void immUniform1i(const char* name, int x)
{
int loc = glGetUniformLocation(imm.bound_program, name);

View File

@@ -83,8 +83,10 @@ void immUniform2f(const char* name, float x, float y);
void immUniform2fv(const char* name, const float data[2]);
void immUniform3f(const char* name, float x, float y, float z);
void immUniform3fv(const char* name, const float data[3]);
void immUniformArray3fv(const char* name, const float *data, int count);
void immUniform4f(const char* name, float x, float y, float z, float w);
void immUniform4fv(const char* name, const float data[4]);
void immUniformMatrix4fv(const char* name, const float data[4][4]);
// convenience functions for setting "uniform vec4 color"