7DRL2015/data/shaders/sprite_outline_fs.glsl

18 lines
444 B
GLSL

#version 150
// uniforms
uniform sampler2D texture_sampler;
// input
varying vec2 frag_uv;
void main() {
float t = texture2D(texture_sampler, frag_uv + vec2( 0.0f, -0.01f )).a;
float b = texture2D(texture_sampler, frag_uv + vec2( 0.0f, 0.01f )).a;
float c = 0.0f;
if (t < 0.75 && b > 0.75) {
c += 0.5f;
}
gl_FragColor = vec4(0.75, 0.5, 0.5, c);
if (gl_FragColor.a == 0.0) discard;
//gl_FragColor = vec4(0.5, 0.0, 0.0, 0.5);
}