summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders/pointLight.fs
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-11-27 12:38:26 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-11-27 12:38:26 +0000
commita21cbb6fa7c62014eb5ffea6c8f096c2b0737c38 (patch)
tree1ea0302585fd3b169721bce82ef3d3f203a8173f /gfx/gl/shaders/pointLight.fs
parentAdd light stage to renderable objects (diff)
downloadilt-a21cbb6fa7c62014eb5ffea6c8f096c2b0737c38.tar.bz2
ilt-a21cbb6fa7c62014eb5ffea6c8f096c2b0737c38.tar.xz
ilt-a21cbb6fa7c62014eb5ffea6c8f096c2b0737c38.zip
Change pointlight render area definition to a cube
Diffstat (limited to 'gfx/gl/shaders/pointLight.fs')
-rw-r--r--gfx/gl/shaders/pointLight.fs9
1 files changed, 6 insertions, 3 deletions
diff --git a/gfx/gl/shaders/pointLight.fs b/gfx/gl/shaders/pointLight.fs
index 18407fe..bd32c05 100644
--- a/gfx/gl/shaders/pointLight.fs
+++ b/gfx/gl/shaders/pointLight.fs
@@ -8,16 +8,19 @@ layout(binding = 1) uniform sampler2D gNormal;
uniform ivec4 viewPort;
uniform vec3 colour;
uniform float kq;
-in vec3 geo_centre;
+in vec4 geo_centre;
void
main()
{
const vec2 texCoord = gl_FragCoord.xy / viewPort.zw;
const vec3 position = texture(gPosition, texCoord).xyz;
- const vec3 normal = texture(gNormal, texCoord).xyz;
- const vec3 lightv = position - geo_centre;
+ const vec3 lightv = position - geo_centre.xyz;
const float lightDist = length(lightv);
+ if (lightDist > geo_centre.w) {
+ discard;
+ }
+ const vec3 normal = texture(gNormal, texCoord).xyz;
const vec3 lightDirection = normalize(lightv);
const float normalDot = dot(-lightDirection, normal);
if (normalDot < 0) {