Added setting to invert channel buffer data

This commit is contained in:
Digital Artifex
2025-08-08 01:57:28 -04:00
parent 18795f056d
commit 91ac5771c4
6 changed files with 65 additions and 13 deletions

View File

@@ -119,18 +119,6 @@ Item
}
}
// Setup the connection to shader pack model for updates
Connections
{
target: shaderPackModel
function onJsonChanged()
{
// Parse the JSON configuration and set the properties of the ShaderChannel
// mainItem.parsePack(shaderPackModel.json);
}
}
// Load the default shader pack configuration on component completion
Component.onCompleted:
{
@@ -175,6 +163,7 @@ Item
var result = Qt.createQmlObject(`ShaderChannel
{
z: 0
invert: ${channel.invert || true}
iTimeScale: ${channel.time_scale || 1.0}
iResolutionScale: ${channel.resolution_scale || 1.0}
visible: false

View File

@@ -69,6 +69,8 @@ Item
property var iDate
property real iTimeScale: 1 // This is used to scale the time for the shader, allowing for slow motion or fast forward effects per channel
property bool invert
property var iChannelResolution: [Qt.vector3d(channel.width * iResolutionScale, channel.height * iResolutionScale, 1), Qt.vector3d(channel.width * iResolutionScale, channel.height * iResolutionScale, 1), Qt.vector3d(channel.width * iResolutionScale, channel.height * iResolutionScale, 1)]
QtObject
@@ -78,6 +80,7 @@ Item
property vector4d iMouse: Qt.vector4d(channel.iMouse.x * channel.mouseBias, channel.iMouse.y * channel.mouseBias, channel.iMouse.z, channel.iMouse.w)
property real iTime: 0
property real lastITime: 0
property real angle: channel.invert ? 180 : 0
}
onITimeChanged:
@@ -140,6 +143,23 @@ Item
// }
// }
]
transform: Rotation
{
id: channelRotation
origin.x: channel.width / 2
origin.y: channel.height / 2
// For vertical flipping, we need to transform the x axis
axis
{
x: 1
y: 0
z: 0
}
angle: data.angle
}
}
//The image channel will be the default channel type for backwards compatability
@@ -149,6 +169,7 @@ Item
Image
{
id: image
anchors.fill: parent
source: Qt.resolvedUrl(channel.source)
fillMode: channel.fillMode

View File

@@ -62,6 +62,7 @@ Item
property alias tmp_resolution_scale: resolutionScaleSlider.value
property alias tmp_resolution_x: resolutionXEdit.value
property alias tmp_resolution_y: resolutionYEdit.value
property alias tmp_invert: channelInvertedCheckBox.checked
property bool tmp_enabled: tmp_source !== ""
property Palette palette
@@ -72,6 +73,7 @@ Item
property int resolution_x
property int resolution_y
property bool enabled
property bool invert
id: window
@@ -304,6 +306,12 @@ Item
}
}
CheckBox
{
id: channelInvertedCheckBox
text: i18n("Invert Channel Data")
}
RowLayout
{
Layout.alignment: Qt.AlignTop
@@ -567,6 +575,7 @@ Item
resolution_x = tmp_resolution_x
resolution_y = tmp_resolution_y
enabled = tmp_enabled
invert = tmp_invert
// Emit the accepted signal and reset the selection
window.accepted()
@@ -616,6 +625,7 @@ Item
tmp_resolution_scale = resolution_scale
tmp_resolution_x = resolution_x
tmp_resolution_y = resolution_y
tmp_invert = invert
tmp_type = type
updateCurrentSelection()

View File

@@ -89,6 +89,9 @@ Item
type: wallpaper.configuration.iChannel0_flag ? wallpaper.configuration.iChannel0_type : 0
source: wallpaper.configuration.iChannel0_flag ? Qt.resolvedUrl(wallpaper.configuration.iChannel0) : ""
// ShaderToy seems to start at bottom left for 0,0
invert: wallpaper.configuration.iChannel0_inverted
}
ShaderChannel
@@ -103,6 +106,9 @@ Item
type: wallpaper.configuration.iChannel1_flag ? wallpaper.configuration.iChannel1_type : 0
source: wallpaper.configuration.iChannel1_flag ? Qt.resolvedUrl(wallpaper.configuration.iChannel1) : ""
// ShaderToy seems to start at bottom left for 0,0
invert: wallpaper.configuration.iChannel1_inverted ? wallpaper.configuration.iChannel1_inverted : true
}
ShaderChannel
@@ -117,6 +123,9 @@ Item
type: wallpaper.configuration.iChannel2_flag ? wallpaper.configuration.iChannel2_type : 0
source: wallpaper.configuration.iChannel2_flag ? Qt.resolvedUrl(wallpaper.configuration.iChannel2) : ""
// ShaderToy seems to start at bottom left for 0,0
invert: wallpaper.configuration.iChannel2_inverted ? wallpaper.configuration.iChannel2_inverted : true
}
ShaderChannel
@@ -133,6 +142,9 @@ Item
type: wallpaper.configuration.iChannel3_flag ? wallpaper.configuration.iChannel3_type : 0
source: wallpaper.configuration.iChannel3_flag ? Qt.resolvedUrl(wallpaper.configuration.iChannel3) : ""
// ShaderToy seems to start at bottom left for 0,0
invert: wallpaper.configuration.iChannel3_inverted ? wallpaper.configuration.iChannel3_inverted : true
}
// The output channel that combines all the input channels and displays the final shader output

View File

@@ -71,6 +71,10 @@ Kirigami.FormLayout
property alias cfg_iChannel2_resolution_y: shaderChannelConfig2.resolution_y
property alias cfg_iChannel3_resolution_x: shaderChannelConfig3.resolution_x
property alias cfg_iChannel3_resolution_y: shaderChannelConfig3.resolution_y
property alias cfg_iChannel0_inverted: shaderChannelConfig0.invert
property alias cfg_iChannel1_inverted: shaderChannelConfig1.invert
property alias cfg_iChannel2_inverted: shaderChannelConfig2.invert
property alias cfg_iChannel3_inverted: shaderChannelConfig3.invert
property alias cfg_shaderSpeed: speedSlider.value
property alias cfg_mouseSpeedBias: mouseBiasSlider.value
property alias cfg_mouseAllowed: mouseEnableButton.checked
@@ -773,7 +777,7 @@ Kirigami.FormLayout
}
textRole: "fileBaseName"
currentIndex: root.cfg_shader_package
currentIndex: root.cfg_shader_package_index
displayText: currentIndex === -1 ? "Custom File" : currentText.replace("_", " ").charAt(0).toUpperCase() + currentText.replace("_", " ").slice(1)
onCurrentTextChanged: