1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-01-31 10:11:20 +00:00

Fix issues between colors and motion blur.

This commit is contained in:
Filippo Scognamiglio 2014-08-03 10:36:07 +02:00
parent 876e6079d4
commit 4b4fabaee3
2 changed files with 7 additions and 4 deletions

View File

@ -255,16 +255,18 @@ Item{
: "") + : "") +
"coords = coords + delta;" + "coords = coords + delta;" +
"vec4 vcolor = texture2D(source, coords) * 256.0; "vec4 vcolor = texture2D(source, coords) * 256.0;
float color = vcolor.r * 0.21 + vcolor.g * 0.72 + vcolor.b + 0.04;" + float color = vcolor.r * 0.21 + vcolor.g * 0.72 + vcolor.b * 0.04;" +
(mBlur !== 0 ? (mBlur !== 0 ?
"vec4 blurredVcolor = texture2D(blurredSource, coords) * 256.0;" +
"float blurredSourceColor = texture2D(blurredSource, coords).a * 256.0;" + "float blurredSourceColor = texture2D(blurredSource, coords).a * 256.0;" +
"blurredSourceColor = blurredSourceColor - blurredSourceColor * " + (1.0 - motionBlurCoefficient) * fpsAttenuation+ ";" + "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;" "color = step(1.0, color) * color + step(color, 1.0) * blurredSourceColor;"
: "") + : "") +
"gl_FragColor = texture2D(source, coords);" + "gl_FragColor = floor(vcolor) / 256.0;" +
"gl_FragColor.a = color / 256.0;" + "gl_FragColor.a = floor(color) / 256.0;" +
"}" "}"
onStatusChanged: if (log) console.log(log) //Print warning messages onStatusChanged: if (log) console.log(log) //Print warning messages

View File

@ -191,7 +191,8 @@ ShaderEffect {
"vec4 realBackColor = texture2D(source, txt_coords);" + "vec4 realBackColor = texture2D(source, txt_coords);" +
(saturation_color !== 0 ? (saturation_color !== 0 ?
"vec4 satured_font_color = mix(font_color, vec4(1) , "+ str(saturation_color) + ");" + "vec4 satured_font_color = mix(font_color, vec4(1) , "+ str(saturation_color) + ");" +
"vec4 mixedColor = mix(font_color, realBackColor * satured_font_color, "+ str(chroma_color) +");": "vec4 mixedColor = mix(font_color, realBackColor * satured_font_color, "+ str(chroma_color) +");"
:
"vec4 mixedColor = mix(font_color, realBackColor * font_color, "+ str(chroma_color) +");" "vec4 mixedColor = mix(font_color, realBackColor * font_color, "+ str(chroma_color) +");"
) + ) +