Warning, /frameworks/kquickcharts/src/shaders6/barchart.frag is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2021 Arjen Hiemstra <ahiemstra@heimr.nl>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 #version 440
0008 
0009 #extension GL_GOOGLE_include_directive: enable
0010 #include "sdf.glsl"
0011 
0012 layout(std140, binding = 0) uniform buf {
0013     highp mat4 matrix;
0014     lowp vec2 aspect; // offset 64
0015     lowp float opacity; // offset 72
0016     lowp float radius; // offset 76
0017     lowp vec4 backgroundColor; // offset 80
0018 } ubuf; // size 96
0019 
0020 layout (location = 0) in lowp vec2 uv;
0021 layout (location = 1) in mediump vec4 foregroundColor;
0022 layout (location = 2) in mediump float value;
0023 
0024 layout (location = 0) out lowp vec4 out_color;
0025 
0026 void main()
0027 {
0028     lowp vec4 color = vec4(0.0);
0029 
0030     lowp float background = sdf_round(sdf_rectangle(uv, vec2(1.0, ubuf.aspect.y) - ubuf.radius), ubuf.radius);
0031 
0032     color = sdf_render(background, color, ubuf.backgroundColor);
0033 
0034     lowp float foreground = sdf_round(sdf_rectangle(vec2(uv.x, -ubuf.aspect.y + uv.y + value), vec2(1.0, value) - ubuf.radius), ubuf.radius);
0035 
0036     color = sdf_render(foreground, color, foregroundColor);
0037 
0038     out_color = color * ubuf.opacity;
0039 }