From 5cc09d9389243791f8f65f96a4d19a74337f2a73 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 24 Jul 2024 20:20:57 +0200 Subject: add vec3 and vec4 and shader uniform functions for those --- include/mgl/gl.h | 3 ++- include/mgl/graphics/shader.h | 2 ++ include/mgl/system/vec.h | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/mgl/gl.h b/include/mgl/gl.h index c1059b6..2537d96 100644 --- a/include/mgl/gl.h +++ b/include/mgl/gl.h @@ -33,7 +33,6 @@ typedef struct { void (*glTexSubImage2D)(unsigned int target, int level, int xoffset, int yoffset, int width, int height, unsigned int format, unsigned int type, const void *pixels); void (*glBindTexture)(unsigned int target, unsigned int texture); void (*glTexParameteri)(unsigned int target, unsigned int pname, int param); - void (*glHint)(unsigned int target, unsigned int mode); void (*glBegin)(unsigned int mode); void (*glEnd)(void); void (*glVertex3f)(float x, float y, float z); @@ -73,6 +72,8 @@ typedef struct { int (*glGetUniformLocation)(unsigned int program, const char *name); void (*glUniform1f)(int location, float v0); void (*glUniform2f)(int location, float v0, float v1); + void (*glUniform3f)(int location, float v0, float v1, float v2); + void (*glUniform4f)(int location, float v0, float v1, float v2, float v3); unsigned int (*glGetError)(void); const unsigned char* (*glGetString)(unsigned int name); void (*glGetIntegerv)(unsigned int pname, int *params); diff --git a/include/mgl/graphics/shader.h b/include/mgl/graphics/shader.h index daf8ac3..16b573a 100644 --- a/include/mgl/graphics/shader.h +++ b/include/mgl/graphics/shader.h @@ -24,6 +24,8 @@ int mgl_shader_program_finalize(mgl_shader_program *self); int mgl_shader_program_set_uniform_float(mgl_shader_program *self, const char *uniform_name, float value); int mgl_shader_program_set_uniform_vec2f(mgl_shader_program *self, const char *uniform_name, mgl_vec2f value); +int mgl_shader_program_set_uniform_vec3f(mgl_shader_program *self, const char *uniform_name, mgl_vec3f value); +int mgl_shader_program_set_uniform_vec4f(mgl_shader_program *self, const char *uniform_name, mgl_vec4f value); /* If |shader_program| is NULL then no shader is used */ void mgl_shader_program_use(mgl_shader_program *shader_program); diff --git a/include/mgl/system/vec.h b/include/mgl/system/vec.h index 8b87376..444efcf 100644 --- a/include/mgl/system/vec.h +++ b/include/mgl/system/vec.h @@ -5,8 +5,24 @@ typedef struct { float x, y; } mgl_vec2f; +typedef struct { + float x, y, z; +} mgl_vec3f; + +typedef struct { + float x, y, z, w; +} mgl_vec4f; + typedef struct { int x, y; } mgl_vec2i; +typedef struct { + int x, y, z; +} mgl_vec3i; + +typedef struct { + int x, y, z, w; +} mgl_vec4i; + #endif /* MGL_VEC_H */ -- cgit v1.2.3