summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.editorconfig17
-rw-r--r--res/shaders/colors.fs2
-rw-r--r--src/main.odin2
3 files changed, 20 insertions, 1 deletions
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..801e91e
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,17 @@
+# EditorConfig is awesome: https://EditorConfig.org
+
+# Top-most EditorConfig file
+root = true
+
+# Universal settings
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+# Odin files
+[*.odin]
+indent_style = space
+indent_size = 2
+tab_width = 2
diff --git a/res/shaders/colors.fs b/res/shaders/colors.fs
index 2184d03..83733cf 100644
--- a/res/shaders/colors.fs
+++ b/res/shaders/colors.fs
@@ -27,7 +27,7 @@ void main() {
   vec3 reflect_dir = reflect(-light_dir, norm);
   float spec = pow(max(dot(view_dir, reflect_dir), 0.0), 32);
   vec3 specular = specular_strength * spec * light_color;
-  
+
   vec3 result = (ambient + diffuse + specular) * object_color;
   FragColor = vec4(result, 1.0);
 }
diff --git a/src/main.odin b/src/main.odin
index bb4803e..2b8dd3e 100644
--- a/src/main.odin
+++ b/src/main.odin
@@ -403,6 +403,7 @@ main :: proc() {
 		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)
+		shader.set_vec3(lighting_shader, cstring("view_position"), &camera.position)
 
 		aspect: f32 = 800.0 / 600.0
 		projection := linalg.matrix4_perspective_f32(
@@ -426,6 +427,7 @@ main :: proc() {
 		gl.BindVertexArray(cube_vao)
 		gl.DrawArrays(gl.TRIANGLES, 0, 36)
 
+		// lamp cube object drawing
 		shader.use(light_cube_shader)
 		shader.set_mat4(light_cube_shader, cstring("projection"), &projection)
 		shader.set_mat4(light_cube_shader, cstring("view"), &view)