From 607c0979bbc9405a724c6ff288659afe7540979a Mon Sep 17 00:00:00 2001 From: Tim McCabe Date: Fri, 22 Sep 2023 10:38:37 -0400 Subject: [PATCH] Add BACKGROUND_INTENSITY to gbc-color --- .../shaders/simpletex_lcd/simpletex_lcd+gbc-color.slang | 7 ++++++- handheld/simpletex_lcd+gbc-color.slangp | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/handheld/shaders/simpletex_lcd/simpletex_lcd+gbc-color.slang b/handheld/shaders/simpletex_lcd/simpletex_lcd+gbc-color.slang index 7492cda9..ad178a3b 100644 --- a/handheld/shaders/simpletex_lcd/simpletex_lcd+gbc-color.slang +++ b/handheld/shaders/simpletex_lcd/simpletex_lcd+gbc-color.slang @@ -40,6 +40,9 @@ > DARKEN_COLOUR: Simply darkens pixel colours (effectively lowers gamma level of pixels) - 0.0: Colours are normal - 2.0: Colours are too dark... + > BACKGROUND_INTENSITY: Adjusts how prominent the paper background texture is + - 0.0: No background texture + - 1.0: Background texture is clearly visible This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -59,6 +62,7 @@ #pragma parameter GRID_BIAS "Grid Bias" 0.0 0.0 1.0 0.05 #pragma parameter DARKEN_GRID "Darken Grid" 0.0 0.0 1.0 0.05 #pragma parameter DARKEN_COLOUR "Darken Colours" 0.0 0.0 2.0 0.05 +#pragma parameter BACKGROUND_INTENSITY "Background Intensity" 1.0 0.0 1.0 0.05 layout(push_constant) uniform Push { @@ -67,6 +71,7 @@ layout(push_constant) uniform Push float GRID_BIAS; float DARKEN_GRID; float DARKEN_COLOUR; + float BACKGROUND_INTENSITY; vec4 OutputSize; vec4 OriginalSize; vec4 SourceSize; @@ -203,7 +208,7 @@ void main() // Note: Have to calculate luminosity a second time... tiresome, but // it's not a particulary expensive operation... luma = (LUMA_R * colour.r) + (LUMA_G * colour.g) + (LUMA_B * colour.b); - colour.rgb = mix(colour.rgb, bgTexture.rgb, luma); + colour.rgb = mix(colour.rgb, bgTexture.rgb, luma * registers.BACKGROUND_INTENSITY); FragColor = vec4(colour.rgb, 1.0); } diff --git a/handheld/simpletex_lcd+gbc-color.slangp b/handheld/simpletex_lcd+gbc-color.slangp index 6a859c3b..d55f03b3 100644 --- a/handheld/simpletex_lcd+gbc-color.slangp +++ b/handheld/simpletex_lcd+gbc-color.slangp @@ -14,9 +14,10 @@ textures = "BACKGROUND" BACKGROUND = "shaders/simpletex_lcd/png/2k/textured_paper.png" BACKGROUND_linear = false -parameters = "GRID_INTENSITY;GRID_WIDTH;GRID_BIAS;DARKEN_GRID;DARKEN_COLOUR" +parameters = "GRID_INTENSITY;GRID_WIDTH;GRID_BIAS;DARKEN_GRID;DARKEN_COLOUR;BACKGROUND_INTENSITY" GRID_INTENSITY = "0.65" GRID_WIDTH = "0.65" GRID_BIAS = "0.6" DARKEN_GRID = "0.0" DARKEN_COLOUR = "0.05" +BACKGROUND_INTENSITY = "1.0"