diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2016-01-07 08:37:49 -0500 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2016-01-07 08:37:49 -0500 |
commit | 81cf23371b94baf608c98d0dd248acfbbd5d2c70 (patch) | |
tree | 42282b56ce04e17fcc3f61d6b356b6ac72250915 /test.frag | |
parent | cdd792bc8ba7337e7bd3a9d0b4141c63f17fb9a8 (diff) | |
parent | e043a2432c4dacce56a308948188482fb230ff33 (diff) |
merge
Diffstat (limited to 'test.frag')
-rw-r--r-- | test.frag | 27 |
1 files changed, 23 insertions, 4 deletions
@@ -1,4 +1,23 @@ -#version 120
-void main(){
- gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
-}
+uniform sampler2D sampler;
+
+uniform vec2 lightLocation;
+uniform vec3 lightColor;
+uniform float amb;
+// uniform float lightStrength;
+//uniform float screenHeight;
+void main() {
+ float lightAdd = 1.0f;
+
+ float dist = length(lightLocation - gl_FragCoord.xy);
+ float attenuation=1.0/(1.0+0.01*dist+0.00000000001*dist*dist);
+
+ //vec4 color = vec4(1.0f,1.0f,1.0f,1.0f);
+ vec4 color = vec4(attenuation, attenuation, attenuation, 1.0f) * vec4(lightColor, 1.0f);
+ //color = color + vec4((vec3(lightColor.r + amb, lightColor.g + amb, lightColor.b + amb)*0.25f),1.0f);
+
+ vec2 coords = gl_TexCoord[0].st;
+ vec4 tex = texture2D(sampler, coords);
+
+ color += vec4(amb,amb,amb,1.0f+amb);
+ gl_FragColor = tex * vec4(color)*tex.a;
+}
\ No newline at end of file |