From b4bf29dc9e88af571c8f95406e02586b8875e7df Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Sun, 14 Sep 2014 00:45:34 +0200 Subject: [PATCH] Resore frames functionalities. --- app/qml/PreprocessedTerminal.qml | 4 ++++ app/qml/ShaderTerminal.qml | 25 ++++++++++++++----------- app/qml/frames/BlackRoughFrame.qml | 19 ++++++++----------- app/qml/frames/NoFrame.qml | 3 --- app/qml/frames/WhiteSimpleFrame.qml | 11 ++++------- app/qml/frames/utils/TerminalFrame.qml | 9 --------- app/qml/main.qml | 3 --- 7 files changed, 30 insertions(+), 44 deletions(-) diff --git a/app/qml/PreprocessedTerminal.qml b/app/qml/PreprocessedTerminal.qml index 8526246..b60c932 100644 --- a/app/qml/PreprocessedTerminal.qml +++ b/app/qml/PreprocessedTerminal.qml @@ -167,6 +167,7 @@ Item{ sourceItem: kterminal hideSource: true smooth: mScanlines == shadersettings.no_rasterization + wrapMode: ShaderEffectSource.ClampToEdge } Loader{ id: blurredSourceLoader @@ -178,6 +179,7 @@ Item{ recursive: true live: false hideSource: true + wrapMode: kterminalSource.wrapMode smooth: mScanlines == shadersettings.no_rasterization @@ -275,6 +277,7 @@ Item{ sourceItem: bloomEffectLoader.item hideSource: true smooth: false + wrapMode: ShaderEffectSource.ClampToEdge } } @@ -445,5 +448,6 @@ Item{ sourceItem: rasterizationEffect hideSource: true smooth: true + wrapMode: ShaderEffectSource.Repeat } } diff --git a/app/qml/ShaderTerminal.qml b/app/qml/ShaderTerminal.qml index 52d4e22..7f00af7 100644 --- a/app/qml/ShaderTerminal.qml +++ b/app/qml/ShaderTerminal.qml @@ -29,7 +29,6 @@ ShaderEffect { property variant bloomSource: terminal.bloomSource property variant rasterizationSource: terminal.rasterizationSource property variant noiseSource: terminal.staticNoiseSource - property size txt_Size: Qt.size(frame.sourceRect.width, frame.sourceRect.height) property real bloom_strength: shadersettings.bloom_strength * 2.5 property real jitter: shadersettings.jitter * 0.007 @@ -47,10 +46,10 @@ ShaderEffect { property bool frameReflections: shadersettings.frameReflections - property real disp_top: frame.item.displacementTop * shadersettings.window_scaling - property real disp_bottom: frame.item.displacementBottom * shadersettings.window_scaling - property real disp_left: frame.item.displacementLeft * shadersettings.window_scaling - property real disp_right: frame.item.displacementRight * shadersettings.window_scaling + property real disp_top: frame.item.displacementTop / height + property real disp_bottom: frame.item.displacementBottom / height + property real disp_left: frame.item.displacementLeft / width + property real disp_right: frame.item.displacementRight / width property real screen_brightness: shadersettings.brightness * 1.5 + 0.5 @@ -86,7 +85,11 @@ ShaderEffect { uniform highp mat4 qt_Matrix; uniform highp float time; uniform sampler2D randomFunctionSource; - uniform highp vec2 txt_Size; + + uniform highp float disp_left; + uniform highp float disp_right; + uniform highp float disp_top; + uniform highp float disp_bottom; attribute highp vec4 qt_Vertex; attribute highp vec2 qt_MultiTexCoord0; @@ -101,7 +104,8 @@ ShaderEffect { uniform lowp float horizontal_sincronization;" : "") + " void main() { - qt_TexCoord0 = qt_MultiTexCoord0; + qt_TexCoord0.x = -disp_left + qt_MultiTexCoord0.x * (1.0 + disp_left + disp_right); + qt_TexCoord0.y = -disp_top + qt_MultiTexCoord0.y * (1.0 + disp_top + disp_bottom); vec2 coords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));" + (brightness_flickering !== 0.0 ? " brightness = 1.0 + (texture2D(randomFunctionSource, coords).g - 0.5) * brightness_flickering;" @@ -120,7 +124,6 @@ ShaderEffect { uniform sampler2D source; uniform highp float qt_Opacity; uniform highp float time; - uniform highp vec2 txt_Size; varying highp vec2 qt_TexCoord0; uniform highp vec4 font_color; @@ -172,9 +175,9 @@ ShaderEffect { :" vec2 coords = qt_TexCoord0;") + - (frameReflections ? " - vec2 inside = step(0.0, coords) - step(1.0, coords); - coords = abs(mod(floor(coords), 2.0) - fract(coords)) * clamp(inside.x + inside.y, 0.0, 1.0);" : "") + +// (frameReflections ? " +// vec2 inside = step(0.0, coords) - step(1.0, coords); +// coords = abs(mod(floor(coords), 2.0) - fract(coords)) * clamp(inside.x + inside.y, 0.0, 1.0);" : "") + (horizontal_sincronization !== 0 ? " float h_distortion = 0.5 * sin(time*0.001 + coords.y*10.0*fract(time/10.0)); diff --git a/app/qml/frames/BlackRoughFrame.qml b/app/qml/frames/BlackRoughFrame.qml index 7bc688a..8661cd7 100644 --- a/app/qml/frames/BlackRoughFrame.qml +++ b/app/qml/frames/BlackRoughFrame.qml @@ -7,22 +7,19 @@ TerminalFrame{ anchors.fill: parent addedWidth: 200 addedHeight: 370 - borderLeft: 148 - borderRight: 148 - borderTop: 232 - borderBottom: 232 + borderLeft: 170 + borderRight: 170 + borderTop: 250 + borderBottom: 250 imageSource: "../images/black-frame.png" normalsSource: "../images/black-frame-normals.png" - rectX: 20 - rectY: 20 - distortionCoefficient: 1.9 - displacementLeft: 70.0 - displacementTop: 55.0 - displacementRight: 50.0 - displacementBottom: 38.0 + displacementLeft: 80.0 + displacementTop: 65.0 + displacementRight: 80.0 + displacementBottom: 65.0 shaderString: "FrameShader.qml" } diff --git a/app/qml/frames/NoFrame.qml b/app/qml/frames/NoFrame.qml index 806e437..e594158 100644 --- a/app/qml/frames/NoFrame.qml +++ b/app/qml/frames/NoFrame.qml @@ -12,9 +12,6 @@ TerminalFrame{ borderTop: 0 borderBottom: 0 - rectX: 15 - rectY: 15 - displacementLeft: 0 displacementTop: 0 displacementRight: 0 diff --git a/app/qml/frames/WhiteSimpleFrame.qml b/app/qml/frames/WhiteSimpleFrame.qml index 207e869..0231c40 100644 --- a/app/qml/frames/WhiteSimpleFrame.qml +++ b/app/qml/frames/WhiteSimpleFrame.qml @@ -14,15 +14,12 @@ TerminalFrame{ imageSource: "../images/screen-frame.png" normalsSource: "../images/screen-frame-normals.png" - rectX: 15 - rectY: 15 - distortionCoefficient: 1.5 - displacementLeft: 45 - displacementTop: 40 - displacementRight: 38.0 - displacementBottom: 28.0 + displacementLeft: 55 + displacementTop: 50 + displacementRight: 55 + displacementBottom: 50 shaderString: "FrameShader.qml" } diff --git a/app/qml/frames/utils/TerminalFrame.qml b/app/qml/frames/utils/TerminalFrame.qml index 3c0b9b1..0232702 100644 --- a/app/qml/frames/utils/TerminalFrame.qml +++ b/app/qml/frames/utils/TerminalFrame.qml @@ -15,10 +15,6 @@ Item{ property string normalsSource property string shaderString - //Value used to create the rect used to add the border to the texture - property real rectX - property real rectY - //Values used to displace the texture in the screen. Used to make reflections correct. property real displacementLeft property real displacementTop @@ -27,11 +23,6 @@ Item{ property real distortionCoefficient - property rect sourceRect: Qt.rect(-rectX * shadersettings.window_scaling, - -rectY * shadersettings.window_scaling, - terminal.width + 2*rectX * shadersettings.window_scaling, - terminal.height + 2*rectY * shadersettings.window_scaling) - BorderImage{ id: frameimage anchors.centerIn: parent diff --git a/app/qml/main.qml b/app/qml/main.qml index 47f42f2..4071404 100644 --- a/app/qml/main.qml +++ b/app/qml/main.qml @@ -153,9 +153,6 @@ ApplicationWindow{ Loader{ id: frame anchors.fill: parent - - property rect sourceRect: item.sourceRect - z: 2.1 source: shadersettings.frame_source }