mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-01-31 02:01:19 +00:00
Added a really cool motion blur to the screen!
This commit is contained in:
parent
5aa1da233a
commit
03a72e39b9
@ -28,6 +28,7 @@ RowLayout {
|
|||||||
property double _value: 0.0
|
property double _value: 0.0
|
||||||
property double min_value: 0.0
|
property double min_value: 0.0
|
||||||
property double max_value: 1.0
|
property double max_value: 1.0
|
||||||
|
property double stepSize: 0.01
|
||||||
|
|
||||||
id: setting_component
|
id: setting_component
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@ -43,7 +44,7 @@ RowLayout {
|
|||||||
}
|
}
|
||||||
Slider{
|
Slider{
|
||||||
id: slider
|
id: slider
|
||||||
stepSize: 0.01
|
stepSize: parent.stepSize
|
||||||
minimumValue: min_value
|
minimumValue: min_value
|
||||||
maximumValue: max_value
|
maximumValue: max_value
|
||||||
onValueChanged: setting_component._value = slider.value;
|
onValueChanged: setting_component._value = slider.value;
|
||||||
@ -55,6 +56,6 @@ RowLayout {
|
|||||||
}
|
}
|
||||||
Text{
|
Text{
|
||||||
id: textfield
|
id: textfield
|
||||||
text: Math.round(((_value - min_value) / (max_value - min_value)) * 100) + "%"
|
text: Math.round(((value - min_value) / (max_value - min_value)) * 100) + "%"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,6 +138,11 @@ ApplicationWindow {
|
|||||||
checked: shadersettings.scanlines
|
checked: shadersettings.scanlines
|
||||||
onCheckedChanged: shadersettings.scanlines = checked;
|
onCheckedChanged: shadersettings.scanlines = checked;
|
||||||
}
|
}
|
||||||
|
SettingComponent{
|
||||||
|
name: "Motion Blur"
|
||||||
|
onValueChanged: shadersettings.motion_blur = value
|
||||||
|
_value: shadersettings.motion_blur
|
||||||
|
}
|
||||||
SettingComponent{
|
SettingComponent{
|
||||||
name: "Noise"
|
name: "Noise"
|
||||||
onValueChanged: shadersettings.noise_strength = value
|
onValueChanged: shadersettings.noise_strength = value
|
||||||
|
@ -32,8 +32,9 @@ Item{
|
|||||||
property real noise_strength: 0.1
|
property real noise_strength: 0.1
|
||||||
property real screen_distortion: 0.15
|
property real screen_distortion: 0.15
|
||||||
property real glowing_line_strength: 0.4
|
property real glowing_line_strength: 0.4
|
||||||
|
property real motion_blur: 0.65
|
||||||
|
|
||||||
property bool scanlines: true
|
property bool scanlines: false
|
||||||
|
|
||||||
property string frame_source: frames_list.get(frames_index).source
|
property string frame_source: frames_list.get(frames_index).source
|
||||||
property int frames_index: 2
|
property int frames_index: 2
|
||||||
@ -112,6 +113,8 @@ Item{
|
|||||||
glowing_line_strength = settings.glowing_line_strength ? settings.glowing_line_strength : glowing_line_strength;
|
glowing_line_strength = settings.glowing_line_strength ? settings.glowing_line_strength : glowing_line_strength;
|
||||||
scanlines = settings.scanlines ? settings.scanlines : scanlines;
|
scanlines = settings.scanlines ? settings.scanlines : scanlines;
|
||||||
|
|
||||||
|
motion_blur = settings.motion_blur ? settings.motion_blur : motion_blur
|
||||||
|
|
||||||
frames_index = settings.frames_index ? settings.frames_index : frames_index;
|
frames_index = settings.frames_index ? settings.frames_index : frames_index;
|
||||||
|
|
||||||
font_index = settings.font_index ? settings.font_index : font_index;
|
font_index = settings.font_index ? settings.font_index : font_index;
|
||||||
@ -130,7 +133,8 @@ Item{
|
|||||||
scanlines: scanlines,
|
scanlines: scanlines,
|
||||||
frames_index: frames_index,
|
frames_index: frames_index,
|
||||||
font_index: font_index,
|
font_index: font_index,
|
||||||
font_scaling: font_scaling
|
font_scaling: font_scaling,
|
||||||
|
motion_blur: motion_blur
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(JSON.stringify(settings));
|
console.log(JSON.stringify(settings));
|
||||||
@ -153,21 +157,21 @@ Item{
|
|||||||
|
|
||||||
|
|
||||||
ListModel{
|
ListModel{
|
||||||
id: profileslist
|
id: profileslist
|
||||||
ListElement{
|
ListElement{
|
||||||
text: "Default"
|
text: "Default"
|
||||||
obj_name: "DEFAULT"
|
obj_name: "DEFAULT"
|
||||||
obj_string: '{"ambient_light":0.3,"background_color":"#000000","font_color":"#00ff3b","font_index":0,"font_scaling":1,"frames_index":2,"glowing_line_strength":0.4,"noise_strength":0.1,"scanlines":true,"screen_distortion":0.15,"screen_flickering":0.07}'
|
obj_string: '{"ambient_light":0.3,"background_color":"#000000","font_color":"#00ff3b","font_index":0,"font_scaling":1,"frames_index":2,"glowing_line_strength":0.4,"noise_strength":0.1,"scanlines":true,"screen_distortion":0.15,"screen_flickering":0.07}'
|
||||||
}
|
}
|
||||||
ListElement{
|
ListElement{
|
||||||
text: "Commodore 64"
|
text: "Commodore 64"
|
||||||
obj_name: "COMMODORE64"
|
obj_name: "COMMODORE64"
|
||||||
obj_string: '{"ambient_light":0.2,"background_color":"#5048b2","font_color":"#8bcad1","font_index":2,"font_scaling":1,"frames_index":1,"glowing_line_strength":0.2,"noise_strength":0.05,"scanlines":false,"screen_distortion":0.1,"screen_flickering":0.03}'
|
obj_string: '{"ambient_light":0.2,"background_color":"#5048b2","font_color":"#8bcad1","font_index":2,"font_scaling":1,"frames_index":1,"glowing_line_strength":0.2,"noise_strength":0.05,"scanlines":false,"screen_distortion":0.1,"screen_flickering":0.03}'
|
||||||
}
|
}
|
||||||
ListElement{
|
ListElement{
|
||||||
text: "IBM Dos"
|
text: "IBM Dos"
|
||||||
obj_name: "IBMDOS"
|
obj_name: "IBMDOS"
|
||||||
obj_string: '{"ambient_light":0.4,"background_color":"#000000","font_color":"#ffffff","font_index":3,"font_scaling":1,"frames_index":1,"glowing_line_strength":0,"noise_strength":0,"scanlines":false,"screen_distortion":0.05,"screen_flickering":0.00}'
|
obj_string: '{"ambient_light":0.4,"background_color":"#000000","font_color":"#ffffff","font_index":3,"font_scaling":1,"frames_index":1,"glowing_line_strength":0,"noise_strength":0,"scanlines":false,"screen_distortion":0.05,"screen_flickering":0.00}'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,26 +2,71 @@ import QtQuick 2.0
|
|||||||
|
|
||||||
import org.kde.konsole 0.1
|
import org.kde.konsole 0.1
|
||||||
|
|
||||||
KTerminal {
|
Item{
|
||||||
font.pointSize: shadersettings.fontSize
|
id: terminalContainer
|
||||||
font.family: shadersettings.font.name
|
property real blur: shadersettings.motion_blur
|
||||||
|
property real motionBlurCoefficient: (_minBlurCoefficient)*blur + (_maxBlurCoefficient)*(1.0-blur)
|
||||||
|
property real _minBlurCoefficient: 0.015
|
||||||
|
property real _maxBlurCoefficient: 0.10
|
||||||
|
KTerminal {
|
||||||
|
id: kterminal
|
||||||
|
font.pointSize: shadersettings.fontSize
|
||||||
|
font.family: shadersettings.font.name
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height
|
||||||
|
|
||||||
colorScheme: "WhiteOnBlack"
|
colorScheme: "MyWhiteOnBlack"
|
||||||
|
|
||||||
session: KSession {
|
session: KSession {
|
||||||
id: ksession
|
id: ksession
|
||||||
kbScheme: "linux"
|
kbScheme: "linux"
|
||||||
|
|
||||||
onFinished: {
|
onFinished: {
|
||||||
Qt.quit()
|
Qt.quit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
font.pointSize = shadersettings.fontSize;
|
||||||
|
font.family = shadersettings.font.name;
|
||||||
|
forceActiveFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Loader{
|
||||||
font.pointSize = shadersettings.fontSize;
|
anchors.fill: parent
|
||||||
font.family = shadersettings.font.name;
|
active: parent.blur !== 0
|
||||||
console.log(shadersettings.font.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onDestruction: console.log("Destroy")
|
sourceComponent: Item{
|
||||||
|
ShaderEffectSource{
|
||||||
|
id: source
|
||||||
|
sourceItem: kterminal
|
||||||
|
hideSource: true
|
||||||
|
}
|
||||||
|
ShaderEffectSource{
|
||||||
|
id: blurredSource
|
||||||
|
sourceItem: blurredterminal
|
||||||
|
recursive: true
|
||||||
|
live: true
|
||||||
|
}
|
||||||
|
ShaderEffect {
|
||||||
|
id: blurredterminal
|
||||||
|
anchors.fill: parent
|
||||||
|
property variant source: source
|
||||||
|
property variant blurredSource: blurredSource
|
||||||
|
z: 2
|
||||||
|
fragmentShader:
|
||||||
|
"uniform lowp float qt_Opacity;" +
|
||||||
|
"uniform lowp sampler2D source;" +
|
||||||
|
"uniform lowp sampler2D blurredSource;" +
|
||||||
|
"varying highp vec2 qt_TexCoord0;" +
|
||||||
|
|
||||||
|
"void main() {" +
|
||||||
|
" float sourceColor = texture2D(source, qt_TexCoord0).r * 512.0;" +
|
||||||
|
" float blurredSourceColor = texture2D(blurredSource, qt_TexCoord0).r * 512.0;" +
|
||||||
|
" gl_FragColor = vec4(vec3(floor(mix(blurredSourceColor, sourceColor, " + motionBlurCoefficient + "))) / 512.0, 1.0);" +
|
||||||
|
"}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,10 +98,18 @@ ApplicationWindow{
|
|||||||
|
|
||||||
Loader{
|
Loader{
|
||||||
id: terminal
|
id: terminal
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MouseArea{
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
|
anchors.fill: parent
|
||||||
|
onWheel:
|
||||||
|
wheel.angleDelta.y > 0 ? terminal.item.scrollUp() : terminal.item.scrollDown()
|
||||||
|
}
|
||||||
|
|
||||||
RadialGradient{
|
RadialGradient{
|
||||||
id: ambientreflection
|
id: ambientreflection
|
||||||
z: 2.0
|
z: 2.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user