mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-02-22 12:58:39 +00:00
Edge borders are now slightly smoother.
This commit is contained in:
parent
8ec688f1d9
commit
ef3303134d
@ -342,42 +342,72 @@ Item{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RASTERIZATION //////////////////////////////////////////////////////////
|
// RASTERIZATION //////////////////////////////////////////////////////////
|
||||||
|
ShaderEffect{
|
||||||
ShaderEffect {
|
id: rasterizationContainer
|
||||||
id: rasterizationEffect
|
width: frame.sourceRect.width
|
||||||
anchors.fill: parent
|
height: frame.sourceRect.height
|
||||||
property size virtual_resolution: terminalContainer.virtual_resolution
|
property size offset: Qt.size(width - rasterizationEffect.width, height - rasterizationEffect.height)
|
||||||
|
property size txtRes: Qt.size(width, height)
|
||||||
|
|
||||||
blending: false
|
blending: false
|
||||||
|
|
||||||
fragmentShader:
|
fragmentShader:
|
||||||
"uniform lowp float qt_Opacity;" +
|
"uniform lowp float qt_Opacity;
|
||||||
|
uniform highp vec2 offset;
|
||||||
|
uniform highp vec2 txtRes;" +
|
||||||
|
|
||||||
"varying highp vec2 qt_TexCoord0;
|
"varying highp vec2 qt_TexCoord0;" +
|
||||||
uniform highp vec2 virtual_resolution;
|
|
||||||
|
|
||||||
float getScanlineIntensity(vec2 coords) {
|
"void main() {" +
|
||||||
float result = 1.0;" +
|
"float color = 1.0;
|
||||||
(mScanlines != shadersettings.no_rasterization ?
|
color *= smoothstep(0.0, offset.x / txtRes.x, qt_TexCoord0.x);
|
||||||
"result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") +
|
color *= smoothstep(0.0, offset.y / txtRes.y, qt_TexCoord0.y);
|
||||||
(mScanlines == shadersettings.pixel_rasterization ?
|
color *= smoothstep(0.0, offset.x / txtRes.x, 1.0 - qt_TexCoord0.x);
|
||||||
"result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + "
|
color *= smoothstep(0.0, offset.y / txtRes.y, 1.0 - qt_TexCoord0.y);" +
|
||||||
return result;
|
|
||||||
}" +
|
|
||||||
|
|
||||||
"void main() {" +
|
"float distance = length(vec2(0.5) - qt_TexCoord0);" +
|
||||||
"float distance = length(vec2(0.5) - qt_TexCoord0);" +
|
"color = mix(color, 0.0, 1.2 * distance * distance);" +
|
||||||
|
|
||||||
"float color = getScanlineIntensity(qt_TexCoord0);" +
|
"gl_FragColor.a = color;" +
|
||||||
"color = mix(color, 0.0, 1.2 * distance * distance);" +
|
"}"
|
||||||
|
|
||||||
"gl_FragColor.a = color;" +
|
ShaderEffect {
|
||||||
"}"
|
id: rasterizationEffect
|
||||||
|
width: terminalContainer.width
|
||||||
|
height: terminalContainer.height
|
||||||
|
anchors.centerIn: parent
|
||||||
|
property size virtual_resolution: terminalContainer.virtual_resolution
|
||||||
|
|
||||||
|
blending: false
|
||||||
|
|
||||||
|
fragmentShader:
|
||||||
|
"uniform lowp float qt_Opacity;" +
|
||||||
|
|
||||||
|
"varying highp vec2 qt_TexCoord0;
|
||||||
|
uniform highp vec2 virtual_resolution;
|
||||||
|
|
||||||
|
float getScanlineIntensity(vec2 coords) {
|
||||||
|
float result = 1.0;" +
|
||||||
|
(mScanlines != shadersettings.no_rasterization ?
|
||||||
|
"result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") +
|
||||||
|
(mScanlines == shadersettings.pixel_rasterization ?
|
||||||
|
"result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + "
|
||||||
|
return result;
|
||||||
|
}" +
|
||||||
|
|
||||||
|
"void main() {" +
|
||||||
|
"float color = getScanlineIntensity(qt_TexCoord0);" +
|
||||||
|
|
||||||
|
"float distance = length(vec2(0.5) - qt_TexCoord0);" +
|
||||||
|
"color = mix(color, 0.0, 1.2 * distance * distance);" +
|
||||||
|
|
||||||
|
"gl_FragColor.a = color;" +
|
||||||
|
"}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ShaderEffectSource{
|
ShaderEffectSource{
|
||||||
id: rasterizationEffectSource
|
id: rasterizationEffectSource
|
||||||
sourceItem: rasterizationEffect
|
sourceItem: rasterizationContainer
|
||||||
sourceRect: frame.sourceRect
|
|
||||||
hideSource: true
|
hideSource: true
|
||||||
smooth: true
|
smooth: true
|
||||||
format: ShaderEffectSource.Alpha
|
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-07-07T00:26:31. -->
|
<!-- Written by QtCreator 3.0.1, 2014-07-09T00:22:58. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user