mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-01-31 02:01:19 +00:00
Moved bloom where it belongs, in postprocessing instead of preprocessing. Restored glowing line animation.
This commit is contained in:
parent
a729eae191
commit
8cb9520ea7
@ -19,14 +19,18 @@
|
||||
*******************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
ShaderEffect {
|
||||
property color font_color: shadersettings.font_color
|
||||
property color background_color: shadersettings.background_color
|
||||
property variant source: theSource
|
||||
property variant bloomSource: bloomSource
|
||||
property size txt_Size: Qt.size(terminal.width, terminal.height)
|
||||
property real time: 0
|
||||
|
||||
property real bloom: shadersettings.bloom_strength
|
||||
|
||||
property real noise_strength: shadersettings.noise_strength
|
||||
property real screen_distorsion: shadersettings.screen_distortion
|
||||
property real glowing_line_strength: shadersettings.glowing_line_strength
|
||||
@ -54,6 +58,23 @@ ShaderEffect {
|
||||
property real deltay: 3 / terminal.height
|
||||
property real deltax: 3 / terminal.width
|
||||
|
||||
//Blurred texture used for bloom
|
||||
Loader{
|
||||
anchors.fill: parent
|
||||
active: bloom !== 0
|
||||
FastBlur{
|
||||
radius: 32
|
||||
anchors.fill: parent
|
||||
source: theSource
|
||||
transparentBorder: true
|
||||
ShaderEffectSource{
|
||||
id: bloomSource
|
||||
sourceItem: parent
|
||||
hideSource: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer{
|
||||
id: timetimer
|
||||
onTriggered: time += interval
|
||||
@ -62,6 +83,7 @@ ShaderEffect {
|
||||
repeat: true
|
||||
}
|
||||
|
||||
//TODO fix the glow line which is after the first time
|
||||
fragmentShader: "
|
||||
uniform sampler2D source;
|
||||
uniform highp float qt_Opacity;
|
||||
@ -74,6 +96,7 @@ ShaderEffect {
|
||||
uniform highp float deltax;
|
||||
uniform highp float deltay;" +
|
||||
|
||||
(bloom !== 0 ? "uniform highp sampler2D bloomSource;" : "") +
|
||||
(noise_strength !== 0 ? "uniform highp float noise_strength;" : "") +
|
||||
(screen_distorsion !== 0 ? "uniform highp float screen_distorsion;" : "")+
|
||||
(glowing_line_strength !== 0 ? "uniform highp float glowing_line_strength;" : "")+
|
||||
@ -99,7 +122,7 @@ ShaderEffect {
|
||||
|
||||
(glowing_line_strength !== 0 ?
|
||||
"float randomPass(vec2 coords){
|
||||
return fract(smoothstep(-0.2, 0.0, coords.y - time * 0.0007)) * glowing_line_strength;
|
||||
return fract(smoothstep(-0.2, 0.0, coords.y - 3.0 * fract(time * 0.0002))) * glowing_line_strength;
|
||||
}" : "") +
|
||||
|
||||
|
||||
@ -121,6 +144,8 @@ ShaderEffect {
|
||||
|
||||
"float color = texture2D(source, coords).r;" +
|
||||
|
||||
(bloom !== 0 ? "color += texture2D(bloomSource, coords).r *" + 2.5 * bloom + ";" : "") +
|
||||
|
||||
(scanlines !== 0 ?
|
||||
"float scanline_alpha = getScanlineIntensity(coords);" : "float scanline_alpha = 0.0;") +
|
||||
|
||||
|
@ -32,7 +32,7 @@ Item{
|
||||
property real screen_distortion: 0.15
|
||||
property real glowing_line_strength: 0.4
|
||||
property real motion_blur: 0.65
|
||||
property real bloom_strength: 0.8
|
||||
property real bloom_strength: 0.6
|
||||
|
||||
property real horizontal_sincronization: 0.1
|
||||
property real screen_flickering: 0.12
|
||||
|
@ -49,23 +49,7 @@ Item{
|
||||
sourceItem: kterminal
|
||||
hideSource: true
|
||||
}
|
||||
Loader{
|
||||
anchors.fill: parent
|
||||
active: mBloom !== 0
|
||||
FastBlur{
|
||||
id: bloom
|
||||
source: kterminal
|
||||
radius: 32
|
||||
anchors.fill: parent
|
||||
transparentBorder: true
|
||||
ShaderEffectSource{
|
||||
id: bloomSource
|
||||
sourceItem: bloom
|
||||
hideSource: true
|
||||
live: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loader{
|
||||
anchors.fill: parent
|
||||
active: mBlur !== 0
|
||||
@ -74,7 +58,6 @@ Item{
|
||||
sourceItem: blurredterminal
|
||||
recursive: true
|
||||
live: true
|
||||
smooth: false
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +66,6 @@ Item{
|
||||
anchors.fill: parent
|
||||
property variant source: source
|
||||
property variant blurredSource: (mBlur !== 0) ? blurredSource : undefined
|
||||
property variant bloomSource: (mBloom !== 0) ? bloomSource : undefined
|
||||
z: 2
|
||||
|
||||
fragmentShader:
|
||||
@ -94,14 +76,9 @@ Item{
|
||||
|
||||
(mBlur !== 0 ?
|
||||
"uniform lowp sampler2D blurredSource;" : "") +
|
||||
(mBloom !== 0 ?
|
||||
"uniform lowp sampler2D bloomSource;" : "") +
|
||||
|
||||
"void main() {" +
|
||||
"float color = texture2D(source, qt_TexCoord0).r * 0.8 * 512.0;" +
|
||||
(mBloom !== 0 ?
|
||||
"color += texture2D(bloomSource, qt_TexCoord0).r * 512.0 *" + mBloom + ";" : ""
|
||||
) +
|
||||
(mBlur !== 0 ?
|
||||
"float blurredSourceColor = texture2D(blurredSource, qt_TexCoord0).r * 512.0;" +
|
||||
"color = mix(blurredSourceColor, color, " + motionBlurCoefficient + ");" : ""
|
||||
|
Loading…
x
Reference in New Issue
Block a user