aboutsummaryrefslogtreecommitdiff
path: root/shaders/main.frag
diff options
context:
space:
mode:
authorccolin2020-12-28 17:36:45 +0100
committerccolin2020-12-28 17:36:45 +0100
commitf3a34665978729ef65010ac2a4a9408e27d5bf3e (patch)
treee8f4d6f2402c9b7113e33684f64b82a98d990313 /shaders/main.frag
parentef37119f4e94c83a6357ebc0b94a39e4e53b20d7 (diff)
skybox
Diffstat (limited to 'shaders/main.frag')
-rw-r--r--shaders/main.frag20
1 files changed, 20 insertions, 0 deletions
diff --git a/shaders/main.frag b/shaders/main.frag
new file mode 100644
index 0000000..8eb47ec
--- /dev/null
+++ b/shaders/main.frag
@@ -0,0 +1,20 @@
+#version 330 core
+
+in vec3 norm;
+in vec2 uv;
+in vec3 frag_pos;
+
+out vec4 final_col;
+
+uniform sampler2D tex;
+
+void main() {
+ vec3 light_col = vec3(1, .964, .783);
+ vec3 ambient = light_col * .2;
+
+ vec3 light_dir = normalize(vec3(5, 10, -8));
+ float diff = max(dot(normalize(norm), light_dir), 0.0);
+ vec3 diffuse = diff * light_col;
+
+ final_col = texture(tex, uv) * vec4(ambient + diffuse, 1);
+}