aboutsummaryrefslogtreecommitdiff
path: root/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'shaders')
-rw-r--r--shaders/rounded_rectangle.glsl8
-rw-r--r--shaders/rounded_rectangle_mask.glsl17
2 files changed, 24 insertions, 1 deletions
diff --git a/shaders/rounded_rectangle.glsl b/shaders/rounded_rectangle.glsl
index 7da0826..2753383 100644
--- a/shaders/rounded_rectangle.glsl
+++ b/shaders/rounded_rectangle.glsl
@@ -1,4 +1,7 @@
uniform float radius;
+uniform float band_y;
+uniform float band_height;
+uniform vec4 band_color;
uniform vec2 resolution;
float rounded_rect(vec2 coord, vec2 size, float r) {
@@ -11,5 +14,8 @@ void main() {
vec2 size = resolution * 0.5;
vec4 background_color = vec4(0.0, 0.0, 0.0, 0.0);
float a = clamp(rounded_rect(uv - center, size - radius, radius), 0.0, 1.0);
- gl_FragColor = mix(gl_Color, background_color, a);
+ vec4 front_color = gl_Color;
+ if(uv.y >= band_y && uv.y <= band_y + band_height)
+ front_color = band_color;
+ gl_FragColor = mix(front_color, background_color, a);
} \ No newline at end of file
diff --git a/shaders/rounded_rectangle_mask.glsl b/shaders/rounded_rectangle_mask.glsl
new file mode 100644
index 0000000..4725273
--- /dev/null
+++ b/shaders/rounded_rectangle_mask.glsl
@@ -0,0 +1,17 @@
+uniform sampler2D texture;
+uniform float radius;
+uniform vec2 resolution;
+
+float rounded_rect(vec2 coord, vec2 size, float r) {
+ return length(max(abs(coord) - size, 0.0)) - r;
+}
+
+void main() {
+ vec2 uv = gl_TexCoord[0].xy * resolution;
+ vec2 center = resolution * 0.5;
+ vec2 size = resolution * 0.5;
+ vec4 background_color = vec4(0.0, 0.0, 0.0, 0.0);
+ vec4 texture_color = texture2D(texture, gl_TexCoord[0].xy);
+ float a = clamp(rounded_rect(uv - center, size - radius, radius), 0.0, 1.0);
+ gl_FragColor = mix(texture_color, background_color, a);
+} \ No newline at end of file