summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders/directionalLight.fs
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/gl/shaders/directionalLight.fs')
-rw-r--r--gfx/gl/shaders/directionalLight.fs18
1 files changed, 18 insertions, 0 deletions
diff --git a/gfx/gl/shaders/directionalLight.fs b/gfx/gl/shaders/directionalLight.fs
new file mode 100644
index 0000000..7562f96
--- /dev/null
+++ b/gfx/gl/shaders/directionalLight.fs
@@ -0,0 +1,18 @@
+#version 330 core
+#extension GL_ARB_shading_language_420pack : enable
+
+out vec3 FragColor;
+
+in vec2 TexCoords;
+
+layout(binding = 1) uniform sampler2D gNormal;
+
+uniform vec3 lightDirection;
+uniform vec3 lightColour;
+
+void
+main()
+{
+ const vec3 Normal = texture(gNormal, TexCoords).rgb;
+ FragColor = dot(-lightDirection, Normal) * lightColour;
+}