summary refs log tree commit diff
path: root/src/shader
diff options
context:
space:
mode:
authoriurii <[email protected]>2024-09-07 12:51:36 +0200
committeriurii <[email protected]>2024-09-07 12:51:36 +0200
commit7019eba5e9fe2500e30b542e8a982a4edae40940 (patch)
tree23b8a9de581f30022e7c97b2fa0913bfc9ac30db /src/shader
parentc78784795449732a4d7edb72af28506ab16d0117 (diff)
downloadfunhalla-7019eba5e9fe2500e30b542e8a982a4edae40940.tar.gz
refactored and wip texture loader
Diffstat (limited to 'src/shader')
-rw-r--r--src/shader/shader.odin60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/shader/shader.odin b/src/shader/shader.odin
deleted file mode 100644
index 720efde..0000000
--- a/src/shader/shader.odin
+++ /dev/null
@@ -1,60 +0,0 @@
-package shader
-
-import "core:math/linalg"
-import "core:strings"
-import gl "vendor:OpenGL"
-
-Shader :: struct {
-	id: u32,
-}
-
-SHADER_LOAD_ERROR :: -1
-SHADER_OK :: 0
-
-Vec3 :: linalg.Vector3f32
-Mat4 :: linalg.Matrix4x4f32
-
-shader_init :: proc(vsp, fsp: string) -> (^Shader, int) {
-	program_id, ok := gl.load_shaders_file(vsp, fsp)
-
-	if !ok {
-		return nil, SHADER_LOAD_ERROR
-	}
-
-	shader := new(Shader)
-	shader.id = program_id
-
-	return shader, SHADER_OK
-}
-
-use :: proc(using shader: ^Shader) {
-	gl.UseProgram(id)
-}
-
-set_bool :: proc(using shader: ^Shader, name: cstring, value: bool) {
-	gl.Uniform1i(gl.GetUniformLocation(id, name), i32(value))
-}
-
-set_i32 :: proc(using shader: ^Shader, name: cstring, value: i32) {
-	gl.Uniform1i(gl.GetUniformLocation(id, name), value)
-}
-
-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: ^Vec3) {
-	gl.Uniform3fv(gl.GetUniformLocation(id, name), 1, &value[0])
-}
-
-set_mat4 :: proc(using shader: ^Shader, name: cstring, value: ^Mat4) {
-	gl.UniformMatrix4fv(gl.GetUniformLocation(id, name), 1, gl.FALSE, &value[0][0])
-}
-
-set_value :: proc {
-	set_i32,
-	set_f32,
-	set_vec3,
-	set_mat4,
-	set_bool,
-}