2014-10-11 01:24:20 +02:00
|
|
|
import QtQuick 2.2
|
2014-12-11 10:40:14 +01:00
|
|
|
import QtGraphicalEffects 1.0
|
2014-10-11 01:24:20 +02:00
|
|
|
|
2015-01-05 21:47:42 +01:00
|
|
|
import "utils.js" as Utils
|
|
|
|
|
2014-12-11 01:48:30 +01:00
|
|
|
ShaderTerminal{
|
2014-10-27 09:28:27 +02:00
|
|
|
property alias title: terminal.title
|
2014-12-14 12:02:40 +01:00
|
|
|
property alias terminalSize: terminal.terminalSize
|
2014-10-27 09:28:27 +02:00
|
|
|
|
2014-12-11 10:07:53 +01:00
|
|
|
id: mainShader
|
2014-12-11 12:08:15 +01:00
|
|
|
opacity: appSettings.windowOpacity * 0.3 + 0.7
|
2014-10-11 01:24:20 +02:00
|
|
|
|
2014-12-11 10:40:14 +01:00
|
|
|
blending: false
|
|
|
|
|
2014-12-14 10:31:38 +01:00
|
|
|
source: terminal.mainSource
|
2014-12-15 02:35:13 +01:00
|
|
|
blurredSource: terminal.blurredSource
|
2014-12-23 18:13:34 +01:00
|
|
|
dispX: (12 / width) * appSettings.windowScaling
|
|
|
|
dispY: (12 / height) * appSettings.windowScaling
|
2014-12-14 10:31:38 +01:00
|
|
|
virtual_resolution: terminal.virtualResolution
|
|
|
|
|
2014-10-11 01:24:20 +02:00
|
|
|
Loader{
|
2014-12-11 01:48:30 +01:00
|
|
|
id: frame
|
|
|
|
anchors.fill: parent
|
2014-12-20 14:58:57 +01:00
|
|
|
|
|
|
|
property real displacementLeft: item ? item.displacementLeft : 0
|
|
|
|
property real displacementTop: item ? item.displacementTop : 0
|
|
|
|
property real displacementRight: item ? item.displacementRight : 0
|
|
|
|
property real displacementBottom: item ? item.displacementBottom : 0
|
|
|
|
|
|
|
|
asynchronous: true
|
|
|
|
visible: status === Loader.Ready
|
|
|
|
|
2014-12-11 01:48:30 +01:00
|
|
|
z: 2.1
|
2014-12-23 18:13:34 +01:00
|
|
|
source: appSettings.frameSource
|
2014-12-11 01:48:30 +01:00
|
|
|
}
|
2014-12-11 10:07:53 +01:00
|
|
|
|
2014-12-11 01:48:30 +01:00
|
|
|
PreprocessedTerminal{
|
|
|
|
id: terminal
|
|
|
|
anchors.fill: parent
|
2014-10-11 01:24:20 +02:00
|
|
|
}
|
2014-12-11 10:07:53 +01:00
|
|
|
|
2014-12-11 10:40:14 +01:00
|
|
|
// EFFECTS ////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
Loader{
|
|
|
|
id: bloomEffectLoader
|
2014-12-23 18:13:34 +01:00
|
|
|
active: appSettings.bloom
|
2014-12-11 10:40:14 +01:00
|
|
|
asynchronous: true
|
2014-12-23 18:13:34 +01:00
|
|
|
width: parent.width * appSettings.bloomQuality
|
|
|
|
height: parent.height * appSettings.bloomQuality
|
2015-01-05 21:47:42 +01:00
|
|
|
|
2014-12-11 10:40:14 +01:00
|
|
|
sourceComponent: FastBlur{
|
2015-01-05 21:47:42 +01:00
|
|
|
radius: Utils.lint(16, 48, appSettings.bloomQuality * appSettings.windowScaling);
|
|
|
|
source: terminal.mainSource
|
2014-12-11 10:40:14 +01:00
|
|
|
transparentBorder: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Loader{
|
|
|
|
id: bloomSourceLoader
|
2014-12-23 18:13:34 +01:00
|
|
|
active: appSettings.bloom !== 0
|
2014-12-11 10:40:14 +01:00
|
|
|
asynchronous: true
|
|
|
|
sourceComponent: ShaderEffectSource{
|
|
|
|
id: _bloomEffectSource
|
|
|
|
sourceItem: bloomEffectLoader.item
|
|
|
|
hideSource: true
|
|
|
|
smooth: true
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bloomSource: bloomSourceLoader.item
|
2014-12-11 10:07:53 +01:00
|
|
|
|
2014-12-14 10:31:38 +01:00
|
|
|
// This shader might be useful in the future. Since we used it only for a couple
|
2014-12-31 16:40:30 +01:00
|
|
|
// of calculations is probably best to move those in the main shader. If in the future
|
|
|
|
// we need to store another fullScreen channel this might be handy.
|
2014-12-14 10:31:38 +01:00
|
|
|
|
|
|
|
// ShaderEffect {
|
|
|
|
// id: rasterizationEffect
|
|
|
|
// width: parent.width
|
|
|
|
// height: parent.height
|
|
|
|
// property real outColor: 0.0
|
2014-12-23 18:13:34 +01:00
|
|
|
// property real dispX: (5 / width) * appSettings.windowScaling
|
|
|
|
// property real dispY: (5 / height) * appSettings.windowScaling
|
2014-12-14 10:31:38 +01:00
|
|
|
// property size virtual_resolution: terminal.virtualResolution
|
|
|
|
|
|
|
|
// blending: false
|
|
|
|
|
|
|
|
// fragmentShader:
|
|
|
|
// "uniform lowp float qt_Opacity;" +
|
|
|
|
|
|
|
|
// "varying highp vec2 qt_TexCoord0;
|
|
|
|
// uniform highp vec2 virtual_resolution;
|
|
|
|
// uniform highp float dispX;
|
|
|
|
// uniform highp float dispY;
|
|
|
|
// uniform mediump float outColor;
|
|
|
|
|
|
|
|
// highp float getScanlineIntensity(vec2 coords) {
|
|
|
|
// highp float result = 1.0;" +
|
|
|
|
|
|
|
|
// (appSettings.rasterization != appSettings.no_rasterization ?
|
|
|
|
// "result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") +
|
|
|
|
// (appSettings.rasterization == appSettings.pixel_rasterization ?
|
|
|
|
// "result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + "
|
|
|
|
|
|
|
|
// return result;
|
|
|
|
// }" +
|
|
|
|
|
|
|
|
// "void main() {" +
|
|
|
|
// "highp float color = getScanlineIntensity(qt_TexCoord0);" +
|
|
|
|
|
|
|
|
// "float distance = length(vec2(0.5) - qt_TexCoord0);" +
|
|
|
|
// "color = mix(color, 0.0, 1.2 * distance * distance);" +
|
|
|
|
|
|
|
|
// "color *= outColor + smoothstep(0.00, dispX, qt_TexCoord0.x) * (1.0 - outColor);" +
|
|
|
|
// "color *= outColor + smoothstep(0.00, dispY, qt_TexCoord0.y) * (1.0 - outColor);" +
|
|
|
|
// "color *= outColor + (1.0 - smoothstep(1.00 - dispX, 1.00, qt_TexCoord0.x)) * (1.0 - outColor);" +
|
|
|
|
// "color *= outColor + (1.0 - smoothstep(1.00 - dispY, 1.00, qt_TexCoord0.y)) * (1.0 - outColor);" +
|
|
|
|
|
|
|
|
// "gl_FragColor.a = color;" +
|
|
|
|
// "}"
|
|
|
|
|
|
|
|
// onStatusChanged: if (log) console.log(log) //Print warning messages
|
|
|
|
// }
|
|
|
|
|
|
|
|
// rasterizationSource: ShaderEffectSource{
|
|
|
|
// id: rasterizationEffectSource
|
|
|
|
// sourceItem: rasterizationEffect
|
|
|
|
// hideSource: true
|
|
|
|
// smooth: true
|
|
|
|
// wrapMode: ShaderEffectSource.ClampToEdge
|
|
|
|
// visible: false
|
|
|
|
// }
|
2014-10-11 01:24:20 +02:00
|
|
|
}
|