mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-03-28 05:28:44 +00:00
Adding Amber Scanline settings
This commit is contained in:
parent
dac2b4ff16
commit
0625ca4f15
@ -94,6 +94,7 @@ QtObject{
|
|||||||
property real flickering: 0.1
|
property real flickering: 0.1
|
||||||
|
|
||||||
property real rbgShift: 0.0
|
property real rbgShift: 0.0
|
||||||
|
property real scanlineBlur: 0.0
|
||||||
|
|
||||||
property real _margin: 0.5
|
property real _margin: 0.5
|
||||||
property real margin: Utils.lint(1.0, 20.0, _margin)
|
property real margin: Utils.lint(1.0, 20.0, _margin)
|
||||||
@ -232,6 +233,7 @@ QtObject{
|
|||||||
rasterization: rasterization,
|
rasterization: rasterization,
|
||||||
jitter: jitter,
|
jitter: jitter,
|
||||||
rbgShift: rbgShift,
|
rbgShift: rbgShift,
|
||||||
|
scanlineBlur: scanlineBlur,
|
||||||
brightness: brightness,
|
brightness: brightness,
|
||||||
contrast: contrast,
|
contrast: contrast,
|
||||||
ambientLight: ambientLight,
|
ambientLight: ambientLight,
|
||||||
@ -325,6 +327,7 @@ QtObject{
|
|||||||
jitter = settings.jitter !== undefined ? settings.jitter : jitter;
|
jitter = settings.jitter !== undefined ? settings.jitter : jitter;
|
||||||
|
|
||||||
rbgShift = settings.rbgShift !== undefined ? settings.rbgShift : rbgShift;
|
rbgShift = settings.rbgShift !== undefined ? settings.rbgShift : rbgShift;
|
||||||
|
scanlineBlur = settings.scanlineBlur !== undefined ? settings.scanlineBlur : rbgShift;
|
||||||
|
|
||||||
ambientLight = settings.ambientLight !== undefined ? settings.ambientLight : ambientLight;
|
ambientLight = settings.ambientLight !== undefined ? settings.ambientLight : ambientLight;
|
||||||
contrast = settings.contrast !== undefined ? settings.contrast : contrast;
|
contrast = settings.contrast !== undefined ? settings.contrast : contrast;
|
||||||
@ -402,6 +405,7 @@ QtObject{
|
|||||||
"jitter": 0.1997,
|
"jitter": 0.1997,
|
||||||
"rasterization": 0,
|
"rasterization": 0,
|
||||||
"rbgShift": 0,
|
"rbgShift": 0,
|
||||||
|
"scanlineBlur": 0,
|
||||||
"saturationColor": 0.2483,
|
"saturationColor": 0.2483,
|
||||||
"screenCurvature": 0.3,
|
"screenCurvature": 0.3,
|
||||||
"staticNoise": 0.1198,
|
"staticNoise": 0.1198,
|
||||||
@ -410,6 +414,34 @@ QtObject{
|
|||||||
}'
|
}'
|
||||||
builtin: true
|
builtin: true
|
||||||
}
|
}
|
||||||
|
ListElement{
|
||||||
|
text: "Amber Scanlines"
|
||||||
|
obj_string: '{
|
||||||
|
"ambientLight": 0.2,
|
||||||
|
"backgroundColor": "#000000",
|
||||||
|
"bloom": 0.32,
|
||||||
|
"brightness": 1,
|
||||||
|
"burnIn": 0.30,
|
||||||
|
"chromaColor": 1,
|
||||||
|
"contrast": 0.75,
|
||||||
|
"flickering": 0.04,
|
||||||
|
"fontColor": "#ff8100",
|
||||||
|
"fontName": "TERMINUS_SCALED",
|
||||||
|
"fontWidth": 1,
|
||||||
|
"glowingLine": 0,
|
||||||
|
"horizontalSync": 0,
|
||||||
|
"jitter": 0.03,
|
||||||
|
"rasterization": 1,
|
||||||
|
"rbgShift": 0,
|
||||||
|
"scanlineBlur": 0.05,
|
||||||
|
"saturationColor": 1,
|
||||||
|
"screenCurvature": 0.05,
|
||||||
|
"staticNoise": 0.05,
|
||||||
|
"windowOpacity": 1,
|
||||||
|
"margin": 0.5
|
||||||
|
}'
|
||||||
|
builtin: true
|
||||||
|
}
|
||||||
ListElement{
|
ListElement{
|
||||||
text: "Monochrome Green"
|
text: "Monochrome Green"
|
||||||
obj_string: '
|
obj_string: '
|
||||||
@ -430,6 +462,7 @@ QtObject{
|
|||||||
"jitter": 0.1997,
|
"jitter": 0.1997,
|
||||||
"rasterization": 0,
|
"rasterization": 0,
|
||||||
"rbgShift": 0,
|
"rbgShift": 0,
|
||||||
|
"scanlineBlur": 0,
|
||||||
"saturationColor": 0.0,
|
"saturationColor": 0.0,
|
||||||
"screenCurvature": 0.3,
|
"screenCurvature": 0.3,
|
||||||
"staticNoise": 0.1198,
|
"staticNoise": 0.1198,
|
||||||
@ -458,6 +491,7 @@ QtObject{
|
|||||||
"jitter": 0.11,
|
"jitter": 0.11,
|
||||||
"rasterization": 1,
|
"rasterization": 1,
|
||||||
"rbgShift": 0,
|
"rbgShift": 0,
|
||||||
|
"scanlineBlur": 0.05,
|
||||||
"saturationColor": 0.5,
|
"saturationColor": 0.5,
|
||||||
"screenCurvature": 0.3,
|
"screenCurvature": 0.3,
|
||||||
"staticNoise": 0.15,
|
"staticNoise": 0.15,
|
||||||
@ -486,6 +520,7 @@ QtObject{
|
|||||||
"jitter": 0,
|
"jitter": 0,
|
||||||
"rasterization": 2,
|
"rasterization": 2,
|
||||||
"rbgShift": 0,
|
"rbgShift": 0,
|
||||||
|
"scanlineBlur": 0,
|
||||||
"saturationColor": 0,
|
"saturationColor": 0,
|
||||||
"screenCurvature": 0,
|
"screenCurvature": 0,
|
||||||
"staticNoise": 0.15,
|
"staticNoise": 0.15,
|
||||||
@ -514,6 +549,7 @@ QtObject{
|
|||||||
"jitter": 0.1,
|
"jitter": 0.1,
|
||||||
"rasterization": 1,
|
"rasterization": 1,
|
||||||
"rbgShift": 0,
|
"rbgShift": 0,
|
||||||
|
"scanlineBlur": 0,
|
||||||
"saturationColor": 0,
|
"saturationColor": 0,
|
||||||
"screenCurvature": 0.5,
|
"screenCurvature": 0.5,
|
||||||
"staticNoise": 0.099,
|
"staticNoise": 0.099,
|
||||||
@ -542,6 +578,7 @@ QtObject{
|
|||||||
"jitter": 0.4,
|
"jitter": 0.4,
|
||||||
"rasterization": 1,
|
"rasterization": 1,
|
||||||
"rbgShift": 0.2969,
|
"rbgShift": 0.2969,
|
||||||
|
"scanlineBlur": 0,
|
||||||
"saturationColor": 0,
|
"saturationColor": 0,
|
||||||
"screenCurvature": 0.5,
|
"screenCurvature": 0.5,
|
||||||
"staticNoise": 0.2969,
|
"staticNoise": 0.2969,
|
||||||
@ -570,6 +607,7 @@ QtObject{
|
|||||||
"jitter": 0.1545,
|
"jitter": 0.1545,
|
||||||
"rasterization": 0,
|
"rasterization": 0,
|
||||||
"rbgShift": 0.3524,
|
"rbgShift": 0.3524,
|
||||||
|
"scanlineBlur": 0,
|
||||||
"saturationColor": 0,
|
"saturationColor": 0,
|
||||||
"screenCurvature": 0.4,
|
"screenCurvature": 0.4,
|
||||||
"staticNoise": 0.0503,
|
"staticNoise": 0.0503,
|
||||||
@ -598,6 +636,7 @@ QtObject{
|
|||||||
"jitter": 0,
|
"jitter": 0,
|
||||||
"rasterization": 0,
|
"rasterization": 0,
|
||||||
"rbgShift": 0,
|
"rbgShift": 0,
|
||||||
|
"scanlineBlur": 0,
|
||||||
"saturationColor": 0,
|
"saturationColor": 0,
|
||||||
"screenCurvature": 0.2,
|
"screenCurvature": 0.2,
|
||||||
"staticNoise": 0,
|
"staticNoise": 0,
|
||||||
@ -626,6 +665,7 @@ QtObject{
|
|||||||
"jitter": 0.099,
|
"jitter": 0.099,
|
||||||
"rasterization": 0,
|
"rasterization": 0,
|
||||||
"rbgShift": 0,
|
"rbgShift": 0,
|
||||||
|
"scanlineBlur": 0,
|
||||||
"saturationColor": 0.4983,
|
"saturationColor": 0.4983,
|
||||||
"screenCurvature": 0,
|
"screenCurvature": 0,
|
||||||
"staticNoise": 0.0955,
|
"staticNoise": 0.0955,
|
||||||
|
@ -85,6 +85,11 @@ Tab{
|
|||||||
onNewValue: appSettings.rbgShift = newValue;
|
onNewValue: appSettings.rbgShift = newValue;
|
||||||
value: appSettings.rbgShift;
|
value: appSettings.rbgShift;
|
||||||
}
|
}
|
||||||
|
CheckableSlider{
|
||||||
|
name: qsTr("Scanline Blur")
|
||||||
|
onNewValue: appSettings.scanlineBlur = newValue;
|
||||||
|
value: appSettings.scanlineBlur;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -378,6 +378,7 @@ Item {
|
|||||||
property real chromaColor: appSettings.chromaColor;
|
property real chromaColor: appSettings.chromaColor;
|
||||||
|
|
||||||
property real rbgShift: (appSettings.rbgShift / width) * appSettings.totalFontScaling // TODO FILIPPO width here is wrong.
|
property real rbgShift: (appSettings.rbgShift / width) * appSettings.totalFontScaling // TODO FILIPPO width here is wrong.
|
||||||
|
property real scanlineBlur: (appSettings.scanlineBlur / width) * appSettings.totalFontScaling
|
||||||
|
|
||||||
property int rasterization: appSettings.rasterization
|
property int rasterization: appSettings.rasterization
|
||||||
|
|
||||||
@ -423,6 +424,9 @@ Item {
|
|||||||
(rbgShift !== 0 ? "
|
(rbgShift !== 0 ? "
|
||||||
uniform lowp float rbgShift;" : "") +
|
uniform lowp float rbgShift;" : "") +
|
||||||
|
|
||||||
|
(scanlineBlur !== 0 ? "
|
||||||
|
uniform lowp float scanlineBlur;" : "") +
|
||||||
|
|
||||||
(ambientLight !== 0 ? "
|
(ambientLight !== 0 ? "
|
||||||
uniform lowp float ambientLight;" : "") +
|
uniform lowp float ambientLight;" : "") +
|
||||||
|
|
||||||
@ -432,15 +436,15 @@ Item {
|
|||||||
(appSettings.rasterization != appSettings.no_rasterization ?
|
(appSettings.rasterization != appSettings.no_rasterization ?
|
||||||
"float val = 0.0;
|
"float val = 0.0;
|
||||||
vec2 rasterizationCoords = fract(coords * virtual_resolution);
|
vec2 rasterizationCoords = fract(coords * virtual_resolution);
|
||||||
val += smoothstep(0.0, 0.5, rasterizationCoords.y);
|
val += smoothstep(0.1, 0.5, rasterizationCoords.y);
|
||||||
val -= smoothstep(0.5, 1.0, rasterizationCoords.y);
|
val -= smoothstep(0.5, 0.9, rasterizationCoords.y);
|
||||||
result *= mix(0.5, 1.0, val);" : "") +
|
result *= mix(0.3, 1.0, val);" : "") +
|
||||||
|
|
||||||
(appSettings.rasterization == appSettings.pixel_rasterization ?
|
(appSettings.rasterization == appSettings.pixel_rasterization ?
|
||||||
"val = 0.0;
|
"val = 0.0;
|
||||||
val += smoothstep(0.0, 0.5, rasterizationCoords.x);
|
val += smoothstep(0.0, 0.5, rasterizationCoords.x);
|
||||||
val -= smoothstep(0.5, 1.0, rasterizationCoords.x);
|
val -= smoothstep(0.5, 1.0, rasterizationCoords.x);
|
||||||
result *= mix(0.5, 1.0, val);" : "") + "
|
result *= mix(0.1, 1.0, val);" : "") + "
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -490,6 +494,19 @@ Item {
|
|||||||
txt_color.b = leftColor.b * 0.30 + rightColor.b * 0.10 + txt_color.b * 0.60;
|
txt_color.b = leftColor.b * 0.30 + rightColor.b * 0.10 + txt_color.b * 0.60;
|
||||||
" : "") +
|
" : "") +
|
||||||
|
|
||||||
|
(scanlineBlur !== 0 ? "
|
||||||
|
vec2 scanlineBlur_displacement = vec2(12.0, 0.0) * scanlineBlur;
|
||||||
|
vec3 scanlineBlur_rightColor = texture2D(source, txt_coords + scanlineBlur_displacement).rgb;
|
||||||
|
vec3 scanlineBlur_leftColor = texture2D(source, txt_coords - scanlineBlur_displacement).rgb;
|
||||||
|
vec3 scanlineBlur_rightColor2 = texture2D(source, txt_coords + scanlineBlur_displacement + scanlineBlur_displacement).rgb;
|
||||||
|
vec3 scanlineBlur_leftColor2 = texture2D(source, txt_coords - scanlineBlur_displacement - scanlineBlur_displacement).rgb;
|
||||||
|
vec3 scanlineBlur_rightColor3 = texture2D(source, txt_coords + scanlineBlur_displacement + scanlineBlur_displacement + scanlineBlur_displacement).rgb;
|
||||||
|
vec3 scanlineBlur_leftColor3 = texture2D(source, txt_coords - scanlineBlur_displacement - scanlineBlur_displacement - scanlineBlur_displacement).rgb;
|
||||||
|
txt_color.r = scanlineBlur_leftColor3.r * 0.05 + scanlineBlur_leftColor2.r * 0.1 + scanlineBlur_leftColor.r * 0.20 + txt_color.r * 0.30 + scanlineBlur_rightColor.r * 0.20 + scanlineBlur_rightColor2.r * 0.1 + scanlineBlur_rightColor3.r * 0.05;
|
||||||
|
txt_color.g = scanlineBlur_leftColor3.g * 0.05 + scanlineBlur_leftColor2.g * 0.1 + scanlineBlur_leftColor.g * 0.20 + txt_color.g * 0.30 + scanlineBlur_rightColor.g * 0.20 + scanlineBlur_rightColor2.g * 0.1 + scanlineBlur_rightColor3.g * 0.05;
|
||||||
|
txt_color.b = scanlineBlur_leftColor3.b * 0.05 + scanlineBlur_leftColor2.b * 0.1 + scanlineBlur_leftColor.b * 0.20 + txt_color.b * 0.30 + scanlineBlur_rightColor.b * 0.20 + scanlineBlur_rightColor2.b * 0.1 + scanlineBlur_rightColor3.b * 0.05;
|
||||||
|
" : "") +
|
||||||
|
|
||||||
"txt_color *= getScanlineIntensity(txt_coords);" +
|
"txt_color *= getScanlineIntensity(txt_coords);" +
|
||||||
|
|
||||||
"txt_color += vec3(0.0001);" +
|
"txt_color += vec3(0.0001);" +
|
||||||
|
@ -87,6 +87,9 @@ Loader {
|
|||||||
property variant blurredSource: burnInSourceEffect
|
property variant blurredSource: burnInSourceEffect
|
||||||
property real burnInCoefficient: burnInSourceEffect.burnInCoefficient
|
property real burnInCoefficient: burnInSourceEffect.burnInCoefficient
|
||||||
|
|
||||||
|
property int rasterization: appSettings.rasterization
|
||||||
|
property size virtual_resolution: Qt.size(kterminal.totalWidth, kterminal.totalHeight)
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
blending: false
|
blending: false
|
||||||
|
|
||||||
@ -97,6 +100,7 @@ Loader {
|
|||||||
|
|
||||||
"uniform lowp float qt_Opacity;" +
|
"uniform lowp float qt_Opacity;" +
|
||||||
"uniform lowp sampler2D txt_source;" +
|
"uniform lowp sampler2D txt_source;" +
|
||||||
|
"uniform highp vec2 virtual_resolution;" +
|
||||||
|
|
||||||
"varying highp vec2 qt_TexCoord0;
|
"varying highp vec2 qt_TexCoord0;
|
||||||
uniform lowp sampler2D blurredSource;
|
uniform lowp sampler2D blurredSource;
|
||||||
@ -106,12 +110,33 @@ Loader {
|
|||||||
return max (max (v.x, v.y), v.z);
|
return max (max (v.x, v.y), v.z);
|
||||||
}" +
|
}" +
|
||||||
|
|
||||||
|
|
||||||
|
"highp float getScanlineIntensity(vec2 coords) {
|
||||||
|
float result = 1.0;" +
|
||||||
|
|
||||||
|
(appSettings.rasterization != appSettings.no_rasterization ?
|
||||||
|
"float val = 0.0;
|
||||||
|
vec2 rasterizationCoords = fract(coords * virtual_resolution);
|
||||||
|
val += smoothstep(0.0, 0.5, rasterizationCoords.y);
|
||||||
|
val -= smoothstep(0.5, 1.0, rasterizationCoords.y);
|
||||||
|
result *= mix(0.5, 1.0, val);" : "") +
|
||||||
|
|
||||||
|
(appSettings.rasterization == appSettings.pixel_rasterization ?
|
||||||
|
"val = 0.0;
|
||||||
|
val += smoothstep(0.0, 0.5, rasterizationCoords.x);
|
||||||
|
val -= smoothstep(0.5, 1.0, rasterizationCoords.x);
|
||||||
|
result *= mix(0.5, 1.0, val);" : "") + "
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}" +
|
||||||
|
|
||||||
|
|
||||||
"void main() {" +
|
"void main() {" +
|
||||||
"vec2 coords = qt_TexCoord0;" +
|
"vec2 coords = qt_TexCoord0;" +
|
||||||
"vec3 origColor = texture2D(txt_source, coords).rgb;" +
|
"vec3 origColor = texture2D(txt_source, coords).rgb;" +
|
||||||
|
"origColor *= getScanlineIntensity(coords);" +
|
||||||
"vec3 blur_color = texture2D(blurredSource, coords).rgb - vec3(burnInCoefficient);" +
|
"vec3 blur_color = texture2D(blurredSource, coords).rgb - vec3(burnInCoefficient);" +
|
||||||
"vec3 color = min(origColor + blur_color, max(origColor, blur_color));" +
|
"vec3 color = min(origColor + blur_color, max(origColor, blur_color));" +
|
||||||
|
|
||||||
"gl_FragColor = vec4(color, max3(color - origColor));" +
|
"gl_FragColor = vec4(color, max3(color - origColor));" +
|
||||||
"}"
|
"}"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user