♻️ Make it possible to reuse the fire shader
This commit is contained in:
+22
-16
@@ -33,17 +33,17 @@ const utils = Me.imports.src.utils;
|
||||
|
||||
// New effects must be registered here and in prefs.js.
|
||||
const ALL_EFFECTS = [
|
||||
Me.imports.src.Apparition.Apparition,
|
||||
Me.imports.src.BrokenGlass.BrokenGlass,
|
||||
Me.imports.src.EnergizeA.EnergizeA,
|
||||
Me.imports.src.EnergizeB.EnergizeB,
|
||||
// Me.imports.src.Apparition.Apparition,
|
||||
// Me.imports.src.BrokenGlass.BrokenGlass,
|
||||
// Me.imports.src.EnergizeA.EnergizeA,
|
||||
// Me.imports.src.EnergizeB.EnergizeB,
|
||||
Me.imports.src.Fire.Fire,
|
||||
Me.imports.src.Hexagon.Hexagon,
|
||||
Me.imports.src.Matrix.Matrix,
|
||||
Me.imports.src.SnapOfDisintegration.SnapOfDisintegration,
|
||||
Me.imports.src.TRexAttack.TRexAttack,
|
||||
Me.imports.src.TVEffect.TVEffect,
|
||||
Me.imports.src.Wisps.Wisps,
|
||||
// Me.imports.src.Hexagon.Hexagon,
|
||||
// Me.imports.src.Matrix.Matrix,
|
||||
// Me.imports.src.SnapOfDisintegration.SnapOfDisintegration,
|
||||
// Me.imports.src.TRexAttack.TRexAttack,
|
||||
// Me.imports.src.TVEffect.TVEffect,
|
||||
// Me.imports.src.Wisps.Wisps,
|
||||
];
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -291,6 +291,9 @@ class Extension {
|
||||
// Tweaks, when you log out or when the screen locks.
|
||||
disable() {
|
||||
|
||||
// Free all effect resources.
|
||||
ALL_EFFECTS.forEach(Effect => Effect.cleanUp());
|
||||
|
||||
// Unregister our resources.
|
||||
Gio.resources_unregister(this._resources);
|
||||
|
||||
@@ -445,7 +448,7 @@ class Extension {
|
||||
// -------------------------------------------------------------------- add the shader
|
||||
|
||||
// Now add a cool shader to our window actor!
|
||||
const shader = this._currentEffect.createShader(actor, this._settings, forOpening);
|
||||
const shader = this._currentEffect.getShader(actor, this._settings, forOpening);
|
||||
|
||||
if (shader) {
|
||||
// There should always be an opacity transition going on...
|
||||
@@ -463,11 +466,14 @@ class Extension {
|
||||
|
||||
// Update uniforms at each frame.
|
||||
transition.connect('new-frame', (t) => {
|
||||
shader.set_uniform_value('uProgress', testMode ? 0.5 : t.get_progress());
|
||||
shader.set_uniform_value('uTime',
|
||||
testMode ? duration / 2 : 0.001 * t.get_elapsed_time());
|
||||
shader.set_uniform_value('uSizeX', actor.width);
|
||||
shader.set_uniform_value('uSizeY', actor.height);
|
||||
shader.set_uniform_float(shader.get_uniform_location('uProgress'), 1,
|
||||
[testMode ? 0.5 : t.get_progress()]);
|
||||
shader.set_uniform_float(
|
||||
shader.get_uniform_location('uTime'), 1,
|
||||
[testMode ? duration / 2 : 0.001 * t.get_elapsed_time()]);
|
||||
shader.set_uniform_float(shader.get_uniform_location('uSizeX'), 1, [actor.width]);
|
||||
shader.set_uniform_float(shader.get_uniform_location('uSizeY'), 1,
|
||||
[actor.height]);
|
||||
});
|
||||
|
||||
// Remove the effect if the animation finished or was interrupted.
|
||||
|
||||
Reference in New Issue
Block a user