Refactoring of build system and use of native executable instead of qmlscene.
28
app/qml/frames/BlackRoughFrame.qml
Normal file
@@ -0,0 +1,28 @@
|
||||
import QtQuick 2.2
|
||||
import "utils"
|
||||
|
||||
TerminalFrame{
|
||||
id: frame
|
||||
z: 2.1
|
||||
anchors.fill: parent
|
||||
addedWidth: 200
|
||||
addedHeight: 370
|
||||
borderLeft: 148
|
||||
borderRight: 148
|
||||
borderTop: 232
|
||||
borderBottom: 232
|
||||
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
|
||||
|
||||
shaderString: "FrameShader.qml"
|
||||
}
|
||||
22
app/qml/frames/NoFrame.qml
Normal file
@@ -0,0 +1,22 @@
|
||||
import QtQuick 2.2
|
||||
import "utils"
|
||||
|
||||
TerminalFrame{
|
||||
id: frame
|
||||
z: 2.1
|
||||
anchors.fill: parent
|
||||
addedWidth: 0
|
||||
addedHeight: 0
|
||||
borderLeft: 0
|
||||
borderRight: 0
|
||||
borderTop: 0
|
||||
borderBottom: 0
|
||||
|
||||
rectX: 15
|
||||
rectY: 15
|
||||
|
||||
displacementLeft: 0
|
||||
displacementTop: 0
|
||||
displacementRight: 0
|
||||
displacementBottom: 0
|
||||
}
|
||||
28
app/qml/frames/WhiteSimpleFrame.qml
Normal file
@@ -0,0 +1,28 @@
|
||||
import QtQuick 2.2
|
||||
import "utils"
|
||||
|
||||
TerminalFrame{
|
||||
id: frame
|
||||
z: 2.1
|
||||
anchors.fill: parent
|
||||
addedWidth: 140
|
||||
addedHeight: 140
|
||||
borderLeft: 116
|
||||
borderRight: 116
|
||||
borderTop: 116
|
||||
borderBottom: 116
|
||||
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
|
||||
|
||||
shaderString: "FrameShader.qml"
|
||||
}
|
||||
BIN
app/qml/frames/images/black-frame-normals.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
app/qml/frames/images/black-frame-original.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
app/qml/frames/images/black-frame.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
app/qml/frames/images/randfunction.png
Normal file
|
After Width: | Height: | Size: 132 KiB |
BIN
app/qml/frames/images/screen-frame-normals.png
Normal file
|
After Width: | Height: | Size: 507 KiB |
BIN
app/qml/frames/images/screen-frame-original.png
Normal file
|
After Width: | Height: | Size: 571 KiB |
BIN
app/qml/frames/images/screen-frame.png
Normal file
|
After Width: | Height: | Size: 811 KiB |
102
app/qml/frames/utils/FrameShader.qml
Normal file
@@ -0,0 +1,102 @@
|
||||
import QtQuick 2.2
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
ShaderEffect{
|
||||
property variant source: framesource
|
||||
property variant normals: framesourcenormals
|
||||
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
|
||||
property real brightness: shadersettings.brightness * 1.5 + 0.5
|
||||
|
||||
property bool frameReflections: shadersettings.frameReflections
|
||||
property variant lightSource: reflectionEffectSourceLoader.item
|
||||
|
||||
property real chroma_color: shadersettings.chroma_color
|
||||
|
||||
Loader{
|
||||
id: reflectionEffectLoader
|
||||
width: parent.width * 0.33
|
||||
height: parent.height * 0.33
|
||||
active: frameReflections
|
||||
|
||||
sourceComponent: FastBlur{
|
||||
id: frameReflectionEffect
|
||||
radius: 128
|
||||
source: terminal.kterminal
|
||||
smooth: false
|
||||
}
|
||||
}
|
||||
|
||||
Loader{
|
||||
id: reflectionEffectSourceLoader
|
||||
active: frameReflections
|
||||
sourceComponent: ShaderEffectSource{
|
||||
id: frameReflectionSource
|
||||
sourceItem: reflectionEffectLoader.item
|
||||
hideSource: true
|
||||
smooth: true
|
||||
}
|
||||
}
|
||||
|
||||
blending: true
|
||||
|
||||
fragmentShader: "
|
||||
uniform sampler2D source;
|
||||
uniform sampler2D normals;
|
||||
uniform highp float screen_distorsion;
|
||||
uniform highp float ambient_light;
|
||||
uniform highp float qt_Opacity;
|
||||
uniform lowp float chroma_color;" +
|
||||
|
||||
(frameReflections ?
|
||||
"uniform sampler2D lightSource;" : "") + "
|
||||
|
||||
uniform vec4 font_color;
|
||||
uniform vec4 background_color;
|
||||
varying lowp float brightness;
|
||||
|
||||
varying highp vec2 qt_TexCoord0;
|
||||
|
||||
vec2 distortCoordinates(vec2 coords){
|
||||
vec2 cc = coords - vec2(0.5);
|
||||
float dist = dot(cc, cc) * screen_distorsion;
|
||||
return (coords + cc * (1.0 + dist) * dist);
|
||||
}
|
||||
|
||||
float rgb2grey(vec3 v){
|
||||
return dot(v, vec3(0.21, 0.72, 0.04));
|
||||
}
|
||||
|
||||
void main(){
|
||||
vec2 coords = distortCoordinates(qt_TexCoord0);
|
||||
vec4 txt_color = texture2D(source, coords);
|
||||
vec4 txt_normal = texture2D(normals, coords);
|
||||
vec3 normal = normalize(txt_normal.rgb * 2.0 - 1.0);
|
||||
vec3 light_direction = normalize(vec3(0.5, 0.5, 0.0) - vec3(qt_TexCoord0, 0.0));
|
||||
|
||||
float dotProd = dot(normal, light_direction);" +
|
||||
|
||||
(frameReflections ? "
|
||||
vec3 realLightColor = texture2D(lightSource, coords).rgb;
|
||||
float screenLight = rgb2grey(realLightColor);
|
||||
float clampedDotProd = clamp(dotProd, 0.05, 1.0);
|
||||
float diffuseReflection = clamp(screenLight * 1.5 * clampedDotProd, 0.0, 0.35);
|
||||
float reflectionAlpha = mix(1.0, 0.90, dotProd);
|
||||
vec3 lightColor = mix(font_color.rgb * screenLight, font_color.rgb * realLightColor, chroma_color);"
|
||||
: "
|
||||
float diffuseReflection = 0.0;
|
||||
float reflectionAlpha = 1.0;
|
||||
vec3 lightColor = font_color.rgb;") + "
|
||||
|
||||
|
||||
vec3 back_color = background_color.rgb * (0.2 + 0.5 * dotProd);
|
||||
vec3 front_color = lightColor * (0.05 + diffuseReflection);
|
||||
|
||||
vec4 dark_color = vec4((back_color + front_color) * txt_normal.a, txt_normal.a * reflectionAlpha);
|
||||
gl_FragColor = mix(dark_color, txt_color, ambient_light);
|
||||
}"
|
||||
|
||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||
}
|
||||
23
app/qml/frames/utils/NoFrameShader.qml
Normal file
@@ -0,0 +1,23 @@
|
||||
import QtQuick 2.2
|
||||
|
||||
ShaderEffect{
|
||||
property variant source: framesource
|
||||
property real screen_distorsion: shadersettings.screen_distortion
|
||||
|
||||
fragmentShader: "
|
||||
uniform sampler2D source;
|
||||
uniform highp float screen_distorsion;
|
||||
varying highp vec2 qt_TexCoord0;
|
||||
|
||||
vec2 distortCoordinates(vec2 coords){
|
||||
vec2 cc = coords - vec2(0.5);
|
||||
float dist = dot(cc, cc) * screen_distorsion;
|
||||
return (coords + cc * (1.0 + dist) * dist);
|
||||
}
|
||||
|
||||
void main(){
|
||||
vec2 coords = distortCoordinates(qt_TexCoord0);
|
||||
float inside = texture2D(source, coords).a;
|
||||
gl_FragColor = vec4(vec3(0.0), inside);
|
||||
}"
|
||||
}
|
||||
81
app/qml/frames/utils/TerminalFrame.qml
Normal file
@@ -0,0 +1,81 @@
|
||||
import QtQuick 2.2
|
||||
|
||||
Item{
|
||||
id: framecontainer
|
||||
property int textureWidth: terminalWindow.width
|
||||
property int textureHeight: terminalWindow.height
|
||||
|
||||
property int addedWidth
|
||||
property int addedHeight
|
||||
property int borderLeft
|
||||
property int borderRight
|
||||
property int borderTop
|
||||
property int borderBottom
|
||||
property string imageSource
|
||||
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
|
||||
property real displacementRight
|
||||
property real displacementBottom
|
||||
|
||||
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
|
||||
width: textureWidth + addedWidth
|
||||
height: textureHeight + addedHeight
|
||||
|
||||
border.bottom: borderBottom
|
||||
border.top: borderTop
|
||||
border.left: borderLeft
|
||||
border.right: borderRight
|
||||
|
||||
source: imageSource
|
||||
horizontalTileMode: BorderImage.Stretch
|
||||
verticalTileMode: BorderImage.Stretch
|
||||
}
|
||||
BorderImage{
|
||||
id: framenormals
|
||||
anchors.fill: frameimage
|
||||
|
||||
border.bottom: borderBottom
|
||||
border.top: borderTop
|
||||
border.left: borderLeft
|
||||
border.right: borderRight
|
||||
|
||||
source: normalsSource
|
||||
horizontalTileMode: BorderImage.Stretch
|
||||
verticalTileMode: BorderImage.Stretch
|
||||
}
|
||||
ShaderEffectSource{
|
||||
id: framesource
|
||||
sourceItem: frameimage
|
||||
hideSource: true
|
||||
textureSize: Qt.size(parent.width, parent.height)
|
||||
}
|
||||
ShaderEffectSource{
|
||||
id: framesourcenormals
|
||||
sourceItem: framenormals
|
||||
hideSource: true
|
||||
textureSize: Qt.size(parent.width, parent.height)
|
||||
}
|
||||
Loader{
|
||||
anchors.centerIn: parent
|
||||
width: parent.width + (addedWidth / textureWidth) * parent.width
|
||||
height: parent.height + (addedHeight / textureHeight) * parent.height
|
||||
source: shaderString
|
||||
}
|
||||
}
|
||||