diff --git a/app/SettingsWindow.qml b/app/SettingsWindow.qml index 9f84a3e..3b05dc3 100644 --- a/app/SettingsWindow.qml +++ b/app/SettingsWindow.qml @@ -28,10 +28,9 @@ ApplicationWindow { id: settings_window title: qsTr("Settings") width: 640 - height: 300 + height: 400 - visible: true - modality: Qt.ApplicationModal + //modality: Qt.ApplicationModal TabView{ anchors.fill: parent @@ -173,6 +172,11 @@ ApplicationWindow { onValueChanged: shadersettings.screen_flickering = value; _value: shadersettings.screen_flickering; } + SettingComponent{ + name: "Horizontal flickering" + onValueChanged: shadersettings.horizontal_sincronization = value; + _value: shadersettings.horizontal_sincronization; + } } } } diff --git a/app/ShaderManager.qml b/app/ShaderManager.qml index ac042da..c9c21a6 100644 --- a/app/ShaderManager.qml +++ b/app/ShaderManager.qml @@ -33,39 +33,33 @@ ShaderEffect { property real scanlines: shadersettings.scanlines ? 1.0 : 0.0 - - Behavior on horizontal_distortion { - NumberAnimation{ - duration: 100 - onRunningChanged: - if(!running) shadercontainer.horizontal_distortion = 0.0; - } - } - - //Manage brightness (the function might be improved) property real screen_flickering: shadersettings.screen_flickering - property real _A: 0.5 + Math.random() * 0.2 - property real _B: 0.3 + Math.random() * 0.2 + property real _A: 0.4 + Math.random() * 0.4 + property real _B: 0.2 + Math.random() * 0.4 property real _C: 1.2 - _A - _B - property real a: (0.2 + Math.random() * 0.2) * 0.05 - property real b: (0.4 + Math.random() * 0.2) * 0.05 - property real c: (0.7 + Math.random() * 0.2) * 0.05 - property real brightness: screen_flickering * ( - _A * Math.cos(a * time) + - _B * Math.sin(b * time) + - _C * Math.cos(c * time)) + property real a: (0.1 + Math.random() * 0.4) * 0.05 + property real b: (0.3 + Math.random() * 0.4) * 0.05 + property real c: (0.6 + Math.random() * 0.4) * 0.05 + + property real randval: (_A * Math.cos(a * time + _B) + + _B * Math.sin(b * time + _C) + + _C * Math.cos(c * time + _A)) + + property real brightness: screen_flickering * randval + property real horizontal_sincronization: shadersettings.horizontal_sincronization + property real _neg_sinc: 1 - horizontal_sincronization + property real horizontal_distortion: randval > (_neg_sinc) ? (randval - _neg_sinc) * horizontal_sincronization : 0 property real deltay: 3 / terminal.height property real deltax: 3 / terminal.width - property real horizontal_distortion: 0.0 - NumberAnimation on time{ - from: -1 - to: 10000 - duration: 10000 - - loops: Animation.Infinite + Timer{ + id: timetimer + onTriggered: time += interval + interval: 16 + running: true + repeat: true } fragmentShader: " @@ -118,9 +112,12 @@ ShaderEffect { vec2 coords = (qt_TexCoord0 - cc * (1.0 + distortion) * distortion);" :"vec2 coords = qt_TexCoord0;") + - (horizontal_distortion !== 0 ? - "float distortion = (sin(coords.y * 20.0 * fract(time * 0.1) + sin(fract(time * 0.2))) + sin(time * 0.05)); - coords.x = coords.x + distortion * 0.3 * horizontal_distortion; " : "") + + (shadersettings.horizontal_sincronization !== 0 ? + "float h_distortion = 0.5 * sin(time*0.001 + coords.y*10.0*fract(time/10.0)); + h_distortion += 0.5 * cos(time*0.04 + 0.03 + coords.y*50.0*fract(time/10.0 + 0.4)); + coords.x = coords.x + h_distortion * 0.3 * horizontal_distortion;" + + (noise_strength ? "noise_strength += horizontal_distortion * 0.5;" : "") + : "") + "float color = texture2D(source, coords).r;" + diff --git a/app/ShaderSettings.qml b/app/ShaderSettings.qml index 6179dd9..6adcfca 100644 --- a/app/ShaderSettings.qml +++ b/app/ShaderSettings.qml @@ -34,7 +34,7 @@ Item{ property real motion_blur: 0.65 property real bloom_strength: 0.8 - property real horizontal_sinc: 0.2 + property real horizontal_sincronization: 0.1 property real screen_flickering: 0.12 property bool scanlines: false diff --git a/app/Terminal.qml b/app/Terminal.qml index bb06e03..06f81f8 100644 --- a/app/Terminal.qml +++ b/app/Terminal.qml @@ -74,8 +74,10 @@ Item{ sourceItem: blurredterminal recursive: true live: true + smooth: false } } + ShaderEffect { id: blurredterminal anchors.fill: parent @@ -83,6 +85,7 @@ Item{ property variant blurredSource: (mBlur !== 0) ? blurredSource : undefined property variant bloomSource: (mBloom !== 0) ? bloomSource : undefined z: 2 + fragmentShader: "uniform lowp float qt_Opacity;" + "uniform lowp sampler2D source;" + diff --git a/app/app.qmlproject.user b/app/app.qmlproject.user index 3137848..0bfa497 100644 --- a/app/app.qmlproject.user +++ b/app/app.qmlproject.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/app/main.qml b/app/main.qml index a1082e5..d756156 100644 --- a/app/main.qml +++ b/app/main.qml @@ -121,6 +121,10 @@ ApplicationWindow{ GradientStop{position: 0.7; color: "#00000000"} } } + + Terminal{ + anchors.fill: parent + } } ShaderSettings{