Linux configuration stuffs
1#version 330
2
3in vec2 fragCoord;
4out vec4 fragColor;
5
6// bar values. defaults to left channels first (low to high), then right (high to low).
7uniform float bars[512];
8
9uniform int bars_count; // number of bars (left + right) (configurable)
10
11uniform vec3 u_resolution; // window resolution, not used here
12
13//colors, configurable in cava config file
14uniform vec3 bg_color; // background color(r,g,b) (0.0 - 1.0), not used here
15uniform vec3 fg_color; // foreground color, not used here
16
17void main()
18{
19 // find which bar to use based on where we are on the x axis
20 int bar = int(bars_count * fragCoord.x);
21
22 float bar_y = 1.0 - abs((fragCoord.y - 0.5)) * 2.0;
23 float y = (bars[bar]) * bar_y;
24
25 float bar_x = (fragCoord.x - float(bar) / float(bars_count)) * bars_count;
26 float bar_r = 1.0 - abs((bar_x - 0.5)) * 2;
27
28 bar_r = bar_r * bar_r * 2;
29
30 // set color
31 fragColor.r = fg_color.x * y * bar_r;
32 fragColor.g = fg_color.y * y * bar_r;
33 fragColor.b = fg_color.z * y * bar_r;
34}