summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders/spotLight.fs
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-11 18:57:57 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-11 18:57:57 +0000
commitb6fbe0bf35bf58447f2f83f6fc519b4d3eaea107 (patch)
tree6bbaad7f0d384bab4f05080b7a65e9540cee2247 /gfx/gl/shaders/spotLight.fs
parentInitial commit with working light instancing (diff)
downloadilt-b6fbe0bf35bf58447f2f83f6fc519b4d3eaea107.tar.bz2
ilt-b6fbe0bf35bf58447f2f83f6fc519b4d3eaea107.tar.xz
ilt-b6fbe0bf35bf58447f2f83f6fc519b4d3eaea107.zip
Full implementation passing through light defs from vertex data
Note: there is a bug where the light position/direction are rotated backwards to the model even though its using the model's rotation matrix... no idea why/how.
Diffstat (limited to 'gfx/gl/shaders/spotLight.fs')
-rw-r--r--gfx/gl/shaders/spotLight.fs12
1 files changed, 5 insertions, 7 deletions
diff --git a/gfx/gl/shaders/spotLight.fs b/gfx/gl/shaders/spotLight.fs
index 6d5d332..ad33458 100644
--- a/gfx/gl/shaders/spotLight.fs
+++ b/gfx/gl/shaders/spotLight.fs
@@ -6,12 +6,10 @@ out vec3 FragColor;
layout(binding = 0) uniform isampler2D gPosition;
layout(binding = 1) uniform sampler2D gNormal;
uniform ivec4 viewPort;
-// uniform vec3 colour;
-// uniform float kq;
-const vec3 colour = vec3(1);
-const float kq = 0.01;
-in vec4 geo_centre;
-in vec4 geo_direction;
+flat in vec4 geo_centre;
+flat in vec4 geo_direction;
+flat in vec3 geo_colour;
+flat in float geo_kq;
void
main()
@@ -32,5 +30,5 @@ main()
if (normalDot < 0) {
discard;
}
- FragColor = (colour * normalDot) / (1 + (kq * pow(lightDist / 1000.0, 2)));
+ FragColor = (geo_colour * normalDot) / (1 + (geo_kq * pow(lightDist / 1000.0, 2)));
}