mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-03-20 17:48:46 +00:00
Merge pull request #118 from Swordfish90/simplifyimprove
Many simplifications and optimizations of the underlying structure. cool-retro-term is now faster, it has better rasterizations and pixel perfect mouse events.
This commit is contained in:
commit
774e4f5306
@ -99,7 +99,7 @@ Item{
|
|||||||
|
|
||||||
// FONTS //////////////////////////////////////////////////////////////////
|
// FONTS //////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
signal terminalFontChanged(string fontSource, int pixelSize, int lineSpacing, size virtualCharSize)
|
signal terminalFontChanged(string fontSource, int pixelSize, int lineSpacing, real screenScaling)
|
||||||
|
|
||||||
Loader{
|
Loader{
|
||||||
id: fontManager
|
id: fontManager
|
||||||
@ -117,17 +117,17 @@ Item{
|
|||||||
}
|
}
|
||||||
|
|
||||||
signal fontScalingChanged
|
signal fontScalingChanged
|
||||||
property var fontScalingList: fontManager.item.fontScalingList
|
property var fontScalingList: [0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5]
|
||||||
property var fontScalingIndexes: [5,1,1]
|
property int fontScalingIndex: 5
|
||||||
|
|
||||||
function setScalingIndex(newScaling){
|
function setScalingIndex(newScaling){
|
||||||
fontScalingIndexes[rasterization] = newScaling;
|
fontScalingIndex = newScaling;
|
||||||
fontScalingChanged();
|
fontScalingChanged();
|
||||||
handleFontChanged();
|
handleFontChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getScalingIndex(){
|
function getScalingIndex(){
|
||||||
return fontScalingIndexes[rasterization];
|
return fontScalingIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
property var fontIndexes: [0,0,0]
|
property var fontIndexes: [0,0,0]
|
||||||
@ -136,14 +136,14 @@ Item{
|
|||||||
function handleFontChanged(){
|
function handleFontChanged(){
|
||||||
if(!fontManager.item) return;
|
if(!fontManager.item) return;
|
||||||
fontManager.item.selectedFontIndex = fontIndexes[rasterization];
|
fontManager.item.selectedFontIndex = fontIndexes[rasterization];
|
||||||
fontManager.item.selectedScalingIndex = fontScalingIndexes[rasterization];
|
fontManager.item.scaling = fontScalingList[fontScalingIndex];
|
||||||
|
|
||||||
var fontSource = fontManager.item.source;
|
var fontSource = fontManager.item.source;
|
||||||
var pixelSize = fontManager.item.pixelSize;
|
var pixelSize = fontManager.item.pixelSize;
|
||||||
var lineSpacing = fontManager.item.lineSpacing;
|
var lineSpacing = fontManager.item.lineSpacing;
|
||||||
var virtualCharSize = fontManager.item.virtualCharSize;
|
var screenScaling = fontManager.item.screenScaling;
|
||||||
|
|
||||||
terminalFontChanged(fontSource, pixelSize, lineSpacing, virtualCharSize);
|
terminalFontChanged(fontSource, pixelSize, lineSpacing, screenScaling);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FRAMES /////////////////////////////////////////////////////////////////
|
// FRAMES /////////////////////////////////////////////////////////////////
|
||||||
@ -164,7 +164,7 @@ Item{
|
|||||||
fps: fps,
|
fps: fps,
|
||||||
window_scaling: window_scaling,
|
window_scaling: window_scaling,
|
||||||
show_terminal_size: show_terminal_size,
|
show_terminal_size: show_terminal_size,
|
||||||
fontScalingIndexes: fontScalingIndexes,
|
fontScalingIndex: fontScalingIndex,
|
||||||
fontIndexes: fontIndexes,
|
fontIndexes: fontIndexes,
|
||||||
frameReflections: _frameReflections,
|
frameReflections: _frameReflections,
|
||||||
showMenubar: showMenubar
|
showMenubar: showMenubar
|
||||||
@ -231,7 +231,7 @@ Item{
|
|||||||
window_scaling = settings.window_scaling !== undefined ? settings.window_scaling : window_scaling
|
window_scaling = settings.window_scaling !== undefined ? settings.window_scaling : window_scaling
|
||||||
|
|
||||||
fontIndexes = settings.fontIndexes !== undefined ? settings.fontIndexes : fontIndexes
|
fontIndexes = settings.fontIndexes !== undefined ? settings.fontIndexes : fontIndexes
|
||||||
fontScalingIndexes = settings.fontScalingIndexes !== undefined ? settings.fontScalingIndexes : fontScalingIndexes
|
fontScalingIndex = settings.fontScalingIndex !== undefined ? settings.fontScalingIndex : fontScalingIndex
|
||||||
|
|
||||||
_frameReflections = settings.frameReflections !== undefined ? settings.frameReflections : _frameReflections;
|
_frameReflections = settings.frameReflections !== undefined ? settings.frameReflections : _frameReflections;
|
||||||
|
|
||||||
|
@ -22,50 +22,50 @@ import QtQuick 2.2
|
|||||||
|
|
||||||
Item{
|
Item{
|
||||||
property int selectedFontIndex
|
property int selectedFontIndex
|
||||||
property int selectedScalingIndex
|
property real scaling
|
||||||
property alias fontlist: fontlist
|
property alias fontlist: fontlist
|
||||||
property var _font: fontlist.get(selectedFontIndex)
|
property var _font: fontlist.get(selectedFontIndex)
|
||||||
property var _scaling: fontScalingList[selectedScalingIndex]
|
|
||||||
property var source: _font.source
|
property var source: _font.source
|
||||||
property var fontScalingList: [0.75, 1.0, 1.25, 1.50, 1.75, 2.0, 2.25, 2.5]
|
property int pixelSize: _font.pixelSize
|
||||||
property int pixelSize: _font.pixelSize * _scaling
|
property int lineSpacing: _font.lineSpacing
|
||||||
property int lineSpacing: (_font.pixelSize / _font.virtualCharHeight) * _font.lineSpacing
|
property real screenScaling: scaling * _font.baseScaling
|
||||||
property size virtualCharSize: Qt.size(_font.virtualCharWidth,
|
|
||||||
_font.virtualCharHeight)
|
|
||||||
|
|
||||||
ListModel{
|
ListModel{
|
||||||
id: fontlist
|
id: fontlist
|
||||||
|
ListElement{
|
||||||
|
text: "Commodore PET 2Y (1977)"
|
||||||
|
source: "fonts/1977-commodore-pet/COMMODORE_PET_2y.ttf"
|
||||||
|
lineSpacing: 2
|
||||||
|
pixelSize: 16
|
||||||
|
baseScaling: 3.0
|
||||||
|
}
|
||||||
ListElement{
|
ListElement{
|
||||||
text: "Commodore PET (1977)"
|
text: "Commodore PET (1977)"
|
||||||
source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
|
source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
|
||||||
lineSpacing: 2
|
lineSpacing: 2
|
||||||
virtualCharWidth: 8
|
pixelSize: 8
|
||||||
virtualCharHeight: 8
|
baseScaling: 4.0
|
||||||
pixelSize: 32
|
|
||||||
}
|
}
|
||||||
ListElement{
|
ListElement{
|
||||||
text: "Apple ][ (1977)"
|
text: "Apple ][ (1977)"
|
||||||
source: "fonts/1977-apple2/PrintChar21.ttf"
|
source: "fonts/1977-apple2/PrintChar21.ttf"
|
||||||
lineSpacing: 2
|
lineSpacing: 2
|
||||||
virtualCharWidth: 7
|
pixelSize: 8
|
||||||
virtualCharHeight: 8
|
baseScaling: 4.0
|
||||||
pixelSize: 32
|
|
||||||
}
|
}
|
||||||
ListElement{
|
ListElement{
|
||||||
text: "Atari 400-800 (1979)"
|
text: "Atari 400-800 (1979)"
|
||||||
source: "fonts/1979-atari-400-800/ATARI400800_original.TTF"
|
source: "fonts/1979-atari-400-800/ATARI400800_original.TTF"
|
||||||
lineSpacing: 3
|
lineSpacing: 3
|
||||||
virtualCharWidth: 8
|
pixelSize: 8
|
||||||
virtualCharHeight: 8
|
baseScaling: 4.0
|
||||||
pixelSize: 32
|
|
||||||
}
|
}
|
||||||
ListElement{
|
ListElement{
|
||||||
text: "Commodore 64 (1982)"
|
text: "Commodore 64 (1982)"
|
||||||
source: "fonts/1982-commodore64/C64_User_Mono_v1.0-STYLE.ttf"
|
source: "fonts/1982-commodore64/C64_User_Mono_v1.0-STYLE.ttf"
|
||||||
lineSpacing: 3
|
lineSpacing: 3
|
||||||
virtualCharWidth: 8
|
pixelSize: 8
|
||||||
virtualCharHeight: 8
|
baseScaling: 4.0
|
||||||
pixelSize: 32
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,16 +22,13 @@ import QtQuick 2.2
|
|||||||
|
|
||||||
Item{
|
Item{
|
||||||
property int selectedFontIndex
|
property int selectedFontIndex
|
||||||
property int selectedScalingIndex
|
property real scaling
|
||||||
property alias fontlist: fontlist
|
property alias fontlist: fontlist
|
||||||
property var _font: fontlist.get(selectedFontIndex)
|
property var _font: fontlist.get(selectedFontIndex)
|
||||||
property var _scaling: fontScalingList[selectedScalingIndex]
|
|
||||||
property var source: _font.source
|
property var source: _font.source
|
||||||
property var fontScalingList: [0.75, 1.0, 1.25, 1.50, 1.75, 2.0, 2.25, 2.50]
|
property int pixelSize: _font.pixelSize
|
||||||
property int pixelSize: _font.pixelSize * _scaling
|
property int lineSpacing: _font.lineSpacing
|
||||||
property int lineSpacing: (_font.pixelSize / _font.virtualCharHeight) * _font.lineSpacing
|
property real screenScaling: scaling * _font.baseScaling
|
||||||
property size virtualCharSize: Qt.size(_font.virtualCharWidth,
|
|
||||||
_font.virtualCharHeight)
|
|
||||||
|
|
||||||
ListModel{
|
ListModel{
|
||||||
id: fontlist
|
id: fontlist
|
||||||
@ -39,41 +36,36 @@ Item{
|
|||||||
text: "Commodore PET 2Y (1977)"
|
text: "Commodore PET 2Y (1977)"
|
||||||
source: "fonts/1977-commodore-pet/COMMODORE_PET_2y.ttf"
|
source: "fonts/1977-commodore-pet/COMMODORE_PET_2y.ttf"
|
||||||
lineSpacing: 2
|
lineSpacing: 2
|
||||||
virtualCharWidth: 4
|
pixelSize: 16
|
||||||
virtualCharHeight: 8
|
baseScaling: 3.0
|
||||||
pixelSize: 32
|
|
||||||
}
|
}
|
||||||
ListElement{
|
ListElement{
|
||||||
text: "Commodore PET (1977)"
|
text: "Commodore PET (1977)"
|
||||||
source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
|
source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
|
||||||
lineSpacing: 2
|
lineSpacing: 2
|
||||||
virtualCharWidth: 8
|
pixelSize: 8
|
||||||
virtualCharHeight: 8
|
baseScaling: 4.0
|
||||||
pixelSize: 32
|
|
||||||
}
|
}
|
||||||
ListElement{
|
ListElement{
|
||||||
text: "Apple ][ (1977)"
|
text: "Apple ][ (1977)"
|
||||||
source: "fonts/1977-apple2/PrintChar21.ttf"
|
source: "fonts/1977-apple2/PrintChar21.ttf"
|
||||||
lineSpacing: 2
|
lineSpacing: 2
|
||||||
virtualCharWidth: 8
|
pixelSize: 8
|
||||||
virtualCharHeight: 8
|
baseScaling: 4.0
|
||||||
pixelSize: 32
|
|
||||||
}
|
}
|
||||||
ListElement{
|
ListElement{
|
||||||
text: "Atari 400-800 (1979)"
|
text: "Atari 400-800 (1979)"
|
||||||
source: "fonts/1979-atari-400-800/ATARI400800_original.TTF"
|
source: "fonts/1979-atari-400-800/ATARI400800_original.TTF"
|
||||||
lineSpacing: 3
|
lineSpacing: 3
|
||||||
virtualCharWidth: 8
|
pixelSize: 8
|
||||||
virtualCharHeight: 8
|
baseScaling: 4.0
|
||||||
pixelSize: 32
|
|
||||||
}
|
}
|
||||||
ListElement{
|
ListElement{
|
||||||
text: "Commodore 64 (1982)"
|
text: "Commodore 64 (1982)"
|
||||||
source: "fonts/1982-commodore64/C64_User_Mono_v1.0-STYLE.ttf"
|
source: "fonts/1982-commodore64/C64_User_Mono_v1.0-STYLE.ttf"
|
||||||
lineSpacing: 3
|
lineSpacing: 3
|
||||||
virtualCharWidth: 8
|
pixelSize: 8
|
||||||
virtualCharHeight: 8
|
baseScaling: 4.0
|
||||||
pixelSize: 32
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,14 +22,13 @@ import QtQuick 2.2
|
|||||||
|
|
||||||
Item{
|
Item{
|
||||||
property int selectedFontIndex
|
property int selectedFontIndex
|
||||||
property int selectedScalingIndex
|
property real scaling
|
||||||
property alias fontlist: fontlist
|
property alias fontlist: fontlist
|
||||||
property var source: fontlist.get(selectedFontIndex).source
|
property var source: fontlist.get(selectedFontIndex).source
|
||||||
property var _font: fontlist.get(selectedFontIndex)
|
property var _font: fontlist.get(selectedFontIndex)
|
||||||
property var _scaling: fontScalingList[selectedScalingIndex]
|
property int pixelSize: _font.pixelSize * scaling
|
||||||
property var fontScalingList: [0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5]
|
|
||||||
property int pixelSize: _font.pixelSize * _scaling
|
|
||||||
property int lineSpacing: pixelSize * _font.lineSpacing
|
property int lineSpacing: pixelSize * _font.lineSpacing
|
||||||
|
property real screenScaling: 1.0
|
||||||
|
|
||||||
//In this configuration lineSpacing is proportional to pixelSize.
|
//In this configuration lineSpacing is proportional to pixelSize.
|
||||||
|
|
||||||
|
@ -26,7 +26,19 @@ import org.crt.konsole 0.1
|
|||||||
|
|
||||||
Item{
|
Item{
|
||||||
id: terminalContainer
|
id: terminalContainer
|
||||||
property variant theSource: finalSource
|
|
||||||
|
//Frame displacement properties. This makes the terminal the same size of the texture.
|
||||||
|
property real dtop: frame.item.displacementTop
|
||||||
|
property real dleft:frame.item.displacementLeft
|
||||||
|
property real dright: frame.item.displacementRight
|
||||||
|
property real dbottom: frame.item.displacementBottom
|
||||||
|
|
||||||
|
anchors.leftMargin: dleft
|
||||||
|
anchors.rightMargin: dright
|
||||||
|
anchors.topMargin: dtop
|
||||||
|
anchors.bottomMargin: dbottom
|
||||||
|
|
||||||
|
property variant theSource: mBlur !== 0 ? blurredSourceLoader.item : kterminalSource
|
||||||
property variant bloomSource: bloomSourceLoader.item
|
property variant bloomSource: bloomSourceLoader.item
|
||||||
property variant rasterizationSource: rasterizationEffectSource
|
property variant rasterizationSource: rasterizationEffectSource
|
||||||
property variant staticNoiseSource: staticNoiseSource
|
property variant staticNoiseSource: staticNoiseSource
|
||||||
@ -45,11 +57,6 @@ Item{
|
|||||||
property real _minBlurCoefficient: 0.70
|
property real _minBlurCoefficient: 0.70
|
||||||
property real _maxBlurCoefficient: 0.90
|
property real _maxBlurCoefficient: 0.90
|
||||||
|
|
||||||
property size virtualPxSize: Qt.size(1,1)
|
|
||||||
property size virtual_resolution: Qt.size(width / virtualPxSize.width, height / virtualPxSize.height)
|
|
||||||
property real deltay: 0.5 / virtual_resolution.height
|
|
||||||
property real deltax: 0.5 / virtual_resolution.width
|
|
||||||
|
|
||||||
property real mBloom: shadersettings.bloom_strength
|
property real mBloom: shadersettings.bloom_strength
|
||||||
property int mScanlines: shadersettings.rasterization
|
property int mScanlines: shadersettings.rasterization
|
||||||
onMScanlinesChanged: restartBlurredSource()
|
onMScanlinesChanged: restartBlurredSource()
|
||||||
@ -60,9 +67,8 @@ Item{
|
|||||||
onMBlurChanged: restartBlurredSource()
|
onMBlurChanged: restartBlurredSource()
|
||||||
|
|
||||||
function restartBlurredSource(){
|
function restartBlurredSource(){
|
||||||
if(!blurredSource) return;
|
if(!blurredSourceLoader.item) return;
|
||||||
blurredSource.live = true;
|
blurredSourceLoader.item.restartBlurSource();
|
||||||
livetimer.restart()
|
|
||||||
}
|
}
|
||||||
function pasteClipboard(){
|
function pasteClipboard(){
|
||||||
kterminal.pasteClipboard();
|
kterminal.pasteClipboard();
|
||||||
@ -73,7 +79,8 @@ Item{
|
|||||||
|
|
||||||
KTerminal {
|
KTerminal {
|
||||||
id: kterminal
|
id: kterminal
|
||||||
anchors.fill: parent
|
width: parent.width
|
||||||
|
height: parent.height
|
||||||
|
|
||||||
colorScheme: "cool-retro-term"
|
colorScheme: "cool-retro-term"
|
||||||
|
|
||||||
@ -89,30 +96,15 @@ Item{
|
|||||||
FontLoader{ id: fontLoader }
|
FontLoader{ id: fontLoader }
|
||||||
Text{id: fontMetrics; text: "B"; visible: false}
|
Text{id: fontMetrics; text: "B"; visible: false}
|
||||||
|
|
||||||
function getPaintedSize(pixelSize){
|
function handleFontChange(fontSource, pixelSize, lineSpacing, screenScaling){
|
||||||
fontMetrics.font.family = fontLoader.name;
|
|
||||||
fontMetrics.font.pixelSize = pixelSize;
|
|
||||||
return Qt.size(fontMetrics.paintedWidth, fontMetrics.paintedHeight);
|
|
||||||
}
|
|
||||||
function isValid(size){
|
|
||||||
return size.width >= 0 && size.height >= 0;
|
|
||||||
}
|
|
||||||
function handleFontChange(fontSource, pixelSize, lineSpacing, virtualCharSize){
|
|
||||||
fontLoader.source = fontSource;
|
fontLoader.source = fontSource;
|
||||||
font.pixelSize = pixelSize * shadersettings.window_scaling;
|
font.pixelSize = pixelSize;
|
||||||
font.family = fontLoader.name;
|
font.family = fontLoader.name;
|
||||||
|
|
||||||
var paintedSize = getPaintedSize(pixelSize);
|
width = Qt.binding(function() {return Math.floor(terminalContainer.width / screenScaling);});
|
||||||
var charSize = isValid(virtualCharSize)
|
height = Qt.binding(function() {return Math.floor(terminalContainer.height / screenScaling);});
|
||||||
? virtualCharSize
|
|
||||||
: Qt.size(paintedSize.width / 2, paintedSize.height / 2);
|
|
||||||
|
|
||||||
var virtualPxSize = Qt.size((paintedSize.width / charSize.width) * shadersettings.window_scaling,
|
setLineSpacing(lineSpacing);
|
||||||
(paintedSize.height / charSize.height) * shadersettings.window_scaling)
|
|
||||||
|
|
||||||
terminalContainer.virtualPxSize = virtualPxSize;
|
|
||||||
|
|
||||||
setLineSpacing(lineSpacing * shadersettings.window_scaling);
|
|
||||||
restartBlurredSource();
|
restartBlurredSource();
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
@ -157,116 +149,121 @@ Item{
|
|||||||
var coord = correctDistortion(mouse.x, mouse.y);
|
var coord = correctDistortion(mouse.x, mouse.y);
|
||||||
kterminal.mouseReleaseEvent(coord, mouse.button, mouse.modifiers);
|
kterminal.mouseReleaseEvent(coord, mouse.button, mouse.modifiers);
|
||||||
}
|
}
|
||||||
onPositionChanged: {
|
onPositionChanged: {
|
||||||
var coord = correctDistortion(mouse.x, mouse.y);
|
var coord = correctDistortion(mouse.x, mouse.y);
|
||||||
kterminal.mouseMoveEvent(coord, mouse.button, mouse.buttons, mouse.modifiers);
|
kterminal.mouseMoveEvent(coord, mouse.button, mouse.buttons, mouse.modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Frame displacement properties
|
|
||||||
property real dtop: frame.item.displacementTop
|
|
||||||
property real dleft:frame.item.displacementLeft
|
|
||||||
property real dright: frame.item.displacementRight
|
|
||||||
property real dbottom: frame.item.displacementBottom
|
|
||||||
|
|
||||||
function correctDistortion(x, y){
|
function correctDistortion(x, y){
|
||||||
x = x / width;
|
x = x / width;
|
||||||
y = y / height;
|
y = y / height;
|
||||||
|
|
||||||
x = (-dleft + x * (width + dleft + dright)) / width
|
|
||||||
y = (-dtop + y * (height + dtop + dbottom)) / height
|
|
||||||
|
|
||||||
var cc = Qt.size(0.5 - x, 0.5 - y);
|
var cc = Qt.size(0.5 - x, 0.5 - y);
|
||||||
var distortion = (cc.height * cc.height + cc.width * cc.width) * shadersettings.screen_distortion;
|
var distortion = (cc.height * cc.height + cc.width * cc.width) * shadersettings.screen_distortion;
|
||||||
|
|
||||||
return Qt.point((x - cc.width * (1+distortion) * distortion) * width,
|
return Qt.point((x - cc.width * (1+distortion) * distortion) * kterminal.width,
|
||||||
(y - cc.height * (1+distortion) * distortion) * height)
|
(y - cc.height * (1+distortion) * distortion) * kterminal.height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ShaderEffectSource{
|
ShaderEffectSource{
|
||||||
id: source
|
id: kterminalSource
|
||||||
sourceItem: kterminal
|
sourceItem: kterminal
|
||||||
hideSource: true
|
hideSource: true
|
||||||
smooth: false
|
smooth: mScanlines == shadersettings.no_rasterization
|
||||||
}
|
wrapMode: ShaderEffectSource.ClampToEdge
|
||||||
ShaderEffectSource{
|
|
||||||
id: blurredSource
|
|
||||||
sourceItem: blurredterminal
|
|
||||||
recursive: true
|
|
||||||
live: false
|
live: false
|
||||||
|
|
||||||
hideSource: true
|
signal sourceUpdate
|
||||||
|
|
||||||
smooth: false
|
Connections{
|
||||||
antialiasing: false
|
target: kterminal
|
||||||
|
onUpdatedImage:{
|
||||||
Timer{
|
kterminalSource.scheduleUpdate();
|
||||||
id: livetimer
|
kterminalSource.sourceUpdate();
|
||||||
running: true
|
}
|
||||||
onRunningChanged: running ?
|
|
||||||
timeManager.onTimeChanged.connect(blurredSource.scheduleUpdate) :
|
|
||||||
timeManager.onTimeChanged.disconnect(blurredSource.scheduleUpdate)
|
|
||||||
|
|
||||||
Component.onCompleted: kterminal.updatedImage.connect(restart);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ShaderEffectSource{
|
Loader{
|
||||||
id: finalSource
|
id: blurredSourceLoader
|
||||||
sourceItem: blurredterminal
|
active: mBlur !== 0
|
||||||
sourceRect: frame.sourceRect
|
|
||||||
hideSource: true
|
sourceComponent: ShaderEffectSource{
|
||||||
|
id: _blurredSourceEffect
|
||||||
|
sourceItem: blurredTerminalLoader.item
|
||||||
|
recursive: true
|
||||||
|
live: false
|
||||||
|
hideSource: true
|
||||||
|
wrapMode: kterminalSource.wrapMode
|
||||||
|
|
||||||
|
smooth: mScanlines == shadersettings.no_rasterization
|
||||||
|
|
||||||
|
function restartBlurSource(){
|
||||||
|
livetimer.restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer{
|
||||||
|
id: livetimer
|
||||||
|
running: true
|
||||||
|
onRunningChanged: {
|
||||||
|
running ?
|
||||||
|
timeBinding.target = timeManager :
|
||||||
|
timeBinding.target = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Connections{
|
||||||
|
id: timeBinding
|
||||||
|
target: timeManager
|
||||||
|
onTimeChanged: {
|
||||||
|
_blurredSourceEffect.scheduleUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Connections{
|
||||||
|
target: kterminalSource
|
||||||
|
onSourceUpdate:{
|
||||||
|
livetimer.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ShaderEffect {
|
|
||||||
id: blurredterminal
|
|
||||||
anchors.fill: parent
|
|
||||||
property variant source: source
|
|
||||||
property variant blurredSource: (mBlur !== 0) ? blurredSource : undefined
|
|
||||||
property real blurCoefficient: (1.0 - motionBlurCoefficient) * fpsAttenuation
|
|
||||||
property size virtual_resolution: parent.virtual_resolution
|
|
||||||
property size delta: Qt.size((mScanlines == shadersettings.pixel_rasterization ? deltax : 0),
|
|
||||||
mScanlines != shadersettings.no_rasterization ? deltay : 0)
|
|
||||||
blending: false
|
|
||||||
|
|
||||||
fragmentShader:
|
Loader{
|
||||||
"uniform lowp float qt_Opacity;" +
|
id: blurredTerminalLoader
|
||||||
"uniform lowp sampler2D source;" +
|
anchors.fill: kterminal
|
||||||
"uniform highp vec2 delta;" +
|
active: mBlur !== 0
|
||||||
|
|
||||||
"varying highp vec2 qt_TexCoord0;
|
sourceComponent: ShaderEffect {
|
||||||
|
property variant txt_source: kterminalSource
|
||||||
|
property variant blurredSource: blurredSourceLoader.item
|
||||||
|
property real blurCoefficient: (1.0 - motionBlurCoefficient) * fpsAttenuation
|
||||||
|
|
||||||
uniform highp vec2 virtual_resolution;" +
|
blending: false
|
||||||
|
|
||||||
(mBlur !== 0 ?
|
fragmentShader:
|
||||||
"uniform lowp sampler2D blurredSource;
|
"uniform lowp float qt_Opacity;" +
|
||||||
uniform lowp float blurCoefficient;"
|
"uniform lowp sampler2D txt_source;" +
|
||||||
: "") +
|
|
||||||
|
|
||||||
"float rgb2grey(vec3 v){
|
"varying highp vec2 qt_TexCoord0;
|
||||||
return dot(v, vec3(0.21, 0.72, 0.04));
|
|
||||||
}" +
|
|
||||||
|
|
||||||
"void main() {" +
|
uniform lowp sampler2D blurredSource;
|
||||||
"vec2 coords = qt_TexCoord0;" +
|
uniform highp float blurCoefficient;" +
|
||||||
(mScanlines != shadersettings.no_rasterization ? "
|
|
||||||
coords.y = floor(virtual_resolution.y * coords.y) / virtual_resolution.y;" +
|
|
||||||
(mScanlines == shadersettings.pixel_rasterization ? "
|
|
||||||
coords.x = floor(virtual_resolution.x * coords.x) / virtual_resolution.x;" : "")
|
|
||||||
: "") +
|
|
||||||
"coords = coords + delta;" +
|
|
||||||
|
|
||||||
"vec4 color = texture2D(source, coords) * 256.0;
|
"float rgb2grey(vec3 v){
|
||||||
color.a = rgb2grey(color.rgb);" +
|
return dot(v, vec3(0.21, 0.72, 0.04));
|
||||||
|
}" +
|
||||||
|
|
||||||
(mBlur !== 0 ?
|
"void main() {" +
|
||||||
"vec4 blur_color = texture2D(blurredSource, coords) * 256.0;" +
|
"vec2 coords = qt_TexCoord0;" +
|
||||||
"blur_color.a = blur_color.a - blur_color.a * blurCoefficient;" +
|
"vec3 color = texture2D(txt_source, coords).rgb * 256.0;" +
|
||||||
"color = step(1.0, color.a) * color + step(color.a, 1.0) * blur_color;"
|
|
||||||
: "") +
|
|
||||||
|
|
||||||
|
"vec3 blur_color = texture2D(blurredSource, coords).rgb * 256.0;" +
|
||||||
|
"blur_color = blur_color - blur_color * blurCoefficient;" +
|
||||||
|
"color = step(vec3(1.0), color) * color + step(color, vec3(1.0)) * blur_color;" +
|
||||||
|
|
||||||
"gl_FragColor = floor(color) / 256.0;" +
|
"gl_FragColor = vec4(floor(color) / 256.0, 1.0);" +
|
||||||
"}"
|
"}"
|
||||||
|
|
||||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||||
|
}
|
||||||
}
|
}
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// EFFECTS //////////////////////////////////////////////////////////////
|
// EFFECTS //////////////////////////////////////////////////////////////
|
||||||
@ -291,7 +288,6 @@ Item{
|
|||||||
sourceComponent: ShaderEffectSource{
|
sourceComponent: ShaderEffectSource{
|
||||||
sourceItem: bloomEffectLoader.item
|
sourceItem: bloomEffectLoader.item
|
||||||
hideSource: true
|
hideSource: true
|
||||||
sourceRect: frame.sourceRect
|
|
||||||
smooth: false
|
smooth: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,7 +297,8 @@ Item{
|
|||||||
ShaderEffect {
|
ShaderEffect {
|
||||||
id: staticNoiseEffect
|
id: staticNoiseEffect
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
property size virtual_resolution: terminalContainer.virtual_resolution
|
property real element_size: shadersettings.rasterization == shadersettings.no_rasterization ? 2 : 1
|
||||||
|
property size virtual_resolution: Qt.size(kterminal.width / element_size, kterminal.height / element_size)
|
||||||
|
|
||||||
blending: false
|
blending: false
|
||||||
|
|
||||||
@ -332,9 +329,9 @@ Item{
|
|||||||
return mix(s, n, inter.y);
|
return mix(s, n, inter.y);
|
||||||
}" +
|
}" +
|
||||||
|
|
||||||
"void main() {" +
|
"void main() {" +
|
||||||
"gl_FragColor.a = smoothNoise(qt_TexCoord0 * virtual_resolution);" +
|
"gl_FragColor.a = smoothNoise(qt_TexCoord0 * virtual_resolution);" +
|
||||||
"}"
|
"}"
|
||||||
|
|
||||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||||
}
|
}
|
||||||
@ -345,33 +342,37 @@ Item{
|
|||||||
wrapMode: ShaderEffectSource.Repeat
|
wrapMode: ShaderEffectSource.Repeat
|
||||||
smooth: true
|
smooth: true
|
||||||
hideSource: true
|
hideSource: true
|
||||||
//format: ShaderEffectSource.Alpha
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RASTERIZATION //////////////////////////////////////////////////////////
|
// RASTERIZATION //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ShaderEffect{
|
ShaderEffect {
|
||||||
id: rasterizationContainer
|
id: rasterizationEffect
|
||||||
width: frame.sourceRect.width
|
width: parent.width
|
||||||
height: frame.sourceRect.height
|
height: parent.height
|
||||||
property size offset: Qt.size(width - rasterizationEffect.width, height - rasterizationEffect.height)
|
property size virtual_resolution: Qt.size(kterminal.width, kterminal.height)
|
||||||
property size txtRes: Qt.size(width, height)
|
|
||||||
|
|
||||||
blending: false
|
blending: false
|
||||||
|
|
||||||
fragmentShader:
|
fragmentShader:
|
||||||
"uniform lowp float qt_Opacity;
|
"uniform lowp float qt_Opacity;" +
|
||||||
uniform highp vec2 offset;
|
|
||||||
uniform highp vec2 txtRes;" +
|
|
||||||
|
|
||||||
"varying highp vec2 qt_TexCoord0;" +
|
"varying highp vec2 qt_TexCoord0;
|
||||||
|
uniform highp vec2 virtual_resolution;
|
||||||
|
|
||||||
|
highp float getScanlineIntensity(vec2 coords) {
|
||||||
|
highp float result = 1.0;" +
|
||||||
|
|
||||||
|
(mScanlines != shadersettings.no_rasterization ?
|
||||||
|
"result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") +
|
||||||
|
(mScanlines == shadersettings.pixel_rasterization ?
|
||||||
|
"result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + "
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}" +
|
||||||
|
|
||||||
"void main() {" +
|
"void main() {" +
|
||||||
"float color = 1.0;
|
"highp float color = getScanlineIntensity(qt_TexCoord0);" +
|
||||||
color *= smoothstep(0.0, offset.x / txtRes.x, qt_TexCoord0.x);
|
|
||||||
color *= smoothstep(0.0, offset.y / txtRes.y, qt_TexCoord0.y);
|
|
||||||
color *= smoothstep(0.0, offset.x / txtRes.x, 1.0 - qt_TexCoord0.x);
|
|
||||||
color *= smoothstep(0.0, offset.y / txtRes.y, 1.0 - qt_TexCoord0.y);" +
|
|
||||||
|
|
||||||
"float distance = length(vec2(0.5) - qt_TexCoord0);" +
|
"float distance = length(vec2(0.5) - qt_TexCoord0);" +
|
||||||
"color = mix(color, 0.0, 1.2 * distance * distance);" +
|
"color = mix(color, 0.0, 1.2 * distance * distance);" +
|
||||||
@ -379,48 +380,13 @@ Item{
|
|||||||
"gl_FragColor.a = color;" +
|
"gl_FragColor.a = color;" +
|
||||||
"}"
|
"}"
|
||||||
|
|
||||||
ShaderEffect {
|
|
||||||
id: rasterizationEffect
|
|
||||||
width: terminalContainer.width
|
|
||||||
height: terminalContainer.height
|
|
||||||
anchors.centerIn: parent
|
|
||||||
property size virtual_resolution: terminalContainer.virtual_resolution
|
|
||||||
|
|
||||||
blending: false
|
|
||||||
|
|
||||||
fragmentShader:
|
|
||||||
"uniform lowp float qt_Opacity;" +
|
|
||||||
|
|
||||||
"varying highp vec2 qt_TexCoord0;
|
|
||||||
uniform highp vec2 virtual_resolution;
|
|
||||||
|
|
||||||
float getScanlineIntensity(vec2 coords) {
|
|
||||||
float result = 1.0;" +
|
|
||||||
(mScanlines != shadersettings.no_rasterization ?
|
|
||||||
"result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") +
|
|
||||||
(mScanlines == shadersettings.pixel_rasterization ?
|
|
||||||
"result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + "
|
|
||||||
return result;
|
|
||||||
}" +
|
|
||||||
|
|
||||||
"void main() {" +
|
|
||||||
"float color = getScanlineIntensity(qt_TexCoord0);" +
|
|
||||||
|
|
||||||
"float distance = length(vec2(0.5) - qt_TexCoord0);" +
|
|
||||||
"color = mix(color, 0.0, 1.2 * distance * distance);" +
|
|
||||||
|
|
||||||
"gl_FragColor.a = color;" +
|
|
||||||
"}"
|
|
||||||
|
|
||||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
|
||||||
}
|
|
||||||
onStatusChanged: if (log) console.log(log) //Print warning messages
|
onStatusChanged: if (log) console.log(log) //Print warning messages
|
||||||
}
|
}
|
||||||
ShaderEffectSource{
|
ShaderEffectSource{
|
||||||
id: rasterizationEffectSource
|
id: rasterizationEffectSource
|
||||||
sourceItem: rasterizationContainer
|
sourceItem: rasterizationEffect
|
||||||
hideSource: true
|
hideSource: true
|
||||||
smooth: true
|
smooth: true
|
||||||
//format: ShaderEffectSource.Alpha
|
wrapMode: ShaderEffectSource.Repeat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
import QtQuick 2.2
|
import QtQuick 2.2
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
|
|
||||||
|
|
||||||
ShaderEffect {
|
ShaderEffect {
|
||||||
property color font_color: shadersettings.font_color
|
property color font_color: shadersettings.font_color
|
||||||
property color background_color: shadersettings.background_color
|
property color background_color: shadersettings.background_color
|
||||||
@ -28,11 +29,8 @@ ShaderEffect {
|
|||||||
property variant bloomSource: terminal.bloomSource
|
property variant bloomSource: terminal.bloomSource
|
||||||
property variant rasterizationSource: terminal.rasterizationSource
|
property variant rasterizationSource: terminal.rasterizationSource
|
||||||
property variant noiseSource: terminal.staticNoiseSource
|
property variant noiseSource: terminal.staticNoiseSource
|
||||||
property size txt_Size: Qt.size(frame.sourceRect.width, frame.sourceRect.height)
|
|
||||||
property real bloom_strength: shadersettings.bloom_strength * 2.5
|
property real bloom_strength: shadersettings.bloom_strength * 2.5
|
||||||
|
|
||||||
property int rasterization: shadersettings.rasterization
|
|
||||||
|
|
||||||
property real jitter: shadersettings.jitter * 0.007
|
property real jitter: shadersettings.jitter * 0.007
|
||||||
|
|
||||||
property real noise_strength: shadersettings.noise_strength
|
property real noise_strength: shadersettings.noise_strength
|
||||||
@ -40,7 +38,6 @@ ShaderEffect {
|
|||||||
property real glowing_line_strength: shadersettings.glowing_line_strength
|
property real glowing_line_strength: shadersettings.glowing_line_strength
|
||||||
|
|
||||||
property real chroma_color: shadersettings.chroma_color;
|
property real chroma_color: shadersettings.chroma_color;
|
||||||
property real saturation_color: shadersettings.saturation_color;
|
|
||||||
|
|
||||||
property real rgb_shift: shadersettings.rgb_shift * 0.2
|
property real rgb_shift: shadersettings.rgb_shift * 0.2
|
||||||
|
|
||||||
@ -49,10 +46,10 @@ ShaderEffect {
|
|||||||
|
|
||||||
property bool frameReflections: shadersettings.frameReflections
|
property bool frameReflections: shadersettings.frameReflections
|
||||||
|
|
||||||
property real disp_top: frame.item.displacementTop * shadersettings.window_scaling
|
property real disp_top: frame.item.displacementTop / height
|
||||||
property real disp_bottom: frame.item.displacementBottom * shadersettings.window_scaling
|
property real disp_bottom: frame.item.displacementBottom / height
|
||||||
property real disp_left: frame.item.displacementLeft * shadersettings.window_scaling
|
property real disp_left: frame.item.displacementLeft / width
|
||||||
property real disp_right: frame.item.displacementRight * shadersettings.window_scaling
|
property real disp_right: frame.item.displacementRight / width
|
||||||
|
|
||||||
property real screen_brightness: shadersettings.brightness * 1.5 + 0.5
|
property real screen_brightness: shadersettings.brightness * 1.5 + 0.5
|
||||||
|
|
||||||
@ -88,7 +85,11 @@ ShaderEffect {
|
|||||||
uniform highp mat4 qt_Matrix;
|
uniform highp mat4 qt_Matrix;
|
||||||
uniform highp float time;
|
uniform highp float time;
|
||||||
uniform sampler2D randomFunctionSource;
|
uniform sampler2D randomFunctionSource;
|
||||||
uniform highp vec2 txt_Size;
|
|
||||||
|
uniform highp float disp_left;
|
||||||
|
uniform highp float disp_right;
|
||||||
|
uniform highp float disp_top;
|
||||||
|
uniform highp float disp_bottom;
|
||||||
|
|
||||||
attribute highp vec4 qt_Vertex;
|
attribute highp vec4 qt_Vertex;
|
||||||
attribute highp vec2 qt_MultiTexCoord0;
|
attribute highp vec2 qt_MultiTexCoord0;
|
||||||
@ -103,8 +104,8 @@ ShaderEffect {
|
|||||||
uniform lowp float horizontal_sincronization;" : "") +
|
uniform lowp float horizontal_sincronization;" : "") +
|
||||||
"
|
"
|
||||||
void main() {
|
void main() {
|
||||||
qt_TexCoord0.x = -"+str(disp_left)+"/txt_Size.x + qt_MultiTexCoord0.x / ((txt_Size.x -("+str(disp_left+disp_right)+")) / txt_Size.x);" + "
|
qt_TexCoord0.x = (qt_MultiTexCoord0.x - disp_left) / (1.0 - disp_left - disp_right);
|
||||||
qt_TexCoord0.y = -"+str(disp_top)+"/txt_Size.y + qt_MultiTexCoord0.y / ((txt_Size.y -("+str(disp_top+disp_bottom)+")) / txt_Size.y);" + "
|
qt_TexCoord0.y = (qt_MultiTexCoord0.y - disp_top) / (1.0 - disp_top - disp_bottom);
|
||||||
vec2 coords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));" +
|
vec2 coords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));" +
|
||||||
(brightness_flickering !== 0.0 ? "
|
(brightness_flickering !== 0.0 ? "
|
||||||
brightness = 1.0 + (texture2D(randomFunctionSource, coords).g - 0.5) * brightness_flickering;"
|
brightness = 1.0 + (texture2D(randomFunctionSource, coords).g - 0.5) * brightness_flickering;"
|
||||||
@ -123,7 +124,6 @@ ShaderEffect {
|
|||||||
uniform sampler2D source;
|
uniform sampler2D source;
|
||||||
uniform highp float qt_Opacity;
|
uniform highp float qt_Opacity;
|
||||||
uniform highp float time;
|
uniform highp float time;
|
||||||
uniform highp vec2 txt_Size;
|
|
||||||
varying highp vec2 qt_TexCoord0;
|
varying highp vec2 qt_TexCoord0;
|
||||||
|
|
||||||
uniform highp vec4 font_color;
|
uniform highp vec4 font_color;
|
||||||
@ -136,7 +136,7 @@ ShaderEffect {
|
|||||||
uniform lowp float bloom_strength;" : "") +
|
uniform lowp float bloom_strength;" : "") +
|
||||||
(noise_strength !== 0 ? "
|
(noise_strength !== 0 ? "
|
||||||
uniform highp float noise_strength;" : "") +
|
uniform highp float noise_strength;" : "") +
|
||||||
(noise_strength !== 0 || jitter !== 0 ? "
|
(noise_strength !== 0 || jitter !== 0 || rgb_shift ? "
|
||||||
uniform lowp sampler2D noiseSource;" : "") +
|
uniform lowp sampler2D noiseSource;" : "") +
|
||||||
(screen_distorsion !== 0 ? "
|
(screen_distorsion !== 0 ? "
|
||||||
uniform highp float screen_distorsion;" : "") +
|
uniform highp float screen_distorsion;" : "") +
|
||||||
@ -175,10 +175,6 @@ ShaderEffect {
|
|||||||
:"
|
:"
|
||||||
vec2 coords = qt_TexCoord0;") +
|
vec2 coords = qt_TexCoord0;") +
|
||||||
|
|
||||||
(frameReflections ? "
|
|
||||||
vec2 inside = step(0.0, coords) - step(1.0, coords);
|
|
||||||
coords = abs(mod(floor(coords), 2.0) - fract(coords)) * clamp(inside.x + inside.y, 0.0, 1.0);" : "") +
|
|
||||||
|
|
||||||
(horizontal_sincronization !== 0 ? "
|
(horizontal_sincronization !== 0 ? "
|
||||||
float h_distortion = 0.5 * sin(time*0.001 + coords.y*10.0*fract(time/10.0));
|
float h_distortion = 0.5 * sin(time*0.001 + coords.y*10.0*fract(time/10.0));
|
||||||
h_distortion += 0.5 * cos(time*0.04 + 0.03 + coords.y*50.0*fract(time/10.0 + 0.4));
|
h_distortion += 0.5 * cos(time*0.04 + 0.03 + coords.y*50.0*fract(time/10.0 + 0.4));
|
||||||
@ -202,36 +198,38 @@ ShaderEffect {
|
|||||||
(glowing_line_strength !== 0 ? "
|
(glowing_line_strength !== 0 ? "
|
||||||
color += randomPass(coords) * glowing_line_strength;" : "") +
|
color += randomPass(coords) * glowing_line_strength;" : "") +
|
||||||
|
|
||||||
|
|
||||||
|
"vec3 txt_color = texture2D(source, txt_coords).rgb;
|
||||||
|
float greyscale_color = rgb2grey(txt_color) + color;" +
|
||||||
|
|
||||||
(chroma_color !== 0 ?
|
(chroma_color !== 0 ?
|
||||||
(rgb_shift !== 0 ? "
|
(rgb_shift !== 0 ? "
|
||||||
float rgb_noise = abs(texture2D(noiseSource, vec2(fract(time/(1024.0 * 256.0)), fract(time/(1024.0*1024.0)))).a - 0.5);
|
float rgb_noise = abs(texture2D(noiseSource, vec2(fract(time/(1024.0 * 256.0)), fract(time/(1024.0*1024.0)))).a - 0.5);
|
||||||
vec4 realBackColor = texture2D(source, txt_coords);
|
float rcolor = texture2D(source, txt_coords + vec2(0.1, 0.0) * rgb_shift * rgb_noise).r;
|
||||||
vec2 rcolor = texture2D(source, txt_coords + vec2(0.1, 0.0) * rgb_shift * rgb_noise).ra;
|
float bcolor = texture2D(source, txt_coords - vec2(0.1, 0.0) * rgb_shift * rgb_noise).b;
|
||||||
vec2 bcolor = texture2D(source, txt_coords - vec2(0.1, 0.0) * rgb_shift * rgb_noise).ba;
|
txt_color.r = rcolor;
|
||||||
realBackColor.r = rcolor.x;
|
txt_color.b = bcolor;
|
||||||
realBackColor.b = bcolor.x;
|
greyscale_color = 0.33 * (rcolor + bcolor);" : "") +
|
||||||
realBackColor.a = 0.33 * (realBackColor.a + rcolor.y + bcolor.y);"
|
|
||||||
:
|
|
||||||
"vec4 realBackColor = texture2D(source, txt_coords);") +
|
|
||||||
|
|
||||||
"vec4 mixedColor = mix(font_color, realBackColor * font_color, chroma_color);" +
|
"vec3 mixedColor = mix(font_color.rgb, txt_color * font_color.rgb, chroma_color);
|
||||||
|
vec3 finalBackColor = mix(background_color.rgb, mixedColor, greyscale_color);
|
||||||
"vec4 finalBackColor = mix(background_color, mixedColor, realBackColor.a);" +
|
vec3 finalColor = mix(finalBackColor, font_color.rgb, color).rgb;"
|
||||||
"vec3 finalColor = mix(finalBackColor, font_color, color).rgb;"
|
|
||||||
:
|
:
|
||||||
"color += texture2D(source, txt_coords).a;" +
|
"vec3 finalColor = mix(background_color.rgb, font_color.rgb, greyscale_color);") +
|
||||||
"vec3 finalColor = mix(background_color, font_color, color).rgb;"
|
|
||||||
) +
|
|
||||||
|
|
||||||
"finalColor *= texture2D(rasterizationSource, coords).a;" +
|
"finalColor *= texture2D(rasterizationSource, coords).a;" +
|
||||||
|
|
||||||
(bloom_strength !== 0 ?
|
(bloom_strength !== 0 ?
|
||||||
"vec3 bloomColor = texture2D(bloomSource, coords).rgb;" +
|
"vec4 bloomFullColor = texture2D(bloomSource, coords);
|
||||||
|
vec3 bloomColor = bloomFullColor.rgb;
|
||||||
|
vec2 minBound = step(vec2(0.0), coords);
|
||||||
|
vec2 maxBound = step(coords, vec2(1.0));
|
||||||
|
float bloomAlpha = bloomFullColor.a * minBound.x * minBound.y * maxBound.x * maxBound.y;" +
|
||||||
(chroma_color !== 0 ?
|
(chroma_color !== 0 ?
|
||||||
"bloomColor = font_color.rgb * mix(vec3(rgb2grey(bloomColor)), bloomColor, chroma_color);"
|
"bloomColor = font_color.rgb * mix(vec3(rgb2grey(bloomColor)), bloomColor, chroma_color);"
|
||||||
:
|
:
|
||||||
"bloomColor = font_color.rgb * rgb2grey(bloomColor);") +
|
"bloomColor = font_color.rgb * rgb2grey(bloomColor);") +
|
||||||
"finalColor += bloomColor * bloom_strength;"
|
"finalColor += bloomColor * bloom_strength * bloomAlpha;"
|
||||||
: "") +
|
: "") +
|
||||||
|
|
||||||
(brightness_flickering !== 0 ? "
|
(brightness_flickering !== 0 ? "
|
||||||
|
@ -7,22 +7,19 @@ TerminalFrame{
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
addedWidth: 200
|
addedWidth: 200
|
||||||
addedHeight: 370
|
addedHeight: 370
|
||||||
borderLeft: 148
|
borderLeft: 170
|
||||||
borderRight: 148
|
borderRight: 170
|
||||||
borderTop: 232
|
borderTop: 250
|
||||||
borderBottom: 232
|
borderBottom: 250
|
||||||
imageSource: "../images/black-frame.png"
|
imageSource: "../images/black-frame.png"
|
||||||
normalsSource: "../images/black-frame-normals.png"
|
normalsSource: "../images/black-frame-normals.png"
|
||||||
|
|
||||||
rectX: 20
|
|
||||||
rectY: 20
|
|
||||||
|
|
||||||
distortionCoefficient: 1.9
|
distortionCoefficient: 1.9
|
||||||
|
|
||||||
displacementLeft: 70.0
|
displacementLeft: 80.0
|
||||||
displacementTop: 55.0
|
displacementTop: 65.0
|
||||||
displacementRight: 50.0
|
displacementRight: 80.0
|
||||||
displacementBottom: 38.0
|
displacementBottom: 65.0
|
||||||
|
|
||||||
shaderString: "FrameShader.qml"
|
shaderString: "FrameShader.qml"
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,6 @@ TerminalFrame{
|
|||||||
borderTop: 0
|
borderTop: 0
|
||||||
borderBottom: 0
|
borderBottom: 0
|
||||||
|
|
||||||
rectX: 15
|
|
||||||
rectY: 15
|
|
||||||
|
|
||||||
displacementLeft: 0
|
displacementLeft: 0
|
||||||
displacementTop: 0
|
displacementTop: 0
|
||||||
displacementRight: 0
|
displacementRight: 0
|
||||||
|
@ -14,15 +14,12 @@ TerminalFrame{
|
|||||||
imageSource: "../images/screen-frame.png"
|
imageSource: "../images/screen-frame.png"
|
||||||
normalsSource: "../images/screen-frame-normals.png"
|
normalsSource: "../images/screen-frame-normals.png"
|
||||||
|
|
||||||
rectX: 15
|
|
||||||
rectY: 15
|
|
||||||
|
|
||||||
distortionCoefficient: 1.5
|
distortionCoefficient: 1.5
|
||||||
|
|
||||||
displacementLeft: 45
|
displacementLeft: 55
|
||||||
displacementTop: 40
|
displacementTop: 50
|
||||||
displacementRight: 38.0
|
displacementRight: 55
|
||||||
displacementBottom: 28.0
|
displacementBottom: 50
|
||||||
|
|
||||||
shaderString: "FrameShader.qml"
|
shaderString: "FrameShader.qml"
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,6 @@ Item{
|
|||||||
property string normalsSource
|
property string normalsSource
|
||||||
property string shaderString
|
property string shaderString
|
||||||
|
|
||||||
//Value used to create the rect used to add the border to the texture
|
|
||||||
property real rectX
|
|
||||||
property real rectY
|
|
||||||
|
|
||||||
//Values used to displace the texture in the screen. Used to make reflections correct.
|
//Values used to displace the texture in the screen. Used to make reflections correct.
|
||||||
property real displacementLeft
|
property real displacementLeft
|
||||||
property real displacementTop
|
property real displacementTop
|
||||||
@ -27,11 +23,6 @@ Item{
|
|||||||
|
|
||||||
property real distortionCoefficient
|
property real distortionCoefficient
|
||||||
|
|
||||||
property rect sourceRect: Qt.rect(-rectX * shadersettings.window_scaling,
|
|
||||||
-rectY * shadersettings.window_scaling,
|
|
||||||
terminal.width + 2*rectX * shadersettings.window_scaling,
|
|
||||||
terminal.height + 2*rectY * shadersettings.window_scaling)
|
|
||||||
|
|
||||||
BorderImage{
|
BorderImage{
|
||||||
id: frameimage
|
id: frameimage
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
@ -83,7 +83,7 @@ ApplicationWindow{
|
|||||||
text: qsTr("Zoom In")
|
text: qsTr("Zoom In")
|
||||||
shortcut: "Ctrl++"
|
shortcut: "Ctrl++"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
var oldScaling = shadersettings.fontScalingIndexes[shadersettings.rasterization];
|
var oldScaling = shadersettings.fontScalingIndex;
|
||||||
var maxScalingIndex = shadersettings.fontScalingList.length - 1;
|
var maxScalingIndex = shadersettings.fontScalingList.length - 1;
|
||||||
shadersettings.setScalingIndex(Math.min(oldScaling + 1, maxScalingIndex));
|
shadersettings.setScalingIndex(Math.min(oldScaling + 1, maxScalingIndex));
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ ApplicationWindow{
|
|||||||
text: qsTr("Zoom Out")
|
text: qsTr("Zoom Out")
|
||||||
shortcut: "Ctrl+-"
|
shortcut: "Ctrl+-"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
var oldScaling = shadersettings.fontScalingIndexes[shadersettings.rasterization];
|
var oldScaling = shadersettings.fontScalingIndex;
|
||||||
shadersettings.setScalingIndex(Math.max(oldScaling - 1, 0));
|
shadersettings.setScalingIndex(Math.max(oldScaling - 1, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,23 +148,17 @@ ApplicationWindow{
|
|||||||
width: parent.width * shadersettings.window_scaling
|
width: parent.width * shadersettings.window_scaling
|
||||||
height: parent.height * shadersettings.window_scaling
|
height: parent.height * shadersettings.window_scaling
|
||||||
scale: 1.0 / shadersettings.window_scaling
|
scale: 1.0 / shadersettings.window_scaling
|
||||||
smooth: false
|
|
||||||
antialiasing: false
|
|
||||||
opacity: shadersettings.windowOpacity * 0.3 + 0.7
|
opacity: shadersettings.windowOpacity * 0.3 + 0.7
|
||||||
|
|
||||||
Loader{
|
Loader{
|
||||||
id: frame
|
id: frame
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
property rect sourceRect: item.sourceRect
|
|
||||||
|
|
||||||
z: 2.1
|
z: 2.1
|
||||||
source: shadersettings.frame_source
|
source: shadersettings.frame_source
|
||||||
}
|
}
|
||||||
PreprocessedTerminal{
|
PreprocessedTerminal{
|
||||||
id: terminal
|
id: terminal
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 30
|
|
||||||
}
|
}
|
||||||
ShaderTerminal{
|
ShaderTerminal{
|
||||||
id: shadercontainer
|
id: shadercontainer
|
||||||
|
@ -1996,7 +1996,7 @@ void KTerminalDisplay::calcGeometry()
|
|||||||
_contentHeight = height() - 2 * DEFAULT_TOP_MARGIN + /* mysterious */ 1;
|
_contentHeight = height() - 2 * DEFAULT_TOP_MARGIN + /* mysterious */ 1;
|
||||||
|
|
||||||
// ensure that display is always at least one column wide
|
// ensure that display is always at least one column wide
|
||||||
_columns = qMax(1, qRound(_contentWidth / _fontWidth));
|
_columns = qMax(1, qFloor(_contentWidth / _fontWidth));
|
||||||
_usedColumns = qMin(_usedColumns,_columns);
|
_usedColumns = qMin(_usedColumns,_columns);
|
||||||
|
|
||||||
// ensure that display is always at least one line high
|
// ensure that display is always at least one line high
|
||||||
@ -2265,7 +2265,7 @@ void KTerminalDisplay::drawCursor(QPainter* painter,
|
|||||||
bool& invertCharacterColor)
|
bool& invertCharacterColor)
|
||||||
{
|
{
|
||||||
QRectF cursorRect = rect;
|
QRectF cursorRect = rect;
|
||||||
cursorRect.setHeight(_fontHeight - _lineSpacing - 1);
|
cursorRect.setHeight(_fontHeight - _lineSpacing);
|
||||||
|
|
||||||
if (!_cursorBlinking)
|
if (!_cursorBlinking)
|
||||||
{
|
{
|
||||||
@ -2280,8 +2280,8 @@ void KTerminalDisplay::drawCursor(QPainter* painter,
|
|||||||
// it is draw entirely inside 'rect'
|
// it is draw entirely inside 'rect'
|
||||||
int penWidth = qMax(1,painter->pen().width());
|
int penWidth = qMax(1,painter->pen().width());
|
||||||
|
|
||||||
painter->drawRect(cursorRect.adjusted( penWidth/2,
|
painter->drawRect(cursorRect.adjusted( penWidth/2 + penWidth%2,
|
||||||
penWidth/2,
|
penWidth/2 + penWidth%2,
|
||||||
- penWidth/2 - penWidth%2,
|
- penWidth/2 - penWidth%2,
|
||||||
- penWidth/2 - penWidth%2));
|
- penWidth/2 - penWidth%2));
|
||||||
if ( hasFocus() )
|
if ( hasFocus() )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user