diff options
author | drumsetmonkey <abelleisle@roadrunner.com> | 2016-01-12 21:28:22 -0500 |
---|---|---|
committer | drumsetmonkey <abelleisle@roadrunner.com> | 2016-01-12 21:28:22 -0500 |
commit | 9765c6303b763a60a2d917fc3c334b30e0fbbcfa (patch) | |
tree | 94f6a3278266ca352601d0ff131f0ff73e6d14d8 /test.frag | |
parent | 599425c0380630197005c9ecc86604396d612f81 (diff) |
Fixed nvidia GLSL bug
Diffstat (limited to 'test.frag')
-rw-r--r-- | test.frag | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -2,7 +2,7 @@ uniform sampler2D sampler;
uniform int numLight;
-uniform vec2 lightLocation[1024];
+uniform vec2 lightLocation[64];
uniform vec3 lightColor;
uniform float amb;
@@ -10,20 +10,22 @@ float b = .0005; float minLight = .05;
float radius = sqrt(1.0 / (b * minLight));
+//float radius = b*minlight;
+
void main(){
- vec4 color = vec4(0.0f,0.0f,0.0f,0.0f);
+ vec4 color = vec4(0.0,0.0,0.0,0.0);
for(int i = 0; i < numLight; i++){
vec2 loc = lightLocation[i];
float dist = length(loc - gl_FragCoord.xy);
//float attenuation=1.0/(1.0+0.01*dist+0.00000000001*dist*dist);
float attenuation = clamp(1.0 - dist*dist/(radius*radius), 0.0, 1.0); attenuation *= attenuation;
- color += vec4(attenuation, attenuation, attenuation, 1.0f) * vec4(lightColor, 1.0f);
+ color += vec4(attenuation, attenuation, attenuation, 1.0) * vec4(lightColor, 1.0);
}
vec2 coords = gl_TexCoord[0].st;
vec4 tex = texture2D(sampler, coords);
- color += vec4(amb,amb,amb,1.0f+amb);
+ color += vec4(amb,amb,amb,1.0+amb);
gl_FragColor = tex * vec4(color)*tex.a;
}
@@ -34,4 +36,4 @@ void main(){ .00008 500
.00002 1000
.00005 2000
-*/
+*/
\ No newline at end of file |