Moved engine from yat to konsole and refactored the project. Not everything works yet.
This commit is contained in:
20
app/frames/BlackRoughFrame.qml
Normal file
20
app/frames/BlackRoughFrame.qml
Normal file
@@ -0,0 +1,20 @@
|
||||
import QtQuick 2.1
|
||||
import "utils"
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
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"
|
||||
sourceRect: Qt.rect(-80, -90, terminal.width + 160, terminal.height + 180)
|
||||
|
||||
shaderString: "WhiteFrameShader.qml"
|
||||
}
|
||||
18
app/frames/NoFrame.qml
Normal file
18
app/frames/NoFrame.qml
Normal file
@@ -0,0 +1,18 @@
|
||||
import QtQuick 2.0
|
||||
import "utils"
|
||||
|
||||
TerminalFrame{
|
||||
id: frame
|
||||
z: 2.1
|
||||
anchors.fill: parent
|
||||
addedWidth: 190
|
||||
addedHeight: 190
|
||||
borderLeft: 116
|
||||
borderRight: 116
|
||||
borderTop: 116
|
||||
borderBottom: 116
|
||||
imageSource: "../images/screen-frame.png"
|
||||
sourceRect: Qt.rect(-65, -75, terminal.width + 130, terminal.height + 150)
|
||||
|
||||
shaderString: "NoFrameShader.qml"
|
||||
}
|
||||
19
app/frames/WhiteSimpleFrame.qml
Normal file
19
app/frames/WhiteSimpleFrame.qml
Normal file
@@ -0,0 +1,19 @@
|
||||
import QtQuick 2.0
|
||||
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"
|
||||
sourceRect: Qt.rect(-65, -75, terminal.width + 130, terminal.height + 150)
|
||||
|
||||
shaderString: "WhiteFrameShader.qml"
|
||||
}
|
||||
BIN
app/frames/images/black-frame-normals.png
Normal file
BIN
app/frames/images/black-frame-normals.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
BIN
app/frames/images/black-frame.png
Normal file
BIN
app/frames/images/black-frame.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
BIN
app/frames/images/screen-frame-normals.png
Normal file
BIN
app/frames/images/screen-frame-normals.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 646 KiB |
BIN
app/frames/images/screen-frame.png
Normal file
BIN
app/frames/images/screen-frame.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 571 KiB |
23
app/frames/utils/NoFrameShader.qml
Normal file
23
app/frames/utils/NoFrameShader.qml
Normal file
@@ -0,0 +1,23 @@
|
||||
import QtQuick 2.1
|
||||
|
||||
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);
|
||||
}"
|
||||
}
|
||||
58
app/frames/utils/TerminalFrame.qml
Normal file
58
app/frames/utils/TerminalFrame.qml
Normal file
@@ -0,0 +1,58 @@
|
||||
import QtQuick 2.1
|
||||
|
||||
Item{
|
||||
id: framecontainer
|
||||
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 rect sourceRect
|
||||
property string shaderString
|
||||
|
||||
BorderImage{
|
||||
id: frameimage
|
||||
anchors.centerIn: parent
|
||||
width: parent.width + addedWidth
|
||||
height: parent.height + 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
|
||||
}
|
||||
ShaderEffectSource{
|
||||
id: framesourcenormals
|
||||
sourceItem: framenormals
|
||||
hideSource: true
|
||||
}
|
||||
Loader{
|
||||
anchors.fill: frameimage
|
||||
source: shaderString
|
||||
}
|
||||
}
|
||||
40
app/frames/utils/WhiteFrameShader.qml
Normal file
40
app/frames/utils/WhiteFrameShader.qml
Normal file
@@ -0,0 +1,40 @@
|
||||
import QtQuick 2.1
|
||||
|
||||
ShaderEffect{
|
||||
property variant source: framesource
|
||||
property variant normals: framesourcenormals
|
||||
property real screen_distorsion: shadersettings.screen_distortion
|
||||
property real ambient_light: shadersettings.ambient_light
|
||||
property color font_color: shadersettings.font_color
|
||||
property color background_color: shadersettings.background_color
|
||||
property real brightness: shadercontainer.brightness
|
||||
|
||||
fragmentShader: "
|
||||
uniform sampler2D source;
|
||||
uniform sampler2D normals;
|
||||
uniform highp float screen_distorsion;
|
||||
uniform highp float ambient_light;
|
||||
|
||||
uniform highp vec4 font_color;
|
||||
uniform highp vec4 background_color;
|
||||
uniform highp 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);
|
||||
}
|
||||
|
||||
void main(){
|
||||
vec2 coords = distortCoordinates(qt_TexCoord0);
|
||||
vec4 txt_color = texture2D(source, coords);
|
||||
vec4 normala = texture2D(normals, coords);
|
||||
vec3 normal = normalize(normala.rgb) * txt_color.a;
|
||||
float reflection = dot(normal, vec3(1.0, 1.0, 0.0)) * 0.4 * brightness;
|
||||
vec3 reflection_color = mix(font_color, background_color, 0.7).rgb * reflection;
|
||||
vec3 final_color = mix(txt_color.rgb, reflection_color, 1.0 - ambient_light);
|
||||
gl_FragColor = vec4(final_color, txt_color.a);
|
||||
}"
|
||||
}
|
||||
Reference in New Issue
Block a user