mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-02-20 20:09:14 +00:00
Edge borders are now slightly smoother.
This commit is contained in:
parent
8ec688f1d9
commit
ef3303134d
@ -342,42 +342,72 @@ Item{
|
||||
}
|
||||
|
||||
// RASTERIZATION //////////////////////////////////////////////////////////
|
||||
|
||||
ShaderEffect {
|
||||
id: rasterizationEffect
|
||||
anchors.fill: parent
|
||||
property size virtual_resolution: terminalContainer.virtual_resolution
|
||||
ShaderEffect{
|
||||
id: rasterizationContainer
|
||||
width: frame.sourceRect.width
|
||||
height: frame.sourceRect.height
|
||||
property size offset: Qt.size(width - rasterizationEffect.width, height - rasterizationEffect.height)
|
||||
property size txtRes: Qt.size(width, height)
|
||||
|
||||
blending: false
|
||||
|
||||
fragmentShader:
|
||||
"uniform lowp float qt_Opacity;" +
|
||||
"uniform lowp float qt_Opacity;
|
||||
uniform highp vec2 offset;
|
||||
uniform highp vec2 txtRes;" +
|
||||
|
||||
"varying highp vec2 qt_TexCoord0;
|
||||
uniform highp vec2 virtual_resolution;
|
||||
"varying highp vec2 qt_TexCoord0;" +
|
||||
|
||||
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 = 1.0;
|
||||
color *= smoothstep(0.0, offset.x / txtRes.x, qt_TexCoord0.x);
|
||||
color *= smoothstep(0.0, offset.y / txtRes.y, qt_TexCoord0.y);
|
||||
color *= smoothstep(0.0, offset.x / txtRes.x, 1.0 - qt_TexCoord0.x);
|
||||
color *= smoothstep(0.0, offset.y / txtRes.y, 1.0 - qt_TexCoord0.y);" +
|
||||
|
||||
"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);" +
|
||||
"color = mix(color, 0.0, 1.2 * distance * distance);" +
|
||||
"gl_FragColor.a = color;" +
|
||||
"}"
|
||||
|
||||
"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{
|
||||
id: rasterizationEffectSource
|
||||
sourceItem: rasterizationEffect
|
||||
sourceRect: frame.sourceRect
|
||||
sourceItem: rasterizationContainer
|
||||
hideSource: true
|
||||
smooth: true
|
||||
format: ShaderEffectSource.Alpha
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!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>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
|
Loading…
x
Reference in New Issue
Block a user