mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-01-18 20:20:45 +00:00
Optimizations: motion blur is better, and quality is now customizable. Default value is 50%. which is again a good compromise.
This commit is contained in:
parent
37317136ed
commit
26d5c56cd0
@ -58,6 +58,7 @@ Item{
|
||||
property real bloom_strength: 0.65
|
||||
|
||||
property real bloom_quality: 0.5
|
||||
property real blur_quality: 0.5
|
||||
|
||||
property real chroma_color: 0.0
|
||||
property real saturation_color: 0.0
|
||||
@ -168,7 +169,8 @@ Item{
|
||||
fontIndexes: fontIndexes,
|
||||
frameReflections: _frameReflections,
|
||||
showMenubar: showMenubar,
|
||||
bloom_quality: bloom_quality
|
||||
bloom_quality: bloom_quality,
|
||||
blur_quality: blur_quality
|
||||
}
|
||||
return stringify(settings);
|
||||
}
|
||||
@ -243,6 +245,7 @@ Item{
|
||||
showMenubar = settings.showMenubar !== undefined ? settings.showMenubar : showMenubar;
|
||||
|
||||
bloom_quality = settings.bloom_quality !== undefined ? settings.bloom_quality : bloom_quality;
|
||||
blur_quality = settings.blur_quality !== undefined ? settings.blur_quality : blur_quality;
|
||||
}
|
||||
|
||||
function loadProfileString(profileString){
|
||||
|
@ -28,7 +28,8 @@ Item{
|
||||
|
||||
property size virtualResolution: Qt.size(kterminal.width, kterminal.height)
|
||||
property alias mainTerminal: kterminal
|
||||
property ShaderEffectSource mainSource: mBlur !== 0 ? blurredSourceLoader.item : kterminalSource
|
||||
property ShaderEffectSource mainSource: kterminalSource
|
||||
property ShaderEffectSource blurredSource: blurredSourceLoader.item
|
||||
|
||||
property real scaleTexture: 1.0
|
||||
property alias title: ksession.title
|
||||
@ -41,9 +42,9 @@ Item{
|
||||
|
||||
//The blur effect has to take into account the framerate
|
||||
property real mBlur: appSettings.motion_blur
|
||||
property real motionBlurCoefficient: (_maxBlurCoefficient * mBlur + _minBlurCoefficient * (1 - mBlur))
|
||||
property real motionBlurCoefficient: (_maxBlurCoefficient * Math.sqrt(mBlur) + _minBlurCoefficient * (1 - Math.sqrt(mBlur)))
|
||||
property real _minBlurCoefficient: 0.70
|
||||
property real _maxBlurCoefficient: 0.90
|
||||
property real _maxBlurCoefficient: 0.95
|
||||
|
||||
property size terminalSize: kterminal.terminalSize
|
||||
property size fontMetrics: kterminal.fontMetrics
|
||||
@ -241,8 +242,8 @@ Item{
|
||||
Loader{
|
||||
id: blurredTerminalLoader
|
||||
|
||||
width: kterminalSource.textureSize.width
|
||||
height: kterminalSource.textureSize.height
|
||||
width: kterminal.width * scaleTexture * appSettings.blur_quality
|
||||
height: kterminal.height * scaleTexture * appSettings.blur_quality
|
||||
active: mBlur !== 0
|
||||
asynchronous: true
|
||||
|
||||
@ -268,13 +269,11 @@ Item{
|
||||
|
||||
"void main() {" +
|
||||
"vec2 coords = qt_TexCoord0;" +
|
||||
"vec3 color = texture2D(txt_source, coords).rgb * 256.0;" +
|
||||
"vec3 origColor = texture2D(txt_source, coords).rgb;" +
|
||||
"vec3 blur_color = texture2D(blurredSource, coords).rgb * (1.0 - blurCoefficient);" +
|
||||
"vec3 color = min(origColor + blur_color, max(origColor, blur_color));" +
|
||||
|
||||
"vec3 blur_color = texture2D(blurredSource, coords).rgb * 256.0;" +
|
||||
"blur_color = blur_color - blur_color * blurCoefficient;" +
|
||||
"color = step(vec3(1.0), color) * color + step(color, vec3(1.0)) * blur_color;" +
|
||||
|
||||
"gl_FragColor = vec4(floor(color) / 256.0, 1.0);" +
|
||||
"gl_FragColor = vec4(color, step(0.004, rgb2grey(color - origColor)));" +
|
||||
"}"
|
||||
|
||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||
|
@ -83,6 +83,27 @@ Tab{
|
||||
Text{text: Math.round(bloomSlider.value * 100) + "%"}
|
||||
}
|
||||
}
|
||||
GroupBox{
|
||||
title: qsTr("Motion Blur")
|
||||
Layout.fillWidth: true
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
GridLayout{
|
||||
id: blurQualityContainer
|
||||
anchors.fill: parent
|
||||
|
||||
Text{text: qsTr("Blur Quality")}
|
||||
Slider{
|
||||
Layout.fillWidth: true
|
||||
id: blurSlider
|
||||
onValueChanged: appSettings.blur_quality = value;
|
||||
value: appSettings.blur_quality
|
||||
stepSize: 0.10
|
||||
Component.onCompleted: minimumValue = 0.3 //Without this value gets set to 0.5
|
||||
}
|
||||
Text{text: Math.round(blurSlider.value * 100) + "%"}
|
||||
}
|
||||
}
|
||||
GroupBox{
|
||||
title: qsTr("Frame")
|
||||
Layout.fillWidth: true
|
||||
|
@ -23,12 +23,15 @@ import QtGraphicalEffects 1.0
|
||||
|
||||
ShaderEffect {
|
||||
property ShaderEffectSource source
|
||||
property ShaderEffectSource blurredSource
|
||||
property ShaderEffectSource bloomSource
|
||||
|
||||
property color font_color: appSettings.font_color
|
||||
property color background_color: appSettings.background_color
|
||||
property real bloom_strength: appSettings.bloom_strength * 2.5
|
||||
|
||||
property real motion_blur: appSettings.motion_blur
|
||||
|
||||
property real jitter: appSettings.jitter * 0.007
|
||||
property real noise_strength: appSettings.noise_strength
|
||||
property size scaleNoiseSize: Qt.size((width) / (noiseTexture.width * appSettings.window_scaling * appSettings.fontScaling),
|
||||
@ -156,6 +159,8 @@ ShaderEffect {
|
||||
(bloom_strength !== 0 ? "
|
||||
uniform highp sampler2D bloomSource;
|
||||
uniform lowp float bloom_strength;" : "") +
|
||||
(motion_blur !== 0 ? "
|
||||
uniform sampler2D blurredSource;" : "") +
|
||||
(noise_strength !== 0 ? "
|
||||
uniform highp float noise_strength;" : "") +
|
||||
(((noise_strength !== 0 || jitter !== 0 || rgb_shift)
|
||||
@ -255,8 +260,14 @@ ShaderEffect {
|
||||
color += randomPass(coords) * glowing_line_strength;" : "") +
|
||||
|
||||
|
||||
"vec3 txt_color = texture2D(source, txt_coords).rgb;
|
||||
float greyscale_color = rgb2grey(txt_color) + color;" +
|
||||
"vec3 txt_color = texture2D(source, txt_coords).rgb;" +
|
||||
|
||||
(motion_blur !== 0 ? "
|
||||
vec4 txt_blur = texture2D(blurredSource, txt_coords);
|
||||
txt_color = txt_color + txt_blur.rgb * txt_blur.a;"
|
||||
: "") +
|
||||
|
||||
"float greyscale_color = rgb2grey(txt_color) + color;" +
|
||||
|
||||
(chroma_color !== 0 ?
|
||||
(rgb_shift !== 0 ? "
|
||||
|
@ -11,6 +11,7 @@ ShaderTerminal{
|
||||
blending: false
|
||||
|
||||
source: terminal.mainSource
|
||||
blurredSource: terminal.blurredSource
|
||||
dispX: (12 / width) * appSettings.window_scaling
|
||||
dispY: (12 / height) * appSettings.window_scaling
|
||||
virtual_resolution: terminal.virtualResolution
|
||||
|
Loading…
x
Reference in New Issue
Block a user