mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-10-31 07:04:20 +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.bottomMargin: frame.displacementBottom * appSettings.windowScaling | ||||
|  | ||||
|     //The blur effect has to take into account the framerate | ||||
|     property real mBlur: Math.sqrt(appSettings.burnIn) | ||||
|     property real motionBlurCoefficient: Utils.lint(_minBlurCoefficient, _maxBlurCoefficient, mBlur) | ||||
|     property real _minBlurCoefficient: 0.2 | ||||
|     property real _maxBlurCoefficient: 0.02 | ||||
|     //Parameters for the burnIn effect. | ||||
|     property real burnIn: appSettings.burnIn | ||||
|     property real fps: appSettings.fps !== 0 ? appSettings.fps : 60 | ||||
|     property real burnInFadeTime: Utils.lint(_minBurnInFadeTime, _maxBurnInFadeTime, burnIn) | ||||
|     property real motionBlurCoefficient: 1.0 / (fps * burnInFadeTime) | ||||
|     property real _minBurnInFadeTime: 0.16 | ||||
|     property real _maxBurnInFadeTime: 1.6 | ||||
|  | ||||
|     property size terminalSize: kterminal.terminalSize | ||||
|     property size fontMetrics: kterminal.fontMetrics | ||||
| @@ -228,13 +230,15 @@ Item{ | ||||
|     Loader{ | ||||
|         id: blurredSourceLoader | ||||
|         asynchronous: true | ||||
|         active: mBlur !== 0 | ||||
|         active: burnIn !== 0 | ||||
|  | ||||
|         sourceComponent: ShaderEffectSource{ | ||||
|             property bool updateBurnIn: false | ||||
|  | ||||
|             id: _blurredSourceEffect | ||||
|             sourceItem: blurredTerminalLoader.item | ||||
|             recursive: true | ||||
|             live: true | ||||
|             live: false | ||||
|             hideSource: true | ||||
|             wrapMode: kterminalSource.wrapMode | ||||
|  | ||||
| @@ -244,6 +248,13 @@ Item{ | ||||
|                 livetimer.restart(); | ||||
|             } | ||||
|  | ||||
|             // This updates the burnin synched with the timer. | ||||
|             Connections { | ||||
|                 target: updateBurnIn ? mainShader : null | ||||
|                 ignoreUnknownSignals: false | ||||
|                 onTimeChanged: _blurredSourceEffect.scheduleUpdate(); | ||||
|             } | ||||
|  | ||||
|             Timer{ | ||||
|                 id: livetimer | ||||
|  | ||||
| @@ -251,14 +262,15 @@ Item{ | ||||
|                 // 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. | ||||
|  | ||||
|                 interval: (1 / motionBlurCoefficient) * 60 * 1.1 | ||||
|                 interval: burnInFadeTime * 1000 * 1.1 | ||||
|                 running: true | ||||
|                 onTriggered: _blurredSourceEffect.live = false; | ||||
|                 onTriggered: _blurredSourceEffect.updateBurnIn = false; | ||||
|             } | ||||
|             Connections{ | ||||
|                 target: kterminal | ||||
|                 onImagePainted:{ | ||||
|                     _blurredSourceEffect.live = true; | ||||
|                     _blurredSourceEffect.scheduleUpdate(); | ||||
|                     _blurredSourceEffect.updateBurnIn = true; | ||||
|                     livetimer.restart(); | ||||
|                 } | ||||
|             } | ||||
| @@ -289,7 +301,7 @@ Item{ | ||||
|                     ? kterminal.height * Math.max(1, burnInScaling) | ||||
|                     : kterminal.height * scaleTexture * appSettings.burnInQuality | ||||
|  | ||||
|         active: mBlur !== 0 | ||||
|         active: burnIn !== 0 | ||||
|         asynchronous: true | ||||
|  | ||||
|         sourceComponent: ShaderEffect { | ||||
|   | ||||
| @@ -26,8 +26,6 @@ ShaderEffect { | ||||
|     property ShaderEffectSource blurredSource | ||||
|     property ShaderEffectSource bloomSource | ||||
|  | ||||
|     property real liveBlur: blurredSource && blurredSource.live ? 1.0 : 0.0 | ||||
|  | ||||
|     property color fontColor: appSettings.fontColor | ||||
|     property color backgroundColor: appSettings.backgroundColor | ||||
|     property real bloom: appSettings.bloom * 2.5 | ||||
| @@ -162,8 +160,7 @@ ShaderEffect { | ||||
|             uniform highp sampler2D bloomSource; | ||||
|             uniform lowp float bloom;" : "") + | ||||
|         (burnIn !== 0 ? " | ||||
|             uniform sampler2D blurredSource; | ||||
|             uniform lowp float liveBlur;" : "") + | ||||
|             uniform sampler2D blurredSource;" : "") + | ||||
|         (staticNoise !== 0 ? " | ||||
|             uniform highp float staticNoise;" : "") + | ||||
|         (((staticNoise !== 0 || jitter !== 0 || rbgShift) | ||||
| @@ -269,7 +266,7 @@ ShaderEffect { | ||||
|             "vec3 txt_color = texture2D(source, txt_coords).rgb;" + | ||||
|  | ||||
|             (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;" | ||||
|             : "") + | ||||
|  | ||||
|   | ||||
 Submodule qmltermwidget updated: 4b3fd2729b...dbf93d175c
									
								
							
		Reference in New Issue
	
	Block a user