mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-10-31 23:22:17 +00:00 
			
		
		
		
	Merge pull request #187 from Swordfish90/refactoring
Optimised and configurable motion blur effect. Other various fixes.
This commit is contained in:
		| @@ -58,6 +58,7 @@ Item{ | ||||
|     property real bloom_strength: 0.65 | ||||
|  | ||||
|     property real bloom_quality: 0.5 | ||||
|     property real blur_quality: 0.5 | ||||
|  | ||||
|     property real chroma_color: 0.0 | ||||
|     property real saturation_color: 0.0 | ||||
| @@ -92,7 +93,7 @@ Item{ | ||||
|     property real fontScaling: 1.0 | ||||
|     property real fontWidth: 1.0 | ||||
|  | ||||
|     property var fontIndexes: [0,0,0] | ||||
|     property var fontNames: ["TERMINUS", "COMMODORE_PET", "COMMODORE_PET"] | ||||
|     property var fontlist: fontManager.item.fontlist | ||||
|  | ||||
|     signal terminalFontChanged(string fontSource, int pixelSize, int lineSpacing, real screenScaling, real fontWidth) | ||||
| @@ -115,6 +116,14 @@ Item{ | ||||
|     onFontScalingChanged: handleFontChanged(); | ||||
|     onFontWidthChanged: handleFontChanged(); | ||||
|  | ||||
|     function getIndexByName(name) { | ||||
|         for (var i = 0; i < fontlist.count; i++) { | ||||
|             if (name === fontlist.get(i).name) | ||||
|                 return i; | ||||
|         } | ||||
|         return undefined; | ||||
|     } | ||||
|  | ||||
|     function incrementScaling(){ | ||||
|         fontScaling = Math.min(fontScaling + 0.05, 2.50); | ||||
|         handleFontChanged(); | ||||
| @@ -126,8 +135,12 @@ Item{ | ||||
|     } | ||||
|  | ||||
|     function handleFontChanged(){ | ||||
|         if(!fontManager.item) return; | ||||
|         fontManager.item.selectedFontIndex = fontIndexes[rasterization]; | ||||
|         if (!fontManager.item) return; | ||||
|  | ||||
|         var index = getIndexByName(fontNames[rasterization]); | ||||
|         if (index === undefined) return; | ||||
|  | ||||
|         fontManager.item.selectedFontIndex = index; | ||||
|         fontManager.item.scaling = fontScaling * window_scaling; | ||||
|  | ||||
|         var fontSource = fontManager.item.source; | ||||
| @@ -165,10 +178,11 @@ Item{ | ||||
|             window_scaling: window_scaling, | ||||
|             show_terminal_size: show_terminal_size, | ||||
|             fontScaling: fontScaling, | ||||
|             fontIndexes: fontIndexes, | ||||
|             fontNames: fontNames, | ||||
|             frameReflections: _frameReflections, | ||||
|             showMenubar: showMenubar, | ||||
|             bloom_quality: bloom_quality | ||||
|             bloom_quality: bloom_quality, | ||||
|             blur_quality: blur_quality | ||||
|         } | ||||
|         return stringify(settings); | ||||
|     } | ||||
| @@ -194,7 +208,7 @@ Item{ | ||||
|             contrast: contrast, | ||||
|             ambient_light: ambient_light, | ||||
|             windowOpacity: windowOpacity, | ||||
|             fontIndex: fontIndexes[rasterization], | ||||
|             fontName: fontNames[rasterization], | ||||
|             fontWidth: fontWidth | ||||
|         } | ||||
|         return stringify(settings); | ||||
| @@ -235,7 +249,7 @@ Item{ | ||||
|         fps = settings.fps !== undefined ? settings.fps: fps | ||||
|         window_scaling = settings.window_scaling !== undefined ? settings.window_scaling : window_scaling | ||||
|  | ||||
|         fontIndexes = settings.fontIndexes !== undefined ? settings.fontIndexes : fontIndexes | ||||
|         fontNames = settings.fontNames !== undefined ? settings.fontNames : fontNames | ||||
|         fontScaling = settings.fontScaling !== undefined ? settings.fontScaling : fontScaling | ||||
|  | ||||
|         _frameReflections = settings.frameReflections !== undefined ? settings.frameReflections : _frameReflections; | ||||
| @@ -243,6 +257,7 @@ Item{ | ||||
|         showMenubar = settings.showMenubar !== undefined ? settings.showMenubar : showMenubar; | ||||
|  | ||||
|         bloom_quality = settings.bloom_quality !== undefined ? settings.bloom_quality : bloom_quality; | ||||
|         blur_quality = settings.blur_quality !== undefined ? settings.blur_quality : blur_quality; | ||||
|     } | ||||
|  | ||||
|     function loadProfileString(profileString){ | ||||
| @@ -275,7 +290,7 @@ Item{ | ||||
|         brightness = settings.brightness !== undefined ? settings.brightness : brightness; | ||||
|         windowOpacity = settings.windowOpacity !== undefined ? settings.windowOpacity : windowOpacity; | ||||
|  | ||||
|         fontIndexes[rasterization] = settings.fontIndex !== undefined ? settings.fontIndex : fontIndexes[rasterization]; | ||||
|         fontNames[rasterization] = settings.fontName !== undefined ? settings.fontName : fontNames[rasterization]; | ||||
|         fontWidth = settings.fontWidth !== undefined ? settings.fontWidth : fontWidth; | ||||
|     } | ||||
|  | ||||
| @@ -328,47 +343,47 @@ Item{ | ||||
|         id: profileslist | ||||
|         ListElement{ | ||||
|             text: "Default Amber" | ||||
|             obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.65,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.4,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}' | ||||
|             obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.65,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.4,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}' | ||||
|             builtin: true | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "Default Green" | ||||
|             obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.45,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}' | ||||
|             obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.45,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}' | ||||
|             builtin: true | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "Default Scanlines" | ||||
|             obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#00ff5b","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.07,"jitter":0.11,"motion_blur":0.4,"noise_strength":0.05,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}' | ||||
|             obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","font_color":"#00ff5b","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.07,"jitter":0.11,"motion_blur":0.4,"noise_strength":0.05,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}' | ||||
|             builtin: true | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "Default Pixelated" | ||||
|             obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.1,"jitter":0,"motion_blur":0.45,"noise_strength":0.14,"rasterization":2,"screen_distortion":0.05,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}' | ||||
|             obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontName":"TERMINUS","font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.1,"jitter":0,"motion_blur":0.45,"noise_strength":0.14,"rasterization":2,"screen_distortion":0.05,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}' | ||||
|             builtin: true | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "Apple ][" | ||||
|             obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.5,"brightness":0.5,"brightness_flickering":0.2,"contrast":0.85,"fontIndex":2,"font_color":"#2fff91","frames_index":1,"glowing_line_strength":0.22,"horizontal_sincronization":0.08,"jitter":0.1,"motion_blur":0.65,"noise_strength":0.08,"rasterization":1,"screen_distortion":0.18,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}' | ||||
|             obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.5,"brightness":0.5,"brightness_flickering":0.2,"contrast":0.85,"fontName":"APPLE_II","font_color":"#2fff91","frames_index":1,"glowing_line_strength":0.22,"horizontal_sincronization":0.08,"jitter":0.1,"motion_blur":0.65,"noise_strength":0.08,"rasterization":1,"screen_distortion":0.18,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}' | ||||
|             builtin: true | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "Vintage" | ||||
|             obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.54,"contrast":0.85,"fontIndex":0,"font_color":"#00ff3e","frames_index":2,"glowing_line_strength":0.3,"horizontal_sincronization":0.2,"jitter":0.4,"motion_blur":0.75,"noise_strength":0.2,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}' | ||||
|             obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.54,"contrast":0.85,"fontName":"TERMINUS","font_color":"#00ff3e","frames_index":2,"glowing_line_strength":0.3,"horizontal_sincronization":0.2,"jitter":0.4,"motion_blur":0.75,"noise_strength":0.2,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}' | ||||
|             builtin: true | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "IBM Dos" | ||||
|             obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.07,"contrast":0.85,"fontIndex":7,"font_color":"#ffffff","frames_index":1,"glowing_line_strength":0.13,"horizontal_sincronization":0,"jitter":0.08,"motion_blur":0.3,"noise_strength":0.03,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":1,"saturation_color":0,"rgb_shift":0.5,"fontWidth":1.0}' | ||||
|             obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.07,"contrast":0.85,"fontName":"IBM_DOS","font_color":"#ffffff","frames_index":1,"glowing_line_strength":0.13,"horizontal_sincronization":0,"jitter":0.08,"motion_blur":0.3,"noise_strength":0.03,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":1,"saturation_color":0,"rgb_shift":0.5,"fontWidth":1.0}' | ||||
|             builtin: true | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "IBM 3278" | ||||
|             obj_string: '{"ambient_light":0.1,"background_color":"#000000","bloom_strength":0.15,"brightness":0.5,"brightness_flickering":0,"contrast":0.95,"fontIndex":8,"font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0,"horizontal_sincronization":0,"jitter":0,"motion_blur":0.6,"noise_strength":0,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}' | ||||
|             obj_string: '{"ambient_light":0.1,"background_color":"#000000","bloom_strength":0.15,"brightness":0.5,"brightness_flickering":0,"contrast":0.95,"fontName":"IBM_3278","font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0,"horizontal_sincronization":0,"jitter":0,"motion_blur":0.6,"noise_strength":0,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}' | ||||
|             builtin: true | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "Transparent Green" | ||||
|             obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4549689440993788,"brightness":0.5,"brightness_flickering":0.20341614906832298,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":0,"glowing_line_strength":0.15993788819875776,"horizontal_sincronization":0.05045871559633028,"jitter":0.20341614906832298,"motion_blur":0.24999999999999997,"noise_strength":0.20031055900621117,"rasterization":0,"screen_distortion":0.05045871559633028,"windowOpacity":0.5956221198156681,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}' | ||||
|             obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.45,"brightness":0.5,"brightness_flickering":0.20,"contrast":0.85,"fontName":"TERMINUS","font_color":"#0ccc68","frames_index":0,"glowing_line_strength":0.16,"horizontal_sincronization":0.05,"jitter":0.20,"motion_blur":0.25,"noise_strength":0.20,"rasterization":0,"screen_distortion":0.05,"windowOpacity":0.60,"chroma_color":0,"saturation_color":0,"rgb_shift":0,"fontWidth":1.0}' | ||||
|             builtin: true | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -34,6 +34,7 @@ Item{ | ||||
|     ListModel{ | ||||
|         id: fontlist | ||||
|         ListElement{ | ||||
|             name: "COMMODORE_PET" | ||||
|             text: "Commodore PET (1977)" | ||||
|             source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf" | ||||
|             lineSpacing: 2 | ||||
| @@ -42,6 +43,7 @@ Item{ | ||||
|             fontWidth: 0.8 | ||||
|         } | ||||
|         ListElement{ | ||||
|             name: "APPLE_II" | ||||
|             text: "Apple ][ (1977)" | ||||
|             source: "fonts/1977-apple2/PrintChar21.ttf" | ||||
|             lineSpacing: 2 | ||||
| @@ -50,6 +52,7 @@ Item{ | ||||
|             fontWidth: 0.9 | ||||
|         } | ||||
|         ListElement{ | ||||
|             name: "ATARI_400" | ||||
|             text: "Atari 400-800 (1979)" | ||||
|             source: "fonts/1979-atari-400-800/ATARI400800_original.TTF" | ||||
|             lineSpacing: 3 | ||||
| @@ -58,6 +61,7 @@ Item{ | ||||
|             fontWidth: 0.8 | ||||
|         } | ||||
|         ListElement{ | ||||
|             name: "COMMODORE_64" | ||||
|             text: "Commodore 64 (1982)" | ||||
|             source: "fonts/1982-commodore64/C64_User_Mono_v1.0-STYLE.ttf" | ||||
|             lineSpacing: 3 | ||||
|   | ||||
| @@ -34,6 +34,7 @@ Item{ | ||||
|     ListModel{ | ||||
|         id: fontlist | ||||
|         ListElement{ | ||||
|             name: "COMMODORE_PET" | ||||
|             text: "Commodore PET (1977)" | ||||
|             source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf" | ||||
|             lineSpacing: 2 | ||||
| @@ -42,6 +43,7 @@ Item{ | ||||
|             fontWidth: 0.7 | ||||
|         } | ||||
|         ListElement{ | ||||
|             name: "APPLE_II" | ||||
|             text: "Apple ][ (1977)" | ||||
|             source: "fonts/1977-apple2/PrintChar21.ttf" | ||||
|             lineSpacing: 2 | ||||
| @@ -50,6 +52,7 @@ Item{ | ||||
|             fontWidth: 0.8 | ||||
|         } | ||||
|         ListElement{ | ||||
|             name: "ATARI_400" | ||||
|             text: "Atari 400-800 (1979)" | ||||
|             source: "fonts/1979-atari-400-800/ATARI400800_original.TTF" | ||||
|             lineSpacing: 3 | ||||
| @@ -58,6 +61,7 @@ Item{ | ||||
|             fontWidth: 0.7 | ||||
|         } | ||||
|         ListElement{ | ||||
|             name: "COMMODORE_64" | ||||
|             text: "Commodore 64 (1982)" | ||||
|             source: "fonts/1982-commodore64/C64_User_Mono_v1.0-STYLE.ttf" | ||||
|             lineSpacing: 3 | ||||
|   | ||||
| @@ -36,6 +36,7 @@ Item{ | ||||
|     ListModel{ | ||||
|         id: fontlist | ||||
|         ListElement{ | ||||
|             name: "TERMINUS" | ||||
|             text: "Terminus (Modern)" | ||||
|             source: "fonts/modern-terminus/TerminusTTF-Bold-4.38.2.ttf" | ||||
|             lineSpacing: 0.2 | ||||
| @@ -43,6 +44,7 @@ Item{ | ||||
|             fontWidth: 1.0 | ||||
|         } | ||||
|         ListElement{ | ||||
|             name: "COMMODORE_PET" | ||||
|             text: "Commodore PET (1977)" | ||||
|             source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf" | ||||
|             lineSpacing: 0.2 | ||||
| @@ -50,6 +52,7 @@ Item{ | ||||
|             fontWidth: 0.7 | ||||
|         } | ||||
|         ListElement{ | ||||
|             name: "APPLE_II" | ||||
|             text: "Apple ][ (1977)" | ||||
|             source: "fonts/1977-apple2/PrintChar21.ttf" | ||||
|             lineSpacing: 0.2 | ||||
| @@ -57,6 +60,7 @@ Item{ | ||||
|             fontWidth: 0.8 | ||||
|         } | ||||
|         ListElement{ | ||||
|             name: "ATARI_400" | ||||
|             text: "Atari 400-800 (1979)" | ||||
|             source: "fonts/1979-atari-400-800/ATARI400800_original.TTF" | ||||
|             lineSpacing: 0.3 | ||||
| @@ -64,6 +68,7 @@ Item{ | ||||
|             fontWidth: 0.7 | ||||
|         } | ||||
|         ListElement{ | ||||
|             name: "COMMODORE_64" | ||||
|             text: "Commodore 64 (1982)" | ||||
|             source: "fonts/1982-commodore64/C64_User_Mono_v1.0-STYLE.ttf" | ||||
|             lineSpacing: 0.3 | ||||
| @@ -71,6 +76,7 @@ Item{ | ||||
|             fontWidth: 0.7 | ||||
|         } | ||||
|         ListElement{ | ||||
|             name: "ATARI_ST" | ||||
|             text: "Atari ST (1985)" | ||||
|             source: "fonts/1985-atari-st/AtariST8x16SystemFont.ttf" | ||||
|             lineSpacing: 0.2 | ||||
| @@ -78,6 +84,7 @@ Item{ | ||||
|             fontWidth: 1.0 | ||||
|         } | ||||
|         ListElement{ | ||||
|             name: "IBM_DOS" | ||||
|             text: "IBM DOS (1985)" | ||||
|             source: "fonts/1985-ibm-pc-vga/Perfect DOS VGA 437.ttf" | ||||
|             lineSpacing: 0.2 | ||||
| @@ -85,6 +92,7 @@ Item{ | ||||
|             fontWidth: 1.0 | ||||
|         } | ||||
|         ListElement{ | ||||
|             name: "IBM_3278" | ||||
|             text: "IBM 3278 (1971)" | ||||
|             source: "fonts/1971-ibm-3278/3270Medium.ttf" | ||||
|             lineSpacing: 0.2 | ||||
|   | ||||
| @@ -28,7 +28,8 @@ Item{ | ||||
|  | ||||
|     property size virtualResolution: Qt.size(kterminal.width, kterminal.height) | ||||
|     property alias mainTerminal: kterminal | ||||
|     property ShaderEffectSource mainSource: mBlur !== 0 ? blurredSourceLoader.item : kterminalSource | ||||
|     property ShaderEffectSource mainSource: kterminalSource | ||||
|     property ShaderEffectSource blurredSource: blurredSourceLoader.item | ||||
|  | ||||
|     property real scaleTexture: 1.0 | ||||
|     property alias title: ksession.title | ||||
| @@ -41,8 +42,8 @@ Item{ | ||||
|  | ||||
|     //The blur effect has to take into account the framerate | ||||
|     property real mBlur: appSettings.motion_blur | ||||
|     property real motionBlurCoefficient: (_maxBlurCoefficient * mBlur + _minBlurCoefficient * (1 - mBlur)) | ||||
|     property real _minBlurCoefficient: 0.70 | ||||
|     property real motionBlurCoefficient: (_maxBlurCoefficient * Math.sqrt(mBlur) + _minBlurCoefficient * (1 - Math.sqrt(mBlur))) | ||||
|     property real _minBlurCoefficient: 0.50 | ||||
|     property real _maxBlurCoefficient: 0.90 | ||||
|  | ||||
|     property size terminalSize: kterminal.terminalSize | ||||
| @@ -241,8 +242,8 @@ Item{ | ||||
|     Loader{ | ||||
|         id: blurredTerminalLoader | ||||
|  | ||||
|         width: kterminalSource.textureSize.width | ||||
|         height: kterminalSource.textureSize.height | ||||
|         width: kterminal.width * scaleTexture * appSettings.blur_quality | ||||
|         height: kterminal.height * scaleTexture * appSettings.blur_quality | ||||
|         active: mBlur !== 0 | ||||
|         asynchronous: true | ||||
|  | ||||
| @@ -268,13 +269,11 @@ Item{ | ||||
|  | ||||
|                 "void main() {" + | ||||
|                     "vec2 coords = qt_TexCoord0;" + | ||||
|                     "vec3 color = texture2D(txt_source, coords).rgb * 256.0;" + | ||||
|                     "vec3 origColor = texture2D(txt_source, coords).rgb;" + | ||||
|                     "vec3 blur_color = texture2D(blurredSource, coords).rgb * (1.0 - blurCoefficient);" + | ||||
|                     "vec3 color = min(origColor + blur_color, max(origColor, 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 = vec4(floor(color) / 256.0, 1.0);" + | ||||
|                     "gl_FragColor = vec4(color, step(0.02, rgb2grey(color - origColor)));" + | ||||
|                 "}" | ||||
|  | ||||
|             onStatusChanged: if (log) console.log(log) //Print warning messages | ||||
|   | ||||
| @@ -83,6 +83,27 @@ Tab{ | ||||
|                 Text{text: Math.round(bloomSlider.value * 100) + "%"} | ||||
|             } | ||||
|         } | ||||
|         GroupBox{ | ||||
|             title: qsTr("Motion Blur") | ||||
|             Layout.fillWidth: true | ||||
|             anchors.left: parent.left | ||||
|             anchors.right: parent.right | ||||
|             GridLayout{ | ||||
|                 id: blurQualityContainer | ||||
|                 anchors.fill: parent | ||||
|  | ||||
|                 Text{text: qsTr("Blur Quality")} | ||||
|                 Slider{ | ||||
|                     Layout.fillWidth: true | ||||
|                     id: blurSlider | ||||
|                     onValueChanged: appSettings.blur_quality = value; | ||||
|                     value: appSettings.blur_quality | ||||
|                     stepSize: 0.10 | ||||
|                     Component.onCompleted: minimumValue = 0.3 //Without this value gets set to 0.5 | ||||
|                 } | ||||
|                 Text{text: Math.round(blurSlider.value * 100) + "%"} | ||||
|             } | ||||
|         } | ||||
|         GroupBox{ | ||||
|             title: qsTr("Frame") | ||||
|             Layout.fillWidth: true | ||||
|   | ||||
| @@ -36,7 +36,6 @@ Tab{ | ||||
|                 currentIndex: appSettings.rasterization | ||||
|                 onCurrentIndexChanged: { | ||||
|                     appSettings.rasterization = currentIndex | ||||
|                     fontChanger.updateIndex(); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| @@ -51,14 +50,22 @@ Tab{ | ||||
|                     id: fontChanger | ||||
|                     Layout.fillWidth: true | ||||
|                     model: appSettings.fontlist | ||||
|                     currentIndex: updateIndex() | ||||
|                     onActivated: { | ||||
|                         appSettings.fontIndexes[appSettings.rasterization] = index; | ||||
|                         var name = appSettings.fontlist.get(index).name; | ||||
|                         appSettings.fontNames[appSettings.rasterization] = name; | ||||
|                         appSettings.handleFontChanged(); | ||||
|                     } | ||||
|                     function updateIndex(){ | ||||
|                         currentIndex = appSettings.fontIndexes[appSettings.rasterization]; | ||||
|                         var name = appSettings.fontNames[appSettings.rasterization]; | ||||
|                         var index = appSettings.getIndexByName(name); | ||||
|                         if (index !== undefined) | ||||
|                             currentIndex = index; | ||||
|                     } | ||||
|                     Connections{ | ||||
|                         target: appSettings | ||||
|                         onRasterizationChanged: fontChanger.updateIndex(); | ||||
|                     } | ||||
|                     Component.onCompleted: updateIndex(); | ||||
|                 } | ||||
|                 Text{ text: qsTr("Scaling") } | ||||
|                 RowLayout{ | ||||
|   | ||||
| @@ -23,12 +23,15 @@ import QtGraphicalEffects 1.0 | ||||
|  | ||||
| ShaderEffect { | ||||
|     property ShaderEffectSource source | ||||
|     property ShaderEffectSource blurredSource | ||||
|     property ShaderEffectSource bloomSource | ||||
|  | ||||
|     property color font_color: appSettings.font_color | ||||
|     property color background_color: appSettings.background_color | ||||
|     property real bloom_strength: appSettings.bloom_strength * 2.5 | ||||
|  | ||||
|     property real motion_blur: appSettings.motion_blur | ||||
|  | ||||
|     property real jitter: appSettings.jitter * 0.007 | ||||
|     property real noise_strength: appSettings.noise_strength | ||||
|     property size scaleNoiseSize: Qt.size((width) / (noiseTexture.width * appSettings.window_scaling * appSettings.fontScaling), | ||||
| @@ -156,6 +159,8 @@ ShaderEffect { | ||||
|         (bloom_strength !== 0 ? " | ||||
|             uniform highp sampler2D bloomSource; | ||||
|             uniform lowp float bloom_strength;" : "") + | ||||
|         (motion_blur !== 0 ? " | ||||
|             uniform sampler2D blurredSource;" : "") + | ||||
|         (noise_strength !== 0 ? " | ||||
|             uniform highp float noise_strength;" : "") + | ||||
|         (((noise_strength !== 0 || jitter !== 0 || rgb_shift) | ||||
| @@ -233,7 +238,9 @@ ShaderEffect { | ||||
|  | ||||
|             (horizontal_sincronization !== 0 ? " | ||||
|                 float dst = sin((coords.y + time * 0.001) * distortionFreq); | ||||
|                 coords.x += dst * distortionScale;" | ||||
|                 coords.x += dst * distortionScale;" + | ||||
|                 (noise_strength ? " | ||||
|                     noise += distortionScale * 3.0;" : "") | ||||
|             : "") + | ||||
|  | ||||
|             (jitter !== 0 || noise_strength !== 0 ? | ||||
| @@ -254,9 +261,14 @@ ShaderEffect { | ||||
|             (glowing_line_strength !== 0 ? " | ||||
|                 color += randomPass(coords) * glowing_line_strength;" : "") + | ||||
|  | ||||
|             "vec3 txt_color = texture2D(source, txt_coords).rgb;" + | ||||
|  | ||||
|             "vec3 txt_color = texture2D(source, txt_coords).rgb; | ||||
|              float greyscale_color = rgb2grey(txt_color) + color;" + | ||||
|             (motion_blur !== 0 ? " | ||||
|                 vec4 txt_blur = texture2D(blurredSource, txt_coords); | ||||
|                 txt_color = txt_color + txt_blur.rgb * txt_blur.a;" | ||||
|             : "") + | ||||
|  | ||||
|              "float greyscale_color = rgb2grey(txt_color) + color;" + | ||||
|  | ||||
|             (chroma_color !== 0 ? | ||||
|                 (rgb_shift !== 0 ? " | ||||
| @@ -273,16 +285,12 @@ ShaderEffect { | ||||
|             : | ||||
|                 "vec3 finalColor = mix(background_color.rgb, font_color.rgb, greyscale_color);") + | ||||
|  | ||||
|             "finalColor *= getScanlineIntensity(coords); | ||||
|              finalColor *= smoothstep(-dispX, 0.0, coords.x) - smoothstep(1.0, 1.0 + dispX, coords.x); | ||||
|              finalColor *= smoothstep(-dispY, 0.0, coords.y) - smoothstep(1.0, 1.0 + dispY, coords.y);" + | ||||
|             "finalColor *= getScanlineIntensity(coords);" + | ||||
|  | ||||
|             (bloom_strength !== 0 ? | ||||
|                 "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;" + | ||||
|                  float bloomAlpha = bloomFullColor.a;" + | ||||
|                 (chroma_color !== 0 ? | ||||
|                     "bloomColor = font_color.rgb * mix(vec3(rgb2grey(bloomColor)), bloomColor, chroma_color);" | ||||
|                 : | ||||
| @@ -290,6 +298,9 @@ ShaderEffect { | ||||
|                 "finalColor += bloomColor * bloom_strength * bloomAlpha;" | ||||
|             : "") + | ||||
|  | ||||
|             "finalColor *= smoothstep(-dispX, 0.0, coords.x) - smoothstep(1.0, 1.0 + dispX, coords.x); | ||||
|              finalColor *= smoothstep(-dispY, 0.0, coords.y) - smoothstep(1.0, 1.0 + dispY, coords.y);" + | ||||
|  | ||||
|             (brightness_flickering !== 0 ? " | ||||
|                 finalColor *= brightness;" : "") + | ||||
|  | ||||
|   | ||||
| @@ -11,6 +11,7 @@ ShaderTerminal{ | ||||
|     blending: false | ||||
|  | ||||
|     source: terminal.mainSource | ||||
|     blurredSource: terminal.blurredSource | ||||
|     dispX: (12 / width) * appSettings.window_scaling | ||||
|     dispY: (12 / height) * appSettings.window_scaling | ||||
|     virtual_resolution: terminal.virtualResolution | ||||
|   | ||||
		Reference in New Issue
	
	Block a user