summary refs log tree commit diff
path: root/src/shader/shader.odin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/shader/shader.odin12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/shader/shader.odin b/src/shader/shader.odin
index 171d7ad..2aa989c 100644
--- a/src/shader/shader.odin
+++ b/src/shader/shader.odin
@@ -1,5 +1,6 @@
 package shader
 
+import "core:math/linalg"
 import "core:os"
 import "core:strings"
 import gl "vendor:OpenGL"
@@ -11,6 +12,9 @@ Shader :: struct {
 SHADER_LOAD_ERROR :: -1
 SHADER_OK :: 0
 
+Vec3 :: linalg.Vector3f32
+Mat4 :: linalg.Matrix4x4f32
+
 shader_init :: proc(vsp, fsp: string) -> (^Shader, int) {
 	assert(os.is_file_path(vsp))
 	assert(os.is_file_path(fsp))
@@ -43,6 +47,14 @@ set_f32 :: proc(using shader: ^Shader, name: cstring, value: f32) {
 	gl.Uniform1f(gl.GetUniformLocation(id, name), value)
 }
 
+set_vec3 :: proc(using shader: ^Shader, name: cstring, value: [^]f32) {
+	gl.Uniform3fv(gl.GetUniformLocation(id, name), 1, value)
+}
+
+set_mat4 :: proc(using shader: ^Shader, name: cstring, value: [^]f32) {
+	gl.UniformMatrix4fv(gl.GetUniformLocation(id, name), 1, gl.FALSE, value)
+}
+
 set_value :: proc {
 	set_i32,
 	set_f32,