Added passes for premultiplied alpha, fixed alpha blending for native transparency
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/* center radius (pixels) */
|
||||
#define C_RADIUS 128
|
||||
/* center line thickness (pixels) */
|
||||
#define C_LINE 2
|
||||
#define C_LINE 1.5
|
||||
/* outline color */
|
||||
#define OUTLINE #333333
|
||||
/* Amplify magnitude of the results each bar displays */
|
||||
|
||||
1
shaders/circle/3.frag
Normal file
1
shaders/circle/3.frag
Normal file
@@ -0,0 +1 @@
|
||||
#include ":util/premultiply.frag"
|
||||
@@ -29,10 +29,10 @@ out vec4 fragment;
|
||||
#define PI 3.14159265359
|
||||
|
||||
void main() {
|
||||
|
||||
|
||||
#if USE_ALPHA > 0
|
||||
#define APPLY_FRAG(f, c) f = vec4(f.rgb * f.a + c.rgb * (1 - f.a), max(c.a, f.a))
|
||||
fragment.a;
|
||||
#define APPLY_FRAG(f, c) f = vec4(f.rgb * f.a + c.rgb * (1 - clamp(f.a, 0, 1)), max(c.a, f.a))
|
||||
fragment = #00000000;
|
||||
#else
|
||||
#define APPLY_FRAG(f, c) f = c
|
||||
#endif
|
||||
|
||||
1
shaders/radial/2.frag
Normal file
1
shaders/radial/2.frag
Normal file
@@ -0,0 +1 @@
|
||||
#include ":util/premultiply.frag"
|
||||
@@ -28,10 +28,9 @@
|
||||
|
||||
/* Set window background opacity mode. Possible values are:
|
||||
|
||||
"native" - True transparency provided by the compositor.
|
||||
Requires GLFW 3.3+ and an active compositor. Can
|
||||
reduce performance on some systems, and will not
|
||||
blend with the visualizer's alpha layer.
|
||||
"native" - True transparency provided by the compositor. Can
|
||||
reduce performance on some systems, depending on
|
||||
the compositor used.
|
||||
|
||||
"xroot" - Maintain a copy of the root window's pixmap
|
||||
(usually the desktop background) to provide a
|
||||
@@ -54,8 +53,8 @@
|
||||
#request setgeometry 0 0 800 600
|
||||
|
||||
/* Window background color (RGB format).
|
||||
Only works with `setopacity "none"` */
|
||||
#request setbg 000000
|
||||
Does not work with `setopacity "xroot"` */
|
||||
#request setbg 00000000
|
||||
|
||||
/* (X11 only) EWMH Window type. Possible values are:
|
||||
|
||||
@@ -68,7 +67,7 @@
|
||||
|
||||
https://standards.freedesktop.org/wm-spec/wm-spec-1.3.html#idm140130317606816
|
||||
*/
|
||||
#request setxwintype "desktop"
|
||||
#request setxwintype "normal"
|
||||
|
||||
/* (X11 only) EWMH Window state atoms (multiple can be specified).
|
||||
Possible values are:
|
||||
|
||||
15
shaders/util/premultiply.frag
Normal file
15
shaders/util/premultiply.frag
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
#request nativeonly true
|
||||
|
||||
#request uniform "prev" tex
|
||||
uniform sampler2D tex;
|
||||
|
||||
out vec4 fragment;
|
||||
in vec4 gl_FragCoord;
|
||||
|
||||
void main() {
|
||||
fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0);
|
||||
#if PREMULTIPLY_ALPHA > 0
|
||||
fragment.rgb *= fragment.a;
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user