diff --git a/app/qml/PreprocessedTerminal.qml b/app/qml/PreprocessedTerminal.qml index 6fc2230..9aaa2da 100644 --- a/app/qml/PreprocessedTerminal.qml +++ b/app/qml/PreprocessedTerminal.qml @@ -19,7 +19,6 @@ *******************************************************************************/ import QtQuick 2.2 -import QtGraphicalEffects 1.0 import QtQuick.Controls 1.1 import QMLTermWidget 1.0 @@ -27,7 +26,9 @@ import QMLTermWidget 1.0 Item{ id: terminalContainer - property size virtualResolution: Qt.size(kterminal.width, kterminal.height); + property size virtualResolution: Qt.size(kterminal.width, kterminal.height) + property alias mainTerminal: kterminal + property ShaderEffectSource mainSource: mBlur !== 0 ? blurredSourceLoader.item : kterminalSource //Frame displacement properties. This makes the terminal the same size of the texture. property real dtop: frame.item.displacementTop * shadersettings.window_scaling @@ -42,10 +43,6 @@ Item{ anchors.topMargin: dtop anchors.bottomMargin: dbottom - property variant theSource: mBlur !== 0 ? blurredSourceLoader.item : kterminalSource - property variant bloomSource: bloomSourceLoader.item - property variant staticNoiseSource: staticNoiseSource - property alias kterminal: kterminal signal sizeChanged @@ -58,15 +55,9 @@ Item{ property real _minBlurCoefficient: 0.70 property real _maxBlurCoefficient: 0.90 - property real mBloom: shadersettings.bloom_strength - property int mScanlines: shadersettings.rasterization - onMScanlinesChanged: restartBlurredSource() - property size terminalSize: kterminal.terminalSize property size paintedTextSize - onMBlurChanged: restartBlurredSource() - // Manage copy and paste Connections{ target: copyAction @@ -77,11 +68,6 @@ Item{ onTriggered: kterminal.pasteClipboard() } - function restartBlurredSource(){ - if(!blurredSourceLoader.item) return; - blurredSourceLoader.item.restartBlurSource(); - } - //When settings are updated sources need to be redrawn. Connections{ target: shadersettings @@ -148,7 +134,6 @@ Item{ kterminal.lineSpacing = lineSpacing; //update(); - restartBlurredSource(); } Component.onCompleted: { shadersettings.terminalFontChanged.connect(handleFontChange); @@ -259,9 +244,13 @@ Item{ livetimer.restart(); } } + // Restart blurred source settings change. Connections{ target: shadersettings - onScanline_qualityChanged: restartBlurredSource(); + onScanline_qualityChanged: _blurredSourceEffect.restartBlurSource(); + onMotion_blurChanged: _blurredSourceEffect.restartBlurSource(); + onTerminalFontChanged: _blurredSourceEffect.restartBlurSource(); + onRasterizationChanged: _blurredSourceEffect.restartBlurSource(); } } } @@ -308,35 +297,4 @@ Item{ onStatusChanged: if (log) console.log(log) //Print warning messages } } - /////////////////////////////////////////////////////////////////////////// - // EFFECTS ////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////// - - // BLOOM //////////////////////////////////////////////////////////////// - - Loader{ - property real scaling: shadersettings.bloom_quality * shadersettings.window_scaling - id: bloomEffectLoader - active: mBloom != 0 - asynchronous: true - width: parent.width * scaling - height: parent.height * scaling - sourceComponent: FastBlur{ - radius: 48 * scaling - source: kterminal - transparentBorder: true - } - } - Loader{ - id: bloomSourceLoader - active: mBloom != 0 - asynchronous: true - sourceComponent: ShaderEffectSource{ - id: _bloomEffectSource - sourceItem: bloomEffectLoader.item - hideSource: true - smooth: true - visible: false - } - } } diff --git a/app/qml/ShaderTerminal.qml b/app/qml/ShaderTerminal.qml index 4360bac..39f2881 100644 --- a/app/qml/ShaderTerminal.qml +++ b/app/qml/ShaderTerminal.qml @@ -23,12 +23,13 @@ import QtGraphicalEffects 1.0 ShaderEffect { + property ShaderEffectSource source property ShaderEffectSource rasterizationSource property ShaderEffectSource noiseSource + property ShaderEffectSource bloomSource + property color font_color: shadersettings.font_color property color background_color: shadersettings.background_color - property variant source: terminal.theSource - property variant bloomSource: terminal.bloomSource property real bloom_strength: shadersettings.bloom_strength * 2.5 property real jitter: shadersettings.jitter * 0.007 diff --git a/app/qml/TerminalContainer.qml b/app/qml/TerminalContainer.qml index 1a67620..a3b9201 100644 --- a/app/qml/TerminalContainer.qml +++ b/app/qml/TerminalContainer.qml @@ -1,4 +1,5 @@ import QtQuick 2.2 +import QtGraphicalEffects 1.0 ShaderTerminal{ property alias title: terminal.title @@ -7,6 +8,8 @@ ShaderTerminal{ id: mainShader opacity: shadersettings.windowOpacity * 0.3 + 0.7 + blending: false + Loader{ id: frame anchors.fill: parent @@ -19,7 +22,37 @@ ShaderTerminal{ anchors.fill: parent } - // NOISE //////////////////////////////////////////////////////////////// + source: terminal.mainSource + + // EFFECTS //////////////////////////////////////////////////////////////// + + Loader{ + property real scaling: shadersettings.bloom_quality * shadersettings.window_scaling + id: bloomEffectLoader + active: shadersettings.bloom_strength + asynchronous: true + width: parent.width * scaling + height: parent.height * scaling + sourceComponent: FastBlur{ + radius: 48 * scaling + source: terminal.mainTerminal + transparentBorder: true + } + } + Loader{ + id: bloomSourceLoader + active: shadersettings.bloom_strength !== 0 + asynchronous: true + sourceComponent: ShaderEffectSource{ + id: _bloomEffectSource + sourceItem: bloomEffectLoader.item + hideSource: true + smooth: true + visible: false + } + } + + bloomSource: bloomSourceLoader.item ShaderEffect { id: staticNoiseEffect