1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-01-18 12:15:27 +00:00

Add two settings to change colors.

This commit is contained in:
Firemark 2014-08-01 00:04:59 +02:00
parent f167b4d447
commit e3d8992a35
3 changed files with 53 additions and 19 deletions

View File

@ -67,6 +67,9 @@ Item{
property real motion_blur: 0.40
property real bloom_strength: 0.65
property real chroma_color: 0.0
property real saturation_color: 0.0
property real jitter: 0.18
property real horizontal_sincronization: 0.08
@ -171,6 +174,8 @@ Item{
brightness_flickering: brightness_flickering,
horizontal_sincronization: horizontal_sincronization,
noise_strength: noise_strength,
chroma_color: chroma_color,
saturation_color: saturation_color,
screen_distortion: screen_distortion,
glowing_line_strength: glowing_line_strength,
frames_index: frames_index,
@ -234,6 +239,8 @@ Item{
horizontal_sincronization = settings.horizontal_sincronization !== undefined ? settings.horizontal_sincronization : horizontal_sincronization
brightness_flickering = settings.brightness_flickering !== undefined ? settings.brightness_flickering : brightness_flickering;
noise_strength = settings.noise_strength !== undefined ? settings.noise_strength : noise_strength;
chroma_color = settings.chroma_color !== undefined ? settings.chroma_color : chroma_color;
saturation_color = settings.saturation_color !== undefined ? settings.saturation_color : saturation_color;
screen_distortion = settings.screen_distortion !== undefined ? settings.screen_distortion : screen_distortion;
glowing_line_strength = settings.glowing_line_strength !== undefined ? settings.glowing_line_strength : glowing_line_strength;
@ -333,7 +340,7 @@ Item{
}
ListElement{
text: "IBM Dos"
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.07,"contrast":0.85,"fontIndex":7,"font_color":"#ffffff","frames_index":1,"glowing_line_strength":0.13,"horizontal_sincronization":0,"jitter":0.08,"motion_blur":0.3,"noise_strength":0.03,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1}'
obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.07,"contrast":0.85,"fontIndex":7,"font_color":"#ffffff","frames_index":1,"glowing_line_strength":0.13,"horizontal_sincronization":0,"jitter":0.08,"motion_blur":0.3,"noise_strength":0.03,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":1}'
builtin: true
}
ListElement{

View File

@ -92,21 +92,35 @@ Tab{
GroupBox{
title: qsTr("Colors")
Layout.fillWidth: true
RowLayout{
anchors.fill: parent
ColorButton{
name: qsTr("Font")
height: 50
Layout.fillWidth: true
onColorSelected: shadersettings._font_color = color;
button_color: shadersettings._font_color
ColumnLayout{
RowLayout{
anchors.fill: parent
ColorButton{
name: qsTr("Font")
height: 50
Layout.fillWidth: true
onColorSelected: shadersettings._font_color = color;
button_color: shadersettings._font_color
}
ColorButton{
name: qsTr("Background")
height: 50
Layout.fillWidth: true
onColorSelected: shadersettings._background_color = color;
button_color: shadersettings._background_color
}
}
ColorButton{
name: qsTr("Background")
height: 50
Layout.fillWidth: true
onColorSelected: shadersettings._background_color = color;
button_color: shadersettings._background_color
ColumnLayout{
CheckableSlider{
name: qsTr("Chroma Color")
onValueChanged: shadersettings.chroma_color = value
_value: shadersettings.chroma_color
}
CheckableSlider{
name: qsTr("Saturation Color")
onValueChanged: shadersettings.saturation_color = value
_value: shadersettings.saturation_color
}
}
}
}

View File

@ -39,6 +39,9 @@ ShaderEffect {
property real screen_distorsion: shadersettings.screen_distortion
property real glowing_line_strength: shadersettings.glowing_line_strength
property real chroma_color: shadersettings.chroma_color;
property real saturation_color: shadersettings.saturation_color;
property real brightness_flickering: shadersettings.brightness_flickering
property real horizontal_sincronization: shadersettings.horizontal_sincronization
@ -184,10 +187,20 @@ ShaderEffect {
(glowing_line_strength !== 0 ? "
color += randomPass(coords) * glowing_line_strength;" : "") +
"vec4 realBackColor = texture2D(source, txt_coords);" +
"vec4 mixedColor = mix(realBackColor * font_color, font_color, 0.0);" +
"vec4 finalBackColor = mix(background_color, mixedColor, realBackColor.a);" +
"vec3 finalColor = mix(finalBackColor, font_color, color).rgb;" +
(chroma_color !== 0 ?
"vec4 realBackColor = texture2D(source, txt_coords);" +
(saturation_color !== 0 ?
"vec4 satured_font_color = mix(font_color, vec4(1) , "+ str(saturation_color) + ");" +
"vec4 mixedColor = mix(font_color, realBackColor * satured_font_color, "+ str(chroma_color) +");":
"vec4 mixedColor = mix(font_color, realBackColor * font_color, "+ str(chroma_color) +");"
) +
"vec4 finalBackColor = mix(background_color, mixedColor, realBackColor.a);" +
"vec3 finalColor = mix(finalBackColor, font_color, color).rgb;" :
"color += texture2D(source, txt_coords).a;" +
"vec3 finalColor = mix(background_color, font_color, color).rgb;"
) +
"finalColor *= texture2D(rasterizationSource, coords).a;" +
(bloom !== 0 ? "