added connector option for composite and s-video
This commit is contained in:
parent
0902b5b835
commit
69c14e4151
6 changed files with 34 additions and 9 deletions
|
@ -13,23 +13,34 @@ 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"
|
#include "/module/scanline.frag"
|
||||||
|
#include "/module/signal.frag"
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec3 color;
|
vec3 color;
|
||||||
|
|
||||||
|
|
||||||
|
// software post-processing effects
|
||||||
#ifdef hBlur
|
#ifdef hBlur
|
||||||
color = hblur();
|
color = hblur();
|
||||||
#else
|
#else
|
||||||
color = texture2D(gcolor, texcoord).rgb;
|
color = texture2D(gcolor, texcoord).rgb;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef aberration
|
|
||||||
color.rb = aberrate().rb;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if scanline > 0
|
#if scanline > 0
|
||||||
color = scanlines(color);
|
color = scanlines(color);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// hardware post-processing effects
|
||||||
|
#if signal == SIGNAL_NTSC
|
||||||
|
color = ntsc(color);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// physical post-processing effects
|
||||||
|
#ifdef aberration
|
||||||
|
color.rb = aberrate(color).rb;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
gl_FragData[0] = vec4(color, 1);
|
gl_FragData[0] = vec4(color, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,10 @@ option.signal=Signal
|
||||||
value.signal.0=RGB (Off)
|
value.signal.0=RGB (Off)
|
||||||
value.signal.1=NTSC
|
value.signal.1=NTSC
|
||||||
|
|
||||||
|
option.wire=Connector
|
||||||
|
value.wire.0=Composite
|
||||||
|
value.wire.1=S-Video
|
||||||
|
|
||||||
option.interlacing=Interlacing
|
option.interlacing=Interlacing
|
||||||
|
|
||||||
option.scanline=Scanlines
|
option.scanline=Scanlines
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
|
|
||||||
vec2 caOffset = vec2(2 * pixelSize / viewWidth, 0);
|
vec2 caOffset = vec2(2 * pixelSize / viewWidth, 0);
|
||||||
|
|
||||||
vec3 aberrate() {
|
vec3 aberrate(vec3 color) {
|
||||||
vec2 offset = caOffset * abs(cos(texcoord * 3.14));
|
vec2 offset = caOffset * abs(cos(texcoord * 3.14));
|
||||||
float red = texture2D(gcolor, texcoord - offset).r;
|
float red = color.r;
|
||||||
float blue = texture2D(gcolor, texcoord + offset).b;
|
float blue = color.b;
|
||||||
|
|
||||||
return vec3(red, 0, blue);
|
return vec3(red, 0, blue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "/var/signal.glsl"
|
#include "/var/signal.glsl"
|
||||||
|
|
||||||
#define signal 0 // [0 1]
|
#define signal 0 // [0 1]
|
||||||
|
#define wire 0 // [0 1]
|
||||||
|
|
||||||
vec3 ntsc(vec3 color) {
|
vec3 ntsc(vec3 color) {
|
||||||
// convert to YIQ
|
// convert to YIQ
|
||||||
|
@ -10,11 +11,17 @@ vec3 ntsc(vec3 color) {
|
||||||
float q = dot(color, vec3(0.211, -.523, 0.312));
|
float q = dot(color, vec3(0.211, -.523, 0.312));
|
||||||
|
|
||||||
// faux ntsc signal
|
// faux ntsc signal
|
||||||
float carrier = 6.283 * 3.570 * gl_FragCoord.x;
|
float carrier = 6.283 * 3.570 * gl_FragCoord.x; // 2π * 3.57MHz * x
|
||||||
float phase = sin(carrier) * i + cos(carrier) * q;
|
float phase = sin(carrier) * i + cos(carrier) * q;
|
||||||
float quad = cos(carrier) * i - sin(carrier) * q;
|
float quad = cos(carrier) * i - sin(carrier) * q;
|
||||||
|
|
||||||
// decode faux signal
|
// decode faux signal
|
||||||
|
#if wire == WIRE_COMPOSITE
|
||||||
|
float composite = phase + quad + (y * 5.500); // p + q + (y * 5.5MHz)
|
||||||
|
y = round(composite * 5.500) / 30.250;
|
||||||
|
phase = composite - quad - (y * 5.500);
|
||||||
|
quad = composite - phase - (y * 5.500);
|
||||||
|
#endif
|
||||||
i = quad * cos(carrier);
|
i = quad * cos(carrier);
|
||||||
q = phase * sin(carrier);
|
q = phase * sin(carrier);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ screen.COLOR.columns=3
|
||||||
screen.COLOR=colorMode dithering <empty> colorDepth <empty> monoPalette hueBits satBits valBits
|
screen.COLOR=colorMode dithering <empty> colorDepth <empty> monoPalette hueBits satBits valBits
|
||||||
|
|
||||||
# screen effects
|
# screen effects
|
||||||
screen.SCREEN=signal <empty> interlacing scanline aberration
|
screen.SCREEN=signal wire interlacing scanline aberration
|
||||||
|
|
||||||
# console effects
|
# console effects
|
||||||
screen.CONSOLE.columns=1
|
screen.CONSOLE.columns=1
|
||||||
|
|
|
@ -2,3 +2,6 @@
|
||||||
#define SIGNAL_RGB 0
|
#define SIGNAL_RGB 0
|
||||||
#define SIGNAL_NTSC 1
|
#define SIGNAL_NTSC 1
|
||||||
|
|
||||||
|
#define WIRE_COMPOSITE 0
|
||||||
|
#define WIRE_SVIDEO 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue