mirror of
https://github.com/lihop/godot-xterm.git
synced 2025-05-04 12:14:24 +02:00
feat(terminal): and stylebox support
Adds support for 'normal' and 'focus' Style Boxes to Terminal node. Changes default background color to transparent, with background to be set by StyleBox. If background color is not transparent, will draw a background color rect to cover the entire control over the top of any stylebox. This is consistent with the behavior of the TextEdit node with regards to theme colors and styleboxes.
This commit is contained in:
parent
a5951978f7
commit
d6a4adf6aa
40 changed files with 608 additions and 52 deletions
|
@ -18,6 +18,7 @@ uniform bool inverse_enabled = true;
|
|||
#ifdef BACKGROUND
|
||||
uniform vec4 background_color;
|
||||
uniform sampler2D background_colors;
|
||||
uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest;
|
||||
#endif
|
||||
|
||||
#ifdef FOREGROUND
|
||||
|
@ -48,7 +49,15 @@ void fragment() {
|
|||
#endif
|
||||
|
||||
if (has_attribute(sample_uv, FLAG_INVERSE) && inverse_enabled) {
|
||||
color = vec4(1.0 - color.rgb, color.a);
|
||||
#ifdef BACKGROUND
|
||||
vec4 bg_color = textureLod(screen_texture, SCREEN_UV, 0.0);
|
||||
vec4 target_color;
|
||||
target_color.a = color.a + (1.0 - color.a) * bg_color.a;
|
||||
target_color.rgb = 1.0 / target_color.a * (color.a * color.rgb + (1.0 - color.a) * bg_color.a * bg_color.rgb);
|
||||
#else
|
||||
vec4 target_color = color;
|
||||
#endif
|
||||
color = vec4(1.0 - target_color.rgb, target_color.a);
|
||||
}
|
||||
|
||||
#ifdef FOREGROUND
|
||||
|
@ -65,10 +74,6 @@ void fragment() {
|
|||
COLOR = color;
|
||||
#endif
|
||||
} else { // Outside the grid.
|
||||
#ifdef BACKGROUND
|
||||
COLOR = background_color;
|
||||
#elif defined(FOREGROUND)
|
||||
COLOR = transparent;
|
||||
#endif
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue