diff options
author | iurii plugatarov <[email protected]> | 2024-08-19 23:49:44 +0200 |
---|---|---|
committer | iurii plugatarov <[email protected]> | 2024-08-19 23:49:44 +0200 |
commit | 0be81b1387f010bb00e1ea34ff66561fa67cedef (patch) | |
tree | ba7f9674e339e82abc495bf64aac6a80125b0c8c | |
parent | 30c8a4d7c2160c174392aa2dccf60178f9cd02c2 (diff) | |
download | funhalla-0be81b1387f010bb00e1ea34ff66561fa67cedef.tar.gz |
updated code
Diffstat (limited to '')
-rw-r--r-- | src/main.odin | 14 | ||||
-rw-r--r-- | src/shader/shader.odin | 8 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/main.odin b/src/main.odin index 43cd5fb..f09ccb4 100644 --- a/src/main.odin +++ b/src/main.odin @@ -225,9 +225,9 @@ main :: proc() { shader.use(lighting_shader) object_color := Vec3{1.0, 0.5, 0.31} light_color := Vec3{1.0, 1.0, 1.0} - shader.set_vec3(lighting_shader, cstring("object_color"), &object_color[0]) - shader.set_vec3(lighting_shader, cstring("light_color"), &light_color[0]) - shader.set_vec3(lighting_shader, cstring("light_position"), &light_pos[0]) + shader.set_vec3(lighting_shader, cstring("object_color"), &object_color) + shader.set_vec3(lighting_shader, cstring("light_color"), &light_color) + shader.set_vec3(lighting_shader, cstring("light_position"), &light_pos) aspect: f32 = 800.0 / 600.0 projection := linalg.matrix4_perspective_f32( @@ -246,18 +246,18 @@ main :: proc() { gl.UniformMatrix4fv(projection_location, 1, gl.FALSE, &projection[0][0]) model := linalg.MATRIX4F32_IDENTITY - shader.set_mat4(lighting_shader, cstring("model"), &model[0][0]) + shader.set_mat4(lighting_shader, cstring("model"), &model) gl.BindVertexArray(cube_vao) gl.DrawArrays(gl.TRIANGLES, 0, 36) shader.use(light_cube_shader) - shader.set_mat4(light_cube_shader, cstring("projection"), &projection[0][0]) - shader.set_mat4(light_cube_shader, cstring("view"), &view[0][0]) + shader.set_mat4(light_cube_shader, cstring("projection"), &projection) + shader.set_mat4(light_cube_shader, cstring("view"), &view) model = linalg.matrix4_translate_f32(light_pos) model *= linalg.matrix4_scale_f32(Vec3{0.2, 0.2, 0.2}) - shader.set_mat4(light_cube_shader, cstring("model"), &model[0][0]) + shader.set_mat4(light_cube_shader, cstring("model"), &model) gl.BindVertexArray(light_cube_vao) gl.DrawArrays(gl.TRIANGLES, 0, 36) diff --git a/src/shader/shader.odin b/src/shader/shader.odin index 2aa989c..cd798ff 100644 --- a/src/shader/shader.odin +++ b/src/shader/shader.odin @@ -47,12 +47,12 @@ 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_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: [^]f32) { - gl.UniformMatrix4fv(gl.GetUniformLocation(id, name), 1, gl.FALSE, value) +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 { |