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

@@ -61,6 +61,10 @@
<label>iChannel0 on/off flag</label> <label>iChannel0 on/off flag</label>
<default>true</default> <default>true</default>
</entry> </entry>
<entry name="iChannel0_inverted" type="Bool">
<label>Invert iChannel0's data for the shader</label>
<default>true</default>
</entry>
<entry name="iChannel0_timeScale" type="Double"> <entry name="iChannel0_timeScale" type="Double">
<label>iChannel0 time scale</label> <label>iChannel0 time scale</label>
<default>1.0</default> <default>1.0</default>
@@ -89,6 +93,10 @@
<label>iChannel1 on/off flag</label> <label>iChannel1 on/off flag</label>
<default>true</default> <default>true</default>
</entry> </entry>
<entry name="iChannel1_inverted" type="Bool">
<label>Invert iChannel1's data for the shader</label>
<default>true</default>
</entry>
<entry name="iChannel1_timeScale" type="Double"> <entry name="iChannel1_timeScale" type="Double">
<label>iChannel1 time scale</label> <label>iChannel1 time scale</label>
<default>1.0</default> <default>1.0</default>
@@ -117,6 +125,10 @@
<label>iChannel2 on/off flag</label> <label>iChannel2 on/off flag</label>
<default>true</default> <default>true</default>
</entry> </entry>
<entry name="iChannel2_inverted" type="Bool">
<label>Invert iChannel2's data for the shader</label>
<default>true</default>
</entry>
<entry name="iChannel2_timeScale" type="Double"> <entry name="iChannel2_timeScale" type="Double">
<label>iChannel2 time scale</label> <label>iChannel2 time scale</label>
<default>1.0</default> <default>1.0</default>
@@ -145,6 +157,10 @@
<label>iChannel3 on/off flag</label> <label>iChannel3 on/off flag</label>
<default>false</default> <default>false</default>
</entry> </entry>
<entry name="iChannel3_inverted" type="Bool">
<label>Invert iChannel3's data for the shader</label>
<default>true</default>
</entry>
<entry name="iChannel3_timeScale" type="Double"> <entry name="iChannel3_timeScale" type="Double">
<label>iChannel3 time scale</label> <label>iChannel3 time scale</label>
<default>1.0</default> <default>1.0</default>

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 // Load the default shader pack configuration on component completion
Component.onCompleted: Component.onCompleted:
{ {
@@ -175,6 +163,7 @@ Item
var result = Qt.createQmlObject(`ShaderChannel var result = Qt.createQmlObject(`ShaderChannel
{ {
z: 0 z: 0
invert: ${channel.invert || true}
iTimeScale: ${channel.time_scale || 1.0} iTimeScale: ${channel.time_scale || 1.0}
iResolutionScale: ${channel.resolution_scale || 1.0} iResolutionScale: ${channel.resolution_scale || 1.0}
visible: false visible: false

View File

@@ -69,6 +69,8 @@ Item
property var iDate 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 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)] 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 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 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 iTime: 0
property real lastITime: 0 property real lastITime: 0
property real angle: channel.invert ? 180 : 0
} }
onITimeChanged: 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 //The image channel will be the default channel type for backwards compatability
@@ -149,6 +169,7 @@ Item
Image Image
{ {
id: image
anchors.fill: parent anchors.fill: parent
source: Qt.resolvedUrl(channel.source) source: Qt.resolvedUrl(channel.source)
fillMode: channel.fillMode fillMode: channel.fillMode

View File

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

View File

@@ -89,6 +89,9 @@ Item
type: wallpaper.configuration.iChannel0_flag ? wallpaper.configuration.iChannel0_type : 0 type: wallpaper.configuration.iChannel0_flag ? wallpaper.configuration.iChannel0_type : 0
source: wallpaper.configuration.iChannel0_flag ? Qt.resolvedUrl(wallpaper.configuration.iChannel0) : "" 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 ShaderChannel
@@ -103,6 +106,9 @@ Item
type: wallpaper.configuration.iChannel1_flag ? wallpaper.configuration.iChannel1_type : 0 type: wallpaper.configuration.iChannel1_flag ? wallpaper.configuration.iChannel1_type : 0
source: wallpaper.configuration.iChannel1_flag ? Qt.resolvedUrl(wallpaper.configuration.iChannel1) : "" 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 ShaderChannel
@@ -117,6 +123,9 @@ Item
type: wallpaper.configuration.iChannel2_flag ? wallpaper.configuration.iChannel2_type : 0 type: wallpaper.configuration.iChannel2_flag ? wallpaper.configuration.iChannel2_type : 0
source: wallpaper.configuration.iChannel2_flag ? Qt.resolvedUrl(wallpaper.configuration.iChannel2) : "" 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 ShaderChannel
@@ -133,6 +142,9 @@ Item
type: wallpaper.configuration.iChannel3_flag ? wallpaper.configuration.iChannel3_type : 0 type: wallpaper.configuration.iChannel3_flag ? wallpaper.configuration.iChannel3_type : 0
source: wallpaper.configuration.iChannel3_flag ? Qt.resolvedUrl(wallpaper.configuration.iChannel3) : "" 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 // 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_iChannel2_resolution_y: shaderChannelConfig2.resolution_y
property alias cfg_iChannel3_resolution_x: shaderChannelConfig3.resolution_x property alias cfg_iChannel3_resolution_x: shaderChannelConfig3.resolution_x
property alias cfg_iChannel3_resolution_y: shaderChannelConfig3.resolution_y 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_shaderSpeed: speedSlider.value
property alias cfg_mouseSpeedBias: mouseBiasSlider.value property alias cfg_mouseSpeedBias: mouseBiasSlider.value
property alias cfg_mouseAllowed: mouseEnableButton.checked property alias cfg_mouseAllowed: mouseEnableButton.checked
@@ -773,7 +777,7 @@ Kirigami.FormLayout
} }
textRole: "fileBaseName" 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) displayText: currentIndex === -1 ? "Custom File" : currentText.replace("_", " ").charAt(0).toUpperCase() + currentText.replace("_", " ").slice(1)
onCurrentTextChanged: onCurrentTextChanged: