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

Rewrite motion blur with colors. It now simpler.

This commit is contained in:
Filippo Scognamiglio 2014-08-03 16:39:28 +02:00
parent 1902e34d04
commit f4771d4f37

View File

@ -220,7 +220,6 @@ Item{
id: finalSource
sourceItem: blurredterminal
sourceRect: frame.sourceRect
//format: ShaderEffectSource.Alpha
hideSource: true
}
ShaderEffect {
@ -258,19 +257,18 @@ Item{
coords.x = floor(virtual_resolution.x * coords.x) / virtual_resolution.x;" : "")
: "") +
"coords = coords + delta;" +
"vec4 vcolor = texture2D(source, coords) * 256.0;
float color = rgb2grey(vcolor);" +
"vec4 color = texture2D(source, coords) * 256.0;
color.a = rgb2grey(color.rgb);" +
(mBlur !== 0 ?
"vec4 blurredVcolor = texture2D(blurredSource, coords) * 256.0;" +
"float blurredSourceColor = texture2D(blurredSource, coords).a * 256.0;" +
"blurredSourceColor = blurredSourceColor - blurredSourceColor * " + (1.0 - motionBlurCoefficient) * fpsAttenuation+ ";" +
"vcolor = step(1.0, color) * vcolor + step(color, 1.0) * blurredVcolor;" +
"color = step(1.0, color) * color + step(color, 1.0) * blurredSourceColor;"
"vec4 blur_color = texture2D(blurredSource, coords) * 256.0;" +
"blur_color.a = blur_color.a - blur_color.a * " + (1.0 - motionBlurCoefficient) * fpsAttenuation+ ";" +
"color = step(1.0, color.a) * color + step(color.a, 1.0) * blur_color;"
: "") +
"gl_FragColor = floor(vcolor) / 256.0;" +
"gl_FragColor.a = floor(color) / 256.0;" +
"gl_FragColor = floor(color) / 256.0;" +
"}"
onStatusChanged: if (log) console.log(log) //Print warning messages