From a21cbb6fa7c62014eb5ffea6c8f096c2b0737c38 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 27 Nov 2022 12:38:26 +0000 Subject: Change pointlight render area definition to a cube --- gfx/gl/shaders/pointLight.fs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gfx/gl/shaders/pointLight.fs') 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) { -- cgit v1.2.3