summaryrefslogtreecommitdiffhomepage
path: root/shaders/lightmap.frag
blob: cba5a269dc9448eea8c25b9f18f0fe586ab3392b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
precision mediump float;

layout (location = 0) uniform vec4 color_intensity;
layout (location = 1) uniform vec2 center;
layout (location = 2) uniform uint falloff;
layout (location = 3) uniform vec2 size;

out vec3 color;

void main() {
    vec2 pos = gl_FragCoord.xy;
    float I = color_intensity.w;
    vec2 tmp = pos - center;
    float dist = sqrt(tmp.x*tmp.x + tmp.y*tmp.y);
    float alpha = 1 - min(1, dist / I);
    color = alpha * color_intensity.xyz;
}