mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-10-31 15:12:28 +00:00 
			
		
		
		
	Improved burnin. This is a very important optimizatoin for mesa linux machines.
This commit is contained in:
		| @@ -44,11 +44,13 @@ Item{ | |||||||
|     anchors.topMargin: frame.displacementTop * appSettings.windowScaling |     anchors.topMargin: frame.displacementTop * appSettings.windowScaling | ||||||
|     anchors.bottomMargin: frame.displacementBottom * appSettings.windowScaling |     anchors.bottomMargin: frame.displacementBottom * appSettings.windowScaling | ||||||
|  |  | ||||||
|     //The blur effect has to take into account the framerate |     //Parameters for the burnIn effect. | ||||||
|     property real mBlur: Math.sqrt(appSettings.burnIn) |     property real burnIn: appSettings.burnIn | ||||||
|     property real motionBlurCoefficient: Utils.lint(_minBlurCoefficient, _maxBlurCoefficient, mBlur) |     property real fps: appSettings.fps !== 0 ? appSettings.fps : 60 | ||||||
|     property real _minBlurCoefficient: 0.2 |     property real burnInFadeTime: Utils.lint(_minBurnInFadeTime, _maxBurnInFadeTime, burnIn) | ||||||
|     property real _maxBlurCoefficient: 0.02 |     property real motionBlurCoefficient: 1.0 / (fps * burnInFadeTime) | ||||||
|  |     property real _minBurnInFadeTime: 0.16 | ||||||
|  |     property real _maxBurnInFadeTime: 1.6 | ||||||
|  |  | ||||||
|     property size terminalSize: kterminal.terminalSize |     property size terminalSize: kterminal.terminalSize | ||||||
|     property size fontMetrics: kterminal.fontMetrics |     property size fontMetrics: kterminal.fontMetrics | ||||||
| @@ -228,13 +230,15 @@ Item{ | |||||||
|     Loader{ |     Loader{ | ||||||
|         id: blurredSourceLoader |         id: blurredSourceLoader | ||||||
|         asynchronous: true |         asynchronous: true | ||||||
|         active: mBlur !== 0 |         active: burnIn !== 0 | ||||||
|  |  | ||||||
|         sourceComponent: ShaderEffectSource{ |         sourceComponent: ShaderEffectSource{ | ||||||
|  |             property bool updateBurnIn: false | ||||||
|  |  | ||||||
|             id: _blurredSourceEffect |             id: _blurredSourceEffect | ||||||
|             sourceItem: blurredTerminalLoader.item |             sourceItem: blurredTerminalLoader.item | ||||||
|             recursive: true |             recursive: true | ||||||
|             live: true |             live: false | ||||||
|             hideSource: true |             hideSource: true | ||||||
|             wrapMode: kterminalSource.wrapMode |             wrapMode: kterminalSource.wrapMode | ||||||
|  |  | ||||||
| @@ -244,6 +248,13 @@ Item{ | |||||||
|                 livetimer.restart(); |                 livetimer.restart(); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  |             // This updates the burnin synched with the timer. | ||||||
|  |             Connections { | ||||||
|  |                 target: updateBurnIn ? mainShader : null | ||||||
|  |                 ignoreUnknownSignals: false | ||||||
|  |                 onTimeChanged: _blurredSourceEffect.scheduleUpdate(); | ||||||
|  |             } | ||||||
|  |  | ||||||
|             Timer{ |             Timer{ | ||||||
|                 id: livetimer |                 id: livetimer | ||||||
|  |  | ||||||
| @@ -251,14 +262,15 @@ Item{ | |||||||
|                 // We multiply 1.1 to have a little bit of margin over the theoretical value. |                 // We multiply 1.1 to have a little bit of margin over the theoretical value. | ||||||
|                 // This solution is not extremely clean, but it's probably the best to avoid measuring fps. |                 // This solution is not extremely clean, but it's probably the best to avoid measuring fps. | ||||||
|  |  | ||||||
|                 interval: (1 / motionBlurCoefficient) * 60 * 1.1 |                 interval: burnInFadeTime * 1000 * 1.1 | ||||||
|                 running: true |                 running: true | ||||||
|                 onTriggered: _blurredSourceEffect.live = false; |                 onTriggered: _blurredSourceEffect.updateBurnIn = false; | ||||||
|             } |             } | ||||||
|             Connections{ |             Connections{ | ||||||
|                 target: kterminal |                 target: kterminal | ||||||
|                 onImagePainted:{ |                 onImagePainted:{ | ||||||
|                     _blurredSourceEffect.live = true; |                     _blurredSourceEffect.scheduleUpdate(); | ||||||
|  |                     _blurredSourceEffect.updateBurnIn = true; | ||||||
|                     livetimer.restart(); |                     livetimer.restart(); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| @@ -289,7 +301,7 @@ Item{ | |||||||
|                     ? kterminal.height * Math.max(1, burnInScaling) |                     ? kterminal.height * Math.max(1, burnInScaling) | ||||||
|                     : kterminal.height * scaleTexture * appSettings.burnInQuality |                     : kterminal.height * scaleTexture * appSettings.burnInQuality | ||||||
|  |  | ||||||
|         active: mBlur !== 0 |         active: burnIn !== 0 | ||||||
|         asynchronous: true |         asynchronous: true | ||||||
|  |  | ||||||
|         sourceComponent: ShaderEffect { |         sourceComponent: ShaderEffect { | ||||||
|   | |||||||
| @@ -26,8 +26,6 @@ ShaderEffect { | |||||||
|     property ShaderEffectSource blurredSource |     property ShaderEffectSource blurredSource | ||||||
|     property ShaderEffectSource bloomSource |     property ShaderEffectSource bloomSource | ||||||
|  |  | ||||||
|     property real liveBlur: blurredSource && blurredSource.live ? 1.0 : 0.0 |  | ||||||
|  |  | ||||||
|     property color fontColor: appSettings.fontColor |     property color fontColor: appSettings.fontColor | ||||||
|     property color backgroundColor: appSettings.backgroundColor |     property color backgroundColor: appSettings.backgroundColor | ||||||
|     property real bloom: appSettings.bloom * 2.5 |     property real bloom: appSettings.bloom * 2.5 | ||||||
| @@ -162,8 +160,7 @@ ShaderEffect { | |||||||
|             uniform highp sampler2D bloomSource; |             uniform highp sampler2D bloomSource; | ||||||
|             uniform lowp float bloom;" : "") + |             uniform lowp float bloom;" : "") + | ||||||
|         (burnIn !== 0 ? " |         (burnIn !== 0 ? " | ||||||
|             uniform sampler2D blurredSource; |             uniform sampler2D blurredSource;" : "") + | ||||||
|             uniform lowp float liveBlur;" : "") + |  | ||||||
|         (staticNoise !== 0 ? " |         (staticNoise !== 0 ? " | ||||||
|             uniform highp float staticNoise;" : "") + |             uniform highp float staticNoise;" : "") + | ||||||
|         (((staticNoise !== 0 || jitter !== 0 || rbgShift) |         (((staticNoise !== 0 || jitter !== 0 || rbgShift) | ||||||
| @@ -269,7 +266,7 @@ ShaderEffect { | |||||||
|             "vec3 txt_color = texture2D(source, txt_coords).rgb;" + |             "vec3 txt_color = texture2D(source, txt_coords).rgb;" + | ||||||
|  |  | ||||||
|             (burnIn !== 0 ? " |             (burnIn !== 0 ? " | ||||||
|                 vec4 txt_blur = liveBlur * texture2D(blurredSource, txt_coords); |                 vec4 txt_blur = texture2D(blurredSource, txt_coords); | ||||||
|                 txt_color = txt_color + txt_blur.rgb * txt_blur.a;" |                 txt_color = txt_color + txt_blur.rgb * txt_blur.a;" | ||||||
|             : "") + |             : "") + | ||||||
|  |  | ||||||
|   | |||||||
 Submodule qmltermwidget updated: 4b3fd2729b...dbf93d175c
									
								
							
		Reference in New Issue
	
	Block a user