1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-01-31 02:01:19 +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 motion_blur: 0.40
property real bloom_strength: 0.65 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 jitter: 0.18
property real horizontal_sincronization: 0.08 property real horizontal_sincronization: 0.08
@ -171,6 +174,8 @@ Item{
brightness_flickering: brightness_flickering, brightness_flickering: brightness_flickering,
horizontal_sincronization: horizontal_sincronization, horizontal_sincronization: horizontal_sincronization,
noise_strength: noise_strength, noise_strength: noise_strength,
chroma_color: chroma_color,
saturation_color: saturation_color,
screen_distortion: screen_distortion, screen_distortion: screen_distortion,
glowing_line_strength: glowing_line_strength, glowing_line_strength: glowing_line_strength,
frames_index: frames_index, frames_index: frames_index,
@ -234,6 +239,8 @@ Item{
horizontal_sincronization = settings.horizontal_sincronization !== undefined ? settings.horizontal_sincronization : horizontal_sincronization horizontal_sincronization = settings.horizontal_sincronization !== undefined ? settings.horizontal_sincronization : horizontal_sincronization
brightness_flickering = settings.brightness_flickering !== undefined ? settings.brightness_flickering : brightness_flickering; brightness_flickering = settings.brightness_flickering !== undefined ? settings.brightness_flickering : brightness_flickering;
noise_strength = settings.noise_strength !== undefined ? settings.noise_strength : noise_strength; 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; 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; glowing_line_strength = settings.glowing_line_strength !== undefined ? settings.glowing_line_strength : glowing_line_strength;
@ -333,7 +340,7 @@ Item{
} }
ListElement{ ListElement{
text: "IBM Dos" 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 builtin: true
} }
ListElement{ ListElement{

View File

@ -92,21 +92,35 @@ Tab{
GroupBox{ GroupBox{
title: qsTr("Colors") title: qsTr("Colors")
Layout.fillWidth: true Layout.fillWidth: true
RowLayout{ ColumnLayout{
anchors.fill: parent RowLayout{
ColorButton{ anchors.fill: parent
name: qsTr("Font") ColorButton{
height: 50 name: qsTr("Font")
Layout.fillWidth: true height: 50
onColorSelected: shadersettings._font_color = color; Layout.fillWidth: true
button_color: shadersettings._font_color 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{ ColumnLayout{
name: qsTr("Background") CheckableSlider{
height: 50 name: qsTr("Chroma Color")
Layout.fillWidth: true onValueChanged: shadersettings.chroma_color = value
onColorSelected: shadersettings._background_color = color; _value: shadersettings.chroma_color
button_color: shadersettings._background_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 screen_distorsion: shadersettings.screen_distortion
property real glowing_line_strength: shadersettings.glowing_line_strength 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 brightness_flickering: shadersettings.brightness_flickering
property real horizontal_sincronization: shadersettings.horizontal_sincronization property real horizontal_sincronization: shadersettings.horizontal_sincronization
@ -184,10 +187,20 @@ ShaderEffect {
(glowing_line_strength !== 0 ? " (glowing_line_strength !== 0 ? "
color += randomPass(coords) * glowing_line_strength;" : "") + color += randomPass(coords) * glowing_line_strength;" : "") +
"vec4 realBackColor = texture2D(source, txt_coords);" + (chroma_color !== 0 ?
"vec4 mixedColor = mix(realBackColor * font_color, font_color, 0.0);" + "vec4 realBackColor = texture2D(source, txt_coords);" +
"vec4 finalBackColor = mix(background_color, mixedColor, realBackColor.a);" + (saturation_color !== 0 ?
"vec3 finalColor = mix(finalBackColor, font_color, color).rgb;" + "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;" + "finalColor *= texture2D(rasterizationSource, coords).a;" +
(bloom !== 0 ? " (bloom !== 0 ? "