mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2026-02-08 00:32:27 +00:00
Compare commits
16 Commits
1.2.0-beta
...
qt6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
002c85e35f | ||
|
|
fed2bf21fe | ||
|
|
3f51308057 | ||
|
|
70d7d1b9ce | ||
|
|
c1082f2e3e | ||
|
|
7038b30381 | ||
|
|
1d73abda51 | ||
|
|
f157648d1e | ||
|
|
d4baaeccfc | ||
|
|
d412b66c6e | ||
|
|
74ae511f92 | ||
|
|
a3fbafe4ae | ||
|
|
8a45fbe9ed | ||
|
|
01c7929ee3 | ||
|
|
2261af17d7 | ||
|
|
41f34c3992 |
98
.github/workflows/appimage.yml
vendored
Normal file
98
.github/workflows/appimage.yml
vendored
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
name: "ci"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: "**"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
appimage:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo add-apt-repository -y ppa:beineri/opt-qt-5.15.2-bionic
|
||||||
|
sudo apt-get update -qq
|
||||||
|
sudo apt-get install -y \
|
||||||
|
build-essential make wget libgl1-mesa-dev \
|
||||||
|
qt515declarative qt515graphicaleffects \
|
||||||
|
qt515quickcontrols qt515quickcontrols2
|
||||||
|
|
||||||
|
- name: Download QT appimage builder
|
||||||
|
run: |
|
||||||
|
wget -c -O linuxdeployqt.AppImage \
|
||||||
|
https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
|
||||||
|
chmod a+x linuxdeployqt.AppImage
|
||||||
|
|
||||||
|
- name: Build project
|
||||||
|
run: |
|
||||||
|
source /opt/qt*/bin/qt*-env.sh && \
|
||||||
|
qmake -v && \
|
||||||
|
qmake CONFIG+=release PREFIX=/usr && \
|
||||||
|
make -j$(nproc)
|
||||||
|
|
||||||
|
- name: Install to appdir
|
||||||
|
run: |
|
||||||
|
source /opt/qt*/bin/qt*-env.sh && \
|
||||||
|
make INSTALL_ROOT=appdir -j$(nproc) install
|
||||||
|
|
||||||
|
- name: Extract version number
|
||||||
|
run: |
|
||||||
|
# Extract version for linuxdeployqt to name the file. Use the tag as
|
||||||
|
# release name but remove prefix.
|
||||||
|
echo "VERSION=$(echo '${{ github.ref }}' | sed 's;.*/;;')" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Build appimage directory
|
||||||
|
run: |
|
||||||
|
mkdir -p \
|
||||||
|
appdir/usr/bin \
|
||||||
|
appdir/usr/lib \
|
||||||
|
appdir/usr/share/applications \
|
||||||
|
appdir/usr/share/metainfo \
|
||||||
|
appdir/usr/share/icons/hicolor/128x128/apps
|
||||||
|
|
||||||
|
cp cool-retro-term appdir/usr/bin/
|
||||||
|
cp cool-retro-term.desktop appdir/usr/share/applications/
|
||||||
|
cp packaging/appdata/cool-retro-term.appdata.xml appdir/usr/share/metainfo/
|
||||||
|
cp app/icons/128x128/cool-retro-term.png appdir/usr/share/icons/hicolor/128x128/apps/
|
||||||
|
cp -r ./app/qml appdir/usr/
|
||||||
|
# Workaround for https://github.com/probonopd/linuxdeployqt/issues/78
|
||||||
|
cp -r ./qmltermwidget/QMLTermWidget appdir/usr/qml/
|
||||||
|
|
||||||
|
find appdir | sort
|
||||||
|
|
||||||
|
- name: Build appimage
|
||||||
|
run: |
|
||||||
|
source /opt/qt*/bin/qt*-env.sh && \
|
||||||
|
./linuxdeployqt.AppImage appdir/usr/share/applications/cool-retro-term.desktop \
|
||||||
|
-verbose=1 -appimage \
|
||||||
|
-qmldir=./app/qml/ \
|
||||||
|
-qmldir=./qmltermwidget/
|
||||||
|
env:
|
||||||
|
# Unset environment variables
|
||||||
|
QTDIR:
|
||||||
|
QT_PLUGIN_PATH:
|
||||||
|
LD_LIBRARY_PATH:
|
||||||
|
|
||||||
|
- name: Upload release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
body: appimage release
|
||||||
|
files: ./**/Cool_Retro_Term-*-x86_64.AppImage
|
||||||
|
|
||||||
|
- name: Clean up
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
find appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq
|
||||||
|
make clean
|
||||||
|
rm -rf appdir
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -43,6 +43,7 @@ Makefile*
|
|||||||
# Excludes compiled files
|
# Excludes compiled files
|
||||||
imports
|
imports
|
||||||
cool-retro-term
|
cool-retro-term
|
||||||
|
build
|
||||||
|
|
||||||
# Mac OSX
|
# Mac OSX
|
||||||
|
|
||||||
|
|||||||
192
README.md
192
README.md
@@ -8,9 +8,9 @@
|
|||||||
cool-retro-term is a terminal emulator which mimics the look and feel of the old cathode tube screens.
|
cool-retro-term is a terminal emulator which mimics the look and feel of the old cathode tube screens.
|
||||||
It has been designed to be eye-candy, customizable, and reasonably lightweight.
|
It has been designed to be eye-candy, customizable, and reasonably lightweight.
|
||||||
|
|
||||||
It uses the QML port of qtermwidget (Konsole) developed by me: https://github.com/Swordfish90/qmltermwidget.
|
It uses the QML port of qtermwidget (Konsole): https://github.com/Swordfish90/qmltermwidget.
|
||||||
|
|
||||||
This terminal emulator works under Linux and macOS and requires Qt 5.2 or higher.
|
This terminal emulator works under Linux and macOS and requires Qt5. It's suggested that you stick to the latest LTS version.
|
||||||
|
|
||||||
Settings such as colors, fonts, and effects can be accessed via context menu.
|
Settings such as colors, fonts, and effects can be accessed via context menu.
|
||||||
|
|
||||||
@@ -20,191 +20,11 @@ Settings such as colors, fonts, and effects can be accessed via context menu.
|
|||||||

|

