Add BACKGROUND_INTENSITY to gbc-color

This commit is contained in:
Tim McCabe 2023-09-22 10:38:37 -04:00
parent 1fac9d0ddd
commit 607c0979bb
2 changed files with 8 additions and 2 deletions

View file

@ -40,6 +40,9 @@
> DARKEN_COLOUR: Simply darkens pixel colours (effectively lowers gamma level of pixels) > DARKEN_COLOUR: Simply darkens pixel colours (effectively lowers gamma level of pixels)
- 0.0: Colours are normal - 0.0: Colours are normal
- 2.0: Colours are too dark... - 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 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 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 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_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 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 layout(push_constant) uniform Push
{ {
@ -67,6 +71,7 @@ layout(push_constant) uniform Push
float GRID_BIAS; float GRID_BIAS;
float DARKEN_GRID; float DARKEN_GRID;
float DARKEN_COLOUR; float DARKEN_COLOUR;
float BACKGROUND_INTENSITY;
vec4 OutputSize; vec4 OutputSize;
vec4 OriginalSize; vec4 OriginalSize;
vec4 SourceSize; vec4 SourceSize;
@ -203,7 +208,7 @@ void main()
// Note: Have to calculate luminosity a second time... tiresome, but // Note: Have to calculate luminosity a second time... tiresome, but
// it's not a particulary expensive operation... // it's not a particulary expensive operation...
luma = (LUMA_R * colour.r) + (LUMA_G * colour.g) + (LUMA_B * colour.b); 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); FragColor = vec4(colour.rgb, 1.0);
} }

View file

@ -14,9 +14,10 @@ textures = "BACKGROUND"
BACKGROUND = "shaders/simpletex_lcd/png/2k/textured_paper.png" BACKGROUND = "shaders/simpletex_lcd/png/2k/textured_paper.png"
BACKGROUND_linear = false 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_INTENSITY = "0.65"
GRID_WIDTH = "0.65" GRID_WIDTH = "0.65"
GRID_BIAS = "0.6" GRID_BIAS = "0.6"
DARKEN_GRID = "0.0" DARKEN_GRID = "0.0"
DARKEN_COLOUR = "0.05" DARKEN_COLOUR = "0.05"
BACKGROUND_INTENSITY = "1.0"