1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-02-21 20:39:00 +00:00

Added jitter effect.

This commit is contained in:
Filippo Scognamiglio 2014-06-20 12:30:42 +02:00
parent 21c7f2c23e
commit 431ec6d133
4 changed files with 23 additions and 4 deletions

View File

@ -270,6 +270,11 @@ Window {
onValueChanged: shadersettings.noise_strength = value onValueChanged: shadersettings.noise_strength = value
_value: shadersettings.noise_strength _value: shadersettings.noise_strength
} }
SettingComponent{
name: "Jitter"
onValueChanged: shadersettings.jitter = value
_value: shadersettings.jitter
}
SettingComponent{ SettingComponent{
name: "Glow" name: "Glow"
onValueChanged: shadersettings.glowing_line_strength = value; onValueChanged: shadersettings.glowing_line_strength = value;

View File

@ -33,6 +33,8 @@ ShaderEffect {
property int rasterization: shadersettings.rasterization property int rasterization: shadersettings.rasterization
property real jitter: shadersettings.jitter * 0.007
property real noise_strength: shadersettings.noise_strength property real noise_strength: shadersettings.noise_strength
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
@ -105,7 +107,8 @@ ShaderEffect {
(bloom !== 0 ? " (bloom !== 0 ? "
uniform highp sampler2D bloomSource;" : "") + uniform highp sampler2D bloomSource;" : "") +
(noise_strength !== 0 ? " (noise_strength !== 0 ? "
uniform highp float noise_strength; uniform highp float noise_strength;" : "") +
(noise_strength !== 0 || jitter !== 0 ? "
uniform lowp sampler2D noiseSource;" : "") + uniform lowp sampler2D noiseSource;" : "") +
(screen_distorsion !== 0 ? " (screen_distorsion !== 0 ? "
uniform highp float screen_distorsion;" : "")+ uniform highp float screen_distorsion;" : "")+
@ -147,7 +150,13 @@ ShaderEffect {
noise += horizontal_distortion;" : "") noise += horizontal_distortion;" : "")
: "") + : "") +
"float color = texture2D(source, coords).a;" + (jitter !== 0 ? "
vec2 offset = vec2(texture2D(noiseSource, coords + fract(time / 57.0)).a,
texture2D(noiseSource, coords + fract(time / 251.0)).a) - 0.5;
vec2 txt_coords = coords + offset * "+str(jitter)+";"
: "vec2 txt_coords = coords;") +
"float color = texture2D(source, txt_coords).a;" +
(noise_strength !== 0 ? " (noise_strength !== 0 ? "
float noiseVal = texture2D(noiseSource, qt_TexCoord0 + vec2(fract(time / 51.0), fract(time / 237.0))).a; float noiseVal = texture2D(noiseSource, qt_TexCoord0 + vec2(fract(time / 51.0), fract(time / 237.0))).a;

View File

@ -60,6 +60,8 @@ Item{
property real motion_blur: 0.65 property real motion_blur: 0.65
property real bloom_strength: 0.6 property real bloom_strength: 0.6
property real jitter: 0.15
property real horizontal_sincronization: 0.1 property real horizontal_sincronization: 0.1
property real brightness_flickering: 0.12 property real brightness_flickering: 0.12
@ -240,7 +242,8 @@ Item{
font_index: font_index, font_index: font_index,
motion_blur: motion_blur, motion_blur: motion_blur,
bloom_strength: bloom_strength, bloom_strength: bloom_strength,
rasterization: rasterization rasterization: rasterization,
jitter: jitter
} }
return JSON.stringify(settings); return JSON.stringify(settings);
} }
@ -304,6 +307,8 @@ Item{
font_index = settings.font_index !== undefined ? settings.font_index : font_index; font_index = settings.font_index !== undefined ? settings.font_index : font_index;
rasterization = settings.rasterization !== undefined ? settings.rasterization : rasterization; rasterization = settings.rasterization !== undefined ? settings.rasterization : rasterization;
jitter = settings.jitter !== undefined ? settings.jitter : jitter
} }
function storeCustomProfiles(){ function storeCustomProfiles(){

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.0.1, 2014-06-11T00:00:49. --> <!-- Written by QtCreator 3.0.1, 2014-06-20T12:25:11. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>