summaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorMark Andrus Roberts <mroberts@twilio.com>2017-02-03 15:34:52 -0800
committerJoe Wilm <joe@jwilm.com>2017-02-07 21:12:56 -0800
commitfbc7b7227171b41d96ca52df52e4cf1833f5fc6f (patch)
tree8f33bd12933b129ec751f5dd643387eae254030f /res
parent92e1cec0880313d962d80bf16eca60cebb509eab (diff)
Add visual bell support
This commit adds support for a visual bell. Although the Handler in src/ansi.rs warns "Hopefully this is never implemented", I wanted to give it a try. A new config option is added, `visual_bell`, which sets the `duration` and `animation` function of the visual bell. The default `duration` is 150 ms, and the default `animation` is `EaseOutExpo`. To disable the visual bell, set its duration to 0. The visual bell is modeled by VisualBell in src/term/mod.rs. It has a method to ring the bell, `ring`, and another method, `intensity`. Both return the "intensity" of the bell, which ramps down from 1.0 to 0.0 at a rate set by `duration` and `animation`. Whether or not the Processor waits for events is now configurable in order to allow for smooth drawing of the visual bell.
Diffstat (limited to 'res')
-rw-r--r--res/text.f.glsl3
-rw-r--r--res/text.v.glsl3
2 files changed, 5 insertions, 1 deletions
diff --git a/res/text.f.glsl b/res/text.f.glsl
index 770c1a36..70d50b38 100644
--- a/res/text.f.glsl
+++ b/res/text.f.glsl
@@ -15,6 +15,7 @@
in vec2 TexCoords;
in vec3 fg;
in vec3 bg;
+flat in float vb;
flat in int background;
layout(location = 0, index = 0) out vec4 color;
@@ -26,7 +27,7 @@ void main()
{
if (background != 0) {
alphaMask = vec4(1.0, 1.0, 1.0, 1.0);
- color = vec4(bg, 1.0);
+ color = vec4(bg + vb, 1.0);
} else {
alphaMask = vec4(texture(mask, TexCoords).rgb, 1.0);
color = vec4(fg, 1.0);
diff --git a/res/text.v.glsl b/res/text.v.glsl
index 99234775..ccb6b8b5 100644
--- a/res/text.v.glsl
+++ b/res/text.v.glsl
@@ -36,10 +36,12 @@ out vec3 bg;
uniform vec2 termDim;
uniform vec2 cellDim;
+uniform float visualBell;
uniform int backgroundPass;
// Orthographic projection
uniform mat4 projection;
+flat out float vb;
flat out int background;
void main()
@@ -72,6 +74,7 @@ void main()
TexCoords = uvOffset + vec2(position.x, 1 - position.y) * uvSize;
}
+ vb = visualBell;
background = backgroundPass;
bg = backgroundColor / vec3(255.0, 255.0, 255.0);
fg = textColor / vec3(255.0, 255.0, 255.0);