From 0772dfab90feffeabf299e449317d08b06653271 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Mon, 10 Jan 2022 17:21:24 +0100 Subject: [PATCH] :wrench: Improve T-Rex effect --- docs/changelog.md | 1 + src/TRexEffect.js | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index e2d87da..a704bed 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -14,6 +14,7 @@ * The source code has received a **major refactoring**. This will make the addition of new effects much easier in the future. * The **layout of the settings dialog** has been reworked to make it easier to expand it in the future. * The lower limit of the **animation time of the TV Effect** has been reduced. +* The T-Rex-Attack effect is not shown in fully transparent regions of a window any more. #### Fixes diff --git a/src/TRexEffect.js b/src/TRexEffect.js index 9850601..d38ebe4 100644 --- a/src/TRexEffect.js +++ b/src/TRexEffect.js @@ -214,15 +214,18 @@ if (utils.isInShellProcess()) { vec2 offset = vec2(dFdx(scratchMap), dFdy(scratchMap)) * uProgress * 0.5; cogl_color_out = texture2D(uTexture, coords + offset); - // Hide scratched out parts. - cogl_color_out *= (scratchMap > uProgress ? 1 : 0); - // Add colorful flashes. float flashIntensity = 1.0 / FLASH_INTENSITY * (scratchMap - uProgress) + 1; if (flashIntensity < 0 || flashIntensity >= 1) { flashIntensity = 0; } + // Hide flashes where there is now window. + flashIntensity *= cogl_color_out.a; + + // Hide scratched out parts. + cogl_color_out *= (scratchMap > uProgress ? 1 : 0); + vec3 flashColor = vec3(${color.red / 255}, ${color.green / 255}, ${color.blue / 255}) * ${color.alpha / 255};