mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-02-21 04:19:00 +00:00
Refactor: extract all the other effects from main terminal.
This commit is contained in:
parent
9f943aa2d0
commit
68a8d7d212
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user