1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-04-19 17:20:45 +01:00

Resore frames functionalities.

This commit is contained in:
Filippo Scognamiglio 2014-09-14 00:45:34 +02:00
parent bc87df170b
commit b4bf29dc9e
7 changed files with 30 additions and 44 deletions

View File

@ -167,6 +167,7 @@ Item{
sourceItem: kterminal sourceItem: kterminal
hideSource: true hideSource: true
smooth: mScanlines == shadersettings.no_rasterization smooth: mScanlines == shadersettings.no_rasterization
wrapMode: ShaderEffectSource.ClampToEdge
} }
Loader{ Loader{
id: blurredSourceLoader id: blurredSourceLoader
@ -178,6 +179,7 @@ Item{
recursive: true recursive: true
live: false live: false
hideSource: true hideSource: true
wrapMode: kterminalSource.wrapMode
smooth: mScanlines == shadersettings.no_rasterization smooth: mScanlines == shadersettings.no_rasterization
@ -275,6 +277,7 @@ Item{
sourceItem: bloomEffectLoader.item sourceItem: bloomEffectLoader.item
hideSource: true hideSource: true
smooth: false smooth: false
wrapMode: ShaderEffectSource.ClampToEdge
} }
} }
@ -445,5 +448,6 @@ Item{
sourceItem: rasterizationEffect sourceItem: rasterizationEffect
hideSource: true hideSource: true
smooth: true smooth: true
wrapMode: ShaderEffectSource.Repeat
} }
} }

View File

@ -29,7 +29,6 @@ ShaderEffect {
property variant bloomSource: terminal.bloomSource property variant bloomSource: terminal.bloomSource
property variant rasterizationSource: terminal.rasterizationSource property variant rasterizationSource: terminal.rasterizationSource
property variant noiseSource: terminal.staticNoiseSource 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 bloom_strength: shadersettings.bloom_strength * 2.5
property real jitter: shadersettings.jitter * 0.007 property real jitter: shadersettings.jitter * 0.007
@ -47,10 +46,10 @@ ShaderEffect {
property bool frameReflections: shadersettings.frameReflections property bool frameReflections: shadersettings.frameReflections
property real disp_top: frame.item.displacementTop * shadersettings.window_scaling property real disp_top: frame.item.displacementTop / height
property real disp_bottom: frame.item.displacementBottom * shadersettings.window_scaling property real disp_bottom: frame.item.displacementBottom / height
property real disp_left: frame.item.displacementLeft * shadersettings.window_scaling property real disp_left: frame.item.displacementLeft / width
property real disp_right: frame.item.displacementRight * shadersettings.window_scaling property real disp_right: frame.item.displacementRight / width
property real screen_brightness: shadersettings.brightness * 1.5 + 0.5 property real screen_brightness: shadersettings.brightness * 1.5 + 0.5
@ -86,7 +85,11 @@ ShaderEffect {
uniform highp mat4 qt_Matrix; uniform highp mat4 qt_Matrix;
uniform highp float time; uniform highp float time;
uniform sampler2D randomFunctionSource; 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 vec4 qt_Vertex;
attribute highp vec2 qt_MultiTexCoord0; attribute highp vec2 qt_MultiTexCoord0;
@ -101,7 +104,8 @@ ShaderEffect {
uniform lowp float horizontal_sincronization;" : "") + uniform lowp float horizontal_sincronization;" : "") +
" "
void main() { 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)));" + vec2 coords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));" +
(brightness_flickering !== 0.0 ? " (brightness_flickering !== 0.0 ? "
brightness = 1.0 + (texture2D(randomFunctionSource, coords).g - 0.5) * brightness_flickering;" brightness = 1.0 + (texture2D(randomFunctionSource, coords).g - 0.5) * brightness_flickering;"
@ -120,7 +124,6 @@ ShaderEffect {
uniform sampler2D source; uniform sampler2D source;
uniform highp float qt_Opacity; uniform highp float qt_Opacity;
uniform highp float time; uniform highp float time;
uniform highp vec2 txt_Size;
varying highp vec2 qt_TexCoord0; varying highp vec2 qt_TexCoord0;
uniform highp vec4 font_color; uniform highp vec4 font_color;
@ -172,9 +175,9 @@ ShaderEffect {
:" :"
vec2 coords = qt_TexCoord0;") + vec2 coords = qt_TexCoord0;") +
(frameReflections ? " // (frameReflections ? "
vec2 inside = step(0.0, coords) - step(1.0, coords); // 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);" : "") + // coords = abs(mod(floor(coords), 2.0) - fract(coords)) * clamp(inside.x + inside.y, 0.0, 1.0);" : "") +
(horizontal_sincronization !== 0 ? " (horizontal_sincronization !== 0 ? "
float h_distortion = 0.5 * sin(time*0.001 + coords.y*10.0*fract(time/10.0)); float h_distortion = 0.5 * sin(time*0.001 + coords.y*10.0*fract(time/10.0));

View File

@ -7,22 +7,19 @@ TerminalFrame{
anchors.fill: parent anchors.fill: parent
addedWidth: 200 addedWidth: 200
addedHeight: 370 addedHeight: 370
borderLeft: 148 borderLeft: 170
borderRight: 148 borderRight: 170
borderTop: 232 borderTop: 250
borderBottom: 232 borderBottom: 250
imageSource: "../images/black-frame.png" imageSource: "../images/black-frame.png"
normalsSource: "../images/black-frame-normals.png" normalsSource: "../images/black-frame-normals.png"
rectX: 20
rectY: 20
distortionCoefficient: 1.9 distortionCoefficient: 1.9
displacementLeft: 70.0 displacementLeft: 80.0
displacementTop: 55.0 displacementTop: 65.0
displacementRight: 50.0 displacementRight: 80.0
displacementBottom: 38.0 displacementBottom: 65.0
shaderString: "FrameShader.qml" shaderString: "FrameShader.qml"
} }

View File

@ -12,9 +12,6 @@ TerminalFrame{
borderTop: 0 borderTop: 0
borderBottom: 0 borderBottom: 0
rectX: 15
rectY: 15
displacementLeft: 0 displacementLeft: 0
displacementTop: 0 displacementTop: 0
displacementRight: 0 displacementRight: 0

View File

@ -14,15 +14,12 @@ TerminalFrame{
imageSource: "../images/screen-frame.png" imageSource: "../images/screen-frame.png"
normalsSource: "../images/screen-frame-normals.png" normalsSource: "../images/screen-frame-normals.png"
rectX: 15
rectY: 15
distortionCoefficient: 1.5 distortionCoefficient: 1.5
displacementLeft: 45 displacementLeft: 55
displacementTop: 40 displacementTop: 50
displacementRight: 38.0 displacementRight: 55
displacementBottom: 28.0 displacementBottom: 50
shaderString: "FrameShader.qml" shaderString: "FrameShader.qml"
} }

View File

@ -15,10 +15,6 @@ Item{
property string normalsSource property string normalsSource
property string shaderString 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. //Values used to displace the texture in the screen. Used to make reflections correct.
property real displacementLeft property real displacementLeft
property real displacementTop property real displacementTop
@ -27,11 +23,6 @@ Item{
property real distortionCoefficient 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{ BorderImage{
id: frameimage id: frameimage
anchors.centerIn: parent anchors.centerIn: parent

View File

@ -153,9 +153,6 @@ ApplicationWindow{
Loader{ Loader{
id: frame id: frame
anchors.fill: parent anchors.fill: parent
property rect sourceRect: item.sourceRect
z: 2.1 z: 2.1
source: shadersettings.frame_source source: shadersettings.frame_source
} }