From c96fdcb4d639ae52ad1d2c812a07e5667849fe71 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 11 Jun 2021 17:11:13 +0200 Subject: Optimize shaders, only update youtube decryption function once every 5 minutes, smoother movement with smaller card items --- shaders/rounded_rectangle.glsl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'shaders/rounded_rectangle.glsl') diff --git a/shaders/rounded_rectangle.glsl b/shaders/rounded_rectangle.glsl index 88a057a..d06a4ba 100644 --- a/shaders/rounded_rectangle.glsl +++ b/shaders/rounded_rectangle.glsl @@ -12,10 +12,11 @@ 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); + float a = clamp(rounded_rect(uv - center, size - radius, radius), 0.0, 1.0); - vec4 front_color = gl_Color; - if(uv.x >= band_pos.x && uv.x <= band_pos.x + band_size.x && uv.y >= band_pos.y && uv.y <= band_pos.y + band_size.y) - front_color = band_color; - gl_FragColor = mix(front_color, background_color, a); + // same as: if(uv.x >= band_pos.x && uv.x <= band_pos.x + band_size.x && uv.y >= band_pos.y && uv.y <= band_pos.y + band_size.y) + vec2 band_blend = step(band_pos, uv) - step(band_pos + band_size, uv); + vec4 front_color = mix(gl_Color, band_color, band_blend.x*band_blend.y); + front_color.a *= (1.0 - a); + gl_FragColor = front_color; } \ No newline at end of file -- cgit v1.2.3