|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
Walk the easy way and install cool-retro-term using one of these convenient packages:
|
|
||||||
|
|
||||||
Just grab the latest AppImage from the release page and make it executable and run it:
|
If you want to get a hold of the latest version, just go to the Releases page and grab the latest AppImage (Linux) or dmg (macOS).
|
||||||
|
|
||||||
wget https://github.com/Swordfish90/cool-retro-term/releases/download/1.1.1/Cool-Retro-Term-1.1.1-x86_64.AppImage
|
Alternatively, most distributions such as Ubuntu, Fedora or Arch already package cool-retro-term in their official repositories.
|
||||||
chmod a+x Cool-Retro-Term-1.1.1-x86_64.AppImage
|
|
||||||
./Cool-Retro-Term-1.1.1-x86_64.AppImage
|
|
||||||
|
|
||||||
**Fedora** has the `cool-retro-term` in the official repositories. All you have to do is `sudo dnf install cool-retro-term`.
|
## Building
|
||||||
|
|
||||||
Users of **openSUSE** can grab a package from [Open Build Service](http://software.opensuse.org/package/cool-retro-term).
|
Check out the wiki and follow the instructions on how to build it on [Linux](https://github.com/Swordfish90/cool-retro-term/wiki/Build-Instructions-(Linux)) and [macOS](https://github.com/Swordfish90/cool-retro-term/wiki/Build-Instructions-(macOS)).
|
||||||
|
|
||||||
**Arch** users can install this [package](https://aur.archlinux.org/packages/cool-retro-term-git/) directly via the [AUR](https://aur.archlinux.org):
|
|
||||||
|
|
||||||
trizen -S aur/cool-retro-term-git
|
|
||||||
|
|
||||||
or use:
|
|
||||||
|
|
||||||
pacman -S cool-retro-term
|
|
||||||
|
|
||||||
to install precompiled from community repository.
|
|
||||||
|
|
||||||
Users of **Ubuntu 14.04 LTS (Trusty) up to 15.10 (Wily)** can use [this PPA](https://launchpad.net/~bugs-launchpad-net-falkensweb).
|
|
||||||
|
|
||||||
**Ubuntu 17.10** can use [this PPA](https://launchpad.net/%7Evantuz/+archive/ubuntu/cool-retro-term)
|
|
||||||
|
|
||||||
**Solus** users can install using `eopg`:
|
|
||||||
```
|
|
||||||
eopkg it cool-retro-term
|
|
||||||
```
|
|
||||||
|
|
||||||
**macOS** users can grab the latest dmg from the [release page](https://github.com/Swordfish90/cool-retro-term/releases) or install via Homebrew or MacPorts:
|
|
||||||
```
|
|
||||||
brew install cool-retro-term --cask
|
|
||||||
```
|
|
||||||
or
|
|
||||||
```
|
|
||||||
port install cool-retro-term
|
|
||||||
```
|
|
||||||
|
|
||||||
**FreeBSD** users can install cool-retro-term with `pkg`:
|
|
||||||
|
|
||||||
pkg install cool-retro-term
|
|
||||||
|
|
||||||
## Build instructions (FreeBSD)
|
|
||||||
|
|
||||||
Grab a copy of [the FreeBSD Ports Collection](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html), modify [`/usr/ports/x11/cool-retro-term/Makefile`](https://svnweb.freebsd.org/ports/head/x11/cool-retro-term/Makefile?view=markup) as you like, and then run `make install` to build and install the emulator:
|
|
||||||
|
|
||||||
```
|
|
||||||
cd /usr/ports/x11/cool-retro-term
|
|
||||||
make install
|
|
||||||
```
|
|
||||||
|
|
||||||
## Build instructions (Linux)
|
|
||||||
|
|
||||||
Build cool-retro-term yourself, you know, the retro way.
|
|
||||||
|
|
||||||
## Dependencies
|
|
||||||
Make sure to install these first.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Ubuntu 14.04**
|
|
||||||
|
|
||||||
sudo apt-get install build-essential qmlscene qt5-qmake qt5-default qtdeclarative5-dev qtdeclarative5-controls-plugin qtdeclarative5-qtquick2-plugin libqt5qml-graphicaleffects qtdeclarative5-dialogs-plugin qtdeclarative5-localstorage-plugin qtdeclarative5-window-plugin
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Ubuntu 16.10**
|
|
||||||
|
|
||||||
sudo apt-get install build-essential qmlscene qt5-qmake qt5-default qtdeclarative5-dev qml-module-qtquick-controls qtdeclarative5-qtquick2-plugin libqt5qml-graphicaleffects qml-module-qtquick-dialogs qtdeclarative5-localstorage-plugin qtdeclarative5-window-plugin
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Ubuntu 17.04**
|
|
||||||
|
|
||||||
sudo apt install build-essential libqt5qml-graphicaleffects qml-module-qt-labs-folderlistmodel qml-module-qt-labs-settings qml-module-qtquick-controls qml-module-qtquick-dialogs qmlscene qt5-default qt5-qmake qtdeclarative5-dev qtdeclarative5-localstorage-plugin qtdeclarative5-qtquick2-plugin qtdeclarative5-window-plugin
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Ubuntu 17.10**
|
|
||||||
|
|
||||||
sudo apt-get install build-essential qml-module-qtgraphicaleffects qml-module-qt-labs-folderlistmodel qml-module-qt-labs-settings qml-module-qtquick-controls qml-module-qtquick-dialogs qmlscene qt5-default qt5-qmake qtdeclarative5-dev qtdeclarative5-localstorage-plugin qtdeclarative5-qtquick2-plugin qtdeclarative5-window-plugin
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**snapcraft (most of distros)**
|
|
||||||
|
|
||||||
sudo snap install cool-retro-term --classic
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Debian Jessie and above**
|
|
||||||
|
|
||||||
sudo apt install build-essential qmlscene qt5-qmake qt5-default qtdeclarative5-dev qml-module-qtquick-controls qml-module-qtgraphicaleffects qml-module-qtquick-dialogs qml-module-qtquick-localstorage qml-module-qtquick-window2 qml-module-qt-labs-settings qml-module-qt-labs-folderlistmodel
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Fedora**
|
|
||||||
This command should install the known fedora dependencies:
|
|
||||||
|
|
||||||
sudo yum -y install qt5-qtbase qt5-qtbase-devel qt5-qtdeclarative qt5-qtdeclarative-devel qt5-qtgraphicaleffects qt5-qtquickcontrols redhat-rpm-config
|
|
||||||
|
|
||||||
or:
|
|
||||||
|
|
||||||
sudo dnf -y install qt5-qtbase qt5-qtbase-devel qt5-qtdeclarative qt5-qtdeclarative-devel qt5-qtgraphicaleffects qt5-qtquickcontrols redhat-rpm-config
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Arch Linux**
|
|
||||||
|
|
||||||
sudo pacman -S qt5-base qt5-declarative qt5-quickcontrols qt5-graphicaleffects
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**openSUSE**
|
|
||||||
|
|
||||||
Add repository with latest Qt 5 (this is only needed on openSUSE 13.1, Factory already has it):
|
|
||||||
|
|
||||||
sudo zypper ar http://download.opensuse.org/repositories/KDE:/Qt5/openSUSE_13.1/ KDE:Qt5
|
|
||||||
|
|
||||||
Install dependencies:
|
|
||||||
|
|
||||||
sudo zypper install libqt5-qtbase-devel libqt5-qtdeclarative-devel libqt5-qtquickcontrols libqt5-qtgraphicaleffects
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Anyone else**
|
|
||||||
|
|
||||||
Install Qt directly from here http://qt-project.org/downloads . Once done export them in you path (replace "_/opt/Qt5.3.1/5.3/gcc_64/bin_" with your correct folder):
|
|
||||||
|
|
||||||
export PATH=/opt/Qt5.3.1/5.3/gcc_64/bin/:$PATH
|
|
||||||
---
|
|
||||||
|
|
||||||
### Compile
|
|
||||||
Once you installed all dependencies (Qt is installed and in your path) you need to compile and run the application:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Get it from GitHub
|
|
||||||
git clone --recursive https://github.com/Swordfish90/cool-retro-term.git
|
|
||||||
|
|
||||||
# Build it
|
|
||||||
cd cool-retro-term
|
|
||||||
|
|
||||||
# Compile (Fedora and OpenSUSE user should use qmake-qt5 instead of qmake)
|
|
||||||
qmake && make
|
|
||||||
|
|
||||||
# Have fun!
|
|
||||||
./cool-retro-term
|
|
||||||
```
|
|
||||||
|
|
||||||
## Build instructions (macOS)
|
|
||||||
|
|
||||||
1. Install [Xcode](https://developer.apple.com/xcode/) and agree to the licence agreement
|
|
||||||
2. Enter the following commands into the terminal:
|
|
||||||
|
|
||||||
**Brew**
|
|
||||||
|
|
||||||
```sh
|
|
||||||
brew install qt5
|
|
||||||
git clone --recursive https://github.com/Swordfish90/cool-retro-term.git
|
|
||||||
export CPPFLAGS="-I/usr/local/opt/qt5/include"
|
|
||||||
export LDFLAGS="-L/usr/local/opt/qt5/lib"
|
|
||||||
export PATH=/usr/local/opt/qt5/bin:$PATH
|
|
||||||
cd cool-retro-term
|
|
||||||
qmake && make
|
|
||||||
mkdir cool-retro-term.app/Contents/PlugIns
|
|
||||||
cp -r qmltermwidget/QMLTermWidget cool-retro-term.app/Contents/PlugIns
|
|
||||||
open cool-retro-term.app
|
|
||||||
```
|
|
||||||
|
|
||||||
**MacPorts**
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo port install qt5
|
|
||||||
git clone --recursive https://github.com/Swordfish90/cool-retro-term.git
|
|
||||||
cd cool-retro-term
|
|
||||||
/opt/local/libexec/qt5/bin/qmake && make
|
|
||||||
mkdir cool-retro-term.app/Contents/PlugIns
|
|
||||||
cp -r qmltermwidget/QMLTermWidget cool-retro-term.app/Contents/PlugIns
|
|
||||||
open cool-retro-term.app
|
|
||||||
```
|
|
||||||
|
|
||||||
**Homebrew**
|
|
||||||
|
|
||||||
```sh
|
|
||||||
brew install cool-retro-term --cask
|
|
||||||
```
|
|
||||||
|
|||||||
17
app/app.pro
17
app/app.pro
@@ -15,6 +15,23 @@ macx:ICON = icons/crt.icns
|
|||||||
|
|
||||||
RESOURCES += qml/resources.qrc
|
RESOURCES += qml/resources.qrc
|
||||||
|
|
||||||
|
# Shader compilation (Qt Shader Baker)
|
||||||
|
QSB_BIN = $$[QT_HOST_BINS]/qsb
|
||||||
|
isEmpty(QSB_BIN): QSB_BIN = $$[QT_INSTALL_BINS]/qsb
|
||||||
|
|
||||||
|
SHADERS_DIR = $${_PRO_FILE_PWD_}/shaders
|
||||||
|
SHADERS += $$files($$SHADERS_DIR/*.frag) $$files($$SHADERS_DIR/*.vert)
|
||||||
|
|
||||||
|
qsb.input = SHADERS
|
||||||
|
qsb.output = ../../app/shaders/${QMAKE_FILE_NAME}.qsb
|
||||||
|
qsb.commands = $$QSB_BIN --glsl \"100 es,120,150\" --hlsl 50 --msl 12 --qt6 -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
|
||||||
|
qsb.clean = $$qsb.output
|
||||||
|
qsb.name = qsb ${QMAKE_FILE_IN}
|
||||||
|
qsb.variable_out = QSB_FILES
|
||||||
|
QMAKE_EXTRA_COMPILERS += qsb
|
||||||
|
PRE_TARGETDEPS += $$QSB_FILES
|
||||||
|
OTHER_FILES += $$SHADERS $$QSB_FILES
|
||||||
|
|
||||||
#########################################
|
#########################################
|
||||||
## INTALLS
|
## INTALLS
|
||||||
#########################################
|
#########################################
|
||||||
|
|||||||
47
app/main.cpp
47
app/main.cpp
@@ -17,6 +17,10 @@
|
|||||||
#include <fileio.h>
|
#include <fileio.h>
|
||||||
#include <monospacefontmanager.h>
|
#include <monospacefontmanager.h>
|
||||||
|
|
||||||
|
#if defined(Q_OS_MAC)
|
||||||
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
QString getNamedArgument(QStringList args, QString name, QString defaultName)
|
QString getNamedArgument(QStringList args, QString name, QString defaultName)
|
||||||
{
|
{
|
||||||
int index = args.indexOf(name);
|
int index = args.indexOf(name);
|
||||||
@@ -31,44 +35,45 @@ QString getNamedArgument(QStringList args, QString name)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// Some environmental variable are necessary on certain platforms.
|
// Some environmental variable are necessary on certain platforms.
|
||||||
|
|
||||||
// This disables QT appmenu under Ubuntu, which is not working with QML apps.
|
|
||||||
setenv("QT_QPA_PLATFORMTHEME", "", 1);
|
|
||||||
|
|
||||||
// Disable Connections slot warnings
|
// Disable Connections slot warnings
|
||||||
QLoggingCategory::setFilterRules("qt.qml.connections.warning=false");
|
QLoggingCategory::setFilterRules("qt.qml.connections.warning=false");
|
||||||
|
|
||||||
#if defined (Q_OS_LINUX)
|
// TODO FILIPPO... This should not be hardcoded but handled as a fallback of sort!
|
||||||
setenv("QSG_RENDER_LOOP", "threaded", 0);
|
QQuickStyle::setStyle("Material");
|
||||||
#endif
|
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Round);
|
||||||
|
|
||||||
|
// #if defined (Q_OS_LINUX)
|
||||||
|
// setenv("QSG_RENDER_LOOP", "threaded", 0);
|
||||||
|
// #endif
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
// This allows UTF-8 characters usage in OSX.
|
// This allows UTF-8 characters usage in OSX.
|
||||||
setenv("LC_CTYPE", "UTF-8", 1);
|
setenv("LC_CTYPE", "UTF-8", 1);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Force fusion style on every platform
|
// Ensure key repeat works for letter keys (disable macOS press-and-hold for this app).
|
||||||
QQuickStyle::setStyle("Fusion");
|
CFPreferencesSetAppValue(CFSTR("ApplePressAndHoldEnabled"), kCFBooleanFalse, kCFPreferencesCurrentApplication);
|
||||||
|
CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (argc>1 && (!strcmp(argv[1],"-h") || !strcmp(argv[1],"--help"))) {
|
if (argc>1 && (!strcmp(argv[1],"-h") || !strcmp(argv[1],"--help"))) {
|
||||||
QTextStream cout(stdout, QIODevice::WriteOnly);
|
QTextStream cout(stdout, QIODevice::WriteOnly);
|
||||||
cout << "Usage: " << argv[0] << " [--default-settings] [--workdir <dir>] [--program <prog>] [-p|--profile <prof>] [--fullscreen] [-h|--help]" << endl;
|
cout << "Usage: " << argv[0] << " [--default-settings] [--workdir <dir>] [--program <prog>] [-p|--profile <prof>] [--fullscreen] [-h|--help]" << Qt::endl;
|
||||||
cout << " --default-settings Run cool-retro-term with the default settings" << endl;
|
cout << " --default-settings Run cool-retro-term with the default settings" << Qt::endl;
|
||||||
cout << " --workdir <dir> Change working directory to 'dir'" << endl;
|
cout << " --workdir <dir> Change working directory to 'dir'" << Qt::endl;
|
||||||
cout << " -e <cmd> Command to execute. This option will catch all following arguments, so use it as the last option." << endl;
|
cout << " -e <cmd> Command to execute. This option will catch all following arguments, so use it as the last option." << Qt::endl;
|
||||||
cout << " -T <title> Set window title to 'title'." << endl;
|
cout << " -T <title> Set window title to 'title'." << Qt::endl;
|
||||||
cout << " --fullscreen Run cool-retro-term in fullscreen." << endl;
|
cout << " --fullscreen Run cool-retro-term in fullscreen." << Qt::endl;
|
||||||
cout << " -p|--profile <prof> Run cool-retro-term with the given profile." << endl;
|
cout << " -p|--profile <prof> Run cool-retro-term with the given profile." << Qt::endl;
|
||||||
cout << " -h|--help Print this help." << endl;
|
cout << " -h|--help Print this help." << Qt::endl;
|
||||||
cout << " --verbose Print additional information such as profiles and settings." << endl;
|
cout << " --verbose Print additional information such as profiles and settings." << Qt::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString appVersion("1.2.0-beta1");
|
QString appVersion("1.2.0");
|
||||||
|
|
||||||
if (argc>1 && (!strcmp(argv[1],"-v") || !strcmp(argv[1],"--version"))) {
|
if (argc>1 && (!strcmp(argv[1],"-v") || !strcmp(argv[1],"--version"))) {
|
||||||
QTextStream cout(stdout, QIODevice::WriteOnly);
|
QTextStream cout(stdout, QIODevice::WriteOnly);
|
||||||
cout << "cool-retro-term " << appVersion << endl;
|
cout << "cool-retro-term " << appVersion << Qt::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ QtObject {
|
|||||||
readonly property real minimumFontScaling: 0.25
|
readonly property real minimumFontScaling: 0.25
|
||||||
readonly property real maximumFontScaling: 2.50
|
readonly property real maximumFontScaling: 2.50
|
||||||
|
|
||||||
readonly property real minBurnInFadeTime: 160
|
readonly property real minBurnInFadeTime: 0.16
|
||||||
readonly property real maxBurnInFadeTime: 1600
|
readonly property real maxBurnInFadeTime: 1.6
|
||||||
|
|
||||||
property bool isMacOS: Qt.platform.os === "osx"
|
property bool isMacOS: Qt.platform.os === "osx"
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ QtObject {
|
|||||||
property bool showTerminalSize: true
|
property bool showTerminalSize: true
|
||||||
property real windowScaling: 1.0
|
property real windowScaling: 1.0
|
||||||
|
|
||||||
property real fps: 20
|
property int effectsFrameSkip: 2
|
||||||
property bool verbose: false
|
property bool verbose: false
|
||||||
|
|
||||||
property real bloomQuality: 0.5
|
property real bloomQuality: 0.5
|
||||||
@@ -229,7 +229,7 @@ QtObject {
|
|||||||
|
|
||||||
function composeSettingsString() {
|
function composeSettingsString() {
|
||||||
var settings = {
|
var settings = {
|
||||||
"fps": fps,
|
"effectsFrameSkip": effectsFrameSkip,
|
||||||
"x": x,
|
"x": x,
|
||||||
"y": y,
|
"y": y,
|
||||||
"width": width,
|
"width": width,
|
||||||
@@ -315,7 +315,7 @@ QtObject {
|
|||||||
showTerminalSize = settings.showTerminalSize
|
showTerminalSize = settings.showTerminalSize
|
||||||
!== undefined ? settings.showTerminalSize : showTerminalSize
|
!== undefined ? settings.showTerminalSize : showTerminalSize
|
||||||
|
|
||||||
fps = settings.fps !== undefined ? settings.fps : fps
|
effectsFrameSkip = settings.effectsFrameSkip !== undefined ? settings.effectsFrameSkip : effectsFrameSkip
|
||||||
windowScaling = settings.windowScaling
|
windowScaling = settings.windowScaling
|
||||||
!== undefined ? settings.windowScaling : windowScaling
|
!== undefined ? settings.windowScaling : windowScaling
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ Loader {
|
|||||||
Connections {
|
Connections {
|
||||||
target: kterminal
|
target: kterminal
|
||||||
|
|
||||||
function onImagePainted() {
|
onImagePainted: {
|
||||||
completelyUpdate()
|
completelyUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,76 +84,68 @@ Loader {
|
|||||||
Connections {
|
Connections {
|
||||||
target: appSettings
|
target: appSettings
|
||||||
|
|
||||||
function onBurnInChanged() {
|
onBurnInChanged: {
|
||||||
burnInEffect.restartBlurSource()
|
burnInEffect.restartBlurSource()
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTerminalFontChanged() {
|
onTerminalFontChanged: {
|
||||||
burnInEffect.restartBlurSource()
|
burnInEffect.restartBlurSource()
|
||||||
}
|
}
|
||||||
|
|
||||||
function onRasterizationChanged() {
|
onRasterizationChanged: {
|
||||||
burnInEffect.restartBlurSource()
|
burnInEffect.restartBlurSource()
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBurnInQualityChanged() {
|
onBurnInQualityChanged: {
|
||||||
burnInEffect.restartBlurSource()
|
burnInEffect.restartBlurSource()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderLibrary {
|
|
||||||
id: shaderLibrary
|
|
||||||
}
|
|
||||||
|
|
||||||
ShaderEffect {
|
ShaderEffect {
|
||||||
id: burnInShaderEffect
|
id: burnInShaderEffect
|
||||||
|
|
||||||
property variant txt_source: kterminalSource
|
property variant txt_source: kterminalSource
|
||||||
property variant burnInSource: burnInEffectSource
|
property variant burnInSource: burnInEffectSource
|
||||||
property real burnInTime: burnInFadeTime
|
property real burnInTime: burnInFadeTime
|
||||||
property real lastUpdate: burnInEffect.lastUpdate
|
property real burnInLastUpdate: burnInEffect.lastUpdate
|
||||||
property real prevLastUpdate: burnInEffect.prevLastUpdate
|
property real prevLastUpdate: burnInEffect.prevLastUpdate
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
blending: false
|
blending: false
|
||||||
|
|
||||||
fragmentShader:
|
// Extra uniforms required by shared block
|
||||||
"#ifdef GL_ES
|
property real qt_Opacity: 1.0
|
||||||
precision mediump float;
|
property real time: timeManager.time
|
||||||
#endif\n" +
|
property color fontColor: appSettings.fontColor
|
||||||
|
property color backgroundColor: appSettings.backgroundColor
|
||||||
|
property real shadowLength: 0
|
||||||
|
property size virtualResolution: Qt.size(width, height)
|
||||||
|
property real rasterizationIntensity: 0
|
||||||
|
property int rasterizationMode: 0
|
||||||
|
property real burnIn: appSettings.burnIn
|
||||||
|
property real staticNoise: 0
|
||||||
|
property real screenCurvature: 0
|
||||||
|
property real glowingLine: 0
|
||||||
|
property real chromaColor: 0
|
||||||
|
property size jitterDisplacement: Qt.size(0, 0)
|
||||||
|
property real ambientLight: 0
|
||||||
|
property real jitter: 0
|
||||||
|
property real horizontalSync: 0
|
||||||
|
property real horizontalSyncStrength: 0
|
||||||
|
property real flickering: 0
|
||||||
|
property real displayTerminalFrame: 0
|
||||||
|
property size scaleNoiseSize: Qt.size(0, 0)
|
||||||
|
property real screen_brightness: 1.0
|
||||||
|
property real bloom: 0
|
||||||
|
property real rbgShift: 0
|
||||||
|
property real screenShadowCoeff: 0
|
||||||
|
property real frameShadowCoeff: 0
|
||||||
|
property color frameColor: backgroundColor
|
||||||
|
property size margin: Qt.size(0, 0)
|
||||||
|
|
||||||
"uniform lowp float qt_Opacity;" +
|
fragmentShader: "qrc:/shaders/burn_in.frag.qsb"
|
||||||
"uniform lowp sampler2D txt_source;" +
|
vertexShader: "qrc:/shaders/passthrough.vert.qsb"
|
||||||
|
|
||||||
"varying highp vec2 qt_TexCoord0;
|
|
||||||
|
|
||||||
uniform lowp sampler2D burnInSource;
|
|
||||||
uniform highp float burnInTime;
|
|
||||||
|
|
||||||
uniform highp float lastUpdate;
|
|
||||||
|
|
||||||
uniform highp float prevLastUpdate;" +
|
|
||||||
|
|
||||||
shaderLibrary.rgb2grey +
|
|
||||||
|
|
||||||
"void main() {
|
|
||||||
vec2 coords = qt_TexCoord0;
|
|
||||||
|
|
||||||
vec3 txtColor = texture2D(txt_source, coords).rgb;
|
|
||||||
vec4 accColor = texture2D(burnInSource, coords);
|
|
||||||
|
|
||||||
float prevMask = accColor.a;
|
|
||||||
float currMask = rgb2grey(txtColor);
|
|
||||||
|
|
||||||
highp float blurDecay = clamp((lastUpdate - prevLastUpdate) * burnInTime, 0.0, 1.0);
|
|
||||||
blurDecay = max(0.0, blurDecay - prevMask);
|
|
||||||
vec3 blurColor = accColor.rgb - vec3(blurDecay);
|
|
||||||
vec3 color = max(blurColor, txtColor);
|
|
||||||
|
|
||||||
gl_FragColor = vec4(color, currMask);
|
|
||||||
}
|
|
||||||
"
|
|
||||||
|
|
||||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
import QtQuick 2.2
|
import QtQuick 2.2
|
||||||
import QtQuick.Dialogs 1.1
|
import QtQuick.Dialogs
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: rootItem
|
id: rootItem
|
||||||
@@ -31,11 +31,13 @@ Item {
|
|||||||
id: colorDialog
|
id: colorDialog
|
||||||
title: qsTr("Choose a color")
|
title: qsTr("Choose a color")
|
||||||
modality: Qt.ApplicationModal
|
modality: Qt.ApplicationModal
|
||||||
visible: false
|
selectedColor: rootItem.color
|
||||||
|
|
||||||
//This is a workaround to a Qt 5.2 bug.
|
onSelectedColorChanged: {
|
||||||
onColorChanged: if (!appSettings.isMacOS) colorSelected(color)
|
if (!appSettings.isMacOS && visible)
|
||||||
onAccepted: if (appSettings.isMacOS) colorSelected(color)
|
colorSelected(selectedColor)
|
||||||
|
}
|
||||||
|
onAccepted: colorSelected(selectedColor)
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -57,6 +59,6 @@ Item {
|
|||||||
}
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: colorDialog.visible = true
|
onClicked: colorDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import QtQuick 2.2
|
|||||||
import QtQuick.Window 2.0
|
import QtQuick.Window 2.0
|
||||||
import QtQuick.Controls 2.0
|
import QtQuick.Controls 2.0
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
import QtQuick.Dialogs 1.1
|
import QtQuick.Dialogs
|
||||||
|
|
||||||
Window {
|
Window {
|
||||||
id: insertnamedialog
|
id: insertnamedialog
|
||||||
|
|||||||
@@ -47,14 +47,14 @@ Item{
|
|||||||
Connections {
|
Connections {
|
||||||
target: copyAction
|
target: copyAction
|
||||||
|
|
||||||
function onTriggered() {
|
onTriggered: {
|
||||||
kterminal.copyClipboard()
|
kterminal.copyClipboard()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Connections {
|
Connections {
|
||||||
target: pasteAction
|
target: pasteAction
|
||||||
|
|
||||||
function onTriggered() {
|
onTriggered: {
|
||||||
kterminal.pasteClipboard()
|
kterminal.pasteClipboard()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,29 +63,29 @@ Item{
|
|||||||
Connections {
|
Connections {
|
||||||
target: appSettings
|
target: appSettings
|
||||||
|
|
||||||
function onFontScalingChanged() {
|
onFontScalingChanged: {
|
||||||
terminalContainer.updateSources()
|
terminalContainer.updateSources()
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFontWidthChanged() {
|
onFontWidthChanged: {
|
||||||
terminalContainer.updateSources()
|
terminalContainer.updateSources()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Connections {
|
Connections {
|
||||||
target: terminalContainer
|
target: terminalContainer
|
||||||
|
|
||||||
function onWidthChanged() {
|
onWidthChanged: {
|
||||||
terminalContainer.updateSources()
|
terminalContainer.updateSources()
|
||||||
}
|
}
|
||||||
|
|
||||||
function onHeightChanged() {
|
onHeightChanged: {
|
||||||
terminalContainer.updateSources()
|
terminalContainer.updateSources()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Connections {
|
Connections {
|
||||||
target: terminalWindow
|
target: terminalWindow
|
||||||
|
|
||||||
function onActiveChanged() {
|
onActiveChanged: {
|
||||||
kterminal.forceActiveFocus()
|
kterminal.forceActiveFocus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -208,31 +208,31 @@ Item{
|
|||||||
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
|
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: kterminal.terminalUsesMouse ? Qt.ArrowCursor : Qt.IBeamCursor
|
cursorShape: kterminal.terminalUsesMouse ? Qt.ArrowCursor : Qt.IBeamCursor
|
||||||
onWheel:{
|
onWheel: function(wheel) {
|
||||||
if(wheel.modifiers & Qt.ControlModifier){
|
if (wheel.modifiers & Qt.ControlModifier) {
|
||||||
wheel.angleDelta.y > 0 ? zoomIn.trigger() : zoomOut.trigger();
|
wheel.angleDelta.y > 0 ? zoomIn.trigger() : zoomOut.trigger();
|
||||||
} else {
|
} else {
|
||||||
var coord = correctDistortion(wheel.x, wheel.y);
|
var coord = correctDistortion(wheel.x, wheel.y);
|
||||||
kterminal.simulateWheel(coord.x, coord.y, wheel.buttons, wheel.modifiers, wheel.angleDelta);
|
kterminal.simulateWheel(coord.x, coord.y, wheel.buttons, wheel.modifiers, wheel.angleDelta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onDoubleClicked: {
|
onDoubleClicked: function(mouse) {
|
||||||
var coord = correctDistortion(mouse.x, mouse.y);
|
var coord = correctDistortion(mouse.x, mouse.y);
|
||||||
kterminal.simulateMouseDoubleClick(coord.x, coord.y, mouse.button, mouse.buttons, mouse.modifiers);
|
kterminal.simulateMouseDoubleClick(coord.x, coord.y, mouse.button, mouse.buttons, mouse.modifiers);
|
||||||
}
|
}
|
||||||
onPressed: {
|
onPressed: function(mouse) {
|
||||||
if((!kterminal.terminalUsesMouse || mouse.modifiers & Qt.ShiftModifier) && mouse.button == Qt.RightButton) {
|
if ((!kterminal.terminalUsesMouse || mouse.modifiers & Qt.ShiftModifier) && mouse.button == Qt.RightButton) {
|
||||||
contextmenu.popup();
|
contextmenu.popup();
|
||||||
} else {
|
} else {
|
||||||
var coord = correctDistortion(mouse.x, mouse.y);
|
var coord = correctDistortion(mouse.x, mouse.y);
|
||||||
kterminal.simulateMousePress(coord.x, coord.y, mouse.button, mouse.buttons, mouse.modifiers)
|
kterminal.simulateMousePress(coord.x, coord.y, mouse.button, mouse.buttons, mouse.modifiers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onReleased: {
|
onReleased: function(mouse) {
|
||||||
var coord = correctDistortion(mouse.x, mouse.y);
|
var coord = correctDistortion(mouse.x, mouse.y);
|
||||||
kterminal.simulateMouseRelease(coord.x, coord.y, mouse.button, mouse.buttons, mouse.modifiers);
|
kterminal.simulateMouseRelease(coord.x, coord.y, mouse.button, mouse.buttons, mouse.modifiers);
|
||||||
}
|
}
|
||||||
onPositionChanged: {
|
onPositionChanged: function(mouse) {
|
||||||
var coord = correctDistortion(mouse.x, mouse.y);
|
var coord = correctDistortion(mouse.x, mouse.y);
|
||||||
kterminal.simulateMouseMove(coord.x, coord.y, mouse.button, mouse.buttons, mouse.modifiers);
|
kterminal.simulateMouseMove(coord.x, coord.y, mouse.button, mouse.buttons, mouse.modifiers);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,24 +73,17 @@ ColumnLayout {
|
|||||||
Slider {
|
Slider {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
id: fpsSlider
|
id: effectsFpsSlider
|
||||||
onValueChanged: {
|
onValueChanged: appSettings.effectsFrameSkip = Math.round(value)
|
||||||
if (enabled) {
|
|
||||||
appSettings.fps = value !== 60 ? value + 1 : 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stepSize: 1
|
stepSize: 1
|
||||||
enabled: false
|
enabled: true
|
||||||
Component.onCompleted: {
|
from: 5
|
||||||
from = 0
|
to: 1
|
||||||
to = 60
|
value: appSettings.effectsFrameSkip
|
||||||
value = appSettings.fps !== 0 ? appSettings.fps - 1 : 60
|
|
||||||
enabled = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
SizedLabel {
|
||||||
text: appSettings.fps !== 0 ? appSettings.fps : qsTr("Max")
|
text: Math.round(100 / Math.max(1, Math.round(effectsFpsSlider.value))) + "%"
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
text: qsTr("Texture Quality")
|
text: qsTr("Texture Quality")
|
||||||
@@ -99,17 +92,13 @@ ColumnLayout {
|
|||||||
id: txtslider
|
id: txtslider
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
onValueChanged: if (enabled)
|
onValueChanged: appSettings.windowScaling = value
|
||||||
appSettings.windowScaling = value
|
|
||||||
stepSize: 0.05
|
stepSize: 0.05
|
||||||
enabled: false
|
enabled: true
|
||||||
Component.onCompleted: {
|
from: 0.25
|
||||||
from = 0.25 //Without this value gets set to 0.5
|
value: appSettings.windowScaling
|
||||||
value = appSettings.windowScaling
|
|
||||||
enabled = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Label {
|
SizedLabel {
|
||||||
text: Math.round(txtslider.value * 100) + "%"
|
text: Math.round(txtslider.value * 100) + "%"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,17 +109,13 @@ ColumnLayout {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
id: bloomSlider
|
id: bloomSlider
|
||||||
onValueChanged: if (enabled)
|
onValueChanged: appSettings.bloomQuality = value
|
||||||
appSettings.bloomQuality = value
|
|
||||||
stepSize: 0.05
|
stepSize: 0.05
|
||||||
enabled: false
|
enabled: true
|
||||||
Component.onCompleted: {
|
from: 0.25
|
||||||
from = 0.25
|
value: appSettings.bloomQuality
|
||||||
value = appSettings.bloomQuality
|
|
||||||
enabled = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Label {
|
SizedLabel {
|
||||||
text: Math.round(bloomSlider.value * 100) + "%"
|
text: Math.round(bloomSlider.value * 100) + "%"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,17 +126,13 @@ ColumnLayout {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: burnInSlider
|
id: burnInSlider
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
onValueChanged: if (enabled)
|
onValueChanged: appSettings.burnInQuality = value
|
||||||
appSettings.burnInQuality = value
|
|
||||||
stepSize: 0.05
|
stepSize: 0.05
|
||||||
enabled: false
|
enabled: true
|
||||||
Component.onCompleted: {
|
from: 0.25
|
||||||
from = 0.25
|
value: appSettings.burnInQuality
|
||||||
value = appSettings.burnInQuality
|
|
||||||
enabled = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Label {
|
SizedLabel {
|
||||||
text: Math.round(burnInSlider.value * 100) + "%"
|
text: Math.round(burnInSlider.value * 100) + "%"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,53 +33,53 @@ ColumnLayout {
|
|||||||
|
|
||||||
CheckableSlider {
|
CheckableSlider {
|
||||||
name: qsTr("Bloom")
|
name: qsTr("Bloom")
|
||||||
onNewValue: appSettings.bloom = newValue
|
onNewValue: function(newValue) { appSettings.bloom = newValue }
|
||||||
value: appSettings.bloom
|
value: appSettings.bloom
|
||||||
}
|
}
|
||||||
CheckableSlider {
|
CheckableSlider {
|
||||||
name: qsTr("BurnIn")
|
name: qsTr("BurnIn")
|
||||||
onNewValue: appSettings.burnIn = newValue
|
onNewValue: function(newValue) { appSettings.burnIn = newValue }
|
||||||
value: appSettings.burnIn
|
value: appSettings.burnIn
|
||||||
}
|
}
|
||||||
CheckableSlider {
|
CheckableSlider {
|
||||||
name: qsTr("Static Noise")
|
name: qsTr("Static Noise")
|
||||||
onNewValue: appSettings.staticNoise = newValue
|
onNewValue: function(newValue) { appSettings.staticNoise = newValue }
|
||||||
value: appSettings.staticNoise
|
value: appSettings.staticNoise
|
||||||
}
|
}
|
||||||
CheckableSlider {
|
CheckableSlider {
|
||||||
name: qsTr("Jitter")
|
name: qsTr("Jitter")
|
||||||
onNewValue: appSettings.jitter = newValue
|
onNewValue: function(newValue) { appSettings.jitter = newValue }
|
||||||
value: appSettings.jitter
|
value: appSettings.jitter
|
||||||
}
|
}
|
||||||
CheckableSlider {
|
CheckableSlider {
|
||||||
name: qsTr("Glow Line")
|
name: qsTr("Glow Line")
|
||||||
onNewValue: appSettings.glowingLine = newValue
|
onNewValue: function(newValue) { appSettings.glowingLine = newValue }
|
||||||
value: appSettings.glowingLine
|
value: appSettings.glowingLine
|
||||||
}
|
}
|
||||||
CheckableSlider {
|
CheckableSlider {
|
||||||
name: qsTr("Screen Curvature")
|
name: qsTr("Screen Curvature")
|
||||||
onNewValue: appSettings.screenCurvature = newValue
|
onNewValue: function(newValue) { appSettings.screenCurvature = newValue }
|
||||||
value: appSettings.screenCurvature
|
value: appSettings.screenCurvature
|
||||||
}
|
}
|
||||||
CheckableSlider {
|
CheckableSlider {
|
||||||
name: qsTr("Ambient Light")
|
name: qsTr("Ambient Light")
|
||||||
onNewValue: appSettings.ambientLight = newValue
|
onNewValue: function(newValue) { appSettings.ambientLight = newValue }
|
||||||
value: appSettings.ambientLight
|
value: appSettings.ambientLight
|
||||||
enabled: appSettings.framesIndex !== 0
|
enabled: appSettings.framesIndex !== 0
|
||||||
}
|
}
|
||||||
CheckableSlider {
|
CheckableSlider {
|
||||||
name: qsTr("Flickering")
|
name: qsTr("Flickering")
|
||||||
onNewValue: appSettings.flickering = newValue
|
onNewValue: function(newValue) { appSettings.flickering = newValue }
|
||||||
value: appSettings.flickering
|
value: appSettings.flickering
|
||||||
}
|
}
|
||||||
CheckableSlider {
|
CheckableSlider {
|
||||||
name: qsTr("Horizontal Sync")
|
name: qsTr("Horizontal Sync")
|
||||||
onNewValue: appSettings.horizontalSync = newValue
|
onNewValue: function(newValue) { appSettings.horizontalSync = newValue }
|
||||||
value: appSettings.horizontalSync
|
value: appSettings.horizontalSync
|
||||||
}
|
}
|
||||||
CheckableSlider {
|
CheckableSlider {
|
||||||
name: qsTr("RGB Shift")
|
name: qsTr("RGB Shift")
|
||||||
onNewValue: appSettings.rbgShift = newValue
|
onNewValue: function(newValue) { appSettings.rbgShift = newValue }
|
||||||
value: appSettings.rbgShift
|
value: appSettings.rbgShift
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
import QtQuick 2.2
|
import QtQuick 2.2
|
||||||
import QtQuick.Controls 2.4
|
import QtQuick.Controls 2.4
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
import QtQuick.Dialogs 1.1
|
import QtQuick.Dialogs
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
GroupBox {
|
GroupBox {
|
||||||
@@ -237,6 +237,7 @@ ColumnLayout {
|
|||||||
MessageDialog {
|
MessageDialog {
|
||||||
id: messageDialog
|
id: messageDialog
|
||||||
title: qsTr("File Error")
|
title: qsTr("File Error")
|
||||||
|
buttons: MessageDialog.Ok
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
messageDialog.close()
|
messageDialog.close()
|
||||||
}
|
}
|
||||||
@@ -248,10 +249,8 @@ ColumnLayout {
|
|||||||
|
|
||||||
sourceComponent: FileDialog {
|
sourceComponent: FileDialog {
|
||||||
nameFilters: ["Json files (*.json)"]
|
nameFilters: ["Json files (*.json)"]
|
||||||
selectMultiple: false
|
fileMode: fileDialog.selectExisting ? FileDialog.OpenFile : FileDialog.SaveFile
|
||||||
selectFolder: false
|
onAccepted: callBack(selectedFile)
|
||||||
selectExisting: fileDialog.selectExisting
|
|
||||||
onAccepted: callBack(fileUrl)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onSelectExistingChanged: reload()
|
onSelectExistingChanged: reload()
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ ColumnLayout {
|
|||||||
Connections {
|
Connections {
|
||||||
target: appSettings
|
target: appSettings
|
||||||
|
|
||||||
function onTerminalFontChanged() {
|
onTerminalFontChanged: {
|
||||||
fontChanger.updateIndex()
|
fontChanger.updateIndex()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,12 +140,12 @@ ColumnLayout {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
CheckableSlider {
|
CheckableSlider {
|
||||||
name: qsTr("Chroma Color")
|
name: qsTr("Chroma Color")
|
||||||
onNewValue: appSettings.chromaColor = newValue
|
onNewValue: function(newValue) { appSettings.chromaColor = newValue }
|
||||||
value: appSettings.chromaColor
|
value: appSettings.chromaColor
|
||||||
}
|
}
|
||||||
CheckableSlider {
|
CheckableSlider {
|
||||||
name: qsTr("Saturation Color")
|
name: qsTr("Saturation Color")
|
||||||
onNewValue: appSettings.saturationColor = newValue
|
onNewValue: function(newValue) { appSettings.saturationColor = newValue }
|
||||||
value: appSettings.saturationColor
|
value: appSettings.saturationColor
|
||||||
enabled: appSettings.chromaColor !== 0
|
enabled: appSettings.chromaColor !== 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ import QtQuick 2.2
|
|||||||
import QtQuick.Controls 2.1
|
import QtQuick.Controls 2.1
|
||||||
import QtQuick.Window 2.1
|
import QtQuick.Window 2.1
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import QtQuick.Dialogs 1.1
|
import QtQuick.Dialogs
|
||||||
|
|
||||||
Window {
|
Window {
|
||||||
id: settings_window
|
id: settings_window
|
||||||
title: qsTr("Settings")
|
title: qsTr("Settings")
|
||||||
width: 600
|
width: 640
|
||||||
height: 480
|
height: 640
|
||||||
|
|
||||||
property int tabmargins: 15
|
property int tabmargins: 15
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
import QtQuick 2.2
|
import QtQuick 2.2
|
||||||
import QtGraphicalEffects 1.0
|
|
||||||
|
|
||||||
import "utils.js" as Utils
|
import "utils.js" as Utils
|
||||||
|
|
||||||
@@ -45,469 +44,174 @@ Item {
|
|||||||
screenResolution.height / virtualResolution.height
|
screenResolution.height / virtualResolution.height
|
||||||
)
|
)
|
||||||
|
|
||||||
ShaderEffect {
|
ShaderEffect {
|
||||||
id: dynamicShader
|
id: dynamicShader
|
||||||
|
|
||||||
property ShaderLibrary shaderLibrary: ShaderLibrary { }
|
property ShaderEffectSource screenBuffer: frameBuffer
|
||||||
|
property ShaderEffectSource burnInSource: burnInEffect.source
|
||||||
property ShaderEffectSource screenBuffer: frameBuffer
|
property ShaderEffectSource frameSource: terminalFrameLoader.item
|
||||||
property ShaderEffectSource burnInSource: burnInEffect.source
|
|
||||||
property ShaderEffectSource frameSource: terminalFrameLoader.item
|
property color fontColor: parent.fontColor
|
||||||
|
property color backgroundColor: parent.backgroundColor
|
||||||
property color fontColor: parent.fontColor
|
property real screenCurvature: parent.screenCurvature
|
||||||
property color backgroundColor: parent.backgroundColor
|
property real chromaColor: parent.chromaColor
|
||||||
property real screenCurvature: parent.screenCurvature
|
property real ambientLight: parent.ambientLight
|
||||||
property real chromaColor: parent.chromaColor
|
|
||||||
property real ambientLight: parent.ambientLight
|
property real flickering: appSettings.flickering
|
||||||
|
property real horizontalSync: appSettings.horizontalSync
|
||||||
property real flickering: appSettings.flickering
|
property real horizontalSyncStrength: Utils.lint(0.05, 0.35, horizontalSync)
|
||||||
property real horizontalSync: appSettings.horizontalSync
|
property real glowingLine: appSettings.glowingLine * 0.2
|
||||||
property real horizontalSyncStrength: Utils.lint(0.05, 0.35, horizontalSync)
|
|
||||||
property real glowingLine: appSettings.glowingLine * 0.2
|
// Fast burnin properties
|
||||||
|
property real burnIn: appSettings.burnIn
|
||||||
// Fast burnin properties
|
property real burnInLastUpdate: burnInEffect.lastUpdate
|
||||||
property real burnIn: appSettings.burnIn
|
property real burnInTime: burnInEffect.burnInFadeTime
|
||||||
property real burnInLastUpdate: burnInEffect.lastUpdate
|
|
||||||
property real burnInTime: burnInEffect.burnInFadeTime
|
property real jitter: appSettings.jitter
|
||||||
|
property size jitterDisplacement: Qt.size(0.007 * jitter, 0.002 * jitter)
|
||||||
property real jitter: appSettings.jitter
|
property real shadowLength: 0.25 * screenCurvature * Utils.lint(0.50, 1.5, ambientLight)
|
||||||
property size jitterDisplacement: Qt.size(0.007 * jitter, 0.002 * jitter)
|
property real staticNoise: appSettings.staticNoise
|
||||||
property real shadowLength: 0.25 * screenCurvature * Utils.lint(0.50, 1.5, ambientLight)
|
property size scaleNoiseSize: Qt.size((width * 0.75) / (noiseTexture.width * appSettings.windowScaling * appSettings.totalFontScaling),
|
||||||
property real staticNoise: appSettings.staticNoise
|
(height * 0.75) / (noiseTexture.height * appSettings.windowScaling * appSettings.totalFontScaling))
|
||||||
property size scaleNoiseSize: Qt.size((width * 0.75) / (noiseTexture.width * appSettings.windowScaling * appSettings.totalFontScaling),
|
|
||||||
(height * 0.75) / (noiseTexture.height * appSettings.windowScaling * appSettings.totalFontScaling))
|
|
||||||
|
|
||||||
property size virtualResolution: parent.virtualResolution
|
|
||||||
|
|
||||||
// Rasterization might display oversamping issues if virtual resolution is close to physical display resolution.
|
|
||||||
// We progressively disable rasterization from 4x up to 2x resolution.
|
|
||||||
property real rasterizationIntensity: Utils.smoothstep(2.0, 4.0, _screenDensity)
|
|
||||||
|
|
||||||
property real displayTerminalFrame: appSettings._frameMargin > 0 || appSettings.screenCurvature > 0
|
|
||||||
|
|
||||||
property real time: timeManager.time
|
|
||||||
property ShaderEffectSource noiseSource: noiseShaderSource
|
|
||||||
|
|
||||||
// If something goes wrong activate the fallback version of the shader.
|
|
||||||
property bool fallBack: false
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
blending: false
|
|
||||||
|
|
||||||
//Smooth random texture used for flickering effect.
|
|
||||||
Image {
|
|
||||||
id: noiseTexture
|
|
||||||
source: "images/allNoise512.png"
|
|
||||||
width: 512
|
|
||||||
height: 512
|
|
||||||
fillMode: Image.Tile
|
|
||||||
visible: false
|
|
||||||
}
|
|
||||||
ShaderEffectSource {
|
|
||||||
id: noiseShaderSource
|
|
||||||
sourceItem: noiseTexture
|
|
||||||
wrapMode: ShaderEffectSource.Repeat
|
|
||||||
visible: false
|
|
||||||
smooth: true
|
|
||||||
}
|
|
||||||
|
|
||||||
//Print the number with a reasonable precision for the shader.
|
|
||||||
function str(num){
|
|
||||||
return num.toFixed(8);
|
|
||||||
}
|
|
||||||
|
|
||||||
vertexShader: "
|
|
||||||
uniform highp mat4 qt_Matrix;
|
|
||||||
uniform highp float time;
|
|
||||||
|
|
||||||
attribute highp vec4 qt_Vertex;
|
|
||||||
attribute highp vec2 qt_MultiTexCoord0;
|
|
||||||
|
|
||||||
varying highp vec2 qt_TexCoord0;" +
|
|
||||||
|
|
||||||
(!fallBack ? "
|
|
||||||
uniform sampler2D noiseSource;" : "") +
|
|
||||||
|
|
||||||
(!fallBack && flickering !== 0.0 ?"
|
|
||||||
varying lowp float brightness;
|
|
||||||
uniform lowp float flickering;" : "") +
|
|
||||||
|
|
||||||
(!fallBack && horizontalSync !== 0.0 ?"
|
|
||||||
uniform lowp float horizontalSyncStrength;
|
|
||||||
varying lowp float distortionScale;
|
|
||||||
varying lowp float distortionFreq;" : "") +
|
|
||||||
|
|
||||||
"
|
|
||||||
void main() {
|
|
||||||
qt_TexCoord0 = qt_MultiTexCoord0;
|
|
||||||
vec2 coords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));" +
|
|
||||||
|
|
||||||
(!fallBack && (flickering !== 0.0 || horizontalSync !== 0.0) ?
|
|
||||||
"vec4 initialNoiseTexel = texture2D(noiseSource, coords);"
|
|
||||||
: "") +
|
|
||||||
|
|
||||||
(!fallBack && flickering !== 0.0 ? "
|
|
||||||
brightness = 1.0 + (initialNoiseTexel.g - 0.5) * flickering;"
|
|
||||||
: "") +
|
|
||||||
|
|
||||||
(!fallBack && horizontalSync !== 0.0 ? "
|
|
||||||
float randval = horizontalSyncStrength - initialNoiseTexel.r;
|
|
||||||
distortionScale = step(0.0, randval) * randval * horizontalSyncStrength;
|
|
||||||
distortionFreq = mix(4.0, 40.0, initialNoiseTexel.g);"
|
|
||||||
: "") +
|
|
||||||
|
|
||||||
"gl_Position = qt_Matrix * qt_Vertex;
|
|
||||||
}"
|
|
||||||
|
|
||||||
fragmentShader: "
|
|
||||||
#ifdef GL_ES
|
|
||||||
precision mediump float;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uniform sampler2D screenBuffer;
|
|
||||||
uniform highp float qt_Opacity;
|
|
||||||
uniform highp float time;
|
|
||||||
varying highp vec2 qt_TexCoord0;
|
|
||||||
|
|
||||||
uniform highp vec4 fontColor;
|
|
||||||
uniform highp vec4 backgroundColor;
|
|
||||||
uniform lowp float shadowLength;
|
|
||||||
|
|
||||||
uniform highp vec2 virtualResolution;
|
|
||||||
uniform lowp float rasterizationIntensity;\n" +
|
|
||||||
|
|
||||||
(burnIn !== 0 ? "
|
|
||||||
uniform sampler2D burnInSource;
|
|
||||||
uniform highp float burnInLastUpdate;
|
|
||||||
uniform highp float burnInTime;" : "") +
|
|
||||||
(staticNoise !== 0 ? "
|
|
||||||
uniform highp float staticNoise;" : "") +
|
|
||||||
(((staticNoise !== 0 || jitter !== 0) ||(fallBack && (flickering || horizontalSync))) ? "
|
|
||||||
uniform lowp sampler2D noiseSource;
|
|
||||||
uniform highp vec2 scaleNoiseSize;" : "") +
|
|
||||||
(displayTerminalFrame ? "
|
|
||||||
uniform lowp sampler2D frameSource;" : "") +
|
|
||||||
(screenCurvature !== 0 ? "
|
|
||||||
uniform highp float screenCurvature;" : "") +
|
|
||||||
(glowingLine !== 0 ? "
|
|
||||||
uniform highp float glowingLine;" : "") +
|
|
||||||
(chromaColor !== 0 ? "
|
|
||||||
uniform lowp float chromaColor;" : "") +
|
|
||||||
(jitter !== 0 ? "
|
|
||||||
uniform lowp vec2 jitterDisplacement;" : "") +
|
|
||||||
(ambientLight !== 0 ? "
|
|
||||||
uniform lowp float ambientLight;" : "") +
|
|
||||||
|
|
||||||
(fallBack && horizontalSync !== 0 ? "
|
|
||||||
uniform lowp float horizontalSyncStrength;" : "") +
|
|
||||||
(fallBack && flickering !== 0.0 ?"
|
|
||||||
uniform lowp float flickering;" : "") +
|
|
||||||
(!fallBack && flickering !== 0 ? "
|
|
||||||
varying lowp float brightness;"
|
|
||||||
: "") +
|
|
||||||
(!fallBack && horizontalSync !== 0 ? "
|
|
||||||
varying lowp float distortionScale;
|
|
||||||
varying lowp float distortionFreq;" : "") +
|
|
||||||
|
|
||||||
(glowingLine !== 0 ? "
|
|
||||||
float randomPass(vec2 coords){
|
|
||||||
return fract(smoothstep(-120.0, 0.0, coords.y - (virtualResolution.y + 120.0) * fract(time * 0.00015)));
|
|
||||||
}" : "") +
|
|
||||||
|
|
||||||
shaderLibrary.min2 +
|
|
||||||
shaderLibrary.rgb2grey +
|
|
||||||
shaderLibrary.rasterizationShader +
|
|
||||||
|
|
||||||
"
|
|
||||||
float isInScreen(vec2 v) {
|
|
||||||
return min2(step(0.0, v) - step(1.0, v));
|
|
||||||
}
|
|
||||||
|
|
||||||
vec2 barrel(vec2 v, vec2 cc) {" +
|
|
||||||
|
|
||||||
(screenCurvature !== 0 ? "
|
|
||||||
float distortion = dot(cc, cc) * screenCurvature;
|
|
||||||
return (v - cc * (1.0 + distortion) * distortion);"
|
|
||||||
:
|
|
||||||
"return v;") +
|
|
||||||
"}" +
|
|
||||||
|
|
||||||
"vec3 convertWithChroma(vec3 inColor) {
|
|
||||||
vec3 outColor = inColor;" +
|
|
||||||
|
|
||||||
(chromaColor !== 0 ?
|
|
||||||
"outColor = fontColor.rgb * mix(vec3(rgb2grey(inColor)), inColor, chromaColor);"
|
|
||||||
:
|
|
||||||
"outColor = fontColor.rgb * rgb2grey(inColor);") +
|
|
||||||
|
|
||||||
" return outColor;
|
|
||||||
}" +
|
|
||||||
|
|
||||||
"void main() {" +
|
|
||||||
"vec2 cc = vec2(0.5) - qt_TexCoord0;" +
|
|
||||||
"float distance = length(cc);" +
|
|
||||||
|
|
||||||
//FallBack if there are problems
|
|
||||||
(fallBack && (flickering !== 0.0 || horizontalSync !== 0.0) ?
|
|
||||||
"vec2 initialCoords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));
|
|
||||||
vec4 initialNoiseTexel = texture2D(noiseSource, initialCoords);"
|
|
||||||
: "") +
|
|
||||||
(fallBack && flickering !== 0.0 ? "
|
|
||||||
float brightness = 1.0 + (initialNoiseTexel.g - 0.5) * flickering;"
|
|
||||||
: "") +
|
|
||||||
(fallBack && horizontalSync !== 0.0 ? "
|
|
||||||
float randval = horizontalSyncStrength - initialNoiseTexel.r;
|
|
||||||
float distortionScale = step(0.0, randval) * randval * horizontalSyncStrength;
|
|
||||||
float distortionFreq = mix(4.0, 40.0, initialNoiseTexel.g);"
|
|
||||||
: "") +
|
|
||||||
|
|
||||||
(staticNoise ? "
|
|
||||||
float noise = staticNoise;" : "") +
|
|
||||||
|
|
||||||
(screenCurvature !== 0 ? "
|
|
||||||
vec2 staticCoords = barrel(qt_TexCoord0, cc);"
|
|
||||||
:"
|
|
||||||
vec2 staticCoords = qt_TexCoord0;") +
|
|
||||||
|
|
||||||
"vec2 coords = qt_TexCoord0;" +
|
|
||||||
|
|
||||||
(horizontalSync !== 0 ? "
|
|
||||||
float dst = sin((coords.y + time * 0.001) * distortionFreq);
|
|
||||||
coords.x += dst * distortionScale;" +
|
|
||||||
|
|
||||||
(staticNoise ? "
|
|
||||||
noise += distortionScale * 7.0;" : "")
|
|
||||||
|
|
||||||
: "") +
|
|
||||||
|
|
||||||
(jitter !== 0 || staticNoise !== 0 ?
|
|
||||||
"vec4 noiseTexel = texture2D(noiseSource, scaleNoiseSize * coords + vec2(fract(time / 51.0), fract(time / 237.0)));"
|
|
||||||
: "") +
|
|
||||||
|
|
||||||
(jitter !== 0 ? "
|
|
||||||
vec2 offset = vec2(noiseTexel.b, noiseTexel.a) - vec2(0.5);
|
|
||||||
vec2 txt_coords = coords + offset * jitterDisplacement;"
|
|
||||||
: "vec2 txt_coords = coords;") +
|
|
||||||
|
|
||||||
"float color = 0.0001;" +
|
property size virtualResolution: parent.virtualResolution
|
||||||
|
|
||||||
(staticNoise !== 0 ? "
|
// Rasterization might display oversamping issues if virtual resolution is close to physical display resolution.
|
||||||
float noiseVal = noiseTexel.a;
|
// We progressively disable rasterization from 4x up to 2x resolution.
|
||||||
color += noiseVal * noise * (1.0 - distance * 1.3);" : "") +
|
property real rasterizationIntensity: Utils.smoothstep(2.0, 4.0, _screenDensity)
|
||||||
|
property int rasterizationMode: appSettings.rasterization
|
||||||
(glowingLine !== 0 ? "
|
|
||||||
color += randomPass(coords * virtualResolution) * glowingLine;" : "") +
|
property real displayTerminalFrame: appSettings._frameMargin > 0 || appSettings.screenCurvature > 0
|
||||||
|
|
||||||
"vec3 txt_color = texture2D(screenBuffer, txt_coords).rgb;" +
|
property real time: timeManager.time
|
||||||
|
property ShaderEffectSource noiseSource: noiseShaderSource
|
||||||
(burnIn !== 0 ? "
|
|
||||||
vec4 txt_blur = texture2D(burnInSource, staticCoords);
|
// Extra uniforms expected by the shared uniform block
|
||||||
float blurDecay = clamp((time - burnInLastUpdate) * burnInTime, 0.0, 1.0);
|
property real screenShadowCoeff: 0
|
||||||
vec3 burnInColor = 0.65 * (txt_blur.rgb - vec3(blurDecay));
|
property real frameShadowCoeff: 0
|
||||||
txt_color = max(txt_color, convertWithChroma(burnInColor));"
|
property color frameColor: backgroundColor
|
||||||
: "") +
|
property size margin: Qt.size(0, 0)
|
||||||
|
property real prevLastUpdate: burnInEffect.prevLastUpdate
|
||||||
"txt_color += fontColor.rgb * vec3(color);" +
|
property real screen_brightness: Utils.lint(0.5, 1.5, appSettings.brightness)
|
||||||
|
property real bloom: appSettings.bloom
|
||||||
"txt_color = applyRasterization(staticCoords, txt_color, virtualResolution, rasterizationIntensity);\n" +
|
property real rbgShift: (appSettings.rbgShift / Math.max(width, 1)) * appSettings.totalFontScaling
|
||||||
|
|
||||||
"vec3 finalColor = txt_color;" +
|
anchors.fill: parent
|
||||||
|
blending: false
|
||||||
(flickering !== 0 ? "
|
|
||||||
finalColor *= brightness;" : "") +
|
Image {
|
||||||
|
id: noiseTexture
|
||||||
(ambientLight !== 0 ? "
|
source: "images/allNoise512.png"
|
||||||
finalColor += vec3(ambientLight) * (1.0 - distance) * (1.0 - distance);" : "") +
|
width: 512
|
||||||
|
height: 512
|
||||||
(displayTerminalFrame ?
|
fillMode: Image.Tile
|
||||||
"vec4 frameColor = texture2D(frameSource, qt_TexCoord0);
|
visible: false
|
||||||
finalColor = mix(finalColor, frameColor.rgb, frameColor.a);"
|
}
|
||||||
: "") +
|
ShaderEffectSource {
|
||||||
|
id: noiseShaderSource
|
||||||
"gl_FragColor = vec4(finalColor, qt_Opacity);" +
|
sourceItem: noiseTexture
|
||||||
"}"
|
wrapMode: ShaderEffectSource.Repeat
|
||||||
|
visible: false
|
||||||
onStatusChanged: {
|
smooth: true
|
||||||
// Print warning messages
|
}
|
||||||
if (log)
|
|
||||||
console.log(log);
|
vertexShader: "qrc:/shaders/terminal_dynamic.vert.qsb"
|
||||||
|
fragmentShader: "qrc:/shaders/terminal_dynamic.frag.qsb"
|
||||||
// Activate fallback mode
|
|
||||||
if (status == ShaderEffect.Error) {
|
onStatusChanged: if (log) console.log(log)
|
||||||
fallBack = true;
|
}
|
||||||
}
|
|
||||||
}
|
Loader {
|
||||||
}
|
id: terminalFrameLoader
|
||||||
|
|
||||||
Loader {
|
active: dynamicShader.displayTerminalFrame
|
||||||
id: terminalFrameLoader
|
|
||||||
|
width: staticShader.width
|
||||||
active: dynamicShader.displayTerminalFrame
|
height: staticShader.height
|
||||||
|
|
||||||
width: staticShader.width
|
sourceComponent: ShaderEffectSource {
|
||||||
height: staticShader.height
|
|
||||||
|
sourceItem: terminalFrame
|
||||||
sourceComponent: ShaderEffectSource {
|
hideSource: true
|
||||||
|
visible: false
|
||||||
sourceItem: terminalFrame
|
format: ShaderEffectSource.RGBA
|
||||||
hideSource: true
|
|
||||||
visible: false
|
TerminalFrame {
|
||||||
format: ShaderEffectSource.RGBA
|
id: terminalFrame
|
||||||
|
blending: false
|
||||||
TerminalFrame {
|
anchors.fill: parent
|
||||||
id: terminalFrame
|
}
|
||||||
blending: false
|
}
|
||||||
anchors.fill: parent
|
}
|
||||||
}
|
|
||||||
}
|
ShaderLibrary {
|
||||||
}
|
id: shaderLibrary
|
||||||
|
}
|
||||||
ShaderLibrary {
|
|
||||||
id: shaderLibrary
|
ShaderEffect {
|
||||||
}
|
id: staticShader
|
||||||
|
|
||||||
ShaderEffect {
|
width: parent.width * appSettings.windowScaling
|
||||||
id: staticShader
|
height: parent.height * appSettings.windowScaling
|
||||||
|
|
||||||
width: parent.width * appSettings.windowScaling
|
property ShaderEffectSource source: parent.source
|
||||||
height: parent.height * appSettings.windowScaling
|
property ShaderEffectSource bloomSource: parent.bloomSource
|
||||||
|
|
||||||
property ShaderEffectSource source: parent.source
|
property color fontColor: parent.fontColor
|
||||||
property ShaderEffectSource bloomSource: parent.bloomSource
|
property color backgroundColor: parent.backgroundColor
|
||||||
|
property real bloom: bloomSource ? appSettings.bloom * 2.5 : 0
|
||||||
property color fontColor: parent.fontColor
|
|
||||||
property color backgroundColor: parent.backgroundColor
|
property real screenCurvature: parent.screenCurvature
|
||||||
property real bloom: appSettings.bloom * 2.5
|
|
||||||
|
property real chromaColor: appSettings.chromaColor;
|
||||||
property real screenCurvature: parent.screenCurvature
|
|
||||||
|
property real rbgShift: (appSettings.rbgShift / width) * appSettings.totalFontScaling
|
||||||
property real chromaColor: appSettings.chromaColor;
|
|
||||||
|
property int rasterization: appSettings.rasterization
|
||||||
property real rbgShift: (appSettings.rbgShift / width) * appSettings.totalFontScaling // TODO FILIPPO width here is wrong.
|
|
||||||
|
property real screen_brightness: Utils.lint(0.5, 1.5, appSettings.brightness)
|
||||||
property int rasterization: appSettings.rasterization
|
|
||||||
|
property real ambientLight: parent.ambientLight
|
||||||
property real screen_brightness: Utils.lint(0.5, 1.5, appSettings.brightness)
|
|
||||||
|
property size virtualResolution: parent.virtualResolution
|
||||||
property real ambientLight: parent.ambientLight
|
|
||||||
|
// Extra uniforms to match shared uniform block
|
||||||
property size virtualResolution: parent.virtualResolution
|
property real time: timeManager.time
|
||||||
|
property real shadowLength: 0
|
||||||
blending: false
|
property real rasterizationIntensity: Utils.smoothstep(2.0, 4.0, _screenDensity)
|
||||||
visible: false
|
property int rasterizationMode: appSettings.rasterization
|
||||||
|
property real burnInLastUpdate: burnInEffect.lastUpdate
|
||||||
//Print the number with a reasonable precision for the shader.
|
property real burnInTime: burnInEffect.burnInFadeTime
|
||||||
function str(num){
|
property real burnIn: appSettings.burnIn
|
||||||
return num.toFixed(8);
|
property real staticNoise: appSettings.staticNoise
|
||||||
}
|
property real glowingLine: appSettings.glowingLine * 0.2
|
||||||
|
property size jitterDisplacement: Qt.size(0, 0)
|
||||||
fragmentShader: "
|
property real jitter: appSettings.jitter
|
||||||
#ifdef GL_ES
|
property real horizontalSync: appSettings.horizontalSync
|
||||||
precision mediump float;
|
property real horizontalSyncStrength: Utils.lint(0.05, 0.35, horizontalSync)
|
||||||
#endif
|
property real flickering: appSettings.flickering
|
||||||
|
property real displayTerminalFrame: dynamicShader.displayTerminalFrame
|
||||||
uniform sampler2D source;
|
property size scaleNoiseSize: Qt.size((width * 0.75) / (512 * appSettings.windowScaling * appSettings.totalFontScaling),
|
||||||
uniform highp float qt_Opacity;
|
(height * 0.75) / (512 * appSettings.windowScaling * appSettings.totalFontScaling))
|
||||||
varying highp vec2 qt_TexCoord0;
|
property real screenShadowCoeff: 0
|
||||||
|
property real frameShadowCoeff: 0
|
||||||
uniform highp vec4 fontColor;
|
property color frameColor: backgroundColor
|
||||||
uniform highp vec4 backgroundColor;
|
property size margin: Qt.size(0, 0)
|
||||||
uniform lowp float screen_brightness;
|
property real prevLastUpdate: burnInEffect.prevLastUpdate
|
||||||
|
|
||||||
uniform highp vec2 virtualResolution;" +
|
blending: false
|
||||||
|
visible: false
|
||||||
(bloom !== 0 ? "
|
|
||||||
uniform highp sampler2D bloomSource;
|
vertexShader: "qrc:/shaders/passthrough.vert.qsb"
|
||||||
uniform lowp float bloom;" : "") +
|
fragmentShader: "qrc:/shaders/terminal_static.frag.qsb"
|
||||||
|
|
||||||
(screenCurvature !== 0 ? "
|
onStatusChanged: if (log) console.log(log)
|
||||||
uniform highp float screenCurvature;" : "") +
|
}
|
||||||
|
|
||||||
(chromaColor !== 0 ? "
|
ShaderEffectSource {
|
||||||
uniform lowp float chromaColor;" : "") +
|
id: frameBuffer
|
||||||
|
visible: false
|
||||||
(rbgShift !== 0 ? "
|
sourceItem: staticShader
|
||||||
uniform lowp float rbgShift;" : "") +
|
hideSource: true
|
||||||
|
}
|
||||||
(ambientLight !== 0 ? "
|
|
||||||
uniform lowp float ambientLight;" : "") +
|
|
||||||
|
|
||||||
shaderLibrary.min2 +
|
|
||||||
shaderLibrary.sum2 +
|
|
||||||
shaderLibrary.rgb2grey +
|
|
||||||
|
|
||||||
"vec3 convertWithChroma(vec3 inColor) {
|
|
||||||
vec3 outColor = inColor;" +
|
|
||||||
|
|
||||||
(chromaColor !== 0 ?
|
|
||||||
"outColor = fontColor.rgb * mix(vec3(rgb2grey(inColor)), inColor, chromaColor);"
|
|
||||||
:
|
|
||||||
"outColor = fontColor.rgb * rgb2grey(inColor);") +
|
|
||||||
|
|
||||||
" return outColor;
|
|
||||||
}" +
|
|
||||||
|
|
||||||
shaderLibrary.rasterizationShader +
|
|
||||||
|
|
||||||
"void main() {" +
|
|
||||||
"vec2 cc = vec2(0.5) - qt_TexCoord0;" +
|
|
||||||
|
|
||||||
(screenCurvature !== 0 ? "
|
|
||||||
float distortion = dot(cc, cc) * screenCurvature;
|
|
||||||
vec2 curvatureCoords = (qt_TexCoord0 - cc * (1.0 + distortion) * distortion);
|
|
||||||
vec2 txt_coords = - 2.0 * curvatureCoords + 3.0 * step(vec2(0.0), curvatureCoords) * curvatureCoords - 3.0 * step(vec2(1.0), curvatureCoords) * curvatureCoords;"
|
|
||||||
:"
|
|
||||||
vec2 txt_coords = qt_TexCoord0;") +
|
|
||||||
|
|
||||||
"vec3 txt_color = texture2D(source, txt_coords).rgb;" +
|
|
||||||
|
|
||||||
(rbgShift !== 0 ? "
|
|
||||||
vec2 displacement = vec2(12.0, 0.0) * rbgShift;
|
|
||||||
vec3 rightColor = texture2D(source, txt_coords + displacement).rgb;
|
|
||||||
vec3 leftColor = texture2D(source, txt_coords - displacement).rgb;
|
|
||||||
txt_color.r = leftColor.r * 0.10 + rightColor.r * 0.30 + txt_color.r * 0.60;
|
|
||||||
txt_color.g = leftColor.g * 0.20 + rightColor.g * 0.20 + txt_color.g * 0.60;
|
|
||||||
txt_color.b = leftColor.b * 0.30 + rightColor.b * 0.10 + txt_color.b * 0.60;
|
|
||||||
" : "") +
|
|
||||||
|
|
||||||
"txt_color += vec3(0.0001);" +
|
|
||||||
"float greyscale_color = rgb2grey(txt_color);" +
|
|
||||||
|
|
||||||
(screenCurvature !== 0 ? "
|
|
||||||
float reflectionMask = sum2(step(vec2(0.0), curvatureCoords) - step(vec2(1.0), curvatureCoords));
|
|
||||||
reflectionMask = clamp(reflectionMask, 0.0, 1.0);"
|
|
||||||
:
|
|
||||||
"float reflectionMask = 1.0;") +
|
|
||||||
|
|
||||||
(chromaColor !== 0 ?
|
|
||||||
"vec3 foregroundColor = mix(fontColor.rgb, txt_color * fontColor.rgb / greyscale_color, chromaColor);
|
|
||||||
vec3 finalColor = mix(backgroundColor.rgb, foregroundColor, greyscale_color * reflectionMask);"
|
|
||||||
:
|
|
||||||
"vec3 finalColor = mix(backgroundColor.rgb, fontColor.rgb, greyscale_color * reflectionMask);") +
|
|
||||||
|
|
||||||
(bloom !== 0 ?
|
|
||||||
"vec4 bloomFullColor = texture2D(bloomSource, txt_coords);
|
|
||||||
vec3 bloomColor = bloomFullColor.rgb;
|
|
||||||
float bloomAlpha = bloomFullColor.a;
|
|
||||||
bloomColor = convertWithChroma(bloomColor);
|
|
||||||
finalColor += clamp(bloomColor * bloom * bloomAlpha, 0.0, 0.5);"
|
|
||||||
: "") +
|
|
||||||
|
|
||||||
"finalColor *= screen_brightness;" +
|
|
||||||
|
|
||||||
"gl_FragColor = vec4(finalColor, qt_Opacity);" +
|
|
||||||
"}"
|
|
||||||
|
|
||||||
onStatusChanged: {
|
|
||||||
// Print warning messages
|
|
||||||
if (log) console.log(log);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ShaderEffectSource {
|
|
||||||
id: frameBuffer
|
|
||||||
visible: false
|
|
||||||
sourceItem: staticShader
|
|
||||||
hideSource: true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
import QtQuick 2.2
|
import QtQuick 2.2
|
||||||
import QtGraphicalEffects 1.0
|
import Qt5Compat.GraphicalEffects
|
||||||
|
|
||||||
import "utils.js" as Utils
|
import "utils.js" as Utils
|
||||||
|
|
||||||
@@ -38,6 +38,7 @@ ShaderTerminal {
|
|||||||
terminalWindow.width * devicePixelRatio * appSettings.windowScaling,
|
terminalWindow.width * devicePixelRatio * appSettings.windowScaling,
|
||||||
terminalWindow.height * devicePixelRatio * appSettings.windowScaling
|
terminalWindow.height * devicePixelRatio * appSettings.windowScaling
|
||||||
)
|
)
|
||||||
|
bloomSource: bloomSourceLoader.item
|
||||||
|
|
||||||
TimeManager {
|
TimeManager {
|
||||||
id: timeManager
|
id: timeManager
|
||||||
@@ -75,6 +76,4 @@ ShaderTerminal {
|
|||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bloomSource: bloomSourceLoader.item
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,65 +40,36 @@ ShaderEffect {
|
|||||||
appSettings.frameMargin / height * appSettings.windowScaling
|
appSettings.frameMargin / height * appSettings.windowScaling
|
||||||
)
|
)
|
||||||
|
|
||||||
ShaderLibrary {
|
// Uniforms required by the shared block
|
||||||
id: shaderLibrary
|
property real qt_Opacity: 1.0
|
||||||
}
|
property real time: timeManager.time
|
||||||
|
property color fontColor: appSettings.fontColor
|
||||||
|
property color backgroundColor: appSettings.backgroundColor
|
||||||
|
property real shadowLength: 0
|
||||||
|
property size virtualResolution: Qt.size(width, height)
|
||||||
|
property real rasterizationIntensity: 0
|
||||||
|
property int rasterizationMode: 0
|
||||||
|
property real burnInLastUpdate: 0
|
||||||
|
property real burnInTime: 0
|
||||||
|
property real burnIn: 0
|
||||||
|
property real staticNoise: 0
|
||||||
|
property real glowingLine: 0
|
||||||
|
property real chromaColor: 0
|
||||||
|
property size jitterDisplacement: Qt.size(0, 0)
|
||||||
|
property real ambientLight: _ambientLight
|
||||||
|
property real jitter: 0
|
||||||
|
property real horizontalSync: 0
|
||||||
|
property real horizontalSyncStrength: 0
|
||||||
|
property real flickering: 0
|
||||||
|
property real displayTerminalFrame: 0
|
||||||
|
property size scaleNoiseSize: Qt.size(0, 0)
|
||||||
|
property real screen_brightness: 1.0
|
||||||
|
property real bloom: 0
|
||||||
|
property real rbgShift: 0
|
||||||
|
property real prevLastUpdate: 0
|
||||||
|
|
||||||
fragmentShader: "
|
vertexShader: "qrc:/shaders/passthrough.vert.qsb"
|
||||||
#ifdef GL_ES
|
fragmentShader: "qrc:/shaders/terminal_frame.frag.qsb"
|
||||||
precision mediump float;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uniform lowp float screenCurvature;
|
|
||||||
uniform lowp float screenShadowCoeff;
|
|
||||||
uniform lowp float frameShadowCoeff;
|
|
||||||
uniform highp float qt_Opacity;
|
|
||||||
uniform lowp vec4 frameColor;
|
|
||||||
uniform mediump vec2 margin;
|
|
||||||
|
|
||||||
varying highp vec2 qt_TexCoord0;
|
|
||||||
|
|
||||||
vec2 distortCoordinates(vec2 coords){
|
|
||||||
vec2 cc = (coords - vec2(0.5));
|
|
||||||
float dist = dot(cc, cc) * screenCurvature;
|
|
||||||
return (coords + cc * (1.0 + dist) * dist);
|
|
||||||
}
|
|
||||||
" +
|
|
||||||
|
|
||||||
shaderLibrary.max2 +
|
|
||||||
shaderLibrary.min2 +
|
|
||||||
shaderLibrary.prod2 +
|
|
||||||
shaderLibrary.sum2 +
|
|
||||||
|
|
||||||
"
|
|
||||||
|
|
||||||
vec2 positiveLog(vec2 x) {
|
|
||||||
return clamp(log(x), vec2(0.0), vec2(100.0));
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
vec2 staticCoords = qt_TexCoord0;
|
|
||||||
vec2 coords = distortCoordinates(staticCoords) * (vec2(1.0) + margin * 2.0) - margin;
|
|
||||||
|
|
||||||
vec2 vignetteCoords = staticCoords * (1.0 - staticCoords.yx);
|
|
||||||
float vignette = pow(prod2(vignetteCoords) * 15.0, 0.25);
|
|
||||||
|
|
||||||
vec3 color = frameColor.rgb * vec3(1.0 - vignette);
|
|
||||||
float alpha = 0.0;
|
|
||||||
|
|
||||||
float frameShadow = max2(positiveLog(-coords * frameShadowCoeff + vec2(1.0)) + positiveLog(coords * frameShadowCoeff - (vec2(frameShadowCoeff) - vec2(1.0))));
|
|
||||||
frameShadow = max(sqrt(frameShadow), 0.0);
|
|
||||||
color *= frameShadow;
|
|
||||||
alpha = sum2(1.0 - step(vec2(0.0), coords) + step(vec2(1.0), coords));
|
|
||||||
alpha = clamp(alpha, 0.0, 1.0);
|
|
||||||
alpha *= mix(1.0, 0.9, frameShadow);
|
|
||||||
|
|
||||||
float screenShadow = 1.0 - prod2(positiveLog(coords * screenShadowCoeff + vec2(1.0)) * positiveLog(-coords * screenShadowCoeff + vec2(screenShadowCoeff + 1.0)));
|
|
||||||
alpha = max(0.8 * screenShadow, alpha);
|
|
||||||
|
|
||||||
gl_FragColor = vec4(color * alpha, alpha);
|
|
||||||
}
|
|
||||||
"
|
|
||||||
|
|
||||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,22 +17,29 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
import QtQuick 2.2
|
import QtQuick
|
||||||
|
|
||||||
Timer {
|
QtObject {
|
||||||
default property bool enableTimer: false
|
id: timeManager
|
||||||
property real time
|
|
||||||
|
|
||||||
NumberAnimation on time {
|
property bool enableTimer: false
|
||||||
from: 0
|
property real time: 0
|
||||||
to: 100000
|
|
||||||
running: appSettings.fps === 0 && enableTimer
|
property int framesPerUpdate: Math.max(1, appSettings.effectsFrameSkip)
|
||||||
duration: 100000
|
property int _frameCounter: 0
|
||||||
loops: Animation.Infinite
|
|
||||||
|
property var frameDriver: FrameAnimation {
|
||||||
|
running: enableTimer
|
||||||
|
onTriggered: {
|
||||||
|
timeManager._frameCounter += 1
|
||||||
|
|
||||||
|
if (timeManager._frameCounter >= timeManager.framesPerUpdate) {
|
||||||
|
time = elapsedTime
|
||||||
|
timeManager._frameCounter = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onTriggered: time += interval
|
onEnableTimerChanged: if (!enableTimer) _frameCounter = 0
|
||||||
running: appSettings.fps !== 0 && enableTimer
|
onFramesPerUpdateChanged: _frameCounter = 0
|
||||||
interval: Math.round(1000 / appSettings.fps)
|
|
||||||
repeat: true
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ Menu {
|
|||||||
appSettings.handleFontChanged()
|
appSettings.handleFontChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onObjectAdded: profilesMenu.insertItem(index, object)
|
onObjectAdded: function(index, object) { profilesMenu.insertItem(index, object) }
|
||||||
onObjectRemoved: profilesMenu.removeItem(object)
|
onObjectRemoved: function(object) { profilesMenu.removeItem(object) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Menu {
|
Menu {
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ MenuBar {
|
|||||||
appSettings.handleFontChanged()
|
appSettings.handleFontChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onObjectAdded: profilesMenu.insertItem(index, object)
|
onObjectAdded: function(index, object) { profilesMenu.insertItem(index, object) }
|
||||||
onObjectRemoved: profilesMenu.removeItem(object)
|
onObjectRemoved: function(object) { profilesMenu.removeItem(object) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Menu {
|
Menu {
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ MenuBar {
|
|||||||
appSettings.handleFontChanged()
|
appSettings.handleFontChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onObjectAdded: profilesMenu.insertItem(index, object)
|
onObjectAdded: function(index, object) { profilesMenu.insertItem(index, object) }
|
||||||
onObjectRemoved: profilesMenu.removeItem(object)
|
onObjectRemoved: function(object) { profilesMenu.removeItem(object) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Menu {
|
Menu {
|
||||||
|
|||||||
@@ -46,5 +46,11 @@
|
|||||||
<file>menus/ShortContextMenu.qml</file>
|
<file>menus/ShortContextMenu.qml</file>
|
||||||
<file>ShaderLibrary.qml</file>
|
<file>ShaderLibrary.qml</file>
|
||||||
<file>menus/OSXMenu.qml</file>
|
<file>menus/OSXMenu.qml</file>
|
||||||
|
<file>../shaders/terminal_dynamic.vert.qsb</file>
|
||||||
|
<file>../shaders/terminal_dynamic.frag.qsb</file>
|
||||||
|
<file>../shaders/passthrough.vert.qsb</file>
|
||||||
|
<file>../shaders/terminal_static.frag.qsb</file>
|
||||||
|
<file>../shaders/terminal_frame.frag.qsb</file>
|
||||||
|
<file>../shaders/burn_in.frag.qsb</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
63
app/shaders/burn_in.frag
Normal file
63
app/shaders/burn_in.frag
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
#version 440
|
||||||
|
|
||||||
|
layout(location = 0) in vec2 qt_TexCoord0;
|
||||||
|
layout(location = 0) out vec4 fragColor;
|
||||||
|
|
||||||
|
layout(std140, binding = 0) uniform ubuf {
|
||||||
|
mat4 qt_Matrix;
|
||||||
|
float qt_Opacity;
|
||||||
|
float time;
|
||||||
|
vec4 fontColor;
|
||||||
|
vec4 backgroundColor;
|
||||||
|
float shadowLength;
|
||||||
|
vec2 virtualResolution;
|
||||||
|
float rasterizationIntensity;
|
||||||
|
int rasterizationMode;
|
||||||
|
float burnInLastUpdate;
|
||||||
|
float burnInTime;
|
||||||
|
float burnIn;
|
||||||
|
float staticNoise;
|
||||||
|
float screenCurvature;
|
||||||
|
float glowingLine;
|
||||||
|
float chromaColor;
|
||||||
|
vec2 jitterDisplacement;
|
||||||
|
float ambientLight;
|
||||||
|
float jitter;
|
||||||
|
float horizontalSync;
|
||||||
|
float horizontalSyncStrength;
|
||||||
|
float flickering;
|
||||||
|
float displayTerminalFrame;
|
||||||
|
vec2 scaleNoiseSize;
|
||||||
|
float screen_brightness;
|
||||||
|
float bloom;
|
||||||
|
float rbgShift;
|
||||||
|
float screenShadowCoeff;
|
||||||
|
float frameShadowCoeff;
|
||||||
|
vec4 frameColor;
|
||||||
|
vec2 margin;
|
||||||
|
float prevLastUpdate;
|
||||||
|
};
|
||||||
|
|
||||||
|
layout(binding = 1) uniform sampler2D txt_source;
|
||||||
|
layout(binding = 2) uniform sampler2D burnInSource;
|
||||||
|
|
||||||
|
float rgb2grey(vec3 v) {
|
||||||
|
return dot(v, vec3(0.21, 0.72, 0.04));
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec2 coords = qt_TexCoord0;
|
||||||
|
|
||||||
|
vec3 txtColor = texture(txt_source, coords).rgb;
|
||||||
|
vec4 accColor = texture(burnInSource, coords);
|
||||||
|
|
||||||
|
float prevMask = accColor.a;
|
||||||
|
float currMask = rgb2grey(txtColor);
|
||||||
|
|
||||||
|
float blurDecay = clamp((burnInLastUpdate - prevLastUpdate) * burnInTime, 0.0, 1.0);
|
||||||
|
blurDecay = max(0.0, blurDecay - prevMask);
|
||||||
|
vec3 blurColor = accColor.rgb - vec3(blurDecay);
|
||||||
|
vec3 color = max(blurColor, txtColor);
|
||||||
|
|
||||||
|
fragColor = vec4(color, currMask) * qt_Opacity;
|
||||||
|
}
|
||||||
BIN
app/shaders/burn_in.frag.qsb
Normal file
BIN
app/shaders/burn_in.frag.qsb
Normal file
Binary file not shown.
46
app/shaders/passthrough.vert
Normal file
46
app/shaders/passthrough.vert
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#version 440
|
||||||
|
|
||||||
|
layout(location = 0) in vec4 qt_Vertex;
|
||||||
|
layout(location = 1) in vec2 qt_MultiTexCoord0;
|
||||||
|
|
||||||
|
layout(std140, binding = 0) uniform ubuf {
|
||||||
|
mat4 qt_Matrix;
|
||||||
|
float qt_Opacity;
|
||||||
|
float time;
|
||||||
|
vec4 fontColor;
|
||||||
|
vec4 backgroundColor;
|
||||||
|
float shadowLength;
|
||||||
|
vec2 virtualResolution;
|
||||||
|
float rasterizationIntensity;
|
||||||
|
int rasterizationMode;
|
||||||
|
float burnInLastUpdate;
|
||||||
|
float burnInTime;
|
||||||
|
float burnIn;
|
||||||
|
float staticNoise;
|
||||||
|
float screenCurvature;
|
||||||
|
float glowingLine;
|
||||||
|
float chromaColor;
|
||||||
|
vec2 jitterDisplacement;
|
||||||
|
float ambientLight;
|
||||||
|
float jitter;
|
||||||
|
float horizontalSync;
|
||||||
|
float horizontalSyncStrength;
|
||||||
|
float flickering;
|
||||||
|
float displayTerminalFrame;
|
||||||
|
vec2 scaleNoiseSize;
|
||||||
|
float screen_brightness;
|
||||||
|
float bloom;
|
||||||
|
float rbgShift;
|
||||||
|
float screenShadowCoeff;
|
||||||
|
float frameShadowCoeff;
|
||||||
|
vec4 frameColor;
|
||||||
|
vec2 margin;
|
||||||
|
float prevLastUpdate;
|
||||||
|
};
|
||||||
|
|
||||||
|
layout(location = 0) out vec2 qt_TexCoord0;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
qt_TexCoord0 = qt_MultiTexCoord0;
|
||||||
|
gl_Position = qt_Matrix * qt_Vertex;
|
||||||
|
}
|
||||||
BIN
app/shaders/passthrough.vert.qsb
Normal file
BIN
app/shaders/passthrough.vert.qsb
Normal file
Binary file not shown.
163
app/shaders/terminal_dynamic.frag
Normal file
163
app/shaders/terminal_dynamic.frag
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
#version 440
|
||||||
|
|
||||||
|
layout(location = 0) in vec2 qt_TexCoord0;
|
||||||
|
layout(location = 1) in float vBrightness;
|
||||||
|
layout(location = 2) in float vDistortionScale;
|
||||||
|
layout(location = 3) in float vDistortionFreq;
|
||||||
|
|
||||||
|
layout(location = 0) out vec4 fragColor;
|
||||||
|
|
||||||
|
layout(std140, binding = 0) uniform ubuf {
|
||||||
|
mat4 qt_Matrix;
|
||||||
|
float qt_Opacity;
|
||||||
|
float time;
|
||||||
|
vec4 fontColor;
|
||||||
|
vec4 backgroundColor;
|
||||||
|
float shadowLength;
|
||||||
|
vec2 virtualResolution;
|
||||||
|
float rasterizationIntensity;
|
||||||
|
int rasterizationMode;
|
||||||
|
float burnInLastUpdate;
|
||||||
|
float burnInTime;
|
||||||
|
float burnIn;
|
||||||
|
float staticNoise;
|
||||||
|
float screenCurvature;
|
||||||
|
float glowingLine;
|
||||||
|
float chromaColor;
|
||||||
|
vec2 jitterDisplacement;
|
||||||
|
float ambientLight;
|
||||||
|
float jitter;
|
||||||
|
float horizontalSync;
|
||||||
|
float horizontalSyncStrength;
|
||||||
|
float flickering;
|
||||||
|
float displayTerminalFrame;
|
||||||
|
vec2 scaleNoiseSize;
|
||||||
|
float screen_brightness;
|
||||||
|
float bloom;
|
||||||
|
float rbgShift;
|
||||||
|
float screenShadowCoeff;
|
||||||
|
float frameShadowCoeff;
|
||||||
|
vec4 frameColor;
|
||||||
|
vec2 margin;
|
||||||
|
float prevLastUpdate;
|
||||||
|
};
|
||||||
|
|
||||||
|
layout(binding = 0) uniform sampler2D noiseSource;
|
||||||
|
layout(binding = 1) uniform sampler2D screenBuffer;
|
||||||
|
layout(binding = 2) uniform sampler2D burnInSource;
|
||||||
|
layout(binding = 3) uniform sampler2D frameSource;
|
||||||
|
|
||||||
|
float min2(vec2 v) { return min(v.x, v.y); }
|
||||||
|
float prod2(vec2 v) { return v.x * v.y; }
|
||||||
|
float sum2(vec2 v) { return v.x + v.y; }
|
||||||
|
float rgb2grey(vec3 v) { return dot(v, vec3(0.21, 0.72, 0.04)); }
|
||||||
|
|
||||||
|
vec3 applyRasterization(vec2 screenCoords, vec3 texel, vec2 virtualRes, float intensity, int mode) {
|
||||||
|
if (intensity <= 0.0 || mode == 0) {
|
||||||
|
return texel;
|
||||||
|
}
|
||||||
|
|
||||||
|
const float INTENSITY = 0.30;
|
||||||
|
const float BRIGHTBOOST = 0.30;
|
||||||
|
|
||||||
|
if (mode == 1) { // scanline
|
||||||
|
vec3 pixelHigh = ((1.0 + BRIGHTBOOST) - (0.2 * texel)) * texel;
|
||||||
|
vec3 pixelLow = ((1.0 - INTENSITY) + (0.1 * texel)) * texel;
|
||||||
|
|
||||||
|
vec2 coords = fract(screenCoords * virtualRes) * 2.0 - vec2(1.0);
|
||||||
|
float mask = 1.0 - abs(coords.y);
|
||||||
|
|
||||||
|
vec3 rasterizationColor = mix(pixelLow, pixelHigh, mask);
|
||||||
|
return mix(texel, rasterizationColor, intensity);
|
||||||
|
} else if (mode == 2) { // pixel
|
||||||
|
vec3 pixelHigh = ((1.0 + BRIGHTBOOST) - (0.2 * texel)) * texel;
|
||||||
|
vec3 pixelLow = ((1.0 - INTENSITY) + (0.1 * texel)) * texel;
|
||||||
|
|
||||||
|
vec2 coords = fract(screenCoords * virtualRes) * 2.0 - vec2(1.0);
|
||||||
|
coords = coords * coords;
|
||||||
|
float mask = 1.0 - coords.x - coords.y;
|
||||||
|
|
||||||
|
vec3 rasterizationColor = mix(pixelLow, pixelHigh, mask);
|
||||||
|
return mix(texel, rasterizationColor, intensity);
|
||||||
|
} else if (mode == 3) { // subpixel
|
||||||
|
const float SUBPIXELS = 3.0;
|
||||||
|
vec3 offsets = vec3(3.141592654) * vec3(0.5, 0.5 - 2.0 / 3.0, 0.5 - 4.0 / 3.0);
|
||||||
|
|
||||||
|
vec2 omega = vec2(3.141592654) * vec2(2.0) * virtualRes;
|
||||||
|
vec2 angle = screenCoords * omega;
|
||||||
|
vec3 xfactors = (SUBPIXELS + sin(angle.x + offsets)) / (SUBPIXELS + 1.0);
|
||||||
|
|
||||||
|
vec3 result = texel * xfactors;
|
||||||
|
vec3 pixelHigh = ((1.0 + BRIGHTBOOST) - (0.2 * result)) * result;
|
||||||
|
vec3 pixelLow = ((1.0 - INTENSITY) + (0.1 * result)) * result;
|
||||||
|
|
||||||
|
vec2 coords = fract(screenCoords * virtualRes) * 2.0 - vec2(1.0);
|
||||||
|
float mask = 1.0 - abs(coords.y);
|
||||||
|
|
||||||
|
vec3 rasterizationColor = mix(pixelLow, pixelHigh, mask);
|
||||||
|
return mix(texel, rasterizationColor, intensity);
|
||||||
|
}
|
||||||
|
|
||||||
|
return texel;
|
||||||
|
}
|
||||||
|
|
||||||
|
float randomPass(vec2 coords){
|
||||||
|
return fract(smoothstep(-120.0, 0.0, coords.y - (virtualResolution.y + 120.0) * fract(time * 0.15)));
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 barrel(vec2 v, vec2 cc) {
|
||||||
|
float distortion = dot(cc, cc) * screenCurvature;
|
||||||
|
return (v - cc * (1.0 + distortion) * distortion);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 convertWithChroma(vec3 inColor) {
|
||||||
|
vec3 outColor = fontColor.rgb * rgb2grey(inColor);
|
||||||
|
if (chromaColor != 0.0) {
|
||||||
|
outColor = fontColor.rgb * mix(vec3(rgb2grey(inColor)), inColor, chromaColor);
|
||||||
|
}
|
||||||
|
return outColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec2 cc = vec2(0.5) - qt_TexCoord0;
|
||||||
|
float distance = length(cc);
|
||||||
|
|
||||||
|
vec2 staticCoords = barrel(qt_TexCoord0, cc);
|
||||||
|
vec2 coords = qt_TexCoord0;
|
||||||
|
|
||||||
|
float dst = sin((coords.y + time) * vDistortionFreq);
|
||||||
|
coords.x += dst * vDistortionScale;
|
||||||
|
|
||||||
|
vec4 noiseTexel = texture(noiseSource, scaleNoiseSize * coords + vec2(fract(time / 0.051), fract(time / 0.237)));
|
||||||
|
|
||||||
|
vec2 txt_coords = coords + (noiseTexel.ba - vec2(0.5)) * jitterDisplacement * jitter;
|
||||||
|
|
||||||
|
float color = 0.0001;
|
||||||
|
color += noiseTexel.a * staticNoise * (1.0 - distance * 1.3);
|
||||||
|
color += randomPass(coords * virtualResolution) * glowingLine;
|
||||||
|
|
||||||
|
vec3 txt_color = texture(screenBuffer, txt_coords).rgb;
|
||||||
|
|
||||||
|
if (burnIn > 0.0) {
|
||||||
|
vec4 txt_blur = texture(burnInSource, staticCoords);
|
||||||
|
float blurDecay = clamp((time - burnInLastUpdate) * burnInTime, 0.0, 1.0);
|
||||||
|
vec3 burnInColor = 0.65 * (txt_blur.rgb - vec3(blurDecay));
|
||||||
|
txt_color = max(txt_color, convertWithChroma(burnInColor));
|
||||||
|
}
|
||||||
|
|
||||||
|
txt_color += fontColor.rgb * vec3(color);
|
||||||
|
txt_color = applyRasterization(staticCoords, txt_color, virtualResolution, rasterizationIntensity, rasterizationMode);
|
||||||
|
|
||||||
|
vec3 finalColor = txt_color;
|
||||||
|
float brightness = mix(1.0, vBrightness, step(0.0, flickering));
|
||||||
|
finalColor *= brightness;
|
||||||
|
|
||||||
|
finalColor += vec3(ambientLight) * (1.0 - distance) * (1.0 - distance);
|
||||||
|
|
||||||
|
if (displayTerminalFrame > 0.0) {
|
||||||
|
vec4 frameColor = texture(frameSource, qt_TexCoord0);
|
||||||
|
finalColor = mix(finalColor, frameColor.rgb, frameColor.a);
|
||||||
|
}
|
||||||
|
|
||||||
|
fragColor = vec4(finalColor, qt_Opacity);
|
||||||
|
}
|
||||||
BIN
app/shaders/terminal_dynamic.frag.qsb
Normal file
BIN
app/shaders/terminal_dynamic.frag.qsb
Normal file
Binary file not shown.
61
app/shaders/terminal_dynamic.vert
Normal file
61
app/shaders/terminal_dynamic.vert
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
#version 440
|
||||||
|
|
||||||
|
layout(location = 0) in vec4 qt_Vertex;
|
||||||
|
layout(location = 1) in vec2 qt_MultiTexCoord0;
|
||||||
|
|
||||||
|
layout(std140, binding = 0) uniform ubuf {
|
||||||
|
mat4 qt_Matrix;
|
||||||
|
float qt_Opacity;
|
||||||
|
float time;
|
||||||
|
vec4 fontColor;
|
||||||
|
vec4 backgroundColor;
|
||||||
|
float shadowLength;
|
||||||
|
vec2 virtualResolution;
|
||||||
|
float rasterizationIntensity;
|
||||||
|
int rasterizationMode;
|
||||||
|
float burnInLastUpdate;
|
||||||
|
float burnInTime;
|
||||||
|
float burnIn;
|
||||||
|
float staticNoise;
|
||||||
|
float screenCurvature;
|
||||||
|
float glowingLine;
|
||||||
|
float chromaColor;
|
||||||
|
vec2 jitterDisplacement;
|
||||||
|
float ambientLight;
|
||||||
|
float jitter;
|
||||||
|
float horizontalSync;
|
||||||
|
float horizontalSyncStrength;
|
||||||
|
float flickering;
|
||||||
|
float displayTerminalFrame;
|
||||||
|
vec2 scaleNoiseSize;
|
||||||
|
float screen_brightness;
|
||||||
|
float bloom;
|
||||||
|
float rbgShift;
|
||||||
|
float screenShadowCoeff;
|
||||||
|
float frameShadowCoeff;
|
||||||
|
vec4 frameColor;
|
||||||
|
vec2 margin;
|
||||||
|
float prevLastUpdate;
|
||||||
|
};
|
||||||
|
|
||||||
|
layout(binding = 0) uniform sampler2D noiseSource;
|
||||||
|
|
||||||
|
layout(location = 0) out vec2 qt_TexCoord0;
|
||||||
|
layout(location = 1) out float vBrightness;
|
||||||
|
layout(location = 2) out float vDistortionScale;
|
||||||
|
layout(location = 3) out float vDistortionFreq;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
qt_TexCoord0 = qt_MultiTexCoord0;
|
||||||
|
|
||||||
|
vec2 coords = vec2(fract(time / 2.048), fract(time / 1048.576));
|
||||||
|
vec4 initialNoiseTexel = texture(noiseSource, coords);
|
||||||
|
|
||||||
|
vBrightness = 1.0 + (initialNoiseTexel.g - 0.5) * flickering;
|
||||||
|
|
||||||
|
float randval = horizontalSyncStrength - initialNoiseTexel.r;
|
||||||
|
vDistortionScale = step(0.0, randval) * randval * horizontalSyncStrength * horizontalSync;
|
||||||
|
vDistortionFreq = mix(4.0, 40.0, initialNoiseTexel.g) * step(0.0, horizontalSync);
|
||||||
|
|
||||||
|
gl_Position = qt_Matrix * qt_Vertex;
|
||||||
|
}
|
||||||
BIN
app/shaders/terminal_dynamic.vert.qsb
Normal file
BIN
app/shaders/terminal_dynamic.vert.qsb
Normal file
Binary file not shown.
77
app/shaders/terminal_frame.frag
Normal file
77
app/shaders/terminal_frame.frag
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
#version 440
|
||||||
|
|
||||||
|
layout(location = 0) in vec2 qt_TexCoord0;
|
||||||
|
layout(location = 0) out vec4 fragColor;
|
||||||
|
|
||||||
|
layout(std140, binding = 0) uniform ubuf {
|
||||||
|
mat4 qt_Matrix;
|
||||||
|
float qt_Opacity;
|
||||||
|
float time;
|
||||||
|
vec4 fontColor;
|
||||||
|
vec4 backgroundColor;
|
||||||
|
float shadowLength;
|
||||||
|
vec2 virtualResolution;
|
||||||
|
float rasterizationIntensity;
|
||||||
|
int rasterizationMode;
|
||||||
|
float burnInLastUpdate;
|
||||||
|
float burnInTime;
|
||||||
|
float burnIn;
|
||||||
|
float staticNoise;
|
||||||
|
float screenCurvature;
|
||||||
|
float glowingLine;
|
||||||
|
float chromaColor;
|
||||||
|
vec2 jitterDisplacement;
|
||||||
|
float ambientLight;
|
||||||
|
float jitter;
|
||||||
|
float horizontalSync;
|
||||||
|
float horizontalSyncStrength;
|
||||||
|
float flickering;
|
||||||
|
float displayTerminalFrame;
|
||||||
|
vec2 scaleNoiseSize;
|
||||||
|
float screen_brightness;
|
||||||
|
float bloom;
|
||||||
|
float rbgShift;
|
||||||
|
float screenShadowCoeff;
|
||||||
|
float frameShadowCoeff;
|
||||||
|
vec4 frameColor;
|
||||||
|
vec2 margin;
|
||||||
|
float prevLastUpdate;
|
||||||
|
};
|
||||||
|
|
||||||
|
float min2(vec2 v) { return min(v.x, v.y); }
|
||||||
|
float max2(vec2 v) { return max(v.x, v.y); }
|
||||||
|
float prod2(vec2 v) { return v.x * v.y; }
|
||||||
|
float sum2(vec2 v) { return v.x + v.y; }
|
||||||
|
|
||||||
|
vec2 distortCoordinates(vec2 coords){
|
||||||
|
vec2 cc = (coords - vec2(0.5));
|
||||||
|
float dist = dot(cc, cc) * screenCurvature;
|
||||||
|
return (coords + cc * (1.0 + dist) * dist);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 positiveLog(vec2 x) {
|
||||||
|
return clamp(log(x), vec2(0.0), vec2(100.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec2 staticCoords = qt_TexCoord0;
|
||||||
|
vec2 coords = distortCoordinates(staticCoords) * (vec2(1.0) + margin * 2.0) - margin;
|
||||||
|
|
||||||
|
vec2 vignetteCoords = staticCoords * (1.0 - staticCoords.yx);
|
||||||
|
float vignette = pow(prod2(vignetteCoords) * 15.0, 0.25);
|
||||||
|
|
||||||
|
vec3 color = frameColor.rgb * vec3(1.0 - vignette);
|
||||||
|
float alpha = 0.0;
|
||||||
|
|
||||||
|
float frameShadow = max2(positiveLog(-coords * frameShadowCoeff + vec2(1.0)) + positiveLog(coords * frameShadowCoeff - (vec2(frameShadowCoeff) - vec2(1.0))));
|
||||||
|
frameShadow = max(sqrt(frameShadow), 0.0);
|
||||||
|
color *= frameShadow;
|
||||||
|
alpha = sum2(1.0 - step(vec2(0.0), coords) + step(vec2(1.0), coords));
|
||||||
|
alpha = clamp(alpha, 0.0, 1.0);
|
||||||
|
alpha *= mix(1.0, 0.9, frameShadow);
|
||||||
|
|
||||||
|
float screenShadow = 1.0 - prod2(positiveLog(coords * screenShadowCoeff + vec2(1.0)) * positiveLog(-coords * screenShadowCoeff + vec2(screenShadowCoeff + 1.0)));
|
||||||
|
alpha = max(0.8 * screenShadow, alpha);
|
||||||
|
|
||||||
|
fragColor = vec4(color * alpha, alpha) * qt_Opacity;
|
||||||
|
}
|
||||||
BIN
app/shaders/terminal_frame.frag.qsb
Normal file
BIN
app/shaders/terminal_frame.frag.qsb
Normal file
Binary file not shown.
104
app/shaders/terminal_static.frag
Normal file
104
app/shaders/terminal_static.frag
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
#version 440
|
||||||
|
|
||||||
|
layout(location = 0) in vec2 qt_TexCoord0;
|
||||||
|
layout(location = 0) out vec4 fragColor;
|
||||||
|
|
||||||
|
layout(std140, binding = 0) uniform ubuf {
|
||||||
|
mat4 qt_Matrix;
|
||||||
|
float qt_Opacity;
|
||||||
|
float time;
|
||||||
|
vec4 fontColor;
|
||||||
|
vec4 backgroundColor;
|
||||||
|
float shadowLength;
|
||||||
|
vec2 virtualResolution;
|
||||||
|
float rasterizationIntensity;
|
||||||
|
int rasterizationMode;
|
||||||
|
float burnInLastUpdate;
|
||||||
|
float burnInTime;
|
||||||
|
float burnIn;
|
||||||
|
float staticNoise;
|
||||||
|
float screenCurvature;
|
||||||
|
float glowingLine;
|
||||||
|
float chromaColor;
|
||||||
|
vec2 jitterDisplacement;
|
||||||
|
float ambientLight;
|
||||||
|
float jitter;
|
||||||
|
float horizontalSync;
|
||||||
|
float horizontalSyncStrength;
|
||||||
|
float flickering;
|
||||||
|
float displayTerminalFrame;
|
||||||
|
vec2 scaleNoiseSize;
|
||||||
|
float screen_brightness;
|
||||||
|
float bloom;
|
||||||
|
float rbgShift;
|
||||||
|
float screenShadowCoeff;
|
||||||
|
float frameShadowCoeff;
|
||||||
|
vec4 frameColor;
|
||||||
|
vec2 margin;
|
||||||
|
float prevLastUpdate;
|
||||||
|
};
|
||||||
|
|
||||||
|
layout(binding = 1) uniform sampler2D source;
|
||||||
|
layout(binding = 2) uniform sampler2D bloomSource;
|
||||||
|
|
||||||
|
float sum2(vec2 v) { return v.x + v.y; }
|
||||||
|
float rgb2grey(vec3 v) { return dot(v, vec3(0.21, 0.72, 0.04)); }
|
||||||
|
|
||||||
|
vec3 convertWithChroma(vec3 inColor) {
|
||||||
|
vec3 outColor = fontColor.rgb * rgb2grey(inColor);
|
||||||
|
if (chromaColor != 0.0) {
|
||||||
|
outColor = fontColor.rgb * mix(vec3(rgb2grey(inColor)), inColor, chromaColor);
|
||||||
|
}
|
||||||
|
return outColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec2 cc = vec2(0.5) - qt_TexCoord0;
|
||||||
|
|
||||||
|
vec2 txt_coords = qt_TexCoord0;
|
||||||
|
if (screenCurvature != 0.0) {
|
||||||
|
float distortion = dot(cc, cc) * screenCurvature;
|
||||||
|
vec2 curvatureCoords = (qt_TexCoord0 - cc * (1.0 + distortion) * distortion);
|
||||||
|
txt_coords = -2.0 * curvatureCoords + 3.0 * step(vec2(0.0), curvatureCoords) * curvatureCoords - 3.0 * step(vec2(1.0), curvatureCoords) * curvatureCoords;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 txt_color = texture(source, txt_coords).rgb;
|
||||||
|
|
||||||
|
if (rbgShift != 0.0) {
|
||||||
|
vec2 displacement = vec2(12.0, 0.0) * rbgShift;
|
||||||
|
vec3 rightColor = texture(source, txt_coords + displacement).rgb;
|
||||||
|
vec3 leftColor = texture(source, txt_coords - displacement).rgb;
|
||||||
|
txt_color.r = leftColor.r * 0.10 + rightColor.r * 0.30 + txt_color.r * 0.60;
|
||||||
|
txt_color.g = leftColor.g * 0.20 + rightColor.g * 0.20 + txt_color.g * 0.60;
|
||||||
|
txt_color.b = leftColor.b * 0.30 + rightColor.b * 0.10 + txt_color.b * 0.60;
|
||||||
|
}
|
||||||
|
|
||||||
|
txt_color += vec3(0.0001);
|
||||||
|
float greyscale_color = rgb2grey(txt_color);
|
||||||
|
|
||||||
|
float reflectionMask = 1.0;
|
||||||
|
if (screenCurvature != 0.0) {
|
||||||
|
float distortion = dot(cc, cc) * screenCurvature;
|
||||||
|
vec2 curvatureCoords = (qt_TexCoord0 - cc * (1.0 + distortion) * distortion);
|
||||||
|
reflectionMask = sum2(step(vec2(0.0), curvatureCoords) - step(vec2(1.0), curvatureCoords));
|
||||||
|
reflectionMask = clamp(reflectionMask, 0.0, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 finalColor;
|
||||||
|
if (chromaColor != 0.0) {
|
||||||
|
vec3 foregroundColor = mix(fontColor.rgb, txt_color * fontColor.rgb / greyscale_color, chromaColor);
|
||||||
|
finalColor = mix(backgroundColor.rgb, foregroundColor, greyscale_color * reflectionMask);
|
||||||
|
} else {
|
||||||
|
finalColor = mix(backgroundColor.rgb, fontColor.rgb, greyscale_color * reflectionMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bloom != 0.0) {
|
||||||
|
vec4 bloomFullColor = texture(bloomSource, txt_coords);
|
||||||
|
vec3 bloomColor = convertWithChroma(bloomFullColor.rgb);
|
||||||
|
float bloomAlpha = bloomFullColor.a;
|
||||||
|
finalColor += clamp(bloomColor * bloom * bloomAlpha, 0.0, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
finalColor *= screen_brightness;
|
||||||
|
fragColor = vec4(finalColor, qt_Opacity);
|
||||||
|
}
|
||||||
BIN
app/shaders/terminal_static.frag.qsb
Normal file
BIN
app/shaders/terminal_static.frag.qsb
Normal file
Binary file not shown.
Submodule qmltermwidget updated: 63228027e1...290f542d23
Reference in New Issue
Block a user