diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-06-10 18:13:56 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-06-10 18:13:56 +0200 |
commit | 1baf69083d740f50eba0de13b366977a07dacbf3 (patch) | |
tree | e397e568d972788a8a339432709e2c53be12bd67 /shaders/lightmap.frag | |
parent | 2204f113710319ae6d735e3d511dd1d75d42a07d (diff) |
wip
Diffstat (limited to 'shaders/lightmap.frag')
-rw-r--r-- | shaders/lightmap.frag | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/shaders/lightmap.frag b/shaders/lightmap.frag index eb7ed789..75815c0f 100644 --- a/shaders/lightmap.frag +++ b/shaders/lightmap.frag @@ -10,9 +10,12 @@ out vec4 color; void main() { vec2 pos = gl_FragCoord.xy; float I = color_intensity.w; - vec2 tmp = pos - center; + float dist = distance(pos, center); //float dist = sqrt(tmp.x*tmp.x + tmp.y*tmp.y); - float dist = sqrt(tmp.x*tmp.x + tmp.y*tmp.y); - float alpha = 1 - min(1, dist / I); - color = vec4(color_intensity.xyz, alpha); + float A = 1; + if (falloff == 0) // linear + A = 1 - min(1, dist / I); + else if (falloff == 2) // quadratic + A = I/(1 + I + dist*dist); + color = vec4(color_intensity.xyz, A); } |