From fda91e69bb7ed3729046673ac9c4e6cf1448c94b Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Mon, 13 Jun 2022 06:22:27 +0200 Subject: [PATCH] :wrench: Use RGB for TV color --- kwin/tv/onSettingsChanged.js | 2 +- resources/shaders/tv.frag | 4 ++-- src/TVEffect.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kwin/tv/onSettingsChanged.js b/kwin/tv/onSettingsChanged.js index e656b03..c739437 100644 --- a/kwin/tv/onSettingsChanged.js +++ b/kwin/tv/onSettingsChanged.js @@ -2,4 +2,4 @@ // The code below is called whenever the user changes something in the configuration of // the effect. -effect.setUniform(this.shader, 'uColor', effect.readConfig('Color', 'white')); \ No newline at end of file +effect.setUniform(this.shader, 'uColor', this.readRGBConfig('Color')); \ No newline at end of file diff --git a/resources/shaders/tv.frag b/resources/shaders/tv.frag index ea53b4c..c3da0b8 100644 --- a/resources/shaders/tv.frag +++ b/resources/shaders/tv.frag @@ -13,7 +13,7 @@ // The content from common.glsl is automatically prepended to each shader effect. -uniform vec4 uColor; +uniform vec3 uColor; const float BLUR_WIDTH = 0.01; // Width of the gradients. const float TB_TIME = 0.7; // Relative time for the top/bottom animation. @@ -55,7 +55,7 @@ void main() { float mask = tbMask * lrMask * ffMask; vec4 oColor = getInputColor(coords); - oColor.rgb = mix(oColor.rgb, uColor.rgb * oColor.a, smoothstep(0.0, 1.0, prog)); + oColor.rgb = mix(oColor.rgb, uColor * oColor.a, smoothstep(0.0, 1.0, prog)); oColor.a *= mask; // These are pretty useful for understanding how this works. diff --git a/src/TVEffect.js b/src/TVEffect.js index b02d8bd..f1cfe5f 100644 --- a/src/TVEffect.js +++ b/src/TVEffect.js @@ -50,8 +50,8 @@ var TVEffect = class { // Write all uniform values at the start of each animation. shader.connect('begin-animation', (shader, settings) => { const c = Clutter.Color.from_string(settings.get_string('tv-effect-color'))[1]; - shader.set_uniform_float(shader._uColor, 4, - [c.red / 255, c.green / 255, c.blue / 255, 1.0]); + shader.set_uniform_float(shader._uColor, 3, + [c.red / 255, c.green / 255, c.blue / 255]); }); }); }