1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-01-18 12:15:27 +00:00

Make the burn-in look more like the real thing.

Exponential decay instead of linear.
This commit is contained in:
Jeremy Phelps 2024-06-14 04:26:52 -04:00
parent f157648d1e
commit 27ca6b3f73
3 changed files with 7 additions and 8 deletions

View File

@ -32,7 +32,7 @@ QtObject {
readonly property real maximumFontScaling: 2.50
readonly property real minBurnInFadeTime: 160
readonly property real maxBurnInFadeTime: 1600
readonly property real maxBurnInFadeTime: 160000
property bool isMacOS: Qt.platform.os === "osx"

View File

@ -29,8 +29,8 @@ Loader {
property real lastUpdate: 0
property real prevLastUpdate: 0
property real burnIn: appSettings.burnIn
property real burnInFadeTime: 1 / Utils.lint(_minBurnInFadeTime, _maxBurnInFadeTime, burnIn)
property real burnIn: appSettings.burnIn;
property real burnInFadeTime: (1 / Utils.lint(_minBurnInFadeTime, _maxBurnInFadeTime, burnIn))*64
property real _minBurnInFadeTime: appSettings.minBurnInFadeTime
property real _maxBurnInFadeTime: appSettings.maxBurnInFadeTime
@ -146,9 +146,8 @@ Loader {
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);
highp float blurDecay = clamp(pow(0.5, burnInTime * (lastUpdate - prevLastUpdate)), 0.0, 1.0);
vec3 blurColor = accColor.rgb * vec3(blurDecay);
vec3 color = max(blurColor, txtColor);
gl_FragColor = vec4(color, currMask);

View File

@ -302,8 +302,8 @@ Item {
(burnIn !== 0 ? "
vec4 txt_blur = texture2D(burnInSource, staticCoords);
float blurDecay = clamp((time - burnInLastUpdate) * burnInTime, 0.0, 1.0);
vec3 burnInColor = 0.65 * (txt_blur.rgb - vec3(blurDecay));
float blurDecay = clamp(pow(0.5, burnInTime * (time - burnInLastUpdate)), 0.0, 1.0);
vec3 burnInColor = txt_blur.rgb * vec3(blurDecay);
txt_color = max(txt_color, convertWithChroma(burnInColor));"
: "") +