mirror of
https://github.com/Relintai/pandemonium_demo_projects.git
synced 2024-12-21 13:56:50 +01:00
31 lines
713 B
GLSL
31 lines
713 B
GLSL
shader_type canvas_item;
|
|
|
|
uniform float outline_width = 2.0;
|
|
uniform vec4 outline_color: hint_color;
|
|
|
|
void fragment() {
|
|
vec4 col = texture(TEXTURE, UV);
|
|
vec2 ps = TEXTURE_PIXEL_SIZE;
|
|
float a;
|
|
float maxa = col.a;
|
|
float mina = col.a;
|
|
|
|
a = texture(TEXTURE, UV + vec2(0.0, -outline_width) * ps).a;
|
|
maxa = max(a, maxa);
|
|
mina = min(a, mina);
|
|
|
|
a = texture(TEXTURE, UV + vec2(0.0, outline_width) * ps).a;
|
|
maxa = max(a, maxa);
|
|
mina = min(a, mina);
|
|
|
|
a = texture(TEXTURE, UV + vec2(-outline_width, 0.0) * ps).a;
|
|
maxa = max(a, maxa);
|
|
mina = min(a, mina);
|
|
|
|
a = texture(TEXTURE, UV + vec2(outline_width, 0.0) * ps).a;
|
|
maxa = max(a, maxa);
|
|
mina = min(a, mina);
|
|
|
|
COLOR = mix(col, outline_color, maxa - mina);
|
|
}
|