This commit is contained in:
Justin Garza
2024-12-25 23:12:38 -05:00
parent 020516e0da
commit 7f02f445e5
8 changed files with 564 additions and 42 deletions
+116
View File
@@ -0,0 +1,116 @@
//////////////////////////////////////////////////////////////////////////////////////////
// ) ( //
// ( /( ( ( ) ( ( ( ( )\ ) ( ( //
// )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( //
// ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ //
// | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) //
// | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< //
// |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ //
// |__/ //
//////////////////////////////////////////////////////////////////////////////////////////
// SPDX-FileCopyrightText: Justin Garza JGarza9788@gmail.com
// SPDX-License-Identifier: GPL-3.0-or-later
// The content from common.glsl is automatically prepended to each shader effect. This
// provides the standard input:
// vec2 iTexCoord: Texture coordinates for retrieving the window input color.
// bool uIsFullscreen: True if the window is maximized or in fullscreen mode.
// bool uForOpening: True if a window-open animation is ongoing, false otherwise.
// float uProgress: A value which transitions from 0 to 1 during the animation.
// float uDuration: The duration of the current animation in seconds.
// vec2 uSize: The size of uTexture in pixels.
// float uPadding: The empty area around the actual window (e.g. where the shadow
// is drawn). For now, this will only be set on GNOME.
// Furthermore, there are two global methods for reading the window input color and
// setting the shader output color. Both methods assume straight alpha:
// vec4 getInputColor(vec2 coords)
// void setOutputColor(vec4 outColor)
uniform float uWavesize;
uniform float uBrightness;
uniform float uStretchR;
uniform float uStretchG;
uniform float uStretchB;
// float wavesize = 1.0;
// float brightness = 1.0;
// float stretchR = 0.25;
// float stretchG = 0.20;
// float stretchB = 0.15;
float FadeInOut(float t, float power)
{
float s = -1.0 * pow((t-0.5)/(0.5),power)+1.0;
s = clamp(s,0.0,1.0);
return s;
}
// The width of the fading effect is loaded from the settings.
uniform float uFadeWidth;
void main() {
// Calculate the progression value based on the animation direction.
// If opening, use uProgress as-is; if closing, invert the progression.
float progress = uForOpening ? uProgress : 1.0 - uProgress;
//progress will now go from 0.5 to 1.0
progress = mix(0.5,1.0,progress);
// the UV
vec2 uv = iTexCoord.st;
vec2 f = vec2(uv.x,1.0 - uv.y);
float w = 0.0;
float p = mix(0.0, 1.0 + uWavesize, progress);
w = 1.0 - abs(p - f.y);
w = clamp(w,0.0,1.0);
w = pow(w, mix(100.0,1.0,uWavesize) );
float mask = 1.0;
if (p - f.y < 0.0)
{
mask = 0.0;
w = 0.0;
}
vec4 oColor = vec4(0.0);
oColor.r = getInputColor(uv + vec2(0.0,w * uStretchR ) ).r * mix(1.0, uBrightness, FadeInOut(progress,4));
oColor.g = getInputColor(uv + vec2(0.0,w * uStretchG ) ).g * mix(1.0, uBrightness, FadeInOut(progress,4));
oColor.b = getInputColor(uv + vec2(0.0,w * uStretchB ) ).b * mix(1.0, uBrightness, FadeInOut(progress,4));
// float stretchA = min(min(uStretchR,uStretchG),uStretchB);
// oColor.a = getInputColor(uv).a * mask * (1.0 - w);
// float mask = (oColor.r + oColor.g + oColor.b)/3.0;
// float mask = max(max(oColor.r,oColor.g),oColor.b);
// oColor.a = getInputColor(uv).a * progress;
//this will not work well on very dark themes
// float mask = (oColor.r + oColor.g + oColor.b)/3.0;
// if (mask > 0.0)
// {
// oColor.a = getInputColor(uv).a;
// }
oColor.a = getInputColor(uv).a * easeInOutSine(progress) * mask;
// float a = getInputColor(uv).a * easeOutExpo(progress);
// oColor.a = clamp(a,0.0,1.0);
// oColor.a = getInputColor(uv).a ;
// oColor.a = mask * getInputColor(uv).a * cmax ;
setOutputColor(oColor);
}
+245
View File
@@ -0,0 +1,245 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: Justin Garza JGarza9788@gmail.com
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="burn-my-windows">
<!-- Main container for the rgbwarp preferences section -->
<object class="AdwExpanderRow" id="rgbwarp-prefs">
<!-- Animation Time Adjustment Section -->
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Animation Time [ms]</property>
<child>
<object class="GtkScale">
<property name="valign">center</property>
<property name="draw-value">1</property>
<property name="digits">0</property>
<property name="value-pos">left</property>
<property name="width-request">300</property>
<property name="adjustment">
<object class="GtkAdjustment" id="rgbwarp-animation-time">
<property name="upper">5000</property>
<property name="lower">100</property>
<property name="step-increment">10</property>
<property name="page-increment">100</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkButton" id="reset-rgbwarp-animation-time">
<property name="icon-name">edit-clear-symbolic</property>
<property name="valign">center</property>
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
<style>
<class name="flat" />
</style>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">WaveSize</property>
<!-- <property name="subtitle" translatable="yes"></property> -->
<child>
<object class="GtkScale" >
<property name="valign">center</property>
<property name="draw-value">1</property>
<property name="digits">2</property>
<property name="value-pos">left</property>
<property name="width-request">300</property>
<property name="adjustment">
<object class="GtkAdjustment" id="rgbwarp-wavesize">
<property name="upper">1.0</property>
<property name="lower">0.0</property>
<property name="step-increment">0.01</property>
<property name="page-increment">0.1</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkButton" id="reset-rgbwarp-wavesize">
<property name="icon-name">edit-clear-symbolic</property>
<property name="valign">center</property>
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
<style>
<class name="flat" />
</style>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Brightness</property>
<!-- <property name="subtitle" translatable="yes"></property> -->
<child>
<object class="GtkScale" >
<property name="valign">center</property>
<property name="draw-value">1</property>
<property name="digits">2</property>
<property name="value-pos">left</property>
<property name="width-request">300</property>
<property name="adjustment">
<object class="GtkAdjustment" id="rgbwarp-brightness">
<property name="upper">1.0</property>
<property name="lower">0.0</property>
<property name="step-increment">0.1</property>
<property name="page-increment">0.25</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkButton" id="reset-rgbwarp-brightness">
<property name="icon-name">edit-clear-symbolic</property>
<property name="valign">center</property>
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
<style>
<class name="flat" />
</style>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">OffsetRed</property>
<!-- <property name="subtitle" translatable="yes"></property> -->
<child>
<object class="GtkScale" >
<property name="valign">center</property>
<property name="draw-value">1</property>
<property name="digits">2</property>
<property name="value-pos">left</property>
<property name="width-request">300</property>
<property name="adjustment">
<object class="GtkAdjustment" id="rgbwarp-offset-r">
<property name="upper">1.0</property>
<property name="lower">0.0</property>
<property name="step-increment">0.01</property>
<property name="page-increment">0.1</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkButton" id="reset-rgbwarp-offset-r">
<property name="icon-name">edit-clear-symbolic</property>
<property name="valign">center</property>
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
<style>
<class name="flat" />
</style>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">OffsetGreen</property>
<!-- <property name="subtitle" translatable="yes"></property> -->
<child>
<object class="GtkScale" >
<property name="valign">center</property>
<property name="draw-value">1</property>
<property name="digits">2</property>
<property name="value-pos">left</property>
<property name="width-request">300</property>
<property name="adjustment">
<object class="GtkAdjustment" id="rgbwarp-offset-g">
<property name="upper">1.0</property>
<property name="lower">0.0</property>
<property name="step-increment">0.01</property>
<property name="page-increment">0.1</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkButton" id="reset-rgbwarp-offset-g">
<property name="icon-name">edit-clear-symbolic</property>
<property name="valign">center</property>
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
<style>
<class name="flat" />
</style>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">OffsetBlue</property>
<!-- <property name="subtitle" translatable="yes"></property> -->
<child>
<object class="GtkScale" >
<property name="valign">center</property>
<property name="draw-value">1</property>
<property name="digits">2</property>
<property name="value-pos">left</property>
<property name="width-request">300</property>
<property name="adjustment">
<object class="GtkAdjustment" id="rgbwarp-offset-b">
<property name="upper">1.0</property>
<property name="lower">0.0</property>
<property name="step-increment">0.01</property>
<property name="page-increment">0.1</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkButton" id="reset-rgbwarp-offset-b">
<property name="icon-name">edit-clear-symbolic</property>
<property name="valign">center</property>
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
<style>
<class name="flat" />
</style>
</object>
</child>
</object>
</child>
</object>
</interface>