mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-01-31 10:11:20 +00:00
Made normal and rasterized images look more consisntent.
This commit is contained in:
parent
25ed5db324
commit
8fd7161ec8
@ -26,7 +26,7 @@ ShaderEffect {
|
|||||||
property color background_color: shadersettings.background_color
|
property color background_color: shadersettings.background_color
|
||||||
property variant source: terminal.theSource
|
property variant source: terminal.theSource
|
||||||
property variant bloomSource: terminal.bloomSource
|
property variant bloomSource: terminal.bloomSource
|
||||||
property variant scanlineSource: terminal.scanlineSource
|
property variant rasterizationSource: terminal.rasterizationSource
|
||||||
property size txt_Size: Qt.size(frame.sourceRect.width, frame.sourceRect.height)
|
property size txt_Size: Qt.size(frame.sourceRect.width, frame.sourceRect.height)
|
||||||
property real bloom: shadersettings.bloom_strength
|
property real bloom: shadersettings.bloom_strength
|
||||||
|
|
||||||
@ -96,10 +96,8 @@ ShaderEffect {
|
|||||||
varying highp vec2 qt_TexCoord0;
|
varying highp vec2 qt_TexCoord0;
|
||||||
|
|
||||||
uniform highp vec4 font_color;
|
uniform highp vec4 font_color;
|
||||||
uniform highp vec4 background_color;" +
|
uniform highp vec4 background_color;
|
||||||
|
uniform highp sampler2D rasterizationSource;" +
|
||||||
(rasterization != shadersettings.no_rasterization ? "
|
|
||||||
uniform highp sampler2D scanlineSource;" : "") +
|
|
||||||
|
|
||||||
(bloom !== 0 ? "
|
(bloom !== 0 ? "
|
||||||
uniform highp sampler2D bloomSource;" : "") +
|
uniform highp sampler2D bloomSource;" : "") +
|
||||||
@ -174,9 +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;" +
|
||||||
(rasterization != shadersettings.no_rasterization ? "
|
|
||||||
finalColor *= texture2D(scanlineSource, coords).r;" : "") +
|
|
||||||
|
|
||||||
(brightness_flickering !== 0 ? "
|
(brightness_flickering !== 0 ? "
|
||||||
finalColor *= brightness;" : "") +
|
finalColor *= brightness;" : "") +
|
||||||
|
@ -28,10 +28,14 @@ Item{
|
|||||||
id: terminalContainer
|
id: terminalContainer
|
||||||
property variant theSource: finalSource
|
property variant theSource: finalSource
|
||||||
property variant bloomSource: bloomSourceLoader.item
|
property variant bloomSource: bloomSourceLoader.item
|
||||||
property variant scanlineSource: scanlineSourceLoader.item
|
property variant rasterizationSource: rasterizationEffectSource
|
||||||
|
|
||||||
property alias kterminal: kterminal
|
property alias kterminal: kterminal
|
||||||
|
|
||||||
|
signal sizeChanged
|
||||||
|
onWidthChanged: sizeChanged()
|
||||||
|
onHeightChanged: sizeChanged()
|
||||||
|
|
||||||
//The blur effect has to take into account the framerate
|
//The blur effect has to take into account the framerate
|
||||||
property real fpsAttenuation: 60 / shadersettings.fps
|
property real fpsAttenuation: 60 / shadersettings.fps
|
||||||
property real mBlur: shadersettings.motion_blur
|
property real mBlur: shadersettings.motion_blur
|
||||||
@ -106,9 +110,9 @@ Item{
|
|||||||
var scanline_spacing = shadersettings.font.lineSpacing;
|
var scanline_spacing = shadersettings.font.lineSpacing;
|
||||||
var line_spacing = Math.round(scanline_spacing * scanline_height);
|
var line_spacing = Math.round(scanline_spacing * scanline_height);
|
||||||
|
|
||||||
// console.log("Font height: " + fontMetrics.paintedHeight)
|
// console.log("Font height: " + fontMetrics.paintedHeight)
|
||||||
// console.log("Scanline Height: " + scanline_height)
|
// console.log("Scanline Height: " + scanline_height)
|
||||||
// console.log("Line Spacing: " + line_spacing)
|
// console.log("Line Spacing: " + line_spacing)
|
||||||
|
|
||||||
terminalContainer.scanlineHeight = scanline_height;
|
terminalContainer.scanlineHeight = scanline_height;
|
||||||
terminalContainer.scanlineWidth = scanline_width;
|
terminalContainer.scanlineWidth = scanline_width;
|
||||||
@ -282,40 +286,36 @@ Item{
|
|||||||
smooth: false
|
smooth: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Scanlines
|
//Rasterization mask
|
||||||
Loader{
|
ShaderEffect {
|
||||||
id: scanlineEffectLoader
|
id: rasterizationEffect
|
||||||
active: mScanlines != shadersettings.no_rasterization
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceComponent: ShaderEffect {
|
property size virtual_resolution: terminalContainer.virtual_resolution
|
||||||
property size virtual_resolution: terminalContainer.virtual_resolution
|
|
||||||
|
|
||||||
fragmentShader:
|
fragmentShader:
|
||||||
"uniform lowp float qt_Opacity;" +
|
"uniform lowp float qt_Opacity;" +
|
||||||
|
|
||||||
"varying highp vec2 qt_TexCoord0;
|
"varying highp vec2 qt_TexCoord0;
|
||||||
uniform highp vec2 virtual_resolution;
|
uniform highp vec2 virtual_resolution;
|
||||||
|
|
||||||
float getScanlineIntensity(vec2 coords) {
|
float getScanlineIntensity(vec2 coords) {
|
||||||
float result = abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" +
|
float result = 1.0;" +
|
||||||
(mScanlines == shadersettings.pixel_rasterization ?
|
(mScanlines != shadersettings.no_rasterization ?
|
||||||
"result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + "
|
"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;
|
return result;
|
||||||
}" +
|
}" +
|
||||||
|
|
||||||
"void main() {" +
|
"void main() {" +
|
||||||
"gl_FragColor = vec4(getScanlineIntensity(qt_TexCoord0));" +
|
"gl_FragColor = vec4(getScanlineIntensity(qt_TexCoord0));" +
|
||||||
"}"
|
"}"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loader{
|
ShaderEffectSource{
|
||||||
id: scanlineSourceLoader
|
id: rasterizationEffectSource
|
||||||
active: mScanlines != shadersettings.no_rasterization
|
sourceItem: rasterizationEffect
|
||||||
sourceComponent: ShaderEffectSource{
|
sourceRect: frame.sourceRect
|
||||||
sourceItem: scanlineEffectLoader.item
|
hideSource: true
|
||||||
sourceRect: frame.sourceRect
|
smooth: true
|
||||||
hideSource: true
|
|
||||||
smooth: true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user