1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-30 16:32:50 -05:00

wrap shaders in a loader

This commit is contained in:
bbedward
2025-09-25 23:33:57 -04:00
parent 066d1847e4
commit c7b4e2c49d

View File

@@ -77,7 +77,6 @@ LazyLoader {
monitor: modelData.name
}
Component.onDestruction: {
weProc.stop()
}
@@ -116,8 +115,10 @@ LazyLoader {
}
function changeWallpaper(newPath, force) {
if (!force && newPath === currentWallpaper.source) return
if (!newPath || newPath.startsWith("#")) return
if (!force && newPath === currentWallpaper.source)
return
if (!newPath || newPath.startsWith("#"))
return
if (root.transitioning) {
transitionAnimation.stop()
@@ -163,7 +164,6 @@ LazyLoader {
}
}
Loader {
anchors.fill: parent
active: !root.source || root.isColorSource
@@ -212,15 +212,14 @@ LazyLoader {
fillMode: Image.PreserveAspectCrop
onStatusChanged: {
if (status !== Image.Ready) return
if (status !== Image.Ready)
return
if (root.actualTransitionType === "none") {
currentWallpaper.source = source
nextWallpaper.source = ""
root.transitionProgress = 0.0
} else {
currentWallpaper.layer.enabled = true
layer.enabled = true
visible = true
if (!root.transitioning) {
transitionAnimation.start()
@@ -229,11 +228,36 @@ LazyLoader {
}
}
ShaderEffect {
id: fadeShader
Loader {
id: effectLoader
anchors.fill: parent
visible: root.actualTransitionType === "fade" && (root.hasCurrent || root.booting)
active: root.actualTransitionType !== "none" && (root.hasCurrent || root.booting)
sourceComponent: {
switch (root.actualTransitionType) {
case "fade":
return fadeComp
case "wipe":
return wipeComp
case "disc":
return discComp
case "stripes":
return stripesComp
case "iris bloom":
return irisComp
case "pixelate":
return pixelateComp
case "portal":
return portalComp
default:
return null
}
}
}
Component {
id: fadeComp
ShaderEffect {
anchors.fill: parent
property variant source1: root.hasCurrent ? currentWallpaper : transparentSource
property variant source2: nextWallpaper
property real progress: root.transitionProgress
@@ -245,15 +269,14 @@ LazyLoader {
property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: modelData.width
property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_fade.frag.qsb")
}
}
Component {
id: wipeComp
ShaderEffect {
id: wipeShader
anchors.fill: parent
visible: root.actualTransitionType === "wipe" && (root.hasCurrent || root.booting)
property variant source1: root.hasCurrent ? currentWallpaper : transparentSource
property variant source2: nextWallpaper
property real progress: root.transitionProgress
@@ -267,15 +290,14 @@ LazyLoader {
property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: modelData.width
property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_wipe.frag.qsb")
}
}
Component {
id: discComp
ShaderEffect {
id: discShader
anchors.fill: parent
visible: root.actualTransitionType === "disc" && (root.hasCurrent || root.booting)
property variant source1: root.hasCurrent ? currentWallpaper : transparentSource
property variant source2: nextWallpaper
property real progress: root.transitionProgress
@@ -291,15 +313,14 @@ LazyLoader {
property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: modelData.width
property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_disc.frag.qsb")
}
}
Component {
id: stripesComp
ShaderEffect {
id: stripesShader
anchors.fill: parent
visible: root.actualTransitionType === "stripes" && (root.hasCurrent || root.booting)
property variant source1: root.hasCurrent ? currentWallpaper : transparentSource
property variant source2: nextWallpaper
property real progress: root.transitionProgress
@@ -315,15 +336,14 @@ LazyLoader {
property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: modelData.width
property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_stripes.frag.qsb")
}
}
Component {
id: irisComp
ShaderEffect {
id: irisBloomShader
anchors.fill: parent
visible: root.actualTransitionType === "iris bloom" && (root.hasCurrent || root.booting)
property variant source1: root.hasCurrent ? currentWallpaper : transparentSource
property variant source2: nextWallpaper
property real progress: root.transitionProgress
@@ -339,19 +359,18 @@ LazyLoader {
property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: modelData.width
property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_iris_bloom.frag.qsb")
}
}
Component {
id: pixelateComp
ShaderEffect {
id: pixelateShader
anchors.fill: parent
visible: root.actualTransitionType === "pixelate" && (root.hasCurrent || root.booting)
property variant source1: root.hasCurrent ? currentWallpaper : transparentSource
property variant source2: nextWallpaper
property real progress: root.transitionProgress
property real smoothness: root.edgeSmoothness // controls starting block size
property real smoothness: root.edgeSmoothness
property real fillMode: root.fillMode
property vector4d fillColor: root.fillColor
property real imageWidth1: Math.max(1, root.hasCurrent ? source1.sourceSize.width : modelData.width)
@@ -363,15 +382,14 @@ LazyLoader {
property real centerX: root.discCenterX
property real centerY: root.discCenterY
property real aspectRatio: root.width / root.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_pixelate.frag.qsb")
}
}
Component {
id: portalComp
ShaderEffect {
id: portalShader
anchors.fill: parent
visible: root.actualTransitionType === "portal" && (root.hasCurrent || root.booting)
property variant source1: root.hasCurrent ? currentWallpaper : transparentSource
property variant source2: nextWallpaper
property real progress: root.transitionProgress
@@ -387,9 +405,9 @@ LazyLoader {
property real imageHeight2: Math.max(1, source2.sourceSize.height)
property real screenWidth: modelData.width
property real screenHeight: modelData.height
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/wp_portal.frag.qsb")
}
}
NumberAnimation {
id: transitionAnimation
@@ -407,8 +425,6 @@ LazyLoader {
nextWallpaper.source = ""
nextWallpaper.visible = false
currentWallpaper.visible = root.actualTransitionType === "none"
currentWallpaper.layer.enabled = false
nextWallpaper.layer.enabled = false
root.transitionProgress = 0.0
})
}