implemented downscale borrowed from BSL

This commit is contained in:
Valerie Wolfe 2024-04-04 18:31:27 -04:00
parent 34dccdfbe8
commit 1d3eca7d6b
3 changed files with 41 additions and 4 deletions

View file

@ -9,8 +9,11 @@
#define rgbSteps 4 // the number of rgb values to use [2 4 8 16 32 64] #define rgbSteps 4 // the number of rgb values to use [2 4 8 16 32 64]
//#define BLACKEN // Whether or not to blackent the background //#define BLACKEN // Whether or not to blackent the background
#define pixelSize 2 // the size of pixels [1 2 4 8 16]
uniform sampler2D gcolor; uniform sampler2D gcolor;
uniform sampler2D colortex1;
uniform float viewWidth, viewHeight;
varying vec2 texcoord; varying vec2 texcoord;
@ -107,8 +110,18 @@ float dither(float color, float dithersteps) {
} }
void main() { void main() {
vec2 newcoord = texcoord;
#if pixelSize > 1
vec2 view = vec2(viewWidth, viewHeight) / float(pixelSize);
float offset = (ceil(pixelSize * 0.5) - 0.5) / float(pixelSize);
newcoord = (floor(newcoord * view) + offset) / view;
#endif
vec3 color = texture2D(gcolor, newcoord).rgb;
//gl_FragData[0] = vec4(vec3(color), 1.0);
float mask; float mask;
vec3 ogRGB = texture2D(gcolor, texcoord).rgb; //vec3 ogRGB = texture2D(gcolor, texcoord).rgb;
vec3 ogRGB = color;
vec3 ogHSV = rgb2hsv(ogRGB).xyz; vec3 ogHSV = rgb2hsv(ogRGB).xyz;
float val = ogHSV.z; float val = ogHSV.z;
vec3 ditherhsv = hsv2rgb(vec3(dither(ogHSV.x, hueSteps), dither(ogHSV.y, satSteps), dither(ogHSV.z, valSteps))).rgb; vec3 ditherhsv = hsv2rgb(vec3(dither(ogHSV.x, hueSteps), dither(ogHSV.y, satSteps), dither(ogHSV.z, valSteps))).rgb;
@ -120,7 +133,6 @@ void main() {
#else #else
vec3 final = ditherhsv; vec3 final = ditherhsv;
#endif #endif
/* DRAWBUFFERS:0 */
gl_FragData[0] = vec4(vec3(final), 1.0); //gcolor gl_FragData[0] = vec4(vec3(final), 1.0); //gcolor
} }

19
shaders/lang/en_US.lang Normal file
View file

@ -0,0 +1,19 @@
option.pixelSize=Downscaling
value.pixelSize.1=Off
value.pixelSize.2=Low (2x)
value.pixelSize.4=Medium (4x)
value.pixelSize.8=High (8x)
value.pixelSize.16=Silly (16x)
screen.COLOR=Color Depth
option.RGB=Use RGB
option.rgbSteps=RGB Depth
option.hueSteps=Hue Depth
option.satSteps=Saturation Depth
option.valSteps=Value Depth
screen.PSX=PSX
option.vWarp=Vertex Warping
option.tWarp=Texture Warping

View file

@ -1 +1,7 @@
sliders=hueSteps satSteps valSteps sliders=pixelSize hueSteps satSteps valSteps rgbSteps
screen=pixelSize [COLOR] [PSX]
screen.COLOR=RGB rgbSteps pixelSize hueSteps satSteps valSteps
screen.PSX=<empty>