mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2026-02-08 00:32:27 +00:00
Fix many smaller issues.
This commit is contained in:
@@ -49,9 +49,10 @@ OTHER_FILES += $$SHADERS $$QSB_FILES
|
||||
DYNAMIC_SHADER = $$SHADERS_DIR/terminal_dynamic.frag
|
||||
STATIC_SHADER = $$SHADERS_DIR/terminal_static.frag
|
||||
|
||||
RASTER_MODES = 0 1 2 3
|
||||
RASTER_MODES = 0 1 2 3 4
|
||||
BINARY_FLAGS = 0 1
|
||||
VARIANT_SHADER_DIR = $$relative_path($$PWD/shaders, $$OUT_PWD)
|
||||
VARIANT_OUTPUTS =
|
||||
|
||||
for(raster_mode, RASTER_MODES) {
|
||||
for(burn_in, BINARY_FLAGS) {
|
||||
@@ -64,6 +65,7 @@ for(raster_mode, RASTER_MODES) {
|
||||
$${dynamic_target}.depends = $$DYNAMIC_SHADER
|
||||
$${dynamic_target}.commands = $$QSB_BIN --glsl \"100 es,120,150\" --hlsl 50 --msl 12 --qt6 -DCRT_RASTER_MODE=$${raster_mode} -DCRT_BURN_IN=$${burn_in} -DCRT_DISPLAY_FRAME=$${display_frame} -DCRT_CHROMA=$${chroma_on} -o $${dynamic_output} $$DYNAMIC_SHADER
|
||||
QMAKE_EXTRA_TARGETS += $${dynamic_target}
|
||||
VARIANT_OUTPUTS += $${dynamic_output}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,10 +82,12 @@ for(rgb_shift, BINARY_FLAGS) {
|
||||
$${static_target}.depends = $$STATIC_SHADER
|
||||
$${static_target}.commands = $$QSB_BIN --glsl \"100 es,120,150\" --hlsl 50 --msl 12 --qt6 -DCRT_RGB_SHIFT=$${rgb_shift} -DCRT_BLOOM=$${bloom_on} -DCRT_CURVATURE=$${curve_on} -DCRT_FRAME_SHININESS=$${shine_on} -o $${static_output} $$STATIC_SHADER
|
||||
QMAKE_EXTRA_TARGETS += $${static_target}
|
||||
VARIANT_OUTPUTS += $${static_output}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PRE_TARGETDEPS += $${VARIANT_OUTPUTS}
|
||||
|
||||
#########################################
|
||||
## INTALLS
|
||||
|
||||
@@ -126,8 +126,6 @@ int main(int argc, char *argv[])
|
||||
engine.rootContext()->setContextProperty("monospaceFontManager", &monospaceFontManager);
|
||||
engine.rootContext()->setContextProperty("monospaceSystemFonts", monospaceFontManager.retrieveMonospaceFonts());
|
||||
|
||||
engine.rootContext()->setContextProperty("devicePixelRatio", app.devicePixelRatio());
|
||||
|
||||
// Manage import paths for Linux and OSX.
|
||||
QStringList importPathList = engine.importPathList();
|
||||
importPathList.prepend(QCoreApplication::applicationDirPath() + "/qmltermwidget");
|
||||
|
||||
@@ -105,7 +105,7 @@ QtObject {
|
||||
property real screenRadius: Utils.lint(4.0, 40.0, _screenRadius)
|
||||
|
||||
property real _margin: 0.5
|
||||
property real margin: Utils.lint(1.0, 40.0, _margin) + 0.5 * screenRadius
|
||||
property real margin: Utils.lint(1.0, 40.0, _margin) + 0.25 * screenRadius
|
||||
|
||||
readonly property int no_rasterization: 0
|
||||
readonly property int scanline_rasterization: 1
|
||||
@@ -178,9 +178,10 @@ QtObject {
|
||||
var fontWidth = fontManager.item.defaultFontWidth * appSettings.fontWidth
|
||||
var fontFamily = fontManager.item.family
|
||||
var isSystemFont = fontManager.item.isSystemFont
|
||||
var lowResolutionFont = fontManager.item.lowResolutionFont;
|
||||
var fallbackFontFamily = ""
|
||||
|
||||
lowResolutionFont = fontManager.item.lowResolutionFont
|
||||
appSettings.lowResolutionFont = fontManager.item.lowResolutionFont
|
||||
|
||||
if (!isSystemFont) {
|
||||
fontLoader.source = fontSourcePath
|
||||
@@ -197,14 +198,14 @@ QtObject {
|
||||
}
|
||||
}
|
||||
|
||||
terminalFontChanged(fontFamily, pixelSize, lineSpacing, screenScaling, fontWidth, fallbackFontFamily)
|
||||
terminalFontChanged(fontFamily, pixelSize, lineSpacing, screenScaling, fontWidth, fallbackFontFamily, lowResolutionFont)
|
||||
}
|
||||
|
||||
onFontSourceChanged: updateFont()
|
||||
onRasterizationChanged: updateFont()
|
||||
onFontNameChanged: updateFont()
|
||||
|
||||
signal terminalFontChanged(string fontFamily, int pixelSize, int lineSpacing, real screenScaling, real fontWidth, string fallbackFontFamily)
|
||||
signal terminalFontChanged(string fontFamily, int pixelSize, int lineSpacing, real screenScaling, real fontWidth, string fallbackFontFamily, bool lowResolutionFont)
|
||||
|
||||
signal initializedSettings
|
||||
|
||||
|
||||
@@ -54,8 +54,6 @@ QtObject {
|
||||
|
||||
property bool isSystemFont: fontlist.get(selectedFontIndex).isSystemFont
|
||||
|
||||
property string family: fontlist.get(selectedFontIndex).family
|
||||
|
||||
// There are two kind of fonts: low resolution and high resolution.
|
||||
// Low resolution font sets the lowResolutionFont property to true.
|
||||
// They are rendered at a fixed pixel size and the texture is upscaled
|
||||
|
||||
@@ -98,7 +98,7 @@ Item{
|
||||
QMLTermWidget {
|
||||
id: kterminal
|
||||
|
||||
property int textureResolutionScale: appSettings.lowResolutionFont ? devicePixelRatio : 1
|
||||
property int textureResolutionScale: appSettings.lowResolutionFont ? Screen.devicePixelRatio : 1
|
||||
property int margin: appSettings.margin / screenScaling
|
||||
property int totalWidth: Math.floor(parent.width / (screenScaling * fontWidth))
|
||||
property int totalHeight: Math.floor(parent.height / screenScaling)
|
||||
@@ -108,8 +108,8 @@ Item{
|
||||
|
||||
textureSize: Qt.size(width / textureResolutionScale, height / textureResolutionScale)
|
||||
|
||||
width: ensureMultiple(rawWidth, devicePixelRatio)
|
||||
height: ensureMultiple(rawHeight, devicePixelRatio)
|
||||
width: ensureMultiple(rawWidth, Screen.devicePixelRatio)
|
||||
height: ensureMultiple(rawHeight, Screen.devicePixelRatio)
|
||||
|
||||
/** Ensure size is a multiple of factor. This is needed for pixel perfect scaling on highdpi screens. */
|
||||
function ensureMultiple(size, factor) {
|
||||
@@ -118,8 +118,9 @@ Item{
|
||||
|
||||
colorScheme: "cool-retro-term"
|
||||
|
||||
antialiasText: !appSettings.lowResolutionFont
|
||||
smooth: !appSettings.lowResolutionFont
|
||||
enableBold: false
|
||||
enableBold: !appSettings.lowResolutionFont
|
||||
fullCursorHeight: true
|
||||
blinkingCursor: appSettings.blinkingCursor
|
||||
|
||||
@@ -146,8 +147,7 @@ Item{
|
||||
}
|
||||
}
|
||||
|
||||
function handleFontChanged(fontFamily, pixelSize, lineSpacing, screenScaling, fontWidth, fallbackFontFamily) {
|
||||
kterminal.antialiasText = !appSettings.lowResolutionFont;
|
||||
function handleFontChanged(fontFamily, pixelSize, lineSpacing, screenScaling, fontWidth, fallbackFontFamily, lowResolutionFont) {
|
||||
var updatedFont = Qt.font({
|
||||
family: fontFamily,
|
||||
pixelSize: pixelSize
|
||||
@@ -213,7 +213,7 @@ Item{
|
||||
|
||||
MouseArea {
|
||||
property real margin: appSettings.margin
|
||||
property real frameSize: appSettings.frameSize
|
||||
property real frameSize: appSettings.frameSize * terminalWindow.normalizedWindowScale
|
||||
|
||||
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
|
||||
anchors.fill: parent
|
||||
@@ -256,7 +256,9 @@ Item{
|
||||
y = y * (1 + frameSize * 2) - frameSize;
|
||||
|
||||
var cc = Qt.size(0.5 - x, 0.5 - y);
|
||||
var distortion = (cc.height * cc.height + cc.width * cc.width) * appSettings.screenCurvature * appSettings.screenCurvatureSize;
|
||||
var distortion = (cc.height * cc.height + cc.width * cc.width)
|
||||
* appSettings.screenCurvature * appSettings.screenCurvatureSize
|
||||
* terminalWindow.normalizedWindowScale;
|
||||
|
||||
return Qt.point((x - cc.width * (1+distortion) * distortion) * (kterminal.totalWidth),
|
||||
(y - cc.height * (1+distortion) * distortion) * (kterminal.totalHeight))
|
||||
|
||||
@@ -79,7 +79,7 @@ ColumnLayout {
|
||||
model: appSettings.filteredFontList
|
||||
textRole: "text"
|
||||
onActivated: {
|
||||
var font = appSettings.filteredFontList.get(index)
|
||||
var font = appSettings.filteredFontList.get(currentIndex)
|
||||
|
||||
// If selecting a high-res font while not in Modern mode,
|
||||
// switch to Modern to render at full resolution.
|
||||
|
||||
@@ -54,7 +54,8 @@ Item {
|
||||
property color fontColor: appSettings.fontColor
|
||||
property color backgroundColor: appSettings.backgroundColor
|
||||
|
||||
property real screenCurvature: appSettings.screenCurvature * appSettings.screenCurvatureSize
|
||||
property real screenCurvature: appSettings.screenCurvature * appSettings.screenCurvatureSize * terminalWindow.normalizedWindowScale
|
||||
property real frameSize: appSettings.frameSize * terminalWindow.normalizedWindowScale
|
||||
|
||||
property real chromaColor: appSettings.chromaColor
|
||||
|
||||
@@ -108,7 +109,7 @@ Item {
|
||||
property real time: timeManager ? timeManager.time : 0
|
||||
property ShaderEffectSource noiseSource: noiseShaderSource
|
||||
|
||||
property real frameSize: appSettings.frameSize
|
||||
property real frameSize: parent.frameSize
|
||||
property real frameShininess: appSettings.frameShininess
|
||||
property real bloom: parent.bloomSource ? appSettings.bloom * 2.5 : 0
|
||||
|
||||
@@ -181,7 +182,7 @@ Item {
|
||||
|
||||
property real screen_brightness: Utils.lint(0.5, 1.5, appSettings.brightness)
|
||||
property real frameShininess: appSettings.frameShininess
|
||||
property real frameSize: appSettings.frameSize
|
||||
property real frameSize: parent.frameSize
|
||||
|
||||
blending: false
|
||||
visible: false
|
||||
|
||||
@@ -27,7 +27,6 @@ ShaderTerminal {
|
||||
property alias terminalSize: terminal.terminalSize
|
||||
signal sessionFinished()
|
||||
|
||||
property real devicePixelRatio: terminalWindow.screen.devicePixelRatio
|
||||
property bool loadBloomEffect: appSettings.bloom > 0 || appSettings._frameShininess > 0
|
||||
|
||||
id: mainShader
|
||||
@@ -37,8 +36,8 @@ ShaderTerminal {
|
||||
burnInEffect: terminal.burnInEffect
|
||||
virtualResolution: terminal.virtualResolution
|
||||
screenResolution: Qt.size(
|
||||
terminalWindow.width * devicePixelRatio * appSettings.windowScaling,
|
||||
terminalWindow.height * devicePixelRatio * appSettings.windowScaling
|
||||
terminalWindow.width * Screen.devicePixelRatio * appSettings.windowScaling,
|
||||
terminalWindow.height * Screen.devicePixelRatio * appSettings.windowScaling
|
||||
)
|
||||
bloomSource: bloomSourceLoader.item
|
||||
|
||||
|
||||
@@ -33,15 +33,15 @@ ShaderEffect {
|
||||
0.125 + 0.750 * ambientLight
|
||||
)
|
||||
|
||||
property real screenCurvature: appSettings.screenCurvature * appSettings.screenCurvatureSize
|
||||
property real screenCurvature: appSettings.screenCurvature * appSettings.screenCurvatureSize * terminalWindow.normalizedWindowScale
|
||||
|
||||
property real frameShininess: appSettings.frameShininess
|
||||
|
||||
property real frameSize: appSettings.frameSize
|
||||
property real frameSize: appSettings.frameSize * terminalWindow.normalizedWindowScale
|
||||
|
||||
property real screenRadius: appSettings.screenRadius
|
||||
|
||||
property size viewportSize: Qt.size(width, height)
|
||||
property size viewportSize: Qt.size(width / appSettings.windowScaling, height / appSettings.windowScaling)
|
||||
|
||||
property real ambientLight: appSettings.ambientLight
|
||||
|
||||
|
||||
@@ -106,7 +106,6 @@ Item {
|
||||
model: tabsModel
|
||||
TerminalContainer {
|
||||
property bool isCurrentItem: StackLayout.isCurrentItem
|
||||
|
||||
onIsCurrentItemChanged: {
|
||||
if (isCurrentItem) {
|
||||
activate()
|
||||
|
||||
@@ -68,6 +68,7 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
property string wintitle: appSettings.wintitle
|
||||
property real normalizedWindowScale: 1024 / ((0.5 * width + 0.5 * height))
|
||||
|
||||
color: "#00000000"
|
||||
|
||||
|
||||
@@ -81,6 +81,14 @@
|
||||
<file>../shaders/terminal_dynamic_raster3_burn1_frame0_chroma1.frag.qsb</file>
|
||||
<file>../shaders/terminal_dynamic_raster3_burn1_frame1_chroma0.frag.qsb</file>
|
||||
<file>../shaders/terminal_dynamic_raster3_burn1_frame1_chroma1.frag.qsb</file>
|
||||
<file>../shaders/terminal_dynamic_raster4_burn0_frame0_chroma0.frag.qsb</file>
|
||||
<file>../shaders/terminal_dynamic_raster4_burn0_frame0_chroma1.frag.qsb</file>
|
||||
<file>../shaders/terminal_dynamic_raster4_burn0_frame1_chroma0.frag.qsb</file>
|
||||
<file>../shaders/terminal_dynamic_raster4_burn0_frame1_chroma1.frag.qsb</file>
|
||||
<file>../shaders/terminal_dynamic_raster4_burn1_frame0_chroma0.frag.qsb</file>
|
||||
<file>../shaders/terminal_dynamic_raster4_burn1_frame0_chroma1.frag.qsb</file>
|
||||
<file>../shaders/terminal_dynamic_raster4_burn1_frame1_chroma0.frag.qsb</file>
|
||||
<file>../shaders/terminal_dynamic_raster4_burn1_frame1_chroma1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_bloom0_curve0_shine0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_bloom0_curve0_shine1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_bloom0_curve1_shine0.frag.qsb</file>
|
||||
|
||||
@@ -25,14 +25,12 @@ void main() {
|
||||
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);
|
||||
float blurValue = rgb2grey(accColor.rgb) - blurDecay;
|
||||
float txtValue = rgb2grey(txtColor);
|
||||
float colorValue = max(blurValue, txtValue);
|
||||
vec3 color = vec3(colorValue);
|
||||
vec3 color = max(accColor.rgb - vec3(blurDecay), txtColor);
|
||||
|
||||
float currMask = step(rgb2grey(color), rgb2grey(txtColor));
|
||||
|
||||
fragColor = vec4(color, currMask) * qt_Opacity;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -65,7 +65,7 @@ vec2 distortCoordinates(vec2 coords){
|
||||
}
|
||||
|
||||
vec3 applyRasterization(vec2 screenCoords, vec3 texel, vec2 virtualRes, float intensity) {
|
||||
#if CRT_RASTER_MODE == 0
|
||||
#if CRT_RASTER_MODE == 0 || CRT_RASTER_MODE == 4
|
||||
return texel;
|
||||
#else
|
||||
if (intensity <= 0.0) {
|
||||
@@ -162,7 +162,7 @@ void main() {
|
||||
#if CRT_BURN_IN == 1
|
||||
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));
|
||||
vec3 burnInColor = 0.65 * (txt_blur.rgb - vec3(blurDecay)) * (1.0 - txt_blur.a);
|
||||
txt_color = max(txt_color, burnInColor);
|
||||
#endif
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -12,6 +12,7 @@ layout(std140, binding = 0) uniform ubuf {
|
||||
float screenRadius;
|
||||
vec2 viewportSize;
|
||||
float ambientLight;
|
||||
float frameShininess;
|
||||
};
|
||||
|
||||
float min2(vec2 v) { return min(v.x, v.y); }
|
||||
@@ -65,8 +66,10 @@ void main() {
|
||||
float frameShadow = (e * 0.66 + w * 0.66 + n * 0.33 + s) * depth;
|
||||
frameShadow *= smoothstep(0.0, edgeSoftPixels * 10.0, distPixels);
|
||||
|
||||
float frameAlpha = 1.0 - frameShininess * 0.4;
|
||||
|
||||
float inScreen = smoothstep(0.0, edgeSoftPixels, -distPixels);
|
||||
float alpha = mix(mix(0.7, 0.9, ambientLight), mix(0.0, 0.2, ambientLight), inScreen);
|
||||
float alpha = mix(frameAlpha, mix(0.0, 0.2, ambientLight), inScreen);
|
||||
float glass = clamp(ambientLight * pow(prod2(coords * (1.0 - coords.yx)) * 50.0, 0.25) * inScreen, 0.0, 1.0);
|
||||
vec3 color = mix(frameColor.rgb * frameShadow, vec3(glass), inScreen);
|
||||
|
||||
|
||||
Binary file not shown.
@@ -12,6 +12,7 @@ layout(std140, binding = 0) uniform ubuf {
|
||||
float screenRadius;
|
||||
vec2 viewportSize;
|
||||
float ambientLight;
|
||||
float frameShininess;
|
||||
};
|
||||
|
||||
layout(location = 0) out vec2 qt_TexCoord0;
|
||||
|
||||
Binary file not shown.
@@ -84,7 +84,7 @@ void main() {
|
||||
#endif
|
||||
|
||||
#if CRT_FRAME_SHININESS == 1
|
||||
vec3 reflectionColor = mix(bloomColor, finalColor, frameShininess * 0.5);
|
||||
vec3 reflectionColor = mix(bloomColor * bloomAlpha * 2.0, finalColor, frameShininess * 0.5);
|
||||
finalColor = mix(finalColor, reflectionColor, isReflection);
|
||||
#endif
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user