From 2774fcd8a26fe195c0b7373e6acf5cd1799fc520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Kapu=C5=9Bci=C5=84ski?= Date: Mon, 14 Mar 2016 20:02:31 +0100 Subject: [PATCH] Small changes in the GL21 shader --- .../opengl/shaders/vertex_shader_21_pervertex.glsl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/graphics/opengl/shaders/vertex_shader_21_pervertex.glsl b/src/graphics/opengl/shaders/vertex_shader_21_pervertex.glsl index c62d218d..3d9f5445 100644 --- a/src/graphics/opengl/shaders/vertex_shader_21_pervertex.glsl +++ b/src/graphics/opengl/shaders/vertex_shader_21_pervertex.glsl @@ -84,13 +84,12 @@ void main() vec3 lightDirection = light.Position.xyz; float atten = 1.0f; - if (light.Position.w != 0.0f) + if (light.Position.w > 0.5f) { float dist = distance(light.Position.xyz, position.xyz); - float atten = 1.0f / (light.Attenuation.x - + light.Attenuation.y * dist - + light.Attenuation.z * dist * dist); + float atten = 1.0f / dot(light.Attenuation, + vec3(1.0f, dist, dist * dist)); lightDirection = normalize(light.Position.xyz - position.xyz); } @@ -107,7 +106,7 @@ void main() } else { - spot = 0.0f; + continue; } }