Added realtime reflections on the frame. They are a little bit hacky but don't have any impact on performances.
This commit is contained in:
@@ -14,10 +14,17 @@ TerminalFrame{
|
||||
borderBottom: 232
|
||||
imageSource: "../images/black-frame.png"
|
||||
normalsSource: "../images/black-frame-normals.png"
|
||||
sourceRect: Qt.rect(-80 * shadersettings.total_scaling,
|
||||
-90 * shadersettings.total_scaling,
|
||||
terminal.width + 160 * shadersettings.total_scaling,
|
||||
terminal.height + 180 * shadersettings.total_scaling)
|
||||
sourceRect: Qt.rect(-15 * shadersettings.total_scaling,
|
||||
-15 * shadersettings.total_scaling,
|
||||
terminal.width + 30 * shadersettings.total_scaling,
|
||||
terminal.height + 30 * shadersettings.total_scaling)
|
||||
|
||||
distortionCoefficient: 1.8
|
||||
|
||||
displacementLeft: 70.0
|
||||
displacementTop: 55.0
|
||||
displacementRight: 50.0
|
||||
displacementBottom: 38.0
|
||||
|
||||
shaderString: "FrameShader.qml"
|
||||
}
|
||||
|
||||
@@ -15,4 +15,9 @@ TerminalFrame{
|
||||
-15,
|
||||
terminal.width + 15,
|
||||
terminal.height + 15)
|
||||
|
||||
displacementLeft: 0
|
||||
displacementTop: 0
|
||||
displacementRight: 0
|
||||
displacementBottom: 0
|
||||
}
|
||||
|
||||
@@ -13,10 +13,17 @@ TerminalFrame{
|
||||
borderBottom: 116
|
||||
imageSource: "../images/screen-frame.png"
|
||||
normalsSource: "../images/screen-frame-normals.png"
|
||||
sourceRect: Qt.rect(-65 * shadersettings.total_scaling,
|
||||
-75 * shadersettings.total_scaling,
|
||||
terminal.width + 130 * shadersettings.total_scaling,
|
||||
terminal.height + 150 * shadersettings.total_scaling)
|
||||
sourceRect: Qt.rect(-10 * shadersettings.total_scaling,
|
||||
-5 * shadersettings.total_scaling,
|
||||
terminal.width + 20 * shadersettings.total_scaling,
|
||||
terminal.height+ 10 * shadersettings.total_scaling)
|
||||
|
||||
distortionCoefficient: 1.3
|
||||
|
||||
displacementLeft: 43.0
|
||||
displacementTop: 40.0
|
||||
displacementRight: 35.0
|
||||
displacementBottom: 32.0
|
||||
|
||||
shaderString: "FrameShader.qml"
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import QtQuick 2.1
|
||||
ShaderEffect{
|
||||
property variant source: framesource
|
||||
property variant normals: framesourcenormals
|
||||
property real screen_distorsion: shadersettings.screen_distortion
|
||||
property real screen_distorsion: shadersettings.screen_distortion * framecontainer.distortionCoefficient
|
||||
property real ambient_light: shadersettings.ambient_light
|
||||
property color font_color: shadersettings.font_color
|
||||
property color background_color: shadersettings.background_color
|
||||
@@ -12,6 +12,8 @@ ShaderEffect{
|
||||
property real brightness_flickering: shadersettings.brightness_flickering
|
||||
property real brightness: shadersettings.brightness * 1.5 + 0.5
|
||||
|
||||
property real frame_reflection_strength: shadersettings.frame_reflection_strength
|
||||
|
||||
property color reflection_color: Qt.rgba((font_color.r*0.3 + background_color.r*0.7),
|
||||
(font_color.g*0.3 + background_color.g*0.7),
|
||||
(font_color.b*0.3 + background_color.b*0.7),
|
||||
@@ -62,10 +64,12 @@ ShaderEffect{
|
||||
vec4 txt_normal = texture2D(normals, coords);
|
||||
vec3 normal = normalize(txt_normal.rgb * 2.0 - 1.0);
|
||||
vec3 light_dir = normalize(vec3(0.5,0.5, 0.0) - vec3(qt_TexCoord0, 0.0));
|
||||
float reflection = (dot(normal, light_dir) * 0.4 + 0.2) * brightness;
|
||||
vec3 final_color = reflection_color.rgb * reflection * 0.5;
|
||||
float reflection = (dot(normal, light_dir));
|
||||
float light = (reflection * 0.4 + 0.2) * brightness;
|
||||
vec3 final_color = reflection_color.rgb * light * 0.5;
|
||||
final_color += txt_color.rgb * ambient_light;
|
||||
gl_FragColor = vec4(final_color * txt_normal.a, txt_color.a * qt_Opacity);
|
||||
float reflection_alpha = (1.0 - reflection*0.4);
|
||||
gl_FragColor = vec4(final_color * txt_normal.a, txt_color.a * qt_Opacity * reflection_alpha);
|
||||
}"
|
||||
|
||||
onStatusChanged: console.log(log) //Print warning messages
|
||||
|
||||
@@ -13,6 +13,14 @@ Item{
|
||||
property rect sourceRect
|
||||
property string shaderString
|
||||
|
||||
//Values used to displace the texture in the screen. Used to make reflections correct.
|
||||
property real displacementLeft
|
||||
property real displacementTop
|
||||
property real displacementRight
|
||||
property real displacementBottom
|
||||
|
||||
property real distortionCoefficient
|
||||
|
||||
BorderImage{
|
||||
id: frameimage
|
||||
anchors.centerIn: parent
|
||||
|
||||
Reference in New Issue
Block a user