1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-02-21 04:19:00 +00:00

Fix: screen curvature is now consistent across all screen sizes. Close #176.

This commit is contained in:
Filippo Scognamiglio 2014-12-20 18:33:31 +01:00
parent c06b3db71e
commit 6832b32741
3 changed files with 6 additions and 10 deletions

View File

@ -14,8 +14,6 @@ TerminalFrame{
imageSource: "../images/black-frame.png"
normalsSource: "../images/black-frame-normals.png"
distortionCoefficient: 1.9
displacementLeft: 80.0
displacementTop: 65.0
displacementRight: 80.0

View File

@ -14,8 +14,6 @@ TerminalFrame{
imageSource: "../images/screen-frame.png"
normalsSource: "../images/screen-frame-normals.png"
distortionCoefficient: 1.5
displacementLeft: 55
displacementTop: 50
displacementRight: 55

View File

@ -5,8 +5,8 @@ import "../../utils.js" as Utils
Item{
id: framecontainer
property int textureWidth: terminalWindow.width
property int textureHeight: terminalWindow.height
property int textureWidth: terminalContainer.width
property int textureHeight: terminalContainer.height
property int addedWidth
property int addedHeight
@ -28,8 +28,6 @@ Item{
property real staticDiffuseComponent: 0.7
property real dinamycDiffuseComponent: 1.0
property real distortionCoefficient
BorderImage{
id: frameimage
anchors.centerIn: parent
@ -105,7 +103,8 @@ Item{
id: staticLight
property alias source: framesource
property alias normals: framesourcenormals
property real screen_distorsion: appSettings.screen_distortion * framecontainer.distortionCoefficient
property real screen_distorsion: appSettings.screen_distortion
property size curvature_coefficients: Qt.size(width / mainShader.width, height / mainShader.height)
property real ambient_light: appSettings.ambient_light
property color font_color: appSettings.font_color
property color background_color: appSettings.background_color
@ -122,6 +121,7 @@ Item{
uniform highp sampler2D normals;
uniform highp sampler2D source;
uniform lowp float screen_distorsion;
uniform highp vec2 curvature_coefficients;
uniform lowp float ambient_light;
uniform highp float qt_Opacity;
uniform lowp vec4 reflectionColor;
@ -130,7 +130,7 @@ Item{
varying highp vec2 qt_TexCoord0;
vec2 distortCoordinates(vec2 coords){
vec2 cc = coords - vec2(0.5);
vec2 cc = (coords - vec2(0.5)) * curvature_coefficients;
float dist = dot(cc, cc) * screen_distorsion;
return (coords + cc * (1.0 + dist) * dist);
}