mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-04-15 23:30:50 +01:00
Merge pull request #184 from Swordfish90/refactoring
Many many fixes and optimizations. Texture scaling now dramatically improve performances, various shader optimizations, improved static noise and horizontal distortion and more...
This commit is contained in:
commit
9fc73468a2
@ -37,6 +37,7 @@ int main(int argc, char *argv[])
|
||||
qDebug() << " --fullscreen Run cool-retro-term in fullscreen.";
|
||||
qDebug() << " -p|--profile <prof> Run cool-retro-term with the given profile.";
|
||||
qDebug() << " -h|--help Print this help.";
|
||||
qDebug() << " --verbose Print additional informations such as profiles and settings.";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,8 @@ import QtQuick.Window 2.0
|
||||
Window{
|
||||
id: dialogwindow
|
||||
title: qsTr("About")
|
||||
width: 450
|
||||
height: 300
|
||||
width: 600
|
||||
height: 400
|
||||
|
||||
ColumnLayout{
|
||||
anchors.fill: parent
|
||||
@ -64,20 +64,18 @@ Window{
|
||||
ColumnLayout{
|
||||
anchors.fill: parent
|
||||
spacing: 10
|
||||
Item{
|
||||
Layout.fillHeight: true
|
||||
Image{
|
||||
Layout.fillWidth: true
|
||||
Image{
|
||||
anchors.fill: parent
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: "images/crt256.png"
|
||||
smooth: true
|
||||
}
|
||||
Layout.fillHeight: true
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: "images/crt256.png"
|
||||
smooth: true
|
||||
}
|
||||
Text{
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: shadersettings.version + "\n" +
|
||||
text: appSettings.version + "\n" +
|
||||
qsTr("Author: ") + "Filippo Scognamiglio\n" +
|
||||
qsTr("Email: ") + "flscogna@gmail.com\n" +
|
||||
qsTr("Source: ") + "https://github.com/Swordfish90/cool-retro-term\n"
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
import QtQuick 2.2
|
||||
|
||||
|
||||
import "utils.js" as Utils
|
||||
|
||||
Item{
|
||||
property string version: "0.9"
|
||||
@ -36,32 +36,20 @@ Item{
|
||||
property real brightness: 0.5
|
||||
|
||||
property bool show_terminal_size: true
|
||||
|
||||
property real window_scaling: 1.0
|
||||
onWindow_scalingChanged: handleFontChanged();
|
||||
|
||||
property real fps: 24
|
||||
property bool verbose: false
|
||||
|
||||
function mix(c1, c2, alpha){
|
||||
return Qt.rgba(c1.r * alpha + c2.r * (1-alpha),
|
||||
c1.g * alpha + c2.g * (1-alpha),
|
||||
c1.b * alpha + c2.b * (1-alpha),
|
||||
c1.a * alpha + c2.a * (1-alpha))
|
||||
}
|
||||
function strToColor(s){
|
||||
var r = parseInt(s.substring(1,3), 16) / 256;
|
||||
var g = parseInt(s.substring(3,5), 16) / 256;
|
||||
var b = parseInt(s.substring(5,7), 16) / 256;
|
||||
return Qt.rgba(r, g, b, 1.0);
|
||||
}
|
||||
onWindow_scalingChanged: handleFontChanged();
|
||||
|
||||
// PROFILE SETTINGS ///////////////////////////////////////////////////////
|
||||
|
||||
property string _background_color: "#000000"
|
||||
property string _font_color: "#ff8100"
|
||||
property string saturated_color: mix(strToColor("#FFFFFF"), strToColor(_font_color), saturation_color * 0.5)
|
||||
property color font_color: mix(strToColor(saturated_color), strToColor(_background_color), 0.7 + (contrast * 0.3))
|
||||
property color background_color: mix(strToColor(_background_color), strToColor(saturated_color), 0.7 + (contrast * 0.3))
|
||||
property string saturated_color: Utils.mix(Utils.strToColor("#FFFFFF"), Utils.strToColor(_font_color), saturation_color * 0.5)
|
||||
property color font_color: Utils.mix(Utils.strToColor(saturated_color), Utils.strToColor(_background_color), 0.7 + (contrast * 0.3))
|
||||
property color background_color: Utils.mix(Utils.strToColor(_background_color), Utils.strToColor(saturated_color), 0.7 + (contrast * 0.3))
|
||||
|
||||
property real noise_strength: 0.1
|
||||
property real screen_distortion: 0.1
|
||||
@ -69,7 +57,7 @@ Item{
|
||||
property real motion_blur: 0.40
|
||||
property real bloom_strength: 0.65
|
||||
|
||||
property real bloom_quality: 1.0
|
||||
property real bloom_quality: 0.5
|
||||
|
||||
property real chroma_color: 0.0
|
||||
property real saturation_color: 0.0
|
||||
@ -87,9 +75,6 @@ Item{
|
||||
|
||||
property int rasterization: no_rasterization
|
||||
|
||||
property int scanline_quality: 2
|
||||
onScanline_qualityChanged: handleFontChanged();
|
||||
|
||||
ListModel{
|
||||
id: framelist
|
||||
ListElement{text: "No frame"; source: "./frames/NoFrame.qml"; reflections: false}
|
||||
@ -104,7 +89,13 @@ Item{
|
||||
|
||||
// FONTS //////////////////////////////////////////////////////////////////
|
||||
|
||||
signal terminalFontChanged(string fontSource, int pixelSize, int lineSpacing, real screenScaling)
|
||||
property real fontScaling: 1.0
|
||||
property real fontWidth: 1.0
|
||||
|
||||
property var fontIndexes: [0,0,0]
|
||||
property var fontlist: fontManager.item.fontlist
|
||||
|
||||
signal terminalFontChanged(string fontSource, int pixelSize, int lineSpacing, real screenScaling, real fontWidth)
|
||||
|
||||
Loader{
|
||||
id: fontManager
|
||||
@ -121,8 +112,8 @@ Item{
|
||||
onLoaded: handleFontChanged()
|
||||
}
|
||||
|
||||
property real fontScaling: 1.0
|
||||
onFontScalingChanged: handleFontChanged();
|
||||
onFontWidthChanged: handleFontChanged();
|
||||
|
||||
function incrementScaling(){
|
||||
fontScaling = Math.min(fontScaling + 0.05, 2.50);
|
||||
@ -134,12 +125,6 @@ Item{
|
||||
handleFontChanged();
|
||||
}
|
||||
|
||||
property real fontWidth: 1.0
|
||||
onFontWidthChanged: handleFontChanged();
|
||||
|
||||
property var fontIndexes: [0,0,0]
|
||||
property var fontlist: fontManager.item.fontlist
|
||||
|
||||
function handleFontChanged(){
|
||||
if(!fontManager.item) return;
|
||||
fontManager.item.selectedFontIndex = fontIndexes[rasterization];
|
||||
@ -149,8 +134,9 @@ Item{
|
||||
var pixelSize = fontManager.item.pixelSize;
|
||||
var lineSpacing = fontManager.item.lineSpacing;
|
||||
var screenScaling = fontManager.item.screenScaling;
|
||||
var fontWidth = fontManager.item.defaultFontWidth * appSettings.fontWidth;
|
||||
|
||||
terminalFontChanged(fontSource, pixelSize, lineSpacing, screenScaling);
|
||||
terminalFontChanged(fontSource, pixelSize, lineSpacing, screenScaling, fontWidth);
|
||||
}
|
||||
|
||||
// FRAMES /////////////////////////////////////////////////////////////////
|
||||
@ -166,6 +152,13 @@ Item{
|
||||
|
||||
Storage{id: storage}
|
||||
|
||||
function stringify(obj) {
|
||||
var replacer = function(key, val) {
|
||||
return val.toFixed ? Number(val.toFixed(4)) : val;
|
||||
}
|
||||
return JSON.stringify(obj, replacer, 2);
|
||||
}
|
||||
|
||||
function composeSettingsString(){
|
||||
var settings = {
|
||||
fps: fps,
|
||||
@ -175,10 +168,9 @@ Item{
|
||||
fontIndexes: fontIndexes,
|
||||
frameReflections: _frameReflections,
|
||||
showMenubar: showMenubar,
|
||||
scanline_quality: scanline_quality,
|
||||
bloom_quality: bloom_quality
|
||||
}
|
||||
return JSON.stringify(settings);
|
||||
return stringify(settings);
|
||||
}
|
||||
|
||||
function composeProfileString(){
|
||||
@ -205,7 +197,7 @@ Item{
|
||||
fontIndex: fontIndexes[rasterization],
|
||||
fontWidth: fontWidth
|
||||
}
|
||||
return JSON.stringify(settings);
|
||||
return stringify(settings);
|
||||
}
|
||||
|
||||
function loadSettings(){
|
||||
@ -218,7 +210,8 @@ Item{
|
||||
loadSettingsString(settingsString);
|
||||
loadProfileString(profileString);
|
||||
|
||||
console.log("Loading settings: " + settingsString + profileString);
|
||||
if (verbose)
|
||||
console.log("Loading settings: " + settingsString + profileString);
|
||||
}
|
||||
|
||||
function storeSettings(){
|
||||
@ -228,8 +221,10 @@ Item{
|
||||
storage.setSetting("_CURRENT_SETTINGS", settingsString);
|
||||
storage.setSetting("_CURRENT_PROFILE", profileString);
|
||||
|
||||
console.log("Storing settings: " + settingsString);
|
||||
console.log("Storing profile: " + profileString);
|
||||
if (verbose) {
|
||||
console.log("Storing settings: " + settingsString);
|
||||
console.log("Storing profile: " + profileString);
|
||||
}
|
||||
}
|
||||
|
||||
function loadSettingsString(settingsString){
|
||||
@ -247,7 +242,6 @@ Item{
|
||||
|
||||
showMenubar = settings.showMenubar !== undefined ? settings.showMenubar : showMenubar;
|
||||
|
||||
scanline_quality = settings.scanline_quality !== undefined ? settings.scanline_quality : scanline_quality;
|
||||
bloom_quality = settings.bloom_quality !== undefined ? settings.bloom_quality : bloom_quality;
|
||||
}
|
||||
|
||||
@ -299,7 +293,7 @@ Item{
|
||||
var customProfiles = JSON.parse(customProfilesString);
|
||||
for (var i=0; i<customProfiles.length; i++) {
|
||||
var profile = customProfiles[i];
|
||||
console.log("Loading custom profile: " + JSON.stringify(profile));
|
||||
console.log("Loading custom profile: " + stringify(profile));
|
||||
profiles_list.append(profile);
|
||||
}
|
||||
}
|
||||
@ -311,7 +305,7 @@ Item{
|
||||
if(profile.builtin) continue;
|
||||
customProfiles.push({text: profile.text, obj_string: profile.obj_string, builtin: false})
|
||||
}
|
||||
return JSON.stringify(customProfiles);
|
||||
return stringify(customProfiles);
|
||||
}
|
||||
|
||||
function loadCurrentProfile(){
|
||||
@ -390,6 +384,9 @@ Item{
|
||||
Component.onCompleted: {
|
||||
// Manage the arguments from the QML side.
|
||||
var args = Qt.application.arguments;
|
||||
if (args.indexOf("--verbose") !== -1) {
|
||||
verbose = true;
|
||||
}
|
||||
if (args.indexOf("--default-settings") === -1) {
|
||||
loadSettings();
|
||||
}
|
||||
|
@ -31,12 +31,12 @@ MenuBar {
|
||||
title: qsTr("Profiles")
|
||||
visible: defaultMenuBar.visible
|
||||
Instantiator{
|
||||
model: shadersettings.profiles_list
|
||||
model: appSettings.profiles_list
|
||||
delegate: MenuItem {
|
||||
text: model.text
|
||||
onTriggered: {
|
||||
shadersettings.loadProfileString(obj_string);
|
||||
shadersettings.handleFontChanged();
|
||||
appSettings.loadProfileString(obj_string);
|
||||
appSettings.handleFontChanged();
|
||||
}
|
||||
}
|
||||
onObjectAdded: profilesMenu.insertItem(index, object)
|
||||
|
@ -29,6 +29,7 @@ Item{
|
||||
property int pixelSize: _font.pixelSize
|
||||
property int lineSpacing: _font.lineSpacing
|
||||
property real screenScaling: scaling * _font.baseScaling
|
||||
property real defaultFontWidth: fontlist.get(selectedFontIndex).fontWidth
|
||||
|
||||
ListModel{
|
||||
id: fontlist
|
||||
@ -38,6 +39,7 @@ Item{
|
||||
lineSpacing: 2
|
||||
pixelSize: 8
|
||||
baseScaling: 4.0
|
||||
fontWidth: 0.8
|
||||
}
|
||||
ListElement{
|
||||
text: "Apple ][ (1977)"
|
||||
@ -45,6 +47,7 @@ Item{
|
||||
lineSpacing: 2
|
||||
pixelSize: 8
|
||||
baseScaling: 4.0
|
||||
fontWidth: 0.9
|
||||
}
|
||||
ListElement{
|
||||
text: "Atari 400-800 (1979)"
|
||||
@ -52,6 +55,7 @@ Item{
|
||||
lineSpacing: 3
|
||||
pixelSize: 8
|
||||
baseScaling: 4.0
|
||||
fontWidth: 0.8
|
||||
}
|
||||
ListElement{
|
||||
text: "Commodore 64 (1982)"
|
||||
@ -59,6 +63,7 @@ Item{
|
||||
lineSpacing: 3
|
||||
pixelSize: 8
|
||||
baseScaling: 4.0
|
||||
fontWidth: 0.8
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ Item{
|
||||
property int pixelSize: _font.pixelSize
|
||||
property int lineSpacing: _font.lineSpacing
|
||||
property real screenScaling: scaling * _font.baseScaling
|
||||
property real defaultFontWidth: fontlist.get(selectedFontIndex).fontWidth
|
||||
|
||||
ListModel{
|
||||
id: fontlist
|
||||
@ -38,6 +39,7 @@ Item{
|
||||
lineSpacing: 2
|
||||
pixelSize: 8
|
||||
baseScaling: 4.0
|
||||
fontWidth: 0.7
|
||||
}
|
||||
ListElement{
|
||||
text: "Apple ][ (1977)"
|
||||
@ -45,6 +47,7 @@ Item{
|
||||
lineSpacing: 2
|
||||
pixelSize: 8
|
||||
baseScaling: 4.0
|
||||
fontWidth: 0.8
|
||||
}
|
||||
ListElement{
|
||||
text: "Atari 400-800 (1979)"
|
||||
@ -52,6 +55,7 @@ Item{
|
||||
lineSpacing: 3
|
||||
pixelSize: 8
|
||||
baseScaling: 4.0
|
||||
fontWidth: 0.7
|
||||
}
|
||||
ListElement{
|
||||
text: "Commodore 64 (1982)"
|
||||
@ -59,6 +63,7 @@ Item{
|
||||
lineSpacing: 3
|
||||
pixelSize: 8
|
||||
baseScaling: 4.0
|
||||
fontWidth: 0.7
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ Item{
|
||||
property int pixelSize: _font.pixelSize * scaling
|
||||
property int lineSpacing: pixelSize * _font.lineSpacing
|
||||
property real screenScaling: 1.0
|
||||
property real defaultFontWidth: fontlist.get(selectedFontIndex).fontWidth
|
||||
|
||||
//In this configuration lineSpacing is proportional to pixelSize.
|
||||
|
||||
@ -39,54 +40,56 @@ Item{
|
||||
source: "fonts/modern-terminus/TerminusTTF-Bold-4.38.2.ttf"
|
||||
lineSpacing: 0.2
|
||||
pixelSize: 35
|
||||
fontWidth: 1.0
|
||||
}
|
||||
ListElement{
|
||||
text: "Commodore PET (1977)"
|
||||
source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
|
||||
lineSpacing: 0.2
|
||||
pixelSize: 24
|
||||
}
|
||||
ListElement{
|
||||
text: "Commodore PET 2Y (1977)"
|
||||
source: "fonts/1977-commodore-pet/COMMODORE_PET_2y.ttf"
|
||||
lineSpacing: 0.2
|
||||
pixelSize: 32
|
||||
pixelSize: 26
|
||||
fontWidth: 0.7
|
||||
}
|
||||
ListElement{
|
||||
text: "Apple ][ (1977)"
|
||||
source: "fonts/1977-apple2/PrintChar21.ttf"
|
||||
lineSpacing: 0.2
|
||||
pixelSize: 24
|
||||
pixelSize: 26
|
||||
fontWidth: 0.8
|
||||
}
|
||||
ListElement{
|
||||
text: "Atari 400-800 (1979)"
|
||||
source: "fonts/1979-atari-400-800/ATARI400800_original.TTF"
|
||||
lineSpacing: 0.3
|
||||
pixelSize: 24
|
||||
pixelSize: 26
|
||||
fontWidth: 0.7
|
||||
}
|
||||
ListElement{
|
||||
text: "Commodore 64 (1982)"
|
||||
source: "fonts/1982-commodore64/C64_User_Mono_v1.0-STYLE.ttf"
|
||||
lineSpacing: 0.3
|
||||
pixelSize: 24
|
||||
pixelSize: 26
|
||||
fontWidth: 0.7
|
||||
}
|
||||
ListElement{
|
||||
text: "Atari ST (1985)"
|
||||
source: "fonts/1985-atari-st/AtariST8x16SystemFont.ttf"
|
||||
lineSpacing: 0.2
|
||||
pixelSize: 32
|
||||
fontWidth: 1.0
|
||||
}
|
||||
ListElement{
|
||||
text: "IBM DOS (1985)"
|
||||
source: "fonts/1985-ibm-pc-vga/Perfect DOS VGA 437.ttf"
|
||||
lineSpacing: 0.2
|
||||
pixelSize: 32
|
||||
fontWidth: 1.0
|
||||
}
|
||||
ListElement{
|
||||
text: "IBM 3278 (1971)"
|
||||
source: "fonts/1971-ibm-3278/3270Medium.ttf"
|
||||
lineSpacing: 0.2
|
||||
pixelSize: 32
|
||||
fontWidth: 1.0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ Window{
|
||||
}
|
||||
|
||||
function validateName(name){
|
||||
var profile_list = shadersettings.profiles_list;
|
||||
var profile_list = appSettings.profiles_list;
|
||||
if (name === "")
|
||||
return 1;
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
*******************************************************************************/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Controls 1.1
|
||||
|
||||
import QMLTermWidget 1.0
|
||||
@ -27,44 +26,27 @@ import QMLTermWidget 1.0
|
||||
Item{
|
||||
id: terminalContainer
|
||||
|
||||
//Frame displacement properties. This makes the terminal the same size of the texture.
|
||||
property real dtop: frame.item.displacementTop
|
||||
property real dleft:frame.item.displacementLeft
|
||||
property real dright: frame.item.displacementRight
|
||||
property real dbottom: frame.item.displacementBottom
|
||||
property size virtualResolution: Qt.size(kterminal.width, kterminal.height)
|
||||
property alias mainTerminal: kterminal
|
||||
property ShaderEffectSource mainSource: mBlur !== 0 ? blurredSourceLoader.item : kterminalSource
|
||||
|
||||
property real scaleTexture: 1.0
|
||||
property alias title: ksession.title
|
||||
|
||||
anchors.leftMargin: dleft
|
||||
anchors.rightMargin: dright
|
||||
anchors.topMargin: dtop
|
||||
anchors.bottomMargin: dbottom
|
||||
|
||||
property variant theSource: mBlur !== 0 ? blurredSourceLoader.item : kterminalSource
|
||||
property variant bloomSource: bloomSourceLoader.item
|
||||
property variant rasterizationSource: rasterizationEffectSource
|
||||
property variant staticNoiseSource: staticNoiseSource
|
||||
|
||||
property alias kterminal: kterminal
|
||||
|
||||
signal sizeChanged
|
||||
onWidthChanged: sizeChanged()
|
||||
onHeightChanged: sizeChanged()
|
||||
anchors.leftMargin: frame.item.displacementLeft * appSettings.window_scaling
|
||||
anchors.rightMargin: frame.item.displacementRight * appSettings.window_scaling
|
||||
anchors.topMargin: frame.item.displacementTop * appSettings.window_scaling
|
||||
anchors.bottomMargin: frame.item.displacementBottom * appSettings.window_scaling
|
||||
|
||||
//The blur effect has to take into account the framerate
|
||||
property real mBlur: shadersettings.motion_blur
|
||||
property real mBlur: appSettings.motion_blur
|
||||
property real motionBlurCoefficient: (_maxBlurCoefficient * mBlur + _minBlurCoefficient * (1 - mBlur))
|
||||
property real _minBlurCoefficient: 0.70
|
||||
property real _maxBlurCoefficient: 0.90
|
||||
|
||||
property real mBloom: shadersettings.bloom_strength
|
||||
property int mScanlines: shadersettings.rasterization
|
||||
onMScanlinesChanged: restartBlurredSource()
|
||||
|
||||
property size terminalSize: kterminal.terminalSize
|
||||
property size paintedTextSize
|
||||
|
||||
onMBlurChanged: restartBlurredSource()
|
||||
property size fontMetrics: kterminal.fontMetrics
|
||||
|
||||
// Manage copy and paste
|
||||
Connections{
|
||||
@ -76,14 +58,9 @@ Item{
|
||||
onTriggered: kterminal.pasteClipboard()
|
||||
}
|
||||
|
||||
function restartBlurredSource(){
|
||||
if(!blurredSourceLoader.item) return;
|
||||
blurredSourceLoader.item.restartBlurSource();
|
||||
}
|
||||
|
||||
//When settings are updated sources need to be redrawn.
|
||||
Connections{
|
||||
target: shadersettings
|
||||
target: appSettings
|
||||
onFontScalingChanged: terminalContainer.updateSources();
|
||||
onFontWidthChanged: terminalContainer.updateSources();
|
||||
}
|
||||
@ -105,6 +82,7 @@ Item{
|
||||
|
||||
smooth: false
|
||||
enableBold: false
|
||||
fullCursorHeight: true
|
||||
|
||||
session: QMLTermSession {
|
||||
id: ksession
|
||||
@ -115,6 +93,7 @@ Item{
|
||||
}
|
||||
|
||||
QMLTermScrollbar {
|
||||
id: kterminalScrollbar
|
||||
terminal: kterminal
|
||||
anchors.margins: width * 0.5
|
||||
width: terminal.fontMetrics.width * 0.75
|
||||
@ -124,33 +103,24 @@ Item{
|
||||
radius: width * 0.25
|
||||
opacity: 0.7
|
||||
}
|
||||
onOpacityChanged: restartBlurredSource();
|
||||
}
|
||||
|
||||
FontLoader{ id: fontLoader }
|
||||
|
||||
function handleFontChange(fontSource, pixelSize, lineSpacing, screenScaling){
|
||||
function handleFontChange(fontSource, pixelSize, lineSpacing, screenScaling, fontWidth){
|
||||
fontLoader.source = fontSource;
|
||||
font.pixelSize = pixelSize;
|
||||
font.family = fontLoader.name;
|
||||
|
||||
var fontWidth = 1.0 / shadersettings.fontWidth;
|
||||
|
||||
width = Qt.binding(function() {return Math.floor(fontWidth * terminalContainer.width / screenScaling);});
|
||||
width = Qt.binding(function() {return Math.floor(terminalContainer.width / (screenScaling * fontWidth));});
|
||||
height = Qt.binding(function() {return Math.floor(terminalContainer.height / screenScaling);});
|
||||
|
||||
var scaleTexture = Math.max(Math.round(screenScaling / shadersettings.scanline_quality), 1.0);
|
||||
|
||||
kterminalSource.textureSize = Qt.binding(function () {
|
||||
return Qt.size(kterminal.width * scaleTexture, kterminal.height * scaleTexture);
|
||||
});
|
||||
scaleTexture = Math.max(1.0, Math.round(screenScaling / 2));
|
||||
|
||||
kterminal.lineSpacing = lineSpacing;
|
||||
//update();
|
||||
restartBlurredSource();
|
||||
}
|
||||
Component.onCompleted: {
|
||||
shadersettings.terminalFontChanged.connect(handleFontChange);
|
||||
appSettings.terminalFontChanged.connect(handleFontChange);
|
||||
|
||||
// Retrieve the variable set in main.cpp if arguments are passed.
|
||||
if (shellProgram)
|
||||
@ -169,14 +139,12 @@ Item{
|
||||
MenuSeparator{visible: Qt.platform.os !== "osx"}
|
||||
MenuItem{action: fullscreenAction; visible: Qt.platform.os !== "osx"}
|
||||
MenuItem{action: showMenubarAction; visible: Qt.platform.os !== "osx"}
|
||||
MenuSeparator{visible: !shadersettings.showMenubar}
|
||||
CRTMainMenuBar{visible: !shadersettings.showMenubar}
|
||||
MenuSeparator{visible: !appSettings.showMenubar}
|
||||
CRTMainMenuBar{visible: !appSettings.showMenubar}
|
||||
}
|
||||
MouseArea{
|
||||
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
|
||||
// This is incredibly ugly. All this file should be reorganized.
|
||||
width: (parent.width + dleft + dright) / shadersettings.window_scaling - dleft -dright
|
||||
height: (parent.height + dtop + dbottom) / shadersettings.window_scaling - dtop - dbottom
|
||||
anchors.fill: parent
|
||||
onWheel:{
|
||||
if(wheel.modifiers & Qt.ControlModifier){
|
||||
wheel.angleDelta.y > 0 ? zoomIn.trigger() : zoomOut.trigger();
|
||||
@ -211,7 +179,7 @@ Item{
|
||||
y = y / height;
|
||||
|
||||
var cc = Qt.size(0.5 - x, 0.5 - y);
|
||||
var distortion = (cc.height * cc.height + cc.width * cc.width) * shadersettings.screen_distortion;
|
||||
var distortion = (cc.height * cc.height + cc.width * cc.width) * appSettings.screen_distortion;
|
||||
|
||||
return Qt.point((x - cc.width * (1+distortion) * distortion) * kterminal.width,
|
||||
(y - cc.height * (1+distortion) * distortion) * kterminal.height)
|
||||
@ -222,6 +190,8 @@ Item{
|
||||
sourceItem: kterminal
|
||||
hideSource: true
|
||||
wrapMode: ShaderEffectSource.ClampToEdge
|
||||
visible: false
|
||||
textureSize: Qt.size(kterminal.width * scaleTexture, kterminal.height * scaleTexture);
|
||||
}
|
||||
Loader{
|
||||
id: blurredSourceLoader
|
||||
@ -236,6 +206,8 @@ Item{
|
||||
hideSource: true
|
||||
wrapMode: kterminalSource.wrapMode
|
||||
|
||||
visible: false
|
||||
|
||||
function restartBlurSource(){
|
||||
livetimer.restart();
|
||||
}
|
||||
@ -243,21 +215,25 @@ Item{
|
||||
Timer{
|
||||
id: livetimer
|
||||
running: true
|
||||
onRunningChanged: {
|
||||
running ?
|
||||
_blurredSourceEffect.live = true :
|
||||
_blurredSourceEffect.live = false
|
||||
}
|
||||
onTriggered: _blurredSourceEffect.live = false;
|
||||
}
|
||||
Connections{
|
||||
target: kterminal
|
||||
onImagePainted:{
|
||||
_blurredSourceEffect.live = true;
|
||||
livetimer.restart();
|
||||
}
|
||||
}
|
||||
// Restart blurred source settings change.
|
||||
Connections{
|
||||
target: shadersettings
|
||||
onScanline_qualityChanged: restartBlurredSource();
|
||||
target: appSettings
|
||||
onMotion_blurChanged: _blurredSourceEffect.restartBlurSource();
|
||||
onTerminalFontChanged: _blurredSourceEffect.restartBlurSource();
|
||||
onRasterizationChanged: _blurredSourceEffect.restartBlurSource();
|
||||
}
|
||||
Connections {
|
||||
target: kterminalScrollbar
|
||||
onOpacityChanged: _blurredSourceEffect.restartBlurSource();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -304,143 +280,4 @@ Item{
|
||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||
}
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// EFFECTS //////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// BLOOM ////////////////////////////////////////////////////////////////
|
||||
|
||||
Loader{
|
||||
property real scaling: shadersettings.bloom_quality * shadersettings.window_scaling
|
||||
id: bloomEffectLoader
|
||||
active: mBloom != 0
|
||||
asynchronous: true
|
||||
width: parent.width * scaling
|
||||
height: parent.height * scaling
|
||||
sourceComponent: FastBlur{
|
||||
radius: 48 * scaling
|
||||
source: kterminal
|
||||
transparentBorder: true
|
||||
}
|
||||
}
|
||||
Loader{
|
||||
id: bloomSourceLoader
|
||||
active: mBloom != 0
|
||||
asynchronous: true
|
||||
sourceComponent: ShaderEffectSource{
|
||||
id: _bloomEffectSource
|
||||
sourceItem: bloomEffectLoader.item
|
||||
hideSource: true
|
||||
smooth: true
|
||||
}
|
||||
}
|
||||
|
||||
// NOISE ////////////////////////////////////////////////////////////////
|
||||
|
||||
ShaderEffect {
|
||||
id: staticNoiseEffect
|
||||
anchors.fill: parent
|
||||
property real element_size: shadersettings.rasterization == shadersettings.no_rasterization ? 2 : 1
|
||||
property size virtual_resolution: Qt.size(kterminal.width / element_size, kterminal.height / element_size)
|
||||
|
||||
blending: false
|
||||
|
||||
fragmentShader:
|
||||
"uniform lowp float qt_Opacity;
|
||||
varying highp vec2 qt_TexCoord0;
|
||||
uniform highp vec2 virtual_resolution;" +
|
||||
|
||||
"highp float noise(vec2 co)
|
||||
{
|
||||
highp float a = 12.9898;
|
||||
highp float b = 78.233;
|
||||
highp float c = 43758.5453;
|
||||
highp float dt= dot(co.xy ,vec2(a,b));
|
||||
highp float sn= mod(dt,3.14);
|
||||
return fract(sin(sn) * c);
|
||||
}
|
||||
|
||||
vec2 sw(vec2 p) {return vec2( floor(p.x) , floor(p.y) );}
|
||||
vec2 se(vec2 p) {return vec2( ceil(p.x) , floor(p.y) );}
|
||||
vec2 nw(vec2 p) {return vec2( floor(p.x) , ceil(p.y) );}
|
||||
vec2 ne(vec2 p) {return vec2( ceil(p.x) , ceil(p.y) );}
|
||||
|
||||
float smoothNoise(vec2 p) {
|
||||
vec2 inter = smoothstep(0., 1., fract(p));
|
||||
float s = mix(noise(sw(p)), noise(se(p)), inter.x);
|
||||
float n = mix(noise(nw(p)), noise(ne(p)), inter.x);
|
||||
return mix(s, n, inter.y);
|
||||
}" +
|
||||
|
||||
"void main() {" +
|
||||
"gl_FragColor.a = smoothNoise(qt_TexCoord0 * virtual_resolution);" +
|
||||
"}"
|
||||
|
||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||
}
|
||||
ShaderEffectSource{
|
||||
id: staticNoiseSource
|
||||
sourceItem: staticNoiseEffect
|
||||
textureSize: Qt.size(parent.width, parent.height)
|
||||
wrapMode: ShaderEffectSource.Repeat
|
||||
smooth: true
|
||||
hideSource: true
|
||||
}
|
||||
|
||||
// RASTERIZATION //////////////////////////////////////////////////////////
|
||||
|
||||
ShaderEffect {
|
||||
id: rasterizationEffect
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
property real outColor: 0.0
|
||||
property real dispX: 5 / width
|
||||
property real dispY: 5 / height
|
||||
property size virtual_resolution: Qt.size(kterminal.width, kterminal.height)
|
||||
|
||||
blending: false
|
||||
|
||||
fragmentShader:
|
||||
"uniform lowp float qt_Opacity;" +
|
||||
|
||||
"varying highp vec2 qt_TexCoord0;
|
||||
uniform highp vec2 virtual_resolution;
|
||||
uniform highp float dispX;
|
||||
uniform highp float dispY;
|
||||
uniform mediump float outColor;
|
||||
|
||||
highp float getScanlineIntensity(vec2 coords) {
|
||||
highp float result = 1.0;" +
|
||||
|
||||
(mScanlines != shadersettings.no_rasterization ?
|
||||
"result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") +
|
||||
(mScanlines == shadersettings.pixel_rasterization ?
|
||||
"result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + "
|
||||
|
||||
return result;
|
||||
}" +
|
||||
|
||||
"void main() {" +
|
||||
"highp float color = getScanlineIntensity(qt_TexCoord0);" +
|
||||
|
||||
"float distance = length(vec2(0.5) - qt_TexCoord0);" +
|
||||
"color = mix(color, 0.0, 1.2 * distance * distance);" +
|
||||
|
||||
"color *= outColor + smoothstep(0.00, dispX, qt_TexCoord0.x) * (1.0 - outColor);" +
|
||||
"color *= outColor + smoothstep(0.00, dispY, qt_TexCoord0.y) * (1.0 - outColor);" +
|
||||
"color *= outColor + (1.0 - smoothstep(1.00 - dispX, 1.00, qt_TexCoord0.x)) * (1.0 - outColor);" +
|
||||
"color *= outColor + (1.0 - smoothstep(1.00 - dispY, 1.00, qt_TexCoord0.y)) * (1.0 - outColor);" +
|
||||
|
||||
"gl_FragColor.a = color;" +
|
||||
"}"
|
||||
|
||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||
}
|
||||
ShaderEffectSource{
|
||||
id: rasterizationEffectSource
|
||||
sourceItem: rasterizationEffect
|
||||
hideSource: true
|
||||
smooth: true
|
||||
wrapMode: ShaderEffectSource.ClampToEdge
|
||||
}
|
||||
}
|
||||
|
@ -30,55 +30,55 @@ Tab{
|
||||
anchors.fill: parent
|
||||
CheckableSlider{
|
||||
name: qsTr("Bloom")
|
||||
onNewValue: shadersettings.bloom_strength = newValue
|
||||
value: shadersettings.bloom_strength
|
||||
onNewValue: appSettings.bloom_strength = newValue
|
||||
value: appSettings.bloom_strength
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Motion Blur")
|
||||
onNewValue: shadersettings.motion_blur = newValue
|
||||
value: shadersettings.motion_blur
|
||||
onNewValue: appSettings.motion_blur = newValue
|
||||
value: appSettings.motion_blur
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Noise")
|
||||
onNewValue: shadersettings.noise_strength = newValue
|
||||
value: shadersettings.noise_strength
|
||||
onNewValue: appSettings.noise_strength = newValue
|
||||
value: appSettings.noise_strength
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Jitter")
|
||||
onNewValue: shadersettings.jitter = newValue
|
||||
value: shadersettings.jitter
|
||||
onNewValue: appSettings.jitter = newValue
|
||||
value: appSettings.jitter
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Glow")
|
||||
onNewValue: shadersettings.glowing_line_strength = newValue;
|
||||
value: shadersettings.glowing_line_strength
|
||||
onNewValue: appSettings.glowing_line_strength = newValue;
|
||||
value: appSettings.glowing_line_strength
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Screen distortion")
|
||||
onNewValue: shadersettings.screen_distortion = newValue;
|
||||
value: shadersettings.screen_distortion;
|
||||
onNewValue: appSettings.screen_distortion = newValue;
|
||||
value: appSettings.screen_distortion;
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Ambient light")
|
||||
onNewValue: shadersettings.ambient_light = newValue;
|
||||
value: shadersettings.ambient_light
|
||||
enabled: shadersettings.frames_index !== 0
|
||||
onNewValue: appSettings.ambient_light = newValue;
|
||||
value: appSettings.ambient_light
|
||||
enabled: appSettings.frames_index !== 0
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Brightness flickering")
|
||||
onNewValue: shadersettings.brightness_flickering = newValue;
|
||||
value: shadersettings.brightness_flickering;
|
||||
onNewValue: appSettings.brightness_flickering = newValue;
|
||||
value: appSettings.brightness_flickering;
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Horizontal flickering")
|
||||
onNewValue: shadersettings.horizontal_sincronization = newValue;
|
||||
value: shadersettings.horizontal_sincronization;
|
||||
onNewValue: appSettings.horizontal_sincronization = newValue;
|
||||
value: appSettings.horizontal_sincronization;
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("RGB shift")
|
||||
onNewValue: shadersettings.rgb_shift = newValue;
|
||||
value: shadersettings.rgb_shift;
|
||||
enabled: shadersettings.chroma_color !== 0
|
||||
onNewValue: appSettings.rgb_shift = newValue;
|
||||
value: appSettings.rgb_shift;
|
||||
enabled: appSettings.chroma_color !== 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ Tab{
|
||||
ComboBox{
|
||||
id: profilesbox
|
||||
Layout.fillWidth: true
|
||||
model: shadersettings.profiles_list
|
||||
currentIndex: shadersettings.profiles_index
|
||||
model: appSettings.profiles_list
|
||||
currentIndex: appSettings.profiles_index
|
||||
}
|
||||
RowLayout{
|
||||
Layout.fillWidth: true
|
||||
@ -42,9 +42,9 @@ Tab{
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Load")
|
||||
onClicked: {
|
||||
shadersettings.profiles_index = profilesbox.currentIndex
|
||||
shadersettings.loadCurrentProfile();
|
||||
shadersettings.handleFontChanged();
|
||||
appSettings.profiles_index = profilesbox.currentIndex
|
||||
appSettings.loadCurrentProfile();
|
||||
appSettings.handleFontChanged();
|
||||
}
|
||||
}
|
||||
Button{
|
||||
@ -55,16 +55,16 @@ Tab{
|
||||
Button{
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Remove Selected")
|
||||
enabled: !shadersettings.profiles_list.get(profilesbox.currentIndex).builtin
|
||||
enabled: !appSettings.profiles_list.get(profilesbox.currentIndex).builtin
|
||||
onClicked: {
|
||||
shadersettings.profiles_list.remove(profilesbox.currentIndex)
|
||||
appSettings.profiles_list.remove(profilesbox.currentIndex)
|
||||
profilesbox.currentIndex = profilesbox.currentIndex - 1
|
||||
}
|
||||
}
|
||||
}
|
||||
InsertNameDialog{
|
||||
id: insertname
|
||||
onNameSelected: shadersettings.addNewCustomProfile(name)
|
||||
onNameSelected: appSettings.addNewCustomProfile(name)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -76,18 +76,18 @@ Tab{
|
||||
columns: 2
|
||||
Text{ text: qsTr("Brightness") }
|
||||
SimpleSlider{
|
||||
onValueChanged: shadersettings.brightness = value
|
||||
value: shadersettings.brightness
|
||||
onValueChanged: appSettings.brightness = value
|
||||
value: appSettings.brightness
|
||||
}
|
||||
Text{ text: qsTr("Contrast") }
|
||||
SimpleSlider{
|
||||
onValueChanged: shadersettings.contrast = value
|
||||
value: shadersettings.contrast
|
||||
onValueChanged: appSettings.contrast = value
|
||||
value: appSettings.contrast
|
||||
}
|
||||
Text{ text: qsTr("Opacity") }
|
||||
SimpleSlider{
|
||||
onValueChanged: shadersettings.windowOpacity = value
|
||||
value: shadersettings.windowOpacity
|
||||
onValueChanged: appSettings.windowOpacity = value
|
||||
value: appSettings.windowOpacity
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -99,9 +99,9 @@ Tab{
|
||||
ComboBox{
|
||||
id: framescombobox
|
||||
Layout.fillWidth: true
|
||||
model: shadersettings.frames_list
|
||||
currentIndex: shadersettings.frames_index
|
||||
onCurrentIndexChanged: shadersettings.frames_index = currentIndex
|
||||
model: appSettings.frames_list
|
||||
currentIndex: appSettings.frames_index
|
||||
onCurrentIndexChanged: appSettings.frames_index = currentIndex
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,8 +36,8 @@ Tab{
|
||||
columns: 3
|
||||
CheckBox{
|
||||
property int fps: checked ? slider.value : 0
|
||||
onFpsChanged: shadersettings.fps = fps
|
||||
checked: shadersettings.fps !== 0
|
||||
onFpsChanged: appSettings.fps = fps
|
||||
checked: appSettings.fps !== 0
|
||||
text: qsTr("Limit FPS")
|
||||
}
|
||||
Slider{
|
||||
@ -46,63 +46,22 @@ Tab{
|
||||
stepSize: 1
|
||||
maximumValue: 60
|
||||
minimumValue: 1
|
||||
enabled: shadersettings.fps !== 0
|
||||
value: shadersettings.fps !== 0 ? shadersettings.fps : 60
|
||||
enabled: appSettings.fps !== 0
|
||||
value: appSettings.fps !== 0 ? appSettings.fps : 60
|
||||
}
|
||||
Text{text: slider.value}
|
||||
Text{text: qsTr("Texture Quality")}
|
||||
Slider{
|
||||
Layout.fillWidth: true
|
||||
id: txtslider
|
||||
onValueChanged: shadersettings.window_scaling = value;
|
||||
value: shadersettings.window_scaling
|
||||
onValueChanged: appSettings.window_scaling = value;
|
||||
value: appSettings.window_scaling
|
||||
stepSize: 0.10
|
||||
Component.onCompleted: minimumValue = 0.3 //Without this value gets set to 0.5
|
||||
}
|
||||
Text{text: Math.round(txtslider.value * 100) + "%"}
|
||||
}
|
||||
}
|
||||
GroupBox{
|
||||
title: qsTr("Rasterization")
|
||||
Layout.fillWidth: true
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
GridLayout{
|
||||
id: scanlineQualityContainer
|
||||
anchors.fill: parent
|
||||
columns: 3
|
||||
property alias valsIndex: scanlineQualitySlider.value
|
||||
property var vals: [4,3,2]
|
||||
property var valsStrings: [
|
||||
qsTr("Low"),
|
||||
qsTr("Medium"),
|
||||
qsTr("High")
|
||||
]
|
||||
|
||||
onValsIndexChanged: shadersettings.scanline_quality = vals[valsIndex];
|
||||
|
||||
Text{text: qsTr("Scanlines Quality")}
|
||||
Slider{
|
||||
id: scanlineQualitySlider
|
||||
Layout.fillWidth: true
|
||||
onValueChanged: parent.valsIndex = value;
|
||||
stepSize: 1
|
||||
Component.onCompleted: {
|
||||
minimumValue = 0;
|
||||
maximumValue = 2;
|
||||
value = parent.vals.indexOf(shadersettings.scanline_quality);
|
||||
}
|
||||
Connections{
|
||||
target: shadersettings
|
||||
onScanline_qualityChanged:
|
||||
scanlineQualityContainer.valsIndex = scanlineQualityContainer.vals.indexOf(shadersettings.scanline_quality);
|
||||
}
|
||||
}
|
||||
Text{
|
||||
text: parent.valsStrings[parent.valsIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
GroupBox{
|
||||
title: qsTr("Bloom")
|
||||
Layout.fillWidth: true
|
||||
@ -111,37 +70,17 @@ Tab{
|
||||
GridLayout{
|
||||
id: bloomQualityContainer
|
||||
anchors.fill: parent
|
||||
columns: 3
|
||||
property alias valsIndex: bloomQualitySlider.value
|
||||
property var vals: [0.25, 0.50, 1.00]
|
||||
property var valsStrings: [
|
||||
qsTr("Low"),
|
||||
qsTr("Medium"),
|
||||
qsTr("High")
|
||||
]
|
||||
|
||||
onValsIndexChanged: shadersettings.bloom_quality = vals[valsIndex];
|
||||
|
||||
Text{text: qsTr("Bloom Quality")}
|
||||
Slider{
|
||||
id: bloomQualitySlider
|
||||
Layout.fillWidth: true
|
||||
onValueChanged: parent.valsIndex = value;
|
||||
stepSize: 1
|
||||
Component.onCompleted: {
|
||||
minimumValue = 0;
|
||||
maximumValue = 2;
|
||||
value = parent.vals.indexOf(shadersettings.bloom_quality);
|
||||
}
|
||||
Connections{
|
||||
target: shadersettings
|
||||
onBloom_qualityChanged:
|
||||
bloomQualityContainer.valsIndex = bloomQualityContainer.vals.indexOf(shadersettings.bloom_quality);
|
||||
}
|
||||
}
|
||||
Text{
|
||||
text: parent.valsStrings[parent.valsIndex];
|
||||
id: bloomSlider
|
||||
onValueChanged: appSettings.bloom_quality = value;
|
||||
value: appSettings.bloom_quality
|
||||
stepSize: 0.10
|
||||
Component.onCompleted: minimumValue = 0.3 //Without this value gets set to 0.5
|
||||
}
|
||||
Text{text: Math.round(bloomSlider.value * 100) + "%"}
|
||||
}
|
||||
}
|
||||
GroupBox{
|
||||
@ -150,9 +89,9 @@ Tab{
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
CheckBox{
|
||||
checked: shadersettings._frameReflections
|
||||
checked: appSettings._frameReflections
|
||||
text: qsTr("Frame Reflections")
|
||||
onCheckedChanged: shadersettings._frameReflections = checked
|
||||
onCheckedChanged: appSettings._frameReflections = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,9 +33,9 @@ Tab{
|
||||
property string selectedElement: model[currentIndex]
|
||||
anchors.fill: parent
|
||||
model: [qsTr("Default"), qsTr("Scanlines"), qsTr("Pixels")]
|
||||
currentIndex: shadersettings.rasterization
|
||||
currentIndex: appSettings.rasterization
|
||||
onCurrentIndexChanged: {
|
||||
shadersettings.rasterization = currentIndex
|
||||
appSettings.rasterization = currentIndex
|
||||
fontChanger.updateIndex();
|
||||
}
|
||||
}
|
||||
@ -50,14 +50,14 @@ Tab{
|
||||
ComboBox{
|
||||
id: fontChanger
|
||||
Layout.fillWidth: true
|
||||
model: shadersettings.fontlist
|
||||
model: appSettings.fontlist
|
||||
currentIndex: updateIndex()
|
||||
onActivated: {
|
||||
shadersettings.fontIndexes[shadersettings.rasterization] = index;
|
||||
shadersettings.handleFontChanged();
|
||||
appSettings.fontIndexes[appSettings.rasterization] = index;
|
||||
appSettings.handleFontChanged();
|
||||
}
|
||||
function updateIndex(){
|
||||
currentIndex = shadersettings.fontIndexes[shadersettings.rasterization];
|
||||
currentIndex = appSettings.fontIndexes[appSettings.rasterization];
|
||||
}
|
||||
}
|
||||
Text{ text: qsTr("Scaling") }
|
||||
@ -66,18 +66,18 @@ Tab{
|
||||
Slider{
|
||||
Layout.fillWidth: true
|
||||
id: fontScalingChanger
|
||||
onValueChanged: if(enabled) shadersettings.fontScaling = value
|
||||
onValueChanged: if(enabled) appSettings.fontScaling = value
|
||||
stepSize: 0.05
|
||||
enabled: false // Another trick to fix initial bad behavior.
|
||||
Component.onCompleted: {
|
||||
minimumValue = 0.5;
|
||||
maximumValue = 2.5;
|
||||
value = shadersettings.fontScaling;
|
||||
value = appSettings.fontScaling;
|
||||
enabled = true;
|
||||
}
|
||||
Connections{
|
||||
target: shadersettings
|
||||
onFontScalingChanged: fontScalingChanger.value = shadersettings.fontScaling;
|
||||
target: appSettings
|
||||
onFontScalingChanged: fontScalingChanger.value = appSettings.fontScaling;
|
||||
}
|
||||
}
|
||||
Text{
|
||||
@ -90,10 +90,14 @@ Tab{
|
||||
Slider{
|
||||
Layout.fillWidth: true
|
||||
id: widthChanger
|
||||
onValueChanged: shadersettings.fontWidth = value;
|
||||
value: shadersettings.fontWidth
|
||||
onValueChanged: appSettings.fontWidth = value;
|
||||
value: appSettings.fontWidth
|
||||
stepSize: 0.05
|
||||
Component.onCompleted: minimumValue = 0.5 //Without this value gets set to 0.5
|
||||
Component.onCompleted: {
|
||||
// This is needed to avoid unnecessary chnaged events.
|
||||
minimumValue = 0.5;
|
||||
maximumValue = 1.5;
|
||||
}
|
||||
}
|
||||
Text{
|
||||
text: Math.round(widthChanger.value * 100) + "%"
|
||||
@ -112,29 +116,29 @@ Tab{
|
||||
name: qsTr("Font")
|
||||
height: 50
|
||||
Layout.fillWidth: true
|
||||
onColorSelected: shadersettings._font_color = color;
|
||||
button_color: shadersettings._font_color
|
||||
onColorSelected: appSettings._font_color = color;
|
||||
button_color: appSettings._font_color
|
||||
}
|
||||
ColorButton{
|
||||
name: qsTr("Background")
|
||||
height: 50
|
||||
Layout.fillWidth: true
|
||||
onColorSelected: shadersettings._background_color = color;
|
||||
button_color: shadersettings._background_color
|
||||
onColorSelected: appSettings._background_color = color;
|
||||
button_color: appSettings._background_color
|
||||
}
|
||||
}
|
||||
ColumnLayout{
|
||||
Layout.fillWidth: true
|
||||
CheckableSlider{
|
||||
name: qsTr("Chroma Color")
|
||||
onNewValue: shadersettings.chroma_color = newValue
|
||||
value: shadersettings.chroma_color
|
||||
onNewValue: appSettings.chroma_color = newValue
|
||||
value: appSettings.chroma_color
|
||||
}
|
||||
CheckableSlider{
|
||||
name: qsTr("Saturation Color")
|
||||
onNewValue: shadersettings.saturation_color = newValue
|
||||
value: shadersettings.saturation_color
|
||||
enabled: shadersettings.chroma_color !== 0
|
||||
onNewValue: appSettings.saturation_color = newValue
|
||||
value: appSettings.saturation_color
|
||||
enabled: appSettings.chroma_color !== 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,37 +21,41 @@
|
||||
import QtQuick 2.2
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
|
||||
ShaderEffect {
|
||||
property color font_color: shadersettings.font_color
|
||||
property color background_color: shadersettings.background_color
|
||||
property variant source: terminal.theSource
|
||||
property variant bloomSource: terminal.bloomSource
|
||||
property variant rasterizationSource: terminal.rasterizationSource
|
||||
property variant noiseSource: terminal.staticNoiseSource
|
||||
property real bloom_strength: shadersettings.bloom_strength * 2.5
|
||||
property ShaderEffectSource source
|
||||
property ShaderEffectSource bloomSource
|
||||
|
||||
property real jitter: shadersettings.jitter * 0.007
|
||||
property color font_color: appSettings.font_color
|
||||
property color background_color: appSettings.background_color
|
||||
property real bloom_strength: appSettings.bloom_strength * 2.5
|
||||
|
||||
property real noise_strength: shadersettings.noise_strength
|
||||
property real screen_distorsion: shadersettings.screen_distortion
|
||||
property real glowing_line_strength: shadersettings.glowing_line_strength
|
||||
property real jitter: appSettings.jitter * 0.007
|
||||
property real noise_strength: appSettings.noise_strength
|
||||
property size scaleNoiseSize: Qt.size((width) / (noiseTexture.width * appSettings.window_scaling * appSettings.fontScaling),
|
||||
(height) / (noiseTexture.height * appSettings.window_scaling * appSettings.fontScaling))
|
||||
|
||||
property real chroma_color: shadersettings.chroma_color;
|
||||
property real screen_distorsion: appSettings.screen_distortion
|
||||
property real glowing_line_strength: appSettings.glowing_line_strength
|
||||
|
||||
property real rgb_shift: shadersettings.rgb_shift * 0.2
|
||||
property real chroma_color: appSettings.chroma_color;
|
||||
|
||||
property real brightness_flickering: shadersettings.brightness_flickering
|
||||
property real horizontal_sincronization: shadersettings.horizontal_sincronization
|
||||
property real rgb_shift: appSettings.rgb_shift * 0.2
|
||||
|
||||
property bool frameReflections: shadersettings.frameReflections
|
||||
property real brightness_flickering: appSettings.brightness_flickering
|
||||
property real horizontal_sincronization: appSettings.horizontal_sincronization
|
||||
|
||||
property real disp_top: (frame.item.displacementTop * shadersettings.window_scaling) / height
|
||||
property real disp_bottom: (frame.item.displacementBottom * shadersettings.window_scaling) / height
|
||||
property real disp_left: (frame.item.displacementLeft * shadersettings.window_scaling) / width
|
||||
property real disp_right: (frame.item.displacementRight * shadersettings.window_scaling) / width
|
||||
property bool frameReflections: appSettings.frameReflections
|
||||
|
||||
property real screen_brightness: shadersettings.brightness * 1.5 + 0.5
|
||||
property real disp_top: (frame.item.displacementTop * appSettings.window_scaling) / height
|
||||
property real disp_bottom: (frame.item.displacementBottom * appSettings.window_scaling) / height
|
||||
property real disp_left: (frame.item.displacementLeft * appSettings.window_scaling) / width
|
||||
property real disp_right: (frame.item.displacementRight * appSettings.window_scaling) / width
|
||||
|
||||
property real screen_brightness: appSettings.brightness * 1.5 + 0.5
|
||||
|
||||
property real dispX
|
||||
property real dispY
|
||||
property size virtual_resolution
|
||||
|
||||
TimeManager{
|
||||
id: timeManager
|
||||
@ -59,7 +63,7 @@ ShaderEffect {
|
||||
}
|
||||
|
||||
property alias time: timeManager.time
|
||||
property variant randomFunctionSource: randfuncsource
|
||||
property variant noiseSource: noiseShaderSource
|
||||
|
||||
// If something goes wrong activate the fallback version of the shader.
|
||||
property bool fallBack: false
|
||||
@ -68,20 +72,19 @@ ShaderEffect {
|
||||
|
||||
//Smooth random texture used for flickering effect.
|
||||
Image{
|
||||
id: randtexture
|
||||
source: "frames/images/randfunction.png"
|
||||
id: noiseTexture
|
||||
source: "images/allNoise512.png"
|
||||
width: 512
|
||||
height: 512
|
||||
sourceSize.width: 512
|
||||
sourceSize.height: 256
|
||||
fillMode: Image.TileVertically
|
||||
fillMode: Image.Tile
|
||||
visible: false
|
||||
}
|
||||
ShaderEffectSource{
|
||||
id: randfuncsource
|
||||
sourceItem: randtexture
|
||||
live: false
|
||||
hideSource: true
|
||||
id: noiseShaderSource
|
||||
sourceItem: noiseTexture
|
||||
wrapMode: ShaderEffectSource.Repeat
|
||||
visible: false
|
||||
smooth: true
|
||||
}
|
||||
|
||||
//Print the number with a reasonable precision for the shader.
|
||||
@ -104,27 +107,33 @@ ShaderEffect {
|
||||
varying highp vec2 qt_TexCoord0;" +
|
||||
|
||||
(!fallBack ? "
|
||||
uniform sampler2D randomFunctionSource;" : "") +
|
||||
uniform sampler2D noiseSource;" : "") +
|
||||
|
||||
(!fallBack && brightness_flickering !== 0.0 ?"
|
||||
varying lowp float brightness;
|
||||
uniform lowp float brightness_flickering;" : "") +
|
||||
(!fallBack && horizontal_sincronization !== 0.0 ?"
|
||||
varying lowp float horizontal_distortion;
|
||||
uniform lowp float horizontal_sincronization;" : "") +
|
||||
uniform lowp float horizontal_sincronization;
|
||||
varying lowp float distortionScale;
|
||||
varying lowp float distortionFreq;" : "") +
|
||||
|
||||
"
|
||||
void main() {
|
||||
qt_TexCoord0.x = (qt_MultiTexCoord0.x - disp_left) / (1.0 - disp_left - disp_right);
|
||||
qt_TexCoord0.y = (qt_MultiTexCoord0.y - disp_top) / (1.0 - disp_top - disp_bottom);
|
||||
vec2 coords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));" +
|
||||
|
||||
(!fallBack && (brightness_flickering !== 0.0 || horizontal_sincronization !== 0.0) ?
|
||||
"vec4 initialNoiseTexel = texture2D(noiseSource, coords);"
|
||||
: "") +
|
||||
(!fallBack && brightness_flickering !== 0.0 ? "
|
||||
brightness = 1.0 + (texture2D(randomFunctionSource, coords).g - 0.5) * brightness_flickering;"
|
||||
: "") +
|
||||
brightness = 1.0 + (initialNoiseTexel.g - 0.5) * brightness_flickering;"
|
||||
: "") +
|
||||
|
||||
(!fallBack && horizontal_sincronization !== 0.0 ? "
|
||||
float randval = 1.5 * texture2D(randomFunctionSource,(vec2(1.0) -coords) * 0.5).g;
|
||||
float negsinc = 1.0 - 0.6 * horizontal_sincronization;" + "
|
||||
horizontal_distortion = step(negsinc, randval) * (randval - negsinc) * 0.3*horizontal_sincronization;"
|
||||
float randval = horizontal_sincronization - initialNoiseTexel.r;
|
||||
distortionScale = step(0.0, randval) * randval * horizontal_sincronization;
|
||||
distortionFreq = mix(4.0, 40.0, initialNoiseTexel.g);"
|
||||
: "") +
|
||||
|
||||
"gl_Position = qt_Matrix * qt_Vertex;
|
||||
@ -138,16 +147,21 @@ ShaderEffect {
|
||||
|
||||
uniform highp vec4 font_color;
|
||||
uniform highp vec4 background_color;
|
||||
uniform highp sampler2D rasterizationSource;
|
||||
uniform lowp float screen_brightness;" +
|
||||
uniform lowp float screen_brightness;
|
||||
|
||||
uniform highp vec2 virtual_resolution;
|
||||
uniform highp float dispX;
|
||||
uniform highp float dispY;" +
|
||||
|
||||
(bloom_strength !== 0 ? "
|
||||
uniform highp sampler2D bloomSource;
|
||||
uniform lowp float bloom_strength;" : "") +
|
||||
(noise_strength !== 0 ? "
|
||||
uniform highp float noise_strength;" : "") +
|
||||
(noise_strength !== 0 || jitter !== 0 || rgb_shift ? "
|
||||
uniform lowp sampler2D noiseSource;" : "") +
|
||||
(((noise_strength !== 0 || jitter !== 0 || rgb_shift)
|
||||
||(fallBack && (brightness_flickering || horizontal_sincronization))) ? "
|
||||
uniform lowp sampler2D noiseSource;
|
||||
uniform highp vec2 scaleNoiseSize;" : "") +
|
||||
(screen_distorsion !== 0 ? "
|
||||
uniform highp float screen_distorsion;" : "") +
|
||||
(glowing_line_strength !== 0 ? "
|
||||
@ -159,23 +173,34 @@ ShaderEffect {
|
||||
(rgb_shift !== 0 ? "
|
||||
uniform lowp float rgb_shift;" : "") +
|
||||
|
||||
(fallBack && (brightness_flickering || horizontal_sincronization) ? "
|
||||
uniform lowp sampler2D randomFunctionSource;" : "") +
|
||||
(fallBack && horizontal_sincronization !== 0 ? "
|
||||
uniform lowp float horizontal_sincronization;" : "") +
|
||||
(fallBack && brightness_flickering !== 0.0 ?"
|
||||
uniform lowp float brightness_flickering;" : "") +
|
||||
(!fallBack && brightness_flickering !== 0 ? "
|
||||
varying lowp float brightness;" : "") +
|
||||
varying lowp float brightness;"
|
||||
: "") +
|
||||
(!fallBack && horizontal_sincronization !== 0 ? "
|
||||
varying lowp float horizontal_distortion;" : "") +
|
||||
varying lowp float distortionScale;
|
||||
varying lowp float distortionFreq;" : "") +
|
||||
|
||||
(glowing_line_strength !== 0 ? "
|
||||
float randomPass(vec2 coords){
|
||||
return fract(smoothstep(-0.2, 0.0, coords.y - 3.0 * fract(time * 0.0001))) * glowing_line_strength;
|
||||
}" : "") +
|
||||
|
||||
"float rgb2grey(vec3 v){
|
||||
"highp float getScanlineIntensity(vec2 coords) {
|
||||
highp float result = 1.0;" +
|
||||
|
||||
(appSettings.rasterization != appSettings.no_rasterization ?
|
||||
"result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") +
|
||||
(appSettings.rasterization == appSettings.pixel_rasterization ?
|
||||
"result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + "
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
float rgb2grey(vec3 v){
|
||||
return dot(v, vec3(0.21, 0.72, 0.04));
|
||||
}" +
|
||||
|
||||
@ -183,18 +208,18 @@ ShaderEffect {
|
||||
"vec2 cc = vec2(0.5) - qt_TexCoord0;" +
|
||||
"float distance = length(cc);" +
|
||||
|
||||
//FallBack if there are problem
|
||||
(fallBack && (brightness_flickering || horizontal_sincronization) ? "
|
||||
vec2 randCoords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));" : "") +
|
||||
|
||||
//FallBack if there are problems
|
||||
(fallBack && (brightness_flickering !== 0.0 || horizontal_sincronization !== 0.0) ?
|
||||
"vec2 initialCoords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));
|
||||
vec4 initialNoiseTexel = texture2D(noiseSource, initialCoords);"
|
||||
: "") +
|
||||
(fallBack && brightness_flickering !== 0.0 ? "
|
||||
float brightness = 1.0 + (texture2D(randomFunctionSource, randCoords).g - 0.5) * brightness_flickering;"
|
||||
: "") +
|
||||
|
||||
float brightness = 1.0 + (initialNoiseTexel.g - 0.5) * brightness_flickering;"
|
||||
: "") +
|
||||
(fallBack && horizontal_sincronization !== 0.0 ? "
|
||||
float randval = 1.5 * texture2D(randomFunctionSource,(vec2(1.0) - randCoords) * 0.5).g;
|
||||
float negsinc = 1.0 - 0.6 * horizontal_sincronization;" + "
|
||||
float horizontal_distortion = step(negsinc, randval) * (randval - negsinc) * 0.3*horizontal_sincronization;"
|
||||
float randval = horizontal_sincronization - initialNoiseTexel.r;
|
||||
float distortionScale = step(0.0, randval) * randval * horizontal_sincronization;
|
||||
float distortionFreq = mix(4.0, 40.0, initialNoiseTexel.g);"
|
||||
: "") +
|
||||
|
||||
(noise_strength ? "
|
||||
@ -207,23 +232,23 @@ ShaderEffect {
|
||||
vec2 coords = qt_TexCoord0;") +
|
||||
|
||||
(horizontal_sincronization !== 0 ? "
|
||||
float h_distortion = 0.5 * sin(time*0.001 + coords.y*10.0*fract(time/10.0));
|
||||
h_distortion += 0.5 * cos(time*0.04 + 0.03 + coords.y*50.0*fract(time/10.0 + 0.4));
|
||||
coords.x = coords.x + h_distortion * horizontal_distortion;" +
|
||||
(noise_strength ? "
|
||||
noise += horizontal_distortion;" : "")
|
||||
float dst = sin((coords.y + time * 0.001) * distortionFreq);
|
||||
coords.x += dst * distortionScale;"
|
||||
: "") +
|
||||
|
||||
(jitter !== 0 || noise_strength !== 0 ?
|
||||
"vec4 noiseTexel = texture2D(noiseSource, scaleNoiseSize * coords + vec2(fract(time / 51.0), fract(time / 237.0)));"
|
||||
: "") +
|
||||
|
||||
(jitter !== 0 ? "
|
||||
vec2 offset = vec2(texture2D(noiseSource, coords + fract(time / 57.0)).a,
|
||||
texture2D(noiseSource, coords + fract(time / 251.0)).a) - 0.5;
|
||||
vec2 offset = vec2(noiseTexel.b, noiseTexel.a) - vec2(0.5);
|
||||
vec2 txt_coords = coords + offset * jitter;"
|
||||
: "vec2 txt_coords = coords;") +
|
||||
|
||||
"float color = 0.0;" +
|
||||
|
||||
(noise_strength !== 0 ? "
|
||||
float noiseVal = texture2D(noiseSource, coords + vec2(fract(time / 51.0), fract(time / 237.0))).a;
|
||||
float noiseVal = noiseTexel.a;
|
||||
color += noiseVal * noise * (1.0 - distance * 1.3);" : "") +
|
||||
|
||||
(glowing_line_strength !== 0 ? "
|
||||
@ -248,7 +273,9 @@ ShaderEffect {
|
||||
:
|
||||
"vec3 finalColor = mix(background_color.rgb, font_color.rgb, greyscale_color);") +
|
||||
|
||||
"finalColor *= texture2D(rasterizationSource, coords).a;" +
|
||||
"finalColor *= getScanlineIntensity(coords);
|
||||
finalColor *= smoothstep(-dispX, 0.0, coords.x) - smoothstep(1.0, 1.0 + dispX, coords.x);
|
||||
finalColor *= smoothstep(-dispY, 0.0, coords.y) - smoothstep(1.0, 1.0 + dispY, coords.y);" +
|
||||
|
||||
(bloom_strength !== 0 ?
|
||||
"vec4 bloomFullColor = texture2D(bloomSource, coords);
|
||||
|
@ -1,57 +1,119 @@
|
||||
import QtQuick 2.2
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
Item{
|
||||
ShaderTerminal{
|
||||
property alias title: terminal.title
|
||||
property alias terminalSize: terminal.terminalSize
|
||||
|
||||
Item{
|
||||
id: scalableContent
|
||||
width: parent.width * shadersettings.window_scaling
|
||||
height: parent.height * shadersettings.window_scaling
|
||||
id: mainShader
|
||||
opacity: appSettings.windowOpacity * 0.3 + 0.7
|
||||
|
||||
Loader{
|
||||
id: frame
|
||||
anchors.fill: parent
|
||||
z: 2.1
|
||||
source: shadersettings.frame_source
|
||||
}
|
||||
PreprocessedTerminal{
|
||||
id: terminal
|
||||
anchors.fill: parent
|
||||
}
|
||||
ShaderTerminal{
|
||||
id: shadercontainer
|
||||
anchors.fill: parent
|
||||
opacity: shadersettings.windowOpacity * 0.3 + 0.7
|
||||
z: 1.9
|
||||
}
|
||||
blending: false
|
||||
|
||||
source: terminal.mainSource
|
||||
dispX: (12 / width) * appSettings.window_scaling
|
||||
dispY: (12 / height) * appSettings.window_scaling
|
||||
virtual_resolution: terminal.virtualResolution
|
||||
|
||||
Loader{
|
||||
id: frame
|
||||
anchors.fill: parent
|
||||
z: 2.1
|
||||
source: appSettings.frame_source
|
||||
}
|
||||
|
||||
// This is used to render the texture to a lower resolution then scale it up.
|
||||
PreprocessedTerminal{
|
||||
id: terminal
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
// EFFECTS ////////////////////////////////////////////////////////////////
|
||||
|
||||
Loader{
|
||||
id: scalableContentSource
|
||||
active: shadersettings.window_scaling < 1
|
||||
id: bloomEffectLoader
|
||||
active: appSettings.bloom_strength
|
||||
asynchronous: true
|
||||
width: parent.width * appSettings.bloom_quality
|
||||
height: parent.height * appSettings.bloom_quality
|
||||
sourceComponent: FastBlur{
|
||||
radius: 48 * appSettings.bloom_quality * appSettings.window_scaling
|
||||
source: terminal.mainTerminal
|
||||
transparentBorder: true
|
||||
}
|
||||
}
|
||||
Loader{
|
||||
id: bloomSourceLoader
|
||||
active: appSettings.bloom_strength !== 0
|
||||
asynchronous: true
|
||||
sourceComponent: ShaderEffectSource{
|
||||
sourceItem: scalableContent
|
||||
id: _bloomEffectSource
|
||||
sourceItem: bloomEffectLoader.item
|
||||
hideSource: true
|
||||
smooth: true
|
||||
}
|
||||
}
|
||||
Loader{
|
||||
active: shadersettings.window_scaling < 1
|
||||
anchors.fill: parent
|
||||
sourceComponent: ShaderEffect{
|
||||
property var source: scalableContentSource.item
|
||||
visible: false
|
||||
}
|
||||
}
|
||||
|
||||
// Terminal size overlay. Shown when terminal size changes.
|
||||
Loader{
|
||||
id: sizeoverlayloader
|
||||
z: 3
|
||||
anchors.centerIn: parent
|
||||
active: shadersettings.show_terminal_size
|
||||
sourceComponent: SizeOverlay{
|
||||
terminalSize: terminal.terminalSize
|
||||
}
|
||||
}
|
||||
bloomSource: bloomSourceLoader.item
|
||||
|
||||
// This shader might be useful in the future. Since we used it only for a couple
|
||||
// of calculations is probably best to move those in the main shader. If in
|
||||
// we will need to store another fullScreen channel this might be handy.
|
||||
|
||||
// ShaderEffect {
|
||||
// id: rasterizationEffect
|
||||
// width: parent.width
|
||||
// height: parent.height
|
||||
// property real outColor: 0.0
|
||||
// property real dispX: (5 / width) * appSettings.window_scaling
|
||||
// property real dispY: (5 / height) * appSettings.window_scaling
|
||||
// property size virtual_resolution: terminal.virtualResolution
|
||||
|
||||
// blending: false
|
||||
|
||||
// fragmentShader:
|
||||
// "uniform lowp float qt_Opacity;" +
|
||||
|
||||
// "varying highp vec2 qt_TexCoord0;
|
||||
// uniform highp vec2 virtual_resolution;
|
||||
// uniform highp float dispX;
|
||||
// uniform highp float dispY;
|
||||
// uniform mediump float outColor;
|
||||
|
||||
// highp float getScanlineIntensity(vec2 coords) {
|
||||
// highp float result = 1.0;" +
|
||||
|
||||
// (appSettings.rasterization != appSettings.no_rasterization ?
|
||||
// "result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") +
|
||||
// (appSettings.rasterization == appSettings.pixel_rasterization ?
|
||||
// "result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + "
|
||||
|
||||
// return result;
|
||||
// }" +
|
||||
|
||||
// "void main() {" +
|
||||
// "highp float color = getScanlineIntensity(qt_TexCoord0);" +
|
||||
|
||||
// "float distance = length(vec2(0.5) - qt_TexCoord0);" +
|
||||
// "color = mix(color, 0.0, 1.2 * distance * distance);" +
|
||||
|
||||
// "color *= outColor + smoothstep(0.00, dispX, qt_TexCoord0.x) * (1.0 - outColor);" +
|
||||
// "color *= outColor + smoothstep(0.00, dispY, qt_TexCoord0.y) * (1.0 - outColor);" +
|
||||
// "color *= outColor + (1.0 - smoothstep(1.00 - dispX, 1.00, qt_TexCoord0.x)) * (1.0 - outColor);" +
|
||||
// "color *= outColor + (1.0 - smoothstep(1.00 - dispY, 1.00, qt_TexCoord0.y)) * (1.0 - outColor);" +
|
||||
|
||||
// "gl_FragColor.a = color;" +
|
||||
// "}"
|
||||
|
||||
// onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||
// }
|
||||
|
||||
// rasterizationSource: ShaderEffectSource{
|
||||
// id: rasterizationEffectSource
|
||||
// sourceItem: rasterizationEffect
|
||||
// hideSource: true
|
||||
// smooth: true
|
||||
// wrapMode: ShaderEffectSource.ClampToEdge
|
||||
// visible: false
|
||||
// }
|
||||
}
|
||||
|
@ -27,13 +27,13 @@ Timer{
|
||||
NumberAnimation on time {
|
||||
from: 0
|
||||
to: 100000
|
||||
running: shadersettings.fps === 0 && enableTimer
|
||||
running: appSettings.fps === 0 && enableTimer
|
||||
duration: 100000
|
||||
loops: Animation.Infinite
|
||||
}
|
||||
|
||||
onTriggered: time += interval
|
||||
running: shadersettings.fps !== 0 && enableTimer
|
||||
interval: Math.round(1000 / shadersettings.fps)
|
||||
running: appSettings.fps !== 0 && enableTimer
|
||||
interval: Math.round(1000 / appSettings.fps)
|
||||
repeat: true
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 132 KiB |
@ -4,16 +4,16 @@ 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 real screen_distorsion: appSettings.screen_distortion * framecontainer.distortionCoefficient
|
||||
property real ambient_light: appSettings.ambient_light
|
||||
property color font_color: appSettings.font_color
|
||||
property color background_color: appSettings.background_color
|
||||
property real brightness: appSettings.brightness * 1.5 + 0.5
|
||||
|
||||
property bool frameReflections: shadersettings.frameReflections
|
||||
property bool frameReflections: appSettings.frameReflections
|
||||
property variant lightSource: reflectionEffectSourceLoader.item
|
||||
|
||||
property real chroma_color: shadersettings.chroma_color
|
||||
property real chroma_color: appSettings.chroma_color
|
||||
|
||||
Loader{
|
||||
id: reflectionEffectLoader
|
||||
@ -37,6 +37,7 @@ ShaderEffect{
|
||||
sourceItem: reflectionEffectLoader.item
|
||||
hideSource: true
|
||||
smooth: true
|
||||
visible: false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,12 +56,14 @@ Item{
|
||||
sourceItem: frameimage
|
||||
hideSource: true
|
||||
textureSize: Qt.size(parent.width, parent.height)
|
||||
visible: false
|
||||
}
|
||||
ShaderEffectSource{
|
||||
id: framesourcenormals
|
||||
sourceItem: framenormals
|
||||
hideSource: true
|
||||
textureSize: Qt.size(parent.width, parent.height)
|
||||
visible: false
|
||||
}
|
||||
Loader{
|
||||
anchors.centerIn: parent
|
||||
|
BIN
app/qml/images/allNoise512.png
Normal file
BIN
app/qml/images/allNoise512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 608 KiB |
@ -33,13 +33,13 @@ ApplicationWindow{
|
||||
|
||||
visible: true
|
||||
|
||||
property bool fullscreen: shadersettings.fullscreen
|
||||
property bool fullscreen: appSettings.fullscreen
|
||||
onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed)
|
||||
|
||||
//Workaround: if menubar is assigned ugly margins are visible.
|
||||
menuBar: Qt.platform.os === "osx"
|
||||
? defaultMenuBar
|
||||
: shadersettings.showMenubar ? defaultMenuBar : null
|
||||
: appSettings.showMenubar ? defaultMenuBar : null
|
||||
|
||||
color: "#00000000"
|
||||
title: terminalContainer.title || qsTr("cool-retro-term")
|
||||
@ -50,17 +50,17 @@ ApplicationWindow{
|
||||
enabled: Qt.platform.os !== "osx"
|
||||
shortcut: "Ctrl+Shift+M"
|
||||
checkable: true
|
||||
checked: shadersettings.showMenubar
|
||||
onTriggered: shadersettings.showMenubar = !shadersettings.showMenubar
|
||||
checked: appSettings.showMenubar
|
||||
onTriggered: appSettings.showMenubar = !appSettings.showMenubar
|
||||
}
|
||||
Action {
|
||||
id: fullscreenAction
|
||||
text: qsTr("Fullscreen")
|
||||
enabled: Qt.platform.os !== "osx"
|
||||
shortcut: "Alt+F11"
|
||||
onTriggered: shadersettings.fullscreen = !shadersettings.fullscreen;
|
||||
onTriggered: appSettings.fullscreen = !appSettings.fullscreen;
|
||||
checkable: true
|
||||
checked: shadersettings.fullscreen
|
||||
checked: appSettings.fullscreen
|
||||
}
|
||||
Action {
|
||||
id: quitAction
|
||||
@ -87,13 +87,13 @@ ApplicationWindow{
|
||||
id: zoomIn
|
||||
text: qsTr("Zoom In")
|
||||
shortcut: "Ctrl++"
|
||||
onTriggered: shadersettings.incrementScaling();
|
||||
onTriggered: appSettings.incrementScaling();
|
||||
}
|
||||
Action{
|
||||
id: zoomOut
|
||||
text: qsTr("Zoom Out")
|
||||
shortcut: "Ctrl+-"
|
||||
onTriggered: shadersettings.decrementScaling();
|
||||
onTriggered: appSettings.decrementScaling();
|
||||
}
|
||||
Action{
|
||||
id: showAboutAction
|
||||
@ -106,11 +106,17 @@ ApplicationWindow{
|
||||
id: defaultMenuBar
|
||||
}
|
||||
ApplicationSettings{
|
||||
id: shadersettings
|
||||
id: appSettings
|
||||
}
|
||||
TerminalContainer{
|
||||
id: terminalContainer
|
||||
anchors.fill: parent
|
||||
width: parent.width * appSettings.window_scaling
|
||||
height: parent.height * appSettings.window_scaling
|
||||
|
||||
transform: Scale {
|
||||
xScale: 1 / appSettings.window_scaling
|
||||
yScale: 1 / appSettings.window_scaling
|
||||
}
|
||||
}
|
||||
SettingsWindow{
|
||||
id: settingswindow
|
||||
@ -120,5 +126,13 @@ ApplicationWindow{
|
||||
id: aboutDialog
|
||||
visible: false
|
||||
}
|
||||
Component.onCompleted: shadersettings.handleFontChanged();
|
||||
Loader{
|
||||
anchors.centerIn: parent
|
||||
active: appSettings.show_terminal_size
|
||||
sourceComponent: SizeOverlay{
|
||||
z: 3
|
||||
terminalSize: terminalContainer.terminalSize
|
||||
}
|
||||
}
|
||||
Component.onCompleted: appSettings.handleFontChanged();
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
<file>frames/images/black-frame-normals.png</file>
|
||||
<file>frames/images/screen-frame.png</file>
|
||||
<file>frames/images/black-frame-original.png</file>
|
||||
<file>frames/images/randfunction.png</file>
|
||||
<file>frames/images/screen-frame-original.png</file>
|
||||
<file>frames/WhiteSimpleFrame.qml</file>
|
||||
<file>frames/utils/FrameShader.qml</file>
|
||||
@ -66,5 +65,7 @@
|
||||
<file>SettingsPerformanceTab.qml</file>
|
||||
<file>TerminalContainer.qml</file>
|
||||
<file>images/crt256.png</file>
|
||||
<file>utils.js</file>
|
||||
<file>images/allNoise512.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
14
app/qml/utils.js
Normal file
14
app/qml/utils.js
Normal file
@ -0,0 +1,14 @@
|
||||
.pragma library
|
||||
|
||||
function mix(c1, c2, alpha){
|
||||
return Qt.rgba(c1.r * alpha + c2.r * (1-alpha),
|
||||
c1.g * alpha + c2.g * (1-alpha),
|
||||
c1.b * alpha + c2.b * (1-alpha),
|
||||
c1.a * alpha + c2.a * (1-alpha))
|
||||
}
|
||||
function strToColor(s){
|
||||
var r = parseInt(s.substring(1,3), 16) / 256;
|
||||
var g = parseInt(s.substring(3,5), 16) / 256;
|
||||
var b = parseInt(s.substring(5,7), 16) / 256;
|
||||
return Qt.rgba(r, g, b, 1.0);
|
||||
}
|
@ -1 +1 @@
|
||||
Subproject commit 02bb99b446a51052f7e950029cf331117ac78ab6
|
||||
Subproject commit fb04792ae3dfbbc40a8d957a7b7300a98862bb9d
|
Loading…
x
Reference in New Issue
Block a user