🔧 Support different profiles for kwin
This commit is contained in:
@@ -48,6 +48,16 @@ generate() {
|
|||||||
echo ""
|
echo ""
|
||||||
cat "../resources/shaders/common.glsl"
|
cat "../resources/shaders/common.glsl"
|
||||||
cat "../resources/shaders/$1.frag"
|
cat "../resources/shaders/$1.frag"
|
||||||
|
} > "${BUILD_DIR}/kwin4_effect_$1/contents/shaders/$1_core.frag"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "#version 100"
|
||||||
|
echo "#define KWIN_LEGACY"
|
||||||
|
echo ""
|
||||||
|
echo "// This file is automatically generated during the build process."
|
||||||
|
echo ""
|
||||||
|
cat "../resources/shaders/common.glsl"
|
||||||
|
cat "../resources/shaders/$1.frag"
|
||||||
} > "${BUILD_DIR}/kwin4_effect_$1/contents/shaders/$1.frag"
|
} > "${BUILD_DIR}/kwin4_effect_$1/contents/shaders/$1.frag"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-6
@@ -1,8 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
KWin - the KDE window manager
|
This file is part of the Burn-My-Windows project.
|
||||||
This file is part of the KDE project.
|
|
||||||
|
|
||||||
SPDX-FileCopyrightText: 2018, 2021, 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org>, Martin Flöser <mgraesslin@kde.org>, Simon Schneegans
|
SPDX-FileCopyrightText: 2018, 2021, 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org>, Martin Flöser <mgraesslin@kde.org>, Simon Schneegans <code@simonschneegans.de>
|
||||||
|
|
||||||
SPDX-License-Identifier: GPL-3.0-or-later
|
SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
@@ -26,7 +25,7 @@ class Effect {
|
|||||||
effects.windowClosed.connect(this.slotWindowClosed.bind(this));
|
effects.windowClosed.connect(this.slotWindowClosed.bind(this));
|
||||||
effects.windowDataChanged.connect(this.slotWindowDataChanged.bind(this));
|
effects.windowDataChanged.connect(this.slotWindowDataChanged.bind(this));
|
||||||
|
|
||||||
this.shader = effect.addShader(Effect.MapTexture, "%NICK%.frag");
|
this.shader = effect.addFragmentShader(Effect.MapTexture, "%NICK%.frag");
|
||||||
|
|
||||||
this.loadConfig();
|
this.loadConfig();
|
||||||
}
|
}
|
||||||
@@ -109,7 +108,7 @@ class Effect {
|
|||||||
animations: [
|
animations: [
|
||||||
{
|
{
|
||||||
type: Effect.ShaderUniform,
|
type: Effect.ShaderUniform,
|
||||||
shader: this.shader,
|
fragmentShader: this.shader,
|
||||||
uniform: "uForOpening",
|
uniform: "uForOpening",
|
||||||
from: 1.0,
|
from: 1.0,
|
||||||
to: 1.0
|
to: 1.0
|
||||||
@@ -143,7 +142,7 @@ class Effect {
|
|||||||
animations: [
|
animations: [
|
||||||
{
|
{
|
||||||
type: Effect.ShaderUniform,
|
type: Effect.ShaderUniform,
|
||||||
shader: this.shader,
|
fragmentShader: this.shader,
|
||||||
uniform: "uForOpening",
|
uniform: "uForOpening",
|
||||||
from: 0.0,
|
from: 0.0,
|
||||||
to: 0.0
|
to: 0.0
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Comment=%DESCRIPTION%
|
|||||||
Type=Service
|
Type=Service
|
||||||
X-KDE-ServiceTypes=KWin/Effect,KCModule
|
X-KDE-ServiceTypes=KWin/Effect,KCModule
|
||||||
X-KDE-PluginInfo-Author=Vlad Zahorodnii, Martin Flöser, Simon Schneegans
|
X-KDE-PluginInfo-Author=Vlad Zahorodnii, Martin Flöser, Simon Schneegans
|
||||||
X-KDE-PluginInfo-Email=vlad.zahorodnii@kde.org, mgraesslin@kde.org
|
X-KDE-PluginInfo-Email=vlad.zahorodnii@kde.org, mgraesslin@kde.org, code@simonschneegans.de
|
||||||
X-KDE-PluginInfo-Name=kwin4_effect_%NICK%
|
X-KDE-PluginInfo-Name=kwin4_effect_%NICK%
|
||||||
X-KDE-PluginInfo-Version=1
|
X-KDE-PluginInfo-Version=1
|
||||||
X-KDE-PluginInfo-Category=Window Open/Close Animation
|
X-KDE-PluginInfo-Category=Window Open/Close Animation
|
||||||
|
|||||||
@@ -17,31 +17,60 @@
|
|||||||
|
|
||||||
// --------------------------------------------------------------------- standard uniforms
|
// --------------------------------------------------------------------- standard uniforms
|
||||||
|
|
||||||
// uForOpening: True if a window-open animation is ongoing, false otherwise.
|
// Each shader can access these standard uniforms:
|
||||||
// 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.
|
|
||||||
// uPadding: The empty area around the actual window (e.g. where the shadow is drawn).
|
|
||||||
|
|
||||||
#ifdef KWIN
|
// bool uForOpening: True if a window-open animation is ongoing, false otherwise.
|
||||||
|
// sampler2D uTexture: Contains the texture of the window.
|
||||||
|
// float uProgress: A value which transitions from 0 to 1 during the animation.
|
||||||
|
// float uTime: A steadily increasing value in seconds.
|
||||||
|
// vec2 uSize: The size of uTexture in pixels.
|
||||||
|
// float uPadding: The empty area around the actual window (e.g. where the shadow
|
||||||
|
// is drawn). For now, this will only be set on GNOME.
|
||||||
|
|
||||||
uniform bool uForOpening;
|
// Furthermore, there is the global input "vec2 iTexCoord" and the output "vec4 oColor".
|
||||||
uniform sampler2D uTexture;
|
|
||||||
|
#ifdef KWIN // --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
uniform float forOpening;
|
||||||
|
uniform sampler2D sampler;
|
||||||
|
uniform float textureWidth;
|
||||||
|
uniform float textureHeight;
|
||||||
uniform float animationProgress;
|
uniform float animationProgress;
|
||||||
// uniform float uTime;
|
|
||||||
// uniform vec2 uSize;
|
vec2 uSize = vec2(textureWidth, textureHeight);
|
||||||
// uniform float uPadding;
|
bool uForOpening = forOpening == 1.0;
|
||||||
|
|
||||||
in vec2 texcoord0;
|
in vec2 texcoord0;
|
||||||
out vec4 fragColor;
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
#define uTexture sampler;
|
||||||
#define uProgress animationProgress
|
#define uProgress animationProgress
|
||||||
|
#define uPadding 0.0
|
||||||
#define iTexCoord texcoord0
|
#define iTexCoord texcoord0
|
||||||
#define oColor fragColor
|
#define oColor fragColor
|
||||||
|
|
||||||
#else
|
#elif KWIN_LEGACY // --------------------------------------------------------------------
|
||||||
|
|
||||||
|
uniform float forOpening;
|
||||||
|
uniform sampler2D sampler;
|
||||||
|
uniform float textureWidth;
|
||||||
|
uniform float textureHeight;
|
||||||
|
uniform float animationProgress;
|
||||||
|
|
||||||
|
vec2 uSize = vec2(textureWidth, textureHeight);
|
||||||
|
bool uForOpening = forOpening == 1.0;
|
||||||
|
|
||||||
|
varying vec2 texcoord0;
|
||||||
|
|
||||||
|
#define uTexture sampler;
|
||||||
|
#define uProgress animationProgress
|
||||||
|
#define uPadding 0.0
|
||||||
|
#define iTexCoord texcoord0
|
||||||
|
#define oColor gl_fragColor
|
||||||
|
|
||||||
|
#else // GNOME --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// On GNOME, the uniforms are just normal uniforms.
|
||||||
uniform bool uForOpening;
|
uniform bool uForOpening;
|
||||||
uniform sampler2D uTexture;
|
uniform sampler2D uTexture;
|
||||||
uniform float uProgress;
|
uniform float uProgress;
|
||||||
@@ -49,10 +78,11 @@ uniform float uTime;
|
|||||||
uniform vec2 uSize;
|
uniform vec2 uSize;
|
||||||
uniform float uPadding;
|
uniform float uPadding;
|
||||||
|
|
||||||
|
// On GNOME, we set iTexCoord and oColor to be aliases for the cogl variables.
|
||||||
#define iTexCoord cogl_tex_coord_in[0]
|
#define iTexCoord cogl_tex_coord_in[0]
|
||||||
#define oColor cogl_color_out
|
#define oColor cogl_color_out
|
||||||
|
|
||||||
#endif
|
#endif // -------------------------------------------------------------------------------
|
||||||
|
|
||||||
// ----------------------------------------------------------------- compositing operators
|
// ----------------------------------------------------------------- compositing operators
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user