git-svn-id: svn://db.shs.com.ru/libs@44 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2015-11-20 21:19:36 +00:00
parent cabaead1c6
commit 104a7f99ad
48 changed files with 1973 additions and 1273 deletions

View File

@@ -1,4 +1,4 @@
#version 130
#version 150
uniform vec2 dt;
uniform vec4 selected, color;
@@ -6,13 +6,14 @@ uniform sampler2D t0;
uniform float fill;
void main(void) {
vec4 ds0 = abs(textureLodOffset(t0, gl_TexCoord[0].xy, 0., ivec2(-1, 0)) - selected);
vec4 ds1 = abs(textureLodOffset(t0, gl_TexCoord[0].xy, 0., ivec2( 1, 0)) - selected);
vec4 ds2 = abs(textureLodOffset(t0, gl_TexCoord[0].xy, 0., ivec2(0, -1)) - selected);
vec4 ds3 = abs(textureLodOffset(t0, gl_TexCoord[0].xy, 0., ivec2(0, 1)) - selected);
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);
gl_FragColor = vec4(color.rgb, v * color.a);
qgl_FragData[0] = vec4(color.rgb, v * color.a);
}