♻️ Rename some variables
This commit is contained in:
+13
-12
@@ -31,11 +31,11 @@ const utils = Me.imports.src.utils;
|
|||||||
|
|
||||||
// The shader class for this effect is registered further down in this file. When this
|
// The shader class for this effect is registered further down in this file. When this
|
||||||
// effect is used for the first time, an instance of this shader class is created. Once
|
// effect is used for the first time, an instance of this shader class is created. Once
|
||||||
// the effect is finished, the shader will be stored in the shaderInstances array and will
|
// the effect is finished, the shader will be stored in the freeShaders array and will
|
||||||
// then be reused if a new shader is requested. ShaderClass which will be used whenever
|
// then be reused if a new shader is requested. ShaderClass which will be used whenever
|
||||||
// this effect is used.
|
// this effect is used.
|
||||||
let ShaderClass = null;
|
let ShaderClass = null;
|
||||||
let availableShaders = [];
|
let freeShaders = [];
|
||||||
|
|
||||||
// The effect class is completely static. It can be used to get some metadata (like the
|
// The effect class is completely static. It can be used to get some metadata (like the
|
||||||
// effect's name or supported GNOME Shell versions), to initialize the respective page of
|
// effect's name or supported GNOME Shell versions), to initialize the respective page of
|
||||||
@@ -108,10 +108,10 @@ var Fire = class Fire {
|
|||||||
static getShader(actor, settings, forOpening) {
|
static getShader(actor, settings, forOpening) {
|
||||||
let shader;
|
let shader;
|
||||||
|
|
||||||
if (availableShaders.length == 0) {
|
if (freeShaders.length == 0) {
|
||||||
shader = new ShaderClass();
|
shader = new ShaderClass();
|
||||||
} else {
|
} else {
|
||||||
shader = availableShaders.pop();
|
shader = freeShaders.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
shader.setUniforms(settings, forOpening);
|
shader.setUniforms(settings, forOpening);
|
||||||
@@ -140,7 +140,7 @@ var Fire = class Fire {
|
|||||||
// This is called from extension.js if the extension is disabled. This should free all
|
// This is called from extension.js if the extension is disabled. This should free all
|
||||||
// static resources.
|
// static resources.
|
||||||
static cleanUp() {
|
static cleanUp() {
|
||||||
availableShaders = [];
|
freeShaders = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------- private stuff
|
// ----------------------------------------------------------------------- private stuff
|
||||||
@@ -276,17 +276,18 @@ if (utils.isInShellProcess()) {
|
|||||||
[c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
|
[c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
|
// clang-format off
|
||||||
this.set_uniform_float(this._u3DNoise, 1, [settings.get_boolean('flame-3d-noise')]);
|
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
|
||||||
this.set_uniform_float(this._uScale, 1, [settings.get_double('flame-scale')]);
|
this.set_uniform_float(this._u3DNoise, 1, [settings.get_boolean('flame-3d-noise')]);
|
||||||
this.set_uniform_float(this._uMovementSpeed, 1,
|
this.set_uniform_float(this._uScale, 1, [settings.get_double('flame-scale')]);
|
||||||
[settings.get_double('flame-movement-speed')]);
|
this.set_uniform_float(this._uMovementSpeed, 1, [settings.get_double('flame-movement-speed')]);
|
||||||
|
// clang-format on
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called by extension.js when the shader is not used anymore. We will store
|
// This is called by extension.js when the shader is not used anymore. We will store
|
||||||
// this instance of the shader so that it can be re-used in th future.
|
// this instance of the shader so that it can be re-used in th future.
|
||||||
free() {
|
free() {
|
||||||
availableShaders.push(this);
|
freeShaders.push(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called by the constructor. This is means it's only called when the effect
|
// This is called by the constructor. This is means it's only called when the effect
|
||||||
|
|||||||
+17
-24
@@ -28,11 +28,11 @@ const utils = Me.imports.src.utils;
|
|||||||
|
|
||||||
// The shader class for this effect is registered further down in this file. When this
|
// The shader class for this effect is registered further down in this file. When this
|
||||||
// effect is used for the first time, an instance of this shader class is created. Once
|
// effect is used for the first time, an instance of this shader class is created. Once
|
||||||
// the effect is finished, the shader will be stored in the shaderInstances array and will
|
// the effect is finished, the shader will be stored in the freeShaders array and will
|
||||||
// then be reused if a new shader is requested. ShaderClass which will be used whenever
|
// then be reused if a new shader is requested. ShaderClass which will be used whenever
|
||||||
// this effect is used.
|
// this effect is used.
|
||||||
let ShaderClass = null;
|
let ShaderClass = null;
|
||||||
let availableShaders = [];
|
let freeShaders = [];
|
||||||
|
|
||||||
// The effect class is completely static. It can be used to get some metadata (like the
|
// The effect class is completely static. It can be used to get some metadata (like the
|
||||||
// effect's name or supported GNOME Shell versions), to initialize the respective page of
|
// effect's name or supported GNOME Shell versions), to initialize the respective page of
|
||||||
@@ -90,10 +90,10 @@ var Hexagon = class Hexagon {
|
|||||||
static getShader(actor, settings, forOpening) {
|
static getShader(actor, settings, forOpening) {
|
||||||
let shader;
|
let shader;
|
||||||
|
|
||||||
if (availableShaders.length == 0) {
|
if (freeShaders.length == 0) {
|
||||||
shader = new ShaderClass();
|
shader = new ShaderClass();
|
||||||
} else {
|
} else {
|
||||||
shader = availableShaders.pop();
|
shader = freeShaders.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
shader.setUniforms(settings, forOpening);
|
shader.setUniforms(settings, forOpening);
|
||||||
@@ -159,34 +159,27 @@ if (utils.isInShellProcess()) {
|
|||||||
|
|
||||||
// Get the two configurable colors. They are directly injected into the shader code
|
// Get the two configurable colors. They are directly injected into the shader code
|
||||||
// below.
|
// below.
|
||||||
const glow =
|
const gc = Clutter.Color.from_string(settings.get_string('hexagon-glow-color'))[1];
|
||||||
Clutter.Color.from_string(settings.get_string('hexagon-glow-color'))[1];
|
const lc = Clutter.Color.from_string(settings.get_string('hexagon-line-color'))[1];
|
||||||
const line =
|
|
||||||
Clutter.Color.from_string(settings.get_string('hexagon-line-color'))[1];
|
|
||||||
|
|
||||||
// If we are currently performing integration test, the animation uses a fixed seed.
|
// If we are currently performing integration test, the animation uses a fixed seed.
|
||||||
const testMode = settings.get_boolean('test-mode');
|
const testMode = settings.get_boolean('test-mode');
|
||||||
|
|
||||||
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
|
// clang-format off
|
||||||
this.set_uniform_float(this._uAdditiveBlending, 1,
|
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
|
||||||
[settings.get_boolean('hexagon-additive-blending')]);
|
this.set_uniform_float(this._uAdditiveBlending, 1, [settings.get_boolean('hexagon-additive-blending')]);
|
||||||
this.set_uniform_float(
|
this.set_uniform_float(this._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
|
||||||
this._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
|
this.set_uniform_float(this._uScale, 1, [settings.get_double('hexagon-scale')]);
|
||||||
this.set_uniform_float(this._uScale, 1, [settings.get_double('hexagon-scale')]);
|
this.set_uniform_float(this._uLineWidth, 1, [settings.get_double('hexagon-line-width')]);
|
||||||
this.set_uniform_float(this._uLineWidth, 1,
|
this.set_uniform_float(this._uGlowColor, 4, [gc.red / 255, gc.green / 255, gc.blue / 255, gc.alpha / 255]);
|
||||||
[settings.get_double('hexagon-line-width')]);
|
this.set_uniform_float(this._uLineColor, 4, [lc.red / 255, lc.green / 255, lc.blue / 255, lc.alpha / 255]);
|
||||||
this.set_uniform_float(
|
// clang-format on
|
||||||
this._uGlowColor, 4,
|
|
||||||
[glow.red / 255, glow.green / 255, glow.blue / 255, glow.alpha / 255]);
|
|
||||||
this.set_uniform_float(
|
|
||||||
this._uLineColor, 4,
|
|
||||||
[line.red / 255, line.green / 255, line.blue / 255, line.alpha / 255]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called by extension.js when the shader is not used anymore. We will store
|
// This is called by extension.js when the shader is not used anymore. We will store
|
||||||
// this instance of the shader so that it can be re-used in th future.
|
// this instance of the shader so that it can be re-used in th future.
|
||||||
free() {
|
free() {
|
||||||
availableShaders.push(this);
|
freeShaders.push(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called by the constructor. This is means it's only called when the effect
|
// This is called by the constructor. This is means it's only called when the effect
|
||||||
|
|||||||
Reference in New Issue
Block a user