diff options
Diffstat (limited to 'shaders')
-rw-r--r-- | shaders/rounded_rectangle.glsl | 9 | ||||
-rw-r--r-- | shaders/rounded_rectangle_no_shadow.glsl | 9 |
2 files changed, 2 insertions, 16 deletions
diff --git a/shaders/rounded_rectangle.glsl b/shaders/rounded_rectangle.glsl index 2863584..40babe2 100644 --- a/shaders/rounded_rectangle.glsl +++ b/shaders/rounded_rectangle.glsl @@ -1,7 +1,4 @@ uniform float radius; -uniform vec2 band_pos; -uniform vec2 band_size; -uniform vec4 band_color; uniform vec2 resolution; float rounded_rect(vec2 coord, vec2 size, float r) { @@ -16,10 +13,6 @@ void main() { float rect_dist = rounded_rect(uv - center, size, radius); float a = clamp(1.0 - smoothstep(0.0, 1.0, rect_dist), 0.0, 1.0); - // 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); float shadow_a = clamp(1.0 - smoothstep(0.0, shadow_offset.x, rect_dist), 0.0, 1.0); - front_color.a *= a; - gl_FragColor = mix(front_color, vec4(0.0, 0.0, 0.0, 0.14), clamp(shadow_a - a, 0.0, 1.0)); + gl_FragColor = mix(vec4(gl_Color.rgb, a), vec4(0.0, 0.0, 0.0, 0.14), clamp(shadow_a - a, 0.0, 1.0)); }
\ No newline at end of file diff --git a/shaders/rounded_rectangle_no_shadow.glsl b/shaders/rounded_rectangle_no_shadow.glsl index c32f842..b12b35c 100644 --- a/shaders/rounded_rectangle_no_shadow.glsl +++ b/shaders/rounded_rectangle_no_shadow.glsl @@ -1,7 +1,4 @@ uniform float radius; -uniform vec2 band_pos; -uniform vec2 band_size; -uniform vec4 band_color; uniform vec2 resolution; float rounded_rect(vec2 coord, vec2 size, float r) { @@ -16,9 +13,5 @@ void main() { float rect_dist = rounded_rect(uv - center, size, radius); float a = clamp(1.0 - smoothstep(0.0, 1.0, rect_dist), 0.0, 1.0); - // 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 *= a; - gl_FragColor = front_color; + gl_FragColor = vec4(gl_Color.rgb, a); }
\ No newline at end of file |