Add support for two different inverse modes

- Inverse mode invert (default) will invert the color in shader.
- Inverse mode swap will simply swap the foreground and background
  colors. This is the default behavior of libtsm and GodotXterm v3.
This commit is contained in:
Leroy Hopson 2024-02-07 23:03:11 +13:00
parent 930f3ef352
commit 8c30bec861
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
3 changed files with 41 additions and 1 deletions

View file

@ -13,6 +13,7 @@ uniform vec2 cell_size;
uniform vec2 grid_size;
uniform sampler2D attributes;
uniform bool inverse_enabled = true;
#ifdef BACKGROUND
uniform vec4 background_color;
@ -46,7 +47,7 @@ void fragment() {
color = texture(TEXTURE, UV);
#endif
if (has_attribute(sample_uv, FLAG_INVERSE)) {
if (has_attribute(sample_uv, FLAG_INVERSE) && inverse_enabled) {
color = vec4(1.0 - color.rgb, color.a);
}