From ed08c18eb9a988832d6d0e86c3764f05f0a8f39e Mon Sep 17 00:00:00 2001 From: rez Date: Mon, 9 Jul 2012 23:16:04 +0000 Subject: [PATCH] letterbox test --- neercs/neercs.cpp | 2 +- neercs/video/postfx.lolfx | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/neercs/neercs.cpp b/neercs/neercs.cpp index a4b99b7..a73897b 100644 --- a/neercs/neercs.cpp +++ b/neercs/neercs.cpp @@ -153,7 +153,7 @@ int main(int argc, char **argv) #endif new Neercs(); - new DebugFps(5, 15); + new DebugFps(2, 2); app.ShowPointer(false); app.Run(); diff --git a/neercs/video/postfx.lolfx b/neercs/video/postfx.lolfx index 105fac1..71588ee 100644 --- a/neercs/video/postfx.lolfx +++ b/neercs/video/postfx.lolfx @@ -40,6 +40,19 @@ float rand(in vec2 p) return fract(sin(dot(p.xy,vec2(12.9898,78.233)))*43758.5453); } +float round_square(in vec2 p,in vec2 b,in float r) + { + return length(max(abs(p)-b,0.0))-r; + } + +vec3 letterbox(in vec2 p,in vec3 c) + { + vec2 b=screen_size*0.3625; + float r=screen_size.x*0.2; + float f=round_square(p,b,r); + return c*clamp(1.0-f,0.0,1.0); + } + void main(void) { vec2 q=gl_TexCoord[0].xy; @@ -77,7 +90,7 @@ void main(void) { color-=0.0125*mod(z.y*4.0+time*0.25,1.0); // electron beam color-=(vec3(rnd1,rnd1,rnd1)-vec3(rnd2,rnd2,rnd2))*0.1; // noise - color*=0.75+0.25*sin(z.x*float(screen_size.x*2)); // scanline w + color*=0.75+0.25*sin(z.x*float(screen_size.x*2)); // scanline w color*=0.90+0.10*cos(z.y*float(screen_size.y))*sin(0.5+z.x*float(screen_size.x)); // scanline h } else @@ -86,5 +99,6 @@ void main(void) } color=vec3(color.x*0.875,color.y*1.0,color.z*0.625); color*=q.x*(6.0-q.x*6.0)*q.y*(6.0-q.y*6.0); // vignetting + color=letterbox(p,color); // letterbox gl_FragColor=vec4(color,1.0); }