🔧 Pass testMode flag to shaders
This commit is contained in:
+2
-1
@@ -521,7 +521,8 @@ class Extension {
|
|||||||
actor.add_effect_with_name('burn-my-windows-effect', shader);
|
actor.add_effect_with_name('burn-my-windows-effect', shader);
|
||||||
|
|
||||||
// Set one-time uniforms.
|
// Set one-time uniforms.
|
||||||
shader.beginAnimation(this._settings, forOpening, duration * 0.001, actor);
|
shader.beginAnimation(profile.settings, forOpening, testMode, duration * 0.001,
|
||||||
|
actor);
|
||||||
|
|
||||||
// Set other uniforms each frame.
|
// Set other uniforms each frame.
|
||||||
transition.connect('new-frame', (t) => {
|
transition.connect('new-frame', (t) => {
|
||||||
|
|||||||
+9
-5
@@ -29,7 +29,7 @@ const utils = Me.imports.src.utils;
|
|||||||
// main benefit when compared to Clutter.ShaderEffect is that setting uniforms of types //
|
// main benefit when compared to Clutter.ShaderEffect is that setting uniforms of types //
|
||||||
// vec2, vec3 or vec4 is supported via the API (with Clutter.ShaderEffect the GJS //
|
// vec2, vec3 or vec4 is supported via the API (with Clutter.ShaderEffect the GJS //
|
||||||
// binding does not work properly). However, there are two drawbacks: On the one hand, //
|
// binding does not work properly). However, there are two drawbacks: On the one hand, //
|
||||||
// the shader source code is cached statically - this mean if we want to have a //
|
// the shader source code is cached statically - this means if we want to have a //
|
||||||
// different shader, we have to derive a new class. Therefore, each effect has to //
|
// different shader, we have to derive a new class. Therefore, each effect has to //
|
||||||
// derive its own class from the class below. This is encapsulated in the //
|
// derive its own class from the class below. This is encapsulated in the //
|
||||||
// ShaderFactory, however it is some really awkward code. The other drawback is the //
|
// ShaderFactory, however it is some really awkward code. The other drawback is the //
|
||||||
@@ -47,8 +47,12 @@ const utils = Me.imports.src.utils;
|
|||||||
var Shader = GObject.registerClass(
|
var Shader = GObject.registerClass(
|
||||||
{
|
{
|
||||||
Signals: {
|
Signals: {
|
||||||
'begin-animation':
|
'begin-animation': {
|
||||||
{param_types: [Gio.Settings.$gtype, GObject.TYPE_BOOLEAN, Clutter.Actor.$gtype]},
|
param_types: [
|
||||||
|
Gio.Settings.$gtype, GObject.TYPE_BOOLEAN, GObject.TYPE_BOOLEAN,
|
||||||
|
Clutter.Actor.$gtype
|
||||||
|
]
|
||||||
|
},
|
||||||
'update-animation': {param_types: [GObject.TYPE_DOUBLE]},
|
'update-animation': {param_types: [GObject.TYPE_DOUBLE]},
|
||||||
'end-animation': {}
|
'end-animation': {}
|
||||||
}
|
}
|
||||||
@@ -76,7 +80,7 @@ var Shader = GObject.registerClass(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This is called once each time the shader is used.
|
// This is called once each time the shader is used.
|
||||||
beginAnimation(settings, forOpening, duration, actor) {
|
beginAnimation(settings, forOpening, testMode, duration, actor) {
|
||||||
|
|
||||||
// Reset progress value.
|
// Reset progress value.
|
||||||
this._progress = 0;
|
this._progress = 0;
|
||||||
@@ -90,7 +94,7 @@ var Shader = GObject.registerClass(
|
|||||||
this.set_uniform_float(this._uDuration, 1, [duration]);
|
this.set_uniform_float(this._uDuration, 1, [duration]);
|
||||||
this.set_uniform_float(this._uSize, 2, [actor.width, actor.height]);
|
this.set_uniform_float(this._uSize, 2, [actor.width, actor.height]);
|
||||||
|
|
||||||
this.emit('begin-animation', settings, forOpening, actor);
|
this.emit('begin-animation', settings, forOpening, testMode, actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called at each frame during the animation.
|
// This is called at each frame during the animation.
|
||||||
|
|||||||
@@ -44,10 +44,7 @@ var Apparition = class {
|
|||||||
shader._uRandomness = shader.get_uniform_location('uRandomness');
|
shader._uRandomness = shader.get_uniform_location('uRandomness');
|
||||||
|
|
||||||
// Write all uniform values at the start of each animation.
|
// Write all uniform values at the start of each animation.
|
||||||
shader.connect('begin-animation', (shader, settings) => {
|
shader.connect('begin-animation', (shader, settings, forOpening, testMode) => {
|
||||||
// If we are performing an integration tests, we use a fixed seed.
|
|
||||||
const testMode = settings.get_boolean('test-mode');
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
|
shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
|
||||||
shader.set_uniform_float(shader._uShake, 1, [settings.get_double('apparition-shake-intensity')]);
|
shader.set_uniform_float(shader._uShake, 1, [settings.get_double('apparition-shake-intensity')]);
|
||||||
|
|||||||
@@ -70,7 +70,8 @@ var BrokenGlass = class {
|
|||||||
shader._uGravity = shader.get_uniform_location('uGravity');
|
shader._uGravity = shader.get_uniform_location('uGravity');
|
||||||
|
|
||||||
// And update all uniforms at the start of each animation.
|
// And update all uniforms at the start of each animation.
|
||||||
shader.connect('begin-animation', (shader, settings, forOpening, actor) => {
|
shader.connect(
|
||||||
|
'begin-animation', (shader, settings, forOpening, testMode, actor) => {
|
||||||
// Usually, the shards fly away from the center of the window.
|
// Usually, the shards fly away from the center of the window.
|
||||||
let epicenterX = 0.5;
|
let epicenterX = 0.5;
|
||||||
let epicenterY = 0.5;
|
let epicenterY = 0.5;
|
||||||
@@ -86,10 +87,6 @@ var BrokenGlass = class {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are currently performing integration test, the animation uses a fixed
|
|
||||||
// seed.
|
|
||||||
const testMode = settings.get_boolean('test-mode');
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
|
shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
|
||||||
shader.set_uniform_float(shader._uEpicenter, 2, [epicenterX, epicenterY]);
|
shader.set_uniform_float(shader._uEpicenter, 2, [epicenterX, epicenterY]);
|
||||||
|
|||||||
+6
-6
@@ -46,16 +46,16 @@ var Doom = class {
|
|||||||
shader._uPixelSize = shader.get_uniform_location('uPixelSize');
|
shader._uPixelSize = shader.get_uniform_location('uPixelSize');
|
||||||
|
|
||||||
// Write all uniform values at the start of each animation.
|
// Write all uniform values at the start of each animation.
|
||||||
shader.connect('begin-animation', (shader, settings, forOpening, actor) => {
|
shader.connect(
|
||||||
|
'begin-animation', (shader, settings, forOpening, testMode, actor) => {
|
||||||
// For this effect, we scale the actor vertically so that it covers the entire
|
// For this effect, we scale the actor vertically so that it covers the entire
|
||||||
// screen. This ensures that the melted window will not be cut off.
|
// screen. This ensures that the melted window will not be cut off.
|
||||||
let actorScale = 2.0 * Math.max(1.0, global.stage.height / actor.height);
|
let actorScale = 2.0 * Math.max(1.0, global.stage.height / actor.height);
|
||||||
|
|
||||||
// If we are currently performing integration test, nothing will be visible in the
|
// If we are currently performing integration test, nothing will be visible in
|
||||||
// test images as the animation has passed the center of the window already. To
|
// the test images as the animation has passed the center of the window already.
|
||||||
// fix this, we set the actor scale to a fixed low value when performing tests.
|
// To fix this, we set the actor scale to a fixed low value when performing
|
||||||
const testMode = settings.get_boolean('test-mode');
|
// tests.
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
shader.set_uniform_float(shader._uActorScale, 1, [testMode ? 1.0 : actorScale]);
|
shader.set_uniform_float(shader._uActorScale, 1, [testMode ? 1.0 : actorScale]);
|
||||||
shader.set_uniform_float(shader._uHorizontalScale, 1, [testMode ? 50.0 :settings.get_double('doom-horizontal-scale')]);
|
shader.set_uniform_float(shader._uHorizontalScale, 1, [testMode ? 50.0 :settings.get_double('doom-horizontal-scale')]);
|
||||||
|
|||||||
@@ -51,12 +51,9 @@ var Glitch = class {
|
|||||||
shader._uSpeed = shader.get_uniform_location('uSpeed');
|
shader._uSpeed = shader.get_uniform_location('uSpeed');
|
||||||
|
|
||||||
// Write all uniform values at the start of each animation.
|
// Write all uniform values at the start of each animation.
|
||||||
shader.connect('begin-animation', (shader, settings) => {
|
shader.connect('begin-animation', (shader, settings, forOpening, testMode) => {
|
||||||
const c = Clutter.Color.from_string(settings.get_string('glitch-color'))[1];
|
const c = Clutter.Color.from_string(settings.get_string('glitch-color'))[1];
|
||||||
|
|
||||||
// If we are performing an integration tests, we use a fixed seed.
|
|
||||||
const testMode = settings.get_boolean('test-mode');
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
shader.set_uniform_float(shader._uSeed, 1, [testMode ? 0 : Math.random()]);
|
shader.set_uniform_float(shader._uSeed, 1, [testMode ? 0 : Math.random()]);
|
||||||
shader.set_uniform_float(shader._uColor, 4, [c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
|
shader.set_uniform_float(shader._uColor, 4, [c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ var Hexagon = class {
|
|||||||
shader._uLineColor = shader.get_uniform_location('uLineColor');
|
shader._uLineColor = shader.get_uniform_location('uLineColor');
|
||||||
|
|
||||||
// Write all uniform values at the start of each animation.
|
// Write all uniform values at the start of each animation.
|
||||||
shader.connect('begin-animation', (shader, settings) => {
|
shader.connect('begin-animation', (shader, settings, forOpening, testMode) => {
|
||||||
// Get the two configurable colors. They are directly injected into the shader
|
// Get the two configurable colors. They are directly injected into the shader
|
||||||
// code below.
|
// code below.
|
||||||
const gc =
|
const gc =
|
||||||
@@ -61,10 +61,6 @@ var Hexagon = class {
|
|||||||
const lc =
|
const lc =
|
||||||
Clutter.Color.from_string(settings.get_string('hexagon-line-color'))[1];
|
Clutter.Color.from_string(settings.get_string('hexagon-line-color'))[1];
|
||||||
|
|
||||||
// If we are currently performing integration test, the animation uses a fixed
|
|
||||||
// seed.
|
|
||||||
const testMode = settings.get_boolean('test-mode');
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
shader.set_uniform_float(shader._uAdditiveBlending, 1, [settings.get_boolean('hexagon-additive-blending')]);
|
shader.set_uniform_float(shader._uAdditiveBlending, 1, [settings.get_boolean('hexagon-additive-blending')]);
|
||||||
shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
|
shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
|
||||||
|
|||||||
@@ -51,10 +51,10 @@ var Incinerate = class {
|
|||||||
shader._uStartPos = shader.get_uniform_location('uStartPos');
|
shader._uStartPos = shader.get_uniform_location('uStartPos');
|
||||||
|
|
||||||
// Write all uniform values at the start of each animation.
|
// Write all uniform values at the start of each animation.
|
||||||
shader.connect('begin-animation', (shader, settings, forOpening, actor) => {
|
shader.connect(
|
||||||
|
'begin-animation', (shader, settings, forOpening, testMode, actor) => {
|
||||||
// If we are currently performing integration test, the animation uses a fixed
|
// If we are currently performing integration test, the animation uses a fixed
|
||||||
// seed.
|
// seed.
|
||||||
const testMode = settings.get_boolean('test-mode');
|
|
||||||
let seed = [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()];
|
let seed = [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()];
|
||||||
|
|
||||||
// If this option is set, we use the mouse pointer position. Because the actor
|
// If this option is set, we use the mouse pointer position. Because the actor
|
||||||
|
|||||||
@@ -52,12 +52,9 @@ var Portal = class {
|
|||||||
shader._uWhirling = shader.get_uniform_location('uWhirling');
|
shader._uWhirling = shader.get_uniform_location('uWhirling');
|
||||||
|
|
||||||
// Write all uniform values at the start of each animation.
|
// Write all uniform values at the start of each animation.
|
||||||
shader.connect('begin-animation', (shader, settings) => {
|
shader.connect('begin-animation', (shader, settings, forOpening, testMode) => {
|
||||||
const c = Clutter.Color.from_string(settings.get_string('portal-color'))[1];
|
const c = Clutter.Color.from_string(settings.get_string('portal-color'))[1];
|
||||||
|
|
||||||
// If we are performing an integration tests, we use a fixed seed.
|
|
||||||
const testMode = settings.get_boolean('test-mode');
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
|
shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
|
||||||
shader.set_uniform_float(shader._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]);
|
shader.set_uniform_float(shader._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]);
|
||||||
|
|||||||
@@ -63,14 +63,10 @@ var SnapOfDisintegration = class {
|
|||||||
shader._uDustScale = shader.get_uniform_location('uDustScale');
|
shader._uDustScale = shader.get_uniform_location('uDustScale');
|
||||||
|
|
||||||
// Write all uniform values at the start of each animation.
|
// Write all uniform values at the start of each animation.
|
||||||
shader.connect('begin-animation', (shader, settings) => {
|
shader.connect('begin-animation', (shader, settings, forOpening, testMode) => {
|
||||||
// The dust particles will fade to this color over time.
|
// The dust particles will fade to this color over time.
|
||||||
const c = Clutter.Color.from_string(settings.get_string('snap-color'))[1];
|
const c = Clutter.Color.from_string(settings.get_string('snap-color'))[1];
|
||||||
|
|
||||||
// If we are currently performing integration test, the animation uses a fixed
|
|
||||||
// seed.
|
|
||||||
const testMode = settings.get_boolean('test-mode');
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
shader.set_uniform_float(shader._uDustColor, 4, [c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
|
shader.set_uniform_float(shader._uDustColor, 4, [c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
|
||||||
shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
|
shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
|
||||||
|
|||||||
@@ -61,13 +61,9 @@ var TRexAttack = class {
|
|||||||
shader._uWarpIntensity = shader.get_uniform_location('uWarpIntensity');
|
shader._uWarpIntensity = shader.get_uniform_location('uWarpIntensity');
|
||||||
|
|
||||||
// Write all uniform values at the start of each animation.
|
// Write all uniform values at the start of each animation.
|
||||||
shader.connect('begin-animation', (shader, settings) => {
|
shader.connect('begin-animation', (shader, settings, forOpening, testMode) => {
|
||||||
const c = Clutter.Color.from_string(settings.get_string('claw-scratch-color'))[1];
|
const c = Clutter.Color.from_string(settings.get_string('claw-scratch-color'))[1];
|
||||||
|
|
||||||
// If we are currently performing integration test, the animation uses a fixed
|
|
||||||
// seed.
|
|
||||||
const testMode = settings.get_boolean('test-mode');
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
shader.set_uniform_float(shader._uFlashColor, 4, [c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
|
shader.set_uniform_float(shader._uFlashColor, 4, [c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
|
||||||
shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
|
shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
|
||||||
|
|||||||
@@ -52,12 +52,9 @@ var TVGlitch = class {
|
|||||||
shader._uSpeed = shader.get_uniform_location('uSpeed');
|
shader._uSpeed = shader.get_uniform_location('uSpeed');
|
||||||
|
|
||||||
// Write all uniform values at the start of each animation.
|
// Write all uniform values at the start of each animation.
|
||||||
shader.connect('begin-animation', (shader, settings) => {
|
shader.connect('begin-animation', (shader, settings, forOpening, testMode) => {
|
||||||
const c = Clutter.Color.from_string(settings.get_string('tv-glitch-color'))[1];
|
const c = Clutter.Color.from_string(settings.get_string('tv-glitch-color'))[1];
|
||||||
|
|
||||||
// If we are performing an integration tests, we use a fixed seed.
|
|
||||||
const testMode = settings.get_boolean('test-mode');
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
shader.set_uniform_float(shader._uSeed, 1, [testMode ? 0 : Math.random()]);
|
shader.set_uniform_float(shader._uSeed, 1, [testMode ? 0 : Math.random()]);
|
||||||
shader.set_uniform_float(shader._uColor, 4, [c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
|
shader.set_uniform_float(shader._uColor, 4, [c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
|
||||||
|
|||||||
@@ -50,13 +50,9 @@ var Wisps = class {
|
|||||||
shader._uScale = shader.get_uniform_location('uScale');
|
shader._uScale = shader.get_uniform_location('uScale');
|
||||||
|
|
||||||
// Write all uniform values at the start of each animation.
|
// Write all uniform values at the start of each animation.
|
||||||
shader.connect('begin-animation', (shader, settings) => {
|
shader.connect('begin-animation', (shader, settings, forOpening, testMode) => {
|
||||||
const c = Clutter.Color.from_string(settings.get_string('wisps-color'))[1];
|
const c = Clutter.Color.from_string(settings.get_string('wisps-color'))[1];
|
||||||
|
|
||||||
// If we are currently performing integration test, the animation uses a fixed
|
|
||||||
// seed.
|
|
||||||
const testMode = settings.get_boolean('test-mode');
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
|
shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
|
||||||
shader.set_uniform_float(shader._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]);
|
shader.set_uniform_float(shader._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]);
|
||||||
|
|||||||
Reference in New Issue
Block a user