summaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorGabriel Martinez <reitaka@gmail.com>2017-08-20 09:55:45 -0700
committerJoe Wilm <jwilm@users.noreply.github.com>2017-08-20 09:55:45 -0700
commit5009566ea5c46a85fa243b18ce4b7fe8e0b89b62 (patch)
treecc14c0de9686a52f0732a4a7ec29b5c23ea86efb /res
parent4e9b1c590e8b0990f5f43fa9d7c53a31a92840a8 (diff)
Add background_opacity option to set terminal transparency (#331)
The option is an Alpha struct that ensures that the contained float is between 0.0 and 1.0. Background colors are multiplied by the opacity to properly alpha blend them.
Diffstat (limited to 'res')
-rw-r--r--res/text.f.glsl8
1 files changed, 5 insertions, 3 deletions
diff --git a/res/text.f.glsl b/res/text.f.glsl
index 70d50b38..dd60333c 100644
--- a/res/text.f.glsl
+++ b/res/text.f.glsl
@@ -21,15 +21,17 @@ flat in int background;
layout(location = 0, index = 0) out vec4 color;
layout(location = 0, index = 1) out vec4 alphaMask;
+uniform float bgOpacity;
uniform sampler2D mask;
void main()
{
if (background != 0) {
- alphaMask = vec4(1.0, 1.0, 1.0, 1.0);
- color = vec4(bg + vb, 1.0);
+ alphaMask = vec4(1.0);
+ color = vec4(bg + vb, 1.0) * bgOpacity;
} else {
- alphaMask = vec4(texture(mask, TexCoords).rgb, 1.0);
+ vec3 textColor = texture(mask, TexCoords).rgb;
+ alphaMask = vec4(textColor, textColor.r);
color = vec4(fg, 1.0);
}
}