summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders/pointLight.fs
diff options
context:
space:
mode:
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) {