From bfc3467e332d9079de0dd9e7694cf9864ec08275 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Fri, 10 Jun 2022 10:29:47 +0200 Subject: [PATCH] :wrench: Fixes for kwin --- resources/shaders/energize-a.frag | 10 +++++----- resources/shaders/energize-b.frag | 12 ++++++------ src/EnergizeA.js | 2 +- src/EnergizeB.js | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/resources/shaders/energize-a.frag b/resources/shaders/energize-a.frag index 775c6c6..6869dd7 100644 --- a/resources/shaders/energize-a.frag +++ b/resources/shaders/energize-a.frag @@ -13,13 +13,13 @@ // The content from common.glsl is automatically prepended to each shader effect. -uniform vec3 uColor; +uniform vec4 uColor; uniform float uScale; const float FADE_IN_TIME = 0.3; const float FADE_OUT_TIME = 0.6; const float HEART_FADE_TIME = 0.3; -const float EDGE_FADE_WIDTH = 50; +const float EDGE_FADE_WIDTH = 50.0; // This method returns two values: // result.x: A mask for the particles. @@ -63,7 +63,7 @@ void main() { vec4 oColor = getInputColor(iTexCoord.st); // Dissolve window to effect color / transparency. - oColor.rgb = mix(uColor, oColor.rgb, 0.2 * masks.y + 0.8); + oColor.rgb = mix(uColor.rgb, oColor.rgb, 0.2 * masks.y + 0.8); oColor.a = oColor.a * masks.y; vec2 scaledUV = (iTexCoord.st - 0.5) * (1.0 + 0.1 * progress); @@ -75,13 +75,13 @@ void main() { float particles = 0.2 * pow((simplex3D(vec3(uv, 0.0 * uProgress * uDuration))), 3.0); // Add more molecule particles. - for (int i = 1; i <= 3; ++i) { + for (float i = 1.0; i <= 3.0; ++i) { vec2 uv = scaledUV * 0.12154 / pow(1.5, i) * uSize; float atoms = simplex3D(vec3(uv, 2.0 * uProgress * uDuration / i)); particles += 0.5 * pow(0.2 * (1.0 / (1.0 - atoms) - 1.0), 2.0); } - oColor.rgb += uColor * particles * masks.x; + oColor.rgb += uColor.rgb * particles * masks.x; oColor.a += particles * masks.x; // These are pretty useful for understanding how this works. diff --git a/resources/shaders/energize-b.frag b/resources/shaders/energize-b.frag index 2834ae9..df40402 100644 --- a/resources/shaders/energize-b.frag +++ b/resources/shaders/energize-b.frag @@ -13,13 +13,13 @@ // The content from common.glsl is automatically prepended to each shader effect. -uniform vec3 uColor; +uniform vec4 uColor; uniform float uScale; const float SHOWER_TIME = 0.3; const float SHOWER_WIDTH = 0.3; const float STREAK_TIME = 0.6; -const float EDGE_FADE = 50; +const float EDGE_FADE = 50.0; // This method returns four values: // result.x: A mask for the particles which lead the shower. @@ -80,28 +80,28 @@ void main() { vec4 oColor = getInputColor(iTexCoord.st); // Dissolve window to effect color / transparency. - oColor.rgb = mix(uColor, oColor.rgb, 0.5 * masks.w + 0.5); + oColor.rgb = mix(uColor.rgb, oColor.rgb, 0.5 * masks.w + 0.5); oColor.a = oColor.a * masks.w; // Add leading shower particles. vec2 showerUV = iTexCoord.st + vec2(0.0, -0.7 * progress / SHOWER_TIME); showerUV *= 0.02 * uSize / uScale; float shower = pow(simplex2D(showerUV), 10.0); - oColor.rgb += uColor * shower * masks.x; + oColor.rgb += uColor.rgb * shower * masks.x; oColor.a += shower * masks.x; // Add trailing streak lines. vec2 streakUV = iTexCoord.st + vec2(0.0, -progress / SHOWER_TIME); streakUV *= vec2(0.05 * uSize.x, 0.001 * uSize.y) / uScale; float streaks = simplex2DFractal(streakUV) * 0.5; - oColor.rgb += uColor * streaks * masks.y; + oColor.rgb += uColor.rgb * streaks * masks.y; oColor.a += streaks * masks.y; // Add glimmering atoms. vec2 atomUV = iTexCoord.st + vec2(0.0, -0.025 * progress / SHOWER_TIME); atomUV *= 0.2 * uSize / uScale; float atoms = pow((simplex3D(vec3(atomUV, uProgress * uDuration))), 5.0); - oColor.rgb += uColor * atoms * masks.z; + oColor.rgb += uColor.rgb * atoms * masks.z; oColor.a += atoms * masks.z; // These are pretty useful for understanding how this works. diff --git a/src/EnergizeA.js b/src/EnergizeA.js index 1064c7e..4d76cc6 100644 --- a/src/EnergizeA.js +++ b/src/EnergizeA.js @@ -51,7 +51,7 @@ var EnergizeA = class { const c = Clutter.Color.from_string(settings.get_string('energize-a-color'))[1]; // clang-format off - shader.set_uniform_float(shader._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]); + shader.set_uniform_float(shader._uColor, 4, [c.red / 255, c.green / 255, c.blue / 255, 1.0]); shader.set_uniform_float(shader._uScale, 1, [settings.get_double('energize-a-scale')]); // clang-format on }); diff --git a/src/EnergizeB.js b/src/EnergizeB.js index 0123857..9640f83 100644 --- a/src/EnergizeB.js +++ b/src/EnergizeB.js @@ -51,7 +51,7 @@ var EnergizeB = class { const c = Clutter.Color.from_string(settings.get_string('energize-b-color'))[1]; // clang-format off - shader.set_uniform_float(shader._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]); + shader.set_uniform_float(shader._uColor, 4, [c.red / 255, c.green / 255, c.blue / 255, 1.0]); shader.set_uniform_float(shader._uScale, 1, [settings.get_double('energize-b-scale')]); // clang-format on });