🎉 Add initial incinerate effect
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
// Inject some common shader snippets. It is only possible to include glsl files from the
|
||||
// "common" directory. Also, the files in the "common" directory are not allowed to
|
||||
// include any further files.
|
||||
#include "common/uniforms.glsl"
|
||||
#include "common/noise.glsl"
|
||||
#include "common/easing.glsl"
|
||||
#include "common/compositing.glsl"
|
||||
#include "common/edgeMask.glsl"
|
||||
|
||||
uniform vec2 uSeed;
|
||||
uniform vec3 uColor;
|
||||
uniform float uScale;
|
||||
uniform float uWidth;
|
||||
uniform float uTurbulence;
|
||||
|
||||
vec4 getFireColor(float v) {
|
||||
const float steps[3] = float[](0.0, 0.5, 1.0);
|
||||
vec4 colors[3] = vec4[](vec4(1, 0, 0, 0), vec4(1, 0, 0, 0.5), vec4(1, 1, 0, 1));
|
||||
|
||||
if (v < steps[0]) {
|
||||
return colors[0];
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
if (v <= steps[i + 1]) {
|
||||
return mix(colors[i], colors[i + 1],
|
||||
vec4(v - steps[i]) / (steps[i + 1] - steps[i]));
|
||||
}
|
||||
}
|
||||
|
||||
return colors[2];
|
||||
}
|
||||
|
||||
void main() {
|
||||
float progress = uProgress / 0.8;
|
||||
|
||||
progress = uForOpening ? 1.0 - progress : progress;
|
||||
|
||||
vec2 uv = 0.01 * cogl_tex_coord_in[0].st * uSize / uScale;
|
||||
|
||||
float lfNoise = simplex2D(cogl_tex_coord_in[0].st + uSeed);
|
||||
lfNoise = mix(lfNoise - 1.0, lfNoise + 1.0, progress);
|
||||
|
||||
float hfNoise = simplex2DFractal(uv + uSeed);
|
||||
hfNoise = mix(hfNoise - 1.0, hfNoise + 1.0, progress);
|
||||
|
||||
float noise = mix(lfNoise, hfNoise, uTurbulence);
|
||||
float fire = noise / (0.03 * uWidth) - progress / (0.03 * uWidth) + progress;
|
||||
|
||||
vec4 windowColor = texture2D(uTexture, cogl_tex_coord_in[0].st);
|
||||
|
||||
// Shell.GLSLEffect uses straight alpha. So we have to convert from premultiplied.
|
||||
if (windowColor.a > 0) {
|
||||
windowColor.rgb /= windowColor.a;
|
||||
}
|
||||
|
||||
cogl_color_out = windowColor;
|
||||
|
||||
if (fire >= 1) {
|
||||
cogl_color_out.a = 0;
|
||||
} else if (fire > 0) {
|
||||
vec4 fire = getFireColor(fire);
|
||||
fire.a *= cogl_color_out.a;
|
||||
cogl_color_out = alphaOver(cogl_color_out, fire);
|
||||
}
|
||||
|
||||
if ((uForOpening && fire < 0) || (!uForOpening && fire > 1)) {
|
||||
float smoke = (uForOpening ? -fire : fire - 1) * uWidth;
|
||||
|
||||
vec2 uv = 0.01 * cogl_tex_coord_in[0].st * uSize / uScale;
|
||||
vec2 smokeShift = vec2(0, smoke * 0.1);
|
||||
smoke = clamp(smoke, 0, 1) * simplex2DFractal(uv + uSeed + smokeShift);
|
||||
|
||||
smoke *= getRelativeEdgeMask(0.3);
|
||||
|
||||
float fadeOutProgress = clamp((uProgress - 0.7) / 0.3, 0, 1);
|
||||
smoke *= 1 - fadeOutProgress;
|
||||
|
||||
cogl_color_out = alphaOver(cogl_color_out, vec4(vec3(0.2), smoke));
|
||||
}
|
||||
|
||||
// if (cogl_tex_coord_in[0].s > 0.5) {
|
||||
// cogl_color_out = vec4(vec3(noise), 1.0);
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface domain="burn-my-windows">
|
||||
|
||||
<object class="GtkBox" id="burn-prefs">
|
||||
<property name="orientation">vertical</property>
|
||||
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<child>
|
||||
<object class="GtkListBox">
|
||||
<property name="selection-mode">none</property>
|
||||
<property name="show-separators">1</property>
|
||||
<style>
|
||||
<class name="rich-list" />
|
||||
</style>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<property name="activatable">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Animation Time [ms]</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale">
|
||||
<property name="halign">end</property>
|
||||
<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="burn-animation-time">
|
||||
<property name="upper">10000</property>
|
||||
<property name="lower">100</property>
|
||||
<property name="step-increment">1</property>
|
||||
<property name="page-increment">100</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="reset-burn-animation-time">
|
||||
<property name="icon-name">edit-clear-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
|
||||
<style>
|
||||
<class name="flat" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<property name="activatable">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Scale</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale">
|
||||
<property name="halign">end</property>
|
||||
<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="burn-scale">
|
||||
<property name="upper">10</property>
|
||||
<property name="lower">0.1</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-burn-scale">
|
||||
<property name="icon-name">edit-clear-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
|
||||
<style>
|
||||
<class name="flat" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<property name="activatable">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Width</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale">
|
||||
<property name="halign">end</property>
|
||||
<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="burn-width">
|
||||
<property name="upper">10</property>
|
||||
<property name="lower">0.1</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-burn-width">
|
||||
<property name="icon-name">edit-clear-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
|
||||
<style>
|
||||
<class name="flat" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<property name="activatable">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Turbulence</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale">
|
||||
<property name="halign">end</property>
|
||||
<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="burn-turbulence">
|
||||
<property name="upper">1</property>
|
||||
<property name="lower">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-burn-turbulence">
|
||||
<property name="icon-name">edit-clear-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
|
||||
<style>
|
||||
<class name="flat" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<property name="activatable">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Color</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="burn-color">
|
||||
<property name="use_alpha">0</property>
|
||||
<property name="show_editor">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="reset-burn-color">
|
||||
<property name="icon-name">edit-clear-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
|
||||
<style>
|
||||
<class name="flat" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
|
||||
</object>
|
||||
|
||||
</interface>
|
||||
Reference in New Issue
Block a user