Przeglądaj źródła

NEERCS: added corner width in setup->screen

master
rodzic
commit
d6b02f12b4
2 zmienionych plików z 12 dodań i 12 usunięć
  1. +4
    -4
      neercs/video/postfx.lolfx
  2. +8
    -8
      neercs/video/render.cpp

+ 4
- 4
neercs/video/postfx.lolfx Wyświetl plik

@@ -24,7 +24,7 @@ uniform vec4 moire_h;
uniform vec4 moire_v; uniform vec4 moire_v;
uniform vec4 scanline_h; uniform vec4 scanline_h;
uniform vec4 scanline_v; uniform vec4 scanline_v;
uniform vec2 corner;
uniform vec3 corner;
uniform float sync; uniform float sync;


vec2 screen(in vec2 p,in float radius) vec2 screen(in vec2 p,in float radius)
@@ -38,9 +38,9 @@ vec3 get_color(in sampler2D tex,in vec2 p)
return texture2D(tex,clamp(p,-1.0,0.0)).xyz; return texture2D(tex,clamp(p,-1.0,0.0)).xyz;
} }


float letterbox(in vec2 p,in float radius,in float smooth)
float letterbox(in vec2 p,in float w,in float radius,in float smooth)
{ {
return 1.0-smoothstep(smooth,1.0,length(max(abs(p*2.0+1.0)-vec2(radius),0.0))+radius);
return 1.0-smoothstep(smooth,1.0,length(max(abs(p*w+w/2.0)-vec2(radius),0.0))+radius);
} }


void main(void) void main(void)
@@ -69,6 +69,6 @@ void main(void)
c*=scanline_h.x+scanline_h.y*cos(z.y*float(screen_size.y*scanline_h.z+scanline_h.w)); // scanline h c*=scanline_h.x+scanline_h.y*cos(z.y*float(screen_size.y*scanline_h.z+scanline_h.w)); // scanline h
c*=scanline_v.x+scanline_v.y*cos(z.x*float(screen_size.x*scanline_v.z+scanline_v.w)); // scanline v c*=scanline_v.x+scanline_v.y*cos(z.x*float(screen_size.x*scanline_v.z+scanline_v.w)); // scanline v
c*=(mask-vignetting); // vignetting c*=(mask-vignetting); // vignetting
c*=letterbox(z,corner.x,corner.y); // corner
c*=letterbox(z,corner.x+2.0,corner.y,corner.z); // corner
gl_FragColor=vec4(c,1.0); gl_FragColor=vec4(c,1.0);
} }

+ 8
- 8
neercs/video/render.cpp Wyświetl plik

@@ -108,7 +108,7 @@ vec4 postfx_moire_h(0.75f,-0.25f,0.0f,1.0f); // vertical moire [base,variable
vec4 postfx_moire_v(0.75f,-0.25f,1.0f,1.5f); // horizontal moire [base,variable,repeat x,repeat y] vec4 postfx_moire_v(0.75f,-0.25f,1.0f,1.5f); // horizontal moire [base,variable,repeat x,repeat y]
vec4 postfx_scanline_h(0.75f, 0.25f,0.0f,2.0f); // vertical scanline [base,variable,repeat x,repeat y] vec4 postfx_scanline_h(0.75f, 0.25f,0.0f,2.0f); // vertical scanline [base,variable,repeat x,repeat y]
vec4 postfx_scanline_v(0.75f,-0.25f,2.0f,0.0f); // horizontal scanline [base,variable,repeat x,repeat y] vec4 postfx_scanline_v(0.75f,-0.25f,2.0f,0.0f); // horizontal scanline [base,variable,repeat x,repeat y]
vec2 postfx_corner(0.75f,0.95f); // corner [radius,blur]
vec3 postfx_corner(0.0f,0.75f,0.95f); // corner [width,radius,blur]
/* text variable */ /* text variable */
ivec2 ratio_2d(2,4); // 2d ratio ivec2 ratio_2d(2,4); // 2d ratio
ivec2 map_size(256,256); // texture map size ivec2 map_size(256,256); // texture map size
@@ -173,11 +173,11 @@ char const *setup_text[] = {
"enable", "enable",
"deform ratio", "deform ratio",
"zoom base", "zoom base",
"corner width",
"corner radius", "corner radius",
"corner blur", "corner blur",
"vignetting", "vignetting",
"", "",
"",
"color", "color",
"filter red", "filter red",
"filter green", "filter green",
@@ -229,8 +229,8 @@ vec4 setup_var[]={ // setup variable [start,end,step,value]
vec4(0), /* main */ vec4(0), /* main */
vec4( 1, 8, 1, ratio_2d.x), vec4( 1, 8, 1, ratio_2d.x),
vec4( 1, 8, 1, ratio_2d.y), vec4( 1, 8, 1, ratio_2d.y),
vec4( 0, 64, 1, border.x / ratio_2d.x / font_size.x),
vec4( 0, 64, 1, border.y / ratio_2d.y / font_size.y),
vec4( 0, 16, 1, border.x / ratio_2d.x / font_size.x),
vec4( 0, 16, 1, border.y / ratio_2d.y / font_size.y),
vec4(0), vec4(0),
vec4(0), vec4(0),
vec4(0), vec4(0),
@@ -266,11 +266,11 @@ vec4 setup_var[]={ // setup variable [start,end,step,value]
vec4( 0, 1, 1, 1), vec4( 0, 1, 1, 1),
vec4( 0.0f, 1.0f, 0.05f, postfx_deform.x), vec4( 0.0f, 1.0f, 0.05f, postfx_deform.x),
vec4( 0.5f, 0.7f, 0.01f, postfx_deform.y), vec4( 0.5f, 0.7f, 0.01f, postfx_deform.y),
vec4( 0.0f, 1.0f, 0.05f, postfx_corner.x),
vec4( 0.0f, 4.0f, 0.10f, postfx_corner.x),
vec4( 0.0f, 1.0f, 0.05f, postfx_corner.y), vec4( 0.0f, 1.0f, 0.05f, postfx_corner.y),
vec4( 0.0f, 1.0f, 0.05f, postfx_corner.z),
vec4(-1.0f, 1.0f, 0.10f, postfx_vignetting), vec4(-1.0f, 1.0f, 0.10f, postfx_vignetting),
vec4(0), vec4(0),
vec4(0),
vec4(0), /* color */ vec4(0), /* color */
vec4(0.0f, 1.0f, 0.05f, color_filter.x), vec4(0.0f, 1.0f, 0.05f, color_filter.x),
vec4(0.0f, 1.0f, 0.05f, color_filter.y), vec4(0.0f, 1.0f, 0.05f, color_filter.y),
@@ -339,9 +339,9 @@ void Render::UpdateVar()
k += 6; /* screen */ k += 6; /* screen */
m_shader_postfx = (setup_var[k].w == 1) ? true : false; k++; m_shader_postfx = (setup_var[k].w == 1) ? true : false; k++;
postfx_deform = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2; postfx_deform = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
postfx_corner = vec2(setup_var[k].w, setup_var[k + 1].w); k += 2;
postfx_corner = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3;
postfx_vignetting = setup_var[k].w; k++; postfx_vignetting = setup_var[k].w; k++;
k += 3; /* color */
k += 2; /* color */
color_filter = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3; color_filter = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3;
color_color = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3; color_color = vec3(setup_var[k].w, setup_var[k + 1].w, setup_var[k + 2].w); k += 3;
postfx_aberration = setup_var[k].w; k++; postfx_aberration = setup_var[k].w; k++;


Ładowanie…
Anuluj
Zapisz