Changeset 1636


Ignore:
Timestamp:
Jul 17, 2012, 2:29:38 AM (8 years ago)
Author:
rez
Message:

glsl letterbox and round corner & some new fancy animation!

Location:
trunk/tools/neercs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/neercs/neercs.cpp

    r1634 r1636  
    8787        float b = m_time * -2 + M_PI / 180 * i * 5;
    8888        int y = h / 2 + h / 4 * lol::cos(a) + h / 4 * lol::sin(b);
     89        caca_set_color_argb(m_caca, hex_color(0.25f + 0.5f / w * i - 0.25f / h * y, 0.25f, 0.25f + 0.25f / w * i + 0.25f / h * y), bg_color);
    8990        caca_draw_line(m_caca, i, y - 1, i, y + 1,'%');
    9091    }
     
    100101    int logo_y = h / 2 - 2;
    101102
    102     caca_set_color_argb(m_caca, hex_color(0.5f + 0.375f * lol::cos(m_time * 3               ),0.5f,0.5f + 0.25f * lol::sin(m_time * 3               )), bg_color);
     103    caca_set_color_argb(m_caca, hex_color(0.5f + 0.5f * lol::cos(m_time * 3               ), 0.5f, 0.5f + 0.25f * lol::sin(m_time * 3               )), bg_color);
    103104    caca_put_str(m_caca, logo_x, logo_y    ,".___  __ ______ ______ ______  ______ ______,");
    104     caca_set_color_argb(m_caca, hex_color(0.5f + 0.375f * lol::cos(m_time * 3 + M_PI / 4 * 1),0.5f,0.5f + 0.25f * lol::sin(m_time * 3 + M_PI / 4 * 1)), bg_color);
     105    caca_set_color_argb(m_caca, hex_color(0.5f + 0.5f * lol::cos(m_time * 3 + M_PI / 4 * 1), 0.5f, 0.5f + 0.25f * lol::sin(m_time * 3 + M_PI / 4 * 1)), bg_color);
    105106    caca_put_str(m_caca, logo_x, logo_y + 1, " \\° \\|  /° __  \\° __  \\° __  \\/° ___//° ___/");
    106     caca_set_color_argb(m_caca, hex_color(0.5f + 0.375f * lol::cos(m_time * 3 + M_PI / 4 * 2),0.5f,0.5f + 0.25f * lol::sin(m_time * 3 + M_PI / 4 * 2)), bg_color);
     107    caca_set_color_argb(m_caca, hex_color(0.5f + 0.5f * lol::cos(m_time * 3 + M_PI / 4 * 2), 0.5f, 0.5f + 0.25f * lol::sin(m_time * 3 + M_PI / 4 * 2)), bg_color);
    107108    caca_put_str(m_caca, logo_x, logo_y + 2, " /   `  >  ____/  ____/  ,_  <_ <____\\___  \\");
    108     caca_set_color_argb(m_caca, hex_color(0.5f + 0.375f * lol::cos(m_time * 3 + M_PI / 4 * 3),0.5f,0.5f + 0.25f * lol::sin(m_time * 3 + M_PI / 4 * 3)), bg_color);
     109    caca_set_color_argb(m_caca, hex_color(0.5f + 0.5f * lol::cos(m_time * 3 + M_PI / 4 * 3), 0.5f, 0.5f + 0.25f * lol::sin(m_time * 3 + M_PI / 4 * 3)), bg_color);
    109110    caca_put_str(m_caca, logo_x, logo_y + 3, "/__/\\___\\______\\______\\__| \\__/_____________\\");
    110111    caca_set_color_argb(m_caca, 0xdef, bg_color);
     
    112113
    113114    caca_set_color_argb(m_caca, 0x666, bg_color);
    114     caca_put_str(m_caca, w - 10, h - 1, "CACA RULEZ");
    115     caca_printf(m_caca, 0, h - 2, "W=%i", w);
    116     caca_printf(m_caca, 0, h - 1, "H=%i", h);
     115    caca_printf(m_caca, 2, h - 3, "W=%i", w);
     116    caca_printf(m_caca, 2, h - 2, "H=%i", h);
     117
     118    caca_set_color_argb(m_caca, hex_color(0.6f + 0.4f * lol::cos(m_time * 2), 0.125f, 0.125f), bg_color);
     119    caca_put_str(m_caca, w - 12, h - 2, "CACA RULEZ");
    117120}
    118121
  • trunk/tools/neercs/video/postfx.lolfx

    r1634 r1636  
    2828        {
    2929        float zoom=1.5-(radius*cos(p.x*lens)+radius*cos(p.y*lens));
    30         return vec2(p.x*zoom-0.5,p.y*zoom-0.5);
     30        return p*zoom-0.5;
    3131        }
    3232
     
    3838float rand(in vec2 p)
    3939        {
    40         return fract(sin(dot(p.xy,vec2(12.9898,78.233)))*43758.5453);
     40        return fract(sin(dot(p,vec2(12.9898,78.233)))*43758.5453);
    4141        }
    4242
     
    8383                color-=0.0125*mod(z.y*4.0+time*0.25,1.0);                                       // electron beam
    8484                color-=(vec3(rnd1,rnd1,rnd1)-vec3(rnd2,rnd2,rnd2))*0.1;         // noise
    85                 color*=0.75+0.25*sin(z.x*float(screen_size.x*2));                       // scanline w
    86                 color*=0.90+0.10*cos(z.y*float(screen_size.y))*sin(0.5+z.x*float(screen_size.x));       // scanline h
     85                color*=0.75+0.25*cos(z.x*float(screen_size.x*2))*sin(0.5+z.y*float(screen_size.y));     // scanline w
     86                color*=0.75+0.50*sin(z.y*float(screen_size.y*2));                       // scanline h
    8787                }
    8888        else
     
    9090                color*=0.675;
    9191                }
    92         color=vec3(color.x*0.875,color.y*1.25,color.z*0.5);
     92        color=vec3(color.x*0.75,color.y*1.0,color.z*0.5);
    9393        color*=q.x*(6.0-q.x*6.0)*q.y*(6.0-q.y*6.0);                                             // vignetting
    9494        //color*=2.0*letterbox(z,-0.75,0.125)*2.0;                                              // vignetting
    95         color*=letterbox(z,-0.75,0.975);                                                                // letterbox
     95        color*=letterbox(z,-0.75,0.95);                                                                 // letterbox
    9696        gl_FragColor=vec4(color,1.0);
    9797        }
  • trunk/tools/neercs/video/render.cpp

    r1635 r1636  
    8484ivec2 border;              // border width
    8585/* text variable */
    86 ivec2 ratio_2d(2,4);       // 2d ratio
     86ivec2 ratio_2d(1,3);       // 2d ratio
    8787ivec2 map_size(256,256);   // texture map size
    8888ivec2 font_size(8,8);      // font size
     
    100100float radial_color = 0;       // color
    101101bool postfx_scanline = true;
    102 float postfx_deform = 0.625f; // deformation ratio
     102float postfx_deform = 0.825f; // deformation ratio
    103103
    104104Shader *shader_simple, *shader_blur_h, *shader_blur_v;
     
    230230{
    231231    screen_size = Video::GetSize();
    232     border = 18 * ratio_2d;
     232    border = 24 * ratio_2d;
    233233    border.y = border.x; // enabled to get same border everywhere
    234234    canvas_char = (screen_size - border * 2) / (font_size * ratio_2d);
     
    248248    m_pause(false),
    249249    m_polygon(true),
    250     m_shader(false),
     250    m_shader(true),
    251251    m_shader_blur(true),
    252252    m_shader_glow(true),
     
    443443        shader_blur_h->SetUniform(shader_blur_h_screen_size, vec2(1.0f / glow_fbo_size));
    444444        shader_blur_h->SetUniform(shader_blur_h_time, fx_angle);
    445         shader_blur_h->SetUniform(shader_blur_h_value, 2.5f/screen_size.x);
     445        shader_blur_h->SetUniform(shader_blur_h_value, 2.25f / screen_size.x);
    446446        fs_quad();
    447447        shader_blur_h->Unbind();
     
    453453        shader_blur_v->SetUniform(shader_blur_v_screen_size, vec2(1.0f / glow_fbo_size));
    454454        shader_blur_v->SetUniform(shader_blur_v_time, fx_angle);
    455         shader_blur_v->SetUniform(shader_blur_h_value, 2.5f/screen_size.y);
     455        shader_blur_v->SetUniform(shader_blur_h_value, 2.25f / screen_size.y);
    456456        fs_quad();
    457457        shader_blur_v->Unbind();
     
    463463        shader_blur_h->SetUniform(shader_blur_h_screen_size, vec2(1.0f / glow_fbo_size));
    464464        shader_blur_h->SetUniform(shader_blur_h_time, fx_angle);
    465         shader_blur_h->SetUniform(shader_blur_h_value, 1.0f/screen_size.x);
     465        shader_blur_h->SetUniform(shader_blur_h_value, 1.0f / screen_size.x);
    466466        fs_quad();
    467467        shader_blur_h->Unbind();
     
    473473        shader_blur_v->SetUniform(shader_blur_v_screen_size, vec2(1.0f / glow_fbo_size));
    474474        shader_blur_v->SetUniform(shader_blur_v_time, fx_angle);
    475         shader_blur_v->SetUniform(shader_blur_h_value, 1.0f/screen_size.y);
     475        shader_blur_v->SetUniform(shader_blur_h_value, 1.0f / screen_size.y);
    476476        fs_quad();
    477477        shader_blur_v->Unbind();
Note: See TracChangeset for help on using the changeset viewer.