aboutsummaryrefslogtreecommitdiffstats
path: root/test.frag
diff options
context:
space:
mode:
Diffstat (limited to 'test.frag')
-rw-r--r--test.frag21
1 files changed, 17 insertions, 4 deletions
diff --git a/test.frag b/test.frag
index 13fe6bc..18b03df 100644
--- a/test.frag
+++ b/test.frag
@@ -1,4 +1,17 @@
-#version 120
-void main(){
- gl_FragColor = glColor;
-}
+uniform vec2 lightLocation;
+uniform vec3 lightColor;
+uniform float screenHeight;
+
+float radius = 4.9;
+float minLight = .01;
+float a = .01;
+float b = 1.0 / (radius*radius * minLight);
+
+void main() {
+ float distance = length(lightLocation - gl_FragCoord.xy);
+ //float attenuation = 1.0 / (1.0 + a*distance + b*distance*distance);
+ float attenuation = clamp(1.0 - distance*distance/(radius*radius), 0.0, 1.0); attenuation *= attenuation;
+ vec4 color = vec4(attenuation, attenuation, attenuation, attenuation) * vec4(lightColor, 1);
+
+ gl_FragColor = color;
+} \ No newline at end of file