From 018b7ce3f7d94af92fa4fab32ffdde451da7fcb9 Mon Sep 17 00:00:00 2001 From: sanine-a Date: Sat, 23 May 2020 11:56:10 -0500 Subject: refactor: rename number, vector, etc in honey_shader_set_* to value --- src/shader.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src') 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); } /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -- cgit v1.2.1