diff options
author | sanine-a <sanine.not@pm.me> | 2020-05-23 11:56:10 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2020-05-23 11:56:10 -0500 |
commit | 018b7ce3f7d94af92fa4fab32ffdde451da7fcb9 (patch) | |
tree | 54a320cd0a18d0cabf4caee3f784c5414c11d6f4 /src/shader.c | |
parent | a247c0adac7b3e50c72fde9b197ef6eabfd38b0b (diff) |
refactor: rename number, vector, etc in honey_shader_set_* to value
Diffstat (limited to 'src/shader.c')
-rw-r--r-- | src/shader.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/shader.c b/src/shader.c index 530cc8f..e9d79a6 100644 --- a/src/shader.c +++ b/src/shader.c @@ -91,30 +91,40 @@ enum honey_shader_result honey_shader_load(honey_shader* shader, void honey_shader_set_int(honey_shader shader, char* int_name, - int number) { + int value) { honey_shader_use(shader); unsigned int int_location = glGetUniformLocation(shader, int_name); - glUniform1i(int_location, number); + glUniform1i(int_location, value); +} + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +void honey_shader_set_float(honey_shader shader, + char* float_name, + float value) { + honey_shader_use(shader); + unsigned int float_location = glGetUniformLocation(shader, float_name); + glUniform1f(float_location, value); } /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ void honey_shader_set_vec3(honey_shader shader, char* vector_name, - vec3 vector) { + vec3 value) { honey_shader_use(shader); unsigned int vector_location = glGetUniformLocation(shader, vector_name); - glUniform3fv(vector_location, 1, (float*) vector); + glUniform3fv(vector_location, 1, (float*) value); } /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ void honey_shader_set_mat4(honey_shader shader, char* matrix_name, - mat4 matrix) { + mat4 value) { glUseProgram(shader); unsigned int matrix_location = glGetUniformLocation(shader, matrix_name); - glUniformMatrix4fv(matrix_location, 1, GL_FALSE, (float*) matrix); + glUniformMatrix4fv(matrix_location, 1, GL_FALSE, (float*) value); } /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ |