Wallpaper: added a bash script to compile all shaders
+ code cleanup
This commit is contained in:
parent
477d38d928
commit
3c7d03ada9
6 changed files with 75 additions and 52 deletions
36
Bin/shaders-compile.sh
Executable file
36
Bin/shaders-compile.sh
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Directory containing the source shaders.
|
||||
SOURCE_DIR="Shaders/frag/"
|
||||
|
||||
# Directory where the compiled shaders will be saved.
|
||||
DEST_DIR="Shaders/qsb/"
|
||||
|
||||
# Check if the source directory exists.
|
||||
if [ ! -d "$SOURCE_DIR" ]; then
|
||||
echo "Source directory $SOURCE_DIR not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create the destination directory if it doesn't exist.
|
||||
mkdir -p "$DEST_DIR"
|
||||
|
||||
# Loop through all files in the source directory ending with .frag
|
||||
for shader in "$SOURCE_DIR"*.frag; do
|
||||
# Check if a file was found (to handle the case of no .frag files).
|
||||
if [ -f "$shader" ]; then
|
||||
# Get the base name of the file (e.g., wp_fade).
|
||||
shader_name=$(basename "$shader" .frag)
|
||||
|
||||
# Construct the output path for the compiled shader.
|
||||
output_path="$DEST_DIR$shader_name.frag.qsb"
|
||||
|
||||
# Construct and run the qsb command.
|
||||
qsb --qt6 -o "$output_path" "$shader"
|
||||
|
||||
# Print a message to confirm compilation.
|
||||
echo "Compiled $shader to $output_path"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Shader compilation complete."
|
||||
|
|
@ -12,14 +12,14 @@ Variants {
|
|||
|
||||
required property ShellScreen modelData
|
||||
|
||||
active: Settings.isLoaded && WallpaperService.getWallpaper(modelData.name)
|
||||
active: Settings.isLoaded
|
||||
|
||||
sourceComponent: PanelWindow {
|
||||
id: root
|
||||
|
||||
// Internal state management
|
||||
property bool firstWallpaper: true
|
||||
property string transitionType: 'fade'
|
||||
property string transitionType: "fade"
|
||||
property bool transitioning: false
|
||||
property real transitionProgress: 0
|
||||
property real edgeSmoothness: Settings.data.wallpaper.transitionEdgeSmoothness
|
||||
|
|
@ -40,7 +40,6 @@ Variants {
|
|||
property string servicedWallpaper: WallpaperService.getWallpaper(modelData.name)
|
||||
onServicedWallpaperChanged: {
|
||||
if (servicedWallpaper && servicedWallpaper !== currentWallpaper.source) {
|
||||
|
||||
// Set wallpaper immediately on startup
|
||||
if (firstWallpaper) {
|
||||
firstWallpaper = false
|
||||
|
|
@ -51,36 +50,25 @@ Variants {
|
|||
// Get the transitionType from the settings
|
||||
transitionType = Settings.data.wallpaper.transitionType
|
||||
|
||||
if (transitionType == 'random') {
|
||||
if (transitionType == "random") {
|
||||
var index = Math.floor(Math.random() * allTransitions.length)
|
||||
transitionType = allTransitions[index]
|
||||
}
|
||||
|
||||
// Ensure the transition type really exists
|
||||
if (transitionType !== "none" && !allTransitions.includes(transitionType)) {
|
||||
transitionType = 'fade'
|
||||
transitionType = "fade"
|
||||
}
|
||||
|
||||
Logger.log("Background", "New wallpaper: ", servicedWallpaper, "On:", modelData.name, "Transition:", transitionType)
|
||||
Logger.log("Background", "New wallpaper: ", servicedWallpaper, "On:", modelData.name, "Transition:",
|
||||
transitionType)
|
||||
|
||||
switch (transitionType) {
|
||||
case "none":
|
||||
setWallpaperImmediate(servicedWallpaper)
|
||||
break
|
||||
case "wipe_left":
|
||||
wipeDirection = 0
|
||||
setWallpaperWithTransition(servicedWallpaper)
|
||||
break
|
||||
case "wipe_right":
|
||||
wipeDirection = 1
|
||||
setWallpaperWithTransition(servicedWallpaper)
|
||||
break
|
||||
case "wipe_up":
|
||||
wipeDirection = 2
|
||||
setWallpaperWithTransition(servicedWallpaper)
|
||||
break
|
||||
case "wipe_down":
|
||||
wipeDirection = 3
|
||||
case "wipe":
|
||||
wipeDirection = Math.random() * 4
|
||||
setWallpaperWithTransition(servicedWallpaper)
|
||||
break
|
||||
case "disc":
|
||||
|
|
@ -89,7 +77,7 @@ Variants {
|
|||
setWallpaperWithTransition(servicedWallpaper)
|
||||
break
|
||||
case "stripes":
|
||||
stripesCount = Math.round(Math.random() * 24 + 2)
|
||||
stripesCount = Math.round(Math.random() * 24 + 6)
|
||||
stripesAngle = Math.random() * 360
|
||||
setWallpaperWithTransition(servicedWallpaper)
|
||||
break
|
||||
|
|
@ -139,7 +127,7 @@ Variants {
|
|||
ShaderEffect {
|
||||
id: fadeShader
|
||||
anchors.fill: parent
|
||||
visible: transitionType === 'fade' || transitionType === 'none'
|
||||
visible: transitionType === "fade" || transitionType === "none"
|
||||
|
||||
property variant source1: currentWallpaper
|
||||
property variant source2: nextWallpaper
|
||||
|
|
@ -151,7 +139,7 @@ Variants {
|
|||
ShaderEffect {
|
||||
id: wipeShader
|
||||
anchors.fill: parent
|
||||
visible: transitionType.startsWith('wipe_')
|
||||
visible: transitionType === "wipe"
|
||||
|
||||
property variant source1: currentWallpaper
|
||||
property variant source2: nextWallpaper
|
||||
|
|
@ -166,7 +154,7 @@ Variants {
|
|||
ShaderEffect {
|
||||
id: discShader
|
||||
anchors.fill: parent
|
||||
visible: transitionType === 'disc'
|
||||
visible: transitionType === "disc"
|
||||
|
||||
property variant source1: currentWallpaper
|
||||
property variant source2: nextWallpaper
|
||||
|
|
@ -183,7 +171,7 @@ Variants {
|
|||
ShaderEffect {
|
||||
id: stripesShader
|
||||
anchors.fill: parent
|
||||
visible: transitionType === 'stripes'
|
||||
visible: transitionType === "stripes"
|
||||
|
||||
property variant source1: currentWallpaper
|
||||
property variant source2: nextWallpaper
|
||||
|
|
@ -203,8 +191,10 @@ Variants {
|
|||
property: "transitionProgress"
|
||||
from: 0.0
|
||||
to: 1.0
|
||||
duration: Settings.data.wallpaper.transitionDuration ?? 1000
|
||||
easing.type: Easing.InOutCubic //transitionType.startsWith('wipe_') ? Easing.InOutCubic : Easing.OutQuad
|
||||
// The stripes shader feels faster visually, we make it a bit slower here.
|
||||
duration: transitionType == "stripes" ? Settings.data.wallpaper.transitionDuration
|
||||
* 1.4 : Settings.data.wallpaper.transitionDuration
|
||||
easing.type: Easing.InOutCubic
|
||||
onFinished: {
|
||||
// Swap images after transition completes
|
||||
currentWallpaper.source = nextWallpaper.source
|
||||
|
|
|
|||
|
|
@ -249,8 +249,6 @@ ColumnLayout {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Reusable component for interval preset chips
|
||||
|
|
|
|||
|
|
@ -36,24 +36,12 @@ Singleton {
|
|||
name: "Stripes"
|
||||
}
|
||||
ListElement {
|
||||
key: "wipe_left"
|
||||
name: "Wipe Left"
|
||||
}
|
||||
ListElement {
|
||||
key: "wipe_right"
|
||||
name: "Wipe Right"
|
||||
}
|
||||
ListElement {
|
||||
key: "wipe_up"
|
||||
name: "Wipe Up"
|
||||
}
|
||||
ListElement {
|
||||
key: "wipe_down"
|
||||
name: "Wipe Down"
|
||||
key: "wipe"
|
||||
name: "Wipe"
|
||||
}
|
||||
}
|
||||
|
||||
// All transition keys but filter out "random"
|
||||
// All transition keys but filter out "none" and "random" so we are left with the real transitions
|
||||
readonly property var allTransitions: Array.from({
|
||||
"length": transitionsModel.count
|
||||
}, (_, i) => transitionsModel.get(i).key).filter(
|
||||
|
|
@ -154,7 +142,6 @@ Singleton {
|
|||
}
|
||||
|
||||
//Logger.log("Wallpaper", "setWallpaper on", screenName, ": ", path)
|
||||
|
||||
var wallpaperChanged = false
|
||||
|
||||
var monitor = getMonitorConfig(screenName)
|
||||
|
|
|
|||
|
|
@ -65,16 +65,28 @@ void main() {
|
|||
// Use absolute stripe position for consistent delay across all stripes
|
||||
float normalizedStripePos = clamp(stripePos / stripes, 0.0, 1.0);
|
||||
|
||||
// Reduced delay factor and better scaling to match other shaders' timing
|
||||
float maxDelay = 0.15; // Maximum delay for the last stripe
|
||||
// Increased delay and better distribution
|
||||
float maxDelay = 0.15;
|
||||
float stripeDelay = normalizedStripePos * maxDelay;
|
||||
|
||||
// Ensure all stripes complete when progress reaches 1.0
|
||||
// without making the overall animation appear faster
|
||||
float stripeProgress = clamp((ubuf.progress - stripeDelay) / (1.0 - maxDelay), 0.0, 1.0);
|
||||
// Better progress mapping that uses the full 0.0-1.0 range
|
||||
// Map progress so that:
|
||||
// - First stripe starts at progress = 0.0
|
||||
// - Last stripe finishes at progress = 1.0
|
||||
float stripeProgress;
|
||||
if (ubuf.progress <= stripeDelay) {
|
||||
stripeProgress = 0.0;
|
||||
} else if (ubuf.progress >= (stripeDelay + (1.0 - maxDelay))) {
|
||||
stripeProgress = 1.0;
|
||||
} else {
|
||||
// Scale the progress within the active window for this stripe
|
||||
float activeStart = stripeDelay;
|
||||
float activeEnd = stripeDelay + (1.0 - maxDelay);
|
||||
stripeProgress = (ubuf.progress - activeStart) / (activeEnd - activeStart);
|
||||
}
|
||||
|
||||
// Apply smooth easing
|
||||
stripeProgress = smoothstep(0.0, 1.0, stripeProgress);
|
||||
// Use gentler easing curve
|
||||
stripeProgress = stripeProgress * stripeProgress * (3.0 - 2.0 * stripeProgress); // Smootherstep instead of smoothstep
|
||||
|
||||
// Use the perpendicular coordinate for edge comparison
|
||||
float yPos = perpCoord;
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue