diff options
author | iurii plugatarov <[email protected]> | 2024-08-18 19:44:13 +0200 |
---|---|---|
committer | iurii plugatarov <[email protected]> | 2024-08-18 19:44:13 +0200 |
commit | 05aa5178f7b0cf0962d4125a6a0af76a972150f2 (patch) | |
tree | dae1b4c8a6db849ea302947d1bdac632c31e9964 /src/shader/shader.odin | |
parent | 054ed4d4ff5b5cdcd6b813e9821912742ea6a654 (diff) | |
download | funhalla-05aa5178f7b0cf0962d4125a6a0af76a972150f2.tar.gz |
light
Diffstat (limited to '')
-rw-r--r-- | src/shader/shader.odin | 12 |
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, |