瀏覽代碼

letterbox test

master
父節點
當前提交
ed08c18eb9
共有 2 個文件被更改,包括 16 次插入2 次删除
  1. +1
    -1
      neercs/neercs.cpp
  2. +15
    -1
      neercs/video/postfx.lolfx

+ 1
- 1
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();


+ 15
- 1
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);
}

Loading…
取消
儲存