resync and updated

This commit is contained in:
Justin Garza
2025-03-08 11:45:31 -05:00
parent db955d5af8
commit 845c765843
6 changed files with 124 additions and 6 deletions
+57 -2
View File
@@ -23,6 +23,10 @@ uniform vec4 uGradient3;
uniform vec4 uGradient4;
uniform vec4 uGradient5;
//new
uniform bool uRandomColor;
uniform float uSeed;
// These may be configurable in the future.
const float EDGE_FADE = 70.0;
const float FADE_WIDTH = 0.1;
@@ -58,6 +62,36 @@ vec4 getFireColor(float v) {
return colors[4];
}
vec4 getFireColorV2(float v, vec4 c0, vec4 c1, vec4 c2, vec4 c3, vec4 c4)
{
float steps[5];
steps[0] = 0.0;
steps[1] = 0.2;
steps[2] = 0.35;
steps[3] = 0.5;
steps[4] = 0.8;
vec4 colors[5];
colors[0] = c0;
colors[1] = c1;
colors[2] = c2;
colors[3] = c3;
colors[4] = c4;
if (v < steps[0]) {
return colors[0];
}
for (int i = 0; i < 4; ++i) {
if (v <= steps[i + 1]) {
return mix(colors[i], colors[i + 1],
vec4(v - steps[i]) / (steps[i + 1] - steps[i]));
}
}
return colors[4];
}
// This method requires the uniforms from standardUniforms() to be available.
// It returns two values: The first is an alpha value which can be used for the window
// texture. This gradually dissolves the window from top to bottom. The second can be used
@@ -114,7 +148,28 @@ void main() {
noise *= effectMask.y;
// Map noise value to color.
vec4 fire = getFireColor(noise);
vec4 fire = vec4(0.0);
if (uRandomColor)
{
vec3 baseColor0 = offsetHue(vec3(1.0,0.0,0.0), hash11(uSeed));
vec3 baseColor1 = offsetHue(baseColor0, 0.1);
vec3 baseColor2 = offsetHue(baseColor1, 0.1);
//hardcoding alpha values
vec4 c0 = vec4(baseColor0,0.0);
vec4 c1 = vec4(baseColor0,0.3);
vec4 c2 = vec4(baseColor1,0.6);
vec4 c3 = vec4(baseColor1,0.9);
vec4 c4 = vec4(baseColor2,1.0);
fire = getFireColorV2(noise,c0,c1,c2,c3,c4);
}
else
{
fire = getFireColor(noise);
}
// Get the window texture.
vec4 oColor = getInputColor(iTexCoord.st);
@@ -131,4 +186,4 @@ void main() {
// oColor = vec4(vec3(effectMask.y), 1);
setOutputColor(oColor);
}
}
+23 -1
View File
@@ -147,6 +147,28 @@ SPDX-License-Identifier: GPL-3.0-or-later
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Use Random Color</property>
<property name="activatable-widget">fire-random-color</property>
<child>
<object class="GtkSwitch" id="fire-random-color">
<property name="valign">center</property>
</object>
</child>
<child>
<object class="GtkButton" id="reset-fire-random-color">
<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">Gradient</property>
@@ -206,4 +228,4 @@ SPDX-License-Identifier: GPL-3.0-or-later
</child>
</object>
</interface>
</interface>