added 'hard' scanline option

This commit is contained in:
Valerie Wolfe 2024-05-03 22:08:09 -04:00
parent 7305a8e17f
commit 59a9f24f3a
4 changed files with 28 additions and 6 deletions

View file

@ -4,7 +4,6 @@
//#define aberration //#define aberration
//#define hBlur //#define hBlur
//#define scanlines
varying vec2 texcoord; varying vec2 texcoord;
@ -13,6 +12,7 @@ uniform float viewWidth;
#include "/module/aberration.frag" #include "/module/aberration.frag"
#include "/module/horizontal_blur.frag" #include "/module/horizontal_blur.frag"
#include "/module/scanline.frag"
void main() { void main() {
vec3 color; vec3 color;
@ -26,11 +26,8 @@ void main() {
color.rb = aberrate().rb; color.rb = aberrate().rb;
#endif #endif
#ifdef scanlines #if scanline > 0
if(mod(int(gl_FragCoord.y / (pixelSize * 2)), 2) == 0) color = scanlines(color);
color.rgb *= 0.95;
else
color.rgb /= 0.95;
#endif #endif
gl_FragData[0] = vec4(color, 1); gl_FragData[0] = vec4(color, 1);

View file

@ -55,6 +55,9 @@ screen.SCREEN=Screen
option.interlacing=Interlacing option.interlacing=Interlacing
option.scanlines=Scanlines option.scanlines=Scanlines
value.scanlines.0=Off
value.scanlines.1=Soft
value.scanlines.2=Hard
option.aberration=Chromatic Aberration option.aberration=Chromatic Aberration

View file

@ -0,0 +1,17 @@
#include "/var/scanline.glsl"
#define scanline 0 // [0 1 2]
public void scanlines() {
#if scanline == SCANLINE_SOFT
if(mod(int(gl_FragCoord.y) / (pixelSize * 2), 2) == 0)
color.rgb *= 0.95;
else
color.rgb /= 0.95;
#elif scanline == SCANLINE_HARD
if(mod(int(gl_FragCoord.y) / (pixelSize * 2), 2) == 0)
color.rgb *= 0.5;
#endif
}

View file

@ -0,0 +1,5 @@
#define SCANLINE_SOFT 1
#define SCANLINE_HARD 2
#define SCANLINE_STRETCH 3