Compare commits
	
		
			3 Commits
		
	
	
		
			osx-fixes
			...
			ryanfelder
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | a9e5f309a6 | ||
|   | 6f84f53390 | ||
|   | 0625ca4f15 | 
| @@ -94,6 +94,7 @@ QtObject{ | ||||
|     property real flickering: 0.1 | ||||
|  | ||||
|     property real rbgShift: 0.0 | ||||
|     property real scanlineBlur: 0.0 | ||||
|  | ||||
|     property real _margin: 0.5 | ||||
|     property real margin: Utils.lint(1.0, 20.0, _margin) | ||||
| @@ -232,6 +233,7 @@ QtObject{ | ||||
|             rasterization: rasterization, | ||||
|             jitter: jitter, | ||||
|             rbgShift: rbgShift, | ||||
|             scanlineBlur: scanlineBlur, | ||||
|             brightness: brightness, | ||||
|             contrast: contrast, | ||||
|             ambientLight: ambientLight, | ||||
| @@ -325,6 +327,7 @@ QtObject{ | ||||
|         jitter = settings.jitter !== undefined ? settings.jitter : jitter; | ||||
|  | ||||
|         rbgShift = settings.rbgShift !== undefined ? settings.rbgShift : rbgShift; | ||||
|         scanlineBlur = settings.scanlineBlur !== undefined ? settings.scanlineBlur : rbgShift; | ||||
|  | ||||
|         ambientLight = settings.ambientLight !== undefined ? settings.ambientLight : ambientLight; | ||||
|         contrast = settings.contrast !== undefined ? settings.contrast : contrast; | ||||
| @@ -402,6 +405,7 @@ QtObject{ | ||||
|                   "jitter": 0.1997, | ||||
|                   "rasterization": 0, | ||||
|                   "rbgShift": 0, | ||||
|                   "scanlineBlur": 0, | ||||
|                   "saturationColor": 0.2483, | ||||
|                   "screenCurvature": 0.3, | ||||
|                   "staticNoise": 0.1198, | ||||
| @@ -410,6 +414,34 @@ QtObject{ | ||||
|                 }' | ||||
|             builtin: true | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "Amber Scanlines" | ||||
|             obj_string: '{ | ||||
|                   "ambientLight": 0.2, | ||||
|                   "backgroundColor": "#000000", | ||||
|                   "bloom": 0.32, | ||||
|                   "brightness": 0.85, | ||||
|                   "burnIn": 0.30, | ||||
|                   "chromaColor": 1, | ||||
|                   "contrast": 0.75, | ||||
|                   "flickering": 0.04, | ||||
|                   "fontColor": "#ff8100", | ||||
|                   "fontName": "TERMINUS_SCALED", | ||||
|                   "fontWidth": 1, | ||||
|                   "glowingLine": 0, | ||||
|                   "horizontalSync": 0, | ||||
|                   "jitter": 0.03, | ||||
|                   "rasterization": 1, | ||||
|                   "rbgShift": 0, | ||||
|                   "scanlineBlur": 0.05, | ||||
|                   "saturationColor": 1, | ||||
|                   "screenCurvature": 0.05, | ||||
|                   "staticNoise": 0.05, | ||||
|                   "windowOpacity": 1, | ||||
|                   "margin": 0.5 | ||||
|                 }' | ||||
|             builtin: true | ||||
|         } | ||||
|         ListElement{ | ||||
|             text: "Monochrome Green" | ||||
|             obj_string: ' | ||||
| @@ -430,6 +462,7 @@ QtObject{ | ||||
|                   "jitter": 0.1997, | ||||
|                   "rasterization": 0, | ||||
|                   "rbgShift": 0, | ||||
|                   "scanlineBlur": 0, | ||||
|                   "saturationColor": 0.0, | ||||
|                   "screenCurvature": 0.3, | ||||
|                   "staticNoise": 0.1198, | ||||
| @@ -458,6 +491,7 @@ QtObject{ | ||||
|                   "jitter": 0.11, | ||||
|                   "rasterization": 1, | ||||
|                   "rbgShift": 0, | ||||
|                   "scanlineBlur": 0.05, | ||||
|                   "saturationColor": 0.5, | ||||
|                   "screenCurvature": 0.3, | ||||
|                   "staticNoise": 0.15, | ||||
| @@ -486,6 +520,7 @@ QtObject{ | ||||
|                   "jitter": 0, | ||||
|                   "rasterization": 2, | ||||
|                   "rbgShift": 0, | ||||
|                   "scanlineBlur": 0, | ||||
|                   "saturationColor": 0, | ||||
|                   "screenCurvature": 0, | ||||
|                   "staticNoise": 0.15, | ||||
| @@ -514,6 +549,7 @@ QtObject{ | ||||
|                   "jitter": 0.1, | ||||
|                   "rasterization": 1, | ||||
|                   "rbgShift": 0, | ||||
|                   "scanlineBlur": 0, | ||||
|                   "saturationColor": 0, | ||||
|                   "screenCurvature": 0.5, | ||||
|                   "staticNoise": 0.099, | ||||
| @@ -542,6 +578,7 @@ QtObject{ | ||||
|                   "jitter": 0.4, | ||||
|                   "rasterization": 1, | ||||
|                   "rbgShift": 0.2969, | ||||
|                   "scanlineBlur": 0, | ||||
|                   "saturationColor": 0, | ||||
|                   "screenCurvature": 0.5, | ||||
|                   "staticNoise": 0.2969, | ||||
| @@ -570,6 +607,7 @@ QtObject{ | ||||
|                   "jitter": 0.1545, | ||||
|                   "rasterization": 0, | ||||
|                   "rbgShift": 0.3524, | ||||
|                   "scanlineBlur": 0, | ||||
|                   "saturationColor": 0, | ||||
|                   "screenCurvature": 0.4, | ||||
|                   "staticNoise": 0.0503, | ||||
| @@ -598,6 +636,7 @@ QtObject{ | ||||
|                   "jitter": 0, | ||||
|                   "rasterization": 0, | ||||
|                   "rbgShift": 0, | ||||
|                   "scanlineBlur": 0, | ||||
|                   "saturationColor": 0, | ||||
|                   "screenCurvature": 0.2, | ||||
|                   "staticNoise": 0, | ||||
| @@ -626,6 +665,7 @@ QtObject{ | ||||
|                   "jitter": 0.099, | ||||
|                   "rasterization": 0, | ||||
|                   "rbgShift": 0, | ||||
|                   "scanlineBlur": 0, | ||||
|                   "saturationColor": 0.4983, | ||||
|                   "screenCurvature": 0, | ||||
|                   "staticNoise": 0.0955, | ||||
|   | ||||
| @@ -78,6 +78,8 @@ Loader { | ||||
|             property real burnInTime: burnInFadeTime | ||||
|             property real lastUpdate: burnInEffect.lastUpdate | ||||
|             property real prevLastUpdate: burnInEffect.prevLastUpdate | ||||
|             property int rasterization: appSettings.rasterization | ||||
|             property size virtual_resolution: Qt.size(kterminal.totalWidth, kterminal.totalHeight) | ||||
|  | ||||
|             anchors.fill: parent | ||||
|             blending: false | ||||
| @@ -97,12 +99,33 @@ Loader { | ||||
|  | ||||
|                  uniform highp float lastUpdate; | ||||
|  | ||||
|                  uniform highp float prevLastUpdate;" + | ||||
|                  uniform highp float prevLastUpdate; | ||||
|  | ||||
|                  uniform highp vec2 virtual_resolution;" + | ||||
|  | ||||
|                 "float rgb2grey(vec3 v){ | ||||
|                     return dot(v, vec3(0.21, 0.72, 0.04)); | ||||
|                 }" + | ||||
|  | ||||
|                 "highp float getScanlineIntensity(vec2 coords) { | ||||
|                  float result = 1.0;" + | ||||
|  | ||||
|                 (appSettings.rasterization != appSettings.no_rasterization ? | ||||
|                     "float val = 0.0; | ||||
|                      vec2 rasterizationCoords = fract(coords * virtual_resolution); | ||||
|                      val += smoothstep(0.0, 0.5, rasterizationCoords.y); | ||||
|                      val -= smoothstep(0.5, 1.0, rasterizationCoords.y); | ||||
|                      result *= mix(0.5, 1.0, val);" : "") + | ||||
|  | ||||
|                 (appSettings.rasterization == appSettings.pixel_rasterization ? | ||||
|                     "val = 0.0; | ||||
|                      val += smoothstep(0.0, 0.5, rasterizationCoords.x); | ||||
|                      val -= smoothstep(0.5, 1.0, rasterizationCoords.x); | ||||
|                      result *= mix(0.5, 1.0, val);" : "") + " | ||||
|  | ||||
|                 return result; | ||||
|                 }" + | ||||
|  | ||||
|                 "void main() { | ||||
|                     vec2 coords = qt_TexCoord0; | ||||
|  | ||||
| @@ -111,7 +134,7 @@ Loader { | ||||
|  | ||||
|                     float prevMask = accColor.a; | ||||
|                     float currMask = rgb2grey(txtColor); | ||||
|  | ||||
|                     txtColor *= getScanlineIntensity(coords); | ||||
|                     highp float blurDecay = clamp((lastUpdate - prevLastUpdate) * burnInTime, 0.0, 1.0); | ||||
|                     blurDecay = max(0.0, blurDecay - prevMask); | ||||
|                     vec3 blurColor = accColor.rgb - vec3(blurDecay); | ||||
|   | ||||
| @@ -85,6 +85,11 @@ Tab{ | ||||
|                     onNewValue: appSettings.rbgShift = newValue; | ||||
|                     value: appSettings.rbgShift; | ||||
|                 } | ||||
|                 CheckableSlider{ | ||||
|                     name: qsTr("Scanline Blur") | ||||
|                     onNewValue: appSettings.scanlineBlur = newValue; | ||||
|                     value: appSettings.scanlineBlur; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -378,6 +378,7 @@ Item { | ||||
|          property real chromaColor: appSettings.chromaColor; | ||||
|  | ||||
|          property real rbgShift: (appSettings.rbgShift / width) * appSettings.totalFontScaling // TODO FILIPPO width here is wrong. | ||||
|          property real scanlineBlur: (appSettings.scanlineBlur / width) * appSettings.totalFontScaling | ||||
|  | ||||
|          property int rasterization: appSettings.rasterization | ||||
|  | ||||
| @@ -423,6 +424,9 @@ Item { | ||||
|              (rbgShift !== 0 ? " | ||||
|                  uniform lowp float rbgShift;" : "") + | ||||
|  | ||||
|              (scanlineBlur !== 0 ? " | ||||
|                  uniform lowp float scanlineBlur;" : "") + | ||||
|  | ||||
|              (ambientLight !== 0 ? " | ||||
|                  uniform lowp float ambientLight;" : "") + | ||||
|  | ||||
| @@ -432,15 +436,15 @@ Item { | ||||
|                 (appSettings.rasterization != appSettings.no_rasterization ? | ||||
|                     "float val = 0.0; | ||||
|                      vec2 rasterizationCoords = fract(coords * virtual_resolution); | ||||
|                      val += smoothstep(0.0, 0.5, rasterizationCoords.y); | ||||
|                      val -= smoothstep(0.5, 1.0, rasterizationCoords.y); | ||||
|                      result *= mix(0.5, 1.0, val);" : "") + | ||||
|                      val += smoothstep(0.1, 0.5, rasterizationCoords.y); | ||||
|                      val -= smoothstep(0.5, 0.9, rasterizationCoords.y); | ||||
|                      result *= mix(0.3, 1.0, val);" : "") + | ||||
|  | ||||
|                 (appSettings.rasterization == appSettings.pixel_rasterization ? | ||||
|                     "val = 0.0; | ||||
|                      val += smoothstep(0.0, 0.5, rasterizationCoords.x); | ||||
|                      val -= smoothstep(0.5, 1.0, rasterizationCoords.x); | ||||
|                      result *= mix(0.5, 1.0, val);" : "") + " | ||||
|                      result *= mix(0.1, 1.0, val);" : "") + " | ||||
|  | ||||
|                 return result; | ||||
|              } | ||||
| @@ -490,6 +494,19 @@ Item { | ||||
|                      txt_color.b = leftColor.b * 0.30 + rightColor.b * 0.10 + txt_color.b * 0.60; | ||||
|                  " : "") + | ||||
|  | ||||
|                  (scanlineBlur !== 0 ? " | ||||
|                      vec2 scanlineBlur_displacement = vec2(12.0, 0.0) * scanlineBlur; | ||||
|                      vec3 scanlineBlur_rightColor = texture2D(source, txt_coords + scanlineBlur_displacement).rgb; | ||||
|                      vec3 scanlineBlur_leftColor = texture2D(source, txt_coords - scanlineBlur_displacement).rgb; | ||||
|                      vec3 scanlineBlur_rightColor2 = texture2D(source, txt_coords + scanlineBlur_displacement + scanlineBlur_displacement).rgb; | ||||
|                      vec3 scanlineBlur_leftColor2 = texture2D(source, txt_coords - scanlineBlur_displacement - scanlineBlur_displacement).rgb; | ||||
|                      vec3 scanlineBlur_rightColor3 = texture2D(source, txt_coords + scanlineBlur_displacement + scanlineBlur_displacement + scanlineBlur_displacement).rgb; | ||||
|                      vec3 scanlineBlur_leftColor3 = texture2D(source, txt_coords - scanlineBlur_displacement - scanlineBlur_displacement - scanlineBlur_displacement).rgb; | ||||
|                      txt_color.r = scanlineBlur_leftColor3.r * 0.05 + scanlineBlur_leftColor2.r * 0.1 + scanlineBlur_leftColor.r * 0.20 + txt_color.r * 0.30 + scanlineBlur_rightColor.r * 0.20 + scanlineBlur_rightColor2.r * 0.1 + scanlineBlur_rightColor3.r * 0.05; | ||||
|                      txt_color.g = scanlineBlur_leftColor3.g * 0.05 + scanlineBlur_leftColor2.g * 0.1 + scanlineBlur_leftColor.g * 0.20 + txt_color.g * 0.30 + scanlineBlur_rightColor.g * 0.20 + scanlineBlur_rightColor2.g * 0.1 + scanlineBlur_rightColor3.g * 0.05; | ||||
|                      txt_color.b = scanlineBlur_leftColor3.b * 0.05 + scanlineBlur_leftColor2.b * 0.1 + scanlineBlur_leftColor.b * 0.20 + txt_color.b * 0.30 + scanlineBlur_rightColor.b * 0.20 + scanlineBlur_rightColor2.b * 0.1 + scanlineBlur_rightColor3.b * 0.05; | ||||
|                  " : "") + | ||||
|  | ||||
|                   "txt_color *= getScanlineIntensity(txt_coords);" + | ||||
|  | ||||
|                   "txt_color += vec3(0.0001);" + | ||||
|   | ||||
| @@ -87,6 +87,9 @@ Loader { | ||||
|                 property variant blurredSource: burnInSourceEffect | ||||
|                 property real burnInCoefficient: burnInSourceEffect.burnInCoefficient | ||||
|  | ||||
|                 property int rasterization: appSettings.rasterization | ||||
|                 property size virtual_resolution: Qt.size(kterminal.totalWidth, kterminal.totalHeight) | ||||
|  | ||||
|                 anchors.fill: parent | ||||
|                 blending: false | ||||
|  | ||||
| @@ -97,6 +100,7 @@ Loader { | ||||
|  | ||||
|                 "uniform lowp float qt_Opacity;" + | ||||
|                 "uniform lowp sampler2D txt_source;" + | ||||
|                 "uniform highp vec2 virtual_resolution;" + | ||||
|  | ||||
|                 "varying highp vec2 qt_TexCoord0; | ||||
|              uniform lowp sampler2D blurredSource; | ||||
| @@ -106,12 +110,33 @@ Loader { | ||||
|                      return max (max (v.x, v.y), v.z); | ||||
|                 }" + | ||||
|  | ||||
|  | ||||
|                 "highp float getScanlineIntensity(vec2 coords) { | ||||
|                  float result = 1.0;" + | ||||
|  | ||||
|                 (appSettings.rasterization != appSettings.no_rasterization ? | ||||
|                     "float val = 0.0; | ||||
|                      vec2 rasterizationCoords = fract(coords * virtual_resolution); | ||||
|                      val += smoothstep(0.0, 0.5, rasterizationCoords.y); | ||||
|                      val -= smoothstep(0.5, 1.0, rasterizationCoords.y); | ||||
|                      result *= mix(0.5, 1.0, val);" : "") + | ||||
|  | ||||
|                 (appSettings.rasterization == appSettings.pixel_rasterization ? | ||||
|                     "val = 0.0; | ||||
|                      val += smoothstep(0.0, 0.5, rasterizationCoords.x); | ||||
|                      val -= smoothstep(0.5, 1.0, rasterizationCoords.x); | ||||
|                      result *= mix(0.5, 1.0, val);" : "") + " | ||||
|  | ||||
|                 return result; | ||||
|                 }" + | ||||
|  | ||||
|  | ||||
|                 "void main() {" + | ||||
|                     "vec2 coords = qt_TexCoord0;" + | ||||
|                     "vec3 origColor = texture2D(txt_source, coords).rgb;" + | ||||
|                     "origColor *= getScanlineIntensity(coords);" + | ||||
|                     "vec3 blur_color = texture2D(blurredSource, coords).rgb - vec3(burnInCoefficient);" + | ||||
|                     "vec3 color = min(origColor + blur_color, max(origColor, blur_color));" + | ||||
|  | ||||
|                     "gl_FragColor = vec4(color, max3(color - origColor));" + | ||||
|                 "}" | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user