20 lines
818 B
GLSL
20 lines
818 B
GLSL
#version 150
|
|
|
|
uniform vec2 dt;
|
|
uniform vec4 selected, color;
|
|
uniform sampler2D t0;
|
|
uniform float fill;
|
|
|
|
void main(void) {
|
|
vec2 tc = qgl_FragTexture.xy;
|
|
vec4 ds0 = abs(textureLodOffset(t0, tc, 0., ivec2(-1, 0)) - selected);
|
|
vec4 ds1 = abs(textureLodOffset(t0, tc, 0., ivec2( 1, 0)) - selected);
|
|
vec4 ds2 = abs(textureLodOffset(t0, tc, 0., ivec2(0, -1)) - selected);
|
|
vec4 ds3 = abs(textureLodOffset(t0, tc, 0., ivec2(0, 1)) - selected);
|
|
float d0 = dot(ds0, vec4(1., 1., 1., 1.)), d1 = dot(ds1, vec4(1., 1., 1., 1.)), d2 = dot(ds2, vec4(1., 1., 1., 1.)), d3 = dot(ds3, vec4(1., 1., 1., 1.));
|
|
float vs = step(1e-6, d0 + d1 + d2 + d3);
|
|
float vm = step(1e-3, (d0 * 255.) * (d1 * 255.) * (d2 * 255.) * (d3 * 255.));
|
|
float v = mix(vs - vm, vs - vm - vm + 1, fill);
|
|
qgl_FragData[0] = vec4(color.rgb, v * color.a);
|
|
}
|