2019-02-20 14:23:23 +00:00
|
|
|
#version 110
|
|
|
|
|
2022-02-07 09:24:24 +00:00
|
|
|
const vec3 back_color_dark = vec3(0.235, 0.235, 0.235);
|
2019-02-20 14:23:23 +00:00
|
|
|
const vec3 back_color_light = vec3(0.365, 0.365, 0.365);
|
|
|
|
|
|
|
|
uniform sampler2D texture;
|
|
|
|
uniform bool transparent_background;
|
2019-07-19 07:18:09 +00:00
|
|
|
uniform bool svg_source;
|
2019-02-20 14:23:23 +00:00
|
|
|
|
|
|
|
varying vec2 tex_coords;
|
|
|
|
|
2019-07-19 07:18:09 +00:00
|
|
|
vec4 svg_color()
|
2019-02-20 14:23:23 +00:00
|
|
|
{
|
2019-07-19 07:18:09 +00:00
|
|
|
// takes foreground from texture
|
|
|
|
vec4 fore_color = texture2D(texture, tex_coords);
|
|
|
|
|
2019-02-20 14:23:23 +00:00
|
|
|
// calculates radial gradient
|
|
|
|
vec3 back_color = vec3(mix(back_color_light, back_color_dark, smoothstep(0.0, 0.5, length(abs(tex_coords.xy) - vec2(0.5)))));
|
|
|
|
|
|
|
|
// blends foreground with background
|
2019-07-19 07:18:09 +00:00
|
|
|
return vec4(mix(back_color, fore_color.rgb, fore_color.a), transparent_background ? fore_color.a : 1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
vec4 non_svg_color()
|
|
|
|
{
|
|
|
|
// takes foreground from texture
|
|
|
|
vec4 color = texture2D(texture, tex_coords);
|
|
|
|
return vec4(color.rgb, transparent_background ? color.a * 0.25 : color.a);
|
|
|
|
}
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
gl_FragColor = svg_source ? svg_color() : non_svg_color();
|
2019-02-20 14:23:23 +00:00
|
|
|
}
|