mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2026-02-08 00:32:27 +00:00
Use custom shader variant also for frame shininess.
This commit is contained in:
16
app/app.pro
16
app/app.pro
@@ -62,13 +62,15 @@ for(rgb_shift, BINARY_FLAGS) {
|
||||
for(chroma_on, BINARY_FLAGS) {
|
||||
for(bloom_on, BINARY_FLAGS) {
|
||||
for(curve_on, BINARY_FLAGS) {
|
||||
static_variant = terminal_static_rgb$${rgb_shift}_chroma$${chroma_on}_bloom$${bloom_on}_curve$${curve_on}
|
||||
static_output = $${VARIANT_SHADER_DIR}/$${static_variant}.frag.qsb
|
||||
static_target = shader_variant_$${static_variant}
|
||||
$${static_target}.target = $${static_output}
|
||||
$${static_target}.depends = $$STATIC_SHADER
|
||||
$${static_target}.commands = $$QSB_BIN --glsl \"100 es,120,150\" --hlsl 50 --msl 12 --qt6 -DCRT_RGB_SHIFT=$${rgb_shift} -DCRT_CHROMA=$${chroma_on} -DCRT_BLOOM=$${bloom_on} -DCRT_CURVATURE=$${curve_on} -o $${static_output} $$STATIC_SHADER
|
||||
QMAKE_EXTRA_TARGETS += $${static_target}
|
||||
for(shine_on, BINARY_FLAGS) {
|
||||
static_variant = terminal_static_rgb$${rgb_shift}_chroma$${chroma_on}_bloom$${bloom_on}_curve$${curve_on}_shine$${shine_on}
|
||||
static_output = $${VARIANT_SHADER_DIR}/$${static_variant}.frag.qsb
|
||||
static_target = shader_variant_$${static_variant}
|
||||
$${static_target}.target = $${static_output}
|
||||
$${static_target}.depends = $$STATIC_SHADER
|
||||
$${static_target}.commands = $$QSB_BIN --glsl \"100 es,120,150\" --hlsl 50 --msl 12 --qt6 -DCRT_RGB_SHIFT=$${rgb_shift} -DCRT_CHROMA=$${chroma_on} -DCRT_BLOOM=$${bloom_on} -DCRT_CURVATURE=$${curve_on} -DCRT_FRAME_SHININESS=$${shine_on} -o $${static_output} $$STATIC_SHADER
|
||||
QMAKE_EXTRA_TARGETS += $${static_target}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,10 +40,12 @@ Item {
|
||||
var chromaOn = appSettings.chromaColor > 0 ? 1 : 0;
|
||||
var bloomOn = appSettings.bloom > 0 ? 1 : 0;
|
||||
var curvatureOn = (appSettings.screenCurvature > 0 || appSettings.frameSize > 0) ? 1 : 0;
|
||||
var shineOn = appSettings.frameShininess > 0 ? 1 : 0;
|
||||
return "qrc:/shaders/terminal_static_rgb" + rgbShiftOn +
|
||||
"_chroma" + chromaOn +
|
||||
"_bloom" + bloomOn +
|
||||
"_curve" + curvatureOn +
|
||||
"_shine" + shineOn +
|
||||
".frag.qsb";
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ ShaderTerminal {
|
||||
property alias terminalSize: terminal.terminalSize
|
||||
|
||||
property real devicePixelRatio: terminalWindow.screen.devicePixelRatio
|
||||
property bool loadBloomEffect: appSettings.bloom > 0 || appSettings._frameShininess > 0
|
||||
|
||||
id: mainShader
|
||||
opacity: appSettings.windowOpacity * 0.3 + 0.7
|
||||
@@ -53,7 +54,7 @@ ShaderTerminal {
|
||||
// EFFECTS ////////////////////////////////////////////////////////////////
|
||||
Loader {
|
||||
id: bloomEffectLoader
|
||||
active: appSettings.bloom
|
||||
active: loadBloomEffect
|
||||
asynchronous: true
|
||||
width: parent.width * appSettings.bloomQuality
|
||||
height: parent.height * appSettings.bloomQuality
|
||||
@@ -66,7 +67,7 @@ ShaderTerminal {
|
||||
}
|
||||
Loader {
|
||||
id: bloomSourceLoader
|
||||
active: appSettings.bloom !== 0
|
||||
active: loadBloomEffect
|
||||
asynchronous: true
|
||||
sourceComponent: ShaderEffectSource {
|
||||
id: _bloomEffectSource
|
||||
|
||||
@@ -80,22 +80,38 @@
|
||||
<file>../shaders/terminal_dynamic_raster3_burn1_frame0_chroma1.frag.qsb</file>
|
||||
<file>../shaders/terminal_dynamic_raster3_burn1_frame1_chroma0.frag.qsb</file>
|
||||
<file>../shaders/terminal_dynamic_raster3_burn1_frame1_chroma1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma0_bloom0_curve0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma0_bloom0_curve1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma0_bloom1_curve0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma0_bloom1_curve1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma1_bloom0_curve0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma1_bloom0_curve1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma1_bloom1_curve0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma1_bloom1_curve1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma0_bloom0_curve0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma0_bloom0_curve1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma0_bloom1_curve0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma0_bloom1_curve1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma1_bloom0_curve0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma1_bloom0_curve1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma1_bloom1_curve0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma1_bloom1_curve1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma0_bloom0_curve0_shine0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma0_bloom0_curve0_shine1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma0_bloom0_curve1_shine0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma0_bloom0_curve1_shine1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma0_bloom1_curve0_shine0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma0_bloom1_curve0_shine1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma0_bloom1_curve1_shine0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma0_bloom1_curve1_shine1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma1_bloom0_curve0_shine0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma1_bloom0_curve0_shine1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma1_bloom0_curve1_shine0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma1_bloom0_curve1_shine1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma1_bloom1_curve0_shine0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma1_bloom1_curve0_shine1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma1_bloom1_curve1_shine0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb0_chroma1_bloom1_curve1_shine1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma0_bloom0_curve0_shine0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma0_bloom0_curve0_shine1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma0_bloom0_curve1_shine0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma0_bloom0_curve1_shine1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma0_bloom1_curve0_shine0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma0_bloom1_curve0_shine1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma0_bloom1_curve1_shine0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma0_bloom1_curve1_shine1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma1_bloom0_curve0_shine0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma1_bloom0_curve0_shine1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma1_bloom0_curve1_shine0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma1_bloom0_curve1_shine1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma1_bloom1_curve0_shine0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma1_bloom1_curve0_shine1.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma1_bloom1_curve1_shine0.frag.qsb</file>
|
||||
<file>../shaders/terminal_static_rgb1_chroma1_bloom1_curve1_shine1.frag.qsb</file>
|
||||
<file>../shaders/terminal_frame.frag.qsb</file>
|
||||
<file>../shaders/burn_in.frag.qsb</file>
|
||||
<file>fonts/unscii/unscii-8-thin.ttf</file>
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#ifndef CRT_BLOOM
|
||||
#define CRT_BLOOM 1
|
||||
#endif
|
||||
#ifndef CRT_FRAME_SHININESS
|
||||
#define CRT_FRAME_SHININESS 1
|
||||
#endif
|
||||
#ifndef CRT_CURVATURE
|
||||
#define CRT_CURVATURE 1
|
||||
#endif
|
||||
@@ -92,24 +95,23 @@ void main() {
|
||||
finalColor = mix(backgroundColor.rgb, fontColor.rgb, greyscale_color * shownDraw);
|
||||
#endif
|
||||
|
||||
vec3 bloomColor;
|
||||
float bloomAlpha;
|
||||
#if CRT_BLOOM == 1
|
||||
vec3 bloomColor = finalColor;
|
||||
float bloomAlpha = 0.0;
|
||||
#if CRT_BLOOM == 1 || CRT_FRAME_SHININESS == 1
|
||||
vec4 bloomFullColor = texture(bloomSource, txt_coords);
|
||||
bloomColor = convertWithChroma(bloomFullColor.rgb);
|
||||
bloomAlpha = bloomFullColor.a;
|
||||
|
||||
vec3 bloomOnScreen = bloomColor * isScreen;
|
||||
finalColor += clamp(bloomOnScreen * bloom * bloomAlpha, 0.0, 0.5);
|
||||
#else
|
||||
bloomColor = finalColor;
|
||||
bloomAlpha = 0.0;
|
||||
#endif
|
||||
|
||||
if (frameShininess > 0.0) {
|
||||
vec3 reflectionColor = mix(backgroundColor.rgb + bloomColor, finalColor, frameShininess * 0.5);
|
||||
finalColor = mix(finalColor, reflectionColor, isReflection);
|
||||
}
|
||||
#if CRT_BLOOM == 1
|
||||
vec3 bloomOnScreen = bloomColor * isScreen;
|
||||
finalColor += clamp(bloomOnScreen * bloom * bloomAlpha, 0.0, 0.5);
|
||||
#endif
|
||||
|
||||
#if CRT_FRAME_SHININESS == 1
|
||||
vec3 reflectionColor = mix(backgroundColor.rgb + bloomColor, finalColor, frameShininess * 0.5);
|
||||
finalColor = mix(finalColor, reflectionColor, isReflection);
|
||||
#endif
|
||||
|
||||
finalColor *= screen_brightness;
|
||||
fragColor = vec4(finalColor, qt_Opacity);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user