mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-10-30 22:54:21 +00:00 
			
		
		
		
	Simplify the unholy overengineered mess of rasterization.
This commit is contained in:
		| @@ -99,7 +99,7 @@ Item{ | ||||
|  | ||||
|     // FONTS ////////////////////////////////////////////////////////////////// | ||||
|  | ||||
|     signal terminalFontChanged(string fontSource, int pixelSize, int lineSpacing, size virtualCharSize) | ||||
|     signal terminalFontChanged(string fontSource, int pixelSize, int lineSpacing, real screenScaling) | ||||
|  | ||||
|     Loader{ | ||||
|         id: fontManager | ||||
| @@ -141,9 +141,9 @@ Item{ | ||||
|         var fontSource = fontManager.item.source; | ||||
|         var pixelSize = fontManager.item.pixelSize; | ||||
|         var lineSpacing = fontManager.item.lineSpacing; | ||||
|         var virtualCharSize = fontManager.item.virtualCharSize; | ||||
|         var screenScaling = fontManager.item.screenScaling; | ||||
|  | ||||
|         terminalFontChanged(fontSource, pixelSize, lineSpacing, virtualCharSize); | ||||
|         terminalFontChanged(fontSource, pixelSize, lineSpacing, screenScaling); | ||||
|     } | ||||
|  | ||||
|     // FRAMES ///////////////////////////////////////////////////////////////// | ||||
|   | ||||
| @@ -27,45 +27,47 @@ Item{ | ||||
|     property var _font: fontlist.get(selectedFontIndex) | ||||
|     property var _scaling: fontScalingList[selectedScalingIndex] | ||||
|     property var source: _font.source | ||||
|     property var fontScalingList: [0.75, 1.0, 1.25, 1.50, 1.75, 2.0, 2.25, 2.5] | ||||
|     property int pixelSize: _font.pixelSize * _scaling | ||||
|     property int lineSpacing: (_font.pixelSize / _font.virtualCharHeight) * _font.lineSpacing | ||||
|     property size virtualCharSize: Qt.size(_font.virtualCharWidth, | ||||
|                                            _font.virtualCharHeight) | ||||
|     property var fontScalingList: [0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5] | ||||
|     property int pixelSize: _font.pixelSize | ||||
|     property int lineSpacing: _font.lineSpacing | ||||
|     property real screenScaling: _scaling * _font.baseScaling | ||||
|  | ||||
|     ListModel{ | ||||
|         id: fontlist | ||||
|         ListElement{ | ||||
|             text: "Commodore PET 2Y (1977)" | ||||
|             source: "fonts/1977-commodore-pet/COMMODORE_PET_2y.ttf" | ||||
|             lineSpacing: 2 | ||||
|             pixelSize: 16 | ||||
|             baseScaling: 3.0 | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "Commodore PET (1977)" | ||||
|             source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf" | ||||
|             lineSpacing: 2 | ||||
|             virtualCharWidth: 8 | ||||
|             virtualCharHeight: 8 | ||||
|             pixelSize: 32 | ||||
|             pixelSize: 8 | ||||
|             baseScaling: 4.0 | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "Apple ][ (1977)" | ||||
|             source: "fonts/1977-apple2/PrintChar21.ttf" | ||||
|             lineSpacing: 2 | ||||
|             virtualCharWidth: 7 | ||||
|             virtualCharHeight: 8 | ||||
|             pixelSize: 32 | ||||
|             pixelSize: 8 | ||||
|             baseScaling: 4.0 | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "Atari 400-800 (1979)" | ||||
|             source: "fonts/1979-atari-400-800/ATARI400800_original.TTF" | ||||
|             lineSpacing: 3 | ||||
|             virtualCharWidth: 8 | ||||
|             virtualCharHeight: 8 | ||||
|             pixelSize: 32 | ||||
|             pixelSize: 8 | ||||
|             baseScaling: 4.0 | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "Commodore 64 (1982)" | ||||
|             source: "fonts/1982-commodore64/C64_User_Mono_v1.0-STYLE.ttf" | ||||
|             lineSpacing: 3 | ||||
|             virtualCharWidth: 8 | ||||
|             virtualCharHeight: 8 | ||||
|             pixelSize: 32 | ||||
|             pixelSize: 8 | ||||
|             baseScaling: 4.0 | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -27,11 +27,10 @@ Item{ | ||||
|     property var _font: fontlist.get(selectedFontIndex) | ||||
|     property var _scaling: fontScalingList[selectedScalingIndex] | ||||
|     property var source: _font.source | ||||
|     property var fontScalingList: [0.75, 1.0, 1.25, 1.50, 1.75, 2.0, 2.25, 2.50] | ||||
|     property int pixelSize: _font.pixelSize * _scaling | ||||
|     property int lineSpacing: (_font.pixelSize / _font.virtualCharHeight) * _font.lineSpacing | ||||
|     property size virtualCharSize: Qt.size(_font.virtualCharWidth, | ||||
|                                            _font.virtualCharHeight) | ||||
|     property var fontScalingList: [0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5] | ||||
|     property int pixelSize: _font.pixelSize | ||||
|     property int lineSpacing: _font.lineSpacing | ||||
|     property real screenScaling: _scaling * _font.baseScaling | ||||
|  | ||||
|     ListModel{ | ||||
|         id: fontlist | ||||
| @@ -39,41 +38,36 @@ Item{ | ||||
|             text: "Commodore PET 2Y (1977)" | ||||
|             source: "fonts/1977-commodore-pet/COMMODORE_PET_2y.ttf" | ||||
|             lineSpacing: 2 | ||||
|             virtualCharWidth: 4 | ||||
|             virtualCharHeight: 8 | ||||
|             pixelSize: 32 | ||||
|             pixelSize: 16 | ||||
|             baseScaling: 3.0 | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "Commodore PET (1977)" | ||||
|             source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf" | ||||
|             lineSpacing: 2 | ||||
|             virtualCharWidth: 8 | ||||
|             virtualCharHeight: 8 | ||||
|             pixelSize: 32 | ||||
|             pixelSize: 8 | ||||
|             baseScaling: 4.0 | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "Apple ][ (1977)" | ||||
|             source: "fonts/1977-apple2/PrintChar21.ttf" | ||||
|             lineSpacing: 2 | ||||
|             virtualCharWidth: 8 | ||||
|             virtualCharHeight: 8 | ||||
|             pixelSize: 32 | ||||
|             pixelSize: 8 | ||||
|             baseScaling: 4.0 | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "Atari 400-800 (1979)" | ||||
|             source: "fonts/1979-atari-400-800/ATARI400800_original.TTF" | ||||
|             lineSpacing: 3 | ||||
|             virtualCharWidth: 8 | ||||
|             virtualCharHeight: 8 | ||||
|             pixelSize: 32 | ||||
|             pixelSize: 8 | ||||
|             baseScaling: 4.0 | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "Commodore 64 (1982)" | ||||
|             source: "fonts/1982-commodore64/C64_User_Mono_v1.0-STYLE.ttf" | ||||
|             lineSpacing: 3 | ||||
|             virtualCharWidth: 8 | ||||
|             virtualCharHeight: 8 | ||||
|             pixelSize: 32 | ||||
|             pixelSize: 8 | ||||
|             baseScaling: 4.0 | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -30,6 +30,7 @@ Item{ | ||||
|     property var fontScalingList: [0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5] | ||||
|     property int pixelSize: _font.pixelSize * _scaling | ||||
|     property int lineSpacing: pixelSize * _font.lineSpacing | ||||
|     property real screenScaling: 1.0 | ||||
|  | ||||
|     //In this configuration lineSpacing is proportional to pixelSize. | ||||
|  | ||||
|   | ||||
| @@ -46,9 +46,6 @@ Item{ | ||||
|     property real _maxBlurCoefficient: 0.90 | ||||
|  | ||||
|     property size virtualPxSize: Qt.size(1,1) | ||||
|     property size virtual_resolution: Qt.size(width / virtualPxSize.width, height / virtualPxSize.height) | ||||
|     property real deltay: 0.5 / virtual_resolution.height | ||||
|     property real deltax: 0.5 / virtual_resolution.width | ||||
|  | ||||
|     property real mBloom: shadersettings.bloom_strength | ||||
|     property int mScanlines: shadersettings.rasterization | ||||
| @@ -73,8 +70,10 @@ Item{ | ||||
|  | ||||
|     KTerminal { | ||||
|         id: kterminal | ||||
|         anchors.fill: parent | ||||
|         width: parent.width | ||||
|         height: parent.height | ||||
|  | ||||
|         smooth: false | ||||
|         colorScheme: "cool-retro-term" | ||||
|  | ||||
|         session: KSession { | ||||
| @@ -89,30 +88,15 @@ Item{ | ||||
|         FontLoader{ id: fontLoader } | ||||
|         Text{id: fontMetrics; text: "B"; visible: false} | ||||
|  | ||||
|         function getPaintedSize(pixelSize){ | ||||
|             fontMetrics.font.family = fontLoader.name; | ||||
|             fontMetrics.font.pixelSize = pixelSize; | ||||
|             return Qt.size(fontMetrics.paintedWidth, fontMetrics.paintedHeight); | ||||
|         } | ||||
|         function isValid(size){ | ||||
|             return size.width >= 0 && size.height >= 0; | ||||
|         } | ||||
|         function handleFontChange(fontSource, pixelSize, lineSpacing, virtualCharSize){ | ||||
|         function handleFontChange(fontSource, pixelSize, lineSpacing, screenScaling){ | ||||
|             fontLoader.source = fontSource; | ||||
|             font.pixelSize = pixelSize * shadersettings.window_scaling; | ||||
|             font.pixelSize = pixelSize; | ||||
|             font.family = fontLoader.name; | ||||
|  | ||||
|             var paintedSize = getPaintedSize(pixelSize); | ||||
|             var charSize = isValid(virtualCharSize) | ||||
|                     ? virtualCharSize | ||||
|                     : Qt.size(paintedSize.width / 2, paintedSize.height / 2); | ||||
|             width = Qt.binding(function() {return Math.floor(terminalContainer.width / screenScaling);}); | ||||
|             height = Qt.binding(function() {return Math.floor(terminalContainer.height / screenScaling);}); | ||||
|  | ||||
|             var virtualPxSize = Qt.size((paintedSize.width  / charSize.width) * shadersettings.window_scaling, | ||||
|                                         (paintedSize.height / charSize.height) * shadersettings.window_scaling) | ||||
|  | ||||
|             terminalContainer.virtualPxSize = virtualPxSize; | ||||
|  | ||||
|             setLineSpacing(lineSpacing * shadersettings.window_scaling); | ||||
|             setLineSpacing(lineSpacing); | ||||
|             restartBlurredSource(); | ||||
|         } | ||||
|         Component.onCompleted: { | ||||
| @@ -157,10 +141,10 @@ Item{ | ||||
|             var coord = correctDistortion(mouse.x, mouse.y); | ||||
|             kterminal.mouseReleaseEvent(coord, mouse.button, mouse.modifiers); | ||||
|         } | ||||
| 	onPositionChanged: { | ||||
| 	    var coord = correctDistortion(mouse.x, mouse.y); | ||||
| 	    kterminal.mouseMoveEvent(coord, mouse.button, mouse.buttons, mouse.modifiers); | ||||
| 	} | ||||
|         onPositionChanged: { | ||||
|             var coord = correctDistortion(mouse.x, mouse.y); | ||||
|             kterminal.mouseMoveEvent(coord, mouse.button, mouse.buttons, mouse.modifiers); | ||||
|         } | ||||
|  | ||||
|         //Frame displacement properties | ||||
|         property real dtop: frame.item.displacementTop | ||||
| @@ -178,8 +162,8 @@ Item{ | ||||
|             var cc = Qt.size(0.5 - x, 0.5 - y); | ||||
|             var distortion = (cc.height * cc.height + cc.width * cc.width) * shadersettings.screen_distortion; | ||||
|  | ||||
|             return Qt.point((x - cc.width  * (1+distortion) * distortion) * width, | ||||
|                            (y - cc.height * (1+distortion) * distortion) * height) | ||||
|             return Qt.point((x - cc.width  * (1+distortion) * distortion) * kterminal.width, | ||||
|                            (y - cc.height * (1+distortion) * distortion) * kterminal.height) | ||||
|         } | ||||
|     } | ||||
|     ShaderEffectSource{ | ||||
| @@ -212,24 +196,24 @@ Item{ | ||||
|     ShaderEffectSource{ | ||||
|         id: finalSource | ||||
|         sourceItem: blurredterminal | ||||
|         sourceRect: frame.sourceRect | ||||
|         //sourceRect: frame.sourceRect | ||||
|         hideSource: true | ||||
|         //Smooth looks ugly when rasterization is used. | ||||
|         smooth: shadersettings.rasterization == shadersettings.no_rasterization | ||||
|     } | ||||
|     ShaderEffect { | ||||
|         id: blurredterminal | ||||
|         anchors.fill: parent | ||||
|         anchors.fill: kterminal | ||||
|         property variant source: source | ||||
|         property variant blurredSource: (mBlur !== 0) ? blurredSource : undefined | ||||
|         property real blurCoefficient: (1.0 - motionBlurCoefficient) * fpsAttenuation | ||||
|         property size virtual_resolution: parent.virtual_resolution | ||||
|         property size delta: Qt.size((mScanlines == shadersettings.pixel_rasterization ? deltax : 0), | ||||
|                                      mScanlines != shadersettings.no_rasterization ? deltay : 0) | ||||
|         property size virtual_resolution: Qt.size(kterminal.width, kterminal.height) | ||||
|  | ||||
|         blending: false | ||||
|  | ||||
|         fragmentShader: | ||||
|             "uniform lowp float qt_Opacity;" + | ||||
|             "uniform lowp sampler2D source;" + | ||||
|             "uniform highp vec2 delta;" + | ||||
|  | ||||
|             "varying highp vec2 qt_TexCoord0; | ||||
|  | ||||
| @@ -246,13 +230,6 @@ Item{ | ||||
|  | ||||
|             "void main() {" + | ||||
|                 "vec2 coords = qt_TexCoord0;" + | ||||
|                 (mScanlines != shadersettings.no_rasterization ? " | ||||
|                             coords.y = floor(virtual_resolution.y * coords.y) / virtual_resolution.y;" + | ||||
|                 (mScanlines == shadersettings.pixel_rasterization ? " | ||||
|                             coords.x = floor(virtual_resolution.x * coords.x) / virtual_resolution.x;" : "") | ||||
|                 : "") + | ||||
|                 "coords = coords + delta;" + | ||||
|  | ||||
|                 "vec4 color = texture2D(source, coords) * 256.0; | ||||
|                  color.a = rgb2grey(color.rgb);" + | ||||
|  | ||||
| @@ -291,7 +268,7 @@ Item{ | ||||
|         sourceComponent: ShaderEffectSource{ | ||||
|             sourceItem: bloomEffectLoader.item | ||||
|             hideSource: true | ||||
|             sourceRect: frame.sourceRect | ||||
|             //sourceRect: frame.sourceRect | ||||
|             smooth: false | ||||
|         } | ||||
|     } | ||||
| @@ -301,7 +278,7 @@ Item{ | ||||
|     ShaderEffect { | ||||
|         id: staticNoiseEffect | ||||
|         anchors.fill: parent | ||||
|         property size virtual_resolution: terminalContainer.virtual_resolution | ||||
|         property size virtual_resolution: Qt.size(kterminal.width, kterminal.height) | ||||
|  | ||||
|         blending: false | ||||
|  | ||||
| @@ -332,9 +309,9 @@ Item{ | ||||
|                 return mix(s, n, inter.y); | ||||
|             }" + | ||||
|  | ||||
|         "void main() {" + | ||||
|             "gl_FragColor.a = smoothNoise(qt_TexCoord0 * virtual_resolution);" + | ||||
|         "}" | ||||
|             "void main() {" + | ||||
|                 "gl_FragColor.a = smoothNoise(qt_TexCoord0 * virtual_resolution);" + | ||||
|             "}" | ||||
|  | ||||
|         onStatusChanged: if (log) console.log(log) //Print warning messages | ||||
|     } | ||||
| @@ -350,77 +327,117 @@ Item{ | ||||
|  | ||||
|     // RASTERIZATION ////////////////////////////////////////////////////////// | ||||
|  | ||||
|     ShaderEffect{ | ||||
|         id: rasterizationContainer | ||||
|         width: frame.sourceRect.width | ||||
|         height: frame.sourceRect.height | ||||
|         property size offset: Qt.size(width - rasterizationEffect.width, height - rasterizationEffect.height) | ||||
|         property size txtRes: Qt.size(width, height) | ||||
| //    ShaderEffect{ | ||||
| //        id: rasterizationContainer | ||||
| //        width: frame.sourceRect.width | ||||
| //        height: frame.sourceRect.height | ||||
| //        property size offset: Qt.size(width - rasterizationEffect.width, height - rasterizationEffect.height) | ||||
| //        property size txtRes: Qt.size(width, height) | ||||
|  | ||||
| //        blending: false | ||||
|  | ||||
| //        fragmentShader: | ||||
| //            "uniform lowp float qt_Opacity; | ||||
| //             uniform highp vec2 offset; | ||||
| //             uniform highp vec2 txtRes;" + | ||||
|  | ||||
| //            "varying highp vec2 qt_TexCoord0;" + | ||||
|  | ||||
| //            "void main() {" + | ||||
| //                "float color = 1.0; | ||||
| //                 color *= smoothstep(0.0, offset.x / txtRes.x, qt_TexCoord0.x); | ||||
| //                 color *= smoothstep(0.0, offset.y / txtRes.y, qt_TexCoord0.y); | ||||
| //                 color *= smoothstep(0.0, offset.x / txtRes.x, 1.0 - qt_TexCoord0.x); | ||||
| //                 color *= smoothstep(0.0, offset.y / txtRes.y, 1.0 - qt_TexCoord0.y);" + | ||||
|  | ||||
| //                "float distance = length(vec2(0.5) - qt_TexCoord0);" + | ||||
| //                "color = mix(color, 0.0, 1.2 * distance * distance);" + | ||||
|  | ||||
| //                "gl_FragColor.a = color;" + | ||||
| //            "}" | ||||
|  | ||||
| //        ShaderEffect { | ||||
| //            id: rasterizationEffect | ||||
| //            width: terminalContainer.width | ||||
| //            height: terminalContainer.height | ||||
| //            anchors.centerIn: parent | ||||
| //            property size virtual_resolution: Qt.size(kterminal.width, kterminal.height) | ||||
|  | ||||
| //            blending: false | ||||
|  | ||||
| //            fragmentShader: | ||||
| //                "uniform lowp float qt_Opacity;" + | ||||
|  | ||||
| //                "varying highp vec2 qt_TexCoord0; | ||||
| //                     uniform highp vec2 virtual_resolution; | ||||
|  | ||||
| //                     float getScanlineIntensity(vec2 coords) { | ||||
| //                        float result = 1.0;" + | ||||
| //                        (mScanlines != shadersettings.no_rasterization ? | ||||
| //                            "result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") + | ||||
| //                        (mScanlines == shadersettings.pixel_rasterization ? | ||||
| //                            "result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + " | ||||
| //                        return result; | ||||
| //                     }" + | ||||
|  | ||||
| //            "void main() {" + | ||||
| //                "float color = getScanlineIntensity(qt_TexCoord0);" + | ||||
|  | ||||
| //                "float distance = length(vec2(0.5) - qt_TexCoord0);" + | ||||
| //                "color = mix(color, 0.0, 1.2 * distance * distance);" + | ||||
|  | ||||
| //                "gl_FragColor.a = color;" + | ||||
| //            "}" | ||||
|  | ||||
| //            onStatusChanged: if (log) console.log(log) //Print warning messages | ||||
| //        } | ||||
| //        onStatusChanged: if (log) console.log(log) //Print warning messages | ||||
| //    } | ||||
| //    ShaderEffectSource{ | ||||
| //        id: rasterizationEffectSource | ||||
| //        sourceItem: rasterizationContainer | ||||
| //        hideSource: true | ||||
| //        smooth: true | ||||
| //        //format: ShaderEffectSource.Alpha | ||||
| //    } | ||||
|     ShaderEffect { | ||||
|         id: rasterizationEffect | ||||
|         width: parent.width * 2 | ||||
|         height: parent.height * 2 | ||||
|         property size virtual_resolution: Qt.size(kterminal.width, kterminal.height) | ||||
|  | ||||
|         blending: false | ||||
|  | ||||
|         fragmentShader: | ||||
|             "uniform lowp float qt_Opacity; | ||||
|              uniform highp vec2 offset; | ||||
|              uniform highp vec2 txtRes;" + | ||||
|             "uniform lowp float qt_Opacity;" + | ||||
|  | ||||
|             "varying highp vec2 qt_TexCoord0;" + | ||||
|             "varying highp vec2 qt_TexCoord0; | ||||
|                  uniform highp vec2 virtual_resolution; | ||||
|  | ||||
|             "void main() {" + | ||||
|                 "float color = 1.0; | ||||
|                  color *= smoothstep(0.0, offset.x / txtRes.x, qt_TexCoord0.x); | ||||
|                  color *= smoothstep(0.0, offset.y / txtRes.y, qt_TexCoord0.y); | ||||
|                  color *= smoothstep(0.0, offset.x / txtRes.x, 1.0 - qt_TexCoord0.x); | ||||
|                  color *= smoothstep(0.0, offset.y / txtRes.y, 1.0 - qt_TexCoord0.y);" + | ||||
|                  highp float getScanlineIntensity(vec2 coords) { | ||||
|                     highp float result = 1.0;" + | ||||
|                     (mScanlines != shadersettings.no_rasterization ? | ||||
|                         "result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") + | ||||
|                     (mScanlines == shadersettings.pixel_rasterization ? | ||||
|                         "result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + " | ||||
|                     return result; | ||||
|                  }" + | ||||
|  | ||||
|                 "float distance = length(vec2(0.5) - qt_TexCoord0);" + | ||||
|                 "color = mix(color, 0.0, 1.2 * distance * distance);" + | ||||
|         "void main() {" + | ||||
|             "highp float color = getScanlineIntensity(qt_TexCoord0);" + | ||||
|  | ||||
|                 "gl_FragColor.a = color;" + | ||||
|             "}" | ||||
|             "float distance = length(vec2(0.5) - qt_TexCoord0);" + | ||||
|             "color = mix(color, 0.0, 1.2 * distance * distance);" + | ||||
|  | ||||
|         ShaderEffect { | ||||
|             id: rasterizationEffect | ||||
|             width: terminalContainer.width | ||||
|             height: terminalContainer.height | ||||
|             anchors.centerIn: parent | ||||
|             property size virtual_resolution: terminalContainer.virtual_resolution | ||||
|             "gl_FragColor.a = color;" + | ||||
|         "}" | ||||
|  | ||||
|             blending: false | ||||
|  | ||||
|             fragmentShader: | ||||
|                 "uniform lowp float qt_Opacity;" + | ||||
|  | ||||
|                 "varying highp vec2 qt_TexCoord0; | ||||
|                      uniform highp vec2 virtual_resolution; | ||||
|  | ||||
|                      float getScanlineIntensity(vec2 coords) { | ||||
|                         float result = 1.0;" + | ||||
|                         (mScanlines != shadersettings.no_rasterization ? | ||||
|                             "result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") + | ||||
|                         (mScanlines == shadersettings.pixel_rasterization ? | ||||
|                             "result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + " | ||||
|                         return result; | ||||
|                      }" + | ||||
|  | ||||
|             "void main() {" + | ||||
|                 "float color = getScanlineIntensity(qt_TexCoord0);" + | ||||
|  | ||||
|                 "float distance = length(vec2(0.5) - qt_TexCoord0);" + | ||||
|                 "color = mix(color, 0.0, 1.2 * distance * distance);" + | ||||
|  | ||||
|                 "gl_FragColor.a = color;" + | ||||
|             "}" | ||||
|  | ||||
|             onStatusChanged: if (log) console.log(log) //Print warning messages | ||||
|         } | ||||
|         onStatusChanged: if (log) console.log(log) //Print warning messages | ||||
|     } | ||||
|     ShaderEffectSource{ | ||||
|         id: rasterizationEffectSource | ||||
|         sourceItem: rasterizationContainer | ||||
|         sourceItem: rasterizationEffect | ||||
|         hideSource: true | ||||
|         smooth: true | ||||
|         //format: ShaderEffectSource.Alpha | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -21,6 +21,7 @@ | ||||
| import QtQuick 2.2 | ||||
| import QtGraphicalEffects 1.0 | ||||
|  | ||||
|  | ||||
| ShaderEffect { | ||||
|     property color font_color: shadersettings.font_color | ||||
|     property color background_color: shadersettings.background_color | ||||
| @@ -103,8 +104,7 @@ ShaderEffect { | ||||
|             uniform lowp float horizontal_sincronization;" : "") + | ||||
|         " | ||||
|         void main() { | ||||
|             qt_TexCoord0.x = -"+str(disp_left)+"/txt_Size.x + qt_MultiTexCoord0.x / ((txt_Size.x -("+str(disp_left+disp_right)+")) / txt_Size.x);" + " | ||||
|             qt_TexCoord0.y = -"+str(disp_top)+"/txt_Size.y + qt_MultiTexCoord0.y / ((txt_Size.y -("+str(disp_top+disp_bottom)+")) / txt_Size.y);" + " | ||||
|             qt_TexCoord0 = qt_MultiTexCoord0; | ||||
|             vec2 coords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0)));" + | ||||
|             (brightness_flickering !== 0.0 ? " | ||||
|                 brightness = 1.0 + (texture2D(randomFunctionSource, coords).g - 0.5) * brightness_flickering;" | ||||
|   | ||||
| @@ -148,8 +148,6 @@ ApplicationWindow{ | ||||
|         width: parent.width * shadersettings.window_scaling | ||||
|         height: parent.height * shadersettings.window_scaling | ||||
|         scale: 1.0 / shadersettings.window_scaling | ||||
|         smooth: false | ||||
|         antialiasing: false | ||||
|         opacity: shadersettings.windowOpacity * 0.3 + 0.7 | ||||
|  | ||||
|         Loader{ | ||||
| @@ -164,7 +162,6 @@ ApplicationWindow{ | ||||
|         PreprocessedTerminal{ | ||||
|             id: terminal | ||||
|             anchors.fill: parent | ||||
|             anchors.margins: 30 | ||||
|         } | ||||
|         ShaderTerminal{ | ||||
|             id: shadercontainer | ||||
|   | ||||
| @@ -87,7 +87,7 @@ const ColorEntry base_color_table[TABLE_COLORS] = | ||||
| // scroll increment used when dragging selection at top/bottom of window. | ||||
|  | ||||
| // static | ||||
| bool KTerminalDisplay::_antialiasText = true; | ||||
| bool KTerminalDisplay::_antialiasText = false; | ||||
| bool KTerminalDisplay::HAVE_TRANSPARENCY = true; | ||||
|  | ||||
| // we use this to force QPainter to display text in LTR mode | ||||
|   | ||||
		Reference in New Issue
	
	Block a user