mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-02-22 12:58:39 +00:00
Saving some GPU memory by using one channel textures where possible.
This commit is contained in:
parent
8fd7161ec8
commit
6c461acf28
@ -159,7 +159,7 @@ ShaderEffect {
|
|||||||
noise += horizontal_distortion;" : "")
|
noise += horizontal_distortion;" : "")
|
||||||
: "") +
|
: "") +
|
||||||
|
|
||||||
"float color = texture2D(source, coords).r;" +
|
"float color = texture2D(source, coords).a;" +
|
||||||
|
|
||||||
(noise_strength !== 0 ? "
|
(noise_strength !== 0 ? "
|
||||||
color += stepNoise(coords) * noise * (1.0 - distance * distance * 2.0);" : "") +
|
color += stepNoise(coords) * noise * (1.0 - distance * distance * 2.0);" : "") +
|
||||||
@ -172,7 +172,7 @@ ShaderEffect {
|
|||||||
|
|
||||||
"vec3 finalColor = mix(background_color, font_color, color).rgb;" +
|
"vec3 finalColor = mix(background_color, font_color, color).rgb;" +
|
||||||
"finalColor = mix(finalColor * 1.1, vec3(0.0), 1.2 * distance * distance);" +
|
"finalColor = mix(finalColor * 1.1, vec3(0.0), 1.2 * distance * distance);" +
|
||||||
"finalColor *= texture2D(rasterizationSource, coords).r;" +
|
"finalColor *= texture2D(rasterizationSource, coords).a;" +
|
||||||
|
|
||||||
(brightness_flickering !== 0 ? "
|
(brightness_flickering !== 0 ? "
|
||||||
finalColor *= brightness;" : "") +
|
finalColor *= brightness;" : "") +
|
||||||
|
@ -73,7 +73,6 @@ Item{
|
|||||||
kterminal.copyClipboard();
|
kterminal.copyClipboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
KTerminal {
|
KTerminal {
|
||||||
id: kterminal
|
id: kterminal
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -218,6 +217,7 @@ Item{
|
|||||||
id: finalSource
|
id: finalSource
|
||||||
sourceItem: blurredterminal
|
sourceItem: blurredterminal
|
||||||
sourceRect: frame.sourceRect
|
sourceRect: frame.sourceRect
|
||||||
|
format: ShaderEffectSource.Alpha
|
||||||
}
|
}
|
||||||
ShaderEffect {
|
ShaderEffect {
|
||||||
id: blurredterminal
|
id: blurredterminal
|
||||||
@ -252,13 +252,13 @@ Item{
|
|||||||
|
|
||||||
"float color = texture2D(source, coords + delta).r * 256.0;" +
|
"float color = texture2D(source, coords + delta).r * 256.0;" +
|
||||||
(mBlur !== 0 ?
|
(mBlur !== 0 ?
|
||||||
"float blurredSourceColor = texture2D(blurredSource, qt_TexCoord0).r * 256.0;" +
|
"float blurredSourceColor = texture2D(blurredSource, qt_TexCoord0).a * 256.0;" +
|
||||||
"blurredSourceColor = blurredSourceColor - blurredSourceColor * " + (1.0 - motionBlurCoefficient) * fpsAttenuation+ ";" +
|
"blurredSourceColor = blurredSourceColor - blurredSourceColor * " + (1.0 - motionBlurCoefficient) * fpsAttenuation+ ";" +
|
||||||
"color = step(1.0, color) * color + step(color, 1.0) * blurredSourceColor;"
|
"color = step(1.0, color) * color + step(color, 1.0) * blurredSourceColor;"
|
||||||
: "") +
|
: "") +
|
||||||
|
|
||||||
|
|
||||||
"gl_FragColor = vec4(vec3(floor(color) / 256.0), 1.0);" +
|
"gl_FragColor.a = vec4(floor(color) / 256.0);" +
|
||||||
"}"
|
"}"
|
||||||
}
|
}
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
@ -308,7 +308,7 @@ Item{
|
|||||||
}" +
|
}" +
|
||||||
|
|
||||||
"void main() {" +
|
"void main() {" +
|
||||||
"gl_FragColor = vec4(getScanlineIntensity(qt_TexCoord0));" +
|
"gl_FragColor.a = getScanlineIntensity(qt_TexCoord0);" +
|
||||||
"}"
|
"}"
|
||||||
}
|
}
|
||||||
ShaderEffectSource{
|
ShaderEffectSource{
|
||||||
@ -317,5 +317,6 @@ Item{
|
|||||||
sourceRect: frame.sourceRect
|
sourceRect: frame.sourceRect
|
||||||
hideSource: true
|
hideSource: true
|
||||||
smooth: true
|
smooth: true
|
||||||
|
format: ShaderEffectSource.Alpha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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-06-07T10:59:29. -->
|
<!-- Written by QtCreator 3.0.1, 2014-06-07T14:58:56. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user