Commit Graph

16 Commits

Author SHA1 Message Date
M. Stoeckl 40237b213a Simplify text shader 2019-02-04 19:03:25 +00:00
Christian Duerr cf9d94eb12
Add color option to visual bell
This adds the option to specify the color of the visual bell using the
`visual_bell.color` configuration setting.

This is done by rendering a big quad over the entire screen, which also
opens up options to draw other arbitrary rectangles on the screen in the
future.
2018-12-17 19:06:07 +00:00
Joe Wilm b79574ee82 Fix solid background color opacity (#847)
Since landing the patch adding transparency support to Alacritty,
there's been an issue where othewise solid background cells were also
being rendered partially transparent. Now, all filled background cells
are rendered fully opaque.

Some logic was added to support discarding filled backgrounds which had
the same color as the default background. This means that, if the
default background is #000 and a cell has that background, it will never
be rendered opaque. This may not be correct.

Note that many truecolor vim color schemes print spaces for default
colored background cells. Performance can be dramatically improved by
using ctermbg=NONE guibg=NONE to skip rendering those cells.
2017-10-21 15:26:42 -07:00
Gabriel Martinez 5009566ea5 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.
2017-08-20 09:55:45 -07:00
Mark Andrus Roberts fbc7b72271 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.
2017-02-07 21:12:56 -08:00
Joe Wilm e503baf2e7 Live shader reloading is now a feature
Which means it can be disabled in release builds. No more working on a
renderer feature and actually breaking the Alacritty your editor is
running inside.
2016-10-27 08:43:23 -07:00
Joe Wilm 58146acea5 Add license header to glsl files 2016-06-29 21:01:22 -07:00
Joe Wilm cdea958e71
Add support for drawing background colors 2016-06-06 16:54:15 -07:00
Joe Wilm ed7aa96907
Refactor Instanced Drawing to use Vertex Arrays
Per-instanced data was previously stored in uniforms. This required
several OpenGL calls to upload all of the data, and it was more complex
to prepare (several vecs vs one).

Additionally, drawing APIs are now accessible through a `RenderApi`
(obtained through `QuadRenderer::with_api`) which enables some RAII
patterns. Specifically, checks for batch flushing are handled in Drop.
2016-06-06 13:20:35 -07:00
Joe Wilm 1f3f9add49
Optimize Rendering with batched draw calls
Draw calls are now batched for performance. Render times on git log at
the default size are now ~200usec.
2016-06-04 21:31:41 -07:00
Joe Wilm 30ec145109
Initial support for Terminal Emulation (woo!)
This patch introduces basic support for terminal emulation. Basic means
commands that don't use paging and are not full screen applications like
vim or tmux. Some paging applications are working properly, such as as
`git log`. Other pagers work reasonably well as long as the help menu is
not accessed.

There is now a central Rgb color type which is shared by the renderer,
terminal emulation, and the pty parser.

The parser no longer owns a Handler. Instead, a mutable reference to a
Handler is provided whenever advancing the parser. This resolved some
potential ownership issues (eg parser owning the `Term` type would've
been unworkable).
2016-06-02 19:42:28 -07:00
Joe Wilm c70acbac0b
Correct sub-pixel font rendering with OpenGL
Uses the GL_ARB_blend_func_extended to get single-pass, per-channel
alpha blending. gl_generator is now used instead of gl to enable the
extension.

The background color is removed since that presumably needs to run in a
separate pass.
2016-05-20 21:36:28 -07:00
Joe Wilm e794bc11b9
Use subpixel font rendering
OpenGL only supports shared alpha blending. Subpixel font rendering
requires using the font RGB values as alpha masks for the corresponding
RGB channels. To support this, blending is implemented in the fragment
shader.
2016-04-11 08:05:19 -07:00
Joe Wilm cda4952145 Bit of cleanup
- Commend vertex slice
- Add helper for binding mask texture (and specify that it's a mask)
- Prefix uniform members of ShaderProgram with u_. This makes it easy to
  identify in the rest of code.
2016-02-24 20:37:17 -08:00
Joe Wilm 24b4c3ba47 Fragment shader supplies color correctly 2016-02-24 19:09:21 -08:00
Joe Wilm 2b7caf95fd Render the letter J
This letter brought to you by OpenGL and freetype.
2016-02-23 20:42:58 -08:00