summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders/pointLight.vs
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-11-23 19:07:18 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-11-23 19:07:18 +0000
commit50d6f63fb28c82a35e68914fe941b685d26f6e89 (patch)
tree4a86d800d36341aedee7319307675cd1e6e5b784 /gfx/gl/shaders/pointLight.vs
parentSupport setting a viewPort uniform for those shaders which need it (diff)
downloadilt-50d6f63fb28c82a35e68914fe941b685d26f6e89.tar.bz2
ilt-50d6f63fb28c82a35e68914fe941b685d26f6e89.tar.xz
ilt-50d6f63fb28c82a35e68914fe941b685d26f6e89.zip
Add rendering support for point lights
Diffstat (limited to 'gfx/gl/shaders/pointLight.vs')
-rw-r--r--gfx/gl/shaders/pointLight.vs18
1 files changed, 18 insertions, 0 deletions
diff --git a/gfx/gl/shaders/pointLight.vs b/gfx/gl/shaders/pointLight.vs
new file mode 100644
index 0000000..6236c33
--- /dev/null
+++ b/gfx/gl/shaders/pointLight.vs
@@ -0,0 +1,18 @@
+#version 330 core
+
+layout(location = 0) in vec3 position;
+
+uniform vec3 colour;
+uniform float kq;
+uniform mat4 viewProjection;
+
+out vec3 centre;
+out float size;
+
+void
+main()
+{
+ centre = position;
+ size = sqrt(256 * max(max(colour.r, colour.g), colour.b) / kq);
+ gl_Position = viewProjection * vec4(centre, 1);
+}