Merge branch 'main' into feature/esm-modules
This commit is contained in:
+10
-5
@@ -75,11 +75,12 @@ export var Shader = GObject.registerClass(
|
||||
this._time = 0;
|
||||
|
||||
// Store standard uniform locations.
|
||||
this._uForOpening = this.get_uniform_location('uForOpening');
|
||||
this._uProgress = this.get_uniform_location('uProgress');
|
||||
this._uDuration = this.get_uniform_location('uDuration');
|
||||
this._uSize = this.get_uniform_location('uSize');
|
||||
this._uPadding = this.get_uniform_location('uPadding');
|
||||
this._uForOpening = this.get_uniform_location('uForOpening');
|
||||
this._uIsFullscreen = this.get_uniform_location('uIsFullscreen');
|
||||
this._uProgress = this.get_uniform_location('uProgress');
|
||||
this._uDuration = this.get_uniform_location('uDuration');
|
||||
this._uSize = this.get_uniform_location('uSize');
|
||||
this._uPadding = this.get_uniform_location('uPadding');
|
||||
|
||||
// Create a timeline to drive the animation.
|
||||
this._timeline = new Clutter.Timeline();
|
||||
@@ -124,9 +125,13 @@ export var Shader = GObject.registerClass(
|
||||
// This is not necessarily symmetric, but I haven't figured out a way to
|
||||
// get the actual values...
|
||||
const padding = (actor.width - actor.meta_window.get_frame_rect().width) / 2;
|
||||
const isFullscreen =
|
||||
actor.meta_window.get_maximized() === Meta.MaximizeFlags.BOTH ||
|
||||
actor.meta_window.fullscreen;
|
||||
|
||||
this.set_uniform_float(this._uPadding, 1, [padding]);
|
||||
this.set_uniform_float(this._uForOpening, 1, [forOpening]);
|
||||
this.set_uniform_float(this._uIsFullscreen, 1, [isFullscreen]);
|
||||
this.set_uniform_float(this._uDuration, 1, [duration * 0.001]);
|
||||
this.set_uniform_float(this._uSize, 2, [actor.width, actor.height]);
|
||||
|
||||
|
||||
+25
-4
@@ -41,16 +41,23 @@ export default class Effect {
|
||||
|
||||
// Store uniform locations of newly created shaders.
|
||||
shader._uSeed = shader.get_uniform_location('uSeed');
|
||||
shader._uColor = shader.get_uniform_location('uColor');
|
||||
shader._uScale = shader.get_uniform_location('uScale');
|
||||
shader._uColor = [
|
||||
shader.get_uniform_location('uColor1'),
|
||||
shader.get_uniform_location('uColor2'),
|
||||
shader.get_uniform_location('uColor3'),
|
||||
];
|
||||
|
||||
// Write all uniform values at the start of each animation.
|
||||
shader.connect('begin-animation', (shader, settings, forOpening, testMode) => {
|
||||
const c = Clutter.Color.from_string(settings.get_string('wisps-color'))[1];
|
||||
for (let i = 1; i <= 3; i++) {
|
||||
const c = Clutter.Color.from_string(settings.get_string('wisps-color-' + i))[1];
|
||||
shader.set_uniform_float(shader._uColor[i - 1], 3,
|
||||
[c.red / 255, c.green / 255, c.blue / 255]);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
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._uScale, 1, [settings.get_double('wisps-scale')]);
|
||||
// clang-format on
|
||||
});
|
||||
@@ -84,7 +91,21 @@ export default class Effect {
|
||||
bindPreferences(dialog) {
|
||||
dialog.bindAdjustment('wisps-animation-time');
|
||||
dialog.bindAdjustment('wisps-scale');
|
||||
dialog.bindColorButton('wisps-color');
|
||||
dialog.bindColorButton('wisps-color-1');
|
||||
dialog.bindColorButton('wisps-color-2');
|
||||
dialog.bindColorButton('wisps-color-3');
|
||||
|
||||
// Connect the buttons only once. The bindPreferences can be called multiple times...
|
||||
if (!this._isConnected) {
|
||||
this._isConnected = true;
|
||||
|
||||
// The wisps-color-reset button needs to be bound explicitly.
|
||||
dialog.getBuilder().get_object('reset-wisps-colors').connect('clicked', () => {
|
||||
dialog.getProfileSettings().reset('wisps-color-1');
|
||||
dialog.getProfileSettings().reset('wisps-color-2');
|
||||
dialog.getProfileSettings().reset('wisps-color-3');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- API for extension.js
|
||||
|
||||
Reference in New Issue
Block a user