aboutsummaryrefslogtreecommitdiffstats
path: root/shaders
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2016-06-10 15:33:02 -0400
committerClyne Sullivan <tullivan99@gmail.com>2016-06-10 15:33:02 -0400
commit076c984c438bea2b34f8dd3a62bb31ebd2eb5282 (patch)
treeb0252c6c054a86eebdf00afccd0afa83e7ff911a /shaders
parent1e9f6aaddb2d21045f5e7dc63d6312a4407b3a08 (diff)
actual game making
Diffstat (limited to 'shaders')
-rw-r--r--shaders/world.frag8
1 files changed, 5 insertions, 3 deletions
diff --git a/shaders/world.frag b/shaders/world.frag
index bde5fa5..617cbb1 100644
--- a/shaders/world.frag
+++ b/shaders/world.frag
@@ -23,10 +23,12 @@ void main()
for (int i = 0; i < lightSize; i++) {
vec2 loc = light[i].xy;
float dist = length(loc - fragCoord.xy);
- float attenuation = clamp(1.0f - dist*dist/(light[i].w*light[i].w), 0.0f, 1.0f);
- attenuation *= attenuation;
+ if (dist < light[i].w) {
+ float attenuation = clamp(1.0f - dist*dist/(light[i].w*light[i].w), 0.0f, 1.0f);
+ attenuation *= attenuation;
- shadeColor += (vec4(attenuation, attenuation, attenuation, 0.0f) * vec4(lightColor[i])) * lightImpact;
+ shadeColor += (vec4(attenuation, attenuation, attenuation, 0.0f) * vec4(lightColor[i])) * lightImpact;
+ }
}
}
shadeColor += ambientLight;