1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-02-21 20:39:00 +00:00

Improved blur effect. Pixels now appear immediately and disappear smoothly as with real burnin effect.

This commit is contained in:
Filippo Scognamiglio 2014-05-15 23:41:12 +02:00
parent df764f78c2
commit 3440ef0e45
2 changed files with 10 additions and 9 deletions

View File

@ -27,11 +27,11 @@ import org.kde.konsole 0.1
Item{ Item{
id: terminalContainer id: terminalContainer
//The blur effect has to take into account the framerate //The blur effect has to take into account the framerate
property real fpsAttenuation: shadersettings.fps / 60 property real fpsAttenuation: 60 / shadersettings.fps
property real mBlur: shadersettings.motion_blur property real mBlur: shadersettings.motion_blur
property real motionBlurCoefficient: ((_minBlurCoefficient)*mBlur + (_maxBlurCoefficient)*(1.0-mBlur)) / fpsAttenuation property real motionBlurCoefficient: (_maxBlurCoefficient * mBlur + _minBlurCoefficient * (1 - mBlur))
property real _minBlurCoefficient: 0.015 property real _minBlurCoefficient: 0.75
property real _maxBlurCoefficient: 0.10 property real _maxBlurCoefficient: 0.95
property real mBloom: shadersettings.bloom_strength property real mBloom: shadersettings.bloom_strength
@ -193,15 +193,16 @@ Item{
: "") + : "") +
"void main() {" + "void main() {" +
"float color = texture2D(source, qt_TexCoord0).r * 0.8 * 512.0;" + "float color = texture2D(source, qt_TexCoord0).r * 256.0;" +
(mBlur !== 0 ? (mBlur !== 0 ?
"float blurredSourceColor = texture2D(blurredSource, qt_TexCoord0).r * 512.0;" + "float blurredSourceColor = texture2D(blurredSource, qt_TexCoord0).r * 256.0;" +
"color = mix(blurredSourceColor, color, " + motionBlurCoefficient + ");" "blurredSourceColor = blurredSourceColor - blurredSourceColor * " + (1.0 - motionBlurCoefficient) * fpsAttenuation+ ";" +
"color = step(1.0, color) * color + step(color, 1.0) * blurredSourceColor;"
: "") + : "") +
"gl_FragColor = vec4(vec3(floor(color) / 512.0), 1.0);" + "gl_FragColor = vec4(vec3(floor(color) / 256.0), 1.0);" +
"}" "}"
} }
} }

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.0.1, 2014-05-08T21:05:06. --> <!-- Written by QtCreator 3.0.1, 2014-05-15T23:38:10. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>