🚚 Move uForOpening to standard uniforms

This commit is contained in:
Simon Schneegans
2022-05-11 05:44:36 +02:00
parent 2bd897fe0e
commit 2eca2c7374
15 changed files with 28 additions and 55 deletions
-3
View File
@@ -146,7 +146,6 @@ if (utils.isInShellProcess()) {
_init() {
super._init();
this._uForOpening = this.get_uniform_location('uForOpening');
this._uSeed = this.get_uniform_location('uSeed');
this._uShake = this.get_uniform_location('uShake');
this._uTwirl = this.get_uniform_location('uTwirl');
@@ -161,7 +160,6 @@ if (utils.isInShellProcess()) {
const testMode = settings.get_boolean('test-mode');
// clang-format off
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
this.set_uniform_float(this._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
this.set_uniform_float(this._uShake, 1, [settings.get_double('apparition-shake-intensity')]);
this.set_uniform_float(this._uTwirl, 1, [settings.get_double('apparition-twirl-intensity')]);
@@ -183,7 +181,6 @@ if (utils.isInShellProcess()) {
// Inject some common shader snippets.
${shaderSnippets.standardUniforms()}
uniform bool uForOpening;
uniform vec2 uSeed;
uniform float uShake;
uniform float uTwirl;
-3
View File
@@ -167,7 +167,6 @@ if (utils.isInShellProcess()) {
shardData.width, shardData.height, shardData.rowstride);
}
this._uForOpening = this.get_uniform_location('uForOpening');
this._uShardTexture = this.get_uniform_location('uShardTexture');
this._uSeed = this.get_uniform_location('uSeed');
this._uEpicenter = this.get_uniform_location('uEpicenter');
@@ -198,7 +197,6 @@ if (utils.isInShellProcess()) {
const testMode = settings.get_boolean('test-mode');
// clang-format off
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
this.set_uniform_float(this._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
this.set_uniform_float(this._uEpicenter, 2, [epicenterX, epicenterY]);
this.set_uniform_float(this._uShardScale, 1, [settings.get_double('broken-glass-scale')]);
@@ -220,7 +218,6 @@ if (utils.isInShellProcess()) {
// Inject some common shader snippets.
${shaderSnippets.standardUniforms()}
uniform bool uForOpening;
uniform sampler2D uShardTexture;
uniform vec2 uSeed;
uniform vec2 uEpicenter;
+4 -7
View File
@@ -140,9 +140,8 @@ if (utils.isInShellProcess()) {
_init() {
super._init();
this._uForOpening = this.get_uniform_location('uForOpening');
this._uColor = this.get_uniform_location('uColor');
this._uScale = this.get_uniform_location('uScale');
this._uColor = this.get_uniform_location('uColor');
this._uScale = this.get_uniform_location('uScale');
}
// This is called each time the effect is used. This can be used to retrieve the
@@ -151,9 +150,8 @@ if (utils.isInShellProcess()) {
const c = Clutter.Color.from_string(settings.get_string('energize-a-color'))[1];
// clang-format off
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
this.set_uniform_float(this._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]);
this.set_uniform_float(this._uScale, 1, [settings.get_double('energize-a-scale')]);
this.set_uniform_float(this._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]);
this.set_uniform_float(this._uScale, 1, [settings.get_double('energize-a-scale')]);
// clang-format on
}
@@ -172,7 +170,6 @@ if (utils.isInShellProcess()) {
${shaderSnippets.noise()}
${shaderSnippets.edgeMask()}
uniform bool uForOpening;
uniform vec3 uColor;
uniform float uScale;
+4 -7
View File
@@ -140,9 +140,8 @@ if (utils.isInShellProcess()) {
_init() {
super._init();
this._uForOpening = this.get_uniform_location('uForOpening');
this._uColor = this.get_uniform_location('uColor');
this._uScale = this.get_uniform_location('uScale');
this._uColor = this.get_uniform_location('uColor');
this._uScale = this.get_uniform_location('uScale');
}
// This is called each time the effect is used. This can be used to retrieve the
@@ -151,9 +150,8 @@ if (utils.isInShellProcess()) {
const c = Clutter.Color.from_string(settings.get_string('energize-b-color'))[1];
// clang-format off
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
this.set_uniform_float(this._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]);
this.set_uniform_float(this._uScale, 1, [settings.get_double('energize-b-scale')]);
this.set_uniform_float(this._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]);
this.set_uniform_float(this._uScale, 1, [settings.get_double('energize-b-scale')]);
// clang-format on
}
@@ -172,7 +170,6 @@ if (utils.isInShellProcess()) {
${shaderSnippets.noise()}
${shaderSnippets.edgeMask()}
uniform bool uForOpening;
uniform vec3 uColor;
uniform float uScale;
-3
View File
@@ -259,7 +259,6 @@ if (utils.isInShellProcess()) {
this.get_uniform_location('uGradient5'),
];
this._uForOpening = this.get_uniform_location('uForOpening');
this._u3DNoise = this.get_uniform_location('u3DNoise');
this._uScale = this.get_uniform_location('uScale');
this._uMovementSpeed = this.get_uniform_location('uMovementSpeed');
@@ -277,7 +276,6 @@ if (utils.isInShellProcess()) {
}
// clang-format off
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
this.set_uniform_float(this._u3DNoise, 1, [settings.get_boolean('flame-3d-noise')]);
this.set_uniform_float(this._uScale, 1, [settings.get_double('flame-scale')]);
this.set_uniform_float(this._uMovementSpeed, 1, [settings.get_double('flame-movement-speed')]);
@@ -301,7 +299,6 @@ if (utils.isInShellProcess()) {
${shaderSnippets.edgeMask()}
${shaderSnippets.compositing()}
uniform bool uForOpening;
uniform bool u3DNoise;
uniform float uScale;
uniform float uMovementSpeed;
-3
View File
@@ -144,7 +144,6 @@ if (utils.isInShellProcess()) {
_init() {
super._init();
this._uForOpening = this.get_uniform_location('uForOpening');
this._uAdditiveBlending = this.get_uniform_location('uAdditiveBlending');
this._uSeed = this.get_uniform_location('uSeed');
this._uScale = this.get_uniform_location('uScale');
@@ -166,7 +165,6 @@ if (utils.isInShellProcess()) {
const testMode = settings.get_boolean('test-mode');
// clang-format off
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
this.set_uniform_float(this._uAdditiveBlending, 1, [settings.get_boolean('hexagon-additive-blending')]);
this.set_uniform_float(this._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
this.set_uniform_float(this._uScale, 1, [settings.get_double('hexagon-scale')]);
@@ -193,7 +191,6 @@ if (utils.isInShellProcess()) {
${shaderSnippets.standardUniforms()}
${shaderSnippets.noise()}
uniform bool uForOpening;
uniform bool uAdditiveBlending;
uniform vec2 uSeed;
uniform float uScale;
-3
View File
@@ -163,7 +163,6 @@ if (utils.isInShellProcess()) {
fontData.width, fontData.height, fontData.rowstride);
}
this._uForOpening = this.get_uniform_location('uForOpening');
this._uFontTexture = this.get_uniform_location('uFontTexture');
this._uTrailColor = this.get_uniform_location('uTrailColor');
this._uTipColor = this.get_uniform_location('uTipColor');
@@ -179,7 +178,6 @@ if (utils.isInShellProcess()) {
const c2 = Clutter.Color.from_string(settings.get_string('matrix-tip-color'))[1];
// clang-format off
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
this.set_uniform_float(this._uTrailColor, 3, [c1.red / 255, c1.green / 255, c1.blue / 255]);
this.set_uniform_float(this._uTipColor, 3, [c2.red / 255, c2.green / 255, c2.blue / 255]);
this.set_uniform_float(this._uLetterSize, 1, [settings.get_int('matrix-scale')]);
@@ -206,7 +204,6 @@ if (utils.isInShellProcess()) {
${shaderSnippets.edgeMask()}
${shaderSnippets.compositing()}
uniform bool uForOpening;
uniform sampler2D uFontTexture;
uniform vec3 uTrailColor;
uniform vec3 uTipColor;
+3 -6
View File
@@ -159,7 +159,6 @@ if (utils.isInShellProcess()) {
dustData.width, dustData.height, dustData.rowstride);
}
this._uForOpening = this.get_uniform_location('uForOpening');
this._uDustTexture = this.get_uniform_location('uDustTexture');
this._uDustColor = this.get_uniform_location('uDustColor');
this._uSeed = this.get_uniform_location('uSeed');
@@ -176,10 +175,9 @@ if (utils.isInShellProcess()) {
const testMode = settings.get_boolean('test-mode');
// clang-format off
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
this.set_uniform_float(this._uDustColor, 4, [c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
this.set_uniform_float(this._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
this.set_uniform_float(this._uDustScale, 1, [settings.get_double('snap-scale')]);
this.set_uniform_float(this._uDustColor, 4, [c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
this.set_uniform_float(this._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
this.set_uniform_float(this._uDustScale, 1, [settings.get_double('snap-scale')]);
// clang-format on
}
@@ -198,7 +196,6 @@ if (utils.isInShellProcess()) {
${shaderSnippets.noise()}
${shaderSnippets.math2D()}
uniform bool uForOpening;
uniform sampler2D uDustTexture;
uniform vec4 uDustColor;
uniform vec2 uSeed;
-3
View File
@@ -156,7 +156,6 @@ if (utils.isInShellProcess()) {
clawData.width, clawData.height, clawData.rowstride);
}
this._uForOpening = this.get_uniform_location('uForOpening');
this._uClawTexture = this.get_uniform_location('uClawTexture');
this._uFlashColor = this.get_uniform_location('uFlashColor');
this._uSeed = this.get_uniform_location('uSeed');
@@ -174,7 +173,6 @@ if (utils.isInShellProcess()) {
const testMode = settings.get_boolean('test-mode');
// clang-format off
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
this.set_uniform_float(this._uFlashColor, 4, [c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
this.set_uniform_float(this._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
this.set_uniform_float(this._uClawSize, 1, [settings.get_double('claw-scratch-scale')]);
@@ -199,7 +197,6 @@ if (utils.isInShellProcess()) {
${shaderSnippets.compositing()}
// See assets/README.md for how this texture was created.
uniform bool uForOpening;
uniform sampler2D uClawTexture;
uniform vec4 uFlashColor;
uniform vec2 uSeed;
+2 -8
View File
@@ -141,19 +141,14 @@ if (utils.isInShellProcess()) {
_init() {
super._init();
this._uForOpening = this.get_uniform_location('uForOpening');
this._uColor = this.get_uniform_location('uColor');
this._uColor = this.get_uniform_location('uColor');
}
// This is called each time the effect is used. This can be used to retrieve the
// configuration from the settings and update all uniforms accordingly.
setUniforms(actor, settings, forOpening) {
const c = Clutter.Color.from_string(settings.get_string('tv-effect-color'))[1];
// clang-format off
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
this.set_uniform_float(this._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]);
// clang-format on
this.set_uniform_float(this._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]);
}
// This is called by extension.js when the shader is not used anymore. We will store
@@ -169,7 +164,6 @@ if (utils.isInShellProcess()) {
// Inject some common shader snippets.
${shaderSnippets.standardUniforms()}
uniform bool uForOpening;
uniform vec3 uColor;
const float BLUR_WIDTH = 0.01; // Width of the gradients.
+6 -9
View File
@@ -141,10 +141,9 @@ if (utils.isInShellProcess()) {
_init() {
super._init();
this._uForOpening = this.get_uniform_location('uForOpening');
this._uSeed = this.get_uniform_location('uSeed');
this._uColor = this.get_uniform_location('uColor');
this._uScale = this.get_uniform_location('uScale');
this._uSeed = this.get_uniform_location('uSeed');
this._uColor = this.get_uniform_location('uColor');
this._uScale = this.get_uniform_location('uScale');
}
// This is called each time the effect is used. This can be used to retrieve the
@@ -156,10 +155,9 @@ if (utils.isInShellProcess()) {
const testMode = settings.get_boolean('test-mode');
// clang-format off
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
this.set_uniform_float(this._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
this.set_uniform_float(this._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]);
this.set_uniform_float(this._uScale, 1, [settings.get_double('wisps-scale')]);
this.set_uniform_float(this._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
this.set_uniform_float(this._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]);
this.set_uniform_float(this._uScale, 1, [settings.get_double('wisps-scale')]);
// clang-format on
}
@@ -179,7 +177,6 @@ if (utils.isInShellProcess()) {
${shaderSnippets.edgeMask()}
${shaderSnippets.compositing()}
uniform bool uForOpening;
uniform vec2 uSeed;
uniform vec3 uColor;
uniform float uScale;
+2
View File
@@ -18,12 +18,14 @@
//////////////////////////////////////////////////////////////////////////////////////////
// These should be included in every shader.
// uForOpening: True if a window-open animation is ongoing, false otherwise.
// uTexture: Contains the texture of the window.
// uProgress: A value which transitions from 0 to 1 during the entire animation.
// uTime: A steadily increasing value in seconds.
// uSize: The size of uTexture in pixels.
function standardUniforms() {
return `
uniform bool uForOpening;
uniform sampler2D uTexture;
uniform float uProgress;
uniform float uTime;