mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-01-18 20:20:45 +00:00
Further improve rgbShift effect. Now can be enabled without chroma color.
This commit is contained in:
parent
293b05fec6
commit
8b1a0a5b8e
@ -79,7 +79,6 @@ Tab{
|
|||||||
name: qsTr("RGB Shift")
|
name: qsTr("RGB Shift")
|
||||||
onNewValue: appSettings.rbgShift = newValue;
|
onNewValue: appSettings.rbgShift = newValue;
|
||||||
value: appSettings.rbgShift;
|
value: appSettings.rbgShift;
|
||||||
enabled: appSettings.chromaColor !== 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ ShaderEffect {
|
|||||||
|
|
||||||
property real chromaColor: appSettings.chromaColor;
|
property real chromaColor: appSettings.chromaColor;
|
||||||
|
|
||||||
property real rbgShift: (appSettings.rbgShift / width) * (appSettings.chromaColor !== 0 ? 1.0 : 0.0)
|
property real rbgShift: (appSettings.rbgShift / width) * appSettings.fontScaling
|
||||||
|
|
||||||
property real flickering: appSettings.flickering
|
property real flickering: appSettings.flickering
|
||||||
property real horizontalSync: appSettings.horizontalSync * 0.5
|
property real horizontalSync: appSettings.horizontalSync * 0.5
|
||||||
@ -115,9 +115,13 @@ ShaderEffect {
|
|||||||
(!fallBack ? "
|
(!fallBack ? "
|
||||||
uniform sampler2D noiseSource;" : "") +
|
uniform sampler2D noiseSource;" : "") +
|
||||||
|
|
||||||
|
(!fallBack && rbgShift !== 0.0 ?"
|
||||||
|
varying lowp vec4 constantNoise;" : "") +
|
||||||
|
|
||||||
(!fallBack && flickering !== 0.0 ?"
|
(!fallBack && flickering !== 0.0 ?"
|
||||||
varying lowp float brightness;
|
varying lowp float brightness;
|
||||||
uniform lowp float flickering;" : "") +
|
uniform lowp float flickering;" : "") +
|
||||||
|
|
||||||
(!fallBack && horizontalSync !== 0.0 ?"
|
(!fallBack && horizontalSync !== 0.0 ?"
|
||||||
uniform lowp float horizontalSync;
|
uniform lowp float horizontalSync;
|
||||||
varying lowp float distortionScale;
|
varying lowp float distortionScale;
|
||||||
@ -129,9 +133,13 @@ ShaderEffect {
|
|||||||
qt_TexCoord0.y = (qt_MultiTexCoord0.y - disp_top) / (1.0 - disp_top - disp_bottom);
|
qt_TexCoord0.y = (qt_MultiTexCoord0.y - disp_top) / (1.0 - disp_top - disp_bottom);
|
||||||
vec2 coords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));" +
|
vec2 coords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));" +
|
||||||
|
|
||||||
(!fallBack && (flickering !== 0.0 || horizontalSync !== 0.0) ?
|
(!fallBack && (flickering !== 0.0 || horizontalSync !== 0.0 || rgbShift !== 0) ?
|
||||||
"vec4 initialNoiseTexel = texture2D(noiseSource, coords);"
|
"vec4 initialNoiseTexel = texture2D(noiseSource, coords);"
|
||||||
: "") +
|
: "") +
|
||||||
|
|
||||||
|
(!fallBack && rbgShift !== 0.0 ?"
|
||||||
|
constantNoise = initialNoiseTexel;" : "") +
|
||||||
|
|
||||||
(!fallBack && flickering !== 0.0 ? "
|
(!fallBack && flickering !== 0.0 ? "
|
||||||
brightness = 1.0 + (initialNoiseTexel.g - 0.5) * flickering;"
|
brightness = 1.0 + (initialNoiseTexel.g - 0.5) * flickering;"
|
||||||
: "") +
|
: "") +
|
||||||
@ -199,6 +207,9 @@ ShaderEffect {
|
|||||||
varying lowp float distortionScale;
|
varying lowp float distortionScale;
|
||||||
varying lowp float distortionFreq;" : "") +
|
varying lowp float distortionFreq;" : "") +
|
||||||
|
|
||||||
|
(!fallBack && rbgShift !== 0.0 ?"
|
||||||
|
varying lowp vec4 constantNoise;" : "") +
|
||||||
|
|
||||||
(glowingLine !== 0 ? "
|
(glowingLine !== 0 ? "
|
||||||
float randomPass(vec2 coords){
|
float randomPass(vec2 coords){
|
||||||
return fract(smoothstep(-120.0, 0.0, coords.y - (virtual_resolution.y + 120.0) * fract(time * 0.00015)));
|
return fract(smoothstep(-120.0, 0.0, coords.y - (virtual_resolution.y + 120.0) * fract(time * 0.00015)));
|
||||||
@ -229,6 +240,8 @@ ShaderEffect {
|
|||||||
float distortionScale = step(0.0, randval) * randval * horizontalSync;
|
float distortionScale = step(0.0, randval) * randval * horizontalSync;
|
||||||
float distortionFreq = mix(4.0, 40.0, initialNoiseTexel.g);"
|
float distortionFreq = mix(4.0, 40.0, initialNoiseTexel.g);"
|
||||||
: "") +
|
: "") +
|
||||||
|
(fallBack && rbgShift !== 0.0 ?"
|
||||||
|
lowp vec4 constantNoise = initialNoiseTexel;" : "") +
|
||||||
|
|
||||||
(staticNoise ? "
|
(staticNoise ? "
|
||||||
float noise = staticNoise;" : "") +
|
float noise = staticNoise;" : "") +
|
||||||
@ -270,14 +283,13 @@ ShaderEffect {
|
|||||||
"txt_color *= min2(step(vec2(0.0), staticCoords) - step(vec2(1.0), staticCoords));" +
|
"txt_color *= min2(step(vec2(0.0), staticCoords) - step(vec2(1.0), staticCoords));" +
|
||||||
|
|
||||||
(rbgShift !== 0 ? "
|
(rbgShift !== 0 ? "
|
||||||
vec2 displacement = vec2(32.0, 0.0) * rbgShift * noiseTexel.r;
|
vec2 displacement = vec2(12.0, 0.0) * rbgShift * (0.6 * constantNoise.r + 0.4);
|
||||||
vec3 rightColor = texture2D(source, txt_coords + displacement).rgb;
|
vec3 rightColor = texture2D(source, txt_coords + displacement).rgb;
|
||||||
vec3 leftColor = texture2D(source, txt_coords - displacement).rgb;
|
vec3 leftColor = texture2D(source, txt_coords - displacement).rgb;
|
||||||
vec3 rgbShiftColor = vec3(0.0);
|
txt_color.r = leftColor.r * 0.25 + rightColor.r * 0.50 + txt_color.r * 0.25;
|
||||||
rgbShiftColor.r = leftColor.r * 0.15 + rightColor.r * 0.7 + txt_color.r * 0.15;
|
txt_color.g = leftColor.g * 0.25 + rightColor.g * 0.25 + txt_color.g * 0.50;
|
||||||
rgbShiftColor.g = leftColor.g * 0.15 + rightColor.g * 0.15 + txt_color.g * 0.7;
|
txt_color.b = leftColor.b * 0.50 + rightColor.b * 0.25 + txt_color.b * 0.25;
|
||||||
rgbShiftColor.b = leftColor.b * 0.7 + rightColor.b * 0.15 + txt_color.b * 0.15;
|
" : "") +
|
||||||
txt_color = max(txt_color, (rgbShiftColor - txt_color));" : "") +
|
|
||||||
|
|
||||||
(burnIn !== 0 ? "
|
(burnIn !== 0 ? "
|
||||||
vec4 txt_blur = texture2D(blurredSource, txt_coords);
|
vec4 txt_blur = texture2D(blurredSource, txt_coords);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user