diff options
-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 { |